@pie-element/complex-rubric 3.8.1-next.9 → 3.8.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.
Files changed (68) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/configure/CHANGELOG.md +11 -0
  3. package/configure/package.json +2 -2
  4. package/package.json +4 -4
  5. package/configure/node_modules/@pie-element/rubric/CHANGELOG.json +0 -257
  6. package/configure/node_modules/@pie-element/rubric/CHANGELOG.md +0 -2683
  7. package/configure/node_modules/@pie-element/rubric/LICENSE.md +0 -5
  8. package/configure/node_modules/@pie-element/rubric/README.md +0 -3
  9. package/configure/node_modules/@pie-element/rubric/configure/CHANGELOG.json +0 -197
  10. package/configure/node_modules/@pie-element/rubric/configure/CHANGELOG.md +0 -2484
  11. package/configure/node_modules/@pie-element/rubric/configure/lib/defaults.js +0 -68
  12. package/configure/node_modules/@pie-element/rubric/configure/lib/defaults.js.map +0 -1
  13. package/configure/node_modules/@pie-element/rubric/configure/lib/index.js +0 -197
  14. package/configure/node_modules/@pie-element/rubric/configure/lib/index.js.map +0 -1
  15. package/configure/node_modules/@pie-element/rubric/configure/lib/main.js +0 -162
  16. package/configure/node_modules/@pie-element/rubric/configure/lib/main.js.map +0 -1
  17. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/authoring.js +0 -573
  18. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/authoring.js.map +0 -1
  19. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/index.js +0 -24
  20. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/index.js.map +0 -1
  21. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/point-menu.js +0 -172
  22. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/point-menu.js.map +0 -1
  23. package/configure/node_modules/@pie-element/rubric/configure/package.json +0 -20
  24. package/configure/node_modules/@pie-element/rubric/configure/src/__tests__/index.test.jsx +0 -178
  25. package/configure/node_modules/@pie-element/rubric/configure/src/defaults.js +0 -42
  26. package/configure/node_modules/@pie-element/rubric/configure/src/index.js +0 -129
  27. package/configure/node_modules/@pie-element/rubric/configure/src/main.jsx +0 -89
  28. package/configure/node_modules/@pie-element/rubric/configure/src/pie-toolbox-rubric/authoring.jsx +0 -449
  29. package/configure/node_modules/@pie-element/rubric/configure/src/pie-toolbox-rubric/index.js +0 -9
  30. package/configure/node_modules/@pie-element/rubric/configure/src/pie-toolbox-rubric/point-menu.jsx +0 -94
  31. package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.json +0 -17
  32. package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.md +0 -1510
  33. package/configure/node_modules/@pie-element/rubric/controller/lib/defaults.js +0 -16
  34. package/configure/node_modules/@pie-element/rubric/controller/lib/defaults.js.map +0 -1
  35. package/configure/node_modules/@pie-element/rubric/controller/lib/index.js +0 -59
  36. package/configure/node_modules/@pie-element/rubric/controller/lib/index.js.map +0 -1
  37. package/configure/node_modules/@pie-element/rubric/controller/package.json +0 -12
  38. package/configure/node_modules/@pie-element/rubric/controller/src/__tests__/index.test.js +0 -33
  39. package/configure/node_modules/@pie-element/rubric/controller/src/defaults.js +0 -8
  40. package/configure/node_modules/@pie-element/rubric/controller/src/index.js +0 -41
  41. package/configure/node_modules/@pie-element/rubric/docs/config-schema.json +0 -712
  42. package/configure/node_modules/@pie-element/rubric/docs/config-schema.json.md +0 -532
  43. package/configure/node_modules/@pie-element/rubric/docs/demo/config.js +0 -8
  44. package/configure/node_modules/@pie-element/rubric/docs/demo/generate.js +0 -8
  45. package/configure/node_modules/@pie-element/rubric/docs/demo/index.html +0 -2
  46. package/configure/node_modules/@pie-element/rubric/docs/pie-schema.json +0 -391
  47. package/configure/node_modules/@pie-element/rubric/docs/pie-schema.json.md +0 -281
  48. package/configure/node_modules/@pie-element/rubric/lib/index.js +0 -94
  49. package/configure/node_modules/@pie-element/rubric/lib/index.js.map +0 -1
  50. package/configure/node_modules/@pie-element/rubric/lib/main.js +0 -270
  51. package/configure/node_modules/@pie-element/rubric/lib/main.js.map +0 -1
  52. package/configure/node_modules/@pie-element/rubric/lib/print.js +0 -114
  53. package/configure/node_modules/@pie-element/rubric/lib/print.js.map +0 -1
  54. package/configure/node_modules/@pie-element/rubric/module/configure.js +0 -1
  55. package/configure/node_modules/@pie-element/rubric/module/controller.js +0 -113
  56. package/configure/node_modules/@pie-element/rubric/module/demo.js +0 -33
  57. package/configure/node_modules/@pie-element/rubric/module/element.js +0 -1
  58. package/configure/node_modules/@pie-element/rubric/module/index.html +0 -21
  59. package/configure/node_modules/@pie-element/rubric/module/manifest.json +0 -10
  60. package/configure/node_modules/@pie-element/rubric/module/print-demo.js +0 -71
  61. package/configure/node_modules/@pie-element/rubric/module/print.html +0 -18
  62. package/configure/node_modules/@pie-element/rubric/module/print.js +0 -1
  63. package/configure/node_modules/@pie-element/rubric/package.json +0 -27
  64. package/configure/node_modules/@pie-element/rubric/src/__tests__/__snapshots__/rubric-view.test.jsx.snap +0 -1815
  65. package/configure/node_modules/@pie-element/rubric/src/__tests__/rubric-view.test.jsx +0 -49
  66. package/configure/node_modules/@pie-element/rubric/src/index.js +0 -37
  67. package/configure/node_modules/@pie-element/rubric/src/main.jsx +0 -219
  68. package/configure/node_modules/@pie-element/rubric/src/print.js +0 -63
@@ -1,49 +0,0 @@
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
- });
@@ -1,37 +0,0 @@
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
- }
@@ -1,219 +0,0 @@
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);
@@ -1,63 +0,0 @@
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
- }