@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.
Files changed (98) hide show
  1. package/CHANGELOG.json +1 -0
  2. package/CHANGELOG.md +1144 -0
  3. package/LICENSE.md +5 -0
  4. package/README.md +0 -0
  5. package/configure/CHANGELOG.json +1 -0
  6. package/configure/CHANGELOG.md +1021 -0
  7. package/configure/lib/defaults.js +172 -0
  8. package/configure/lib/defaults.js.map +1 -0
  9. package/configure/lib/design.js +546 -0
  10. package/configure/lib/design.js.map +1 -0
  11. package/configure/lib/index.js +169 -0
  12. package/configure/lib/index.js.map +1 -0
  13. package/configure/lib/markupUtils.js +39 -0
  14. package/configure/lib/markupUtils.js.map +1 -0
  15. package/configure/lib/response.js +394 -0
  16. package/configure/lib/response.js.map +1 -0
  17. package/configure/lib/utils.js +15 -0
  18. package/configure/lib/utils.js.map +1 -0
  19. package/configure/package.json +26 -0
  20. package/controller/CHANGELOG.json +1 -0
  21. package/controller/CHANGELOG.md +874 -0
  22. package/controller/lib/defaults.js +28 -0
  23. package/controller/lib/defaults.js.map +1 -0
  24. package/controller/lib/index.js +360 -0
  25. package/controller/lib/index.js.map +1 -0
  26. package/controller/package.json +17 -0
  27. package/docs/config-schema.json +2251 -0
  28. package/docs/config-schema.json.md +1658 -0
  29. package/docs/demo/config.js +8 -0
  30. package/docs/demo/generate.js +42 -0
  31. package/docs/demo/index.html +1 -0
  32. package/docs/demo/session.js +14 -0
  33. package/docs/pie-schema.json +1231 -0
  34. package/docs/pie-schema.json.md +894 -0
  35. package/lib/index.js +76 -0
  36. package/lib/index.js.map +1 -0
  37. package/lib/main.js +877 -0
  38. package/lib/main.js.map +1 -0
  39. package/lib/print.js +88 -0
  40. package/lib/print.js.map +1 -0
  41. package/module/configure.js +1 -0
  42. package/module/controller.js +3711 -0
  43. package/module/demo.js +67 -0
  44. package/module/element.js +1 -0
  45. package/module/index.html +21 -0
  46. package/module/manifest.json +22 -0
  47. package/module/print-demo.js +105 -0
  48. package/module/print.html +18 -0
  49. package/module/print.js +1 -0
  50. package/package.json +22 -93
  51. package/configure.js +0 -2
  52. package/controller.js +0 -1
  53. package/dist/author/defaults.d.ts +0 -173
  54. package/dist/author/defaults.js +0 -123
  55. package/dist/author/design.d.ts +0 -35
  56. package/dist/author/design.js +0 -360
  57. package/dist/author/index.d.ts +0 -42
  58. package/dist/author/index.js +0 -97
  59. package/dist/author/markupUtils.d.ts +0 -11
  60. package/dist/author/markupUtils.js +0 -10
  61. package/dist/author/response.d.ts +0 -41
  62. package/dist/author/response.js +0 -238
  63. package/dist/author/utils.d.ts +0 -9
  64. package/dist/author/utils.js +0 -7
  65. package/dist/browser/author/index.js +0 -31954
  66. package/dist/browser/author/index.js.map +0 -1
  67. package/dist/browser/browser-DJA4OL8j.js +0 -331
  68. package/dist/browser/browser-DJA4OL8j.js.map +0 -1
  69. package/dist/browser/controller/index.js +0 -37731
  70. package/dist/browser/controller/index.js.map +0 -1
  71. package/dist/browser/delivery/index.js +0 -81
  72. package/dist/browser/delivery/index.js.map +0 -1
  73. package/dist/browser/dist-Csid0rBE.js +0 -17046
  74. package/dist/browser/dist-Csid0rBE.js.map +0 -1
  75. package/dist/browser/dist-D9ARZhQk.js +0 -1426
  76. package/dist/browser/dist-D9ARZhQk.js.map +0 -1
  77. package/dist/browser/main-I_wWeaur.js +0 -1274
  78. package/dist/browser/main-I_wWeaur.js.map +0 -1
  79. package/dist/browser/math-templated.css +0 -2
  80. package/dist/browser/print/index.js +0 -47
  81. package/dist/browser/print/index.js.map +0 -1
  82. package/dist/controller/defaults.d.ts +0 -29
  83. package/dist/controller/defaults.js +0 -23
  84. package/dist/controller/index.d.ts +0 -45
  85. package/dist/controller/index.js +0 -154
  86. package/dist/delivery/index.d.ts +0 -20
  87. package/dist/delivery/index.js +0 -51
  88. package/dist/delivery/main.d.ts +0 -40
  89. package/dist/delivery/main.js +0 -492
  90. package/dist/index.d.ts +0 -1
  91. package/dist/index.iife.d.ts +0 -8
  92. package/dist/index.iife.js +0 -205
  93. package/dist/index.js +0 -2
  94. package/dist/math-templated.css +0 -2
  95. package/dist/print/index.d.ts +0 -15
  96. package/dist/print/index.js +0 -47
  97. package/dist/runtime-support.d.ts +0 -12
  98. package/dist/runtime-support.js +0 -12
@@ -1,123 +0,0 @@
1
- //#region src/author/defaults.ts
2
- var e = {
3
- model: {
4
- allowTrailingZerosDefault: !1,
5
- equationEditor: "8",
6
- ignoreOrderDefault: !1,
7
- markup: "",
8
- playerSpellCheckEnabled: !0,
9
- prompt: "",
10
- promptEnabled: !0,
11
- rationale: "",
12
- rationaleEnabled: !0,
13
- responses: {},
14
- spellCheckEnabled: !0,
15
- teacherInstructions: "",
16
- teacherInstructionsEnabled: !0,
17
- toolbarEditorPosition: "bottom",
18
- validationDefault: "literal"
19
- },
20
- configuration: {
21
- ignoreOrder: {
22
- settings: !0,
23
- label: "Ignore Order",
24
- enabled: !0
25
- },
26
- allowTrailingZeros: {
27
- settings: !0,
28
- label: "Allow Trailing Zeros",
29
- enabled: !0
30
- },
31
- partialScoring: {
32
- settings: !0,
33
- label: "Allow Partial Scoring"
34
- },
35
- baseInputConfiguration: {
36
- html: { disabled: !0 },
37
- audio: { disabled: !1 },
38
- video: { disabled: !1 },
39
- image: { disabled: !1 },
40
- h3: { disabled: !0 },
41
- blockquote: { disabled: !0 },
42
- textAlign: { disabled: !0 },
43
- showParagraphs: { disabled: !1 },
44
- separateParagraphs: { disabled: !0 }
45
- },
46
- prompt: {
47
- label: "Prompt",
48
- settings: !0,
49
- inputConfiguration: {
50
- audio: { disabled: !1 },
51
- video: { disabled: !1 },
52
- image: { disabled: !1 }
53
- },
54
- required: !1
55
- },
56
- spellCheck: {
57
- label: "Spellcheck",
58
- settings: !1,
59
- enabled: !0
60
- },
61
- editSource: {
62
- label: "Edit Source",
63
- settings: !1,
64
- enabled: !1
65
- },
66
- playerSpellCheck: {
67
- label: "Student Spellcheck",
68
- settings: !0,
69
- enabled: !0
70
- },
71
- teacherInstructions: {
72
- settings: !0,
73
- label: "Teacher Instructions",
74
- inputConfiguration: {
75
- audio: { disabled: !1 },
76
- video: { disabled: !1 },
77
- image: { disabled: !1 }
78
- },
79
- required: !1
80
- },
81
- rationale: {
82
- settings: !0,
83
- label: "Rationale",
84
- inputConfiguration: {
85
- audio: { disabled: !1 },
86
- video: { disabled: !1 },
87
- image: { disabled: !1 }
88
- },
89
- required: !1
90
- },
91
- template: { inputConfiguration: {
92
- audio: { disabled: !1 },
93
- video: { disabled: !1 },
94
- image: { disabled: !1 }
95
- } },
96
- maxImageWidth: {
97
- teacherInstructions: 300,
98
- prompt: 300,
99
- rationale: 300
100
- },
101
- maxImageHeight: {
102
- teacherInstructions: 300,
103
- prompt: 300,
104
- rationale: 300
105
- },
106
- mathMlOptions: {
107
- mmlOutput: !1,
108
- mmlEditing: !1
109
- },
110
- language: {
111
- settings: !1,
112
- label: "Specify Language",
113
- enabled: !1
114
- },
115
- languageChoices: {
116
- label: "Language Choices",
117
- options: []
118
- },
119
- maxResponseAreas: 10
120
- }
121
- };
122
- //#endregion
123
- export { e as default };
@@ -1,35 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/math-templated/configure/src/design.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 Design extends React.Component {
12
- static propTypes: {
13
- model: PropTypes.Validator<object>;
14
- configuration: PropTypes.Validator<object>;
15
- onModelChanged: PropTypes.Validator<(...args: any[]) => any>;
16
- onConfigurationChanged: PropTypes.Validator<(...args: any[]) => any>;
17
- imageSupport: PropTypes.Requireable<PropTypes.InferProps<{
18
- add: PropTypes.Validator<(...args: any[]) => any>;
19
- delete: PropTypes.Validator<(...args: any[]) => any>;
20
- }>>;
21
- uploadSoundSupport: PropTypes.Requireable<object>;
22
- };
23
- state: {};
24
- componentDidMount(): void;
25
- handleChange: any;
26
- onResponseChange: any;
27
- onResponseDone: any;
28
- onChangeResponse: any;
29
- onResponsesChanged: any;
30
- onChange: any;
31
- onHandleAreaChange: import("@pie-element/shared-lodash").CancelableFunction<(nodes: any) => void>;
32
- onBlur: any;
33
- render(): React.JSX.Element;
34
- }
35
- export default Design;
@@ -1,360 +0,0 @@
1
- import e from "./response.js";
2
- import { createSlateMarkup as t, processMarkup as n } from "./markupUtils.js";
3
- import { generateValidationMessage as r } from "./utils.js";
4
- import i from "react";
5
- import a from "prop-types";
6
- import { cloneDeep as o, pick as s, throttle as c } from "@pie-element/shared-lodash";
7
- import { styled as l } from "@mui/material/styles";
8
- import u from "@mui/material/Tooltip";
9
- import { jsx as d, jsxs as f } from "react/jsx-runtime";
10
- import p from "@mui/material/Typography";
11
- import m from "@mui/material/Select";
12
- import h from "@mui/material/MenuItem";
13
- import ee from "@mui/icons-material/Info";
14
- import { InputContainer as g, layout as te, settings as _ } from "@pie-lib/config-ui";
15
- import v, { ALL_PLUGINS as ne } from "@pie-lib/editable-html-tip-tap";
16
- //#region src/author/design.tsx
17
- var { dropdown: y } = _, { Panel: re, toggle: b } = _, x = l(g)(({ theme: e }) => ({
18
- width: "100%",
19
- paddingTop: e.spacing(2),
20
- marginBottom: e.spacing(2)
21
- })), S = l(v)({ width: "100%" }), C = l("div")(({ theme: e }) => ({
22
- color: e.palette.error.main,
23
- fontSize: "0.75rem",
24
- marginTop: e.spacing(1)
25
- })), ie = l("div")(({ theme: e }) => ({
26
- color: e.palette.error.main,
27
- fontSize: "0.75rem",
28
- marginBottom: e.spacing(1)
29
- })), ae = l(v)(({ theme: e }) => ({
30
- width: "100%",
31
- marginTop: e.spacing(2),
32
- marginBottom: e.spacing(3)
33
- })), oe = l(g)(({ theme: e }) => ({
34
- width: "100%",
35
- marginTop: e.spacing(2),
36
- "& > *:not(label)": { marginTop: e.spacing(1) },
37
- marginBottom: e.spacing(2)
38
- })), se = l(m)({ width: "100%" }), w = l(p)(({ theme: e }) => ({
39
- fontSize: e.typography.fontSize * 1.25,
40
- fontWeight: "bold"
41
- })), T = l("div")({
42
- display: "flex",
43
- alignItems: "center",
44
- gap: "8px"
45
- }), E = l(u)(({ theme: e }) => ({ "& .MuiTooltip-tooltip": {
46
- fontSize: e.typography.fontSize - 2,
47
- whiteSpace: "pre",
48
- maxWidth: "500px"
49
- } })), D = (e) => {
50
- let t = document.createElement("div");
51
- return t.innerHTML = e.trim(), t;
52
- }, O = class extends i.Component {
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
- };
64
- state = {};
65
- componentDidMount() {
66
- let { model: { slateMarkup: e } } = this.props;
67
- this.setState({ markup: e });
68
- }
69
- handleChange = (e, t) => {
70
- let { onModelChanged: n, model: r } = this.props, i = o(r);
71
- i[e] = t, n(i);
72
- };
73
- onResponseChange = (e, t) => {
74
- let { model: n, onModelChanged: r } = this.props, i = { ...n };
75
- i.responses[t] = e, r(i);
76
- };
77
- onResponseDone = () => {
78
- let { model: e, onModelChanged: n } = this.props;
79
- n({
80
- ...e,
81
- slateMarkup: t(e.markup, e.responses)
82
- });
83
- };
84
- onChangeResponse = (e, t) => {
85
- let { model: n, onModelChanged: r } = this.props, { responses: i } = n;
86
- i[e] ? i[e][0].answer = t || "" : i[e] = [{
87
- answer: t || "",
88
- id: "response" + e,
89
- allowSpaces: !0
90
- }], r({
91
- ...n,
92
- responses: i
93
- });
94
- };
95
- onResponsesChanged = (e) => {
96
- this.props.onModelChanged({
97
- ...this.props.model,
98
- responses: e
99
- });
100
- };
101
- onChange = (e) => {
102
- let { model: { responses: t, validationDefault: r, allowTrailingZerosDefault: i, ignoreOrderDefault: a }, onModelChanged: o } = this.props, s = {}, c = D(e);
103
- c.querySelectorAll("[data-type=\"math_templated\"]").forEach((e, n) => {
104
- let { value: o, index: c } = e.dataset;
105
- o || (e.dataset.value = ""), s[n] = t[c] || {
106
- allowSpaces: !0,
107
- validation: r || "symbolic",
108
- allowTrailingZeros: i || !1,
109
- ignoreOrder: a || !1,
110
- answer: "",
111
- alternates: {}
112
- }, e.dataset.index = n.toString();
113
- });
114
- let l = n(e);
115
- this.setState({ cachedResponses: void 0 }, () => o({
116
- ...this.props.model,
117
- slateMarkup: c.innerHTML,
118
- responses: s,
119
- markup: l
120
- }));
121
- };
122
- onHandleAreaChange = c((e) => {
123
- let { model: { responses: t }, onModelChanged: n } = this.props, { cachedResponses: r } = this.state;
124
- if (!e) return;
125
- let i = t ? o(t) : {}, a = r ? o(r) : {};
126
- e.forEach((e) => {
127
- let t = e.index;
128
- !i[t] && a[t] ? (Object.assign(i, s(a, t)), Object.prototype.hasOwnProperty.call(a, t) && delete a[t]) : (Object.assign(a, s(i, t)), Object.prototype.hasOwnProperty.call(i, t) && delete i[t]);
129
- }), this.setState({ cachedResponses: a }, () => n({
130
- ...this.props.model,
131
- responses: i
132
- }));
133
- }, 500, {
134
- trailing: !1,
135
- leading: !0
136
- });
137
- onBlur = (e) => {
138
- let { relatedTarget: t, currentTarget: n } = e || {};
139
- function r(e, t = 0) {
140
- if (!e || t >= 16) return null;
141
- let n = e.offsetParent;
142
- return n ? n.getAttribute("role") === "tooltip" ? n : r(n, t + 1) : null;
143
- }
144
- function i(e, t = 0) {
145
- if (!e || t >= 4) return null;
146
- let n = e?.children?.[0];
147
- return n ? n.attributes && n.attributes["data-keypad"] ? n : i(n, t + 1) : null;
148
- }
149
- let a = r(t), o = a ? i(a) : null;
150
- (!t || !n || !o?.attributes["data-keypad"]) && this.setState({ activeAnswerBlock: "" });
151
- };
152
- render() {
153
- let { configuration: t, imageSupport: n, model: i, onConfigurationChanged: a, onModelChanged: o, uploadSoundSupport: s } = this.props, { baseInputConfiguration: c = {}, contentDimensions: l = {}, prompt: u = {}, rationale: p = {}, settingsPanelDisabled: m, teacherInstructions: g = {}, language: _ = {}, languageChoices: v = {}, spellCheck: D = {}, playerSpellCheck: O = {}, maxImageWidth: k = {}, maxImageHeight: A = {}, mathMlOptions: j = {}, template: ce = {}, editSource: M = {}, ignoreOrder: le = {}, allowTrailingZeros: ue = {}, partialScoring: N = {}, maxResponseAreas: P } = t || {}, { errors: F, extraCSSRules: I, promptEnabled: L, rationaleEnabled: R, spellCheckEnabled: z, teacherInstructionsEnabled: B, toolbarEditorPosition: V, responses: H, equationEditor: U } = i || {}, { prompt: W, rationale: G, responseAreas: K, teacherInstructions: q, responses: J = {} } = F || {}, Y = r(t), de = {
154
- "language.enabled": _.settings && b(_.label, !0),
155
- language: _.settings && _.enabled && y(v.label, v.options)
156
- }, fe = {
157
- teacherInstructionsEnabled: g.settings && b(g.label),
158
- rationaleEnabled: p.settings && b(p.label),
159
- promptEnabled: u.settings && b(u.label),
160
- spellCheckEnabled: D.settings && b(D.label),
161
- playerSpellCheckEnabled: O.settings && b(O.label),
162
- "editSource.enabled": M?.settings && b(M.label, !0),
163
- partialScoring: N.settings && b(N.label)
164
- }, X = k && k.prompt, Z = A && A.prompt, Q = { position: V === "top" ? "top" : "bottom" }, $ = (e = {}, t = {}) => ({
165
- ...t,
166
- ...e
167
- });
168
- return /* @__PURE__ */ f(te.ConfigLayout, {
169
- extraCSSRules: I,
170
- dimensions: l,
171
- hideSettings: m,
172
- settings: /* @__PURE__ */ d(re, {
173
- model: i,
174
- configuration: t,
175
- onChangeModel: (e) => o(e),
176
- onChangeConfiguration: a,
177
- groups: {
178
- Settings: de,
179
- Properties: fe
180
- }
181
- }),
182
- children: [
183
- B && /* @__PURE__ */ f(x, {
184
- label: g.label,
185
- children: [/* @__PURE__ */ d(S, {
186
- markup: i.teacherInstructions || "",
187
- onChange: (e) => this.handleChange("teacherInstructions", e),
188
- imageSupport: n,
189
- nonEmpty: !1,
190
- error: q,
191
- toolbarOpts: Q,
192
- pluginProps: $(g?.inputConfiguration, c),
193
- spellCheck: z,
194
- maxImageWidth: k && k.teacherInstructions || X,
195
- maxImageHeight: A && A.teacherInstructions || Z,
196
- uploadSoundSupport: s,
197
- languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
198
- mathMlOptions: j
199
- }), q && /* @__PURE__ */ d(C, { children: q })]
200
- }),
201
- L && /* @__PURE__ */ f(x, {
202
- label: u.label,
203
- children: [/* @__PURE__ */ d(S, {
204
- markup: i.prompt,
205
- onChange: (e) => this.handleChange("prompt", e),
206
- imageSupport: n,
207
- nonEmpty: !1,
208
- disableUnderline: !0,
209
- error: W,
210
- toolbarOpts: Q,
211
- pluginProps: $(g?.inputConfiguration, c),
212
- spellCheck: z,
213
- maxImageWidth: X,
214
- maxImageHeight: Z,
215
- uploadSoundSupport: s,
216
- languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
217
- mathMlOptions: j
218
- }), W && /* @__PURE__ */ d(C, { children: W })]
219
- }),
220
- /* @__PURE__ */ f(T, { children: [/* @__PURE__ */ d(w, {
221
- component: "div",
222
- children: "Response Template"
223
- }), /* @__PURE__ */ d(E, {
224
- disableFocusListener: !0,
225
- disableTouchListener: !0,
226
- placement: "right",
227
- title: Y,
228
- children: /* @__PURE__ */ d(ee, {
229
- fontSize: "small",
230
- color: "primary"
231
- })
232
- })] }),
233
- /* @__PURE__ */ d(ae, {
234
- activePlugins: ne,
235
- toolbarOpts: { position: "top" },
236
- spellCheck: z,
237
- pluginProps: $(ce?.inputConfiguration, c),
238
- responseAreaProps: {
239
- type: "math-templated",
240
- respAreaToolbar: null,
241
- error: () => J,
242
- onHandleAreaChange: this.onHandleAreaChange,
243
- maxResponseAreas: P
244
- },
245
- markup: i.slateMarkup,
246
- onChange: this.onChange,
247
- imageSupport: n,
248
- disableImageAlignmentButtons: !0,
249
- onBlur: this.onBlur,
250
- disabled: !1,
251
- highlightShape: !1,
252
- error: K,
253
- uploadSoundSupport: s,
254
- languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
255
- mathMlOptions: j
256
- }),
257
- K && /* @__PURE__ */ d(ie, { children: K }),
258
- /* @__PURE__ */ d(w, { children: "Define Response" }),
259
- /* @__PURE__ */ d(oe, {
260
- label: "Response Template Equation Editor",
261
- children: /* @__PURE__ */ f(se, {
262
- MenuProps: { transitionDuration: {
263
- enter: 225,
264
- exit: 195
265
- } },
266
- onChange: (e) => this.handleChange("equationEditor", e.target.value),
267
- value: U,
268
- children: [
269
- /* @__PURE__ */ d(h, {
270
- value: "non-negative-integers",
271
- children: "Numeric - Non-Negative Integers"
272
- }),
273
- /* @__PURE__ */ d(h, {
274
- value: "integers",
275
- children: "Numeric - Integers"
276
- }),
277
- /* @__PURE__ */ d(h, {
278
- value: "decimals",
279
- children: "Numeric - Decimals"
280
- }),
281
- /* @__PURE__ */ d(h, {
282
- value: "fractions",
283
- children: "Numeric - Fractions"
284
- }),
285
- /* @__PURE__ */ d(h, {
286
- value: 1,
287
- children: "Grade 1 - 2"
288
- }),
289
- /* @__PURE__ */ d(h, {
290
- value: 3,
291
- children: "Grade 3 - 5"
292
- }),
293
- /* @__PURE__ */ d(h, {
294
- value: 6,
295
- children: "Grade 6 - 7"
296
- }),
297
- /* @__PURE__ */ d(h, {
298
- value: 8,
299
- children: "Grade 8 - HS"
300
- }),
301
- /* @__PURE__ */ d(h, {
302
- value: "geometry",
303
- children: "Geometry"
304
- }),
305
- /* @__PURE__ */ d(h, {
306
- value: "advanced-algebra",
307
- children: "Advanced Algebra"
308
- }),
309
- /* @__PURE__ */ d(h, {
310
- value: "statistics",
311
- children: "Statistics"
312
- }),
313
- /* @__PURE__ */ d(h, {
314
- value: "item-authoring",
315
- children: "Item Authoring"
316
- })
317
- ]
318
- })
319
- }),
320
- Object.keys(H || {}).map((t, n) => {
321
- let r = H[n];
322
- return r ? /* @__PURE__ */ d(e, {
323
- responseKey: n,
324
- mode: U,
325
- response: r,
326
- onResponseChange: this.onResponseChange,
327
- onResponseDone: this.onResponseDone,
328
- index: n,
329
- cIgnoreOrder: le,
330
- cAllowTrailingZeros: ue,
331
- error: J && J[n]
332
- }, n) : null;
333
- }),
334
- R && /* @__PURE__ */ f(x, {
335
- label: p.label,
336
- children: [/* @__PURE__ */ d(S, {
337
- markup: i.rationale || "",
338
- onChange: (e) => this.handleChange("rationale", e),
339
- imageSupport: n,
340
- nonEmpty: !1,
341
- error: G,
342
- toolbarOpts: Q,
343
- pluginProps: $(p?.inputConfiguration, {
344
- ...c,
345
- math: { controlledKeypadMode: !1 }
346
- }),
347
- spellCheck: z,
348
- maxImageWidth: k && k.rationale || X,
349
- maxImageHeight: A && A.rationale || Z,
350
- uploadSoundSupport: s,
351
- languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
352
- mathMlOptions: j
353
- }), G && /* @__PURE__ */ d(C, { children: G })]
354
- })
355
- ]
356
- });
357
- }
358
- };
359
- //#endregion
360
- export { O as default };
@@ -1,42 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/math-templated/configure/src/index.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 default class MathTemplateConfigure extends HTMLElement {
10
- static prepareModel: (model?: {}) => {
11
- slateMarkup: any;
12
- markup: string;
13
- responses: {};
14
- allowTrailingZerosDefault: boolean;
15
- equationEditor: string;
16
- ignoreOrderDefault: boolean;
17
- playerSpellCheckEnabled: boolean;
18
- prompt: string;
19
- promptEnabled: boolean;
20
- rationale: string;
21
- rationaleEnabled: boolean;
22
- spellCheckEnabled: boolean;
23
- teacherInstructions: string;
24
- teacherInstructionsEnabled: boolean;
25
- toolbarEditorPosition: string;
26
- validationDefault: string;
27
- };
28
- constructor();
29
- set model(s: any);
30
- set configuration(c: any);
31
- set disableSidePanel(s: any);
32
- dispatchModelUpdated(reset: any): void;
33
- onModelChanged(m: any, reset: any): void;
34
- onConfigurationChanged(c: any): void;
35
- /** @param {done, progress, file} handler */
36
- insertImage(handler: any): void;
37
- onDeleteImage(src: any, done: any): void;
38
- insertSound(handler: any): void;
39
- onDeleteSound(src: any, done: any): void;
40
- _render(): void;
41
- disconnectedCallback(): void;
42
- }
@@ -1,97 +0,0 @@
1
- import { createSlateMarkup as e, processMarkup as t } from "./markupUtils.js";
2
- import n from "./design.js";
3
- import r from "./defaults.js";
4
- import i from "react";
5
- import { createRoot as a } from "react-dom/client";
6
- import { defaults as o, isArray as s } from "@pie-element/shared-lodash";
7
- import c from "debug";
8
- import { DeleteImageEvent as l, DeleteSoundEvent as u, InsertImageEvent as d, InsertSoundEvent as f, ModelUpdatedEvent as p } from "@pie-element/shared-configure-events";
9
- //#region src/author/index.ts
10
- var m = c("math-templated:configure"), h = class c extends HTMLElement {
11
- static prepareModel = (n = {}) => {
12
- let { validationDefault: i, allowTrailingZerosDefault: a, ignoreOrderDefault: o, responses: c = {} } = n, l = Object.keys(c).reduce((e, t) => {
13
- let n = c[t];
14
- return e[t] = {
15
- ...n,
16
- validation: n.validation || i,
17
- allowTrailingZeros: n.allowTrailingZeros || a,
18
- ignoreOrder: n.ignoreOrder || o
19
- }, e;
20
- }, {}), u = {
21
- ...r.model,
22
- ...n,
23
- responses: l
24
- }, d = u.slateMarkup || e(u.markup, u.responses), f = t(d);
25
- return u.responses && Object.keys(u.responses).forEach((e) => {
26
- s(u.responses[e]) && (u.responses[e] = (u.responses[e] || []).map((e, t) => e.answer ? e : (m("Choice does not contain \"answer\" property, which is required.", e), {
27
- answer: `${t}`,
28
- ...e
29
- })));
30
- }), {
31
- ...u,
32
- slateMarkup: d,
33
- markup: f
34
- };
35
- };
36
- constructor() {
37
- super(), this._root = null, this._model = c.prepareModel(), this._configuration = r.configuration, this.onModelChanged = this.onModelChanged.bind(this), this.onConfigurationChanged = this.onConfigurationChanged.bind(this);
38
- }
39
- set model(e) {
40
- this._model = c.prepareModel(e), this._render();
41
- }
42
- set configuration(e) {
43
- this._configuration = o(e, r.configuration), e.language?.enabled ? e.languageChoices?.options?.length && (this._model.language = e.languageChoices.options[0].value) : e.language.settings && this._model.language ? (this._configuration.language.enabled = !0, (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) && (this._configuration.languageChoices.options = []), this._configuration.languageChoices.options.find((e) => e.value === this._model.language) || this._configuration.languageChoices.options.push({
44
- value: this._model.language,
45
- label: this._model.language
46
- })) : delete this._model.language, this._render();
47
- }
48
- set disableSidePanel(e) {
49
- this._disableSidePanel = e, this._render();
50
- }
51
- dispatchModelUpdated(e) {
52
- let t = !!e;
53
- this.dispatchEvent(new p(this._model, t));
54
- }
55
- onModelChanged(e, t) {
56
- this._model = c.prepareModel(e), this._render(), this.dispatchModelUpdated(t);
57
- }
58
- onConfigurationChanged(e) {
59
- this._configuration = e, this._render();
60
- }
61
- insertImage(e) {
62
- this.dispatchEvent(new d(e));
63
- }
64
- onDeleteImage(e, t) {
65
- this.dispatchEvent(new l(e, t));
66
- }
67
- insertSound(e) {
68
- this.dispatchEvent(new f(e));
69
- }
70
- onDeleteSound(e, t) {
71
- this.dispatchEvent(new u(e, t));
72
- }
73
- _render() {
74
- m("_render");
75
- let e = i.createElement(n, {
76
- model: this._model,
77
- configuration: this._configuration,
78
- onModelChanged: this.onModelChanged,
79
- onConfigurationChanged: this.onConfigurationChanged,
80
- disableSidePanel: this._disableSidePanel,
81
- imageSupport: {
82
- add: this.insertImage.bind(this),
83
- delete: this.onDeleteImage.bind(this)
84
- },
85
- uploadSoundSupport: {
86
- add: this.insertSound.bind(this),
87
- delete: this.onDeleteSound.bind(this)
88
- }
89
- });
90
- this._root ||= a(this), this._root.render(e);
91
- }
92
- disconnectedCallback() {
93
- this._root && this._root.unmount();
94
- }
95
- };
96
- //#endregion
97
- export { h as default };
@@ -1,11 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/math-templated/configure/src/markupUtils.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 removeUnwantedCharacters: (markup: any) => any;
10
- export declare const processMarkup: (markup: any) => string;
11
- export declare const createSlateMarkup: (markup: any, responses: any) => any;
@@ -1,10 +0,0 @@
1
- //#region src/author/markupUtils.tsx
2
- var e = "imes|riangle|an|heta|herefore", t = "throot|parallel|cong|approx|eq|e|sim", n = RegExp(`(\\t(?!${e}))|(\\n(?!${t}))|(\\\\t(?!${e}))|(\\\\n(?!${t}))`, "g"), r = (e) => e.replace(n, "").replace(/\\"/g, "\"").replace(/\\\//g, "/"), i = (e = "") => {
3
- let t = document.createElement("div");
4
- return t.innerHTML = e.trim(), t;
5
- }, a = (e) => {
6
- let t = i(r(e || "") || "");
7
- return t.querySelectorAll("[data-type=\"math_templated\"]").forEach((e) => e.replaceWith(`{{${e.dataset.index}}}`)), t.innerHTML;
8
- }, o = /\{\{(\d+)\}\}/g, s = (e, t) => e ? r(e).replace(o, (e, n) => `<span data-type="math_templated" data-index="${n}" data-value="${t[n]?.answer || ""}"></span>`) : "";
9
- //#endregion
10
- export { s as createSlateMarkup, a as processMarkup };