@pie-element/math-inline 13.0.5 → 13.0.6-next.20261016234357
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/dist/browser/author/index.js +3846 -3846
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/controller/index.js +1 -1
- package/dist/browser/delivery/index.js +2 -2
- package/dist/browser/{dist-BHHPmy0B.js → dist-8z5BiprA.js} +3164 -2884
- package/dist/browser/dist-8z5BiprA.js.map +1 -0
- package/dist/browser/editor-runtime/author/index.js +984 -984
- package/dist/browser/editor-runtime/author/index.js.map +1 -1
- package/dist/browser/editor-runtime/controller/index.js +1 -1
- package/dist/browser/editor-runtime/delivery/index.js +2 -2
- package/dist/browser/editor-runtime/{dist-B1WbtNIm.js → dist-CxAWUhJe.js} +3164 -2884
- package/dist/browser/editor-runtime/dist-CxAWUhJe.js.map +1 -0
- package/dist/browser/editor-runtime/es-BkpdVdfR.js +10 -0
- package/dist/browser/editor-runtime/es-BkpdVdfR.js.map +1 -0
- package/dist/browser/editor-runtime/es-IvhhD5u_.js +9 -0
- package/dist/browser/editor-runtime/es-IvhhD5u_.js.map +1 -0
- package/dist/browser/editor-runtime/{main-BO5Bc5oB.js → main-JX3mHB2O.js} +132 -131
- package/dist/browser/editor-runtime/main-JX3mHB2O.js.map +1 -0
- package/dist/browser/editor-runtime/print/index.js +3 -3
- package/dist/browser/es-BkpdVdfR.js +10 -0
- package/dist/browser/es-BkpdVdfR.js.map +1 -0
- package/dist/browser/es-IvhhD5u_.js +9 -0
- package/dist/browser/es-IvhhD5u_.js.map +1 -0
- package/dist/browser/{main-CjEk0ct_.js → main-AY7YNfuw.js} +132 -131
- package/dist/browser/main-AY7YNfuw.js.map +1 -0
- package/dist/browser/print/index.js +3 -3
- package/dist/index.iife.js +49 -49
- package/dist/schemas/configuration.schema.json +1 -1
- package/dist/schemas/model.schema.json +1 -1
- package/dist/schemas/session.schema.json +1 -1
- package/module/print.js +10107 -9811
- package/module/print.js.map +1 -1
- package/package.json +16 -16
- package/dist/browser/dist-BHHPmy0B.js.map +0 -1
- package/dist/browser/editor-runtime/dist-B1WbtNIm.js.map +0 -1
- package/dist/browser/editor-runtime/main-BO5Bc5oB.js.map +0 -1
- package/dist/browser/main-CjEk0ct_.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { s as e } from "./rolldown-runtime-DgMJErsw.js";
|
|
2
2
|
import { d as t, p as n, t as r } from "./dist-w6lPOmAs.js";
|
|
3
|
-
import { C as i, H as a, L as o, M as s,
|
|
4
|
-
import
|
|
3
|
+
import { C as i, H as a, L as o, M as s, Mt as c, R as l, S as u, T as d, _ as f, f as ee, ft as p, g as m, gt as h, h as g, ht as _, m as v, mt as y, n as b, pt as x, u as te, v as S, vt as C, w } from "./dist-CxAWUhJe.js";
|
|
4
|
+
import T, { useRef as ne } from "react";
|
|
5
5
|
import { jsx as E, jsxs as D } from "react/jsx-runtime";
|
|
6
|
-
import
|
|
6
|
+
import re from "react-dom";
|
|
7
7
|
//#region ../../lib-react/correct-answer-toggle/dist/expander.js
|
|
8
|
-
var O = /* @__PURE__ */ e(
|
|
8
|
+
var O = /* @__PURE__ */ e(c(), 1), k = "height ease-in 300ms, opacity ease-in 300ms", A = C("div")(() => ({
|
|
9
9
|
position: "relative",
|
|
10
10
|
height: 0,
|
|
11
11
|
overflow: "hidden",
|
|
@@ -40,8 +40,8 @@ var O = /* @__PURE__ */ e(_(), 1), k = "height ease-in 300ms, opacity ease-in 30
|
|
|
40
40
|
width: 0
|
|
41
41
|
}
|
|
42
42
|
})), j = (e) => {
|
|
43
|
-
let { show: t, children: n, className: r } = e, i =
|
|
44
|
-
return /* @__PURE__ */ E(
|
|
43
|
+
let { show: t, children: n, className: r } = e, i = ne(null);
|
|
44
|
+
return /* @__PURE__ */ E(h, {
|
|
45
45
|
nodeRef: i,
|
|
46
46
|
in: t,
|
|
47
47
|
appear: !0,
|
|
@@ -66,8 +66,18 @@ j.propTypes = {
|
|
|
66
66
|
children: O.default.oneOfType([O.default.arrayOf(O.default.node), O.default.node]).isRequired
|
|
67
67
|
};
|
|
68
68
|
//#endregion
|
|
69
|
-
//#region ../../lib-react/
|
|
70
|
-
var
|
|
69
|
+
//#region ../../lib-react/correct-answer-toggle/dist/i18n/index.js
|
|
70
|
+
var ie = _({
|
|
71
|
+
packageName: "@pie-lib/correct-answer-toggle",
|
|
72
|
+
source: {
|
|
73
|
+
showCorrectAnswer: "Show correct answer",
|
|
74
|
+
hideCorrectAnswer: "Hide correct answer"
|
|
75
|
+
},
|
|
76
|
+
loaders: { es: () => import(
|
|
77
|
+
/* webpackMode: "eager" */
|
|
78
|
+
"./es-IvhhD5u_.js"
|
|
79
|
+
) }
|
|
80
|
+
}), M = ({ bgFill: e, fgFill: t }) => /* @__PURE__ */ D("svg", {
|
|
71
81
|
"aria-hidden": "true",
|
|
72
82
|
focusable: "false",
|
|
73
83
|
preserveAspectRatio: "xMinYMin meet",
|
|
@@ -142,7 +152,7 @@ N.propTypes = {
|
|
|
142
152
|
fgFill: O.default.string.isRequired,
|
|
143
153
|
borderFill: O.default.string.isRequired
|
|
144
154
|
};
|
|
145
|
-
var P =
|
|
155
|
+
var P = C("div")(({ size: e }) => ({
|
|
146
156
|
width: e || "25px",
|
|
147
157
|
height: e || "25px"
|
|
148
158
|
})), F = ({ open: e, size: t }) => /* @__PURE__ */ E(P, {
|
|
@@ -168,17 +178,17 @@ function I(e) {
|
|
|
168
178
|
function L(e, t) {
|
|
169
179
|
return !e || I(e) ? e : I(e.default) ? e.default : t && I(e[t]) ? e[t] : t && I(e[t]?.default) ? e[t].default : e;
|
|
170
180
|
}
|
|
171
|
-
var R = S, z = R.default,
|
|
181
|
+
var R = S, z = R.default, ae = z && typeof z == "object" ? z : R, B = L(w, "Readable") || L(ae.Readable, "Readable"), V = {
|
|
172
182
|
WebkitTouchCallout: "none",
|
|
173
183
|
WebkitUserSelect: "none",
|
|
174
184
|
KhtmlUserSelect: "none",
|
|
175
185
|
MozUserSelect: "none",
|
|
176
186
|
msUserSelect: "none",
|
|
177
187
|
userSelect: "none"
|
|
178
|
-
},
|
|
188
|
+
}, oe = C("div")(() => ({
|
|
179
189
|
width: "100%",
|
|
180
190
|
cursor: "pointer"
|
|
181
|
-
})),
|
|
191
|
+
})), H = C("button")(() => ({
|
|
182
192
|
margin: "0 auto",
|
|
183
193
|
textAlign: "center",
|
|
184
194
|
display: "flex",
|
|
@@ -194,15 +204,15 @@ var R = S, z = R.default, B = z && typeof z == "object" ? z : R, V = L(C, "Reada
|
|
|
194
204
|
outline: `2px solid ${y.buttonFocusOutline()}`,
|
|
195
205
|
outlineOffset: "-2px"
|
|
196
206
|
}
|
|
197
|
-
})),
|
|
207
|
+
})), se = C("div")(() => ({
|
|
198
208
|
width: "fit-content",
|
|
199
209
|
minWidth: "140px",
|
|
200
210
|
alignSelf: "center",
|
|
201
211
|
verticalAlign: "middle",
|
|
202
212
|
color: `var(--correct-answer-toggle-label-color, ${y.text()})`,
|
|
203
213
|
fontWeight: "normal",
|
|
204
|
-
...
|
|
205
|
-
})),
|
|
214
|
+
...V
|
|
215
|
+
})), U = C("div")(() => ({
|
|
206
216
|
position: "absolute",
|
|
207
217
|
width: "25px",
|
|
208
218
|
"&.enter": { opacity: "0" },
|
|
@@ -215,12 +225,12 @@ var R = S, z = R.default, B = z && typeof z == "object" ? z : R, V = L(C, "Reada
|
|
|
215
225
|
opacity: "0",
|
|
216
226
|
transition: "opacity 0.3s ease-in"
|
|
217
227
|
}
|
|
218
|
-
})),
|
|
228
|
+
})), ce = C("div")(() => ({
|
|
219
229
|
width: "25px",
|
|
220
230
|
marginRight: "5px",
|
|
221
231
|
display: "flex",
|
|
222
232
|
alignItems: "center"
|
|
223
|
-
})),
|
|
233
|
+
})), le = class extends T.Component {
|
|
224
234
|
static propTypes = {
|
|
225
235
|
onToggle: O.default.func,
|
|
226
236
|
toggled: O.default.bool,
|
|
@@ -231,43 +241,34 @@ var R = S, z = R.default, B = z && typeof z == "object" ? z : R, V = L(C, "Reada
|
|
|
231
241
|
language: O.default.string
|
|
232
242
|
};
|
|
233
243
|
static defaultProps = {
|
|
234
|
-
showMessage: "Show correct answer",
|
|
235
|
-
hideMessage: "Hide correct answer",
|
|
236
244
|
show: !1,
|
|
237
245
|
toggled: !1
|
|
238
246
|
};
|
|
239
|
-
constructor(
|
|
240
|
-
super(
|
|
241
|
-
...e.defaultProps,
|
|
242
|
-
showMessage: H.t("common:showCorrectAnswer", { lng: t.language }),
|
|
243
|
-
hideMessage: H.t("common:hideCorrectAnswer", { lng: t.language })
|
|
244
|
-
};
|
|
247
|
+
constructor(e) {
|
|
248
|
+
super(e), this.state = { show: e.show }, this.openIconRef = T.createRef(), this.closedIconRef = T.createRef();
|
|
245
249
|
}
|
|
250
|
+
relabel = () => this.forceUpdate();
|
|
246
251
|
onClick() {
|
|
247
252
|
this.props.onToggle(!this.props.toggled);
|
|
248
253
|
}
|
|
249
254
|
onTouch(e) {
|
|
250
255
|
e.preventDefault(), this.props.onToggle(!this.props.toggled);
|
|
251
256
|
}
|
|
252
|
-
UNSAFE_componentWillReceiveProps(
|
|
253
|
-
this.setState({ show:
|
|
254
|
-
...e.defaultProps,
|
|
255
|
-
showMessage: H.t("common:showCorrectAnswer", { lng: t.language }),
|
|
256
|
-
hideMessage: H.t("common:hideCorrectAnswer", { lng: t.language })
|
|
257
|
-
});
|
|
257
|
+
UNSAFE_componentWillReceiveProps(e) {
|
|
258
|
+
this.setState({ show: e.show });
|
|
258
259
|
}
|
|
259
260
|
render() {
|
|
260
|
-
let { className: e, toggled: t,
|
|
261
|
-
return /* @__PURE__ */ E(
|
|
261
|
+
let { className: e, toggled: t, language: n } = this.props, r = ie.forLocale(n, this.relabel), i = this.props.hideMessage ?? r.t("hideCorrectAnswer"), a = this.props.showMessage ?? r.t("showCorrectAnswer");
|
|
262
|
+
return /* @__PURE__ */ E(oe, {
|
|
262
263
|
className: e,
|
|
263
264
|
children: /* @__PURE__ */ E(j, {
|
|
264
265
|
show: this.state.show,
|
|
265
|
-
children: /* @__PURE__ */ D(
|
|
266
|
+
children: /* @__PURE__ */ D(H, {
|
|
266
267
|
type: "button",
|
|
267
268
|
"aria-pressed": !!t,
|
|
268
269
|
onClick: this.onClick.bind(this),
|
|
269
270
|
onTouchEnd: this.onTouch.bind(this),
|
|
270
|
-
children: [/* @__PURE__ */ D(
|
|
271
|
+
children: [/* @__PURE__ */ D(ce, { children: [/* @__PURE__ */ E(h, {
|
|
271
272
|
nodeRef: this.openIconRef,
|
|
272
273
|
timeout: 400,
|
|
273
274
|
in: t,
|
|
@@ -278,11 +279,11 @@ var R = S, z = R.default, B = z && typeof z == "object" ? z : R, V = L(C, "Reada
|
|
|
278
279
|
exit: "exit",
|
|
279
280
|
exitActive: "exit-active"
|
|
280
281
|
},
|
|
281
|
-
children: /* @__PURE__ */ E(
|
|
282
|
+
children: /* @__PURE__ */ E(U, {
|
|
282
283
|
ref: this.openIconRef,
|
|
283
284
|
children: /* @__PURE__ */ E(F, { open: t }, "correct-open")
|
|
284
285
|
})
|
|
285
|
-
}), /* @__PURE__ */ E(
|
|
286
|
+
}), /* @__PURE__ */ E(h, {
|
|
286
287
|
nodeRef: this.closedIconRef,
|
|
287
288
|
timeout: 5e3,
|
|
288
289
|
in: !t,
|
|
@@ -293,29 +294,29 @@ var R = S, z = R.default, B = z && typeof z == "object" ? z : R, V = L(C, "Reada
|
|
|
293
294
|
exit: "exit",
|
|
294
295
|
exitActive: "exit-active"
|
|
295
296
|
},
|
|
296
|
-
children: /* @__PURE__ */ E(
|
|
297
|
+
children: /* @__PURE__ */ E(U, {
|
|
297
298
|
ref: this.closedIconRef,
|
|
298
299
|
children: /* @__PURE__ */ E(F, { open: t }, "correct-closed")
|
|
299
300
|
})
|
|
300
|
-
})] }), /* @__PURE__ */ E(
|
|
301
|
+
})] }), /* @__PURE__ */ E(B, {
|
|
301
302
|
false: !0,
|
|
302
|
-
children: /* @__PURE__ */ E(
|
|
303
|
+
children: /* @__PURE__ */ E(se, {
|
|
303
304
|
"aria-hidden": !this.state.show,
|
|
304
|
-
children: t ?
|
|
305
|
+
children: t ? i : a
|
|
305
306
|
})
|
|
306
307
|
})]
|
|
307
308
|
})
|
|
308
309
|
})
|
|
309
310
|
});
|
|
310
311
|
}
|
|
311
|
-
},
|
|
312
|
+
}, W = {
|
|
312
313
|
advanced: "Advanced Multi",
|
|
313
314
|
simple: "Simple"
|
|
314
|
-
},
|
|
315
|
+
}, ue = C("div")(({ theme: e }) => ({
|
|
315
316
|
marginTop: e.spacing(2),
|
|
316
317
|
marginBottom: e.spacing(2),
|
|
317
318
|
padding: e.spacing(1)
|
|
318
|
-
})),
|
|
319
|
+
})), de = C("div", { shouldForwardProp: (e) => !["isCorrect", "isIncorrect"].includes(e) })(({ theme: e, isCorrect: t, isIncorrect: n }) => ({
|
|
319
320
|
color: y.text(),
|
|
320
321
|
background: y.background(),
|
|
321
322
|
border: t ? `2px solid ${y.correct()} !important` : n ? `2px solid ${y.incorrect()} !important` : `1px solid ${y.primaryLight()}`,
|
|
@@ -345,7 +346,7 @@ if (typeof document < "u") {
|
|
|
345
346
|
`, document.head.appendChild(t);
|
|
346
347
|
}
|
|
347
348
|
}
|
|
348
|
-
var
|
|
349
|
+
var fe = class extends T.Component {
|
|
349
350
|
static propTypes = {
|
|
350
351
|
onSimpleResponseChange: O.default.func,
|
|
351
352
|
model: O.default.object.isRequired,
|
|
@@ -372,9 +373,9 @@ var ue = class extends w.Component {
|
|
|
372
373
|
let { model: e, showCorrect: t, session: n, emptyResponse: r, onSimpleResponseChange: i, showKeypad: a } = this.props, { config: o, disabled: s, correctness: c } = e || {};
|
|
373
374
|
if (!o) return;
|
|
374
375
|
let l = c && c.correct, { responses: u, equationEditor: d } = o;
|
|
375
|
-
return /* @__PURE__ */ E(
|
|
376
|
+
return /* @__PURE__ */ E(ue, {
|
|
376
377
|
"data-keypad": !0,
|
|
377
|
-
children: t || s ? /* @__PURE__ */ E(
|
|
378
|
+
children: t || s ? /* @__PURE__ */ E(de, {
|
|
378
379
|
isIncorrect: !r && !l && !t,
|
|
379
380
|
isCorrect: !r && (l || t),
|
|
380
381
|
children: /* @__PURE__ */ E(v.Static, { latex: t ? u && u.length && u[0].answer : n.response || "" })
|
|
@@ -397,14 +398,14 @@ var ue = class extends w.Component {
|
|
|
397
398
|
};
|
|
398
399
|
//#endregion
|
|
399
400
|
//#region src/delivery/main.tsx
|
|
400
|
-
function
|
|
401
|
+
function G(e) {
|
|
401
402
|
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
402
403
|
}
|
|
403
|
-
function
|
|
404
|
-
return !e ||
|
|
404
|
+
function K(e, t) {
|
|
405
|
+
return !e || G(e) ? e : G(e.default) ? e.default : t && G(e[t]) ? e[t] : t && G(e[t]?.default) ? e[t].default : e;
|
|
405
406
|
}
|
|
406
|
-
var
|
|
407
|
-
function
|
|
407
|
+
var pe = S, q = pe.default, J = q && typeof q == "object" ? q : pe, me = K(s, "UiLayout") || K(J.UiLayout, "UiLayout"), Y = K(d, "PreviewPrompt") || K(J.PreviewPrompt, "PreviewPrompt"), he = K(w, "Readable") || K(J.Readable, "Readable"), ge = K(o, "Collapsible") || K(J.Collapsible, "Collapsible"), _e = K(p, "Feedback") || K(J.Feedback, "Feedback"), { translator: X } = n, ve = !1, ye = /\\newline/g, Z = /{{response}}/gm, be = 6, xe = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
408
|
+
function Se(e = []) {
|
|
408
409
|
return e.map((e) => ({
|
|
409
410
|
name: e,
|
|
410
411
|
latex: e,
|
|
@@ -412,7 +413,7 @@ function be(e = []) {
|
|
|
412
413
|
label: e
|
|
413
414
|
}));
|
|
414
415
|
}
|
|
415
|
-
function
|
|
416
|
+
function Ce(e, t) {
|
|
416
417
|
let n = e;
|
|
417
418
|
for (; n !== null;) {
|
|
418
419
|
if (t && n === t) return !0;
|
|
@@ -420,36 +421,36 @@ function xe(e, t) {
|
|
|
420
421
|
}
|
|
421
422
|
return !1;
|
|
422
423
|
}
|
|
423
|
-
function
|
|
424
|
+
function we(e = [], t) {
|
|
424
425
|
return Math.floor(e.length / 5) * 30 + (t === "miscellaneous" ? 600 : 500);
|
|
425
426
|
}
|
|
426
|
-
function
|
|
427
|
+
function Te(e, t) {
|
|
427
428
|
let { config: n, disabled: r } = e || {}, { expression: i, responses: a, printMode: o, alwaysShowCorrect: s } = n || {};
|
|
428
429
|
if (n && i) {
|
|
429
430
|
let e = i;
|
|
430
431
|
if (t.showCorrect) return a && a.length && a[0].answer;
|
|
431
432
|
let n = 1;
|
|
432
|
-
return (e || "").replace(
|
|
433
|
+
return (e || "").replace(Z, function() {
|
|
433
434
|
let e = t.session.answers[`r${n}`];
|
|
434
435
|
if (o && !s) {
|
|
435
436
|
let e = "\\ \\ ".repeat(30) + "\\newline ";
|
|
436
437
|
return `\\MathQuillMathField[r${n++}]{${e.repeat(3)}}`;
|
|
437
438
|
}
|
|
438
439
|
return r ? `\\embed{answerBlock}[r${n++}]` : `\\MathQuillMathField[r${n++}]{${e && e.value || ""}}`;
|
|
439
|
-
}).replace(
|
|
440
|
+
}).replace(ye, "\\embed{newLine}[]");
|
|
440
441
|
}
|
|
441
442
|
}
|
|
442
|
-
function
|
|
443
|
+
function Ee(e, t) {
|
|
443
444
|
let n = {};
|
|
444
445
|
if (t.config && t.config.expression) {
|
|
445
446
|
let r = 1;
|
|
446
|
-
(t.config.expression || "").replace(
|
|
447
|
+
(t.config.expression || "").replace(Z, () => {
|
|
447
448
|
n[`r${r}`] = { value: e && e.answers && e.answers[`r${r}`] && e.answers[`r${r}`].value || "" }, r += 1;
|
|
448
449
|
});
|
|
449
450
|
}
|
|
450
451
|
return n;
|
|
451
452
|
}
|
|
452
|
-
var
|
|
453
|
+
var De = class extends T.Component {
|
|
453
454
|
static propTypes = {
|
|
454
455
|
session: O.default.object.isRequired,
|
|
455
456
|
onSessionChange: O.default.func,
|
|
@@ -457,7 +458,7 @@ var Te = class extends w.Component {
|
|
|
457
458
|
};
|
|
458
459
|
constructor(e) {
|
|
459
460
|
super(e);
|
|
460
|
-
let { model: t, session: n } = e, r =
|
|
461
|
+
let { model: t, session: n } = e, r = Ee(n, t);
|
|
461
462
|
this.state = {
|
|
462
463
|
session: {
|
|
463
464
|
...e.session,
|
|
@@ -465,12 +466,12 @@ var Te = class extends w.Component {
|
|
|
465
466
|
},
|
|
466
467
|
activeAnswerBlock: "",
|
|
467
468
|
showCorrect: this.props.model.config.alwaysShowCorrect || !1,
|
|
468
|
-
tooltipContainerRef:
|
|
469
|
+
tooltipContainerRef: T.createRef()
|
|
469
470
|
}, this.instructionsIdPrefix = a("math-inline-instructions");
|
|
470
471
|
}
|
|
471
472
|
UNSAFE_componentWillMount() {
|
|
472
|
-
typeof window < "u" && (
|
|
473
|
-
let t =
|
|
473
|
+
typeof window < "u" && (ve ||= (m("answerBlock", (e) => {
|
|
474
|
+
let t = Oe();
|
|
474
475
|
return {
|
|
475
476
|
htmlString: `<div class="${t.blockContainer}">
|
|
476
477
|
<div class="${t.blockResponse}" data-answer-block-index="${e}">R</div>
|
|
@@ -489,9 +490,9 @@ var Te = class extends w.Component {
|
|
|
489
490
|
let n = this.root.querySelector(`[data-answer-block="${t}"]`), i = this.root.querySelector(`[data-answer-block-index="${t}"]`);
|
|
490
491
|
if (n) {
|
|
491
492
|
let a = r[t];
|
|
492
|
-
|
|
493
|
+
g(n, a && a.value || ""), e.view && (n.parentElement.parentElement.classList.remove("correct"), n.parentElement.parentElement.classList.remove("incorrect")), i.textContent = "R";
|
|
493
494
|
}
|
|
494
|
-
}),
|
|
495
|
+
}), l(this.root);
|
|
495
496
|
};
|
|
496
497
|
countResponseOccurrences(e) {
|
|
497
498
|
let t = e?.match(/\{\{response\}\}/g);
|
|
@@ -501,13 +502,13 @@ var Te = class extends w.Component {
|
|
|
501
502
|
let { config: n } = this.props.model, { config: r = {} } = e.model || {}, { session: i } = this.props, { session: a = {} } = e || {};
|
|
502
503
|
if (i && a && !t(i.answers, a.answers) && this.setState({ session: {
|
|
503
504
|
...a,
|
|
504
|
-
answers:
|
|
505
|
-
} }), n.note && n.language && n.language !== r.language && n.note ===
|
|
505
|
+
answers: Ee(a, this.props.model)
|
|
506
|
+
} }), n.note && n.language && n.language !== r.language && n.note === X.t("mathInline.primaryCorrectWithAlternates", { lng: n.language }) && (n.note = X.t("mathInline.primaryCorrectWithAlternates", { lng: r.language })), (n.env && n.env.mode !== "evaluate" || r.env && r.env.mode !== "evaluate") && this.setState({
|
|
506
507
|
...this.state.session,
|
|
507
508
|
showCorrect: !1
|
|
508
509
|
}), r.alwaysShowCorrect && this.setState({ showCorrect: !0 }), this.countResponseOccurrences(n.expression) < this.countResponseOccurrences(r.expression) && setTimeout(() => this.updateAria(), 100), n && n.responses && n.responses.length !== r.responses.length || !n && r && r.responses || n && r && n.expression !== r.expression) {
|
|
509
510
|
let e = {}, t = this.state.session.answers, n = 1;
|
|
510
|
-
(r.expression || "").replace(
|
|
511
|
+
(r.expression || "").replace(Z, () => {
|
|
511
512
|
e[`r${n}`] = { value: t && t[`r${n}`] && t[`r${n}`].value || "" }, n++;
|
|
512
513
|
}), this.setState((t) => ({ session: {
|
|
513
514
|
...t.session,
|
|
@@ -521,7 +522,7 @@ var Te = class extends w.Component {
|
|
|
521
522
|
return !r || !i;
|
|
522
523
|
}
|
|
523
524
|
componentDidMount() {
|
|
524
|
-
this.handleAnswerBlockDomUpdate(), this.updateAria(), setTimeout(() =>
|
|
525
|
+
this.handleAnswerBlockDomUpdate(), this.updateAria(), setTimeout(() => l(this.root), 100);
|
|
525
526
|
}
|
|
526
527
|
componentDidUpdate(e, t) {
|
|
527
528
|
this.handleAnswerBlockDomUpdate(), (e.model?.config?.responseType !== this.props.model?.config?.responseType || e.model?.language !== this.props.model?.language) && this.updateAria();
|
|
@@ -529,7 +530,7 @@ var Te = class extends w.Component {
|
|
|
529
530
|
updateAria = () => {
|
|
530
531
|
if (this.root) {
|
|
531
532
|
this.root.querySelectorAll(".mq-selectable").forEach((e) => e.setAttribute("aria-hidden", "true"));
|
|
532
|
-
let e =
|
|
533
|
+
let e = X.t("mathInline.keypadInstructions", { lng: this.props.model?.language });
|
|
533
534
|
this.root.querySelectorAll("textarea").forEach((t, n) => {
|
|
534
535
|
let r = `${this.instructionsIdPrefix}-${n}`, i = t.closest(".mq-textarea");
|
|
535
536
|
if (i) {
|
|
@@ -549,7 +550,7 @@ var Te = class extends w.Component {
|
|
|
549
550
|
}, 0);
|
|
550
551
|
};
|
|
551
552
|
handleKeyDown = (e, t) => {
|
|
552
|
-
let n =
|
|
553
|
+
let n = Ce(e.target, this.root), r = this.mqStatic && this.mqStatic.inputRef?.current ? this.mqStatic.inputRef?.current.contains(document.activeElement) : !!document.activeElement?.closest(".mq-editable-field"), { key: i, type: a } = e;
|
|
553
554
|
r && (i === "ArrowDown" || a === "click" || a === "touchstart") ? this.state.activeAnswerBlock !== t && n && (this.cleanupKeyDownListener(), this.setState({ activeAnswerBlock: t }, () => {
|
|
554
555
|
this.onSubFieldFocus(t), i === "ArrowDown" && this.focusFirstKeypadElement();
|
|
555
556
|
})) : e.key === "Escape" && this.setState({ activeAnswerBlock: "" });
|
|
@@ -602,7 +603,7 @@ var Te = class extends w.Component {
|
|
|
602
603
|
this.setState({ showCorrect: e }, this.handleAnswerBlockDomUpdate);
|
|
603
604
|
};
|
|
604
605
|
subFieldChanged = (e, t) => {
|
|
605
|
-
if (
|
|
606
|
+
if (f(), e) {
|
|
606
607
|
let n = window.scrollX, r = window.scrollY;
|
|
607
608
|
this.setState((n) => ({ session: {
|
|
608
609
|
...n.session,
|
|
@@ -642,52 +643,52 @@ var Te = class extends w.Component {
|
|
|
642
643
|
};
|
|
643
644
|
setTooltipRef(e) {
|
|
644
645
|
setTimeout(() => {
|
|
645
|
-
if (e &&
|
|
646
|
+
if (e && xe) {
|
|
646
647
|
let e = document.querySelector("[role='tooltip']");
|
|
647
648
|
e && e.firstChild.setAttribute("tabindex", "-1");
|
|
648
649
|
}
|
|
649
650
|
}, 1);
|
|
650
651
|
}
|
|
651
652
|
render() {
|
|
652
|
-
let { model: e } = this.props, { activeAnswerBlock: t, showCorrect: n, session: a, tooltipContainerRef: o } = this.state, { config: s, correctness: c, disabled:
|
|
653
|
+
let { model: e } = this.props, { activeAnswerBlock: t, showCorrect: n, session: a, tooltipContainerRef: o } = this.state, { config: s, correctness: c, disabled: l, extraCSSRules: d, view: f, teacherInstructions: p, rationale: m, feedback: h, animationsDisabled: g, printMode: _, alwaysShowCorrect: b, language: S } = e || {};
|
|
653
654
|
if (!s) return null;
|
|
654
|
-
let { showNote: C, note: w, prompt: T, responses:
|
|
655
|
+
let { showNote: C, note: w, prompt: T, responses: ne, responseType: O, equationEditor: k, customKeys: A, env: { mode: j, role: ie } = {} } = s || {}, M = (n || j === "view" && ie === "instructor") && C && w, N = r(ne), P = !N && c && c.correctness !== "correct", F = l && c, I = Se(A), L = c && c.correct, R = Te(e, this.state) || "", z = l && !c, ae = _ && !b, B = m && (i(m) || u(m)), V = p && (i(p) || u(p)), oe = /* @__PURE__ */ E(Ie, { children: /* @__PURE__ */ E(v.Static, {
|
|
655
656
|
className: "static-math",
|
|
656
657
|
ref: (e) => {
|
|
657
658
|
e && (this.mqStatic = e);
|
|
658
659
|
},
|
|
659
|
-
latex:
|
|
660
|
+
latex: R,
|
|
660
661
|
language: S,
|
|
661
662
|
onSubFieldChange: this.subFieldChanged,
|
|
662
663
|
getFieldName: this.getFieldName,
|
|
663
664
|
setInput: this.setInput,
|
|
664
665
|
onSubFieldFocus: this.onSubFieldFocus,
|
|
665
666
|
onBlur: this.onBlur
|
|
666
|
-
}) }),
|
|
667
|
-
|
|
668
|
-
|
|
667
|
+
}) }), H = /* @__PURE__ */ D(je, { children: [
|
|
668
|
+
j === "gather" && /* @__PURE__ */ E(Le, { children: X.t("mathInline.mathEquationResponseQuestion", { lng: S }) }),
|
|
669
|
+
z && V && (g ? /* @__PURE__ */ E("div", { dangerouslySetInnerHTML: { __html: x(p) } }) : /* @__PURE__ */ E($, {
|
|
669
670
|
labels: {
|
|
670
|
-
hidden:
|
|
671
|
-
visible:
|
|
671
|
+
hidden: X.t("common:showTeacherInstructions", { lng: S }),
|
|
672
|
+
visible: X.t("common:hideTeacherInstructions", { lng: S })
|
|
672
673
|
},
|
|
673
674
|
children: /* @__PURE__ */ E("div", { dangerouslySetInnerHTML: { __html: x(p) } })
|
|
674
675
|
})),
|
|
675
|
-
T && /* @__PURE__ */ E(
|
|
676
|
-
|
|
676
|
+
T && /* @__PURE__ */ E(Ae, { children: /* @__PURE__ */ E(Y, { prompt: T }) }),
|
|
677
|
+
ae ? oe : /* @__PURE__ */ E(he, {
|
|
677
678
|
false: !0,
|
|
678
|
-
children: /* @__PURE__ */ D(
|
|
679
|
+
children: /* @__PURE__ */ D(Fe, { children: [O === W.simple && /* @__PURE__ */ E(fe, {
|
|
679
680
|
onSimpleResponseChange: this.onSimpleResponseChange,
|
|
680
681
|
showCorrect: n,
|
|
681
|
-
emptyResponse:
|
|
682
|
+
emptyResponse: N,
|
|
682
683
|
model: e,
|
|
683
684
|
session: a,
|
|
684
685
|
onSubFieldFocus: this.onSubFieldFocus,
|
|
685
686
|
showKeypad: !!t
|
|
686
|
-
}),
|
|
687
|
+
}), O === W.advanced && /* @__PURE__ */ E(Pe, {
|
|
687
688
|
ref: o,
|
|
688
|
-
isIncorrect: !
|
|
689
|
-
isCorrect: !
|
|
690
|
-
showCorrectness: !
|
|
689
|
+
isIncorrect: !N && !L && !n,
|
|
690
|
+
isCorrect: !N && (L || n),
|
|
691
|
+
showCorrectness: !N && l && c && !f,
|
|
691
692
|
correctAnswerShown: n,
|
|
692
693
|
printCorrect: _ && b,
|
|
693
694
|
children: /* @__PURE__ */ E(te, {
|
|
@@ -740,12 +741,12 @@ var Te = class extends w.Component {
|
|
|
740
741
|
boxShadow: "none"
|
|
741
742
|
} }
|
|
742
743
|
},
|
|
743
|
-
title: Object.keys(a.answers).map((e) => e === t && !(n ||
|
|
744
|
+
title: Object.keys(a.answers).map((e) => e === t && !(n || l) && /* @__PURE__ */ E(Ne, {
|
|
744
745
|
"data-keypad": !0,
|
|
745
|
-
style: { width:
|
|
746
|
+
style: { width: we(I, k) },
|
|
746
747
|
children: /* @__PURE__ */ E(ee, {
|
|
747
|
-
additionalKeys:
|
|
748
|
-
mode:
|
|
748
|
+
additionalKeys: I,
|
|
749
|
+
mode: k || be,
|
|
749
750
|
onClick: this.onClick
|
|
750
751
|
})
|
|
751
752
|
}, e) || null),
|
|
@@ -754,7 +755,7 @@ var Te = class extends w.Component {
|
|
|
754
755
|
ref: (e) => {
|
|
755
756
|
e && (this.mqStatic = e);
|
|
756
757
|
},
|
|
757
|
-
latex:
|
|
758
|
+
latex: R,
|
|
758
759
|
language: S,
|
|
759
760
|
onSubFieldChange: this.subFieldChanged,
|
|
760
761
|
getFieldName: this.getFieldName,
|
|
@@ -765,22 +766,22 @@ var Te = class extends w.Component {
|
|
|
765
766
|
})
|
|
766
767
|
})] })
|
|
767
768
|
}),
|
|
768
|
-
|
|
769
|
-
|
|
769
|
+
z && M && /* @__PURE__ */ E(Me, { dangerouslySetInnerHTML: { __html: `<strong>Note:</strong> ${x(w)}` } }),
|
|
770
|
+
z && B && (g ? /* @__PURE__ */ E("div", { dangerouslySetInnerHTML: { __html: x(m) } }) : /* @__PURE__ */ E(ge, {
|
|
770
771
|
labels: {
|
|
771
|
-
hidden:
|
|
772
|
-
visible:
|
|
772
|
+
hidden: X.t("common:showRationale", { lng: S }),
|
|
773
|
+
visible: X.t("common:hideRationale", { lng: S })
|
|
773
774
|
},
|
|
774
775
|
children: /* @__PURE__ */ E("div", { dangerouslySetInnerHTML: { __html: x(m) } })
|
|
775
776
|
}))
|
|
776
777
|
] });
|
|
777
|
-
return
|
|
778
|
+
return F && (P || V || B || h) ? /* @__PURE__ */ E(Q, {
|
|
778
779
|
extraCSSRules: d,
|
|
779
780
|
ref: (e) => {
|
|
780
|
-
let t =
|
|
781
|
+
let t = re.findDOMNode(e);
|
|
781
782
|
this.root = t || this.root;
|
|
782
783
|
},
|
|
783
|
-
children: /* @__PURE__ */ E(
|
|
784
|
+
children: /* @__PURE__ */ E(ke, {
|
|
784
785
|
interactive: !0,
|
|
785
786
|
enterTouchDelay: 0,
|
|
786
787
|
placement: "bottom-start",
|
|
@@ -802,50 +803,50 @@ var Te = class extends w.Component {
|
|
|
802
803
|
}
|
|
803
804
|
},
|
|
804
805
|
title: /* @__PURE__ */ D("div", { children: [
|
|
805
|
-
/* @__PURE__ */ E(
|
|
806
|
+
/* @__PURE__ */ E(je, { children: P && /* @__PURE__ */ E(Re, {
|
|
806
807
|
language: S,
|
|
807
808
|
show: !0,
|
|
808
809
|
toggled: n,
|
|
809
810
|
onToggle: this.toggleShowCorrect
|
|
810
811
|
}) }),
|
|
811
|
-
|
|
812
|
+
V && /* @__PURE__ */ E($, {
|
|
812
813
|
labels: {
|
|
813
|
-
hidden:
|
|
814
|
-
visible:
|
|
814
|
+
hidden: X.t("common:showTeacherInstructions", { lng: S }),
|
|
815
|
+
visible: X.t("common:hideTeacherInstructions", { lng: S })
|
|
815
816
|
},
|
|
816
|
-
children: /* @__PURE__ */ E(
|
|
817
|
+
children: /* @__PURE__ */ E(Y, { prompt: p })
|
|
817
818
|
}, "collapsible-teacher-instructions"),
|
|
818
|
-
|
|
819
|
+
M && i(w) && /* @__PURE__ */ E($, {
|
|
819
820
|
labels: {
|
|
820
|
-
hidden:
|
|
821
|
-
visible:
|
|
821
|
+
hidden: X.t("common:showNote", { lng: S }),
|
|
822
|
+
visible: X.t("common:hideNote", { lng: S })
|
|
822
823
|
},
|
|
823
|
-
children: /* @__PURE__ */ E(
|
|
824
|
+
children: /* @__PURE__ */ E(Y, { prompt: w })
|
|
824
825
|
}, "collapsible-note"),
|
|
825
|
-
|
|
826
|
+
B && /* @__PURE__ */ E($, {
|
|
826
827
|
labels: {
|
|
827
|
-
hidden:
|
|
828
|
-
visible:
|
|
828
|
+
hidden: X.t("common:showRationale", { lng: S }),
|
|
829
|
+
visible: X.t("common:hideRationale", { lng: S })
|
|
829
830
|
},
|
|
830
|
-
children: /* @__PURE__ */ E(
|
|
831
|
+
children: /* @__PURE__ */ E(Y, { prompt: m })
|
|
831
832
|
}, "collapsible-rationale"),
|
|
832
|
-
h && /* @__PURE__ */ E(
|
|
833
|
+
h && /* @__PURE__ */ E(_e, {
|
|
833
834
|
correctness: c.correctness,
|
|
834
835
|
feedback: h
|
|
835
836
|
})
|
|
836
837
|
] }),
|
|
837
|
-
children:
|
|
838
|
+
children: H
|
|
838
839
|
})
|
|
839
|
-
}) : /* @__PURE__ */ E(
|
|
840
|
+
}) : /* @__PURE__ */ E(Q, {
|
|
840
841
|
extraCSSRules: d,
|
|
841
842
|
ref: (e) => {
|
|
842
|
-
let t =
|
|
843
|
+
let t = re.findDOMNode(e);
|
|
843
844
|
this.root = t || this.root;
|
|
844
845
|
},
|
|
845
|
-
children:
|
|
846
|
+
children: H
|
|
846
847
|
});
|
|
847
848
|
}
|
|
848
|
-
},
|
|
849
|
+
}, Oe = () => ({
|
|
849
850
|
blockContainer: "block-container",
|
|
850
851
|
blockResponse: "block-response",
|
|
851
852
|
blockMath: "block-math"
|
|
@@ -899,20 +900,20 @@ if (typeof document < "u") {
|
|
|
899
900
|
`, document.head.appendChild(t);
|
|
900
901
|
}
|
|
901
902
|
}
|
|
902
|
-
var
|
|
903
|
+
var Q = C(me)(() => ({
|
|
903
904
|
color: y.text(),
|
|
904
905
|
backgroundColor: y.background(),
|
|
905
906
|
display: "inline-block"
|
|
906
|
-
})),
|
|
907
|
+
})), ke = C(te)({}), Ae = C("div")(({ theme: e }) => ({ marginBottom: e.spacing(2) })), je = C("div")({
|
|
907
908
|
width: "100%",
|
|
908
909
|
position: "relative",
|
|
909
910
|
backgroundColor: y.background(),
|
|
910
911
|
color: y.text()
|
|
911
|
-
}),
|
|
912
|
+
}), Me = C("div")(({ theme: e }) => ({ paddingBottom: e.spacing(2) })), $ = C(ge)(({ theme: e }) => ({ marginBottom: e.spacing(2) })), Ne = C("div")(({ theme: e }) => ({
|
|
912
913
|
zIndex: 10,
|
|
913
914
|
minWidth: "400px",
|
|
914
915
|
marginTop: e.spacing(2)
|
|
915
|
-
})),
|
|
916
|
+
})), Pe = C("div", { shouldForwardProp: (e) => ![
|
|
916
917
|
"isIncorrect",
|
|
917
918
|
"isCorrect",
|
|
918
919
|
"showCorrectness",
|
|
@@ -942,7 +943,7 @@ var De = f(fe)(() => ({
|
|
|
942
943
|
"& sup": { top: 0 }
|
|
943
944
|
}
|
|
944
945
|
};
|
|
945
|
-
}),
|
|
946
|
+
}), Fe = C("div")({
|
|
946
947
|
position: "relative",
|
|
947
948
|
"& .mq-overarrow-inner": {
|
|
948
949
|
border: "none !important",
|
|
@@ -972,21 +973,21 @@ var De = f(fe)(() => ({
|
|
|
972
973
|
paddingTop: "1.5px !important"
|
|
973
974
|
},
|
|
974
975
|
"& .mq-parallelogram": { lineHeight: .85 }
|
|
975
|
-
}),
|
|
976
|
+
}), Ie = C("div")(({ theme: e }) => ({
|
|
976
977
|
marginBottom: e.spacing(1),
|
|
977
978
|
pointerEvents: "none"
|
|
978
|
-
})),
|
|
979
|
+
})), Le = C("h2")({
|
|
979
980
|
position: "absolute",
|
|
980
981
|
left: "-10000px",
|
|
981
982
|
top: "auto",
|
|
982
983
|
width: "1px",
|
|
983
984
|
height: "1px",
|
|
984
985
|
overflow: "hidden"
|
|
985
|
-
}),
|
|
986
|
+
}), Re = C(le)(({ theme: e }) => ({
|
|
986
987
|
color: y.text(),
|
|
987
988
|
marginBottom: e.spacing(2)
|
|
988
989
|
}));
|
|
989
990
|
//#endregion
|
|
990
|
-
export {
|
|
991
|
+
export { De as t };
|
|
991
992
|
|
|
992
|
-
//# sourceMappingURL=main-
|
|
993
|
+
//# sourceMappingURL=main-JX3mHB2O.js.map
|