@pie-element/drag-in-the-blank 10.1.2-next.4 → 10.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.
- package/dist/author/choice.js +43 -42
- package/dist/author/choices.js +12 -9
- package/dist/author/index.d.ts +1 -0
- package/dist/author/index.js +5 -2
- package/dist/author/main.js +3 -3
- package/dist/author/markupUtils.js +1 -1
- package/dist/browser/author/index.js +18448 -21619
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/controller/index.js +3 -3
- package/dist/browser/controller/index.js.map +1 -1
- package/dist/browser/delivery/index.js +893 -739
- package/dist/browser/delivery/index.js.map +1 -1
- package/dist/browser/{dist-Ct4HeHUM.js → dist-CqufoV2m.js} +2 -2
- package/dist/browser/dist-CqufoV2m.js.map +1 -0
- package/dist/browser/{drag-provider-aGtmUbQG.js → drag-provider-BbQMM4wo.js} +3030 -3082
- package/dist/browser/drag-provider-BbQMM4wo.js.map +1 -0
- package/dist/browser/rolldown-runtime-CWhphoD1.js +32 -0
- package/dist/delivery/index.js +4 -4
- package/dist/delivery/main.js +1 -1
- package/dist/index.iife.js +35 -35
- package/package.json +14 -9
- package/dist/browser/dist-Ct4HeHUM.js.map +0 -1
- package/dist/browser/drag-provider-aGtmUbQG.js.map +0 -1
package/dist/author/choice.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { choiceIsEmpty as e } from "./markupUtils.js";
|
|
2
2
|
import "react";
|
|
3
|
-
import t from "
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import o from "@
|
|
8
|
-
import s from "@mui/icons-material/
|
|
3
|
+
import { color as t } from "@pie-lib/render-ui";
|
|
4
|
+
import n from "prop-types";
|
|
5
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
6
|
+
import { styled as a } from "@mui/material/styles";
|
|
7
|
+
import { useDraggable as o } from "@dnd-kit/core";
|
|
8
|
+
import s from "@mui/icons-material/MoreVert";
|
|
9
|
+
import c from "@mui/icons-material/Delete";
|
|
9
10
|
//#region src/author/choice.tsx
|
|
10
|
-
var
|
|
11
|
+
var l = ({ style: e }) => /* @__PURE__ */ i("span", {
|
|
11
12
|
style: e,
|
|
12
|
-
children: [/* @__PURE__ */
|
|
13
|
+
children: [/* @__PURE__ */ r(s, { style: { margin: "0 -16px" } }), /* @__PURE__ */ r(s, {})]
|
|
13
14
|
});
|
|
14
|
-
|
|
15
|
-
var
|
|
15
|
+
l.propTypes = { style: n.object };
|
|
16
|
+
var u = a("div", { shouldForwardProp: (e) => !["error", "isDragging"].includes(e) })(({ theme: e, error: n }) => ({
|
|
16
17
|
display: "inline-flex",
|
|
17
18
|
minWidth: "178px",
|
|
18
19
|
minHeight: "36px",
|
|
@@ -23,66 +24,66 @@ var l = i("div", { shouldForwardProp: (e) => !["error", "isDragging"].includes(e
|
|
|
23
24
|
position: "relative",
|
|
24
25
|
padding: "8px 35px 8px 35px",
|
|
25
26
|
cursor: "grab",
|
|
26
|
-
border: `1px solid ${
|
|
27
|
+
border: `1px solid ${n ? "#f44336" : t.border()}`,
|
|
27
28
|
"& img": { display: "flex" },
|
|
28
29
|
"& p": { margin: 0 },
|
|
29
30
|
"& mjx-frac": { fontSize: "120% !important" }
|
|
30
|
-
})),
|
|
31
|
+
})), d = a(c)(({ theme: e }) => ({
|
|
31
32
|
position: "absolute",
|
|
32
33
|
top: "6px",
|
|
33
34
|
right: "0",
|
|
34
|
-
color:
|
|
35
|
+
color: t.text(),
|
|
35
36
|
zIndex: 2,
|
|
36
37
|
"&:hover": {
|
|
37
38
|
cursor: "pointer",
|
|
38
39
|
color: e.palette.common.black
|
|
39
40
|
}
|
|
40
|
-
})),
|
|
41
|
-
let { choice:
|
|
42
|
-
id: `choice-${
|
|
41
|
+
})), f = (n) => {
|
|
42
|
+
let { choice: a, onClick: s, onRemoveChoice: c, error: f, instanceId: p, disabled: m } = n, { attributes: h, listeners: g, setNodeRef: _, isDragging: v } = o({
|
|
43
|
+
id: `choice-${a.id}-${p || "default"}`,
|
|
43
44
|
data: {
|
|
44
45
|
type: "drag-in-the-blank-choice",
|
|
45
|
-
id:
|
|
46
|
-
value:
|
|
47
|
-
instanceId:
|
|
46
|
+
id: a.id,
|
|
47
|
+
value: a,
|
|
48
|
+
instanceId: p
|
|
48
49
|
},
|
|
49
|
-
disabled:
|
|
50
|
-
}),
|
|
51
|
-
if (e(
|
|
50
|
+
disabled: m || e(a)
|
|
51
|
+
}), y = (t) => {
|
|
52
|
+
if (e(a)) {
|
|
52
53
|
t.preventDefault(), alert("You need to define a value for an answer choice before it can be associated with a response area.");
|
|
53
54
|
return;
|
|
54
55
|
}
|
|
55
56
|
};
|
|
56
|
-
return /* @__PURE__ */
|
|
57
|
-
ref:
|
|
58
|
-
error:
|
|
59
|
-
isDragging:
|
|
60
|
-
onClick:
|
|
61
|
-
...m,
|
|
57
|
+
return /* @__PURE__ */ i(u, {
|
|
58
|
+
ref: _,
|
|
59
|
+
error: f,
|
|
60
|
+
isDragging: v,
|
|
61
|
+
onClick: s,
|
|
62
62
|
...h,
|
|
63
|
-
|
|
63
|
+
...g,
|
|
64
|
+
onDragStart: y,
|
|
64
65
|
children: [
|
|
65
|
-
/* @__PURE__ */
|
|
66
|
+
/* @__PURE__ */ r(l, { style: {
|
|
66
67
|
position: "absolute",
|
|
67
68
|
top: "6px",
|
|
68
69
|
left: "15px",
|
|
69
|
-
color:
|
|
70
|
+
color: t.borderGray(),
|
|
70
71
|
zIndex: 2
|
|
71
72
|
} }),
|
|
72
|
-
/* @__PURE__ */
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
e.preventDefault(), e.stopPropagation(),
|
|
73
|
+
/* @__PURE__ */ r("span", { dangerouslySetInnerHTML: { __html: a.value } }),
|
|
74
|
+
/* @__PURE__ */ r(d, { onClick: (e) => {
|
|
75
|
+
e.preventDefault(), e.stopPropagation(), c(e);
|
|
75
76
|
} })
|
|
76
77
|
]
|
|
77
78
|
});
|
|
78
79
|
};
|
|
79
|
-
|
|
80
|
-
choice:
|
|
81
|
-
onClick:
|
|
82
|
-
onRemoveChoice:
|
|
83
|
-
error:
|
|
84
|
-
instanceId:
|
|
85
|
-
disabled:
|
|
80
|
+
f.propTypes = {
|
|
81
|
+
choice: n.object.isRequired,
|
|
82
|
+
onClick: n.func,
|
|
83
|
+
onRemoveChoice: n.func.isRequired,
|
|
84
|
+
error: n.bool,
|
|
85
|
+
instanceId: n.string,
|
|
86
|
+
disabled: n.bool
|
|
86
87
|
};
|
|
87
88
|
//#endregion
|
|
88
|
-
export {
|
|
89
|
+
export { f as BlankContent, f as default };
|
package/dist/author/choices.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { choiceIsEmpty as e } from "./markupUtils.js";
|
|
2
|
-
import t from "./choice.js";
|
|
2
|
+
import { BlankContent as t } from "./choice.js";
|
|
3
3
|
import n from "react";
|
|
4
4
|
import { renderMath as r } from "@pie-element/shared-math-rendering-mathjax";
|
|
5
5
|
import i from "prop-types";
|
|
@@ -76,13 +76,16 @@ var d = s("div")(({ theme: e }) => ({
|
|
|
76
76
|
}
|
|
77
77
|
i(l);
|
|
78
78
|
};
|
|
79
|
-
onChoiceDone = (t) => {
|
|
80
|
-
let { onChange:
|
|
81
|
-
if (!
|
|
82
|
-
|
|
79
|
+
onChoiceDone = (t, n) => {
|
|
80
|
+
let { onChange: r, model: i } = this.props, { choices: a } = i, o = (a || []).find((e) => e.id === t), s = n === void 0 ? o && o.value : n;
|
|
81
|
+
if (!o || !e({ value: s })) {
|
|
82
|
+
o && o.value !== s && r((a || []).map((e) => e.id === t ? {
|
|
83
|
+
...e,
|
|
84
|
+
value: s
|
|
85
|
+
} : e)), this.setState({ focusedEl: void 0 });
|
|
83
86
|
return;
|
|
84
87
|
}
|
|
85
|
-
|
|
88
|
+
r((a || []).filter((e) => e.id !== t)), this.setState({
|
|
86
89
|
focusedEl: void 0,
|
|
87
90
|
warning: {
|
|
88
91
|
open: !0,
|
|
@@ -135,8 +138,8 @@ var d = s("div")(({ theme: e }) => ({
|
|
|
135
138
|
onChange: (e) => {
|
|
136
139
|
this.preventDone || this.onChoiceChanged(n.value, e, n.id);
|
|
137
140
|
},
|
|
138
|
-
onDone: () => {
|
|
139
|
-
this.preventDone || this.onChoiceDone(n.id);
|
|
141
|
+
onDone: (e) => {
|
|
142
|
+
this.preventDone || this.onChoiceDone(n.id, e);
|
|
140
143
|
},
|
|
141
144
|
onBlur: (e) => {
|
|
142
145
|
let t = e.relatedTarget && e.relatedTarget.closest(".insert-character-dialog");
|
|
@@ -169,4 +172,4 @@ var d = s("div")(({ theme: e }) => ({
|
|
|
169
172
|
}
|
|
170
173
|
};
|
|
171
174
|
//#endregion
|
|
172
|
-
export { h as default };
|
|
175
|
+
export { h as Choices, h as default };
|
package/dist/author/index.d.ts
CHANGED
package/dist/author/index.js
CHANGED
|
@@ -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";
|
|
@@ -84,8 +84,11 @@ var m = p("multiple-choice:configure"), h = class p extends HTMLElement {
|
|
|
84
84
|
o(this);
|
|
85
85
|
}, 0);
|
|
86
86
|
}
|
|
87
|
+
connectedCallback() {
|
|
88
|
+
this._render();
|
|
89
|
+
}
|
|
87
90
|
disconnectedCallback() {
|
|
88
|
-
this._root
|
|
91
|
+
this._root &&= (this._root.unmount(), null);
|
|
89
92
|
}
|
|
90
93
|
};
|
|
91
94
|
//#endregion
|
package/dist/author/main.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createSlateMarkup as e } from "./markupUtils.js";
|
|
2
|
-
import t from "./choice.js";
|
|
3
|
-
import n from "./choices.js";
|
|
2
|
+
import { BlankContent as t } from "./choice.js";
|
|
3
|
+
import { Choices as n } from "./choices.js";
|
|
4
4
|
import { generateValidationMessage as r } from "./utils.js";
|
|
5
5
|
import i from "react";
|
|
6
6
|
import { renderMath as a } from "@pie-element/shared-math-rendering-mathjax";
|
|
@@ -298,4 +298,4 @@ var y = v(s, "InputContainer") || v(S.InputContainer, "InputContainer"), b = o,
|
|
|
298
298
|
}
|
|
299
299
|
};
|
|
300
300
|
//#endregion
|
|
301
|
-
export { A as default };
|
|
301
|
+
export { A as Main, A as default };
|