@pie-element/placement-ordering 14.1.2-next.2 → 14.1.2-next.20
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/author.js +2 -0
- package/dist/author/choice-editor.js +2 -2
- package/dist/author/choice-tile.js +3 -2
- package/dist/author/design.js +1 -1
- package/dist/author/index.d.ts +1 -0
- package/dist/author/index.js +5 -2
- package/dist/browser/assets/Symbola-4c507403.woff2 +0 -0
- package/dist/browser/author/index.js +14940 -19583
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/{browser-Dbw2uHQ7.js → browser-DMpDEszG.js} +7 -3
- package/dist/browser/browser-DMpDEszG.js.map +1 -0
- package/dist/browser/controller/index.js +140 -55
- package/dist/browser/controller/index.js.map +1 -1
- package/dist/browser/delivery/index.js +474 -325
- package/dist/browser/delivery/index.js.map +1 -1
- package/dist/browser/{dist-D9ARZhQk.js → dist-DCmVXYeO.js} +109 -7
- package/dist/browser/dist-DCmVXYeO.js.map +1 -0
- package/dist/browser/{drag-provider-C4BiCI76.js → drag-provider-LgVkQ5Yi.js} +2219 -2266
- package/dist/browser/drag-provider-LgVkQ5Yi.js.map +1 -0
- package/dist/browser/editor-runtime/assets/Symbola-4c507403.woff2 +0 -0
- package/dist/browser/editor-runtime/author/index.js +19668 -0
- package/dist/browser/editor-runtime/author/index.js.map +1 -0
- package/dist/browser/editor-runtime/browser-0nthm_zo.js +376 -0
- package/dist/browser/editor-runtime/browser-0nthm_zo.js.map +1 -0
- package/dist/browser/editor-runtime/controller/index.js +327 -0
- package/dist/browser/editor-runtime/controller/index.js.map +1 -0
- package/dist/browser/editor-runtime/delivery/index.js +1184 -0
- package/dist/browser/editor-runtime/delivery/index.js.map +1 -0
- package/dist/browser/editor-runtime/dist-DCmVXYeO.js +1528 -0
- package/dist/browser/editor-runtime/dist-DCmVXYeO.js.map +1 -0
- package/dist/browser/editor-runtime/drag-provider-Dpx1BjBS.js +10508 -0
- package/dist/browser/editor-runtime/drag-provider-Dpx1BjBS.js.map +1 -0
- package/dist/controller/scoring.js +3 -3
- package/dist/delivery/index.js +2 -2
- package/dist/delivery/keyboard-coordinates.d.ts +47 -0
- package/dist/delivery/keyboard-coordinates.js +51 -0
- package/dist/delivery/main.js +1 -1
- package/dist/delivery/ordering.js +14 -19
- package/dist/delivery/placement-ordering.d.ts +13 -0
- package/dist/delivery/placement-ordering.js +168 -83
- package/dist/delivery/tile.d.ts +3 -0
- package/dist/delivery/tile.js +75 -61
- package/dist/delivery/tiler.d.ts +6 -0
- package/dist/delivery/tiler.js +6 -3
- package/dist/index.iife.js +35 -35
- package/package.json +36 -25
- package/dist/browser/browser-Dbw2uHQ7.js.map +0 -1
- package/dist/browser/dist-D9ARZhQk.js.map +0 -1
- package/dist/browser/drag-provider-C4BiCI76.js.map +0 -1
- package/dist/browser/placement-ordering.css +0 -2
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { C as e, _ as t, b as n, g as r, k as i, l as a, r as o, t as s, u as c, v as l } from "../browser-
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
4
|
-
import
|
|
5
|
-
import { createRoot as
|
|
6
|
-
import
|
|
7
|
-
import { jsx as
|
|
1
|
+
import { C as e, _ as t, b as n, g as r, k as i, l as a, r as o, t as s, u as c, v as l } from "../browser-DMpDEszG.js";
|
|
2
|
+
import { Lt as u, Rt as d, T as f, at as p, c as m, ct as h, dt as g, ft as _, l as v, lt as y, mt as b, n as x, ot as S, s as C, st as w, t as ee, u as T, ut as E, v as D } from "../drag-provider-LgVkQ5Yi.js";
|
|
3
|
+
import { t as O } from "../dist-DCmVXYeO.js";
|
|
4
|
+
import k, { createElement as A, useRef as j } from "react";
|
|
5
|
+
import { createRoot as M } from "react-dom/client";
|
|
6
|
+
import N from "react-dom";
|
|
7
|
+
import { jsx as P, jsxs as F } from "react/jsx-runtime";
|
|
8
8
|
//#region ../../shared/player-events/dist/index.js
|
|
9
|
-
var
|
|
9
|
+
var I = /* @__PURE__ */ i(s(), 1);
|
|
10
10
|
(class e extends CustomEvent {
|
|
11
11
|
static {
|
|
12
12
|
this.TYPE = "model-set";
|
|
@@ -23,7 +23,7 @@ var j = /* @__PURE__ */ i(s(), 1);
|
|
|
23
23
|
}), this.component = t, this.complete = n;
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
|
-
var
|
|
26
|
+
var te = class e extends CustomEvent {
|
|
27
27
|
static {
|
|
28
28
|
this.TYPE = "session-changed";
|
|
29
29
|
}
|
|
@@ -37,39 +37,47 @@ var ae = class e extends CustomEvent {
|
|
|
37
37
|
}
|
|
38
38
|
}), this.component = t, this.complete = n;
|
|
39
39
|
}
|
|
40
|
-
},
|
|
40
|
+
}, L = /* @__PURE__ */ i(u(), 1);
|
|
41
|
+
function R(e, t, n) {
|
|
42
|
+
let r = { ...e };
|
|
43
|
+
return t.top + e.y <= n.top ? r.y = n.top - t.top : t.bottom + e.y >= n.top + n.height && (r.y = n.top + n.height - t.bottom), t.left + e.x <= n.left ? r.x = n.left - t.left : t.right + e.x >= n.left + n.width && (r.x = n.left + n.width - t.right), r;
|
|
44
|
+
}
|
|
45
|
+
var ne = (e) => {
|
|
46
|
+
let { containerNodeRect: t, draggingNodeRect: n, transform: r } = e;
|
|
47
|
+
return !n || !t ? r : R(r, n, t);
|
|
48
|
+
}, z = ({ bgFill: e, fgFill: t }) => /* @__PURE__ */ F("svg", {
|
|
41
49
|
preserveAspectRatio: "xMinYMin meet",
|
|
42
50
|
version: "1.1",
|
|
43
51
|
viewBox: "-283 359 34 35",
|
|
44
52
|
style: { enableBackground: "new -283 359 34 35" },
|
|
45
53
|
children: [
|
|
46
|
-
/* @__PURE__ */
|
|
54
|
+
/* @__PURE__ */ P("circle", {
|
|
47
55
|
cx: "-266",
|
|
48
56
|
cy: "375.9",
|
|
49
57
|
r: "14",
|
|
50
58
|
fill: e
|
|
51
59
|
}),
|
|
52
|
-
/* @__PURE__ */
|
|
60
|
+
/* @__PURE__ */ P("path", {
|
|
53
61
|
d: "M-280.5,375.9c0-8,6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5s-6.5,14.5-14.5,14.5S-280.5,383.9-280.5,375.9z\n M-279.5,375.9c0,7.4,6.1,13.5,13.5,13.5c7.4,0,13.5-6.1,13.5-13.5s-6.1-13.5-13.5-13.5C-273.4,362.4-279.5,368.5-279.5,375.9z",
|
|
54
62
|
fill: e
|
|
55
63
|
}),
|
|
56
|
-
/* @__PURE__ */
|
|
64
|
+
/* @__PURE__ */ P("polygon", {
|
|
57
65
|
points: "-265.4,383.1 -258.6,377.2 -261.2,374.2 -264.3,376.9 -268.9,368.7 -272.4,370.6",
|
|
58
66
|
fill: t
|
|
59
67
|
})
|
|
60
68
|
]
|
|
61
69
|
});
|
|
62
|
-
|
|
63
|
-
bgFill:
|
|
64
|
-
fgFill:
|
|
70
|
+
z.propTypes = {
|
|
71
|
+
bgFill: L.default.string.isRequired,
|
|
72
|
+
fgFill: L.default.string.isRequired
|
|
65
73
|
};
|
|
66
|
-
var
|
|
74
|
+
var re = ({ bgFill: e, fgFill: t, borderFill: n }) => /* @__PURE__ */ F("svg", {
|
|
67
75
|
preserveAspectRatio: "xMinYMin meet",
|
|
68
76
|
version: "1.1",
|
|
69
77
|
viewBox: "-129.5 127 34 35",
|
|
70
78
|
style: { enableBackground: "new -129.5 127 34 35" },
|
|
71
79
|
children: [
|
|
72
|
-
/* @__PURE__ */
|
|
80
|
+
/* @__PURE__ */ P("path", {
|
|
73
81
|
style: {
|
|
74
82
|
fill: "#D0CAC5",
|
|
75
83
|
stroke: "#E6E3E0",
|
|
@@ -78,7 +86,7 @@ var se = ({ bgFill: e, fgFill: t, borderFill: n }) => /* @__PURE__ */ A("svg", {
|
|
|
78
86
|
},
|
|
79
87
|
d: "M-112.9,160.4c-8.5,0-15.5-6.9-15.5-15.5c0-8.5,6.9-15.5,15.5-15.5s15.5,6.9,15.5,15.5\n C-97.4,153.5-104.3,160.4-112.9,160.4z"
|
|
80
88
|
}),
|
|
81
|
-
/* @__PURE__ */
|
|
89
|
+
/* @__PURE__ */ P("path", {
|
|
82
90
|
style: {
|
|
83
91
|
fill: "#B3ABA4",
|
|
84
92
|
stroke: "#CDC7C2",
|
|
@@ -87,48 +95,48 @@ var se = ({ bgFill: e, fgFill: t, borderFill: n }) => /* @__PURE__ */ A("svg", {
|
|
|
87
95
|
},
|
|
88
96
|
d: "M-113.2,159c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-105.2,159-113.2,159z"
|
|
89
97
|
}),
|
|
90
|
-
/* @__PURE__ */
|
|
98
|
+
/* @__PURE__ */ P("circle", {
|
|
91
99
|
cx: "-114.2",
|
|
92
100
|
cy: "143.5",
|
|
93
101
|
r: "14",
|
|
94
102
|
fill: e
|
|
95
103
|
}),
|
|
96
|
-
/* @__PURE__ */
|
|
104
|
+
/* @__PURE__ */ P("path", {
|
|
97
105
|
d: "M-114.2,158c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-106.2,158-114.2,158z\n M-114.2,130c-7.4,0-13.5,6.1-13.5,13.5s6.1,13.5,13.5,13.5s13.5-6.1,13.5-13.5S-106.8,130-114.2,130z",
|
|
98
106
|
fill: n
|
|
99
107
|
}),
|
|
100
|
-
/* @__PURE__ */
|
|
108
|
+
/* @__PURE__ */ P("polygon", {
|
|
101
109
|
points: "-114.8,150.7 -121.6,144.8 -119,141.8 -115.9,144.5 -111.3,136.3 -107.8,138.2",
|
|
102
110
|
fill: t
|
|
103
111
|
})
|
|
104
112
|
]
|
|
105
113
|
});
|
|
106
|
-
|
|
107
|
-
bgFill:
|
|
108
|
-
fgFill:
|
|
109
|
-
borderFill:
|
|
114
|
+
re.propTypes = {
|
|
115
|
+
bgFill: L.default.string.isRequired,
|
|
116
|
+
fgFill: L.default.string.isRequired,
|
|
117
|
+
borderFill: L.default.string.isRequired
|
|
110
118
|
};
|
|
111
|
-
var
|
|
119
|
+
var ie = b("div")(({ size: e }) => ({
|
|
112
120
|
width: e || "25px",
|
|
113
121
|
height: e || "25px"
|
|
114
|
-
})),
|
|
122
|
+
})), B = ({ open: e, size: t }) => /* @__PURE__ */ P(ie, {
|
|
115
123
|
size: t,
|
|
116
|
-
children: e ? /* @__PURE__ */
|
|
124
|
+
children: e ? /* @__PURE__ */ P(z, {
|
|
117
125
|
bgFill: "#bce2ff",
|
|
118
126
|
fgFill: "#1a9cff"
|
|
119
|
-
}) : /* @__PURE__ */
|
|
127
|
+
}) : /* @__PURE__ */ P(re, {
|
|
120
128
|
bgFill: "white",
|
|
121
129
|
fgFill: "#1a9cff",
|
|
122
130
|
borderFill: "#bce2ff"
|
|
123
131
|
})
|
|
124
132
|
});
|
|
125
|
-
|
|
126
|
-
open:
|
|
127
|
-
size:
|
|
128
|
-
},
|
|
133
|
+
B.propTypes = {
|
|
134
|
+
open: L.default.bool,
|
|
135
|
+
size: L.default.string
|
|
136
|
+
}, B.defaultProps = { open: !1 };
|
|
129
137
|
//#endregion
|
|
130
138
|
//#region ../../lib-react/correct-answer-toggle/dist/expander.js
|
|
131
|
-
var
|
|
139
|
+
var ae = "height ease-in 300ms, opacity ease-in 300ms", oe = b("div")(() => ({
|
|
132
140
|
position: "relative",
|
|
133
141
|
height: 0,
|
|
134
142
|
overflow: "hidden",
|
|
@@ -136,7 +144,7 @@ var le = "height ease-in 300ms, opacity ease-in 300ms", ue = y("div")(() => ({
|
|
|
136
144
|
visibility: "hidden",
|
|
137
145
|
width: 0,
|
|
138
146
|
"&.enter": {
|
|
139
|
-
transition:
|
|
147
|
+
transition: ae,
|
|
140
148
|
opacity: 1,
|
|
141
149
|
height: "auto",
|
|
142
150
|
width: "auto",
|
|
@@ -150,7 +158,7 @@ var le = "height ease-in 300ms, opacity ease-in 300ms", ue = y("div")(() => ({
|
|
|
150
158
|
minHeight: "25px"
|
|
151
159
|
},
|
|
152
160
|
"&.exit": {
|
|
153
|
-
transition:
|
|
161
|
+
transition: ae,
|
|
154
162
|
opacity: 0,
|
|
155
163
|
height: 0,
|
|
156
164
|
visibility: "visible",
|
|
@@ -162,9 +170,9 @@ var le = "height ease-in 300ms, opacity ease-in 300ms", ue = y("div")(() => ({
|
|
|
162
170
|
height: 0,
|
|
163
171
|
width: 0
|
|
164
172
|
}
|
|
165
|
-
})),
|
|
166
|
-
let { show: t, children: n, className: r } = e, i =
|
|
167
|
-
return /* @__PURE__ */
|
|
173
|
+
})), se = (e) => {
|
|
174
|
+
let { show: t, children: n, className: r } = e, i = j(null);
|
|
175
|
+
return /* @__PURE__ */ P(S, {
|
|
168
176
|
nodeRef: i,
|
|
169
177
|
in: t,
|
|
170
178
|
appear: !0,
|
|
@@ -176,49 +184,49 @@ var le = "height ease-in 300ms, opacity ease-in 300ms", ue = y("div")(() => ({
|
|
|
176
184
|
exit: "exit",
|
|
177
185
|
exitDone: "exit-done"
|
|
178
186
|
},
|
|
179
|
-
children: /* @__PURE__ */
|
|
187
|
+
children: /* @__PURE__ */ P(oe, {
|
|
180
188
|
ref: i,
|
|
181
189
|
className: r,
|
|
182
190
|
children: n
|
|
183
191
|
})
|
|
184
192
|
});
|
|
185
193
|
};
|
|
186
|
-
|
|
187
|
-
show:
|
|
188
|
-
className:
|
|
189
|
-
children:
|
|
194
|
+
se.propTypes = {
|
|
195
|
+
show: L.default.bool.isRequired,
|
|
196
|
+
className: L.default.string,
|
|
197
|
+
children: L.default.oneOfType([L.default.arrayOf(L.default.node), L.default.node]).isRequired
|
|
190
198
|
};
|
|
191
199
|
//#endregion
|
|
192
200
|
//#region ../../lib-react/correct-answer-toggle/dist/index.js
|
|
193
|
-
function
|
|
201
|
+
function V(e) {
|
|
194
202
|
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
195
203
|
}
|
|
196
|
-
function
|
|
197
|
-
return !e ||
|
|
204
|
+
function ce(e, t) {
|
|
205
|
+
return !e || V(e) ? e : V(e.default) ? e.default : t && V(e[t]) ? e[t] : t && V(e[t]?.default) ? e[t].default : e;
|
|
198
206
|
}
|
|
199
|
-
var
|
|
207
|
+
var le = ce(v, "Readable") || ce(ue.Readable, "Readable"), H = x, U = H.default, ue = U && typeof U == "object" ? U : H, { translator: W } = O, de = {
|
|
200
208
|
WebkitTouchCallout: "none",
|
|
201
209
|
WebkitUserSelect: "none",
|
|
202
210
|
KhtmlUserSelect: "none",
|
|
203
211
|
MozUserSelect: "none",
|
|
204
212
|
msUserSelect: "none",
|
|
205
213
|
userSelect: "none"
|
|
206
|
-
},
|
|
214
|
+
}, fe = b("div")(() => ({
|
|
207
215
|
width: "100%",
|
|
208
216
|
cursor: "pointer"
|
|
209
|
-
})),
|
|
217
|
+
})), pe = b("div")(() => ({
|
|
210
218
|
margin: "0 auto",
|
|
211
219
|
textAlign: "center",
|
|
212
220
|
display: "flex"
|
|
213
|
-
})),
|
|
221
|
+
})), me = b("div")(() => ({
|
|
214
222
|
width: "fit-content",
|
|
215
223
|
minWidth: "140px",
|
|
216
224
|
alignSelf: "center",
|
|
217
225
|
verticalAlign: "middle",
|
|
218
|
-
color: `var(--correct-answer-toggle-label-color, ${
|
|
226
|
+
color: `var(--correct-answer-toggle-label-color, ${w.text()})`,
|
|
219
227
|
fontWeight: "normal",
|
|
220
|
-
...
|
|
221
|
-
})),
|
|
228
|
+
...de
|
|
229
|
+
})), G = b("div")(() => ({
|
|
222
230
|
position: "absolute",
|
|
223
231
|
width: "25px",
|
|
224
232
|
"&.enter": { opacity: "0" },
|
|
@@ -231,20 +239,20 @@ var fe = F(_, "Readable") || F(pe.Readable, "Readable"), I = b, L = I.default, p
|
|
|
231
239
|
opacity: "0",
|
|
232
240
|
transition: "opacity 0.3s ease-in"
|
|
233
241
|
}
|
|
234
|
-
})),
|
|
242
|
+
})), he = b("div")(() => ({
|
|
235
243
|
width: "25px",
|
|
236
244
|
marginRight: "5px",
|
|
237
245
|
display: "flex",
|
|
238
246
|
alignItems: "center"
|
|
239
|
-
})),
|
|
247
|
+
})), ge = class e extends k.Component {
|
|
240
248
|
static propTypes = {
|
|
241
|
-
onToggle:
|
|
242
|
-
toggled:
|
|
243
|
-
show:
|
|
244
|
-
hideMessage:
|
|
245
|
-
showMessage:
|
|
246
|
-
className:
|
|
247
|
-
language:
|
|
249
|
+
onToggle: L.default.func,
|
|
250
|
+
toggled: L.default.bool,
|
|
251
|
+
show: L.default.bool,
|
|
252
|
+
hideMessage: L.default.string,
|
|
253
|
+
showMessage: L.default.string,
|
|
254
|
+
className: L.default.string,
|
|
255
|
+
language: L.default.string
|
|
248
256
|
};
|
|
249
257
|
static defaultProps = {
|
|
250
258
|
showMessage: "Show correct answer",
|
|
@@ -253,10 +261,10 @@ var fe = F(_, "Readable") || F(pe.Readable, "Readable"), I = b, L = I.default, p
|
|
|
253
261
|
toggled: !1
|
|
254
262
|
};
|
|
255
263
|
constructor(t) {
|
|
256
|
-
super(t), this.state = { show: t.show }, this.openIconRef =
|
|
264
|
+
super(t), this.state = { show: t.show }, this.openIconRef = k.createRef(), this.closedIconRef = k.createRef(), e.defaultProps = {
|
|
257
265
|
...e.defaultProps,
|
|
258
|
-
showMessage:
|
|
259
|
-
hideMessage:
|
|
266
|
+
showMessage: W.t("common:showCorrectAnswer", { lng: t.language }),
|
|
267
|
+
hideMessage: W.t("common:hideCorrectAnswer", { lng: t.language })
|
|
260
268
|
};
|
|
261
269
|
}
|
|
262
270
|
onClick() {
|
|
@@ -268,20 +276,20 @@ var fe = F(_, "Readable") || F(pe.Readable, "Readable"), I = b, L = I.default, p
|
|
|
268
276
|
UNSAFE_componentWillReceiveProps(t) {
|
|
269
277
|
this.setState({ show: t.show }), t.language !== this.props?.language && (e.defaultProps = {
|
|
270
278
|
...e.defaultProps,
|
|
271
|
-
showMessage:
|
|
272
|
-
hideMessage:
|
|
279
|
+
showMessage: W.t("common:showCorrectAnswer", { lng: t.language }),
|
|
280
|
+
hideMessage: W.t("common:hideCorrectAnswer", { lng: t.language })
|
|
273
281
|
});
|
|
274
282
|
}
|
|
275
283
|
render() {
|
|
276
284
|
let { className: e, toggled: t, hideMessage: n, showMessage: r } = this.props;
|
|
277
|
-
return /* @__PURE__ */
|
|
285
|
+
return /* @__PURE__ */ P(fe, {
|
|
278
286
|
className: e,
|
|
279
|
-
children: /* @__PURE__ */
|
|
287
|
+
children: /* @__PURE__ */ P(se, {
|
|
280
288
|
show: this.state.show,
|
|
281
|
-
children: /* @__PURE__ */
|
|
289
|
+
children: /* @__PURE__ */ F(pe, {
|
|
282
290
|
onClick: this.onClick.bind(this),
|
|
283
291
|
onTouchEnd: this.onTouch.bind(this),
|
|
284
|
-
children: [/* @__PURE__ */
|
|
292
|
+
children: [/* @__PURE__ */ F(he, { children: [/* @__PURE__ */ P(S, {
|
|
285
293
|
nodeRef: this.openIconRef,
|
|
286
294
|
timeout: 400,
|
|
287
295
|
in: t,
|
|
@@ -292,11 +300,11 @@ var fe = F(_, "Readable") || F(pe.Readable, "Readable"), I = b, L = I.default, p
|
|
|
292
300
|
exit: "exit",
|
|
293
301
|
exitActive: "exit-active"
|
|
294
302
|
},
|
|
295
|
-
children: /* @__PURE__ */
|
|
303
|
+
children: /* @__PURE__ */ P(G, {
|
|
296
304
|
ref: this.openIconRef,
|
|
297
|
-
children: /* @__PURE__ */
|
|
305
|
+
children: /* @__PURE__ */ P(B, { open: t }, "correct-open")
|
|
298
306
|
})
|
|
299
|
-
}), /* @__PURE__ */
|
|
307
|
+
}), /* @__PURE__ */ P(S, {
|
|
300
308
|
nodeRef: this.closedIconRef,
|
|
301
309
|
timeout: 5e3,
|
|
302
310
|
in: !t,
|
|
@@ -307,13 +315,13 @@ var fe = F(_, "Readable") || F(pe.Readable, "Readable"), I = b, L = I.default, p
|
|
|
307
315
|
exit: "exit",
|
|
308
316
|
exitActive: "exit-active"
|
|
309
317
|
},
|
|
310
|
-
children: /* @__PURE__ */
|
|
318
|
+
children: /* @__PURE__ */ P(G, {
|
|
311
319
|
ref: this.closedIconRef,
|
|
312
|
-
children: /* @__PURE__ */
|
|
320
|
+
children: /* @__PURE__ */ P(B, { open: t }, "correct-closed")
|
|
313
321
|
})
|
|
314
|
-
})] }), /* @__PURE__ */
|
|
322
|
+
})] }), /* @__PURE__ */ P(le, {
|
|
315
323
|
false: !0,
|
|
316
|
-
children: /* @__PURE__ */
|
|
324
|
+
children: /* @__PURE__ */ P(me, {
|
|
317
325
|
"aria-hidden": !this.state.show,
|
|
318
326
|
children: t ? n : r
|
|
319
327
|
})
|
|
@@ -325,22 +333,22 @@ var fe = F(_, "Readable") || F(pe.Readable, "Readable"), I = b, L = I.default, p
|
|
|
325
333
|
};
|
|
326
334
|
//#endregion
|
|
327
335
|
//#region ../../lib-react/drag/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js
|
|
328
|
-
function
|
|
336
|
+
function _e(e) {
|
|
329
337
|
var t, n, r = "";
|
|
330
338
|
if (typeof e == "string" || typeof e == "number") r += e;
|
|
331
339
|
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
332
340
|
var i = e.length;
|
|
333
|
-
for (t = 0; t < i; t++) e[t] && (n =
|
|
341
|
+
for (t = 0; t < i; t++) e[t] && (n = _e(e[t])) && (r && (r += " "), r += n);
|
|
334
342
|
} else for (n in e) e[n] && (r && (r += " "), r += n);
|
|
335
343
|
return r;
|
|
336
344
|
}
|
|
337
|
-
function
|
|
338
|
-
for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t =
|
|
345
|
+
function ve() {
|
|
346
|
+
for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t = _e(e)) && (r && (r += " "), r += t);
|
|
339
347
|
return r;
|
|
340
348
|
}
|
|
341
349
|
//#endregion
|
|
342
350
|
//#region ../../lib-react/drag/dist/placeholder.js
|
|
343
|
-
var
|
|
351
|
+
var ye = b("div")(({ theme: e }) => ({
|
|
344
352
|
"&.placeholder": {
|
|
345
353
|
WebkitTouchCallout: "none",
|
|
346
354
|
WebkitUserSelect: "none",
|
|
@@ -350,22 +358,22 @@ var be = y("div")(({ theme: e }) => ({
|
|
|
350
358
|
userSelect: "none",
|
|
351
359
|
width: "100%",
|
|
352
360
|
height: "100%",
|
|
353
|
-
background:
|
|
361
|
+
background: w.white(),
|
|
354
362
|
transition: "background-color 200ms linear, border-color 200ms linear",
|
|
355
363
|
boxSizing: "border-box",
|
|
356
364
|
display: "grid",
|
|
357
365
|
gridRowGap: e.spacing(1),
|
|
358
366
|
gridColumnGap: e.spacing(1),
|
|
359
367
|
padding: e.spacing(1),
|
|
360
|
-
border: `2px dashed ${
|
|
368
|
+
border: `2px dashed ${w.black()}`
|
|
361
369
|
},
|
|
362
|
-
"&.
|
|
370
|
+
"&.placeholderDisabled": {
|
|
363
371
|
boxShadow: "none",
|
|
364
|
-
background:
|
|
372
|
+
background: w.white()
|
|
365
373
|
},
|
|
366
374
|
"&.over": {
|
|
367
|
-
border: `1px solid ${
|
|
368
|
-
backgroundColor:
|
|
375
|
+
border: `1px solid ${w.border()}`,
|
|
376
|
+
backgroundColor: w.backgroundDark()
|
|
369
377
|
},
|
|
370
378
|
"&.board": {
|
|
371
379
|
padding: e.spacing(1),
|
|
@@ -376,7 +384,7 @@ var be = y("div")(({ theme: e }) => ({
|
|
|
376
384
|
justifyContent: "center",
|
|
377
385
|
overflow: "hidden",
|
|
378
386
|
touchAction: "none",
|
|
379
|
-
backgroundColor:
|
|
387
|
+
backgroundColor: w.surface()
|
|
380
388
|
},
|
|
381
389
|
"&.categorizeBoard": {
|
|
382
390
|
padding: e.spacing(.5),
|
|
@@ -387,312 +395,323 @@ var be = y("div")(({ theme: e }) => ({
|
|
|
387
395
|
justifyContent: "center",
|
|
388
396
|
overflow: "hidden",
|
|
389
397
|
touchAction: "none",
|
|
390
|
-
backgroundColor:
|
|
398
|
+
backgroundColor: w.surface()
|
|
391
399
|
},
|
|
392
400
|
"&.verticalPool": {
|
|
393
401
|
display: "flex",
|
|
394
402
|
flexFlow: "column wrap"
|
|
395
403
|
}
|
|
396
|
-
})),
|
|
397
|
-
let { children: t, className: n, isOver: r, type: i, grid: a, disabled: o, choiceBoard: s, isCategorize: c, isVerticalPool: l, minHeight: u, extraStyles: d } = e, f =
|
|
404
|
+
})), be = (e) => {
|
|
405
|
+
let { children: t, className: n, isOver: r, type: i, grid: a, disabled: o, choiceBoard: s, isCategorize: c, isVerticalPool: l, minHeight: u, extraStyles: d } = e, f = ve("placeholder", o && "placeholderDisabled", r && "over", i, n), p = {};
|
|
398
406
|
if (a && a.columns && (p.gridTemplateColumns = `repeat(${a.columns}, 1fr)`), a && a.rows) {
|
|
399
407
|
let e = a.rowsRepeatValue || "1fr";
|
|
400
408
|
p.gridTemplateRows = `repeat(${a.rows}, ${e})`;
|
|
401
409
|
}
|
|
402
|
-
i === "choice" && (p.border = `1px solid ${
|
|
410
|
+
i === "choice" && (p.border = `1px solid ${w.borderLight()}`, p.background = w.surface());
|
|
403
411
|
let m = c ? "categorizeBoard" : "board";
|
|
404
|
-
return /* @__PURE__ */
|
|
412
|
+
return /* @__PURE__ */ P(ye, {
|
|
405
413
|
style: {
|
|
406
414
|
...p,
|
|
407
415
|
minHeight: u,
|
|
408
416
|
...d
|
|
409
417
|
},
|
|
410
|
-
className:
|
|
418
|
+
className: ve(s ? m : f, l && "verticalPool"),
|
|
411
419
|
children: t
|
|
412
420
|
});
|
|
413
421
|
};
|
|
414
|
-
|
|
415
|
-
choiceBoard:
|
|
416
|
-
grid:
|
|
417
|
-
columns:
|
|
418
|
-
rows:
|
|
419
|
-
rowsRepeatValue:
|
|
422
|
+
be.propTypes = {
|
|
423
|
+
choiceBoard: L.default.bool,
|
|
424
|
+
grid: L.default.shape({
|
|
425
|
+
columns: L.default.number,
|
|
426
|
+
rows: L.default.number,
|
|
427
|
+
rowsRepeatValue: L.default.string
|
|
420
428
|
}),
|
|
421
|
-
children:
|
|
422
|
-
className:
|
|
423
|
-
isOver:
|
|
424
|
-
index:
|
|
425
|
-
type:
|
|
426
|
-
disabled:
|
|
427
|
-
isCategorize:
|
|
428
|
-
isVerticalPool:
|
|
429
|
-
minHeight:
|
|
429
|
+
children: L.default.oneOfType([L.default.arrayOf(L.default.node), L.default.node]).isRequired,
|
|
430
|
+
className: L.default.string,
|
|
431
|
+
isOver: L.default.bool,
|
|
432
|
+
index: L.default.number,
|
|
433
|
+
type: L.default.string,
|
|
434
|
+
disabled: L.default.bool,
|
|
435
|
+
isCategorize: L.default.bool,
|
|
436
|
+
isVerticalPool: L.default.bool,
|
|
437
|
+
minHeight: L.default.number
|
|
430
438
|
};
|
|
431
439
|
//#endregion
|
|
432
440
|
//#region src/delivery/tile.tsx
|
|
433
|
-
var xe = (0,
|
|
441
|
+
var xe = (0, I.default)("pie-elements:placement-ordering:tile"), Se = b("div")(({ theme: e }) => ({
|
|
434
442
|
width: "100%",
|
|
435
443
|
fontSize: e.typography.fontSize + 4,
|
|
436
444
|
textAlign: "center",
|
|
437
445
|
color: `rgba(${e.palette.common.black}, 0.6)`
|
|
438
|
-
})),
|
|
446
|
+
})), Ce = ({ type: e, index: t, isOver: n, disabled: r }) => /* @__PURE__ */ P(be, {
|
|
439
447
|
type: e,
|
|
440
448
|
isOver: n,
|
|
441
449
|
disabled: r,
|
|
442
|
-
children: e === "target" && t !== void 0 && /* @__PURE__ */
|
|
450
|
+
children: e === "target" && t !== void 0 && /* @__PURE__ */ P(Se, { children: t })
|
|
443
451
|
});
|
|
444
|
-
|
|
445
|
-
type:
|
|
446
|
-
index:
|
|
447
|
-
isOver:
|
|
448
|
-
disabled:
|
|
452
|
+
Ce.propTypes = {
|
|
453
|
+
type: L.default.string,
|
|
454
|
+
index: L.default.number,
|
|
455
|
+
isOver: L.default.bool,
|
|
456
|
+
disabled: L.default.bool
|
|
449
457
|
};
|
|
450
|
-
var
|
|
451
|
-
cursor:
|
|
458
|
+
var we = b("div")(({ theme: e, isDragging: t, isSelected: n, isOver: r, disabled: i, outcome: a, label: o, type: s }) => ({
|
|
459
|
+
cursor: i ? "not-allowed" : "grab",
|
|
452
460
|
width: "100%",
|
|
453
461
|
height: "100%",
|
|
454
462
|
padding: "10px",
|
|
455
463
|
boxSizing: "border-box",
|
|
456
464
|
overflow: "hidden",
|
|
457
|
-
border:
|
|
458
|
-
backgroundColor:
|
|
459
|
-
transition:
|
|
465
|
+
border: s === "choice" || s === "target" ? `1px solid ${w.border()}` : "1px solid transparent",
|
|
466
|
+
backgroundColor: s === "choice" || s === "target" ? w.background() : "transparent",
|
|
467
|
+
transition: s === "choice" || s === "target" ? "background-color 150ms ease, border-color 150ms ease, opacity 150ms ease" : "none",
|
|
460
468
|
pointerEvents: "none",
|
|
461
469
|
userSelect: "none",
|
|
462
|
-
...(
|
|
463
|
-
backgroundColor:
|
|
464
|
-
borderColor:
|
|
465
|
-
transform:
|
|
470
|
+
...(s === "choice" || s === "target") && { "&:hover": {
|
|
471
|
+
backgroundColor: i ? w.background() : w.secondary(),
|
|
472
|
+
borderColor: i ? w.disabled() : e.palette.primary.main,
|
|
473
|
+
transform: i ? "none" : "scale(1.02)"
|
|
466
474
|
} },
|
|
467
|
-
...(
|
|
475
|
+
...(s === "choice" || s === "target") && r && !i && {
|
|
468
476
|
opacity: .4,
|
|
469
|
-
backgroundColor:
|
|
477
|
+
backgroundColor: w.primaryLight(),
|
|
470
478
|
borderColor: e.palette.primary.main,
|
|
471
479
|
borderStyle: "dashed",
|
|
472
480
|
transform: "scale(1.05)"
|
|
473
481
|
},
|
|
474
|
-
...(
|
|
482
|
+
...(s === "choice" || s === "target") && (t || n) && !i && {
|
|
475
483
|
opacity: .6,
|
|
476
|
-
backgroundColor:
|
|
484
|
+
backgroundColor: w.secondaryLight(),
|
|
477
485
|
transform: "scale(1.05) rotate(2deg)",
|
|
478
486
|
boxShadow: "0 8px 16px rgba(0,0,0,0.2)",
|
|
479
487
|
cursor: "grabbing"
|
|
480
488
|
},
|
|
481
|
-
...(
|
|
489
|
+
...(s === "choice" || s === "target") && i && {
|
|
482
490
|
cursor: "not-allowed",
|
|
483
491
|
"&:hover": {
|
|
484
|
-
backgroundColor:
|
|
492
|
+
backgroundColor: w.background(),
|
|
485
493
|
transform: "none"
|
|
486
494
|
}
|
|
487
495
|
},
|
|
488
|
-
...(
|
|
489
|
-
...(
|
|
490
|
-
...!
|
|
496
|
+
...(s === "choice" || s === "target") && a === "incorrect" && { border: `1px solid ${w.incorrect()}` },
|
|
497
|
+
...(s === "choice" || s === "target") && a === "correct" && { border: `1px solid ${w.correct()}` },
|
|
498
|
+
...!o && {
|
|
491
499
|
border: "none",
|
|
492
500
|
"&:hover": { backgroundColor: "unset" }
|
|
493
501
|
}
|
|
494
|
-
})),
|
|
495
|
-
let { type: t, isDragging: n,
|
|
496
|
-
return
|
|
502
|
+
})), Te = (e) => {
|
|
503
|
+
let { type: t, isDragging: n, isSelected: r, empty: i, isOver: a, label: o, disabled: s, outcome: c, guideIndex: l } = e;
|
|
504
|
+
return i ? /* @__PURE__ */ P(Ce, {
|
|
497
505
|
type: t,
|
|
498
|
-
index:
|
|
499
|
-
isOver:
|
|
500
|
-
disabled:
|
|
501
|
-
}) : /* @__PURE__ */
|
|
506
|
+
index: l,
|
|
507
|
+
isOver: a,
|
|
508
|
+
disabled: s
|
|
509
|
+
}) : /* @__PURE__ */ P(we, {
|
|
502
510
|
type: t,
|
|
503
511
|
isDragging: n,
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
512
|
+
isSelected: r,
|
|
513
|
+
isOver: a,
|
|
514
|
+
disabled: s,
|
|
515
|
+
outcome: c,
|
|
516
|
+
label: o,
|
|
517
|
+
dangerouslySetInnerHTML: { __html: o }
|
|
509
518
|
});
|
|
510
|
-
},
|
|
511
|
-
let { label: t, type: n, id: r, empty: i, disabled: a, outcome: o, index: s, guideIndex: c, instanceId: l, draggable: u, tileIndex: d } = e,
|
|
512
|
-
id:
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
519
|
+
}, K = (e) => {
|
|
520
|
+
let { label: t, type: n, id: r, empty: i, disabled: a, outcome: o, index: s, guideIndex: c, instanceId: l, draggable: u, tileIndex: d, selectedChoice: f, onChoiceClick: p, onPlacementClick: m } = e, h = `tile-${n}-${r ?? "empty"}-${d}-${l}`, v = `drop-${n}-${r ?? "empty"}-${d}-${l}`, y = {
|
|
521
|
+
id: r,
|
|
522
|
+
type: n,
|
|
523
|
+
instanceId: l,
|
|
524
|
+
value: t,
|
|
525
|
+
index: s
|
|
526
|
+
}, { attributes: b, listeners: x, setNodeRef: S, transform: C, isDragging: w } = g({
|
|
527
|
+
id: h,
|
|
528
|
+
data: y,
|
|
520
529
|
disabled: !u || a
|
|
521
|
-
}), { setNodeRef:
|
|
522
|
-
id:
|
|
523
|
-
data:
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
return D.useEffect(() => {
|
|
533
|
-
let e = C.current, t = (e) => {
|
|
530
|
+
}), { setNodeRef: ee, isOver: T } = _({
|
|
531
|
+
id: v,
|
|
532
|
+
data: y,
|
|
533
|
+
disabled: w
|
|
534
|
+
}), E = !!f && f.type === y.type && f.id === y.id && f.index === y.index, [D, O] = k.useState(!1), A = !!f && !a, j = T || n === "target" && A && D, M = () => {
|
|
535
|
+
a || (n === "choice" ? f?.type === "target" ? m?.(y) : u && p?.(y) : n === "target" && (E ? p?.(y) : f ? m?.(y) : u && p?.(y)));
|
|
536
|
+
}, N = !(u && !a) && !a && A, F = (e) => {
|
|
537
|
+
(e.code === "Space" || e.code === "Enter") && (e.preventDefault(), M());
|
|
538
|
+
}, I = k.useRef(null);
|
|
539
|
+
k.useEffect(() => {
|
|
540
|
+
let e = I.current, t = (e) => {
|
|
534
541
|
e.preventDefault();
|
|
535
542
|
};
|
|
536
543
|
return e && e.addEventListener("touchstart", t, { passive: !1 }), () => {
|
|
537
544
|
e && e.removeEventListener("touchstart", t);
|
|
538
545
|
};
|
|
539
|
-
}, [])
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
546
|
+
}, []);
|
|
547
|
+
let te = (e) => {
|
|
548
|
+
I.current = e, S(e), ee(e);
|
|
549
|
+
};
|
|
550
|
+
xe("[render], props: ", e);
|
|
551
|
+
let L = n === "target" ? `target-${s}` : n === "choice" ? `choice-${r}` : null, R = L ? `${l}:${L}` : void 0;
|
|
552
|
+
return /* @__PURE__ */ P("div", {
|
|
553
|
+
ref: te,
|
|
543
554
|
style: {
|
|
544
|
-
transform:
|
|
555
|
+
transform: C ? `translate3d(${C.x}px, ${C.y}px, 0)` : void 0,
|
|
545
556
|
boxSizing: "border-box",
|
|
546
557
|
overflow: "visible",
|
|
547
558
|
padding: 0,
|
|
548
559
|
margin: 0,
|
|
549
560
|
textAlign: "center",
|
|
550
561
|
pointerEvents: "auto",
|
|
551
|
-
cursor: a ? "not-allowed" :
|
|
552
|
-
zIndex:
|
|
553
|
-
willChange:
|
|
562
|
+
cursor: a ? "not-allowed" : n === "target" && A ? "pointer" : w ? "grabbing" : "grab",
|
|
563
|
+
zIndex: w ? 1e3 : "auto",
|
|
564
|
+
willChange: w ? "transform" : "auto"
|
|
554
565
|
},
|
|
566
|
+
role: N ? "button" : void 0,
|
|
567
|
+
tabIndex: N ? 0 : void 0,
|
|
568
|
+
onKeyDown: N ? F : void 0,
|
|
569
|
+
onClick: M,
|
|
570
|
+
onMouseEnter: () => O(!0),
|
|
571
|
+
onMouseLeave: () => O(!1),
|
|
572
|
+
"data-tile-id": R,
|
|
555
573
|
...u && !a ? {
|
|
556
|
-
...
|
|
557
|
-
...
|
|
574
|
+
...x,
|
|
575
|
+
...b
|
|
558
576
|
} : {},
|
|
559
|
-
children: /* @__PURE__ */
|
|
577
|
+
children: /* @__PURE__ */ P(Te, {
|
|
560
578
|
label: t,
|
|
561
579
|
id: r,
|
|
562
580
|
empty: i,
|
|
563
581
|
index: s,
|
|
564
582
|
guideIndex: c,
|
|
565
|
-
isOver:
|
|
566
|
-
isDragging:
|
|
583
|
+
isOver: j,
|
|
584
|
+
isDragging: w,
|
|
585
|
+
isSelected: E,
|
|
567
586
|
disabled: a,
|
|
568
587
|
outcome: o,
|
|
569
588
|
type: n
|
|
570
589
|
})
|
|
571
590
|
});
|
|
572
591
|
};
|
|
573
|
-
|
|
574
|
-
id:
|
|
575
|
-
label:
|
|
576
|
-
isOver:
|
|
577
|
-
type:
|
|
578
|
-
empty:
|
|
579
|
-
disabled:
|
|
580
|
-
outcome:
|
|
581
|
-
index:
|
|
582
|
-
guideIndex:
|
|
583
|
-
instanceId:
|
|
584
|
-
draggable:
|
|
585
|
-
tileIndex:
|
|
592
|
+
K.propTypes = {
|
|
593
|
+
id: L.default.any,
|
|
594
|
+
label: L.default.string,
|
|
595
|
+
isOver: L.default.bool,
|
|
596
|
+
type: L.default.string,
|
|
597
|
+
empty: L.default.bool,
|
|
598
|
+
disabled: L.default.bool,
|
|
599
|
+
outcome: L.default.string,
|
|
600
|
+
index: L.default.number,
|
|
601
|
+
guideIndex: L.default.number,
|
|
602
|
+
instanceId: L.default.any,
|
|
603
|
+
draggable: L.default.bool,
|
|
604
|
+
tileIndex: L.default.number,
|
|
605
|
+
selectedChoice: L.default.object,
|
|
606
|
+
onChoiceClick: L.default.func,
|
|
607
|
+
onPlacementClick: L.default.func
|
|
586
608
|
};
|
|
587
609
|
//#endregion
|
|
588
610
|
//#region src/delivery/tiler.tsx
|
|
589
|
-
var
|
|
590
|
-
choiceLabel:
|
|
591
|
-
targetLabel:
|
|
592
|
-
disabled:
|
|
593
|
-
tiles:
|
|
594
|
-
tileSize:
|
|
595
|
-
addGuide:
|
|
596
|
-
|
|
611
|
+
var q = {
|
|
612
|
+
choiceLabel: L.default.string,
|
|
613
|
+
targetLabel: L.default.string,
|
|
614
|
+
disabled: L.default.bool,
|
|
615
|
+
tiles: L.default.array.isRequired,
|
|
616
|
+
tileSize: L.default.string,
|
|
617
|
+
addGuide: L.default.bool,
|
|
618
|
+
selectedChoice: L.default.object,
|
|
619
|
+
onChoiceClick: L.default.func,
|
|
620
|
+
onPlacementClick: L.default.func
|
|
621
|
+
}, Ee = {
|
|
597
622
|
tileSize: "1fr",
|
|
598
623
|
disabled: !1,
|
|
599
624
|
addGuide: !1
|
|
600
|
-
},
|
|
601
|
-
let t = (t, n) => (t.instanceId = e.instanceId, t.disabled = e.disabled, t.guideIndex = e.addGuide ? t.index + 1 : void 0, t.tileIndex = n, e.includeTargets || t.type === "choice" ? /* @__PURE__ */
|
|
625
|
+
}, De = (e) => {
|
|
626
|
+
let t = (t, n) => (t.instanceId = e.instanceId, t.disabled = e.disabled, t.guideIndex = e.addGuide ? t.index + 1 : void 0, t.tileIndex = n, t.selectedChoice = e.selectedChoice, t.onChoiceClick = e.onChoiceClick, t.onPlacementClick = e.onPlacementClick, e.includeTargets || t.type === "choice" ? /* @__PURE__ */ A(K, {
|
|
602
627
|
...t,
|
|
603
628
|
key: n
|
|
604
|
-
}) : /* @__PURE__ */
|
|
629
|
+
}) : /* @__PURE__ */ A(K, {
|
|
605
630
|
...t,
|
|
606
631
|
label: "",
|
|
607
632
|
key: n
|
|
608
633
|
}));
|
|
609
|
-
return t.propTypes = { ...
|
|
610
|
-
},
|
|
634
|
+
return t.propTypes = { ...q }, t;
|
|
635
|
+
}, Oe = b("div")(({ theme: e, includeTargets: t }) => ({
|
|
611
636
|
display: "grid",
|
|
612
637
|
paddingBottom: e.spacing(2),
|
|
613
638
|
...t && { gridGap: "10px" }
|
|
614
|
-
})),
|
|
639
|
+
})), ke = b("div")({ textAlign: "center" }), Ae = b("div")({
|
|
615
640
|
textAlign: "center",
|
|
616
641
|
gridRow: "3/4"
|
|
617
|
-
}),
|
|
642
|
+
}), je = b("div")(({ includeTargets: e }) => ({
|
|
618
643
|
gridAutoFlow: "column",
|
|
619
644
|
display: "grid",
|
|
620
645
|
...e && { gridGap: "10px" }
|
|
621
|
-
})),
|
|
646
|
+
})), Me = b("div")({
|
|
622
647
|
gridColumn: "1/2",
|
|
623
648
|
textAlign: "center"
|
|
624
|
-
}),
|
|
649
|
+
}), Ne = b("div")({
|
|
625
650
|
gridColumn: "2/3",
|
|
626
651
|
textAlign: "center"
|
|
627
|
-
}),
|
|
628
|
-
static propTypes = { ...
|
|
629
|
-
static defaultProps = { ...
|
|
652
|
+
}), Pe = class extends k.Component {
|
|
653
|
+
static propTypes = { ...q };
|
|
654
|
+
static defaultProps = { ...Ee };
|
|
630
655
|
render() {
|
|
631
656
|
let { includeTargets: e, choiceLabelEnabled: t, choiceLabel: n, targetLabel: r, tiles: i, tileSize: a } = this.props, o = e ? `auto ${a} auto ${a}` : `auto ${a} auto`, s = e ? i.length / 2 : i.length, c = {
|
|
632
657
|
gridTemplateColumns: e ? `repeat(${s}, ${a})` : `auto repeat(${Math.floor(s / 2) - 1}, ${a} 10px) ${a} auto`,
|
|
633
658
|
gridTemplateRows: o
|
|
634
659
|
}, l = { gridColumn: `1/${s + 1}` };
|
|
635
|
-
return /* @__PURE__ */
|
|
660
|
+
return /* @__PURE__ */ F(Oe, {
|
|
636
661
|
includeTargets: e,
|
|
637
662
|
style: c,
|
|
638
663
|
children: [
|
|
639
|
-
/* @__PURE__ */
|
|
664
|
+
/* @__PURE__ */ P(ke, {
|
|
640
665
|
style: l,
|
|
641
666
|
dangerouslySetInnerHTML: { __html: t ? n : "" }
|
|
642
667
|
}),
|
|
643
|
-
e && /* @__PURE__ */
|
|
668
|
+
e && /* @__PURE__ */ P(Ae, {
|
|
644
669
|
style: l,
|
|
645
670
|
dangerouslySetInnerHTML: { __html: r }
|
|
646
671
|
}),
|
|
647
|
-
i.map(
|
|
672
|
+
i.map(De(this.props))
|
|
648
673
|
]
|
|
649
674
|
});
|
|
650
675
|
}
|
|
651
|
-
},
|
|
652
|
-
static propTypes = { ...
|
|
653
|
-
static defaultProps = { ...
|
|
676
|
+
}, Fe = class extends k.Component {
|
|
677
|
+
static propTypes = { ...q };
|
|
678
|
+
static defaultProps = { ...Ee };
|
|
654
679
|
render() {
|
|
655
680
|
let { includeTargets: e, choiceLabelEnabled: t, choiceLabel: n, targetLabel: r, tiles: i, tileSize: a } = this.props, o = e ? 2 : 1, s = e ? i.length / 2 : i.length;
|
|
656
|
-
return /* @__PURE__ */
|
|
681
|
+
return /* @__PURE__ */ F(je, {
|
|
657
682
|
includeTargets: e,
|
|
658
683
|
style: {
|
|
659
684
|
gridTemplateColumns: `repeat(${o}, ${a})`,
|
|
660
685
|
gridTemplateRows: e ? `auto repeat(${s}, ${a})` : `auto auto repeat(${Math.floor(s / 2) - 1}, ${a} 10px) ${a} auto`
|
|
661
686
|
},
|
|
662
687
|
children: [
|
|
663
|
-
/* @__PURE__ */
|
|
664
|
-
e && /* @__PURE__ */
|
|
665
|
-
i.map(
|
|
688
|
+
/* @__PURE__ */ P(Me, { dangerouslySetInnerHTML: { __html: t ? n : "" } }),
|
|
689
|
+
e && /* @__PURE__ */ P(Ne, { dangerouslySetInnerHTML: { __html: r } }),
|
|
690
|
+
i.map(De(this.props))
|
|
666
691
|
]
|
|
667
692
|
});
|
|
668
693
|
}
|
|
669
|
-
},
|
|
694
|
+
}, Ie = (0, I.default)("pie-elements:placement-ordering:ordering"), Le = (e, t, n) => {
|
|
670
695
|
let r = e.find((e, n) => n === t), i = e.filter((e, n) => n !== t);
|
|
671
696
|
return [
|
|
672
697
|
...i.slice(0, n),
|
|
673
698
|
r,
|
|
674
699
|
...i.slice(n)
|
|
675
700
|
];
|
|
676
|
-
}, Ie = (e, n, r) => {
|
|
677
|
-
if (K("[swap]", e, n, r), !e || e.length <= 1 || n === void 0 || r === void 0) throw Error(`swap requires a non-empty array, fromIndex, toIndex: ${e}, ${n} ${r}`);
|
|
678
|
-
let i = t(e), a = e[r];
|
|
679
|
-
return i[r] = i[n], i[n] = a, i;
|
|
680
701
|
};
|
|
681
|
-
function
|
|
702
|
+
function Re(e, n) {
|
|
682
703
|
let r = t(e.response);
|
|
683
704
|
if (r[n.index] === n.id) r[n.index] = void 0;
|
|
684
705
|
else throw Error(`Tried to remove from index: ${n.index}, but the id doesn't match: array: ${r}, target: ${n.id}`);
|
|
685
706
|
return r;
|
|
686
707
|
}
|
|
687
|
-
function
|
|
708
|
+
function ze(e, n, r) {
|
|
688
709
|
let { response: i, opts: a } = e, o = t(i);
|
|
689
|
-
if (a.includeTargets) return n.type === "choice" && r.type === "target" ? (o[r.index] = n.id, o) : n.type === "target" && r.type === "choice" ? (o[n.index] = void 0, o) : n.type === "target" && r.type === "target" ?
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
return K("fromIndex: ", t, "toIndex:", i), Fe(e.response, t, i);
|
|
693
|
-
}
|
|
710
|
+
if (a.includeTargets) return n.type === "choice" && r.type === "target" ? (o[r.index] = n.id, o) : n.type === "target" && r.type === "choice" ? (o[n.index] = void 0, o) : n.type === "target" && r.type === "target" ? (o[r.index] = n.id, o[n.index] = void 0, o) : (Ie("do nothing to the response"), i);
|
|
711
|
+
let s = e.response.findIndex((e) => e !== void 0 && e === n.id), c = e.response.findIndex((e) => e !== void 0 && e === r.id);
|
|
712
|
+
return Ie("fromIndex: ", s, "toIndex:", c), Le(e.response, s, c);
|
|
694
713
|
}
|
|
695
|
-
function
|
|
714
|
+
function J(e, t, n, r) {
|
|
696
715
|
if (r.includeTargets) {
|
|
697
716
|
let i = [];
|
|
698
717
|
for (let r = 0; r < t.length; r++) {
|
|
@@ -705,6 +724,7 @@ function q(e, t, n, r) {
|
|
|
705
724
|
}
|
|
706
725
|
return e.map((e) => t.indexOf(e.id) !== -1 && !r.allowSameChoiceInTargets ? {
|
|
707
726
|
type: "choice",
|
|
727
|
+
id: e.id,
|
|
708
728
|
empty: !0,
|
|
709
729
|
droppable: !0,
|
|
710
730
|
draggable: !1
|
|
@@ -726,26 +746,26 @@ function q(e, t, n, r) {
|
|
|
726
746
|
return i === 0 && t.push(a), t.push(o, a), t;
|
|
727
747
|
}, []);
|
|
728
748
|
}
|
|
729
|
-
function
|
|
749
|
+
function Be(e, t, r, i) {
|
|
730
750
|
return i = n({ includeTargets: !0 }, i), r ||= [], t = !t || a(t) ? i.includeTargets ? Array(e.length) : c(e, (e) => e.id) : t, {
|
|
731
751
|
choices: e,
|
|
732
752
|
response: t,
|
|
733
753
|
opts: i,
|
|
734
754
|
outcomes: r,
|
|
735
|
-
tiles:
|
|
755
|
+
tiles: J(e, t, r, i)
|
|
736
756
|
};
|
|
737
757
|
}
|
|
738
|
-
function
|
|
758
|
+
function Ve(e, t) {
|
|
739
759
|
switch (e.type) {
|
|
740
760
|
case "move": {
|
|
741
|
-
let { from: n, to: r } = e, i =
|
|
761
|
+
let { from: n, to: r } = e, i = ze(t, n, r), a = J(t.choices, i, t.outcomes, t.opts);
|
|
742
762
|
return Object.assign({}, t, {
|
|
743
763
|
response: i,
|
|
744
764
|
tiles: a
|
|
745
765
|
});
|
|
746
766
|
}
|
|
747
767
|
case "remove": {
|
|
748
|
-
let { target: n } = e, r =
|
|
768
|
+
let { target: n } = e, r = Re(t, n), i = J(t.choices, r, t.outcomes, t.opts);
|
|
749
769
|
return Object.assign({}, t, {
|
|
750
770
|
response: r,
|
|
751
771
|
tiles: i
|
|
@@ -756,54 +776,124 @@ function Be(e, t) {
|
|
|
756
776
|
}
|
|
757
777
|
//#endregion
|
|
758
778
|
//#region src/delivery/utils.ts
|
|
759
|
-
var
|
|
779
|
+
var He = (e, t) => {
|
|
760
780
|
if (!Array.isArray(e) || !Array.isArray(t) || e.length !== t.length) return !1;
|
|
761
781
|
let n = (e) => e.map((e) => JSON.stringify(e)).sort(), r = n(e), i = n(t), a = r.every((e, t) => e === i[t]), o = e.every((e, n) => JSON.stringify(e) === JSON.stringify(t[n]));
|
|
762
782
|
return a && !o;
|
|
763
|
-
}
|
|
783
|
+
}, Ue = (e, { active: t, context: n, currentCoordinates: r }) => {
|
|
784
|
+
let { code: i } = e, a = i === "Tab", o = i === h.Down || i === h.Up || i === h.Left || i === h.Right;
|
|
785
|
+
if (!a && !o) return;
|
|
786
|
+
if (o) return y(e, {
|
|
787
|
+
context: n,
|
|
788
|
+
currentCoordinates: r
|
|
789
|
+
});
|
|
790
|
+
e.preventDefault();
|
|
791
|
+
let { droppableRects: s, droppableContainers: c, collisionRect: l, draggableNodes: u, active: d } = n;
|
|
792
|
+
if (!s || s.size === 0) return r;
|
|
793
|
+
let f = {
|
|
794
|
+
x: (l?.width || 0) / 2,
|
|
795
|
+
y: (l?.height || 0) / 2
|
|
796
|
+
}, p = {
|
|
797
|
+
x: r.x + f.x,
|
|
798
|
+
y: r.y + f.y
|
|
799
|
+
}, m = u?.get(t)?.data?.current?.id, g = d?.rect?.current?.initial, _ = typeof t == "string" ? t.replace(/^tile-/, "drop-") : void 0, v = [], b;
|
|
800
|
+
for (let [e, t] of c) {
|
|
801
|
+
let n = t?.data?.current, r = e === _;
|
|
802
|
+
if (t?.disabled && !r) continue;
|
|
803
|
+
let i = n?.type === "choice" && n?.id === m;
|
|
804
|
+
if (n?.type === "choice" && !i) continue;
|
|
805
|
+
let a = (r ? g : null) || s.get(e);
|
|
806
|
+
if (!a) continue;
|
|
807
|
+
let o = {
|
|
808
|
+
x: a.left + a.width / 2,
|
|
809
|
+
y: a.top + a.height / 2
|
|
810
|
+
}, c = {
|
|
811
|
+
id: e,
|
|
812
|
+
dropPosition: {
|
|
813
|
+
x: a.left,
|
|
814
|
+
y: a.top + a.height / 2 - f.y
|
|
815
|
+
},
|
|
816
|
+
center: o
|
|
817
|
+
};
|
|
818
|
+
i ? b = c : v.push(c);
|
|
819
|
+
}
|
|
820
|
+
if (v.length === 0 && !b) return r;
|
|
821
|
+
let x = e.shiftKey;
|
|
822
|
+
v.sort((e, t) => Math.abs(e.center.y - t.center.y) > 10 ? e.center.y - t.center.y : e.center.x - t.center.x), b && v.push(b);
|
|
823
|
+
let S = 0, C = Infinity;
|
|
824
|
+
for (let e = 0; e < v.length; e++) {
|
|
825
|
+
let t = We(p, v[e].center);
|
|
826
|
+
t < C && (C = t, S = e);
|
|
827
|
+
}
|
|
828
|
+
return v[x ? (S - 1 + v.length) % v.length : (S + 1) % v.length].dropPosition;
|
|
829
|
+
}, We = (e, t) => Math.sqrt((e.x - t.x) ** 2 + (e.y - t.y) ** 2);
|
|
764
830
|
//#endregion
|
|
765
831
|
//#region src/delivery/placement-ordering.tsx
|
|
766
|
-
function
|
|
832
|
+
function Y(e) {
|
|
767
833
|
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
768
834
|
}
|
|
769
|
-
function
|
|
770
|
-
return !e ||
|
|
835
|
+
function X(e, t) {
|
|
836
|
+
return !e || Y(e) ? e : Y(e.default) ? e.default : t && Y(e[t]) ? e[t] : t && Y(e[t]?.default) ? e[t].default : e;
|
|
771
837
|
}
|
|
772
|
-
var
|
|
773
|
-
|
|
774
|
-
|
|
838
|
+
var Ge = X(D, "UiLayout") || X($.UiLayout, "UiLayout"), Z = X(T, "PreviewPrompt") || X($.PreviewPrompt, "PreviewPrompt"), Ke = X(p, "Feedback") || X($.Feedback, "Feedback"), qe = X(f, "Collapsible") || X($.Collapsible, "Collapsible"), Je = x, Q = Je.default, $ = Q && typeof Q == "object" ? Q : Je, Ye = 250, Xe = (e, t) => {
|
|
839
|
+
if (!e || !t) return !1;
|
|
840
|
+
let n = t.left + t.width / 2, r = t.top + t.height / 2;
|
|
841
|
+
return n >= e.left && n <= e.right && r >= e.top && r <= e.bottom;
|
|
842
|
+
}, Ze = (e) => e ? {
|
|
843
|
+
keyboardCoordinateGetter: Ue,
|
|
844
|
+
keyboardCodes: {
|
|
845
|
+
start: ["Space", "Enter"],
|
|
846
|
+
cancel: ["Escape"],
|
|
847
|
+
end: ["Space", "Enter"]
|
|
848
|
+
},
|
|
849
|
+
accessibility: { screenReaderInstructions: { draggable: "Press Space or Enter to pick up this answer choice. Once picked up, use Tab or Shift+Tab to cycle through response areas, or use arrow keys to move it freely. Press Space or Enter to drop, or Escape to cancel." } }
|
|
850
|
+
} : {}, { translator: Qe } = O, $e = (0, I.default)("pie-elements:placement-ordering"), et = b("div")({
|
|
851
|
+
color: w.text(),
|
|
852
|
+
backgroundColor: w.background(),
|
|
775
853
|
display: "flex",
|
|
776
854
|
flexDirection: "column",
|
|
777
855
|
alignItems: "center",
|
|
778
856
|
boxSizing: "border-box"
|
|
779
|
-
}),
|
|
857
|
+
}), tt = b("div")({
|
|
858
|
+
alignSelf: "stretch",
|
|
859
|
+
maxWidth: "100%",
|
|
860
|
+
overflowX: "auto",
|
|
861
|
+
overflowY: "hidden"
|
|
862
|
+
}), nt = b("div")({
|
|
863
|
+
display: "flex",
|
|
864
|
+
justifyContent: "center",
|
|
865
|
+
minWidth: "min-content"
|
|
866
|
+
}), rt = b("div")(({ theme: e }) => ({ paddingBottom: e.spacing(1) })), it = b("div")(({ theme: e }) => ({ paddingBottom: e.spacing(2) })), at = b(ge)(({ theme: e }) => ({ paddingBottom: e.spacing(1) })), ot = b(qe)(({ theme: e }) => ({
|
|
780
867
|
marginBottom: e.spacing(2),
|
|
781
868
|
alignSelf: "flex-start"
|
|
782
|
-
})),
|
|
869
|
+
})), st = (e) => {
|
|
783
870
|
let { tiler: t, ordering: n, onDropChoice: r, onRemoveChoice: i, ...a } = e;
|
|
784
|
-
return /* @__PURE__ */
|
|
871
|
+
return /* @__PURE__ */ P(t, {
|
|
785
872
|
...a,
|
|
786
873
|
tiles: n.tiles,
|
|
787
874
|
onDropChoice: (e, t) => r(e, t, n),
|
|
788
875
|
onRemoveChoice: (e) => i(e, n)
|
|
789
876
|
});
|
|
790
877
|
};
|
|
791
|
-
|
|
792
|
-
tiler:
|
|
793
|
-
ordering:
|
|
794
|
-
onDropChoice:
|
|
795
|
-
onRemoveChoice:
|
|
878
|
+
st.propTypes = {
|
|
879
|
+
tiler: L.default.func,
|
|
880
|
+
ordering: L.default.any,
|
|
881
|
+
onDropChoice: L.default.func,
|
|
882
|
+
onRemoveChoice: L.default.func
|
|
796
883
|
};
|
|
797
|
-
var
|
|
884
|
+
var ct = class extends k.Component {
|
|
798
885
|
static propTypes = {
|
|
799
|
-
onSessionChange:
|
|
800
|
-
model:
|
|
801
|
-
session:
|
|
886
|
+
onSessionChange: L.default.func.isRequired,
|
|
887
|
+
model: L.default.object.isRequired,
|
|
888
|
+
session: L.default.oneOfType([L.default.array.isRequired, L.default.object.isRequired])
|
|
802
889
|
};
|
|
803
890
|
constructor(e) {
|
|
804
891
|
super(e), this.instanceId = r();
|
|
805
892
|
let { value: t, needsReset: n } = this.validateSession(e);
|
|
806
|
-
this.state = {
|
|
893
|
+
this.state = {
|
|
894
|
+
showingCorrect: !1,
|
|
895
|
+
selectedChoice: null
|
|
896
|
+
}, this.lastDragEndAt = 0;
|
|
807
897
|
let { model: i } = e || {}, { env: a } = i || {}, { mode: o } = a || {};
|
|
808
898
|
n && o === "gather" && this.props.onSessionChange({
|
|
809
899
|
...e.session,
|
|
@@ -812,7 +902,7 @@ var $e = class extends D.Component {
|
|
|
812
902
|
}
|
|
813
903
|
toggleCorrect = (e) => this.setState({ showingCorrect: e });
|
|
814
904
|
componentDidUpdate() {
|
|
815
|
-
d(
|
|
905
|
+
d(N.findDOMNode(this));
|
|
816
906
|
}
|
|
817
907
|
validateSession = ({ model: e, session: t }, n = !1) => {
|
|
818
908
|
let { config: r, choices: i } = e || {}, { includeTargets: a } = r || {}, s = i.map((e) => e.id), { value: c } = t || {}, u;
|
|
@@ -831,9 +921,9 @@ var $e = class extends D.Component {
|
|
|
831
921
|
};
|
|
832
922
|
};
|
|
833
923
|
UNSAFE_componentWillReceiveProps(e) {
|
|
834
|
-
let { model: t = {} } = e || {}, { model: n = {} } = this.props || {}, { correctResponse: r, config: i, choices: a = [], env: o } = t, { includeTargets: s } = i || {}, c = {}, l = n.language && n.language !== t.language, u = n.note && n.note ===
|
|
835
|
-
l && u && (n.note =
|
|
836
|
-
let d =
|
|
924
|
+
let { model: t = {} } = e || {}, { model: n = {} } = this.props || {}, { correctResponse: r, config: i, choices: a = [], env: o } = t, { includeTargets: s } = i || {}, c = {}, l = n.language && n.language !== t.language, u = n.note && n.note === Qe.t("common:commonCorrectAnswerWithAlternates", { lng: n.language });
|
|
925
|
+
l && u && (n.note = Qe.t("common:commonCorrectAnswerWithAlternates", { lng: t.language })), r || (c.showingCorrect = !1);
|
|
926
|
+
let d = He(a, n.choices), { value: f, needsReset: p } = this.validateSession(e, d), m = {
|
|
837
927
|
...e.session,
|
|
838
928
|
value: f
|
|
839
929
|
}, h = n.config?.includeTargets !== s;
|
|
@@ -844,8 +934,8 @@ var $e = class extends D.Component {
|
|
|
844
934
|
}
|
|
845
935
|
onDropChoice = (e, t, n) => {
|
|
846
936
|
let { onSessionChange: r, session: i } = this.props, a = n.tiles.find((e) => e.id === t.id && e.type === t.type && e.index === t.index), o = e;
|
|
847
|
-
|
|
848
|
-
let s =
|
|
937
|
+
$e("[onDropChoice] ", a, o);
|
|
938
|
+
let s = Ve({
|
|
849
939
|
type: "move",
|
|
850
940
|
from: a,
|
|
851
941
|
to: o
|
|
@@ -854,8 +944,8 @@ var $e = class extends D.Component {
|
|
|
854
944
|
};
|
|
855
945
|
onRemoveChoice = (e, t) => {
|
|
856
946
|
let { onSessionChange: n, session: r } = this.props;
|
|
857
|
-
|
|
858
|
-
let i =
|
|
947
|
+
$e("[onRemoveChoice]", e);
|
|
948
|
+
let i = Ve({
|
|
859
949
|
type: "remove",
|
|
860
950
|
target: e
|
|
861
951
|
}, t);
|
|
@@ -866,88 +956,147 @@ var $e = class extends D.Component {
|
|
|
866
956
|
orientation: "vertical",
|
|
867
957
|
includeTargets: !0
|
|
868
958
|
};
|
|
869
|
-
return n ?
|
|
959
|
+
return n ? Be(e.choices, e.correctResponse, e.correctResponse.map((e) => ({
|
|
870
960
|
id: e,
|
|
871
961
|
outcome: "correct"
|
|
872
962
|
})), {
|
|
873
963
|
includeTargets: r,
|
|
874
964
|
allowSameChoiceInTargets: e.config.allowSameChoiceInTargets
|
|
875
|
-
}) :
|
|
965
|
+
}) : Be(e.choices, t.value, e.outcomes, {
|
|
876
966
|
includeTargets: r,
|
|
877
967
|
allowSameChoiceInTargets: e.config.allowSameChoiceInTargets
|
|
878
968
|
});
|
|
879
969
|
};
|
|
880
970
|
onDragEnd = (e) => {
|
|
881
971
|
let { over: t, active: n } = e, r = this.createOrdering();
|
|
882
|
-
if (t && n) {
|
|
972
|
+
if (this.cancelSelection(), this.lastDragEndAt = Date.now(), t && n) {
|
|
883
973
|
let e = n.data.current, i = t.data.current;
|
|
884
974
|
if (e && i && i.type === "target") {
|
|
885
|
-
this.onDropChoice(i, e, r);
|
|
975
|
+
this.onDropChoice(i, e, r), this.focusTile(this.getDestinationSlotId(i));
|
|
886
976
|
return;
|
|
887
977
|
}
|
|
888
|
-
e && i && this.onDropChoice(i, e, r);
|
|
978
|
+
e && i && (this.onDropChoice(i, e, r), this.focusTile(this.getDestinationSlotId(i)));
|
|
889
979
|
} else if (!t && n) {
|
|
890
|
-
let e = n.data.current;
|
|
891
|
-
e && e.type === "target" && this.onRemoveChoice(e, r)
|
|
980
|
+
let e = n.data.current, t = Xe(n.rect?.current?.initial, n.rect?.current?.translated);
|
|
981
|
+
e && e.type === "target" && !t && (this.onRemoveChoice(e, r), this.focusTile(this.getDestinationSlotId({
|
|
982
|
+
type: "choice",
|
|
983
|
+
id: e.id
|
|
984
|
+
})));
|
|
892
985
|
}
|
|
893
986
|
};
|
|
987
|
+
onDragStart = (e) => {
|
|
988
|
+
let { active: t } = e;
|
|
989
|
+
t?.data?.current && this.selectChoice(t.data.current);
|
|
990
|
+
};
|
|
991
|
+
onDragCancel = () => {
|
|
992
|
+
this.cancelSelection(), this.lastDragEndAt = Date.now();
|
|
993
|
+
};
|
|
994
|
+
isSameChoice = (e, t) => !!e && !!t && e.type === t.type && e.id === t.id && e.index === t.index;
|
|
995
|
+
selectChoice = (e) => {
|
|
996
|
+
this.setState({ selectedChoice: e });
|
|
997
|
+
};
|
|
998
|
+
toggleChoiceSelection = (e) => {
|
|
999
|
+
this.setState((t) => ({ selectedChoice: this.isSameChoice(t.selectedChoice, e) ? null : e }));
|
|
1000
|
+
};
|
|
1001
|
+
cancelSelection = () => {
|
|
1002
|
+
this.setState({ selectedChoice: null });
|
|
1003
|
+
};
|
|
1004
|
+
endAnyLiveKeyboardDrag = () => {
|
|
1005
|
+
document.dispatchEvent(new KeyboardEvent("keydown", {
|
|
1006
|
+
code: "Escape",
|
|
1007
|
+
bubbles: !0,
|
|
1008
|
+
cancelable: !0
|
|
1009
|
+
}));
|
|
1010
|
+
};
|
|
1011
|
+
placeSelectedChoice = (e) => {
|
|
1012
|
+
let { selectedChoice: t } = this.state;
|
|
1013
|
+
if (!t) return;
|
|
1014
|
+
let n = this.createOrdering(), r = this.getDestinationSlotId(e);
|
|
1015
|
+
this.onDropChoice(e, t, n), this.cancelSelection(), this.endAnyLiveKeyboardDrag(), this.lastDragEndAt = Date.now(), this.focusTile(r);
|
|
1016
|
+
};
|
|
1017
|
+
getDestinationSlotId = (e) => e ? e.type === "target" ? `target-${e.index}` : e.type === "choice" ? `choice-${e.id}` : null : null;
|
|
1018
|
+
focusTile = (e) => {
|
|
1019
|
+
if (!e) return;
|
|
1020
|
+
let t = `[data-tile-id="${this.instanceId}:${e}"]`;
|
|
1021
|
+
requestAnimationFrame(() => {
|
|
1022
|
+
requestAnimationFrame(() => {
|
|
1023
|
+
document.querySelector(t)?.focus();
|
|
1024
|
+
});
|
|
1025
|
+
});
|
|
1026
|
+
};
|
|
1027
|
+
isClickSoonAfterDragEnd = () => Date.now() - this.lastDragEndAt < Ye;
|
|
1028
|
+
onChoiceClick = (e) => {
|
|
1029
|
+
this.isClickSoonAfterDragEnd() || this.toggleChoiceSelection(e);
|
|
1030
|
+
};
|
|
1031
|
+
onPlacementClick = (e) => {
|
|
1032
|
+
this.isClickSoonAfterDragEnd() || this.placeSelectedChoice(e);
|
|
1033
|
+
};
|
|
894
1034
|
render() {
|
|
895
|
-
let { model: e } = this.props, { correctResponse: t, correctness: n, extraCSSRules: r, prompt: i, rationale: a, feedback: o, config: s, note: c, showNote: l, env: u, disabled: d, teacherInstructions: f, language:
|
|
1035
|
+
let { model: e } = this.props, { correctResponse: t, correctness: n, extraCSSRules: r, prompt: i, rationale: a, feedback: o, config: s, note: c, showNote: l, env: u, disabled: d, teacherInstructions: f, language: p } = e, h = t && t.length > 0, { showingCorrect: g } = this.state, _ = s || {
|
|
896
1036
|
orientation: "vertical",
|
|
897
1037
|
includeTargets: !0
|
|
898
|
-
}, { orientation:
|
|
899
|
-
color:
|
|
900
|
-
backgroundColor:
|
|
1038
|
+
}, { orientation: v, includeTargets: y } = _, b = v === "vertical", x = this.createOrdering(), { mode: S, role: T } = u || {}, D = b ? Fe : Pe, O = (g || S === "view" && T === "instructor") && l && c, k = a && (m(a) || C(a)), A = f && (m(f) || C(f)), j = {
|
|
1039
|
+
color: w.text(),
|
|
1040
|
+
backgroundColor: w.background(),
|
|
901
1041
|
display: "flex",
|
|
902
1042
|
flexDirection: "column",
|
|
903
1043
|
alignItems: "center",
|
|
904
|
-
boxSizing: "border-box"
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
1044
|
+
boxSizing: "border-box",
|
|
1045
|
+
width: "100%"
|
|
1046
|
+
}, M = y ? {
|
|
1047
|
+
selectedChoice: this.state.selectedChoice,
|
|
1048
|
+
onChoiceClick: this.onChoiceClick,
|
|
1049
|
+
onPlacementClick: this.onPlacementClick
|
|
1050
|
+
} : {};
|
|
1051
|
+
return /* @__PURE__ */ P(ee, {
|
|
1052
|
+
onDragStart: this.onDragStart,
|
|
908
1053
|
onDragEnd: this.onDragEnd,
|
|
909
|
-
|
|
910
|
-
|
|
1054
|
+
onDragCancel: this.onDragCancel,
|
|
1055
|
+
collisionDetection: E,
|
|
1056
|
+
modifiers: [ne],
|
|
1057
|
+
...Ze(y),
|
|
1058
|
+
children: /* @__PURE__ */ P(et, { children: /* @__PURE__ */ F(Ge, {
|
|
911
1059
|
extraCSSRules: r,
|
|
912
|
-
style:
|
|
1060
|
+
style: j,
|
|
913
1061
|
children: [
|
|
914
|
-
|
|
1062
|
+
A && /* @__PURE__ */ P(ot, {
|
|
915
1063
|
labels: {
|
|
916
1064
|
hidden: "Show Teacher Instructions",
|
|
917
1065
|
visible: "Hide Teacher Instructions"
|
|
918
1066
|
},
|
|
919
1067
|
className: "collapsible",
|
|
920
|
-
children: /* @__PURE__ */
|
|
1068
|
+
children: /* @__PURE__ */ P(Z, { prompt: f })
|
|
921
1069
|
}),
|
|
922
|
-
/* @__PURE__ */
|
|
923
|
-
/* @__PURE__ */
|
|
1070
|
+
/* @__PURE__ */ P(rt, { children: /* @__PURE__ */ P(Z, { prompt: i }) }),
|
|
1071
|
+
/* @__PURE__ */ P(at, {
|
|
924
1072
|
show: h,
|
|
925
1073
|
toggled: g,
|
|
926
1074
|
onToggle: this.toggleCorrect,
|
|
927
|
-
language:
|
|
1075
|
+
language: p
|
|
928
1076
|
}),
|
|
929
|
-
/* @__PURE__ */
|
|
1077
|
+
/* @__PURE__ */ P(tt, { children: /* @__PURE__ */ P(nt, { children: /* @__PURE__ */ P(st, {
|
|
930
1078
|
instanceId: this.instanceId,
|
|
931
1079
|
choiceLabel: _.choiceLabel,
|
|
932
1080
|
targetLabel: _.targetLabel,
|
|
933
|
-
ordering:
|
|
934
|
-
tiler:
|
|
1081
|
+
ordering: x,
|
|
1082
|
+
tiler: D,
|
|
935
1083
|
disabled: d,
|
|
936
1084
|
addGuide: _.showOrdering,
|
|
937
1085
|
tileSize: _.tileSize,
|
|
938
|
-
includeTargets:
|
|
939
|
-
choiceLabelEnabled: e.config && e.config.choiceLabelEnabled
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
O && /* @__PURE__ */
|
|
1086
|
+
includeTargets: y,
|
|
1087
|
+
choiceLabelEnabled: e.config && e.config.choiceLabelEnabled,
|
|
1088
|
+
...M
|
|
1089
|
+
}) }) }),
|
|
1090
|
+
O && /* @__PURE__ */ P(it, { dangerouslySetInnerHTML: { __html: c } }),
|
|
1091
|
+
k && /* @__PURE__ */ P(ot, {
|
|
943
1092
|
labels: {
|
|
944
1093
|
hidden: "Show Rationale",
|
|
945
1094
|
visible: "Hide Rationale"
|
|
946
1095
|
},
|
|
947
1096
|
className: "collapsible",
|
|
948
|
-
children: /* @__PURE__ */
|
|
1097
|
+
children: /* @__PURE__ */ P(Z, { prompt: a })
|
|
949
1098
|
}),
|
|
950
|
-
!g && /* @__PURE__ */
|
|
1099
|
+
!g && /* @__PURE__ */ P(Ke, {
|
|
951
1100
|
correctness: n,
|
|
952
1101
|
feedback: o
|
|
953
1102
|
})
|
|
@@ -955,24 +1104,24 @@ var $e = class extends D.Component {
|
|
|
955
1104
|
}) })
|
|
956
1105
|
});
|
|
957
1106
|
}
|
|
958
|
-
},
|
|
1107
|
+
}, lt = class extends k.Component {
|
|
959
1108
|
static propTypes = {
|
|
960
|
-
model:
|
|
961
|
-
session:
|
|
962
|
-
onSessionChange:
|
|
1109
|
+
model: L.default.object.isRequired,
|
|
1110
|
+
session: L.default.oneOfType([L.default.array.isRequired, L.default.object.isRequired]),
|
|
1111
|
+
onSessionChange: L.default.func.isRequired
|
|
963
1112
|
};
|
|
964
1113
|
render() {
|
|
965
1114
|
let { model: e, session: t, onSessionChange: n } = this.props;
|
|
966
|
-
return /* @__PURE__ */
|
|
1115
|
+
return /* @__PURE__ */ P(ct, {
|
|
967
1116
|
model: e,
|
|
968
1117
|
session: t,
|
|
969
1118
|
onSessionChange: n
|
|
970
1119
|
});
|
|
971
1120
|
}
|
|
972
|
-
},
|
|
1121
|
+
}, ut = (0, I.default)("pie-elements:placement-ordering"), dt = ({ model: t, session: n }) => {
|
|
973
1122
|
let { config: r } = t, i = (n && e(n.value) || []).length === t.choices.length;
|
|
974
1123
|
return r.includeTargets || i;
|
|
975
|
-
},
|
|
1124
|
+
}, ft = class extends HTMLElement {
|
|
976
1125
|
constructor() {
|
|
977
1126
|
super(), this._root = null, this._mathObserver = null, this._mathRenderPending = !1;
|
|
978
1127
|
}
|
|
@@ -997,7 +1146,7 @@ var $e = class extends D.Component {
|
|
|
997
1146
|
}
|
|
998
1147
|
isComplete = (t) => t && e(t).length === this._model.completeLength;
|
|
999
1148
|
sessionChange = (e) => {
|
|
1000
|
-
this._session.value = e.value, this.render(), this.dispatchEvent(new
|
|
1149
|
+
this._session.value = e.value, this.render(), this.dispatchEvent(new te(this.tagName.toLowerCase(), this._session && this.isComplete(this._session.value)));
|
|
1001
1150
|
};
|
|
1002
1151
|
set model(e) {
|
|
1003
1152
|
this._model = e, this.render(), this.dispatchEvent(new CustomEvent("model-set", {
|
|
@@ -1013,23 +1162,23 @@ var $e = class extends D.Component {
|
|
|
1013
1162
|
}
|
|
1014
1163
|
render() {
|
|
1015
1164
|
if (this._model && this._session) {
|
|
1016
|
-
|
|
1017
|
-
let e =
|
|
1165
|
+
ut("[render] session: ", this._session.value), ut("[render] model: ", this._model), this._initMathObserver();
|
|
1166
|
+
let e = k.createElement(lt, {
|
|
1018
1167
|
model: this._model,
|
|
1019
1168
|
session: this._session,
|
|
1020
1169
|
onSessionChange: this.sessionChange
|
|
1021
1170
|
});
|
|
1022
|
-
this._root ||=
|
|
1171
|
+
this._root ||= M(this), this._root.render(e);
|
|
1023
1172
|
}
|
|
1024
1173
|
}
|
|
1025
1174
|
connectedCallback() {
|
|
1026
|
-
this._initMathObserver();
|
|
1175
|
+
this._initMathObserver(), this.render();
|
|
1027
1176
|
}
|
|
1028
1177
|
disconnectedCallback() {
|
|
1029
|
-
this._disconnectMathObserver(), this._root
|
|
1178
|
+
this._disconnectMathObserver(), this._root &&= (this._root.unmount(), null);
|
|
1030
1179
|
}
|
|
1031
1180
|
};
|
|
1032
1181
|
//#endregion
|
|
1033
|
-
export {
|
|
1182
|
+
export { ft as default, dt as isValidSession };
|
|
1034
1183
|
|
|
1035
1184
|
//# sourceMappingURL=index.js.map
|