@pie-element/complex-rubric 7.1.1 → 7.1.2-next.1
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.js +2 -0
- package/controller.js +1 -0
- package/dist/author/defaults.d.ts +231 -0
- package/dist/author/defaults.js +177 -0
- package/dist/author/index.d.ts +34 -0
- package/dist/author/index.js +87 -0
- package/dist/author/main.d.ts +23 -0
- package/dist/author/main.js +106 -0
- package/dist/browser/author/index.js +7384 -0
- package/dist/browser/author/index.js.map +1 -0
- package/dist/browser/controller/index.js +145 -0
- package/dist/browser/controller/index.js.map +1 -0
- package/dist/browser/delivery/index.js +96 -0
- package/dist/browser/delivery/index.js.map +1 -0
- package/dist/browser/dist-DJUOd5EZ.js +19 -0
- package/dist/browser/dist-DJUOd5EZ.js.map +1 -0
- package/dist/browser/print/index.js +84 -0
- package/dist/browser/print/index.js.map +1 -0
- package/dist/controller/defaults.d.ts +39 -0
- package/dist/controller/defaults.js +42 -0
- package/dist/controller/index.d.ts +25 -0
- package/dist/controller/index.js +107 -0
- package/dist/controller/utils.d.ts +9 -0
- package/dist/controller/utils.js +4 -0
- package/dist/delivery/index.d.ts +23 -0
- package/dist/delivery/index.js +96 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.iife.d.ts +8 -0
- package/dist/index.iife.js +145 -0
- package/dist/index.js +2 -0
- package/dist/print/index.d.ts +24 -0
- package/dist/print/index.js +84 -0
- package/dist/runtime-support.d.ts +12 -0
- package/dist/runtime-support.js +12 -0
- package/package.json +90 -22
- package/CHANGELOG.md +0 -1443
- package/LICENSE.md +0 -5
- package/README.md +0 -3
- package/configure/CHANGELOG.md +0 -1097
- package/configure/lib/defaults.js +0 -271
- package/configure/lib/defaults.js.map +0 -1
- package/configure/lib/index.js +0 -150
- package/configure/lib/index.js.map +0 -1
- package/configure/lib/main.js +0 -172
- package/configure/lib/main.js.map +0 -1
- package/configure/package.json +0 -27
- package/configure/src/__tests__/index.test.js +0 -94
- package/configure/src/__tests__/main.test.jsx +0 -140
- package/configure/src/defaults.js +0 -213
- package/configure/src/index.js +0 -169
- package/configure/src/main.jsx +0 -162
- package/controller/CHANGELOG.md +0 -936
- package/controller/lib/defaults.js +0 -42
- package/controller/lib/defaults.js.map +0 -1
- package/controller/lib/index.js +0 -239
- package/controller/lib/index.js.map +0 -1
- package/controller/lib/utils.js +0 -11
- package/controller/lib/utils.js.map +0 -1
- package/controller/package.json +0 -16
- package/controller/src/__tests__/index.test.js +0 -55
- package/controller/src/defaults.js +0 -39
- package/controller/src/index.js +0 -220
- package/controller/src/utils.js +0 -3
- package/docs/config-schema.json +0 -4255
- package/docs/config-schema.json.md +0 -3162
- package/docs/demo/config.js +0 -8
- package/docs/demo/generate.js +0 -196
- package/docs/demo/index.html +0 -1
- package/docs/demo/session.js +0 -6
- package/docs/pie-schema.json +0 -3302
- package/docs/pie-schema.json.md +0 -2364
- package/lib/index.js +0 -141
- package/lib/index.js.map +0 -1
- package/lib/print.js +0 -129
- package/lib/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
- package/src/__tests__/index.test.js +0 -256
- package/src/index.js +0 -152
- package/src/print.js +0 -140
package/src/index.js
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import Rubric from '@pie-element/rubric';
|
|
2
|
-
import MultiTraitRubric from '@pie-element/multi-trait-rubric';
|
|
3
|
-
import { RUBRIC_TYPES } from '@pie-lib/rubric';
|
|
4
|
-
|
|
5
|
-
const RUBRIC_TAG_NAME = 'complex-rubric-simple';
|
|
6
|
-
const MULTI_TRAIT_RUBRIC_TAG_NAME = 'complex-rubric-multi-trait';
|
|
7
|
-
|
|
8
|
-
class ComplexRubricSimple extends Rubric {}
|
|
9
|
-
|
|
10
|
-
class ComplexRubricMultiTrait extends MultiTraitRubric {}
|
|
11
|
-
|
|
12
|
-
const defineRubrics = () => {
|
|
13
|
-
if (!customElements.get(RUBRIC_TAG_NAME)) {
|
|
14
|
-
customElements.define(RUBRIC_TAG_NAME, ComplexRubricSimple);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
if (!customElements.get(MULTI_TRAIT_RUBRIC_TAG_NAME)) {
|
|
18
|
-
customElements.define(MULTI_TRAIT_RUBRIC_TAG_NAME, ComplexRubricMultiTrait);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
defineRubrics();
|
|
23
|
-
|
|
24
|
-
class ComplexRubric extends HTMLElement {
|
|
25
|
-
constructor() {
|
|
26
|
-
super();
|
|
27
|
-
this._model = {};
|
|
28
|
-
this._type = RUBRIC_TYPES.SIMPLE_RUBRIC;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
set type(t) {
|
|
32
|
-
this._type = t;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
get type() {
|
|
36
|
-
return this._type;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
set model(m) {
|
|
40
|
-
this._model = m;
|
|
41
|
-
const oldType = this._type;
|
|
42
|
-
this.type = m.rubricType;
|
|
43
|
-
|
|
44
|
-
switch (this._type) {
|
|
45
|
-
case RUBRIC_TYPES.SIMPLE_RUBRIC:
|
|
46
|
-
default:
|
|
47
|
-
customElements.whenDefined(RUBRIC_TAG_NAME).then(() => {
|
|
48
|
-
this.setRubricModel(this.simpleRubric);
|
|
49
|
-
});
|
|
50
|
-
break;
|
|
51
|
-
case RUBRIC_TYPES.MULTI_TRAIT_RUBRIC:
|
|
52
|
-
customElements.whenDefined(MULTI_TRAIT_RUBRIC_TAG_NAME).then(() => {
|
|
53
|
-
this.setMultiTraitRubricModel(this.multiTraitRubric);
|
|
54
|
-
});
|
|
55
|
-
break;
|
|
56
|
-
case RUBRIC_TYPES.RUBRICLESS:
|
|
57
|
-
customElements.whenDefined(RUBRIC_TAG_NAME).then(() => {
|
|
58
|
-
this.setRubriclessModel(this.rubricless);
|
|
59
|
-
});
|
|
60
|
-
break;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (oldType !== this.type) {
|
|
64
|
-
this._render();
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
setRubricModel(simpleRubric) {
|
|
69
|
-
if (this._model && this._model.rubrics && this._model.rubrics.simpleRubric) {
|
|
70
|
-
const { mode } = this._model;
|
|
71
|
-
|
|
72
|
-
simpleRubric.model = {
|
|
73
|
-
...this._model.rubrics.simpleRubric,
|
|
74
|
-
mode,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
setMultiTraitRubricModel(multiTraitRubric) {
|
|
80
|
-
if (this._model && this._model.rubrics && this._model.rubrics.multiTraitRubric) {
|
|
81
|
-
const { mode } = this._model;
|
|
82
|
-
|
|
83
|
-
multiTraitRubric.model = {
|
|
84
|
-
...this._model.rubrics.multiTraitRubric,
|
|
85
|
-
mode,
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
setRubriclessModel(rubricless) {
|
|
91
|
-
if (this._model && this._model.rubrics && this._model.rubrics.rubricless) {
|
|
92
|
-
const { mode } = this._model;
|
|
93
|
-
|
|
94
|
-
rubricless.model = {
|
|
95
|
-
...this._model.rubrics.rubricless,
|
|
96
|
-
mode,
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
get multiTraitRubric() {
|
|
102
|
-
return this.querySelector(`${MULTI_TRAIT_RUBRIC_TAG_NAME}#multiTraitRubric`);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
get simpleRubric() {
|
|
106
|
-
return this.querySelector(`${RUBRIC_TAG_NAME}#simpleRubric`);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
get rubricless() {
|
|
110
|
-
return this.querySelector(`${RUBRIC_TAG_NAME}#rubricless`);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
connectedCallback() {
|
|
114
|
-
this._render();
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
_render() {
|
|
118
|
-
let rubricTag;
|
|
119
|
-
if (this._type === RUBRIC_TYPES.SIMPLE_RUBRIC) {
|
|
120
|
-
rubricTag = `<${RUBRIC_TAG_NAME} id="simpleRubric" />`;
|
|
121
|
-
} else if (this._type === RUBRIC_TYPES.RUBRICLESS) {
|
|
122
|
-
rubricTag = `<${RUBRIC_TAG_NAME} id="rubricless" />`;
|
|
123
|
-
} else {
|
|
124
|
-
rubricTag = `<${MULTI_TRAIT_RUBRIC_TAG_NAME} id="multiTraitRubric" />`;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
this.innerHTML = rubricTag;
|
|
128
|
-
|
|
129
|
-
// when item is re-rendered (due to connectedCallback), if the custom element is already defined,
|
|
130
|
-
// we need to set the model and session, otherwise the setters are not reached again
|
|
131
|
-
switch (this._type) {
|
|
132
|
-
case RUBRIC_TYPES.SIMPLE_RUBRIC:
|
|
133
|
-
default:
|
|
134
|
-
if (customElements.get(RUBRIC_TAG_NAME)) {
|
|
135
|
-
this.setRubricModel(this.simpleRubric);
|
|
136
|
-
}
|
|
137
|
-
break;
|
|
138
|
-
case RUBRIC_TYPES.MULTI_TRAIT_RUBRIC:
|
|
139
|
-
if (customElements.get(MULTI_TRAIT_RUBRIC_TAG_NAME)) {
|
|
140
|
-
this.setMultiTraitRubricModel(this.multiTraitRubric);
|
|
141
|
-
}
|
|
142
|
-
break;
|
|
143
|
-
case RUBRIC_TYPES.RUBRICLESS:
|
|
144
|
-
if (customElements.get(RUBRIC_TAG_NAME)) {
|
|
145
|
-
this.setRubriclessModel(this.rubricless);
|
|
146
|
-
}
|
|
147
|
-
break;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export default ComplexRubric;
|
package/src/print.js
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
// here it is actually using rubric/src/index.js, instead of using rubric/src/print.js
|
|
2
|
-
import Rubric from '@pie-element/rubric';
|
|
3
|
-
// here it is actually using multi-trait-rubric/src/index.js, instead of using multi-trait-rubric/src/print.js
|
|
4
|
-
import MultiTraitRubric from '@pie-element/multi-trait-rubric';
|
|
5
|
-
import { RUBRIC_TYPES } from '@pie-lib/rubric';
|
|
6
|
-
|
|
7
|
-
const RUBRIC_TAG_NAME = 'complex-rubric-simple';
|
|
8
|
-
const MULTI_TRAIT_RUBRIC_TAG_NAME = 'complex-rubric-multi-trait';
|
|
9
|
-
|
|
10
|
-
class ComplexRubricSimple extends Rubric {}
|
|
11
|
-
class ComplexRubricMultiTrait extends MultiTraitRubric {}
|
|
12
|
-
|
|
13
|
-
const rubricTags = {
|
|
14
|
-
[RUBRIC_TYPES.SIMPLE_RUBRIC]: `<${RUBRIC_TAG_NAME} id="simpleRubric" />`,
|
|
15
|
-
[RUBRIC_TYPES.RUBRICLESS]: `<${RUBRIC_TAG_NAME} id="rubricless" />`,
|
|
16
|
-
[RUBRIC_TYPES.MULTI_TRAIT_RUBRIC]: `<${MULTI_TRAIT_RUBRIC_TAG_NAME} id="multiTraitRubric" />`,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const preparePrintModel = (model, opts) => {
|
|
20
|
-
const instr = opts.role === 'instructor';
|
|
21
|
-
|
|
22
|
-
if (!instr) {
|
|
23
|
-
return {};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
model.mode = 'evaluate';
|
|
27
|
-
model.animationsDisabled = true;
|
|
28
|
-
|
|
29
|
-
return model;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const defineRubrics = () => {
|
|
33
|
-
if (!customElements.get(RUBRIC_TAG_NAME)) {
|
|
34
|
-
customElements.define(RUBRIC_TAG_NAME, ComplexRubricSimple);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (!customElements.get(MULTI_TRAIT_RUBRIC_TAG_NAME)) {
|
|
38
|
-
customElements.define(MULTI_TRAIT_RUBRIC_TAG_NAME, ComplexRubricMultiTrait);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
defineRubrics();
|
|
43
|
-
|
|
44
|
-
class ComplexRubricPrint extends HTMLElement {
|
|
45
|
-
constructor() {
|
|
46
|
-
super();
|
|
47
|
-
this._model = {};
|
|
48
|
-
this._type = RUBRIC_TYPES.SIMPLE_RUBRIC;
|
|
49
|
-
this._options = null;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
set type(t) {
|
|
53
|
-
this._type = t;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
get type() {
|
|
57
|
-
return this._type;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
set model(m) {
|
|
61
|
-
this._model = m;
|
|
62
|
-
const oldType = this._type;
|
|
63
|
-
this.type = m.rubricType;
|
|
64
|
-
|
|
65
|
-
switch (this._type) {
|
|
66
|
-
case RUBRIC_TYPES.SIMPLE_RUBRIC:
|
|
67
|
-
default:
|
|
68
|
-
customElements.whenDefined(RUBRIC_TAG_NAME).then(() => {
|
|
69
|
-
this.setRubricModel(this.simpleRubric);
|
|
70
|
-
});
|
|
71
|
-
break;
|
|
72
|
-
case RUBRIC_TYPES.MULTI_TRAIT_RUBRIC:
|
|
73
|
-
customElements.whenDefined(MULTI_TRAIT_RUBRIC_TAG_NAME).then(() => {
|
|
74
|
-
this.setMultiTraitRubricModel(this.multiTraitRubric);
|
|
75
|
-
});
|
|
76
|
-
break;
|
|
77
|
-
case RUBRIC_TYPES.RUBRICLESS:
|
|
78
|
-
customElements.whenDefined(RUBRIC_TAG_NAME).then(() => {
|
|
79
|
-
this.setRubriclessModel(this.rubricless);
|
|
80
|
-
});
|
|
81
|
-
break;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
if (oldType !== this.type) {
|
|
85
|
-
this._render();
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
setRubricModel(simpleRubric) {
|
|
90
|
-
if (this._model && this._model.rubrics && this._model.rubrics.simpleRubric) {
|
|
91
|
-
simpleRubric.model = preparePrintModel(this._model.rubrics.simpleRubric, this._options);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
setMultiTraitRubricModel(multiTraitRubric) {
|
|
96
|
-
if (this._model && this._model.rubrics && this._model.rubrics.multiTraitRubric) {
|
|
97
|
-
const { scales, excludeZero } = this._model.rubrics.multiTraitRubric || {};
|
|
98
|
-
const parsedScales = (scales || []).map((scale) => ({ ...scale, excludeZero }));
|
|
99
|
-
|
|
100
|
-
multiTraitRubric.model = {
|
|
101
|
-
...preparePrintModel(this._model.rubrics.multiTraitRubric, this._options),
|
|
102
|
-
visible: true,
|
|
103
|
-
arrowsDisabled: true,
|
|
104
|
-
scales: parsedScales,
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
setRubriclessModel(rubricless) {
|
|
110
|
-
if (this._model && this._model.rubrics && this._model.rubrics.rubricless) {
|
|
111
|
-
rubricless.model = preparePrintModel(this._model.rubrics.rubricless, this._options);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
set options(o) {
|
|
116
|
-
this._options = o;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
get multiTraitRubric() {
|
|
120
|
-
return this.querySelector(`${MULTI_TRAIT_RUBRIC_TAG_NAME}#multiTraitRubric`);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
get simpleRubric() {
|
|
124
|
-
return this.querySelector(`${RUBRIC_TAG_NAME}#simpleRubric`);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
get rubricless() {
|
|
128
|
-
return this.querySelector(`${RUBRIC_TAG_NAME}#rubricless`);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
connectedCallback() {
|
|
132
|
-
this._render();
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
_render() {
|
|
136
|
-
this.innerHTML = rubricTags[this._type] || '';
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
export default ComplexRubricPrint;
|