@pie-element/explicit-constructed-response 11.1.2-next.4 → 11.1.2-next.6

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 (31) hide show
  1. package/dist/author/alternateResponses.js +2 -2
  2. package/dist/author/alternateSection.js +34 -33
  3. package/dist/author/ecr-toolbar.js +1 -1
  4. package/dist/author/index.d.ts +1 -0
  5. package/dist/author/index.js +5 -2
  6. package/dist/author/main.js +3 -3
  7. package/dist/author/markupUtils.js +1 -1
  8. package/dist/browser/author/index.js +14 -11
  9. package/dist/browser/author/index.js.map +1 -1
  10. package/dist/browser/{browser-D9pWhsjw.js → browser-xPiwYICU.js} +2 -2
  11. package/dist/browser/browser-xPiwYICU.js.map +1 -0
  12. package/dist/browser/controller/index.js +3 -3
  13. package/dist/browser/controller/index.js.map +1 -1
  14. package/dist/browser/delivery/index.js +3 -3
  15. package/dist/browser/delivery/index.js.map +1 -1
  16. package/dist/browser/{dist-D9ARZhQk.js → dist-DiGNNRzu.js} +2 -2
  17. package/dist/browser/{dist-D9ARZhQk.js.map → dist-DiGNNRzu.js.map} +1 -1
  18. package/dist/browser/{dist-BCSgqXjk.js → dist-HhpuchEj.js} +20298 -23516
  19. package/dist/browser/dist-HhpuchEj.js.map +1 -0
  20. package/dist/browser/{main-CoJAe1Fq.js → main-CsLCZ3jN.js} +11 -14
  21. package/dist/browser/main-CsLCZ3jN.js.map +1 -0
  22. package/dist/browser/print/index.js +3 -3
  23. package/dist/browser/print/index.js.map +1 -1
  24. package/dist/delivery/index.js +2 -2
  25. package/dist/delivery/main.js +1 -1
  26. package/dist/index.iife.js +109 -113
  27. package/dist/print/index.js +1 -1
  28. package/package.json +16 -10
  29. package/dist/browser/browser-D9pWhsjw.js.map +0 -1
  30. package/dist/browser/dist-BCSgqXjk.js.map +0 -1
  31. package/dist/browser/main-CoJAe1Fq.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import e from "./alternateSection.js";
1
+ import { AlternateSection as e } from "./alternateSection.js";
2
2
  import t from "react";
3
3
  import n from "prop-types";
4
4
  import { cloneDeep as r, isEqual as i, map as a, reduce as o } from "@pie-element/shared-lodash";
@@ -110,4 +110,4 @@ var l = class extends t.Component {
110
110
  }
111
111
  };
112
112
  //#endregion
113
- export { l as default };
113
+ export { l as AlternateResponses, l as default };
@@ -2,17 +2,18 @@ import { decodeHTML as e, getAdjustedLength as t, stripHtmlTags as n } from "./m
2
2
  import r from "react";
3
3
  import i from "prop-types";
4
4
  import { debounce as a, isEqual as o, max as s } from "@pie-element/shared-lodash";
5
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
6
- import { styled as u } from "@mui/material/styles";
7
- import d from "@pie-lib/editable-html-tip-tap";
8
- import f from "@mui/material/Button";
9
- import p from "@mui/icons-material/Delete";
10
- import m from "@mui/material/IconButton";
11
- import h from "@mui/material/MenuItem";
12
- import g from "@mui/material/Select";
13
- import _ from "@mui/material/TextField";
5
+ import { color as c } from "@pie-lib/render-ui";
6
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
7
+ import { styled as d } from "@mui/material/styles";
8
+ import f from "@pie-lib/editable-html-tip-tap";
9
+ import p from "@mui/material/Button";
10
+ import m from "@mui/icons-material/Delete";
11
+ import h from "@mui/material/IconButton";
12
+ import g from "@mui/material/MenuItem";
13
+ import _ from "@mui/material/Select";
14
+ import v from "@mui/material/TextField";
14
15
  //#region src/author/alternateSection.tsx
15
- var v = u("div")(({ theme: e }) => ({ marginBottom: e.spacing(.5) })), y = u("div")(({ theme: e }) => ({
16
+ var y = d("div")(({ theme: e }) => ({ marginBottom: e.spacing(.5) })), b = d("div")(({ theme: e }) => ({
16
17
  alignItems: "flex-start",
17
18
  flexDirection: "column",
18
19
  display: "flex",
@@ -21,36 +22,36 @@ var v = u("div")(({ theme: e }) => ({ marginBottom: e.spacing(.5) })), y = u("di
21
22
  marginBottom: e.spacing(2.5),
22
23
  width: "100%"
23
24
  }
24
- })), b = u(d)(({ theme: e, hasError: t }) => ({
25
+ })), x = d(f)(({ theme: e, hasError: t }) => ({
25
26
  flex: "1",
26
27
  marginRight: e.spacing(2.5),
27
28
  ...t && {
28
29
  border: `2px solid ${e.palette.error.main}`,
29
30
  borderRadius: "6px"
30
31
  }
31
- })), x = u(m)(({ theme: e }) => ({ "& svg": { fill: e.palette.grey[600] } })), S = u("div")({
32
+ })), S = d(h)(() => ({ "& svg": { fill: c.text() } })), C = d("div")({
32
33
  alignItems: "flex-end",
33
34
  display: "flex",
34
35
  justifyContent: "space-between",
35
36
  width: "100%"
36
- }), C = u("div")({
37
+ }), w = d("div")({
37
38
  alignItems: "center",
38
39
  display: "flex"
39
- }), w = u(_)(({ theme: e }) => ({
40
+ }), T = d(v)(({ theme: e }) => ({
40
41
  width: "230px",
41
42
  marginRight: e.spacing(2.5),
42
43
  "& .MuiInput-underline:before": { borderBottomColor: e.palette.divider },
43
44
  "& .MuiInput-underline:hover:not(.Mui-disabled):before": { borderBottomColor: e.palette.text.primary },
44
45
  "& .MuiInput-underline:after": { borderBottomColor: e.palette.primary.main }
45
- })), T = u("div")(({ theme: e }) => ({
46
+ })), E = d("div")(({ theme: e }) => ({
46
47
  fontSize: e.typography.fontSize - 2,
47
48
  color: e.palette.error.main,
48
49
  paddingTop: e.spacing(.5)
49
- })), E = u("div")({
50
+ })), D = d("div")({
50
51
  alignItems: "center",
51
52
  display: "flex",
52
53
  justifyContent: "space-between"
53
- }), D = class extends r.Component {
54
+ }), O = class extends r.Component {
54
55
  static propTypes = {
55
56
  error: i.string,
56
57
  markup: i.string,
@@ -75,7 +76,7 @@ var v = u("div")(({ theme: e }) => ({ marginBottom: e.spacing(.5) })), y = u("di
75
76
  };
76
77
  render() {
77
78
  let { value: e } = this.state, { onDelete: t, spellCheck: n, error: i, showMaxLength: a, pluginProps: o } = this.props, s = a ? {} : { maxLength: 25 };
78
- return /* @__PURE__ */ l(r.Fragment, { children: [/* @__PURE__ */ l(E, { children: [/* @__PURE__ */ c(b, {
79
+ return /* @__PURE__ */ u(r.Fragment, { children: [/* @__PURE__ */ u(D, { children: [/* @__PURE__ */ l(x, {
79
80
  hasError: !!i,
80
81
  disableUnderline: !0,
81
82
  onChange: this.onChange,
@@ -91,14 +92,14 @@ var v = u("div")(({ theme: e }) => ({ marginBottom: e.spacing(.5) })), y = u("di
91
92
  isHidden: !!o?.characters?.disabled
92
93
  },
93
94
  ...s
94
- }), /* @__PURE__ */ c(x, {
95
+ }), /* @__PURE__ */ l(S, {
95
96
  "aria-label": "delete",
96
97
  onClick: t,
97
98
  size: "large",
98
- children: /* @__PURE__ */ c(p, {})
99
- })] }), i && /* @__PURE__ */ c(T, { children: i })] });
99
+ children: /* @__PURE__ */ l(m, {})
100
+ })] }), i && /* @__PURE__ */ l(E, { children: i })] });
100
101
  }
101
- }, O = class extends r.Component {
102
+ }, k = class extends r.Component {
102
103
  static propTypes = {
103
104
  choices: i.array,
104
105
  selectChoices: i.array.isRequired,
@@ -161,9 +162,9 @@ var v = u("div")(({ theme: e }) => ({ marginBottom: e.spacing(.5) })), y = u("di
161
162
  n && n >= r && n <= r + 10 && t(n);
162
163
  };
163
164
  render() {
164
- let { selectChoices: t, maxLength: n, showMaxLength: r, value: i, spellCheck: a, errors: o, pluginProps: s } = this.props, { choices: u } = this.state, d = this.getChoicesMaxLength();
165
- return /* @__PURE__ */ l(v, { children: [
166
- /* @__PURE__ */ l(S, { children: [/* @__PURE__ */ l(g, {
165
+ let { selectChoices: t, maxLength: n, showMaxLength: r, value: i, spellCheck: a, errors: o, pluginProps: s } = this.props, { choices: c } = this.state, d = this.getChoicesMaxLength();
166
+ return /* @__PURE__ */ u(y, { children: [
167
+ /* @__PURE__ */ u(C, { children: [/* @__PURE__ */ u(_, {
167
168
  variant: "standard",
168
169
  displayEmpty: !0,
169
170
  onChange: this.handleSelect,
@@ -173,14 +174,14 @@ var v = u("div")(({ theme: e }) => ({ marginBottom: e.spacing(.5) })), y = u("di
173
174
  enter: 225,
174
175
  exit: 195
175
176
  } },
176
- children: [/* @__PURE__ */ c(h, {
177
+ children: [/* @__PURE__ */ l(g, {
177
178
  value: "",
178
- children: /* @__PURE__ */ c("em", { children: i ? "Remove selection" : "Select a response" })
179
- }), t.map((t, n) => /* @__PURE__ */ c(h, {
179
+ children: /* @__PURE__ */ l("em", { children: i ? "Remove selection" : "Select a response" })
180
+ }), t.map((t, n) => /* @__PURE__ */ l(g, {
180
181
  value: t?.value,
181
182
  children: e(t?.label)
182
183
  }, n))]
183
- }), u && u.length > 0 && /* @__PURE__ */ l(C, { children: [n && r && /* @__PURE__ */ c(w, {
184
+ }), c && c.length > 0 && /* @__PURE__ */ u(w, { children: [n && r && /* @__PURE__ */ l(T, {
184
185
  variant: "standard",
185
186
  label: "Maximum length (characters)",
186
187
  type: "number",
@@ -190,14 +191,14 @@ var v = u("div")(({ theme: e }) => ({ marginBottom: e.spacing(.5) })), y = u("di
190
191
  },
191
192
  value: n,
192
193
  onChange: this.changeLength
193
- }), /* @__PURE__ */ c(f, {
194
+ }), /* @__PURE__ */ l(p, {
194
195
  variant: "contained",
195
196
  color: "primary",
196
197
  onClick: this.onAddChoice,
197
198
  children: "Add"
198
199
  })] })] }),
199
- o && o[0] && /* @__PURE__ */ c(T, { children: o[0] }),
200
- /* @__PURE__ */ c(y, { children: u && u.map((e, t) => t > 0 && /* @__PURE__ */ c(D, {
200
+ o && o[0] && /* @__PURE__ */ l(E, { children: o[0] }),
201
+ /* @__PURE__ */ l(b, { children: c && c.map((e, t) => t > 0 && /* @__PURE__ */ l(O, {
201
202
  markup: e.label,
202
203
  onChange: (n) => this.onChoiceChanged(e, n, t),
203
204
  onDelete: () => this.onRemoveChoice(e),
@@ -210,4 +211,4 @@ var v = u("div")(({ theme: e }) => ({ marginBottom: e.spacing(.5) })), y = u("di
210
211
  }
211
212
  };
212
213
  //#endregion
213
- export { O as default };
214
+ export { k as AlternateSection, k as default, O as Choice };
@@ -97,4 +97,4 @@ var o = i(a)(({ theme: e }) => ({
97
97
  }
98
98
  };
99
99
  //#endregion
100
- export { s as default };
100
+ export { s as ECRToolbar, s as default };
@@ -38,5 +38,6 @@ export default class ExplicitConstructedResponse extends HTMLElement {
38
38
  insertSound(handler: any): void;
39
39
  onDeleteSound(src: any, done: any): void;
40
40
  _render(): void;
41
+ connectedCallback(): void;
41
42
  disconnectedCallback(): void;
42
43
  }
@@ -1,5 +1,5 @@
1
1
  import { createSlateMarkup as e, processMarkup as t } from "./markupUtils.js";
2
- import n from "./main.js";
2
+ import { Main as n } from "./main.js";
3
3
  import r from "./defaults.js";
4
4
  import i from "react";
5
5
  import { createRoot as a } from "react-dom/client";
@@ -88,8 +88,11 @@ var m = c("explicit-constructed-response:configure"), h = class c extends HTMLEl
88
88
  });
89
89
  this._root ||= a(this), this._root.render(e);
90
90
  }
91
+ connectedCallback() {
92
+ this._render();
93
+ }
91
94
  disconnectedCallback() {
92
- this._root && this._root.unmount();
95
+ this._root &&= (this._root.unmount(), null);
93
96
  }
94
97
  };
95
98
  //#endregion
@@ -1,6 +1,6 @@
1
1
  import { decodeHTML as e, getAdjustedLength as t } from "./markupUtils.js";
2
- import n from "./ecr-toolbar.js";
3
- import r from "./alternateResponses.js";
2
+ import { ECRToolbar as n } from "./ecr-toolbar.js";
3
+ import { AlternateResponses as r } from "./alternateResponses.js";
4
4
  import { generateValidationMessage as i } from "./utils.js";
5
5
  import a from "react";
6
6
  import o from "prop-types";
@@ -288,4 +288,4 @@ var { toggle: y, Panel: re, dropdown: ie } = g, b = p(h)(({ theme: e }) => ({
288
288
  }
289
289
  };
290
290
  //#endregion
291
- export { w as default };
291
+ export { w as Main, w as default };
@@ -10,4 +10,4 @@ var t = "imes|riangle|an|heta|herefore", n = "throot|parallel|cong|approx|eq|e|s
10
10
  }), t.innerHTML;
11
11
  }, s = /\{\{(\d+)\}\}/g, c = (t, n) => t ? i(t).replace(s, (t, r) => `<span data-type="explicit_constructed_response" data-index="${r}" data-value="${e(n[r][0].label || "")}"></span>`) : "", l = (e) => e <= 2 ? e + 2 : e <= 4 ? e + 3 : e <= 6 ? e + 4 : e + 5, u = (e) => typeof e == "string" ? e.replace(/<\/?[^>]+(>|$)/g, "") : "", d = (e) => new DOMParser().parseFromString(e, "text/html").body.textContent || "";
12
12
  //#endregion
13
- export { c as createSlateMarkup, d as decodeHTML, l as getAdjustedLength, o as processMarkup, u as stripHtmlTags };
13
+ export { c as createSlateMarkup, d as decodeHTML, l as getAdjustedLength, o as processMarkup, i as removeUnwantedCharacters, u as stripHtmlTags };
@@ -1,5 +1,5 @@
1
- import { E as e, S as t, a as n, b as r, c as i, h as a, i as o, l as s, m as c, n as l, o as u, p as d, r as f, s as p, t as m, u as h, v as g } from "../browser-D9pWhsjw.js";
2
- import { $ as _, A as v, B as y, D as b, E as x, F as S, H as C, I as w, J as T, K as E, L as D, M as O, N as k, P as A, Q as j, R as M, S as N, T as P, U as F, V as ee, W as I, X as te, Y as ne, Z as re, a as ie, b as L, c as ae, d as oe, et as R, f as se, i as z, it as ce, j as le, k as ue, l as B, n as de, nt as fe, o as pe, p as me, q as V, r as he, rt as ge, s as _e, t as H, tt as U, u as ve, v as ye, w as be, x as xe, y as Se, z as Ce } from "../dist-BCSgqXjk.js";
1
+ import { E as e, S as t, a as n, b as r, c as i, h as a, i as o, l as s, m as c, n as l, o as u, p as d, r as f, s as p, t as m, u as h, v as g } from "../browser-xPiwYICU.js";
2
+ import { $ as _, A as v, B as y, D as b, E as x, F as S, H as C, I as w, J as T, K as E, L as D, M as O, N as k, P as A, Q as j, R as M, S as N, T as P, U as F, V as ee, W as I, X as te, Y as ne, Z as re, a as ie, b as L, c as ae, d as oe, et as R, f as se, i as z, it as ce, j as le, k as ue, l as B, n as de, nt as fe, o as pe, p as me, q as V, r as he, rt as ge, s as _e, t as H, tt as U, u as ve, v as ye, w as be, x as xe, y as Se, z as Ce } from "../dist-HhpuchEj.js";
3
3
  import * as W from "react";
4
4
  import G, { Component as we, createElement as Te } from "react";
5
5
  import { createRoot as Ee } from "react-dom/client";
@@ -1683,7 +1683,7 @@ var ln = Object.defineProperty, un = (e, t) => {
1683
1683
  }
1684
1684
  };
1685
1685
  //#endregion
1686
- //#region ../../lib-react/config-ui/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/extends.js
1686
+ //#region ../../lib-react/config-ui/dist/node_modules/.bun/@babel_runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/extends.js
1687
1687
  function _n() {
1688
1688
  return _n = Object.assign ? Object.assign.bind() : function(e) {
1689
1689
  for (var t = 1; t < arguments.length; t++) {
@@ -1694,7 +1694,7 @@ function _n() {
1694
1694
  }, _n.apply(null, arguments);
1695
1695
  }
1696
1696
  //#endregion
1697
- //#region ../../lib-react/config-ui/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
1697
+ //#region ../../lib-react/config-ui/dist/node_modules/.bun/@babel_runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
1698
1698
  function vn(e, t) {
1699
1699
  if (e == null) return {};
1700
1700
  var n = {};
@@ -1705,14 +1705,14 @@ function vn(e, t) {
1705
1705
  return n;
1706
1706
  }
1707
1707
  //#endregion
1708
- //#region ../../lib-react/config-ui/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
1708
+ //#region ../../lib-react/config-ui/dist/node_modules/.bun/@babel_runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
1709
1709
  function yn(e, t) {
1710
1710
  return yn = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {
1711
1711
  return e.__proto__ = t, e;
1712
1712
  }, yn(e, t);
1713
1713
  }
1714
1714
  //#endregion
1715
- //#region ../../lib-react/config-ui/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js
1715
+ //#region ../../lib-react/config-ui/dist/node_modules/.bun/@babel_runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js
1716
1716
  function bn(e, t) {
1717
1717
  e.prototype = Object.create(t.prototype), e.prototype.constructor = e, yn(e, t);
1718
1718
  }
@@ -2105,9 +2105,9 @@ var tr = er()(function(e) {
2105
2105
  tr.displayName = "Measure", tr.propTypes.children = Q.default.func;
2106
2106
  //#endregion
2107
2107
  //#region ../../lib-react/config-ui/dist/layout/settings-box.js
2108
- var nr = V("div")(({ theme: e }) => ({
2109
- backgroundColor: e.palette.background.paper,
2110
- border: `2px solid ${e.palette.grey[200]}`,
2108
+ var nr = V("div")(() => ({
2109
+ backgroundColor: I.white(),
2110
+ border: `2px solid ${I.border()}`,
2111
2111
  display: "flex",
2112
2112
  flexDirection: "column",
2113
2113
  justifyContent: "flex-start",
@@ -2603,7 +2603,7 @@ var Jr = qr(ye, "InputContainer") || qr(Zr.InputContainer, "InputContainer"), Yr
2603
2603
  border: `2px solid ${e.palette.error.main}`,
2604
2604
  borderRadius: "6px"
2605
2605
  }
2606
- })), hi = V(oe)(({ theme: e }) => ({ "& svg": { fill: e.palette.grey[600] } })), gi = V("div")({
2606
+ })), hi = V(oe)(() => ({ "& svg": { fill: I.text() } })), gi = V("div")({
2607
2607
  alignItems: "flex-end",
2608
2608
  display: "flex",
2609
2609
  justifyContent: "space-between",
@@ -3368,8 +3368,11 @@ var Jr = qr(ye, "InputContainer") || qr(Zr.InputContainer, "InputContainer"), Yr
3368
3368
  });
3369
3369
  this._root ||= Ee(this), this._root.render(e);
3370
3370
  }
3371
+ connectedCallback() {
3372
+ this._render();
3373
+ }
3371
3374
  disconnectedCallback() {
3372
- this._root && this._root.unmount();
3375
+ this._root &&= (this._root.unmount(), null);
3373
3376
  }
3374
3377
  };
3375
3378
  //#endregion