@pie-element/complex-rubric 5.3.4-next.3 → 6.0.0-beta.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/lib/defaults.js +52 -24
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/index.js +103 -194
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/main.js +140 -199
- package/configure/lib/main.js.map +1 -1
- package/configure/node_modules/@pie-element/multi-trait-rubric/CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/CHANGELOG.md +2491 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/README.md +55 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/CHANGELOG.md +2333 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/common.js +429 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/common.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/defaults.js +181 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/defaults.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/index.js +157 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/main.js +455 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/main.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/modals.js +206 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/modals.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/scale.js +451 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/scale.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/trait.js +275 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/trait.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/traitsHeader.js +233 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/traitsHeader.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/utils.js +87 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/utils.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/configure/package.json +24 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/CHANGELOG.md +1571 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/defaults.js +18 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/defaults.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/index.js +158 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/utils.js +11 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/utils.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/controller/package.json +14 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/config-schema.json +1628 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/config-schema.json.md +1202 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/config.js +8 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/generate.js +117 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/index.html +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/session.js +6 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/pie-schema.json +861 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/docs/pie-schema.json.md +614 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/index.js +54 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/main.js +123 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/main.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/scale.js +248 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/scale.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/trait.js +83 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/lib/trait.js.map +1 -0
- package/configure/node_modules/@pie-element/multi-trait-rubric/package.json +32 -0
- package/configure/node_modules/@pie-element/rubric/CHANGELOG.json +257 -0
- package/configure/node_modules/@pie-element/rubric/CHANGELOG.md +2774 -0
- package/configure/node_modules/@pie-element/rubric/README.md +3 -0
- package/configure/node_modules/@pie-element/rubric/configure/CHANGELOG.json +197 -0
- package/configure/node_modules/@pie-element/rubric/configure/CHANGELOG.md +2541 -0
- package/configure/node_modules/@pie-element/rubric/configure/lib/defaults.js +67 -0
- package/configure/node_modules/@pie-element/rubric/configure/lib/defaults.js.map +1 -0
- package/configure/node_modules/@pie-element/rubric/configure/lib/index.js +135 -0
- package/configure/node_modules/@pie-element/rubric/configure/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/rubric/configure/lib/main.js +103 -0
- package/configure/node_modules/@pie-element/rubric/configure/lib/main.js.map +1 -0
- package/configure/node_modules/@pie-element/rubric/configure/package.json +24 -0
- package/configure/node_modules/@pie-element/rubric/configure/src/__tests__/index.test.jsx +178 -0
- package/configure/node_modules/@pie-element/rubric/configure/src/defaults.js +42 -0
- package/configure/node_modules/@pie-element/rubric/configure/src/index.js +139 -0
- package/configure/node_modules/@pie-element/rubric/configure/src/main.jsx +87 -0
- package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.json +17 -0
- package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.md +1564 -0
- package/configure/node_modules/@pie-element/rubric/controller/lib/defaults.js +15 -0
- package/configure/node_modules/@pie-element/rubric/controller/lib/defaults.js.map +1 -0
- package/configure/node_modules/@pie-element/rubric/controller/lib/index.js +46 -0
- package/configure/node_modules/@pie-element/rubric/controller/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/rubric/controller/package.json +12 -0
- package/configure/node_modules/@pie-element/rubric/controller/src/__tests__/index.test.js +33 -0
- package/configure/node_modules/@pie-element/rubric/controller/src/defaults.js +8 -0
- package/configure/node_modules/@pie-element/rubric/controller/src/index.js +41 -0
- package/configure/node_modules/@pie-element/rubric/docs/config-schema.json +712 -0
- package/configure/node_modules/@pie-element/rubric/docs/config-schema.json.md +532 -0
- package/configure/node_modules/@pie-element/rubric/docs/demo/config.js +8 -0
- package/configure/node_modules/@pie-element/rubric/docs/demo/generate.js +8 -0
- package/configure/node_modules/@pie-element/rubric/docs/demo/index.html +2 -0
- package/configure/node_modules/@pie-element/rubric/docs/pie-schema.json +391 -0
- package/configure/node_modules/@pie-element/rubric/docs/pie-schema.json.md +281 -0
- package/configure/node_modules/@pie-element/rubric/lib/index.js +52 -0
- package/configure/node_modules/@pie-element/rubric/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/rubric/lib/main.js +210 -0
- package/configure/node_modules/@pie-element/rubric/lib/main.js.map +1 -0
- package/configure/node_modules/@pie-element/rubric/lib/print.js +71 -0
- package/configure/node_modules/@pie-element/rubric/lib/print.js.map +1 -0
- package/configure/node_modules/@pie-element/rubric/package.json +30 -0
- package/configure/node_modules/@pie-element/rubric/src/__tests__/__snapshots__/rubric-view.test.jsx.snap +2641 -0
- package/configure/node_modules/@pie-element/rubric/src/__tests__/rubric-view.test.jsx +49 -0
- package/configure/node_modules/@pie-element/rubric/src/index.js +48 -0
- package/configure/node_modules/@pie-element/rubric/src/main.jsx +226 -0
- package/configure/node_modules/@pie-element/rubric/src/print.js +74 -0
- package/configure/node_modules/clsx/clsx.d.ts +6 -0
- package/configure/node_modules/clsx/dist/clsx.js +1 -0
- package/configure/node_modules/clsx/dist/clsx.m.js +1 -0
- package/configure/node_modules/clsx/dist/clsx.min.js +1 -0
- package/configure/node_modules/clsx/license +9 -0
- package/configure/node_modules/clsx/package.json +37 -0
- package/configure/node_modules/clsx/readme.md +88 -0
- package/configure/package.json +12 -9
- package/configure/src/__tests__/index.test.js +30 -5
- package/configure/src/__tests__/main.test.jsx +39 -23
- package/configure/src/index.js +13 -6
- package/configure/src/main.jsx +16 -15
- package/controller/lib/defaults.js +11 -15
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +117 -180
- package/controller/lib/index.js.map +1 -1
- package/controller/lib/utils.js +1 -3
- package/controller/lib/utils.js.map +1 -1
- package/controller/package.json +1 -1
- package/lib/index.js +113 -204
- package/lib/index.js.map +1 -1
- package/lib/print.js +96 -190
- package/lib/print.js.map +1 -1
- package/package.json +10 -14
- package/src/__tests__/index.test.js +25 -7
- package/configure/src/__tests__/__snapshots__/main.test.jsx.snap +0 -193
- package/esm/configure.js +0 -15856
- package/esm/configure.js.map +0 -1
- package/esm/controller.js +0 -281
- package/esm/controller.js.map +0 -1
- package/esm/element.js +0 -179
- package/esm/element.js.map +0 -1
- package/esm/package.json +0 -3
- package/esm/print.js +0 -163
- package/esm/print.js.map +0 -1
- package/module/configure.js +0 -1
- package/module/controller.js +0 -262
- package/module/demo.js +0 -221
- package/module/element.js +0 -1
- package/module/index.html +0 -21
- package/module/manifest.json +0 -22
- package/module/print-demo.js +0 -259
- package/module/print.html +0 -18
- package/module/print.js +0 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _default = exports.default = {
|
|
8
|
+
points: ['', '', '', ''],
|
|
9
|
+
sampleAnswers: [null, null, null, null],
|
|
10
|
+
maxPoints: 3,
|
|
11
|
+
maxPointsEnabled: true,
|
|
12
|
+
excludeZero: false,
|
|
13
|
+
excludeZeroEnabled: true
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.js","names":["points","sampleAnswers","maxPoints","maxPointsEnabled","excludeZero","excludeZeroEnabled"],"sources":["../src/defaults.js"],"sourcesContent":["export default {\n points: ['', '', '', ''],\n sampleAnswers: [null, null, null, null],\n maxPoints: 3,\n maxPointsEnabled: true,\n excludeZero: false,\n excludeZeroEnabled: true,\n};\n"],"mappings":";;;;;;iCAAe;EACbA,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;EACxBC,aAAa,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;EACvCC,SAAS,EAAE,CAAC;EACZC,gBAAgB,EAAE,IAAI;EACtBC,WAAW,EAAE,KAAK;EAClBC,kBAAkB,EAAE;AACtB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.model = model;
|
|
8
|
+
exports.validate = validate;
|
|
9
|
+
var _defaults = _interopRequireDefault(require("./defaults"));
|
|
10
|
+
const normalize = model => ({
|
|
11
|
+
..._defaults.default,
|
|
12
|
+
...model
|
|
13
|
+
});
|
|
14
|
+
function model(model, session, env) {
|
|
15
|
+
return new Promise(resolve => {
|
|
16
|
+
const modelResult = normalize(model || {});
|
|
17
|
+
resolve(env && env.role && env.role === 'instructor' ? modelResult : {});
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function markupToText(s) {
|
|
21
|
+
return (s || '').replace(/(<([^>]+)>)/gi, '');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// IMPORTANT! If you make any changes to this function, please make sure you also update complex-rubric/controller/validateSimpleRubric function!“.
|
|
25
|
+
function validate(model) {
|
|
26
|
+
const {
|
|
27
|
+
points
|
|
28
|
+
} = model;
|
|
29
|
+
const errors = {};
|
|
30
|
+
const pointsDescriptorsErrors = {};
|
|
31
|
+
(points || []).forEach((point, index) => {
|
|
32
|
+
if (!point || point === '<div></div>') {
|
|
33
|
+
pointsDescriptorsErrors[index] = 'Points descriptors cannot be empty.';
|
|
34
|
+
} else {
|
|
35
|
+
const identicalPointDescr = points.slice(index + 1).some(p => markupToText(p) === markupToText(point));
|
|
36
|
+
if (identicalPointDescr) {
|
|
37
|
+
pointsDescriptorsErrors[index] = 'Points descriptors should be unique.';
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
if (Object.keys(pointsDescriptorsErrors).length > 0) {
|
|
42
|
+
errors.pointsDescriptorsErrors = pointsDescriptorsErrors;
|
|
43
|
+
}
|
|
44
|
+
return errors;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_defaults","_interopRequireDefault","require","normalize","model","defaults","session","env","Promise","resolve","modelResult","role","markupToText","s","replace","validate","points","errors","pointsDescriptorsErrors","forEach","point","index","identicalPointDescr","slice","some","p","Object","keys","length"],"sources":["../src/index.js"],"sourcesContent":["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"],"mappings":";;;;;;;;AAAA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,MAAMC,SAAS,GAAIC,KAAK,KAAM;EAAE,GAAGC,iBAAQ;EAAE,GAAGD;AAAM,CAAC,CAAC;AAEjD,SAASA,KAAKA,CAACA,KAAK,EAAEE,OAAO,EAAEC,GAAG,EAAE;EACzC,OAAO,IAAIC,OAAO,CAAEC,OAAO,IAAK;IAC9B,MAAMC,WAAW,GAAGP,SAAS,CAACC,KAAK,IAAI,CAAC,CAAC,CAAC;IAE1CK,OAAO,CAACF,GAAG,IAAIA,GAAG,CAACI,IAAI,IAAIJ,GAAG,CAACI,IAAI,KAAK,YAAY,GAAGD,WAAW,GAAG,CAAC,CAAC,CAAC;EAC1E,CAAC,CAAC;AACJ;AAEA,SAASE,YAAYA,CAACC,CAAC,EAAE;EACvB,OAAO,CAACA,CAAC,IAAI,EAAE,EAAEC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC;AAC/C;;AAEA;AACO,SAASC,QAAQA,CAACX,KAAK,EAAE;EAC9B,MAAM;IAAEY;EAAO,CAAC,GAAGZ,KAAK;EACxB,MAAMa,MAAM,GAAG,CAAC,CAAC;EACjB,MAAMC,uBAAuB,GAAG,CAAC,CAAC;EAElC,CAACF,MAAM,IAAI,EAAE,EAAEG,OAAO,CAAC,CAACC,KAAK,EAAEC,KAAK,KAAK;IAEvC,IAAI,CAACD,KAAK,IAAIA,KAAK,KAAK,aAAa,EAAE;MACrCF,uBAAuB,CAACG,KAAK,CAAC,GAAG,qCAAqC;IACxE,CAAC,MAAM;MACL,MAAMC,mBAAmB,GAAGN,MAAM,CAACO,KAAK,CAACF,KAAK,GAAG,CAAC,CAAC,CAACG,IAAI,CAAEC,CAAC,IAAKb,YAAY,CAACa,CAAC,CAAC,KAAKb,YAAY,CAACQ,KAAK,CAAC,CAAC;MAExG,IAAIE,mBAAmB,EAAE;QACvBJ,uBAAuB,CAACG,KAAK,CAAC,GAAG,sCAAsC;MACzE;IACF;EACF,CAAC,CAAC;EAEF,IAAIK,MAAM,CAACC,IAAI,CAACT,uBAAuB,CAAC,CAACU,MAAM,GAAG,CAAC,EAAE;IACnDX,MAAM,CAACC,uBAAuB,GAAGA,uBAAuB;EAC1D;EAEA,OAAOD,MAAM;AACf","ignoreList":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { model } from '../index';
|
|
2
|
+
|
|
3
|
+
describe('rubric model', () => {
|
|
4
|
+
let state = {
|
|
5
|
+
points: ['nothing right', 'a teeny bit right', 'mostly right', 'bingo'],
|
|
6
|
+
sampleAnswers: [null, 'just right', 'not left', null],
|
|
7
|
+
maxPoints: 4,
|
|
8
|
+
maxPointsEnabled: true,
|
|
9
|
+
excludeZero: false,
|
|
10
|
+
excludeZeroEnabled: true,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
let session = {};
|
|
14
|
+
let env, result;
|
|
15
|
+
|
|
16
|
+
it('returns no model for gather', async () => {
|
|
17
|
+
env = { mode: 'gather' };
|
|
18
|
+
result = await model(state, session, env);
|
|
19
|
+
expect(result).toEqual({});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('returns no model for student role', async () => {
|
|
23
|
+
env = { mode: 'gather', role: 'student' };
|
|
24
|
+
result = await model(state, session, env);
|
|
25
|
+
expect(result).toEqual({});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('returns model for instructor role', async () => {
|
|
29
|
+
env = { mode: 'gather', role: 'instructor' };
|
|
30
|
+
result = await model(state, session, env);
|
|
31
|
+
expect(result).toEqual(state);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import defaults from './defaults';
|
|
2
|
+
|
|
3
|
+
const normalize = (model) => ({ ...defaults, ...model });
|
|
4
|
+
|
|
5
|
+
export function model(model, session, env) {
|
|
6
|
+
return new Promise((resolve) => {
|
|
7
|
+
const modelResult = normalize(model || {});
|
|
8
|
+
|
|
9
|
+
resolve(env && env.role && env.role === 'instructor' ? modelResult : {});
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function markupToText(s) {
|
|
14
|
+
return (s || '').replace(/(<([^>]+)>)/gi, '');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// IMPORTANT! If you make any changes to this function, please make sure you also update complex-rubric/controller/validateSimpleRubric function!“.
|
|
18
|
+
export function validate(model) {
|
|
19
|
+
const { points } = model;
|
|
20
|
+
const errors = {};
|
|
21
|
+
const pointsDescriptorsErrors = {};
|
|
22
|
+
|
|
23
|
+
(points || []).forEach((point, index) => {
|
|
24
|
+
|
|
25
|
+
if (!point || point === '<div></div>') {
|
|
26
|
+
pointsDescriptorsErrors[index] = 'Points descriptors cannot be empty.';
|
|
27
|
+
} else {
|
|
28
|
+
const identicalPointDescr = points.slice(index + 1).some((p) => markupToText(p) === markupToText(point));
|
|
29
|
+
|
|
30
|
+
if (identicalPointDescr) {
|
|
31
|
+
pointsDescriptorsErrors[index] = 'Points descriptors should be unique.';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
if (Object.keys(pointsDescriptorsErrors).length > 0) {
|
|
37
|
+
errors.pointsDescriptorsErrors = pointsDescriptorsErrors;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return errors;
|
|
41
|
+
}
|