@pie-element/placement-ordering 14.1.2-next.10 → 14.1.2-next.12
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/browser/author/index.js +23433 -30942
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/delivery/index.js +180 -162
- package/dist/browser/delivery/index.js.map +1 -1
- package/dist/browser/{drag-provider-B5wazJHM.js → drag-provider-CfLLSbf2.js} +781 -779
- package/dist/browser/drag-provider-CfLLSbf2.js.map +1 -0
- package/dist/delivery/placement-ordering.d.ts +2 -0
- package/dist/delivery/placement-ordering.js +18 -5
- package/dist/delivery/tile.js +11 -6
- package/dist/index.iife.js +21 -21
- package/package.json +7 -7
- package/dist/browser/drag-provider-B5wazJHM.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
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-
|
|
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-CfLLSbf2.js";
|
|
3
3
|
import { t as O } from "../dist-DiGNNRzu.js";
|
|
4
4
|
import k, { createElement as A, useRef as j } from "react";
|
|
5
5
|
import { createRoot as M } from "react-dom/client";
|
|
@@ -38,14 +38,14 @@ var te = class e extends CustomEvent {
|
|
|
38
38
|
}), this.component = t, this.complete = n;
|
|
39
39
|
}
|
|
40
40
|
}, L = /* @__PURE__ */ i(u(), 1);
|
|
41
|
-
function
|
|
41
|
+
function R(e, t, n) {
|
|
42
42
|
let r = { ...e };
|
|
43
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
44
|
}
|
|
45
|
-
var
|
|
45
|
+
var ne = (e) => {
|
|
46
46
|
let { containerNodeRect: t, draggingNodeRect: n, transform: r } = e;
|
|
47
|
-
return !n || !t ? r :
|
|
48
|
-
},
|
|
47
|
+
return !n || !t ? r : R(r, n, t);
|
|
48
|
+
}, z = ({ bgFill: e, fgFill: t }) => /* @__PURE__ */ F("svg", {
|
|
49
49
|
preserveAspectRatio: "xMinYMin meet",
|
|
50
50
|
version: "1.1",
|
|
51
51
|
viewBox: "-283 359 34 35",
|
|
@@ -67,11 +67,11 @@ var re = (e) => {
|
|
|
67
67
|
})
|
|
68
68
|
]
|
|
69
69
|
});
|
|
70
|
-
|
|
70
|
+
z.propTypes = {
|
|
71
71
|
bgFill: L.default.string.isRequired,
|
|
72
72
|
fgFill: L.default.string.isRequired
|
|
73
73
|
};
|
|
74
|
-
var
|
|
74
|
+
var re = ({ bgFill: e, fgFill: t, borderFill: n }) => /* @__PURE__ */ F("svg", {
|
|
75
75
|
preserveAspectRatio: "xMinYMin meet",
|
|
76
76
|
version: "1.1",
|
|
77
77
|
viewBox: "-129.5 127 34 35",
|
|
@@ -111,32 +111,32 @@ var ie = ({ bgFill: e, fgFill: t, borderFill: n }) => /* @__PURE__ */ F("svg", {
|
|
|
111
111
|
})
|
|
112
112
|
]
|
|
113
113
|
});
|
|
114
|
-
|
|
114
|
+
re.propTypes = {
|
|
115
115
|
bgFill: L.default.string.isRequired,
|
|
116
116
|
fgFill: L.default.string.isRequired,
|
|
117
117
|
borderFill: L.default.string.isRequired
|
|
118
118
|
};
|
|
119
|
-
var
|
|
119
|
+
var ie = b("div")(({ size: e }) => ({
|
|
120
120
|
width: e || "25px",
|
|
121
121
|
height: e || "25px"
|
|
122
|
-
})),
|
|
122
|
+
})), B = ({ open: e, size: t }) => /* @__PURE__ */ P(ie, {
|
|
123
123
|
size: t,
|
|
124
|
-
children: e ? /* @__PURE__ */ P(
|
|
124
|
+
children: e ? /* @__PURE__ */ P(z, {
|
|
125
125
|
bgFill: "#bce2ff",
|
|
126
126
|
fgFill: "#1a9cff"
|
|
127
|
-
}) : /* @__PURE__ */ P(
|
|
127
|
+
}) : /* @__PURE__ */ P(re, {
|
|
128
128
|
bgFill: "white",
|
|
129
129
|
fgFill: "#1a9cff",
|
|
130
130
|
borderFill: "#bce2ff"
|
|
131
131
|
})
|
|
132
132
|
});
|
|
133
|
-
|
|
133
|
+
B.propTypes = {
|
|
134
134
|
open: L.default.bool,
|
|
135
135
|
size: L.default.string
|
|
136
|
-
},
|
|
136
|
+
}, B.defaultProps = { open: !1 };
|
|
137
137
|
//#endregion
|
|
138
138
|
//#region ../../lib-react/correct-answer-toggle/dist/expander.js
|
|
139
|
-
var
|
|
139
|
+
var ae = "height ease-in 300ms, opacity ease-in 300ms", oe = b("div")(() => ({
|
|
140
140
|
position: "relative",
|
|
141
141
|
height: 0,
|
|
142
142
|
overflow: "hidden",
|
|
@@ -144,7 +144,7 @@ var oe = "height ease-in 300ms, opacity ease-in 300ms", se = b("div")(() => ({
|
|
|
144
144
|
visibility: "hidden",
|
|
145
145
|
width: 0,
|
|
146
146
|
"&.enter": {
|
|
147
|
-
transition:
|
|
147
|
+
transition: ae,
|
|
148
148
|
opacity: 1,
|
|
149
149
|
height: "auto",
|
|
150
150
|
width: "auto",
|
|
@@ -158,7 +158,7 @@ var oe = "height ease-in 300ms, opacity ease-in 300ms", se = b("div")(() => ({
|
|
|
158
158
|
minHeight: "25px"
|
|
159
159
|
},
|
|
160
160
|
"&.exit": {
|
|
161
|
-
transition:
|
|
161
|
+
transition: ae,
|
|
162
162
|
opacity: 0,
|
|
163
163
|
height: 0,
|
|
164
164
|
visibility: "visible",
|
|
@@ -170,7 +170,7 @@ var oe = "height ease-in 300ms, opacity ease-in 300ms", se = b("div")(() => ({
|
|
|
170
170
|
height: 0,
|
|
171
171
|
width: 0
|
|
172
172
|
}
|
|
173
|
-
})),
|
|
173
|
+
})), se = (e) => {
|
|
174
174
|
let { show: t, children: n, className: r } = e, i = j(null);
|
|
175
175
|
return /* @__PURE__ */ P(S, {
|
|
176
176
|
nodeRef: i,
|
|
@@ -184,49 +184,49 @@ var oe = "height ease-in 300ms, opacity ease-in 300ms", se = b("div")(() => ({
|
|
|
184
184
|
exit: "exit",
|
|
185
185
|
exitDone: "exit-done"
|
|
186
186
|
},
|
|
187
|
-
children: /* @__PURE__ */ P(
|
|
187
|
+
children: /* @__PURE__ */ P(oe, {
|
|
188
188
|
ref: i,
|
|
189
189
|
className: r,
|
|
190
190
|
children: n
|
|
191
191
|
})
|
|
192
192
|
});
|
|
193
193
|
};
|
|
194
|
-
|
|
194
|
+
se.propTypes = {
|
|
195
195
|
show: L.default.bool.isRequired,
|
|
196
196
|
className: L.default.string,
|
|
197
197
|
children: L.default.oneOfType([L.default.arrayOf(L.default.node), L.default.node]).isRequired
|
|
198
198
|
};
|
|
199
199
|
//#endregion
|
|
200
200
|
//#region ../../lib-react/correct-answer-toggle/dist/index.js
|
|
201
|
-
function
|
|
201
|
+
function V(e) {
|
|
202
202
|
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
203
203
|
}
|
|
204
|
-
function
|
|
205
|
-
return !e ||
|
|
204
|
+
function ce(e, t) {
|
|
205
|
+
return !e || V(e) ? e : V(e.default) ? e.default : t && V(e[t]) ? e[t] : t && V(e[t]?.default) ? e[t].default : e;
|
|
206
206
|
}
|
|
207
|
-
var
|
|
207
|
+
var le = ce(v, "Readable") || ce(de.Readable, "Readable"), ue = x, H = ue.default, de = H && typeof H == "object" ? H : ue, { translator: U } = O, fe = {
|
|
208
208
|
WebkitTouchCallout: "none",
|
|
209
209
|
WebkitUserSelect: "none",
|
|
210
210
|
KhtmlUserSelect: "none",
|
|
211
211
|
MozUserSelect: "none",
|
|
212
212
|
msUserSelect: "none",
|
|
213
213
|
userSelect: "none"
|
|
214
|
-
},
|
|
214
|
+
}, pe = b("div")(() => ({
|
|
215
215
|
width: "100%",
|
|
216
216
|
cursor: "pointer"
|
|
217
|
-
})),
|
|
217
|
+
})), me = b("div")(() => ({
|
|
218
218
|
margin: "0 auto",
|
|
219
219
|
textAlign: "center",
|
|
220
220
|
display: "flex"
|
|
221
|
-
})),
|
|
221
|
+
})), he = b("div")(() => ({
|
|
222
222
|
width: "fit-content",
|
|
223
223
|
minWidth: "140px",
|
|
224
224
|
alignSelf: "center",
|
|
225
225
|
verticalAlign: "middle",
|
|
226
226
|
color: `var(--correct-answer-toggle-label-color, ${w.text()})`,
|
|
227
227
|
fontWeight: "normal",
|
|
228
|
-
...
|
|
229
|
-
})),
|
|
228
|
+
...fe
|
|
229
|
+
})), W = b("div")(() => ({
|
|
230
230
|
position: "absolute",
|
|
231
231
|
width: "25px",
|
|
232
232
|
"&.enter": { opacity: "0" },
|
|
@@ -239,12 +239,12 @@ var ue = le(v, "Readable") || le(fe.Readable, "Readable"), de = x, V = de.defaul
|
|
|
239
239
|
opacity: "0",
|
|
240
240
|
transition: "opacity 0.3s ease-in"
|
|
241
241
|
}
|
|
242
|
-
})),
|
|
242
|
+
})), ge = b("div")(() => ({
|
|
243
243
|
width: "25px",
|
|
244
244
|
marginRight: "5px",
|
|
245
245
|
display: "flex",
|
|
246
246
|
alignItems: "center"
|
|
247
|
-
})),
|
|
247
|
+
})), _e = class e extends k.Component {
|
|
248
248
|
static propTypes = {
|
|
249
249
|
onToggle: L.default.func,
|
|
250
250
|
toggled: L.default.bool,
|
|
@@ -263,8 +263,8 @@ var ue = le(v, "Readable") || le(fe.Readable, "Readable"), de = x, V = de.defaul
|
|
|
263
263
|
constructor(t) {
|
|
264
264
|
super(t), this.state = { show: t.show }, this.openIconRef = k.createRef(), this.closedIconRef = k.createRef(), e.defaultProps = {
|
|
265
265
|
...e.defaultProps,
|
|
266
|
-
showMessage:
|
|
267
|
-
hideMessage:
|
|
266
|
+
showMessage: U.t("common:showCorrectAnswer", { lng: t.language }),
|
|
267
|
+
hideMessage: U.t("common:hideCorrectAnswer", { lng: t.language })
|
|
268
268
|
};
|
|
269
269
|
}
|
|
270
270
|
onClick() {
|
|
@@ -276,20 +276,20 @@ var ue = le(v, "Readable") || le(fe.Readable, "Readable"), de = x, V = de.defaul
|
|
|
276
276
|
UNSAFE_componentWillReceiveProps(t) {
|
|
277
277
|
this.setState({ show: t.show }), t.language !== this.props?.language && (e.defaultProps = {
|
|
278
278
|
...e.defaultProps,
|
|
279
|
-
showMessage:
|
|
280
|
-
hideMessage:
|
|
279
|
+
showMessage: U.t("common:showCorrectAnswer", { lng: t.language }),
|
|
280
|
+
hideMessage: U.t("common:hideCorrectAnswer", { lng: t.language })
|
|
281
281
|
});
|
|
282
282
|
}
|
|
283
283
|
render() {
|
|
284
284
|
let { className: e, toggled: t, hideMessage: n, showMessage: r } = this.props;
|
|
285
|
-
return /* @__PURE__ */ P(
|
|
285
|
+
return /* @__PURE__ */ P(pe, {
|
|
286
286
|
className: e,
|
|
287
|
-
children: /* @__PURE__ */ P(
|
|
287
|
+
children: /* @__PURE__ */ P(se, {
|
|
288
288
|
show: this.state.show,
|
|
289
|
-
children: /* @__PURE__ */ F(
|
|
289
|
+
children: /* @__PURE__ */ F(me, {
|
|
290
290
|
onClick: this.onClick.bind(this),
|
|
291
291
|
onTouchEnd: this.onTouch.bind(this),
|
|
292
|
-
children: [/* @__PURE__ */ F(
|
|
292
|
+
children: [/* @__PURE__ */ F(ge, { children: [/* @__PURE__ */ P(S, {
|
|
293
293
|
nodeRef: this.openIconRef,
|
|
294
294
|
timeout: 400,
|
|
295
295
|
in: t,
|
|
@@ -300,9 +300,9 @@ var ue = le(v, "Readable") || le(fe.Readable, "Readable"), de = x, V = de.defaul
|
|
|
300
300
|
exit: "exit",
|
|
301
301
|
exitActive: "exit-active"
|
|
302
302
|
},
|
|
303
|
-
children: /* @__PURE__ */ P(
|
|
303
|
+
children: /* @__PURE__ */ P(W, {
|
|
304
304
|
ref: this.openIconRef,
|
|
305
|
-
children: /* @__PURE__ */ P(
|
|
305
|
+
children: /* @__PURE__ */ P(B, { open: t }, "correct-open")
|
|
306
306
|
})
|
|
307
307
|
}), /* @__PURE__ */ P(S, {
|
|
308
308
|
nodeRef: this.closedIconRef,
|
|
@@ -315,13 +315,13 @@ var ue = le(v, "Readable") || le(fe.Readable, "Readable"), de = x, V = de.defaul
|
|
|
315
315
|
exit: "exit",
|
|
316
316
|
exitActive: "exit-active"
|
|
317
317
|
},
|
|
318
|
-
children: /* @__PURE__ */ P(
|
|
318
|
+
children: /* @__PURE__ */ P(W, {
|
|
319
319
|
ref: this.closedIconRef,
|
|
320
|
-
children: /* @__PURE__ */ P(
|
|
320
|
+
children: /* @__PURE__ */ P(B, { open: t }, "correct-closed")
|
|
321
321
|
})
|
|
322
|
-
})] }), /* @__PURE__ */ P(
|
|
322
|
+
})] }), /* @__PURE__ */ P(le, {
|
|
323
323
|
false: !0,
|
|
324
|
-
children: /* @__PURE__ */ P(
|
|
324
|
+
children: /* @__PURE__ */ P(he, {
|
|
325
325
|
"aria-hidden": !this.state.show,
|
|
326
326
|
children: t ? n : r
|
|
327
327
|
})
|
|
@@ -333,22 +333,22 @@ var ue = le(v, "Readable") || le(fe.Readable, "Readable"), de = x, V = de.defaul
|
|
|
333
333
|
};
|
|
334
334
|
//#endregion
|
|
335
335
|
//#region ../../lib-react/drag/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js
|
|
336
|
-
function
|
|
336
|
+
function ve(e) {
|
|
337
337
|
var t, n, r = "";
|
|
338
338
|
if (typeof e == "string" || typeof e == "number") r += e;
|
|
339
339
|
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
340
340
|
var i = e.length;
|
|
341
|
-
for (t = 0; t < i; t++) e[t] && (n =
|
|
341
|
+
for (t = 0; t < i; t++) e[t] && (n = ve(e[t])) && (r && (r += " "), r += n);
|
|
342
342
|
} else for (n in e) e[n] && (r && (r += " "), r += n);
|
|
343
343
|
return r;
|
|
344
344
|
}
|
|
345
|
-
function
|
|
346
|
-
for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t =
|
|
345
|
+
function ye() {
|
|
346
|
+
for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t = ve(e)) && (r && (r += " "), r += t);
|
|
347
347
|
return r;
|
|
348
348
|
}
|
|
349
349
|
//#endregion
|
|
350
350
|
//#region ../../lib-react/drag/dist/placeholder.js
|
|
351
|
-
var
|
|
351
|
+
var be = b("div")(({ theme: e }) => ({
|
|
352
352
|
"&.placeholder": {
|
|
353
353
|
WebkitTouchCallout: "none",
|
|
354
354
|
WebkitUserSelect: "none",
|
|
@@ -401,25 +401,25 @@ var xe = b("div")(({ theme: e }) => ({
|
|
|
401
401
|
display: "flex",
|
|
402
402
|
flexFlow: "column wrap"
|
|
403
403
|
}
|
|
404
|
-
})),
|
|
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 =
|
|
404
|
+
})), xe = (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 = ye("placeholder", o && "placeholderDisabled", r && "over", i, n), p = {};
|
|
406
406
|
if (a && a.columns && (p.gridTemplateColumns = `repeat(${a.columns}, 1fr)`), a && a.rows) {
|
|
407
407
|
let e = a.rowsRepeatValue || "1fr";
|
|
408
408
|
p.gridTemplateRows = `repeat(${a.rows}, ${e})`;
|
|
409
409
|
}
|
|
410
|
-
i === "choice" && (p.border = `1px solid ${w.borderLight()}`, p.background = w.
|
|
410
|
+
i === "choice" && (p.border = `1px solid ${w.borderLight()}`, p.background = w.surface());
|
|
411
411
|
let m = c ? "categorizeBoard" : "board";
|
|
412
|
-
return /* @__PURE__ */ P(
|
|
412
|
+
return /* @__PURE__ */ P(be, {
|
|
413
413
|
style: {
|
|
414
414
|
...p,
|
|
415
415
|
minHeight: u,
|
|
416
416
|
...d
|
|
417
417
|
},
|
|
418
|
-
className:
|
|
418
|
+
className: ye(s ? m : f, l && "verticalPool"),
|
|
419
419
|
children: t
|
|
420
420
|
});
|
|
421
421
|
};
|
|
422
|
-
|
|
422
|
+
xe.propTypes = {
|
|
423
423
|
choiceBoard: L.default.bool,
|
|
424
424
|
grid: L.default.shape({
|
|
425
425
|
columns: L.default.number,
|
|
@@ -438,24 +438,24 @@ Se.propTypes = {
|
|
|
438
438
|
};
|
|
439
439
|
//#endregion
|
|
440
440
|
//#region src/delivery/tile.tsx
|
|
441
|
-
var
|
|
441
|
+
var Se = (0, I.default)("pie-elements:placement-ordering:tile"), Ce = b("div")(({ theme: e }) => ({
|
|
442
442
|
width: "100%",
|
|
443
443
|
fontSize: e.typography.fontSize + 4,
|
|
444
444
|
textAlign: "center",
|
|
445
445
|
color: `rgba(${e.palette.common.black}, 0.6)`
|
|
446
|
-
})),
|
|
446
|
+
})), we = ({ type: e, index: t, isOver: n, disabled: r }) => /* @__PURE__ */ P(xe, {
|
|
447
447
|
type: e,
|
|
448
448
|
isOver: n,
|
|
449
449
|
disabled: r,
|
|
450
|
-
children: e === "target" && t !== void 0 && /* @__PURE__ */ P(
|
|
450
|
+
children: e === "target" && t !== void 0 && /* @__PURE__ */ P(Ce, { children: t })
|
|
451
451
|
});
|
|
452
|
-
|
|
452
|
+
we.propTypes = {
|
|
453
453
|
type: L.default.string,
|
|
454
454
|
index: L.default.number,
|
|
455
455
|
isOver: L.default.bool,
|
|
456
456
|
disabled: L.default.bool
|
|
457
457
|
};
|
|
458
|
-
var
|
|
458
|
+
var Te = b("div")(({ theme: e, isDragging: t, isSelected: n, isOver: r, disabled: i, outcome: a, label: o, type: s }) => ({
|
|
459
459
|
cursor: i ? "not-allowed" : "grab",
|
|
460
460
|
width: "100%",
|
|
461
461
|
height: "100%",
|
|
@@ -499,14 +499,14 @@ var Ee = b("div")(({ theme: e, isDragging: t, isSelected: n, isOver: r, disabled
|
|
|
499
499
|
border: "none",
|
|
500
500
|
"&:hover": { backgroundColor: "unset" }
|
|
501
501
|
}
|
|
502
|
-
})),
|
|
502
|
+
})), Ee = (e) => {
|
|
503
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(
|
|
504
|
+
return i ? /* @__PURE__ */ P(we, {
|
|
505
505
|
type: t,
|
|
506
506
|
index: l,
|
|
507
507
|
isOver: a,
|
|
508
508
|
disabled: s
|
|
509
|
-
}) : /* @__PURE__ */ P(
|
|
509
|
+
}) : /* @__PURE__ */ P(Te, {
|
|
510
510
|
type: t,
|
|
511
511
|
isDragging: n,
|
|
512
512
|
isSelected: r,
|
|
@@ -516,7 +516,7 @@ var Ee = b("div")(({ theme: e, isDragging: t, isSelected: n, isOver: r, disabled
|
|
|
516
516
|
label: o,
|
|
517
517
|
dangerouslySetInnerHTML: { __html: o }
|
|
518
518
|
});
|
|
519
|
-
},
|
|
519
|
+
}, G = (e) => {
|
|
520
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
521
|
id: r,
|
|
522
522
|
type: n,
|
|
@@ -533,20 +533,24 @@ var Ee = b("div")(({ theme: e, isDragging: t, isSelected: n, isOver: r, disabled
|
|
|
533
533
|
disabled: w
|
|
534
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
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) => {
|
|
536
|
+
}, N = !(u && !a) && !a && A, F = (e) => {
|
|
537
537
|
(e.code === "Space" || e.code === "Enter") && (e.preventDefault(), M());
|
|
538
538
|
}, I = k.useRef(null);
|
|
539
|
-
|
|
539
|
+
k.useEffect(() => {
|
|
540
540
|
let e = I.current, t = (e) => {
|
|
541
541
|
e.preventDefault();
|
|
542
542
|
};
|
|
543
543
|
return e && e.addEventListener("touchstart", t, { passive: !1 }), () => {
|
|
544
544
|
e && e.removeEventListener("touchstart", t);
|
|
545
545
|
};
|
|
546
|
-
}, [])
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
546
|
+
}, []);
|
|
547
|
+
let te = (e) => {
|
|
548
|
+
I.current = e, S(e), ee(e);
|
|
549
|
+
};
|
|
550
|
+
Se("[render], props: ", e);
|
|
551
|
+
let L = n === "target" ? `target-${s}` : n === "choice" ? `choice-${r}` : null, R = L ? `${l}:${L}` : void 0;
|
|
552
|
+
return /* @__PURE__ */ P("div", {
|
|
553
|
+
ref: te,
|
|
550
554
|
style: {
|
|
551
555
|
transform: C ? `translate3d(${C.x}px, ${C.y}px, 0)` : void 0,
|
|
552
556
|
boxSizing: "border-box",
|
|
@@ -565,11 +569,12 @@ var Ee = b("div")(({ theme: e, isDragging: t, isSelected: n, isOver: r, disabled
|
|
|
565
569
|
onClick: M,
|
|
566
570
|
onMouseEnter: () => O(!0),
|
|
567
571
|
onMouseLeave: () => O(!1),
|
|
572
|
+
"data-tile-id": R,
|
|
568
573
|
...u && !a ? {
|
|
569
574
|
...x,
|
|
570
575
|
...b
|
|
571
576
|
} : {},
|
|
572
|
-
children: /* @__PURE__ */ P(
|
|
577
|
+
children: /* @__PURE__ */ P(Ee, {
|
|
573
578
|
label: t,
|
|
574
579
|
id: r,
|
|
575
580
|
empty: i,
|
|
@@ -584,7 +589,7 @@ var Ee = b("div")(({ theme: e, isDragging: t, isSelected: n, isOver: r, disabled
|
|
|
584
589
|
})
|
|
585
590
|
});
|
|
586
591
|
};
|
|
587
|
-
|
|
592
|
+
G.propTypes = {
|
|
588
593
|
id: L.default.any,
|
|
589
594
|
label: L.default.string,
|
|
590
595
|
isOver: L.default.bool,
|
|
@@ -603,7 +608,7 @@ W.propTypes = {
|
|
|
603
608
|
};
|
|
604
609
|
//#endregion
|
|
605
610
|
//#region src/delivery/tiler.tsx
|
|
606
|
-
var
|
|
611
|
+
var K = {
|
|
607
612
|
choiceLabel: L.default.string,
|
|
608
613
|
targetLabel: L.default.string,
|
|
609
614
|
disabled: L.default.bool,
|
|
@@ -613,106 +618,106 @@ var G = {
|
|
|
613
618
|
selectedChoice: L.default.object,
|
|
614
619
|
onChoiceClick: L.default.func,
|
|
615
620
|
onPlacementClick: L.default.func
|
|
616
|
-
},
|
|
621
|
+
}, De = {
|
|
617
622
|
tileSize: "1fr",
|
|
618
623
|
disabled: !1,
|
|
619
624
|
addGuide: !1
|
|
620
|
-
},
|
|
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(
|
|
625
|
+
}, Oe = (e) => {
|
|
626
|
+
let t = (t, n) => (t.instanceId = e.instanceId, t.disabled = e.disabled, t.guideIndex = e.addGuide ? t.index + 1 : void 0, t.tileIndex = n, t.selectedChoice = e.selectedChoice, t.onChoiceClick = e.onChoiceClick, t.onPlacementClick = e.onPlacementClick, e.includeTargets || t.type === "choice" ? /* @__PURE__ */ A(G, {
|
|
622
627
|
...t,
|
|
623
628
|
key: n
|
|
624
|
-
}) : /* @__PURE__ */ A(
|
|
629
|
+
}) : /* @__PURE__ */ A(G, {
|
|
625
630
|
...t,
|
|
626
631
|
label: "",
|
|
627
632
|
key: n
|
|
628
633
|
}));
|
|
629
|
-
return t.propTypes = { ...
|
|
630
|
-
},
|
|
634
|
+
return t.propTypes = { ...K }, t;
|
|
635
|
+
}, ke = b("div")(({ theme: e, includeTargets: t }) => ({
|
|
631
636
|
display: "grid",
|
|
632
637
|
paddingBottom: e.spacing(2),
|
|
633
638
|
...t && { gridGap: "10px" }
|
|
634
|
-
})),
|
|
639
|
+
})), Ae = b("div")({ textAlign: "center" }), je = b("div")({
|
|
635
640
|
textAlign: "center",
|
|
636
641
|
gridRow: "3/4"
|
|
637
|
-
}),
|
|
642
|
+
}), Me = b("div")(({ includeTargets: e }) => ({
|
|
638
643
|
gridAutoFlow: "column",
|
|
639
644
|
display: "grid",
|
|
640
645
|
...e && { gridGap: "10px" }
|
|
641
|
-
})),
|
|
646
|
+
})), Ne = b("div")({
|
|
642
647
|
gridColumn: "1/2",
|
|
643
648
|
textAlign: "center"
|
|
644
|
-
}),
|
|
649
|
+
}), Pe = b("div")({
|
|
645
650
|
gridColumn: "2/3",
|
|
646
651
|
textAlign: "center"
|
|
647
|
-
}),
|
|
648
|
-
static propTypes = { ...
|
|
649
|
-
static defaultProps = { ...
|
|
652
|
+
}), Fe = class extends k.Component {
|
|
653
|
+
static propTypes = { ...K };
|
|
654
|
+
static defaultProps = { ...De };
|
|
650
655
|
render() {
|
|
651
656
|
let { includeTargets: e, choiceLabelEnabled: t, choiceLabel: n, targetLabel: r, tiles: i, tileSize: a } = this.props, o = e ? `auto ${a} auto ${a}` : `auto ${a} auto`, s = e ? i.length / 2 : i.length, c = {
|
|
652
657
|
gridTemplateColumns: e ? `repeat(${s}, ${a})` : `auto repeat(${Math.floor(s / 2) - 1}, ${a} 10px) ${a} auto`,
|
|
653
658
|
gridTemplateRows: o
|
|
654
659
|
}, l = { gridColumn: `1/${s + 1}` };
|
|
655
|
-
return /* @__PURE__ */ F(
|
|
660
|
+
return /* @__PURE__ */ F(ke, {
|
|
656
661
|
includeTargets: e,
|
|
657
662
|
style: c,
|
|
658
663
|
children: [
|
|
659
|
-
/* @__PURE__ */ P(
|
|
664
|
+
/* @__PURE__ */ P(Ae, {
|
|
660
665
|
style: l,
|
|
661
666
|
dangerouslySetInnerHTML: { __html: t ? n : "" }
|
|
662
667
|
}),
|
|
663
|
-
e && /* @__PURE__ */ P(
|
|
668
|
+
e && /* @__PURE__ */ P(je, {
|
|
664
669
|
style: l,
|
|
665
670
|
dangerouslySetInnerHTML: { __html: r }
|
|
666
671
|
}),
|
|
667
|
-
i.map(
|
|
672
|
+
i.map(Oe(this.props))
|
|
668
673
|
]
|
|
669
674
|
});
|
|
670
675
|
}
|
|
671
|
-
},
|
|
672
|
-
static propTypes = { ...
|
|
673
|
-
static defaultProps = { ...
|
|
676
|
+
}, Ie = class extends k.Component {
|
|
677
|
+
static propTypes = { ...K };
|
|
678
|
+
static defaultProps = { ...De };
|
|
674
679
|
render() {
|
|
675
680
|
let { includeTargets: e, choiceLabelEnabled: t, choiceLabel: n, targetLabel: r, tiles: i, tileSize: a } = this.props, o = e ? 2 : 1, s = e ? i.length / 2 : i.length;
|
|
676
|
-
return /* @__PURE__ */ F(
|
|
681
|
+
return /* @__PURE__ */ F(Me, {
|
|
677
682
|
includeTargets: e,
|
|
678
683
|
style: {
|
|
679
684
|
gridTemplateColumns: `repeat(${o}, ${a})`,
|
|
680
685
|
gridTemplateRows: e ? `auto repeat(${s}, ${a})` : `auto auto repeat(${Math.floor(s / 2) - 1}, ${a} 10px) ${a} auto`
|
|
681
686
|
},
|
|
682
687
|
children: [
|
|
683
|
-
/* @__PURE__ */ P(
|
|
684
|
-
e && /* @__PURE__ */ P(
|
|
685
|
-
i.map(
|
|
688
|
+
/* @__PURE__ */ P(Ne, { dangerouslySetInnerHTML: { __html: t ? n : "" } }),
|
|
689
|
+
e && /* @__PURE__ */ P(Pe, { dangerouslySetInnerHTML: { __html: r } }),
|
|
690
|
+
i.map(Oe(this.props))
|
|
686
691
|
]
|
|
687
692
|
});
|
|
688
693
|
}
|
|
689
|
-
},
|
|
694
|
+
}, q = (0, I.default)("pie-elements:placement-ordering:ordering"), Le = (e, t, n) => {
|
|
690
695
|
let r = e.find((e, n) => n === t), i = e.filter((e, n) => n !== t);
|
|
691
696
|
return [
|
|
692
697
|
...i.slice(0, n),
|
|
693
698
|
r,
|
|
694
699
|
...i.slice(n)
|
|
695
700
|
];
|
|
696
|
-
},
|
|
697
|
-
if (
|
|
701
|
+
}, Re = (e, n, r) => {
|
|
702
|
+
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}`);
|
|
698
703
|
let i = t(e), a = e[r];
|
|
699
704
|
return i[r] = i[n], i[n] = a, i;
|
|
700
705
|
};
|
|
701
|
-
function
|
|
706
|
+
function ze(e, n) {
|
|
702
707
|
let r = t(e.response);
|
|
703
708
|
if (r[n.index] === n.id) r[n.index] = void 0;
|
|
704
709
|
else throw Error(`Tried to remove from index: ${n.index}, but the id doesn't match: array: ${r}, target: ${n.id}`);
|
|
705
710
|
return r;
|
|
706
711
|
}
|
|
707
|
-
function
|
|
712
|
+
function Be(e, n, r) {
|
|
708
713
|
let { response: i, opts: a } = e, o = t(i);
|
|
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" ?
|
|
714
|
+
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" ? Re(i, n.index, r.index) : (q("do nothing to the response"), i);
|
|
710
715
|
{
|
|
711
716
|
let t = e.response.findIndex((e) => e !== void 0 && e === n.id), i = e.response.findIndex((e) => e !== void 0 && e === r.id);
|
|
712
|
-
return
|
|
717
|
+
return q("fromIndex: ", t, "toIndex:", i), Le(e.response, t, i);
|
|
713
718
|
}
|
|
714
719
|
}
|
|
715
|
-
function
|
|
720
|
+
function J(e, t, n, r) {
|
|
716
721
|
if (r.includeTargets) {
|
|
717
722
|
let i = [];
|
|
718
723
|
for (let r = 0; r < t.length; r++) {
|
|
@@ -747,26 +752,26 @@ function q(e, t, n, r) {
|
|
|
747
752
|
return i === 0 && t.push(a), t.push(o, a), t;
|
|
748
753
|
}, []);
|
|
749
754
|
}
|
|
750
|
-
function
|
|
755
|
+
function Ve(e, t, r, i) {
|
|
751
756
|
return i = n({ includeTargets: !0 }, i), r ||= [], t = !t || a(t) ? i.includeTargets ? Array(e.length) : c(e, (e) => e.id) : t, {
|
|
752
757
|
choices: e,
|
|
753
758
|
response: t,
|
|
754
759
|
opts: i,
|
|
755
760
|
outcomes: r,
|
|
756
|
-
tiles:
|
|
761
|
+
tiles: J(e, t, r, i)
|
|
757
762
|
};
|
|
758
763
|
}
|
|
759
|
-
function
|
|
764
|
+
function He(e, t) {
|
|
760
765
|
switch (e.type) {
|
|
761
766
|
case "move": {
|
|
762
|
-
let { from: n, to: r } = e, i =
|
|
767
|
+
let { from: n, to: r } = e, i = Be(t, n, r), a = J(t.choices, i, t.outcomes, t.opts);
|
|
763
768
|
return Object.assign({}, t, {
|
|
764
769
|
response: i,
|
|
765
770
|
tiles: a
|
|
766
771
|
});
|
|
767
772
|
}
|
|
768
773
|
case "remove": {
|
|
769
|
-
let { target: n } = e, r =
|
|
774
|
+
let { target: n } = e, r = ze(t, n), i = J(t.choices, r, t.outcomes, t.opts);
|
|
770
775
|
return Object.assign({}, t, {
|
|
771
776
|
response: r,
|
|
772
777
|
tiles: i
|
|
@@ -777,11 +782,11 @@ function Ue(e, t) {
|
|
|
777
782
|
}
|
|
778
783
|
//#endregion
|
|
779
784
|
//#region src/delivery/utils.ts
|
|
780
|
-
var
|
|
785
|
+
var Ue = (e, t) => {
|
|
781
786
|
if (!Array.isArray(e) || !Array.isArray(t) || e.length !== t.length) return !1;
|
|
782
787
|
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]));
|
|
783
788
|
return a && !o;
|
|
784
|
-
},
|
|
789
|
+
}, We = (e, { active: t, context: n, currentCoordinates: r }) => {
|
|
785
790
|
let { code: i } = e, a = i === "Tab", o = i === h.Down || i === h.Up || i === h.Left || i === h.Right;
|
|
786
791
|
if (!a && !o) return;
|
|
787
792
|
if (o) return y(e, {
|
|
@@ -823,51 +828,51 @@ var We = (e, t) => {
|
|
|
823
828
|
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
829
|
let S = 0, C = Infinity;
|
|
825
830
|
for (let e = 0; e < v.length; e++) {
|
|
826
|
-
let t =
|
|
831
|
+
let t = Ge(p, v[e].center);
|
|
827
832
|
t < C && (C = t, S = e);
|
|
828
833
|
}
|
|
829
834
|
return v[x ? (S - 1 + v.length) % v.length : (S + 1) % v.length].dropPosition;
|
|
830
|
-
},
|
|
835
|
+
}, Ge = (e, t) => Math.sqrt((e.x - t.x) ** 2 + (e.y - t.y) ** 2);
|
|
831
836
|
//#endregion
|
|
832
837
|
//#region src/delivery/placement-ordering.tsx
|
|
833
|
-
function
|
|
838
|
+
function Y(e) {
|
|
834
839
|
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
835
840
|
}
|
|
836
|
-
function
|
|
837
|
-
return !e ||
|
|
841
|
+
function X(e, t) {
|
|
842
|
+
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;
|
|
838
843
|
}
|
|
839
|
-
var
|
|
844
|
+
var Ke = X(D, "UiLayout") || X($.UiLayout, "UiLayout"), Z = X(T, "PreviewPrompt") || X($.PreviewPrompt, "PreviewPrompt"), qe = X(p, "Feedback") || X($.Feedback, "Feedback"), Je = X(f, "Collapsible") || X($.Collapsible, "Collapsible"), Ye = x, Q = Ye.default, $ = Q && typeof Q == "object" ? Q : Ye, Xe = 250, Ze = (e, t) => {
|
|
840
845
|
if (!e || !t) return !1;
|
|
841
846
|
let n = t.left + t.width / 2, r = t.top + t.height / 2;
|
|
842
847
|
return n >= e.left && n <= e.right && r >= e.top && r <= e.bottom;
|
|
843
|
-
},
|
|
844
|
-
keyboardCoordinateGetter:
|
|
848
|
+
}, Qe = (e) => e ? {
|
|
849
|
+
keyboardCoordinateGetter: We,
|
|
845
850
|
keyboardCodes: {
|
|
846
851
|
start: ["Space", "Enter"],
|
|
847
852
|
cancel: ["Escape"],
|
|
848
853
|
end: ["Space", "Enter"]
|
|
849
854
|
},
|
|
850
855
|
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:
|
|
856
|
+
} : {}, { translator: $e } = O, et = (0, I.default)("pie-elements:placement-ordering"), tt = b("div")({
|
|
852
857
|
color: w.text(),
|
|
853
858
|
backgroundColor: w.background(),
|
|
854
859
|
display: "flex",
|
|
855
860
|
flexDirection: "column",
|
|
856
861
|
alignItems: "center",
|
|
857
862
|
boxSizing: "border-box"
|
|
858
|
-
}),
|
|
863
|
+
}), nt = b("div")({
|
|
859
864
|
alignSelf: "stretch",
|
|
860
865
|
maxWidth: "100%",
|
|
861
866
|
overflowX: "auto",
|
|
862
867
|
overflowY: "hidden"
|
|
863
|
-
}),
|
|
868
|
+
}), rt = b("div")({
|
|
864
869
|
display: "flex",
|
|
865
870
|
justifyContent: "center",
|
|
866
871
|
minWidth: "min-content"
|
|
867
|
-
}),
|
|
872
|
+
}), it = b("div")(({ theme: e }) => ({ paddingBottom: e.spacing(1) })), at = b("div")(({ theme: e }) => ({ paddingBottom: e.spacing(2) })), ot = b(_e)(({ theme: e }) => ({ paddingBottom: e.spacing(1) })), st = b(Je)(({ theme: e }) => ({
|
|
868
873
|
marginBottom: e.spacing(2),
|
|
869
874
|
alignSelf: "flex-start"
|
|
870
|
-
})),
|
|
875
|
+
})), ct = (e) => {
|
|
871
876
|
let { tiler: t, ordering: n, onDropChoice: r, onRemoveChoice: i, ...a } = e;
|
|
872
877
|
return /* @__PURE__ */ P(t, {
|
|
873
878
|
...a,
|
|
@@ -876,13 +881,13 @@ var qe = Y(D, "UiLayout") || Y(Q.UiLayout, "UiLayout"), X = Y(T, "PreviewPrompt"
|
|
|
876
881
|
onRemoveChoice: (e) => i(e, n)
|
|
877
882
|
});
|
|
878
883
|
};
|
|
879
|
-
|
|
884
|
+
ct.propTypes = {
|
|
880
885
|
tiler: L.default.func,
|
|
881
886
|
ordering: L.default.any,
|
|
882
887
|
onDropChoice: L.default.func,
|
|
883
888
|
onRemoveChoice: L.default.func
|
|
884
889
|
};
|
|
885
|
-
var
|
|
890
|
+
var lt = class extends k.Component {
|
|
886
891
|
static propTypes = {
|
|
887
892
|
onSessionChange: L.default.func.isRequired,
|
|
888
893
|
model: L.default.object.isRequired,
|
|
@@ -922,9 +927,9 @@ var ut = class extends k.Component {
|
|
|
922
927
|
};
|
|
923
928
|
};
|
|
924
929
|
UNSAFE_componentWillReceiveProps(e) {
|
|
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 ===
|
|
926
|
-
l && u && (n.note =
|
|
927
|
-
let d =
|
|
930
|
+
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 });
|
|
931
|
+
l && u && (n.note = $e.t("common:commonCorrectAnswerWithAlternates", { lng: t.language })), r || (c.showingCorrect = !1);
|
|
932
|
+
let d = Ue(a, n.choices), { value: f, needsReset: p } = this.validateSession(e, d), m = {
|
|
928
933
|
...e.session,
|
|
929
934
|
value: f
|
|
930
935
|
}, h = n.config?.includeTargets !== s;
|
|
@@ -935,8 +940,8 @@ var ut = class extends k.Component {
|
|
|
935
940
|
}
|
|
936
941
|
onDropChoice = (e, t, n) => {
|
|
937
942
|
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;
|
|
938
|
-
|
|
939
|
-
let s =
|
|
943
|
+
et("[onDropChoice] ", a, o);
|
|
944
|
+
let s = He({
|
|
940
945
|
type: "move",
|
|
941
946
|
from: a,
|
|
942
947
|
to: o
|
|
@@ -945,8 +950,8 @@ var ut = class extends k.Component {
|
|
|
945
950
|
};
|
|
946
951
|
onRemoveChoice = (e, t) => {
|
|
947
952
|
let { onSessionChange: n, session: r } = this.props;
|
|
948
|
-
|
|
949
|
-
let i =
|
|
953
|
+
et("[onRemoveChoice]", e);
|
|
954
|
+
let i = He({
|
|
950
955
|
type: "remove",
|
|
951
956
|
target: e
|
|
952
957
|
}, t);
|
|
@@ -957,13 +962,13 @@ var ut = class extends k.Component {
|
|
|
957
962
|
orientation: "vertical",
|
|
958
963
|
includeTargets: !0
|
|
959
964
|
};
|
|
960
|
-
return n ?
|
|
965
|
+
return n ? Ve(e.choices, e.correctResponse, e.correctResponse.map((e) => ({
|
|
961
966
|
id: e,
|
|
962
967
|
outcome: "correct"
|
|
963
968
|
})), {
|
|
964
969
|
includeTargets: r,
|
|
965
970
|
allowSameChoiceInTargets: e.config.allowSameChoiceInTargets
|
|
966
|
-
}) :
|
|
971
|
+
}) : Ve(e.choices, t.value, e.outcomes, {
|
|
967
972
|
includeTargets: r,
|
|
968
973
|
allowSameChoiceInTargets: e.config.allowSameChoiceInTargets
|
|
969
974
|
});
|
|
@@ -973,13 +978,16 @@ var ut = class extends k.Component {
|
|
|
973
978
|
if (this.cancelSelection(), this.lastDragEndAt = Date.now(), t && n) {
|
|
974
979
|
let e = n.data.current, i = t.data.current;
|
|
975
980
|
if (e && i && i.type === "target") {
|
|
976
|
-
this.onDropChoice(i, e, r);
|
|
981
|
+
this.onDropChoice(i, e, r), this.focusTile(this.getDestinationSlotId(i));
|
|
977
982
|
return;
|
|
978
983
|
}
|
|
979
|
-
e && i && this.onDropChoice(i, e, r);
|
|
984
|
+
e && i && (this.onDropChoice(i, e, r), this.focusTile(this.getDestinationSlotId(i)));
|
|
980
985
|
} else if (!t && n) {
|
|
981
|
-
let e = n.data.current, t =
|
|
982
|
-
e && e.type === "target" && !t && this.onRemoveChoice(e, r)
|
|
986
|
+
let e = n.data.current, t = Ze(n.rect?.current?.initial, n.rect?.current?.translated);
|
|
987
|
+
e && e.type === "target" && !t && (this.onRemoveChoice(e, r), this.focusTile(this.getDestinationSlotId({
|
|
988
|
+
type: "choice",
|
|
989
|
+
id: e.id
|
|
990
|
+
})));
|
|
983
991
|
}
|
|
984
992
|
};
|
|
985
993
|
onDragStart = (e) => {
|
|
@@ -1009,10 +1017,20 @@ var ut = class extends k.Component {
|
|
|
1009
1017
|
placeSelectedChoice = (e) => {
|
|
1010
1018
|
let { selectedChoice: t } = this.state;
|
|
1011
1019
|
if (!t) return;
|
|
1012
|
-
let n = this.createOrdering();
|
|
1013
|
-
this.onDropChoice(e, t, n), this.cancelSelection(), this.endAnyLiveKeyboardDrag(), this.lastDragEndAt = Date.now();
|
|
1020
|
+
let n = this.createOrdering(), r = this.getDestinationSlotId(e);
|
|
1021
|
+
this.onDropChoice(e, t, n), this.cancelSelection(), this.endAnyLiveKeyboardDrag(), this.lastDragEndAt = Date.now(), this.focusTile(r);
|
|
1022
|
+
};
|
|
1023
|
+
getDestinationSlotId = (e) => e ? e.type === "target" ? `target-${e.index}` : e.type === "choice" ? `choice-${e.id}` : null : null;
|
|
1024
|
+
focusTile = (e) => {
|
|
1025
|
+
if (!e) return;
|
|
1026
|
+
let t = `[data-tile-id="${this.instanceId}:${e}"]`;
|
|
1027
|
+
requestAnimationFrame(() => {
|
|
1028
|
+
requestAnimationFrame(() => {
|
|
1029
|
+
document.querySelector(t)?.focus();
|
|
1030
|
+
});
|
|
1031
|
+
});
|
|
1014
1032
|
};
|
|
1015
|
-
isClickSoonAfterDragEnd = () => Date.now() - this.lastDragEndAt <
|
|
1033
|
+
isClickSoonAfterDragEnd = () => Date.now() - this.lastDragEndAt < Xe;
|
|
1016
1034
|
onChoiceClick = (e) => {
|
|
1017
1035
|
this.isClickSoonAfterDragEnd() || this.toggleChoiceSelection(e);
|
|
1018
1036
|
};
|
|
@@ -1023,7 +1041,7 @@ var ut = class extends k.Component {
|
|
|
1023
1041
|
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 || {
|
|
1024
1042
|
orientation: "vertical",
|
|
1025
1043
|
includeTargets: !0
|
|
1026
|
-
}, { orientation: v, includeTargets: y } = _, b = v === "vertical", x = this.createOrdering(), { mode: S, role: T } = u || {}, D = b ?
|
|
1044
|
+
}, { orientation: v, includeTargets: y } = _, b = v === "vertical", x = this.createOrdering(), { mode: S, role: T } = u || {}, D = b ? Ie : Fe, O = (g || S === "view" && T === "instructor") && l && c, k = a && (m(a) || C(a)), A = f && (m(f) || C(f)), j = {
|
|
1027
1045
|
color: w.text(),
|
|
1028
1046
|
backgroundColor: w.background(),
|
|
1029
1047
|
display: "flex",
|
|
@@ -1041,28 +1059,28 @@ var ut = class extends k.Component {
|
|
|
1041
1059
|
onDragEnd: this.onDragEnd,
|
|
1042
1060
|
onDragCancel: this.onDragCancel,
|
|
1043
1061
|
collisionDetection: E,
|
|
1044
|
-
modifiers: [
|
|
1045
|
-
|
|
1046
|
-
children: /* @__PURE__ */ P(
|
|
1062
|
+
modifiers: [ne],
|
|
1063
|
+
...Qe(y),
|
|
1064
|
+
children: /* @__PURE__ */ P(tt, { children: /* @__PURE__ */ F(Ke, {
|
|
1047
1065
|
extraCSSRules: r,
|
|
1048
1066
|
style: j,
|
|
1049
1067
|
children: [
|
|
1050
|
-
A && /* @__PURE__ */ P(
|
|
1068
|
+
A && /* @__PURE__ */ P(st, {
|
|
1051
1069
|
labels: {
|
|
1052
1070
|
hidden: "Show Teacher Instructions",
|
|
1053
1071
|
visible: "Hide Teacher Instructions"
|
|
1054
1072
|
},
|
|
1055
1073
|
className: "collapsible",
|
|
1056
|
-
children: /* @__PURE__ */ P(
|
|
1074
|
+
children: /* @__PURE__ */ P(Z, { prompt: f })
|
|
1057
1075
|
}),
|
|
1058
|
-
/* @__PURE__ */ P(
|
|
1059
|
-
/* @__PURE__ */ P(
|
|
1076
|
+
/* @__PURE__ */ P(it, { children: /* @__PURE__ */ P(Z, { prompt: i }) }),
|
|
1077
|
+
/* @__PURE__ */ P(ot, {
|
|
1060
1078
|
show: h,
|
|
1061
1079
|
toggled: g,
|
|
1062
1080
|
onToggle: this.toggleCorrect,
|
|
1063
1081
|
language: p
|
|
1064
1082
|
}),
|
|
1065
|
-
/* @__PURE__ */ P(
|
|
1083
|
+
/* @__PURE__ */ P(nt, { children: /* @__PURE__ */ P(rt, { children: /* @__PURE__ */ P(ct, {
|
|
1066
1084
|
instanceId: this.instanceId,
|
|
1067
1085
|
choiceLabel: _.choiceLabel,
|
|
1068
1086
|
targetLabel: _.targetLabel,
|
|
@@ -1075,16 +1093,16 @@ var ut = class extends k.Component {
|
|
|
1075
1093
|
choiceLabelEnabled: e.config && e.config.choiceLabelEnabled,
|
|
1076
1094
|
...M
|
|
1077
1095
|
}) }) }),
|
|
1078
|
-
O && /* @__PURE__ */ P(
|
|
1079
|
-
k && /* @__PURE__ */ P(
|
|
1096
|
+
O && /* @__PURE__ */ P(at, { dangerouslySetInnerHTML: { __html: c } }),
|
|
1097
|
+
k && /* @__PURE__ */ P(st, {
|
|
1080
1098
|
labels: {
|
|
1081
1099
|
hidden: "Show Rationale",
|
|
1082
1100
|
visible: "Hide Rationale"
|
|
1083
1101
|
},
|
|
1084
1102
|
className: "collapsible",
|
|
1085
|
-
children: /* @__PURE__ */ P(
|
|
1103
|
+
children: /* @__PURE__ */ P(Z, { prompt: a })
|
|
1086
1104
|
}),
|
|
1087
|
-
!g && /* @__PURE__ */ P(
|
|
1105
|
+
!g && /* @__PURE__ */ P(qe, {
|
|
1088
1106
|
correctness: n,
|
|
1089
1107
|
feedback: o
|
|
1090
1108
|
})
|
|
@@ -1092,7 +1110,7 @@ var ut = class extends k.Component {
|
|
|
1092
1110
|
}) })
|
|
1093
1111
|
});
|
|
1094
1112
|
}
|
|
1095
|
-
},
|
|
1113
|
+
}, ut = class extends k.Component {
|
|
1096
1114
|
static propTypes = {
|
|
1097
1115
|
model: L.default.object.isRequired,
|
|
1098
1116
|
session: L.default.oneOfType([L.default.array.isRequired, L.default.object.isRequired]),
|
|
@@ -1100,13 +1118,13 @@ var ut = class extends k.Component {
|
|
|
1100
1118
|
};
|
|
1101
1119
|
render() {
|
|
1102
1120
|
let { model: e, session: t, onSessionChange: n } = this.props;
|
|
1103
|
-
return /* @__PURE__ */ P(
|
|
1121
|
+
return /* @__PURE__ */ P(lt, {
|
|
1104
1122
|
model: e,
|
|
1105
1123
|
session: t,
|
|
1106
1124
|
onSessionChange: n
|
|
1107
1125
|
});
|
|
1108
1126
|
}
|
|
1109
|
-
},
|
|
1127
|
+
}, dt = (0, I.default)("pie-elements:placement-ordering"), ft = ({ model: t, session: n }) => {
|
|
1110
1128
|
let { config: r } = t, i = (n && e(n.value) || []).length === t.choices.length;
|
|
1111
1129
|
return r.includeTargets || i;
|
|
1112
1130
|
}, pt = class extends HTMLElement {
|
|
@@ -1150,8 +1168,8 @@ var ut = class extends k.Component {
|
|
|
1150
1168
|
}
|
|
1151
1169
|
render() {
|
|
1152
1170
|
if (this._model && this._session) {
|
|
1153
|
-
|
|
1154
|
-
let e = k.createElement(
|
|
1171
|
+
dt("[render] session: ", this._session.value), dt("[render] model: ", this._model), this._initMathObserver();
|
|
1172
|
+
let e = k.createElement(ut, {
|
|
1155
1173
|
model: this._model,
|
|
1156
1174
|
session: this._session,
|
|
1157
1175
|
onSessionChange: this.sessionChange
|