@pie-element/math-templated 8.0.4-next.20261011174919 → 8.0.4
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/author/defaults.d.ts +56 -54
- package/dist/author/design.d.ts +41 -22
- package/dist/author/design.js +93 -106
- package/dist/author/index.d.ts +18 -28
- package/dist/author/index.js +15 -5
- package/dist/author/utils.d.ts +2 -1
- package/dist/browser/author/index.js +24 -29
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/controller/index.js +15 -12
- package/dist/browser/controller/index.js.map +1 -1
- package/dist/browser/editor-runtime/author/index.js +24 -29
- package/dist/browser/editor-runtime/author/index.js.map +1 -1
- package/dist/browser/editor-runtime/controller/index.js +15 -12
- package/dist/browser/editor-runtime/controller/index.js.map +1 -1
- package/dist/controller/defaults.d.ts +12 -11
- package/dist/controller/index.d.ts +72 -21
- package/dist/controller/index.js +15 -12
- package/dist/index.d.ts +1 -0
- package/dist/schemas/configuration.schema.json +382 -0
- package/dist/schemas/model.schema.json +474 -0
- package/dist/schemas/session.schema.json +36 -0
- package/dist/types.d.ts +177 -0
- package/package.json +22 -18
package/dist/author/design.js
CHANGED
|
@@ -2,72 +2,60 @@ import { Response as e } from "./response.js";
|
|
|
2
2
|
import { createSlateMarkup as t, processMarkup as n } from "./markupUtils.js";
|
|
3
3
|
import { generateValidationMessage as r } from "./utils.js";
|
|
4
4
|
import i from "react";
|
|
5
|
-
import a from "
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import u from "
|
|
9
|
-
import
|
|
10
|
-
import p from "@mui/material/
|
|
11
|
-
import m from "@mui/material/
|
|
12
|
-
import h from "@mui/material/
|
|
13
|
-
import g from "@
|
|
14
|
-
import
|
|
15
|
-
import y, { ALL_PLUGINS as b } from "@pie-lib/editable-html-tip-tap";
|
|
5
|
+
import { cloneDeep as a, pick as o, throttle as s } from "@pie-element/shared-lodash";
|
|
6
|
+
import { styled as c } from "@mui/material/styles";
|
|
7
|
+
import l from "@mui/material/Tooltip";
|
|
8
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
9
|
+
import f from "@mui/material/Typography";
|
|
10
|
+
import p from "@mui/material/Select";
|
|
11
|
+
import m from "@mui/material/MenuItem";
|
|
12
|
+
import h from "@mui/icons-material/Info";
|
|
13
|
+
import { InputContainer as g, layout as ee, settings as _ } from "@pie-lib/config-ui";
|
|
14
|
+
import v, { ALL_PLUGINS as y } from "@pie-lib/editable-html-tip-tap";
|
|
16
15
|
//#region src/author/design.tsx
|
|
17
|
-
var { dropdown: te } =
|
|
16
|
+
var { dropdown: te } = _, { Panel: ne, toggle: b } = _, x = c(g)(({ theme: e }) => ({
|
|
18
17
|
width: "100%",
|
|
19
18
|
paddingTop: e.spacing(2),
|
|
20
19
|
marginBottom: e.spacing(2)
|
|
21
|
-
})),
|
|
20
|
+
})), S = c(v)({ width: "100%" }), C = c("div")(({ theme: e }) => ({
|
|
22
21
|
color: e.palette.error.main,
|
|
23
22
|
fontSize: "0.75rem",
|
|
24
23
|
marginTop: e.spacing(1)
|
|
25
|
-
})),
|
|
24
|
+
})), re = c("div")(({ theme: e }) => ({
|
|
26
25
|
color: e.palette.error.main,
|
|
27
26
|
fontSize: "0.75rem",
|
|
28
27
|
marginBottom: e.spacing(1)
|
|
29
|
-
})),
|
|
28
|
+
})), w = c(v)(({ theme: e }) => ({
|
|
30
29
|
width: "100%",
|
|
31
30
|
marginTop: e.spacing(2),
|
|
32
31
|
marginBottom: e.spacing(3)
|
|
33
|
-
})), ie =
|
|
32
|
+
})), ie = c(g)(({ theme: e }) => ({
|
|
34
33
|
width: "100%",
|
|
35
34
|
marginTop: e.spacing(2),
|
|
36
35
|
"& > *:not(label)": { marginTop: e.spacing(1) },
|
|
37
36
|
marginBottom: e.spacing(2)
|
|
38
|
-
})), ae =
|
|
37
|
+
})), ae = c(p)({ width: "100%" }), T = c(f)(({ theme: e }) => ({
|
|
39
38
|
fontSize: e.typography.fontSize * 1.25,
|
|
40
39
|
fontWeight: "bold"
|
|
41
|
-
})),
|
|
40
|
+
})), oe = c("div")({
|
|
42
41
|
display: "flex",
|
|
43
42
|
alignItems: "center",
|
|
44
43
|
gap: "8px"
|
|
45
|
-
}),
|
|
44
|
+
}), se = c(l)(({ theme: e }) => ({ "& .MuiTooltip-tooltip": {
|
|
46
45
|
fontSize: e.typography.fontSize - 2,
|
|
47
46
|
whiteSpace: "pre",
|
|
48
47
|
maxWidth: "500px"
|
|
49
|
-
} })),
|
|
48
|
+
} })), E = (e) => {
|
|
50
49
|
let t = document.createElement("div");
|
|
51
50
|
return t.innerHTML = e.trim(), t;
|
|
52
|
-
},
|
|
53
|
-
static propTypes = {
|
|
54
|
-
model: a.object.isRequired,
|
|
55
|
-
configuration: a.object.isRequired,
|
|
56
|
-
onModelChanged: a.func.isRequired,
|
|
57
|
-
onConfigurationChanged: a.func.isRequired,
|
|
58
|
-
imageSupport: a.shape({
|
|
59
|
-
add: a.func.isRequired,
|
|
60
|
-
delete: a.func.isRequired
|
|
61
|
-
}),
|
|
62
|
-
uploadSoundSupport: a.object
|
|
63
|
-
};
|
|
51
|
+
}, D = class extends i.Component {
|
|
64
52
|
state = {};
|
|
65
53
|
componentDidMount() {
|
|
66
54
|
let { model: { slateMarkup: e } } = this.props;
|
|
67
55
|
this.setState({ markup: e });
|
|
68
56
|
}
|
|
69
57
|
handleChange = (e, t) => {
|
|
70
|
-
let { onModelChanged: n, model: r } = this.props, i =
|
|
58
|
+
let { onModelChanged: n, model: r } = this.props, i = a(r);
|
|
71
59
|
i[e] = t, n(i);
|
|
72
60
|
};
|
|
73
61
|
onResponseChange = (e, t) => {
|
|
@@ -82,7 +70,7 @@ var { dropdown: te } = v, { Panel: ne, toggle: x } = v, S = l(_)(({ theme: e })
|
|
|
82
70
|
});
|
|
83
71
|
};
|
|
84
72
|
onChangeResponse = (e, t) => {
|
|
85
|
-
let { model: n, onModelChanged: r } = this.props,
|
|
73
|
+
let { model: n, onModelChanged: r } = this.props, i = n.responses;
|
|
86
74
|
i[e] ? i[e][0].answer = t || "" : i[e] = [{
|
|
87
75
|
answer: t || "",
|
|
88
76
|
id: "response" + e,
|
|
@@ -99,7 +87,7 @@ var { dropdown: te } = v, { Panel: ne, toggle: x } = v, S = l(_)(({ theme: e })
|
|
|
99
87
|
});
|
|
100
88
|
};
|
|
101
89
|
onChange = (e) => {
|
|
102
|
-
let { model: { responses: t, validationDefault: r, allowTrailingZerosDefault: i, ignoreOrderDefault: a }, onModelChanged: o } = this.props, s = {}, c =
|
|
90
|
+
let { model: { responses: t, validationDefault: r, allowTrailingZerosDefault: i, ignoreOrderDefault: a }, onModelChanged: o } = this.props, s = {}, c = E(e);
|
|
103
91
|
c.querySelectorAll("[data-type=\"math_templated\"]").forEach((e, n) => {
|
|
104
92
|
let { value: o, index: c } = e.dataset;
|
|
105
93
|
o || (e.dataset.value = ""), s[n] = t[c] || {
|
|
@@ -119,14 +107,14 @@ var { dropdown: te } = v, { Panel: ne, toggle: x } = v, S = l(_)(({ theme: e })
|
|
|
119
107
|
markup: l
|
|
120
108
|
}));
|
|
121
109
|
};
|
|
122
|
-
onHandleAreaChange =
|
|
110
|
+
onHandleAreaChange = s((e) => {
|
|
123
111
|
let { model: { responses: t }, onModelChanged: n } = this.props, { cachedResponses: r } = this.state;
|
|
124
112
|
if (!e) return;
|
|
125
|
-
let i = t ?
|
|
113
|
+
let i = t ? a(t) : {}, s = r ? a(r) : {};
|
|
126
114
|
e.forEach((e) => {
|
|
127
115
|
let t = e.index;
|
|
128
|
-
!i[t] &&
|
|
129
|
-
}), this.setState({ cachedResponses:
|
|
116
|
+
!i[t] && s[t] ? (Object.assign(i, o(s, t)), Object.prototype.hasOwnProperty.call(s, t) && delete s[t]) : (Object.assign(s, o(i, t)), Object.prototype.hasOwnProperty.call(i, t) && delete i[t]);
|
|
117
|
+
}), this.setState({ cachedResponses: s }, () => n({
|
|
130
118
|
...this.props.model,
|
|
131
119
|
responses: i
|
|
132
120
|
}));
|
|
@@ -144,32 +132,32 @@ var { dropdown: te } = v, { Panel: ne, toggle: x } = v, S = l(_)(({ theme: e })
|
|
|
144
132
|
function i(e, t = 0) {
|
|
145
133
|
if (!e || t >= 4) return null;
|
|
146
134
|
let n = e?.children?.[0];
|
|
147
|
-
return n ? n.attributes && n.attributes
|
|
135
|
+
return n ? n.attributes && n.attributes.getNamedItem("data-keypad") ? n : i(n, t + 1) : null;
|
|
148
136
|
}
|
|
149
137
|
let a = r(t), o = a ? i(a) : null;
|
|
150
|
-
(!t || !n || !o?.attributes
|
|
138
|
+
(!t || !n || !o?.attributes.getNamedItem("data-keypad")) && this.setState({ activeAnswerBlock: "" });
|
|
151
139
|
};
|
|
152
140
|
render() {
|
|
153
|
-
let { configuration: t, imageSupport: n, model: i, onConfigurationChanged: a, onModelChanged: o, uploadSoundSupport: s } = this.props, { baseInputConfiguration: c = {}, contentDimensions: l = {}, prompt:
|
|
154
|
-
"language.enabled": v.settings &&
|
|
155
|
-
language: v.settings && v.enabled && te(
|
|
141
|
+
let { configuration: t, imageSupport: n, model: i, onConfigurationChanged: a, onModelChanged: o, uploadSoundSupport: s } = this.props, { baseInputConfiguration: c = {}, contentDimensions: l = {}, prompt: f = {}, rationale: p = {}, settingsPanelDisabled: g, teacherInstructions: _ = {}, language: v = {}, languageChoices: E = {}, spellCheck: D = {}, playerSpellCheck: O = {}, maxImageWidth: k = {}, maxImageHeight: A = {}, mathMlOptions: j = {}, template: M = {}, editSource: N = {}, ignoreOrder: P = {}, allowTrailingZeros: F = {}, partialScoring: I = {}, maxResponseAreas: L } = t || {}, { errors: R, extraCSSRules: z, promptEnabled: B, rationaleEnabled: V, spellCheckEnabled: H, teacherInstructionsEnabled: ce, toolbarEditorPosition: le, responses: U, equationEditor: W } = i || {}, { prompt: G, rationale: K, responseAreas: q, teacherInstructions: J, responses: Y = {} } = R || {}, ue = r(t), de = {
|
|
142
|
+
"language.enabled": v.settings && b(v.label, !0),
|
|
143
|
+
language: v.settings && v.enabled && te(E.label, E.options)
|
|
156
144
|
}, fe = {
|
|
157
|
-
teacherInstructionsEnabled: _.settings &&
|
|
158
|
-
rationaleEnabled: p.settings &&
|
|
159
|
-
promptEnabled:
|
|
160
|
-
spellCheckEnabled:
|
|
161
|
-
playerSpellCheckEnabled:
|
|
162
|
-
"editSource.enabled": N?.settings &&
|
|
163
|
-
partialScoring:
|
|
164
|
-
}, X =
|
|
145
|
+
teacherInstructionsEnabled: _.settings && b(_.label),
|
|
146
|
+
rationaleEnabled: p.settings && b(p.label),
|
|
147
|
+
promptEnabled: f.settings && b(f.label),
|
|
148
|
+
spellCheckEnabled: D.settings && b(D.label),
|
|
149
|
+
playerSpellCheckEnabled: O.settings && b(O.label),
|
|
150
|
+
"editSource.enabled": N?.settings && b(N.label, !0),
|
|
151
|
+
partialScoring: I.settings && b(I.label)
|
|
152
|
+
}, X = k && k.prompt, Z = A && A.prompt, Q = { position: le === "top" ? "top" : "bottom" }, $ = (e = {}, t = {}) => ({
|
|
165
153
|
...t,
|
|
166
154
|
...e
|
|
167
155
|
});
|
|
168
|
-
return /* @__PURE__ */
|
|
169
|
-
extraCSSRules:
|
|
156
|
+
return /* @__PURE__ */ d(ee.ConfigLayout, {
|
|
157
|
+
extraCSSRules: z,
|
|
170
158
|
dimensions: l,
|
|
171
|
-
hideSettings:
|
|
172
|
-
settings: /* @__PURE__ */
|
|
159
|
+
hideSettings: g,
|
|
160
|
+
settings: /* @__PURE__ */ u(ne, {
|
|
173
161
|
model: i,
|
|
174
162
|
configuration: t,
|
|
175
163
|
onChangeModel: (e) => o(e),
|
|
@@ -180,9 +168,9 @@ var { dropdown: te } = v, { Panel: ne, toggle: x } = v, S = l(_)(({ theme: e })
|
|
|
180
168
|
}
|
|
181
169
|
}),
|
|
182
170
|
children: [
|
|
183
|
-
|
|
171
|
+
ce && /* @__PURE__ */ d(x, {
|
|
184
172
|
label: _.label,
|
|
185
|
-
children: [/* @__PURE__ */
|
|
173
|
+
children: [/* @__PURE__ */ u(S, {
|
|
186
174
|
markup: i.teacherInstructions || "",
|
|
187
175
|
onChange: (e) => this.handleChange("teacherInstructions", e),
|
|
188
176
|
imageSupport: n,
|
|
@@ -190,17 +178,17 @@ var { dropdown: te } = v, { Panel: ne, toggle: x } = v, S = l(_)(({ theme: e })
|
|
|
190
178
|
error: J,
|
|
191
179
|
toolbarOpts: Q,
|
|
192
180
|
pluginProps: $(_?.inputConfiguration, c),
|
|
193
|
-
spellCheck:
|
|
194
|
-
maxImageWidth:
|
|
195
|
-
maxImageHeight:
|
|
181
|
+
spellCheck: H,
|
|
182
|
+
maxImageWidth: k && k.teacherInstructions || X,
|
|
183
|
+
maxImageHeight: A && A.teacherInstructions || Z,
|
|
196
184
|
uploadSoundSupport: s,
|
|
197
185
|
languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
|
|
198
|
-
mathMlOptions:
|
|
199
|
-
}), J && /* @__PURE__ */
|
|
186
|
+
mathMlOptions: j
|
|
187
|
+
}), J && /* @__PURE__ */ u(C, { children: J })]
|
|
200
188
|
}),
|
|
201
|
-
|
|
202
|
-
label:
|
|
203
|
-
children: [/* @__PURE__ */
|
|
189
|
+
B && /* @__PURE__ */ d(x, {
|
|
190
|
+
label: f.label,
|
|
191
|
+
children: [/* @__PURE__ */ u(S, {
|
|
204
192
|
markup: i.prompt,
|
|
205
193
|
onChange: (e) => this.handleChange("prompt", e),
|
|
206
194
|
imageSupport: n,
|
|
@@ -209,38 +197,38 @@ var { dropdown: te } = v, { Panel: ne, toggle: x } = v, S = l(_)(({ theme: e })
|
|
|
209
197
|
error: G,
|
|
210
198
|
toolbarOpts: Q,
|
|
211
199
|
pluginProps: $(_?.inputConfiguration, c),
|
|
212
|
-
spellCheck:
|
|
200
|
+
spellCheck: H,
|
|
213
201
|
maxImageWidth: X,
|
|
214
202
|
maxImageHeight: Z,
|
|
215
203
|
uploadSoundSupport: s,
|
|
216
204
|
languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
|
|
217
|
-
mathMlOptions:
|
|
218
|
-
}), G && /* @__PURE__ */
|
|
205
|
+
mathMlOptions: j
|
|
206
|
+
}), G && /* @__PURE__ */ u(C, { children: G })]
|
|
219
207
|
}),
|
|
220
|
-
/* @__PURE__ */
|
|
208
|
+
/* @__PURE__ */ d(oe, { children: [/* @__PURE__ */ u(T, {
|
|
221
209
|
component: "div",
|
|
222
210
|
children: "Response Template"
|
|
223
|
-
}), /* @__PURE__ */
|
|
211
|
+
}), /* @__PURE__ */ u(se, {
|
|
224
212
|
disableFocusListener: !0,
|
|
225
213
|
disableTouchListener: !0,
|
|
226
214
|
placement: "right",
|
|
227
215
|
title: ue,
|
|
228
|
-
children: /* @__PURE__ */
|
|
216
|
+
children: /* @__PURE__ */ u(h, {
|
|
229
217
|
fontSize: "small",
|
|
230
218
|
color: "primary"
|
|
231
219
|
})
|
|
232
220
|
})] }),
|
|
233
|
-
/* @__PURE__ */
|
|
234
|
-
activePlugins:
|
|
221
|
+
/* @__PURE__ */ u(w, {
|
|
222
|
+
activePlugins: y,
|
|
235
223
|
toolbarOpts: { position: "top" },
|
|
236
|
-
spellCheck:
|
|
237
|
-
pluginProps: $(
|
|
224
|
+
spellCheck: H,
|
|
225
|
+
pluginProps: $(M?.inputConfiguration, c),
|
|
238
226
|
responseAreaProps: {
|
|
239
227
|
type: "math-templated",
|
|
240
228
|
respAreaToolbar: null,
|
|
241
229
|
error: () => Y,
|
|
242
230
|
onHandleAreaChange: this.onHandleAreaChange,
|
|
243
|
-
maxResponseAreas:
|
|
231
|
+
maxResponseAreas: L
|
|
244
232
|
},
|
|
245
233
|
markup: i.slateMarkup,
|
|
246
234
|
onChange: this.onChange,
|
|
@@ -252,13 +240,13 @@ var { dropdown: te } = v, { Panel: ne, toggle: x } = v, S = l(_)(({ theme: e })
|
|
|
252
240
|
error: q,
|
|
253
241
|
uploadSoundSupport: s,
|
|
254
242
|
languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
|
|
255
|
-
mathMlOptions:
|
|
243
|
+
mathMlOptions: j
|
|
256
244
|
}),
|
|
257
|
-
q && /* @__PURE__ */
|
|
258
|
-
/* @__PURE__ */
|
|
259
|
-
/* @__PURE__ */
|
|
245
|
+
q && /* @__PURE__ */ u(re, { children: q }),
|
|
246
|
+
/* @__PURE__ */ u(T, { children: "Define Response" }),
|
|
247
|
+
/* @__PURE__ */ u(ie, {
|
|
260
248
|
label: "Response Template Equation Editor",
|
|
261
|
-
children: /* @__PURE__ */
|
|
249
|
+
children: /* @__PURE__ */ d(ae, {
|
|
262
250
|
MenuProps: { transitionDuration: {
|
|
263
251
|
enter: 225,
|
|
264
252
|
exit: 195
|
|
@@ -266,51 +254,51 @@ var { dropdown: te } = v, { Panel: ne, toggle: x } = v, S = l(_)(({ theme: e })
|
|
|
266
254
|
onChange: (e) => this.handleChange("equationEditor", e.target.value),
|
|
267
255
|
value: W,
|
|
268
256
|
children: [
|
|
269
|
-
/* @__PURE__ */
|
|
257
|
+
/* @__PURE__ */ u(m, {
|
|
270
258
|
value: "non-negative-integers",
|
|
271
259
|
children: "Numeric - Non-Negative Integers"
|
|
272
260
|
}),
|
|
273
|
-
/* @__PURE__ */
|
|
261
|
+
/* @__PURE__ */ u(m, {
|
|
274
262
|
value: "integers",
|
|
275
263
|
children: "Numeric - Integers"
|
|
276
264
|
}),
|
|
277
|
-
/* @__PURE__ */
|
|
265
|
+
/* @__PURE__ */ u(m, {
|
|
278
266
|
value: "decimals",
|
|
279
267
|
children: "Numeric - Decimals"
|
|
280
268
|
}),
|
|
281
|
-
/* @__PURE__ */
|
|
269
|
+
/* @__PURE__ */ u(m, {
|
|
282
270
|
value: "fractions",
|
|
283
271
|
children: "Numeric - Fractions"
|
|
284
272
|
}),
|
|
285
|
-
/* @__PURE__ */
|
|
273
|
+
/* @__PURE__ */ u(m, {
|
|
286
274
|
value: 1,
|
|
287
275
|
children: "Grade 1 - 2"
|
|
288
276
|
}),
|
|
289
|
-
/* @__PURE__ */
|
|
277
|
+
/* @__PURE__ */ u(m, {
|
|
290
278
|
value: 3,
|
|
291
279
|
children: "Grade 3 - 5"
|
|
292
280
|
}),
|
|
293
|
-
/* @__PURE__ */
|
|
281
|
+
/* @__PURE__ */ u(m, {
|
|
294
282
|
value: 6,
|
|
295
283
|
children: "Grade 6 - 7"
|
|
296
284
|
}),
|
|
297
|
-
/* @__PURE__ */
|
|
285
|
+
/* @__PURE__ */ u(m, {
|
|
298
286
|
value: 8,
|
|
299
287
|
children: "Grade 8 - HS"
|
|
300
288
|
}),
|
|
301
|
-
/* @__PURE__ */
|
|
289
|
+
/* @__PURE__ */ u(m, {
|
|
302
290
|
value: "geometry",
|
|
303
291
|
children: "Geometry"
|
|
304
292
|
}),
|
|
305
|
-
/* @__PURE__ */
|
|
293
|
+
/* @__PURE__ */ u(m, {
|
|
306
294
|
value: "advanced-algebra",
|
|
307
295
|
children: "Advanced Algebra"
|
|
308
296
|
}),
|
|
309
|
-
/* @__PURE__ */
|
|
297
|
+
/* @__PURE__ */ u(m, {
|
|
310
298
|
value: "statistics",
|
|
311
299
|
children: "Statistics"
|
|
312
300
|
}),
|
|
313
|
-
/* @__PURE__ */
|
|
301
|
+
/* @__PURE__ */ u(m, {
|
|
314
302
|
value: "item-authoring",
|
|
315
303
|
children: "Item Authoring"
|
|
316
304
|
})
|
|
@@ -319,21 +307,20 @@ var { dropdown: te } = v, { Panel: ne, toggle: x } = v, S = l(_)(({ theme: e })
|
|
|
319
307
|
}),
|
|
320
308
|
Object.keys(U || {}).map((t, n) => {
|
|
321
309
|
let r = U[n];
|
|
322
|
-
return r ? /* @__PURE__ */
|
|
310
|
+
return r ? /* @__PURE__ */ u(e, {
|
|
323
311
|
responseKey: n,
|
|
324
312
|
mode: W,
|
|
325
313
|
response: r,
|
|
326
314
|
onResponseChange: this.onResponseChange,
|
|
327
315
|
onResponseDone: this.onResponseDone,
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
cAllowTrailingZeros: le,
|
|
316
|
+
cIgnoreOrder: P,
|
|
317
|
+
cAllowTrailingZeros: F,
|
|
331
318
|
error: Y && Y[n]
|
|
332
319
|
}, n) : null;
|
|
333
320
|
}),
|
|
334
|
-
|
|
321
|
+
V && /* @__PURE__ */ d(x, {
|
|
335
322
|
label: p.label,
|
|
336
|
-
children: [/* @__PURE__ */
|
|
323
|
+
children: [/* @__PURE__ */ u(S, {
|
|
337
324
|
markup: i.rationale || "",
|
|
338
325
|
onChange: (e) => this.handleChange("rationale", e),
|
|
339
326
|
imageSupport: n,
|
|
@@ -344,17 +331,17 @@ var { dropdown: te } = v, { Panel: ne, toggle: x } = v, S = l(_)(({ theme: e })
|
|
|
344
331
|
...c,
|
|
345
332
|
math: { controlledKeypadMode: !1 }
|
|
346
333
|
}),
|
|
347
|
-
spellCheck:
|
|
348
|
-
maxImageWidth:
|
|
349
|
-
maxImageHeight:
|
|
334
|
+
spellCheck: H,
|
|
335
|
+
maxImageWidth: k && k.rationale || X,
|
|
336
|
+
maxImageHeight: A && A.rationale || Z,
|
|
350
337
|
uploadSoundSupport: s,
|
|
351
338
|
languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
|
|
352
|
-
mathMlOptions:
|
|
353
|
-
}), K && /* @__PURE__ */
|
|
339
|
+
mathMlOptions: j
|
|
340
|
+
}), K && /* @__PURE__ */ u(C, { children: K })]
|
|
354
341
|
})
|
|
355
342
|
]
|
|
356
343
|
});
|
|
357
344
|
}
|
|
358
345
|
};
|
|
359
346
|
//#endregion
|
|
360
|
-
export {
|
|
347
|
+
export { D as Design, D as default };
|
package/dist/author/index.d.ts
CHANGED
|
@@ -1,34 +1,24 @@
|
|
|
1
|
+
import { type DeleteDone, type ImageHandler, type SoundHandler } from '@pie-element/shared-configure-events';
|
|
2
|
+
import { type AuthorModel } from './design.js';
|
|
3
|
+
import type { MathTemplatedConfiguration } from '../types.js';
|
|
1
4
|
export default class MathTemplateConfigure extends HTMLElement {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
equationEditor: string;
|
|
8
|
-
ignoreOrderDefault: boolean;
|
|
9
|
-
playerSpellCheckEnabled: boolean;
|
|
10
|
-
prompt: string;
|
|
11
|
-
promptEnabled: boolean;
|
|
12
|
-
rationale: string;
|
|
13
|
-
rationaleEnabled: boolean;
|
|
14
|
-
spellCheckEnabled: boolean;
|
|
15
|
-
teacherInstructions: string;
|
|
16
|
-
teacherInstructionsEnabled: boolean;
|
|
17
|
-
toolbarEditorPosition: string;
|
|
18
|
-
validationDefault: string;
|
|
19
|
-
};
|
|
5
|
+
private _root;
|
|
6
|
+
private _model;
|
|
7
|
+
private _configuration;
|
|
8
|
+
private _disableSidePanel?;
|
|
9
|
+
static prepareModel: (model?: AuthorModel) => AuthorModel;
|
|
20
10
|
constructor();
|
|
21
|
-
set model(s:
|
|
22
|
-
set configuration(c:
|
|
23
|
-
set disableSidePanel(s:
|
|
24
|
-
dispatchModelUpdated(reset
|
|
25
|
-
onModelChanged(m:
|
|
26
|
-
onConfigurationChanged(c:
|
|
11
|
+
set model(s: AuthorModel);
|
|
12
|
+
set configuration(c: MathTemplatedConfiguration);
|
|
13
|
+
set disableSidePanel(s: boolean);
|
|
14
|
+
dispatchModelUpdated(reset?: boolean): void;
|
|
15
|
+
onModelChanged(m: AuthorModel, reset?: boolean): void;
|
|
16
|
+
onConfigurationChanged(c: MathTemplatedConfiguration): void;
|
|
27
17
|
/** @param {done, progress, file} handler */
|
|
28
|
-
insertImage(handler:
|
|
29
|
-
onDeleteImage(src:
|
|
30
|
-
insertSound(handler:
|
|
31
|
-
onDeleteSound(src:
|
|
18
|
+
insertImage(handler: ImageHandler): void;
|
|
19
|
+
onDeleteImage(src: string, done: DeleteDone): void;
|
|
20
|
+
insertSound(handler: SoundHandler): void;
|
|
21
|
+
onDeleteSound(src: string, done: DeleteDone): void;
|
|
32
22
|
_render(): void;
|
|
33
23
|
connectedCallback(): void;
|
|
34
24
|
disconnectedCallback(): void;
|
package/dist/author/index.js
CHANGED
|
@@ -8,6 +8,10 @@ import c from "debug";
|
|
|
8
8
|
import { DeleteImageEvent as l, DeleteSoundEvent as u, InsertImageEvent as d, InsertSoundEvent as f, ModelUpdatedEvent as p } from "@pie-element/shared-configure-events";
|
|
9
9
|
//#region src/author/index.ts
|
|
10
10
|
var m = c("math-templated:configure"), h = class c extends HTMLElement {
|
|
11
|
+
_root;
|
|
12
|
+
_model;
|
|
13
|
+
_configuration;
|
|
14
|
+
_disableSidePanel;
|
|
11
15
|
static prepareModel = (n = {}) => {
|
|
12
16
|
let { validationDefault: i, allowTrailingZerosDefault: a, ignoreOrderDefault: o, responses: c = {} } = n, l = Object.keys(c).reduce((e, t) => {
|
|
13
17
|
let n = c[t];
|
|
@@ -23,7 +27,8 @@ var m = c("math-templated:configure"), h = class c extends HTMLElement {
|
|
|
23
27
|
responses: l
|
|
24
28
|
}, d = u.slateMarkup || e(u.markup, u.responses), f = t(d);
|
|
25
29
|
return u.responses && Object.keys(u.responses).forEach((e) => {
|
|
26
|
-
|
|
30
|
+
let t = u.responses[e];
|
|
31
|
+
s(t) && (u.responses[e] = (t || []).map((e, t) => e.answer ? e : (m("Choice does not contain \"answer\" property, which is required.", e), {
|
|
27
32
|
answer: `${t}`,
|
|
28
33
|
...e
|
|
29
34
|
})));
|
|
@@ -40,10 +45,15 @@ var m = c("math-templated:configure"), h = class c extends HTMLElement {
|
|
|
40
45
|
this._model = c.prepareModel(e), this._render();
|
|
41
46
|
}
|
|
42
47
|
set configuration(e) {
|
|
43
|
-
this._configuration = o(e, r.configuration), e.language?.enabled
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
if (this._configuration = o(e, r.configuration), e.language?.enabled) e.languageChoices?.options?.length && (this._model.language = e.languageChoices.options[0].value);
|
|
49
|
+
else if (e.language.settings && this._model.language) {
|
|
50
|
+
let e = this._configuration.language, t = this._configuration.languageChoices, n = this._model.language;
|
|
51
|
+
e.enabled = !0, (!t.options || !t.options.length) && (t.options = []), t.options.find((e) => e.value === n) || t.options.push({
|
|
52
|
+
value: n,
|
|
53
|
+
label: n
|
|
54
|
+
});
|
|
55
|
+
} else delete this._model.language;
|
|
56
|
+
this._render();
|
|
47
57
|
}
|
|
48
58
|
set disableSidePanel(e) {
|
|
49
59
|
this._disableSidePanel = e, this._render();
|
package/dist/author/utils.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { MathTemplatedConfiguration } from '../types.js';
|
|
2
|
+
export declare const generateValidationMessage: (config: MathTemplatedConfiguration) => string;
|
|
@@ -29689,15 +29689,12 @@ var cL = class extends L.Component {
|
|
|
29689
29689
|
}), fL = (e) => typeof e == "string" ? {
|
|
29690
29690
|
label: e,
|
|
29691
29691
|
value: e
|
|
29692
|
-
} : e, pL =
|
|
29693
|
-
|
|
29694
|
-
|
|
29695
|
-
|
|
29696
|
-
|
|
29697
|
-
|
|
29698
|
-
isConfigProperty: n
|
|
29699
|
-
};
|
|
29700
|
-
}, mL = (e, t, n = !1) => ({
|
|
29692
|
+
} : e, pL = (e, t, n = !1) => ({
|
|
29693
|
+
type: "radio",
|
|
29694
|
+
label: e,
|
|
29695
|
+
choices: t && t.map((e) => fL(e)),
|
|
29696
|
+
isConfigProperty: n
|
|
29697
|
+
}), mL = (e, t, n = !1) => ({
|
|
29701
29698
|
type: "dropdown",
|
|
29702
29699
|
label: e,
|
|
29703
29700
|
choices: t,
|
|
@@ -29998,17 +29995,6 @@ var RL = class extends I.Component {
|
|
|
29998
29995
|
let t = document.createElement("div");
|
|
29999
29996
|
return t.innerHTML = e.trim(), t;
|
|
30000
29997
|
}, cR = class extends L.Component {
|
|
30001
|
-
static propTypes = {
|
|
30002
|
-
model: Z.default.object.isRequired,
|
|
30003
|
-
configuration: Z.default.object.isRequired,
|
|
30004
|
-
onModelChanged: Z.default.func.isRequired,
|
|
30005
|
-
onConfigurationChanged: Z.default.func.isRequired,
|
|
30006
|
-
imageSupport: Z.default.shape({
|
|
30007
|
-
add: Z.default.func.isRequired,
|
|
30008
|
-
delete: Z.default.func.isRequired
|
|
30009
|
-
}),
|
|
30010
|
-
uploadSoundSupport: Z.default.object
|
|
30011
|
-
};
|
|
30012
29998
|
state = {};
|
|
30013
29999
|
componentDidMount() {
|
|
30014
30000
|
let { model: { slateMarkup: e } } = this.props;
|
|
@@ -30030,7 +30016,7 @@ var RL = class extends I.Component {
|
|
|
30030
30016
|
});
|
|
30031
30017
|
};
|
|
30032
30018
|
onChangeResponse = (e, t) => {
|
|
30033
|
-
let { model: n, onModelChanged: r } = this.props,
|
|
30019
|
+
let { model: n, onModelChanged: r } = this.props, i = n.responses;
|
|
30034
30020
|
i[e] ? i[e][0].answer = t || "" : i[e] = [{
|
|
30035
30021
|
answer: t || "",
|
|
30036
30022
|
id: "response" + e,
|
|
@@ -30092,10 +30078,10 @@ var RL = class extends I.Component {
|
|
|
30092
30078
|
function i(e, t = 0) {
|
|
30093
30079
|
if (!e || t >= 4) return null;
|
|
30094
30080
|
let n = e?.children?.[0];
|
|
30095
|
-
return n ? n.attributes && n.attributes
|
|
30081
|
+
return n ? n.attributes && n.attributes.getNamedItem("data-keypad") ? n : i(n, t + 1) : null;
|
|
30096
30082
|
}
|
|
30097
30083
|
let a = r(t), o = a ? i(a) : null;
|
|
30098
|
-
(!t || !n || !o?.attributes
|
|
30084
|
+
(!t || !n || !o?.attributes.getNamedItem("data-keypad")) && this.setState({ activeAnswerBlock: "" });
|
|
30099
30085
|
};
|
|
30100
30086
|
render() {
|
|
30101
30087
|
let { configuration: e, imageSupport: t, model: n, onConfigurationChanged: r, onModelChanged: i, uploadSoundSupport: a } = this.props, { baseInputConfiguration: o = {}, contentDimensions: s = {}, prompt: c = {}, rationale: l = {}, settingsPanelDisabled: u, teacherInstructions: d = {}, language: f = {}, languageChoices: p = {}, spellCheck: m = {}, playerSpellCheck: h = {}, maxImageWidth: g = {}, maxImageHeight: _ = {}, mathMlOptions: v = {}, template: y = {}, editSource: b = {}, ignoreOrder: x = {}, allowTrailingZeros: S = {}, partialScoring: C = {}, maxResponseAreas: ee } = e || {}, { errors: te, extraCSSRules: ne, promptEnabled: re, rationaleEnabled: w, spellCheckEnabled: T, teacherInstructionsEnabled: E, toolbarEditorPosition: ie, responses: ae, equationEditor: D } = n || {}, { prompt: oe, rationale: se, responseAreas: ce, teacherInstructions: le, responses: ue = {} } = te || {}, de = qL(e), O = {
|
|
@@ -30273,7 +30259,6 @@ var RL = class extends I.Component {
|
|
|
30273
30259
|
response: n,
|
|
30274
30260
|
onResponseChange: this.onResponseChange,
|
|
30275
30261
|
onResponseDone: this.onResponseDone,
|
|
30276
|
-
index: t,
|
|
30277
30262
|
cIgnoreOrder: x,
|
|
30278
30263
|
cAllowTrailingZeros: S,
|
|
30279
30264
|
error: ue && ue[t]
|
|
@@ -30423,6 +30408,10 @@ var RL = class extends I.Component {
|
|
|
30423
30408
|
maxResponseAreas: 10
|
|
30424
30409
|
}
|
|
30425
30410
|
}, uR = (0, Nt.default)("math-templated:configure"), dR = class e extends HTMLElement {
|
|
30411
|
+
_root;
|
|
30412
|
+
_model;
|
|
30413
|
+
_configuration;
|
|
30414
|
+
_disableSidePanel;
|
|
30426
30415
|
static prepareModel = (e = {}) => {
|
|
30427
30416
|
let { validationDefault: t, allowTrailingZerosDefault: n, ignoreOrderDefault: r, responses: i = {} } = e, a = Object.keys(i).reduce((e, a) => {
|
|
30428
30417
|
let o = i[a];
|
|
@@ -30438,7 +30427,8 @@ var RL = class extends I.Component {
|
|
|
30438
30427
|
responses: a
|
|
30439
30428
|
}, s = o.slateMarkup || KL(o.markup, o.responses), c = WL(s);
|
|
30440
30429
|
return o.responses && Object.keys(o.responses).forEach((e) => {
|
|
30441
|
-
|
|
30430
|
+
let t = o.responses[e];
|
|
30431
|
+
nt(t) && (o.responses[e] = (t || []).map((e, t) => e.answer ? e : (uR("Choice does not contain \"answer\" property, which is required.", e), {
|
|
30442
30432
|
answer: `${t}`,
|
|
30443
30433
|
...e
|
|
30444
30434
|
})));
|
|
@@ -30455,10 +30445,15 @@ var RL = class extends I.Component {
|
|
|
30455
30445
|
this._model = e.prepareModel(t), this._render();
|
|
30456
30446
|
}
|
|
30457
30447
|
set configuration(e) {
|
|
30458
|
-
this._configuration = Xe(e, lR.configuration), e.language?.enabled
|
|
30459
|
-
|
|
30460
|
-
|
|
30461
|
-
|
|
30448
|
+
if (this._configuration = Xe(e, lR.configuration), e.language?.enabled) e.languageChoices?.options?.length && (this._model.language = e.languageChoices.options[0].value);
|
|
30449
|
+
else if (e.language.settings && this._model.language) {
|
|
30450
|
+
let e = this._configuration.language, t = this._configuration.languageChoices, n = this._model.language;
|
|
30451
|
+
e.enabled = !0, (!t.options || !t.options.length) && (t.options = []), t.options.find((e) => e.value === n) || t.options.push({
|
|
30452
|
+
value: n,
|
|
30453
|
+
label: n
|
|
30454
|
+
});
|
|
30455
|
+
} else delete this._model.language;
|
|
30456
|
+
this._render();
|
|
30462
30457
|
}
|
|
30463
30458
|
set disableSidePanel(e) {
|
|
30464
30459
|
this._disableSidePanel = e, this._render();
|