@pie-element/complex-rubric 3.7.10-next.87 → 3.8.1-next.5

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.
Files changed (76) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/configure/CHANGELOG.md +19 -0
  3. package/configure/node_modules/@pie-element/rubric/CHANGELOG.json +257 -0
  4. package/configure/node_modules/@pie-element/rubric/CHANGELOG.md +2683 -0
  5. package/configure/node_modules/@pie-element/rubric/LICENSE.md +5 -0
  6. package/configure/node_modules/@pie-element/rubric/README.md +3 -0
  7. package/configure/node_modules/@pie-element/rubric/configure/CHANGELOG.json +197 -0
  8. package/configure/node_modules/@pie-element/rubric/configure/CHANGELOG.md +2484 -0
  9. package/configure/node_modules/@pie-element/rubric/configure/lib/defaults.js +68 -0
  10. package/configure/node_modules/@pie-element/rubric/configure/lib/defaults.js.map +1 -0
  11. package/configure/node_modules/@pie-element/rubric/configure/lib/index.js +197 -0
  12. package/configure/node_modules/@pie-element/rubric/configure/lib/index.js.map +1 -0
  13. package/configure/node_modules/@pie-element/rubric/configure/lib/main.js +162 -0
  14. package/configure/node_modules/@pie-element/rubric/configure/lib/main.js.map +1 -0
  15. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/authoring.js +573 -0
  16. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/authoring.js.map +1 -0
  17. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/index.js +24 -0
  18. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/index.js.map +1 -0
  19. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/point-menu.js +172 -0
  20. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/point-menu.js.map +1 -0
  21. package/configure/node_modules/@pie-element/rubric/configure/package.json +20 -0
  22. package/configure/node_modules/@pie-element/rubric/configure/src/__tests__/index.test.jsx +178 -0
  23. package/configure/node_modules/@pie-element/rubric/configure/src/defaults.js +42 -0
  24. package/configure/node_modules/@pie-element/rubric/configure/src/index.js +129 -0
  25. package/configure/node_modules/@pie-element/rubric/configure/src/main.jsx +89 -0
  26. package/configure/node_modules/@pie-element/rubric/configure/src/pie-toolbox-rubric/authoring.jsx +449 -0
  27. package/configure/node_modules/@pie-element/rubric/configure/src/pie-toolbox-rubric/index.js +9 -0
  28. package/configure/node_modules/@pie-element/rubric/configure/src/pie-toolbox-rubric/point-menu.jsx +94 -0
  29. package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.json +17 -0
  30. package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.md +1510 -0
  31. package/configure/node_modules/@pie-element/rubric/controller/lib/defaults.js +16 -0
  32. package/configure/node_modules/@pie-element/rubric/controller/lib/defaults.js.map +1 -0
  33. package/configure/node_modules/@pie-element/rubric/controller/lib/index.js +59 -0
  34. package/configure/node_modules/@pie-element/rubric/controller/lib/index.js.map +1 -0
  35. package/configure/node_modules/@pie-element/rubric/controller/package.json +12 -0
  36. package/configure/node_modules/@pie-element/rubric/controller/src/__tests__/index.test.js +33 -0
  37. package/configure/node_modules/@pie-element/rubric/controller/src/defaults.js +8 -0
  38. package/configure/node_modules/@pie-element/rubric/controller/src/index.js +41 -0
  39. package/configure/node_modules/@pie-element/rubric/docs/config-schema.json +712 -0
  40. package/configure/node_modules/@pie-element/rubric/docs/config-schema.json.md +532 -0
  41. package/configure/node_modules/@pie-element/rubric/docs/demo/config.js +8 -0
  42. package/configure/node_modules/@pie-element/rubric/docs/demo/generate.js +8 -0
  43. package/configure/node_modules/@pie-element/rubric/docs/demo/index.html +2 -0
  44. package/configure/node_modules/@pie-element/rubric/docs/pie-schema.json +391 -0
  45. package/configure/node_modules/@pie-element/rubric/docs/pie-schema.json.md +281 -0
  46. package/configure/node_modules/@pie-element/rubric/lib/index.js +94 -0
  47. package/configure/node_modules/@pie-element/rubric/lib/index.js.map +1 -0
  48. package/configure/node_modules/@pie-element/rubric/lib/main.js +270 -0
  49. package/configure/node_modules/@pie-element/rubric/lib/main.js.map +1 -0
  50. package/configure/node_modules/@pie-element/rubric/lib/print.js +114 -0
  51. package/configure/node_modules/@pie-element/rubric/lib/print.js.map +1 -0
  52. package/configure/node_modules/@pie-element/rubric/module/configure.js +1 -0
  53. package/configure/node_modules/@pie-element/rubric/module/controller.js +113 -0
  54. package/configure/node_modules/@pie-element/rubric/module/demo.js +33 -0
  55. package/configure/node_modules/@pie-element/rubric/module/element.js +1 -0
  56. package/configure/node_modules/@pie-element/rubric/module/index.html +21 -0
  57. package/configure/node_modules/@pie-element/rubric/module/manifest.json +10 -0
  58. package/configure/node_modules/@pie-element/rubric/module/print-demo.js +71 -0
  59. package/configure/node_modules/@pie-element/rubric/module/print.html +18 -0
  60. package/configure/node_modules/@pie-element/rubric/module/print.js +1 -0
  61. package/configure/node_modules/@pie-element/rubric/package.json +27 -0
  62. package/configure/node_modules/@pie-element/rubric/src/__tests__/__snapshots__/rubric-view.test.jsx.snap +1815 -0
  63. package/configure/node_modules/@pie-element/rubric/src/__tests__/rubric-view.test.jsx +49 -0
  64. package/configure/node_modules/@pie-element/rubric/src/index.js +37 -0
  65. package/configure/node_modules/@pie-element/rubric/src/main.jsx +219 -0
  66. package/configure/node_modules/@pie-element/rubric/src/print.js +63 -0
  67. package/configure/package.json +5 -5
  68. package/controller/CHANGELOG.md +18 -0
  69. package/controller/package.json +1 -1
  70. package/module/configure.js +1 -1
  71. package/module/element.js +1 -1
  72. package/module/index.html +1 -1
  73. package/module/manifest.json +5 -5
  74. package/module/print.html +1 -1
  75. package/module/print.js +1 -1
  76. package/package.json +4 -4
@@ -0,0 +1,49 @@
1
+ import { mount } from 'enzyme';
2
+ import React from 'react';
3
+ import Rubric from '../main';
4
+
5
+ describe('rubric viewer', () => {
6
+ const wrapper = (extras) => {
7
+ const props = {
8
+ value: {
9
+ points: ['nothing right', 'a teeny bit right', 'mostly right', 'bingo'],
10
+ sampleAnswers: [null, 'just right', 'not left', null],
11
+ excludeZero: false,
12
+ ...extras,
13
+ },
14
+ };
15
+
16
+ return mount(<Rubric {...props} />);
17
+ };
18
+
19
+ describe('snapshot', () => {
20
+ it('renders', () => {
21
+ const w = wrapper();
22
+ expect(w).toMatchSnapshot();
23
+ });
24
+ });
25
+
26
+ describe('expanded snapshot', () => {
27
+ it('renders', () => {
28
+ const w = wrapper();
29
+ w.find('#rubric-toggle').simulate('click');
30
+ expect(w).toMatchSnapshot();
31
+ });
32
+ });
33
+
34
+ describe('exclude zeros', () => {
35
+ it('renders correctly with excluded zeroes', () => {
36
+ let w = wrapper({
37
+ excludeZero: true,
38
+ points: ['a teeny bit right', 'mostly right', 'bingo'],
39
+ sampleAnswers: ['just right', 'not left', null]
40
+ });
41
+ w.find('#rubric-toggle').simulate('click');
42
+ expect(w.find('li').length).toEqual(5);
43
+
44
+ w = wrapper({excludeZero: false});
45
+ w.find('#rubric-toggle').simulate('click');
46
+ expect(w.find('li').length).toEqual(6);
47
+ });
48
+ });
49
+ });
@@ -0,0 +1,37 @@
1
+ import Rubric from './main';
2
+ import React from 'react';
3
+ import ReactDOM from 'react-dom';
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
+ }
13
+
14
+ set model(s) {
15
+ this._model = s;
16
+ this._render();
17
+ }
18
+
19
+ onModelChanged(m) {
20
+ this._model = m;
21
+ this._render();
22
+ }
23
+
24
+ connectedCallback() {
25
+ this._render();
26
+ }
27
+
28
+ _render() {
29
+ if (this._model) {
30
+ const el = <Rubric value={this._model} />;
31
+
32
+ ReactDOM.render(el, this, () => {
33
+ renderMath(this);
34
+ });
35
+ }
36
+ }
37
+ }
@@ -0,0 +1,219 @@
1
+ import React from 'react';
2
+ import { withStyles } from '@material-ui/core/styles';
3
+ import ListItem from '@material-ui/core/ListItem';
4
+ import List from '@material-ui/core/List';
5
+ import Collapse from '@material-ui/core/Collapse';
6
+ import { color, UiLayout } from '@pie-lib/render-ui';
7
+ import PropTypes from 'prop-types';
8
+
9
+ export const RubricType = PropTypes.shape({
10
+ excludeZero: PropTypes.bool,
11
+ points: PropTypes.arrayOf(PropTypes.string),
12
+ sampleAnswers: PropTypes.arrayOf(PropTypes.string),
13
+ animationsDisabled: PropTypes.bool,
14
+ });
15
+
16
+ class Rubric extends React.Component {
17
+ dudUrl = 'javascript:;';
18
+
19
+ constructor(props) {
20
+ super(props);
21
+ this.state = {
22
+ rubricOpen: false,
23
+ linkPrefix: 'Show',
24
+ };
25
+ this.toggleRubric = this.toggleRubric.bind(this);
26
+ }
27
+
28
+ static propTypes = {
29
+ classes: PropTypes.object.isRequired,
30
+ model: PropTypes.object.isRequired,
31
+ animationsDisabled: PropTypes.bool,
32
+ value: RubricType,
33
+ };
34
+
35
+ toggleRubric() {
36
+ this.setState({ rubricOpen: !this.state.rubricOpen });
37
+ this.setState({ linkPrefix: this.state.rubricOpen ? 'Show' : 'Hide' });
38
+ }
39
+
40
+ shouldRenderPoint = (index, value) => {
41
+ if (!value.excludeZero) {
42
+ return true;
43
+ } else {
44
+ return index !== 0;
45
+ }
46
+ };
47
+
48
+ render() {
49
+ const { model, value, classes } = this.props;
50
+ let { animationsDisabled } = this.props;
51
+ animationsDisabled = animationsDisabled || value.animationsDisabled;
52
+
53
+ if (value && value.points) {
54
+ const { extraCSSRules } = model || {};
55
+ const { points, sampleAnswers } = value;
56
+
57
+ const rubricList = (
58
+ <List component="nav">
59
+ {points
60
+ .slice(0)
61
+ .reverse()
62
+ .map((desc, index) => {
63
+ index = points.length - index - 1;
64
+ const pointsLabel = value.excludeZero ? index + 1 : index;
65
+
66
+ return (
67
+ <React.Fragment key={index}>
68
+ <ListItem key={`P${index}`} className={classes.listColumn}>
69
+ <h3 className={classes.titleText}>
70
+ {pointsLabel === 1 ? `${pointsLabel} PT` : `${pointsLabel} PTS`}
71
+ </h3>
72
+ <div className={classes.text} dangerouslySetInnerHTML={{ __html: desc }} />
73
+ </ListItem>
74
+
75
+ {sampleAnswers && sampleAnswers[index] && (
76
+ <ListItem key={`S${index}`} className={classes.listColumn}>
77
+ <h4 className={classes.titleText} style={{ fontWeight: 'normal' }}>
78
+ Sample Answer
79
+ </h4>
80
+ <div className={classes.text} dangerouslySetInnerHTML={{ __html: sampleAnswers[index] }} />
81
+ </ListItem>
82
+ )}
83
+ </React.Fragment>
84
+ );
85
+ })}
86
+ </List>
87
+ );
88
+
89
+ return (
90
+ <UiLayout extraCSSRules={extraCSSRules} className={classes.root}>
91
+ {/* screen reader only heading for navigation as per PD-5057 */}
92
+ <h2 className={classes.hiddenScreenReader}>Rubric</h2>
93
+ {!animationsDisabled ? (
94
+ <React.Fragment>
95
+ <h2
96
+ id={'rubric-toggle'}
97
+ className={classes.rubricToggle}
98
+ tabIndex={0}
99
+ role="button"
100
+ aria-expanded={this.state.rubricOpen}
101
+ onClick={this.toggleRubric}
102
+ onKeyPress={(e) => {
103
+ if (e.key === 'Enter' || e.key === ' ') this.toggleRubric();
104
+ }}
105
+ >
106
+ {this.state.linkPrefix} Rubric
107
+ <span className={classes.chevronStyle} aria-hidden="true">
108
+ {this.state.rubricOpen ? (
109
+ <svg
110
+ width="20"
111
+ height="20"
112
+ viewBox="0 0 24 24"
113
+ fill="none"
114
+ stroke="currentColor"
115
+ strokeWidth="2"
116
+ strokeLinecap="round"
117
+ strokeLinejoin="round"
118
+ >
119
+ <polyline points="18 15 12 9 6 15"></polyline>
120
+ </svg>
121
+ ) : (
122
+ <svg
123
+ width="20"
124
+ height="20"
125
+ viewBox="0 0 24 24"
126
+ fill="none"
127
+ stroke="currentColor"
128
+ strokeWidth="2"
129
+ strokeLinecap="round"
130
+ strokeLinejoin="round"
131
+ >
132
+ <polyline points="6 9 12 15 18 9"></polyline>
133
+ </svg>
134
+ )}
135
+ </span>
136
+ </h2>
137
+ <Collapse in={this.state.rubricOpen} timeout="auto">
138
+ {rubricList}
139
+ </Collapse>
140
+ </React.Fragment>
141
+ ) : (
142
+ rubricList
143
+ )}
144
+ </UiLayout>
145
+ );
146
+ } else {
147
+ return null;
148
+ }
149
+ }
150
+ }
151
+
152
+ const styles = (theme) => ({
153
+ root: {
154
+ color: color.text(),
155
+ backgroundColor: color.background(),
156
+ // apply styles to tables to match the rest of the UI
157
+ '&:not(.MathJax) table': {
158
+ borderCollapse: 'collapse',
159
+ },
160
+ '&:not(.MathJax) table td, &:not(.MathJax) table th': {
161
+ padding: '8px 12px',
162
+ textAlign: 'left',
163
+ },
164
+ // reset paragraph margins and line-height inside lists to override client styles
165
+ '& ul p, & ol p': {
166
+ marginBottom: 0,
167
+ marginTop: 0,
168
+ lineHeight: 'normal',
169
+ },
170
+ },
171
+ listColumn: {
172
+ display: 'flex',
173
+ flexDirection: 'column',
174
+ alignItems: 'flex-start',
175
+ padding: '12px 0px',
176
+ },
177
+ listColumnItem: {
178
+ padding: 0,
179
+ },
180
+ text: {
181
+ color: color.text(),
182
+ },
183
+ titleText: {
184
+ color: color.text(),
185
+ fontSize: '16px',
186
+ fontWeight: '700',
187
+ margin: 0,
188
+ paddingBottom: '6px',
189
+ },
190
+ rubricToggle: {
191
+ display: 'flex',
192
+ alignItems: 'center',
193
+ cursor: 'pointer',
194
+ userSelect: 'none',
195
+ fontSize: theme.typography.fontSize,
196
+ fontWeight: '500',
197
+ color: color.tertiary(),
198
+ margin: 0,
199
+ },
200
+ chevronStyle: {
201
+ display: 'inline-flex',
202
+ transition: 'transform 0.2s',
203
+ marginLeft: 2,
204
+ alignSelf: 'center',
205
+ },
206
+ hiddenScreenReader: {
207
+ position: 'absolute',
208
+ width: '1px',
209
+ height: '1px',
210
+ padding: 0,
211
+ margin: '-1px',
212
+ overflow: 'hidden',
213
+ clip: 'rect(0,0,0,0)',
214
+ border: 0,
215
+ whiteSpace: 'nowrap',
216
+ },
217
+ });
218
+
219
+ export default withStyles(styles)(Rubric);
@@ -0,0 +1,63 @@
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom';
3
+ import debounce from 'lodash/debounce';
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._rerender = debounce(
31
+ () => {
32
+ if (this._model && this._session) {
33
+ const printModel = preparePrintModel(this._model, this._options);
34
+
35
+ const element =
36
+ this._options &&
37
+ React.createElement(Main, {
38
+ ...printModel,
39
+ });
40
+
41
+ ReactDOM.render(element, this, () => {
42
+ log('render complete - render math');
43
+ renderMath(this);
44
+ });
45
+ } else {
46
+ log('skip');
47
+ }
48
+ },
49
+ 50,
50
+ { leading: false, trailing: true },
51
+ );
52
+ }
53
+ set options(o) {
54
+ this._options = o;
55
+ }
56
+
57
+ set model(s) {
58
+ this._model = s;
59
+ this._rerender();
60
+ }
61
+
62
+ connectedCallback() {}
63
+ }
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@pie-element/complex-rubric-configure",
3
3
  "private": true,
4
- "version": "2.6.21",
4
+ "version": "2.7.0",
5
5
  "description": "Complex Rubric authoring view",
6
6
  "main": "lib/index.js",
7
7
  "module": "src/index.js",
8
8
  "author": "Pie Framework Authors",
9
9
  "dependencies": {
10
10
  "@material-ui/core": "^3.9.2",
11
- "@pie-element/multi-trait-rubric": "^4.6.8-next.74",
12
- "@pie-element/rubric": "^4.9.8-next.74",
11
+ "@pie-element/multi-trait-rubric": "^4.7.0",
12
+ "@pie-element/rubric": "^4.10.0-next.0",
13
13
  "@pie-framework/pie-configure-events": "^1.3.0",
14
- "@pie-lib/rubric": "^0.24.0",
15
- "@pie-lib/render-ui": "^4.31.0",
16
14
  "@pie-lib/config-ui": "^11.25.0",
15
+ "@pie-lib/render-ui": "^4.31.0",
16
+ "@pie-lib/rubric": "^0.24.0",
17
17
  "debug": "^4.1.1",
18
18
  "lodash": "^4.17.15",
19
19
  "prop-types": "^15.6.2",
@@ -3,6 +3,24 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.3.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/complex-rubric-controller@3.2.9...@pie-element/complex-rubric-controller@3.3.0) (2025-09-25)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * conflicts ([5c99a5d](https://github.com/pie-framework/pie-elements/commit/5c99a5db49549422ba1e29b6c67f210e688677d8))
12
+ * merge develop ([b5ec752](https://github.com/pie-framework/pie-elements/commit/b5ec752f6fedc576449c277308499bc853244544))
13
+ * update pie-lib/pie-toolbox PD-5196 ([d525b88](https://github.com/pie-framework/pie-elements/commit/d525b888f16fcc2ac115c8e699ca6f249db27406))
14
+
15
+
16
+ ### Features
17
+
18
+ * split pie-toolbox in ebsr, rubric, multi-trait-rubric, complex-rubric PD-5158 ([314604f](https://github.com/pie-framework/pie-elements/commit/314604fcc9bea9632ca78afd01be0e7516937313))
19
+
20
+
21
+
22
+
23
+
6
24
  ## [3.2.9](https://github.com/pie-framework/pie-elements/compare/@pie-element/complex-rubric-controller@3.2.8...@pie-element/complex-rubric-controller@3.2.9) (2025-09-11)
7
25
 
8
26
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pie-element/complex-rubric-controller",
3
3
  "private": true,
4
- "version": "3.2.9",
4
+ "version": "3.3.0",
5
5
  "description": "",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"