@pie-element/math-templated 7.1.1-next.12 → 7.1.2
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 +1 -0
- package/CHANGELOG.md +1144 -0
- package/LICENSE.md +5 -0
- package/README.md +0 -0
- package/configure/CHANGELOG.json +1 -0
- package/configure/CHANGELOG.md +1021 -0
- package/configure/lib/defaults.js +172 -0
- package/configure/lib/defaults.js.map +1 -0
- package/configure/lib/design.js +546 -0
- package/configure/lib/design.js.map +1 -0
- package/configure/lib/index.js +169 -0
- package/configure/lib/index.js.map +1 -0
- package/configure/lib/markupUtils.js +39 -0
- package/configure/lib/markupUtils.js.map +1 -0
- package/configure/lib/response.js +394 -0
- package/configure/lib/response.js.map +1 -0
- package/configure/lib/utils.js +15 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +26 -0
- package/controller/CHANGELOG.json +1 -0
- package/controller/CHANGELOG.md +874 -0
- package/controller/lib/defaults.js +28 -0
- package/controller/lib/defaults.js.map +1 -0
- package/controller/lib/index.js +360 -0
- package/controller/lib/index.js.map +1 -0
- package/controller/package.json +17 -0
- package/docs/config-schema.json +2251 -0
- package/docs/config-schema.json.md +1658 -0
- package/docs/demo/config.js +8 -0
- package/docs/demo/generate.js +42 -0
- package/docs/demo/index.html +1 -0
- package/docs/demo/session.js +14 -0
- package/docs/pie-schema.json +1231 -0
- package/docs/pie-schema.json.md +894 -0
- package/lib/index.js +76 -0
- package/lib/index.js.map +1 -0
- package/lib/main.js +877 -0
- package/lib/main.js.map +1 -0
- package/lib/print.js +88 -0
- package/lib/print.js.map +1 -0
- package/module/configure.js +1 -0
- package/module/controller.js +3711 -0
- package/module/demo.js +67 -0
- package/module/element.js +1 -0
- package/module/index.html +21 -0
- package/module/manifest.json +22 -0
- package/module/print-demo.js +105 -0
- package/module/print.html +18 -0
- package/module/print.js +1 -0
- package/package.json +22 -93
- package/configure.js +0 -2
- package/controller.js +0 -1
- package/dist/author/defaults.d.ts +0 -173
- package/dist/author/defaults.js +0 -123
- package/dist/author/design.d.ts +0 -35
- package/dist/author/design.js +0 -360
- package/dist/author/index.d.ts +0 -42
- package/dist/author/index.js +0 -97
- package/dist/author/markupUtils.d.ts +0 -11
- package/dist/author/markupUtils.js +0 -10
- package/dist/author/response.d.ts +0 -41
- package/dist/author/response.js +0 -238
- package/dist/author/utils.d.ts +0 -9
- package/dist/author/utils.js +0 -7
- package/dist/browser/author/index.js +0 -31954
- package/dist/browser/author/index.js.map +0 -1
- package/dist/browser/browser-DJA4OL8j.js +0 -331
- package/dist/browser/browser-DJA4OL8j.js.map +0 -1
- package/dist/browser/controller/index.js +0 -37731
- package/dist/browser/controller/index.js.map +0 -1
- package/dist/browser/delivery/index.js +0 -81
- package/dist/browser/delivery/index.js.map +0 -1
- package/dist/browser/dist-Csid0rBE.js +0 -17046
- package/dist/browser/dist-Csid0rBE.js.map +0 -1
- package/dist/browser/dist-D9ARZhQk.js +0 -1426
- package/dist/browser/dist-D9ARZhQk.js.map +0 -1
- package/dist/browser/main-I_wWeaur.js +0 -1274
- package/dist/browser/main-I_wWeaur.js.map +0 -1
- package/dist/browser/math-templated.css +0 -2
- package/dist/browser/print/index.js +0 -47
- package/dist/browser/print/index.js.map +0 -1
- package/dist/controller/defaults.d.ts +0 -29
- package/dist/controller/defaults.js +0 -23
- package/dist/controller/index.d.ts +0 -45
- package/dist/controller/index.js +0 -154
- package/dist/delivery/index.d.ts +0 -20
- package/dist/delivery/index.js +0 -51
- package/dist/delivery/main.d.ts +0 -40
- package/dist/delivery/main.js +0 -492
- package/dist/index.d.ts +0 -1
- package/dist/index.iife.d.ts +0 -8
- package/dist/index.iife.js +0 -205
- package/dist/index.js +0 -2
- package/dist/math-templated.css +0 -2
- package/dist/print/index.d.ts +0 -15
- package/dist/print/index.js +0 -47
- package/dist/runtime-support.d.ts +0 -12
- package/dist/runtime-support.js +0 -12
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/math-templated/configure/src/response.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 * as React from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
|
-
export declare class Response extends React.Component {
|
|
12
|
-
static propTypes: {
|
|
13
|
-
defaultResponse: PropTypes.Requireable<boolean>;
|
|
14
|
-
error: PropTypes.Requireable<object>;
|
|
15
|
-
mode: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
16
|
-
onResponseChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
17
|
-
onResponseDone: PropTypes.Validator<(...args: any[]) => any>;
|
|
18
|
-
response: PropTypes.Validator<object>;
|
|
19
|
-
cIgnoreOrder: PropTypes.Validator<object>;
|
|
20
|
-
cAllowTrailingZeros: PropTypes.Validator<object>;
|
|
21
|
-
responseKey: PropTypes.Validator<number>;
|
|
22
|
-
};
|
|
23
|
-
static defaultProps: {
|
|
24
|
-
defaultResponse: boolean;
|
|
25
|
-
mode: string;
|
|
26
|
-
};
|
|
27
|
-
constructor(props: any);
|
|
28
|
-
onChange: (name: any) => (evt: any) => void;
|
|
29
|
-
onConfigChanged: (name: any) => (evt: any) => void;
|
|
30
|
-
onLiteralOptionsChange: (name: any) => () => void;
|
|
31
|
-
onAnswerChange: any;
|
|
32
|
-
onAlternateAnswerChange: (alternateId: any) => (answer: any) => void;
|
|
33
|
-
onAddAlternate: any;
|
|
34
|
-
onRemoveAlternate: (alternateId: any) => () => void;
|
|
35
|
-
onDone: any;
|
|
36
|
-
onFocus: any;
|
|
37
|
-
onAlternateFocus: (alternateId: any) => () => void;
|
|
38
|
-
onAlternateDone: (alternateId: any) => () => void;
|
|
39
|
-
render(): React.JSX.Element;
|
|
40
|
-
}
|
|
41
|
-
export default Response;
|
package/dist/author/response.js
DELETED
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
import * as e from "react";
|
|
2
|
-
import t from "prop-types";
|
|
3
|
-
import { styled as n } from "@mui/material/styles";
|
|
4
|
-
import { color as r } from "@pie-lib/render-ui";
|
|
5
|
-
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
|
-
import o from "@mui/material/Typography";
|
|
7
|
-
import s from "@mui/material/Select";
|
|
8
|
-
import c from "@mui/material/MenuItem";
|
|
9
|
-
import { InputContainer as l } from "@pie-lib/config-ui";
|
|
10
|
-
import { MathToolbar as u } from "@pie-lib/math-toolbar";
|
|
11
|
-
import d from "@mui/material/Card";
|
|
12
|
-
import f from "@mui/material/CardContent";
|
|
13
|
-
import p from "@mui/material/Button";
|
|
14
|
-
import m from "@mui/material/FormControlLabel";
|
|
15
|
-
import h from "@mui/material/InputLabel";
|
|
16
|
-
import g from "@mui/material/Checkbox";
|
|
17
|
-
import _ from "@mui/material/IconButton";
|
|
18
|
-
import v from "@mui/icons-material/Delete";
|
|
19
|
-
//#region src/author/response.tsx
|
|
20
|
-
var y = n(d)(({ theme: e }) => ({
|
|
21
|
-
marginBottom: e.spacing(2.5),
|
|
22
|
-
width: "100%",
|
|
23
|
-
minWidth: "548px",
|
|
24
|
-
border: `1px solid ${e.palette.grey[700]}`,
|
|
25
|
-
display: "flex",
|
|
26
|
-
flexDirection: "column",
|
|
27
|
-
justifyContent: "space-between"
|
|
28
|
-
})), b = n(f)(({ theme: e }) => ({ paddingBottom: `${e.spacing(2)} !important` })), x = n(o)({
|
|
29
|
-
fontWeight: 700,
|
|
30
|
-
fontSize: "1.2rem",
|
|
31
|
-
flex: 3
|
|
32
|
-
}), S = n(l)(({ theme: e }) => ({
|
|
33
|
-
flex: 2,
|
|
34
|
-
"& > *:not(label)": { marginTop: e.spacing(1) }
|
|
35
|
-
})), C = n("div")(({ theme: e }) => ({ marginBottom: e.spacing(2) })), w = n("div")({
|
|
36
|
-
display: "flex",
|
|
37
|
-
alignItems: "center",
|
|
38
|
-
justifyContent: "space-between"
|
|
39
|
-
}), T = n("div")({ display: "flex" }), E = n(p)(({ theme: e }) => ({
|
|
40
|
-
border: `1px solid ${e.palette.grey.A400}`,
|
|
41
|
-
color: r.text()
|
|
42
|
-
})), D = n(_)(({ theme: e }) => ({ marginLeft: e.spacing(1) })), O = n("div")(({ theme: e }) => ({
|
|
43
|
-
fontSize: e.typography.fontSize - 2,
|
|
44
|
-
color: e.palette.error.main,
|
|
45
|
-
paddingTop: e.spacing(1)
|
|
46
|
-
})), k = n("div")(({ theme: e }) => ({
|
|
47
|
-
background: e.palette.grey.A100,
|
|
48
|
-
color: e.palette.grey.A700,
|
|
49
|
-
display: "inline",
|
|
50
|
-
minWidth: "50px",
|
|
51
|
-
padding: "8px",
|
|
52
|
-
border: "1px solid #C0C3CF"
|
|
53
|
-
})), A = n("div")({
|
|
54
|
-
display: "flex",
|
|
55
|
-
justifyContent: "space-between",
|
|
56
|
-
alignItems: "center"
|
|
57
|
-
}), j = n(g)({ color: `${r.tertiary()} !important` });
|
|
58
|
-
if (typeof document < "u") {
|
|
59
|
-
let e = "math-templated-response-styles";
|
|
60
|
-
if (!document.getElementById(e)) {
|
|
61
|
-
let t = document.createElement("style");
|
|
62
|
-
t.id = e, t.textContent = "\n .response-editor {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n min-width: 500px;\n max-width: 900px;\n height: auto;\n min-height: 40px;\n }\n .math-toolbar {\n width: 100%;\n }\n ", document.head.appendChild(t);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
var M = class extends e.Component {
|
|
66
|
-
static propTypes = {
|
|
67
|
-
defaultResponse: t.bool,
|
|
68
|
-
error: t.object,
|
|
69
|
-
mode: t.oneOfType([t.string, t.number]),
|
|
70
|
-
onResponseChange: t.func.isRequired,
|
|
71
|
-
onResponseDone: t.func.isRequired,
|
|
72
|
-
response: t.object.isRequired,
|
|
73
|
-
cIgnoreOrder: t.object.isRequired,
|
|
74
|
-
cAllowTrailingZeros: t.object.isRequired,
|
|
75
|
-
responseKey: t.number.isRequired
|
|
76
|
-
};
|
|
77
|
-
static defaultProps = {
|
|
78
|
-
defaultResponse: !1,
|
|
79
|
-
mode: "8"
|
|
80
|
-
};
|
|
81
|
-
constructor(e) {
|
|
82
|
-
super(e);
|
|
83
|
-
let { response: { alternates: t } = {} } = e || {}, n = Object.keys(t || {}).length;
|
|
84
|
-
this.state = {
|
|
85
|
-
alternateIdCounter: n + 1,
|
|
86
|
-
showKeypad: {
|
|
87
|
-
openCount: 0,
|
|
88
|
-
main: !1
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
onChange = (e) => (t) => {
|
|
93
|
-
let { response: n, onResponseChange: r, responseKey: i } = this.props, a = { ...n };
|
|
94
|
-
a[e] = t.target.value, r(a, i);
|
|
95
|
-
};
|
|
96
|
-
onConfigChanged = (e) => (t) => {
|
|
97
|
-
let { response: n, onResponseChange: r, responseKey: i } = this.props, a = { ...n };
|
|
98
|
-
a[e] = t.target.checked, r(a, i);
|
|
99
|
-
};
|
|
100
|
-
onLiteralOptionsChange = (e) => () => {
|
|
101
|
-
let { response: t, onResponseChange: n, responseKey: r } = this.props, i = { ...t };
|
|
102
|
-
i[e] = !t[e], n(i, r);
|
|
103
|
-
};
|
|
104
|
-
onAnswerChange = (e) => {
|
|
105
|
-
let { response: t, onResponseChange: n, responseKey: r } = this.props, i = { ...t };
|
|
106
|
-
i.answer = e, n(i, r);
|
|
107
|
-
};
|
|
108
|
-
onAlternateAnswerChange = (e) => (t) => {
|
|
109
|
-
let { response: n, onResponseChange: r, responseKey: i } = this.props, a = { ...n };
|
|
110
|
-
a.alternates[e] = t, r(a, i);
|
|
111
|
-
};
|
|
112
|
-
onAddAlternate = () => {
|
|
113
|
-
let { response: e, onResponseChange: t, responseKey: n } = this.props, { alternateIdCounter: r } = this.state, i = { ...e };
|
|
114
|
-
i.alternates ||= {}, i.alternates[r] = "", t(i, n), this.setState({ alternateIdCounter: r + 1 });
|
|
115
|
-
};
|
|
116
|
-
onRemoveAlternate = (e) => () => {
|
|
117
|
-
let { response: t, onResponseChange: n, responseKey: r } = this.props, i = { ...t };
|
|
118
|
-
delete i.alternates[e], n(i, r), this.setState((t) => ({ showKeypad: {
|
|
119
|
-
...t.showKeypad,
|
|
120
|
-
openCount: t.showKeypad[e] ? t.showKeypad.openCount - 1 : t.showKeypad.openCount
|
|
121
|
-
} }));
|
|
122
|
-
};
|
|
123
|
-
onDone = () => {
|
|
124
|
-
let { onResponseDone: e } = this.props;
|
|
125
|
-
this.setState((e) => ({ showKeypad: {
|
|
126
|
-
...e.showKeypad,
|
|
127
|
-
openCount: e.showKeypad.openCount - 1,
|
|
128
|
-
main: !1
|
|
129
|
-
} })), e();
|
|
130
|
-
};
|
|
131
|
-
onFocus = () => {
|
|
132
|
-
this.setState((e) => ({ showKeypad: {
|
|
133
|
-
...e.showKeypad,
|
|
134
|
-
openCount: e.showKeypad.main ? e.showKeypad.openCount : e.showKeypad.openCount + 1,
|
|
135
|
-
main: !0
|
|
136
|
-
} }));
|
|
137
|
-
};
|
|
138
|
-
onAlternateFocus = (e) => () => {
|
|
139
|
-
this.setState((t) => ({ showKeypad: {
|
|
140
|
-
...t.showKeypad,
|
|
141
|
-
openCount: t.showKeypad[e] ? t.showKeypad.openCount : t.showKeypad.openCount + 1,
|
|
142
|
-
[e]: !0
|
|
143
|
-
} }));
|
|
144
|
-
};
|
|
145
|
-
onAlternateDone = (e) => () => {
|
|
146
|
-
this.setState((t) => ({ showKeypad: {
|
|
147
|
-
...t.showKeypad,
|
|
148
|
-
openCount: t.showKeypad.openCount - 1,
|
|
149
|
-
[e]: !1
|
|
150
|
-
} }));
|
|
151
|
-
};
|
|
152
|
-
render() {
|
|
153
|
-
let { mode: e, responseKey: t, response: n, cAllowTrailingZeros: r, cIgnoreOrder: o, error: l } = this.props, { showKeypad: d } = this.state, { validation: f, answer: p, alternates: g, ignoreOrder: _, allowTrailingZeros: M } = n, N = Object.keys(g || {}).length > 0, P = {
|
|
154
|
-
editor: "response-editor",
|
|
155
|
-
mathToolbar: "math-toolbar"
|
|
156
|
-
};
|
|
157
|
-
return /* @__PURE__ */ i(y, {
|
|
158
|
-
style: { minHeight: `${d.openCount > 0 ? 430 : 230}px` },
|
|
159
|
-
children: /* @__PURE__ */ a(b, { children: [
|
|
160
|
-
/* @__PURE__ */ a(w, { children: [/* @__PURE__ */ a(x, {
|
|
161
|
-
component: "div",
|
|
162
|
-
children: ["Response for ", /* @__PURE__ */ i(k, { children: `R ${parseInt(t) + 1}` })]
|
|
163
|
-
}), /* @__PURE__ */ i(S, {
|
|
164
|
-
label: "Validation",
|
|
165
|
-
children: /* @__PURE__ */ a(s, {
|
|
166
|
-
onChange: this.onChange("validation"),
|
|
167
|
-
value: f || "literal",
|
|
168
|
-
MenuProps: { transitionDuration: {
|
|
169
|
-
enter: 225,
|
|
170
|
-
exit: 195
|
|
171
|
-
} },
|
|
172
|
-
children: [/* @__PURE__ */ i(c, {
|
|
173
|
-
value: "literal",
|
|
174
|
-
children: "Literal Validation"
|
|
175
|
-
}), /* @__PURE__ */ i(c, {
|
|
176
|
-
value: "symbolic",
|
|
177
|
-
children: "Symbolic Validation"
|
|
178
|
-
})]
|
|
179
|
-
})
|
|
180
|
-
})] }),
|
|
181
|
-
f === "literal" && /* @__PURE__ */ a(T, { children: [r.enabled && /* @__PURE__ */ i(m, {
|
|
182
|
-
label: r.label,
|
|
183
|
-
control: /* @__PURE__ */ i(j, {
|
|
184
|
-
checked: M,
|
|
185
|
-
onChange: this.onLiteralOptionsChange("allowTrailingZeros")
|
|
186
|
-
})
|
|
187
|
-
}), o.enabled && /* @__PURE__ */ i(m, {
|
|
188
|
-
label: o.label,
|
|
189
|
-
control: /* @__PURE__ */ i(j, {
|
|
190
|
-
checked: _,
|
|
191
|
-
onChange: this.onLiteralOptionsChange("ignoreOrder")
|
|
192
|
-
})
|
|
193
|
-
})] }),
|
|
194
|
-
/* @__PURE__ */ a(C, { children: [
|
|
195
|
-
/* @__PURE__ */ i(h, { children: "Correct Answer" }),
|
|
196
|
-
/* @__PURE__ */ i(u, {
|
|
197
|
-
keypadMode: e,
|
|
198
|
-
classNames: P,
|
|
199
|
-
controlledKeypad: !0,
|
|
200
|
-
showKeypad: d.main,
|
|
201
|
-
latex: p || "",
|
|
202
|
-
onChange: this.onAnswerChange,
|
|
203
|
-
onFocus: this.onFocus,
|
|
204
|
-
onDone: this.onDone,
|
|
205
|
-
error: l && l.answer
|
|
206
|
-
}),
|
|
207
|
-
l && l.answer ? /* @__PURE__ */ i(O, { children: l.answer }) : null
|
|
208
|
-
] }),
|
|
209
|
-
N && Object.keys(g).map((t, n) => /* @__PURE__ */ a(C, { children: [
|
|
210
|
-
/* @__PURE__ */ a(h, { children: ["Alternate", Object.keys(g).length > 1 ? ` ${n + 1}` : ""] }),
|
|
211
|
-
/* @__PURE__ */ a(A, { children: [/* @__PURE__ */ i(u, {
|
|
212
|
-
classNames: P,
|
|
213
|
-
controlledKeypad: !0,
|
|
214
|
-
keypadMode: e,
|
|
215
|
-
showKeypad: d[t] || !1,
|
|
216
|
-
latex: g[t] || "",
|
|
217
|
-
onChange: this.onAlternateAnswerChange(t),
|
|
218
|
-
onFocus: this.onAlternateFocus(t),
|
|
219
|
-
onDone: this.onAlternateDone(t),
|
|
220
|
-
error: l && l[t]
|
|
221
|
-
}), /* @__PURE__ */ i(D, {
|
|
222
|
-
onClick: this.onRemoveAlternate(t),
|
|
223
|
-
size: "large",
|
|
224
|
-
children: /* @__PURE__ */ i(v, {})
|
|
225
|
-
})] }),
|
|
226
|
-
l && l[t] ? /* @__PURE__ */ i(O, { children: l[t] }) : null
|
|
227
|
-
] }, t)),
|
|
228
|
-
/* @__PURE__ */ i(E, {
|
|
229
|
-
type: "primary",
|
|
230
|
-
onClick: this.onAddAlternate,
|
|
231
|
-
children: "ADD ALTERNATE"
|
|
232
|
-
})
|
|
233
|
-
] })
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
//#endregion
|
|
238
|
-
export { M as default };
|
package/dist/author/utils.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/math-templated/configure/src/utils.js
|
|
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
|
-
export declare const generateValidationMessage: (config: any) => string;
|
package/dist/author/utils.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
//#region src/author/utils.ts
|
|
2
|
-
var e = (e) => {
|
|
3
|
-
let { maxResponseAreas: t } = e;
|
|
4
|
-
return "Validation requirements:" + ("\nCorrect answers should not be blank.\nEach answer defined for a response area should be unique.\nThere should be at least 1 " + (t ? `and at most ${t} ` : "") + "response area" + (t ? "s" : "") + " defined.");
|
|
5
|
-
};
|
|
6
|
-
//#endregion
|
|
7
|
-
export { e as generateValidationMessage };
|