@pie-element/explicit-constructed-response 3.9.2 → 3.9.3-next.1016

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 (40) hide show
  1. package/CHANGELOG.md +204 -0
  2. package/configure/CHANGELOG.md +176 -0
  3. package/configure/lib/alternateResponses.js +45 -12
  4. package/configure/lib/alternateResponses.js.map +1 -1
  5. package/configure/lib/alternateSection.js +116 -19
  6. package/configure/lib/alternateSection.js.map +1 -1
  7. package/configure/lib/defaults.js +30 -0
  8. package/configure/lib/defaults.js.map +1 -1
  9. package/configure/lib/ecr-toolbar.js +19 -7
  10. package/configure/lib/ecr-toolbar.js.map +1 -1
  11. package/configure/lib/index.js +3 -3
  12. package/configure/lib/main.js +250 -42
  13. package/configure/lib/main.js.map +1 -1
  14. package/configure/lib/markupUtils.js +29 -3
  15. package/configure/lib/markupUtils.js.map +1 -1
  16. package/configure/lib/utils.js +15 -0
  17. package/configure/lib/utils.js.map +1 -0
  18. package/configure/package.json +3 -3
  19. package/controller/CHANGELOG.md +61 -0
  20. package/controller/lib/index.js +99 -6
  21. package/controller/lib/index.js.map +1 -1
  22. package/controller/package.json +1 -1
  23. package/docs/config-schema.json +116 -0
  24. package/docs/config-schema.json.md +89 -1
  25. package/docs/demo/generate.js +3 -1
  26. package/docs/pie-schema.json +57 -0
  27. package/docs/pie-schema.json.md +45 -0
  28. package/lib/index.js +5 -1
  29. package/lib/index.js.map +1 -1
  30. package/lib/main.js +75 -24
  31. package/lib/main.js.map +1 -1
  32. package/lib/print.js +115 -0
  33. package/lib/print.js.map +1 -0
  34. package/package.json +11 -7
  35. package/module/configure.js +0 -2121
  36. package/module/controller.js +0 -20840
  37. package/module/demo.js +0 -44
  38. package/module/element.js +0 -240
  39. package/module/index.html +0 -16
  40. package/module/manifest.json +0 -10
package/module/demo.js DELETED
@@ -1,44 +0,0 @@
1
- import Configure from './configure.js';
2
- import Element from './element.js';
3
- import * as controller from './controller.js';
4
-
5
- const choice = (l, v) => ({ label: l, value: v });
6
-
7
- const markup = '<p>The {{0}} <br> jumped {{1}} <br> the {{2}}</p>';
8
-
9
- var model = (id, element) => ({
10
- id,
11
- element,
12
- markup,
13
- disabled: false,
14
- choices: {
15
- 0: [choice('cow', '0'), choice('cattle', '1'), choice('calf', '2')],
16
- 1: [choice('over', '0'), choice('past', '1'), choice('beyond', '2')],
17
- 2: [choice('moon', '0')]
18
- },
19
- prompt: 'Complete the sentence',
20
- promptEnabled: true
21
- });
22
-
23
- var generate = {
24
- model: model
25
- };
26
-
27
- const { model: model$1 } = generate;
28
-
29
- var config = {
30
- elements: {
31
- 'explicit-constructed-response': '../..'
32
- },
33
- models: [model$1('1', 'explicit-constructed-response')]
34
- };
35
-
36
- //Note: demo-el is a custom element loaded in the markup.
37
- customElements.whenDefined('demo-el').then(() => {
38
- config.models.forEach(m => {
39
- const de = document.createElement('demo-el');
40
- document.body.appendChild(de);
41
- de.def = { tagName: m.element, Element, Configure, controller };
42
- de.model = m;
43
- });
44
- });
package/module/element.js DELETED
@@ -1,240 +0,0 @@
1
- import {_dll_material_ui__core_styles, _dll_react, _dll_prop_types, _dll_lodash, _dll_pie_lib__correct_answer_toggle, _dll_pie_lib__mask_markup, _dll_pie_lib__render_ui, _dll_react_dom, _dll_pie_framework__pie_player_events, _dll_pie_lib__math_rendering} from "../../../@pie-ui/shared-lib@^4.3.3/module/index.js";
2
- const React = _dll_react;
3
- const PropTypes = _dll_prop_types;
4
- const {debounce: debounce} = _dll_lodash;
5
- const {isEmpty: isEmpty} = _dll_lodash;
6
- const CorrectAnswerToggle = _dll_pie_lib__correct_answer_toggle;
7
- const {ConstructedResponse: ConstructedResponse} = _dll_pie_lib__mask_markup;
8
- const {color: color} = _dll_pie_lib__render_ui;
9
- const {Collapsible: Collapsible} = _dll_pie_lib__render_ui;
10
- const {hasText: hasText} = _dll_pie_lib__render_ui;
11
- const {withStyles: withStyles} = _dll_material_ui__core_styles;
12
- const _jsxFileName = "/home/ede/dev/github/pie-framework/pie-elements/node_modules/@pie-ui/explicit-constructed-response/src/main.js";
13
- class Main extends React.Component {
14
- constructor(...args) {
15
- super(...args);
16
- Main.prototype.__init.call(this);
17
- Main.prototype.__init2.call(this);
18
- Main.prototype.__init3.call(this);
19
- Main.prototype.__init4.call(this);
20
- }
21
- static __initStatic() {
22
- this.propTypes = {
23
- classes: PropTypes.object.isRequired,
24
- prompt: PropTypes.string,
25
- rationale: PropTypes.string,
26
- disabled: PropTypes.bool,
27
- markup: PropTypes.string,
28
- mode: PropTypes.string,
29
- teacherInstructions: PropTypes.string,
30
- value: PropTypes.object,
31
- feedback: PropTypes.object,
32
- onChange: PropTypes.func
33
- };
34
- }
35
- static __initStatic2() {
36
- this.defaultProps = {
37
- value: {}
38
- };
39
- }
40
- __init() {
41
- this.state = {
42
- showCorrectAnswer: false,
43
- value: this.props.value
44
- };
45
- }
46
- UNSAFE_componentWillReceiveProps(nextProps) {
47
- if (isEmpty(nextProps.feedback)) {
48
- this.setState({
49
- showCorrectAnswer: false
50
- });
51
- }
52
- }
53
- __init2() {
54
- this.toggleShowCorrect = () => {
55
- this.setState({
56
- showCorrectAnswer: !this.state.showCorrectAnswer
57
- });
58
- };
59
- }
60
- __init3() {
61
- this.changeSession = debounce(this.props.onChange, 1500);
62
- }
63
- __init4() {
64
- this.onChange = value => {
65
- this.setState({
66
- value
67
- });
68
- this.changeSession(value);
69
- };
70
- }
71
- render() {
72
- const {showCorrectAnswer, value} = this.state;
73
- const {classes, mode, prompt, rationale, teacherInstructions} = this.props;
74
- return React.createElement('div', {
75
- className: classes.mainContainer,
76
- __self: this,
77
- __source: {
78
- fileName: _jsxFileName,
79
- lineNumber: 56
80
- }
81
- }, teacherInstructions && hasText(teacherInstructions) && React.createElement('div', {
82
- className: classes.collapsible,
83
- __self: this,
84
- __source: {
85
- fileName: _jsxFileName,
86
- lineNumber: 59
87
- }
88
- }, React.createElement(Collapsible, {
89
- labels: {
90
- hidden: 'Show Teacher Instructions',
91
- visible: 'Hide Teacher Instructions'
92
- },
93
- __self: this,
94
- __source: {
95
- fileName: _jsxFileName,
96
- lineNumber: 60
97
- }
98
- }, React.createElement('div', {
99
- dangerouslySetInnerHTML: {
100
- __html: teacherInstructions
101
- },
102
- __self: this,
103
- __source: {
104
- fileName: _jsxFileName,
105
- lineNumber: 63
106
- }
107
- }))), React.createElement(CorrectAnswerToggle, {
108
- show: mode === 'evaluate',
109
- toggled: showCorrectAnswer,
110
- onToggle: this.toggleShowCorrect,
111
- __self: this,
112
- __source: {
113
- fileName: _jsxFileName,
114
- lineNumber: 68
115
- }
116
- }), prompt && React.createElement('div', {
117
- dangerouslySetInnerHTML: {
118
- __html: prompt
119
- },
120
- __self: this,
121
- __source: {
122
- fileName: _jsxFileName,
123
- lineNumber: 73
124
- }
125
- }), rationale && hasText(rationale) && React.createElement('div', {
126
- className: classes.collapsible,
127
- __self: this,
128
- __source: {
129
- fileName: _jsxFileName,
130
- lineNumber: 76
131
- }
132
- }, React.createElement(Collapsible, {
133
- labels: {
134
- hidden: 'Show Rationale',
135
- visible: 'Hide Rationale'
136
- },
137
- __self: this,
138
- __source: {
139
- fileName: _jsxFileName,
140
- lineNumber: 77
141
- }
142
- }, React.createElement('div', {
143
- dangerouslySetInnerHTML: {
144
- __html: rationale
145
- },
146
- __self: this,
147
- __source: {
148
- fileName: _jsxFileName,
149
- lineNumber: 80
150
- }
151
- }))), React.createElement(ConstructedResponse, {
152
- ...this.props,
153
- onChange: this.onChange,
154
- showCorrectAnswer: showCorrectAnswer,
155
- value: value,
156
- __self: this,
157
- __source: {
158
- fileName: _jsxFileName,
159
- lineNumber: 85
160
- }
161
- }));
162
- }
163
- }
164
- Main.__initStatic();
165
- Main.__initStatic2();
166
- const styles = theme => ({
167
- mainContainer: {
168
- padding: theme.spacing.unit,
169
- color: color.text(),
170
- backgroundColor: color.background()
171
- },
172
- collapsible: {
173
- margin: `${theme.spacing.unit * 2} 0`
174
- }
175
- });
176
- var Main$1 = withStyles(styles)(Main);
177
- const React$1 = _dll_react;
178
- const ReactDOM = _dll_react_dom;
179
- const {ModelSetEvent: ModelSetEvent} = _dll_pie_framework__pie_player_events;
180
- const {SessionChangedEvent: SessionChangedEvent} = _dll_pie_framework__pie_player_events;
181
- const {renderMath: renderMath} = _dll_pie_lib__math_rendering;
182
- class InlineDropdown extends HTMLElement {
183
- constructor() {
184
- super();
185
- InlineDropdown.prototype.__init.call(this);
186
- InlineDropdown.prototype.__init2.call(this);
187
- InlineDropdown.prototype.__init3.call(this);
188
- this._model = null;
189
- this._session = null;
190
- }
191
- set model(m) {
192
- this._model = m;
193
- this.dispatchEvent(new ModelSetEvent(this.tagName.toLowerCase(), this.session && !!this.session.value, !!this._model));
194
- this._render();
195
- }
196
- set session(s) {
197
- this._session = s;
198
- this._render();
199
- }
200
- get session() {
201
- return this._session;
202
- }
203
- __init() {
204
- this._render = () => {
205
- if (this._model && this._session) {
206
- let elem = React$1.createElement(Main$1, {
207
- teacherInstructions: this._model.teacherInstructions,
208
- prompt: this._model.prompt,
209
- rationale: this._model.rationale,
210
- disabled: this._model.disabled,
211
- choices: this._model.choices,
212
- markup: this._model.markup,
213
- mode: this._model.mode,
214
- value: this._session.value,
215
- feedback: this._model.feedback,
216
- onChange: this.changeSession
217
- });
218
- ReactDOM.render(elem, this, () => {
219
- renderMath(this);
220
- });
221
- }
222
- };
223
- }
224
- __init2() {
225
- this.dispatchChangedEvent = () => {
226
- this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), this.session && !!this.session.value));
227
- };
228
- }
229
- __init3() {
230
- this.changeSession = value => {
231
- this.session.value = value;
232
- this.dispatchChangedEvent();
233
- this._render();
234
- };
235
- }
236
- connectedCallback() {
237
- this._render();
238
- }
239
- }
240
- export default InlineDropdown;
package/module/index.html DELETED
@@ -1,16 +0,0 @@
1
-
2
- <!doctype html>
3
- <html>
4
- <head>
5
- <title>@pie-element/explicit-constructed-response@3.7.9</title>
6
- <link
7
- href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
8
- rel="stylesheet"
9
- />
10
- <script
11
- type="module"
12
- src="https://unpkg.com/@pslb/demo-el@^1.0.0/dist/demo-el/demo-el.esm.js"></script>
13
- <script type="module" src="./demo.js"></script>
14
- </head>
15
- <body></body>
16
- </html>
@@ -1,10 +0,0 @@
1
- {
2
- "name": "@pie-element/explicit-constructed-response",
3
- "version": "3.7.9",
4
- "modules": [
5
- {
6
- "name": "@pie-ui/shared-lib",
7
- "version": "^4.3.3"
8
- }
9
- ]
10
- }