@pie-element/placement-ordering 14.1.2-next.7 → 14.1.2-next.9
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 +723 -615
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/delivery/index.js +275 -267
- package/dist/browser/delivery/index.js.map +1 -1
- package/dist/browser/{drag-provider-BdfhGCEU.js → drag-provider-B5wazJHM.js} +745 -743
- package/dist/browser/drag-provider-B5wazJHM.js.map +1 -0
- package/dist/delivery/keyboard-coordinates.d.ts +24 -12
- package/dist/delivery/keyboard-coordinates.js +31 -28
- package/dist/delivery/ordering.js +1 -0
- package/dist/delivery/placement-ordering.js +29 -25
- package/dist/index.iife.js +21 -21
- package/package.json +6 -6
- package/dist/browser/drag-provider-BdfhGCEU.js.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
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,
|
|
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
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";
|
|
6
|
-
import
|
|
7
|
-
import { jsx as
|
|
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 F = /* @__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,47 +37,47 @@ var re = class e extends CustomEvent {
|
|
|
37
37
|
}
|
|
38
38
|
}), this.component = t, this.complete = n;
|
|
39
39
|
}
|
|
40
|
-
},
|
|
41
|
-
function
|
|
40
|
+
}, L = /* @__PURE__ */ i(u(), 1);
|
|
41
|
+
function ne(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 re = (e) => {
|
|
46
46
|
let { containerNodeRect: t, draggingNodeRect: n, transform: r } = e;
|
|
47
|
-
return !n || !t ? r :
|
|
48
|
-
},
|
|
47
|
+
return !n || !t ? r : ne(r, n, t);
|
|
48
|
+
}, R = ({ bgFill: e, fgFill: t }) => /* @__PURE__ */ F("svg", {
|
|
49
49
|
preserveAspectRatio: "xMinYMin meet",
|
|
50
50
|
version: "1.1",
|
|
51
51
|
viewBox: "-283 359 34 35",
|
|
52
52
|
style: { enableBackground: "new -283 359 34 35" },
|
|
53
53
|
children: [
|
|
54
|
-
/* @__PURE__ */
|
|
54
|
+
/* @__PURE__ */ P("circle", {
|
|
55
55
|
cx: "-266",
|
|
56
56
|
cy: "375.9",
|
|
57
57
|
r: "14",
|
|
58
58
|
fill: e
|
|
59
59
|
}),
|
|
60
|
-
/* @__PURE__ */
|
|
60
|
+
/* @__PURE__ */ P("path", {
|
|
61
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",
|
|
62
62
|
fill: e
|
|
63
63
|
}),
|
|
64
|
-
/* @__PURE__ */
|
|
64
|
+
/* @__PURE__ */ P("polygon", {
|
|
65
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",
|
|
66
66
|
fill: t
|
|
67
67
|
})
|
|
68
68
|
]
|
|
69
69
|
});
|
|
70
|
-
|
|
71
|
-
bgFill:
|
|
72
|
-
fgFill:
|
|
70
|
+
R.propTypes = {
|
|
71
|
+
bgFill: L.default.string.isRequired,
|
|
72
|
+
fgFill: L.default.string.isRequired
|
|
73
73
|
};
|
|
74
|
-
var
|
|
74
|
+
var ie = ({ 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",
|
|
78
78
|
style: { enableBackground: "new -129.5 127 34 35" },
|
|
79
79
|
children: [
|
|
80
|
-
/* @__PURE__ */
|
|
80
|
+
/* @__PURE__ */ P("path", {
|
|
81
81
|
style: {
|
|
82
82
|
fill: "#D0CAC5",
|
|
83
83
|
stroke: "#E6E3E0",
|
|
@@ -86,7 +86,7 @@ var se = ({ bgFill: e, fgFill: t, borderFill: n }) => /* @__PURE__ */ P("svg", {
|
|
|
86
86
|
},
|
|
87
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"
|
|
88
88
|
}),
|
|
89
|
-
/* @__PURE__ */
|
|
89
|
+
/* @__PURE__ */ P("path", {
|
|
90
90
|
style: {
|
|
91
91
|
fill: "#B3ABA4",
|
|
92
92
|
stroke: "#CDC7C2",
|
|
@@ -95,48 +95,48 @@ var se = ({ bgFill: e, fgFill: t, borderFill: n }) => /* @__PURE__ */ P("svg", {
|
|
|
95
95
|
},
|
|
96
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"
|
|
97
97
|
}),
|
|
98
|
-
/* @__PURE__ */
|
|
98
|
+
/* @__PURE__ */ P("circle", {
|
|
99
99
|
cx: "-114.2",
|
|
100
100
|
cy: "143.5",
|
|
101
101
|
r: "14",
|
|
102
102
|
fill: e
|
|
103
103
|
}),
|
|
104
|
-
/* @__PURE__ */
|
|
104
|
+
/* @__PURE__ */ P("path", {
|
|
105
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",
|
|
106
106
|
fill: n
|
|
107
107
|
}),
|
|
108
|
-
/* @__PURE__ */
|
|
108
|
+
/* @__PURE__ */ P("polygon", {
|
|
109
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",
|
|
110
110
|
fill: t
|
|
111
111
|
})
|
|
112
112
|
]
|
|
113
113
|
});
|
|
114
|
-
|
|
115
|
-
bgFill:
|
|
116
|
-
fgFill:
|
|
117
|
-
borderFill:
|
|
114
|
+
ie.propTypes = {
|
|
115
|
+
bgFill: L.default.string.isRequired,
|
|
116
|
+
fgFill: L.default.string.isRequired,
|
|
117
|
+
borderFill: L.default.string.isRequired
|
|
118
118
|
};
|
|
119
|
-
var
|
|
119
|
+
var ae = b("div")(({ size: e }) => ({
|
|
120
120
|
width: e || "25px",
|
|
121
121
|
height: e || "25px"
|
|
122
|
-
})),
|
|
122
|
+
})), z = ({ open: e, size: t }) => /* @__PURE__ */ P(ae, {
|
|
123
123
|
size: t,
|
|
124
|
-
children: e ? /* @__PURE__ */
|
|
124
|
+
children: e ? /* @__PURE__ */ P(R, {
|
|
125
125
|
bgFill: "#bce2ff",
|
|
126
126
|
fgFill: "#1a9cff"
|
|
127
|
-
}) : /* @__PURE__ */
|
|
127
|
+
}) : /* @__PURE__ */ P(ie, {
|
|
128
128
|
bgFill: "white",
|
|
129
129
|
fgFill: "#1a9cff",
|
|
130
130
|
borderFill: "#bce2ff"
|
|
131
131
|
})
|
|
132
132
|
});
|
|
133
|
-
|
|
134
|
-
open:
|
|
135
|
-
size:
|
|
136
|
-
},
|
|
133
|
+
z.propTypes = {
|
|
134
|
+
open: L.default.bool,
|
|
135
|
+
size: L.default.string
|
|
136
|
+
}, z.defaultProps = { open: !1 };
|
|
137
137
|
//#endregion
|
|
138
138
|
//#region ../../lib-react/correct-answer-toggle/dist/expander.js
|
|
139
|
-
var
|
|
139
|
+
var oe = "height ease-in 300ms, opacity ease-in 300ms", se = b("div")(() => ({
|
|
140
140
|
position: "relative",
|
|
141
141
|
height: 0,
|
|
142
142
|
overflow: "hidden",
|
|
@@ -144,7 +144,7 @@ var le = "height ease-in 300ms, opacity ease-in 300ms", ue = b("div")(() => ({
|
|
|
144
144
|
visibility: "hidden",
|
|
145
145
|
width: 0,
|
|
146
146
|
"&.enter": {
|
|
147
|
-
transition:
|
|
147
|
+
transition: oe,
|
|
148
148
|
opacity: 1,
|
|
149
149
|
height: "auto",
|
|
150
150
|
width: "auto",
|
|
@@ -158,7 +158,7 @@ var le = "height ease-in 300ms, opacity ease-in 300ms", ue = b("div")(() => ({
|
|
|
158
158
|
minHeight: "25px"
|
|
159
159
|
},
|
|
160
160
|
"&.exit": {
|
|
161
|
-
transition:
|
|
161
|
+
transition: oe,
|
|
162
162
|
opacity: 0,
|
|
163
163
|
height: 0,
|
|
164
164
|
visibility: "visible",
|
|
@@ -170,9 +170,9 @@ var le = "height ease-in 300ms, opacity ease-in 300ms", ue = b("div")(() => ({
|
|
|
170
170
|
height: 0,
|
|
171
171
|
width: 0
|
|
172
172
|
}
|
|
173
|
-
})),
|
|
173
|
+
})), ce = (e) => {
|
|
174
174
|
let { show: t, children: n, className: r } = e, i = j(null);
|
|
175
|
-
return /* @__PURE__ */
|
|
175
|
+
return /* @__PURE__ */ P(S, {
|
|
176
176
|
nodeRef: i,
|
|
177
177
|
in: t,
|
|
178
178
|
appear: !0,
|
|
@@ -184,48 +184,48 @@ var le = "height ease-in 300ms, opacity ease-in 300ms", ue = b("div")(() => ({
|
|
|
184
184
|
exit: "exit",
|
|
185
185
|
exitDone: "exit-done"
|
|
186
186
|
},
|
|
187
|
-
children: /* @__PURE__ */
|
|
187
|
+
children: /* @__PURE__ */ P(se, {
|
|
188
188
|
ref: i,
|
|
189
189
|
className: r,
|
|
190
190
|
children: n
|
|
191
191
|
})
|
|
192
192
|
});
|
|
193
193
|
};
|
|
194
|
-
|
|
195
|
-
show:
|
|
196
|
-
className:
|
|
197
|
-
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
|
|
198
198
|
};
|
|
199
199
|
//#endregion
|
|
200
200
|
//#region ../../lib-react/correct-answer-toggle/dist/index.js
|
|
201
|
-
function
|
|
201
|
+
function B(e) {
|
|
202
202
|
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
203
203
|
}
|
|
204
|
-
function
|
|
205
|
-
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;
|
|
206
206
|
}
|
|
207
|
-
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 = {
|
|
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
|
+
}, me = b("div")(() => ({
|
|
215
215
|
width: "100%",
|
|
216
216
|
cursor: "pointer"
|
|
217
|
-
})),
|
|
217
|
+
})), he = b("div")(() => ({
|
|
218
218
|
margin: "0 auto",
|
|
219
219
|
textAlign: "center",
|
|
220
220
|
display: "flex"
|
|
221
|
-
})),
|
|
221
|
+
})), ge = 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
|
-
...
|
|
228
|
+
...pe
|
|
229
229
|
})), U = b("div")(() => ({
|
|
230
230
|
position: "absolute",
|
|
231
231
|
width: "25px",
|
|
@@ -239,20 +239,20 @@ var fe = z(v, "Readable") || z(pe.Readable, "Readable"), B = x, V = B.default, p
|
|
|
239
239
|
opacity: "0",
|
|
240
240
|
transition: "opacity 0.3s ease-in"
|
|
241
241
|
}
|
|
242
|
-
})),
|
|
242
|
+
})), _e = b("div")(() => ({
|
|
243
243
|
width: "25px",
|
|
244
244
|
marginRight: "5px",
|
|
245
245
|
display: "flex",
|
|
246
246
|
alignItems: "center"
|
|
247
|
-
})),
|
|
247
|
+
})), ve = class e extends k.Component {
|
|
248
248
|
static propTypes = {
|
|
249
|
-
onToggle:
|
|
250
|
-
toggled:
|
|
251
|
-
show:
|
|
252
|
-
hideMessage:
|
|
253
|
-
showMessage:
|
|
254
|
-
className:
|
|
255
|
-
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
|
|
256
256
|
};
|
|
257
257
|
static defaultProps = {
|
|
258
258
|
showMessage: "Show correct answer",
|
|
@@ -282,14 +282,14 @@ var fe = z(v, "Readable") || z(pe.Readable, "Readable"), B = x, V = B.default, p
|
|
|
282
282
|
}
|
|
283
283
|
render() {
|
|
284
284
|
let { className: e, toggled: t, hideMessage: n, showMessage: r } = this.props;
|
|
285
|
-
return /* @__PURE__ */
|
|
285
|
+
return /* @__PURE__ */ P(me, {
|
|
286
286
|
className: e,
|
|
287
|
-
children: /* @__PURE__ */
|
|
287
|
+
children: /* @__PURE__ */ P(ce, {
|
|
288
288
|
show: this.state.show,
|
|
289
|
-
children: /* @__PURE__ */
|
|
289
|
+
children: /* @__PURE__ */ F(he, {
|
|
290
290
|
onClick: this.onClick.bind(this),
|
|
291
291
|
onTouchEnd: this.onTouch.bind(this),
|
|
292
|
-
children: [/* @__PURE__ */
|
|
292
|
+
children: [/* @__PURE__ */ F(_e, { children: [/* @__PURE__ */ P(S, {
|
|
293
293
|
nodeRef: this.openIconRef,
|
|
294
294
|
timeout: 400,
|
|
295
295
|
in: t,
|
|
@@ -300,11 +300,11 @@ var fe = z(v, "Readable") || z(pe.Readable, "Readable"), B = x, V = B.default, p
|
|
|
300
300
|
exit: "exit",
|
|
301
301
|
exitActive: "exit-active"
|
|
302
302
|
},
|
|
303
|
-
children: /* @__PURE__ */
|
|
303
|
+
children: /* @__PURE__ */ P(U, {
|
|
304
304
|
ref: this.openIconRef,
|
|
305
|
-
children: /* @__PURE__ */
|
|
305
|
+
children: /* @__PURE__ */ P(z, { open: t }, "correct-open")
|
|
306
306
|
})
|
|
307
|
-
}), /* @__PURE__ */
|
|
307
|
+
}), /* @__PURE__ */ P(S, {
|
|
308
308
|
nodeRef: this.closedIconRef,
|
|
309
309
|
timeout: 5e3,
|
|
310
310
|
in: !t,
|
|
@@ -315,13 +315,13 @@ var fe = z(v, "Readable") || z(pe.Readable, "Readable"), B = x, V = B.default, p
|
|
|
315
315
|
exit: "exit",
|
|
316
316
|
exitActive: "exit-active"
|
|
317
317
|
},
|
|
318
|
-
children: /* @__PURE__ */
|
|
318
|
+
children: /* @__PURE__ */ P(U, {
|
|
319
319
|
ref: this.closedIconRef,
|
|
320
|
-
children: /* @__PURE__ */
|
|
320
|
+
children: /* @__PURE__ */ P(z, { open: t }, "correct-closed")
|
|
321
321
|
})
|
|
322
|
-
})] }), /* @__PURE__ */
|
|
322
|
+
})] }), /* @__PURE__ */ P(ue, {
|
|
323
323
|
false: !0,
|
|
324
|
-
children: /* @__PURE__ */
|
|
324
|
+
children: /* @__PURE__ */ P(ge, {
|
|
325
325
|
"aria-hidden": !this.state.show,
|
|
326
326
|
children: t ? n : r
|
|
327
327
|
})
|
|
@@ -333,17 +333,17 @@ var fe = z(v, "Readable") || z(pe.Readable, "Readable"), B = x, V = B.default, p
|
|
|
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 ye(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 = ye(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
345
|
function be() {
|
|
346
|
-
for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t =
|
|
346
|
+
for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t = ye(e)) && (r && (r += " "), r += t);
|
|
347
347
|
return r;
|
|
348
348
|
}
|
|
349
349
|
//#endregion
|
|
@@ -369,11 +369,11 @@ var xe = b("div")(({ theme: e }) => ({
|
|
|
369
369
|
},
|
|
370
370
|
"&.placeholderDisabled": {
|
|
371
371
|
boxShadow: "none",
|
|
372
|
-
background:
|
|
372
|
+
background: w.white()
|
|
373
373
|
},
|
|
374
374
|
"&.over": {
|
|
375
|
-
border: `1px solid ${
|
|
376
|
-
backgroundColor:
|
|
375
|
+
border: `1px solid ${w.border()}`,
|
|
376
|
+
backgroundColor: w.backgroundDark()
|
|
377
377
|
},
|
|
378
378
|
"&.board": {
|
|
379
379
|
padding: e.spacing(1),
|
|
@@ -384,7 +384,7 @@ var xe = b("div")(({ theme: e }) => ({
|
|
|
384
384
|
justifyContent: "center",
|
|
385
385
|
overflow: "hidden",
|
|
386
386
|
touchAction: "none",
|
|
387
|
-
backgroundColor: w.
|
|
387
|
+
backgroundColor: w.surface()
|
|
388
388
|
},
|
|
389
389
|
"&.categorizeBoard": {
|
|
390
390
|
padding: e.spacing(.5),
|
|
@@ -395,7 +395,7 @@ var xe = b("div")(({ theme: e }) => ({
|
|
|
395
395
|
justifyContent: "center",
|
|
396
396
|
overflow: "hidden",
|
|
397
397
|
touchAction: "none",
|
|
398
|
-
backgroundColor: w.
|
|
398
|
+
backgroundColor: w.surface()
|
|
399
399
|
},
|
|
400
400
|
"&.verticalPool": {
|
|
401
401
|
display: "flex",
|
|
@@ -409,7 +409,7 @@ var xe = b("div")(({ theme: e }) => ({
|
|
|
409
409
|
}
|
|
410
410
|
i === "choice" && (p.border = `1px solid ${w.borderLight()}`, p.background = w.backgroundDark());
|
|
411
411
|
let m = c ? "categorizeBoard" : "board";
|
|
412
|
-
return /* @__PURE__ */
|
|
412
|
+
return /* @__PURE__ */ P(xe, {
|
|
413
413
|
style: {
|
|
414
414
|
...p,
|
|
415
415
|
minHeight: u,
|
|
@@ -420,40 +420,40 @@ var xe = b("div")(({ theme: e }) => ({
|
|
|
420
420
|
});
|
|
421
421
|
};
|
|
422
422
|
Se.propTypes = {
|
|
423
|
-
choiceBoard:
|
|
424
|
-
grid:
|
|
425
|
-
columns:
|
|
426
|
-
rows:
|
|
427
|
-
rowsRepeatValue:
|
|
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
|
|
428
428
|
}),
|
|
429
|
-
children:
|
|
430
|
-
className:
|
|
431
|
-
isOver:
|
|
432
|
-
index:
|
|
433
|
-
type:
|
|
434
|
-
disabled:
|
|
435
|
-
isCategorize:
|
|
436
|
-
isVerticalPool:
|
|
437
|
-
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
|
|
438
438
|
};
|
|
439
439
|
//#endregion
|
|
440
440
|
//#region src/delivery/tile.tsx
|
|
441
|
-
var Ce = (0,
|
|
441
|
+
var Ce = (0, I.default)("pie-elements:placement-ordering:tile"), we = 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
|
-
})), Te = ({ type: e, index: t, isOver: n, disabled: r }) => /* @__PURE__ */
|
|
446
|
+
})), Te = ({ type: e, index: t, isOver: n, disabled: r }) => /* @__PURE__ */ P(Se, {
|
|
447
447
|
type: e,
|
|
448
448
|
isOver: n,
|
|
449
449
|
disabled: r,
|
|
450
|
-
children: e === "target" && t !== void 0 && /* @__PURE__ */
|
|
450
|
+
children: e === "target" && t !== void 0 && /* @__PURE__ */ P(we, { children: t })
|
|
451
451
|
});
|
|
452
452
|
Te.propTypes = {
|
|
453
|
-
type:
|
|
454
|
-
index:
|
|
455
|
-
isOver:
|
|
456
|
-
disabled:
|
|
453
|
+
type: L.default.string,
|
|
454
|
+
index: L.default.number,
|
|
455
|
+
isOver: L.default.bool,
|
|
456
|
+
disabled: L.default.bool
|
|
457
457
|
};
|
|
458
458
|
var Ee = 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",
|
|
@@ -501,12 +501,12 @@ var Ee = b("div")(({ theme: e, isDragging: t, isSelected: n, isOver: r, disabled
|
|
|
501
501
|
}
|
|
502
502
|
})), De = (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__ */
|
|
504
|
+
return i ? /* @__PURE__ */ P(Te, {
|
|
505
505
|
type: t,
|
|
506
506
|
index: l,
|
|
507
507
|
isOver: a,
|
|
508
508
|
disabled: s
|
|
509
|
-
}) : /* @__PURE__ */
|
|
509
|
+
}) : /* @__PURE__ */ P(Ee, {
|
|
510
510
|
type: t,
|
|
511
511
|
isDragging: n,
|
|
512
512
|
isSelected: r,
|
|
@@ -516,117 +516,117 @@ 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
|
-
},
|
|
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}`,
|
|
519
|
+
}, W = (e) => {
|
|
520
|
+
let { label: t, type: n, id: r, empty: i, disabled: a, outcome: o, index: s, guideIndex: c, instanceId: l, draggable: u, tileIndex: d, selectedChoice: f, onChoiceClick: p, onPlacementClick: m } = e, h = `tile-${n}-${r ?? "empty"}-${d}-${l}`, v = `drop-${n}-${r ?? "empty"}-${d}-${l}`, y = {
|
|
521
521
|
id: r,
|
|
522
522
|
type: n,
|
|
523
523
|
instanceId: l,
|
|
524
524
|
value: t,
|
|
525
525
|
index: s
|
|
526
|
-
}, { attributes:
|
|
526
|
+
}, { attributes: b, listeners: x, setNodeRef: S, transform: C, isDragging: w } = g({
|
|
527
527
|
id: h,
|
|
528
|
-
data:
|
|
528
|
+
data: y,
|
|
529
529
|
disabled: !u || a
|
|
530
|
-
}), { setNodeRef:
|
|
531
|
-
id:
|
|
532
|
-
data:
|
|
533
|
-
disabled:
|
|
534
|
-
}),
|
|
535
|
-
a || (n === "choice" ? f?.type === "target" ? m?.(
|
|
536
|
-
},
|
|
537
|
-
(e.code === "Space" || e.code === "Enter") && (e.preventDefault(),
|
|
538
|
-
},
|
|
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
539
|
return k.useEffect(() => {
|
|
540
|
-
let e =
|
|
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
|
-
}, []), Ce("[render], props: ", e), /* @__PURE__ */
|
|
546
|
+
}, []), Ce("[render], props: ", e), /* @__PURE__ */ P("div", {
|
|
547
547
|
ref: (e) => {
|
|
548
|
-
|
|
548
|
+
I.current = e, S(e), ee(e);
|
|
549
549
|
},
|
|
550
550
|
style: {
|
|
551
|
-
transform:
|
|
551
|
+
transform: C ? `translate3d(${C.x}px, ${C.y}px, 0)` : void 0,
|
|
552
552
|
boxSizing: "border-box",
|
|
553
553
|
overflow: "visible",
|
|
554
554
|
padding: 0,
|
|
555
555
|
margin: 0,
|
|
556
556
|
textAlign: "center",
|
|
557
557
|
pointerEvents: "auto",
|
|
558
|
-
cursor: a ? "not-allowed" : n === "target" &&
|
|
559
|
-
zIndex:
|
|
560
|
-
willChange:
|
|
558
|
+
cursor: a ? "not-allowed" : n === "target" && A ? "pointer" : w ? "grabbing" : "grab",
|
|
559
|
+
zIndex: w ? 1e3 : "auto",
|
|
560
|
+
willChange: w ? "transform" : "auto"
|
|
561
561
|
},
|
|
562
|
-
role:
|
|
563
|
-
tabIndex:
|
|
564
|
-
onKeyDown:
|
|
565
|
-
onClick:
|
|
566
|
-
onMouseEnter: () =>
|
|
567
|
-
onMouseLeave: () =>
|
|
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),
|
|
568
568
|
...u && !a ? {
|
|
569
|
-
...
|
|
570
|
-
...
|
|
569
|
+
...x,
|
|
570
|
+
...b
|
|
571
571
|
} : {},
|
|
572
|
-
children: /* @__PURE__ */
|
|
572
|
+
children: /* @__PURE__ */ P(De, {
|
|
573
573
|
label: t,
|
|
574
574
|
id: r,
|
|
575
575
|
empty: i,
|
|
576
576
|
index: s,
|
|
577
577
|
guideIndex: c,
|
|
578
|
-
isOver:
|
|
579
|
-
isDragging:
|
|
580
|
-
isSelected:
|
|
578
|
+
isOver: j,
|
|
579
|
+
isDragging: w,
|
|
580
|
+
isSelected: E,
|
|
581
581
|
disabled: a,
|
|
582
582
|
outcome: o,
|
|
583
583
|
type: n
|
|
584
584
|
})
|
|
585
585
|
});
|
|
586
586
|
};
|
|
587
|
-
|
|
588
|
-
id:
|
|
589
|
-
label:
|
|
590
|
-
isOver:
|
|
591
|
-
type:
|
|
592
|
-
empty:
|
|
593
|
-
disabled:
|
|
594
|
-
outcome:
|
|
595
|
-
index:
|
|
596
|
-
guideIndex:
|
|
597
|
-
instanceId:
|
|
598
|
-
draggable:
|
|
599
|
-
tileIndex:
|
|
600
|
-
selectedChoice:
|
|
601
|
-
onChoiceClick:
|
|
602
|
-
onPlacementClick:
|
|
587
|
+
W.propTypes = {
|
|
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
|
|
603
603
|
};
|
|
604
604
|
//#endregion
|
|
605
605
|
//#region src/delivery/tiler.tsx
|
|
606
|
-
var
|
|
607
|
-
choiceLabel:
|
|
608
|
-
targetLabel:
|
|
609
|
-
disabled:
|
|
610
|
-
tiles:
|
|
611
|
-
tileSize:
|
|
612
|
-
addGuide:
|
|
613
|
-
selectedChoice:
|
|
614
|
-
onChoiceClick:
|
|
615
|
-
onPlacementClick:
|
|
606
|
+
var G = {
|
|
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
616
|
}, Oe = {
|
|
617
617
|
tileSize: "1fr",
|
|
618
618
|
disabled: !1,
|
|
619
619
|
addGuide: !1
|
|
620
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(
|
|
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, {
|
|
622
622
|
...t,
|
|
623
623
|
key: n
|
|
624
|
-
}) : /* @__PURE__ */ A(
|
|
624
|
+
}) : /* @__PURE__ */ A(W, {
|
|
625
625
|
...t,
|
|
626
626
|
label: "",
|
|
627
627
|
key: n
|
|
628
628
|
}));
|
|
629
|
-
return t.propTypes = { ...
|
|
629
|
+
return t.propTypes = { ...G }, t;
|
|
630
630
|
}, Ae = b("div")(({ theme: e, includeTargets: t }) => ({
|
|
631
631
|
display: "grid",
|
|
632
632
|
paddingBottom: e.spacing(2),
|
|
@@ -645,22 +645,22 @@ var K = {
|
|
|
645
645
|
gridColumn: "2/3",
|
|
646
646
|
textAlign: "center"
|
|
647
647
|
}), Ie = class extends k.Component {
|
|
648
|
-
static propTypes = { ...
|
|
648
|
+
static propTypes = { ...G };
|
|
649
649
|
static defaultProps = { ...Oe };
|
|
650
650
|
render() {
|
|
651
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 = {
|
|
652
652
|
gridTemplateColumns: e ? `repeat(${s}, ${a})` : `auto repeat(${Math.floor(s / 2) - 1}, ${a} 10px) ${a} auto`,
|
|
653
653
|
gridTemplateRows: o
|
|
654
654
|
}, l = { gridColumn: `1/${s + 1}` };
|
|
655
|
-
return /* @__PURE__ */
|
|
655
|
+
return /* @__PURE__ */ F(Ae, {
|
|
656
656
|
includeTargets: e,
|
|
657
657
|
style: c,
|
|
658
658
|
children: [
|
|
659
|
-
/* @__PURE__ */
|
|
659
|
+
/* @__PURE__ */ P(je, {
|
|
660
660
|
style: l,
|
|
661
661
|
dangerouslySetInnerHTML: { __html: t ? n : "" }
|
|
662
662
|
}),
|
|
663
|
-
e && /* @__PURE__ */
|
|
663
|
+
e && /* @__PURE__ */ P(Me, {
|
|
664
664
|
style: l,
|
|
665
665
|
dangerouslySetInnerHTML: { __html: r }
|
|
666
666
|
}),
|
|
@@ -669,24 +669,24 @@ var K = {
|
|
|
669
669
|
});
|
|
670
670
|
}
|
|
671
671
|
}, Le = class extends k.Component {
|
|
672
|
-
static propTypes = { ...
|
|
672
|
+
static propTypes = { ...G };
|
|
673
673
|
static defaultProps = { ...Oe };
|
|
674
674
|
render() {
|
|
675
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;
|
|
676
|
-
return /* @__PURE__ */
|
|
676
|
+
return /* @__PURE__ */ F(Ne, {
|
|
677
677
|
includeTargets: e,
|
|
678
678
|
style: {
|
|
679
679
|
gridTemplateColumns: `repeat(${o}, ${a})`,
|
|
680
680
|
gridTemplateRows: e ? `auto repeat(${s}, ${a})` : `auto auto repeat(${Math.floor(s / 2) - 1}, ${a} 10px) ${a} auto`
|
|
681
681
|
},
|
|
682
682
|
children: [
|
|
683
|
-
/* @__PURE__ */
|
|
684
|
-
e && /* @__PURE__ */
|
|
683
|
+
/* @__PURE__ */ P(Pe, { dangerouslySetInnerHTML: { __html: t ? n : "" } }),
|
|
684
|
+
e && /* @__PURE__ */ P(Fe, { dangerouslySetInnerHTML: { __html: r } }),
|
|
685
685
|
i.map(ke(this.props))
|
|
686
686
|
]
|
|
687
687
|
});
|
|
688
688
|
}
|
|
689
|
-
},
|
|
689
|
+
}, K = (0, I.default)("pie-elements:placement-ordering:ordering"), Re = (e, t, n) => {
|
|
690
690
|
let r = e.find((e, n) => n === t), i = e.filter((e, n) => n !== t);
|
|
691
691
|
return [
|
|
692
692
|
...i.slice(0, n),
|
|
@@ -694,7 +694,7 @@ var K = {
|
|
|
694
694
|
...i.slice(n)
|
|
695
695
|
];
|
|
696
696
|
}, ze = (e, n, r) => {
|
|
697
|
-
if (
|
|
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
698
|
let i = t(e), a = e[r];
|
|
699
699
|
return i[r] = i[n], i[n] = a, i;
|
|
700
700
|
};
|
|
@@ -706,13 +706,13 @@ function Be(e, n) {
|
|
|
706
706
|
}
|
|
707
707
|
function Ve(e, n, r) {
|
|
708
708
|
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" ? ze(i, n.index, r.index) : (
|
|
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);
|
|
710
710
|
{
|
|
711
711
|
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
|
|
712
|
+
return K("fromIndex: ", t, "toIndex:", i), Re(e.response, t, i);
|
|
713
713
|
}
|
|
714
714
|
}
|
|
715
|
-
function
|
|
715
|
+
function q(e, t, n, r) {
|
|
716
716
|
if (r.includeTargets) {
|
|
717
717
|
let i = [];
|
|
718
718
|
for (let r = 0; r < t.length; r++) {
|
|
@@ -725,6 +725,7 @@ function J(e, t, n, r) {
|
|
|
725
725
|
}
|
|
726
726
|
return e.map((e) => t.indexOf(e.id) !== -1 && !r.allowSameChoiceInTargets ? {
|
|
727
727
|
type: "choice",
|
|
728
|
+
id: e.id,
|
|
728
729
|
empty: !0,
|
|
729
730
|
droppable: !0,
|
|
730
731
|
draggable: !1
|
|
@@ -752,20 +753,20 @@ function He(e, t, r, i) {
|
|
|
752
753
|
response: t,
|
|
753
754
|
opts: i,
|
|
754
755
|
outcomes: r,
|
|
755
|
-
tiles:
|
|
756
|
+
tiles: q(e, t, r, i)
|
|
756
757
|
};
|
|
757
758
|
}
|
|
758
759
|
function Ue(e, t) {
|
|
759
760
|
switch (e.type) {
|
|
760
761
|
case "move": {
|
|
761
|
-
let { from: n, to: r } = e, i = Ve(t, n, r), a =
|
|
762
|
+
let { from: n, to: r } = e, i = Ve(t, n, r), a = q(t.choices, i, t.outcomes, t.opts);
|
|
762
763
|
return Object.assign({}, t, {
|
|
763
764
|
response: i,
|
|
764
765
|
tiles: a
|
|
765
766
|
});
|
|
766
767
|
}
|
|
767
768
|
case "remove": {
|
|
768
|
-
let { target: n } = e, r = Be(t, n), i =
|
|
769
|
+
let { target: n } = e, r = Be(t, n), i = q(t.choices, r, t.outcomes, t.opts);
|
|
769
770
|
return Object.assign({}, t, {
|
|
770
771
|
response: r,
|
|
771
772
|
tiles: i
|
|
@@ -781,58 +782,65 @@ var We = (e, t) => {
|
|
|
781
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]));
|
|
782
783
|
return a && !o;
|
|
783
784
|
}, Ge = (e, { active: t, context: n, currentCoordinates: r }) => {
|
|
784
|
-
let { code: i } = e, a = i === "Tab", o = i ===
|
|
785
|
+
let { code: i } = e, a = i === "Tab", o = i === h.Down || i === h.Up || i === h.Left || i === h.Right;
|
|
785
786
|
if (!a && !o) return;
|
|
786
787
|
if (o) return y(e, {
|
|
787
788
|
context: n,
|
|
788
789
|
currentCoordinates: r
|
|
789
790
|
});
|
|
790
791
|
e.preventDefault();
|
|
791
|
-
let { droppableRects: s, droppableContainers: c, collisionRect: l } = n;
|
|
792
|
+
let { droppableRects: s, droppableContainers: c, collisionRect: l, draggableNodes: u, active: d } = n;
|
|
792
793
|
if (!s || s.size === 0) return r;
|
|
793
|
-
let
|
|
794
|
+
let f = {
|
|
794
795
|
x: (l?.width || 0) / 2,
|
|
795
796
|
y: (l?.height || 0) / 2
|
|
796
|
-
},
|
|
797
|
-
x: r.x +
|
|
798
|
-
y: r.y +
|
|
799
|
-
},
|
|
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;
|
|
800
801
|
for (let [e, t] of c) {
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
x:
|
|
809
|
-
y:
|
|
810
|
-
}
|
|
811
|
-
p.push({
|
|
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
812
|
id: e,
|
|
813
|
-
dropPosition:
|
|
814
|
-
|
|
815
|
-
|
|
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);
|
|
816
820
|
}
|
|
817
|
-
if (
|
|
818
|
-
let
|
|
819
|
-
|
|
820
|
-
let
|
|
821
|
-
for (let e = 0; e <
|
|
822
|
-
let t = Ke(
|
|
823
|
-
t <
|
|
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);
|
|
824
828
|
}
|
|
825
|
-
return
|
|
829
|
+
return v[x ? (S - 1 + v.length) % v.length : (S + 1) % v.length].dropPosition;
|
|
826
830
|
}, Ke = (e, t) => Math.sqrt((e.x - t.x) ** 2 + (e.y - t.y) ** 2);
|
|
827
831
|
//#endregion
|
|
828
832
|
//#region src/delivery/placement-ordering.tsx
|
|
829
|
-
function
|
|
833
|
+
function J(e) {
|
|
830
834
|
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
831
835
|
}
|
|
832
|
-
function
|
|
833
|
-
return !e ||
|
|
836
|
+
function Y(e, t) {
|
|
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;
|
|
834
838
|
}
|
|
835
|
-
var qe =
|
|
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 ? {
|
|
836
844
|
keyboardCoordinateGetter: Ge,
|
|
837
845
|
keyboardCodes: {
|
|
838
846
|
start: ["Space", "Enter"],
|
|
@@ -840,45 +848,45 @@ var qe = X(D, "UiLayout") || X($.UiLayout, "UiLayout"), Z = X(T, "PreviewPrompt"
|
|
|
840
848
|
end: ["Space", "Enter"]
|
|
841
849
|
},
|
|
842
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." } }
|
|
843
|
-
} : {}, { translator:
|
|
851
|
+
} : {}, { translator: et } = O, tt = (0, I.default)("pie-elements:placement-ordering"), nt = b("div")({
|
|
844
852
|
color: w.text(),
|
|
845
853
|
backgroundColor: w.background(),
|
|
846
854
|
display: "flex",
|
|
847
855
|
flexDirection: "column",
|
|
848
856
|
alignItems: "center",
|
|
849
857
|
boxSizing: "border-box"
|
|
850
|
-
}),
|
|
858
|
+
}), rt = b("div")({
|
|
851
859
|
alignSelf: "stretch",
|
|
852
860
|
maxWidth: "100%",
|
|
853
861
|
overflowX: "auto",
|
|
854
862
|
overflowY: "hidden"
|
|
855
|
-
}),
|
|
863
|
+
}), it = b("div")({
|
|
856
864
|
display: "flex",
|
|
857
865
|
justifyContent: "center",
|
|
858
866
|
minWidth: "min-content"
|
|
859
|
-
}),
|
|
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 }) => ({
|
|
860
868
|
marginBottom: e.spacing(2),
|
|
861
869
|
alignSelf: "flex-start"
|
|
862
|
-
})),
|
|
870
|
+
})), lt = (e) => {
|
|
863
871
|
let { tiler: t, ordering: n, onDropChoice: r, onRemoveChoice: i, ...a } = e;
|
|
864
|
-
return /* @__PURE__ */
|
|
872
|
+
return /* @__PURE__ */ P(t, {
|
|
865
873
|
...a,
|
|
866
874
|
tiles: n.tiles,
|
|
867
875
|
onDropChoice: (e, t) => r(e, t, n),
|
|
868
876
|
onRemoveChoice: (e) => i(e, n)
|
|
869
877
|
});
|
|
870
878
|
};
|
|
871
|
-
|
|
872
|
-
tiler:
|
|
873
|
-
ordering:
|
|
874
|
-
onDropChoice:
|
|
875
|
-
onRemoveChoice:
|
|
879
|
+
lt.propTypes = {
|
|
880
|
+
tiler: L.default.func,
|
|
881
|
+
ordering: L.default.any,
|
|
882
|
+
onDropChoice: L.default.func,
|
|
883
|
+
onRemoveChoice: L.default.func
|
|
876
884
|
};
|
|
877
|
-
var
|
|
885
|
+
var ut = class extends k.Component {
|
|
878
886
|
static propTypes = {
|
|
879
|
-
onSessionChange:
|
|
880
|
-
model:
|
|
881
|
-
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])
|
|
882
890
|
};
|
|
883
891
|
constructor(e) {
|
|
884
892
|
super(e), this.instanceId = r();
|
|
@@ -895,7 +903,7 @@ var lt = class extends k.Component {
|
|
|
895
903
|
}
|
|
896
904
|
toggleCorrect = (e) => this.setState({ showingCorrect: e });
|
|
897
905
|
componentDidUpdate() {
|
|
898
|
-
d(
|
|
906
|
+
d(N.findDOMNode(this));
|
|
899
907
|
}
|
|
900
908
|
validateSession = ({ model: e, session: t }, n = !1) => {
|
|
901
909
|
let { config: r, choices: i } = e || {}, { includeTargets: a } = r || {}, s = i.map((e) => e.id), { value: c } = t || {}, u;
|
|
@@ -914,8 +922,8 @@ var lt = class extends k.Component {
|
|
|
914
922
|
};
|
|
915
923
|
};
|
|
916
924
|
UNSAFE_componentWillReceiveProps(e) {
|
|
917
|
-
let { model: t = {} } = e || {}, { model: n = {} } = this.props || {}, { correctResponse: r, config: i, choices: a = [], env: o } = t, { includeTargets: s } = i || {}, c = {}, l = n.language && n.language !== t.language, u = n.note && n.note ===
|
|
918
|
-
l && u && (n.note =
|
|
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);
|
|
919
927
|
let d = We(a, n.choices), { value: f, needsReset: p } = this.validateSession(e, d), m = {
|
|
920
928
|
...e.session,
|
|
921
929
|
value: f
|
|
@@ -927,7 +935,7 @@ var lt = class extends k.Component {
|
|
|
927
935
|
}
|
|
928
936
|
onDropChoice = (e, t, n) => {
|
|
929
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;
|
|
930
|
-
|
|
938
|
+
tt("[onDropChoice] ", a, o);
|
|
931
939
|
let s = Ue({
|
|
932
940
|
type: "move",
|
|
933
941
|
from: a,
|
|
@@ -937,7 +945,7 @@ var lt = class extends k.Component {
|
|
|
937
945
|
};
|
|
938
946
|
onRemoveChoice = (e, t) => {
|
|
939
947
|
let { onSessionChange: n, session: r } = this.props;
|
|
940
|
-
|
|
948
|
+
tt("[onRemoveChoice]", e);
|
|
941
949
|
let i = Ue({
|
|
942
950
|
type: "remove",
|
|
943
951
|
target: e
|
|
@@ -970,8 +978,8 @@ var lt = class extends k.Component {
|
|
|
970
978
|
}
|
|
971
979
|
e && i && this.onDropChoice(i, e, r);
|
|
972
980
|
} else if (!t && n) {
|
|
973
|
-
let e = n.data.current;
|
|
974
|
-
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);
|
|
975
983
|
}
|
|
976
984
|
};
|
|
977
985
|
onDragStart = (e) => {
|
|
@@ -1012,10 +1020,10 @@ var lt = class extends k.Component {
|
|
|
1012
1020
|
this.isClickSoonAfterDragEnd() || this.placeSelectedChoice(e);
|
|
1013
1021
|
};
|
|
1014
1022
|
render() {
|
|
1015
|
-
let { model: e } = this.props, { correctResponse: t, correctness: n, extraCSSRules: r, prompt: i, rationale: a, feedback: o, config: s, note: c, showNote: l, env: u, disabled: d, teacherInstructions: f, language: p } = e,
|
|
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 || {
|
|
1016
1024
|
orientation: "vertical",
|
|
1017
1025
|
includeTargets: !0
|
|
1018
|
-
}, { orientation:
|
|
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 = {
|
|
1019
1027
|
color: w.text(),
|
|
1020
1028
|
backgroundColor: w.background(),
|
|
1021
1029
|
display: "flex",
|
|
@@ -1023,60 +1031,60 @@ var lt = class extends k.Component {
|
|
|
1023
1031
|
alignItems: "center",
|
|
1024
1032
|
boxSizing: "border-box",
|
|
1025
1033
|
width: "100%"
|
|
1026
|
-
},
|
|
1034
|
+
}, M = y ? {
|
|
1027
1035
|
selectedChoice: this.state.selectedChoice,
|
|
1028
1036
|
onChoiceClick: this.onChoiceClick,
|
|
1029
1037
|
onPlacementClick: this.onPlacementClick
|
|
1030
1038
|
} : {};
|
|
1031
|
-
return /* @__PURE__ */
|
|
1039
|
+
return /* @__PURE__ */ P(ee, {
|
|
1032
1040
|
onDragStart: this.onDragStart,
|
|
1033
1041
|
onDragEnd: this.onDragEnd,
|
|
1034
1042
|
onDragCancel: this.onDragCancel,
|
|
1035
1043
|
collisionDetection: E,
|
|
1036
|
-
modifiers: [
|
|
1037
|
-
|
|
1038
|
-
children: /* @__PURE__ */
|
|
1044
|
+
modifiers: [re],
|
|
1045
|
+
...$e(y),
|
|
1046
|
+
children: /* @__PURE__ */ P(nt, { children: /* @__PURE__ */ F(qe, {
|
|
1039
1047
|
extraCSSRules: r,
|
|
1040
|
-
style:
|
|
1048
|
+
style: j,
|
|
1041
1049
|
children: [
|
|
1042
|
-
|
|
1050
|
+
A && /* @__PURE__ */ P(ct, {
|
|
1043
1051
|
labels: {
|
|
1044
1052
|
hidden: "Show Teacher Instructions",
|
|
1045
1053
|
visible: "Hide Teacher Instructions"
|
|
1046
1054
|
},
|
|
1047
1055
|
className: "collapsible",
|
|
1048
|
-
children: /* @__PURE__ */
|
|
1056
|
+
children: /* @__PURE__ */ P(X, { prompt: f })
|
|
1049
1057
|
}),
|
|
1050
|
-
/* @__PURE__ */
|
|
1051
|
-
/* @__PURE__ */
|
|
1052
|
-
show:
|
|
1058
|
+
/* @__PURE__ */ P(at, { children: /* @__PURE__ */ P(X, { prompt: i }) }),
|
|
1059
|
+
/* @__PURE__ */ P(st, {
|
|
1060
|
+
show: h,
|
|
1053
1061
|
toggled: g,
|
|
1054
1062
|
onToggle: this.toggleCorrect,
|
|
1055
1063
|
language: p
|
|
1056
1064
|
}),
|
|
1057
|
-
/* @__PURE__ */
|
|
1065
|
+
/* @__PURE__ */ P(rt, { children: /* @__PURE__ */ P(it, { children: /* @__PURE__ */ P(lt, {
|
|
1058
1066
|
instanceId: this.instanceId,
|
|
1059
1067
|
choiceLabel: _.choiceLabel,
|
|
1060
1068
|
targetLabel: _.targetLabel,
|
|
1061
|
-
ordering:
|
|
1062
|
-
tiler:
|
|
1069
|
+
ordering: x,
|
|
1070
|
+
tiler: D,
|
|
1063
1071
|
disabled: d,
|
|
1064
1072
|
addGuide: _.showOrdering,
|
|
1065
1073
|
tileSize: _.tileSize,
|
|
1066
|
-
includeTargets:
|
|
1074
|
+
includeTargets: y,
|
|
1067
1075
|
choiceLabelEnabled: e.config && e.config.choiceLabelEnabled,
|
|
1068
|
-
...
|
|
1076
|
+
...M
|
|
1069
1077
|
}) }) }),
|
|
1070
|
-
|
|
1071
|
-
|
|
1078
|
+
O && /* @__PURE__ */ P(ot, { dangerouslySetInnerHTML: { __html: c } }),
|
|
1079
|
+
k && /* @__PURE__ */ P(ct, {
|
|
1072
1080
|
labels: {
|
|
1073
1081
|
hidden: "Show Rationale",
|
|
1074
1082
|
visible: "Hide Rationale"
|
|
1075
1083
|
},
|
|
1076
1084
|
className: "collapsible",
|
|
1077
|
-
children: /* @__PURE__ */
|
|
1085
|
+
children: /* @__PURE__ */ P(X, { prompt: a })
|
|
1078
1086
|
}),
|
|
1079
|
-
!g && /* @__PURE__ */
|
|
1087
|
+
!g && /* @__PURE__ */ P(Je, {
|
|
1080
1088
|
correctness: n,
|
|
1081
1089
|
feedback: o
|
|
1082
1090
|
})
|
|
@@ -1084,21 +1092,21 @@ var lt = class extends k.Component {
|
|
|
1084
1092
|
}) })
|
|
1085
1093
|
});
|
|
1086
1094
|
}
|
|
1087
|
-
},
|
|
1095
|
+
}, dt = class extends k.Component {
|
|
1088
1096
|
static propTypes = {
|
|
1089
|
-
model:
|
|
1090
|
-
session:
|
|
1091
|
-
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
|
|
1092
1100
|
};
|
|
1093
1101
|
render() {
|
|
1094
1102
|
let { model: e, session: t, onSessionChange: n } = this.props;
|
|
1095
|
-
return /* @__PURE__ */
|
|
1103
|
+
return /* @__PURE__ */ P(ut, {
|
|
1096
1104
|
model: e,
|
|
1097
1105
|
session: t,
|
|
1098
1106
|
onSessionChange: n
|
|
1099
1107
|
});
|
|
1100
1108
|
}
|
|
1101
|
-
},
|
|
1109
|
+
}, $ = (0, I.default)("pie-elements:placement-ordering"), ft = ({ model: t, session: n }) => {
|
|
1102
1110
|
let { config: r } = t, i = (n && e(n.value) || []).length === t.choices.length;
|
|
1103
1111
|
return r.includeTargets || i;
|
|
1104
1112
|
}, pt = class extends HTMLElement {
|
|
@@ -1126,7 +1134,7 @@ var lt = class extends k.Component {
|
|
|
1126
1134
|
}
|
|
1127
1135
|
isComplete = (t) => t && e(t).length === this._model.completeLength;
|
|
1128
1136
|
sessionChange = (e) => {
|
|
1129
|
-
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)));
|
|
1130
1138
|
};
|
|
1131
1139
|
set model(e) {
|
|
1132
1140
|
this._model = e, this.render(), this.dispatchEvent(new CustomEvent("model-set", {
|
|
@@ -1142,8 +1150,8 @@ var lt = class extends k.Component {
|
|
|
1142
1150
|
}
|
|
1143
1151
|
render() {
|
|
1144
1152
|
if (this._model && this._session) {
|
|
1145
|
-
|
|
1146
|
-
let e = k.createElement(
|
|
1153
|
+
$("[render] session: ", this._session.value), $("[render] model: ", this._model), this._initMathObserver();
|
|
1154
|
+
let e = k.createElement(dt, {
|
|
1147
1155
|
model: this._model,
|
|
1148
1156
|
session: this._session,
|
|
1149
1157
|
onSessionChange: this.sessionChange
|