@pie-element/placement-ordering 14.1.2-next.11 → 14.1.2-next.13
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 +181 -169
- 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/ordering.js +13 -19
- 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 +6 -6
- 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(ue.Readable, "Readable"), H = x, U = H.default, ue = U && typeof U == "object" ? U : H, { translator: W } = O, de = {
|
|
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
|
+
}, fe = b("div")(() => ({
|
|
215
215
|
width: "100%",
|
|
216
216
|
cursor: "pointer"
|
|
217
|
-
})),
|
|
217
|
+
})), pe = b("div")(() => ({
|
|
218
218
|
margin: "0 auto",
|
|
219
219
|
textAlign: "center",
|
|
220
220
|
display: "flex"
|
|
221
|
-
})),
|
|
221
|
+
})), me = 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
|
+
...de
|
|
229
|
+
})), G = 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
|
+
})), he = b("div")(() => ({
|
|
243
243
|
width: "25px",
|
|
244
244
|
marginRight: "5px",
|
|
245
245
|
display: "flex",
|
|
246
246
|
alignItems: "center"
|
|
247
|
-
})),
|
|
247
|
+
})), ge = 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: W.t("common:showCorrectAnswer", { lng: t.language }),
|
|
267
|
+
hideMessage: W.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: W.t("common:showCorrectAnswer", { lng: t.language }),
|
|
280
|
+
hideMessage: W.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(fe, {
|
|
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(pe, {
|
|
290
290
|
onClick: this.onClick.bind(this),
|
|
291
291
|
onTouchEnd: this.onTouch.bind(this),
|
|
292
|
-
children: [/* @__PURE__ */ F(
|
|
292
|
+
children: [/* @__PURE__ */ F(he, { 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(G, {
|
|
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(G, {
|
|
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(me, {
|
|
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 _e(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 = _e(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 ve() {
|
|
346
|
+
for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t = _e(e)) && (r && (r += " "), r += t);
|
|
347
347
|
return r;
|
|
348
348
|
}
|
|
349
349
|
//#endregion
|
|
350
350
|
//#region ../../lib-react/drag/dist/placeholder.js
|
|
351
|
-
var
|
|
351
|
+
var ye = 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
|
+
})), be = (e) => {
|
|
405
|
+
let { children: t, className: n, isOver: r, type: i, grid: a, disabled: o, choiceBoard: s, isCategorize: c, isVerticalPool: l, minHeight: u, extraStyles: d } = e, f = ve("placeholder", o && "placeholderDisabled", r && "over", i, n), p = {};
|
|
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(ye, {
|
|
413
413
|
style: {
|
|
414
414
|
...p,
|
|
415
415
|
minHeight: u,
|
|
416
416
|
...d
|
|
417
417
|
},
|
|
418
|
-
className:
|
|
418
|
+
className: ve(s ? m : f, l && "verticalPool"),
|
|
419
419
|
children: t
|
|
420
420
|
});
|
|
421
421
|
};
|
|
422
|
-
|
|
422
|
+
be.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 xe = (0, I.default)("pie-elements:placement-ordering:tile"), Se = 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
|
+
})), Ce = ({ type: e, index: t, isOver: n, disabled: r }) => /* @__PURE__ */ P(be, {
|
|
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(Se, { children: t })
|
|
451
451
|
});
|
|
452
|
-
|
|
452
|
+
Ce.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 we = 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
|
+
})), Te = (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(Ce, {
|
|
505
505
|
type: t,
|
|
506
506
|
index: l,
|
|
507
507
|
isOver: a,
|
|
508
508
|
disabled: s
|
|
509
|
-
}) : /* @__PURE__ */ P(
|
|
509
|
+
}) : /* @__PURE__ */ P(we, {
|
|
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
|
+
}, K = (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
|
+
xe("[render], props: ", e);
|
|
551
|
+
let L = n === "target" ? `target-${s}` : n === "choice" ? `choice-${r}` : null, R = L ? `${l}:${L}` : void 0;
|
|
552
|
+
return /* @__PURE__ */ P("div", {
|
|
553
|
+
ref: te,
|
|
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(Te, {
|
|
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
|
+
K.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 q = {
|
|
607
612
|
choiceLabel: L.default.string,
|
|
608
613
|
targetLabel: L.default.string,
|
|
609
614
|
disabled: L.default.bool,
|
|
@@ -613,106 +618,100 @@ var G = {
|
|
|
613
618
|
selectedChoice: L.default.object,
|
|
614
619
|
onChoiceClick: L.default.func,
|
|
615
620
|
onPlacementClick: L.default.func
|
|
616
|
-
},
|
|
621
|
+
}, Ee = {
|
|
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
|
+
}, De = (e) => {
|
|
626
|
+
let t = (t, n) => (t.instanceId = e.instanceId, t.disabled = e.disabled, t.guideIndex = e.addGuide ? t.index + 1 : void 0, t.tileIndex = n, t.selectedChoice = e.selectedChoice, t.onChoiceClick = e.onChoiceClick, t.onPlacementClick = e.onPlacementClick, e.includeTargets || t.type === "choice" ? /* @__PURE__ */ A(K, {
|
|
622
627
|
...t,
|
|
623
628
|
key: n
|
|
624
|
-
}) : /* @__PURE__ */ A(
|
|
629
|
+
}) : /* @__PURE__ */ A(K, {
|
|
625
630
|
...t,
|
|
626
631
|
label: "",
|
|
627
632
|
key: n
|
|
628
633
|
}));
|
|
629
|
-
return t.propTypes = { ...
|
|
630
|
-
},
|
|
634
|
+
return t.propTypes = { ...q }, t;
|
|
635
|
+
}, Oe = b("div")(({ theme: e, includeTargets: t }) => ({
|
|
631
636
|
display: "grid",
|
|
632
637
|
paddingBottom: e.spacing(2),
|
|
633
638
|
...t && { gridGap: "10px" }
|
|
634
|
-
})),
|
|
639
|
+
})), ke = b("div")({ textAlign: "center" }), Ae = b("div")({
|
|
635
640
|
textAlign: "center",
|
|
636
641
|
gridRow: "3/4"
|
|
637
|
-
}),
|
|
642
|
+
}), je = b("div")(({ includeTargets: e }) => ({
|
|
638
643
|
gridAutoFlow: "column",
|
|
639
644
|
display: "grid",
|
|
640
645
|
...e && { gridGap: "10px" }
|
|
641
|
-
})),
|
|
646
|
+
})), Me = b("div")({
|
|
642
647
|
gridColumn: "1/2",
|
|
643
648
|
textAlign: "center"
|
|
644
|
-
}),
|
|
649
|
+
}), Ne = b("div")({
|
|
645
650
|
gridColumn: "2/3",
|
|
646
651
|
textAlign: "center"
|
|
647
|
-
}),
|
|
648
|
-
static propTypes = { ...
|
|
649
|
-
static defaultProps = { ...
|
|
652
|
+
}), Pe = class extends k.Component {
|
|
653
|
+
static propTypes = { ...q };
|
|
654
|
+
static defaultProps = { ...Ee };
|
|
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(Oe, {
|
|
656
661
|
includeTargets: e,
|
|
657
662
|
style: c,
|
|
658
663
|
children: [
|
|
659
|
-
/* @__PURE__ */ P(
|
|
664
|
+
/* @__PURE__ */ P(ke, {
|
|
660
665
|
style: l,
|
|
661
666
|
dangerouslySetInnerHTML: { __html: t ? n : "" }
|
|
662
667
|
}),
|
|
663
|
-
e && /* @__PURE__ */ P(
|
|
668
|
+
e && /* @__PURE__ */ P(Ae, {
|
|
664
669
|
style: l,
|
|
665
670
|
dangerouslySetInnerHTML: { __html: r }
|
|
666
671
|
}),
|
|
667
|
-
i.map(
|
|
672
|
+
i.map(De(this.props))
|
|
668
673
|
]
|
|
669
674
|
});
|
|
670
675
|
}
|
|
671
|
-
},
|
|
672
|
-
static propTypes = { ...
|
|
673
|
-
static defaultProps = { ...
|
|
676
|
+
}, Fe = class extends k.Component {
|
|
677
|
+
static propTypes = { ...q };
|
|
678
|
+
static defaultProps = { ...Ee };
|
|
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(je, {
|
|
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(Me, { dangerouslySetInnerHTML: { __html: t ? n : "" } }),
|
|
689
|
+
e && /* @__PURE__ */ P(Ne, { dangerouslySetInnerHTML: { __html: r } }),
|
|
690
|
+
i.map(De(this.props))
|
|
686
691
|
]
|
|
687
692
|
});
|
|
688
693
|
}
|
|
689
|
-
},
|
|
694
|
+
}, Ie = (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
|
-
}, ze = (e, n, r) => {
|
|
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}`);
|
|
698
|
-
let i = t(e), a = e[r];
|
|
699
|
-
return i[r] = i[n], i[n] = a, i;
|
|
700
701
|
};
|
|
701
|
-
function
|
|
702
|
+
function Re(e, n) {
|
|
702
703
|
let r = t(e.response);
|
|
703
704
|
if (r[n.index] === n.id) r[n.index] = void 0;
|
|
704
705
|
else throw Error(`Tried to remove from index: ${n.index}, but the id doesn't match: array: ${r}, target: ${n.id}`);
|
|
705
706
|
return r;
|
|
706
707
|
}
|
|
707
|
-
function
|
|
708
|
+
function ze(e, n, r) {
|
|
708
709
|
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" ?
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
return K("fromIndex: ", t, "toIndex:", i), Re(e.response, t, i);
|
|
713
|
-
}
|
|
710
|
+
if (a.includeTargets) return n.type === "choice" && r.type === "target" ? (o[r.index] = n.id, o) : n.type === "target" && r.type === "choice" ? (o[n.index] = void 0, o) : n.type === "target" && r.type === "target" ? (o[r.index] = n.id, o[n.index] = void 0, o) : (Ie("do nothing to the response"), i);
|
|
711
|
+
let s = e.response.findIndex((e) => e !== void 0 && e === n.id), c = e.response.findIndex((e) => e !== void 0 && e === r.id);
|
|
712
|
+
return Ie("fromIndex: ", s, "toIndex:", c), Le(e.response, s, c);
|
|
714
713
|
}
|
|
715
|
-
function
|
|
714
|
+
function J(e, t, n, r) {
|
|
716
715
|
if (r.includeTargets) {
|
|
717
716
|
let i = [];
|
|
718
717
|
for (let r = 0; r < t.length; r++) {
|
|
@@ -747,26 +746,26 @@ function q(e, t, n, r) {
|
|
|
747
746
|
return i === 0 && t.push(a), t.push(o, a), t;
|
|
748
747
|
}, []);
|
|
749
748
|
}
|
|
750
|
-
function
|
|
749
|
+
function Be(e, t, r, i) {
|
|
751
750
|
return i = n({ includeTargets: !0 }, i), r ||= [], t = !t || a(t) ? i.includeTargets ? Array(e.length) : c(e, (e) => e.id) : t, {
|
|
752
751
|
choices: e,
|
|
753
752
|
response: t,
|
|
754
753
|
opts: i,
|
|
755
754
|
outcomes: r,
|
|
756
|
-
tiles:
|
|
755
|
+
tiles: J(e, t, r, i)
|
|
757
756
|
};
|
|
758
757
|
}
|
|
759
|
-
function
|
|
758
|
+
function Ve(e, t) {
|
|
760
759
|
switch (e.type) {
|
|
761
760
|
case "move": {
|
|
762
|
-
let { from: n, to: r } = e, i =
|
|
761
|
+
let { from: n, to: r } = e, i = ze(t, n, r), a = J(t.choices, i, t.outcomes, t.opts);
|
|
763
762
|
return Object.assign({}, t, {
|
|
764
763
|
response: i,
|
|
765
764
|
tiles: a
|
|
766
765
|
});
|
|
767
766
|
}
|
|
768
767
|
case "remove": {
|
|
769
|
-
let { target: n } = e, r =
|
|
768
|
+
let { target: n } = e, r = Re(t, n), i = J(t.choices, r, t.outcomes, t.opts);
|
|
770
769
|
return Object.assign({}, t, {
|
|
771
770
|
response: r,
|
|
772
771
|
tiles: i
|
|
@@ -777,11 +776,11 @@ function Ue(e, t) {
|
|
|
777
776
|
}
|
|
778
777
|
//#endregion
|
|
779
778
|
//#region src/delivery/utils.ts
|
|
780
|
-
var
|
|
779
|
+
var He = (e, t) => {
|
|
781
780
|
if (!Array.isArray(e) || !Array.isArray(t) || e.length !== t.length) return !1;
|
|
782
781
|
let n = (e) => e.map((e) => JSON.stringify(e)).sort(), r = n(e), i = n(t), a = r.every((e, t) => e === i[t]), o = e.every((e, n) => JSON.stringify(e) === JSON.stringify(t[n]));
|
|
783
782
|
return a && !o;
|
|
784
|
-
},
|
|
783
|
+
}, Ue = (e, { active: t, context: n, currentCoordinates: r }) => {
|
|
785
784
|
let { code: i } = e, a = i === "Tab", o = i === h.Down || i === h.Up || i === h.Left || i === h.Right;
|
|
786
785
|
if (!a && !o) return;
|
|
787
786
|
if (o) return y(e, {
|
|
@@ -823,51 +822,51 @@ var We = (e, t) => {
|
|
|
823
822
|
v.sort((e, t) => Math.abs(e.center.y - t.center.y) > 10 ? e.center.y - t.center.y : e.center.x - t.center.x), b && v.push(b);
|
|
824
823
|
let S = 0, C = Infinity;
|
|
825
824
|
for (let e = 0; e < v.length; e++) {
|
|
826
|
-
let t =
|
|
825
|
+
let t = We(p, v[e].center);
|
|
827
826
|
t < C && (C = t, S = e);
|
|
828
827
|
}
|
|
829
828
|
return v[x ? (S - 1 + v.length) % v.length : (S + 1) % v.length].dropPosition;
|
|
830
|
-
},
|
|
829
|
+
}, We = (e, t) => Math.sqrt((e.x - t.x) ** 2 + (e.y - t.y) ** 2);
|
|
831
830
|
//#endregion
|
|
832
831
|
//#region src/delivery/placement-ordering.tsx
|
|
833
|
-
function
|
|
832
|
+
function Y(e) {
|
|
834
833
|
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
835
834
|
}
|
|
836
|
-
function
|
|
837
|
-
return !e ||
|
|
835
|
+
function X(e, t) {
|
|
836
|
+
return !e || Y(e) ? e : Y(e.default) ? e.default : t && Y(e[t]) ? e[t] : t && Y(e[t]?.default) ? e[t].default : e;
|
|
838
837
|
}
|
|
839
|
-
var
|
|
838
|
+
var Ge = X(D, "UiLayout") || X($.UiLayout, "UiLayout"), Z = X(T, "PreviewPrompt") || X($.PreviewPrompt, "PreviewPrompt"), Ke = X(p, "Feedback") || X($.Feedback, "Feedback"), qe = X(f, "Collapsible") || X($.Collapsible, "Collapsible"), Je = x, Q = Je.default, $ = Q && typeof Q == "object" ? Q : Je, Ye = 250, Xe = (e, t) => {
|
|
840
839
|
if (!e || !t) return !1;
|
|
841
840
|
let n = t.left + t.width / 2, r = t.top + t.height / 2;
|
|
842
841
|
return n >= e.left && n <= e.right && r >= e.top && r <= e.bottom;
|
|
843
|
-
},
|
|
844
|
-
keyboardCoordinateGetter:
|
|
842
|
+
}, Ze = (e) => e ? {
|
|
843
|
+
keyboardCoordinateGetter: Ue,
|
|
845
844
|
keyboardCodes: {
|
|
846
845
|
start: ["Space", "Enter"],
|
|
847
846
|
cancel: ["Escape"],
|
|
848
847
|
end: ["Space", "Enter"]
|
|
849
848
|
},
|
|
850
849
|
accessibility: { screenReaderInstructions: { draggable: "Press Space or Enter to pick up this answer choice. Once picked up, use Tab or Shift+Tab to cycle through response areas, or use arrow keys to move it freely. Press Space or Enter to drop, or Escape to cancel." } }
|
|
851
|
-
} : {}, { translator:
|
|
850
|
+
} : {}, { translator: Qe } = O, $e = (0, I.default)("pie-elements:placement-ordering"), et = b("div")({
|
|
852
851
|
color: w.text(),
|
|
853
852
|
backgroundColor: w.background(),
|
|
854
853
|
display: "flex",
|
|
855
854
|
flexDirection: "column",
|
|
856
855
|
alignItems: "center",
|
|
857
856
|
boxSizing: "border-box"
|
|
858
|
-
}),
|
|
857
|
+
}), tt = b("div")({
|
|
859
858
|
alignSelf: "stretch",
|
|
860
859
|
maxWidth: "100%",
|
|
861
860
|
overflowX: "auto",
|
|
862
861
|
overflowY: "hidden"
|
|
863
|
-
}),
|
|
862
|
+
}), nt = b("div")({
|
|
864
863
|
display: "flex",
|
|
865
864
|
justifyContent: "center",
|
|
866
865
|
minWidth: "min-content"
|
|
867
|
-
}),
|
|
866
|
+
}), rt = b("div")(({ theme: e }) => ({ paddingBottom: e.spacing(1) })), it = b("div")(({ theme: e }) => ({ paddingBottom: e.spacing(2) })), at = b(ge)(({ theme: e }) => ({ paddingBottom: e.spacing(1) })), ot = b(qe)(({ theme: e }) => ({
|
|
868
867
|
marginBottom: e.spacing(2),
|
|
869
868
|
alignSelf: "flex-start"
|
|
870
|
-
})),
|
|
869
|
+
})), st = (e) => {
|
|
871
870
|
let { tiler: t, ordering: n, onDropChoice: r, onRemoveChoice: i, ...a } = e;
|
|
872
871
|
return /* @__PURE__ */ P(t, {
|
|
873
872
|
...a,
|
|
@@ -876,13 +875,13 @@ var qe = Y(D, "UiLayout") || Y(Q.UiLayout, "UiLayout"), X = Y(T, "PreviewPrompt"
|
|
|
876
875
|
onRemoveChoice: (e) => i(e, n)
|
|
877
876
|
});
|
|
878
877
|
};
|
|
879
|
-
|
|
878
|
+
st.propTypes = {
|
|
880
879
|
tiler: L.default.func,
|
|
881
880
|
ordering: L.default.any,
|
|
882
881
|
onDropChoice: L.default.func,
|
|
883
882
|
onRemoveChoice: L.default.func
|
|
884
883
|
};
|
|
885
|
-
var
|
|
884
|
+
var ct = class extends k.Component {
|
|
886
885
|
static propTypes = {
|
|
887
886
|
onSessionChange: L.default.func.isRequired,
|
|
888
887
|
model: L.default.object.isRequired,
|
|
@@ -922,9 +921,9 @@ var ut = class extends k.Component {
|
|
|
922
921
|
};
|
|
923
922
|
};
|
|
924
923
|
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 =
|
|
924
|
+
let { model: t = {} } = e || {}, { model: n = {} } = this.props || {}, { correctResponse: r, config: i, choices: a = [], env: o } = t, { includeTargets: s } = i || {}, c = {}, l = n.language && n.language !== t.language, u = n.note && n.note === Qe.t("common:commonCorrectAnswerWithAlternates", { lng: n.language });
|
|
925
|
+
l && u && (n.note = Qe.t("common:commonCorrectAnswerWithAlternates", { lng: t.language })), r || (c.showingCorrect = !1);
|
|
926
|
+
let d = He(a, n.choices), { value: f, needsReset: p } = this.validateSession(e, d), m = {
|
|
928
927
|
...e.session,
|
|
929
928
|
value: f
|
|
930
929
|
}, h = n.config?.includeTargets !== s;
|
|
@@ -935,8 +934,8 @@ var ut = class extends k.Component {
|
|
|
935
934
|
}
|
|
936
935
|
onDropChoice = (e, t, n) => {
|
|
937
936
|
let { onSessionChange: r, session: i } = this.props, a = n.tiles.find((e) => e.id === t.id && e.type === t.type && e.index === t.index), o = e;
|
|
938
|
-
|
|
939
|
-
let s =
|
|
937
|
+
$e("[onDropChoice] ", a, o);
|
|
938
|
+
let s = Ve({
|
|
940
939
|
type: "move",
|
|
941
940
|
from: a,
|
|
942
941
|
to: o
|
|
@@ -945,8 +944,8 @@ var ut = class extends k.Component {
|
|
|
945
944
|
};
|
|
946
945
|
onRemoveChoice = (e, t) => {
|
|
947
946
|
let { onSessionChange: n, session: r } = this.props;
|
|
948
|
-
|
|
949
|
-
let i =
|
|
947
|
+
$e("[onRemoveChoice]", e);
|
|
948
|
+
let i = Ve({
|
|
950
949
|
type: "remove",
|
|
951
950
|
target: e
|
|
952
951
|
}, t);
|
|
@@ -957,13 +956,13 @@ var ut = class extends k.Component {
|
|
|
957
956
|
orientation: "vertical",
|
|
958
957
|
includeTargets: !0
|
|
959
958
|
};
|
|
960
|
-
return n ?
|
|
959
|
+
return n ? Be(e.choices, e.correctResponse, e.correctResponse.map((e) => ({
|
|
961
960
|
id: e,
|
|
962
961
|
outcome: "correct"
|
|
963
962
|
})), {
|
|
964
963
|
includeTargets: r,
|
|
965
964
|
allowSameChoiceInTargets: e.config.allowSameChoiceInTargets
|
|
966
|
-
}) :
|
|
965
|
+
}) : Be(e.choices, t.value, e.outcomes, {
|
|
967
966
|
includeTargets: r,
|
|
968
967
|
allowSameChoiceInTargets: e.config.allowSameChoiceInTargets
|
|
969
968
|
});
|
|
@@ -973,13 +972,16 @@ var ut = class extends k.Component {
|
|
|
973
972
|
if (this.cancelSelection(), this.lastDragEndAt = Date.now(), t && n) {
|
|
974
973
|
let e = n.data.current, i = t.data.current;
|
|
975
974
|
if (e && i && i.type === "target") {
|
|
976
|
-
this.onDropChoice(i, e, r);
|
|
975
|
+
this.onDropChoice(i, e, r), this.focusTile(this.getDestinationSlotId(i));
|
|
977
976
|
return;
|
|
978
977
|
}
|
|
979
|
-
e && i && this.onDropChoice(i, e, r);
|
|
978
|
+
e && i && (this.onDropChoice(i, e, r), this.focusTile(this.getDestinationSlotId(i)));
|
|
980
979
|
} else if (!t && n) {
|
|
981
|
-
let e = n.data.current, t =
|
|
982
|
-
e && e.type === "target" && !t && this.onRemoveChoice(e, r)
|
|
980
|
+
let e = n.data.current, t = Xe(n.rect?.current?.initial, n.rect?.current?.translated);
|
|
981
|
+
e && e.type === "target" && !t && (this.onRemoveChoice(e, r), this.focusTile(this.getDestinationSlotId({
|
|
982
|
+
type: "choice",
|
|
983
|
+
id: e.id
|
|
984
|
+
})));
|
|
983
985
|
}
|
|
984
986
|
};
|
|
985
987
|
onDragStart = (e) => {
|
|
@@ -1009,10 +1011,20 @@ var ut = class extends k.Component {
|
|
|
1009
1011
|
placeSelectedChoice = (e) => {
|
|
1010
1012
|
let { selectedChoice: t } = this.state;
|
|
1011
1013
|
if (!t) return;
|
|
1012
|
-
let n = this.createOrdering();
|
|
1013
|
-
this.onDropChoice(e, t, n), this.cancelSelection(), this.endAnyLiveKeyboardDrag(), this.lastDragEndAt = Date.now();
|
|
1014
|
+
let n = this.createOrdering(), r = this.getDestinationSlotId(e);
|
|
1015
|
+
this.onDropChoice(e, t, n), this.cancelSelection(), this.endAnyLiveKeyboardDrag(), this.lastDragEndAt = Date.now(), this.focusTile(r);
|
|
1016
|
+
};
|
|
1017
|
+
getDestinationSlotId = (e) => e ? e.type === "target" ? `target-${e.index}` : e.type === "choice" ? `choice-${e.id}` : null : null;
|
|
1018
|
+
focusTile = (e) => {
|
|
1019
|
+
if (!e) return;
|
|
1020
|
+
let t = `[data-tile-id="${this.instanceId}:${e}"]`;
|
|
1021
|
+
requestAnimationFrame(() => {
|
|
1022
|
+
requestAnimationFrame(() => {
|
|
1023
|
+
document.querySelector(t)?.focus();
|
|
1024
|
+
});
|
|
1025
|
+
});
|
|
1014
1026
|
};
|
|
1015
|
-
isClickSoonAfterDragEnd = () => Date.now() - this.lastDragEndAt <
|
|
1027
|
+
isClickSoonAfterDragEnd = () => Date.now() - this.lastDragEndAt < Ye;
|
|
1016
1028
|
onChoiceClick = (e) => {
|
|
1017
1029
|
this.isClickSoonAfterDragEnd() || this.toggleChoiceSelection(e);
|
|
1018
1030
|
};
|
|
@@ -1023,7 +1035,7 @@ var ut = class extends k.Component {
|
|
|
1023
1035
|
let { model: e } = this.props, { correctResponse: t, correctness: n, extraCSSRules: r, prompt: i, rationale: a, feedback: o, config: s, note: c, showNote: l, env: u, disabled: d, teacherInstructions: f, language: p } = e, h = t && t.length > 0, { showingCorrect: g } = this.state, _ = s || {
|
|
1024
1036
|
orientation: "vertical",
|
|
1025
1037
|
includeTargets: !0
|
|
1026
|
-
}, { orientation: v, includeTargets: y } = _, b = v === "vertical", x = this.createOrdering(), { mode: S, role: T } = u || {}, D = b ?
|
|
1038
|
+
}, { orientation: v, includeTargets: y } = _, b = v === "vertical", x = this.createOrdering(), { mode: S, role: T } = u || {}, D = b ? Fe : Pe, O = (g || S === "view" && T === "instructor") && l && c, k = a && (m(a) || C(a)), A = f && (m(f) || C(f)), j = {
|
|
1027
1039
|
color: w.text(),
|
|
1028
1040
|
backgroundColor: w.background(),
|
|
1029
1041
|
display: "flex",
|
|
@@ -1041,28 +1053,28 @@ var ut = class extends k.Component {
|
|
|
1041
1053
|
onDragEnd: this.onDragEnd,
|
|
1042
1054
|
onDragCancel: this.onDragCancel,
|
|
1043
1055
|
collisionDetection: E,
|
|
1044
|
-
modifiers: [
|
|
1045
|
-
|
|
1046
|
-
children: /* @__PURE__ */ P(
|
|
1056
|
+
modifiers: [ne],
|
|
1057
|
+
...Ze(y),
|
|
1058
|
+
children: /* @__PURE__ */ P(et, { children: /* @__PURE__ */ F(Ge, {
|
|
1047
1059
|
extraCSSRules: r,
|
|
1048
1060
|
style: j,
|
|
1049
1061
|
children: [
|
|
1050
|
-
A && /* @__PURE__ */ P(
|
|
1062
|
+
A && /* @__PURE__ */ P(ot, {
|
|
1051
1063
|
labels: {
|
|
1052
1064
|
hidden: "Show Teacher Instructions",
|
|
1053
1065
|
visible: "Hide Teacher Instructions"
|
|
1054
1066
|
},
|
|
1055
1067
|
className: "collapsible",
|
|
1056
|
-
children: /* @__PURE__ */ P(
|
|
1068
|
+
children: /* @__PURE__ */ P(Z, { prompt: f })
|
|
1057
1069
|
}),
|
|
1058
|
-
/* @__PURE__ */ P(
|
|
1059
|
-
/* @__PURE__ */ P(
|
|
1070
|
+
/* @__PURE__ */ P(rt, { children: /* @__PURE__ */ P(Z, { prompt: i }) }),
|
|
1071
|
+
/* @__PURE__ */ P(at, {
|
|
1060
1072
|
show: h,
|
|
1061
1073
|
toggled: g,
|
|
1062
1074
|
onToggle: this.toggleCorrect,
|
|
1063
1075
|
language: p
|
|
1064
1076
|
}),
|
|
1065
|
-
/* @__PURE__ */ P(
|
|
1077
|
+
/* @__PURE__ */ P(tt, { children: /* @__PURE__ */ P(nt, { children: /* @__PURE__ */ P(st, {
|
|
1066
1078
|
instanceId: this.instanceId,
|
|
1067
1079
|
choiceLabel: _.choiceLabel,
|
|
1068
1080
|
targetLabel: _.targetLabel,
|
|
@@ -1075,16 +1087,16 @@ var ut = class extends k.Component {
|
|
|
1075
1087
|
choiceLabelEnabled: e.config && e.config.choiceLabelEnabled,
|
|
1076
1088
|
...M
|
|
1077
1089
|
}) }) }),
|
|
1078
|
-
O && /* @__PURE__ */ P(
|
|
1079
|
-
k && /* @__PURE__ */ P(
|
|
1090
|
+
O && /* @__PURE__ */ P(it, { dangerouslySetInnerHTML: { __html: c } }),
|
|
1091
|
+
k && /* @__PURE__ */ P(ot, {
|
|
1080
1092
|
labels: {
|
|
1081
1093
|
hidden: "Show Rationale",
|
|
1082
1094
|
visible: "Hide Rationale"
|
|
1083
1095
|
},
|
|
1084
1096
|
className: "collapsible",
|
|
1085
|
-
children: /* @__PURE__ */ P(
|
|
1097
|
+
children: /* @__PURE__ */ P(Z, { prompt: a })
|
|
1086
1098
|
}),
|
|
1087
|
-
!g && /* @__PURE__ */ P(
|
|
1099
|
+
!g && /* @__PURE__ */ P(Ke, {
|
|
1088
1100
|
correctness: n,
|
|
1089
1101
|
feedback: o
|
|
1090
1102
|
})
|
|
@@ -1092,7 +1104,7 @@ var ut = class extends k.Component {
|
|
|
1092
1104
|
}) })
|
|
1093
1105
|
});
|
|
1094
1106
|
}
|
|
1095
|
-
},
|
|
1107
|
+
}, lt = class extends k.Component {
|
|
1096
1108
|
static propTypes = {
|
|
1097
1109
|
model: L.default.object.isRequired,
|
|
1098
1110
|
session: L.default.oneOfType([L.default.array.isRequired, L.default.object.isRequired]),
|
|
@@ -1100,16 +1112,16 @@ var ut = class extends k.Component {
|
|
|
1100
1112
|
};
|
|
1101
1113
|
render() {
|
|
1102
1114
|
let { model: e, session: t, onSessionChange: n } = this.props;
|
|
1103
|
-
return /* @__PURE__ */ P(
|
|
1115
|
+
return /* @__PURE__ */ P(ct, {
|
|
1104
1116
|
model: e,
|
|
1105
1117
|
session: t,
|
|
1106
1118
|
onSessionChange: n
|
|
1107
1119
|
});
|
|
1108
1120
|
}
|
|
1109
|
-
},
|
|
1121
|
+
}, ut = (0, I.default)("pie-elements:placement-ordering"), dt = ({ model: t, session: n }) => {
|
|
1110
1122
|
let { config: r } = t, i = (n && e(n.value) || []).length === t.choices.length;
|
|
1111
1123
|
return r.includeTargets || i;
|
|
1112
|
-
},
|
|
1124
|
+
}, ft = class extends HTMLElement {
|
|
1113
1125
|
constructor() {
|
|
1114
1126
|
super(), this._root = null, this._mathObserver = null, this._mathRenderPending = !1;
|
|
1115
1127
|
}
|
|
@@ -1150,8 +1162,8 @@ var ut = class extends k.Component {
|
|
|
1150
1162
|
}
|
|
1151
1163
|
render() {
|
|
1152
1164
|
if (this._model && this._session) {
|
|
1153
|
-
|
|
1154
|
-
let e = k.createElement(
|
|
1165
|
+
ut("[render] session: ", this._session.value), ut("[render] model: ", this._model), this._initMathObserver();
|
|
1166
|
+
let e = k.createElement(lt, {
|
|
1155
1167
|
model: this._model,
|
|
1156
1168
|
session: this._session,
|
|
1157
1169
|
onSessionChange: this.sessionChange
|
|
@@ -1167,6 +1179,6 @@ var ut = class extends k.Component {
|
|
|
1167
1179
|
}
|
|
1168
1180
|
};
|
|
1169
1181
|
//#endregion
|
|
1170
|
-
export {
|
|
1182
|
+
export { ft as default, dt as isValidSession };
|
|
1171
1183
|
|
|
1172
1184
|
//# sourceMappingURL=index.js.map
|