@pie-element/placement-ordering 14.1.2-next.1 → 14.1.2-next.11
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 +23488 -20640
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/{browser-Dbw2uHQ7.js → browser-Bd36Xf5z.js} +6 -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 +441 -304
- 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-DSf9QLEN.js → drag-provider-B5wazJHM.js} +2465 -2511
- package/dist/browser/drag-provider-B5wazJHM.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 +47 -0
- package/dist/delivery/keyboard-coordinates.js +51 -0
- package/dist/delivery/main.js +1 -1
- package/dist/delivery/ordering.js +2 -1
- package/dist/delivery/placement-ordering.d.ts +11 -0
- package/dist/delivery/placement-ordering.js +153 -81
- 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 +19 -19
- package/dist/browser/browser-Dbw2uHQ7.js.map +0 -1
- package/dist/browser/drag-provider-DSf9QLEN.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, 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-B5wazJHM.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 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 ne(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 re = (e) => {
|
|
46
|
+
let { containerNodeRect: t, draggingNodeRect: n, transform: r } = e;
|
|
47
|
+
return !n || !t ? r : ne(r, n, t);
|
|
48
|
+
}, R = ({ 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
|
+
R.propTypes = {
|
|
71
|
+
bgFill: L.default.string.isRequired,
|
|
72
|
+
fgFill: L.default.string.isRequired
|
|
65
73
|
};
|
|
66
|
-
var
|
|
74
|
+
var ie = ({ 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
|
+
ie.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 ae = b("div")(({ size: e }) => ({
|
|
112
120
|
width: e || "25px",
|
|
113
121
|
height: e || "25px"
|
|
114
|
-
})),
|
|
122
|
+
})), z = ({ open: e, size: t }) => /* @__PURE__ */ P(ae, {
|
|
115
123
|
size: t,
|
|
116
|
-
children: e ? /* @__PURE__ */
|
|
124
|
+
children: e ? /* @__PURE__ */ P(R, {
|
|
117
125
|
bgFill: "#bce2ff",
|
|
118
126
|
fgFill: "#1a9cff"
|
|
119
|
-
}) : /* @__PURE__ */
|
|
127
|
+
}) : /* @__PURE__ */ P(ie, {
|
|
120
128
|
bgFill: "white",
|
|
121
129
|
fgFill: "#1a9cff",
|
|
122
130
|
borderFill: "#bce2ff"
|
|
123
131
|
})
|
|
124
132
|
});
|
|
125
|
-
|
|
126
|
-
open:
|
|
127
|
-
size:
|
|
128
|
-
},
|
|
133
|
+
z.propTypes = {
|
|
134
|
+
open: L.default.bool,
|
|
135
|
+
size: L.default.string
|
|
136
|
+
}, z.defaultProps = { open: !1 };
|
|
129
137
|
//#endregion
|
|
130
138
|
//#region ../../lib-react/correct-answer-toggle/dist/expander.js
|
|
131
|
-
var
|
|
139
|
+
var oe = "height ease-in 300ms, opacity ease-in 300ms", se = 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: oe,
|
|
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: oe,
|
|
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
|
+
})), ce = (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(se, {
|
|
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
|
+
ce.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 B(e) {
|
|
194
202
|
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
195
203
|
}
|
|
196
|
-
function
|
|
197
|
-
return !e ||
|
|
204
|
+
function le(e, t) {
|
|
205
|
+
return !e || B(e) ? e : B(e.default) ? e.default : t && B(e[t]) ? e[t] : t && B(e[t]?.default) ? e[t].default : e;
|
|
198
206
|
}
|
|
199
|
-
var
|
|
207
|
+
var ue = le(v, "Readable") || le(fe.Readable, "Readable"), de = x, V = de.default, fe = V && typeof V == "object" ? V : de, { translator: H } = O, pe = {
|
|
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
|
+
}, me = b("div")(() => ({
|
|
207
215
|
width: "100%",
|
|
208
216
|
cursor: "pointer"
|
|
209
|
-
})),
|
|
217
|
+
})), he = b("div")(() => ({
|
|
210
218
|
margin: "0 auto",
|
|
211
219
|
textAlign: "center",
|
|
212
220
|
display: "flex"
|
|
213
|
-
})),
|
|
221
|
+
})), ge = 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
|
+
...pe
|
|
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
|
-
})),
|
|
242
|
+
})), _e = b("div")(() => ({
|
|
235
243
|
width: "25px",
|
|
236
244
|
marginRight: "5px",
|
|
237
245
|
display: "flex",
|
|
238
246
|
alignItems: "center"
|
|
239
|
-
})),
|
|
247
|
+
})), ve = 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: 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__ */ P(me, {
|
|
278
286
|
className: e,
|
|
279
|
-
children: /* @__PURE__ */
|
|
287
|
+
children: /* @__PURE__ */ P(ce, {
|
|
280
288
|
show: this.state.show,
|
|
281
|
-
children: /* @__PURE__ */
|
|
289
|
+
children: /* @__PURE__ */ F(he, {
|
|
282
290
|
onClick: this.onClick.bind(this),
|
|
283
291
|
onTouchEnd: this.onTouch.bind(this),
|
|
284
|
-
children: [/* @__PURE__ */
|
|
292
|
+
children: [/* @__PURE__ */ F(_e, { 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(U, {
|
|
296
304
|
ref: this.openIconRef,
|
|
297
|
-
children: /* @__PURE__ */
|
|
305
|
+
children: /* @__PURE__ */ P(z, { 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(U, {
|
|
311
319
|
ref: this.closedIconRef,
|
|
312
|
-
children: /* @__PURE__ */
|
|
320
|
+
children: /* @__PURE__ */ P(z, { open: t }, "correct-closed")
|
|
313
321
|
})
|
|
314
|
-
})] }), /* @__PURE__ */
|
|
322
|
+
})] }), /* @__PURE__ */ P(ue, {
|
|
315
323
|
false: !0,
|
|
316
|
-
children: /* @__PURE__ */
|
|
324
|
+
children: /* @__PURE__ */ P(ge, {
|
|
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 ye(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 = ye(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 = ye(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
|
-
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,183 +395,189 @@ 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
|
+
})), 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__ */ P(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: 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
|
|
441
|
+
var Ce = (0, I.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__ */ P(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__ */ P(we, { children: t })
|
|
443
451
|
});
|
|
444
|
-
|
|
445
|
-
type:
|
|
446
|
-
index:
|
|
447
|
-
isOver:
|
|
448
|
-
disabled:
|
|
452
|
+
Te.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 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__ */ P(Te, {
|
|
497
505
|
type: t,
|
|
498
|
-
index:
|
|
499
|
-
isOver:
|
|
500
|
-
disabled:
|
|
501
|
-
}) : /* @__PURE__ */
|
|
506
|
+
index: l,
|
|
507
|
+
isOver: a,
|
|
508
|
+
disabled: s
|
|
509
|
+
}) : /* @__PURE__ */ P(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
519
|
}, W = (e) => {
|
|
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
|
-
|
|
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, F = (e) => {
|
|
537
|
+
(e.code === "Space" || e.code === "Enter") && (e.preventDefault(), M());
|
|
538
|
+
}, I = k.useRef(null);
|
|
539
|
+
return 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
|
-
}, []),
|
|
546
|
+
}, []), Ce("[render], props: ", e), /* @__PURE__ */ P("div", {
|
|
540
547
|
ref: (e) => {
|
|
541
|
-
|
|
548
|
+
I.current = e, S(e), ee(e);
|
|
542
549
|
},
|
|
543
550
|
style: {
|
|
544
|
-
transform:
|
|
551
|
+
transform: C ? `translate3d(${C.x}px, ${C.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" && A ? "pointer" : w ? "grabbing" : "grab",
|
|
559
|
+
zIndex: w ? 1e3 : "auto",
|
|
560
|
+
willChange: w ? "transform" : "auto"
|
|
554
561
|
},
|
|
562
|
+
role: N ? "button" : void 0,
|
|
563
|
+
tabIndex: N ? 0 : void 0,
|
|
564
|
+
onKeyDown: N ? F : void 0,
|
|
565
|
+
onClick: M,
|
|
566
|
+
onMouseEnter: () => O(!0),
|
|
567
|
+
onMouseLeave: () => O(!1),
|
|
555
568
|
...u && !a ? {
|
|
556
|
-
...
|
|
557
|
-
...
|
|
569
|
+
...x,
|
|
570
|
+
...b
|
|
558
571
|
} : {},
|
|
559
|
-
children: /* @__PURE__ */
|
|
572
|
+
children: /* @__PURE__ */ P(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: j,
|
|
579
|
+
isDragging: w,
|
|
580
|
+
isSelected: E,
|
|
567
581
|
disabled: a,
|
|
568
582
|
outcome: o,
|
|
569
583
|
type: n
|
|
@@ -571,125 +585,131 @@ var Ce = y("div")(({ theme: e, isDragging: t, isOver: n, disabled: r, outcome: i
|
|
|
571
585
|
});
|
|
572
586
|
};
|
|
573
587
|
W.propTypes = {
|
|
574
|
-
id:
|
|
575
|
-
label:
|
|
576
|
-
isOver:
|
|
577
|
-
type:
|
|
578
|
-
empty:
|
|
579
|
-
disabled:
|
|
580
|
-
outcome:
|
|
581
|
-
index:
|
|
582
|
-
guideIndex:
|
|
583
|
-
instanceId:
|
|
584
|
-
draggable:
|
|
585
|
-
tileIndex:
|
|
588
|
+
id: L.default.any,
|
|
589
|
+
label: L.default.string,
|
|
590
|
+
isOver: L.default.bool,
|
|
591
|
+
type: L.default.string,
|
|
592
|
+
empty: L.default.bool,
|
|
593
|
+
disabled: L.default.bool,
|
|
594
|
+
outcome: L.default.string,
|
|
595
|
+
index: L.default.number,
|
|
596
|
+
guideIndex: L.default.number,
|
|
597
|
+
instanceId: L.default.any,
|
|
598
|
+
draggable: L.default.bool,
|
|
599
|
+
tileIndex: L.default.number,
|
|
600
|
+
selectedChoice: L.default.object,
|
|
601
|
+
onChoiceClick: L.default.func,
|
|
602
|
+
onPlacementClick: L.default.func
|
|
586
603
|
};
|
|
587
604
|
//#endregion
|
|
588
605
|
//#region src/delivery/tiler.tsx
|
|
589
606
|
var G = {
|
|
590
|
-
choiceLabel:
|
|
591
|
-
targetLabel:
|
|
592
|
-
disabled:
|
|
593
|
-
tiles:
|
|
594
|
-
tileSize:
|
|
595
|
-
addGuide:
|
|
596
|
-
|
|
607
|
+
choiceLabel: L.default.string,
|
|
608
|
+
targetLabel: L.default.string,
|
|
609
|
+
disabled: L.default.bool,
|
|
610
|
+
tiles: L.default.array.isRequired,
|
|
611
|
+
tileSize: L.default.string,
|
|
612
|
+
addGuide: L.default.bool,
|
|
613
|
+
selectedChoice: L.default.object,
|
|
614
|
+
onChoiceClick: L.default.func,
|
|
615
|
+
onPlacementClick: L.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(W, {
|
|
602
622
|
...t,
|
|
603
623
|
key: n
|
|
604
|
-
}) : /* @__PURE__ */
|
|
624
|
+
}) : /* @__PURE__ */ A(W, {
|
|
605
625
|
...t,
|
|
606
626
|
label: "",
|
|
607
627
|
key: n
|
|
608
628
|
}));
|
|
609
629
|
return t.propTypes = { ...G }, t;
|
|
610
|
-
},
|
|
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
|
-
}),
|
|
647
|
+
}), Ie = class extends k.Component {
|
|
628
648
|
static propTypes = { ...G };
|
|
629
|
-
static defaultProps = { ...
|
|
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__ */ F(Ae, {
|
|
636
656
|
includeTargets: e,
|
|
637
657
|
style: c,
|
|
638
658
|
children: [
|
|
639
|
-
/* @__PURE__ */
|
|
659
|
+
/* @__PURE__ */ P(je, {
|
|
640
660
|
style: l,
|
|
641
661
|
dangerouslySetInnerHTML: { __html: t ? n : "" }
|
|
642
662
|
}),
|
|
643
|
-
e && /* @__PURE__ */
|
|
663
|
+
e && /* @__PURE__ */ P(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
|
-
},
|
|
671
|
+
}, Le = class extends k.Component {
|
|
652
672
|
static propTypes = { ...G };
|
|
653
|
-
static defaultProps = { ...
|
|
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__ */ F(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__ */ P(Pe, { dangerouslySetInnerHTML: { __html: t ? n : "" } }),
|
|
684
|
+
e && /* @__PURE__ */ P(Fe, { dangerouslySetInnerHTML: { __html: r } }),
|
|
685
|
+
i.map(ke(this.props))
|
|
666
686
|
]
|
|
667
687
|
});
|
|
668
688
|
}
|
|
669
|
-
}, K = (0,
|
|
689
|
+
}, K = (0, I.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
|
-
},
|
|
696
|
+
}, ze = (e, n, r) => {
|
|
677
697
|
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
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) : (K("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 K("fromIndex: ", t, "toIndex:", i),
|
|
712
|
+
return K("fromIndex: ", t, "toIndex:", i), Re(e.response, t, i);
|
|
693
713
|
}
|
|
694
714
|
}
|
|
695
715
|
function q(e, t, n, r) {
|
|
@@ -705,6 +725,7 @@ function q(e, t, n, r) {
|
|
|
705
725
|
}
|
|
706
726
|
return e.map((e) => t.indexOf(e.id) !== -1 && !r.allowSameChoiceInTargets ? {
|
|
707
727
|
type: "choice",
|
|
728
|
+
id: e.id,
|
|
708
729
|
empty: !0,
|
|
709
730
|
droppable: !0,
|
|
710
731
|
draggable: !1
|
|
@@ -726,7 +747,7 @@ function q(e, t, n, r) {
|
|
|
726
747
|
return i === 0 && t.push(a), t.push(o, a), t;
|
|
727
748
|
}, []);
|
|
728
749
|
}
|
|
729
|
-
function
|
|
750
|
+
function He(e, t, r, i) {
|
|
730
751
|
return i = n({ includeTargets: !0 }, i), r ||= [], t = !t || a(t) ? i.includeTargets ? Array(e.length) : c(e, (e) => e.id) : t, {
|
|
731
752
|
choices: e,
|
|
732
753
|
response: t,
|
|
@@ -735,17 +756,17 @@ function ze(e, t, r, i) {
|
|
|
735
756
|
tiles: q(e, t, r, i)
|
|
736
757
|
};
|
|
737
758
|
}
|
|
738
|
-
function
|
|
759
|
+
function Ue(e, t) {
|
|
739
760
|
switch (e.type) {
|
|
740
761
|
case "move": {
|
|
741
|
-
let { from: n, to: r } = e, i =
|
|
762
|
+
let { from: n, to: r } = e, i = Ve(t, n, r), a = q(t.choices, i, t.outcomes, t.opts);
|
|
742
763
|
return Object.assign({}, t, {
|
|
743
764
|
response: i,
|
|
744
765
|
tiles: a
|
|
745
766
|
});
|
|
746
767
|
}
|
|
747
768
|
case "remove": {
|
|
748
|
-
let { target: n } = e, r =
|
|
769
|
+
let { target: n } = e, r = Be(t, n), i = q(t.choices, r, t.outcomes, t.opts);
|
|
749
770
|
return Object.assign({}, t, {
|
|
750
771
|
response: r,
|
|
751
772
|
tiles: i
|
|
@@ -756,11 +777,57 @@ function Be(e, t) {
|
|
|
756
777
|
}
|
|
757
778
|
//#endregion
|
|
758
779
|
//#region src/delivery/utils.ts
|
|
759
|
-
var
|
|
780
|
+
var We = (e, t) => {
|
|
760
781
|
if (!Array.isArray(e) || !Array.isArray(t) || e.length !== t.length) return !1;
|
|
761
782
|
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
783
|
return a && !o;
|
|
763
|
-
}
|
|
784
|
+
}, Ge = (e, { active: t, context: n, currentCoordinates: r }) => {
|
|
785
|
+
let { code: i } = e, a = i === "Tab", o = i === h.Down || i === h.Up || i === h.Left || i === h.Right;
|
|
786
|
+
if (!a && !o) return;
|
|
787
|
+
if (o) return y(e, {
|
|
788
|
+
context: n,
|
|
789
|
+
currentCoordinates: r
|
|
790
|
+
});
|
|
791
|
+
e.preventDefault();
|
|
792
|
+
let { droppableRects: s, droppableContainers: c, collisionRect: l, draggableNodes: u, active: d } = n;
|
|
793
|
+
if (!s || s.size === 0) return r;
|
|
794
|
+
let f = {
|
|
795
|
+
x: (l?.width || 0) / 2,
|
|
796
|
+
y: (l?.height || 0) / 2
|
|
797
|
+
}, p = {
|
|
798
|
+
x: r.x + f.x,
|
|
799
|
+
y: r.y + f.y
|
|
800
|
+
}, m = u?.get(t)?.data?.current?.id, g = d?.rect?.current?.initial, _ = typeof t == "string" ? t.replace(/^tile-/, "drop-") : void 0, v = [], b;
|
|
801
|
+
for (let [e, t] of c) {
|
|
802
|
+
let n = t?.data?.current, r = e === _;
|
|
803
|
+
if (t?.disabled && !r) continue;
|
|
804
|
+
let i = n?.type === "choice" && n?.id === m;
|
|
805
|
+
if (n?.type === "choice" && !i) continue;
|
|
806
|
+
let a = (r ? g : null) || s.get(e);
|
|
807
|
+
if (!a) continue;
|
|
808
|
+
let o = {
|
|
809
|
+
x: a.left + a.width / 2,
|
|
810
|
+
y: a.top + a.height / 2
|
|
811
|
+
}, c = {
|
|
812
|
+
id: e,
|
|
813
|
+
dropPosition: {
|
|
814
|
+
x: a.left,
|
|
815
|
+
y: a.top + a.height / 2 - f.y
|
|
816
|
+
},
|
|
817
|
+
center: o
|
|
818
|
+
};
|
|
819
|
+
i ? b = c : v.push(c);
|
|
820
|
+
}
|
|
821
|
+
if (v.length === 0 && !b) return r;
|
|
822
|
+
let x = e.shiftKey;
|
|
823
|
+
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);
|
|
824
|
+
let S = 0, C = Infinity;
|
|
825
|
+
for (let e = 0; e < v.length; e++) {
|
|
826
|
+
let t = Ke(p, v[e].center);
|
|
827
|
+
t < C && (C = t, S = e);
|
|
828
|
+
}
|
|
829
|
+
return v[x ? (S - 1 + v.length) % v.length : (S + 1) % v.length].dropPosition;
|
|
830
|
+
}, Ke = (e, t) => Math.sqrt((e.x - t.x) ** 2 + (e.y - t.y) ** 2);
|
|
764
831
|
//#endregion
|
|
765
832
|
//#region src/delivery/placement-ordering.tsx
|
|
766
833
|
function J(e) {
|
|
@@ -769,41 +836,65 @@ function J(e) {
|
|
|
769
836
|
function Y(e, t) {
|
|
770
837
|
return !e || J(e) ? e : J(e.default) ? e.default : t && J(e[t]) ? e[t] : t && J(e[t]?.default) ? e[t].default : e;
|
|
771
838
|
}
|
|
772
|
-
var
|
|
773
|
-
|
|
774
|
-
|
|
839
|
+
var qe = Y(D, "UiLayout") || Y(Q.UiLayout, "UiLayout"), X = Y(T, "PreviewPrompt") || Y(Q.PreviewPrompt, "PreviewPrompt"), Je = Y(p, "Feedback") || Y(Q.Feedback, "Feedback"), Ye = Y(f, "Collapsible") || Y(Q.Collapsible, "Collapsible"), Xe = x, Z = Xe.default, Q = Z && typeof Z == "object" ? Z : Xe, Ze = 250, Qe = (e, t) => {
|
|
840
|
+
if (!e || !t) return !1;
|
|
841
|
+
let n = t.left + t.width / 2, r = t.top + t.height / 2;
|
|
842
|
+
return n >= e.left && n <= e.right && r >= e.top && r <= e.bottom;
|
|
843
|
+
}, $e = (e) => e ? {
|
|
844
|
+
keyboardCoordinateGetter: Ge,
|
|
845
|
+
keyboardCodes: {
|
|
846
|
+
start: ["Space", "Enter"],
|
|
847
|
+
cancel: ["Escape"],
|
|
848
|
+
end: ["Space", "Enter"]
|
|
849
|
+
},
|
|
850
|
+
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." } }
|
|
851
|
+
} : {}, { translator: et } = O, tt = (0, I.default)("pie-elements:placement-ordering"), nt = b("div")({
|
|
852
|
+
color: w.text(),
|
|
853
|
+
backgroundColor: w.background(),
|
|
775
854
|
display: "flex",
|
|
776
855
|
flexDirection: "column",
|
|
777
856
|
alignItems: "center",
|
|
778
857
|
boxSizing: "border-box"
|
|
779
|
-
}),
|
|
858
|
+
}), rt = b("div")({
|
|
859
|
+
alignSelf: "stretch",
|
|
860
|
+
maxWidth: "100%",
|
|
861
|
+
overflowX: "auto",
|
|
862
|
+
overflowY: "hidden"
|
|
863
|
+
}), it = b("div")({
|
|
864
|
+
display: "flex",
|
|
865
|
+
justifyContent: "center",
|
|
866
|
+
minWidth: "min-content"
|
|
867
|
+
}), at = b("div")(({ theme: e }) => ({ paddingBottom: e.spacing(1) })), ot = b("div")(({ theme: e }) => ({ paddingBottom: e.spacing(2) })), st = b(ve)(({ theme: e }) => ({ paddingBottom: e.spacing(1) })), ct = b(Ye)(({ theme: e }) => ({
|
|
780
868
|
marginBottom: e.spacing(2),
|
|
781
869
|
alignSelf: "flex-start"
|
|
782
|
-
})),
|
|
870
|
+
})), lt = (e) => {
|
|
783
871
|
let { tiler: t, ordering: n, onDropChoice: r, onRemoveChoice: i, ...a } = e;
|
|
784
|
-
return /* @__PURE__ */
|
|
872
|
+
return /* @__PURE__ */ P(t, {
|
|
785
873
|
...a,
|
|
786
874
|
tiles: n.tiles,
|
|
787
875
|
onDropChoice: (e, t) => r(e, t, n),
|
|
788
876
|
onRemoveChoice: (e) => i(e, n)
|
|
789
877
|
});
|
|
790
878
|
};
|
|
791
|
-
|
|
792
|
-
tiler:
|
|
793
|
-
ordering:
|
|
794
|
-
onDropChoice:
|
|
795
|
-
onRemoveChoice:
|
|
879
|
+
lt.propTypes = {
|
|
880
|
+
tiler: L.default.func,
|
|
881
|
+
ordering: L.default.any,
|
|
882
|
+
onDropChoice: L.default.func,
|
|
883
|
+
onRemoveChoice: L.default.func
|
|
796
884
|
};
|
|
797
|
-
var
|
|
885
|
+
var ut = class extends k.Component {
|
|
798
886
|
static propTypes = {
|
|
799
|
-
onSessionChange:
|
|
800
|
-
model:
|
|
801
|
-
session:
|
|
887
|
+
onSessionChange: L.default.func.isRequired,
|
|
888
|
+
model: L.default.object.isRequired,
|
|
889
|
+
session: L.default.oneOfType([L.default.array.isRequired, L.default.object.isRequired])
|
|
802
890
|
};
|
|
803
891
|
constructor(e) {
|
|
804
892
|
super(e), this.instanceId = r();
|
|
805
893
|
let { value: t, needsReset: n } = this.validateSession(e);
|
|
806
|
-
this.state = {
|
|
894
|
+
this.state = {
|
|
895
|
+
showingCorrect: !1,
|
|
896
|
+
selectedChoice: null
|
|
897
|
+
}, this.lastDragEndAt = 0;
|
|
807
898
|
let { model: i } = e || {}, { env: a } = i || {}, { mode: o } = a || {};
|
|
808
899
|
n && o === "gather" && this.props.onSessionChange({
|
|
809
900
|
...e.session,
|
|
@@ -812,7 +903,7 @@ var $e = class extends D.Component {
|
|
|
812
903
|
}
|
|
813
904
|
toggleCorrect = (e) => this.setState({ showingCorrect: e });
|
|
814
905
|
componentDidUpdate() {
|
|
815
|
-
d(
|
|
906
|
+
d(N.findDOMNode(this));
|
|
816
907
|
}
|
|
817
908
|
validateSession = ({ model: e, session: t }, n = !1) => {
|
|
818
909
|
let { config: r, choices: i } = e || {}, { includeTargets: a } = r || {}, s = i.map((e) => e.id), { value: c } = t || {}, u;
|
|
@@ -831,9 +922,9 @@ var $e = class extends D.Component {
|
|
|
831
922
|
};
|
|
832
923
|
};
|
|
833
924
|
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 =
|
|
925
|
+
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 === et.t("common:commonCorrectAnswerWithAlternates", { lng: n.language });
|
|
926
|
+
l && u && (n.note = et.t("common:commonCorrectAnswerWithAlternates", { lng: t.language })), r || (c.showingCorrect = !1);
|
|
927
|
+
let d = We(a, n.choices), { value: f, needsReset: p } = this.validateSession(e, d), m = {
|
|
837
928
|
...e.session,
|
|
838
929
|
value: f
|
|
839
930
|
}, h = n.config?.includeTargets !== s;
|
|
@@ -844,8 +935,8 @@ var $e = class extends D.Component {
|
|
|
844
935
|
}
|
|
845
936
|
onDropChoice = (e, t, n) => {
|
|
846
937
|
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 =
|
|
938
|
+
tt("[onDropChoice] ", a, o);
|
|
939
|
+
let s = Ue({
|
|
849
940
|
type: "move",
|
|
850
941
|
from: a,
|
|
851
942
|
to: o
|
|
@@ -854,8 +945,8 @@ var $e = class extends D.Component {
|
|
|
854
945
|
};
|
|
855
946
|
onRemoveChoice = (e, t) => {
|
|
856
947
|
let { onSessionChange: n, session: r } = this.props;
|
|
857
|
-
|
|
858
|
-
let i =
|
|
948
|
+
tt("[onRemoveChoice]", e);
|
|
949
|
+
let i = Ue({
|
|
859
950
|
type: "remove",
|
|
860
951
|
target: e
|
|
861
952
|
}, t);
|
|
@@ -866,20 +957,20 @@ var $e = class extends D.Component {
|
|
|
866
957
|
orientation: "vertical",
|
|
867
958
|
includeTargets: !0
|
|
868
959
|
};
|
|
869
|
-
return n ?
|
|
960
|
+
return n ? He(e.choices, e.correctResponse, e.correctResponse.map((e) => ({
|
|
870
961
|
id: e,
|
|
871
962
|
outcome: "correct"
|
|
872
963
|
})), {
|
|
873
964
|
includeTargets: r,
|
|
874
965
|
allowSameChoiceInTargets: e.config.allowSameChoiceInTargets
|
|
875
|
-
}) :
|
|
966
|
+
}) : He(e.choices, t.value, e.outcomes, {
|
|
876
967
|
includeTargets: r,
|
|
877
968
|
allowSameChoiceInTargets: e.config.allowSameChoiceInTargets
|
|
878
969
|
});
|
|
879
970
|
};
|
|
880
971
|
onDragEnd = (e) => {
|
|
881
972
|
let { over: t, active: n } = e, r = this.createOrdering();
|
|
882
|
-
if (t && n) {
|
|
973
|
+
if (this.cancelSelection(), this.lastDragEndAt = Date.now(), t && n) {
|
|
883
974
|
let e = n.data.current, i = t.data.current;
|
|
884
975
|
if (e && i && i.type === "target") {
|
|
885
976
|
this.onDropChoice(i, e, r);
|
|
@@ -887,67 +978,113 @@ var $e = class extends D.Component {
|
|
|
887
978
|
}
|
|
888
979
|
e && i && this.onDropChoice(i, e, r);
|
|
889
980
|
} else if (!t && n) {
|
|
890
|
-
let e = n.data.current;
|
|
891
|
-
e && e.type === "target" && this.onRemoveChoice(e, r);
|
|
981
|
+
let e = n.data.current, t = Qe(n.rect?.current?.initial, n.rect?.current?.translated);
|
|
982
|
+
e && e.type === "target" && !t && this.onRemoveChoice(e, r);
|
|
892
983
|
}
|
|
893
984
|
};
|
|
985
|
+
onDragStart = (e) => {
|
|
986
|
+
let { active: t } = e;
|
|
987
|
+
t?.data?.current && this.selectChoice(t.data.current);
|
|
988
|
+
};
|
|
989
|
+
onDragCancel = () => {
|
|
990
|
+
this.cancelSelection(), this.lastDragEndAt = Date.now();
|
|
991
|
+
};
|
|
992
|
+
isSameChoice = (e, t) => !!e && !!t && e.type === t.type && e.id === t.id && e.index === t.index;
|
|
993
|
+
selectChoice = (e) => {
|
|
994
|
+
this.setState({ selectedChoice: e });
|
|
995
|
+
};
|
|
996
|
+
toggleChoiceSelection = (e) => {
|
|
997
|
+
this.setState((t) => ({ selectedChoice: this.isSameChoice(t.selectedChoice, e) ? null : e }));
|
|
998
|
+
};
|
|
999
|
+
cancelSelection = () => {
|
|
1000
|
+
this.setState({ selectedChoice: null });
|
|
1001
|
+
};
|
|
1002
|
+
endAnyLiveKeyboardDrag = () => {
|
|
1003
|
+
document.dispatchEvent(new KeyboardEvent("keydown", {
|
|
1004
|
+
code: "Escape",
|
|
1005
|
+
bubbles: !0,
|
|
1006
|
+
cancelable: !0
|
|
1007
|
+
}));
|
|
1008
|
+
};
|
|
1009
|
+
placeSelectedChoice = (e) => {
|
|
1010
|
+
let { selectedChoice: t } = this.state;
|
|
1011
|
+
if (!t) return;
|
|
1012
|
+
let n = this.createOrdering();
|
|
1013
|
+
this.onDropChoice(e, t, n), this.cancelSelection(), this.endAnyLiveKeyboardDrag(), this.lastDragEndAt = Date.now();
|
|
1014
|
+
};
|
|
1015
|
+
isClickSoonAfterDragEnd = () => Date.now() - this.lastDragEndAt < Ze;
|
|
1016
|
+
onChoiceClick = (e) => {
|
|
1017
|
+
this.isClickSoonAfterDragEnd() || this.toggleChoiceSelection(e);
|
|
1018
|
+
};
|
|
1019
|
+
onPlacementClick = (e) => {
|
|
1020
|
+
this.isClickSoonAfterDragEnd() || this.placeSelectedChoice(e);
|
|
1021
|
+
};
|
|
894
1022
|
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:
|
|
1023
|
+
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
1024
|
orientation: "vertical",
|
|
897
1025
|
includeTargets: !0
|
|
898
|
-
}, { orientation:
|
|
899
|
-
color:
|
|
900
|
-
backgroundColor:
|
|
1026
|
+
}, { orientation: v, includeTargets: y } = _, b = v === "vertical", x = this.createOrdering(), { mode: S, role: T } = u || {}, D = b ? Le : Ie, O = (g || S === "view" && T === "instructor") && l && c, k = a && (m(a) || C(a)), A = f && (m(f) || C(f)), j = {
|
|
1027
|
+
color: w.text(),
|
|
1028
|
+
backgroundColor: w.background(),
|
|
901
1029
|
display: "flex",
|
|
902
1030
|
flexDirection: "column",
|
|
903
1031
|
alignItems: "center",
|
|
904
|
-
boxSizing: "border-box"
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
1032
|
+
boxSizing: "border-box",
|
|
1033
|
+
width: "100%"
|
|
1034
|
+
}, M = y ? {
|
|
1035
|
+
selectedChoice: this.state.selectedChoice,
|
|
1036
|
+
onChoiceClick: this.onChoiceClick,
|
|
1037
|
+
onPlacementClick: this.onPlacementClick
|
|
1038
|
+
} : {};
|
|
1039
|
+
return /* @__PURE__ */ P(ee, {
|
|
1040
|
+
onDragStart: this.onDragStart,
|
|
908
1041
|
onDragEnd: this.onDragEnd,
|
|
909
|
-
|
|
910
|
-
|
|
1042
|
+
onDragCancel: this.onDragCancel,
|
|
1043
|
+
collisionDetection: E,
|
|
1044
|
+
modifiers: [re],
|
|
1045
|
+
...$e(y),
|
|
1046
|
+
children: /* @__PURE__ */ P(nt, { children: /* @__PURE__ */ F(qe, {
|
|
911
1047
|
extraCSSRules: r,
|
|
912
|
-
style:
|
|
1048
|
+
style: j,
|
|
913
1049
|
children: [
|
|
914
|
-
|
|
1050
|
+
A && /* @__PURE__ */ P(ct, {
|
|
915
1051
|
labels: {
|
|
916
1052
|
hidden: "Show Teacher Instructions",
|
|
917
1053
|
visible: "Hide Teacher Instructions"
|
|
918
1054
|
},
|
|
919
1055
|
className: "collapsible",
|
|
920
|
-
children: /* @__PURE__ */
|
|
1056
|
+
children: /* @__PURE__ */ P(X, { prompt: f })
|
|
921
1057
|
}),
|
|
922
|
-
/* @__PURE__ */
|
|
923
|
-
/* @__PURE__ */
|
|
1058
|
+
/* @__PURE__ */ P(at, { children: /* @__PURE__ */ P(X, { prompt: i }) }),
|
|
1059
|
+
/* @__PURE__ */ P(st, {
|
|
924
1060
|
show: h,
|
|
925
1061
|
toggled: g,
|
|
926
1062
|
onToggle: this.toggleCorrect,
|
|
927
|
-
language:
|
|
1063
|
+
language: p
|
|
928
1064
|
}),
|
|
929
|
-
/* @__PURE__ */
|
|
1065
|
+
/* @__PURE__ */ P(rt, { children: /* @__PURE__ */ P(it, { children: /* @__PURE__ */ P(lt, {
|
|
930
1066
|
instanceId: this.instanceId,
|
|
931
1067
|
choiceLabel: _.choiceLabel,
|
|
932
1068
|
targetLabel: _.targetLabel,
|
|
933
|
-
ordering:
|
|
934
|
-
tiler:
|
|
1069
|
+
ordering: x,
|
|
1070
|
+
tiler: D,
|
|
935
1071
|
disabled: d,
|
|
936
1072
|
addGuide: _.showOrdering,
|
|
937
1073
|
tileSize: _.tileSize,
|
|
938
|
-
includeTargets:
|
|
939
|
-
choiceLabelEnabled: e.config && e.config.choiceLabelEnabled
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
O && /* @__PURE__ */
|
|
1074
|
+
includeTargets: y,
|
|
1075
|
+
choiceLabelEnabled: e.config && e.config.choiceLabelEnabled,
|
|
1076
|
+
...M
|
|
1077
|
+
}) }) }),
|
|
1078
|
+
O && /* @__PURE__ */ P(ot, { dangerouslySetInnerHTML: { __html: c } }),
|
|
1079
|
+
k && /* @__PURE__ */ P(ct, {
|
|
943
1080
|
labels: {
|
|
944
1081
|
hidden: "Show Rationale",
|
|
945
1082
|
visible: "Hide Rationale"
|
|
946
1083
|
},
|
|
947
1084
|
className: "collapsible",
|
|
948
|
-
children: /* @__PURE__ */
|
|
1085
|
+
children: /* @__PURE__ */ P(X, { prompt: a })
|
|
949
1086
|
}),
|
|
950
|
-
!g && /* @__PURE__ */
|
|
1087
|
+
!g && /* @__PURE__ */ P(Je, {
|
|
951
1088
|
correctness: n,
|
|
952
1089
|
feedback: o
|
|
953
1090
|
})
|
|
@@ -955,24 +1092,24 @@ var $e = class extends D.Component {
|
|
|
955
1092
|
}) })
|
|
956
1093
|
});
|
|
957
1094
|
}
|
|
958
|
-
},
|
|
1095
|
+
}, dt = class extends k.Component {
|
|
959
1096
|
static propTypes = {
|
|
960
|
-
model:
|
|
961
|
-
session:
|
|
962
|
-
onSessionChange:
|
|
1097
|
+
model: L.default.object.isRequired,
|
|
1098
|
+
session: L.default.oneOfType([L.default.array.isRequired, L.default.object.isRequired]),
|
|
1099
|
+
onSessionChange: L.default.func.isRequired
|
|
963
1100
|
};
|
|
964
1101
|
render() {
|
|
965
1102
|
let { model: e, session: t, onSessionChange: n } = this.props;
|
|
966
|
-
return /* @__PURE__ */
|
|
1103
|
+
return /* @__PURE__ */ P(ut, {
|
|
967
1104
|
model: e,
|
|
968
1105
|
session: t,
|
|
969
1106
|
onSessionChange: n
|
|
970
1107
|
});
|
|
971
1108
|
}
|
|
972
|
-
},
|
|
1109
|
+
}, $ = (0, I.default)("pie-elements:placement-ordering"), ft = ({ model: t, session: n }) => {
|
|
973
1110
|
let { config: r } = t, i = (n && e(n.value) || []).length === t.choices.length;
|
|
974
1111
|
return r.includeTargets || i;
|
|
975
|
-
},
|
|
1112
|
+
}, pt = class extends HTMLElement {
|
|
976
1113
|
constructor() {
|
|
977
1114
|
super(), this._root = null, this._mathObserver = null, this._mathRenderPending = !1;
|
|
978
1115
|
}
|
|
@@ -997,7 +1134,7 @@ var $e = class extends D.Component {
|
|
|
997
1134
|
}
|
|
998
1135
|
isComplete = (t) => t && e(t).length === this._model.completeLength;
|
|
999
1136
|
sessionChange = (e) => {
|
|
1000
|
-
this._session.value = e.value, this.render(), this.dispatchEvent(new
|
|
1137
|
+
this._session.value = e.value, this.render(), this.dispatchEvent(new te(this.tagName.toLowerCase(), this._session && this.isComplete(this._session.value)));
|
|
1001
1138
|
};
|
|
1002
1139
|
set model(e) {
|
|
1003
1140
|
this._model = e, this.render(), this.dispatchEvent(new CustomEvent("model-set", {
|
|
@@ -1013,23 +1150,23 @@ var $e = class extends D.Component {
|
|
|
1013
1150
|
}
|
|
1014
1151
|
render() {
|
|
1015
1152
|
if (this._model && this._session) {
|
|
1016
|
-
|
|
1017
|
-
let e =
|
|
1153
|
+
$("[render] session: ", this._session.value), $("[render] model: ", this._model), this._initMathObserver();
|
|
1154
|
+
let e = k.createElement(dt, {
|
|
1018
1155
|
model: this._model,
|
|
1019
1156
|
session: this._session,
|
|
1020
1157
|
onSessionChange: this.sessionChange
|
|
1021
1158
|
});
|
|
1022
|
-
this._root ||=
|
|
1159
|
+
this._root ||= M(this), this._root.render(e);
|
|
1023
1160
|
}
|
|
1024
1161
|
}
|
|
1025
1162
|
connectedCallback() {
|
|
1026
|
-
this._initMathObserver();
|
|
1163
|
+
this._initMathObserver(), this.render();
|
|
1027
1164
|
}
|
|
1028
1165
|
disconnectedCallback() {
|
|
1029
|
-
this._disconnectMathObserver(), this._root
|
|
1166
|
+
this._disconnectMathObserver(), this._root &&= (this._root.unmount(), null);
|
|
1030
1167
|
}
|
|
1031
1168
|
};
|
|
1032
1169
|
//#endregion
|
|
1033
|
-
export {
|
|
1170
|
+
export { pt as default, ft as isValidSession };
|
|
1034
1171
|
|
|
1035
1172
|
//# sourceMappingURL=index.js.map
|