@pie-element/math-inline 5.6.4-next.770 → 5.6.4-next.772
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/configure/package.json +4 -4
- package/module/element.js +3708 -15
- package/module/print.js +3708 -15
- package/package.json +4 -4
package/module/print.js
CHANGED
|
@@ -1,17 +1,3713 @@
|
|
|
1
|
-
import {_dll_react,
|
|
1
|
+
import {_dll_lodash, _dll_react, _dll_prop_types, _dll_material_ui__core_styles, _dll_debug, _dll_classnames, _dll_material_ui__core, _dll_material_ui__core_styles_color_manipulator, _dll_pie_lib__render_ui, _dll_material_ui__icons, _dll_pie_lib__correct_answer_toggle, _dll_react_dom} from "../../../@pie-lib/shared-module@^1.4.9/module/index.js";
|
|
2
2
|
import {_dll_pie_lib__math_rendering} from "../../../@pie-lib/math-rendering-module@^1.0.34/module/index.js";
|
|
3
|
-
import {
|
|
3
|
+
import {_dll_pie_framework__mathquill} from "../../../@pie-lib/math-edit-module@^1.1.30/module/index.js";
|
|
4
|
+
const set$v = o => ({
|
|
5
|
+
...o,
|
|
6
|
+
category: 'comparison'
|
|
7
|
+
});
|
|
8
|
+
const lessThan$1 = set$v({
|
|
9
|
+
name: 'Less than',
|
|
10
|
+
latex: '<',
|
|
11
|
+
command: '\\lt'
|
|
12
|
+
});
|
|
13
|
+
const greaterThan$1 = set$v({
|
|
14
|
+
name: 'Greater than',
|
|
15
|
+
latex: '>',
|
|
16
|
+
command: '\\gt'
|
|
17
|
+
});
|
|
18
|
+
const lessThanEqual$1 = set$v({
|
|
19
|
+
name: 'Less than or equal',
|
|
20
|
+
latex: '\\le',
|
|
21
|
+
symbol: '<=',
|
|
22
|
+
command: '\\le'
|
|
23
|
+
});
|
|
24
|
+
const greaterThanEqual$1 = set$v({
|
|
25
|
+
name: 'Greater than or equal',
|
|
26
|
+
symbol: '>=',
|
|
27
|
+
command: '\\ge',
|
|
28
|
+
latex: '\\ge'
|
|
29
|
+
});
|
|
30
|
+
var comparison$1 = Object.freeze({
|
|
31
|
+
__proto__: null,
|
|
32
|
+
lessThan: lessThan$1,
|
|
33
|
+
greaterThan: greaterThan$1,
|
|
34
|
+
lessThanEqual: lessThanEqual$1,
|
|
35
|
+
greaterThanEqual: greaterThanEqual$1
|
|
36
|
+
});
|
|
37
|
+
const _$5 = _dll_lodash;
|
|
38
|
+
const mkSet$1 = category => o => ({
|
|
39
|
+
...o,
|
|
40
|
+
category
|
|
41
|
+
});
|
|
42
|
+
const transformToKeySetStructure$1 = (data = []) => {
|
|
43
|
+
const structure = [];
|
|
44
|
+
_$5.times(5, () => {
|
|
45
|
+
structure.push([]);
|
|
46
|
+
});
|
|
47
|
+
let ln = data.length;
|
|
48
|
+
let i = 0;
|
|
49
|
+
let j = 0;
|
|
50
|
+
while (j < ln) {
|
|
51
|
+
structure[i++].push(data[j++]);
|
|
52
|
+
if (i === 5) {
|
|
53
|
+
i = 0;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return structure;
|
|
57
|
+
};
|
|
58
|
+
const latexAndNameDontExist$1 = base => k => {
|
|
59
|
+
const flattened = _$5.flatten(base);
|
|
60
|
+
const latexExists = flattened.some(b => b.latex === k.latex);
|
|
61
|
+
const nameExists = flattened.some(b => b.name === k.name);
|
|
62
|
+
return !latexExists && !nameExists;
|
|
63
|
+
};
|
|
64
|
+
const extendKeySet$1 = (base = [], keySetData = []) => {
|
|
65
|
+
keySetData = keySetData.filter(latexAndNameDontExist$1(base));
|
|
66
|
+
const final = [];
|
|
67
|
+
_$5.times(5 - base.length, () => {
|
|
68
|
+
base.push([]);
|
|
69
|
+
});
|
|
70
|
+
_$5.times(5, () => {
|
|
71
|
+
final.push([]);
|
|
72
|
+
});
|
|
73
|
+
const extra = transformToKeySetStructure$1(keySetData);
|
|
74
|
+
for (let i = 0; i < 5; i++) {
|
|
75
|
+
final[i] = [...base[i], ...extra[i]];
|
|
76
|
+
}
|
|
77
|
+
return final;
|
|
78
|
+
};
|
|
79
|
+
const set$u = mkSet$1('vars');
|
|
80
|
+
const x$1 = set$u({
|
|
81
|
+
name: 'X',
|
|
82
|
+
latex: 'x',
|
|
83
|
+
write: 'x'
|
|
84
|
+
});
|
|
85
|
+
const y$1 = set$u({
|
|
86
|
+
name: 'Y',
|
|
87
|
+
latex: 'y',
|
|
88
|
+
write: 'y'
|
|
89
|
+
});
|
|
90
|
+
const theta$1 = set$u({
|
|
91
|
+
name: 'Theta',
|
|
92
|
+
latex: '\\theta',
|
|
93
|
+
write: '\\theta'
|
|
94
|
+
});
|
|
95
|
+
var vars$1 = Object.freeze({
|
|
96
|
+
__proto__: null,
|
|
97
|
+
x: x$1,
|
|
98
|
+
y: y$1,
|
|
99
|
+
theta: theta$1
|
|
100
|
+
});
|
|
101
|
+
const set$t = mkSet$1('fractions');
|
|
102
|
+
const blankOverBlank$1 = set$t({
|
|
103
|
+
name: 'blank/blank',
|
|
104
|
+
latex: '\\frac{}{}',
|
|
105
|
+
command: '\\frac'
|
|
106
|
+
});
|
|
107
|
+
const xOverBlank$1 = set$t({
|
|
108
|
+
latex: '\\frac{x}{ }',
|
|
109
|
+
name: 'X/blank',
|
|
110
|
+
label: 'x/[]',
|
|
111
|
+
command: '/'
|
|
112
|
+
});
|
|
113
|
+
const xBlankBlank$1 = set$t({
|
|
114
|
+
name: 'X (blank/blank)',
|
|
115
|
+
latex: 'x\\frac{}{}',
|
|
116
|
+
label: 'x([]/[])',
|
|
117
|
+
command: '\\frac'
|
|
118
|
+
});
|
|
119
|
+
var fractions$1 = Object.freeze({
|
|
120
|
+
__proto__: null,
|
|
121
|
+
blankOverBlank: blankOverBlank$1,
|
|
122
|
+
xOverBlank: xOverBlank$1,
|
|
123
|
+
xBlankBlank: xBlankBlank$1
|
|
124
|
+
});
|
|
125
|
+
const set$s = mkSet$1('exponent');
|
|
126
|
+
const squared$1 = set$s({
|
|
127
|
+
name: 'Squared',
|
|
128
|
+
latex: 'x^2',
|
|
129
|
+
write: '^2'
|
|
130
|
+
});
|
|
131
|
+
const xToPowerOfN$1 = set$s({
|
|
132
|
+
name: 'X to the power of n',
|
|
133
|
+
latex: 'x^{}',
|
|
134
|
+
command: '^'
|
|
135
|
+
});
|
|
136
|
+
const squareRoot$1 = set$s({
|
|
137
|
+
name: 'Square root',
|
|
138
|
+
latex: '\\sqrt{}',
|
|
139
|
+
command: '\\sqrt'
|
|
140
|
+
});
|
|
141
|
+
const nthRoot$1 = set$s({
|
|
142
|
+
name: 'Nth root',
|
|
143
|
+
latex: '\\sqrt[{}]{}',
|
|
144
|
+
command: '\\nthroot'
|
|
145
|
+
});
|
|
146
|
+
var exponent$1 = Object.freeze({
|
|
147
|
+
__proto__: null,
|
|
148
|
+
squared: squared$1,
|
|
149
|
+
xToPowerOfN: xToPowerOfN$1,
|
|
150
|
+
squareRoot: squareRoot$1,
|
|
151
|
+
nthRoot: nthRoot$1
|
|
152
|
+
});
|
|
153
|
+
const set$r = mkSet$1('misc');
|
|
154
|
+
const plusMinus$1 = set$r({
|
|
155
|
+
name: 'Plus/Minus',
|
|
156
|
+
latex: '\\pm',
|
|
157
|
+
write: '\\pm'
|
|
158
|
+
});
|
|
159
|
+
const absValue$1 = set$r({
|
|
160
|
+
name: 'Absolute Value',
|
|
161
|
+
latex: '\\abs{}',
|
|
162
|
+
symbol: '| |',
|
|
163
|
+
command: '|'
|
|
164
|
+
});
|
|
165
|
+
const parenthesis$1 = set$r({
|
|
166
|
+
name: 'Parenthesis',
|
|
167
|
+
latex: '\\left(\\right)',
|
|
168
|
+
symbol: '( )',
|
|
169
|
+
command: '('
|
|
170
|
+
});
|
|
171
|
+
const brackets$1 = set$r({
|
|
172
|
+
name: 'Brackets',
|
|
173
|
+
latex: '\\left[\\right]',
|
|
174
|
+
symbol: '[ ]',
|
|
175
|
+
command: '['
|
|
176
|
+
});
|
|
177
|
+
const percentage$1 = set$r({
|
|
178
|
+
name: 'Percentage',
|
|
179
|
+
latex: '%',
|
|
180
|
+
command: '%'
|
|
181
|
+
});
|
|
182
|
+
const approx$1 = set$r({
|
|
183
|
+
latex: '\\approx',
|
|
184
|
+
command: '\\approx'
|
|
185
|
+
});
|
|
186
|
+
const nApprox$1 = set$r({
|
|
187
|
+
latex: '\\napprox',
|
|
188
|
+
command: '\\napprox'
|
|
189
|
+
});
|
|
190
|
+
const notEqual$1 = set$r({
|
|
191
|
+
latex: '\\neq',
|
|
192
|
+
command: '\\neq'
|
|
193
|
+
});
|
|
194
|
+
const similar$1 = set$r({
|
|
195
|
+
latex: '\\sim',
|
|
196
|
+
command: '\\sim'
|
|
197
|
+
});
|
|
198
|
+
const notSimilar$1 = set$r({
|
|
199
|
+
latex: '\\nsim',
|
|
200
|
+
command: '\\nsim'
|
|
201
|
+
});
|
|
202
|
+
var misc$1 = Object.freeze({
|
|
203
|
+
__proto__: null,
|
|
204
|
+
plusMinus: plusMinus$1,
|
|
205
|
+
absValue: absValue$1,
|
|
206
|
+
parenthesis: parenthesis$1,
|
|
207
|
+
brackets: brackets$1,
|
|
208
|
+
percentage: percentage$1,
|
|
209
|
+
approx: approx$1,
|
|
210
|
+
nApprox: nApprox$1,
|
|
211
|
+
notEqual: notEqual$1,
|
|
212
|
+
similar: similar$1,
|
|
213
|
+
notSimilar: notSimilar$1
|
|
214
|
+
});
|
|
215
|
+
const set$q = mkSet$1('constants');
|
|
216
|
+
const pi$1 = set$q({
|
|
217
|
+
name: 'Pi',
|
|
218
|
+
label: 'π',
|
|
219
|
+
latex: '\\pi',
|
|
220
|
+
command: '\\pi',
|
|
221
|
+
category: 'constants'
|
|
222
|
+
});
|
|
223
|
+
const eulers$1 = set$q({
|
|
224
|
+
name: 'Eulers',
|
|
225
|
+
label: 'e',
|
|
226
|
+
latex: 'e',
|
|
227
|
+
command: 'e',
|
|
228
|
+
category: 'constants'
|
|
229
|
+
});
|
|
230
|
+
const infinity$1 = set$q({
|
|
231
|
+
name: 'Infinity',
|
|
232
|
+
label: '\\infty',
|
|
233
|
+
latex: '\\infty',
|
|
234
|
+
command: '\\infty',
|
|
235
|
+
category: 'constants'
|
|
236
|
+
});
|
|
237
|
+
const halfInfinity$1 = set$q({
|
|
238
|
+
name: 'Half Infinity',
|
|
239
|
+
label: '\\propto',
|
|
240
|
+
latex: '\\propto',
|
|
241
|
+
command: '\\propto',
|
|
242
|
+
category: 'constants'
|
|
243
|
+
});
|
|
244
|
+
var constants$1 = Object.freeze({
|
|
245
|
+
__proto__: null,
|
|
246
|
+
pi: pi$1,
|
|
247
|
+
eulers: eulers$1,
|
|
248
|
+
infinity: infinity$1,
|
|
249
|
+
halfInfinity: halfInfinity$1
|
|
250
|
+
});
|
|
251
|
+
const set$p = mkSet$1('trigonometry');
|
|
252
|
+
const sin$1 = set$p({
|
|
253
|
+
name: 'sin',
|
|
254
|
+
label: 'sin',
|
|
255
|
+
command: '\\sin',
|
|
256
|
+
latex: '\\sin'
|
|
257
|
+
});
|
|
258
|
+
const cos$1 = set$p({
|
|
259
|
+
name: 'cos',
|
|
260
|
+
label: 'cos',
|
|
261
|
+
command: '\\cos',
|
|
262
|
+
latex: '\\cos'
|
|
263
|
+
});
|
|
264
|
+
const tan$1 = set$p({
|
|
265
|
+
name: 'tan',
|
|
266
|
+
label: 'tan',
|
|
267
|
+
command: '\\tan',
|
|
268
|
+
latex: '\\tan'
|
|
269
|
+
});
|
|
270
|
+
const sec$1 = set$p({
|
|
271
|
+
name: 'sec',
|
|
272
|
+
label: 'sec',
|
|
273
|
+
command: '\\sec',
|
|
274
|
+
latex: '\\sec'
|
|
275
|
+
});
|
|
276
|
+
const csc$1 = set$p({
|
|
277
|
+
name: 'csc',
|
|
278
|
+
label: 'csc',
|
|
279
|
+
command: '\\csc',
|
|
280
|
+
latex: '\\csc'
|
|
281
|
+
});
|
|
282
|
+
const cot$1 = set$p({
|
|
283
|
+
name: 'cot',
|
|
284
|
+
label: 'cot',
|
|
285
|
+
command: '\\cot',
|
|
286
|
+
latex: '\\cot'
|
|
287
|
+
});
|
|
288
|
+
var trigonometry$1 = Object.freeze({
|
|
289
|
+
__proto__: null,
|
|
290
|
+
sin: sin$1,
|
|
291
|
+
cos: cos$1,
|
|
292
|
+
tan: tan$1,
|
|
293
|
+
sec: sec$1,
|
|
294
|
+
csc: csc$1,
|
|
295
|
+
cot: cot$1
|
|
296
|
+
});
|
|
297
|
+
const set$o = o => ({
|
|
298
|
+
...o,
|
|
299
|
+
category: 'geometry'
|
|
300
|
+
});
|
|
301
|
+
const overline$1 = set$o({
|
|
302
|
+
name: 'Overline',
|
|
303
|
+
latex: '\\overline{}',
|
|
304
|
+
command: '\\overline'
|
|
305
|
+
});
|
|
306
|
+
const overRightArrow$1 = set$o({
|
|
307
|
+
name: 'Overline',
|
|
308
|
+
latex: '\\overrightarrow{}',
|
|
309
|
+
command: '\\overrightarrow'
|
|
310
|
+
});
|
|
311
|
+
const overLeftRightArrow$1 = set$o({
|
|
312
|
+
name: 'Overline',
|
|
313
|
+
latex: '\\overleftrightarrow{\\overline{}}',
|
|
314
|
+
symbol: 'AB',
|
|
315
|
+
command: '\\overleftrightarrow'
|
|
316
|
+
});
|
|
317
|
+
const segment$1 = set$o({
|
|
318
|
+
name: 'Segment',
|
|
319
|
+
latex: '\\overleftrightarrow{AB}',
|
|
320
|
+
write: '\\overleftrightarrow{AB}',
|
|
321
|
+
label: 'AB'
|
|
322
|
+
});
|
|
323
|
+
const parallel$1 = set$o({
|
|
324
|
+
name: 'Parallel',
|
|
325
|
+
latex: '\\parallel',
|
|
326
|
+
command: '\\parallel'
|
|
327
|
+
});
|
|
328
|
+
const notParallel$1 = set$o({
|
|
329
|
+
name: 'Not Parallel',
|
|
330
|
+
latex: '\\nparallel',
|
|
331
|
+
command: '\\nparallel'
|
|
332
|
+
});
|
|
333
|
+
const perpindicular$1 = set$o({
|
|
334
|
+
name: 'Perpendicular',
|
|
335
|
+
latex: '\\perp',
|
|
336
|
+
command: '\\perpendicular'
|
|
337
|
+
});
|
|
338
|
+
const angle$1 = set$o({
|
|
339
|
+
name: 'Angle',
|
|
340
|
+
latex: '\\angle',
|
|
341
|
+
command: '\\angle'
|
|
342
|
+
});
|
|
343
|
+
const overArc$1 = set$o({
|
|
344
|
+
name: 'Over arc',
|
|
345
|
+
latex: '\\overarc{\\overline{}}',
|
|
346
|
+
command: '\\overarc'
|
|
347
|
+
});
|
|
348
|
+
const measureOfAngle$1 = set$o({
|
|
349
|
+
name: 'Measure Of Angle',
|
|
350
|
+
latex: '\\measuredangle',
|
|
351
|
+
command: ['m', '\\angle']
|
|
352
|
+
});
|
|
353
|
+
const triangle$1 = set$o({
|
|
354
|
+
name: 'Triangle',
|
|
355
|
+
latex: '\\triangle',
|
|
356
|
+
command: '\\triangle'
|
|
357
|
+
});
|
|
358
|
+
const square$1 = set$o({
|
|
359
|
+
name: 'Square',
|
|
360
|
+
latex: '\\square',
|
|
361
|
+
command: '\\square'
|
|
362
|
+
});
|
|
363
|
+
const parallelogram$1 = set$o({
|
|
364
|
+
name: 'Parallelogram',
|
|
365
|
+
latex: '\\parallelogram',
|
|
366
|
+
command: '\\parallelogram'
|
|
367
|
+
});
|
|
368
|
+
const circledDot$1 = set$o({
|
|
369
|
+
name: 'Circled Dot',
|
|
370
|
+
latex: '\\odot',
|
|
371
|
+
command: '\\odot'
|
|
372
|
+
});
|
|
373
|
+
const degree$1 = set$o({
|
|
374
|
+
name: 'Degree',
|
|
375
|
+
latex: '\\degree',
|
|
376
|
+
command: '\\degree'
|
|
377
|
+
});
|
|
378
|
+
const similarTo$1 = set$o({
|
|
379
|
+
name: 'Similar To',
|
|
380
|
+
command: '\\sim',
|
|
381
|
+
latex: '\\sim'
|
|
382
|
+
});
|
|
383
|
+
const congruentTo$1 = set$o({
|
|
384
|
+
name: 'Congruent To',
|
|
385
|
+
command: '\\cong',
|
|
386
|
+
latex: '\\cong'
|
|
387
|
+
});
|
|
388
|
+
const notCongruentTo$1 = set$o({
|
|
389
|
+
name: 'Not Congruent To',
|
|
390
|
+
command: '\\ncong',
|
|
391
|
+
latex: '\\ncong'
|
|
392
|
+
});
|
|
393
|
+
const primeArcminute$1 = set$o({
|
|
394
|
+
name: 'Prime',
|
|
395
|
+
label: 'pam',
|
|
396
|
+
latex: "'",
|
|
397
|
+
write: "'"
|
|
398
|
+
});
|
|
399
|
+
const doublePrimeArcSecond$1 = set$o({
|
|
400
|
+
name: 'Double Prime/Arcsecond',
|
|
401
|
+
latex: '"',
|
|
402
|
+
write: '"'
|
|
403
|
+
});
|
|
404
|
+
const leftArrow$1 = set$o({
|
|
405
|
+
name: 'Left Arrow',
|
|
406
|
+
latex: '\\leftarrow',
|
|
407
|
+
command: '\\leftarrow'
|
|
408
|
+
});
|
|
409
|
+
const rightArrow$1 = set$o({
|
|
410
|
+
name: 'Right Arrow',
|
|
411
|
+
latex: '\\rightarrow',
|
|
412
|
+
command: '\\rightarrow'
|
|
413
|
+
});
|
|
414
|
+
const leftrightArrow$1 = set$o({
|
|
415
|
+
name: 'Left Right Arrow',
|
|
416
|
+
latex: '\\leftrightarrow',
|
|
417
|
+
command: '\\leftrightarrow'
|
|
418
|
+
});
|
|
419
|
+
var geometry$1 = Object.freeze({
|
|
420
|
+
__proto__: null,
|
|
421
|
+
overline: overline$1,
|
|
422
|
+
overRightArrow: overRightArrow$1,
|
|
423
|
+
overLeftRightArrow: overLeftRightArrow$1,
|
|
424
|
+
segment: segment$1,
|
|
425
|
+
parallel: parallel$1,
|
|
426
|
+
notParallel: notParallel$1,
|
|
427
|
+
perpindicular: perpindicular$1,
|
|
428
|
+
angle: angle$1,
|
|
429
|
+
overArc: overArc$1,
|
|
430
|
+
measureOfAngle: measureOfAngle$1,
|
|
431
|
+
triangle: triangle$1,
|
|
432
|
+
square: square$1,
|
|
433
|
+
parallelogram: parallelogram$1,
|
|
434
|
+
circledDot: circledDot$1,
|
|
435
|
+
degree: degree$1,
|
|
436
|
+
similarTo: similarTo$1,
|
|
437
|
+
congruentTo: congruentTo$1,
|
|
438
|
+
notCongruentTo: notCongruentTo$1,
|
|
439
|
+
primeArcminute: primeArcminute$1,
|
|
440
|
+
doublePrimeArcSecond: doublePrimeArcSecond$1,
|
|
441
|
+
leftArrow: leftArrow$1,
|
|
442
|
+
rightArrow: rightArrow$1,
|
|
443
|
+
leftrightArrow: leftrightArrow$1
|
|
444
|
+
});
|
|
445
|
+
const set$n = mkSet$1('operators');
|
|
446
|
+
const circleDot$1 = set$n({
|
|
447
|
+
name: 'CircleDot',
|
|
448
|
+
label: '⋅',
|
|
449
|
+
write: '\\cdot'
|
|
450
|
+
});
|
|
451
|
+
var operators$1 = Object.freeze({
|
|
452
|
+
__proto__: null,
|
|
453
|
+
circleDot: circleDot$1
|
|
454
|
+
});
|
|
455
|
+
const set$m = mkSet$1('log');
|
|
456
|
+
const log$b = set$m({
|
|
457
|
+
name: 'Log',
|
|
458
|
+
label: 'log',
|
|
459
|
+
command: '\\log',
|
|
460
|
+
latex: '\\log'
|
|
461
|
+
});
|
|
462
|
+
const logSubscript$1 = set$m({
|
|
463
|
+
name: 'Log with subscript',
|
|
464
|
+
label: 'log s',
|
|
465
|
+
latex: '\\log_{}',
|
|
466
|
+
command: ['\\log', '_', ' ']
|
|
467
|
+
});
|
|
468
|
+
const ln$1 = set$m({
|
|
469
|
+
name: 'Ln',
|
|
470
|
+
label: 'ln',
|
|
471
|
+
command: '\\ln',
|
|
472
|
+
latex: '\\ln'
|
|
473
|
+
});
|
|
474
|
+
var log$c = Object.freeze({
|
|
475
|
+
__proto__: null,
|
|
476
|
+
log: log$b,
|
|
477
|
+
logSubscript: logSubscript$1,
|
|
478
|
+
ln: ln$1
|
|
479
|
+
});
|
|
480
|
+
const set$l = mkSet$1('sub-sup');
|
|
481
|
+
const superscript$1 = set$l({
|
|
482
|
+
name: 'Superscript',
|
|
483
|
+
latex: 'x^{}',
|
|
484
|
+
command: '^'
|
|
485
|
+
});
|
|
486
|
+
const subscript$1 = set$l({
|
|
487
|
+
name: 'Subscript',
|
|
488
|
+
latex: 'x_{}',
|
|
489
|
+
command: '_'
|
|
490
|
+
});
|
|
491
|
+
var subSup$1 = Object.freeze({
|
|
492
|
+
__proto__: null,
|
|
493
|
+
superscript: superscript$1,
|
|
494
|
+
subscript: subscript$1
|
|
495
|
+
});
|
|
496
|
+
const set$k = mkSet$1('statistics');
|
|
497
|
+
const xBar$1 = set$k({
|
|
498
|
+
name: 'X Bar',
|
|
499
|
+
label: 'x̄',
|
|
500
|
+
latex: '\\overline{x}',
|
|
501
|
+
write: '\\overline{x}'
|
|
502
|
+
});
|
|
503
|
+
const yBar$1 = set$k({
|
|
504
|
+
name: 'Y Bar',
|
|
505
|
+
latex: '\\overline{y}',
|
|
506
|
+
write: '\\overline{y}'
|
|
507
|
+
});
|
|
508
|
+
const mu$1 = set$k({
|
|
509
|
+
name: 'mu',
|
|
510
|
+
label: 'mu',
|
|
511
|
+
latex: '\\mu',
|
|
512
|
+
write: '\\mu'
|
|
513
|
+
});
|
|
514
|
+
const sigma$1 = set$k({
|
|
515
|
+
name: 'Sigma',
|
|
516
|
+
label: '\\Sigma',
|
|
517
|
+
latex: '\\Sigma',
|
|
518
|
+
write: '\\Sigma'
|
|
519
|
+
});
|
|
520
|
+
const smallSigma$1 = set$k({
|
|
521
|
+
name: 'sigma',
|
|
522
|
+
label: '\\sigma',
|
|
523
|
+
latex: '\\sigma',
|
|
524
|
+
write: '\\sigma'
|
|
525
|
+
});
|
|
526
|
+
var statistics$1 = Object.freeze({
|
|
527
|
+
__proto__: null,
|
|
528
|
+
xBar: xBar$1,
|
|
529
|
+
yBar: yBar$1,
|
|
530
|
+
mu: mu$1,
|
|
531
|
+
sigma: sigma$1,
|
|
532
|
+
smallSigma: smallSigma$1
|
|
533
|
+
});
|
|
534
|
+
const DELETE$1 = '\u232B';
|
|
535
|
+
const LEFT_ARROW$1 = '◀';
|
|
536
|
+
const RIGHT_ARROW$1 = '▶';
|
|
537
|
+
const DIVIDE$1 = '\u00F7';
|
|
538
|
+
const MULTIPLY$1 = '\u00D7';
|
|
539
|
+
const set$j = mkSet$1('operators');
|
|
540
|
+
const equals$1 = set$j({
|
|
541
|
+
write: '=',
|
|
542
|
+
label: '='
|
|
543
|
+
});
|
|
544
|
+
const plus$1 = set$j({
|
|
545
|
+
write: '+',
|
|
546
|
+
label: '+'
|
|
547
|
+
});
|
|
548
|
+
const minus$1 = set$j({
|
|
549
|
+
write: '−',
|
|
550
|
+
label: '−'
|
|
551
|
+
});
|
|
552
|
+
const divide$1 = set$j({
|
|
553
|
+
name: 'divide',
|
|
554
|
+
label: DIVIDE$1,
|
|
555
|
+
command: '\\divide',
|
|
556
|
+
otherNotation: '\\div'
|
|
557
|
+
});
|
|
558
|
+
const multiply$1 = set$j({
|
|
559
|
+
name: 'multiply',
|
|
560
|
+
label: MULTIPLY$1,
|
|
561
|
+
command: '\\times'
|
|
562
|
+
});
|
|
563
|
+
var basicOperators$1 = Object.freeze({
|
|
564
|
+
__proto__: null,
|
|
565
|
+
equals: equals$1,
|
|
566
|
+
plus: plus$1,
|
|
567
|
+
minus: minus$1,
|
|
568
|
+
divide: divide$1,
|
|
569
|
+
multiply: multiply$1
|
|
570
|
+
});
|
|
571
|
+
const set$i = mkSet$1('matrices');
|
|
572
|
+
const singleCellMatrix$1 = set$i({
|
|
573
|
+
name: 'Single Cell Matrix',
|
|
574
|
+
label: '[ ]',
|
|
575
|
+
write: '\\begin{pmatrix}\\end{pmatrix}'
|
|
576
|
+
});
|
|
577
|
+
const doubleCellMatrix$1 = set$i({
|
|
578
|
+
name: 'Double Cell Matrix',
|
|
579
|
+
label: '[ ] [ ] \\\\newline [ ] [ ]',
|
|
580
|
+
write: '\\begin{bmatrix}&\\\\&\\end{bmatrix}'
|
|
581
|
+
});
|
|
582
|
+
var matrices$1 = Object.freeze({
|
|
583
|
+
__proto__: null,
|
|
584
|
+
singleCellMatrix: singleCellMatrix$1,
|
|
585
|
+
doubleCellMatrix: doubleCellMatrix$1
|
|
586
|
+
});
|
|
587
|
+
const {times: times$1} = _dll_lodash;
|
|
588
|
+
const digitMap$1 = {
|
|
589
|
+
0: 'zero',
|
|
590
|
+
1: 'one',
|
|
591
|
+
2: 'two',
|
|
592
|
+
3: 'three',
|
|
593
|
+
4: 'four',
|
|
594
|
+
5: 'five',
|
|
595
|
+
6: 'six',
|
|
596
|
+
7: 'seven',
|
|
597
|
+
8: 'eight',
|
|
598
|
+
9: 'nine'
|
|
599
|
+
};
|
|
600
|
+
const comma$3 = {
|
|
601
|
+
name: 'comma',
|
|
602
|
+
label: ',',
|
|
603
|
+
write: ',',
|
|
604
|
+
category: 'digit'
|
|
605
|
+
};
|
|
606
|
+
const decimalPoint$3 = {
|
|
607
|
+
name: 'decimal-point',
|
|
608
|
+
label: '.',
|
|
609
|
+
write: '.',
|
|
610
|
+
category: 'digit'
|
|
611
|
+
};
|
|
612
|
+
var digits$1 = times$1(10, String).map(n => {
|
|
613
|
+
return {
|
|
614
|
+
name: digitMap$1[n],
|
|
615
|
+
write: n,
|
|
616
|
+
label: n,
|
|
617
|
+
category: 'digit'
|
|
618
|
+
};
|
|
619
|
+
}).reduce((acc, o) => {
|
|
620
|
+
acc[o.name] = o;
|
|
621
|
+
return acc;
|
|
622
|
+
}, {
|
|
623
|
+
comma: comma$3,
|
|
624
|
+
decimalPoint: decimalPoint$3
|
|
625
|
+
});
|
|
626
|
+
const set$h = mkSet$1('logic');
|
|
627
|
+
const therefore$1 = set$h({
|
|
628
|
+
name: 'Therefore',
|
|
629
|
+
label: '∴',
|
|
630
|
+
write: '∴'
|
|
631
|
+
});
|
|
632
|
+
const longDivision$1 = set$h({
|
|
633
|
+
name: 'Long division',
|
|
634
|
+
latex: '\\longdiv{}',
|
|
635
|
+
command: '\\longdiv'
|
|
636
|
+
});
|
|
637
|
+
const set$g = mkSet$1('navigation');
|
|
638
|
+
const left$1 = set$g({
|
|
639
|
+
label: LEFT_ARROW$1,
|
|
640
|
+
keystroke: 'Left'
|
|
641
|
+
});
|
|
642
|
+
const right$1 = set$g({
|
|
643
|
+
label: RIGHT_ARROW$1,
|
|
644
|
+
keystroke: 'Right'
|
|
645
|
+
});
|
|
646
|
+
const del$1 = {
|
|
647
|
+
label: DELETE$1,
|
|
648
|
+
category: 'edit',
|
|
649
|
+
keystroke: 'Backspace'
|
|
650
|
+
};
|
|
651
|
+
const hs$1 = [[blankOverBlank$1, percentage$1, x$1, squared$1, squareRoot$1], [circleDot$1, y$1, subscript$1, xToPowerOfN$1, nthRoot$1], [plusMinus$1, lessThan$1, greaterThan$1, lessThanEqual$1, greaterThanEqual$1], [pi$1, theta$1, parenthesis$1, brackets$1, absValue$1], [notEqual$1, sin$1, cos$1, tan$1, degree$1]];
|
|
652
|
+
const advancedAlgebra$1 = (() => {
|
|
653
|
+
const out = [...hs$1.map(arr => [...arr])];
|
|
654
|
+
out[0].push({
|
|
655
|
+
name: 'i',
|
|
656
|
+
latex: 'i',
|
|
657
|
+
write: 'i'
|
|
658
|
+
});
|
|
659
|
+
out[1].push(log$b);
|
|
660
|
+
out[2].push(logSubscript$1);
|
|
661
|
+
out[3].push(ln$1);
|
|
662
|
+
out[4].push(eulers$1);
|
|
663
|
+
return out;
|
|
664
|
+
})();
|
|
665
|
+
const statisticsSet$1 = (() => {
|
|
666
|
+
const out = [...hs$1.map(arr => [...arr])];
|
|
667
|
+
out[0].push(mu$1);
|
|
668
|
+
out[1].push(xBar$1);
|
|
669
|
+
out[2].push(yBar$1);
|
|
670
|
+
out[3].push(sigma$1);
|
|
671
|
+
out[4].push(smallSigma$1);
|
|
672
|
+
return out;
|
|
673
|
+
})();
|
|
674
|
+
const gradeSets$1 = [{
|
|
675
|
+
predicate: n => n >= 3 && n <= 5,
|
|
676
|
+
set: [[lessThan$1, greaterThan$1], [xOverBlank$1, xBlankBlank$1], [x$1, longDivision$1]]
|
|
677
|
+
}, {
|
|
678
|
+
predicate: n => n >= 6 && n <= 7,
|
|
679
|
+
set: [[degree$1, lessThan$1, greaterThan$1], [circleDot$1, lessThanEqual$1, greaterThanEqual$1], [x$1, y$1, squared$1, xToPowerOfN$1], [plusMinus$1, xOverBlank$1, xBlankBlank$1, squareRoot$1], [pi$1, parenthesis$1, absValue$1, nthRoot$1]]
|
|
680
|
+
}, {
|
|
681
|
+
predicate: n => n >= 8 || n === 'HS',
|
|
682
|
+
set: hs$1
|
|
683
|
+
}, {
|
|
684
|
+
predicate: 'non-negative-integers',
|
|
685
|
+
set: [[digits$1.seven, digits$1.eight, digits$1.nine], [digits$1.four, digits$1.five, digits$1.six], [digits$1.one, digits$1.two, digits$1.three], [digits$1.zero, {
|
|
686
|
+
name: '',
|
|
687
|
+
latex: '',
|
|
688
|
+
write: ''
|
|
689
|
+
}, {
|
|
690
|
+
name: '',
|
|
691
|
+
latex: '',
|
|
692
|
+
write: ''
|
|
693
|
+
}], [left$1, right$1, del$1]]
|
|
694
|
+
}, {
|
|
695
|
+
predicate: 'integers',
|
|
696
|
+
set: [[digits$1.seven, digits$1.eight, digits$1.nine], [digits$1.four, digits$1.five, digits$1.six], [digits$1.one, digits$1.two, digits$1.three], [digits$1.zero, {
|
|
697
|
+
name: '',
|
|
698
|
+
latex: '',
|
|
699
|
+
write: ''
|
|
700
|
+
}, minus$1], [left$1, right$1, del$1]]
|
|
701
|
+
}, {
|
|
702
|
+
predicate: 'decimals',
|
|
703
|
+
set: [[digits$1.seven, digits$1.eight, digits$1.nine], [digits$1.four, digits$1.five, digits$1.six], [digits$1.one, digits$1.two, digits$1.three], [digits$1.zero, digits$1.decimalPoint, minus$1], [left$1, right$1, del$1]]
|
|
704
|
+
}, {
|
|
705
|
+
predicate: 'fractions',
|
|
706
|
+
set: [[digits$1.seven, digits$1.eight, digits$1.nine], [digits$1.four, digits$1.five, digits$1.six], [digits$1.one, digits$1.two, digits$1.three], [digits$1.zero, blankOverBlank$1, minus$1], [left$1, right$1, del$1]]
|
|
707
|
+
}, {
|
|
708
|
+
predicate: 'geometry',
|
|
709
|
+
set: [[blankOverBlank$1, degree$1, primeArcminute$1, doublePrimeArcSecond$1, congruentTo$1, similarTo$1], [circleDot$1, angle$1, measureOfAngle$1, triangle$1, notCongruentTo$1, notSimilar$1], [sin$1, cos$1, tan$1, pi$1, squareRoot$1, nthRoot$1], [csc$1, sec$1, cot$1, theta$1, subscript$1, xToPowerOfN$1], [overline$1, overRightArrow$1, overLeftRightArrow$1, overArc$1, perpindicular$1, parallel$1]]
|
|
710
|
+
}, {
|
|
711
|
+
predicate: 'advanced-algebra',
|
|
712
|
+
set: advancedAlgebra$1
|
|
713
|
+
}, {
|
|
714
|
+
predicate: 'statistics',
|
|
715
|
+
set: statisticsSet$1
|
|
716
|
+
}, {
|
|
717
|
+
predicate: 'item-authoring',
|
|
718
|
+
set: [[divide$1, blankOverBlank$1, longDivision$1, halfInfinity$1, squared$1, squareRoot$1, overline$1, overRightArrow$1, overLeftRightArrow$1, log$b], [multiply$1, circleDot$1, {
|
|
719
|
+
name: '',
|
|
720
|
+
latex: '',
|
|
721
|
+
write: ''
|
|
722
|
+
}, subscript$1, xToPowerOfN$1, nthRoot$1, perpindicular$1, parallel$1, overArc$1, logSubscript$1], [plusMinus$1, pi$1, theta$1, degree$1, angle$1, leftArrow$1, rightArrow$1, triangle$1, square$1, ln$1], [notEqual$1, absValue$1, smallSigma$1, mu$1, therefore$1, sigma$1, leftrightArrow$1, sin$1, cos$1, tan$1], [lessThanEqual$1, greaterThanEqual$1, {
|
|
723
|
+
name: '',
|
|
724
|
+
latex: '',
|
|
725
|
+
write: ''
|
|
726
|
+
}, {
|
|
727
|
+
name: '',
|
|
728
|
+
latex: '',
|
|
729
|
+
write: ''
|
|
730
|
+
}, infinity$1, {
|
|
731
|
+
name: '',
|
|
732
|
+
latex: '',
|
|
733
|
+
write: ''
|
|
734
|
+
}, {
|
|
735
|
+
name: '',
|
|
736
|
+
latex: '',
|
|
737
|
+
write: ''
|
|
738
|
+
}, csc$1, sec$1, cot$1]]
|
|
739
|
+
}];
|
|
740
|
+
const keysForGrade$1 = n => {
|
|
741
|
+
const number = parseInt(n, 10);
|
|
742
|
+
n = isNaN(number) ? n : number;
|
|
743
|
+
if (!n) {
|
|
744
|
+
return [];
|
|
745
|
+
}
|
|
746
|
+
const match = gradeSets$1.find(gs => {
|
|
747
|
+
if (typeof gs.predicate === 'string') {
|
|
748
|
+
return gs.predicate === n;
|
|
749
|
+
} else {
|
|
750
|
+
return gs.predicate(n);
|
|
751
|
+
}
|
|
752
|
+
});
|
|
753
|
+
if (match) {
|
|
754
|
+
return match.set || [];
|
|
755
|
+
}
|
|
756
|
+
};
|
|
757
|
+
const ALL_KEYS$1 = [...Object.values(basicOperators$1), ...Object.values(comparison$1), ...Object.values(constants$1), ...Object.values(digits$1), ...Object.values(exponent$1), ...Object.values(fractions$1), ...Object.values(geometry$1), ...Object.values(log$c), ...Object.values(matrices$1), ...Object.values(misc$1), ...Object.values(operators$1), ...Object.values(statistics$1), ...Object.values(subSup$1), ...Object.values(trigonometry$1), ...Object.values(vars$1)];
|
|
758
|
+
const normalizeAdditionalKeys$1 = additionalKeys => {
|
|
759
|
+
return (additionalKeys || []).map(additionalkey => {
|
|
760
|
+
const {latex} = additionalkey;
|
|
761
|
+
const predefinedKey = (ALL_KEYS$1 || []).find(key => latex === key.latex || latex === key.write || latex === key.command || latex === key.otherNotation);
|
|
762
|
+
return predefinedKey || additionalkey;
|
|
763
|
+
});
|
|
764
|
+
};
|
|
765
|
+
const {one: one$1, two: two$1, three: three$1, four: four$1, five: five$1, six: six$1, seven: seven$1, eight: eight$1, nine: nine$1, zero: zero$1, comma: comma$2, decimalPoint: decimalPoint$2} = digits$1;
|
|
766
|
+
const baseSet$1 = [[seven$1, eight$1, nine$1, divide$1], [four$1, five$1, six$1, multiply$1], [one$1, two$1, three$1, minus$1], [zero$1, decimalPoint$2, comma$2, plus$1], [left$1, right$1, del$1, equals$1]];
|
|
767
|
+
const _$4 = _dll_lodash;
|
|
768
|
+
const sortKeys$1 = keys => {
|
|
769
|
+
_$4.times(5 - keys.length, () => {
|
|
770
|
+
keys.push([]);
|
|
771
|
+
});
|
|
772
|
+
const out = _$4.zip.apply(null, keys);
|
|
773
|
+
return out;
|
|
774
|
+
};
|
|
775
|
+
const registerLineBreak$1 = function (MQ) {
|
|
776
|
+
MQ.registerEmbed('newLine', () => {
|
|
777
|
+
return {
|
|
778
|
+
htmlString: '<div class="newLine"></div>',
|
|
779
|
+
text: () => 'testText',
|
|
780
|
+
latex: () => '\\embed{newLine}[]'
|
|
781
|
+
};
|
|
782
|
+
});
|
|
783
|
+
};
|
|
784
|
+
const React$e = _dll_react;
|
|
785
|
+
const PropTypes$d = _dll_prop_types;
|
|
786
|
+
const {withStyles: withStyles$9} = _dll_material_ui__core_styles;
|
|
787
|
+
const debug$8 = _dll_debug;
|
|
788
|
+
const classNames$4 = _dll_classnames;
|
|
789
|
+
const MathQuill$5 = _dll_pie_framework__mathquill;
|
|
790
|
+
const _jsxFileName$d = "/home/circleci/repo/node_modules/@pie-lib/math-input/src/mq/input.jsx";
|
|
791
|
+
let MQ$3;
|
|
792
|
+
if (typeof window !== 'undefined') {
|
|
793
|
+
MQ$3 = MathQuill$5.getInterface(2);
|
|
794
|
+
if (MQ$3 && MQ$3.registerEmbed) {
|
|
795
|
+
registerLineBreak$1(MQ$3);
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
const log$a = debug$8('math-input:mq:input');
|
|
799
|
+
class Input$1 extends React$e.Component {
|
|
800
|
+
constructor(...args) {
|
|
801
|
+
super(...args);
|
|
802
|
+
Input$1.prototype.__init.call(this);
|
|
803
|
+
Input$1.prototype.__init2.call(this);
|
|
804
|
+
Input$1.prototype.__init3.call(this);
|
|
805
|
+
}
|
|
806
|
+
static __initStatic() {
|
|
807
|
+
this.propTypes = {
|
|
808
|
+
className: PropTypes$d.string,
|
|
809
|
+
classes: PropTypes$d.object.isRequired,
|
|
810
|
+
onClick: PropTypes$d.func,
|
|
811
|
+
onChange: PropTypes$d.func,
|
|
812
|
+
latex: PropTypes$d.string,
|
|
813
|
+
onFocus: PropTypes$d.func,
|
|
814
|
+
onBlur: PropTypes$d.func
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
componentDidMount() {
|
|
818
|
+
if (!MQ$3) {
|
|
819
|
+
throw new Error('MQ is not defined - but component has mounted?');
|
|
820
|
+
}
|
|
821
|
+
this.mathField = MQ$3.MathField(this.input, {
|
|
822
|
+
handlers: {
|
|
823
|
+
edit: this.onInputEdit.bind(this)
|
|
824
|
+
}
|
|
825
|
+
});
|
|
826
|
+
this.updateLatex();
|
|
827
|
+
}
|
|
828
|
+
componentDidUpdate() {
|
|
829
|
+
this.updateLatex();
|
|
830
|
+
}
|
|
831
|
+
updateLatex() {
|
|
832
|
+
if (!this.mathField) {
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
835
|
+
const {latex} = this.props;
|
|
836
|
+
if (latex) {
|
|
837
|
+
this.mathField.latex(latex);
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
clear() {
|
|
841
|
+
this.mathField.latex('');
|
|
842
|
+
return '';
|
|
843
|
+
}
|
|
844
|
+
blur() {
|
|
845
|
+
log$a('blur mathfield');
|
|
846
|
+
this.mathField.blur();
|
|
847
|
+
}
|
|
848
|
+
focus() {
|
|
849
|
+
log$a('focus mathfield...');
|
|
850
|
+
this.mathField.focus();
|
|
851
|
+
}
|
|
852
|
+
command(v) {
|
|
853
|
+
log$a('command: ', v);
|
|
854
|
+
if (Array.isArray(v)) {
|
|
855
|
+
v.forEach(vv => {
|
|
856
|
+
this.mathField.cmd(vv);
|
|
857
|
+
});
|
|
858
|
+
} else {
|
|
859
|
+
this.mathField.cmd(v);
|
|
860
|
+
}
|
|
861
|
+
this.mathField.focus();
|
|
862
|
+
return this.mathField.latex();
|
|
863
|
+
}
|
|
864
|
+
keystroke(v) {
|
|
865
|
+
this.mathField.keystroke(v);
|
|
866
|
+
this.mathField.focus();
|
|
867
|
+
return this.mathField.latex();
|
|
868
|
+
}
|
|
869
|
+
write(v) {
|
|
870
|
+
log$a('write: ', v);
|
|
871
|
+
this.mathField.write(v);
|
|
872
|
+
this.mathField.focus();
|
|
873
|
+
return this.mathField.latex();
|
|
874
|
+
}
|
|
875
|
+
__init() {
|
|
876
|
+
this.onInputEdit = () => {
|
|
877
|
+
log$a('[onInputEdit] ...');
|
|
878
|
+
const {onChange} = this.props;
|
|
879
|
+
if (!this.mathField) {
|
|
880
|
+
return;
|
|
881
|
+
}
|
|
882
|
+
if (onChange) {
|
|
883
|
+
onChange(this.mathField.latex());
|
|
884
|
+
}
|
|
885
|
+
};
|
|
886
|
+
}
|
|
887
|
+
__init2() {
|
|
888
|
+
this.refresh = () => {
|
|
889
|
+
this.blur();
|
|
890
|
+
this.focus();
|
|
891
|
+
};
|
|
892
|
+
}
|
|
893
|
+
__init3() {
|
|
894
|
+
this.onKeyPress = event => {
|
|
895
|
+
const keys = Object.keys(this.mathField.__controller.options);
|
|
896
|
+
if (keys.indexOf('ignoreNextMousedown') < 0) {
|
|
897
|
+
this.refresh();
|
|
898
|
+
}
|
|
899
|
+
if (event.charCode === 13) {
|
|
900
|
+
this.write('\\embed{newLine}[]');
|
|
901
|
+
this.onInputEdit();
|
|
902
|
+
}
|
|
903
|
+
};
|
|
904
|
+
}
|
|
905
|
+
shouldComponentUpdate(nextProps) {
|
|
906
|
+
log$a('next: ', nextProps.latex);
|
|
907
|
+
log$a('current: ', this.mathField.latex());
|
|
908
|
+
return nextProps.latex !== this.mathField.latex();
|
|
909
|
+
}
|
|
910
|
+
render() {
|
|
911
|
+
const {onClick, onFocus, onBlur, classes, className} = this.props;
|
|
912
|
+
return React$e.createElement('span', {
|
|
913
|
+
className: classNames$4(classes.input, className),
|
|
914
|
+
onKeyPress: this.onKeyPress,
|
|
915
|
+
onClick: onClick,
|
|
916
|
+
onFocus: onFocus,
|
|
917
|
+
onBlur: onBlur,
|
|
918
|
+
ref: r => this.input = r,
|
|
919
|
+
__self: this,
|
|
920
|
+
__source: {
|
|
921
|
+
fileName: _jsxFileName$d,
|
|
922
|
+
lineNumber: 149
|
|
923
|
+
}
|
|
924
|
+
});
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
Input$1.__initStatic();
|
|
928
|
+
const styles$7 = () => ({});
|
|
929
|
+
withStyles$9(styles$7)(Input$1);
|
|
930
|
+
const PropTypes$c = _dll_prop_types;
|
|
931
|
+
const React$d = _dll_react;
|
|
932
|
+
const debug$7 = _dll_debug;
|
|
933
|
+
const MathQuill$4 = _dll_pie_framework__mathquill;
|
|
934
|
+
const _jsxFileName$c = "/home/circleci/repo/node_modules/@pie-lib/math-input/src/mq/static.jsx";
|
|
935
|
+
let MQ$2;
|
|
936
|
+
if (typeof window !== 'undefined') {
|
|
937
|
+
MQ$2 = MathQuill$4.getInterface(2);
|
|
938
|
+
}
|
|
939
|
+
const log$9 = debug$7('pie-lib:math-input:mq:static');
|
|
940
|
+
const REGEX$2 = /\\MathQuillMathField\[r\d*\]\{(.*?)\}/g;
|
|
941
|
+
const WHITESPACE_REGEX$1 = / /g;
|
|
942
|
+
function stripSpaces$1(string = '') {
|
|
943
|
+
return string.replace(WHITESPACE_REGEX$1, '');
|
|
944
|
+
}
|
|
945
|
+
class Static$1 extends React$d.Component {
|
|
946
|
+
constructor(...args) {
|
|
947
|
+
super(...args);
|
|
948
|
+
Static$1.prototype.__init.call(this);
|
|
949
|
+
}
|
|
950
|
+
static __initStatic() {
|
|
951
|
+
this.propTypes = {
|
|
952
|
+
latex: PropTypes$c.string.isRequired,
|
|
953
|
+
onFocus: PropTypes$c.func,
|
|
954
|
+
onBlur: PropTypes$c.func,
|
|
955
|
+
className: PropTypes$c.string,
|
|
956
|
+
getFieldName: PropTypes$c.func,
|
|
957
|
+
onSubFieldChange: PropTypes$c.func,
|
|
958
|
+
onSubFieldFocus: PropTypes$c.func,
|
|
959
|
+
setInput: PropTypes$c.func
|
|
960
|
+
};
|
|
961
|
+
}
|
|
962
|
+
componentDidMount() {
|
|
963
|
+
this.update();
|
|
964
|
+
updateSpans$1();
|
|
965
|
+
}
|
|
966
|
+
componentDidUpdate() {
|
|
967
|
+
this.update();
|
|
968
|
+
updateSpans$1();
|
|
969
|
+
}
|
|
970
|
+
onInputEdit(field) {
|
|
971
|
+
if (!this.mathField) {
|
|
972
|
+
return;
|
|
973
|
+
}
|
|
974
|
+
const name = this.props.getFieldName(field, this.mathField.innerFields);
|
|
975
|
+
if (this.props.onSubFieldChange) {
|
|
976
|
+
this.props.onSubFieldChange(name, field.latex());
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
update() {
|
|
980
|
+
if (!MQ$2) {
|
|
981
|
+
throw new Error('MQ is not defined - but component has mounted?');
|
|
982
|
+
}
|
|
983
|
+
if (!this.mathField) {
|
|
984
|
+
this.mathField = MQ$2.StaticMath(this.input, {
|
|
985
|
+
handlers: {
|
|
986
|
+
edit: this.onInputEdit.bind(this)
|
|
987
|
+
}
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
try {
|
|
991
|
+
this.mathField.parseLatex(this.props.latex);
|
|
992
|
+
this.mathField.latex(this.props.latex);
|
|
993
|
+
} catch (e) {
|
|
994
|
+
this.mathField.latex('\\MathQuillMathField[r1]{}');
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
blur() {
|
|
998
|
+
log$9('blur mathfield');
|
|
999
|
+
this.mathField.blur();
|
|
1000
|
+
}
|
|
1001
|
+
focus() {
|
|
1002
|
+
log$9('focus mathfield...');
|
|
1003
|
+
this.mathField.focus();
|
|
1004
|
+
}
|
|
1005
|
+
shouldComponentUpdate(nextProps) {
|
|
1006
|
+
try {
|
|
1007
|
+
const parsedLatex = this.mathField.parseLatex(nextProps.latex);
|
|
1008
|
+
const stripped = stripSpaces$1(parsedLatex);
|
|
1009
|
+
const newFieldCount = (nextProps.latex.match(REGEX$2) || []).length;
|
|
1010
|
+
const out = stripped !== stripSpaces$1(this.mathField.latex().trim()) || newFieldCount !== Object.keys(this.mathField.innerFields).length / 2;
|
|
1011
|
+
log$9('[shouldComponentUpdate] ', out);
|
|
1012
|
+
return out;
|
|
1013
|
+
} catch (e) {
|
|
1014
|
+
console.warn('Error parsing latex:', e.message, 'skip update');
|
|
1015
|
+
console.warn(e);
|
|
1016
|
+
return false;
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
__init() {
|
|
1020
|
+
this.onFocus = e => {
|
|
1021
|
+
try {
|
|
1022
|
+
let rootBlock = e.target.parentElement.nextSibling;
|
|
1023
|
+
let id = parseInt(rootBlock.getAttribute('mathquill-block-id'), 10);
|
|
1024
|
+
if (!id) {
|
|
1025
|
+
rootBlock = rootBlock.parentElement;
|
|
1026
|
+
id = parseInt(rootBlock.getAttribute('mathquill-block-id'), 10);
|
|
1027
|
+
}
|
|
1028
|
+
const innerField = this.mathField.innerFields.find(f => f.id === id);
|
|
1029
|
+
if (innerField) {
|
|
1030
|
+
const name = this.props.getFieldName(innerField, this.mathField.innerFields);
|
|
1031
|
+
if (this.props.setInput) {
|
|
1032
|
+
this.props.setInput(innerField);
|
|
1033
|
+
}
|
|
1034
|
+
this.props.onSubFieldFocus(name, innerField);
|
|
1035
|
+
}
|
|
1036
|
+
} catch (err) {
|
|
1037
|
+
console.error('error finding root block', err.message);
|
|
1038
|
+
}
|
|
1039
|
+
};
|
|
1040
|
+
}
|
|
1041
|
+
render() {
|
|
1042
|
+
const {onBlur, className} = this.props;
|
|
1043
|
+
return React$d.createElement('span', {
|
|
1044
|
+
className: className,
|
|
1045
|
+
onFocus: this.onFocus,
|
|
1046
|
+
onBlur: onBlur,
|
|
1047
|
+
ref: r => this.input = r,
|
|
1048
|
+
__self: this,
|
|
1049
|
+
__source: {
|
|
1050
|
+
fileName: _jsxFileName$c,
|
|
1051
|
+
lineNumber: 137
|
|
1052
|
+
}
|
|
1053
|
+
});
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
Static$1.__initStatic();
|
|
1057
|
+
const React$c = _dll_react;
|
|
1058
|
+
const PropTypes$b = _dll_prop_types;
|
|
1059
|
+
const {Button: Button$2} = _dll_material_ui__core;
|
|
1060
|
+
const {IconButton: IconButton$2} = _dll_material_ui__core;
|
|
1061
|
+
const {colors: {green: green$1}} = _dll_material_ui__core;
|
|
1062
|
+
const {withStyles: withStyles$8} = _dll_material_ui__core_styles;
|
|
1063
|
+
const classNames$3 = _dll_classnames;
|
|
1064
|
+
const {lighten: lighten$1} = _dll_material_ui__core_styles_color_manipulator;
|
|
1065
|
+
const {fade: fade$1} = _dll_material_ui__core_styles_color_manipulator;
|
|
1066
|
+
const debug$6 = _dll_debug;
|
|
1067
|
+
const _$3 = _dll_lodash;
|
|
1068
|
+
const _jsxFileName$b = "/home/circleci/repo/node_modules/@pie-lib/math-input/src/keypad/index.jsx";
|
|
1069
|
+
const log$8 = debug$6('pie-lib:math-inline:keypad');
|
|
1070
|
+
const LatexButton$1 = withStyles$8(theme => ({
|
|
1071
|
+
root: {
|
|
1072
|
+
textTransform: 'none',
|
|
1073
|
+
padding: 0,
|
|
1074
|
+
margin: 0,
|
|
1075
|
+
fontSize: '110% !important'
|
|
1076
|
+
},
|
|
1077
|
+
latexButton: {
|
|
1078
|
+
pointerEvents: 'none',
|
|
1079
|
+
textTransform: 'none !important',
|
|
1080
|
+
'& .mq-scaled.mq-sqrt-prefix': {
|
|
1081
|
+
transform: 'scale(1, 0.9) !important'
|
|
1082
|
+
},
|
|
1083
|
+
'& .mq-sup-only .mq-sup': {
|
|
1084
|
+
marginBottom: '0.9px !important'
|
|
1085
|
+
},
|
|
1086
|
+
'& .mq-empty': {
|
|
1087
|
+
backgroundColor: `${fade$1(theme.palette.secondary.main, 0.4)} !important`
|
|
1088
|
+
},
|
|
1089
|
+
'& .mq-overline .mq-overline-inner': {
|
|
1090
|
+
borderTop: '2px solid black'
|
|
1091
|
+
},
|
|
1092
|
+
'& .mq-overarrow': {
|
|
1093
|
+
width: '30px',
|
|
1094
|
+
marginTop: '0 !important',
|
|
1095
|
+
borderTop: '2px solid black',
|
|
1096
|
+
'&.mq-arrow-both': {
|
|
1097
|
+
'& *': {
|
|
1098
|
+
lineHeight: '1 !important'
|
|
1099
|
+
},
|
|
1100
|
+
'&:before': {
|
|
1101
|
+
fontSize: '80%',
|
|
1102
|
+
left: 'calc(-13%)',
|
|
1103
|
+
top: '-0.25em'
|
|
1104
|
+
},
|
|
1105
|
+
'&:after': {
|
|
1106
|
+
fontSize: '80% !important',
|
|
1107
|
+
right: 'calc(-13%) !important',
|
|
1108
|
+
top: '-1.5em'
|
|
1109
|
+
},
|
|
1110
|
+
'&.mq-empty:before': {
|
|
1111
|
+
fontSize: '80%',
|
|
1112
|
+
left: 'calc(-13%)',
|
|
1113
|
+
top: '-0.25em'
|
|
1114
|
+
},
|
|
1115
|
+
'&.mq-empty:after': {
|
|
1116
|
+
fontSize: '80%',
|
|
1117
|
+
right: 'calc(-13%)',
|
|
1118
|
+
top: '-0.25em'
|
|
1119
|
+
},
|
|
1120
|
+
'&.mq-empty': {
|
|
1121
|
+
minHeight: '1.4em'
|
|
1122
|
+
}
|
|
1123
|
+
},
|
|
1124
|
+
'&.mq-arrow-right:before': {
|
|
1125
|
+
fontSize: '80%',
|
|
1126
|
+
right: 'calc(-13%)',
|
|
1127
|
+
top: '-0.25em'
|
|
1128
|
+
},
|
|
1129
|
+
'& .mq-overarrow-inner': {
|
|
1130
|
+
border: 'none !important'
|
|
1131
|
+
},
|
|
1132
|
+
'& .mq-overarrow-inner .mq-overarrow-inner-right': {
|
|
1133
|
+
display: 'none !important'
|
|
1134
|
+
}
|
|
1135
|
+
},
|
|
1136
|
+
'& .mq-root-block': {
|
|
1137
|
+
padding: '5px'
|
|
1138
|
+
},
|
|
1139
|
+
'& .mq-overarrow.mq-arrow-both.mq-empty:after': {
|
|
1140
|
+
right: '-6px',
|
|
1141
|
+
fontSize: '80% !important',
|
|
1142
|
+
top: '-3px'
|
|
1143
|
+
},
|
|
1144
|
+
'& .mq-overarrow.mq-arrow-right.mq-empty:before': {
|
|
1145
|
+
right: '-5px',
|
|
1146
|
+
fontSize: '80% !important',
|
|
1147
|
+
top: '-3px'
|
|
1148
|
+
},
|
|
1149
|
+
'& .mq-overarrow.mq-arrow-both.mq-empty:before': {
|
|
1150
|
+
left: '-6px',
|
|
1151
|
+
fontSize: '80% !important',
|
|
1152
|
+
top: '-3px'
|
|
1153
|
+
},
|
|
1154
|
+
'& .mq-longdiv-inner': {
|
|
1155
|
+
borderTop: '1px solid !important',
|
|
1156
|
+
paddingTop: '1.5px !important'
|
|
1157
|
+
},
|
|
1158
|
+
'& .mq-parallelogram': {
|
|
1159
|
+
lineHeight: 0.85
|
|
1160
|
+
},
|
|
1161
|
+
'& .mq-overarc': {
|
|
1162
|
+
borderTop: '2px solid black !important',
|
|
1163
|
+
'& .mq-overline-inner': {
|
|
1164
|
+
borderTop: 'none !important',
|
|
1165
|
+
paddingTop: '0 !important'
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
},
|
|
1169
|
+
parallelButton: {
|
|
1170
|
+
fontStyle: 'italic'
|
|
1171
|
+
},
|
|
1172
|
+
leftRightArrowButton: {
|
|
1173
|
+
'& .mq-overarrow.mq-arrow-both': {
|
|
1174
|
+
'& .mq-overline-inner': {
|
|
1175
|
+
borderTop: 'none !important',
|
|
1176
|
+
paddingTop: '0 !important'
|
|
1177
|
+
},
|
|
1178
|
+
'&:after': {
|
|
1179
|
+
top: '-1.64em !important'
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
}))(props => {
|
|
1184
|
+
let buttonClass;
|
|
1185
|
+
if (props.latex === '\\parallel') {
|
|
1186
|
+
buttonClass = classNames$3(props.classes.latexButton, props.mqClassName, props.classes.parallelButton);
|
|
1187
|
+
} else if (props.latex === '\\overleftrightarrow{\\overline{}}') {
|
|
1188
|
+
buttonClass = classNames$3(props.classes.latexButton, props.mqClassName, props.classes.leftRightArrowButton);
|
|
1189
|
+
} else {
|
|
1190
|
+
buttonClass = classNames$3(props.classes.latexButton, props.mqClassName);
|
|
1191
|
+
}
|
|
1192
|
+
try {
|
|
1193
|
+
const MQ = MathQuill.getInterface(2);
|
|
1194
|
+
const span = document.createElement('span');
|
|
1195
|
+
span.innerHTML = '';
|
|
1196
|
+
const mathField = MQ.StaticMath(span);
|
|
1197
|
+
mathField.parseLatex(props.latex);
|
|
1198
|
+
mathField.latex(props.latex);
|
|
1199
|
+
} catch (e) {
|
|
1200
|
+
return React$c.createElement(React$c.Fragment, null);
|
|
1201
|
+
}
|
|
1202
|
+
return React$c.createElement(Button$2, {
|
|
1203
|
+
className: classNames$3(props.classes.root, props.className),
|
|
1204
|
+
onClick: props.onClick,
|
|
1205
|
+
__self: undefined,
|
|
1206
|
+
__source: {
|
|
1207
|
+
fileName: _jsxFileName$b,
|
|
1208
|
+
lineNumber: 163
|
|
1209
|
+
}
|
|
1210
|
+
}, React$c.createElement(Static$1, {
|
|
1211
|
+
className: buttonClass,
|
|
1212
|
+
latex: props.latex,
|
|
1213
|
+
__self: undefined,
|
|
1214
|
+
__source: {
|
|
1215
|
+
fileName: _jsxFileName$b,
|
|
1216
|
+
lineNumber: 164
|
|
1217
|
+
}
|
|
1218
|
+
}));
|
|
1219
|
+
});
|
|
1220
|
+
class KeyPad$1 extends React$c.Component {
|
|
1221
|
+
constructor(...args) {
|
|
1222
|
+
super(...args);
|
|
1223
|
+
KeyPad$1.prototype.__init.call(this);
|
|
1224
|
+
KeyPad$1.prototype.__init2.call(this);
|
|
1225
|
+
KeyPad$1.prototype.__init3.call(this);
|
|
1226
|
+
}
|
|
1227
|
+
static __initStatic() {
|
|
1228
|
+
this.propTypes = {
|
|
1229
|
+
classes: PropTypes$b.object.isRequired,
|
|
1230
|
+
className: PropTypes$b.string,
|
|
1231
|
+
baseSet: PropTypes$b.array,
|
|
1232
|
+
additionalKeys: PropTypes$b.array,
|
|
1233
|
+
onPress: PropTypes$b.func.isRequired,
|
|
1234
|
+
onFocus: PropTypes$b.func,
|
|
1235
|
+
noDecimal: PropTypes$b.bool,
|
|
1236
|
+
mode: PropTypes$b.string
|
|
1237
|
+
};
|
|
1238
|
+
}
|
|
1239
|
+
static __initStatic2() {
|
|
1240
|
+
this.defaultProps = {
|
|
1241
|
+
baseSet: baseSet$1,
|
|
1242
|
+
noDecimal: false
|
|
1243
|
+
};
|
|
1244
|
+
}
|
|
1245
|
+
__init() {
|
|
1246
|
+
this.buttonClick = key => {
|
|
1247
|
+
log$8('[buttonClick]', key);
|
|
1248
|
+
const {onPress} = this.props;
|
|
1249
|
+
onPress(key);
|
|
1250
|
+
};
|
|
1251
|
+
}
|
|
1252
|
+
__init2() {
|
|
1253
|
+
this.flowKeys = (base, extras) => {
|
|
1254
|
+
const transposed = [...sortKeys$1(base), ...sortKeys$1(extras)];
|
|
1255
|
+
return _$3.flatten(transposed);
|
|
1256
|
+
};
|
|
1257
|
+
}
|
|
1258
|
+
__init3() {
|
|
1259
|
+
this.keyIsNotAllowed = key => {
|
|
1260
|
+
const {noDecimal} = this.props;
|
|
1261
|
+
if ((key.write === '.' && key.label === '.' || key.write === ',' && key.label === ',') && noDecimal) {
|
|
1262
|
+
return true;
|
|
1263
|
+
}
|
|
1264
|
+
return false;
|
|
1265
|
+
};
|
|
1266
|
+
}
|
|
1267
|
+
render() {
|
|
1268
|
+
const {classes, className, baseSet, additionalKeys, onFocus, mode} = this.props;
|
|
1269
|
+
const noBaseSet = ['non-negative-integers', 'integers', 'decimals', 'fractions', 'item-authoring'];
|
|
1270
|
+
const keysWithoutBaseSet = noBaseSet.includes(mode);
|
|
1271
|
+
const allKeys = keysWithoutBaseSet ? this.flowKeys([], additionalKeys || []) : this.flowKeys(baseSet, additionalKeys || []);
|
|
1272
|
+
const shift = allKeys.length % 5 ? 1 : 0;
|
|
1273
|
+
const style = {
|
|
1274
|
+
gridTemplateColumns: `repeat(${Math.floor(allKeys.length / 5) + shift}, minmax(min-content, 150px))`
|
|
1275
|
+
};
|
|
1276
|
+
return React$c.createElement('div', {
|
|
1277
|
+
className: classNames$3(classes.keys, className),
|
|
1278
|
+
style: style,
|
|
1279
|
+
onFocus: onFocus,
|
|
1280
|
+
__self: this,
|
|
1281
|
+
__source: {
|
|
1282
|
+
fileName: _jsxFileName$b,
|
|
1283
|
+
lineNumber: 231
|
|
1284
|
+
}
|
|
1285
|
+
}, allKeys.map((k, index) => {
|
|
1286
|
+
const onClick = this.buttonClick.bind(this, k);
|
|
1287
|
+
if (!k) {
|
|
1288
|
+
return React$c.createElement('span', {
|
|
1289
|
+
key: `empty-${index}`,
|
|
1290
|
+
__self: this,
|
|
1291
|
+
__source: {
|
|
1292
|
+
fileName: _jsxFileName$b,
|
|
1293
|
+
lineNumber: 236
|
|
1294
|
+
}
|
|
1295
|
+
});
|
|
1296
|
+
}
|
|
1297
|
+
const common = {
|
|
1298
|
+
onClick,
|
|
1299
|
+
className: classNames$3(classes.labelButton, !keysWithoutBaseSet && classes[k.category], k.label === ',' && classes.comma, k.label === '.' && classes.dot),
|
|
1300
|
+
disabled: this.keyIsNotAllowed(k),
|
|
1301
|
+
key: `${k.label || k.latex || k.command}-${index}`
|
|
1302
|
+
};
|
|
1303
|
+
if (k.latex) {
|
|
1304
|
+
return React$c.createElement(LatexButton$1, {
|
|
1305
|
+
latex: k.latex,
|
|
1306
|
+
...common,
|
|
1307
|
+
className: classes.latexButton,
|
|
1308
|
+
__self: this,
|
|
1309
|
+
__source: {
|
|
1310
|
+
fileName: _jsxFileName$b,
|
|
1311
|
+
lineNumber: 252
|
|
1312
|
+
}
|
|
1313
|
+
});
|
|
1314
|
+
}
|
|
1315
|
+
if (k.label) {
|
|
1316
|
+
return React$c.createElement(Button$2, {
|
|
1317
|
+
...common,
|
|
1318
|
+
__self: this,
|
|
1319
|
+
__source: {
|
|
1320
|
+
fileName: _jsxFileName$b,
|
|
1321
|
+
lineNumber: 256
|
|
1322
|
+
}
|
|
1323
|
+
}, k.label);
|
|
1324
|
+
} else {
|
|
1325
|
+
const Icon = k.icon ? k.icon : 'div';
|
|
1326
|
+
return React$c.createElement(IconButton$2, {
|
|
1327
|
+
tabIndex: '-1',
|
|
1328
|
+
...common,
|
|
1329
|
+
__self: this,
|
|
1330
|
+
__source: {
|
|
1331
|
+
fileName: _jsxFileName$b,
|
|
1332
|
+
lineNumber: 261
|
|
1333
|
+
}
|
|
1334
|
+
}, React$c.createElement(Icon, {
|
|
1335
|
+
className: classes.icon,
|
|
1336
|
+
__self: this,
|
|
1337
|
+
__source: {
|
|
1338
|
+
fileName: _jsxFileName$b,
|
|
1339
|
+
lineNumber: 262
|
|
1340
|
+
}
|
|
1341
|
+
}));
|
|
1342
|
+
}
|
|
1343
|
+
}));
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
KeyPad$1.__initStatic();
|
|
1347
|
+
KeyPad$1.__initStatic2();
|
|
1348
|
+
const styles$6 = theme => ({
|
|
1349
|
+
keys: {
|
|
1350
|
+
'& *': {
|
|
1351
|
+
fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'
|
|
1352
|
+
},
|
|
1353
|
+
width: '100%',
|
|
1354
|
+
display: 'grid',
|
|
1355
|
+
gridTemplateRows: 'repeat(5, minmax(40px, 60px))',
|
|
1356
|
+
gridRowGap: '0px',
|
|
1357
|
+
gridColumnGap: '0px',
|
|
1358
|
+
gridAutoFlow: 'column'
|
|
1359
|
+
},
|
|
1360
|
+
holder: {
|
|
1361
|
+
position: 'relative',
|
|
1362
|
+
width: '100%',
|
|
1363
|
+
height: '100%',
|
|
1364
|
+
backgroundColor: '#cef',
|
|
1365
|
+
borderRadius: 0,
|
|
1366
|
+
padding: `${theme.spacing.unit}px 0 ${theme.spacing.unit}px 0`
|
|
1367
|
+
},
|
|
1368
|
+
labelButton: {
|
|
1369
|
+
minWidth: 'auto',
|
|
1370
|
+
fontSize: '140% !important',
|
|
1371
|
+
backgroundColor: lighten$1(theme.palette.primary.light, 0.5),
|
|
1372
|
+
'&:hover': {
|
|
1373
|
+
backgroundColor: lighten$1(theme.palette.primary.light, 0.7)
|
|
1374
|
+
},
|
|
1375
|
+
borderRadius: 0
|
|
1376
|
+
},
|
|
1377
|
+
latexButton: {
|
|
1378
|
+
minWidth: 'auto',
|
|
1379
|
+
borderRadius: 0,
|
|
1380
|
+
backgroundColor: lighten$1(theme.palette.primary.light, 0.5),
|
|
1381
|
+
'&:hover': {
|
|
1382
|
+
backgroundColor: lighten$1(theme.palette.primary.light, 0.7)
|
|
1383
|
+
}
|
|
1384
|
+
},
|
|
1385
|
+
base: {},
|
|
1386
|
+
operators: {
|
|
1387
|
+
backgroundColor: lighten$1(theme.palette.secondary.light, 0.5),
|
|
1388
|
+
'&:hover': {
|
|
1389
|
+
backgroundColor: lighten$1(theme.palette.secondary.light, 0.7)
|
|
1390
|
+
}
|
|
1391
|
+
},
|
|
1392
|
+
comparison: {
|
|
1393
|
+
backgroundColor: lighten$1(green$1[500], 0.5),
|
|
1394
|
+
'&:hover': {
|
|
1395
|
+
backgroundColor: lighten$1(green$1[500], 0.7)
|
|
1396
|
+
}
|
|
1397
|
+
},
|
|
1398
|
+
comma: {
|
|
1399
|
+
fontSize: '200% !important',
|
|
1400
|
+
lineHeight: '100%'
|
|
1401
|
+
},
|
|
1402
|
+
dot: {
|
|
1403
|
+
fontSize: '200% !important',
|
|
1404
|
+
lineHeight: '100%'
|
|
1405
|
+
},
|
|
1406
|
+
icon: {
|
|
1407
|
+
height: '30px'
|
|
1408
|
+
}
|
|
1409
|
+
});
|
|
1410
|
+
var Keypad$1 = withStyles$8(styles$6)(KeyPad$1);
|
|
1411
|
+
const React$b = _dll_react;
|
|
1412
|
+
const PropTypes$a = _dll_prop_types;
|
|
1413
|
+
const _jsxFileName$a = "/home/circleci/repo/node_modules/@pie-lib/math-input/src/horizontal-keypad.jsx";
|
|
1414
|
+
const toOldModel$1 = d => {
|
|
1415
|
+
if (d.command) {
|
|
1416
|
+
return {
|
|
1417
|
+
value: d.command,
|
|
1418
|
+
type: 'command'
|
|
1419
|
+
};
|
|
1420
|
+
} else if (d.write) {
|
|
1421
|
+
return {
|
|
1422
|
+
value: d.write
|
|
1423
|
+
};
|
|
1424
|
+
} else if (d.keystroke) {
|
|
1425
|
+
return {
|
|
1426
|
+
type: 'cursor',
|
|
1427
|
+
value: d.keystroke
|
|
1428
|
+
};
|
|
1429
|
+
}
|
|
1430
|
+
};
|
|
1431
|
+
class HorizontalKeypad$1 extends React$b.Component {
|
|
1432
|
+
constructor(...args) {
|
|
1433
|
+
super(...args);
|
|
1434
|
+
HorizontalKeypad$1.prototype.__init.call(this);
|
|
1435
|
+
}
|
|
1436
|
+
static __initStatic() {
|
|
1437
|
+
this.propTypes = {
|
|
1438
|
+
className: PropTypes$a.string,
|
|
1439
|
+
mode: PropTypes$a.oneOfType([PropTypes$a.string, PropTypes$a.number]),
|
|
1440
|
+
onClick: PropTypes$a.func.isRequired,
|
|
1441
|
+
onFocus: PropTypes$a.func,
|
|
1442
|
+
noDecimal: PropTypes$a.bool,
|
|
1443
|
+
additionalKeys: PropTypes$a.array
|
|
1444
|
+
};
|
|
1445
|
+
}
|
|
1446
|
+
static __initStatic2() {
|
|
1447
|
+
this.defaultProps = {
|
|
1448
|
+
mode: 'scientific',
|
|
1449
|
+
noDecimal: false,
|
|
1450
|
+
additionalKeys: []
|
|
1451
|
+
};
|
|
1452
|
+
}
|
|
1453
|
+
__init() {
|
|
1454
|
+
this.keypadPress = data => {
|
|
1455
|
+
const {onClick} = this.props;
|
|
1456
|
+
onClick(toOldModel$1(data));
|
|
1457
|
+
};
|
|
1458
|
+
}
|
|
1459
|
+
render() {
|
|
1460
|
+
const {mode, onFocus, noDecimal, className, additionalKeys} = this.props;
|
|
1461
|
+
const normalizedKeys = normalizeAdditionalKeys$1(additionalKeys);
|
|
1462
|
+
return React$b.createElement(Keypad$1, {
|
|
1463
|
+
className: className,
|
|
1464
|
+
onFocus: onFocus,
|
|
1465
|
+
noDecimal: noDecimal,
|
|
1466
|
+
additionalKeys: extendKeySet$1(keysForGrade$1(mode), normalizedKeys),
|
|
1467
|
+
onPress: this.keypadPress,
|
|
1468
|
+
mode: mode,
|
|
1469
|
+
__self: this,
|
|
1470
|
+
__source: {
|
|
1471
|
+
fileName: _jsxFileName$a,
|
|
1472
|
+
lineNumber: 44
|
|
1473
|
+
}
|
|
1474
|
+
});
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
HorizontalKeypad$1.__initStatic();
|
|
1478
|
+
HorizontalKeypad$1.__initStatic2();
|
|
1479
|
+
const updateSpans$1 = () => {
|
|
1480
|
+
const spans = Array.from(document.querySelectorAll('span[mathquill-command-id]'));
|
|
1481
|
+
(spans || []).forEach(span => {
|
|
1482
|
+
if (span && span.innerText === '∥' && span.className !== 'mq-editable-field') {
|
|
1483
|
+
span.style.fontSize = '32px';
|
|
1484
|
+
}
|
|
1485
|
+
});
|
|
1486
|
+
};
|
|
4
1487
|
const ResponseTypes = {
|
|
5
1488
|
advanced: 'Advanced Multi',
|
|
6
1489
|
simple: 'Simple'
|
|
7
1490
|
};
|
|
1491
|
+
const set$f = o => ({
|
|
1492
|
+
...o,
|
|
1493
|
+
category: 'comparison'
|
|
1494
|
+
});
|
|
1495
|
+
const lessThan = set$f({
|
|
1496
|
+
name: 'Less than',
|
|
1497
|
+
latex: '<',
|
|
1498
|
+
command: '\\lt'
|
|
1499
|
+
});
|
|
1500
|
+
const greaterThan = set$f({
|
|
1501
|
+
name: 'Greater than',
|
|
1502
|
+
latex: '>',
|
|
1503
|
+
command: '\\gt'
|
|
1504
|
+
});
|
|
1505
|
+
const lessThanEqual = set$f({
|
|
1506
|
+
name: 'Less than or equal',
|
|
1507
|
+
latex: '\\le',
|
|
1508
|
+
symbol: '<=',
|
|
1509
|
+
command: '\\le'
|
|
1510
|
+
});
|
|
1511
|
+
const greaterThanEqual = set$f({
|
|
1512
|
+
name: 'Greater than or equal',
|
|
1513
|
+
symbol: '>=',
|
|
1514
|
+
command: '\\ge',
|
|
1515
|
+
latex: '\\ge'
|
|
1516
|
+
});
|
|
1517
|
+
var comparison = Object.freeze({
|
|
1518
|
+
__proto__: null,
|
|
1519
|
+
lessThan: lessThan,
|
|
1520
|
+
greaterThan: greaterThan,
|
|
1521
|
+
lessThanEqual: lessThanEqual,
|
|
1522
|
+
greaterThanEqual: greaterThanEqual
|
|
1523
|
+
});
|
|
1524
|
+
const _$2 = _dll_lodash;
|
|
1525
|
+
const mkSet = category => o => ({
|
|
1526
|
+
...o,
|
|
1527
|
+
category
|
|
1528
|
+
});
|
|
1529
|
+
const transformToKeySetStructure = (data = []) => {
|
|
1530
|
+
const structure = [];
|
|
1531
|
+
_$2.times(5, () => {
|
|
1532
|
+
structure.push([]);
|
|
1533
|
+
});
|
|
1534
|
+
let ln = data.length;
|
|
1535
|
+
let i = 0;
|
|
1536
|
+
let j = 0;
|
|
1537
|
+
while (j < ln) {
|
|
1538
|
+
structure[i++].push(data[j++]);
|
|
1539
|
+
if (i === 5) {
|
|
1540
|
+
i = 0;
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
return structure;
|
|
1544
|
+
};
|
|
1545
|
+
const latexAndNameDontExist = base => k => {
|
|
1546
|
+
const flattened = _$2.flatten(base);
|
|
1547
|
+
const latexExists = flattened.some(b => b.latex === k.latex);
|
|
1548
|
+
const nameExists = flattened.some(b => b.name === k.name);
|
|
1549
|
+
return !latexExists && !nameExists;
|
|
1550
|
+
};
|
|
1551
|
+
const extendKeySet = (base = [], keySetData = []) => {
|
|
1552
|
+
keySetData = keySetData.filter(latexAndNameDontExist(base));
|
|
1553
|
+
const final = [];
|
|
1554
|
+
_$2.times(5 - base.length, () => {
|
|
1555
|
+
base.push([]);
|
|
1556
|
+
});
|
|
1557
|
+
_$2.times(5, () => {
|
|
1558
|
+
final.push([]);
|
|
1559
|
+
});
|
|
1560
|
+
const extra = transformToKeySetStructure(keySetData);
|
|
1561
|
+
for (let i = 0; i < 5; i++) {
|
|
1562
|
+
final[i] = [...base[i], ...extra[i]];
|
|
1563
|
+
}
|
|
1564
|
+
return final;
|
|
1565
|
+
};
|
|
1566
|
+
const set$e = mkSet('vars');
|
|
1567
|
+
const x = set$e({
|
|
1568
|
+
name: 'X',
|
|
1569
|
+
latex: 'x',
|
|
1570
|
+
write: 'x'
|
|
1571
|
+
});
|
|
1572
|
+
const y = set$e({
|
|
1573
|
+
name: 'Y',
|
|
1574
|
+
latex: 'y',
|
|
1575
|
+
write: 'y'
|
|
1576
|
+
});
|
|
1577
|
+
const theta = set$e({
|
|
1578
|
+
name: 'Theta',
|
|
1579
|
+
latex: '\\theta',
|
|
1580
|
+
write: '\\theta'
|
|
1581
|
+
});
|
|
1582
|
+
var vars = Object.freeze({
|
|
1583
|
+
__proto__: null,
|
|
1584
|
+
x: x,
|
|
1585
|
+
y: y,
|
|
1586
|
+
theta: theta
|
|
1587
|
+
});
|
|
1588
|
+
const set$d = mkSet('fractions');
|
|
1589
|
+
const blankOverBlank = set$d({
|
|
1590
|
+
name: 'blank/blank',
|
|
1591
|
+
latex: '\\frac{}{}',
|
|
1592
|
+
command: '\\frac'
|
|
1593
|
+
});
|
|
1594
|
+
const xOverBlank = set$d({
|
|
1595
|
+
latex: '\\frac{x}{ }',
|
|
1596
|
+
name: 'X/blank',
|
|
1597
|
+
label: 'x/[]',
|
|
1598
|
+
command: '/'
|
|
1599
|
+
});
|
|
1600
|
+
const xBlankBlank = set$d({
|
|
1601
|
+
name: 'X (blank/blank)',
|
|
1602
|
+
latex: 'x\\frac{}{}',
|
|
1603
|
+
label: 'x([]/[])',
|
|
1604
|
+
command: '\\frac'
|
|
1605
|
+
});
|
|
1606
|
+
var fractions = Object.freeze({
|
|
1607
|
+
__proto__: null,
|
|
1608
|
+
blankOverBlank: blankOverBlank,
|
|
1609
|
+
xOverBlank: xOverBlank,
|
|
1610
|
+
xBlankBlank: xBlankBlank
|
|
1611
|
+
});
|
|
1612
|
+
const set$c = mkSet('exponent');
|
|
1613
|
+
const squared = set$c({
|
|
1614
|
+
name: 'Squared',
|
|
1615
|
+
latex: 'x^2',
|
|
1616
|
+
write: '^2'
|
|
1617
|
+
});
|
|
1618
|
+
const xToPowerOfN = set$c({
|
|
1619
|
+
name: 'X to the power of n',
|
|
1620
|
+
latex: 'x^{}',
|
|
1621
|
+
command: '^'
|
|
1622
|
+
});
|
|
1623
|
+
const squareRoot = set$c({
|
|
1624
|
+
name: 'Square root',
|
|
1625
|
+
latex: '\\sqrt{}',
|
|
1626
|
+
command: '\\sqrt'
|
|
1627
|
+
});
|
|
1628
|
+
const nthRoot = set$c({
|
|
1629
|
+
name: 'Nth root',
|
|
1630
|
+
latex: '\\sqrt[{}]{}',
|
|
1631
|
+
command: '\\nthroot'
|
|
1632
|
+
});
|
|
1633
|
+
var exponent = Object.freeze({
|
|
1634
|
+
__proto__: null,
|
|
1635
|
+
squared: squared,
|
|
1636
|
+
xToPowerOfN: xToPowerOfN,
|
|
1637
|
+
squareRoot: squareRoot,
|
|
1638
|
+
nthRoot: nthRoot
|
|
1639
|
+
});
|
|
1640
|
+
const set$b = mkSet('misc');
|
|
1641
|
+
const plusMinus = set$b({
|
|
1642
|
+
name: 'Plus/Minus',
|
|
1643
|
+
latex: '\\pm',
|
|
1644
|
+
write: '\\pm'
|
|
1645
|
+
});
|
|
1646
|
+
const absValue = set$b({
|
|
1647
|
+
name: 'Absolute Value',
|
|
1648
|
+
latex: '\\abs{}',
|
|
1649
|
+
symbol: '| |',
|
|
1650
|
+
command: '|'
|
|
1651
|
+
});
|
|
1652
|
+
const parenthesis = set$b({
|
|
1653
|
+
name: 'Parenthesis',
|
|
1654
|
+
latex: '\\left(\\right)',
|
|
1655
|
+
symbol: '( )',
|
|
1656
|
+
command: '('
|
|
1657
|
+
});
|
|
1658
|
+
const brackets = set$b({
|
|
1659
|
+
name: 'Brackets',
|
|
1660
|
+
latex: '\\left[\\right]',
|
|
1661
|
+
symbol: '[ ]',
|
|
1662
|
+
command: '['
|
|
1663
|
+
});
|
|
1664
|
+
const percentage = set$b({
|
|
1665
|
+
name: 'Percentage',
|
|
1666
|
+
latex: '%',
|
|
1667
|
+
command: '%'
|
|
1668
|
+
});
|
|
1669
|
+
const approx = set$b({
|
|
1670
|
+
latex: '\\approx',
|
|
1671
|
+
command: '\\approx'
|
|
1672
|
+
});
|
|
1673
|
+
const nApprox = set$b({
|
|
1674
|
+
latex: '\\napprox',
|
|
1675
|
+
command: '\\napprox'
|
|
1676
|
+
});
|
|
1677
|
+
const notEqual = set$b({
|
|
1678
|
+
latex: '\\neq',
|
|
1679
|
+
command: '\\neq'
|
|
1680
|
+
});
|
|
1681
|
+
const similar = set$b({
|
|
1682
|
+
latex: '\\sim',
|
|
1683
|
+
command: '\\sim'
|
|
1684
|
+
});
|
|
1685
|
+
const notSimilar = set$b({
|
|
1686
|
+
latex: '\\nsim',
|
|
1687
|
+
command: '\\nsim'
|
|
1688
|
+
});
|
|
1689
|
+
var misc = Object.freeze({
|
|
1690
|
+
__proto__: null,
|
|
1691
|
+
plusMinus: plusMinus,
|
|
1692
|
+
absValue: absValue,
|
|
1693
|
+
parenthesis: parenthesis,
|
|
1694
|
+
brackets: brackets,
|
|
1695
|
+
percentage: percentage,
|
|
1696
|
+
approx: approx,
|
|
1697
|
+
nApprox: nApprox,
|
|
1698
|
+
notEqual: notEqual,
|
|
1699
|
+
similar: similar,
|
|
1700
|
+
notSimilar: notSimilar
|
|
1701
|
+
});
|
|
1702
|
+
const set$a = mkSet('constants');
|
|
1703
|
+
const pi = set$a({
|
|
1704
|
+
name: 'Pi',
|
|
1705
|
+
label: 'π',
|
|
1706
|
+
latex: '\\pi',
|
|
1707
|
+
command: '\\pi',
|
|
1708
|
+
category: 'constants'
|
|
1709
|
+
});
|
|
1710
|
+
const eulers = set$a({
|
|
1711
|
+
name: 'Eulers',
|
|
1712
|
+
label: 'e',
|
|
1713
|
+
latex: 'e',
|
|
1714
|
+
command: 'e',
|
|
1715
|
+
category: 'constants'
|
|
1716
|
+
});
|
|
1717
|
+
const infinity = set$a({
|
|
1718
|
+
name: 'Infinity',
|
|
1719
|
+
label: '\\infty',
|
|
1720
|
+
latex: '\\infty',
|
|
1721
|
+
command: '\\infty',
|
|
1722
|
+
category: 'constants'
|
|
1723
|
+
});
|
|
1724
|
+
const halfInfinity = set$a({
|
|
1725
|
+
name: 'Half Infinity',
|
|
1726
|
+
label: '\\propto',
|
|
1727
|
+
latex: '\\propto',
|
|
1728
|
+
command: '\\propto',
|
|
1729
|
+
category: 'constants'
|
|
1730
|
+
});
|
|
1731
|
+
var constants = Object.freeze({
|
|
1732
|
+
__proto__: null,
|
|
1733
|
+
pi: pi,
|
|
1734
|
+
eulers: eulers,
|
|
1735
|
+
infinity: infinity,
|
|
1736
|
+
halfInfinity: halfInfinity
|
|
1737
|
+
});
|
|
1738
|
+
const set$9 = mkSet('trigonometry');
|
|
1739
|
+
const sin = set$9({
|
|
1740
|
+
name: 'sin',
|
|
1741
|
+
label: 'sin',
|
|
1742
|
+
command: '\\sin',
|
|
1743
|
+
latex: '\\sin'
|
|
1744
|
+
});
|
|
1745
|
+
const cos = set$9({
|
|
1746
|
+
name: 'cos',
|
|
1747
|
+
label: 'cos',
|
|
1748
|
+
command: '\\cos',
|
|
1749
|
+
latex: '\\cos'
|
|
1750
|
+
});
|
|
1751
|
+
const tan = set$9({
|
|
1752
|
+
name: 'tan',
|
|
1753
|
+
label: 'tan',
|
|
1754
|
+
command: '\\tan',
|
|
1755
|
+
latex: '\\tan'
|
|
1756
|
+
});
|
|
1757
|
+
const sec = set$9({
|
|
1758
|
+
name: 'sec',
|
|
1759
|
+
label: 'sec',
|
|
1760
|
+
command: '\\sec',
|
|
1761
|
+
latex: '\\sec'
|
|
1762
|
+
});
|
|
1763
|
+
const csc = set$9({
|
|
1764
|
+
name: 'csc',
|
|
1765
|
+
label: 'csc',
|
|
1766
|
+
command: '\\csc',
|
|
1767
|
+
latex: '\\csc'
|
|
1768
|
+
});
|
|
1769
|
+
const cot = set$9({
|
|
1770
|
+
name: 'cot',
|
|
1771
|
+
label: 'cot',
|
|
1772
|
+
command: '\\cot',
|
|
1773
|
+
latex: '\\cot'
|
|
1774
|
+
});
|
|
1775
|
+
var trigonometry = Object.freeze({
|
|
1776
|
+
__proto__: null,
|
|
1777
|
+
sin: sin,
|
|
1778
|
+
cos: cos,
|
|
1779
|
+
tan: tan,
|
|
1780
|
+
sec: sec,
|
|
1781
|
+
csc: csc,
|
|
1782
|
+
cot: cot
|
|
1783
|
+
});
|
|
1784
|
+
const set$8 = o => ({
|
|
1785
|
+
...o,
|
|
1786
|
+
category: 'geometry'
|
|
1787
|
+
});
|
|
1788
|
+
const overline = set$8({
|
|
1789
|
+
name: 'Overline',
|
|
1790
|
+
latex: '\\overline{}',
|
|
1791
|
+
command: '\\overline'
|
|
1792
|
+
});
|
|
1793
|
+
const overRightArrow = set$8({
|
|
1794
|
+
name: 'Overline',
|
|
1795
|
+
latex: '\\overrightarrow{}',
|
|
1796
|
+
command: '\\overrightarrow'
|
|
1797
|
+
});
|
|
1798
|
+
const overLeftRightArrow = set$8({
|
|
1799
|
+
name: 'Overline',
|
|
1800
|
+
latex: '\\overleftrightarrow{\\overline{}}',
|
|
1801
|
+
symbol: 'AB',
|
|
1802
|
+
command: '\\overleftrightarrow'
|
|
1803
|
+
});
|
|
1804
|
+
const segment = set$8({
|
|
1805
|
+
name: 'Segment',
|
|
1806
|
+
latex: '\\overleftrightarrow{AB}',
|
|
1807
|
+
write: '\\overleftrightarrow{AB}',
|
|
1808
|
+
label: 'AB'
|
|
1809
|
+
});
|
|
1810
|
+
const parallel = set$8({
|
|
1811
|
+
name: 'Parallel',
|
|
1812
|
+
latex: '\\parallel',
|
|
1813
|
+
command: '\\parallel'
|
|
1814
|
+
});
|
|
1815
|
+
const notParallel = set$8({
|
|
1816
|
+
name: 'Not Parallel',
|
|
1817
|
+
latex: '\\nparallel',
|
|
1818
|
+
command: '\\nparallel'
|
|
1819
|
+
});
|
|
1820
|
+
const perpindicular = set$8({
|
|
1821
|
+
name: 'Perpendicular',
|
|
1822
|
+
latex: '\\perp',
|
|
1823
|
+
command: '\\perpendicular'
|
|
1824
|
+
});
|
|
1825
|
+
const angle = set$8({
|
|
1826
|
+
name: 'Angle',
|
|
1827
|
+
latex: '\\angle',
|
|
1828
|
+
command: '\\angle'
|
|
1829
|
+
});
|
|
1830
|
+
const overArc = set$8({
|
|
1831
|
+
name: 'Over arc',
|
|
1832
|
+
latex: '\\overarc{\\overline{}}',
|
|
1833
|
+
command: '\\overarc'
|
|
1834
|
+
});
|
|
1835
|
+
const measureOfAngle = set$8({
|
|
1836
|
+
name: 'Measure Of Angle',
|
|
1837
|
+
latex: '\\measuredangle',
|
|
1838
|
+
command: ['m', '\\angle']
|
|
1839
|
+
});
|
|
1840
|
+
const triangle = set$8({
|
|
1841
|
+
name: 'Triangle',
|
|
1842
|
+
latex: '\\triangle',
|
|
1843
|
+
command: '\\triangle'
|
|
1844
|
+
});
|
|
1845
|
+
const square = set$8({
|
|
1846
|
+
name: 'Square',
|
|
1847
|
+
latex: '\\square',
|
|
1848
|
+
command: '\\square'
|
|
1849
|
+
});
|
|
1850
|
+
const parallelogram = set$8({
|
|
1851
|
+
name: 'Parallelogram',
|
|
1852
|
+
latex: '\\parallelogram',
|
|
1853
|
+
command: '\\parallelogram'
|
|
1854
|
+
});
|
|
1855
|
+
const circledDot = set$8({
|
|
1856
|
+
name: 'Circled Dot',
|
|
1857
|
+
latex: '\\odot',
|
|
1858
|
+
command: '\\odot'
|
|
1859
|
+
});
|
|
1860
|
+
const degree = set$8({
|
|
1861
|
+
name: 'Degree',
|
|
1862
|
+
latex: '\\degree',
|
|
1863
|
+
command: '\\degree'
|
|
1864
|
+
});
|
|
1865
|
+
const similarTo = set$8({
|
|
1866
|
+
name: 'Similar To',
|
|
1867
|
+
command: '\\sim',
|
|
1868
|
+
latex: '\\sim'
|
|
1869
|
+
});
|
|
1870
|
+
const congruentTo = set$8({
|
|
1871
|
+
name: 'Congruent To',
|
|
1872
|
+
command: '\\cong',
|
|
1873
|
+
latex: '\\cong'
|
|
1874
|
+
});
|
|
1875
|
+
const notCongruentTo = set$8({
|
|
1876
|
+
name: 'Not Congruent To',
|
|
1877
|
+
command: '\\ncong',
|
|
1878
|
+
latex: '\\ncong'
|
|
1879
|
+
});
|
|
1880
|
+
const primeArcminute = set$8({
|
|
1881
|
+
name: 'Prime',
|
|
1882
|
+
label: 'pam',
|
|
1883
|
+
latex: "'",
|
|
1884
|
+
write: "'"
|
|
1885
|
+
});
|
|
1886
|
+
const doublePrimeArcSecond = set$8({
|
|
1887
|
+
name: 'Double Prime/Arcsecond',
|
|
1888
|
+
latex: '"',
|
|
1889
|
+
write: '"'
|
|
1890
|
+
});
|
|
1891
|
+
const leftArrow = set$8({
|
|
1892
|
+
name: 'Left Arrow',
|
|
1893
|
+
latex: '\\leftarrow',
|
|
1894
|
+
command: '\\leftarrow'
|
|
1895
|
+
});
|
|
1896
|
+
const rightArrow = set$8({
|
|
1897
|
+
name: 'Right Arrow',
|
|
1898
|
+
latex: '\\rightarrow',
|
|
1899
|
+
command: '\\rightarrow'
|
|
1900
|
+
});
|
|
1901
|
+
const leftrightArrow = set$8({
|
|
1902
|
+
name: 'Left Right Arrow',
|
|
1903
|
+
latex: '\\leftrightarrow',
|
|
1904
|
+
command: '\\leftrightarrow'
|
|
1905
|
+
});
|
|
1906
|
+
var geometry = Object.freeze({
|
|
1907
|
+
__proto__: null,
|
|
1908
|
+
overline: overline,
|
|
1909
|
+
overRightArrow: overRightArrow,
|
|
1910
|
+
overLeftRightArrow: overLeftRightArrow,
|
|
1911
|
+
segment: segment,
|
|
1912
|
+
parallel: parallel,
|
|
1913
|
+
notParallel: notParallel,
|
|
1914
|
+
perpindicular: perpindicular,
|
|
1915
|
+
angle: angle,
|
|
1916
|
+
overArc: overArc,
|
|
1917
|
+
measureOfAngle: measureOfAngle,
|
|
1918
|
+
triangle: triangle,
|
|
1919
|
+
square: square,
|
|
1920
|
+
parallelogram: parallelogram,
|
|
1921
|
+
circledDot: circledDot,
|
|
1922
|
+
degree: degree,
|
|
1923
|
+
similarTo: similarTo,
|
|
1924
|
+
congruentTo: congruentTo,
|
|
1925
|
+
notCongruentTo: notCongruentTo,
|
|
1926
|
+
primeArcminute: primeArcminute,
|
|
1927
|
+
doublePrimeArcSecond: doublePrimeArcSecond,
|
|
1928
|
+
leftArrow: leftArrow,
|
|
1929
|
+
rightArrow: rightArrow,
|
|
1930
|
+
leftrightArrow: leftrightArrow
|
|
1931
|
+
});
|
|
1932
|
+
const set$7 = mkSet('operators');
|
|
1933
|
+
const circleDot = set$7({
|
|
1934
|
+
name: 'CircleDot',
|
|
1935
|
+
label: '⋅',
|
|
1936
|
+
write: '\\cdot'
|
|
1937
|
+
});
|
|
1938
|
+
var operators = Object.freeze({
|
|
1939
|
+
__proto__: null,
|
|
1940
|
+
circleDot: circleDot
|
|
1941
|
+
});
|
|
1942
|
+
const set$6 = mkSet('log');
|
|
1943
|
+
const log$6 = set$6({
|
|
1944
|
+
name: 'Log',
|
|
1945
|
+
label: 'log',
|
|
1946
|
+
command: '\\log',
|
|
1947
|
+
latex: '\\log'
|
|
1948
|
+
});
|
|
1949
|
+
const logSubscript = set$6({
|
|
1950
|
+
name: 'Log with subscript',
|
|
1951
|
+
label: 'log s',
|
|
1952
|
+
latex: '\\log_{}',
|
|
1953
|
+
command: ['\\log', '_', ' ']
|
|
1954
|
+
});
|
|
1955
|
+
const ln = set$6({
|
|
1956
|
+
name: 'Ln',
|
|
1957
|
+
label: 'ln',
|
|
1958
|
+
command: '\\ln',
|
|
1959
|
+
latex: '\\ln'
|
|
1960
|
+
});
|
|
1961
|
+
var log$7 = Object.freeze({
|
|
1962
|
+
__proto__: null,
|
|
1963
|
+
log: log$6,
|
|
1964
|
+
logSubscript: logSubscript,
|
|
1965
|
+
ln: ln
|
|
1966
|
+
});
|
|
1967
|
+
const set$5 = mkSet('sub-sup');
|
|
1968
|
+
const superscript = set$5({
|
|
1969
|
+
name: 'Superscript',
|
|
1970
|
+
latex: 'x^{}',
|
|
1971
|
+
command: '^'
|
|
1972
|
+
});
|
|
1973
|
+
const subscript = set$5({
|
|
1974
|
+
name: 'Subscript',
|
|
1975
|
+
latex: 'x_{}',
|
|
1976
|
+
command: '_'
|
|
1977
|
+
});
|
|
1978
|
+
var subSup = Object.freeze({
|
|
1979
|
+
__proto__: null,
|
|
1980
|
+
superscript: superscript,
|
|
1981
|
+
subscript: subscript
|
|
1982
|
+
});
|
|
1983
|
+
const set$4 = mkSet('statistics');
|
|
1984
|
+
const xBar = set$4({
|
|
1985
|
+
name: 'X Bar',
|
|
1986
|
+
label: 'x̄',
|
|
1987
|
+
latex: '\\overline{x}',
|
|
1988
|
+
write: '\\overline{x}'
|
|
1989
|
+
});
|
|
1990
|
+
const yBar = set$4({
|
|
1991
|
+
name: 'Y Bar',
|
|
1992
|
+
latex: '\\overline{y}',
|
|
1993
|
+
write: '\\overline{y}'
|
|
1994
|
+
});
|
|
1995
|
+
const mu = set$4({
|
|
1996
|
+
name: 'mu',
|
|
1997
|
+
label: 'mu',
|
|
1998
|
+
latex: '\\mu',
|
|
1999
|
+
write: '\\mu'
|
|
2000
|
+
});
|
|
2001
|
+
const sigma = set$4({
|
|
2002
|
+
name: 'Sigma',
|
|
2003
|
+
label: '\\Sigma',
|
|
2004
|
+
latex: '\\Sigma',
|
|
2005
|
+
write: '\\Sigma'
|
|
2006
|
+
});
|
|
2007
|
+
const smallSigma = set$4({
|
|
2008
|
+
name: 'sigma',
|
|
2009
|
+
label: '\\sigma',
|
|
2010
|
+
latex: '\\sigma',
|
|
2011
|
+
write: '\\sigma'
|
|
2012
|
+
});
|
|
2013
|
+
var statistics = Object.freeze({
|
|
2014
|
+
__proto__: null,
|
|
2015
|
+
xBar: xBar,
|
|
2016
|
+
yBar: yBar,
|
|
2017
|
+
mu: mu,
|
|
2018
|
+
sigma: sigma,
|
|
2019
|
+
smallSigma: smallSigma
|
|
2020
|
+
});
|
|
2021
|
+
const DELETE = '\u232B';
|
|
2022
|
+
const LEFT_ARROW = '◀';
|
|
2023
|
+
const RIGHT_ARROW = '▶';
|
|
2024
|
+
const DIVIDE = '\u00F7';
|
|
2025
|
+
const MULTIPLY = '\u00D7';
|
|
2026
|
+
const set$3 = mkSet('operators');
|
|
2027
|
+
const equals = set$3({
|
|
2028
|
+
write: '=',
|
|
2029
|
+
label: '='
|
|
2030
|
+
});
|
|
2031
|
+
const plus = set$3({
|
|
2032
|
+
write: '+',
|
|
2033
|
+
label: '+'
|
|
2034
|
+
});
|
|
2035
|
+
const minus = set$3({
|
|
2036
|
+
write: '−',
|
|
2037
|
+
label: '−'
|
|
2038
|
+
});
|
|
2039
|
+
const divide = set$3({
|
|
2040
|
+
name: 'divide',
|
|
2041
|
+
label: DIVIDE,
|
|
2042
|
+
command: '\\divide',
|
|
2043
|
+
otherNotation: '\\div'
|
|
2044
|
+
});
|
|
2045
|
+
const multiply = set$3({
|
|
2046
|
+
name: 'multiply',
|
|
2047
|
+
label: MULTIPLY,
|
|
2048
|
+
command: '\\times'
|
|
2049
|
+
});
|
|
2050
|
+
var basicOperators = Object.freeze({
|
|
2051
|
+
__proto__: null,
|
|
2052
|
+
equals: equals,
|
|
2053
|
+
plus: plus,
|
|
2054
|
+
minus: minus,
|
|
2055
|
+
divide: divide,
|
|
2056
|
+
multiply: multiply
|
|
2057
|
+
});
|
|
2058
|
+
const set$2 = mkSet('matrices');
|
|
2059
|
+
const singleCellMatrix = set$2({
|
|
2060
|
+
name: 'Single Cell Matrix',
|
|
2061
|
+
label: '[ ]',
|
|
2062
|
+
write: '\\begin{pmatrix}\\end{pmatrix}'
|
|
2063
|
+
});
|
|
2064
|
+
const doubleCellMatrix = set$2({
|
|
2065
|
+
name: 'Double Cell Matrix',
|
|
2066
|
+
label: '[ ] [ ] \\\\newline [ ] [ ]',
|
|
2067
|
+
write: '\\begin{bmatrix}&\\\\&\\end{bmatrix}'
|
|
2068
|
+
});
|
|
2069
|
+
var matrices = Object.freeze({
|
|
2070
|
+
__proto__: null,
|
|
2071
|
+
singleCellMatrix: singleCellMatrix,
|
|
2072
|
+
doubleCellMatrix: doubleCellMatrix
|
|
2073
|
+
});
|
|
2074
|
+
const {times: times} = _dll_lodash;
|
|
2075
|
+
const digitMap = {
|
|
2076
|
+
0: 'zero',
|
|
2077
|
+
1: 'one',
|
|
2078
|
+
2: 'two',
|
|
2079
|
+
3: 'three',
|
|
2080
|
+
4: 'four',
|
|
2081
|
+
5: 'five',
|
|
2082
|
+
6: 'six',
|
|
2083
|
+
7: 'seven',
|
|
2084
|
+
8: 'eight',
|
|
2085
|
+
9: 'nine'
|
|
2086
|
+
};
|
|
2087
|
+
const comma$1 = {
|
|
2088
|
+
name: 'comma',
|
|
2089
|
+
label: ',',
|
|
2090
|
+
write: ',',
|
|
2091
|
+
category: 'digit'
|
|
2092
|
+
};
|
|
2093
|
+
const decimalPoint$1 = {
|
|
2094
|
+
name: 'decimal-point',
|
|
2095
|
+
label: '.',
|
|
2096
|
+
write: '.',
|
|
2097
|
+
category: 'digit'
|
|
2098
|
+
};
|
|
2099
|
+
var digits = times(10, String).map(n => {
|
|
2100
|
+
return {
|
|
2101
|
+
name: digitMap[n],
|
|
2102
|
+
write: n,
|
|
2103
|
+
label: n,
|
|
2104
|
+
category: 'digit'
|
|
2105
|
+
};
|
|
2106
|
+
}).reduce((acc, o) => {
|
|
2107
|
+
acc[o.name] = o;
|
|
2108
|
+
return acc;
|
|
2109
|
+
}, {
|
|
2110
|
+
comma: comma$1,
|
|
2111
|
+
decimalPoint: decimalPoint$1
|
|
2112
|
+
});
|
|
2113
|
+
const set$1 = mkSet('logic');
|
|
2114
|
+
const therefore = set$1({
|
|
2115
|
+
name: 'Therefore',
|
|
2116
|
+
label: '∴',
|
|
2117
|
+
write: '∴'
|
|
2118
|
+
});
|
|
2119
|
+
const longDivision = set$1({
|
|
2120
|
+
name: 'Long division',
|
|
2121
|
+
latex: '\\longdiv{}',
|
|
2122
|
+
command: '\\longdiv'
|
|
2123
|
+
});
|
|
2124
|
+
const set = mkSet('navigation');
|
|
2125
|
+
const left = set({
|
|
2126
|
+
label: LEFT_ARROW,
|
|
2127
|
+
keystroke: 'Left'
|
|
2128
|
+
});
|
|
2129
|
+
const right = set({
|
|
2130
|
+
label: RIGHT_ARROW,
|
|
2131
|
+
keystroke: 'Right'
|
|
2132
|
+
});
|
|
2133
|
+
const del = {
|
|
2134
|
+
label: DELETE,
|
|
2135
|
+
category: 'edit',
|
|
2136
|
+
keystroke: 'Backspace'
|
|
2137
|
+
};
|
|
2138
|
+
const hs = [[blankOverBlank, percentage, x, squared, squareRoot], [circleDot, y, subscript, xToPowerOfN, nthRoot], [plusMinus, lessThan, greaterThan, lessThanEqual, greaterThanEqual], [pi, theta, parenthesis, brackets, absValue], [notEqual, sin, cos, tan, degree]];
|
|
2139
|
+
const advancedAlgebra = (() => {
|
|
2140
|
+
const out = [...hs.map(arr => [...arr])];
|
|
2141
|
+
out[0].push({
|
|
2142
|
+
name: 'i',
|
|
2143
|
+
latex: 'i',
|
|
2144
|
+
write: 'i'
|
|
2145
|
+
});
|
|
2146
|
+
out[1].push(log$6);
|
|
2147
|
+
out[2].push(logSubscript);
|
|
2148
|
+
out[3].push(ln);
|
|
2149
|
+
out[4].push(eulers);
|
|
2150
|
+
return out;
|
|
2151
|
+
})();
|
|
2152
|
+
const statisticsSet = (() => {
|
|
2153
|
+
const out = [...hs.map(arr => [...arr])];
|
|
2154
|
+
out[0].push(mu);
|
|
2155
|
+
out[1].push(xBar);
|
|
2156
|
+
out[2].push(yBar);
|
|
2157
|
+
out[3].push(sigma);
|
|
2158
|
+
out[4].push(smallSigma);
|
|
2159
|
+
return out;
|
|
2160
|
+
})();
|
|
2161
|
+
const gradeSets = [{
|
|
2162
|
+
predicate: n => n >= 3 && n <= 5,
|
|
2163
|
+
set: [[lessThan, greaterThan], [xOverBlank, xBlankBlank], [x, longDivision]]
|
|
2164
|
+
}, {
|
|
2165
|
+
predicate: n => n >= 6 && n <= 7,
|
|
2166
|
+
set: [[degree, lessThan, greaterThan], [circleDot, lessThanEqual, greaterThanEqual], [x, y, squared, xToPowerOfN], [plusMinus, xOverBlank, xBlankBlank, squareRoot], [pi, parenthesis, absValue, nthRoot]]
|
|
2167
|
+
}, {
|
|
2168
|
+
predicate: n => n >= 8 || n === 'HS',
|
|
2169
|
+
set: hs
|
|
2170
|
+
}, {
|
|
2171
|
+
predicate: 'non-negative-integers',
|
|
2172
|
+
set: [[digits.seven, digits.eight, digits.nine], [digits.four, digits.five, digits.six], [digits.one, digits.two, digits.three], [digits.zero, {
|
|
2173
|
+
name: '',
|
|
2174
|
+
latex: '',
|
|
2175
|
+
write: ''
|
|
2176
|
+
}, {
|
|
2177
|
+
name: '',
|
|
2178
|
+
latex: '',
|
|
2179
|
+
write: ''
|
|
2180
|
+
}], [left, right, del]]
|
|
2181
|
+
}, {
|
|
2182
|
+
predicate: 'integers',
|
|
2183
|
+
set: [[digits.seven, digits.eight, digits.nine], [digits.four, digits.five, digits.six], [digits.one, digits.two, digits.three], [digits.zero, {
|
|
2184
|
+
name: '',
|
|
2185
|
+
latex: '',
|
|
2186
|
+
write: ''
|
|
2187
|
+
}, minus], [left, right, del]]
|
|
2188
|
+
}, {
|
|
2189
|
+
predicate: 'decimals',
|
|
2190
|
+
set: [[digits.seven, digits.eight, digits.nine], [digits.four, digits.five, digits.six], [digits.one, digits.two, digits.three], [digits.zero, digits.decimalPoint, minus], [left, right, del]]
|
|
2191
|
+
}, {
|
|
2192
|
+
predicate: 'fractions',
|
|
2193
|
+
set: [[digits.seven, digits.eight, digits.nine], [digits.four, digits.five, digits.six], [digits.one, digits.two, digits.three], [digits.zero, blankOverBlank, minus], [left, right, del]]
|
|
2194
|
+
}, {
|
|
2195
|
+
predicate: 'geometry',
|
|
2196
|
+
set: [[blankOverBlank, degree, primeArcminute, doublePrimeArcSecond, congruentTo, similarTo], [circleDot, angle, measureOfAngle, triangle, notCongruentTo, notSimilar], [sin, cos, tan, pi, squareRoot, nthRoot], [csc, sec, cot, theta, subscript, xToPowerOfN], [overline, overRightArrow, overLeftRightArrow, overArc, perpindicular, parallel]]
|
|
2197
|
+
}, {
|
|
2198
|
+
predicate: 'advanced-algebra',
|
|
2199
|
+
set: advancedAlgebra
|
|
2200
|
+
}, {
|
|
2201
|
+
predicate: 'statistics',
|
|
2202
|
+
set: statisticsSet
|
|
2203
|
+
}, {
|
|
2204
|
+
predicate: 'item-authoring',
|
|
2205
|
+
set: [[divide, blankOverBlank, longDivision, halfInfinity, squared, squareRoot, overline, overRightArrow, overLeftRightArrow, log$6], [multiply, circleDot, {
|
|
2206
|
+
name: '',
|
|
2207
|
+
latex: '',
|
|
2208
|
+
write: ''
|
|
2209
|
+
}, subscript, xToPowerOfN, nthRoot, perpindicular, parallel, overArc, logSubscript], [plusMinus, pi, theta, degree, angle, leftArrow, rightArrow, triangle, square, ln], [notEqual, absValue, smallSigma, mu, therefore, sigma, leftrightArrow, sin, cos, tan], [lessThanEqual, greaterThanEqual, {
|
|
2210
|
+
name: '',
|
|
2211
|
+
latex: '',
|
|
2212
|
+
write: ''
|
|
2213
|
+
}, {
|
|
2214
|
+
name: '',
|
|
2215
|
+
latex: '',
|
|
2216
|
+
write: ''
|
|
2217
|
+
}, infinity, {
|
|
2218
|
+
name: '',
|
|
2219
|
+
latex: '',
|
|
2220
|
+
write: ''
|
|
2221
|
+
}, {
|
|
2222
|
+
name: '',
|
|
2223
|
+
latex: '',
|
|
2224
|
+
write: ''
|
|
2225
|
+
}, csc, sec, cot]]
|
|
2226
|
+
}];
|
|
2227
|
+
const keysForGrade = n => {
|
|
2228
|
+
const number = parseInt(n, 10);
|
|
2229
|
+
n = isNaN(number) ? n : number;
|
|
2230
|
+
if (!n) {
|
|
2231
|
+
return [];
|
|
2232
|
+
}
|
|
2233
|
+
const match = gradeSets.find(gs => {
|
|
2234
|
+
if (typeof gs.predicate === 'string') {
|
|
2235
|
+
return gs.predicate === n;
|
|
2236
|
+
} else {
|
|
2237
|
+
return gs.predicate(n);
|
|
2238
|
+
}
|
|
2239
|
+
});
|
|
2240
|
+
if (match) {
|
|
2241
|
+
return match.set || [];
|
|
2242
|
+
}
|
|
2243
|
+
};
|
|
2244
|
+
const ALL_KEYS = [...Object.values(basicOperators), ...Object.values(comparison), ...Object.values(constants), ...Object.values(digits), ...Object.values(exponent), ...Object.values(fractions), ...Object.values(geometry), ...Object.values(log$7), ...Object.values(matrices), ...Object.values(misc), ...Object.values(operators), ...Object.values(statistics), ...Object.values(subSup), ...Object.values(trigonometry), ...Object.values(vars)];
|
|
2245
|
+
const normalizeAdditionalKeys = additionalKeys => {
|
|
2246
|
+
return (additionalKeys || []).map(additionalkey => {
|
|
2247
|
+
const {latex} = additionalkey;
|
|
2248
|
+
const predefinedKey = (ALL_KEYS || []).find(key => latex === key.latex || latex === key.write || latex === key.command || latex === key.otherNotation);
|
|
2249
|
+
return predefinedKey || additionalkey;
|
|
2250
|
+
});
|
|
2251
|
+
};
|
|
2252
|
+
const {one, two, three, four, five, six, seven, eight, nine, zero, comma, decimalPoint} = digits;
|
|
2253
|
+
const baseSet = [[seven, eight, nine, divide], [four, five, six, multiply], [one, two, three, minus], [zero, decimalPoint, comma, plus], [left, right, del, equals]];
|
|
2254
|
+
const _$1 = _dll_lodash;
|
|
2255
|
+
const sortKeys = keys => {
|
|
2256
|
+
_$1.times(5 - keys.length, () => {
|
|
2257
|
+
keys.push([]);
|
|
2258
|
+
});
|
|
2259
|
+
const out = _$1.zip.apply(null, keys);
|
|
2260
|
+
return out;
|
|
2261
|
+
};
|
|
2262
|
+
const registerLineBreak = function (MQ) {
|
|
2263
|
+
MQ.registerEmbed('newLine', () => {
|
|
2264
|
+
return {
|
|
2265
|
+
htmlString: '<div class="newLine"></div>',
|
|
2266
|
+
text: () => 'testText',
|
|
2267
|
+
latex: () => '\\embed{newLine}[]'
|
|
2268
|
+
};
|
|
2269
|
+
});
|
|
2270
|
+
};
|
|
2271
|
+
const React$a = _dll_react;
|
|
2272
|
+
const PropTypes$9 = _dll_prop_types;
|
|
2273
|
+
const {withStyles: withStyles$7} = _dll_material_ui__core_styles;
|
|
2274
|
+
const debug$5 = _dll_debug;
|
|
2275
|
+
const classNames$2 = _dll_classnames;
|
|
2276
|
+
const MathQuill$3 = _dll_pie_framework__mathquill;
|
|
2277
|
+
const _jsxFileName$9 = "/home/circleci/repo/node_modules/@pie-lib/math-toolbar/node_modules/@pie-lib/math-input/src/mq/input.jsx";
|
|
2278
|
+
let MQ$1;
|
|
2279
|
+
if (typeof window !== 'undefined') {
|
|
2280
|
+
MQ$1 = MathQuill$3.getInterface(2);
|
|
2281
|
+
if (MQ$1 && MQ$1.registerEmbed) {
|
|
2282
|
+
registerLineBreak(MQ$1);
|
|
2283
|
+
}
|
|
2284
|
+
}
|
|
2285
|
+
const log$5 = debug$5('math-input:mq:input');
|
|
2286
|
+
class Input extends React$a.Component {
|
|
2287
|
+
constructor(...args) {
|
|
2288
|
+
super(...args);
|
|
2289
|
+
Input.prototype.__init.call(this);
|
|
2290
|
+
Input.prototype.__init2.call(this);
|
|
2291
|
+
Input.prototype.__init3.call(this);
|
|
2292
|
+
}
|
|
2293
|
+
static __initStatic() {
|
|
2294
|
+
this.propTypes = {
|
|
2295
|
+
className: PropTypes$9.string,
|
|
2296
|
+
classes: PropTypes$9.object.isRequired,
|
|
2297
|
+
onClick: PropTypes$9.func,
|
|
2298
|
+
onChange: PropTypes$9.func,
|
|
2299
|
+
latex: PropTypes$9.string,
|
|
2300
|
+
onFocus: PropTypes$9.func,
|
|
2301
|
+
onBlur: PropTypes$9.func
|
|
2302
|
+
};
|
|
2303
|
+
}
|
|
2304
|
+
componentDidMount() {
|
|
2305
|
+
if (!MQ$1) {
|
|
2306
|
+
throw new Error('MQ is not defined - but component has mounted?');
|
|
2307
|
+
}
|
|
2308
|
+
this.mathField = MQ$1.MathField(this.input, {
|
|
2309
|
+
handlers: {
|
|
2310
|
+
edit: this.onInputEdit.bind(this)
|
|
2311
|
+
}
|
|
2312
|
+
});
|
|
2313
|
+
this.updateLatex();
|
|
2314
|
+
}
|
|
2315
|
+
componentDidUpdate() {
|
|
2316
|
+
this.updateLatex();
|
|
2317
|
+
}
|
|
2318
|
+
updateLatex() {
|
|
2319
|
+
if (!this.mathField) {
|
|
2320
|
+
return;
|
|
2321
|
+
}
|
|
2322
|
+
const {latex} = this.props;
|
|
2323
|
+
if (latex) {
|
|
2324
|
+
this.mathField.latex(latex);
|
|
2325
|
+
}
|
|
2326
|
+
}
|
|
2327
|
+
clear() {
|
|
2328
|
+
this.mathField.latex('');
|
|
2329
|
+
return '';
|
|
2330
|
+
}
|
|
2331
|
+
blur() {
|
|
2332
|
+
log$5('blur mathfield');
|
|
2333
|
+
this.mathField.blur();
|
|
2334
|
+
}
|
|
2335
|
+
focus() {
|
|
2336
|
+
log$5('focus mathfield...');
|
|
2337
|
+
this.mathField.focus();
|
|
2338
|
+
}
|
|
2339
|
+
command(v) {
|
|
2340
|
+
log$5('command: ', v);
|
|
2341
|
+
if (Array.isArray(v)) {
|
|
2342
|
+
v.forEach(vv => {
|
|
2343
|
+
this.mathField.cmd(vv);
|
|
2344
|
+
});
|
|
2345
|
+
} else {
|
|
2346
|
+
this.mathField.cmd(v);
|
|
2347
|
+
}
|
|
2348
|
+
this.mathField.focus();
|
|
2349
|
+
return this.mathField.latex();
|
|
2350
|
+
}
|
|
2351
|
+
keystroke(v) {
|
|
2352
|
+
this.mathField.keystroke(v);
|
|
2353
|
+
this.mathField.focus();
|
|
2354
|
+
return this.mathField.latex();
|
|
2355
|
+
}
|
|
2356
|
+
write(v) {
|
|
2357
|
+
log$5('write: ', v);
|
|
2358
|
+
this.mathField.write(v);
|
|
2359
|
+
this.mathField.focus();
|
|
2360
|
+
return this.mathField.latex();
|
|
2361
|
+
}
|
|
2362
|
+
__init() {
|
|
2363
|
+
this.onInputEdit = () => {
|
|
2364
|
+
log$5('[onInputEdit] ...');
|
|
2365
|
+
const {onChange} = this.props;
|
|
2366
|
+
if (!this.mathField) {
|
|
2367
|
+
return;
|
|
2368
|
+
}
|
|
2369
|
+
if (onChange) {
|
|
2370
|
+
onChange(this.mathField.latex());
|
|
2371
|
+
}
|
|
2372
|
+
};
|
|
2373
|
+
}
|
|
2374
|
+
__init2() {
|
|
2375
|
+
this.refresh = () => {
|
|
2376
|
+
this.blur();
|
|
2377
|
+
this.focus();
|
|
2378
|
+
};
|
|
2379
|
+
}
|
|
2380
|
+
__init3() {
|
|
2381
|
+
this.onKeyPress = event => {
|
|
2382
|
+
const keys = Object.keys(this.mathField.__controller.options);
|
|
2383
|
+
if (keys.indexOf('ignoreNextMousedown') < 0) {
|
|
2384
|
+
this.refresh();
|
|
2385
|
+
}
|
|
2386
|
+
if (event.charCode === 13) {
|
|
2387
|
+
this.write('\\embed{newLine}[]');
|
|
2388
|
+
this.onInputEdit();
|
|
2389
|
+
}
|
|
2390
|
+
};
|
|
2391
|
+
}
|
|
2392
|
+
shouldComponentUpdate(nextProps) {
|
|
2393
|
+
log$5('next: ', nextProps.latex);
|
|
2394
|
+
log$5('current: ', this.mathField.latex());
|
|
2395
|
+
return nextProps.latex !== this.mathField.latex();
|
|
2396
|
+
}
|
|
2397
|
+
render() {
|
|
2398
|
+
const {onClick, onFocus, onBlur, classes, className} = this.props;
|
|
2399
|
+
return React$a.createElement('span', {
|
|
2400
|
+
className: classNames$2(classes.input, className),
|
|
2401
|
+
onKeyPress: this.onKeyPress,
|
|
2402
|
+
onClick: onClick,
|
|
2403
|
+
onFocus: onFocus,
|
|
2404
|
+
onBlur: onBlur,
|
|
2405
|
+
ref: r => this.input = r,
|
|
2406
|
+
__self: this,
|
|
2407
|
+
__source: {
|
|
2408
|
+
fileName: _jsxFileName$9,
|
|
2409
|
+
lineNumber: 149
|
|
2410
|
+
}
|
|
2411
|
+
});
|
|
2412
|
+
}
|
|
2413
|
+
}
|
|
2414
|
+
Input.__initStatic();
|
|
2415
|
+
const styles$5 = () => ({});
|
|
2416
|
+
var input = withStyles$7(styles$5)(Input);
|
|
2417
|
+
const PropTypes$8 = _dll_prop_types;
|
|
2418
|
+
const React$9 = _dll_react;
|
|
2419
|
+
const debug$4 = _dll_debug;
|
|
2420
|
+
const MathQuill$2 = _dll_pie_framework__mathquill;
|
|
2421
|
+
const _jsxFileName$8 = "/home/circleci/repo/node_modules/@pie-lib/math-toolbar/node_modules/@pie-lib/math-input/src/mq/static.jsx";
|
|
2422
|
+
let MQ;
|
|
2423
|
+
if (typeof window !== 'undefined') {
|
|
2424
|
+
MQ = MathQuill$2.getInterface(2);
|
|
2425
|
+
}
|
|
2426
|
+
const log$4 = debug$4('pie-lib:math-input:mq:static');
|
|
2427
|
+
const REGEX$1 = /\\MathQuillMathField\[r\d*\]\{(.*?)\}/g;
|
|
2428
|
+
const WHITESPACE_REGEX = / /g;
|
|
2429
|
+
function stripSpaces(string = '') {
|
|
2430
|
+
return string.replace(WHITESPACE_REGEX, '');
|
|
2431
|
+
}
|
|
2432
|
+
class Static extends React$9.Component {
|
|
2433
|
+
constructor(...args) {
|
|
2434
|
+
super(...args);
|
|
2435
|
+
Static.prototype.__init.call(this);
|
|
2436
|
+
}
|
|
2437
|
+
static __initStatic() {
|
|
2438
|
+
this.propTypes = {
|
|
2439
|
+
latex: PropTypes$8.string.isRequired,
|
|
2440
|
+
onFocus: PropTypes$8.func,
|
|
2441
|
+
onBlur: PropTypes$8.func,
|
|
2442
|
+
className: PropTypes$8.string,
|
|
2443
|
+
getFieldName: PropTypes$8.func,
|
|
2444
|
+
onSubFieldChange: PropTypes$8.func,
|
|
2445
|
+
onSubFieldFocus: PropTypes$8.func,
|
|
2446
|
+
setInput: PropTypes$8.func
|
|
2447
|
+
};
|
|
2448
|
+
}
|
|
2449
|
+
componentDidMount() {
|
|
2450
|
+
this.update();
|
|
2451
|
+
updateSpans();
|
|
2452
|
+
}
|
|
2453
|
+
componentDidUpdate() {
|
|
2454
|
+
this.update();
|
|
2455
|
+
updateSpans();
|
|
2456
|
+
}
|
|
2457
|
+
onInputEdit(field) {
|
|
2458
|
+
if (!this.mathField) {
|
|
2459
|
+
return;
|
|
2460
|
+
}
|
|
2461
|
+
const name = this.props.getFieldName(field, this.mathField.innerFields);
|
|
2462
|
+
if (this.props.onSubFieldChange) {
|
|
2463
|
+
this.props.onSubFieldChange(name, field.latex());
|
|
2464
|
+
}
|
|
2465
|
+
}
|
|
2466
|
+
update() {
|
|
2467
|
+
if (!MQ) {
|
|
2468
|
+
throw new Error('MQ is not defined - but component has mounted?');
|
|
2469
|
+
}
|
|
2470
|
+
if (!this.mathField) {
|
|
2471
|
+
this.mathField = MQ.StaticMath(this.input, {
|
|
2472
|
+
handlers: {
|
|
2473
|
+
edit: this.onInputEdit.bind(this)
|
|
2474
|
+
}
|
|
2475
|
+
});
|
|
2476
|
+
}
|
|
2477
|
+
try {
|
|
2478
|
+
this.mathField.parseLatex(this.props.latex);
|
|
2479
|
+
this.mathField.latex(this.props.latex);
|
|
2480
|
+
} catch (e) {
|
|
2481
|
+
this.mathField.latex('\\MathQuillMathField[r1]{}');
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
blur() {
|
|
2485
|
+
log$4('blur mathfield');
|
|
2486
|
+
this.mathField.blur();
|
|
2487
|
+
}
|
|
2488
|
+
focus() {
|
|
2489
|
+
log$4('focus mathfield...');
|
|
2490
|
+
this.mathField.focus();
|
|
2491
|
+
}
|
|
2492
|
+
shouldComponentUpdate(nextProps) {
|
|
2493
|
+
try {
|
|
2494
|
+
const parsedLatex = this.mathField.parseLatex(nextProps.latex);
|
|
2495
|
+
const stripped = stripSpaces(parsedLatex);
|
|
2496
|
+
const newFieldCount = (nextProps.latex.match(REGEX$1) || []).length;
|
|
2497
|
+
const out = stripped !== stripSpaces(this.mathField.latex().trim()) || newFieldCount !== Object.keys(this.mathField.innerFields).length / 2;
|
|
2498
|
+
log$4('[shouldComponentUpdate] ', out);
|
|
2499
|
+
return out;
|
|
2500
|
+
} catch (e) {
|
|
2501
|
+
console.warn('Error parsing latex:', e.message, 'skip update');
|
|
2502
|
+
console.warn(e);
|
|
2503
|
+
return false;
|
|
2504
|
+
}
|
|
2505
|
+
}
|
|
2506
|
+
__init() {
|
|
2507
|
+
this.onFocus = e => {
|
|
2508
|
+
try {
|
|
2509
|
+
let rootBlock = e.target.parentElement.nextSibling;
|
|
2510
|
+
let id = parseInt(rootBlock.getAttribute('mathquill-block-id'), 10);
|
|
2511
|
+
if (!id) {
|
|
2512
|
+
rootBlock = rootBlock.parentElement;
|
|
2513
|
+
id = parseInt(rootBlock.getAttribute('mathquill-block-id'), 10);
|
|
2514
|
+
}
|
|
2515
|
+
const innerField = this.mathField.innerFields.find(f => f.id === id);
|
|
2516
|
+
if (innerField) {
|
|
2517
|
+
const name = this.props.getFieldName(innerField, this.mathField.innerFields);
|
|
2518
|
+
if (this.props.setInput) {
|
|
2519
|
+
this.props.setInput(innerField);
|
|
2520
|
+
}
|
|
2521
|
+
this.props.onSubFieldFocus(name, innerField);
|
|
2522
|
+
}
|
|
2523
|
+
} catch (err) {
|
|
2524
|
+
console.error('error finding root block', err.message);
|
|
2525
|
+
}
|
|
2526
|
+
};
|
|
2527
|
+
}
|
|
2528
|
+
render() {
|
|
2529
|
+
const {onBlur, className} = this.props;
|
|
2530
|
+
return React$9.createElement('span', {
|
|
2531
|
+
className: className,
|
|
2532
|
+
onFocus: this.onFocus,
|
|
2533
|
+
onBlur: onBlur,
|
|
2534
|
+
ref: r => this.input = r,
|
|
2535
|
+
__self: this,
|
|
2536
|
+
__source: {
|
|
2537
|
+
fileName: _jsxFileName$8,
|
|
2538
|
+
lineNumber: 137
|
|
2539
|
+
}
|
|
2540
|
+
});
|
|
2541
|
+
}
|
|
2542
|
+
}
|
|
2543
|
+
Static.__initStatic();
|
|
2544
|
+
const React$8 = _dll_react;
|
|
2545
|
+
const PropTypes$7 = _dll_prop_types;
|
|
2546
|
+
const {Button: Button$1} = _dll_material_ui__core;
|
|
2547
|
+
const {IconButton: IconButton$1} = _dll_material_ui__core;
|
|
2548
|
+
const {colors: {green: green}} = _dll_material_ui__core;
|
|
2549
|
+
const {withStyles: withStyles$6} = _dll_material_ui__core_styles;
|
|
2550
|
+
const classNames$1 = _dll_classnames;
|
|
2551
|
+
const {lighten: lighten} = _dll_material_ui__core_styles_color_manipulator;
|
|
2552
|
+
const {fade: fade} = _dll_material_ui__core_styles_color_manipulator;
|
|
2553
|
+
const debug$3 = _dll_debug;
|
|
2554
|
+
const _ = _dll_lodash;
|
|
2555
|
+
const _jsxFileName$7 = "/home/circleci/repo/node_modules/@pie-lib/math-toolbar/node_modules/@pie-lib/math-input/src/keypad/index.jsx";
|
|
2556
|
+
const log$3 = debug$3('pie-lib:math-inline:keypad');
|
|
2557
|
+
const LatexButton = withStyles$6(theme => ({
|
|
2558
|
+
root: {
|
|
2559
|
+
textTransform: 'none',
|
|
2560
|
+
padding: 0,
|
|
2561
|
+
margin: 0,
|
|
2562
|
+
fontSize: '110% !important'
|
|
2563
|
+
},
|
|
2564
|
+
latexButton: {
|
|
2565
|
+
pointerEvents: 'none',
|
|
2566
|
+
textTransform: 'none !important',
|
|
2567
|
+
'& .mq-scaled.mq-sqrt-prefix': {
|
|
2568
|
+
transform: 'scale(1, 0.9) !important'
|
|
2569
|
+
},
|
|
2570
|
+
'& .mq-sup-only .mq-sup': {
|
|
2571
|
+
marginBottom: '0.9px !important'
|
|
2572
|
+
},
|
|
2573
|
+
'& .mq-empty': {
|
|
2574
|
+
backgroundColor: `${fade(theme.palette.secondary.main, 0.4)} !important`
|
|
2575
|
+
},
|
|
2576
|
+
'& .mq-overline .mq-overline-inner': {
|
|
2577
|
+
borderTop: '2px solid black'
|
|
2578
|
+
},
|
|
2579
|
+
'& .mq-overarrow': {
|
|
2580
|
+
width: '30px',
|
|
2581
|
+
marginTop: '0 !important',
|
|
2582
|
+
borderTop: '2px solid black',
|
|
2583
|
+
'&.mq-arrow-both': {
|
|
2584
|
+
'& *': {
|
|
2585
|
+
lineHeight: '1 !important'
|
|
2586
|
+
},
|
|
2587
|
+
'&:before': {
|
|
2588
|
+
fontSize: '80%',
|
|
2589
|
+
left: 'calc(-13%)',
|
|
2590
|
+
top: '-0.25em'
|
|
2591
|
+
},
|
|
2592
|
+
'&:after': {
|
|
2593
|
+
fontSize: '80% !important',
|
|
2594
|
+
right: 'calc(-13%) !important',
|
|
2595
|
+
top: '-1.5em'
|
|
2596
|
+
},
|
|
2597
|
+
'&.mq-empty:before': {
|
|
2598
|
+
fontSize: '80%',
|
|
2599
|
+
left: 'calc(-13%)',
|
|
2600
|
+
top: '-0.25em'
|
|
2601
|
+
},
|
|
2602
|
+
'&.mq-empty:after': {
|
|
2603
|
+
fontSize: '80%',
|
|
2604
|
+
right: 'calc(-13%)',
|
|
2605
|
+
top: '-0.25em'
|
|
2606
|
+
},
|
|
2607
|
+
'&.mq-empty': {
|
|
2608
|
+
minHeight: '1.4em'
|
|
2609
|
+
}
|
|
2610
|
+
},
|
|
2611
|
+
'&.mq-arrow-right:before': {
|
|
2612
|
+
fontSize: '80%',
|
|
2613
|
+
right: 'calc(-13%)',
|
|
2614
|
+
top: '-0.25em'
|
|
2615
|
+
},
|
|
2616
|
+
'& .mq-overarrow-inner': {
|
|
2617
|
+
border: 'none !important'
|
|
2618
|
+
},
|
|
2619
|
+
'& .mq-overarrow-inner .mq-overarrow-inner-right': {
|
|
2620
|
+
display: 'none !important'
|
|
2621
|
+
}
|
|
2622
|
+
},
|
|
2623
|
+
'& .mq-root-block': {
|
|
2624
|
+
padding: '5px'
|
|
2625
|
+
},
|
|
2626
|
+
'& .mq-overarrow.mq-arrow-both.mq-empty:after': {
|
|
2627
|
+
right: '-6px',
|
|
2628
|
+
fontSize: '80% !important',
|
|
2629
|
+
top: '-3px'
|
|
2630
|
+
},
|
|
2631
|
+
'& .mq-overarrow.mq-arrow-right.mq-empty:before': {
|
|
2632
|
+
right: '-5px',
|
|
2633
|
+
fontSize: '80% !important',
|
|
2634
|
+
top: '-3px'
|
|
2635
|
+
},
|
|
2636
|
+
'& .mq-overarrow.mq-arrow-both.mq-empty:before': {
|
|
2637
|
+
left: '-6px',
|
|
2638
|
+
fontSize: '80% !important',
|
|
2639
|
+
top: '-3px'
|
|
2640
|
+
},
|
|
2641
|
+
'& .mq-longdiv-inner': {
|
|
2642
|
+
borderTop: '1px solid !important',
|
|
2643
|
+
paddingTop: '1.5px !important'
|
|
2644
|
+
},
|
|
2645
|
+
'& .mq-parallelogram': {
|
|
2646
|
+
lineHeight: 0.85
|
|
2647
|
+
},
|
|
2648
|
+
'& .mq-overarc': {
|
|
2649
|
+
borderTop: '2px solid black !important',
|
|
2650
|
+
'& .mq-overline-inner': {
|
|
2651
|
+
borderTop: 'none !important',
|
|
2652
|
+
paddingTop: '0 !important'
|
|
2653
|
+
}
|
|
2654
|
+
}
|
|
2655
|
+
},
|
|
2656
|
+
parallelButton: {
|
|
2657
|
+
fontStyle: 'italic'
|
|
2658
|
+
},
|
|
2659
|
+
leftRightArrowButton: {
|
|
2660
|
+
'& .mq-overarrow.mq-arrow-both': {
|
|
2661
|
+
'& .mq-overline-inner': {
|
|
2662
|
+
borderTop: 'none !important',
|
|
2663
|
+
paddingTop: '0 !important'
|
|
2664
|
+
},
|
|
2665
|
+
'&:after': {
|
|
2666
|
+
top: '-1.64em !important'
|
|
2667
|
+
}
|
|
2668
|
+
}
|
|
2669
|
+
}
|
|
2670
|
+
}))(props => {
|
|
2671
|
+
let buttonClass;
|
|
2672
|
+
if (props.latex === '\\parallel') {
|
|
2673
|
+
buttonClass = classNames$1(props.classes.latexButton, props.mqClassName, props.classes.parallelButton);
|
|
2674
|
+
} else if (props.latex === '\\overleftrightarrow{\\overline{}}') {
|
|
2675
|
+
buttonClass = classNames$1(props.classes.latexButton, props.mqClassName, props.classes.leftRightArrowButton);
|
|
2676
|
+
} else {
|
|
2677
|
+
buttonClass = classNames$1(props.classes.latexButton, props.mqClassName);
|
|
2678
|
+
}
|
|
2679
|
+
return React$8.createElement(Button$1, {
|
|
2680
|
+
className: classNames$1(props.classes.root, props.className),
|
|
2681
|
+
onClick: props.onClick,
|
|
2682
|
+
__self: undefined,
|
|
2683
|
+
__source: {
|
|
2684
|
+
fileName: _jsxFileName$7,
|
|
2685
|
+
lineNumber: 149
|
|
2686
|
+
}
|
|
2687
|
+
}, React$8.createElement(Static, {
|
|
2688
|
+
className: buttonClass,
|
|
2689
|
+
latex: props.latex,
|
|
2690
|
+
__self: undefined,
|
|
2691
|
+
__source: {
|
|
2692
|
+
fileName: _jsxFileName$7,
|
|
2693
|
+
lineNumber: 150
|
|
2694
|
+
}
|
|
2695
|
+
}));
|
|
2696
|
+
});
|
|
2697
|
+
class KeyPad extends React$8.Component {
|
|
2698
|
+
constructor(...args) {
|
|
2699
|
+
super(...args);
|
|
2700
|
+
KeyPad.prototype.__init.call(this);
|
|
2701
|
+
KeyPad.prototype.__init2.call(this);
|
|
2702
|
+
KeyPad.prototype.__init3.call(this);
|
|
2703
|
+
}
|
|
2704
|
+
static __initStatic() {
|
|
2705
|
+
this.propTypes = {
|
|
2706
|
+
classes: PropTypes$7.object.isRequired,
|
|
2707
|
+
className: PropTypes$7.string,
|
|
2708
|
+
baseSet: PropTypes$7.array,
|
|
2709
|
+
additionalKeys: PropTypes$7.array,
|
|
2710
|
+
onPress: PropTypes$7.func.isRequired,
|
|
2711
|
+
onFocus: PropTypes$7.func,
|
|
2712
|
+
noDecimal: PropTypes$7.bool,
|
|
2713
|
+
mode: PropTypes$7.string
|
|
2714
|
+
};
|
|
2715
|
+
}
|
|
2716
|
+
static __initStatic2() {
|
|
2717
|
+
this.defaultProps = {
|
|
2718
|
+
baseSet: baseSet,
|
|
2719
|
+
noDecimal: false
|
|
2720
|
+
};
|
|
2721
|
+
}
|
|
2722
|
+
__init() {
|
|
2723
|
+
this.buttonClick = key => {
|
|
2724
|
+
log$3('[buttonClick]', key);
|
|
2725
|
+
const {onPress} = this.props;
|
|
2726
|
+
onPress(key);
|
|
2727
|
+
};
|
|
2728
|
+
}
|
|
2729
|
+
__init2() {
|
|
2730
|
+
this.flowKeys = (base, extras) => {
|
|
2731
|
+
const transposed = [...sortKeys(base), ...sortKeys(extras)];
|
|
2732
|
+
return _.flatten(transposed);
|
|
2733
|
+
};
|
|
2734
|
+
}
|
|
2735
|
+
__init3() {
|
|
2736
|
+
this.keyIsNotAllowed = key => {
|
|
2737
|
+
const {noDecimal} = this.props;
|
|
2738
|
+
if ((key.write === '.' && key.label === '.' || key.write === ',' && key.label === ',') && noDecimal) {
|
|
2739
|
+
return true;
|
|
2740
|
+
}
|
|
2741
|
+
return false;
|
|
2742
|
+
};
|
|
2743
|
+
}
|
|
2744
|
+
render() {
|
|
2745
|
+
const {classes, className, baseSet, additionalKeys, onFocus, mode} = this.props;
|
|
2746
|
+
const noBaseSet = ['non-negative-integers', 'integers', 'decimals', 'fractions', 'item-authoring'];
|
|
2747
|
+
const keysWithoutBaseSet = noBaseSet.includes(mode);
|
|
2748
|
+
const allKeys = keysWithoutBaseSet ? this.flowKeys([], additionalKeys || []) : this.flowKeys(baseSet, additionalKeys || []);
|
|
2749
|
+
const shift = allKeys.length % 5 ? 1 : 0;
|
|
2750
|
+
const style = {
|
|
2751
|
+
gridTemplateColumns: `repeat(${Math.floor(allKeys.length / 5) + shift}, minmax(min-content, 150px))`
|
|
2752
|
+
};
|
|
2753
|
+
return React$8.createElement('div', {
|
|
2754
|
+
className: classNames$1(classes.keys, className),
|
|
2755
|
+
style: style,
|
|
2756
|
+
onFocus: onFocus,
|
|
2757
|
+
__self: this,
|
|
2758
|
+
__source: {
|
|
2759
|
+
fileName: _jsxFileName$7,
|
|
2760
|
+
lineNumber: 217
|
|
2761
|
+
}
|
|
2762
|
+
}, allKeys.map((k, index) => {
|
|
2763
|
+
const onClick = this.buttonClick.bind(this, k);
|
|
2764
|
+
if (!k) {
|
|
2765
|
+
return React$8.createElement('span', {
|
|
2766
|
+
key: `empty-${index}`,
|
|
2767
|
+
__self: this,
|
|
2768
|
+
__source: {
|
|
2769
|
+
fileName: _jsxFileName$7,
|
|
2770
|
+
lineNumber: 222
|
|
2771
|
+
}
|
|
2772
|
+
});
|
|
2773
|
+
}
|
|
2774
|
+
const common = {
|
|
2775
|
+
onClick,
|
|
2776
|
+
className: classNames$1(classes.labelButton, !keysWithoutBaseSet && classes[k.category], k.label === ',' && classes.comma, k.label === '.' && classes.dot),
|
|
2777
|
+
disabled: this.keyIsNotAllowed(k),
|
|
2778
|
+
key: `${k.label || k.latex || k.command}-${index}`
|
|
2779
|
+
};
|
|
2780
|
+
if (k.latex) {
|
|
2781
|
+
return React$8.createElement(LatexButton, {
|
|
2782
|
+
latex: k.latex,
|
|
2783
|
+
...common,
|
|
2784
|
+
className: classes.latexButton,
|
|
2785
|
+
__self: this,
|
|
2786
|
+
__source: {
|
|
2787
|
+
fileName: _jsxFileName$7,
|
|
2788
|
+
lineNumber: 238
|
|
2789
|
+
}
|
|
2790
|
+
});
|
|
2791
|
+
}
|
|
2792
|
+
if (k.label) {
|
|
2793
|
+
return React$8.createElement(Button$1, {
|
|
2794
|
+
...common,
|
|
2795
|
+
__self: this,
|
|
2796
|
+
__source: {
|
|
2797
|
+
fileName: _jsxFileName$7,
|
|
2798
|
+
lineNumber: 242
|
|
2799
|
+
}
|
|
2800
|
+
}, k.label);
|
|
2801
|
+
} else {
|
|
2802
|
+
const Icon = k.icon ? k.icon : 'div';
|
|
2803
|
+
return React$8.createElement(IconButton$1, {
|
|
2804
|
+
tabIndex: '-1',
|
|
2805
|
+
...common,
|
|
2806
|
+
__self: this,
|
|
2807
|
+
__source: {
|
|
2808
|
+
fileName: _jsxFileName$7,
|
|
2809
|
+
lineNumber: 247
|
|
2810
|
+
}
|
|
2811
|
+
}, React$8.createElement(Icon, {
|
|
2812
|
+
className: classes.icon,
|
|
2813
|
+
__self: this,
|
|
2814
|
+
__source: {
|
|
2815
|
+
fileName: _jsxFileName$7,
|
|
2816
|
+
lineNumber: 248
|
|
2817
|
+
}
|
|
2818
|
+
}));
|
|
2819
|
+
}
|
|
2820
|
+
}));
|
|
2821
|
+
}
|
|
2822
|
+
}
|
|
2823
|
+
KeyPad.__initStatic();
|
|
2824
|
+
KeyPad.__initStatic2();
|
|
2825
|
+
const styles$4 = theme => ({
|
|
2826
|
+
keys: {
|
|
2827
|
+
'& *': {
|
|
2828
|
+
fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'
|
|
2829
|
+
},
|
|
2830
|
+
width: '100%',
|
|
2831
|
+
display: 'grid',
|
|
2832
|
+
gridTemplateRows: 'repeat(5, minmax(40px, 60px))',
|
|
2833
|
+
gridRowGap: '0px',
|
|
2834
|
+
gridColumnGap: '0px',
|
|
2835
|
+
gridAutoFlow: 'column'
|
|
2836
|
+
},
|
|
2837
|
+
holder: {
|
|
2838
|
+
position: 'relative',
|
|
2839
|
+
width: '100%',
|
|
2840
|
+
height: '100%',
|
|
2841
|
+
backgroundColor: '#cef',
|
|
2842
|
+
borderRadius: 0,
|
|
2843
|
+
padding: `${theme.spacing.unit}px 0 ${theme.spacing.unit}px 0`
|
|
2844
|
+
},
|
|
2845
|
+
labelButton: {
|
|
2846
|
+
minWidth: 'auto',
|
|
2847
|
+
fontSize: '140% !important',
|
|
2848
|
+
backgroundColor: lighten(theme.palette.primary.light, 0.5),
|
|
2849
|
+
'&:hover': {
|
|
2850
|
+
backgroundColor: lighten(theme.palette.primary.light, 0.7)
|
|
2851
|
+
},
|
|
2852
|
+
borderRadius: 0
|
|
2853
|
+
},
|
|
2854
|
+
latexButton: {
|
|
2855
|
+
minWidth: 'auto',
|
|
2856
|
+
borderRadius: 0,
|
|
2857
|
+
backgroundColor: lighten(theme.palette.primary.light, 0.5),
|
|
2858
|
+
'&:hover': {
|
|
2859
|
+
backgroundColor: lighten(theme.palette.primary.light, 0.7)
|
|
2860
|
+
}
|
|
2861
|
+
},
|
|
2862
|
+
base: {},
|
|
2863
|
+
operators: {
|
|
2864
|
+
backgroundColor: lighten(theme.palette.secondary.light, 0.5),
|
|
2865
|
+
'&:hover': {
|
|
2866
|
+
backgroundColor: lighten(theme.palette.secondary.light, 0.7)
|
|
2867
|
+
}
|
|
2868
|
+
},
|
|
2869
|
+
comparison: {
|
|
2870
|
+
backgroundColor: lighten(green[500], 0.5),
|
|
2871
|
+
'&:hover': {
|
|
2872
|
+
backgroundColor: lighten(green[500], 0.7)
|
|
2873
|
+
}
|
|
2874
|
+
},
|
|
2875
|
+
comma: {
|
|
2876
|
+
fontSize: '200% !important',
|
|
2877
|
+
lineHeight: '100%'
|
|
2878
|
+
},
|
|
2879
|
+
dot: {
|
|
2880
|
+
fontSize: '200% !important',
|
|
2881
|
+
lineHeight: '100%'
|
|
2882
|
+
},
|
|
2883
|
+
icon: {
|
|
2884
|
+
height: '30px'
|
|
2885
|
+
}
|
|
2886
|
+
});
|
|
2887
|
+
var Keypad = withStyles$6(styles$4)(KeyPad);
|
|
2888
|
+
const React$7 = _dll_react;
|
|
2889
|
+
const PropTypes$6 = _dll_prop_types;
|
|
2890
|
+
const _jsxFileName$6 = "/home/circleci/repo/node_modules/@pie-lib/math-toolbar/node_modules/@pie-lib/math-input/src/horizontal-keypad.jsx";
|
|
2891
|
+
const toOldModel = d => {
|
|
2892
|
+
if (d.command) {
|
|
2893
|
+
return {
|
|
2894
|
+
value: d.command,
|
|
2895
|
+
type: 'command'
|
|
2896
|
+
};
|
|
2897
|
+
} else if (d.write) {
|
|
2898
|
+
return {
|
|
2899
|
+
value: d.write
|
|
2900
|
+
};
|
|
2901
|
+
} else if (d.keystroke) {
|
|
2902
|
+
return {
|
|
2903
|
+
type: 'cursor',
|
|
2904
|
+
value: d.keystroke
|
|
2905
|
+
};
|
|
2906
|
+
}
|
|
2907
|
+
};
|
|
2908
|
+
class HorizontalKeypad extends React$7.Component {
|
|
2909
|
+
constructor(...args) {
|
|
2910
|
+
super(...args);
|
|
2911
|
+
HorizontalKeypad.prototype.__init.call(this);
|
|
2912
|
+
}
|
|
2913
|
+
static __initStatic() {
|
|
2914
|
+
this.propTypes = {
|
|
2915
|
+
className: PropTypes$6.string,
|
|
2916
|
+
mode: PropTypes$6.oneOfType([PropTypes$6.string, PropTypes$6.number]),
|
|
2917
|
+
onClick: PropTypes$6.func.isRequired,
|
|
2918
|
+
onFocus: PropTypes$6.func,
|
|
2919
|
+
noDecimal: PropTypes$6.bool,
|
|
2920
|
+
additionalKeys: PropTypes$6.array
|
|
2921
|
+
};
|
|
2922
|
+
}
|
|
2923
|
+
static __initStatic2() {
|
|
2924
|
+
this.defaultProps = {
|
|
2925
|
+
mode: 'scientific',
|
|
2926
|
+
noDecimal: false,
|
|
2927
|
+
additionalKeys: []
|
|
2928
|
+
};
|
|
2929
|
+
}
|
|
2930
|
+
__init() {
|
|
2931
|
+
this.keypadPress = data => {
|
|
2932
|
+
const {onClick} = this.props;
|
|
2933
|
+
onClick(toOldModel(data));
|
|
2934
|
+
};
|
|
2935
|
+
}
|
|
2936
|
+
render() {
|
|
2937
|
+
const {mode, onFocus, noDecimal, className, additionalKeys} = this.props;
|
|
2938
|
+
const normalizedKeys = normalizeAdditionalKeys(additionalKeys);
|
|
2939
|
+
return React$7.createElement(Keypad, {
|
|
2940
|
+
className: className,
|
|
2941
|
+
onFocus: onFocus,
|
|
2942
|
+
noDecimal: noDecimal,
|
|
2943
|
+
additionalKeys: extendKeySet(keysForGrade(mode), normalizedKeys),
|
|
2944
|
+
onPress: this.keypadPress,
|
|
2945
|
+
mode: mode,
|
|
2946
|
+
__self: this,
|
|
2947
|
+
__source: {
|
|
2948
|
+
fileName: _jsxFileName$6,
|
|
2949
|
+
lineNumber: 44
|
|
2950
|
+
}
|
|
2951
|
+
});
|
|
2952
|
+
}
|
|
2953
|
+
}
|
|
2954
|
+
HorizontalKeypad.__initStatic();
|
|
2955
|
+
HorizontalKeypad.__initStatic2();
|
|
2956
|
+
const updateSpans = () => {
|
|
2957
|
+
const spans = Array.from(document.querySelectorAll('span[mathquill-command-id]'));
|
|
2958
|
+
(spans || []).forEach(span => {
|
|
2959
|
+
if (span && span.innerText === '∥' && span.className !== 'mq-editable-field') {
|
|
2960
|
+
span.style.fontSize = '32px';
|
|
2961
|
+
}
|
|
2962
|
+
});
|
|
2963
|
+
};
|
|
2964
|
+
const React$6 = _dll_react;
|
|
2965
|
+
const debug$2 = _dll_debug;
|
|
2966
|
+
const PropTypes$5 = _dll_prop_types;
|
|
2967
|
+
const cx$3 = _dll_classnames;
|
|
2968
|
+
const {Button: Button} = _dll_material_ui__core;
|
|
2969
|
+
const {MenuItem: MenuItem} = _dll_material_ui__core;
|
|
2970
|
+
const {Select: Select} = _dll_material_ui__core;
|
|
2971
|
+
const {withStyles: withStyles$5} = _dll_material_ui__core_styles;
|
|
2972
|
+
const {color: color$2} = _dll_pie_lib__render_ui;
|
|
2973
|
+
const {InputContainer: InputContainer} = _dll_pie_lib__render_ui;
|
|
2974
|
+
const _jsxFileName$5 = "/home/circleci/repo/node_modules/@pie-lib/math-toolbar/src/editor-and-pad.jsx";
|
|
2975
|
+
const log$2 = debug$2('@pie-lib:math-toolbar:editor-and-pad');
|
|
2976
|
+
const decimalRegex = /\.|,/g;
|
|
2977
|
+
const toNodeData = data => {
|
|
2978
|
+
if (!data) {
|
|
2979
|
+
return;
|
|
2980
|
+
}
|
|
2981
|
+
const {type, value} = data;
|
|
2982
|
+
if (type === 'command' || type === 'cursor') {
|
|
2983
|
+
return data;
|
|
2984
|
+
} else if (type === 'answer') {
|
|
2985
|
+
return {
|
|
2986
|
+
type: 'answer',
|
|
2987
|
+
...data
|
|
2988
|
+
};
|
|
2989
|
+
} else if (value === 'clear') {
|
|
2990
|
+
return {
|
|
2991
|
+
type: 'clear'
|
|
2992
|
+
};
|
|
2993
|
+
} else {
|
|
2994
|
+
return {
|
|
2995
|
+
type: 'write',
|
|
2996
|
+
value
|
|
2997
|
+
};
|
|
2998
|
+
}
|
|
2999
|
+
};
|
|
3000
|
+
class EditorAndPad extends React$6.Component {
|
|
3001
|
+
static __initStatic() {
|
|
3002
|
+
this.propTypes = {
|
|
3003
|
+
classNames: PropTypes$5.object,
|
|
3004
|
+
keypadMode: PropTypes$5.oneOfType([PropTypes$5.string, PropTypes$5.number]),
|
|
3005
|
+
autoFocus: PropTypes$5.bool,
|
|
3006
|
+
allowAnswerBlock: PropTypes$5.bool,
|
|
3007
|
+
showKeypad: PropTypes$5.bool,
|
|
3008
|
+
controlledKeypad: PropTypes$5.bool,
|
|
3009
|
+
controlledKeypadMode: PropTypes$5.bool,
|
|
3010
|
+
noDecimal: PropTypes$5.bool,
|
|
3011
|
+
additionalKeys: PropTypes$5.array,
|
|
3012
|
+
latex: PropTypes$5.string.isRequired,
|
|
3013
|
+
onAnswerBlockAdd: PropTypes$5.func,
|
|
3014
|
+
onFocus: PropTypes$5.func,
|
|
3015
|
+
onBlur: PropTypes$5.func,
|
|
3016
|
+
onChange: PropTypes$5.func.isRequired,
|
|
3017
|
+
classes: PropTypes$5.object
|
|
3018
|
+
};
|
|
3019
|
+
}
|
|
3020
|
+
constructor(props) {
|
|
3021
|
+
super(props);
|
|
3022
|
+
EditorAndPad.prototype.__init.call(this);
|
|
3023
|
+
EditorAndPad.prototype.__init2.call(this);
|
|
3024
|
+
EditorAndPad.prototype.__init3.call(this);
|
|
3025
|
+
EditorAndPad.prototype.__init4.call(this);
|
|
3026
|
+
this.state = {
|
|
3027
|
+
equationEditor: 'item-authoring'
|
|
3028
|
+
};
|
|
3029
|
+
}
|
|
3030
|
+
componentDidMount() {
|
|
3031
|
+
if (this.input && this.props.autoFocus) {
|
|
3032
|
+
this.input.focus();
|
|
3033
|
+
}
|
|
3034
|
+
}
|
|
3035
|
+
__init() {
|
|
3036
|
+
this.onClick = data => {
|
|
3037
|
+
const {noDecimal} = this.props;
|
|
3038
|
+
const c = toNodeData(data);
|
|
3039
|
+
log$2('mathChange: ', c);
|
|
3040
|
+
if (noDecimal && (c.value === '.' || c.value === ',')) {
|
|
3041
|
+
return;
|
|
3042
|
+
}
|
|
3043
|
+
if (c.type === 'clear') {
|
|
3044
|
+
log$2('call clear...');
|
|
3045
|
+
this.input.clear();
|
|
3046
|
+
} else if (c.type === 'command') {
|
|
3047
|
+
this.input.command(c.value);
|
|
3048
|
+
} else if (c.type === 'cursor') {
|
|
3049
|
+
this.input.keystroke(c.value);
|
|
3050
|
+
} else if (c.type === 'answer') {
|
|
3051
|
+
this.input.write('%response%');
|
|
3052
|
+
} else {
|
|
3053
|
+
this.input.write(c.value);
|
|
3054
|
+
}
|
|
3055
|
+
};
|
|
3056
|
+
}
|
|
3057
|
+
__init2() {
|
|
3058
|
+
this.onAnswerBlockClick = () => {
|
|
3059
|
+
this.props.onAnswerBlockAdd();
|
|
3060
|
+
this.onClick({
|
|
3061
|
+
type: 'answer'
|
|
3062
|
+
});
|
|
3063
|
+
};
|
|
3064
|
+
}
|
|
3065
|
+
__init3() {
|
|
3066
|
+
this.onEditorChange = latex => {
|
|
3067
|
+
const {onChange, noDecimal} = this.props;
|
|
3068
|
+
updateSpans();
|
|
3069
|
+
if (noDecimal && (latex.indexOf('.') !== -1 || latex.indexOf(',') !== -1) && this.input) {
|
|
3070
|
+
this.input.clear();
|
|
3071
|
+
this.input.write(latex.replace(decimalRegex, ''));
|
|
3072
|
+
return;
|
|
3073
|
+
}
|
|
3074
|
+
onChange(latex);
|
|
3075
|
+
};
|
|
3076
|
+
}
|
|
3077
|
+
shouldComponentUpdate(nextProps, nextState) {
|
|
3078
|
+
const inputIsDifferent = this.input.mathField.latex() !== nextProps.latex;
|
|
3079
|
+
log$2('[shouldComponentUpdate] ', 'inputIsDifferent: ', inputIsDifferent);
|
|
3080
|
+
if (!inputIsDifferent && this.props.keypadMode !== nextProps.keypadMode) {
|
|
3081
|
+
return true;
|
|
3082
|
+
}
|
|
3083
|
+
if (!inputIsDifferent && this.props.noDecimal !== nextProps.noDecimal) {
|
|
3084
|
+
return true;
|
|
3085
|
+
}
|
|
3086
|
+
if (!inputIsDifferent && this.state.equationEditor !== nextState.equationEditor) {
|
|
3087
|
+
return true;
|
|
3088
|
+
}
|
|
3089
|
+
if (!inputIsDifferent && this.props.controlledKeypad) {
|
|
3090
|
+
return this.props.showKeypad !== nextProps.showKeypad;
|
|
3091
|
+
}
|
|
3092
|
+
return inputIsDifferent;
|
|
3093
|
+
}
|
|
3094
|
+
__init4() {
|
|
3095
|
+
this.onEditorTypeChange = evt => {
|
|
3096
|
+
this.setState({
|
|
3097
|
+
equationEditor: evt.target.value
|
|
3098
|
+
});
|
|
3099
|
+
};
|
|
3100
|
+
}
|
|
3101
|
+
render() {
|
|
3102
|
+
const {classNames, keypadMode, allowAnswerBlock, additionalKeys, controlledKeypad, controlledKeypadMode, showKeypad, noDecimal, latex, onFocus, onBlur, classes} = this.props;
|
|
3103
|
+
const shouldShowKeypad = !controlledKeypad || controlledKeypad && showKeypad;
|
|
3104
|
+
log$2('[render]', latex);
|
|
3105
|
+
return React$6.createElement('div', {
|
|
3106
|
+
className: cx$3(classes.mathToolbar, classNames.mathToolbar),
|
|
3107
|
+
__self: this,
|
|
3108
|
+
__source: {
|
|
3109
|
+
fileName: _jsxFileName$5,
|
|
3110
|
+
lineNumber: 160
|
|
3111
|
+
}
|
|
3112
|
+
}, React$6.createElement('div', {
|
|
3113
|
+
className: classes.inputAndTypeContainer,
|
|
3114
|
+
__self: this,
|
|
3115
|
+
__source: {
|
|
3116
|
+
fileName: _jsxFileName$5,
|
|
3117
|
+
lineNumber: 161
|
|
3118
|
+
}
|
|
3119
|
+
}, controlledKeypadMode && React$6.createElement(InputContainer, {
|
|
3120
|
+
label: "Equation Editor",
|
|
3121
|
+
className: classes.selectContainer,
|
|
3122
|
+
__self: this,
|
|
3123
|
+
__source: {
|
|
3124
|
+
fileName: _jsxFileName$5,
|
|
3125
|
+
lineNumber: 163
|
|
3126
|
+
}
|
|
3127
|
+
}, React$6.createElement(Select, {
|
|
3128
|
+
className: classes.select,
|
|
3129
|
+
onChange: this.onEditorTypeChange,
|
|
3130
|
+
value: this.state.equationEditor,
|
|
3131
|
+
__self: this,
|
|
3132
|
+
__source: {
|
|
3133
|
+
fileName: _jsxFileName$5,
|
|
3134
|
+
lineNumber: 164
|
|
3135
|
+
}
|
|
3136
|
+
}, React$6.createElement(MenuItem, {
|
|
3137
|
+
value: "non-negative-integers",
|
|
3138
|
+
__self: this,
|
|
3139
|
+
__source: {
|
|
3140
|
+
fileName: _jsxFileName$5,
|
|
3141
|
+
lineNumber: 169
|
|
3142
|
+
}
|
|
3143
|
+
}, "Numeric - Non-Negative Integers"), React$6.createElement(MenuItem, {
|
|
3144
|
+
value: "integers",
|
|
3145
|
+
__self: this,
|
|
3146
|
+
__source: {
|
|
3147
|
+
fileName: _jsxFileName$5,
|
|
3148
|
+
lineNumber: 170
|
|
3149
|
+
}
|
|
3150
|
+
}, "Numeric - Integers"), React$6.createElement(MenuItem, {
|
|
3151
|
+
value: "decimals",
|
|
3152
|
+
__self: this,
|
|
3153
|
+
__source: {
|
|
3154
|
+
fileName: _jsxFileName$5,
|
|
3155
|
+
lineNumber: 171
|
|
3156
|
+
}
|
|
3157
|
+
}, "Numeric - Decimals"), React$6.createElement(MenuItem, {
|
|
3158
|
+
value: "fractions",
|
|
3159
|
+
__self: this,
|
|
3160
|
+
__source: {
|
|
3161
|
+
fileName: _jsxFileName$5,
|
|
3162
|
+
lineNumber: 172
|
|
3163
|
+
}
|
|
3164
|
+
}, "Numeric - Fractions"), React$6.createElement(MenuItem, {
|
|
3165
|
+
value: 1,
|
|
3166
|
+
__self: this,
|
|
3167
|
+
__source: {
|
|
3168
|
+
fileName: _jsxFileName$5,
|
|
3169
|
+
lineNumber: 173
|
|
3170
|
+
}
|
|
3171
|
+
}, "Grade 1 - 2"), React$6.createElement(MenuItem, {
|
|
3172
|
+
value: 3,
|
|
3173
|
+
__self: this,
|
|
3174
|
+
__source: {
|
|
3175
|
+
fileName: _jsxFileName$5,
|
|
3176
|
+
lineNumber: 174
|
|
3177
|
+
}
|
|
3178
|
+
}, "Grade 3 - 5"), React$6.createElement(MenuItem, {
|
|
3179
|
+
value: 6,
|
|
3180
|
+
__self: this,
|
|
3181
|
+
__source: {
|
|
3182
|
+
fileName: _jsxFileName$5,
|
|
3183
|
+
lineNumber: 175
|
|
3184
|
+
}
|
|
3185
|
+
}, "Grade 6 - 7"), React$6.createElement(MenuItem, {
|
|
3186
|
+
value: 8,
|
|
3187
|
+
__self: this,
|
|
3188
|
+
__source: {
|
|
3189
|
+
fileName: _jsxFileName$5,
|
|
3190
|
+
lineNumber: 176
|
|
3191
|
+
}
|
|
3192
|
+
}, "Grade 8 - HS"), React$6.createElement(MenuItem, {
|
|
3193
|
+
value: 'geometry',
|
|
3194
|
+
__self: this,
|
|
3195
|
+
__source: {
|
|
3196
|
+
fileName: _jsxFileName$5,
|
|
3197
|
+
lineNumber: 177
|
|
3198
|
+
}
|
|
3199
|
+
}, "Geometry"), React$6.createElement(MenuItem, {
|
|
3200
|
+
value: 'advanced-algebra',
|
|
3201
|
+
__self: this,
|
|
3202
|
+
__source: {
|
|
3203
|
+
fileName: _jsxFileName$5,
|
|
3204
|
+
lineNumber: 178
|
|
3205
|
+
}
|
|
3206
|
+
}, "Advanced Algebra"), React$6.createElement(MenuItem, {
|
|
3207
|
+
value: 'statistics',
|
|
3208
|
+
__self: this,
|
|
3209
|
+
__source: {
|
|
3210
|
+
fileName: _jsxFileName$5,
|
|
3211
|
+
lineNumber: 179
|
|
3212
|
+
}
|
|
3213
|
+
}, "Statistics"), React$6.createElement(MenuItem, {
|
|
3214
|
+
value: 'item-authoring',
|
|
3215
|
+
__self: this,
|
|
3216
|
+
__source: {
|
|
3217
|
+
fileName: _jsxFileName$5,
|
|
3218
|
+
lineNumber: 180
|
|
3219
|
+
}
|
|
3220
|
+
}, "Item Authoring"))), React$6.createElement(input, {
|
|
3221
|
+
onFocus: onFocus,
|
|
3222
|
+
onBlur: onBlur,
|
|
3223
|
+
className: cx$3(classes.mathEditor, classNames.editor, !controlledKeypadMode ? classes.longMathEditor : ''),
|
|
3224
|
+
innerRef: r => this.input = r,
|
|
3225
|
+
latex: latex,
|
|
3226
|
+
onChange: this.onEditorChange,
|
|
3227
|
+
__self: this,
|
|
3228
|
+
__source: {
|
|
3229
|
+
fileName: _jsxFileName$5,
|
|
3230
|
+
lineNumber: 184
|
|
3231
|
+
}
|
|
3232
|
+
})), allowAnswerBlock && React$6.createElement(Button, {
|
|
3233
|
+
className: classes.addAnswerBlockButton,
|
|
3234
|
+
type: "primary",
|
|
3235
|
+
style: {
|
|
3236
|
+
bottom: shouldShowKeypad ? '320px' : '20px'
|
|
3237
|
+
},
|
|
3238
|
+
onClick: this.onAnswerBlockClick,
|
|
3239
|
+
__self: this,
|
|
3240
|
+
__source: {
|
|
3241
|
+
fileName: _jsxFileName$5,
|
|
3242
|
+
lineNumber: 198
|
|
3243
|
+
}
|
|
3244
|
+
}, "+ Response Area"), React$6.createElement('hr', {
|
|
3245
|
+
className: classes.hr,
|
|
3246
|
+
__self: this,
|
|
3247
|
+
__source: {
|
|
3248
|
+
fileName: _jsxFileName$5,
|
|
3249
|
+
lineNumber: 207
|
|
3250
|
+
}
|
|
3251
|
+
}), shouldShowKeypad && React$6.createElement(HorizontalKeypad, {
|
|
3252
|
+
additionalKeys: additionalKeys,
|
|
3253
|
+
mode: controlledKeypadMode ? this.state.equationEditor : keypadMode,
|
|
3254
|
+
onClick: this.onClick,
|
|
3255
|
+
noDecimal: noDecimal,
|
|
3256
|
+
__self: this,
|
|
3257
|
+
__source: {
|
|
3258
|
+
fileName: _jsxFileName$5,
|
|
3259
|
+
lineNumber: 209
|
|
3260
|
+
}
|
|
3261
|
+
}));
|
|
3262
|
+
}
|
|
3263
|
+
}
|
|
3264
|
+
EditorAndPad.__initStatic();
|
|
3265
|
+
const styles$3 = theme => ({
|
|
3266
|
+
inputAndTypeContainer: {
|
|
3267
|
+
display: 'flex',
|
|
3268
|
+
alignItems: 'center',
|
|
3269
|
+
'& *': {
|
|
3270
|
+
fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'
|
|
3271
|
+
},
|
|
3272
|
+
'& .mq-overarrow.mq-arrow-both': {
|
|
3273
|
+
minWidth: '1.23em',
|
|
3274
|
+
'& *': {
|
|
3275
|
+
lineHeight: '1 !important'
|
|
3276
|
+
},
|
|
3277
|
+
'&:before': {
|
|
3278
|
+
top: '-0.4em',
|
|
3279
|
+
left: '-1px'
|
|
3280
|
+
},
|
|
3281
|
+
'&:after': {
|
|
3282
|
+
top: '-2.36em',
|
|
3283
|
+
right: '-1px'
|
|
3284
|
+
},
|
|
3285
|
+
'&.mq-empty:after': {
|
|
3286
|
+
top: '-0.45em'
|
|
3287
|
+
}
|
|
3288
|
+
},
|
|
3289
|
+
'& .mq-overarrow.mq-arrow-right': {
|
|
3290
|
+
'&:before': {
|
|
3291
|
+
top: '-0.4em',
|
|
3292
|
+
right: '-1px'
|
|
3293
|
+
}
|
|
3294
|
+
}
|
|
3295
|
+
},
|
|
3296
|
+
selectContainer: {
|
|
3297
|
+
flex: 'initial',
|
|
3298
|
+
width: '25%',
|
|
3299
|
+
minWidth: '100px',
|
|
3300
|
+
marginLeft: '15px',
|
|
3301
|
+
marginTop: '5px',
|
|
3302
|
+
marginBottom: '5px',
|
|
3303
|
+
marginRight: '5px'
|
|
3304
|
+
},
|
|
3305
|
+
mathEditor: {
|
|
3306
|
+
maxWidth: '400px',
|
|
3307
|
+
color: color$2.text(),
|
|
3308
|
+
backgroundColor: color$2.background(),
|
|
3309
|
+
padding: theme.spacing.unit,
|
|
3310
|
+
marginTop: theme.spacing.unit,
|
|
3311
|
+
marginBottom: theme.spacing.unit
|
|
3312
|
+
},
|
|
3313
|
+
longMathEditor: {
|
|
3314
|
+
maxWidth: '500px'
|
|
3315
|
+
},
|
|
3316
|
+
addAnswerBlockButton: {
|
|
3317
|
+
position: 'absolute',
|
|
3318
|
+
right: '12px',
|
|
3319
|
+
border: '1px solid lightgrey'
|
|
3320
|
+
},
|
|
3321
|
+
hr: {
|
|
3322
|
+
padding: 0,
|
|
3323
|
+
margin: 0,
|
|
3324
|
+
height: '1px',
|
|
3325
|
+
border: 'none',
|
|
3326
|
+
borderBottom: `solid 1px ${theme.palette.primary.main}`
|
|
3327
|
+
},
|
|
3328
|
+
mathToolbar: {
|
|
3329
|
+
zIndex: 9,
|
|
3330
|
+
position: 'relative',
|
|
3331
|
+
textAlign: 'center',
|
|
3332
|
+
width: 'auto',
|
|
3333
|
+
'& > .mq-math-mode': {
|
|
3334
|
+
border: 'solid 1px lightgrey'
|
|
3335
|
+
},
|
|
3336
|
+
'& > .mq-focused': {
|
|
3337
|
+
outline: 'none',
|
|
3338
|
+
boxShadow: 'none',
|
|
3339
|
+
border: `dotted 1px ${theme.palette.primary.main}`,
|
|
3340
|
+
borderRadius: '0px'
|
|
3341
|
+
},
|
|
3342
|
+
'& .mq-overarrow-inner': {
|
|
3343
|
+
border: 'none !important',
|
|
3344
|
+
paddingTop: '0 !important'
|
|
3345
|
+
},
|
|
3346
|
+
'& .mq-overarrow-inner-right': {
|
|
3347
|
+
display: 'none !important'
|
|
3348
|
+
},
|
|
3349
|
+
'& .mq-overarrow-inner-left': {
|
|
3350
|
+
display: 'none !important'
|
|
3351
|
+
},
|
|
3352
|
+
'& .mq-longdiv-inner': {
|
|
3353
|
+
borderTop: '1px solid !important',
|
|
3354
|
+
paddingTop: '1.5px !important'
|
|
3355
|
+
},
|
|
3356
|
+
'& .mq-overarrow.mq-arrow-both': {
|
|
3357
|
+
minWidth: '1.23em'
|
|
3358
|
+
},
|
|
3359
|
+
'& .mq-parallelogram': {
|
|
3360
|
+
lineHeight: 0.85
|
|
3361
|
+
}
|
|
3362
|
+
}
|
|
3363
|
+
});
|
|
3364
|
+
var EditorAndPad$1 = withStyles$5(styles$3)(EditorAndPad);
|
|
3365
|
+
const React$5 = _dll_react;
|
|
3366
|
+
const {IconButton: IconButton} = _dll_material_ui__core;
|
|
3367
|
+
const {Check: Check} = _dll_material_ui__icons;
|
|
3368
|
+
const {withStyles: withStyles$4} = _dll_material_ui__core_styles;
|
|
3369
|
+
const PropTypes$4 = _dll_prop_types;
|
|
3370
|
+
const _jsxFileName$4 = "/home/circleci/repo/node_modules/@pie-lib/math-toolbar/src/done-button.jsx";
|
|
3371
|
+
const RawDoneButton = ({classes, onClick}) => React$5.createElement(IconButton, {
|
|
3372
|
+
'aria-label': "Done",
|
|
3373
|
+
className: classes.iconRoot,
|
|
3374
|
+
onClick: onClick,
|
|
3375
|
+
classes: {
|
|
3376
|
+
label: classes.label,
|
|
3377
|
+
root: classes.iconRoot
|
|
3378
|
+
},
|
|
3379
|
+
__self: undefined,
|
|
3380
|
+
__source: {
|
|
3381
|
+
fileName: _jsxFileName$4,
|
|
3382
|
+
lineNumber: 9
|
|
3383
|
+
}
|
|
3384
|
+
}, React$5.createElement(Check, {
|
|
3385
|
+
__self: undefined,
|
|
3386
|
+
__source: {
|
|
3387
|
+
fileName: _jsxFileName$4,
|
|
3388
|
+
lineNumber: 18
|
|
3389
|
+
}
|
|
3390
|
+
}));
|
|
3391
|
+
RawDoneButton.propTypes = {
|
|
3392
|
+
classes: PropTypes$4.object.isRequired,
|
|
3393
|
+
onClick: PropTypes$4.func
|
|
3394
|
+
};
|
|
3395
|
+
const styles$2 = {
|
|
3396
|
+
iconRoot: {
|
|
3397
|
+
verticalAlign: 'top',
|
|
3398
|
+
width: '28px',
|
|
3399
|
+
height: '28px',
|
|
3400
|
+
color: '#00bb00'
|
|
3401
|
+
},
|
|
3402
|
+
label: {
|
|
3403
|
+
position: 'absolute',
|
|
3404
|
+
top: '2px'
|
|
3405
|
+
}
|
|
3406
|
+
};
|
|
3407
|
+
const DoneButton = withStyles$4(styles$2)(RawDoneButton);
|
|
3408
|
+
const React$4 = _dll_react;
|
|
3409
|
+
const classNames = _dll_classnames;
|
|
3410
|
+
const debug$1 = _dll_debug;
|
|
3411
|
+
const {withStyles: withStyles$3} = _dll_material_ui__core_styles;
|
|
3412
|
+
const PropTypes$3 = _dll_prop_types;
|
|
3413
|
+
const _jsxFileName$3 = "/home/circleci/repo/node_modules/@pie-lib/math-toolbar/src/math-preview.jsx";
|
|
3414
|
+
const log$1 = debug$1('@pie-lib:math-toolbar:math-preview');
|
|
3415
|
+
class RawMathPreview extends React$4.Component {
|
|
3416
|
+
static __initStatic() {
|
|
3417
|
+
this.propTypes = {
|
|
3418
|
+
latex: PropTypes$3.string,
|
|
3419
|
+
node: PropTypes$3.object,
|
|
3420
|
+
classes: PropTypes$3.object,
|
|
3421
|
+
isSelected: PropTypes$3.bool,
|
|
3422
|
+
onFocus: PropTypes$3.func,
|
|
3423
|
+
onBlur: PropTypes$3.func
|
|
3424
|
+
};
|
|
3425
|
+
}
|
|
3426
|
+
render() {
|
|
3427
|
+
log$1('[render] data: ', this.props.node.data);
|
|
3428
|
+
const latex = this.props.node.data.get('latex');
|
|
3429
|
+
const {classes, isSelected, onFocus, onBlur} = this.props;
|
|
3430
|
+
return React$4.createElement('div', {
|
|
3431
|
+
className: classNames(classes.root, isSelected && classes.selected),
|
|
3432
|
+
__self: this,
|
|
3433
|
+
__source: {
|
|
3434
|
+
fileName: _jsxFileName$3,
|
|
3435
|
+
lineNumber: 25
|
|
3436
|
+
}
|
|
3437
|
+
}, ' ', React$4.createElement('span', {
|
|
3438
|
+
className: classes.insideOverlay,
|
|
3439
|
+
__self: this,
|
|
3440
|
+
__source: {
|
|
3441
|
+
fileName: _jsxFileName$3,
|
|
3442
|
+
lineNumber: 27
|
|
3443
|
+
}
|
|
3444
|
+
}), React$4.createElement(Static, {
|
|
3445
|
+
latex: latex,
|
|
3446
|
+
onFocus: onFocus,
|
|
3447
|
+
onBlur: onBlur,
|
|
3448
|
+
__self: this,
|
|
3449
|
+
__source: {
|
|
3450
|
+
fileName: _jsxFileName$3,
|
|
3451
|
+
lineNumber: 28
|
|
3452
|
+
}
|
|
3453
|
+
}));
|
|
3454
|
+
}
|
|
3455
|
+
}
|
|
3456
|
+
RawMathPreview.__initStatic();
|
|
3457
|
+
const mp = theme => ({
|
|
3458
|
+
root: {
|
|
3459
|
+
display: 'inline-flex',
|
|
3460
|
+
alignItems: 'center',
|
|
3461
|
+
position: 'relative',
|
|
3462
|
+
'& > .mq-math-mode': {
|
|
3463
|
+
border: 'solid 1px lightgrey'
|
|
3464
|
+
},
|
|
3465
|
+
'& > .mq-focused': {
|
|
3466
|
+
outline: 'none',
|
|
3467
|
+
boxShadow: 'none',
|
|
3468
|
+
border: 'solid 1px black',
|
|
3469
|
+
borderRadius: '0px'
|
|
3470
|
+
},
|
|
3471
|
+
'& *': {
|
|
3472
|
+
fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'
|
|
3473
|
+
},
|
|
3474
|
+
'& .mq-overarrow-inner': {
|
|
3475
|
+
paddingTop: '0 !important',
|
|
3476
|
+
border: 'none !important'
|
|
3477
|
+
},
|
|
3478
|
+
'& .mq-overarrow.mq-arrow-both': {
|
|
3479
|
+
minWidth: '1.23em',
|
|
3480
|
+
'& *': {
|
|
3481
|
+
lineHeight: '1 !important'
|
|
3482
|
+
},
|
|
3483
|
+
'&:before': {
|
|
3484
|
+
top: '-0.4em',
|
|
3485
|
+
left: '-1px'
|
|
3486
|
+
},
|
|
3487
|
+
'&:after': {
|
|
3488
|
+
top: '-2.36em',
|
|
3489
|
+
right: '-1px'
|
|
3490
|
+
},
|
|
3491
|
+
'&.mq-empty:after': {
|
|
3492
|
+
top: '-0.45em'
|
|
3493
|
+
}
|
|
3494
|
+
},
|
|
3495
|
+
'& .mq-overarrow.mq-arrow-right': {
|
|
3496
|
+
'&:before': {
|
|
3497
|
+
top: '-0.4em',
|
|
3498
|
+
right: '-1px'
|
|
3499
|
+
}
|
|
3500
|
+
},
|
|
3501
|
+
'& .mq-overarrow-inner-right': {
|
|
3502
|
+
display: 'none !important'
|
|
3503
|
+
},
|
|
3504
|
+
'& .mq-overarrow-inner-left': {
|
|
3505
|
+
display: 'none !important'
|
|
3506
|
+
},
|
|
3507
|
+
'& .mq-longdiv-inner': {
|
|
3508
|
+
borderTop: '1px solid !important',
|
|
3509
|
+
paddingTop: '1.5px !important'
|
|
3510
|
+
},
|
|
3511
|
+
'& .mq-parallelogram': {
|
|
3512
|
+
lineHeight: 0.85
|
|
3513
|
+
}
|
|
3514
|
+
},
|
|
3515
|
+
selected: {
|
|
3516
|
+
border: `solid 1px ${theme.palette.primary.main}`,
|
|
3517
|
+
'& > .mq-math-mode': {
|
|
3518
|
+
border: 'solid 0px lightgrey'
|
|
3519
|
+
}
|
|
3520
|
+
},
|
|
3521
|
+
insideOverlay: {
|
|
3522
|
+
position: 'absolute',
|
|
3523
|
+
bottom: 0,
|
|
3524
|
+
left: 0,
|
|
3525
|
+
right: 0,
|
|
3526
|
+
top: 0
|
|
3527
|
+
}
|
|
3528
|
+
});
|
|
3529
|
+
withStyles$3(mp)(RawMathPreview);
|
|
3530
|
+
const React$3 = _dll_react;
|
|
3531
|
+
const PropTypes$2 = _dll_prop_types;
|
|
3532
|
+
const cx$2 = _dll_classnames;
|
|
3533
|
+
const {withStyles: withStyles$2} = _dll_material_ui__core_styles;
|
|
3534
|
+
const _jsxFileName$2 = "/home/circleci/repo/node_modules/@pie-lib/math-toolbar/src/index.jsx";
|
|
3535
|
+
class MathToolbar extends React$3.Component {
|
|
3536
|
+
static __initStatic() {
|
|
3537
|
+
this.propTypes = {
|
|
3538
|
+
autoFocus: PropTypes$2.bool,
|
|
3539
|
+
allowAnswerBlock: PropTypes$2.bool,
|
|
3540
|
+
controlledKeypad: PropTypes$2.bool,
|
|
3541
|
+
controlledKeypadMode: PropTypes$2.bool,
|
|
3542
|
+
keypadMode: PropTypes$2.oneOfType([PropTypes$2.string, PropTypes$2.number]),
|
|
3543
|
+
classNames: PropTypes$2.object,
|
|
3544
|
+
showKeypad: PropTypes$2.bool,
|
|
3545
|
+
noDecimal: PropTypes$2.bool,
|
|
3546
|
+
additionalKeys: PropTypes$2.array,
|
|
3547
|
+
latex: PropTypes$2.string.isRequired,
|
|
3548
|
+
onAnswerBlockAdd: PropTypes$2.func,
|
|
3549
|
+
onChange: PropTypes$2.func,
|
|
3550
|
+
onDone: PropTypes$2.func.isRequired,
|
|
3551
|
+
onFocus: PropTypes$2.func,
|
|
3552
|
+
onBlur: PropTypes$2.func,
|
|
3553
|
+
hideDoneButton: PropTypes$2.bool
|
|
3554
|
+
};
|
|
3555
|
+
}
|
|
3556
|
+
static __initStatic2() {
|
|
3557
|
+
this.defaultProps = {
|
|
3558
|
+
classNames: {},
|
|
3559
|
+
keypadMode: 'item-authoring',
|
|
3560
|
+
autoFocus: false,
|
|
3561
|
+
allowAnswerBlock: false,
|
|
3562
|
+
controlledKeypad: false,
|
|
3563
|
+
controlledKeypadMode: false,
|
|
3564
|
+
noDecimal: false,
|
|
3565
|
+
showKeypad: true,
|
|
3566
|
+
additionalKeys: [],
|
|
3567
|
+
onChange: () => {},
|
|
3568
|
+
onAnswerBlockAdd: () => {},
|
|
3569
|
+
onFocus: () => {},
|
|
3570
|
+
hideDoneButton: false
|
|
3571
|
+
};
|
|
3572
|
+
}
|
|
3573
|
+
constructor(props) {
|
|
3574
|
+
super(props);
|
|
3575
|
+
MathToolbar.prototype.__init.call(this);
|
|
3576
|
+
MathToolbar.prototype.__init2.call(this);
|
|
3577
|
+
this.state = {
|
|
3578
|
+
latex: props.latex
|
|
3579
|
+
};
|
|
3580
|
+
}
|
|
3581
|
+
__init() {
|
|
3582
|
+
this.done = () => {
|
|
3583
|
+
this.props.onDone(this.state.latex);
|
|
3584
|
+
};
|
|
3585
|
+
}
|
|
3586
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
3587
|
+
this.setState({
|
|
3588
|
+
latex: nextProps.latex
|
|
3589
|
+
});
|
|
3590
|
+
}
|
|
3591
|
+
__init2() {
|
|
3592
|
+
this.onChange = latex => {
|
|
3593
|
+
this.setState({
|
|
3594
|
+
latex
|
|
3595
|
+
});
|
|
3596
|
+
this.props.onChange(latex);
|
|
3597
|
+
};
|
|
3598
|
+
}
|
|
3599
|
+
render() {
|
|
3600
|
+
const {latex} = this.state;
|
|
3601
|
+
const {classNames, autoFocus, allowAnswerBlock, onAnswerBlockAdd, controlledKeypad, controlledKeypadMode, keypadMode, noDecimal, additionalKeys, showKeypad, onFocus, onBlur, hideDoneButton} = this.props;
|
|
3602
|
+
return React$3.createElement(PureToolbar, {
|
|
3603
|
+
autoFocus: autoFocus,
|
|
3604
|
+
classNames: classNames,
|
|
3605
|
+
onAnswerBlockAdd: onAnswerBlockAdd,
|
|
3606
|
+
allowAnswerBlock: allowAnswerBlock,
|
|
3607
|
+
latex: latex,
|
|
3608
|
+
additionalKeys: additionalKeys,
|
|
3609
|
+
noDecimal: noDecimal,
|
|
3610
|
+
keypadMode: keypadMode,
|
|
3611
|
+
onChange: this.onChange,
|
|
3612
|
+
onDone: this.done,
|
|
3613
|
+
onFocus: onFocus,
|
|
3614
|
+
onBlur: onBlur,
|
|
3615
|
+
showKeypad: showKeypad,
|
|
3616
|
+
controlledKeypad: controlledKeypad,
|
|
3617
|
+
controlledKeypadMode: controlledKeypadMode,
|
|
3618
|
+
hideDoneButton: hideDoneButton,
|
|
3619
|
+
__self: this,
|
|
3620
|
+
__source: {
|
|
3621
|
+
fileName: _jsxFileName$2,
|
|
3622
|
+
lineNumber: 86
|
|
3623
|
+
}
|
|
3624
|
+
});
|
|
3625
|
+
}
|
|
3626
|
+
}
|
|
3627
|
+
MathToolbar.__initStatic();
|
|
3628
|
+
MathToolbar.__initStatic2();
|
|
3629
|
+
class RawPureToolbar extends React$3.Component {
|
|
3630
|
+
static __initStatic3() {
|
|
3631
|
+
this.propTypes = {
|
|
3632
|
+
classNames: PropTypes$2.object,
|
|
3633
|
+
latex: PropTypes$2.string.isRequired,
|
|
3634
|
+
keypadMode: PropTypes$2.oneOfType([PropTypes$2.string, PropTypes$2.number]),
|
|
3635
|
+
onChange: PropTypes$2.func.isRequired,
|
|
3636
|
+
onDone: PropTypes$2.func.isRequired,
|
|
3637
|
+
onBlur: PropTypes$2.func,
|
|
3638
|
+
onAnswerBlockAdd: PropTypes$2.func,
|
|
3639
|
+
additionalKeys: PropTypes$2.array,
|
|
3640
|
+
onFocus: PropTypes$2.func,
|
|
3641
|
+
classes: PropTypes$2.object.isRequired,
|
|
3642
|
+
autoFocus: PropTypes$2.bool,
|
|
3643
|
+
noDecimal: PropTypes$2.bool,
|
|
3644
|
+
allowAnswerBlock: PropTypes$2.bool,
|
|
3645
|
+
controlledKeypad: PropTypes$2.bool,
|
|
3646
|
+
controlledKeypadMode: PropTypes$2.bool,
|
|
3647
|
+
showKeypad: PropTypes$2.bool,
|
|
3648
|
+
hideDoneButton: PropTypes$2.bool
|
|
3649
|
+
};
|
|
3650
|
+
}
|
|
3651
|
+
render() {
|
|
3652
|
+
const {classNames, autoFocus, allowAnswerBlock, onAnswerBlockAdd, controlledKeypad, controlledKeypadMode, additionalKeys, showKeypad, keypadMode, noDecimal, latex, onChange, onDone, onFocus, onBlur, hideDoneButton, classes} = this.props;
|
|
3653
|
+
return React$3.createElement('div', {
|
|
3654
|
+
className: cx$2(classes.pureToolbar, (classNames || ({})).toolbar),
|
|
3655
|
+
__self: this,
|
|
3656
|
+
__source: {
|
|
3657
|
+
fileName: _jsxFileName$2,
|
|
3658
|
+
lineNumber: 151
|
|
3659
|
+
}
|
|
3660
|
+
}, React$3.createElement('div', {
|
|
3661
|
+
__self: this,
|
|
3662
|
+
__source: {
|
|
3663
|
+
fileName: _jsxFileName$2,
|
|
3664
|
+
lineNumber: 152
|
|
3665
|
+
}
|
|
3666
|
+
}), React$3.createElement(EditorAndPad$1, {
|
|
3667
|
+
autoFocus: autoFocus,
|
|
3668
|
+
keypadMode: keypadMode,
|
|
3669
|
+
classNames: classNames || ({}),
|
|
3670
|
+
controlledKeypad: controlledKeypad,
|
|
3671
|
+
controlledKeypadMode: controlledKeypadMode,
|
|
3672
|
+
noDecimal: noDecimal,
|
|
3673
|
+
showKeypad: showKeypad,
|
|
3674
|
+
additionalKeys: additionalKeys,
|
|
3675
|
+
allowAnswerBlock: allowAnswerBlock,
|
|
3676
|
+
onAnswerBlockAdd: onAnswerBlockAdd,
|
|
3677
|
+
latex: latex,
|
|
3678
|
+
onChange: onChange,
|
|
3679
|
+
onFocus: onFocus,
|
|
3680
|
+
onBlur: onBlur,
|
|
3681
|
+
__self: this,
|
|
3682
|
+
__source: {
|
|
3683
|
+
fileName: _jsxFileName$2,
|
|
3684
|
+
lineNumber: 153
|
|
3685
|
+
}
|
|
3686
|
+
}), (!controlledKeypad || controlledKeypad && showKeypad) && !hideDoneButton && React$3.createElement(DoneButton, {
|
|
3687
|
+
onClick: onDone,
|
|
3688
|
+
__self: this,
|
|
3689
|
+
__source: {
|
|
3690
|
+
fileName: _jsxFileName$2,
|
|
3691
|
+
lineNumber: 170
|
|
3692
|
+
}
|
|
3693
|
+
}));
|
|
3694
|
+
}
|
|
3695
|
+
}
|
|
3696
|
+
RawPureToolbar.__initStatic3();
|
|
3697
|
+
const styles$1 = () => ({
|
|
3698
|
+
pureToolbar: {
|
|
3699
|
+
display: 'flex',
|
|
3700
|
+
width: '100%',
|
|
3701
|
+
zIndex: 8,
|
|
3702
|
+
alignItems: 'center'
|
|
3703
|
+
}
|
|
3704
|
+
});
|
|
3705
|
+
const PureToolbar = withStyles$2(styles$1)(RawPureToolbar);
|
|
8
3706
|
const React$2 = _dll_react;
|
|
9
3707
|
const cx$1 = _dll_classnames;
|
|
10
3708
|
const {withStyles: withStyles$1} = _dll_material_ui__core_styles;
|
|
11
3709
|
const PropTypes$1 = _dll_prop_types;
|
|
12
3710
|
const {color: color$1} = _dll_pie_lib__render_ui;
|
|
13
|
-
const {MathToolbar: MathToolbar} = _dll_pie_lib__math_toolbar;
|
|
14
|
-
const {mq: mq$1} = _dll_pie_lib__math_input;
|
|
15
3711
|
const _jsxFileName$1 = "/home/circleci/repo/packages/math-inline/src/simple-question-block.jsx";
|
|
16
3712
|
class SimpleQuestionBlockRaw extends React$2.Component {
|
|
17
3713
|
constructor(...args) {
|
|
@@ -75,7 +3771,7 @@ class SimpleQuestionBlockRaw extends React$2.Component {
|
|
|
75
3771
|
fileName: _jsxFileName$1,
|
|
76
3772
|
lineNumber: 56
|
|
77
3773
|
}
|
|
78
|
-
}, React$2.createElement(
|
|
3774
|
+
}, React$2.createElement(Static$1, {
|
|
79
3775
|
latex: showCorrect ? responses && responses.length && responses[0].answer : session.response || '',
|
|
80
3776
|
__self: this,
|
|
81
3777
|
__source: {
|
|
@@ -162,11 +3858,8 @@ const {Tooltip: Tooltip} = _dll_material_ui__core;
|
|
|
162
3858
|
const {isEqual: isEqual} = _dll_lodash;
|
|
163
3859
|
const {isEmpty: isEmpty} = _dll_lodash;
|
|
164
3860
|
const cx = _dll_classnames;
|
|
165
|
-
const {mq: mq} = _dll_pie_lib__math_input;
|
|
166
|
-
const {HorizontalKeypad: HorizontalKeypad} = _dll_pie_lib__math_input;
|
|
167
|
-
const {updateSpans: updateSpans} = _dll_pie_lib__math_input;
|
|
168
|
-
const MathQuill = _dll_pie_framework__mathquill;
|
|
169
3861
|
const {renderMath: renderMath$1} = _dll_pie_lib__math_rendering;
|
|
3862
|
+
const MathQuill$1 = _dll_pie_framework__mathquill;
|
|
170
3863
|
const _jsxFileName = "/home/circleci/repo/packages/math-inline/src/main.jsx";
|
|
171
3864
|
function _optionalChain(ops) {
|
|
172
3865
|
let lastAccessLHS = undefined;
|
|
@@ -272,7 +3965,7 @@ class Main extends React$1.Component {
|
|
|
272
3965
|
UNSAFE_componentWillMount() {
|
|
273
3966
|
const {classes} = this.props;
|
|
274
3967
|
if (typeof window !== 'undefined') {
|
|
275
|
-
let MQ = MathQuill.getInterface(2);
|
|
3968
|
+
let MQ = MathQuill$1.getInterface(2);
|
|
276
3969
|
if (!registered) {
|
|
277
3970
|
MQ.registerEmbed('answerBlock', data => {
|
|
278
3971
|
return {
|
|
@@ -300,7 +3993,7 @@ class Main extends React$1.Component {
|
|
|
300
3993
|
const el = this.root.querySelector(`#${answerId}`);
|
|
301
3994
|
const indexEl = this.root.querySelector(`#${answerId}Index`);
|
|
302
3995
|
if (el) {
|
|
303
|
-
let MQ = MathQuill.getInterface(2);
|
|
3996
|
+
let MQ = MathQuill$1.getInterface(2);
|
|
304
3997
|
const answer = answers[answerId];
|
|
305
3998
|
el.textContent = answer && answer.value || '';
|
|
306
3999
|
if (!model.view) ; else {
|
|
@@ -448,7 +4141,7 @@ class Main extends React$1.Component {
|
|
|
448
4141
|
}
|
|
449
4142
|
__init10() {
|
|
450
4143
|
this.subFieldChanged = (name, subfieldValue) => {
|
|
451
|
-
updateSpans();
|
|
4144
|
+
updateSpans$1();
|
|
452
4145
|
if (name) {
|
|
453
4146
|
this.setState(state => ({
|
|
454
4147
|
session: {
|
|
@@ -522,7 +4215,7 @@ class Main extends React$1.Component {
|
|
|
522
4215
|
fileName: _jsxFileName,
|
|
523
4216
|
lineNumber: 411
|
|
524
4217
|
}
|
|
525
|
-
}, React$1.createElement(
|
|
4218
|
+
}, React$1.createElement(Static$1, {
|
|
526
4219
|
ref: mqStatic => this.mqStatic = mqStatic || this.mqStatic,
|
|
527
4220
|
latex: staticLatex,
|
|
528
4221
|
onSubFieldChange: this.subFieldChanged,
|
|
@@ -615,7 +4308,7 @@ class Main extends React$1.Component {
|
|
|
615
4308
|
fileName: _jsxFileName,
|
|
616
4309
|
lineNumber: 463
|
|
617
4310
|
}
|
|
618
|
-
}, React$1.createElement(HorizontalKeypad, {
|
|
4311
|
+
}, React$1.createElement(HorizontalKeypad$1, {
|
|
619
4312
|
additionalKeys: additionalKeys,
|
|
620
4313
|
mode: equationEditor || DEFAULT_KEYPAD_VARIANT,
|
|
621
4314
|
onClick: this.onClick,
|
|
@@ -630,7 +4323,7 @@ class Main extends React$1.Component {
|
|
|
630
4323
|
fileName: _jsxFileName,
|
|
631
4324
|
lineNumber: 451
|
|
632
4325
|
}
|
|
633
|
-
}, React$1.createElement(
|
|
4326
|
+
}, React$1.createElement(Static$1, {
|
|
634
4327
|
ref: mqStatic => this.mqStatic = mqStatic || this.mqStatic,
|
|
635
4328
|
latex: staticLatex,
|
|
636
4329
|
onSubFieldChange: this.subFieldChanged,
|