@pie-element/select-text 6.5.19 → 6.5.20-beta.1443
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.md +377 -0
- package/configure/CHANGELOG.md +348 -0
- package/configure/lib/defaultConfiguration.js +20 -0
- package/configure/lib/defaultConfiguration.js.map +1 -1
- package/configure/lib/design.js +138 -65
- package/configure/lib/design.js.map +1 -1
- package/configure/lib/index.js +18 -8
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/utils.js +118 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +6 -6
- package/controller/CHANGELOG.md +155 -0
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +37 -4
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +4 -4
- package/docs/config-schema.json +115 -0
- package/docs/config-schema.json.md +89 -1
- package/docs/demo/config.js +2 -4
- package/docs/demo/generate.js +199 -90
- package/docs/demo/session.js +19 -6
- package/docs/pie-schema.json +33 -0
- package/docs/pie-schema.json.md +24 -0
- package/lib/index.js +50 -2
- package/lib/index.js.map +1 -1
- package/lib/main.js +43 -32
- package/lib/main.js.map +1 -1
- package/lib/print.js +124 -0
- package/lib/print.js.map +1 -0
- package/lib/utils.js +106 -0
- package/lib/utils.js.map +1 -0
- package/package.json +11 -7
package/docs/demo/generate.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
const tokens = () => [
|
|
2
2
|
{
|
|
3
|
-
text:
|
|
3
|
+
text: "If 'tweren't for sight and sound and smell,",
|
|
4
4
|
start: 0,
|
|
5
|
-
end: 43
|
|
5
|
+
end: 43,
|
|
6
6
|
},
|
|
7
7
|
{
|
|
8
|
-
text:
|
|
8
|
+
text: "I'd like the city pretty well,",
|
|
9
9
|
start: 44,
|
|
10
|
-
end: 74
|
|
10
|
+
end: 74,
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
13
|
text: 'But when it comes to getting rest,',
|
|
14
14
|
start: 75,
|
|
15
|
-
end: 109
|
|
15
|
+
end: 109,
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
text: 'I like the country lots the best.',
|
|
19
19
|
start: 110,
|
|
20
|
-
end: 143
|
|
20
|
+
end: 143,
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
text: 'Sometimes it seems to me I must',
|
|
24
24
|
start: 145,
|
|
25
|
-
end: 176
|
|
25
|
+
end: 176,
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
|
-
text:
|
|
28
|
+
text: "Just quit the city's din and dust,",
|
|
29
29
|
start: 177,
|
|
30
|
-
end: 211
|
|
30
|
+
end: 211,
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
text: 'And get out where the sky is blue,',
|
|
34
34
|
start: 212,
|
|
35
|
-
end: 246
|
|
35
|
+
end: 246,
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
38
|
text: 'And say, now, how does it seem to you?',
|
|
39
39
|
start: 247,
|
|
40
|
-
end: 285
|
|
41
|
-
}
|
|
40
|
+
end: 285,
|
|
41
|
+
},
|
|
42
42
|
];
|
|
43
43
|
|
|
44
44
|
const mathSampleText =
|
|
@@ -48,30 +48,32 @@ const mathSampleTokens = [
|
|
|
48
48
|
{
|
|
49
49
|
start: 583,
|
|
50
50
|
end: 1465,
|
|
51
|
-
text: '<span class="lrn_token"><math xmlns="http://www.w3.org/1998/Math/MathML">\n <mstyle displaystyle="true">\n <mrow>\n <mo>[</mo>\n <mn>6</mn>\n <mi>x</mi>\n <mrow>\n <mo>(</mo>\n <mo>-</mo>\n <msup>\n <mi>x</mi>\n <mn>2</mn>\n </msup>\n <mo>+</mo>\n <mn>3</mn>\n <mi>x</mi>\n <mo>-</mo>\n <mn>1</mn>\n <mo>)</mo>\n </mrow>\n <mo>+</mo>\n <mn>2</mn>\n <mrow>\n <mo>(</mo>\n <mo>-</mo>\n <msup>\n <mi>x</mi>\n <mn>2</mn>\n </msup>\n <mo>+</mo>\n <mn>3</mn>\n <mi>x</mi>\n <mo>-</mo>\n <mn>1</mn>\n <mo>)</mo>\n </mrow>\n <mo>]</mo>\n </mrow>\n <mrow>\n <mo>(</mo>\n <msup>\n <mi>x</mi>\n <mn>2</mn>\n </msup>\n <mo>)</mo>\n </mrow>\n </mstyle>\n</math></span>',
|
|
51
|
+
text: '<span class="lrn_token"><math xmlns="http://www.w3.org/1998/Math/MathML">\n <mstyle displaystyle="true">\n <mrow>\n <mo>[</mo>\n <mn>6</mn>\n <mi>x</mi>\n <mrow>\n <mo>(</mo>\n <mo>-</mo>\n <msup>\n <mi>x</mi>\n <mn>2</mn>\n </msup>\n <mo>+</mo>\n <mn>3</mn>\n <mi>x</mi>\n <mo>-</mo>\n <mn>1</mn>\n <mo>)</mo>\n </mrow>\n <mo>+</mo>\n <mn>2</mn>\n <mrow>\n <mo>(</mo>\n <mo>-</mo>\n <msup>\n <mi>x</mi>\n <mn>2</mn>\n </msup>\n <mo>+</mo>\n <mn>3</mn>\n <mi>x</mi>\n <mo>-</mo>\n <mn>1</mn>\n <mo>)</mo>\n </mrow>\n <mo>]</mo>\n </mrow>\n <mrow>\n <mo>(</mo>\n <msup>\n <mi>x</mi>\n <mn>2</mn>\n </msup>\n <mo>)</mo>\n </mrow>\n </mstyle>\n</math></span>',
|
|
52
|
+
correct: true,
|
|
53
|
+
},
|
|
52
54
|
{ start: 1474, end: 2218 },
|
|
53
55
|
{ start: 2227, end: 2797 },
|
|
54
|
-
{ start: 2806, end: 3112 }
|
|
56
|
+
{ start: 2806, end: 3112 },
|
|
55
57
|
];
|
|
56
58
|
|
|
57
|
-
const base = extras =>
|
|
59
|
+
const base = (extras) =>
|
|
58
60
|
Object.assign(
|
|
59
61
|
{},
|
|
60
62
|
{
|
|
61
|
-
highlightChoices: true,
|
|
63
|
+
// highlightChoices: true,
|
|
62
64
|
feedback: {
|
|
63
65
|
correct: {
|
|
64
66
|
type: 'default',
|
|
65
|
-
default: 'Correct'
|
|
67
|
+
default: 'Correct',
|
|
66
68
|
},
|
|
67
69
|
incorrect: {
|
|
68
70
|
type: 'default',
|
|
69
|
-
default: 'Incorrect'
|
|
71
|
+
default: 'Incorrect',
|
|
70
72
|
},
|
|
71
73
|
partial: {
|
|
72
74
|
type: 'default',
|
|
73
|
-
default: 'Nearly'
|
|
74
|
-
}
|
|
75
|
+
default: 'Nearly',
|
|
76
|
+
},
|
|
75
77
|
},
|
|
76
78
|
partialScoring: false,
|
|
77
79
|
maxSelections: 2,
|
|
@@ -92,10 +94,10 @@ And get out where the sky is blue,<br />
|
|
|
92
94
|
And say, now, how does it seem to you?</p>`,
|
|
93
95
|
tokens: tokens(),
|
|
94
96
|
},
|
|
95
|
-
extras
|
|
97
|
+
extras,
|
|
96
98
|
);
|
|
97
99
|
|
|
98
|
-
const mathSample = extras => {
|
|
100
|
+
const mathSample = (extras) => {
|
|
99
101
|
return Object.assign(
|
|
100
102
|
{},
|
|
101
103
|
{
|
|
@@ -103,16 +105,16 @@ const mathSample = extras => {
|
|
|
103
105
|
feedback: {
|
|
104
106
|
correct: {
|
|
105
107
|
type: 'default',
|
|
106
|
-
default: 'Correct'
|
|
108
|
+
default: 'Correct',
|
|
107
109
|
},
|
|
108
110
|
incorrect: {
|
|
109
111
|
type: 'default',
|
|
110
|
-
default: 'Incorrect'
|
|
112
|
+
default: 'Incorrect',
|
|
111
113
|
},
|
|
112
114
|
partial: {
|
|
113
115
|
type: 'default',
|
|
114
|
-
default: 'Nearly'
|
|
115
|
-
}
|
|
116
|
+
default: 'Nearly',
|
|
117
|
+
},
|
|
116
118
|
},
|
|
117
119
|
partialScoring: false,
|
|
118
120
|
maxSelections: 2,
|
|
@@ -128,84 +130,191 @@ And get out where the sky is blue,<br />
|
|
|
128
130
|
And say, now, how does it seem to you?</p>`,
|
|
129
131
|
tokens: mathSampleTokens,
|
|
130
132
|
},
|
|
131
|
-
extras
|
|
133
|
+
extras,
|
|
132
134
|
);
|
|
133
135
|
};
|
|
134
136
|
|
|
135
|
-
exports.model = (id, element) => {
|
|
136
|
-
return Object.assign({}, { id, element }, base({}));
|
|
137
|
-
};
|
|
138
|
-
|
|
139
137
|
exports.mathSample = (id, element) => {
|
|
140
138
|
return Object.assign({}, { id, element }, mathSample({}));
|
|
141
139
|
};
|
|
142
140
|
|
|
143
141
|
exports.htmlSample = (id, element) => {
|
|
144
|
-
return Object.assign(
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
142
|
+
return Object.assign(
|
|
143
|
+
{},
|
|
144
|
+
{ id, element },
|
|
145
|
+
{
|
|
146
|
+
highlightChoices: true,
|
|
147
|
+
feedback: {
|
|
148
|
+
correct: {
|
|
149
|
+
type: 'default',
|
|
150
|
+
default: 'Correct',
|
|
151
|
+
},
|
|
152
|
+
incorrect: {
|
|
153
|
+
type: 'default',
|
|
154
|
+
default: 'Incorrect',
|
|
155
|
+
},
|
|
156
|
+
partial: {
|
|
157
|
+
type: 'default',
|
|
158
|
+
default: 'Nearly',
|
|
159
|
+
},
|
|
154
160
|
},
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
161
|
+
partialScoring: false,
|
|
162
|
+
text: '<p style=\'padding: 20px\'>A flicker and then gone. In its wake, only <span class="lrn_token">the after-echo of a distant high-pitched ringing that vibrated through him even as it returned to silence once again</span>, as he stared into the smiling faces of the crew and told himself that yes he was meant to be here, that <span class="lrn_token">it had been his destiny to succeed and so he had succeeded</span>, the sense of panic already replaced by the pride of his accomplishment, replaced so completely that he would not remember that flicker, would not allow himself to remember, <span class="lrn_token">even after everything else had happened</span>. In his memory of that moment, <span class="lrn_token">he was an astronaut and they were welcoming him aboard the space station</span>. And in his memory he was smiling. Is this not what he was meant to do? Is the answer not as fixed and indisputable as any equation he might have been tasked to solve?</p>\n',
|
|
163
|
+
prompt:
|
|
164
|
+
'<p>Select the <span class="relative-emphasis">one</span> phrase below that suggests that in the future, Keith may interpret this moment differently.</p>',
|
|
165
|
+
maxSelections: 2,
|
|
166
|
+
mode: 'sentence',
|
|
167
|
+
rationale: 'Rationale goes here.',
|
|
168
|
+
tokens: [
|
|
169
|
+
{
|
|
170
|
+
correct: false,
|
|
171
|
+
start: 67,
|
|
172
|
+
end: 215,
|
|
173
|
+
text: '<span class="lrn_token">the after-echo of a distant high-pitched ringing that vibrated through him even as it returned to silence once again</span>',
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
correct: false,
|
|
177
|
+
start: 321,
|
|
178
|
+
end: 410,
|
|
179
|
+
text: '<span class="lrn_token">it had been his destiny to succeed and so he had succeeded</span>',
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
correct: true,
|
|
183
|
+
start: 585,
|
|
184
|
+
end: 655,
|
|
185
|
+
text: '<span class="lrn_token">even after everything else had happened</span>',
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
correct: false,
|
|
189
|
+
start: 687,
|
|
190
|
+
end: 790,
|
|
191
|
+
text: '<span class="lrn_token">he was an astronaut and they were welcoming him aboard the space station</span>',
|
|
192
|
+
},
|
|
193
|
+
],
|
|
159
194
|
},
|
|
160
|
-
|
|
161
|
-
text: '<p style=\'padding: 20px\'>A flicker and then gone. In its wake, only <span class="lrn_token">the after-echo of a distant high-pitched ringing that vibrated through him even as it returned to silence once again</span>, as he stared into the smiling faces of the crew and told himself that yes he was meant to be here, that <span class="lrn_token">it had been his destiny to succeed and so he had succeeded</span>, the sense of panic already replaced by the pride of his accomplishment, replaced so completely that he would not remember that flicker, would not allow himself to remember, <span class="lrn_token">even after everything else had happened</span>. In his memory of that moment, <span class="lrn_token">he was an astronaut and they were welcoming him aboard the space station</span>. And in his memory he was smiling. Is this not what he was meant to do? Is the answer not as fixed and indisputable as any equation he might have been tasked to solve?</p>\n',
|
|
162
|
-
prompt: '<p>Select the <span class="relative-emphasis">one</span> phrase below that suggests that in the future, Keith may interpret this moment differently.</p>',
|
|
163
|
-
maxSelections: 2,
|
|
164
|
-
mode: 'sentence',
|
|
165
|
-
rationale: 'Rationale goes here.',
|
|
166
|
-
tokens: [
|
|
167
|
-
{
|
|
168
|
-
correct: false,
|
|
169
|
-
start: 67,
|
|
170
|
-
end: 215,
|
|
171
|
-
text: '<span class="lrn_token">the after-echo of a distant high-pitched ringing that vibrated through him even as it returned to silence once again</span>'
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
correct: false,
|
|
175
|
-
start: 321,
|
|
176
|
-
end: 410,
|
|
177
|
-
text: '<span class="lrn_token">it had been his destiny to succeed and so he had succeeded</span>'
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
correct: true,
|
|
181
|
-
start: 585,
|
|
182
|
-
end: 655,
|
|
183
|
-
text: '<span class="lrn_token">even after everything else had happened</span>'
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
correct: false,
|
|
187
|
-
start: 687,
|
|
188
|
-
end: 790,
|
|
189
|
-
text: '<span class="lrn_token">he was an astronaut and they were welcoming him aboard the space station</span>'
|
|
190
|
-
}
|
|
191
|
-
],
|
|
192
|
-
});
|
|
195
|
+
);
|
|
193
196
|
};
|
|
194
197
|
|
|
195
198
|
exports.htmlAscii = (id, element) => ({
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
199
|
+
id,
|
|
200
|
+
element,
|
|
201
|
+
highlightChoices: true,
|
|
202
|
+
prompt: 'Select the parts that have references for Lucy',
|
|
203
|
+
text: '<p>“Lucy? Are you using your time wisely to plan your project?” Mr. Wilson asked.</p><p> Lucy looked a little confused at first.</p>',
|
|
204
|
+
tokens: [
|
|
205
|
+
{
|
|
202
206
|
start: 10,
|
|
203
207
|
end: 68,
|
|
204
|
-
text: 'Lucy? Are you using your time wisely to plan your project?'
|
|
205
|
-
},
|
|
208
|
+
text: 'Lucy? Are you using your time wisely to plan your project?',
|
|
209
|
+
},
|
|
210
|
+
{
|
|
206
211
|
start: 106,
|
|
207
212
|
end: 145,
|
|
208
|
-
text: 'Lucy looked a little confused at first.'
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
);
|
|
213
|
+
text: 'Lucy looked a little confused at first.',
|
|
214
|
+
},
|
|
215
|
+
],
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
const simpleItem = {
|
|
219
|
+
text: 'A. Almost never\n\nB. Once in a while\n\nC. Sometimes\n\nD. Often\n\nE. Almost all the time',
|
|
220
|
+
tokens: [
|
|
221
|
+
{
|
|
222
|
+
text: 'A. Almost never',
|
|
223
|
+
end: 15,
|
|
224
|
+
start: 0,
|
|
225
|
+
correct: true,
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
start: 17,
|
|
229
|
+
end: 35,
|
|
230
|
+
correct: false,
|
|
231
|
+
text: 'B. Once in a while',
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
correct: false,
|
|
235
|
+
end: 49,
|
|
236
|
+
start: 37,
|
|
237
|
+
text: 'C. Sometimes',
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
text: 'D. Often',
|
|
241
|
+
correct: false,
|
|
242
|
+
end: 59,
|
|
243
|
+
start: 51,
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
start: 61,
|
|
247
|
+
correct: false,
|
|
248
|
+
end: 83,
|
|
249
|
+
text: 'E. Almost all the time',
|
|
250
|
+
},
|
|
251
|
+
],
|
|
252
|
+
rationale: '<p>answers vary</p>',
|
|
253
|
+
partialScoring: true,
|
|
254
|
+
teacherInstructions: '',
|
|
255
|
+
prompt: '<p>I got my work done right away instead of waiting until the last minute.</p>',
|
|
256
|
+
maxSelections: 1,
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
exports.model = (id, element) => {
|
|
260
|
+
return Object.assign(
|
|
261
|
+
{},
|
|
262
|
+
{ id, element },
|
|
263
|
+
base({
|
|
264
|
+
// "id": "8a808081701d693801703174fb900421",
|
|
265
|
+
teacherInstructions: '',
|
|
266
|
+
partialScoring: true,
|
|
267
|
+
prompt:
|
|
268
|
+
'<p>Select the sentence from "The Gymnast" that <span class="relative-emphasis">best</span> represents the theme.</p>',
|
|
269
|
+
rationale:
|
|
270
|
+
'<p>The final sentence of the passage best exemplifies the theme of the short story because Natasha's practice and determination finally pays off.</p>',
|
|
271
|
+
tokens: [
|
|
272
|
+
{
|
|
273
|
+
text: 'She thought about what she had to do, struggling to rein in her wild, fearful thoughts.',
|
|
274
|
+
end: 90,
|
|
275
|
+
start: 3,
|
|
276
|
+
correct: false,
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
start: 449,
|
|
280
|
+
end: 585,
|
|
281
|
+
text: 'Just for a hair of a moment, Natasha wondered if she really wanted a perfect 10, so weary was she of trying for but never achieving one.',
|
|
282
|
+
correct: false,
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
end: 627,
|
|
286
|
+
correct: false,
|
|
287
|
+
text: "At last Natasha's moment arrived.",
|
|
288
|
+
start: 594,
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
end: 743,
|
|
292
|
+
text: "The faces of past giants of gymnastics swam before her mind's eye, now razor–sharp with fierce determination.",
|
|
293
|
+
correct: false,
|
|
294
|
+
start: 628,
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
text: 'Suddenly, the din of the gymnasium was silent to her.',
|
|
298
|
+
end: 997,
|
|
299
|
+
correct: false,
|
|
300
|
+
start: 944,
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
end: 1087,
|
|
304
|
+
start: 998,
|
|
305
|
+
correct: false,
|
|
306
|
+
text: 'Forcing all sound out of her mind, she focused on the gleaming balance beam ahead of her.',
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
correct: true,
|
|
310
|
+
start: 1088,
|
|
311
|
+
end: 1225,
|
|
312
|
+
text: 'Taking a deep breath, Natasha made her graceful, yet powerful approach, mounted the beam flawlessly, and...executed her first perfect 10.',
|
|
313
|
+
},
|
|
314
|
+
],
|
|
315
|
+
// "element": "select-text",
|
|
316
|
+
text: "<p>She thought about what she had to do, struggling to rein in her wild, fearful thoughts. Coach Cummings always said that an undisciplined mind never scored a perfect 10. Natasha wanted to please her Coach, yet sometimes his approval wasn't as exciting as his anger. The gymnasts were unanimous about one thing: Coach Cummings's fits of disapproving rage were much more humorous to witness than his infrequent, backslapping moments of high praise. Just for a hair of a moment, Natasha wondered if she really wanted a perfect 10, so weary was she of trying for but never achieving one.</p>\n\n<p>At last Natasha's moment arrived. The faces of past giants of gymnastics swam before her mind's eye, now razor–sharp with fierce determination. \"I am talented. I am not afraid. I will make a perfect 10,\" she spoke aloud to herself, as she approached the mat, dusted her hands with chalk to prevent slippage, and returned to her starting point. Suddenly, the din of the gymnasium was silent to her. Forcing all sound out of her mind, she focused on the gleaming balance beam ahead of her. Taking a deep breath, Natasha made her graceful, yet powerful approach, mounted the beam flawlessly, and...executed her first perfect 10.</p>\n",
|
|
317
|
+
rubricEnabled: false,
|
|
318
|
+
}),
|
|
319
|
+
);
|
|
320
|
+
};
|
package/docs/demo/session.js
CHANGED
|
@@ -2,10 +2,23 @@ module.exports = [
|
|
|
2
2
|
{
|
|
3
3
|
id: '1',
|
|
4
4
|
element: 'select-text',
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
selectedTokens: [
|
|
6
|
+
// { start: 0, end: 36 },
|
|
7
|
+
// { start: 37, end: 74 },
|
|
8
|
+
// { start: 117, end: 177 }
|
|
9
|
+
// {
|
|
10
|
+
// // "correct": true,
|
|
11
|
+
// "start": 1088,
|
|
12
|
+
// "end": 1225,
|
|
13
|
+
// "text": "Taking a deep breath, Natasha made her graceful, yet powerful approach, mounted the beam flawlessly, and...executed her first perfect 10."
|
|
14
|
+
// },
|
|
15
|
+
// {
|
|
16
|
+
// "start": 1082,
|
|
17
|
+
// "end": 1219,
|
|
18
|
+
// "text": "Taking a deep breath, Natasha made her graceful, yet powerful approach, mounted the beam flawlessly, and...executed her first perfect 10.",
|
|
19
|
+
// "oldStart": 1088,
|
|
20
|
+
// "oldEnd": 1225
|
|
21
|
+
// }
|
|
22
|
+
],
|
|
23
|
+
},
|
|
11
24
|
];
|
package/docs/pie-schema.json
CHANGED
|
@@ -289,6 +289,11 @@
|
|
|
289
289
|
"type": "boolean",
|
|
290
290
|
"title": "teacherInstructionsEnabled"
|
|
291
291
|
},
|
|
292
|
+
"spellCheckEnabled": {
|
|
293
|
+
"description": "Indicates if spellcheck is enabled",
|
|
294
|
+
"type": "boolean",
|
|
295
|
+
"title": "spellCheckEnabled"
|
|
296
|
+
},
|
|
292
297
|
"toolbarEditorPosition": {
|
|
293
298
|
"description": "Indicates the editor's toolbar position which can be 'bottom' or 'top'",
|
|
294
299
|
"default": ": 'bottom'",
|
|
@@ -299,6 +304,11 @@
|
|
|
299
304
|
"type": "string",
|
|
300
305
|
"title": "toolbarEditorPosition"
|
|
301
306
|
},
|
|
307
|
+
"rubricEnabled": {
|
|
308
|
+
"description": "Indicates if Rubric is enabled",
|
|
309
|
+
"type": "boolean",
|
|
310
|
+
"title": "rubricEnabled"
|
|
311
|
+
},
|
|
302
312
|
"id": {
|
|
303
313
|
"description": "Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.",
|
|
304
314
|
"type": "string",
|
|
@@ -316,6 +326,8 @@
|
|
|
316
326
|
"id",
|
|
317
327
|
"prompt",
|
|
318
328
|
"rationaleEnabled",
|
|
329
|
+
"rubricEnabled",
|
|
330
|
+
"spellCheckEnabled",
|
|
319
331
|
"studentInstructionsEnabled",
|
|
320
332
|
"teacherInstructionsEnabled",
|
|
321
333
|
"text",
|
|
@@ -338,6 +350,27 @@
|
|
|
338
350
|
}
|
|
339
351
|
}
|
|
340
352
|
},
|
|
353
|
+
"ConfigureMaxImageDimensionsProp": {
|
|
354
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
355
|
+
"type": "object",
|
|
356
|
+
"properties": {
|
|
357
|
+
"teacherInstructions": {
|
|
358
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
359
|
+
"type": "number",
|
|
360
|
+
"title": "teacherInstructions"
|
|
361
|
+
},
|
|
362
|
+
"prompt": {
|
|
363
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
364
|
+
"type": "number",
|
|
365
|
+
"title": "prompt"
|
|
366
|
+
},
|
|
367
|
+
"rationale": {
|
|
368
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
369
|
+
"type": "number",
|
|
370
|
+
"title": "rationale"
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
},
|
|
341
374
|
"ComplexFeedbackType": {
|
|
342
375
|
"title": "ComplexFeedbackType",
|
|
343
376
|
"type": "object",
|
package/docs/pie-schema.json.md
CHANGED
|
@@ -117,6 +117,10 @@ Indicates if Student Instructions are enabled
|
|
|
117
117
|
|
|
118
118
|
Indicates if Teacher Instructions are enabled
|
|
119
119
|
|
|
120
|
+
# `spellCheckEnabled` (boolean, required)
|
|
121
|
+
|
|
122
|
+
Indicates if spellcheck is enabled
|
|
123
|
+
|
|
120
124
|
# `toolbarEditorPosition` (string, enum)
|
|
121
125
|
|
|
122
126
|
Indicates the editor's toolbar position which can be 'bottom' or 'top'
|
|
@@ -128,6 +132,10 @@ This element must be one of the following enum values:
|
|
|
128
132
|
|
|
129
133
|
Default: `": 'bottom'"`
|
|
130
134
|
|
|
135
|
+
# `rubricEnabled` (boolean, required)
|
|
136
|
+
|
|
137
|
+
Indicates if Rubric is enabled
|
|
138
|
+
|
|
131
139
|
# `id` (string, required)
|
|
132
140
|
|
|
133
141
|
Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.
|
|
@@ -154,6 +162,22 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
154
162
|
|
|
155
163
|
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
156
164
|
|
|
165
|
+
## `ConfigureMaxImageDimensionsProp` (object)
|
|
166
|
+
|
|
167
|
+
Properties of the `ConfigureMaxImageDimensionsProp` object:
|
|
168
|
+
|
|
169
|
+
### `teacherInstructions` (number)
|
|
170
|
+
|
|
171
|
+
Indicates the max dimension for images in teacher instructions
|
|
172
|
+
|
|
173
|
+
### `prompt` (number)
|
|
174
|
+
|
|
175
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
176
|
+
|
|
177
|
+
### `rationale` (number)
|
|
178
|
+
|
|
179
|
+
Indicates the max dimension for images in rationale
|
|
180
|
+
|
|
157
181
|
## `ComplexFeedbackType` (object)
|
|
158
182
|
|
|
159
183
|
Properties of the `ComplexFeedbackType` object:
|
package/lib/index.js
CHANGED
|
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports["default"] = void 0;
|
|
9
9
|
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
10
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
13
|
|
|
12
14
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
@@ -29,6 +31,12 @@ var _main = _interopRequireDefault(require("./main"));
|
|
|
29
31
|
|
|
30
32
|
var _mathRendering = require("@pie-lib/math-rendering");
|
|
31
33
|
|
|
34
|
+
var _utils = _interopRequireDefault(require("./utils"));
|
|
35
|
+
|
|
36
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
37
|
+
|
|
38
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
39
|
+
|
|
32
40
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
33
41
|
|
|
34
42
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
@@ -52,9 +60,49 @@ var SelectText = /*#__PURE__*/function (_HTMLElement) {
|
|
|
52
60
|
}
|
|
53
61
|
}, {
|
|
54
62
|
key: "session",
|
|
63
|
+
get: function get() {
|
|
64
|
+
return this._session;
|
|
65
|
+
},
|
|
55
66
|
set: function set(s) {
|
|
56
67
|
this._session = s;
|
|
57
68
|
|
|
69
|
+
if (this._model) {
|
|
70
|
+
var generatedModel = (0, _utils["default"])(this._model) || {};
|
|
71
|
+
var tokens = generatedModel.tokens;
|
|
72
|
+
|
|
73
|
+
var _ref = s || {},
|
|
74
|
+
selectedTokens = _ref.selectedTokens;
|
|
75
|
+
|
|
76
|
+
selectedTokens = selectedTokens || []; // This case was introduced mostly for createCorrectSession:
|
|
77
|
+
// make sure initial session tokens are parsed and have correct start and end (according to the regenerated model)
|
|
78
|
+
|
|
79
|
+
var selectedTokenExistsInGeneratedTokens = function selectedTokenExistsInGeneratedTokens(s) {
|
|
80
|
+
return tokens.find(function (_ref2) {
|
|
81
|
+
var tStart = _ref2.start,
|
|
82
|
+
tEnd = _ref2.end;
|
|
83
|
+
return s.start === tStart && s.end === tEnd;
|
|
84
|
+
});
|
|
85
|
+
}; // check if ALL the selectedTokens have the correct start and end
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
var allAreCorrect = selectedTokens.reduce(function (acc, selectedToken) {
|
|
89
|
+
return acc && selectedTokenExistsInGeneratedTokens(selectedToken);
|
|
90
|
+
}, true);
|
|
91
|
+
|
|
92
|
+
if (!allAreCorrect) {
|
|
93
|
+
// otherwise, make sure to parse selectedTokens as well
|
|
94
|
+
var _generatedModel = (0, _utils["default"])(_objectSpread(_objectSpread({}, this._model), {}, {
|
|
95
|
+
tokens: selectedTokens
|
|
96
|
+
})) || {};
|
|
97
|
+
|
|
98
|
+
var _tokens = _generatedModel.tokens;
|
|
99
|
+
|
|
100
|
+
if (_tokens) {
|
|
101
|
+
this._session.selectedTokens = _tokens;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
58
106
|
if (!Array.isArray(this._session.selectedTokens)) {
|
|
59
107
|
this._session.selectedTokens = [];
|
|
60
108
|
}
|
|
@@ -64,8 +112,8 @@ var SelectText = /*#__PURE__*/function (_HTMLElement) {
|
|
|
64
112
|
}, {
|
|
65
113
|
key: "isSessionComplete",
|
|
66
114
|
value: function isSessionComplete() {
|
|
67
|
-
var
|
|
68
|
-
selectedTokens =
|
|
115
|
+
var _ref3 = this._session || {},
|
|
116
|
+
selectedTokens = _ref3.selectedTokens;
|
|
69
117
|
|
|
70
118
|
return Array.isArray(selectedTokens) && selectedTokens.length > 0;
|
|
71
119
|
}
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["SelectText","m","_model","render","dispatchEvent","ModelSetEvent","tagName","toLowerCase","isSessionComplete","undefined","
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["SelectText","m","_model","render","dispatchEvent","ModelSetEvent","tagName","toLowerCase","isSessionComplete","undefined","_session","s","generatedModel","tokens","selectedTokens","selectedTokenExistsInGeneratedTokens","find","tStart","start","tEnd","end","allAreCorrect","reduce","acc","selectedToken","Array","isArray","length","selection","SessionChangedEvent","el","React","createElement","Main","model","session","onSelectionChange","selectionChanged","bind","ReactDOM","HTMLElement"],"mappings":"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","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport { SessionChangedEvent, ModelSetEvent } from '@pie-framework/pie-player-events';\nimport Main from './main';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport generateModel from './utils';\n\nexport default class SelectText extends HTMLElement {\n constructor() {\n super();\n }\n\n set model(m) {\n this._model = m;\n\n this.render();\n this.dispatchEvent(\n new ModelSetEvent(this.tagName.toLowerCase(), this.isSessionComplete(), this._model !== undefined),\n );\n }\n\n set session(s) {\n this._session = s;\n\n if (this._model) {\n const generatedModel = generateModel(this._model) || {};\n const { tokens } = generatedModel;\n let { selectedTokens } = s || {};\n\n selectedTokens = selectedTokens || [];\n\n // This case was introduced mostly for createCorrectSession:\n // make sure initial session tokens are parsed and have correct start and end (according to the regenerated model)\n const selectedTokenExistsInGeneratedTokens = (s) =>\n tokens.find(({ start: tStart, end: tEnd }) => s.start === tStart && s.end === tEnd);\n\n // check if ALL the selectedTokens have the correct start and end\n const allAreCorrect = selectedTokens.reduce(\n (acc, selectedToken) => acc && selectedTokenExistsInGeneratedTokens(selectedToken),\n true,\n );\n\n if (!allAreCorrect) {\n // otherwise, make sure to parse selectedTokens as well\n const generatedModel = generateModel({ ...this._model, tokens: selectedTokens }) || {};\n const { tokens } = generatedModel;\n\n if (tokens) {\n this._session.selectedTokens = tokens;\n }\n }\n }\n\n if (!Array.isArray(this._session.selectedTokens)) {\n this._session.selectedTokens = [];\n }\n this.render();\n }\n\n get session() {\n return this._session;\n }\n\n isSessionComplete() {\n const { selectedTokens } = this._session || {};\n return Array.isArray(selectedTokens) && selectedTokens.length > 0;\n }\n\n selectionChanged(selection) {\n this._session.selectedTokens = selection;\n\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), this.isSessionComplete()));\n }\n\n connectedCallback() {\n this.render();\n }\n\n render() {\n if (this._model && this._session) {\n const el = React.createElement(Main, {\n model: this._model,\n session: this._session,\n onSelectionChange: this.selectionChanged.bind(this),\n });\n\n ReactDOM.render(el, this, () => {\n renderMath(this);\n });\n }\n }\n}\n"],"file":"index.js"}
|