@pie-element/placement-ordering 14.1.2-next.5 → 14.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-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/author/index.js +22660 -25834
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/{browser-DHPggtaA.js → browser-Bd36Xf5z.js} +2 -2
- package/dist/browser/browser-Bd36Xf5z.js.map +1 -0
- package/dist/browser/controller/index.js +3 -3
- package/dist/browser/controller/index.js.map +1 -1
- package/dist/browser/delivery/index.js +436 -307
- package/dist/browser/delivery/index.js.map +1 -1
- package/dist/browser/{dist-D9ARZhQk.js → dist-DiGNNRzu.js} +2 -2
- package/dist/browser/{dist-D9ARZhQk.js.map → dist-DiGNNRzu.js.map} +1 -1
- package/dist/browser/{drag-provider-C1slTlsc.js → drag-provider-BdfhGCEU.js} +2474 -2529
- package/dist/browser/drag-provider-BdfhGCEU.js.map +1 -0
- package/dist/controller/scoring.js +1 -1
- package/dist/delivery/index.js +2 -2
- package/dist/delivery/keyboard-coordinates.d.ts +35 -0
- package/dist/delivery/keyboard-coordinates.js +48 -0
- package/dist/delivery/main.js +1 -1
- package/dist/delivery/ordering.js +1 -1
- package/dist/delivery/placement-ordering.d.ts +11 -0
- package/dist/delivery/placement-ordering.js +147 -79
- package/dist/delivery/tile.d.ts +3 -0
- package/dist/delivery/tile.js +66 -57
- 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 +14 -8
- package/dist/browser/browser-DHPggtaA.js.map +0 -1
- package/dist/browser/drag-provider-C1slTlsc.js.map +0 -1
|
@@ -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-Bd36Xf5z.js";
|
|
2
|
+
import { Lt as u, Rt as d, T as f, at as p, bt as m, c as h, ct as g, dt as _, ft as ee, l as v, lt as y, mt as b, n as x, ot as S, s as C, st as w, t as te, u as T, ut as E, v as D } from "../drag-provider-BdfhGCEU.js";
|
|
3
|
+
import { t as O } from "../dist-DiGNNRzu.js";
|
|
4
|
+
import k, { createElement as A, useRef as j } from "react";
|
|
5
|
+
import { createRoot as M } from "react-dom/client";
|
|
6
|
+
import ne from "react-dom";
|
|
7
|
+
import { jsx as N, jsxs as P } from "react/jsx-runtime";
|
|
8
8
|
//#region ../../shared/player-events/dist/index.js
|
|
9
|
-
var
|
|
9
|
+
var F = /* @__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 re = 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
|
+
}, I = /* @__PURE__ */ i(u(), 1);
|
|
41
|
+
function ie(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 ae = (e) => {
|
|
46
|
+
let { containerNodeRect: t, draggingNodeRect: n, transform: r } = e;
|
|
47
|
+
return !n || !t ? r : ie(r, n, t);
|
|
48
|
+
}, oe = ({ bgFill: e, fgFill: t }) => /* @__PURE__ */ P("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__ */ N("circle", {
|
|
47
55
|
cx: "-266",
|
|
48
56
|
cy: "375.9",
|
|
49
57
|
r: "14",
|
|
50
58
|
fill: e
|
|
51
59
|
}),
|
|
52
|
-
/* @__PURE__ */
|
|
60
|
+
/* @__PURE__ */ N("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__ */ N("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
70
|
oe.propTypes = {
|
|
63
|
-
bgFill:
|
|
64
|
-
fgFill:
|
|
71
|
+
bgFill: I.default.string.isRequired,
|
|
72
|
+
fgFill: I.default.string.isRequired
|
|
65
73
|
};
|
|
66
|
-
var se = ({ bgFill: e, fgFill: t, borderFill: n }) => /* @__PURE__ */
|
|
74
|
+
var se = ({ bgFill: e, fgFill: t, borderFill: n }) => /* @__PURE__ */ P("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__ */ N("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__ */ N("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__ */ N("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__ */ N("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__ */ N("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
114
|
se.propTypes = {
|
|
107
|
-
bgFill:
|
|
108
|
-
fgFill:
|
|
109
|
-
borderFill:
|
|
115
|
+
bgFill: I.default.string.isRequired,
|
|
116
|
+
fgFill: I.default.string.isRequired,
|
|
117
|
+
borderFill: I.default.string.isRequired
|
|
110
118
|
};
|
|
111
|
-
var ce =
|
|
119
|
+
var ce = b("div")(({ size: e }) => ({
|
|
112
120
|
width: e || "25px",
|
|
113
121
|
height: e || "25px"
|
|
114
|
-
})),
|
|
122
|
+
})), L = ({ open: e, size: t }) => /* @__PURE__ */ N(ce, {
|
|
115
123
|
size: t,
|
|
116
|
-
children: e ? /* @__PURE__ */
|
|
124
|
+
children: e ? /* @__PURE__ */ N(oe, {
|
|
117
125
|
bgFill: "#bce2ff",
|
|
118
126
|
fgFill: "#1a9cff"
|
|
119
|
-
}) : /* @__PURE__ */
|
|
127
|
+
}) : /* @__PURE__ */ N(se, {
|
|
120
128
|
bgFill: "white",
|
|
121
129
|
fgFill: "#1a9cff",
|
|
122
130
|
borderFill: "#bce2ff"
|
|
123
131
|
})
|
|
124
132
|
});
|
|
125
|
-
|
|
126
|
-
open:
|
|
127
|
-
size:
|
|
128
|
-
},
|
|
133
|
+
L.propTypes = {
|
|
134
|
+
open: I.default.bool,
|
|
135
|
+
size: I.default.string
|
|
136
|
+
}, L.defaultProps = { open: !1 };
|
|
129
137
|
//#endregion
|
|
130
138
|
//#region ../../lib-react/correct-answer-toggle/dist/expander.js
|
|
131
|
-
var le = "height ease-in 300ms, opacity ease-in 300ms", ue =
|
|
139
|
+
var le = "height ease-in 300ms, opacity ease-in 300ms", ue = b("div")(() => ({
|
|
132
140
|
position: "relative",
|
|
133
141
|
height: 0,
|
|
134
142
|
overflow: "hidden",
|
|
@@ -163,8 +171,8 @@ var le = "height ease-in 300ms, opacity ease-in 300ms", ue = y("div")(() => ({
|
|
|
163
171
|
width: 0
|
|
164
172
|
}
|
|
165
173
|
})), de = (e) => {
|
|
166
|
-
let { show: t, children: n, className: r } = e, i =
|
|
167
|
-
return /* @__PURE__ */
|
|
174
|
+
let { show: t, children: n, className: r } = e, i = j(null);
|
|
175
|
+
return /* @__PURE__ */ N(S, {
|
|
168
176
|
nodeRef: i,
|
|
169
177
|
in: t,
|
|
170
178
|
appear: !0,
|
|
@@ -176,7 +184,7 @@ 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__ */ N(ue, {
|
|
180
188
|
ref: i,
|
|
181
189
|
className: r,
|
|
182
190
|
children: n
|
|
@@ -184,41 +192,41 @@ var le = "height ease-in 300ms, opacity ease-in 300ms", ue = y("div")(() => ({
|
|
|
184
192
|
});
|
|
185
193
|
};
|
|
186
194
|
de.propTypes = {
|
|
187
|
-
show:
|
|
188
|
-
className:
|
|
189
|
-
children:
|
|
195
|
+
show: I.default.bool.isRequired,
|
|
196
|
+
className: I.default.string,
|
|
197
|
+
children: I.default.oneOfType([I.default.arrayOf(I.default.node), I.default.node]).isRequired
|
|
190
198
|
};
|
|
191
199
|
//#endregion
|
|
192
200
|
//#region ../../lib-react/correct-answer-toggle/dist/index.js
|
|
193
|
-
function
|
|
201
|
+
function R(e) {
|
|
194
202
|
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
195
203
|
}
|
|
196
|
-
function
|
|
197
|
-
return !e ||
|
|
204
|
+
function z(e, t) {
|
|
205
|
+
return !e || R(e) ? e : R(e.default) ? e.default : t && R(e[t]) ? e[t] : t && R(e[t]?.default) ? e[t].default : e;
|
|
198
206
|
}
|
|
199
|
-
var fe =
|
|
207
|
+
var fe = z(v, "Readable") || z(pe.Readable, "Readable"), B = x, V = B.default, pe = V && typeof V == "object" ? V : B, { translator: H } = O, me = {
|
|
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
|
-
}, he =
|
|
214
|
+
}, he = b("div")(() => ({
|
|
207
215
|
width: "100%",
|
|
208
216
|
cursor: "pointer"
|
|
209
|
-
})), ge =
|
|
217
|
+
})), ge = b("div")(() => ({
|
|
210
218
|
margin: "0 auto",
|
|
211
219
|
textAlign: "center",
|
|
212
220
|
display: "flex"
|
|
213
|
-
})), _e =
|
|
221
|
+
})), _e = 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
228
|
...me
|
|
221
|
-
})),
|
|
229
|
+
})), U = 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
|
-
})), ve =
|
|
242
|
+
})), ve = b("div")(() => ({
|
|
235
243
|
width: "25px",
|
|
236
244
|
marginRight: "5px",
|
|
237
245
|
display: "flex",
|
|
238
246
|
alignItems: "center"
|
|
239
|
-
})), ye = class e extends
|
|
247
|
+
})), ye = 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: I.default.func,
|
|
250
|
+
toggled: I.default.bool,
|
|
251
|
+
show: I.default.bool,
|
|
252
|
+
hideMessage: I.default.string,
|
|
253
|
+
showMessage: I.default.string,
|
|
254
|
+
className: I.default.string,
|
|
255
|
+
language: I.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: H.t("common:showCorrectAnswer", { lng: t.language }),
|
|
267
|
+
hideMessage: H.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: H.t("common:showCorrectAnswer", { lng: t.language }),
|
|
280
|
+
hideMessage: H.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__ */ N(he, {
|
|
278
286
|
className: e,
|
|
279
|
-
children: /* @__PURE__ */
|
|
287
|
+
children: /* @__PURE__ */ N(de, {
|
|
280
288
|
show: this.state.show,
|
|
281
|
-
children: /* @__PURE__ */
|
|
289
|
+
children: /* @__PURE__ */ P(ge, {
|
|
282
290
|
onClick: this.onClick.bind(this),
|
|
283
291
|
onTouchEnd: this.onTouch.bind(this),
|
|
284
|
-
children: [/* @__PURE__ */
|
|
292
|
+
children: [/* @__PURE__ */ P(ve, { children: [/* @__PURE__ */ N(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__ */ N(U, {
|
|
296
304
|
ref: this.openIconRef,
|
|
297
|
-
children: /* @__PURE__ */
|
|
305
|
+
children: /* @__PURE__ */ N(L, { open: t }, "correct-open")
|
|
298
306
|
})
|
|
299
|
-
}), /* @__PURE__ */
|
|
307
|
+
}), /* @__PURE__ */ N(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__ */ N(U, {
|
|
311
319
|
ref: this.closedIconRef,
|
|
312
|
-
children: /* @__PURE__ */
|
|
320
|
+
children: /* @__PURE__ */ N(L, { open: t }, "correct-closed")
|
|
313
321
|
})
|
|
314
|
-
})] }), /* @__PURE__ */
|
|
322
|
+
})] }), /* @__PURE__ */ N(fe, {
|
|
315
323
|
false: !0,
|
|
316
|
-
children: /* @__PURE__ */
|
|
324
|
+
children: /* @__PURE__ */ N(_e, {
|
|
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 W(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 = W(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 be() {
|
|
346
|
+
for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t = W(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 xe = 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
372
|
background: e.palette.background.paper
|
|
365
373
|
},
|
|
366
374
|
"&.over": {
|
|
367
|
-
border: `1px solid ${
|
|
368
|
-
backgroundColor: `${
|
|
375
|
+
border: `1px solid ${m[500]}`,
|
|
376
|
+
backgroundColor: `${m[300]}`
|
|
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.backgroundDark()
|
|
380
388
|
},
|
|
381
389
|
"&.categorizeBoard": {
|
|
382
390
|
padding: e.spacing(.5),
|
|
@@ -387,312 +395,324 @@ var be = y("div")(({ theme: e }) => ({
|
|
|
387
395
|
justifyContent: "center",
|
|
388
396
|
overflow: "hidden",
|
|
389
397
|
touchAction: "none",
|
|
390
|
-
backgroundColor:
|
|
398
|
+
backgroundColor: w.backgroundDark()
|
|
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
|
+
})), Se = (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 = be("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.backgroundDark());
|
|
403
411
|
let m = c ? "categorizeBoard" : "board";
|
|
404
|
-
return /* @__PURE__ */
|
|
412
|
+
return /* @__PURE__ */ N(xe, {
|
|
405
413
|
style: {
|
|
406
414
|
...p,
|
|
407
415
|
minHeight: u,
|
|
408
416
|
...d
|
|
409
417
|
},
|
|
410
|
-
className:
|
|
418
|
+
className: be(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
|
+
Se.propTypes = {
|
|
423
|
+
choiceBoard: I.default.bool,
|
|
424
|
+
grid: I.default.shape({
|
|
425
|
+
columns: I.default.number,
|
|
426
|
+
rows: I.default.number,
|
|
427
|
+
rowsRepeatValue: I.default.string
|
|
420
428
|
}),
|
|
421
|
-
children:
|
|
422
|
-
className:
|
|
423
|
-
isOver:
|
|
424
|
-
index:
|
|
425
|
-
type:
|
|
426
|
-
disabled:
|
|
427
|
-
isCategorize:
|
|
428
|
-
isVerticalPool:
|
|
429
|
-
minHeight:
|
|
429
|
+
children: I.default.oneOfType([I.default.arrayOf(I.default.node), I.default.node]).isRequired,
|
|
430
|
+
className: I.default.string,
|
|
431
|
+
isOver: I.default.bool,
|
|
432
|
+
index: I.default.number,
|
|
433
|
+
type: I.default.string,
|
|
434
|
+
disabled: I.default.bool,
|
|
435
|
+
isCategorize: I.default.bool,
|
|
436
|
+
isVerticalPool: I.default.bool,
|
|
437
|
+
minHeight: I.default.number
|
|
430
438
|
};
|
|
431
439
|
//#endregion
|
|
432
440
|
//#region src/delivery/tile.tsx
|
|
433
|
-
var
|
|
441
|
+
var Ce = (0, F.default)("pie-elements:placement-ordering:tile"), we = 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
|
+
})), Te = ({ type: e, index: t, isOver: n, disabled: r }) => /* @__PURE__ */ N(Se, {
|
|
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__ */ N(we, { children: t })
|
|
443
451
|
});
|
|
444
|
-
|
|
445
|
-
type:
|
|
446
|
-
index:
|
|
447
|
-
isOver:
|
|
448
|
-
disabled:
|
|
452
|
+
Te.propTypes = {
|
|
453
|
+
type: I.default.string,
|
|
454
|
+
index: I.default.number,
|
|
455
|
+
isOver: I.default.bool,
|
|
456
|
+
disabled: I.default.bool
|
|
449
457
|
};
|
|
450
|
-
var
|
|
451
|
-
cursor:
|
|
458
|
+
var Ee = 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
|
+
})), De = (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__ */ N(Te, {
|
|
497
505
|
type: t,
|
|
498
|
-
index:
|
|
499
|
-
isOver:
|
|
500
|
-
disabled:
|
|
501
|
-
}) : /* @__PURE__ */
|
|
506
|
+
index: l,
|
|
507
|
+
isOver: a,
|
|
508
|
+
disabled: s
|
|
509
|
+
}) : /* @__PURE__ */ N(Ee, {
|
|
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
|
+
}, G = (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}`, g = `drop-${n}-${r ?? "empty"}-${d}-${l}`, v = {
|
|
521
|
+
id: r,
|
|
522
|
+
type: n,
|
|
523
|
+
instanceId: l,
|
|
524
|
+
value: t,
|
|
525
|
+
index: s
|
|
526
|
+
}, { attributes: y, listeners: b, setNodeRef: x, transform: S, isDragging: C } = _({
|
|
527
|
+
id: h,
|
|
528
|
+
data: v,
|
|
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: w, isOver: te } = ee({
|
|
531
|
+
id: g,
|
|
532
|
+
data: v,
|
|
533
|
+
disabled: C
|
|
534
|
+
}), T = !!f && f.type === v.type && f.id === v.id && f.index === v.index, [E, D] = k.useState(!1), O = !!f && !a, A = te || n === "target" && O && E, j = () => {
|
|
535
|
+
a || (n === "choice" ? f?.type === "target" ? m?.(v) : u && p?.(v) : n === "target" && (T ? p?.(v) : f ? m?.(v) : u && p?.(v)));
|
|
536
|
+
}, M = !(u && !a) && !a, ne = (e) => {
|
|
537
|
+
(e.code === "Space" || e.code === "Enter") && (e.preventDefault(), j());
|
|
538
|
+
}, P = k.useRef(null);
|
|
539
|
+
return k.useEffect(() => {
|
|
540
|
+
let e = P.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
|
-
}, []),
|
|
546
|
+
}, []), Ce("[render], props: ", e), /* @__PURE__ */ N("div", {
|
|
540
547
|
ref: (e) => {
|
|
541
|
-
|
|
548
|
+
P.current = e, x(e), w(e);
|
|
542
549
|
},
|
|
543
550
|
style: {
|
|
544
|
-
transform:
|
|
551
|
+
transform: S ? `translate3d(${S.x}px, ${S.y}px, 0)` : void 0,
|
|
545
552
|
boxSizing: "border-box",
|
|
546
553
|
overflow: "visible",
|
|
547
554
|
padding: 0,
|
|
548
555
|
margin: 0,
|
|
549
556
|
textAlign: "center",
|
|
550
557
|
pointerEvents: "auto",
|
|
551
|
-
cursor: a ? "not-allowed" :
|
|
552
|
-
zIndex:
|
|
553
|
-
willChange:
|
|
558
|
+
cursor: a ? "not-allowed" : n === "target" && O ? "pointer" : C ? "grabbing" : "grab",
|
|
559
|
+
zIndex: C ? 1e3 : "auto",
|
|
560
|
+
willChange: C ? "transform" : "auto"
|
|
554
561
|
},
|
|
562
|
+
role: M ? "button" : void 0,
|
|
563
|
+
tabIndex: M ? 0 : void 0,
|
|
564
|
+
onKeyDown: M ? ne : void 0,
|
|
565
|
+
onClick: j,
|
|
566
|
+
onMouseEnter: () => D(!0),
|
|
567
|
+
onMouseLeave: () => D(!1),
|
|
555
568
|
...u && !a ? {
|
|
556
|
-
...
|
|
557
|
-
...
|
|
569
|
+
...b,
|
|
570
|
+
...y
|
|
558
571
|
} : {},
|
|
559
|
-
children: /* @__PURE__ */
|
|
572
|
+
children: /* @__PURE__ */ N(De, {
|
|
560
573
|
label: t,
|
|
561
574
|
id: r,
|
|
562
575
|
empty: i,
|
|
563
576
|
index: s,
|
|
564
577
|
guideIndex: c,
|
|
565
|
-
isOver:
|
|
566
|
-
isDragging:
|
|
578
|
+
isOver: A,
|
|
579
|
+
isDragging: C,
|
|
580
|
+
isSelected: T,
|
|
567
581
|
disabled: a,
|
|
568
582
|
outcome: o,
|
|
569
583
|
type: n
|
|
570
584
|
})
|
|
571
585
|
});
|
|
572
586
|
};
|
|
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:
|
|
587
|
+
G.propTypes = {
|
|
588
|
+
id: I.default.any,
|
|
589
|
+
label: I.default.string,
|
|
590
|
+
isOver: I.default.bool,
|
|
591
|
+
type: I.default.string,
|
|
592
|
+
empty: I.default.bool,
|
|
593
|
+
disabled: I.default.bool,
|
|
594
|
+
outcome: I.default.string,
|
|
595
|
+
index: I.default.number,
|
|
596
|
+
guideIndex: I.default.number,
|
|
597
|
+
instanceId: I.default.any,
|
|
598
|
+
draggable: I.default.bool,
|
|
599
|
+
tileIndex: I.default.number,
|
|
600
|
+
selectedChoice: I.default.object,
|
|
601
|
+
onChoiceClick: I.default.func,
|
|
602
|
+
onPlacementClick: I.default.func
|
|
586
603
|
};
|
|
587
604
|
//#endregion
|
|
588
605
|
//#region src/delivery/tiler.tsx
|
|
589
|
-
var
|
|
590
|
-
choiceLabel:
|
|
591
|
-
targetLabel:
|
|
592
|
-
disabled:
|
|
593
|
-
tiles:
|
|
594
|
-
tileSize:
|
|
595
|
-
addGuide:
|
|
596
|
-
|
|
606
|
+
var K = {
|
|
607
|
+
choiceLabel: I.default.string,
|
|
608
|
+
targetLabel: I.default.string,
|
|
609
|
+
disabled: I.default.bool,
|
|
610
|
+
tiles: I.default.array.isRequired,
|
|
611
|
+
tileSize: I.default.string,
|
|
612
|
+
addGuide: I.default.bool,
|
|
613
|
+
selectedChoice: I.default.object,
|
|
614
|
+
onChoiceClick: I.default.func,
|
|
615
|
+
onPlacementClick: I.default.func
|
|
616
|
+
}, Oe = {
|
|
597
617
|
tileSize: "1fr",
|
|
598
618
|
disabled: !1,
|
|
599
619
|
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__ */
|
|
620
|
+
}, ke = (e) => {
|
|
621
|
+
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(G, {
|
|
602
622
|
...t,
|
|
603
623
|
key: n
|
|
604
|
-
}) : /* @__PURE__ */
|
|
624
|
+
}) : /* @__PURE__ */ A(G, {
|
|
605
625
|
...t,
|
|
606
626
|
label: "",
|
|
607
627
|
key: n
|
|
608
628
|
}));
|
|
609
|
-
return t.propTypes = { ...
|
|
610
|
-
},
|
|
629
|
+
return t.propTypes = { ...K }, t;
|
|
630
|
+
}, Ae = b("div")(({ theme: e, includeTargets: t }) => ({
|
|
611
631
|
display: "grid",
|
|
612
632
|
paddingBottom: e.spacing(2),
|
|
613
633
|
...t && { gridGap: "10px" }
|
|
614
|
-
})),
|
|
634
|
+
})), je = b("div")({ textAlign: "center" }), Me = b("div")({
|
|
615
635
|
textAlign: "center",
|
|
616
636
|
gridRow: "3/4"
|
|
617
|
-
}),
|
|
637
|
+
}), Ne = b("div")(({ includeTargets: e }) => ({
|
|
618
638
|
gridAutoFlow: "column",
|
|
619
639
|
display: "grid",
|
|
620
640
|
...e && { gridGap: "10px" }
|
|
621
|
-
})),
|
|
641
|
+
})), Pe = b("div")({
|
|
622
642
|
gridColumn: "1/2",
|
|
623
643
|
textAlign: "center"
|
|
624
|
-
}),
|
|
644
|
+
}), Fe = b("div")({
|
|
625
645
|
gridColumn: "2/3",
|
|
626
646
|
textAlign: "center"
|
|
627
|
-
}),
|
|
628
|
-
static propTypes = { ...
|
|
629
|
-
static defaultProps = { ...
|
|
647
|
+
}), Ie = class extends k.Component {
|
|
648
|
+
static propTypes = { ...K };
|
|
649
|
+
static defaultProps = { ...Oe };
|
|
630
650
|
render() {
|
|
631
651
|
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
652
|
gridTemplateColumns: e ? `repeat(${s}, ${a})` : `auto repeat(${Math.floor(s / 2) - 1}, ${a} 10px) ${a} auto`,
|
|
633
653
|
gridTemplateRows: o
|
|
634
654
|
}, l = { gridColumn: `1/${s + 1}` };
|
|
635
|
-
return /* @__PURE__ */
|
|
655
|
+
return /* @__PURE__ */ P(Ae, {
|
|
636
656
|
includeTargets: e,
|
|
637
657
|
style: c,
|
|
638
658
|
children: [
|
|
639
|
-
/* @__PURE__ */
|
|
659
|
+
/* @__PURE__ */ N(je, {
|
|
640
660
|
style: l,
|
|
641
661
|
dangerouslySetInnerHTML: { __html: t ? n : "" }
|
|
642
662
|
}),
|
|
643
|
-
e && /* @__PURE__ */
|
|
663
|
+
e && /* @__PURE__ */ N(Me, {
|
|
644
664
|
style: l,
|
|
645
665
|
dangerouslySetInnerHTML: { __html: r }
|
|
646
666
|
}),
|
|
647
|
-
i.map(
|
|
667
|
+
i.map(ke(this.props))
|
|
648
668
|
]
|
|
649
669
|
});
|
|
650
670
|
}
|
|
651
|
-
},
|
|
652
|
-
static propTypes = { ...
|
|
653
|
-
static defaultProps = { ...
|
|
671
|
+
}, Le = class extends k.Component {
|
|
672
|
+
static propTypes = { ...K };
|
|
673
|
+
static defaultProps = { ...Oe };
|
|
654
674
|
render() {
|
|
655
675
|
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__ */
|
|
676
|
+
return /* @__PURE__ */ P(Ne, {
|
|
657
677
|
includeTargets: e,
|
|
658
678
|
style: {
|
|
659
679
|
gridTemplateColumns: `repeat(${o}, ${a})`,
|
|
660
680
|
gridTemplateRows: e ? `auto repeat(${s}, ${a})` : `auto auto repeat(${Math.floor(s / 2) - 1}, ${a} 10px) ${a} auto`
|
|
661
681
|
},
|
|
662
682
|
children: [
|
|
663
|
-
/* @__PURE__ */
|
|
664
|
-
e && /* @__PURE__ */
|
|
665
|
-
i.map(
|
|
683
|
+
/* @__PURE__ */ N(Pe, { dangerouslySetInnerHTML: { __html: t ? n : "" } }),
|
|
684
|
+
e && /* @__PURE__ */ N(Fe, { dangerouslySetInnerHTML: { __html: r } }),
|
|
685
|
+
i.map(ke(this.props))
|
|
666
686
|
]
|
|
667
687
|
});
|
|
668
688
|
}
|
|
669
|
-
},
|
|
689
|
+
}, q = (0, F.default)("pie-elements:placement-ordering:ordering"), Re = (e, t, n) => {
|
|
670
690
|
let r = e.find((e, n) => n === t), i = e.filter((e, n) => n !== t);
|
|
671
691
|
return [
|
|
672
692
|
...i.slice(0, n),
|
|
673
693
|
r,
|
|
674
694
|
...i.slice(n)
|
|
675
695
|
];
|
|
676
|
-
},
|
|
677
|
-
if (
|
|
696
|
+
}, ze = (e, n, r) => {
|
|
697
|
+
if (q("[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
698
|
let i = t(e), a = e[r];
|
|
679
699
|
return i[r] = i[n], i[n] = a, i;
|
|
680
700
|
};
|
|
681
|
-
function
|
|
701
|
+
function Be(e, n) {
|
|
682
702
|
let r = t(e.response);
|
|
683
703
|
if (r[n.index] === n.id) r[n.index] = void 0;
|
|
684
704
|
else throw Error(`Tried to remove from index: ${n.index}, but the id doesn't match: array: ${r}, target: ${n.id}`);
|
|
685
705
|
return r;
|
|
686
706
|
}
|
|
687
|
-
function
|
|
707
|
+
function Ve(e, n, r) {
|
|
688
708
|
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" ?
|
|
709
|
+
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" ? ze(i, n.index, r.index) : (q("do nothing to the response"), i);
|
|
690
710
|
{
|
|
691
711
|
let t = e.response.findIndex((e) => e !== void 0 && e === n.id), i = e.response.findIndex((e) => e !== void 0 && e === r.id);
|
|
692
|
-
return
|
|
712
|
+
return q("fromIndex: ", t, "toIndex:", i), Re(e.response, t, i);
|
|
693
713
|
}
|
|
694
714
|
}
|
|
695
|
-
function
|
|
715
|
+
function J(e, t, n, r) {
|
|
696
716
|
if (r.includeTargets) {
|
|
697
717
|
let i = [];
|
|
698
718
|
for (let r = 0; r < t.length; r++) {
|
|
@@ -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 He(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 Ue(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 = Ve(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 = Be(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,117 @@ function Be(e, t) {
|
|
|
756
776
|
}
|
|
757
777
|
//#endregion
|
|
758
778
|
//#region src/delivery/utils.ts
|
|
759
|
-
var
|
|
779
|
+
var We = (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
|
+
}, Ge = (e, { active: t, context: n, currentCoordinates: r }) => {
|
|
784
|
+
let { code: i } = e, a = i === "Tab", o = i === g.Down || i === g.Up || i === g.Left || i === g.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 } = n;
|
|
792
|
+
if (!s || s.size === 0) return r;
|
|
793
|
+
let u = {
|
|
794
|
+
x: (l?.width || 0) / 2,
|
|
795
|
+
y: (l?.height || 0) / 2
|
|
796
|
+
}, d = {
|
|
797
|
+
x: r.x + u.x,
|
|
798
|
+
y: r.y + u.y
|
|
799
|
+
}, f = t?.data?.current?.type === "choice", p = [];
|
|
800
|
+
for (let [e, t] of c) {
|
|
801
|
+
if (t?.disabled || f && t?.data?.current?.type === "choice") continue;
|
|
802
|
+
let n = s.get(e);
|
|
803
|
+
if (!n) continue;
|
|
804
|
+
let r = {
|
|
805
|
+
x: n.left + n.width / 2,
|
|
806
|
+
y: n.top + n.height / 2
|
|
807
|
+
}, i = {
|
|
808
|
+
x: n.left,
|
|
809
|
+
y: n.top + n.height / 2
|
|
810
|
+
};
|
|
811
|
+
p.push({
|
|
812
|
+
id: e,
|
|
813
|
+
dropPosition: i,
|
|
814
|
+
center: r
|
|
815
|
+
});
|
|
816
|
+
}
|
|
817
|
+
if (p.length === 0) return r;
|
|
818
|
+
let m = e.shiftKey;
|
|
819
|
+
p.sort((e, t) => Math.abs(e.center.y - t.center.y) > 10 ? e.center.y - t.center.y : e.center.x - t.center.x);
|
|
820
|
+
let h = 0, _ = Infinity;
|
|
821
|
+
for (let e = 0; e < p.length; e++) {
|
|
822
|
+
let t = Ke(d, p[e].center);
|
|
823
|
+
t < _ && (_ = t, h = e);
|
|
824
|
+
}
|
|
825
|
+
return p[m ? (h - 1 + p.length) % p.length : (h + 1) % p.length].dropPosition;
|
|
826
|
+
}, Ke = (e, t) => Math.sqrt((e.x - t.x) ** 2 + (e.y - t.y) ** 2);
|
|
764
827
|
//#endregion
|
|
765
828
|
//#region src/delivery/placement-ordering.tsx
|
|
766
|
-
function
|
|
829
|
+
function Y(e) {
|
|
767
830
|
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
768
831
|
}
|
|
769
|
-
function
|
|
770
|
-
return !e ||
|
|
832
|
+
function X(e, t) {
|
|
833
|
+
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
834
|
}
|
|
772
|
-
var
|
|
773
|
-
|
|
774
|
-
|
|
835
|
+
var qe = X(D, "UiLayout") || X($.UiLayout, "UiLayout"), Z = X(T, "PreviewPrompt") || X($.PreviewPrompt, "PreviewPrompt"), Je = X(p, "Feedback") || X($.Feedback, "Feedback"), Ye = X(f, "Collapsible") || X($.Collapsible, "Collapsible"), Xe = x, Q = Xe.default, $ = Q && typeof Q == "object" ? Q : Xe, Ze = 250, Qe = (e) => e ? {
|
|
836
|
+
keyboardCoordinateGetter: Ge,
|
|
837
|
+
keyboardCodes: {
|
|
838
|
+
start: ["Space", "Enter"],
|
|
839
|
+
cancel: ["Escape"],
|
|
840
|
+
end: ["Space", "Enter"]
|
|
841
|
+
},
|
|
842
|
+
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." } }
|
|
843
|
+
} : {}, { translator: $e } = O, et = (0, F.default)("pie-elements:placement-ordering"), tt = b("div")({
|
|
844
|
+
color: w.text(),
|
|
845
|
+
backgroundColor: w.background(),
|
|
775
846
|
display: "flex",
|
|
776
847
|
flexDirection: "column",
|
|
777
848
|
alignItems: "center",
|
|
778
849
|
boxSizing: "border-box"
|
|
779
|
-
}),
|
|
850
|
+
}), nt = b("div")({
|
|
851
|
+
alignSelf: "stretch",
|
|
852
|
+
maxWidth: "100%",
|
|
853
|
+
overflowX: "auto",
|
|
854
|
+
overflowY: "hidden"
|
|
855
|
+
}), rt = b("div")({
|
|
856
|
+
display: "flex",
|
|
857
|
+
justifyContent: "center",
|
|
858
|
+
minWidth: "min-content"
|
|
859
|
+
}), it = b("div")(({ theme: e }) => ({ paddingBottom: e.spacing(1) })), at = b("div")(({ theme: e }) => ({ paddingBottom: e.spacing(2) })), ot = b(ye)(({ theme: e }) => ({ paddingBottom: e.spacing(1) })), st = b(Ye)(({ theme: e }) => ({
|
|
780
860
|
marginBottom: e.spacing(2),
|
|
781
861
|
alignSelf: "flex-start"
|
|
782
|
-
})),
|
|
862
|
+
})), ct = (e) => {
|
|
783
863
|
let { tiler: t, ordering: n, onDropChoice: r, onRemoveChoice: i, ...a } = e;
|
|
784
|
-
return /* @__PURE__ */
|
|
864
|
+
return /* @__PURE__ */ N(t, {
|
|
785
865
|
...a,
|
|
786
866
|
tiles: n.tiles,
|
|
787
867
|
onDropChoice: (e, t) => r(e, t, n),
|
|
788
868
|
onRemoveChoice: (e) => i(e, n)
|
|
789
869
|
});
|
|
790
870
|
};
|
|
791
|
-
|
|
792
|
-
tiler:
|
|
793
|
-
ordering:
|
|
794
|
-
onDropChoice:
|
|
795
|
-
onRemoveChoice:
|
|
871
|
+
ct.propTypes = {
|
|
872
|
+
tiler: I.default.func,
|
|
873
|
+
ordering: I.default.any,
|
|
874
|
+
onDropChoice: I.default.func,
|
|
875
|
+
onRemoveChoice: I.default.func
|
|
796
876
|
};
|
|
797
|
-
var
|
|
877
|
+
var lt = class extends k.Component {
|
|
798
878
|
static propTypes = {
|
|
799
|
-
onSessionChange:
|
|
800
|
-
model:
|
|
801
|
-
session:
|
|
879
|
+
onSessionChange: I.default.func.isRequired,
|
|
880
|
+
model: I.default.object.isRequired,
|
|
881
|
+
session: I.default.oneOfType([I.default.array.isRequired, I.default.object.isRequired])
|
|
802
882
|
};
|
|
803
883
|
constructor(e) {
|
|
804
884
|
super(e), this.instanceId = r();
|
|
805
885
|
let { value: t, needsReset: n } = this.validateSession(e);
|
|
806
|
-
this.state = {
|
|
886
|
+
this.state = {
|
|
887
|
+
showingCorrect: !1,
|
|
888
|
+
selectedChoice: null
|
|
889
|
+
}, this.lastDragEndAt = 0;
|
|
807
890
|
let { model: i } = e || {}, { env: a } = i || {}, { mode: o } = a || {};
|
|
808
891
|
n && o === "gather" && this.props.onSessionChange({
|
|
809
892
|
...e.session,
|
|
@@ -812,7 +895,7 @@ var $e = class extends D.Component {
|
|
|
812
895
|
}
|
|
813
896
|
toggleCorrect = (e) => this.setState({ showingCorrect: e });
|
|
814
897
|
componentDidUpdate() {
|
|
815
|
-
d(
|
|
898
|
+
d(ne.findDOMNode(this));
|
|
816
899
|
}
|
|
817
900
|
validateSession = ({ model: e, session: t }, n = !1) => {
|
|
818
901
|
let { config: r, choices: i } = e || {}, { includeTargets: a } = r || {}, s = i.map((e) => e.id), { value: c } = t || {}, u;
|
|
@@ -831,9 +914,9 @@ var $e = class extends D.Component {
|
|
|
831
914
|
};
|
|
832
915
|
};
|
|
833
916
|
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 =
|
|
917
|
+
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 === $e.t("common:commonCorrectAnswerWithAlternates", { lng: n.language });
|
|
918
|
+
l && u && (n.note = $e.t("common:commonCorrectAnswerWithAlternates", { lng: t.language })), r || (c.showingCorrect = !1);
|
|
919
|
+
let d = We(a, n.choices), { value: f, needsReset: p } = this.validateSession(e, d), m = {
|
|
837
920
|
...e.session,
|
|
838
921
|
value: f
|
|
839
922
|
}, h = n.config?.includeTargets !== s;
|
|
@@ -844,8 +927,8 @@ var $e = class extends D.Component {
|
|
|
844
927
|
}
|
|
845
928
|
onDropChoice = (e, t, n) => {
|
|
846
929
|
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 =
|
|
930
|
+
et("[onDropChoice] ", a, o);
|
|
931
|
+
let s = Ue({
|
|
849
932
|
type: "move",
|
|
850
933
|
from: a,
|
|
851
934
|
to: o
|
|
@@ -854,8 +937,8 @@ var $e = class extends D.Component {
|
|
|
854
937
|
};
|
|
855
938
|
onRemoveChoice = (e, t) => {
|
|
856
939
|
let { onSessionChange: n, session: r } = this.props;
|
|
857
|
-
|
|
858
|
-
let i =
|
|
940
|
+
et("[onRemoveChoice]", e);
|
|
941
|
+
let i = Ue({
|
|
859
942
|
type: "remove",
|
|
860
943
|
target: e
|
|
861
944
|
}, t);
|
|
@@ -866,20 +949,20 @@ var $e = class extends D.Component {
|
|
|
866
949
|
orientation: "vertical",
|
|
867
950
|
includeTargets: !0
|
|
868
951
|
};
|
|
869
|
-
return n ?
|
|
952
|
+
return n ? He(e.choices, e.correctResponse, e.correctResponse.map((e) => ({
|
|
870
953
|
id: e,
|
|
871
954
|
outcome: "correct"
|
|
872
955
|
})), {
|
|
873
956
|
includeTargets: r,
|
|
874
957
|
allowSameChoiceInTargets: e.config.allowSameChoiceInTargets
|
|
875
|
-
}) :
|
|
958
|
+
}) : He(e.choices, t.value, e.outcomes, {
|
|
876
959
|
includeTargets: r,
|
|
877
960
|
allowSameChoiceInTargets: e.config.allowSameChoiceInTargets
|
|
878
961
|
});
|
|
879
962
|
};
|
|
880
963
|
onDragEnd = (e) => {
|
|
881
964
|
let { over: t, active: n } = e, r = this.createOrdering();
|
|
882
|
-
if (t && n) {
|
|
965
|
+
if (this.cancelSelection(), this.lastDragEndAt = Date.now(), t && n) {
|
|
883
966
|
let e = n.data.current, i = t.data.current;
|
|
884
967
|
if (e && i && i.type === "target") {
|
|
885
968
|
this.onDropChoice(i, e, r);
|
|
@@ -891,63 +974,109 @@ var $e = class extends D.Component {
|
|
|
891
974
|
e && e.type === "target" && this.onRemoveChoice(e, r);
|
|
892
975
|
}
|
|
893
976
|
};
|
|
977
|
+
onDragStart = (e) => {
|
|
978
|
+
let { active: t } = e;
|
|
979
|
+
t?.data?.current && this.selectChoice(t.data.current);
|
|
980
|
+
};
|
|
981
|
+
onDragCancel = () => {
|
|
982
|
+
this.cancelSelection(), this.lastDragEndAt = Date.now();
|
|
983
|
+
};
|
|
984
|
+
isSameChoice = (e, t) => !!e && !!t && e.type === t.type && e.id === t.id && e.index === t.index;
|
|
985
|
+
selectChoice = (e) => {
|
|
986
|
+
this.setState({ selectedChoice: e });
|
|
987
|
+
};
|
|
988
|
+
toggleChoiceSelection = (e) => {
|
|
989
|
+
this.setState((t) => ({ selectedChoice: this.isSameChoice(t.selectedChoice, e) ? null : e }));
|
|
990
|
+
};
|
|
991
|
+
cancelSelection = () => {
|
|
992
|
+
this.setState({ selectedChoice: null });
|
|
993
|
+
};
|
|
994
|
+
endAnyLiveKeyboardDrag = () => {
|
|
995
|
+
document.dispatchEvent(new KeyboardEvent("keydown", {
|
|
996
|
+
code: "Escape",
|
|
997
|
+
bubbles: !0,
|
|
998
|
+
cancelable: !0
|
|
999
|
+
}));
|
|
1000
|
+
};
|
|
1001
|
+
placeSelectedChoice = (e) => {
|
|
1002
|
+
let { selectedChoice: t } = this.state;
|
|
1003
|
+
if (!t) return;
|
|
1004
|
+
let n = this.createOrdering();
|
|
1005
|
+
this.onDropChoice(e, t, n), this.cancelSelection(), this.endAnyLiveKeyboardDrag(), this.lastDragEndAt = Date.now();
|
|
1006
|
+
};
|
|
1007
|
+
isClickSoonAfterDragEnd = () => Date.now() - this.lastDragEndAt < Ze;
|
|
1008
|
+
onChoiceClick = (e) => {
|
|
1009
|
+
this.isClickSoonAfterDragEnd() || this.toggleChoiceSelection(e);
|
|
1010
|
+
};
|
|
1011
|
+
onPlacementClick = (e) => {
|
|
1012
|
+
this.isClickSoonAfterDragEnd() || this.placeSelectedChoice(e);
|
|
1013
|
+
};
|
|
894
1014
|
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:
|
|
1015
|
+
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, m = t && t.length > 0, { showingCorrect: g } = this.state, _ = s || {
|
|
896
1016
|
orientation: "vertical",
|
|
897
1017
|
includeTargets: !0
|
|
898
|
-
}, { orientation:
|
|
899
|
-
color:
|
|
900
|
-
backgroundColor:
|
|
1018
|
+
}, { orientation: ee, includeTargets: v } = _, y = ee === "vertical", b = this.createOrdering(), { mode: x, role: S } = u || {}, T = y ? Le : Ie, D = (g || x === "view" && S === "instructor") && l && c, O = a && (h(a) || C(a)), k = f && (h(f) || C(f)), A = {
|
|
1019
|
+
color: w.text(),
|
|
1020
|
+
backgroundColor: w.background(),
|
|
901
1021
|
display: "flex",
|
|
902
1022
|
flexDirection: "column",
|
|
903
1023
|
alignItems: "center",
|
|
904
|
-
boxSizing: "border-box"
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
1024
|
+
boxSizing: "border-box",
|
|
1025
|
+
width: "100%"
|
|
1026
|
+
}, j = v ? {
|
|
1027
|
+
selectedChoice: this.state.selectedChoice,
|
|
1028
|
+
onChoiceClick: this.onChoiceClick,
|
|
1029
|
+
onPlacementClick: this.onPlacementClick
|
|
1030
|
+
} : {};
|
|
1031
|
+
return /* @__PURE__ */ N(te, {
|
|
1032
|
+
onDragStart: this.onDragStart,
|
|
908
1033
|
onDragEnd: this.onDragEnd,
|
|
909
|
-
|
|
910
|
-
|
|
1034
|
+
onDragCancel: this.onDragCancel,
|
|
1035
|
+
collisionDetection: E,
|
|
1036
|
+
modifiers: [ae],
|
|
1037
|
+
...Qe(v),
|
|
1038
|
+
children: /* @__PURE__ */ N(tt, { children: /* @__PURE__ */ P(qe, {
|
|
911
1039
|
extraCSSRules: r,
|
|
912
|
-
style:
|
|
1040
|
+
style: A,
|
|
913
1041
|
children: [
|
|
914
|
-
|
|
1042
|
+
k && /* @__PURE__ */ N(st, {
|
|
915
1043
|
labels: {
|
|
916
1044
|
hidden: "Show Teacher Instructions",
|
|
917
1045
|
visible: "Hide Teacher Instructions"
|
|
918
1046
|
},
|
|
919
1047
|
className: "collapsible",
|
|
920
|
-
children: /* @__PURE__ */
|
|
1048
|
+
children: /* @__PURE__ */ N(Z, { prompt: f })
|
|
921
1049
|
}),
|
|
922
|
-
/* @__PURE__ */
|
|
923
|
-
/* @__PURE__ */
|
|
924
|
-
show:
|
|
1050
|
+
/* @__PURE__ */ N(it, { children: /* @__PURE__ */ N(Z, { prompt: i }) }),
|
|
1051
|
+
/* @__PURE__ */ N(ot, {
|
|
1052
|
+
show: m,
|
|
925
1053
|
toggled: g,
|
|
926
1054
|
onToggle: this.toggleCorrect,
|
|
927
|
-
language:
|
|
1055
|
+
language: p
|
|
928
1056
|
}),
|
|
929
|
-
/* @__PURE__ */
|
|
1057
|
+
/* @__PURE__ */ N(nt, { children: /* @__PURE__ */ N(rt, { children: /* @__PURE__ */ N(ct, {
|
|
930
1058
|
instanceId: this.instanceId,
|
|
931
1059
|
choiceLabel: _.choiceLabel,
|
|
932
1060
|
targetLabel: _.targetLabel,
|
|
933
|
-
ordering:
|
|
934
|
-
tiler:
|
|
1061
|
+
ordering: b,
|
|
1062
|
+
tiler: T,
|
|
935
1063
|
disabled: d,
|
|
936
1064
|
addGuide: _.showOrdering,
|
|
937
1065
|
tileSize: _.tileSize,
|
|
938
|
-
includeTargets:
|
|
939
|
-
choiceLabelEnabled: e.config && e.config.choiceLabelEnabled
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
1066
|
+
includeTargets: v,
|
|
1067
|
+
choiceLabelEnabled: e.config && e.config.choiceLabelEnabled,
|
|
1068
|
+
...j
|
|
1069
|
+
}) }) }),
|
|
1070
|
+
D && /* @__PURE__ */ N(at, { dangerouslySetInnerHTML: { __html: c } }),
|
|
1071
|
+
O && /* @__PURE__ */ N(st, {
|
|
943
1072
|
labels: {
|
|
944
1073
|
hidden: "Show Rationale",
|
|
945
1074
|
visible: "Hide Rationale"
|
|
946
1075
|
},
|
|
947
1076
|
className: "collapsible",
|
|
948
|
-
children: /* @__PURE__ */
|
|
1077
|
+
children: /* @__PURE__ */ N(Z, { prompt: a })
|
|
949
1078
|
}),
|
|
950
|
-
!g && /* @__PURE__ */
|
|
1079
|
+
!g && /* @__PURE__ */ N(Je, {
|
|
951
1080
|
correctness: n,
|
|
952
1081
|
feedback: o
|
|
953
1082
|
})
|
|
@@ -955,24 +1084,24 @@ var $e = class extends D.Component {
|
|
|
955
1084
|
}) })
|
|
956
1085
|
});
|
|
957
1086
|
}
|
|
958
|
-
},
|
|
1087
|
+
}, ut = class extends k.Component {
|
|
959
1088
|
static propTypes = {
|
|
960
|
-
model:
|
|
961
|
-
session:
|
|
962
|
-
onSessionChange:
|
|
1089
|
+
model: I.default.object.isRequired,
|
|
1090
|
+
session: I.default.oneOfType([I.default.array.isRequired, I.default.object.isRequired]),
|
|
1091
|
+
onSessionChange: I.default.func.isRequired
|
|
963
1092
|
};
|
|
964
1093
|
render() {
|
|
965
1094
|
let { model: e, session: t, onSessionChange: n } = this.props;
|
|
966
|
-
return /* @__PURE__ */
|
|
1095
|
+
return /* @__PURE__ */ N(lt, {
|
|
967
1096
|
model: e,
|
|
968
1097
|
session: t,
|
|
969
1098
|
onSessionChange: n
|
|
970
1099
|
});
|
|
971
1100
|
}
|
|
972
|
-
},
|
|
1101
|
+
}, dt = (0, F.default)("pie-elements:placement-ordering"), ft = ({ model: t, session: n }) => {
|
|
973
1102
|
let { config: r } = t, i = (n && e(n.value) || []).length === t.choices.length;
|
|
974
1103
|
return r.includeTargets || i;
|
|
975
|
-
},
|
|
1104
|
+
}, pt = class extends HTMLElement {
|
|
976
1105
|
constructor() {
|
|
977
1106
|
super(), this._root = null, this._mathObserver = null, this._mathRenderPending = !1;
|
|
978
1107
|
}
|
|
@@ -997,7 +1126,7 @@ var $e = class extends D.Component {
|
|
|
997
1126
|
}
|
|
998
1127
|
isComplete = (t) => t && e(t).length === this._model.completeLength;
|
|
999
1128
|
sessionChange = (e) => {
|
|
1000
|
-
this._session.value = e.value, this.render(), this.dispatchEvent(new
|
|
1129
|
+
this._session.value = e.value, this.render(), this.dispatchEvent(new re(this.tagName.toLowerCase(), this._session && this.isComplete(this._session.value)));
|
|
1001
1130
|
};
|
|
1002
1131
|
set model(e) {
|
|
1003
1132
|
this._model = e, this.render(), this.dispatchEvent(new CustomEvent("model-set", {
|
|
@@ -1013,23 +1142,23 @@ var $e = class extends D.Component {
|
|
|
1013
1142
|
}
|
|
1014
1143
|
render() {
|
|
1015
1144
|
if (this._model && this._session) {
|
|
1016
|
-
|
|
1017
|
-
let e =
|
|
1145
|
+
dt("[render] session: ", this._session.value), dt("[render] model: ", this._model), this._initMathObserver();
|
|
1146
|
+
let e = k.createElement(ut, {
|
|
1018
1147
|
model: this._model,
|
|
1019
1148
|
session: this._session,
|
|
1020
1149
|
onSessionChange: this.sessionChange
|
|
1021
1150
|
});
|
|
1022
|
-
this._root ||=
|
|
1151
|
+
this._root ||= M(this), this._root.render(e);
|
|
1023
1152
|
}
|
|
1024
1153
|
}
|
|
1025
1154
|
connectedCallback() {
|
|
1026
|
-
this._initMathObserver();
|
|
1155
|
+
this._initMathObserver(), this.render();
|
|
1027
1156
|
}
|
|
1028
1157
|
disconnectedCallback() {
|
|
1029
|
-
this._disconnectMathObserver(), this._root
|
|
1158
|
+
this._disconnectMathObserver(), this._root &&= (this._root.unmount(), null);
|
|
1030
1159
|
}
|
|
1031
1160
|
};
|
|
1032
1161
|
//#endregion
|
|
1033
|
-
export {
|
|
1162
|
+
export { pt as default, ft as isValidSession };
|
|
1034
1163
|
|
|
1035
1164
|
//# sourceMappingURL=index.js.map
|