@pie-element/math-inline 12.1.1-next.20 → 12.1.1-next.22

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.
@@ -1,12 +1,12 @@
1
1
  import e from "./response.js";
2
2
  import { ResponseTypes as t, generateValidationMessage as n, getPluginProps as r } from "./utils.js";
3
3
  import * as i from "react";
4
- import { isEqual as a } from "@pie-element/shared-lodash";
5
- import o from "prop-types";
6
- import { applyStaticMath as s, registerEmbed as c } from "@pie-lib/math-input";
7
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
8
- import { styled as d } from "@mui/material/styles";
9
- import f from "@mui/material/Tooltip";
4
+ import a from "prop-types";
5
+ import { applyStaticMath as o, registerEmbed as s } from "@pie-lib/math-input";
6
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
7
+ import { styled as u } from "@mui/material/styles";
8
+ import d from "@mui/material/Tooltip";
9
+ import { isEqual as f } from "@pie-element/shared-lodash";
10
10
  import { MathToolbar as p } from "@pie-lib/math-toolbar";
11
11
  import { InputContainer as m } from "@pie-lib/config-ui";
12
12
  import h from "@pie-lib/editable-html-tip-tap";
@@ -15,20 +15,20 @@ import _ from "@mui/material/Select";
15
15
  import v from "@mui/material/MenuItem";
16
16
  import y from "@mui/icons-material/Info";
17
17
  //#region src/author/general-config-block.tsx
18
- var b = !1, x = d("div")({
18
+ var b = !1, x = u("div")({
19
19
  display: "flex",
20
20
  flexDirection: "column"
21
- }), S = d(g)({ fontSize: "0.85rem" }), C = d("div")({ fontSize: "1.1rem" }), w = d("div")({
21
+ }), S = u(g)({ fontSize: "0.85rem" }), C = u("div")({ fontSize: "1.1rem" }), w = u("div")({
22
22
  display: "flex",
23
23
  alignItems: "center",
24
24
  justifyContent: "space-between"
25
- }), T = d(m)(({ theme: e }) => ({
25
+ }), T = u(m)(({ theme: e }) => ({
26
26
  flex: "initial",
27
27
  width: "40%",
28
28
  marginTop: e.spacing(2),
29
29
  marginBottom: e.spacing(2),
30
30
  "& > *:not(label)": { marginTop: e.spacing(1) }
31
- })), ee = d("div")({
31
+ })), ee = u("div")({
32
32
  display: "flex",
33
33
  flexDirection: "column",
34
34
  ".block-container": {
@@ -62,18 +62,18 @@ var b = !1, x = d("div")({
62
62
  padding: "8px"
63
63
  },
64
64
  ".math-toolbar": { maxWidth: "900px" }
65
- }), E = d(f)(({ theme: e }) => ({ "& .MuiTooltip-tooltip": {
65
+ }), E = u(d)(({ theme: e }) => ({ "& .MuiTooltip-tooltip": {
66
66
  fontSize: e.typography.fontSize - 2,
67
67
  whiteSpace: "pre-wrap"
68
- } })), D = d("div")(({ theme: e }) => ({
68
+ } })), D = u("div")(({ theme: e }) => ({
69
69
  fontSize: e.typography.fontSize - 2,
70
70
  color: e.palette.error.main,
71
71
  paddingTop: e.spacing(1)
72
- })), O = d(m)(({ theme: e }) => ({
72
+ })), O = u(m)(({ theme: e }) => ({
73
73
  width: "100%",
74
74
  paddingTop: e.spacing(2),
75
75
  marginBottom: e.spacing(2)
76
- })), k = d("div")(({ theme: e }) => ({ marginBottom: e.spacing(2.5) })), A = /{{response}}/gm, j = /\\%response\\%/gm, M = /\\embed\{answerBlock\}\[r\d*\]/g, N = /\\embed\{newLine\}\[\]/g, P = /\\newline/g;
76
+ })), k = u("div")(({ theme: e }) => ({ marginBottom: e.spacing(2.5) })), A = /{{response}}/gm, j = /\\%response\\%/gm, M = /\\embed\{answerBlock\}\[r\d*\]/g, N = /\\embed\{newLine\}\[\]/g, P = /\\newline/g;
77
77
  function F(e) {
78
78
  if (e) {
79
79
  let t = 1;
@@ -85,14 +85,14 @@ function I(e) {
85
85
  }
86
86
  var L = class extends i.Component {
87
87
  static propTypes = {
88
- model: o.object.isRequired,
89
- imageSupport: o.object,
90
- uploadSoundSupport: o.object,
91
- configuration: o.object,
92
- onChange: o.func.isRequired,
93
- promptEnabled: o.bool,
94
- rationaleEnabled: o.bool,
95
- toolbarOpts: o.object
88
+ model: a.object.isRequired,
89
+ imageSupport: a.object,
90
+ uploadSoundSupport: a.object,
91
+ configuration: a.object,
92
+ onChange: a.func.isRequired,
93
+ promptEnabled: a.bool,
94
+ rationaleEnabled: a.bool,
95
+ toolbarOpts: a.object
96
96
  };
97
97
  constructor(e) {
98
98
  super(e);
@@ -123,7 +123,7 @@ var L = class extends i.Component {
123
123
  this.setState({ showKeypad: !1 });
124
124
  };
125
125
  UNSAFE_componentWillMount() {
126
- typeof window < "u" && (b ||= (c("answerBlock", (e) => ({
126
+ typeof window < "u" && (b ||= (s("answerBlock", (e) => ({
127
127
  htmlString: `
128
128
  <div class="block-container block-container-generic">
129
129
  <div class="block-response block-response-generic" id="${e}Index">Response</div>
@@ -146,10 +146,10 @@ var L = class extends i.Component {
146
146
  t[`r${n++}`] = { value: "" };
147
147
  });
148
148
  }
149
- a(t, this.state.responseAreas) || this.setState({ responseAreas: t }, () => {
149
+ f(t, this.state.responseAreas) || this.setState({ responseAreas: t }, () => {
150
150
  this.root && Object.keys(t).length && Object.keys(t).forEach((e, t) => {
151
151
  let n = this.root.querySelector(`#${e}`), r = this.root.querySelector(`#${e}Index`);
152
- n && (s(n), r.textContent = `R${t + 1}`);
152
+ n && (o(n), r.textContent = `R${t + 1}`);
153
153
  });
154
154
  });
155
155
  };
@@ -169,26 +169,26 @@ var L = class extends i.Component {
169
169
  i.responses[t] = e, r(i);
170
170
  };
171
171
  render() {
172
- let { model: i, imageSupport: a, uploadSoundSupport: o, configuration: s, promptEnabled: c, rationaleEnabled: d, toolbarOpts: f } = this.props, { showKeypad: m } = this.state, { prompt: g, expression: b, equationEditor: A, promptEquationEditor: j = "8", responses: M, responseType: N, rationale: P, spellCheckEnabled: I, errors: L = {} } = i, { baseInputConfiguration: R = {}, rationale: z = {}, prompt: B = {}, ignoreOrder: V = {}, allowTrailingZeros: H = {}, maxResponseAreas: U, maxImageWidth: W = {}, maxImageHeight: G = {}, mathMlOptions: K = {} } = s || {}, te = n(s, i), { prompt: q, rationale: J, responsesErrors: Y, responseAreasError: X } = L, Z = W && W.prompt, Q = G && G.prompt, ne = {
172
+ let { model: i, imageSupport: a, uploadSoundSupport: o, configuration: s, promptEnabled: u, rationaleEnabled: d, toolbarOpts: f } = this.props, { showKeypad: m } = this.state, { prompt: g, expression: b, equationEditor: A, promptEquationEditor: j = "8", responses: M, responseType: N, rationale: P, spellCheckEnabled: I, errors: L = {} } = i, { baseInputConfiguration: R = {}, rationale: z = {}, prompt: B = {}, ignoreOrder: V = {}, allowTrailingZeros: H = {}, maxResponseAreas: U, maxImageWidth: W = {}, maxImageHeight: G = {}, mathMlOptions: K = {} } = s || {}, te = n(s, i), { prompt: q, rationale: J, responsesErrors: Y, responseAreasError: X } = L, Z = W && W.prompt, Q = G && G.prompt, ne = {
173
173
  editor: "response-editor",
174
174
  mathToolbar: "math-toolbar"
175
- }, re = N === t.advanced ? M : M.slice(0, 1), $ = /* @__PURE__ */ l(E, {
175
+ }, re = N === t.advanced ? M : M.slice(0, 1), $ = /* @__PURE__ */ c(E, {
176
176
  disableFocusListener: !0,
177
177
  disableTouchListener: !0,
178
178
  placement: "right",
179
179
  title: te,
180
- children: /* @__PURE__ */ l(y, {
180
+ children: /* @__PURE__ */ c(y, {
181
181
  fontSize: "small",
182
182
  color: "primary",
183
183
  style: { marginLeft: "5px" }
184
184
  })
185
185
  });
186
- return /* @__PURE__ */ u(x, {
186
+ return /* @__PURE__ */ l(x, {
187
187
  ref: (e) => this.root = e || this.root,
188
188
  children: [
189
- c && /* @__PURE__ */ u(O, {
189
+ u && /* @__PURE__ */ l(O, {
190
190
  label: B.label,
191
- children: [/* @__PURE__ */ l(h, {
191
+ children: [/* @__PURE__ */ c(h, {
192
192
  onFocus: this.onPromptFocus,
193
193
  markup: g || "",
194
194
  onChange: this.onChange("prompt"),
@@ -203,16 +203,16 @@ var L = class extends i.Component {
203
203
  uploadSoundSupport: o,
204
204
  languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
205
205
  mathMlOptions: K
206
- }), q && /* @__PURE__ */ l(D, { children: q })]
206
+ }), q && /* @__PURE__ */ c(D, { children: q })]
207
207
  }),
208
- N === t.advanced && /* @__PURE__ */ u(k, { children: [
209
- /* @__PURE__ */ u(w, {
208
+ N === t.advanced && /* @__PURE__ */ l(k, { children: [
209
+ /* @__PURE__ */ l(w, {
210
210
  style: { justifyContent: "flex-start" },
211
- children: [/* @__PURE__ */ l(C, { children: "Define Response" }), $]
211
+ children: [/* @__PURE__ */ c(C, { children: "Define Response" }), $]
212
212
  }),
213
- /* @__PURE__ */ l(T, {
213
+ /* @__PURE__ */ c(T, {
214
214
  label: "Response Template Equation Editor",
215
- children: /* @__PURE__ */ u(_, {
215
+ children: /* @__PURE__ */ l(_, {
216
216
  onChange: this.onChange("promptEquationEditor"),
217
217
  value: j,
218
218
  MenuProps: { transitionDuration: {
@@ -220,58 +220,58 @@ var L = class extends i.Component {
220
220
  exit: 195
221
221
  } },
222
222
  children: [
223
- /* @__PURE__ */ l(v, {
223
+ /* @__PURE__ */ c(v, {
224
224
  value: "non-negative-integers",
225
225
  children: "Numeric - Non-Negative Integers"
226
226
  }),
227
- /* @__PURE__ */ l(v, {
227
+ /* @__PURE__ */ c(v, {
228
228
  value: "integers",
229
229
  children: "Numeric - Integers"
230
230
  }),
231
- /* @__PURE__ */ l(v, {
231
+ /* @__PURE__ */ c(v, {
232
232
  value: "decimals",
233
233
  children: "Numeric - Decimals"
234
234
  }),
235
- /* @__PURE__ */ l(v, {
235
+ /* @__PURE__ */ c(v, {
236
236
  value: "fractions",
237
237
  children: "Numeric - Fractions"
238
238
  }),
239
- /* @__PURE__ */ l(v, {
239
+ /* @__PURE__ */ c(v, {
240
240
  value: 1,
241
241
  children: "Grade 1 - 2"
242
242
  }),
243
- /* @__PURE__ */ l(v, {
243
+ /* @__PURE__ */ c(v, {
244
244
  value: 3,
245
245
  children: "Grade 3 - 5"
246
246
  }),
247
- /* @__PURE__ */ l(v, {
247
+ /* @__PURE__ */ c(v, {
248
248
  value: 6,
249
249
  children: "Grade 6 - 7"
250
250
  }),
251
- /* @__PURE__ */ l(v, {
251
+ /* @__PURE__ */ c(v, {
252
252
  value: 8,
253
253
  children: "Grade 8 - HS"
254
254
  }),
255
- /* @__PURE__ */ l(v, {
255
+ /* @__PURE__ */ c(v, {
256
256
  value: "geometry",
257
257
  children: "Geometry"
258
258
  }),
259
- /* @__PURE__ */ l(v, {
259
+ /* @__PURE__ */ c(v, {
260
260
  value: "advanced-algebra",
261
261
  children: "Advanced Algebra"
262
262
  }),
263
- /* @__PURE__ */ l(v, {
263
+ /* @__PURE__ */ c(v, {
264
264
  value: "statistics",
265
265
  children: "Statistics"
266
266
  }),
267
- /* @__PURE__ */ l(v, {
267
+ /* @__PURE__ */ c(v, {
268
268
  value: "item-authoring",
269
269
  children: "Item Authoring"
270
270
  })
271
271
  ]
272
272
  })
273
273
  }, "templateEditorType"),
274
- /* @__PURE__ */ u(ee, { children: [/* @__PURE__ */ l(S, { children: "RESPONSE TEMPLATE" }), /* @__PURE__ */ l(p, {
274
+ /* @__PURE__ */ l(ee, { children: [/* @__PURE__ */ c(S, { children: "RESPONSE TEMPLATE" }), /* @__PURE__ */ c(p, {
275
275
  classNames: ne,
276
276
  allowAnswerBlock: !0,
277
277
  keypadMode: j,
@@ -284,15 +284,15 @@ var L = class extends i.Component {
284
284
  maxResponseAreas: U,
285
285
  error: X
286
286
  })] }, "templateHolder"),
287
- X && /* @__PURE__ */ l(D, { children: X })
287
+ X && /* @__PURE__ */ c(D, { children: X })
288
288
  ] }),
289
- /* @__PURE__ */ u(w, {
289
+ /* @__PURE__ */ l(w, {
290
290
  style: { justifyContent: "flex-start" },
291
- children: [/* @__PURE__ */ l(C, { children: "Define Correct Response" }), N === t.simple ? $ : null]
291
+ children: [/* @__PURE__ */ c(C, { children: "Define Correct Response" }), N === t.simple ? $ : null]
292
292
  }),
293
- /* @__PURE__ */ l(T, {
293
+ /* @__PURE__ */ c(T, {
294
294
  label: "Equation Editor",
295
- children: /* @__PURE__ */ u(_, {
295
+ children: /* @__PURE__ */ l(_, {
296
296
  onChange: this.onChange("equationEditor"),
297
297
  value: A,
298
298
  MenuProps: { transitionDuration: {
@@ -300,58 +300,58 @@ var L = class extends i.Component {
300
300
  exit: 195
301
301
  } },
302
302
  children: [
303
- /* @__PURE__ */ l(v, {
303
+ /* @__PURE__ */ c(v, {
304
304
  value: "non-negative-integers",
305
305
  children: "Numeric - Non-Negative Integers"
306
306
  }),
307
- /* @__PURE__ */ l(v, {
307
+ /* @__PURE__ */ c(v, {
308
308
  value: "integers",
309
309
  children: "Numeric - Integers"
310
310
  }),
311
- /* @__PURE__ */ l(v, {
311
+ /* @__PURE__ */ c(v, {
312
312
  value: "decimals",
313
313
  children: "Numeric - Decimals"
314
314
  }),
315
- /* @__PURE__ */ l(v, {
315
+ /* @__PURE__ */ c(v, {
316
316
  value: "fractions",
317
317
  children: "Numeric - Fractions"
318
318
  }),
319
- /* @__PURE__ */ l(v, {
319
+ /* @__PURE__ */ c(v, {
320
320
  value: 1,
321
321
  children: "Grade 1 - 2"
322
322
  }),
323
- /* @__PURE__ */ l(v, {
323
+ /* @__PURE__ */ c(v, {
324
324
  value: 3,
325
325
  children: "Grade 3 - 5"
326
326
  }),
327
- /* @__PURE__ */ l(v, {
327
+ /* @__PURE__ */ c(v, {
328
328
  value: 6,
329
329
  children: "Grade 6 - 7"
330
330
  }),
331
- /* @__PURE__ */ l(v, {
331
+ /* @__PURE__ */ c(v, {
332
332
  value: 8,
333
333
  children: "Grade 8 - HS"
334
334
  }),
335
- /* @__PURE__ */ l(v, {
335
+ /* @__PURE__ */ c(v, {
336
336
  value: "geometry",
337
337
  children: "Geometry"
338
338
  }),
339
- /* @__PURE__ */ l(v, {
339
+ /* @__PURE__ */ c(v, {
340
340
  value: "advanced-algebra",
341
341
  children: "Advanced Algebra"
342
342
  }),
343
- /* @__PURE__ */ l(v, {
343
+ /* @__PURE__ */ c(v, {
344
344
  value: "statistics",
345
345
  children: "Statistics"
346
346
  }),
347
- /* @__PURE__ */ l(v, {
347
+ /* @__PURE__ */ c(v, {
348
348
  value: "item-authoring",
349
349
  children: "Item Authoring"
350
350
  })
351
351
  ]
352
352
  })
353
353
  }),
354
- re.map((n, r) => /* @__PURE__ */ l(e, {
354
+ re.map((n, r) => /* @__PURE__ */ c(e, {
355
355
  mode: A,
356
356
  response: n,
357
357
  defaultResponse: N === t.simple,
@@ -361,9 +361,9 @@ var L = class extends i.Component {
361
361
  cAllowTrailingZeros: H,
362
362
  error: Y && Y[r]
363
363
  }, n.id)),
364
- d && /* @__PURE__ */ u(O, {
364
+ d && /* @__PURE__ */ l(O, {
365
365
  label: z.label,
366
- children: [/* @__PURE__ */ l(h, {
366
+ children: [/* @__PURE__ */ c(h, {
367
367
  markup: P || "",
368
368
  onChange: this.onChange("rationale"),
369
369
  imageSupport: a,
@@ -380,7 +380,7 @@ var L = class extends i.Component {
380
380
  uploadSoundSupport: o,
381
381
  languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
382
382
  mathMlOptions: K
383
- }), J && /* @__PURE__ */ l(D, { children: J })]
383
+ }), J && /* @__PURE__ */ c(D, { children: J })]
384
384
  })
385
385
  ]
386
386
  });
@@ -26473,6 +26473,8 @@ var gj = (e) => {
26473
26473
  classes: t
26474
26474
  }) });
26475
26475
  }, _j = M("div")(() => ({
26476
+ height: 0,
26477
+ overflow: "visible",
26476
26478
  "& .defaultToolbar": {
26477
26479
  display: "flex",
26478
26480
  width: "100%",
@@ -26508,13 +26510,14 @@ var gj = (e) => {
26508
26510
  color: "var(--white)"
26509
26511
  },
26510
26512
  "& .toolbar": {
26511
- position: "absolute",
26513
+ position: "relative",
26514
+ top: "5px",
26512
26515
  zIndex: 20,
26513
26516
  cursor: "pointer",
26514
26517
  justifyContent: "space-between",
26515
26518
  background: "var(--editable-html-toolbar-bg, #efefef)",
26516
26519
  minWidth: "280px",
26517
- margin: "5px 0 0 0",
26520
+ margin: 0,
26518
26521
  padding: "2px",
26519
26522
  boxShadow: "0px 1px 5px 0px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 3px 1px -2px rgba(0, 0, 0, 0.12)",
26520
26523
  boxSizing: "border-box",
@@ -26523,7 +26526,10 @@ var gj = (e) => {
26523
26526
  pointerEvents: "none"
26524
26527
  },
26525
26528
  "& .toolbarWithNoDone": { minWidth: "265px" },
26526
- "& .toolbarTop": { top: "-45px" },
26529
+ "& .toolbarTop": {
26530
+ position: "absolute",
26531
+ top: "-45px"
26532
+ },
26527
26533
  "& .toolbarRight": { right: 0 },
26528
26534
  "& .fullWidth": { width: "100%" },
26529
26535
  "& .hidden": { visibility: "hidden" },
@@ -33195,6 +33201,8 @@ var tB = W_.create({
33195
33201
  "--red-light": "#ffebe5",
33196
33202
  "--shadow": "0px 12px 33px 0px rgba(0, 0, 0, .06),\n 0px 3.618px 9.949px 0px rgba(0, 0, 0, .04)"
33197
33203
  }, dB = (e) => ({
33204
+ role: "textbox",
33205
+ "data-pie-editor": "true",
33198
33206
  spellcheck: e ? "true" : "false",
33199
33207
  autocorrect: e ? "on" : "off",
33200
33208
  autocapitalize: e ? "on" : "off"
@@ -33361,7 +33369,10 @@ var tB = W_.create({
33361
33369
  g?.setEditable(!e.disabled);
33362
33370
  }, [e.disabled, g]), L(() => {
33363
33371
  if (!g) return;
33364
- let e = g.options?.editorProps, t = dB(h);
33372
+ let e = g.options?.editorProps, t = {
33373
+ ...e?.attributes,
33374
+ ...dB(h)
33375
+ };
33365
33376
  e?.attributes?.spellcheck !== t.spellcheck && g.setOptions({ editorProps: {
33366
33377
  ...e,
33367
33378
  attributes: t