@pie-element/match 12.4.0-beta.7 → 13.0.0-next.20261002094057

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 (110) hide show
  1. package/author.js +2 -0
  2. package/configure.js +2 -0
  3. package/controller.js +1 -0
  4. package/dist/author/add-row.d.ts +17 -0
  5. package/dist/author/add-row.js +24 -0
  6. package/dist/author/answer-config-block.d.ts +36 -0
  7. package/dist/author/answer-config-block.js +177 -0
  8. package/dist/author/configure.d.ts +48 -0
  9. package/dist/author/configure.js +259 -0
  10. package/dist/author/defaults.d.ts +203 -0
  11. package/dist/author/defaults.js +151 -0
  12. package/dist/author/general-config-block.d.ts +22 -0
  13. package/dist/author/general-config-block.js +93 -0
  14. package/dist/author/index.d.ts +45 -0
  15. package/dist/author/index.js +79 -0
  16. package/dist/author/row.d.ts +51 -0
  17. package/dist/author/row.js +208 -0
  18. package/dist/author/utils.d.ts +10 -0
  19. package/dist/author/utils.js +10 -0
  20. package/dist/browser/Typography-C2S9t4p_.js +9414 -0
  21. package/dist/browser/Typography-C2S9t4p_.js.map +1 -0
  22. package/dist/browser/assets/Symbola-4c507403.woff2 +0 -0
  23. package/dist/browser/author/index.js +36948 -0
  24. package/dist/browser/author/index.js.map +1 -0
  25. package/dist/browser/browser-kkT1XVKw.js +219 -0
  26. package/dist/browser/browser-kkT1XVKw.js.map +1 -0
  27. package/dist/browser/controller/index.js +267 -0
  28. package/dist/browser/controller/index.js.map +1 -0
  29. package/dist/browser/delivery/index.js +2092 -0
  30. package/dist/browser/delivery/index.js.map +1 -0
  31. package/dist/browser/dist-C4gh2n2Z.js +104 -0
  32. package/dist/browser/dist-C4gh2n2Z.js.map +1 -0
  33. package/dist/browser/editor-runtime/Typography-CyFhrWHw.js +9414 -0
  34. package/dist/browser/editor-runtime/Typography-CyFhrWHw.js.map +1 -0
  35. package/dist/browser/editor-runtime/assets/Symbola-4c507403.woff2 +0 -0
  36. package/dist/browser/editor-runtime/author/index.js +20539 -0
  37. package/dist/browser/editor-runtime/author/index.js.map +1 -0
  38. package/dist/browser/editor-runtime/browser-jJGxjKdp.js +219 -0
  39. package/dist/browser/editor-runtime/browser-jJGxjKdp.js.map +1 -0
  40. package/dist/browser/editor-runtime/controller/index.js +267 -0
  41. package/dist/browser/editor-runtime/controller/index.js.map +1 -0
  42. package/dist/browser/editor-runtime/delivery/index.js +2092 -0
  43. package/dist/browser/editor-runtime/delivery/index.js.map +1 -0
  44. package/dist/browser/editor-runtime/dist-C4gh2n2Z.js +104 -0
  45. package/dist/browser/editor-runtime/dist-C4gh2n2Z.js.map +1 -0
  46. package/dist/controller/defaults.d.ts +27 -0
  47. package/dist/controller/defaults.js +25 -0
  48. package/dist/controller/index.d.ts +29 -0
  49. package/dist/controller/index.js +154 -0
  50. package/dist/delivery/answer-grid.d.ts +29 -0
  51. package/dist/delivery/answer-grid.js +107 -0
  52. package/dist/delivery/index.d.ts +21 -0
  53. package/dist/delivery/index.js +51 -0
  54. package/dist/delivery/main.d.ts +26 -0
  55. package/dist/delivery/main.js +112 -0
  56. package/dist/index.d.ts +1 -0
  57. package/dist/index.iife.d.ts +8 -0
  58. package/dist/index.iife.js +148 -0
  59. package/dist/index.js +2 -0
  60. package/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js +16 -0
  61. package/dist/runtime-support.d.ts +12 -0
  62. package/dist/runtime-support.js +12 -0
  63. package/package.json +96 -22
  64. package/CHANGELOG.json +0 -1462
  65. package/CHANGELOG.md +0 -2380
  66. package/LICENSE.md +0 -5
  67. package/README.md +0 -1
  68. package/configure/CHANGELOG.json +0 -892
  69. package/configure/CHANGELOG.md +0 -2083
  70. package/configure/lib/add-row.js +0 -40
  71. package/configure/lib/add-row.js.map +0 -1
  72. package/configure/lib/answer-config-block.js +0 -288
  73. package/configure/lib/answer-config-block.js.map +0 -1
  74. package/configure/lib/common.js +0 -31
  75. package/configure/lib/common.js.map +0 -1
  76. package/configure/lib/configure.js +0 -410
  77. package/configure/lib/configure.js.map +0 -1
  78. package/configure/lib/defaults.js +0 -201
  79. package/configure/lib/defaults.js.map +0 -1
  80. package/configure/lib/general-config-block.js +0 -144
  81. package/configure/lib/general-config-block.js.map +0 -1
  82. package/configure/lib/index.js +0 -156
  83. package/configure/lib/index.js.map +0 -1
  84. package/configure/lib/row.js +0 -321
  85. package/configure/lib/row.js.map +0 -1
  86. package/configure/lib/utils.js +0 -12
  87. package/configure/lib/utils.js.map +0 -1
  88. package/configure/package.json +0 -29
  89. package/configure/utils.js +0 -19
  90. package/controller/CHANGELOG.json +0 -502
  91. package/controller/CHANGELOG.md +0 -1405
  92. package/controller/lib/defaults.js +0 -25
  93. package/controller/lib/defaults.js.map +0 -1
  94. package/controller/lib/index.js +0 -424
  95. package/controller/lib/index.js.map +0 -1
  96. package/controller/package.json +0 -24
  97. package/docs/config-schema.json +0 -2929
  98. package/docs/config-schema.json.md +0 -2162
  99. package/docs/demo/config.js +0 -8
  100. package/docs/demo/generate.js +0 -49
  101. package/docs/demo/index.html +0 -1
  102. package/docs/demo/session.js +0 -11
  103. package/docs/pie-schema.json +0 -1530
  104. package/docs/pie-schema.json.md +0 -907
  105. package/lib/answer-grid.js +0 -166
  106. package/lib/answer-grid.js.map +0 -1
  107. package/lib/index.js +0 -86
  108. package/lib/index.js.map +0 -1
  109. package/lib/main.js +0 -163
  110. package/lib/main.js.map +0 -1
@@ -0,0 +1,208 @@
1
+ import e from "react";
2
+ import t from "prop-types";
3
+ import { color as n } from "@pie-lib/render-ui";
4
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
+ import a from "@mui/material/Radio";
6
+ import { styled as o } from "@mui/material/styles";
7
+ import s from "debug";
8
+ import { AlertDialog as c, Checkbox as l } from "@pie-lib/config-ui";
9
+ import u, { DEFAULT_PLUGINS as d } from "@pie-lib/editable-html-tip-tap";
10
+ import f from "@mui/icons-material/DragHandle";
11
+ import p from "@mui/material/IconButton";
12
+ import m from "@mui/icons-material/Delete";
13
+ import { useDraggable as h, useDroppable as g } from "@dnd-kit/core";
14
+ //#region src/author/row.tsx
15
+ s("@pie-element:categorize:configure:choice");
16
+ var _ = !1, v = o("span")({ cursor: "move" }), y = o("div")(({ theme: e }) => ({
17
+ marginTop: e.spacing(2),
18
+ display: "flex",
19
+ alignItems: "center",
20
+ flex: 1
21
+ })), b = o("div")(({ theme: e }) => ({
22
+ flex: 1,
23
+ display: "flex",
24
+ justifyContent: "center",
25
+ alignItems: "center",
26
+ minWidth: "120px",
27
+ padding: `0 ${e.spacing(1)}`
28
+ })), x = o(a)(({ theme: e, error: t }) => ({
29
+ "& input": { width: "100% !important" },
30
+ "&.MuiRadio-root": { color: `${t ? e.palette.error.main : n.tertiary()} !important` }
31
+ })), S = o("div")(({ theme: e }) => ({
32
+ flex: .5,
33
+ display: "flex",
34
+ justifyContent: "center",
35
+ minWidth: "45px",
36
+ padding: `0 ${e.spacing(1)}`
37
+ })), C = o(b)(({ theme: e }) => ({
38
+ flex: 2,
39
+ display: "flex",
40
+ justifyContent: "flex-start",
41
+ padding: 0,
42
+ maxWidth: "unset",
43
+ textAlign: "left",
44
+ minWidth: "200px",
45
+ marginRight: e.spacing(1),
46
+ "&> div": { width: "100%" }
47
+ })), w = o("hr")(({ theme: e }) => ({
48
+ marginTop: e.spacing(2),
49
+ border: 0,
50
+ borderTop: `2px solid ${n.border()}`,
51
+ width: "100%"
52
+ })), T = o("div")(({ theme: e }) => ({
53
+ fontSize: e.typography.fontSize - 2,
54
+ color: e.palette.error.main,
55
+ paddingTop: e.spacing(1)
56
+ })), E = class extends e.Component {
57
+ static propTypes = {
58
+ model: t.object.isRequired,
59
+ row: t.object.isRequired,
60
+ idx: t.number.isRequired,
61
+ maxImageWidth: t.object,
62
+ maxImageHeight: t.object,
63
+ onDeleteRow: t.func.isRequired,
64
+ onChange: t.func.isRequired,
65
+ imageSupport: t.shape({
66
+ add: t.func.isRequired,
67
+ delete: t.func.isRequired
68
+ }),
69
+ uploadSoundSupport: t.shape({
70
+ add: t.func.isRequired,
71
+ delete: t.func.isRequired
72
+ }),
73
+ inputConfiguration: t.object,
74
+ toolbarOpts: t.object,
75
+ error: t.string,
76
+ spellCheck: t.bool,
77
+ minQuestions: t.number
78
+ };
79
+ static defaultProps = {};
80
+ state = { dialog: {
81
+ open: !1,
82
+ text: ""
83
+ } };
84
+ componentDidMount() {
85
+ document.addEventListener("mouseup", this.onMouseUpOnHandle);
86
+ }
87
+ onRowTitleChange = (e) => (t) => {
88
+ let { model: n, onChange: r } = this.props, i = { ...n };
89
+ i.rows[e].title = t, r(i);
90
+ };
91
+ onRowValueChange = (e, t) => (n) => {
92
+ let { model: r, onChange: i } = this.props, a = { ...r };
93
+ if (r.choiceMode === "radio") for (let t = 0; t < a.rows[e].values.length; t++) a.rows[e].values[t] = !1;
94
+ a.rows[e].values[t] = n.target.checked, i(a);
95
+ };
96
+ onDeleteRow = (e) => () => {
97
+ let { model: t, onDeleteRow: n, minQuestions: r } = this.props;
98
+ t.rows && t.rows.length === r ? this.setState({ dialog: {
99
+ open: !0,
100
+ text: `There should be at least ${r} question row` + (r > 1 ? "s" : "") + "."
101
+ } }) : n(e);
102
+ };
103
+ onMouseDownOnHandle = () => {
104
+ _ = !0;
105
+ };
106
+ onMouseUpOnHandle = () => {
107
+ _ = !1;
108
+ };
109
+ render() {
110
+ let { imageSupport: e, model: t, row: n, idx: a, inputConfiguration: o = {}, toolbarOpts: s, spellCheck: h, error: g, maxImageWidth: _, maxImageHeight: E, uploadSoundSupport: D, mathMlOptions: O = {} } = this.props, { dialog: k } = this.state, A = (d || []).filter((e) => e !== "bulleted-list" && e !== "numbered-list");
111
+ return /* @__PURE__ */ i("div", {
112
+ style: { width: "100%" },
113
+ children: [
114
+ /* @__PURE__ */ r(v, {
115
+ itemID: "handle",
116
+ onMouseDown: this.onMouseDownOnHandle,
117
+ children: /* @__PURE__ */ r(f, { color: "primary" })
118
+ }),
119
+ /* @__PURE__ */ i(y, { children: [
120
+ /* @__PURE__ */ r(C, { children: /* @__PURE__ */ r(u, {
121
+ imageSupport: e,
122
+ autoWidthToolbar: !0,
123
+ disableUnderline: !0,
124
+ label: "label",
125
+ markup: n.title,
126
+ onChange: this.onRowTitleChange(a),
127
+ pluginProps: o,
128
+ toolbarOpts: s,
129
+ activePlugins: A,
130
+ spellCheck: h,
131
+ maxImageWidth: _,
132
+ maxImageHeight: E,
133
+ uploadSoundSupport: D,
134
+ languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
135
+ error: g && g !== "No correct response defined.",
136
+ mathMlOptions: O
137
+ }) }),
138
+ n.values.map((e, n) => /* @__PURE__ */ r(b, { children: t.choiceMode === "radio" ? /* @__PURE__ */ r(x, {
139
+ error: g?.includes("No correct response defined."),
140
+ onChange: this.onRowValueChange(a, n),
141
+ checked: e === !0
142
+ }) : /* @__PURE__ */ r(l, {
143
+ onChange: this.onRowValueChange(a, n),
144
+ checked: e === !0,
145
+ label: "",
146
+ error: g?.includes("No correct response defined.")
147
+ }) }, n)),
148
+ /* @__PURE__ */ r(S, { children: /* @__PURE__ */ r(p, {
149
+ onClick: this.onDeleteRow(a),
150
+ "aria-label": "Delete",
151
+ size: "large",
152
+ children: /* @__PURE__ */ r(m, {})
153
+ }) })
154
+ ] }),
155
+ g && /* @__PURE__ */ r(T, { children: g }),
156
+ /* @__PURE__ */ r(w, {}),
157
+ /* @__PURE__ */ r(c, {
158
+ open: k.open,
159
+ title: "Warning",
160
+ text: k.text,
161
+ onConfirm: () => this.setState({ dialog: { open: !1 } })
162
+ })
163
+ ]
164
+ });
165
+ }
166
+ };
167
+ function D(e) {
168
+ let { attributes: t, listeners: n, setNodeRef: i, transform: a, transition: o, isDragging: s } = h({
169
+ id: `row-${e.row.id}`,
170
+ data: {
171
+ type: "row",
172
+ index: e.idx,
173
+ id: e.row.id
174
+ }
175
+ }), { setNodeRef: c, isOver: l } = g({
176
+ id: `row-drop-${e.row.id}`,
177
+ data: {
178
+ type: "row",
179
+ index: e.idx,
180
+ id: e.row.id
181
+ }
182
+ });
183
+ return /* @__PURE__ */ r("div", {
184
+ ref: c,
185
+ style: {
186
+ transform: a ? `translate3d(${a.x}px, ${a.y}px, 0)` : void 0,
187
+ transition: o,
188
+ opacity: s ? .5 : 1,
189
+ backgroundColor: l ? "rgba(0, 0, 0, 0.1)" : "transparent"
190
+ },
191
+ children: /* @__PURE__ */ r("div", {
192
+ ref: i,
193
+ ...n,
194
+ onKeyDown: (e) => {
195
+ let t = e.target;
196
+ t.closest("[contenteditable]") || t.closest("input") || t.closest("textarea") || t.isContentEditable || n?.onKeyDown?.(e);
197
+ },
198
+ onPointerDown: (e) => {
199
+ let t = e.target;
200
+ t.closest("[contenteditable]") || t.closest("input") || t.closest("textarea") || t.isContentEditable || n?.onPointerDown?.(e);
201
+ },
202
+ ...t,
203
+ children: /* @__PURE__ */ r(E, { ...e })
204
+ })
205
+ });
206
+ }
207
+ //#endregion
208
+ export { E as Row, _ as canDrag, D as default };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @synced-from pie-elements/packages/match/configure/src/utils.js
3
+ * @auto-generated
4
+ *
5
+ * This file is automatically synced from pie-elements and converted to TypeScript.
6
+ * Manual edits will be overwritten on next sync.
7
+ * To make changes, edit the upstream JavaScript file and run sync again.
8
+ */
9
+ export declare const getPluginProps: (props?: {}, baseInputConfiguration?: {}) => {};
10
+ export declare const generateValidationMessage: (model: any, configuration: any) => string;
@@ -0,0 +1,10 @@
1
+ //#region src/author/utils.ts
2
+ var e = (e = {}, t = {}) => ({
3
+ ...t,
4
+ ...e
5
+ }), t = (e, t) => {
6
+ let { choiceMode: n } = e, { minQuestions: r, maxQuestions: i, maxAnswers: a } = t, o = `\nThere should be at least ${r}` + (i ? ` and at most ${i}` : "") + " question row" + (r > 1 || i ? "s." : ".") + "\nRow and column headings should be non-blank and unique. \nFirst column heading is excluded from validation." + (a ? `\nThere should be at most ${a} answer choices.` : ""), s = n === "radio" ? "\nThere should be a correct response defined for every row." : "\nThere should be at least one correct response defined for every row.";
7
+ return "Validation requirements:" + o + s;
8
+ };
9
+ //#endregion
10
+ export { t as generateValidationMessage, e as getPluginProps };