@pie-element/rubric 8.1.2-next.2 → 8.1.2
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.json +257 -0
- package/CHANGELOG.md +1725 -0
- package/LICENSE.md +5 -0
- package/README.md +3 -0
- package/configure/CHANGELOG.json +197 -0
- package/configure/CHANGELOG.md +1565 -0
- package/configure/lib/defaults.js +70 -0
- package/configure/lib/defaults.js.map +1 -0
- package/configure/lib/index.js +135 -0
- package/configure/lib/index.js.map +1 -0
- package/configure/lib/main.js +103 -0
- package/configure/lib/main.js.map +1 -0
- package/configure/package.json +23 -0
- package/configure/src/__tests__/index.test.jsx +192 -0
- package/configure/src/defaults.js +43 -0
- package/configure/src/index.js +139 -0
- package/configure/src/main.jsx +87 -0
- package/controller/CHANGELOG.json +17 -0
- package/controller/CHANGELOG.md +901 -0
- package/controller/lib/defaults.js +15 -0
- package/controller/lib/defaults.js.map +1 -0
- package/controller/lib/index.js +46 -0
- package/controller/lib/index.js.map +1 -0
- package/controller/package.json +12 -0
- package/controller/src/__tests__/index.test.js +33 -0
- package/controller/src/defaults.js +8 -0
- package/controller/src/index.js +41 -0
- package/docs/config-schema.json +712 -0
- package/docs/config-schema.json.md +532 -0
- package/docs/demo/config.js +8 -0
- package/docs/demo/generate.js +8 -0
- package/docs/demo/index.html +2 -0
- package/docs/pie-schema.json +391 -0
- package/docs/pie-schema.json.md +281 -0
- package/lib/index.js +52 -0
- package/lib/index.js.map +1 -0
- package/lib/main.js +208 -0
- package/lib/main.js.map +1 -0
- package/lib/print.js +71 -0
- package/lib/print.js.map +1 -0
- package/module/configure.js +1 -0
- package/module/controller.js +73 -0
- package/module/demo.js +33 -0
- package/module/element.js +1 -0
- package/module/index.html +21 -0
- package/module/manifest.json +14 -0
- package/module/print-demo.js +71 -0
- package/module/print.html +18 -0
- package/module/print.js +1 -0
- package/package.json +25 -87
- package/src/__tests__/rubric-view.test.jsx +37 -0
- package/src/index.js +48 -0
- package/src/main.jsx +226 -0
- package/src/print.js +74 -0
- package/configure.js +0 -2
- package/controller.js +0 -1
- package/dist/author/defaults.d.ts +0 -71
- package/dist/author/defaults.js +0 -53
- package/dist/author/index.d.ts +0 -21
- package/dist/author/index.js +0 -72
- package/dist/author/main.d.ts +0 -14
- package/dist/author/main.js +0 -51
- package/dist/browser/author/index.js +0 -44381
- package/dist/browser/author/index.js.map +0 -1
- package/dist/browser/controller/index.js +0 -41
- package/dist/browser/controller/index.js.map +0 -1
- package/dist/browser/delivery/index.js +0 -34
- package/dist/browser/delivery/index.js.map +0 -1
- package/dist/browser/dist-D-HDsar4.js +0 -9091
- package/dist/browser/dist-D-HDsar4.js.map +0 -1
- package/dist/browser/dist-DnnL1HSL.js +0 -98
- package/dist/browser/dist-DnnL1HSL.js.map +0 -1
- package/dist/browser/main-Fk9pdppe.js +0 -153
- package/dist/browser/main-Fk9pdppe.js.map +0 -1
- package/dist/browser/print/index.js +0 -34
- package/dist/browser/print/index.js.map +0 -1
- package/dist/browser/rubric.css +0 -2
- package/dist/controller/defaults.d.ts +0 -17
- package/dist/controller/defaults.js +0 -21
- package/dist/controller/index.d.ts +0 -10
- package/dist/controller/index.js +0 -23
- package/dist/delivery/index.d.ts +0 -16
- package/dist/delivery/index.js +0 -33
- package/dist/delivery/main.d.ts +0 -34
- package/dist/delivery/main.js +0 -156
- package/dist/index.d.ts +0 -1
- package/dist/index.iife.d.ts +0 -8
- package/dist/index.iife.js +0 -145
- package/dist/index.js +0 -2
- package/dist/print/index.d.ts +0 -15
- package/dist/print/index.js +0 -34
- package/dist/runtime-support.d.ts +0 -12
- package/dist/runtime-support.js +0 -12
package/package.json
CHANGED
|
@@ -1,99 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/rubric",
|
|
3
|
-
"
|
|
3
|
+
"repository": "pie-framework/pie-elements",
|
|
4
|
+
"version": "8.1.2",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"module": "src/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./src/index.js",
|
|
10
|
+
"default": "./lib/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./print": "./src/print.js",
|
|
13
|
+
"./configure/lib": {
|
|
14
|
+
"require": "./configure/lib/index.js",
|
|
15
|
+
"default": "./configure/lib/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
4
18
|
"description": "Rubric Scoring Interaction",
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
5
22
|
"dependencies": {
|
|
6
23
|
"@emotion/react": "^11.14.0",
|
|
7
24
|
"@emotion/style": "^0.8.0",
|
|
8
25
|
"@mui/icons-material": "^7.3.4",
|
|
9
26
|
"@mui/material": "^7.3.4",
|
|
10
|
-
"@pie-lib/
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"debug": "^4.4.3",
|
|
14
|
-
"@pie-lib/rubric": "2.0.4-next.30",
|
|
15
|
-
"@pie-lib/config-ui": "13.0.4-next.30",
|
|
16
|
-
"@pie-element/shared-math-rendering-mathjax": "0.1.1-next.0",
|
|
17
|
-
"@pie-element/shared-lodash": "0.1.1-next.0"
|
|
18
|
-
},
|
|
19
|
-
"peerDependencies": {
|
|
20
|
-
"react": "^18.0.0",
|
|
21
|
-
"react-dom": "^18.0.0"
|
|
22
|
-
},
|
|
23
|
-
"exports": {
|
|
24
|
-
".": {
|
|
25
|
-
"types": "./dist/index.d.ts",
|
|
26
|
-
"default": "./dist/index.js"
|
|
27
|
-
},
|
|
28
|
-
"./delivery": {
|
|
29
|
-
"types": "./dist/delivery/index.d.ts",
|
|
30
|
-
"default": "./dist/delivery/index.js"
|
|
31
|
-
},
|
|
32
|
-
"./browser/delivery": {
|
|
33
|
-
"default": "./dist/browser/delivery/index.js"
|
|
34
|
-
},
|
|
35
|
-
"./author": {
|
|
36
|
-
"types": "./dist/author/index.d.ts",
|
|
37
|
-
"default": "./dist/author/index.js"
|
|
38
|
-
},
|
|
39
|
-
"./browser/author": {
|
|
40
|
-
"default": "./dist/browser/author/index.js"
|
|
41
|
-
},
|
|
42
|
-
"./configure": {
|
|
43
|
-
"types": "./dist/author/index.d.ts",
|
|
44
|
-
"default": "./dist/author/index.js"
|
|
45
|
-
},
|
|
46
|
-
"./controller": {
|
|
47
|
-
"types": "./dist/controller/index.d.ts",
|
|
48
|
-
"default": "./dist/controller/index.js"
|
|
49
|
-
},
|
|
50
|
-
"./controller.js": {
|
|
51
|
-
"types": "./dist/controller/index.d.ts",
|
|
52
|
-
"default": "./dist/controller/index.js"
|
|
53
|
-
},
|
|
54
|
-
"./browser/controller": {
|
|
55
|
-
"default": "./dist/browser/controller/index.js"
|
|
56
|
-
},
|
|
57
|
-
"./print": {
|
|
58
|
-
"types": "./dist/print/index.d.ts",
|
|
59
|
-
"default": "./dist/print/index.js"
|
|
60
|
-
},
|
|
61
|
-
"./browser/print": {
|
|
62
|
-
"default": "./dist/browser/print/index.js"
|
|
63
|
-
},
|
|
64
|
-
"./runtime-support": {
|
|
65
|
-
"types": "./dist/runtime-support.d.ts",
|
|
66
|
-
"default": "./dist/runtime-support.js"
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
"type": "module",
|
|
70
|
-
"main": "./dist/index.js",
|
|
71
|
-
"types": "./dist/index.d.ts",
|
|
72
|
-
"files": [
|
|
73
|
-
"configure.js",
|
|
74
|
-
"controller.js",
|
|
75
|
-
"dist"
|
|
76
|
-
],
|
|
77
|
-
"sideEffects": false,
|
|
78
|
-
"devDependencies": {
|
|
79
|
-
"vite": "^8.0.1",
|
|
80
|
-
"typescript": "^5.9.3",
|
|
81
|
-
"@vitejs/plugin-react": "^6.0.1",
|
|
82
|
-
"@types/react": "^18.2.0",
|
|
83
|
-
"@types/react-dom": "^18.2.0"
|
|
27
|
+
"@pie-lib/math-rendering": "5.0.2",
|
|
28
|
+
"@pie-lib/render-ui": "6.1.1",
|
|
29
|
+
"prop-types": "^15.8.1"
|
|
84
30
|
},
|
|
31
|
+
"author": "pie framework developers",
|
|
32
|
+
"license": "ISC",
|
|
33
|
+
"gitHead": "206ff17a94e8e197744d059f97ad2b9a1bc9145d",
|
|
85
34
|
"scripts": {
|
|
86
|
-
"
|
|
87
|
-
"dev": "bun x vite",
|
|
88
|
-
"demo": "bun x vite --mode demo",
|
|
89
|
-
"test": "bun x vitest run"
|
|
90
|
-
},
|
|
91
|
-
"pie": {
|
|
92
|
-
"controller": "@pie-element/rubric/controller",
|
|
93
|
-
"configure": "@pie-element/rubric/configure",
|
|
94
|
-
"browserSharedDependencies": {
|
|
95
|
-
"react": "18.2.0",
|
|
96
|
-
"react-dom": "18.2.0"
|
|
97
|
-
}
|
|
35
|
+
"postpublish": "../../scripts/postpublish"
|
|
98
36
|
}
|
|
99
37
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import Rubric from '../main';
|
|
5
|
+
|
|
6
|
+
describe('rubric viewer', () => {
|
|
7
|
+
const wrapper = (extras) => {
|
|
8
|
+
const props = {
|
|
9
|
+
value: {
|
|
10
|
+
points: ['nothing right', 'a teeny bit right', 'mostly right', 'bingo'],
|
|
11
|
+
sampleAnswers: [null, 'just right', 'not left', null],
|
|
12
|
+
excludeZero: false,
|
|
13
|
+
...extras,
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
return render(<Rubric {...props} />);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
describe('exclude zeros', () => {
|
|
21
|
+
it('renders correctly with excluded zeroes', async () => {
|
|
22
|
+
let result = wrapper({
|
|
23
|
+
excludeZero: true,
|
|
24
|
+
points: ['a teeny bit right', 'mostly right', 'bingo'],
|
|
25
|
+
sampleAnswers: ['just right', 'not left', null]
|
|
26
|
+
});
|
|
27
|
+
let toggle = result.container.querySelector('#rubric-toggle');
|
|
28
|
+
await userEvent.click(toggle);
|
|
29
|
+
expect(result.container.querySelectorAll('li').length).toEqual(5);
|
|
30
|
+
|
|
31
|
+
result = wrapper({excludeZero: false});
|
|
32
|
+
toggle = result.container.querySelector('#rubric-toggle');
|
|
33
|
+
await userEvent.click(toggle);
|
|
34
|
+
expect(result.container.querySelectorAll('li').length).toEqual(6);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
});
|
package/src/index.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import Rubric from './main';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { createRoot } from 'react-dom/client';
|
|
4
|
+
import debug from 'debug';
|
|
5
|
+
import { renderMath } from '@pie-lib/math-rendering';
|
|
6
|
+
|
|
7
|
+
export default class RubricRender extends HTMLElement {
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
debug.log('constructor called');
|
|
11
|
+
this.onModelChanged = this.onModelChanged.bind(this);
|
|
12
|
+
this._root = null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
set model(s) {
|
|
16
|
+
this._model = s;
|
|
17
|
+
this._render();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
onModelChanged(m) {
|
|
21
|
+
this._model = m;
|
|
22
|
+
this._render();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
connectedCallback() {
|
|
26
|
+
this._render();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
_render() {
|
|
30
|
+
if (this._model) {
|
|
31
|
+
const el = React.createElement(Rubric, { value: this._model });
|
|
32
|
+
|
|
33
|
+
if (!this._root) {
|
|
34
|
+
this._root = createRoot(this);
|
|
35
|
+
}
|
|
36
|
+
this._root.render(el);
|
|
37
|
+
queueMicrotask(() => {
|
|
38
|
+
renderMath(this);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
disconnectedCallback() {
|
|
44
|
+
if (this._root) {
|
|
45
|
+
this._root.unmount();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
package/src/main.jsx
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
|
+
import ListItem from '@mui/material/ListItem';
|
|
4
|
+
import List from '@mui/material/List';
|
|
5
|
+
import Collapse from '@mui/material/Collapse';
|
|
6
|
+
import { color, UiLayout } from '@pie-lib/render-ui';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
|
|
9
|
+
const StyledUiLayout = styled(UiLayout)({
|
|
10
|
+
color: color.text(),
|
|
11
|
+
backgroundColor: color.background(),
|
|
12
|
+
// apply styles to tables to match the rest of the UI
|
|
13
|
+
'&:not(.MathJax) table': {
|
|
14
|
+
borderCollapse: 'collapse',
|
|
15
|
+
},
|
|
16
|
+
'&:not(.MathJax) table td, &:not(.MathJax) table th': {
|
|
17
|
+
padding: '8px 12px',
|
|
18
|
+
textAlign: 'left',
|
|
19
|
+
},
|
|
20
|
+
// reset paragraph margins and line-height inside lists to override client styles
|
|
21
|
+
'& ul p, & ol p': {
|
|
22
|
+
marginBottom: 0,
|
|
23
|
+
marginTop: 0,
|
|
24
|
+
lineHeight: 'normal',
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const StyledListItem = styled(ListItem)({
|
|
29
|
+
display: 'flex',
|
|
30
|
+
flexDirection: 'column',
|
|
31
|
+
alignItems: 'flex-start',
|
|
32
|
+
padding: '12px 0px',
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const Text = styled('div')({
|
|
36
|
+
color: color.text(),
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const TitleText = styled('h3')({
|
|
40
|
+
color: color.text(),
|
|
41
|
+
fontSize: '16px',
|
|
42
|
+
fontWeight: '700',
|
|
43
|
+
margin: 0,
|
|
44
|
+
paddingBottom: '6px',
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const SampleTitleText = styled('h4')({
|
|
48
|
+
color: color.text(),
|
|
49
|
+
fontSize: '16px',
|
|
50
|
+
fontWeight: 'normal',
|
|
51
|
+
margin: 0,
|
|
52
|
+
paddingBottom: '6px',
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const RubricToggle = styled('h2')(({ theme }) => ({
|
|
56
|
+
display: 'flex',
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
cursor: 'pointer',
|
|
59
|
+
userSelect: 'none',
|
|
60
|
+
fontSize: theme.typography.fontSize,
|
|
61
|
+
fontWeight: '500',
|
|
62
|
+
color: color.tertiary(),
|
|
63
|
+
margin: 0,
|
|
64
|
+
}));
|
|
65
|
+
|
|
66
|
+
const ChevronStyle = styled('span')({
|
|
67
|
+
display: 'inline-flex',
|
|
68
|
+
transition: 'transform 0.2s',
|
|
69
|
+
marginLeft: 2,
|
|
70
|
+
alignSelf: 'center',
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const HiddenScreenReader = styled('h2')({
|
|
74
|
+
position: 'absolute',
|
|
75
|
+
width: '1px',
|
|
76
|
+
height: '1px',
|
|
77
|
+
padding: 0,
|
|
78
|
+
margin: '-1px',
|
|
79
|
+
overflow: 'hidden',
|
|
80
|
+
clip: 'rect(0,0,0,0)',
|
|
81
|
+
border: 0,
|
|
82
|
+
whiteSpace: 'nowrap',
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
export const RubricType = PropTypes.shape({
|
|
86
|
+
excludeZero: PropTypes.bool,
|
|
87
|
+
points: PropTypes.arrayOf(PropTypes.string),
|
|
88
|
+
sampleAnswers: PropTypes.arrayOf(PropTypes.string),
|
|
89
|
+
animationsDisabled: PropTypes.bool,
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
class Rubric extends React.Component {
|
|
93
|
+
dudUrl = 'javascript:;';
|
|
94
|
+
|
|
95
|
+
constructor(props) {
|
|
96
|
+
super(props);
|
|
97
|
+
this.state = {
|
|
98
|
+
rubricOpen: false,
|
|
99
|
+
linkPrefix: 'Show',
|
|
100
|
+
};
|
|
101
|
+
this.toggleRubric = this.toggleRubric.bind(this);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
static propTypes = {
|
|
105
|
+
model: PropTypes.object.isRequired,
|
|
106
|
+
animationsDisabled: PropTypes.bool,
|
|
107
|
+
value: RubricType,
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
toggleRubric() {
|
|
111
|
+
this.setState({ rubricOpen: !this.state.rubricOpen });
|
|
112
|
+
this.setState({ linkPrefix: this.state.rubricOpen ? 'Show' : 'Hide' });
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
shouldRenderPoint = (index, value) => {
|
|
116
|
+
if (!value.excludeZero) {
|
|
117
|
+
return true;
|
|
118
|
+
} else {
|
|
119
|
+
return index !== 0;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
render() {
|
|
124
|
+
const { model, value } = this.props;
|
|
125
|
+
let { animationsDisabled } = this.props;
|
|
126
|
+
animationsDisabled = animationsDisabled || value.animationsDisabled;
|
|
127
|
+
|
|
128
|
+
if (value && value.points) {
|
|
129
|
+
const { extraCSSRules } = model || {};
|
|
130
|
+
const { points, sampleAnswers } = value;
|
|
131
|
+
|
|
132
|
+
const rubricList = (
|
|
133
|
+
<List component="nav">
|
|
134
|
+
{points
|
|
135
|
+
.slice(0)
|
|
136
|
+
.reverse()
|
|
137
|
+
.map((desc, index) => {
|
|
138
|
+
index = points.length - index - 1;
|
|
139
|
+
const pointsLabel = value.excludeZero ? index + 1 : index;
|
|
140
|
+
|
|
141
|
+
return (
|
|
142
|
+
<React.Fragment key={index}>
|
|
143
|
+
<StyledListItem key={`P${index}`}>
|
|
144
|
+
<TitleText>
|
|
145
|
+
{pointsLabel === 1 ? `${pointsLabel} PT` : `${pointsLabel} PTS`}
|
|
146
|
+
</TitleText>
|
|
147
|
+
<Text dangerouslySetInnerHTML={{ __html: desc }} />
|
|
148
|
+
</StyledListItem>
|
|
149
|
+
|
|
150
|
+
{sampleAnswers && sampleAnswers[index] && (
|
|
151
|
+
<StyledListItem key={`S${index}`}>
|
|
152
|
+
<SampleTitleText>
|
|
153
|
+
Sample Answer
|
|
154
|
+
</SampleTitleText>
|
|
155
|
+
<Text dangerouslySetInnerHTML={{ __html: sampleAnswers[index] }} />
|
|
156
|
+
</StyledListItem>
|
|
157
|
+
)}
|
|
158
|
+
</React.Fragment>
|
|
159
|
+
);
|
|
160
|
+
})}
|
|
161
|
+
</List>
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
return (
|
|
165
|
+
<StyledUiLayout extraCSSRules={extraCSSRules}>
|
|
166
|
+
{/* screen reader only heading for navigation as per PD-5057 */}
|
|
167
|
+
<HiddenScreenReader>Rubric</HiddenScreenReader>
|
|
168
|
+
{!animationsDisabled ? (
|
|
169
|
+
<React.Fragment>
|
|
170
|
+
<RubricToggle
|
|
171
|
+
id={'rubric-toggle'}
|
|
172
|
+
tabIndex={0}
|
|
173
|
+
role="button"
|
|
174
|
+
aria-expanded={this.state.rubricOpen}
|
|
175
|
+
onClick={this.toggleRubric}
|
|
176
|
+
onKeyPress={(e) => {
|
|
177
|
+
if (e.key === 'Enter' || e.key === ' ') this.toggleRubric();
|
|
178
|
+
}}
|
|
179
|
+
>
|
|
180
|
+
{this.state.linkPrefix} Rubric
|
|
181
|
+
<ChevronStyle aria-hidden="true">
|
|
182
|
+
{this.state.rubricOpen ? (
|
|
183
|
+
<svg
|
|
184
|
+
width="20"
|
|
185
|
+
height="20"
|
|
186
|
+
viewBox="0 0 24 24"
|
|
187
|
+
fill="none"
|
|
188
|
+
stroke="currentColor"
|
|
189
|
+
strokeWidth="2"
|
|
190
|
+
strokeLinecap="round"
|
|
191
|
+
strokeLinejoin="round"
|
|
192
|
+
>
|
|
193
|
+
<polyline points="18 15 12 9 6 15"></polyline>
|
|
194
|
+
</svg>
|
|
195
|
+
) : (
|
|
196
|
+
<svg
|
|
197
|
+
width="20"
|
|
198
|
+
height="20"
|
|
199
|
+
viewBox="0 0 24 24"
|
|
200
|
+
fill="none"
|
|
201
|
+
stroke="currentColor"
|
|
202
|
+
strokeWidth="2"
|
|
203
|
+
strokeLinecap="round"
|
|
204
|
+
strokeLinejoin="round"
|
|
205
|
+
>
|
|
206
|
+
<polyline points="6 9 12 15 18 9"></polyline>
|
|
207
|
+
</svg>
|
|
208
|
+
)}
|
|
209
|
+
</ChevronStyle>
|
|
210
|
+
</RubricToggle>
|
|
211
|
+
<Collapse in={this.state.rubricOpen} timeout={{ enter: 225, exit: 195 }}>
|
|
212
|
+
{rubricList}
|
|
213
|
+
</Collapse>
|
|
214
|
+
</React.Fragment>
|
|
215
|
+
) : (
|
|
216
|
+
rubricList
|
|
217
|
+
)}
|
|
218
|
+
</StyledUiLayout>
|
|
219
|
+
);
|
|
220
|
+
} else {
|
|
221
|
+
return null;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export default Rubric;
|
package/src/print.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createRoot } from 'react-dom/client';
|
|
3
|
+
import { debounce } from 'lodash-es';
|
|
4
|
+
import Main from './main';
|
|
5
|
+
import { renderMath } from '@pie-lib/math-rendering';
|
|
6
|
+
import debug from 'debug';
|
|
7
|
+
|
|
8
|
+
const log = debug('pie-element:rubric:print');
|
|
9
|
+
|
|
10
|
+
const preparePrintModel = (model, opts) => {
|
|
11
|
+
const instr = opts.role === 'instructor';
|
|
12
|
+
|
|
13
|
+
if (!instr) {
|
|
14
|
+
return {};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
model.value = { ...model };
|
|
18
|
+
model.mode = 'evaluate';
|
|
19
|
+
model.animationsDisabled = true;
|
|
20
|
+
|
|
21
|
+
return model;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default class RubricPrint extends HTMLElement {
|
|
25
|
+
constructor() {
|
|
26
|
+
super();
|
|
27
|
+
this._options = null;
|
|
28
|
+
this._model = null;
|
|
29
|
+
this._session = [];
|
|
30
|
+
this._root = null;
|
|
31
|
+
this._rerender = debounce(
|
|
32
|
+
() => {
|
|
33
|
+
if (this._model && this._session) {
|
|
34
|
+
const printModel = preparePrintModel(this._model, this._options);
|
|
35
|
+
|
|
36
|
+
const element =
|
|
37
|
+
this._options &&
|
|
38
|
+
React.createElement(Main, {
|
|
39
|
+
...printModel,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
if (!this._root) {
|
|
43
|
+
this._root = createRoot(this);
|
|
44
|
+
}
|
|
45
|
+
this._root.render(element);
|
|
46
|
+
queueMicrotask(() => {
|
|
47
|
+
log('render complete - render math');
|
|
48
|
+
renderMath(this);
|
|
49
|
+
});
|
|
50
|
+
} else {
|
|
51
|
+
log('skip');
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
50,
|
|
55
|
+
{ leading: false, trailing: true },
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
set options(o) {
|
|
59
|
+
this._options = o;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
set model(s) {
|
|
63
|
+
this._model = s;
|
|
64
|
+
this._rerender();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
connectedCallback() {}
|
|
68
|
+
|
|
69
|
+
disconnectedCallback() {
|
|
70
|
+
if (this._root) {
|
|
71
|
+
this._root.unmount();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
package/configure.js
DELETED
package/controller.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './dist/controller/index.js';
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/rubric/configure/src/defaults.js
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
declare const _default: {
|
|
10
|
-
model: {
|
|
11
|
-
points: string[];
|
|
12
|
-
sampleAnswers: null[];
|
|
13
|
-
maxPoints: number;
|
|
14
|
-
excludeZero: boolean;
|
|
15
|
-
excludeZeroEnabled: boolean;
|
|
16
|
-
maxPointsEnabled: boolean;
|
|
17
|
-
};
|
|
18
|
-
configuration: {
|
|
19
|
-
baseInputConfiguration: {
|
|
20
|
-
h3: {
|
|
21
|
-
disabled: boolean;
|
|
22
|
-
};
|
|
23
|
-
audio: {
|
|
24
|
-
disabled: boolean;
|
|
25
|
-
};
|
|
26
|
-
video: {
|
|
27
|
-
disabled: boolean;
|
|
28
|
-
};
|
|
29
|
-
image: {
|
|
30
|
-
disabled: boolean;
|
|
31
|
-
};
|
|
32
|
-
textAlign: {
|
|
33
|
-
disabled: boolean;
|
|
34
|
-
};
|
|
35
|
-
showParagraphs: {
|
|
36
|
-
disabled: boolean;
|
|
37
|
-
};
|
|
38
|
-
separateParagraphs: {
|
|
39
|
-
disabled: boolean;
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
rubriclessInstruction: {
|
|
43
|
-
inputConfiguration: {
|
|
44
|
-
audio: {
|
|
45
|
-
disabled: boolean;
|
|
46
|
-
};
|
|
47
|
-
video: {
|
|
48
|
-
disabled: boolean;
|
|
49
|
-
};
|
|
50
|
-
image: {
|
|
51
|
-
disabled: boolean;
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
showExcludeZero: {
|
|
56
|
-
settings: boolean;
|
|
57
|
-
label: string;
|
|
58
|
-
};
|
|
59
|
-
showMaxPoint: {
|
|
60
|
-
settings: boolean;
|
|
61
|
-
label: string;
|
|
62
|
-
};
|
|
63
|
-
settingsPanelDisabled: boolean;
|
|
64
|
-
mathMlOptions: {
|
|
65
|
-
mmlOutput: boolean;
|
|
66
|
-
mmlEditing: boolean;
|
|
67
|
-
};
|
|
68
|
-
maxMaxPoints: number;
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
export default _default;
|
package/dist/author/defaults.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
//#region src/author/defaults.ts
|
|
2
|
-
var e = {
|
|
3
|
-
model: {
|
|
4
|
-
points: [
|
|
5
|
-
"",
|
|
6
|
-
"",
|
|
7
|
-
"",
|
|
8
|
-
""
|
|
9
|
-
],
|
|
10
|
-
sampleAnswers: [
|
|
11
|
-
null,
|
|
12
|
-
null,
|
|
13
|
-
null,
|
|
14
|
-
null
|
|
15
|
-
],
|
|
16
|
-
maxPoints: 3,
|
|
17
|
-
excludeZero: !1,
|
|
18
|
-
excludeZeroEnabled: !0,
|
|
19
|
-
maxPointsEnabled: !0
|
|
20
|
-
},
|
|
21
|
-
configuration: {
|
|
22
|
-
baseInputConfiguration: {
|
|
23
|
-
h3: { disabled: !0 },
|
|
24
|
-
audio: { disabled: !1 },
|
|
25
|
-
video: { disabled: !1 },
|
|
26
|
-
image: { disabled: !1 },
|
|
27
|
-
textAlign: { disabled: !0 },
|
|
28
|
-
showParagraphs: { disabled: !1 },
|
|
29
|
-
separateParagraphs: { disabled: !0 }
|
|
30
|
-
},
|
|
31
|
-
rubriclessInstruction: { inputConfiguration: {
|
|
32
|
-
audio: { disabled: !1 },
|
|
33
|
-
video: { disabled: !1 },
|
|
34
|
-
image: { disabled: !1 }
|
|
35
|
-
} },
|
|
36
|
-
showExcludeZero: {
|
|
37
|
-
settings: !0,
|
|
38
|
-
label: "Ability to exclude zero"
|
|
39
|
-
},
|
|
40
|
-
showMaxPoint: {
|
|
41
|
-
settings: !0,
|
|
42
|
-
label: "Show max points dropdown"
|
|
43
|
-
},
|
|
44
|
-
settingsPanelDisabled: !1,
|
|
45
|
-
mathMlOptions: {
|
|
46
|
-
mmlOutput: !1,
|
|
47
|
-
mmlEditing: !1
|
|
48
|
-
},
|
|
49
|
-
maxMaxPoints: 9
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
//#endregion
|
|
53
|
-
export { e as default };
|
package/dist/author/index.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/rubric/configure/src/index.js
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
export default class RubricElement extends HTMLElement {
|
|
10
|
-
constructor();
|
|
11
|
-
updateModelAccordingToReceivedProps: any;
|
|
12
|
-
set model(m: any);
|
|
13
|
-
set configuration(c: any);
|
|
14
|
-
onModelChanged(m: any): void;
|
|
15
|
-
onConfigurationChanged: any;
|
|
16
|
-
insertImage(handler: any): void;
|
|
17
|
-
onDeleteImage(src: any, done: any): void;
|
|
18
|
-
connectedCallback(): void;
|
|
19
|
-
_render(): void;
|
|
20
|
-
disconnectedCallback(): void;
|
|
21
|
-
}
|