@pie-element/math-inline 12.1.1-next.12 → 12.1.1-next.123
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +2627 -0
- package/CHANGELOG.md +2473 -0
- package/LICENSE.md +5 -0
- package/README.md +3 -0
- package/configure/CHANGELOG.json +1652 -0
- package/configure/CHANGELOG.md +2101 -0
- package/configure/lib/configure.js +186 -0
- package/configure/lib/configure.js.map +1 -0
- package/configure/lib/defaults.js +185 -0
- package/configure/lib/defaults.js.map +1 -0
- package/configure/lib/general-config-block.js +525 -0
- package/configure/lib/general-config-block.js.map +1 -0
- package/configure/lib/index.js +140 -0
- package/configure/lib/index.js.map +1 -0
- package/configure/lib/response.js +369 -0
- package/configure/lib/response.js.map +1 -0
- package/configure/lib/utils.js +31 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +29 -0
- package/controller/CHANGELOG.json +1002 -0
- package/controller/CHANGELOG.md +1536 -0
- package/controller/lib/defaults.js +43 -0
- package/controller/lib/defaults.js.map +1 -0
- package/controller/lib/index.js +383 -0
- package/controller/lib/index.js.map +1 -0
- package/controller/lib/utils.js +11 -0
- package/controller/lib/utils.js.map +1 -0
- package/controller/package.json +26 -0
- package/docs/config-schema.json +2071 -0
- package/docs/config-schema.json.md +1533 -0
- package/docs/demo/config.js +8 -0
- package/docs/demo/generate.js +41 -0
- package/docs/demo/index.html +1 -0
- package/docs/demo/session.js +11 -0
- package/docs/pie-schema.json +1472 -0
- package/docs/pie-schema.json.md +845 -0
- package/lib/index.js +94 -0
- package/lib/index.js.map +1 -0
- package/lib/main.js +1030 -0
- package/lib/main.js.map +1 -0
- package/lib/print.js +92 -0
- package/lib/print.js.map +1 -0
- package/lib/simple-question-block.js +148 -0
- package/lib/simple-question-block.js.map +1 -0
- package/lib/utils.js +11 -0
- package/lib/utils.js.map +1 -0
- package/package.json +26 -93
- package/configure.js +0 -2
- package/controller.js +0 -1
- package/dist/author/configure.d.ts +0 -25
- package/dist/author/configure.js +0 -114
- package/dist/author/defaults.d.ts +0 -186
- package/dist/author/defaults.js +0 -145
- package/dist/author/general-config-block.d.ts +0 -35
- package/dist/author/general-config-block.js +0 -390
- package/dist/author/index.d.ts +0 -60
- package/dist/author/index.js +0 -77
- package/dist/author/response.d.ts +0 -40
- package/dist/author/response.js +0 -238
- package/dist/author/utils.d.ts +0 -14
- package/dist/author/utils.js +0 -13
- package/dist/browser/author/index.js +0 -30246
- package/dist/browser/author/index.js.map +0 -1
- package/dist/browser/controller/index.js +0 -37789
- package/dist/browser/controller/index.js.map +0 -1
- package/dist/browser/delivery/index.js +0 -84
- package/dist/browser/delivery/index.js.map +0 -1
- package/dist/browser/dist-BJ5Sm1Fi.js +0 -313
- package/dist/browser/dist-BJ5Sm1Fi.js.map +0 -1
- package/dist/browser/dist-D9ARZhQk.js +0 -1426
- package/dist/browser/dist-D9ARZhQk.js.map +0 -1
- package/dist/browser/dist-OamHPwLm.js +0 -19418
- package/dist/browser/dist-OamHPwLm.js.map +0 -1
- package/dist/browser/main-BDByYWlm.js +0 -973
- package/dist/browser/main-BDByYWlm.js.map +0 -1
- package/dist/browser/math-inline.css +0 -2
- package/dist/browser/print/index.js +0 -50
- package/dist/browser/print/index.js.map +0 -1
- package/dist/controller/defaults.d.ts +0 -44
- package/dist/controller/defaults.js +0 -39
- package/dist/controller/index.d.ts +0 -22
- package/dist/controller/index.js +0 -171
- package/dist/controller/utils.d.ts +0 -12
- package/dist/controller/utils.js +0 -7
- package/dist/delivery/index.d.ts +0 -22
- package/dist/delivery/index.js +0 -55
- package/dist/delivery/main.d.ts +0 -44
- package/dist/delivery/main.js +0 -606
- package/dist/delivery/simple-question-block.d.ts +0 -27
- package/dist/delivery/simple-question-block.js +0 -94
- package/dist/delivery/utils.d.ts +0 -12
- package/dist/delivery/utils.js +0 -7
- package/dist/index.d.ts +0 -1
- package/dist/index.iife.d.ts +0 -8
- package/dist/index.iife.js +0 -227
- package/dist/index.js +0 -2
- package/dist/math-inline.css +0 -2
- package/dist/print/index.d.ts +0 -15
- package/dist/print/index.js +0 -50
- package/dist/runtime-support.d.ts +0 -12
- package/dist/runtime-support.js +0 -12
package/dist/delivery/main.js
DELETED
|
@@ -1,606 +0,0 @@
|
|
|
1
|
-
import { ResponseTypes as e } from "./utils.js";
|
|
2
|
-
import t from "./simple-question-block.js";
|
|
3
|
-
import n from "react";
|
|
4
|
-
import { isEmpty as r, isEqual as i } from "@pie-element/shared-lodash";
|
|
5
|
-
import a from "prop-types";
|
|
6
|
-
import o from "@pie-lib/correct-answer-toggle";
|
|
7
|
-
import { HorizontalKeypad as s, applyStaticMath as c, mq as l, registerEmbed as u, updateSpans as d } from "@pie-lib/math-input";
|
|
8
|
-
import * as f from "@pie-lib/render-ui";
|
|
9
|
-
import { Collapsible as p, Feedback as m, PreviewPrompt as h, Readable as g, UiLayout as _, color as v, hasMedia as y, hasText as b } from "@pie-lib/render-ui";
|
|
10
|
-
import { jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
11
|
-
import { renderMath as C } from "@pie-element/shared-math-rendering-mathjax";
|
|
12
|
-
import { styled as w } from "@mui/material/styles";
|
|
13
|
-
import T from "@mui/material/Tooltip";
|
|
14
|
-
import E from "@pie-lib/translator";
|
|
15
|
-
import D from "react-dom";
|
|
16
|
-
//#region src/delivery/main.tsx
|
|
17
|
-
function O(e) {
|
|
18
|
-
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
19
|
-
}
|
|
20
|
-
function k(e, t) {
|
|
21
|
-
return !e || O(e) ? e : O(e.default) ? e.default : t && O(e[t]) ? e[t] : t && O(e[t]?.default) ? e[t].default : e;
|
|
22
|
-
}
|
|
23
|
-
var A = k(_, "UiLayout") || k(F.UiLayout, "UiLayout"), j = k(h, "PreviewPrompt") || k(F.PreviewPrompt, "PreviewPrompt"), ee = k(g, "Readable") || k(F.Readable, "Readable"), M = k(p, "Collapsible") || k(F.Collapsible, "Collapsible"), te = k(m, "Feedback") || k(F.Feedback, "Feedback"), N = f, P = N.default, F = P && typeof P == "object" ? P : N, { translator: I } = E, L = !1, R = /\\newline/g, z = /{{response}}/gm, ne = 6, B = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
24
|
-
function re(e = []) {
|
|
25
|
-
return e.map((e) => ({
|
|
26
|
-
name: e,
|
|
27
|
-
latex: e,
|
|
28
|
-
write: e,
|
|
29
|
-
label: e
|
|
30
|
-
}));
|
|
31
|
-
}
|
|
32
|
-
function V(e, t) {
|
|
33
|
-
let n = e;
|
|
34
|
-
for (; n !== null;) {
|
|
35
|
-
if (t && n === t) return !0;
|
|
36
|
-
n = n.parentNode;
|
|
37
|
-
}
|
|
38
|
-
return !1;
|
|
39
|
-
}
|
|
40
|
-
function ie(e = [], t) {
|
|
41
|
-
return Math.floor(e.length / 5) * 30 + (t === "miscellaneous" ? 600 : 500);
|
|
42
|
-
}
|
|
43
|
-
function ae(e, t) {
|
|
44
|
-
let { config: n, disabled: r } = e || {}, { expression: i, responses: a, printMode: o, alwaysShowCorrect: s } = n || {};
|
|
45
|
-
if (n && i) {
|
|
46
|
-
let e = i;
|
|
47
|
-
if (t.showCorrect) return a && a.length && a[0].answer;
|
|
48
|
-
let n = 1;
|
|
49
|
-
return (e || "").replace(z, function() {
|
|
50
|
-
let e = t.session.answers[`r${n}`];
|
|
51
|
-
if (o && !s) {
|
|
52
|
-
let e = "\\ \\ ".repeat(30) + "\\newline ";
|
|
53
|
-
return `\\MathQuillMathField[r${n++}]{${e.repeat(3)}}`;
|
|
54
|
-
}
|
|
55
|
-
return r ? `\\embed{answerBlock}[r${n++}]` : `\\MathQuillMathField[r${n++}]{${e && e.value || ""}}`;
|
|
56
|
-
}).replace(R, "\\embed{newLine}[]");
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
function H(e, t) {
|
|
60
|
-
let n = {};
|
|
61
|
-
if (t.config && t.config.expression) {
|
|
62
|
-
let r = 1;
|
|
63
|
-
(t.config.expression || "").replace(z, () => {
|
|
64
|
-
n[`r${r}`] = { value: e && e.answers && e.answers[`r${r}`] && e.answers[`r${r}`].value || "" }, r += 1;
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
return n;
|
|
68
|
-
}
|
|
69
|
-
var U = class extends n.Component {
|
|
70
|
-
static propTypes = {
|
|
71
|
-
session: a.object.isRequired,
|
|
72
|
-
onSessionChange: a.func,
|
|
73
|
-
model: a.object.isRequired
|
|
74
|
-
};
|
|
75
|
-
constructor(e) {
|
|
76
|
-
super(e);
|
|
77
|
-
let { model: t, session: r } = e, i = H(r, t);
|
|
78
|
-
this.state = {
|
|
79
|
-
session: {
|
|
80
|
-
...e.session,
|
|
81
|
-
answers: i
|
|
82
|
-
},
|
|
83
|
-
activeAnswerBlock: "",
|
|
84
|
-
showCorrect: this.props.model.config.alwaysShowCorrect || !1,
|
|
85
|
-
tooltipContainerRef: n.createRef()
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
UNSAFE_componentWillMount() {
|
|
89
|
-
typeof window < "u" && (L ||= (u("answerBlock", (e) => {
|
|
90
|
-
let t = W();
|
|
91
|
-
return {
|
|
92
|
-
htmlString: `<div class="${t.blockContainer}">
|
|
93
|
-
<div class="${t.blockResponse}" id="${e}Index">R</div>
|
|
94
|
-
<div class="${t.blockMath}">
|
|
95
|
-
<span id="${e}"></span>
|
|
96
|
-
</div>
|
|
97
|
-
</div>`,
|
|
98
|
-
text: () => "text",
|
|
99
|
-
latex: () => `\\embed{answerBlock}[${e}]`
|
|
100
|
-
};
|
|
101
|
-
}), !0));
|
|
102
|
-
}
|
|
103
|
-
handleAnswerBlockDomUpdate = () => {
|
|
104
|
-
let { model: e } = this.props, { session: t, showCorrect: n } = this.state, r = t.answers;
|
|
105
|
-
this.root && e.disabled && !n && Object.keys(r).forEach((t) => {
|
|
106
|
-
let n = this.root.querySelector(`#${t}`), i = this.root.querySelector(`#${t}Index`);
|
|
107
|
-
if (n) {
|
|
108
|
-
let a = r[t];
|
|
109
|
-
c(n, a && a.value || ""), e.view && (n.parentElement.parentElement.classList.remove("correct"), n.parentElement.parentElement.classList.remove("incorrect")), i.textContent = "R";
|
|
110
|
-
}
|
|
111
|
-
}), C(this.root);
|
|
112
|
-
};
|
|
113
|
-
countResponseOccurrences(e) {
|
|
114
|
-
let t = e?.match(/\{\{response\}\}/g);
|
|
115
|
-
return t ? t.length : 0;
|
|
116
|
-
}
|
|
117
|
-
UNSAFE_componentWillReceiveProps(e) {
|
|
118
|
-
let { config: t } = this.props.model, { config: n = {} } = e.model || {}, { session: r } = this.props, { session: a = {} } = e || {};
|
|
119
|
-
if (r && a && !i(r.answers, a.answers) && this.setState({ session: {
|
|
120
|
-
...a,
|
|
121
|
-
answers: H(a, this.props.model)
|
|
122
|
-
} }), t.note && t.language && t.language !== n.language && t.note === I.t("mathInline.primaryCorrectWithAlternates", { lng: t.language }) && (t.note = I.t("mathInline.primaryCorrectWithAlternates", { lng: n.language })), (t.env && t.env.mode !== "evaluate" || n.env && n.env.mode !== "evaluate") && this.setState({
|
|
123
|
-
...this.state.session,
|
|
124
|
-
showCorrect: !1
|
|
125
|
-
}), n.alwaysShowCorrect && this.setState({ showCorrect: !0 }), this.countResponseOccurrences(t.expression) < this.countResponseOccurrences(n.expression) && setTimeout(() => this.updateAria(), 100), t && t.responses && t.responses.length !== n.responses.length || !t && n && n.responses || t && n && t.expression !== n.expression) {
|
|
126
|
-
let e = {}, t = this.state.session.answers, r = 1;
|
|
127
|
-
(n.expression || "").replace(z, () => {
|
|
128
|
-
e[`r${r}`] = { value: t && t[`r${r}`] && t[`r${r}`].value || "" }, r++;
|
|
129
|
-
}), this.setState((t) => ({ session: {
|
|
130
|
-
...t.session,
|
|
131
|
-
completeAnswer: this.mqStatic && this.mqStatic.mathField.latex(),
|
|
132
|
-
answers: e
|
|
133
|
-
} }), this.handleAnswerBlockDomUpdate);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
shouldComponentUpdate(e, t) {
|
|
137
|
-
let n = i(this.props.model, e.model), r = i(this.state, t);
|
|
138
|
-
return !n || !r;
|
|
139
|
-
}
|
|
140
|
-
componentDidMount() {
|
|
141
|
-
this.handleAnswerBlockDomUpdate(), this.updateAria(), setTimeout(() => C(this.root), 100);
|
|
142
|
-
}
|
|
143
|
-
componentDidUpdate(e, t) {
|
|
144
|
-
this.handleAnswerBlockDomUpdate(), e.model?.config?.responseType !== this.props.model?.config?.responseType && this.updateAria();
|
|
145
|
-
}
|
|
146
|
-
updateAria = () => {
|
|
147
|
-
this.root && (this.root.querySelectorAll(".mq-selectable").forEach((e) => e.setAttribute("aria-hidden", "true")), this.root.querySelectorAll("textarea").forEach((e, t) => {
|
|
148
|
-
e.setAttribute("aria-label", "Enter answer.");
|
|
149
|
-
let n = `instructions-${t}`, r = e.closest(".mq-textarea");
|
|
150
|
-
if (r) {
|
|
151
|
-
let t = r.querySelector(`#${n}`);
|
|
152
|
-
t || (t = document.createElement("span"), t.id = n, t.className = "sr-only", t.textContent = "This field supports both keypad and keyboard input. Use the keyboard to access and interact with the on-screen math keypad, which accepts LaTeX markup. Use the down arrow key to open the keypad and navigate its buttons. Use the escape key to close the keypad and return to the input field.", r.insertBefore(t, e)), e.setAttribute("aria-describedby", n);
|
|
153
|
-
}
|
|
154
|
-
}));
|
|
155
|
-
};
|
|
156
|
-
focusFirstKeypadElement = () => {
|
|
157
|
-
setTimeout(() => {
|
|
158
|
-
let e = document.querySelector("[data-keypad]");
|
|
159
|
-
if (e) {
|
|
160
|
-
let t = e.querySelector("button, [role='button']");
|
|
161
|
-
t && t.focus();
|
|
162
|
-
}
|
|
163
|
-
}, 0);
|
|
164
|
-
};
|
|
165
|
-
handleKeyDown = (e, t) => {
|
|
166
|
-
let n = V(e.target, this.root), r = this.mqStatic && this.mqStatic.inputRef?.current ? this.mqStatic.inputRef?.current.contains(document.activeElement) : document.activeElement?.getAttribute("aria-label") === "Enter answer.", { key: i, type: a } = e;
|
|
167
|
-
r && (i === "ArrowDown" || a === "click" || a === "touchstart") ? this.state.activeAnswerBlock !== t && n && (this.cleanupKeyDownListener(), this.setState({ activeAnswerBlock: t }, () => {
|
|
168
|
-
this.onSubFieldFocus(t), i === "ArrowDown" && this.focusFirstKeypadElement();
|
|
169
|
-
})) : e.key === "Escape" && this.setState({ activeAnswerBlock: "" });
|
|
170
|
-
};
|
|
171
|
-
onSubFieldFocus = (e) => {
|
|
172
|
-
this.handleEvent || (this.handleEvent = (t) => {
|
|
173
|
-
this.handleKeyDown(t, e);
|
|
174
|
-
}, document.addEventListener("keydown", this.handleEvent), document.addEventListener("click", this.handleEvent), document.addEventListener("touchstart", this.handleEvent));
|
|
175
|
-
};
|
|
176
|
-
cleanupKeyDownListener = () => {
|
|
177
|
-
this.handleEvent &&= (document.removeEventListener("keydown", this.handleEvent), document.removeEventListener("click", this.handleEvent), document.removeEventListener("touchstart", this.handleEvent), null);
|
|
178
|
-
};
|
|
179
|
-
componentWillUnmount() {
|
|
180
|
-
this.cleanupKeyDownListener && this.cleanupKeyDownListener();
|
|
181
|
-
}
|
|
182
|
-
onDone = () => {};
|
|
183
|
-
onSimpleResponseChange = (e) => {
|
|
184
|
-
this.setState((t) => ({ session: {
|
|
185
|
-
...t.session,
|
|
186
|
-
response: e
|
|
187
|
-
} }), this.callOnSessionChange);
|
|
188
|
-
};
|
|
189
|
-
toNodeData = (e) => {
|
|
190
|
-
if (!e) return;
|
|
191
|
-
let { type: t, value: n } = e;
|
|
192
|
-
return t === "command" || t === "cursor" ? e : t === "answer" ? {
|
|
193
|
-
type: "answer",
|
|
194
|
-
...e
|
|
195
|
-
} : n === "clear" ? { type: "clear" } : {
|
|
196
|
-
type: "write",
|
|
197
|
-
value: n
|
|
198
|
-
};
|
|
199
|
-
};
|
|
200
|
-
setInput = (e) => {
|
|
201
|
-
this.input = e;
|
|
202
|
-
};
|
|
203
|
-
onClick = (e) => {
|
|
204
|
-
let t = window.scrollX, n = window.scrollY, r = this.toNodeData(e);
|
|
205
|
-
r.type === "clear" ? this.input.clear() : r.type === "command" ? Array.isArray(r.value) ? r.value.forEach((e) => {
|
|
206
|
-
this.input.cmd(e);
|
|
207
|
-
}) : this.input.cmd(r.value) : r.type === "cursor" ? this.input.keystroke(r.value) : this.input.write(r.value), this.input.focus(), requestAnimationFrame(() => {
|
|
208
|
-
window.scrollTo(t, n), requestAnimationFrame(() => window.scrollTo(t, n));
|
|
209
|
-
});
|
|
210
|
-
};
|
|
211
|
-
callOnSessionChange = () => {
|
|
212
|
-
let { onSessionChange: e } = this.props;
|
|
213
|
-
e && e(this.state.session);
|
|
214
|
-
};
|
|
215
|
-
toggleShowCorrect = (e) => {
|
|
216
|
-
this.setState({ showCorrect: e }, this.handleAnswerBlockDomUpdate);
|
|
217
|
-
};
|
|
218
|
-
subFieldChanged = (e, t) => {
|
|
219
|
-
if (d(), e) {
|
|
220
|
-
let n = window.scrollX, r = window.scrollY;
|
|
221
|
-
this.setState((n) => ({ session: {
|
|
222
|
-
...n.session,
|
|
223
|
-
completeAnswer: this.mqStatic && this.mqStatic.mathField.latex(),
|
|
224
|
-
answers: {
|
|
225
|
-
...n.session.answers,
|
|
226
|
-
[e]: { value: t }
|
|
227
|
-
}
|
|
228
|
-
} }), () => {
|
|
229
|
-
this.callOnSessionChange(), requestAnimationFrame(() => {
|
|
230
|
-
window.scrollTo(n, r);
|
|
231
|
-
});
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
getFieldName = (e, t) => {
|
|
236
|
-
let { answers: n } = this.state.session;
|
|
237
|
-
if (Object.keys(n || {}).length) return Object.keys(n).find((n) => {
|
|
238
|
-
let r = t[n];
|
|
239
|
-
return r && r.id == e.id;
|
|
240
|
-
});
|
|
241
|
-
};
|
|
242
|
-
onBlur = (e) => {
|
|
243
|
-
let { relatedTarget: t, currentTarget: n } = e || {}, r = n && n.closest("[role=tooltip]");
|
|
244
|
-
function i(e, t = 0) {
|
|
245
|
-
if (!e || t >= 16) return null;
|
|
246
|
-
let n = e.offsetParent;
|
|
247
|
-
return n ? n.getAttribute("role") === "tooltip" ? n : i(n, t + 1) : null;
|
|
248
|
-
}
|
|
249
|
-
function a(e, t = 0) {
|
|
250
|
-
if (!e || t >= 4) return null;
|
|
251
|
-
let n = e?.children?.[0];
|
|
252
|
-
return n ? n.attributes && n.attributes["data-keypad"] ? n : a(n, t + 1) : null;
|
|
253
|
-
}
|
|
254
|
-
let o = i(t), s = o ? a(o) : null;
|
|
255
|
-
(!t || !n || !s?.attributes["data-keypad"]) && (r || this.setState({ activeAnswerBlock: "" }));
|
|
256
|
-
};
|
|
257
|
-
setTooltipRef(e) {
|
|
258
|
-
setTimeout(() => {
|
|
259
|
-
if (e && B) {
|
|
260
|
-
let e = document.querySelector("[role='tooltip']");
|
|
261
|
-
e && e.firstChild.setAttribute("tabindex", "-1");
|
|
262
|
-
}
|
|
263
|
-
}, 1);
|
|
264
|
-
}
|
|
265
|
-
render() {
|
|
266
|
-
let { model: n } = this.props, { activeAnswerBlock: i, showCorrect: a, session: o, tooltipContainerRef: c } = this.state, { config: u, correctness: d, disabled: f, extraCSSRules: p, view: m, teacherInstructions: h, rationale: g, feedback: _, animationsDisabled: C, printMode: w, alwaysShowCorrect: E, language: O } = n || {};
|
|
267
|
-
if (!u) return null;
|
|
268
|
-
let { showNote: k, note: A, prompt: N, responses: P, responseType: F, equationEditor: L, customKeys: R, id: z, env: { mode: B, role: V } = {} } = u || {}, H = (a || B === "view" && V === "instructor") && k && A, U = r(P), W = !U && d && d.correctness !== "correct", he = f && d, J = re(R), Y = d && d.correct, X = ae(n, this.state) || "", Z = f && !d, ge = w && !E, Q = g && (b(g) || y(g)), $ = h && (b(h) || y(h)), _e = /* @__PURE__ */ x(fe, { children: /* @__PURE__ */ x(l.Static, {
|
|
269
|
-
className: "static-math",
|
|
270
|
-
ref: (e) => {
|
|
271
|
-
e && (this.mqStatic = e);
|
|
272
|
-
},
|
|
273
|
-
latex: X,
|
|
274
|
-
onSubFieldChange: this.subFieldChanged,
|
|
275
|
-
getFieldName: this.getFieldName,
|
|
276
|
-
setInput: this.setInput,
|
|
277
|
-
onSubFieldFocus: this.onSubFieldFocus,
|
|
278
|
-
onBlur: this.onBlur
|
|
279
|
-
}) }), ve = /* @__PURE__ */ S(K, { children: [
|
|
280
|
-
B === "gather" && /* @__PURE__ */ x(pe, { children: "Math Equation Response Question" }),
|
|
281
|
-
Z && $ && (C ? /* @__PURE__ */ x("div", { dangerouslySetInnerHTML: { __html: h } }) : /* @__PURE__ */ x(q, {
|
|
282
|
-
labels: {
|
|
283
|
-
hidden: "Show Teacher Instructions",
|
|
284
|
-
visible: "Hide Teacher Instructions"
|
|
285
|
-
},
|
|
286
|
-
children: /* @__PURE__ */ x("div", { dangerouslySetInnerHTML: { __html: h } })
|
|
287
|
-
})),
|
|
288
|
-
N && /* @__PURE__ */ x(se, { children: /* @__PURE__ */ x(j, { prompt: N }) }),
|
|
289
|
-
ge ? _e : /* @__PURE__ */ x(ee, {
|
|
290
|
-
false: !0,
|
|
291
|
-
children: /* @__PURE__ */ S(de, {
|
|
292
|
-
tabIndex: 0,
|
|
293
|
-
children: [F === e.simple && /* @__PURE__ */ x(t, {
|
|
294
|
-
onSimpleResponseChange: this.onSimpleResponseChange,
|
|
295
|
-
showCorrect: a,
|
|
296
|
-
emptyResponse: U,
|
|
297
|
-
model: n,
|
|
298
|
-
session: o,
|
|
299
|
-
onSubFieldFocus: this.onSubFieldFocus,
|
|
300
|
-
showKeypad: !!i
|
|
301
|
-
}), F === e.advanced && /* @__PURE__ */ x(ue, {
|
|
302
|
-
ref: c,
|
|
303
|
-
isIncorrect: !U && !Y && !a,
|
|
304
|
-
isCorrect: !U && (Y || a),
|
|
305
|
-
showCorrectness: !U && f && d && !m,
|
|
306
|
-
correctAnswerShown: a,
|
|
307
|
-
printCorrect: w && E,
|
|
308
|
-
children: /* @__PURE__ */ x(T, {
|
|
309
|
-
ref: (e) => this.setTooltipRef(e),
|
|
310
|
-
enterTouchDelay: 0,
|
|
311
|
-
interactive: !0,
|
|
312
|
-
open: !!i,
|
|
313
|
-
slotProps: {
|
|
314
|
-
popper: {
|
|
315
|
-
container: c?.current || void 0,
|
|
316
|
-
placement: "bottom-start",
|
|
317
|
-
sx: {
|
|
318
|
-
backgroundColor: "transparent",
|
|
319
|
-
width: "650px",
|
|
320
|
-
opacity: 1,
|
|
321
|
-
"& .MuiTooltip-arrow": { display: "none" }
|
|
322
|
-
},
|
|
323
|
-
modifiers: [
|
|
324
|
-
{
|
|
325
|
-
name: "offset",
|
|
326
|
-
options: { offset: [0, 8] }
|
|
327
|
-
},
|
|
328
|
-
{
|
|
329
|
-
name: "preventOverflow",
|
|
330
|
-
enabled: !0,
|
|
331
|
-
options: {
|
|
332
|
-
boundary: "viewport",
|
|
333
|
-
padding: 8
|
|
334
|
-
}
|
|
335
|
-
},
|
|
336
|
-
{
|
|
337
|
-
name: "computeStyles",
|
|
338
|
-
options: {
|
|
339
|
-
adaptive: !0,
|
|
340
|
-
gpuAcceleration: !0
|
|
341
|
-
}
|
|
342
|
-
},
|
|
343
|
-
{
|
|
344
|
-
name: "flip",
|
|
345
|
-
enabled: !1
|
|
346
|
-
}
|
|
347
|
-
]
|
|
348
|
-
},
|
|
349
|
-
tooltip: { sx: {
|
|
350
|
-
fontSize: "initial",
|
|
351
|
-
backgroundColor: "transparent",
|
|
352
|
-
width: "600px",
|
|
353
|
-
marginTop: 0,
|
|
354
|
-
paddingTop: 0,
|
|
355
|
-
boxShadow: "none"
|
|
356
|
-
} }
|
|
357
|
-
},
|
|
358
|
-
title: Object.keys(o.answers).map((e) => e === i && !(a || f) && /* @__PURE__ */ x(le, {
|
|
359
|
-
"data-keypad": !0,
|
|
360
|
-
style: { width: ie(J, L) },
|
|
361
|
-
children: /* @__PURE__ */ x(s, {
|
|
362
|
-
additionalKeys: J,
|
|
363
|
-
mode: L || ne,
|
|
364
|
-
onClick: this.onClick
|
|
365
|
-
})
|
|
366
|
-
}, e) || null),
|
|
367
|
-
children: /* @__PURE__ */ x("div", { children: /* @__PURE__ */ x(l.Static, {
|
|
368
|
-
className: "static-math",
|
|
369
|
-
ref: (e) => {
|
|
370
|
-
e && (this.mqStatic = e);
|
|
371
|
-
},
|
|
372
|
-
latex: X,
|
|
373
|
-
onSubFieldChange: this.subFieldChanged,
|
|
374
|
-
getFieldName: this.getFieldName,
|
|
375
|
-
setInput: this.setInput,
|
|
376
|
-
onSubFieldFocus: this.onSubFieldFocus,
|
|
377
|
-
onBlur: this.onBlur
|
|
378
|
-
}) })
|
|
379
|
-
})
|
|
380
|
-
})]
|
|
381
|
-
})
|
|
382
|
-
}),
|
|
383
|
-
Z && H && /* @__PURE__ */ x(ce, { dangerouslySetInnerHTML: { __html: `<strong>Note:</strong> ${A}` } }),
|
|
384
|
-
Z && Q && (C ? /* @__PURE__ */ x("div", { dangerouslySetInnerHTML: { __html: g } }) : /* @__PURE__ */ x(M, {
|
|
385
|
-
labels: {
|
|
386
|
-
hidden: "Show Rationale",
|
|
387
|
-
visible: "Hide Rationale"
|
|
388
|
-
},
|
|
389
|
-
children: /* @__PURE__ */ x("div", { dangerouslySetInnerHTML: { __html: g } })
|
|
390
|
-
}))
|
|
391
|
-
] });
|
|
392
|
-
return he && (W || $ || Q || _) ? /* @__PURE__ */ x(G, {
|
|
393
|
-
extraCSSRules: p,
|
|
394
|
-
ref: (e) => {
|
|
395
|
-
let t = D.findDOMNode(e);
|
|
396
|
-
this.root = t || this.root;
|
|
397
|
-
},
|
|
398
|
-
children: /* @__PURE__ */ x(oe, {
|
|
399
|
-
interactive: !0,
|
|
400
|
-
enterTouchDelay: 0,
|
|
401
|
-
placement: "bottom-start",
|
|
402
|
-
slotProps: {
|
|
403
|
-
tooltip: { sx: (e) => ({
|
|
404
|
-
background: `${v.primaryLight()} !important`,
|
|
405
|
-
color: v.text(),
|
|
406
|
-
padding: e.spacing(2),
|
|
407
|
-
border: `1px solid ${v.secondary()}`,
|
|
408
|
-
fontSize: "16px",
|
|
409
|
-
"& :not(.MathJax) > table tr": { "&:nth-child(2n)": { backgroundColor: "unset !important" } }
|
|
410
|
-
}) },
|
|
411
|
-
popper: {
|
|
412
|
-
sx: { opacity: 1 },
|
|
413
|
-
modifiers: [{
|
|
414
|
-
name: "offset",
|
|
415
|
-
options: { offset: [0, 2] }
|
|
416
|
-
}]
|
|
417
|
-
}
|
|
418
|
-
},
|
|
419
|
-
title: /* @__PURE__ */ S("div", { children: [
|
|
420
|
-
/* @__PURE__ */ x(K, { children: W && /* @__PURE__ */ x(me, {
|
|
421
|
-
language: O,
|
|
422
|
-
show: !0,
|
|
423
|
-
toggled: a,
|
|
424
|
-
onToggle: this.toggleShowCorrect
|
|
425
|
-
}) }),
|
|
426
|
-
$ && /* @__PURE__ */ x(q, {
|
|
427
|
-
labels: {
|
|
428
|
-
hidden: "Show Teacher Instructions",
|
|
429
|
-
visible: "Hide Teacher Instructions"
|
|
430
|
-
},
|
|
431
|
-
children: /* @__PURE__ */ x(j, { prompt: h })
|
|
432
|
-
}, "collapsible-teacher-instructions"),
|
|
433
|
-
H && b(A) && /* @__PURE__ */ x(q, {
|
|
434
|
-
labels: {
|
|
435
|
-
hidden: I.t("common:showNote", { lng: O }),
|
|
436
|
-
visible: I.t("common:hideNote", { lng: O })
|
|
437
|
-
},
|
|
438
|
-
children: /* @__PURE__ */ x(j, { prompt: A })
|
|
439
|
-
}, "collapsible-note"),
|
|
440
|
-
Q && /* @__PURE__ */ x(q, {
|
|
441
|
-
labels: {
|
|
442
|
-
hidden: "Show Rationale",
|
|
443
|
-
visible: "Hide Rationale"
|
|
444
|
-
},
|
|
445
|
-
children: /* @__PURE__ */ x(j, { prompt: g })
|
|
446
|
-
}, "collapsible-rationale"),
|
|
447
|
-
_ && /* @__PURE__ */ x(te, {
|
|
448
|
-
correctness: d.correctness,
|
|
449
|
-
feedback: _
|
|
450
|
-
})
|
|
451
|
-
] }),
|
|
452
|
-
children: ve
|
|
453
|
-
})
|
|
454
|
-
}) : /* @__PURE__ */ x(G, {
|
|
455
|
-
id: z,
|
|
456
|
-
extraCSSRules: p,
|
|
457
|
-
ref: (e) => {
|
|
458
|
-
let t = D.findDOMNode(e);
|
|
459
|
-
this.root = t || this.root;
|
|
460
|
-
},
|
|
461
|
-
children: ve
|
|
462
|
-
});
|
|
463
|
-
}
|
|
464
|
-
}, W = () => ({
|
|
465
|
-
blockContainer: "block-container",
|
|
466
|
-
blockResponse: "block-response",
|
|
467
|
-
blockMath: "block-math"
|
|
468
|
-
});
|
|
469
|
-
if (typeof document < "u") {
|
|
470
|
-
let e = "math-inline-block-styles";
|
|
471
|
-
if (!document.getElementById(e)) {
|
|
472
|
-
let t = document.createElement("style");
|
|
473
|
-
t.id = e, t.textContent = `
|
|
474
|
-
.block-container {
|
|
475
|
-
margin: 8px !important;
|
|
476
|
-
display: inline-flex;
|
|
477
|
-
border: 2px solid grey !important;
|
|
478
|
-
}
|
|
479
|
-
.block-response {
|
|
480
|
-
color: grey;
|
|
481
|
-
background: #f5f5f5;
|
|
482
|
-
font-size: 0.8rem !important;
|
|
483
|
-
padding: 4px !important;
|
|
484
|
-
display: flex;
|
|
485
|
-
align-items: center;
|
|
486
|
-
justify-content: center;
|
|
487
|
-
border-right: 2px solid #bdbdbd !important;
|
|
488
|
-
flex-shrink: 0;
|
|
489
|
-
flex-grow: 0;
|
|
490
|
-
flex-basis: auto;
|
|
491
|
-
}
|
|
492
|
-
.block-math {
|
|
493
|
-
color: ${v.text()};
|
|
494
|
-
background-color: ${v.background()};
|
|
495
|
-
padding: 4px !important;
|
|
496
|
-
display: flex;
|
|
497
|
-
align-items: center;
|
|
498
|
-
justify-content: center;
|
|
499
|
-
flex-grow: 1;
|
|
500
|
-
}
|
|
501
|
-
.block-math > .mq-math-mode > .mq-hasCursor > .mq-cursor {
|
|
502
|
-
display: none;
|
|
503
|
-
}
|
|
504
|
-
.sr-only {
|
|
505
|
-
position: absolute;
|
|
506
|
-
left: -10000px;
|
|
507
|
-
top: auto;
|
|
508
|
-
width: 1px;
|
|
509
|
-
height: 1px;
|
|
510
|
-
overflow: hidden;
|
|
511
|
-
}
|
|
512
|
-
.static-math > .mq-root-block > .mq-editable-field {
|
|
513
|
-
border-color: ${v.text()};
|
|
514
|
-
}
|
|
515
|
-
`, document.head.appendChild(t);
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
var G = w(A)(() => ({
|
|
519
|
-
color: v.text(),
|
|
520
|
-
backgroundColor: v.background(),
|
|
521
|
-
display: "inline-block"
|
|
522
|
-
})), oe = w(T)({}), se = w("div")(({ theme: e }) => ({ marginBottom: e.spacing(2) })), K = w("div")({
|
|
523
|
-
width: "100%",
|
|
524
|
-
position: "relative",
|
|
525
|
-
backgroundColor: v.background(),
|
|
526
|
-
color: v.text()
|
|
527
|
-
}), ce = w("div")(({ theme: e }) => ({ paddingBottom: e.spacing(2) })), q = w(M)(({ theme: e }) => ({ marginBottom: e.spacing(2) })), le = w("div")(({ theme: e }) => ({
|
|
528
|
-
zIndex: 10,
|
|
529
|
-
minWidth: "400px",
|
|
530
|
-
marginTop: e.spacing(2)
|
|
531
|
-
})), ue = w("div", { shouldForwardProp: (e) => ![
|
|
532
|
-
"isIncorrect",
|
|
533
|
-
"isCorrect",
|
|
534
|
-
"showCorrectness",
|
|
535
|
-
"correctAnswerShown",
|
|
536
|
-
"printCorrect"
|
|
537
|
-
].includes(e) })(({ theme: e, isIncorrect: t, isCorrect: n, showCorrectness: r, correctAnswerShown: i, printCorrect: a }) => {
|
|
538
|
-
let o = t ? v.incorrect() : n ? v.correct() : void 0;
|
|
539
|
-
return {
|
|
540
|
-
maxWidth: "fit-content",
|
|
541
|
-
padding: e.spacing(.25),
|
|
542
|
-
...r && { border: o ? `2px solid ${o} !important` : "2px solid" },
|
|
543
|
-
...!r && o && { borderColor: `${o} !important` },
|
|
544
|
-
...i && {
|
|
545
|
-
padding: e.spacing(1),
|
|
546
|
-
letterSpacing: "0.5px"
|
|
547
|
-
},
|
|
548
|
-
...a && { border: `2px solid ${v.correct()} !important` },
|
|
549
|
-
"& .mq-math-mode": {
|
|
550
|
-
"& .mq-root-block": {
|
|
551
|
-
paddingRight: "0 !important",
|
|
552
|
-
paddingLeft: "0 !important",
|
|
553
|
-
"& .mq-editable-field": {
|
|
554
|
-
minWidth: "10px",
|
|
555
|
-
padding: e.spacing(.4)
|
|
556
|
-
}
|
|
557
|
-
},
|
|
558
|
-
"& sup": { top: 0 }
|
|
559
|
-
}
|
|
560
|
-
};
|
|
561
|
-
}), de = w("div")({
|
|
562
|
-
position: "relative",
|
|
563
|
-
"& .mq-overarrow-inner": {
|
|
564
|
-
border: "none !important",
|
|
565
|
-
padding: "0 !important"
|
|
566
|
-
},
|
|
567
|
-
"& .mq-overarrow-inner-right": { display: "none !important" },
|
|
568
|
-
"& .mq-overarrow-inner-left": { display: "none !important" },
|
|
569
|
-
"& .mq-overarrow.mq-arrow-both": {
|
|
570
|
-
minWidth: "1.23em",
|
|
571
|
-
"& *": { lineHeight: "1 !important" },
|
|
572
|
-
"&:before": {
|
|
573
|
-
top: "-0.4em",
|
|
574
|
-
left: "-1px"
|
|
575
|
-
},
|
|
576
|
-
"&:after": {
|
|
577
|
-
top: "-2.4em",
|
|
578
|
-
right: "-1px"
|
|
579
|
-
},
|
|
580
|
-
"&.mq-empty:after": { top: "-0.45em" }
|
|
581
|
-
},
|
|
582
|
-
"& .mq-overarrow.mq-arrow-right": { "&:before": {
|
|
583
|
-
top: "-0.4em",
|
|
584
|
-
right: "-1px"
|
|
585
|
-
} },
|
|
586
|
-
"& .mq-longdiv-inner": {
|
|
587
|
-
borderTop: "1px solid !important",
|
|
588
|
-
paddingTop: "1.5px !important"
|
|
589
|
-
},
|
|
590
|
-
"& .mq-parallelogram": { lineHeight: .85 }
|
|
591
|
-
}), fe = w("div")(({ theme: e }) => ({
|
|
592
|
-
marginBottom: e.spacing(1),
|
|
593
|
-
pointerEvents: "none"
|
|
594
|
-
})), pe = w("h2")({
|
|
595
|
-
position: "absolute",
|
|
596
|
-
left: "-10000px",
|
|
597
|
-
top: "auto",
|
|
598
|
-
width: "1px",
|
|
599
|
-
height: "1px",
|
|
600
|
-
overflow: "hidden"
|
|
601
|
-
}), me = w(o)(({ theme: e }) => ({
|
|
602
|
-
color: v.text(),
|
|
603
|
-
marginBottom: e.spacing(2)
|
|
604
|
-
}));
|
|
605
|
-
//#endregion
|
|
606
|
-
export { U as default };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/math-inline/src/simple-question-block.jsx
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
|
-
export declare class SimpleQuestionBlock extends React.Component {
|
|
12
|
-
static propTypes: {
|
|
13
|
-
onSimpleResponseChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
14
|
-
model: PropTypes.Validator<object>;
|
|
15
|
-
emptyResponse: PropTypes.Requireable<boolean>;
|
|
16
|
-
session: PropTypes.Validator<object>;
|
|
17
|
-
showCorrect: PropTypes.Requireable<boolean>;
|
|
18
|
-
onSubFieldFocus: PropTypes.Validator<(...args: any[]) => any>;
|
|
19
|
-
showKeypad: PropTypes.Validator<boolean>;
|
|
20
|
-
};
|
|
21
|
-
constructor(props: any);
|
|
22
|
-
mathToolBarContainsTarget: (e: any) => boolean;
|
|
23
|
-
handleClick: any;
|
|
24
|
-
onFocus: any;
|
|
25
|
-
render(): React.JSX.Element | undefined;
|
|
26
|
-
}
|
|
27
|
-
export default SimpleQuestionBlock;
|