@citolab/qti-components 8.0.0 → 8.0.2
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/cdn/index.global.js +1 -1
- package/cdn/index.js +690 -316
- package/dist/base.d.ts +135 -9
- package/dist/base.js +1 -1
- package/dist/chunk-4DB4SC5K.js +100 -0
- package/dist/chunk-4DB4SC5K.js.map +1 -0
- package/dist/{chunk-WVVMNF74.js → chunk-7AVWRQIS.js} +188 -160
- package/dist/{chunk-WVVMNF74.js.map → chunk-7AVWRQIS.js.map} +1 -1
- package/dist/{chunk-MGF5F3S2.js → chunk-BQFWCZFH.js} +2 -2
- package/dist/{chunk-5QYII4OZ.js → chunk-CK7AV2UJ.js} +147 -101
- package/dist/chunk-CK7AV2UJ.js.map +1 -0
- package/dist/chunk-G6GFQDVN.js +7 -0
- package/dist/chunk-G6GFQDVN.js.map +1 -0
- package/dist/{chunk-LZJHHZQ2.js → chunk-HBSWJC3B.js} +643 -553
- package/dist/chunk-HBSWJC3B.js.map +1 -0
- package/dist/chunk-HQESINXH.js +834 -0
- package/dist/chunk-HQESINXH.js.map +1 -0
- package/dist/{chunk-KYEZRYO6.js → chunk-J5SQLKNP.js} +145 -119
- package/dist/{chunk-KYEZRYO6.js.map → chunk-J5SQLKNP.js.map} +1 -1
- package/dist/{chunk-V5G7X53Y.js → chunk-NJQHUUTN.js} +2 -2
- package/dist/{chunk-W4QZPCNC.js → chunk-RSVRS5AK.js} +59 -58
- package/dist/chunk-RSVRS5AK.js.map +1 -0
- package/dist/{chunk-5SJS36BI.js → chunk-TWPXES3S.js} +642 -673
- package/dist/chunk-TWPXES3S.js.map +1 -0
- package/dist/{chunk-NA2N2WSG.js → chunk-VAE6HBKR.js} +176 -152
- package/dist/{chunk-NA2N2WSG.js.map → chunk-VAE6HBKR.js.map} +1 -1
- package/dist/{chunk-MJVPNN7W.js → chunk-ZII6M3SN.js} +2 -2
- package/dist/computed-item.types.d-BKZdSLLJ.d.ts +19 -0
- package/dist/computed.types.d-DpKIYO6e.d.ts +44 -0
- package/dist/config.context.d-BvU9r-Mg.d.ts +91 -0
- package/dist/corrections.d.ts +415 -1
- package/dist/corrections.js +8 -9
- package/dist/elements.d.ts +393 -1
- package/dist/elements.js +4 -5
- package/dist/index.d.ts +27 -9
- package/dist/index.js +21 -14
- package/dist/interaction.d-CJiMv8H7.d.ts +126 -0
- package/dist/interaction.interface.d-CvjHM2bi.d.ts +46 -0
- package/dist/interactions.d.ts +281 -1
- package/dist/interactions.js +4 -5
- package/dist/item.css +588 -214
- package/dist/item.d.ts +92 -1
- package/dist/item.js +5 -5
- package/dist/item.types.d-QU7LljEK.d.ts +82 -0
- package/dist/loader.d.ts +22 -1
- package/dist/processing.d.ts +730 -1
- package/dist/processing.js +2 -2
- package/dist/qti-components-jsx.d.ts +854 -844
- package/dist/qti-components-jsx.js +1 -0
- package/dist/qti-condition-expression.d-aMvBvpc6.d.ts +8 -0
- package/dist/qti-expression.d-BietT_8b.d.ts +31 -0
- package/dist/qti-feedback.d-DZbad0RN.d.ts +21 -0
- package/dist/qti-rule-base.d-ajOnfGXY.d.ts +16 -0
- package/dist/qti-test.d-_YAlhDbt.d.ts +702 -0
- package/dist/qti-text-entry-interaction.d-BGdfV9qG.d.ts +1567 -0
- package/dist/qti-transform-test.d-BL7GGFJj.d.ts +70 -0
- package/dist/qti.context.d-CejJMlfZ.d.ts +50 -0
- package/dist/response.d-_8y4kjGP.d.ts +106 -0
- package/dist/test.d.ts +32 -1
- package/dist/test.js +14 -7
- package/dist/transformers.d.ts +18 -1
- package/package.json +15 -11
- package/dist/chunk-5QYII4OZ.js.map +0 -1
- package/dist/chunk-5SJS36BI.js.map +0 -1
- package/dist/chunk-64XSIBGO.js +0 -241
- package/dist/chunk-64XSIBGO.js.map +0 -1
- package/dist/chunk-H3J7LFRO.js +0 -2243
- package/dist/chunk-H3J7LFRO.js.map +0 -1
- package/dist/chunk-LZJHHZQ2.js.map +0 -1
- package/dist/chunk-W4QZPCNC.js.map +0 -1
- package/dist/chunk-WCQ26LV7.js +0 -102
- package/dist/chunk-WCQ26LV7.js.map +0 -1
- package/dist/chunk-X3E5HXG2.js +0 -20
- package/dist/chunk-X3E5HXG2.js.map +0 -1
- /package/dist/{chunk-MGF5F3S2.js.map → chunk-BQFWCZFH.js.map} +0 -0
- /package/dist/{chunk-V5G7X53Y.js.map → chunk-NJQHUUTN.js.map} +0 -0
- /package/dist/{chunk-MJVPNN7W.js.map → chunk-ZII6M3SN.js.map} +0 -0
|
@@ -1,52 +1,34 @@
|
|
|
1
1
|
import {
|
|
2
|
-
o as o2
|
|
3
|
-
} from "./chunk-X3E5HXG2.js";
|
|
4
|
-
import {
|
|
5
|
-
M,
|
|
6
|
-
e as e3,
|
|
7
|
-
f,
|
|
8
|
-
h,
|
|
9
|
-
i as i3,
|
|
10
|
-
p,
|
|
11
|
-
t,
|
|
12
|
-
u,
|
|
13
|
-
v,
|
|
14
2
|
watch
|
|
15
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4DB4SC5K.js";
|
|
16
4
|
import {
|
|
17
|
-
A,
|
|
18
|
-
E,
|
|
19
5
|
Interaction,
|
|
20
|
-
T,
|
|
21
|
-
b,
|
|
22
6
|
boxSizing,
|
|
23
|
-
c,
|
|
24
7
|
configContext,
|
|
25
8
|
dropRegion,
|
|
26
|
-
e,
|
|
27
|
-
e2,
|
|
28
|
-
i,
|
|
29
|
-
i2,
|
|
30
9
|
interactionContext,
|
|
31
10
|
itemContext,
|
|
32
|
-
n,
|
|
33
|
-
n2,
|
|
34
|
-
o,
|
|
35
11
|
parseResponseAttribute,
|
|
36
12
|
qtiContext,
|
|
37
|
-
r,
|
|
38
13
|
removeDoubleSlashes,
|
|
39
14
|
responseAttributeConverter,
|
|
40
15
|
serializeResponseAttribute,
|
|
41
16
|
validationMessage
|
|
42
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-HQESINXH.js";
|
|
18
|
+
|
|
19
|
+
// ../interactions/core/dist/elements/qti-gap-text/qti-gap-text.js
|
|
20
|
+
import { html as html2, LitElement } from "lit";
|
|
21
|
+
import { property as property2 } from "lit/decorators.js";
|
|
43
22
|
|
|
44
23
|
// ../interactions/core/dist/mixins/active-element/active-element.mixin.js
|
|
24
|
+
import { html } from "lit";
|
|
25
|
+
import { property, state } from "lit/decorators.js";
|
|
26
|
+
import { consume } from "@lit/context";
|
|
45
27
|
var __decorate = function(decorators, target, key, desc) {
|
|
46
|
-
var
|
|
47
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
48
|
-
else for (var
|
|
49
|
-
return
|
|
28
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
29
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
30
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
31
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
50
32
|
};
|
|
51
33
|
var ariaBooleanConverter = {
|
|
52
34
|
toAttribute: (value) => value ? "true" : "false",
|
|
@@ -104,6 +86,10 @@ function ActiveElementMixin(Base, type) {
|
|
|
104
86
|
this.#appliedChoiceRole = null;
|
|
105
87
|
this.internals = this.attachInternals();
|
|
106
88
|
}
|
|
89
|
+
/* `PropertyValues`, not `PropertyValues<this>`: the polymorphic `this` narrows the
|
|
90
|
+
parameter per subclass and breaks structural compatibility with LitElement, which
|
|
91
|
+
is what `Constructor<LitElement>` — the standard Lit mixin constraint — checks.
|
|
92
|
+
See Interaction#firstUpdated in @qti-components/base. */
|
|
107
93
|
willUpdate(changed) {
|
|
108
94
|
super.willUpdate(changed);
|
|
109
95
|
this.#syncChoiceRole();
|
|
@@ -160,32 +146,32 @@ function ActiveElementMixin(Base, type) {
|
|
|
160
146
|
}));
|
|
161
147
|
}
|
|
162
148
|
render() {
|
|
163
|
-
return
|
|
149
|
+
return html`<slot></slot>`;
|
|
164
150
|
}
|
|
165
151
|
}
|
|
166
152
|
__decorate([
|
|
167
|
-
|
|
153
|
+
property({ type: String })
|
|
168
154
|
], QtiChoice.prototype, "identifier", void 0);
|
|
169
155
|
__decorate([
|
|
170
|
-
|
|
156
|
+
property({ type: Number, reflect: true, attribute: "tabindex" })
|
|
171
157
|
], QtiChoice.prototype, "tabIndex", void 0);
|
|
172
158
|
__decorate([
|
|
173
|
-
|
|
159
|
+
property({
|
|
174
160
|
type: Boolean,
|
|
175
161
|
attribute: "aria-disabled",
|
|
176
162
|
converter: ariaBooleanConverter
|
|
177
163
|
})
|
|
178
164
|
], QtiChoice.prototype, "disabled", void 0);
|
|
179
165
|
__decorate([
|
|
180
|
-
|
|
166
|
+
property({
|
|
181
167
|
type: Boolean,
|
|
182
168
|
attribute: "aria-readonly",
|
|
183
169
|
converter: ariaBooleanConverter
|
|
184
170
|
})
|
|
185
171
|
], QtiChoice.prototype, "readonly", void 0);
|
|
186
172
|
__decorate([
|
|
187
|
-
|
|
188
|
-
|
|
173
|
+
consume({ context: interactionContext, subscribe: true }),
|
|
174
|
+
state()
|
|
189
175
|
], QtiChoice.prototype, "_interactionContext", void 0);
|
|
190
176
|
__decorate([
|
|
191
177
|
watch("disabled", { waitUntilFirstUpdate: true })
|
|
@@ -197,9 +183,10 @@ function ActiveElementMixin(Base, type) {
|
|
|
197
183
|
}
|
|
198
184
|
|
|
199
185
|
// ../interactions/core/dist/elements/qti-gap-text/qti-gap-text.styles.js
|
|
186
|
+
import { css } from "lit";
|
|
200
187
|
var qti_gap_text_styles_default = [
|
|
201
188
|
boxSizing,
|
|
202
|
-
|
|
189
|
+
css`
|
|
203
190
|
/*
|
|
204
191
|
* A chip's own box. Both drag-drop interactions that use this element laid it out from the
|
|
205
192
|
* theme — gap-match with 'display: flex !important; align-items: center !important',
|
|
@@ -235,12 +222,12 @@ var qti_gap_text_styles_default = [
|
|
|
235
222
|
|
|
236
223
|
// ../interactions/core/dist/elements/qti-gap-text/qti-gap-text.js
|
|
237
224
|
var __decorate2 = function(decorators, target, key, desc) {
|
|
238
|
-
var
|
|
239
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
240
|
-
else for (var
|
|
241
|
-
return
|
|
225
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
226
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
227
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
228
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
242
229
|
};
|
|
243
|
-
var QtiGapText = class extends ActiveElementMixin(
|
|
230
|
+
var QtiGapText = class extends ActiveElementMixin(LitElement, "qti-gap-text") {
|
|
244
231
|
constructor() {
|
|
245
232
|
super(...arguments);
|
|
246
233
|
this.tabindex = 0;
|
|
@@ -253,18 +240,23 @@ var QtiGapText = class extends ActiveElementMixin(i2, "qti-gap-text") {
|
|
|
253
240
|
this.setAttribute("slot", "drags");
|
|
254
241
|
}
|
|
255
242
|
render() {
|
|
256
|
-
return
|
|
243
|
+
return html2`<div part="control"></div>
|
|
257
244
|
<slot part="label"></slot>`;
|
|
258
245
|
}
|
|
259
246
|
};
|
|
260
247
|
__decorate2([
|
|
261
|
-
|
|
248
|
+
property2({ type: Number, reflect: true })
|
|
262
249
|
], QtiGapText.prototype, "tabindex", void 0);
|
|
263
250
|
|
|
251
|
+
// ../interactions/core/dist/elements/qti-hotspot-choice/qti-hotspot-choice.js
|
|
252
|
+
import { LitElement as LitElement2 } from "lit";
|
|
253
|
+
import { property as property3 } from "lit/decorators.js";
|
|
254
|
+
|
|
264
255
|
// ../interactions/core/dist/elements/qti-hotspot-choice/qti-hotspot-choice.styles.js
|
|
256
|
+
import { css as css2 } from "lit";
|
|
265
257
|
var qti_hotspot_choice_styles_default = [
|
|
266
258
|
boxSizing,
|
|
267
|
-
|
|
259
|
+
css2`
|
|
268
260
|
:host {
|
|
269
261
|
display: flex;
|
|
270
262
|
user-select: none;
|
|
@@ -289,24 +281,28 @@ var qti_hotspot_choice_styles_default = [
|
|
|
289
281
|
|
|
290
282
|
// ../interactions/core/dist/elements/qti-hotspot-choice/qti-hotspot-choice.js
|
|
291
283
|
var __decorate3 = function(decorators, target, key, desc) {
|
|
292
|
-
var
|
|
293
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
294
|
-
else for (var
|
|
295
|
-
return
|
|
284
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
285
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
286
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
287
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
296
288
|
};
|
|
297
|
-
var QtiHotspotChoice = class extends ActiveElementMixin(
|
|
289
|
+
var QtiHotspotChoice = class extends ActiveElementMixin(LitElement2, "qti-hotspot-choice") {
|
|
298
290
|
static {
|
|
299
291
|
this.styles = qti_hotspot_choice_styles_default;
|
|
300
292
|
}
|
|
301
293
|
};
|
|
302
294
|
__decorate3([
|
|
303
|
-
|
|
295
|
+
property3({ attribute: "aria-ordervalue", type: Number, reflect: true })
|
|
304
296
|
], QtiHotspotChoice.prototype, "order", void 0);
|
|
305
297
|
|
|
298
|
+
// ../interactions/core/dist/elements/qti-hottext/qti-hottext.js
|
|
299
|
+
import { html as html3, LitElement as LitElement3 } from "lit";
|
|
300
|
+
|
|
306
301
|
// ../interactions/core/dist/elements/qti-hottext/qti-hottext.styles.js
|
|
302
|
+
import { css as css3 } from "lit";
|
|
307
303
|
var qti_hottext_styles_default = [
|
|
308
304
|
boxSizing,
|
|
309
|
-
|
|
305
|
+
css3`
|
|
310
306
|
/* 'position: relative' is the containing block for the answer-key tick the theme draws as an
|
|
311
307
|
absolutely positioned ::before. See CONTRACT.md §7. */
|
|
312
308
|
:host {
|
|
@@ -330,77 +326,32 @@ var qti_hottext_styles_default = [
|
|
|
330
326
|
];
|
|
331
327
|
|
|
332
328
|
// ../interactions/core/dist/elements/qti-hottext/qti-hottext.js
|
|
333
|
-
var QtiHottext = class extends ActiveElementMixin(
|
|
329
|
+
var QtiHottext = class extends ActiveElementMixin(LitElement3, "qti-hottext") {
|
|
334
330
|
static {
|
|
335
331
|
this.styles = qti_hottext_styles_default;
|
|
336
332
|
}
|
|
337
333
|
render() {
|
|
338
|
-
return
|
|
334
|
+
return html3`<div part="control"><div part="control-mark"></div></div>
|
|
339
335
|
<slot part="label"></slot>`;
|
|
340
336
|
}
|
|
341
337
|
};
|
|
342
338
|
|
|
343
|
-
//
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
};
|
|
349
|
-
var c2 = e3(class extends i3 {
|
|
350
|
-
constructor(e5) {
|
|
351
|
-
if (super(e5), e5.type !== t.CHILD) throw Error("repeat() can only be used in text expressions");
|
|
352
|
-
}
|
|
353
|
-
dt(e5, s, t2) {
|
|
354
|
-
let r2;
|
|
355
|
-
void 0 === t2 ? t2 = s : void 0 !== s && (r2 = s);
|
|
356
|
-
const l = [], o5 = [];
|
|
357
|
-
let i5 = 0;
|
|
358
|
-
for (const s2 of e5) l[i5] = r2 ? r2(s2, i5) : i5, o5[i5] = t2(s2, i5), i5++;
|
|
359
|
-
return { values: o5, keys: l };
|
|
360
|
-
}
|
|
361
|
-
render(e5, s, t2) {
|
|
362
|
-
return this.dt(e5, s, t2).values;
|
|
363
|
-
}
|
|
364
|
-
update(s, [t2, r2, c3]) {
|
|
365
|
-
const d = M(s), { values: p2, keys: a } = this.dt(t2, r2, c3);
|
|
366
|
-
if (!Array.isArray(d)) return this.ut = a, p2;
|
|
367
|
-
const h3 = this.ut ??= [], v2 = [];
|
|
368
|
-
let m, y, x = 0, j = d.length - 1, k = 0, w = p2.length - 1;
|
|
369
|
-
for (; x <= j && k <= w; ) if (null === d[x]) x++;
|
|
370
|
-
else if (null === d[j]) j--;
|
|
371
|
-
else if (h3[x] === a[k]) v2[k] = u(d[x], p2[k]), x++, k++;
|
|
372
|
-
else if (h3[j] === a[w]) v2[w] = u(d[j], p2[w]), j--, w--;
|
|
373
|
-
else if (h3[x] === a[w]) v2[w] = u(d[x], p2[w]), v(s, v2[w + 1], d[x]), x++, w--;
|
|
374
|
-
else if (h3[j] === a[k]) v2[k] = u(d[j], p2[k]), v(s, d[x], d[j]), j--, k++;
|
|
375
|
-
else if (void 0 === m && (m = u2(a, k, w), y = u2(h3, x, j)), m.has(h3[x])) if (m.has(h3[j])) {
|
|
376
|
-
const e5 = y.get(a[k]), t3 = void 0 !== e5 ? d[e5] : null;
|
|
377
|
-
if (null === t3) {
|
|
378
|
-
const e6 = v(s, d[x]);
|
|
379
|
-
u(e6, p2[k]), v2[k] = e6;
|
|
380
|
-
} else v2[k] = u(t3, p2[k]), v(s, d[x], t3), d[e5] = null;
|
|
381
|
-
k++;
|
|
382
|
-
} else h(d[j]), j--;
|
|
383
|
-
else h(d[x]), x++;
|
|
384
|
-
for (; k <= w; ) {
|
|
385
|
-
const e5 = v(s, v2[w + 1]);
|
|
386
|
-
u(e5, p2[k]), v2[k++] = e5;
|
|
387
|
-
}
|
|
388
|
-
for (; x <= j; ) {
|
|
389
|
-
const e5 = d[x++];
|
|
390
|
-
null !== e5 && h(e5);
|
|
391
|
-
}
|
|
392
|
-
return this.ut = a, p(s, v2), E;
|
|
393
|
-
}
|
|
394
|
-
});
|
|
339
|
+
// ../interactions/core/dist/elements/qti-simple-associable-choice/qti-simple-associable-choice.js
|
|
340
|
+
import { html as html4, LitElement as LitElement4 } from "lit";
|
|
341
|
+
import { property as property4, state as state2 } from "lit/decorators.js";
|
|
342
|
+
import { repeat } from "lit/directives/repeat.js";
|
|
343
|
+
import { consume as consume2 } from "@lit/context";
|
|
395
344
|
|
|
396
345
|
// ../interactions/core/dist/context/drag-drop.context.js
|
|
397
|
-
|
|
346
|
+
import { createContext } from "@lit/context";
|
|
347
|
+
var dragDropContext = createContext(/* @__PURE__ */ Symbol("dragDropContext"));
|
|
398
348
|
|
|
399
349
|
// ../interactions/core/dist/elements/qti-simple-associable-choice/qti-simple-associable-choice.styles.js
|
|
350
|
+
import { css as css4 } from "lit";
|
|
400
351
|
var qti_simple_associable_choice_styles_default = [
|
|
401
352
|
boxSizing,
|
|
402
353
|
dropRegion,
|
|
403
|
-
|
|
354
|
+
css4`
|
|
404
355
|
/*
|
|
405
356
|
* 'align-items' / 'justify-content' are variables because one caller cannot be reached any other
|
|
406
357
|
* way. In tabular match this element is a light-DOM *grandchild* of the slotted
|
|
@@ -542,12 +493,12 @@ var qti_simple_associable_choice_styles_default = [
|
|
|
542
493
|
|
|
543
494
|
// ../interactions/core/dist/elements/qti-simple-associable-choice/qti-simple-associable-choice.js
|
|
544
495
|
var __decorate4 = function(decorators, target, key, desc) {
|
|
545
|
-
var
|
|
546
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
547
|
-
else for (var
|
|
548
|
-
return
|
|
496
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
497
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
498
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
499
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
549
500
|
};
|
|
550
|
-
var QtiSimpleAssociableChoice = class extends ActiveElementMixin(
|
|
501
|
+
var QtiSimpleAssociableChoice = class extends ActiveElementMixin(LitElement4, "qti-simple-associable-choice") {
|
|
551
502
|
constructor() {
|
|
552
503
|
super(...arguments);
|
|
553
504
|
this.matchMin = 0;
|
|
@@ -574,29 +525,29 @@ var QtiSimpleAssociableChoice = class extends ActiveElementMixin(i2, "qti-simple
|
|
|
574
525
|
// So we have a slot for whenever another qti-simple-associable-choice is dropped in here.
|
|
575
526
|
// And we have slot for content like in this associate interaction
|
|
576
527
|
render() {
|
|
577
|
-
return
|
|
528
|
+
return html4`
|
|
578
529
|
<div part="control"></div>
|
|
579
530
|
<slot part="label"></slot>
|
|
580
531
|
<div part="drop">
|
|
581
|
-
${
|
|
532
|
+
${repeat(this.drags, (node) => node.getAttribute("identifier"), (node) => node)}
|
|
582
533
|
</div>
|
|
583
534
|
`;
|
|
584
535
|
}
|
|
585
536
|
};
|
|
586
537
|
__decorate4([
|
|
587
|
-
|
|
538
|
+
property4({
|
|
588
539
|
type: Number,
|
|
589
540
|
attribute: "match-min"
|
|
590
541
|
})
|
|
591
542
|
], QtiSimpleAssociableChoice.prototype, "matchMin", void 0);
|
|
592
543
|
__decorate4([
|
|
593
|
-
|
|
544
|
+
property4({
|
|
594
545
|
type: Number,
|
|
595
546
|
attribute: "match-max"
|
|
596
547
|
})
|
|
597
548
|
], QtiSimpleAssociableChoice.prototype, "matchMax", void 0);
|
|
598
549
|
__decorate4([
|
|
599
|
-
|
|
550
|
+
property4({
|
|
600
551
|
type: String,
|
|
601
552
|
attribute: "fixed",
|
|
602
553
|
converter: {
|
|
@@ -606,14 +557,19 @@ __decorate4([
|
|
|
606
557
|
})
|
|
607
558
|
], QtiSimpleAssociableChoice.prototype, "fixed", void 0);
|
|
608
559
|
__decorate4([
|
|
609
|
-
|
|
610
|
-
|
|
560
|
+
consume2({ context: dragDropContext, subscribe: true }),
|
|
561
|
+
state2()
|
|
611
562
|
], QtiSimpleAssociableChoice.prototype, "_dragDrop", void 0);
|
|
612
563
|
|
|
564
|
+
// ../interactions/core/dist/elements/qti-simple-choice/qti-simple-choice.js
|
|
565
|
+
import { html as html5, LitElement as LitElement5, nothing } from "lit";
|
|
566
|
+
import { property as property5 } from "lit/decorators.js";
|
|
567
|
+
|
|
613
568
|
// ../interactions/core/dist/elements/qti-simple-choice/qti-simple-choice.styles.js
|
|
569
|
+
import { css as css5 } from "lit";
|
|
614
570
|
var qti_simple_choice_styles_default = [
|
|
615
571
|
boxSizing,
|
|
616
|
-
|
|
572
|
+
css5`
|
|
617
573
|
/*
|
|
618
574
|
* 'position: relative' unconditionally, because this element can carry a correction badge and a
|
|
619
575
|
* badge needs a containing block. The theme draws the badge as an absolutely positioned ::after
|
|
@@ -654,12 +610,12 @@ var qti_simple_choice_styles_default = [
|
|
|
654
610
|
|
|
655
611
|
// ../interactions/core/dist/elements/qti-simple-choice/qti-simple-choice.js
|
|
656
612
|
var __decorate5 = function(decorators, target, key, desc) {
|
|
657
|
-
var
|
|
658
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
659
|
-
else for (var
|
|
660
|
-
return
|
|
613
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
614
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
615
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
616
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
661
617
|
};
|
|
662
|
-
var QtiSimpleChoice = class extends ActiveElementMixin(
|
|
618
|
+
var QtiSimpleChoice = class extends ActiveElementMixin(LitElement5, "qti-simple-choice") {
|
|
663
619
|
constructor() {
|
|
664
620
|
super(...arguments);
|
|
665
621
|
this.templateIdentifier = null;
|
|
@@ -671,7 +627,7 @@ var QtiSimpleChoice = class extends ActiveElementMixin(i2, "qti-simple-choice")
|
|
|
671
627
|
}
|
|
672
628
|
static {
|
|
673
629
|
this.shadowRootOptions = {
|
|
674
|
-
...
|
|
630
|
+
...LitElement5.shadowRootOptions,
|
|
675
631
|
delegatesFocus: true
|
|
676
632
|
};
|
|
677
633
|
}
|
|
@@ -679,19 +635,19 @@ var QtiSimpleChoice = class extends ActiveElementMixin(i2, "qti-simple-choice")
|
|
|
679
635
|
return this["internals"].states.has("checked");
|
|
680
636
|
}
|
|
681
637
|
render() {
|
|
682
|
-
return
|
|
683
|
-
${this.marker ?
|
|
638
|
+
return html5`<div part="control" tabindex="0"><div part="control-mark"></div></div>
|
|
639
|
+
${this.marker ? html5`<div id="label" part="marker">${this.marker}</div>` : nothing}
|
|
684
640
|
<slot part="label"></slot>`;
|
|
685
641
|
}
|
|
686
642
|
};
|
|
687
643
|
__decorate5([
|
|
688
|
-
|
|
644
|
+
property5({ type: String, attribute: "template-identifier" })
|
|
689
645
|
], QtiSimpleChoice.prototype, "templateIdentifier", void 0);
|
|
690
646
|
__decorate5([
|
|
691
|
-
|
|
647
|
+
property5({ type: String, attribute: "show-hide" })
|
|
692
648
|
], QtiSimpleChoice.prototype, "showHide", void 0);
|
|
693
649
|
__decorate5([
|
|
694
|
-
|
|
650
|
+
property5({
|
|
695
651
|
type: Boolean,
|
|
696
652
|
converter: {
|
|
697
653
|
fromAttribute: (value) => value === "true",
|
|
@@ -700,15 +656,21 @@ __decorate5([
|
|
|
700
656
|
})
|
|
701
657
|
], QtiSimpleChoice.prototype, "fixed", void 0);
|
|
702
658
|
__decorate5([
|
|
703
|
-
|
|
659
|
+
property5({ type: String, attribute: false })
|
|
704
660
|
], QtiSimpleChoice.prototype, "marker", void 0);
|
|
705
661
|
|
|
662
|
+
// ../interactions/associate-interaction/dist/qti-associate-interaction.js
|
|
663
|
+
import { html as html6 } from "lit";
|
|
664
|
+
import { repeat as repeat2 } from "lit/directives/repeat.js";
|
|
665
|
+
import { state as state3 } from "lit/decorators.js";
|
|
666
|
+
|
|
706
667
|
// ../interactions/core/dist/mixins/dropzone-auto-size/dropzone-auto-size.mixin.js
|
|
668
|
+
import { property as property6 } from "lit/decorators.js";
|
|
707
669
|
var __decorate6 = function(decorators, target, key, desc) {
|
|
708
|
-
var
|
|
709
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
710
|
-
else for (var
|
|
711
|
-
return
|
|
670
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
671
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
672
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
673
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
712
674
|
};
|
|
713
675
|
function applyDropzoneAutoSizing(host, draggables, droppables, dragContainers, options = {}) {
|
|
714
676
|
const publishWidth = options.publishWidth ?? true;
|
|
@@ -899,7 +861,7 @@ var DropzoneAutoSizeMixin = (superClass, draggablesSelector, droppablesSelector,
|
|
|
899
861
|
}
|
|
900
862
|
}
|
|
901
863
|
__decorate6([
|
|
902
|
-
|
|
864
|
+
property6({ type: Boolean, attribute: "auto-size-dropzones" })
|
|
903
865
|
/**
|
|
904
866
|
* Size the dropzones from the chips they will hold.
|
|
905
867
|
*
|
|
@@ -924,7 +886,7 @@ var [Observable, Subscriber] = (() => {
|
|
|
924
886
|
enumerable
|
|
925
887
|
});
|
|
926
888
|
}
|
|
927
|
-
const pTry = "try" in Promise ? Promise.try.bind(Promise) : (fn, ...args) => new Promise((
|
|
889
|
+
const pTry = "try" in Promise ? Promise.try.bind(Promise) : (fn, ...args) => new Promise((r) => r(fn(...args)));
|
|
928
890
|
const pWithResolvers = "withResolvers" in Promise ? Promise.withResolvers.bind(Promise) : () => {
|
|
929
891
|
let resolve, reject;
|
|
930
892
|
const promise = new Promise((res, rej) => (resolve = res, reject = rej));
|
|
@@ -939,22 +901,22 @@ var [Observable, Subscriber] = (() => {
|
|
|
939
901
|
const AsyncFromSyncIteratorPrototype = {
|
|
940
902
|
next(...args) {
|
|
941
903
|
const O = this;
|
|
942
|
-
const
|
|
943
|
-
if (!
|
|
904
|
+
const state11 = privateState.get(O);
|
|
905
|
+
if (!state11?.syncIteratorRecord)
|
|
944
906
|
throw new TypeError(
|
|
945
907
|
"AsyncFromSyncIteratorPrototype.next called on invalid object"
|
|
946
908
|
);
|
|
947
|
-
const { syncIteratorRecord } =
|
|
909
|
+
const { syncIteratorRecord } = state11;
|
|
948
910
|
return pTry(() => syncIteratorRecord.next(...args));
|
|
949
911
|
},
|
|
950
912
|
return(...args) {
|
|
951
913
|
const O = this;
|
|
952
|
-
const
|
|
953
|
-
if (!
|
|
914
|
+
const state11 = privateState.get(O);
|
|
915
|
+
if (!state11?.syncIteratorRecord)
|
|
954
916
|
throw new TypeError(
|
|
955
917
|
"AsyncFromSyncIteratorPrototype.return called on invalid object"
|
|
956
918
|
);
|
|
957
|
-
const { syncIteratorRecord } =
|
|
919
|
+
const { syncIteratorRecord } = state11;
|
|
958
920
|
return pTry(() => {
|
|
959
921
|
if (!syncIteratorRecord.return) return { value: void 0, done: true };
|
|
960
922
|
return syncIteratorRecord.return(...args);
|
|
@@ -962,12 +924,12 @@ var [Observable, Subscriber] = (() => {
|
|
|
962
924
|
},
|
|
963
925
|
throw(...args) {
|
|
964
926
|
const O = this;
|
|
965
|
-
const
|
|
966
|
-
if (!
|
|
927
|
+
const state11 = privateState.get(O);
|
|
928
|
+
if (!state11?.syncIteratorRecord)
|
|
967
929
|
throw new TypeError(
|
|
968
930
|
"AsyncFromSyncIteratorPrototype.throw called on invalid object"
|
|
969
931
|
);
|
|
970
|
-
const { syncIteratorRecord } =
|
|
932
|
+
const { syncIteratorRecord } = state11;
|
|
971
933
|
return pTry(() => {
|
|
972
934
|
if (!syncIteratorRecord.throw) {
|
|
973
935
|
syncIteratorRecord.return();
|
|
@@ -1033,16 +995,16 @@ var [Observable, Subscriber] = (() => {
|
|
|
1033
995
|
}
|
|
1034
996
|
}
|
|
1035
997
|
function closeASubscription(subscriber, reason) {
|
|
1036
|
-
const
|
|
1037
|
-
if (!
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
for (const teardown of
|
|
998
|
+
const state11 = privateState.get(subscriber);
|
|
999
|
+
if (!state11?.active) return;
|
|
1000
|
+
state11.active = false;
|
|
1001
|
+
state11.subscriptionController.abort(reason);
|
|
1002
|
+
for (const teardown of state11.teardowns.reverse()) {
|
|
1041
1003
|
if (isBrowserContext() && !isDocumentFullyActive(document)) return;
|
|
1042
1004
|
try {
|
|
1043
1005
|
teardown();
|
|
1044
|
-
} catch (
|
|
1045
|
-
reportError(
|
|
1006
|
+
} catch (e) {
|
|
1007
|
+
reportError(e);
|
|
1046
1008
|
}
|
|
1047
1009
|
}
|
|
1048
1010
|
}
|
|
@@ -1093,8 +1055,8 @@ var [Observable, Subscriber] = (() => {
|
|
|
1093
1055
|
if (observableState.subscribeCallback) {
|
|
1094
1056
|
try {
|
|
1095
1057
|
observableState.subscribeCallback(subscriber);
|
|
1096
|
-
} catch (
|
|
1097
|
-
subscriber.error(
|
|
1058
|
+
} catch (e) {
|
|
1059
|
+
subscriber.error(e);
|
|
1098
1060
|
}
|
|
1099
1061
|
}
|
|
1100
1062
|
}
|
|
@@ -1118,10 +1080,10 @@ var [Observable, Subscriber] = (() => {
|
|
|
1118
1080
|
if (!(this instanceof Subscriber2))
|
|
1119
1081
|
throw new TypeError("illegal invocation");
|
|
1120
1082
|
if (!arguments.length) throw new TypeError("too few arguments");
|
|
1121
|
-
const
|
|
1122
|
-
if (!
|
|
1083
|
+
const state11 = privateState.get(this);
|
|
1084
|
+
if (!state11?.active) return;
|
|
1123
1085
|
if (isBrowserContext() && !isDocumentFullyActive(document)) return;
|
|
1124
|
-
const internalObservers = new Set(
|
|
1086
|
+
const internalObservers = new Set(state11.observers);
|
|
1125
1087
|
for (const observer of internalObservers) {
|
|
1126
1088
|
observer.next(value);
|
|
1127
1089
|
}
|
|
@@ -1131,14 +1093,14 @@ var [Observable, Subscriber] = (() => {
|
|
|
1131
1093
|
if (!(this instanceof Subscriber2))
|
|
1132
1094
|
throw new TypeError("illegal invocation");
|
|
1133
1095
|
if (!arguments.length) throw new TypeError("too few arguments");
|
|
1134
|
-
const
|
|
1135
|
-
if (!
|
|
1096
|
+
const state11 = privateState.get(this);
|
|
1097
|
+
if (!state11?.active) {
|
|
1136
1098
|
reportError(error);
|
|
1137
1099
|
return;
|
|
1138
1100
|
}
|
|
1139
1101
|
if (isBrowserContext() && !isDocumentFullyActive(document)) return;
|
|
1140
1102
|
closeASubscription(this, error);
|
|
1141
|
-
const internalObservers = new Set(
|
|
1103
|
+
const internalObservers = new Set(state11.observers);
|
|
1142
1104
|
for (const observer of internalObservers) {
|
|
1143
1105
|
observer.error(error);
|
|
1144
1106
|
}
|
|
@@ -1147,11 +1109,11 @@ var [Observable, Subscriber] = (() => {
|
|
|
1147
1109
|
complete() {
|
|
1148
1110
|
if (!(this instanceof Subscriber2))
|
|
1149
1111
|
throw new TypeError("illegal invocation");
|
|
1150
|
-
const
|
|
1151
|
-
if (!
|
|
1112
|
+
const state11 = privateState.get(this);
|
|
1113
|
+
if (!state11?.active) return;
|
|
1152
1114
|
if (isBrowserContext() && !isDocumentFullyActive(document)) return;
|
|
1153
1115
|
closeASubscription(this);
|
|
1154
|
-
const internalObservers = new Set(
|
|
1116
|
+
const internalObservers = new Set(state11.observers);
|
|
1155
1117
|
for (const observer of internalObservers) {
|
|
1156
1118
|
observer.complete();
|
|
1157
1119
|
}
|
|
@@ -1164,9 +1126,9 @@ var [Observable, Subscriber] = (() => {
|
|
|
1164
1126
|
throw new TypeError(`Parameter 1 is not of type 'Function'`);
|
|
1165
1127
|
}
|
|
1166
1128
|
if (isBrowserContext() && !isDocumentFullyActive(document)) return;
|
|
1167
|
-
const
|
|
1168
|
-
if (
|
|
1169
|
-
|
|
1129
|
+
const state11 = privateState.get(this);
|
|
1130
|
+
if (state11?.active)
|
|
1131
|
+
state11.teardowns.push(teardown);
|
|
1170
1132
|
else teardown();
|
|
1171
1133
|
}
|
|
1172
1134
|
get active() {
|
|
@@ -1248,8 +1210,8 @@ var [Observable, Subscriber] = (() => {
|
|
|
1248
1210
|
nextAlgorithm(subscriber, iteratorRecord);
|
|
1249
1211
|
},
|
|
1250
1212
|
// If nextPromise was rejected with reason r, then run subscriber’s error() method given r.
|
|
1251
|
-
(
|
|
1252
|
-
subscriber.error(
|
|
1213
|
+
(r) => {
|
|
1214
|
+
subscriber.error(r);
|
|
1253
1215
|
}
|
|
1254
1216
|
);
|
|
1255
1217
|
};
|
|
@@ -1319,13 +1281,13 @@ var [Observable, Subscriber] = (() => {
|
|
|
1319
1281
|
return new Observable2((subscriber) => {
|
|
1320
1282
|
value.then(
|
|
1321
1283
|
// 9.1.1.1. If value was fulfilled with value v, then:
|
|
1322
|
-
(
|
|
1323
|
-
subscriber.next(
|
|
1284
|
+
(v) => {
|
|
1285
|
+
subscriber.next(v);
|
|
1324
1286
|
subscriber.complete();
|
|
1325
1287
|
},
|
|
1326
1288
|
// 9.1.1.2 If value was rejected with reason r, then run subscriber’s error() method, given r.
|
|
1327
|
-
(
|
|
1328
|
-
subscriber.error(
|
|
1289
|
+
(r) => {
|
|
1290
|
+
subscriber.error(r);
|
|
1329
1291
|
}
|
|
1330
1292
|
);
|
|
1331
1293
|
});
|
|
@@ -1389,8 +1351,8 @@ var [Observable, Subscriber] = (() => {
|
|
|
1389
1351
|
let mappedValue;
|
|
1390
1352
|
try {
|
|
1391
1353
|
mappedValue = mapper(value, idx);
|
|
1392
|
-
} catch (
|
|
1393
|
-
subscriber.error(
|
|
1354
|
+
} catch (e) {
|
|
1355
|
+
subscriber.error(e);
|
|
1394
1356
|
return;
|
|
1395
1357
|
}
|
|
1396
1358
|
idx += 1;
|
|
@@ -1428,8 +1390,8 @@ var [Observable, Subscriber] = (() => {
|
|
|
1428
1390
|
if (subscribeCallback !== null) {
|
|
1429
1391
|
try {
|
|
1430
1392
|
subscribeCallback();
|
|
1431
|
-
} catch (
|
|
1432
|
-
subscriber.error(
|
|
1393
|
+
} catch (e) {
|
|
1394
|
+
subscriber.error(e);
|
|
1433
1395
|
return;
|
|
1434
1396
|
}
|
|
1435
1397
|
}
|
|
@@ -1438,8 +1400,8 @@ var [Observable, Subscriber] = (() => {
|
|
|
1438
1400
|
if (abortCallback !== null) {
|
|
1439
1401
|
abortCallback(subscriber.signal.reason);
|
|
1440
1402
|
}
|
|
1441
|
-
} catch (
|
|
1442
|
-
reportError(
|
|
1403
|
+
} catch (e) {
|
|
1404
|
+
reportError(e);
|
|
1443
1405
|
}
|
|
1444
1406
|
};
|
|
1445
1407
|
subscriber.signal.addEventListener("abort", abortCallbackWrapped, { once: true });
|
|
@@ -1448,9 +1410,9 @@ var [Observable, Subscriber] = (() => {
|
|
|
1448
1410
|
if (nextCallback !== null) {
|
|
1449
1411
|
try {
|
|
1450
1412
|
nextCallback(value);
|
|
1451
|
-
} catch (
|
|
1413
|
+
} catch (e) {
|
|
1452
1414
|
subscriber.signal.removeEventListener("abort", abortCallbackWrapped);
|
|
1453
|
-
subscriber.error(
|
|
1415
|
+
subscriber.error(e);
|
|
1454
1416
|
return;
|
|
1455
1417
|
}
|
|
1456
1418
|
}
|
|
@@ -1461,8 +1423,8 @@ var [Observable, Subscriber] = (() => {
|
|
|
1461
1423
|
if (errorCallback !== null) {
|
|
1462
1424
|
try {
|
|
1463
1425
|
errorCallback(error);
|
|
1464
|
-
} catch (
|
|
1465
|
-
subscriber.error(
|
|
1426
|
+
} catch (e) {
|
|
1427
|
+
subscriber.error(e);
|
|
1466
1428
|
return;
|
|
1467
1429
|
}
|
|
1468
1430
|
}
|
|
@@ -1473,8 +1435,8 @@ var [Observable, Subscriber] = (() => {
|
|
|
1473
1435
|
if (completeCallback !== null) {
|
|
1474
1436
|
try {
|
|
1475
1437
|
completeCallback();
|
|
1476
|
-
} catch (
|
|
1477
|
-
subscriber.error(
|
|
1438
|
+
} catch (e) {
|
|
1439
|
+
subscriber.error(e);
|
|
1478
1440
|
return;
|
|
1479
1441
|
}
|
|
1480
1442
|
}
|
|
@@ -1499,8 +1461,8 @@ var [Observable, Subscriber] = (() => {
|
|
|
1499
1461
|
let matches = false;
|
|
1500
1462
|
try {
|
|
1501
1463
|
matches = predicate(value, idx);
|
|
1502
|
-
} catch (
|
|
1503
|
-
subscriber.error(
|
|
1464
|
+
} catch (e) {
|
|
1465
|
+
subscriber.error(e);
|
|
1504
1466
|
return;
|
|
1505
1467
|
}
|
|
1506
1468
|
idx += 1;
|
|
@@ -1583,15 +1545,15 @@ var [Observable, Subscriber] = (() => {
|
|
|
1583
1545
|
let mappedResult;
|
|
1584
1546
|
try {
|
|
1585
1547
|
mappedResult = mapper(value, idx);
|
|
1586
|
-
} catch (
|
|
1587
|
-
return subscriber.error(
|
|
1548
|
+
} catch (e) {
|
|
1549
|
+
return subscriber.error(e);
|
|
1588
1550
|
}
|
|
1589
1551
|
idx += 1;
|
|
1590
1552
|
let innerObservable;
|
|
1591
1553
|
try {
|
|
1592
1554
|
innerObservable = Observable2.from(mappedResult);
|
|
1593
|
-
} catch (
|
|
1594
|
-
return subscriber.error(
|
|
1555
|
+
} catch (e) {
|
|
1556
|
+
return subscriber.error(e);
|
|
1595
1557
|
}
|
|
1596
1558
|
let innerObserver = new InternalObserver({
|
|
1597
1559
|
next(value2) {
|
|
@@ -1652,15 +1614,15 @@ var [Observable, Subscriber] = (() => {
|
|
|
1652
1614
|
let mappedResult;
|
|
1653
1615
|
try {
|
|
1654
1616
|
mappedResult = mapper(value, idx);
|
|
1655
|
-
} catch (
|
|
1656
|
-
return subscriber.error(
|
|
1617
|
+
} catch (e) {
|
|
1618
|
+
return subscriber.error(e);
|
|
1657
1619
|
}
|
|
1658
1620
|
idx += 1;
|
|
1659
1621
|
let innerObservable;
|
|
1660
1622
|
try {
|
|
1661
1623
|
innerObservable = Observable2.from(mappedResult);
|
|
1662
|
-
} catch (
|
|
1663
|
-
return subscriber.error(
|
|
1624
|
+
} catch (e) {
|
|
1625
|
+
return subscriber.error(e);
|
|
1664
1626
|
}
|
|
1665
1627
|
let innerObserver = new InternalObserver({
|
|
1666
1628
|
next(value2) {
|
|
@@ -1775,7 +1737,7 @@ var [Observable, Subscriber] = (() => {
|
|
|
1775
1737
|
toArray(options = {}) {
|
|
1776
1738
|
if (!(this instanceof Observable2))
|
|
1777
1739
|
throw new TypeError("illegal invocation");
|
|
1778
|
-
let { promise:
|
|
1740
|
+
let { promise: p, resolve, reject } = pWithResolvers();
|
|
1779
1741
|
if (options.signal) {
|
|
1780
1742
|
if (options.signal.aborted) {
|
|
1781
1743
|
return Promise.reject(options.signal.reason);
|
|
@@ -1797,7 +1759,7 @@ var [Observable, Subscriber] = (() => {
|
|
|
1797
1759
|
}
|
|
1798
1760
|
});
|
|
1799
1761
|
subscribeTo(this, observer, options);
|
|
1800
|
-
return
|
|
1762
|
+
return p;
|
|
1801
1763
|
}
|
|
1802
1764
|
// https://wicg.github.io/observable/#dom-observable-foreach
|
|
1803
1765
|
forEach(callback, options = {}) {
|
|
@@ -1805,12 +1767,12 @@ var [Observable, Subscriber] = (() => {
|
|
|
1805
1767
|
throw new TypeError("illegal invocation");
|
|
1806
1768
|
if (typeof callback !== "function")
|
|
1807
1769
|
throw new TypeError(`Parameter 1 is not of type 'Function'`);
|
|
1808
|
-
let { promise:
|
|
1770
|
+
let { promise: p, resolve, reject } = pWithResolvers();
|
|
1809
1771
|
let visitorCallbackController = new AbortController();
|
|
1810
1772
|
const internalOptions = { signal: anySignal([visitorCallbackController.signal, options.signal]) };
|
|
1811
1773
|
if (internalOptions.signal.aborted) {
|
|
1812
1774
|
reject(internalOptions.signal.reason);
|
|
1813
|
-
return
|
|
1775
|
+
return p;
|
|
1814
1776
|
}
|
|
1815
1777
|
internalOptions.signal.addEventListener("abort", () => {
|
|
1816
1778
|
reject(internalOptions.signal.reason);
|
|
@@ -1820,9 +1782,9 @@ var [Observable, Subscriber] = (() => {
|
|
|
1820
1782
|
next(value) {
|
|
1821
1783
|
try {
|
|
1822
1784
|
callback(value, idx);
|
|
1823
|
-
} catch (
|
|
1824
|
-
reject(
|
|
1825
|
-
visitorCallbackController.abort(
|
|
1785
|
+
} catch (e) {
|
|
1786
|
+
reject(e);
|
|
1787
|
+
visitorCallbackController.abort(e);
|
|
1826
1788
|
}
|
|
1827
1789
|
idx += 1;
|
|
1828
1790
|
},
|
|
@@ -1834,7 +1796,7 @@ var [Observable, Subscriber] = (() => {
|
|
|
1834
1796
|
}
|
|
1835
1797
|
});
|
|
1836
1798
|
subscribeTo(this, observer, internalOptions);
|
|
1837
|
-
return
|
|
1799
|
+
return p;
|
|
1838
1800
|
}
|
|
1839
1801
|
// https://wicg.github.io/observable/#dom-observable-every
|
|
1840
1802
|
every(predicate, options = {}) {
|
|
@@ -1842,12 +1804,12 @@ var [Observable, Subscriber] = (() => {
|
|
|
1842
1804
|
throw new TypeError("illegal invocation");
|
|
1843
1805
|
if (typeof predicate !== "function")
|
|
1844
1806
|
throw new TypeError(`Parameter 1 is not of type 'Function'`);
|
|
1845
|
-
let { promise:
|
|
1807
|
+
let { promise: p, resolve, reject } = pWithResolvers();
|
|
1846
1808
|
let controller = new AbortController();
|
|
1847
1809
|
const internalOptions = { signal: anySignal([controller.signal, options.signal]) };
|
|
1848
1810
|
if (internalOptions.signal.aborted) {
|
|
1849
1811
|
reject(internalOptions.signal.reason);
|
|
1850
|
-
return
|
|
1812
|
+
return p;
|
|
1851
1813
|
}
|
|
1852
1814
|
internalOptions.signal.addEventListener("abort", () => {
|
|
1853
1815
|
reject(internalOptions.signal.reason);
|
|
@@ -1858,9 +1820,9 @@ var [Observable, Subscriber] = (() => {
|
|
|
1858
1820
|
let passed = false;
|
|
1859
1821
|
try {
|
|
1860
1822
|
passed = predicate(value, idx);
|
|
1861
|
-
} catch (
|
|
1862
|
-
reject(
|
|
1863
|
-
controller.abort(
|
|
1823
|
+
} catch (e) {
|
|
1824
|
+
reject(e);
|
|
1825
|
+
controller.abort(e);
|
|
1864
1826
|
}
|
|
1865
1827
|
idx += 1;
|
|
1866
1828
|
if (!passed) {
|
|
@@ -1876,18 +1838,18 @@ var [Observable, Subscriber] = (() => {
|
|
|
1876
1838
|
}
|
|
1877
1839
|
});
|
|
1878
1840
|
subscribeTo(this, observer, internalOptions);
|
|
1879
|
-
return
|
|
1841
|
+
return p;
|
|
1880
1842
|
}
|
|
1881
1843
|
// https://wicg.github.io/observable/#dom-observable-first
|
|
1882
1844
|
first(options = {}) {
|
|
1883
1845
|
if (!(this instanceof Observable2))
|
|
1884
1846
|
throw new TypeError("illegal invocation");
|
|
1885
|
-
let { promise:
|
|
1847
|
+
let { promise: p, resolve, reject } = pWithResolvers();
|
|
1886
1848
|
let controller = new AbortController();
|
|
1887
1849
|
const internalOptions = { signal: anySignal([controller.signal, options.signal]) };
|
|
1888
1850
|
if (internalOptions.signal.aborted) {
|
|
1889
1851
|
reject(internalOptions.signal.reason);
|
|
1890
|
-
return
|
|
1852
|
+
return p;
|
|
1891
1853
|
}
|
|
1892
1854
|
internalOptions.signal.addEventListener("abort", () => {
|
|
1893
1855
|
reject(internalOptions.signal.reason);
|
|
@@ -1905,17 +1867,17 @@ var [Observable, Subscriber] = (() => {
|
|
|
1905
1867
|
}
|
|
1906
1868
|
});
|
|
1907
1869
|
subscribeTo(this, observer, internalOptions);
|
|
1908
|
-
return
|
|
1870
|
+
return p;
|
|
1909
1871
|
}
|
|
1910
1872
|
// https://wicg.github.io/observable/#dom-observable-last
|
|
1911
1873
|
last(options = {}) {
|
|
1912
1874
|
if (!(this instanceof Observable2))
|
|
1913
1875
|
throw new TypeError("illegal invocation");
|
|
1914
|
-
let { promise:
|
|
1876
|
+
let { promise: p, resolve, reject } = pWithResolvers();
|
|
1915
1877
|
if (options.signal) {
|
|
1916
1878
|
if (options.signal.aborted) {
|
|
1917
1879
|
reject(options.signal.reason);
|
|
1918
|
-
return
|
|
1880
|
+
return p;
|
|
1919
1881
|
}
|
|
1920
1882
|
options.signal.addEventListener("abort", () => {
|
|
1921
1883
|
reject(options.signal.reason);
|
|
@@ -1937,7 +1899,7 @@ var [Observable, Subscriber] = (() => {
|
|
|
1937
1899
|
}
|
|
1938
1900
|
});
|
|
1939
1901
|
subscribeTo(this, observer, options);
|
|
1940
|
-
return
|
|
1902
|
+
return p;
|
|
1941
1903
|
}
|
|
1942
1904
|
// https://wicg.github.io/observable/#dom-observable-find
|
|
1943
1905
|
find(predicate, options = {}) {
|
|
@@ -1945,12 +1907,12 @@ var [Observable, Subscriber] = (() => {
|
|
|
1945
1907
|
throw new TypeError("illegal invocation");
|
|
1946
1908
|
if (typeof predicate !== "function")
|
|
1947
1909
|
throw new TypeError(`Parameter 1 is not of type 'Function'`);
|
|
1948
|
-
let { promise:
|
|
1910
|
+
let { promise: p, resolve, reject } = pWithResolvers();
|
|
1949
1911
|
let controller = new AbortController();
|
|
1950
1912
|
const internalOptions = { signal: anySignal([controller.signal, options.signal]) };
|
|
1951
1913
|
if (internalOptions.signal.aborted) {
|
|
1952
1914
|
reject(internalOptions.signal.reason);
|
|
1953
|
-
return
|
|
1915
|
+
return p;
|
|
1954
1916
|
}
|
|
1955
1917
|
internalOptions.signal.addEventListener("abort", () => {
|
|
1956
1918
|
reject(internalOptions.signal.reason);
|
|
@@ -1961,9 +1923,9 @@ var [Observable, Subscriber] = (() => {
|
|
|
1961
1923
|
let passed = false;
|
|
1962
1924
|
try {
|
|
1963
1925
|
passed = predicate(value, idx);
|
|
1964
|
-
} catch (
|
|
1965
|
-
reject(
|
|
1966
|
-
controller.abort(
|
|
1926
|
+
} catch (e) {
|
|
1927
|
+
reject(e);
|
|
1928
|
+
controller.abort(e);
|
|
1967
1929
|
}
|
|
1968
1930
|
idx += 1;
|
|
1969
1931
|
if (passed) {
|
|
@@ -1979,7 +1941,7 @@ var [Observable, Subscriber] = (() => {
|
|
|
1979
1941
|
}
|
|
1980
1942
|
});
|
|
1981
1943
|
subscribeTo(this, observer, internalOptions);
|
|
1982
|
-
return
|
|
1944
|
+
return p;
|
|
1983
1945
|
}
|
|
1984
1946
|
// https://wicg.github.io/observable/#dom-observable-some
|
|
1985
1947
|
some(predicate, options = {}) {
|
|
@@ -1987,12 +1949,12 @@ var [Observable, Subscriber] = (() => {
|
|
|
1987
1949
|
throw new TypeError("illegal invocation");
|
|
1988
1950
|
if (typeof predicate !== "function")
|
|
1989
1951
|
throw new TypeError(`Parameter 1 is not of type 'Function'`);
|
|
1990
|
-
let { promise:
|
|
1952
|
+
let { promise: p, resolve, reject } = pWithResolvers();
|
|
1991
1953
|
let controller = new AbortController();
|
|
1992
1954
|
const internalOptions = { signal: anySignal([controller.signal, options.signal]) };
|
|
1993
1955
|
if (internalOptions.signal.aborted) {
|
|
1994
1956
|
reject(internalOptions.signal.reason);
|
|
1995
|
-
return
|
|
1957
|
+
return p;
|
|
1996
1958
|
}
|
|
1997
1959
|
internalOptions.signal.addEventListener("abort", () => {
|
|
1998
1960
|
reject(internalOptions.signal.reason);
|
|
@@ -2003,9 +1965,9 @@ var [Observable, Subscriber] = (() => {
|
|
|
2003
1965
|
let passed = false;
|
|
2004
1966
|
try {
|
|
2005
1967
|
passed = predicate(value, idx);
|
|
2006
|
-
} catch (
|
|
2007
|
-
reject(
|
|
2008
|
-
controller.abort(
|
|
1968
|
+
} catch (e) {
|
|
1969
|
+
reject(e);
|
|
1970
|
+
controller.abort(e);
|
|
2009
1971
|
}
|
|
2010
1972
|
idx += 1;
|
|
2011
1973
|
if (passed) {
|
|
@@ -2021,7 +1983,7 @@ var [Observable, Subscriber] = (() => {
|
|
|
2021
1983
|
}
|
|
2022
1984
|
});
|
|
2023
1985
|
subscribeTo(this, observer, internalOptions);
|
|
2024
|
-
return
|
|
1986
|
+
return p;
|
|
2025
1987
|
}
|
|
2026
1988
|
// https://wicg.github.io/observable/#dom-observable-reduce
|
|
2027
1989
|
reduce(reducer, initialValue, options = {}) {
|
|
@@ -2029,12 +1991,12 @@ var [Observable, Subscriber] = (() => {
|
|
|
2029
1991
|
throw new TypeError("illegal invocation");
|
|
2030
1992
|
if (typeof reducer !== "function")
|
|
2031
1993
|
throw new TypeError(`Parameter 1 is not of type 'Function'`);
|
|
2032
|
-
let { promise:
|
|
1994
|
+
let { promise: p, resolve, reject } = pWithResolvers();
|
|
2033
1995
|
const controller = new AbortController();
|
|
2034
1996
|
const internalOptions = { signal: anySignal([controller.signal, options.signal]) };
|
|
2035
1997
|
if (internalOptions.signal.aborted) {
|
|
2036
1998
|
reject(internalOptions.signal.reason);
|
|
2037
|
-
return
|
|
1999
|
+
return p;
|
|
2038
2000
|
}
|
|
2039
2001
|
internalOptions.signal.addEventListener("abort", () => {
|
|
2040
2002
|
reject(internalOptions.signal.reason);
|
|
@@ -2053,9 +2015,9 @@ var [Observable, Subscriber] = (() => {
|
|
|
2053
2015
|
const result = reducer(accumulator, value, idx);
|
|
2054
2016
|
idx++;
|
|
2055
2017
|
accumulator = result;
|
|
2056
|
-
} catch (
|
|
2057
|
-
reject(
|
|
2058
|
-
controller.abort(
|
|
2018
|
+
} catch (e) {
|
|
2019
|
+
reject(e);
|
|
2020
|
+
controller.abort(e);
|
|
2059
2021
|
return;
|
|
2060
2022
|
}
|
|
2061
2023
|
},
|
|
@@ -2073,7 +2035,7 @@ var [Observable, Subscriber] = (() => {
|
|
|
2073
2035
|
}
|
|
2074
2036
|
});
|
|
2075
2037
|
subscribeTo(this, observer, internalOptions);
|
|
2076
|
-
return
|
|
2038
|
+
return p;
|
|
2077
2039
|
}
|
|
2078
2040
|
}
|
|
2079
2041
|
enumerate(Observable2.prototype, "subscribe");
|
|
@@ -2343,17 +2305,17 @@ function isDraggableDisabled(target) {
|
|
|
2343
2305
|
return internals?.states?.has("disabled") ?? false;
|
|
2344
2306
|
}
|
|
2345
2307
|
var internalsOf = (el) => el?.internals;
|
|
2346
|
-
function setDragChipState(el,
|
|
2308
|
+
function setDragChipState(el, state11, on) {
|
|
2347
2309
|
const states = internalsOf(el)?.states;
|
|
2348
2310
|
if (!states)
|
|
2349
2311
|
return;
|
|
2350
2312
|
if (on)
|
|
2351
|
-
states.add(
|
|
2313
|
+
states.add(state11);
|
|
2352
2314
|
else
|
|
2353
|
-
states.delete(
|
|
2315
|
+
states.delete(state11);
|
|
2354
2316
|
}
|
|
2355
|
-
function hasDragChipState(el,
|
|
2356
|
-
return internalsOf(el)?.states?.has(
|
|
2317
|
+
function hasDragChipState(el, state11) {
|
|
2318
|
+
return internalsOf(el)?.states?.has(state11) ?? false;
|
|
2357
2319
|
}
|
|
2358
2320
|
function clearDragChipStates(el) {
|
|
2359
2321
|
setDragChipState(el, "dragging", false);
|
|
@@ -2662,15 +2624,15 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
2662
2624
|
console.error("\u274C [Observable DnD] No shadow root found!");
|
|
2663
2625
|
return;
|
|
2664
2626
|
}
|
|
2665
|
-
const pointerDragSub = shadowRoot.when("pointerdown").filter((
|
|
2666
|
-
if (!
|
|
2627
|
+
const pointerDragSub = shadowRoot.when("pointerdown").filter((e) => {
|
|
2628
|
+
if (!e.isTrusted) {
|
|
2667
2629
|
return false;
|
|
2668
2630
|
}
|
|
2669
|
-
const target = findDraggableTarget(
|
|
2631
|
+
const target = findDraggableTarget(e, draggablesSelector);
|
|
2670
2632
|
const hostDisabled = this.disabled || this.readonly;
|
|
2671
2633
|
const targetDisabled = isDraggableDisabled(target) || isDragChipHidden(target);
|
|
2672
2634
|
const touchHandledRecently = Date.now() - this.lastTouchStartAt < 50;
|
|
2673
|
-
return target &&
|
|
2635
|
+
return target && e.isPrimary !== false && e.button === 0 && !hostDisabled && !targetDisabled && !touchHandledRecently;
|
|
2674
2636
|
}).subscribe((downEvent) => {
|
|
2675
2637
|
this.lastPointerDownAt = Date.now();
|
|
2676
2638
|
const dragTarget = findDraggableTarget(downEvent, draggablesSelector);
|
|
@@ -2711,11 +2673,11 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
2711
2673
|
}
|
|
2712
2674
|
}, delay);
|
|
2713
2675
|
});
|
|
2714
|
-
const mouseDragSub = shadowRoot.when("mousedown").filter((
|
|
2715
|
-
const target = findDraggableTarget(
|
|
2676
|
+
const mouseDragSub = shadowRoot.when("mousedown").filter((e) => {
|
|
2677
|
+
const target = findDraggableTarget(e, draggablesSelector);
|
|
2716
2678
|
const hostDisabled = this.disabled || this.readonly;
|
|
2717
2679
|
const targetDisabled = isDraggableDisabled(target) || isDragChipHidden(target);
|
|
2718
|
-
const isLeftButton =
|
|
2680
|
+
const isLeftButton = e.button === 0;
|
|
2719
2681
|
const pointerHandledRecently = Date.now() - this.lastPointerDownAt < 50;
|
|
2720
2682
|
return target && isLeftButton && !hostDisabled && !targetDisabled && !pointerHandledRecently;
|
|
2721
2683
|
}).subscribe((downEvent) => {
|
|
@@ -2726,11 +2688,11 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
2726
2688
|
downEvent.preventDefault();
|
|
2727
2689
|
this.initiateDrag(dragTarget, downEvent.clientX, downEvent.clientY, "mouse", "mouse", void 0, downEvent.isTrusted);
|
|
2728
2690
|
});
|
|
2729
|
-
const touchDragSub = shadowRoot.when("touchstart").filter((
|
|
2730
|
-
const target = findDraggableTarget(
|
|
2691
|
+
const touchDragSub = shadowRoot.when("touchstart").filter((e) => {
|
|
2692
|
+
const target = findDraggableTarget(e, draggablesSelector);
|
|
2731
2693
|
const hostDisabled = this.disabled || this.readonly;
|
|
2732
2694
|
const targetDisabled = isDraggableDisabled(target) || isDragChipHidden(target);
|
|
2733
|
-
const hasTouchPoint = Boolean(
|
|
2695
|
+
const hasTouchPoint = Boolean(e.touches?.[0] || e.changedTouches?.[0]);
|
|
2734
2696
|
const pointerHandledRecently = Date.now() - this.lastPointerDownAt < 50;
|
|
2735
2697
|
return target && hasTouchPoint && !hostDisabled && !targetDisabled && !pointerHandledRecently;
|
|
2736
2698
|
}).subscribe((startEvent) => {
|
|
@@ -2751,15 +2713,15 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
2751
2713
|
dropIndex: 0,
|
|
2752
2714
|
dropElement: null
|
|
2753
2715
|
};
|
|
2754
|
-
const keyboardStream = shadowRoot.when("keydown").subscribe((
|
|
2716
|
+
const keyboardStream = shadowRoot.when("keydown").subscribe((e) => {
|
|
2755
2717
|
const draggables = this.trackedDraggables.filter((d) => !isDragChipHidden(d));
|
|
2756
2718
|
const dropTargets = [...this.trackedDroppables, ...this.trackedDragContainers];
|
|
2757
2719
|
if (!keyboardState.dragging) {
|
|
2758
|
-
const target = findDraggableTarget(
|
|
2720
|
+
const target = findDraggableTarget(e, draggablesSelector);
|
|
2759
2721
|
const hostDisabled = this.disabled || this.readonly;
|
|
2760
2722
|
const targetDisabled = isDraggableDisabled(target) || isDragChipHidden(target);
|
|
2761
|
-
if (target && ["Space", "Enter"].includes(
|
|
2762
|
-
|
|
2723
|
+
if (target && ["Space", "Enter"].includes(e.code) && !hostDisabled && !targetDisabled) {
|
|
2724
|
+
e.preventDefault();
|
|
2763
2725
|
target.setAttribute("data-keyboard-dragging", "true");
|
|
2764
2726
|
keyboardState = {
|
|
2765
2727
|
dragging: true,
|
|
@@ -2770,17 +2732,17 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
2770
2732
|
};
|
|
2771
2733
|
}
|
|
2772
2734
|
} else {
|
|
2773
|
-
switch (
|
|
2735
|
+
switch (e.code) {
|
|
2774
2736
|
case "ArrowRight":
|
|
2775
2737
|
case "ArrowDown": {
|
|
2776
|
-
|
|
2738
|
+
e.preventDefault();
|
|
2777
2739
|
const nextDropIndex = (keyboardState.dropIndex + 1) % dropTargets.length;
|
|
2778
2740
|
keyboardState = { ...keyboardState, dropIndex: nextDropIndex, dropElement: dropTargets[nextDropIndex] };
|
|
2779
2741
|
break;
|
|
2780
2742
|
}
|
|
2781
2743
|
case "ArrowLeft":
|
|
2782
2744
|
case "ArrowUp": {
|
|
2783
|
-
|
|
2745
|
+
e.preventDefault();
|
|
2784
2746
|
const prevDropIndex = (keyboardState.dropIndex - 1 + dropTargets.length) % dropTargets.length;
|
|
2785
2747
|
keyboardState = { ...keyboardState, dropIndex: prevDropIndex, dropElement: dropTargets[prevDropIndex] };
|
|
2786
2748
|
break;
|
|
@@ -2788,7 +2750,7 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
2788
2750
|
case "Space":
|
|
2789
2751
|
case "Enter":
|
|
2790
2752
|
case "Tab": {
|
|
2791
|
-
|
|
2753
|
+
e.preventDefault();
|
|
2792
2754
|
if (keyboardState.dragElement && keyboardState.dropElement) {
|
|
2793
2755
|
const canDrop = this.allowDrop(keyboardState.dragElement, keyboardState.dropElement) || this.trackedDragContainers.includes(keyboardState.dropElement);
|
|
2794
2756
|
if (canDrop) {
|
|
@@ -2809,7 +2771,7 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
2809
2771
|
break;
|
|
2810
2772
|
}
|
|
2811
2773
|
case "Escape": {
|
|
2812
|
-
|
|
2774
|
+
e.preventDefault();
|
|
2813
2775
|
this.trackedDraggables.forEach((d) => d.removeAttribute("data-keyboard-dragging"));
|
|
2814
2776
|
keyboardState = {
|
|
2815
2777
|
dragging: false,
|
|
@@ -2893,14 +2855,14 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
2893
2855
|
if (captureTarget && activePointerId !== void 0 && captureTarget.setPointerCapture) {
|
|
2894
2856
|
captureTarget.setPointerCapture(activePointerId);
|
|
2895
2857
|
}
|
|
2896
|
-
} catch (
|
|
2858
|
+
} catch (e) {
|
|
2897
2859
|
}
|
|
2898
2860
|
}
|
|
2899
|
-
const preventAllTouch = (
|
|
2900
|
-
if (
|
|
2901
|
-
|
|
2861
|
+
const preventAllTouch = (e) => {
|
|
2862
|
+
if (e.cancelable) {
|
|
2863
|
+
e.preventDefault();
|
|
2902
2864
|
if (eventSource === "pointer") {
|
|
2903
|
-
|
|
2865
|
+
e.stopPropagation();
|
|
2904
2866
|
}
|
|
2905
2867
|
}
|
|
2906
2868
|
};
|
|
@@ -2924,7 +2886,7 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
2924
2886
|
if (captureTarget && activePointerId !== void 0 && captureTarget.releasePointerCapture) {
|
|
2925
2887
|
captureTarget.releasePointerCapture(activePointerId);
|
|
2926
2888
|
}
|
|
2927
|
-
} catch (
|
|
2889
|
+
} catch (e) {
|
|
2928
2890
|
}
|
|
2929
2891
|
}
|
|
2930
2892
|
};
|
|
@@ -2937,56 +2899,56 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
2937
2899
|
return expected === void 0 || evt.isTrusted === expected;
|
|
2938
2900
|
};
|
|
2939
2901
|
const moveSub = document.when(moveEventName).takeUntil(document.when(upEventName)).subscribe({
|
|
2940
|
-
next: (
|
|
2941
|
-
if (!trustMatchesCurrentDrag(
|
|
2902
|
+
next: (e) => {
|
|
2903
|
+
if (!trustMatchesCurrentDrag(e)) {
|
|
2942
2904
|
return;
|
|
2943
2905
|
}
|
|
2944
|
-
|
|
2945
|
-
|
|
2906
|
+
e.preventDefault();
|
|
2907
|
+
e.stopPropagation();
|
|
2946
2908
|
if (eventSource === "touch") {
|
|
2947
|
-
const touch =
|
|
2909
|
+
const touch = e.touches?.[0] || e.changedTouches?.[0];
|
|
2948
2910
|
if (!touch)
|
|
2949
2911
|
return;
|
|
2950
2912
|
this.handleDragMove(touch.clientX, touch.clientY);
|
|
2951
2913
|
return;
|
|
2952
2914
|
}
|
|
2953
2915
|
if (eventSource === "mouse") {
|
|
2954
|
-
const mouseEvent =
|
|
2916
|
+
const mouseEvent = e;
|
|
2955
2917
|
if (typeof mouseEvent.buttons === "number" && (mouseEvent.buttons & 1) !== 1) {
|
|
2956
2918
|
return;
|
|
2957
2919
|
}
|
|
2958
2920
|
}
|
|
2959
|
-
this.handleDragMove(
|
|
2921
|
+
this.handleDragMove(e.clientX, e.clientY);
|
|
2960
2922
|
}
|
|
2961
2923
|
});
|
|
2962
2924
|
const endSub = document.when(upEventName).subscribe({
|
|
2963
|
-
next: (
|
|
2964
|
-
if (!trustMatchesCurrentDrag(
|
|
2925
|
+
next: (e) => {
|
|
2926
|
+
if (!trustMatchesCurrentDrag(e)) {
|
|
2965
2927
|
return;
|
|
2966
2928
|
}
|
|
2967
|
-
|
|
2968
|
-
|
|
2929
|
+
e.preventDefault();
|
|
2930
|
+
e.stopPropagation();
|
|
2969
2931
|
this.handleDragEnd();
|
|
2970
2932
|
}
|
|
2971
2933
|
});
|
|
2972
2934
|
const cancelSub = eventSource === "touch" ? document.when("touchcancel").subscribe({
|
|
2973
|
-
next: (
|
|
2974
|
-
if (!trustMatchesCurrentDrag(
|
|
2935
|
+
next: (e) => {
|
|
2936
|
+
if (!trustMatchesCurrentDrag(e)) {
|
|
2975
2937
|
return;
|
|
2976
2938
|
}
|
|
2977
2939
|
this.handleDragEnd();
|
|
2978
2940
|
}
|
|
2979
2941
|
}) : eventSource === "mouse" ? null : document.when("pointercancel").subscribe({
|
|
2980
|
-
next: (
|
|
2981
|
-
if (!trustMatchesCurrentDrag(
|
|
2942
|
+
next: (e) => {
|
|
2943
|
+
if (!trustMatchesCurrentDrag(e)) {
|
|
2982
2944
|
return;
|
|
2983
2945
|
}
|
|
2984
2946
|
this.handleDragEnd();
|
|
2985
2947
|
}
|
|
2986
2948
|
});
|
|
2987
|
-
const escapeSub = document.when("keydown").filter((
|
|
2988
|
-
next: (
|
|
2989
|
-
if (!trustMatchesCurrentDrag(
|
|
2949
|
+
const escapeSub = document.when("keydown").filter((e) => e.key === "Escape").subscribe({
|
|
2950
|
+
next: (e) => {
|
|
2951
|
+
if (!trustMatchesCurrentDrag(e)) {
|
|
2990
2952
|
return;
|
|
2991
2953
|
}
|
|
2992
2954
|
this.handleDragEnd();
|
|
@@ -3064,9 +3026,9 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
3064
3026
|
createDragClone(element, rect) {
|
|
3065
3027
|
const clone = element.cloneNode(true);
|
|
3066
3028
|
const computedStyles = window.getComputedStyle(element);
|
|
3067
|
-
for (let
|
|
3068
|
-
const
|
|
3069
|
-
clone.style.setProperty(
|
|
3029
|
+
for (let i = 0; i < computedStyles.length; i++) {
|
|
3030
|
+
const property20 = computedStyles[i];
|
|
3031
|
+
clone.style.setProperty(property20, computedStyles.getPropertyValue(property20));
|
|
3070
3032
|
}
|
|
3071
3033
|
const host = resolveDragCloneHost(element.isConnected ? element : this, this.dragCloneRoot());
|
|
3072
3034
|
this.cloneFrame = measureFixedFrame(host);
|
|
@@ -3198,21 +3160,21 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
3198
3160
|
returnAnchorItems: []
|
|
3199
3161
|
};
|
|
3200
3162
|
}
|
|
3201
|
-
setInternalsState(
|
|
3163
|
+
setInternalsState(state11, enabled) {
|
|
3202
3164
|
const internals = this._internals;
|
|
3203
3165
|
if (!internals?.states)
|
|
3204
3166
|
return;
|
|
3205
3167
|
if (enabled) {
|
|
3206
|
-
internals.states.add(
|
|
3168
|
+
internals.states.add(state11);
|
|
3207
3169
|
} else {
|
|
3208
|
-
internals.states.delete(
|
|
3170
|
+
internals.states.delete(state11);
|
|
3209
3171
|
}
|
|
3210
3172
|
}
|
|
3211
3173
|
cleanup() {
|
|
3212
3174
|
this.subscriptions.forEach((sub) => {
|
|
3213
3175
|
try {
|
|
3214
3176
|
sub.unsubscribe();
|
|
3215
|
-
} catch (
|
|
3177
|
+
} catch (e) {
|
|
3216
3178
|
}
|
|
3217
3179
|
});
|
|
3218
3180
|
this.subscriptions = [];
|
|
@@ -3232,6 +3194,10 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
3232
3194
|
return DragDropCoreElement;
|
|
3233
3195
|
};
|
|
3234
3196
|
|
|
3197
|
+
// ../interactions/core/dist/mixins/drag-drop-observables/drag-drop-slotted.mixin.js
|
|
3198
|
+
import { property as property7 } from "lit/decorators.js";
|
|
3199
|
+
import { provide } from "@lit/context";
|
|
3200
|
+
|
|
3235
3201
|
// ../interactions/core/dist/mixins/drag-drop-observables/utils/flip.utils.js
|
|
3236
3202
|
var DEFAULT_FLIP_OPTIONS = {
|
|
3237
3203
|
duration: 250,
|
|
@@ -3274,8 +3240,8 @@ function resolveMotionScale(element) {
|
|
|
3274
3240
|
const raw = getComputedStyle(element).getPropertyValue("--qti-motion").trim();
|
|
3275
3241
|
if (raw === "")
|
|
3276
3242
|
return 1;
|
|
3277
|
-
const
|
|
3278
|
-
return Number.isFinite(
|
|
3243
|
+
const n = Number.parseFloat(raw);
|
|
3244
|
+
return Number.isFinite(n) && n > 0 ? n : 0;
|
|
3279
3245
|
}
|
|
3280
3246
|
function motionEnabled(element) {
|
|
3281
3247
|
return resolveMotionScale(element) > 0;
|
|
@@ -3322,10 +3288,10 @@ function animateMultipleFlips(previousStates, options = {}) {
|
|
|
3322
3288
|
|
|
3323
3289
|
// ../interactions/core/dist/mixins/drag-drop-observables/drag-drop-slotted.mixin.js
|
|
3324
3290
|
var __decorate7 = function(decorators, target, key, desc) {
|
|
3325
|
-
var
|
|
3326
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3327
|
-
else for (var
|
|
3328
|
-
return
|
|
3291
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3292
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3293
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3294
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3329
3295
|
};
|
|
3330
3296
|
var DragDropSlottedMixin = (superClass, draggablesSelector, droppablesSelector, dragContainersSelector = 'slot[part="drags"]', collisionAlgorithm = "closestCornersWithInventoryPriority") => {
|
|
3331
3297
|
const AutoSized = DropzoneAutoSizeMixin(superClass, draggablesSelector, droppablesSelector, dragContainersSelector);
|
|
@@ -3839,7 +3805,7 @@ var DragDropSlottedMixin = (superClass, draggablesSelector, droppablesSelector,
|
|
|
3839
3805
|
const matchMax = getMatchMaxValue(this.trackedDraggables, identifier);
|
|
3840
3806
|
const placedInDropzones = this.trackedDroppables.reduce((count, droppable) => {
|
|
3841
3807
|
if (this.isDeclarativeTarget(droppable)) {
|
|
3842
|
-
return count + this.chipsIn(droppable).filter((
|
|
3808
|
+
return count + this.chipsIn(droppable).filter((c) => c.getAttribute("identifier") === identifier).length;
|
|
3843
3809
|
}
|
|
3844
3810
|
return count + droppable.querySelectorAll(`[identifier="${identifier}"]`).length;
|
|
3845
3811
|
}, 0);
|
|
@@ -3927,19 +3893,19 @@ var DragDropSlottedMixin = (superClass, draggablesSelector, droppablesSelector,
|
|
|
3927
3893
|
}
|
|
3928
3894
|
}
|
|
3929
3895
|
__decorate7([
|
|
3930
|
-
|
|
3896
|
+
property7({ type: Number, reflect: true, attribute: "min-associations" })
|
|
3931
3897
|
], DragDropSlottedElement.prototype, "minAssociations", void 0);
|
|
3932
3898
|
__decorate7([
|
|
3933
|
-
|
|
3899
|
+
property7({ type: Number, reflect: true, attribute: "max-associations" })
|
|
3934
3900
|
], DragDropSlottedElement.prototype, "maxAssociations", null);
|
|
3935
3901
|
__decorate7([
|
|
3936
|
-
|
|
3902
|
+
provide({ context: dragDropContext })
|
|
3937
3903
|
], DragDropSlottedElement.prototype, "_dragDrop", void 0);
|
|
3938
3904
|
__decorate7([
|
|
3939
|
-
|
|
3905
|
+
property7({ type: Boolean, attribute: "disable-animations" })
|
|
3940
3906
|
], DragDropSlottedElement.prototype, "disableAnimations", null);
|
|
3941
3907
|
__decorate7([
|
|
3942
|
-
|
|
3908
|
+
property7({
|
|
3943
3909
|
attribute: "response",
|
|
3944
3910
|
reflect: false,
|
|
3945
3911
|
noAccessor: true,
|
|
@@ -4236,11 +4202,12 @@ var DragDropSlottedSortableMixin = (superClass, sortableItemSelector = '[qti-dra
|
|
|
4236
4202
|
};
|
|
4237
4203
|
|
|
4238
4204
|
// ../interactions/associate-interaction/dist/qti-associate-interaction.styles.js
|
|
4205
|
+
import { css as css6 } from "lit";
|
|
4239
4206
|
var qti_associate_interaction_styles_default = [
|
|
4240
4207
|
boxSizing,
|
|
4241
4208
|
validationMessage,
|
|
4242
4209
|
dropRegion,
|
|
4243
|
-
|
|
4210
|
+
css6`
|
|
4244
4211
|
:host {
|
|
4245
4212
|
display: block; /* necessary to calculate scaling position */
|
|
4246
4213
|
}
|
|
@@ -4298,10 +4265,10 @@ var qti_associate_interaction_styles_default = [
|
|
|
4298
4265
|
|
|
4299
4266
|
// ../interactions/associate-interaction/dist/qti-associate-interaction.js
|
|
4300
4267
|
var __decorate8 = function(decorators, target, key, desc) {
|
|
4301
|
-
var
|
|
4302
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4303
|
-
else for (var
|
|
4304
|
-
return
|
|
4268
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4269
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4270
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4271
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4305
4272
|
};
|
|
4306
4273
|
var SlottedBase = DragDropSlottedMixin(Interaction, "qti-simple-associable-choice", `[part~='drop']`, `slot[name='qti-simple-associable-choice']`, "pointerWithin");
|
|
4307
4274
|
var QtiAssociateInteraction = class extends DragDropSlottedSortableMixin(SlottedBase, '[qti-draggable="true"]') {
|
|
@@ -4330,8 +4297,8 @@ var QtiAssociateInteraction = class extends DragDropSlottedSortableMixin(Slotted
|
|
|
4330
4297
|
*/
|
|
4331
4298
|
#renderDrop(identifier, name) {
|
|
4332
4299
|
const drags = this._dragDrop?.nodesByTarget?.[identifier] ?? [];
|
|
4333
|
-
return
|
|
4334
|
-
${
|
|
4300
|
+
return html6`<div name=${name} part="drop" data-declarative-drops identifier=${identifier}>
|
|
4301
|
+
${repeat2(drags, (node) => node.getAttribute("identifier"), (node) => node)}
|
|
4335
4302
|
</div>`;
|
|
4336
4303
|
}
|
|
4337
4304
|
/**
|
|
@@ -4351,9 +4318,9 @@ var QtiAssociateInteraction = class extends DragDropSlottedSortableMixin(Slotted
|
|
|
4351
4318
|
}
|
|
4352
4319
|
getResponse() {
|
|
4353
4320
|
const response = [];
|
|
4354
|
-
for (let
|
|
4355
|
-
const leftDrop = this.shadowRoot?.querySelector(`[part~='drop'][identifier="droplist${
|
|
4356
|
-
const rightDrop = this.shadowRoot?.querySelector(`[part~='drop'][identifier="droplist${
|
|
4321
|
+
for (let i = 0; i < this.#rowCount; i++) {
|
|
4322
|
+
const leftDrop = this.shadowRoot?.querySelector(`[part~='drop'][identifier="droplist${i}_left"]`);
|
|
4323
|
+
const rightDrop = this.shadowRoot?.querySelector(`[part~='drop'][identifier="droplist${i}_right"]`);
|
|
4357
4324
|
const leftId = leftDrop && this.chipsIn(leftDrop)[0]?.getAttribute("identifier");
|
|
4358
4325
|
const rightId = rightDrop && this.chipsIn(rightDrop)[0]?.getAttribute("identifier");
|
|
4359
4326
|
if (leftId && rightId) {
|
|
@@ -4379,18 +4346,18 @@ var QtiAssociateInteraction = class extends DragDropSlottedSortableMixin(Slotted
|
|
|
4379
4346
|
return this.getResponse().length;
|
|
4380
4347
|
}
|
|
4381
4348
|
getValue(val) {
|
|
4382
|
-
return val?.flatMap((pair,
|
|
4349
|
+
return val?.flatMap((pair, i) => {
|
|
4383
4350
|
const parts = pair.split(" ");
|
|
4384
4351
|
if (parts.length !== 2)
|
|
4385
4352
|
return [];
|
|
4386
|
-
return [`${parts[0]} droplist${
|
|
4353
|
+
return [`${parts[0]} droplist${i}_left`, `${parts[1]} droplist${i}_right`];
|
|
4387
4354
|
}) ?? [];
|
|
4388
4355
|
}
|
|
4389
4356
|
render() {
|
|
4390
|
-
return
|
|
4357
|
+
return html6` <slot name="prompt"></slot>
|
|
4391
4358
|
<slot part="drags" name="qti-simple-associable-choice"></slot>
|
|
4392
4359
|
<div part="drops">
|
|
4393
|
-
${this._childrenMap.length > 0 && Array.from({ length: this.#rowCount }, (_, index) =>
|
|
4360
|
+
${this._childrenMap.length > 0 && Array.from({ length: this.#rowCount }, (_, index) => html6`<div part="drop-row">
|
|
4394
4361
|
${this.#renderDrop(`droplist${index}_left`, `left${index}`)}
|
|
4395
4362
|
${this.#renderDrop(`droplist${index}_right`, `right${index}`)}
|
|
4396
4363
|
</div>`)}
|
|
@@ -4410,15 +4377,20 @@ var QtiAssociateInteraction = class extends DragDropSlottedSortableMixin(Slotted
|
|
|
4410
4377
|
}
|
|
4411
4378
|
};
|
|
4412
4379
|
__decorate8([
|
|
4413
|
-
|
|
4380
|
+
state3()
|
|
4414
4381
|
], QtiAssociateInteraction.prototype, "_childrenMap", void 0);
|
|
4415
4382
|
|
|
4383
|
+
// ../interactions/choice-interaction/dist/qti-choice-interaction.js
|
|
4384
|
+
import { html as html7 } from "lit";
|
|
4385
|
+
import { property as property10 } from "lit/decorators.js";
|
|
4386
|
+
|
|
4416
4387
|
// ../interactions/core/dist/mixins/choices/choices.mixin.js
|
|
4388
|
+
import { property as property8, query } from "lit/decorators.js";
|
|
4417
4389
|
var __decorate9 = function(decorators, target, key, desc) {
|
|
4418
|
-
var
|
|
4419
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4420
|
-
else for (var
|
|
4421
|
-
return
|
|
4390
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4391
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4392
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4393
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4422
4394
|
};
|
|
4423
4395
|
var ChoicesMixin = (superClass, selector) => {
|
|
4424
4396
|
class ChoicesMixinElement extends superClass {
|
|
@@ -4498,7 +4470,7 @@ var ChoicesMixin = (superClass, selector) => {
|
|
|
4498
4470
|
}
|
|
4499
4471
|
});
|
|
4500
4472
|
this._determineInputType();
|
|
4501
|
-
const validIdentifiers = new Set(this._choiceElements.map((
|
|
4473
|
+
const validIdentifiers = new Set(this._choiceElements.map((c) => c.identifier));
|
|
4502
4474
|
if (Array.isArray(this.response)) {
|
|
4503
4475
|
const filteredResponse = this.response.filter((id) => validIdentifiers.has(id));
|
|
4504
4476
|
if (filteredResponse.length !== this.response.length) {
|
|
@@ -4521,7 +4493,7 @@ var ChoicesMixin = (superClass, selector) => {
|
|
|
4521
4493
|
isValid = false;
|
|
4522
4494
|
validityMessage = this.dataset.minSelectionsMessage || `Please select at least ${this.minChoices} ${this.minChoices === 1 ? "option" : "options"}.`;
|
|
4523
4495
|
}
|
|
4524
|
-
const anchor = this._choiceElements.find((
|
|
4496
|
+
const anchor = this._choiceElements.find((c) => this.contains(c)) || this;
|
|
4525
4497
|
this.setInteractionValidity(isValid, validityMessage, anchor, { suppressInline: true });
|
|
4526
4498
|
return isValid;
|
|
4527
4499
|
}
|
|
@@ -4605,13 +4577,13 @@ var ChoicesMixin = (superClass, selector) => {
|
|
|
4605
4577
|
}
|
|
4606
4578
|
}
|
|
4607
4579
|
__decorate9([
|
|
4608
|
-
|
|
4580
|
+
query("#validation-message")
|
|
4609
4581
|
], ChoicesMixinElement.prototype, "_validationMessageElement", void 0);
|
|
4610
4582
|
__decorate9([
|
|
4611
|
-
|
|
4583
|
+
property8({ type: Number, attribute: "min-choices" })
|
|
4612
4584
|
], ChoicesMixinElement.prototype, "minChoices", void 0);
|
|
4613
4585
|
__decorate9([
|
|
4614
|
-
|
|
4586
|
+
property8({ type: Number, attribute: "max-choices" })
|
|
4615
4587
|
], ChoicesMixinElement.prototype, "maxChoices", void 0);
|
|
4616
4588
|
__decorate9([
|
|
4617
4589
|
watch("maxChoices")
|
|
@@ -4623,7 +4595,7 @@ var ChoicesMixin = (superClass, selector) => {
|
|
|
4623
4595
|
watch("readonly", { waitUntilFirstUpdate: true })
|
|
4624
4596
|
], ChoicesMixinElement.prototype, "_handleReadonlyChange", void 0);
|
|
4625
4597
|
__decorate9([
|
|
4626
|
-
|
|
4598
|
+
property8({
|
|
4627
4599
|
attribute: "response",
|
|
4628
4600
|
reflect: false,
|
|
4629
4601
|
converter: responseAttributeConverter({ emptyAs: "" })
|
|
@@ -4636,11 +4608,12 @@ var ChoicesMixin = (superClass, selector) => {
|
|
|
4636
4608
|
};
|
|
4637
4609
|
|
|
4638
4610
|
// ../interactions/core/dist/mixins/vocabulary/vocabulary-mixin.js
|
|
4611
|
+
import { property as property9 } from "lit/decorators.js";
|
|
4639
4612
|
var __decorate10 = function(decorators, target, key, desc) {
|
|
4640
|
-
var
|
|
4641
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4642
|
-
else for (var
|
|
4643
|
-
return
|
|
4613
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4614
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4615
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4616
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4644
4617
|
};
|
|
4645
4618
|
var VocabularyMixin = (superClass, _selector) => {
|
|
4646
4619
|
class VocabularyElement extends superClass {
|
|
@@ -4700,7 +4673,7 @@ var VocabularyMixin = (superClass, _selector) => {
|
|
|
4700
4673
|
return value.split(/\s+/).map((token) => token.trim()).filter(Boolean).filter((token, index, tokens) => tokens.indexOf(token) === index);
|
|
4701
4674
|
}
|
|
4702
4675
|
#syncLabels() {
|
|
4703
|
-
const choiceElements = Array.from(this.querySelectorAll("qti-simple-choice")).map((
|
|
4676
|
+
const choiceElements = Array.from(this.querySelectorAll("qti-simple-choice")).map((c) => c);
|
|
4704
4677
|
const choices = this.#getOrderedChoices(choiceElements);
|
|
4705
4678
|
const labelType = this.#getActiveLabelType();
|
|
4706
4679
|
const labelSuffixType = this.#getActiveLabelSuffixType();
|
|
@@ -4712,13 +4685,13 @@ var VocabularyMixin = (superClass, _selector) => {
|
|
|
4712
4685
|
return choiceElements.map((choice, index) => {
|
|
4713
4686
|
const order = Number(choice.style.order);
|
|
4714
4687
|
return { el: choice, order: Number.isFinite(order) ? order : index + 1, index };
|
|
4715
|
-
}).sort((a,
|
|
4688
|
+
}).sort((a, b) => a.order - b.order || a.index - b.index).map((choice) => choice.el);
|
|
4716
4689
|
}
|
|
4717
4690
|
#getActiveLabelType() {
|
|
4718
|
-
return this.#classes.filter((
|
|
4691
|
+
return this.#classes.filter((c) => this.#allLabels.includes(c)).pop() ?? null;
|
|
4719
4692
|
}
|
|
4720
4693
|
#getActiveLabelSuffixType() {
|
|
4721
|
-
return this.#classes.filter((
|
|
4694
|
+
return this.#classes.filter((c) => this.#allLabelSuffixes.includes(c)).pop() ?? null;
|
|
4722
4695
|
}
|
|
4723
4696
|
#getLabel(index, labelType, labelSuffixType) {
|
|
4724
4697
|
let effectiveLabelType = labelType;
|
|
@@ -4761,7 +4734,7 @@ var VocabularyMixin = (superClass, _selector) => {
|
|
|
4761
4734
|
}
|
|
4762
4735
|
}
|
|
4763
4736
|
__decorate10([
|
|
4764
|
-
|
|
4737
|
+
property9({
|
|
4765
4738
|
type: String,
|
|
4766
4739
|
attribute: "class"
|
|
4767
4740
|
})
|
|
@@ -4770,10 +4743,11 @@ var VocabularyMixin = (superClass, _selector) => {
|
|
|
4770
4743
|
};
|
|
4771
4744
|
|
|
4772
4745
|
// ../interactions/choice-interaction/dist/qti-choice-interaction.styles.js
|
|
4746
|
+
import { css as css7 } from "lit";
|
|
4773
4747
|
var qti_choice_interaction_styles_default = [
|
|
4774
4748
|
boxSizing,
|
|
4775
4749
|
validationMessage,
|
|
4776
|
-
|
|
4750
|
+
css7`
|
|
4777
4751
|
:host {
|
|
4778
4752
|
display: block;
|
|
4779
4753
|
}
|
|
@@ -4845,10 +4819,10 @@ var qti_choice_interaction_styles_default = [
|
|
|
4845
4819
|
|
|
4846
4820
|
// ../interactions/choice-interaction/dist/qti-choice-interaction.js
|
|
4847
4821
|
var __decorate11 = function(decorators, target, key, desc) {
|
|
4848
|
-
var
|
|
4849
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4850
|
-
else for (var
|
|
4851
|
-
return
|
|
4822
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4823
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4824
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4825
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4852
4826
|
};
|
|
4853
4827
|
var QtiChoiceInteraction = class extends VocabularyMixin(ChoicesMixin(Interaction, "qti-simple-choice"), "qti-simple-choice") {
|
|
4854
4828
|
constructor() {
|
|
@@ -4863,7 +4837,7 @@ var QtiChoiceInteraction = class extends VocabularyMixin(ChoicesMixin(Interactio
|
|
|
4863
4837
|
this.style.setProperty("--item-count", choices.length.toString());
|
|
4864
4838
|
}
|
|
4865
4839
|
render() {
|
|
4866
|
-
return
|
|
4840
|
+
return html7`
|
|
4867
4841
|
<slot part="prompt" name="prompt"></slot>
|
|
4868
4842
|
<slot part="slot" @slotchange=${this.#handleSlotChange}></slot>
|
|
4869
4843
|
<div part="message" role="alert" id="validation-message"></div>
|
|
@@ -4871,13 +4845,19 @@ var QtiChoiceInteraction = class extends VocabularyMixin(ChoicesMixin(Interactio
|
|
|
4871
4845
|
}
|
|
4872
4846
|
};
|
|
4873
4847
|
__decorate11([
|
|
4874
|
-
|
|
4848
|
+
property10({ type: String })
|
|
4875
4849
|
], QtiChoiceInteraction.prototype, "orientation", void 0);
|
|
4876
4850
|
|
|
4851
|
+
// ../interactions/extended-text-interaction/dist/qti-extended-text-interaction.js
|
|
4852
|
+
import { html as html8 } from "lit";
|
|
4853
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
4854
|
+
import { property as property11, state as state4 } from "lit/decorators.js";
|
|
4855
|
+
|
|
4877
4856
|
// ../interactions/extended-text-interaction/dist/qti-extended-text-interaction.styles.js
|
|
4857
|
+
import { css as css8 } from "lit";
|
|
4878
4858
|
var qti_extended_text_interaction_styles_default = [
|
|
4879
4859
|
boxSizing,
|
|
4880
|
-
|
|
4860
|
+
css8`
|
|
4881
4861
|
/* PK: display host as block, else design will be collapsed */
|
|
4882
4862
|
/* 'position: relative' anchors the correction glyph the theme draws over the textarea. */
|
|
4883
4863
|
:host {
|
|
@@ -4895,10 +4875,10 @@ var qti_extended_text_interaction_styles_default = [
|
|
|
4895
4875
|
|
|
4896
4876
|
// ../interactions/extended-text-interaction/dist/qti-extended-text-interaction.js
|
|
4897
4877
|
var __decorate12 = function(decorators, target, key, desc) {
|
|
4898
|
-
var
|
|
4899
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4900
|
-
else for (var
|
|
4901
|
-
return
|
|
4878
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4879
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4880
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4881
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4902
4882
|
};
|
|
4903
4883
|
var DEFAULT_ROWS = 5;
|
|
4904
4884
|
var CHARS_PER_ROW = 50;
|
|
@@ -5014,11 +4994,11 @@ var QtiExtendedTextInteraction = class extends Interaction {
|
|
|
5014
4994
|
*/
|
|
5015
4995
|
/** The prompt, above the field. */
|
|
5016
4996
|
renderPrompt() {
|
|
5017
|
-
return
|
|
4997
|
+
return html8`<slot name="prompt"></slot>`;
|
|
5018
4998
|
}
|
|
5019
4999
|
/** The field itself. */
|
|
5020
5000
|
renderTextarea() {
|
|
5021
|
-
return
|
|
5001
|
+
return html8`<textarea
|
|
5022
5002
|
part="textarea"
|
|
5023
5003
|
name="${this.responseIdentifier}"
|
|
5024
5004
|
spellcheck="false"
|
|
@@ -5030,7 +5010,7 @@ var QtiExtendedTextInteraction = class extends Interaction {
|
|
|
5030
5010
|
@blur="${(_) => {
|
|
5031
5011
|
this.reportValidity();
|
|
5032
5012
|
}}"
|
|
5033
|
-
placeholder="${
|
|
5013
|
+
placeholder="${ifDefined(this.placeholderText ? this.placeholderText : void 0)}"
|
|
5034
5014
|
rows="${this._rows}"
|
|
5035
5015
|
?disabled="${this.disabled}"
|
|
5036
5016
|
?readonly="${this.readonly}"
|
|
@@ -5039,10 +5019,10 @@ var QtiExtendedTextInteraction = class extends Interaction {
|
|
|
5039
5019
|
}
|
|
5040
5020
|
/** Hidden until `Interaction.reportValidity` shows it. */
|
|
5041
5021
|
renderValidationMessage() {
|
|
5042
|
-
return
|
|
5022
|
+
return html8`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`;
|
|
5043
5023
|
}
|
|
5044
5024
|
render() {
|
|
5045
|
-
return
|
|
5025
|
+
return html8`${this.renderPrompt()}${this.renderTextarea()} ${this.renderValidationMessage()}`;
|
|
5046
5026
|
}
|
|
5047
5027
|
textChanged(event) {
|
|
5048
5028
|
if (this.disabled || this.readonly)
|
|
@@ -5055,47 +5035,51 @@ var QtiExtendedTextInteraction = class extends Interaction {
|
|
|
5055
5035
|
}
|
|
5056
5036
|
};
|
|
5057
5037
|
__decorate12([
|
|
5058
|
-
|
|
5038
|
+
state4()
|
|
5059
5039
|
], QtiExtendedTextInteraction.prototype, "_rows", void 0);
|
|
5060
5040
|
__decorate12([
|
|
5061
|
-
|
|
5041
|
+
property11({ type: Number, attribute: "expected-length" })
|
|
5062
5042
|
], QtiExtendedTextInteraction.prototype, "expectedLength", void 0);
|
|
5063
5043
|
__decorate12([
|
|
5064
|
-
|
|
5044
|
+
property11({ type: Number, attribute: "expected-lines" })
|
|
5065
5045
|
], QtiExtendedTextInteraction.prototype, "expectedLines", void 0);
|
|
5066
5046
|
__decorate12([
|
|
5067
|
-
|
|
5047
|
+
property11({ type: String, reflect: true })
|
|
5068
5048
|
], QtiExtendedTextInteraction.prototype, "format", void 0);
|
|
5069
5049
|
__decorate12([
|
|
5070
5050
|
watch("format")
|
|
5071
5051
|
], QtiExtendedTextInteraction.prototype, "_handleFormatChange", void 0);
|
|
5072
5052
|
__decorate12([
|
|
5073
|
-
|
|
5053
|
+
property11({ type: String, attribute: "pattern-mask" })
|
|
5074
5054
|
], QtiExtendedTextInteraction.prototype, "patternMask", void 0);
|
|
5075
5055
|
__decorate12([
|
|
5076
|
-
|
|
5056
|
+
property11({ type: String, attribute: "placeholder-text" })
|
|
5077
5057
|
], QtiExtendedTextInteraction.prototype, "placeholderText", void 0);
|
|
5078
5058
|
__decorate12([
|
|
5079
|
-
|
|
5059
|
+
property11({ type: String, attribute: "data-patternmask-message" })
|
|
5080
5060
|
], QtiExtendedTextInteraction.prototype, "dataPatternmaskMessage", void 0);
|
|
5081
5061
|
__decorate12([
|
|
5082
|
-
|
|
5062
|
+
property11({ type: String, attribute: "class" })
|
|
5083
5063
|
], QtiExtendedTextInteraction.prototype, "classNames", void 0);
|
|
5084
5064
|
__decorate12([
|
|
5085
5065
|
watch(["classNames", "expectedLines", "expectedLength"])
|
|
5086
5066
|
], QtiExtendedTextInteraction.prototype, "_handleRowsInputChange", null);
|
|
5087
5067
|
__decorate12([
|
|
5088
|
-
|
|
5068
|
+
property11({ type: String, attribute: "response", reflect: false })
|
|
5089
5069
|
], QtiExtendedTextInteraction.prototype, "response", void 0);
|
|
5090
5070
|
__decorate12([
|
|
5091
5071
|
watch("response", { waitUntilFirstUpdate: true })
|
|
5092
5072
|
], QtiExtendedTextInteraction.prototype, "_handleResponseChange", void 0);
|
|
5093
5073
|
|
|
5074
|
+
// ../interactions/gap-match-interaction/dist/qti-gap-match-interaction.js
|
|
5075
|
+
import { html as html9 } from "lit";
|
|
5076
|
+
|
|
5094
5077
|
// ../interactions/gap-match-interaction/dist/qti-gap-match-interaction.styles.js
|
|
5078
|
+
import { css as css9 } from "lit";
|
|
5095
5079
|
var qti_gap_match_interaction_styles_default = [
|
|
5096
5080
|
boxSizing,
|
|
5097
5081
|
validationMessage,
|
|
5098
|
-
|
|
5082
|
+
css9`
|
|
5099
5083
|
:host {
|
|
5100
5084
|
display: flex;
|
|
5101
5085
|
align-items: flex-start;
|
|
@@ -5148,13 +5132,19 @@ var QtiGapMatchInteraction = class extends DragDropSlottedSortableMixin(DragDrop
|
|
|
5148
5132
|
this.styles = qti_gap_match_interaction_styles_default;
|
|
5149
5133
|
}
|
|
5150
5134
|
render() {
|
|
5151
|
-
return
|
|
5135
|
+
return html9`<slot name="prompt"> </slot>
|
|
5152
5136
|
<slot part="drags" name="drags"></slot>
|
|
5153
5137
|
<slot part="drops"></slot>
|
|
5154
5138
|
<div role="alert" part="message" id="validation-message"></div>`;
|
|
5155
5139
|
}
|
|
5156
5140
|
};
|
|
5157
5141
|
|
|
5142
|
+
// ../interactions/graphic-associate-interaction/dist/qti-graphic-associate-interaction.js
|
|
5143
|
+
import { html as html10, nothing as nothing2, svg } from "lit";
|
|
5144
|
+
import { property as property12, queryAssignedElements, state as state5 } from "lit/decorators.js";
|
|
5145
|
+
import { ifDefined as ifDefined2 } from "lit/directives/if-defined.js";
|
|
5146
|
+
import { repeat as repeat3 } from "lit/directives/repeat.js";
|
|
5147
|
+
|
|
5158
5148
|
// ../interactions/core/dist/internal/hotspots/hotspot.js
|
|
5159
5149
|
function positionShapes(shape, coordsNumber, img, hotspot) {
|
|
5160
5150
|
const imgWidth = img.getAttribute("width") ? parseFloat(img.getAttribute("width")) : img.naturalWidth;
|
|
@@ -5220,8 +5210,8 @@ function positionShapes(shape, coordsNumber, img, hotspot) {
|
|
|
5220
5210
|
return;
|
|
5221
5211
|
}
|
|
5222
5212
|
const polycoords = [];
|
|
5223
|
-
for (let
|
|
5224
|
-
polycoords.push({ x: coordsNumber[
|
|
5213
|
+
for (let i = 0; i < coordsNumber.length; i += 2) {
|
|
5214
|
+
polycoords.push({ x: coordsNumber[i], y: coordsNumber[i + 1] });
|
|
5225
5215
|
}
|
|
5226
5216
|
const leftX = Math.min(...polycoords.map((point) => point.x));
|
|
5227
5217
|
const rightX = Math.max(...polycoords.map((point) => point.x));
|
|
@@ -5239,9 +5229,9 @@ function positionShapes(shape, coordsNumber, img, hotspot) {
|
|
|
5239
5229
|
x: (point.x - leftX) / (rightX - leftX) * 100,
|
|
5240
5230
|
y: (point.y - topY) / (bottomY - topY) * 100
|
|
5241
5231
|
}));
|
|
5242
|
-
const polyD = polygonData.map((
|
|
5232
|
+
const polyD = polygonData.map((p) => `${p.x}% ${p.y}%`).join(",");
|
|
5243
5233
|
hotspot.style.clipPath = `polygon(${polyD})`;
|
|
5244
|
-
const svgPoints = polygonData.map((
|
|
5234
|
+
const svgPoints = polygonData.map((p) => `${p.x},${p.y}`).join(" ");
|
|
5245
5235
|
const outline = (strokeWidth) => `url("data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'><polygon points='${svgPoints}' fill='none' stroke='black' stroke-width='${strokeWidth}' vector-effect='non-scaling-stroke' stroke-linejoin='round'/></svg>`)}")`;
|
|
5246
5236
|
hotspot.style.setProperty("--qti-shape-outline", outline(4));
|
|
5247
5237
|
hotspot.style.setProperty("--qti-shape-outline-bold", outline(8));
|
|
@@ -5254,10 +5244,11 @@ function positionShapes(shape, coordsNumber, img, hotspot) {
|
|
|
5254
5244
|
}
|
|
5255
5245
|
|
|
5256
5246
|
// ../interactions/graphic-associate-interaction/dist/qti-graphic-associate-interaction.styles.js
|
|
5247
|
+
import { css as css10 } from "lit";
|
|
5257
5248
|
var qti_graphic_associate_interaction_styles_default = [
|
|
5258
5249
|
boxSizing,
|
|
5259
5250
|
validationMessage,
|
|
5260
|
-
|
|
5251
|
+
css10`
|
|
5261
5252
|
/* Containing block for the absolutely positioned hotspots over the image. Was on this host in
|
|
5262
5253
|
the theme, together with a 'display: block' this component now owns. */
|
|
5263
5254
|
:host {
|
|
@@ -5292,10 +5283,10 @@ var qti_graphic_associate_interaction_styles_default = [
|
|
|
5292
5283
|
|
|
5293
5284
|
// ../interactions/graphic-associate-interaction/dist/qti-graphic-associate-interaction.js
|
|
5294
5285
|
var __decorate13 = function(decorators, target, key, desc) {
|
|
5295
|
-
var
|
|
5296
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
5297
|
-
else for (var
|
|
5298
|
-
return
|
|
5286
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5287
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5288
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5289
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5299
5290
|
};
|
|
5300
5291
|
var QtiGraphicAssociateInteraction = class extends Interaction {
|
|
5301
5292
|
static {
|
|
@@ -5333,17 +5324,17 @@ var QtiGraphicAssociateInteraction = class extends Interaction {
|
|
|
5333
5324
|
}
|
|
5334
5325
|
/** Extension hook for optional SVG lines rendered above the candidate response. */
|
|
5335
5326
|
renderSupplementalLines() {
|
|
5336
|
-
return
|
|
5327
|
+
return nothing2;
|
|
5337
5328
|
}
|
|
5338
5329
|
render() {
|
|
5339
|
-
return
|
|
5330
|
+
return html10`<slot name="prompt"></slot>
|
|
5340
5331
|
<line-container>
|
|
5341
5332
|
<svg
|
|
5342
|
-
width=${
|
|
5343
|
-
height=${
|
|
5333
|
+
width=${ifDefined2(this.grImage[0]?.width)}
|
|
5334
|
+
height=${ifDefined2(this.grImage[0]?.height)}
|
|
5344
5335
|
viewbox="0 0 ${this.grImage[0]?.width} ${this.grImage[0]?.height}"
|
|
5345
5336
|
>
|
|
5346
|
-
${
|
|
5337
|
+
${repeat3(this.#getResponseArray(), (line) => line, (line, index) => svg`
|
|
5347
5338
|
<line
|
|
5348
5339
|
part="line"
|
|
5349
5340
|
x1=${parseInt(this.querySelector(`[identifier=${line.split(" ")[0]}]`).style.left)}
|
|
@@ -5352,15 +5343,15 @@ var QtiGraphicAssociateInteraction = class extends Interaction {
|
|
|
5352
5343
|
y2=${parseInt(this.querySelector(`[identifier=${line.split(" ")[1]}]`).style.top)}
|
|
5353
5344
|
stroke="red"
|
|
5354
5345
|
stroke-width="3"
|
|
5355
|
-
@click=${(
|
|
5356
|
-
|
|
5357
|
-
this._response = this._response.filter((_,
|
|
5346
|
+
@click=${(e) => {
|
|
5347
|
+
e.stopPropagation();
|
|
5348
|
+
this._response = this._response.filter((_, i) => i !== index);
|
|
5358
5349
|
this.saveResponse(this.response);
|
|
5359
5350
|
}}
|
|
5360
5351
|
/>
|
|
5361
5352
|
`)}
|
|
5362
5353
|
${this.renderSupplementalLines()}
|
|
5363
|
-
${this.#startPoint &&
|
|
5354
|
+
${this.#startPoint && svg`<line
|
|
5364
5355
|
part="point"
|
|
5365
5356
|
x1=${this.startCoord.x}
|
|
5366
5357
|
y1=${this.startCoord.y}
|
|
@@ -5374,9 +5365,9 @@ var QtiGraphicAssociateInteraction = class extends Interaction {
|
|
|
5374
5365
|
</line-container>
|
|
5375
5366
|
<div role="alert" part="message" id="validation-message"></div>`;
|
|
5376
5367
|
}
|
|
5377
|
-
#positionHotspotOnRegister(
|
|
5368
|
+
#positionHotspotOnRegister(e) {
|
|
5378
5369
|
const img = this.querySelector("img");
|
|
5379
|
-
const hotspot =
|
|
5370
|
+
const hotspot = e.target;
|
|
5380
5371
|
const coords = hotspot.getAttribute("coords");
|
|
5381
5372
|
const shape = hotspot.getAttribute("shape");
|
|
5382
5373
|
const coordsNumber = coords.split(",").map((s) => parseInt(s));
|
|
@@ -5427,19 +5418,19 @@ var QtiGraphicAssociateInteraction = class extends Interaction {
|
|
|
5427
5418
|
}
|
|
5428
5419
|
};
|
|
5429
5420
|
__decorate13([
|
|
5430
|
-
|
|
5421
|
+
state5()
|
|
5431
5422
|
], QtiGraphicAssociateInteraction.prototype, "startCoord", void 0);
|
|
5432
5423
|
__decorate13([
|
|
5433
|
-
|
|
5424
|
+
state5()
|
|
5434
5425
|
], QtiGraphicAssociateInteraction.prototype, "mouseCoord", void 0);
|
|
5435
5426
|
__decorate13([
|
|
5436
|
-
|
|
5427
|
+
queryAssignedElements({ selector: "img" })
|
|
5437
5428
|
], QtiGraphicAssociateInteraction.prototype, "grImage", void 0);
|
|
5438
5429
|
__decorate13([
|
|
5439
|
-
|
|
5430
|
+
state5()
|
|
5440
5431
|
], QtiGraphicAssociateInteraction.prototype, "_response", void 0);
|
|
5441
5432
|
__decorate13([
|
|
5442
|
-
|
|
5433
|
+
property12({
|
|
5443
5434
|
attribute: "response",
|
|
5444
5435
|
reflect: false,
|
|
5445
5436
|
noAccessor: true,
|
|
@@ -5447,11 +5438,15 @@ __decorate13([
|
|
|
5447
5438
|
})
|
|
5448
5439
|
], QtiGraphicAssociateInteraction.prototype, "response", null);
|
|
5449
5440
|
|
|
5441
|
+
// ../interactions/graphic-gap-match-interaction/dist/qti-graphic-gap-match-interaction.js
|
|
5442
|
+
import { html as html11 } from "lit";
|
|
5443
|
+
|
|
5450
5444
|
// ../interactions/graphic-gap-match-interaction/dist/qti-graphic-gap-match-interaction.styles.js
|
|
5445
|
+
import { css as css11 } from "lit";
|
|
5451
5446
|
var qti_graphic_gap_match_interaction_styles_default = [
|
|
5452
5447
|
boxSizing,
|
|
5453
5448
|
validationMessage,
|
|
5454
|
-
|
|
5449
|
+
css11`
|
|
5455
5450
|
:host {
|
|
5456
5451
|
display: flex;
|
|
5457
5452
|
align-items: flex-start;
|
|
@@ -5518,7 +5513,7 @@ var QtiGraphicGapMatchInteraction = class extends DragDropSlottedSortableMixin(S
|
|
|
5518
5513
|
this.styles = qti_graphic_gap_match_interaction_styles_default;
|
|
5519
5514
|
}
|
|
5520
5515
|
render() {
|
|
5521
|
-
return
|
|
5516
|
+
return html11` <slot name="prompt"></slot>
|
|
5522
5517
|
<slot part="image"></slot>
|
|
5523
5518
|
<slot part="drags" name="drags" class="hover-border"></slot>
|
|
5524
5519
|
<div role="alert" part="message" id="validation-message"></div>`;
|
|
@@ -5526,8 +5521,8 @@ var QtiGraphicGapMatchInteraction = class extends DragDropSlottedSortableMixin(S
|
|
|
5526
5521
|
shouldReturnToInventoryOnInventoryDrop() {
|
|
5527
5522
|
return true;
|
|
5528
5523
|
}
|
|
5529
|
-
#positionHotspotOnRegister(
|
|
5530
|
-
const hotspot =
|
|
5524
|
+
#positionHotspotOnRegister(e) {
|
|
5525
|
+
const hotspot = e.target;
|
|
5531
5526
|
const coords = hotspot.getAttribute("coords");
|
|
5532
5527
|
const shape = hotspot.getAttribute("shape");
|
|
5533
5528
|
const coordsNumber = coords.split(",").map((s) => parseInt(s));
|
|
@@ -5563,11 +5558,15 @@ var QtiGraphicGapMatchInteraction = class extends DragDropSlottedSortableMixin(S
|
|
|
5563
5558
|
}
|
|
5564
5559
|
};
|
|
5565
5560
|
|
|
5561
|
+
// ../interactions/graphic-order-interaction/dist/qti-graphic-order-interaction.js
|
|
5562
|
+
import { html as html12 } from "lit";
|
|
5563
|
+
|
|
5566
5564
|
// ../interactions/graphic-order-interaction/dist/qti-graphic-order-interaction.styles.js
|
|
5565
|
+
import { css as css12 } from "lit";
|
|
5567
5566
|
var qti_graphic_order_interaction_styles_default = [
|
|
5568
5567
|
boxSizing,
|
|
5569
5568
|
validationMessage,
|
|
5570
|
-
|
|
5569
|
+
css12`
|
|
5571
5570
|
/* The order pins are anchored outside their hotspot's box. */
|
|
5572
5571
|
:host {
|
|
5573
5572
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
@@ -5619,14 +5618,14 @@ var QtiGraphicOrderInteraction = class _QtiGraphicOrderInteraction extends Choic
|
|
|
5619
5618
|
}
|
|
5620
5619
|
static #LOCATOR_CLASS = "cito-graphic-order-marker";
|
|
5621
5620
|
render() {
|
|
5622
|
-
return
|
|
5621
|
+
return html12`
|
|
5623
5622
|
<slot name="prompt"></slot>
|
|
5624
5623
|
<slot></slot>
|
|
5625
5624
|
<div role="alert" part="message" id="validation-message"></div>
|
|
5626
5625
|
`;
|
|
5627
5626
|
}
|
|
5628
|
-
#setHotspotOrder(
|
|
5629
|
-
const { identifier } =
|
|
5627
|
+
#setHotspotOrder(e) {
|
|
5628
|
+
const { identifier } = e.detail;
|
|
5630
5629
|
const hotspot = this._choiceElements.find((el) => el.getAttribute("identifier") === identifier);
|
|
5631
5630
|
if (!hotspot)
|
|
5632
5631
|
return;
|
|
@@ -5634,7 +5633,7 @@ var QtiGraphicOrderInteraction = class _QtiGraphicOrderInteraction extends Choic
|
|
|
5634
5633
|
if (!this.choiceOrdering) {
|
|
5635
5634
|
this.choiceOrdering = true;
|
|
5636
5635
|
if (hotspot.order == null) {
|
|
5637
|
-
const currentSelection = this._choiceElements.filter((
|
|
5636
|
+
const currentSelection = this._choiceElements.filter((i) => i.order != null).length;
|
|
5638
5637
|
if (currentSelection >= maxSelection) {
|
|
5639
5638
|
this.choiceOrdering = false;
|
|
5640
5639
|
return;
|
|
@@ -5667,7 +5666,7 @@ var QtiGraphicOrderInteraction = class _QtiGraphicOrderInteraction extends Choic
|
|
|
5667
5666
|
this._choiceElements.forEach((choice) => {
|
|
5668
5667
|
choice.style.removeProperty("anchor-name");
|
|
5669
5668
|
});
|
|
5670
|
-
const orderedChoices = this._choiceElements.filter((choice) => choice.order != null).sort((a,
|
|
5669
|
+
const orderedChoices = this._choiceElements.filter((choice) => choice.order != null).sort((a, b) => a.order - b.order);
|
|
5671
5670
|
orderedChoices.forEach((choice) => {
|
|
5672
5671
|
const anchorName = this.#anchorNameForChoice(choice);
|
|
5673
5672
|
choice.style.setProperty("anchor-name", anchorName);
|
|
@@ -5683,9 +5682,9 @@ var QtiGraphicOrderInteraction = class _QtiGraphicOrderInteraction extends Choic
|
|
|
5683
5682
|
this.append(marker);
|
|
5684
5683
|
});
|
|
5685
5684
|
}
|
|
5686
|
-
#positionHotspotOnRegister(
|
|
5685
|
+
#positionHotspotOnRegister(e) {
|
|
5687
5686
|
const img = this.querySelector("img");
|
|
5688
|
-
const hotspot =
|
|
5687
|
+
const hotspot = e.target;
|
|
5689
5688
|
const coords = hotspot.getAttribute("coords");
|
|
5690
5689
|
const shape = hotspot.getAttribute("shape");
|
|
5691
5690
|
const coordsNumber = coords.split(",").map((s) => parseInt(s));
|
|
@@ -5705,11 +5704,15 @@ var QtiGraphicOrderInteraction = class _QtiGraphicOrderInteraction extends Choic
|
|
|
5705
5704
|
}
|
|
5706
5705
|
};
|
|
5707
5706
|
|
|
5707
|
+
// ../interactions/hotspot-interaction/dist/qti-hotspot-interaction.js
|
|
5708
|
+
import { html as html13 } from "lit";
|
|
5709
|
+
|
|
5708
5710
|
// ../interactions/hotspot-interaction/dist/qti-hotspot-interaction.styles.js
|
|
5711
|
+
import { css as css13 } from "lit";
|
|
5709
5712
|
var qti_hotspot_interaction_styles_default = [
|
|
5710
5713
|
boxSizing,
|
|
5711
5714
|
validationMessage,
|
|
5712
|
-
|
|
5715
|
+
css13`
|
|
5713
5716
|
:host {
|
|
5714
5717
|
display: block;
|
|
5715
5718
|
}
|
|
@@ -5767,7 +5770,7 @@ var QtiHotspotInteraction = class extends ChoicesMixin(Interaction, "qti-hotspot
|
|
|
5767
5770
|
this.styles = qti_hotspot_interaction_styles_default;
|
|
5768
5771
|
}
|
|
5769
5772
|
render() {
|
|
5770
|
-
return
|
|
5773
|
+
return html13`
|
|
5771
5774
|
<slot name="prompt"></slot>
|
|
5772
5775
|
<slot></slot>
|
|
5773
5776
|
<div part="message" role="alert" id="validation-message"></div>
|
|
@@ -5790,9 +5793,9 @@ var QtiHotspotInteraction = class extends ChoicesMixin(Interaction, "qti-hotspot
|
|
|
5790
5793
|
}
|
|
5791
5794
|
return this.#imageLoadPromise;
|
|
5792
5795
|
}
|
|
5793
|
-
async #positionHotspotOnRegister(
|
|
5796
|
+
async #positionHotspotOnRegister(e) {
|
|
5794
5797
|
const img = this.querySelector("img");
|
|
5795
|
-
const hotspot =
|
|
5798
|
+
const hotspot = e.target;
|
|
5796
5799
|
const coords = hotspot.getAttribute("coords");
|
|
5797
5800
|
const shape = hotspot.getAttribute("shape");
|
|
5798
5801
|
const coordsNumber = coords.split(",").map((s) => parseInt(s));
|
|
@@ -5809,11 +5812,15 @@ var QtiHotspotInteraction = class extends ChoicesMixin(Interaction, "qti-hotspot
|
|
|
5809
5812
|
}
|
|
5810
5813
|
};
|
|
5811
5814
|
|
|
5815
|
+
// ../interactions/hottext-interaction/dist/qti-hottext-interaction.js
|
|
5816
|
+
import { html as html14 } from "lit";
|
|
5817
|
+
|
|
5812
5818
|
// ../interactions/hottext-interaction/dist/qti-hottext-interaction.styles.js
|
|
5819
|
+
import { css as css14 } from "lit";
|
|
5813
5820
|
var qti_hottext_interaction_styles_default = [
|
|
5814
5821
|
boxSizing,
|
|
5815
5822
|
validationMessage,
|
|
5816
|
-
|
|
5823
|
+
css14`
|
|
5817
5824
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
5818
5825
|
:host {
|
|
5819
5826
|
display: block;
|
|
@@ -5825,7 +5832,7 @@ var qti_hottext_interaction_styles_default = [
|
|
|
5825
5832
|
var QtiHottextInteraction = class extends ChoicesMixin(Interaction, "qti-hottext") {
|
|
5826
5833
|
constructor() {
|
|
5827
5834
|
super(...arguments);
|
|
5828
|
-
this.render = () =>
|
|
5835
|
+
this.render = () => html14`<slot></slot>
|
|
5829
5836
|
<div part="message" role="alert" id="validation-message"></div>`;
|
|
5830
5837
|
}
|
|
5831
5838
|
static {
|
|
@@ -5833,6 +5840,11 @@ var QtiHottextInteraction = class extends ChoicesMixin(Interaction, "qti-hottext
|
|
|
5833
5840
|
}
|
|
5834
5841
|
};
|
|
5835
5842
|
|
|
5843
|
+
// ../interactions/inline-choice-interaction/dist/qti-inline-choice-interaction.js
|
|
5844
|
+
import { html as html15 } from "lit";
|
|
5845
|
+
import { property as property13, state as state6 } from "lit/decorators.js";
|
|
5846
|
+
import { consume as consume3 } from "@lit/context";
|
|
5847
|
+
|
|
5836
5848
|
// ../interactions/core/dist/mixins/menu-auto-size/menu-auto-size.mixin.js
|
|
5837
5849
|
var MenuAutoSizeMixin = (superClass, menuSelector = "[part='menu']", triggerSelector = "[part='trigger']", customProperty = "--qti-inline-choice-width") => {
|
|
5838
5850
|
class MenuAutoSizeElement extends superClass {
|
|
@@ -6018,7 +6030,8 @@ var MenuAutoSizeMixin = (superClass, menuSelector = "[part='menu']", triggerSele
|
|
|
6018
6030
|
};
|
|
6019
6031
|
|
|
6020
6032
|
// ../interactions/inline-choice-interaction/dist/qti-inline-choice-interaction.styles.js
|
|
6021
|
-
|
|
6033
|
+
import { css as css15 } from "lit";
|
|
6034
|
+
var own = css15`
|
|
6022
6035
|
/* ── Host ──────────────────────────────────────────────────────────────────
|
|
6023
6036
|
Inline-block so the element flows with surrounding text.
|
|
6024
6037
|
--qti-inline-choice-width is the single width control surface:
|
|
@@ -6205,10 +6218,10 @@ var qti_inline_choice_interaction_styles_default = styles;
|
|
|
6205
6218
|
|
|
6206
6219
|
// ../interactions/inline-choice-interaction/dist/qti-inline-choice-interaction.js
|
|
6207
6220
|
var __decorate14 = function(decorators, target, key, desc) {
|
|
6208
|
-
var
|
|
6209
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
6210
|
-
else for (var
|
|
6211
|
-
return
|
|
6221
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6222
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6223
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6224
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6212
6225
|
};
|
|
6213
6226
|
var inlineChoiceMenuCounter = 0;
|
|
6214
6227
|
var QtiInlineChoiceInteraction = class extends MenuAutoSizeMixin(Interaction) {
|
|
@@ -6312,7 +6325,7 @@ var QtiInlineChoiceInteraction = class extends MenuAutoSizeMixin(Interaction) {
|
|
|
6312
6325
|
/** The closed combobox — the box showing the chosen option. */
|
|
6313
6326
|
renderTrigger() {
|
|
6314
6327
|
const selected = this.#selectedOption();
|
|
6315
|
-
return
|
|
6328
|
+
return html15`
|
|
6316
6329
|
<button
|
|
6317
6330
|
part="trigger"
|
|
6318
6331
|
type="button"
|
|
@@ -6336,7 +6349,7 @@ var QtiInlineChoiceInteraction = class extends MenuAutoSizeMixin(Interaction) {
|
|
|
6336
6349
|
}
|
|
6337
6350
|
/** The popover listbox. */
|
|
6338
6351
|
renderMenu() {
|
|
6339
|
-
return
|
|
6352
|
+
return html15`
|
|
6340
6353
|
<div
|
|
6341
6354
|
id="${this._menuId}"
|
|
6342
6355
|
part="menu"
|
|
@@ -6360,10 +6373,10 @@ var QtiInlineChoiceInteraction = class extends MenuAutoSizeMixin(Interaction) {
|
|
|
6360
6373
|
}
|
|
6361
6374
|
/** Hidden until `Interaction.reportValidity` shows it. */
|
|
6362
6375
|
renderValidationMessage() {
|
|
6363
|
-
return
|
|
6376
|
+
return html15`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`;
|
|
6364
6377
|
}
|
|
6365
6378
|
render() {
|
|
6366
|
-
return
|
|
6379
|
+
return html15` ${this.renderTrigger()} ${this.renderMenu()} ${this.renderValidationMessage()} `;
|
|
6367
6380
|
}
|
|
6368
6381
|
async connectedCallback() {
|
|
6369
6382
|
super.connectedCallback();
|
|
@@ -6380,6 +6393,10 @@ var QtiInlineChoiceInteraction = class extends MenuAutoSizeMixin(Interaction) {
|
|
|
6380
6393
|
this._slotObserver?.disconnect();
|
|
6381
6394
|
this._slotObserver = null;
|
|
6382
6395
|
}
|
|
6396
|
+
/* `PropertyValues`, not `PropertyValues<this>`: the polymorphic `this` narrows the
|
|
6397
|
+
parameter per subclass and breaks structural compatibility with LitElement, which
|
|
6398
|
+
is what `Constructor<LitElement>` — the standard Lit mixin constraint — checks.
|
|
6399
|
+
See Interaction#firstUpdated in @qti-components/base. */
|
|
6383
6400
|
willUpdate(changed) {
|
|
6384
6401
|
if (changed.has("configContext")) {
|
|
6385
6402
|
this.#updateOptions();
|
|
@@ -6403,7 +6420,7 @@ var QtiInlineChoiceInteraction = class extends MenuAutoSizeMixin(Interaction) {
|
|
|
6403
6420
|
const choices = Array.from(this.querySelectorAll("qti-inline-choice"));
|
|
6404
6421
|
const prompt = this.dataPrompt || this.configContext?.inlineChoicePrompt || "select";
|
|
6405
6422
|
const pendingValue = this._pendingResponse;
|
|
6406
|
-
const currentlySelectedValue = pendingValue !== void 0 ? pendingValue ?? "" : this.options.find((
|
|
6423
|
+
const currentlySelectedValue = pendingValue !== void 0 ? pendingValue ?? "" : this.options.find((o) => o.selected)?.value ?? "";
|
|
6407
6424
|
const nextOptions = [
|
|
6408
6425
|
{
|
|
6409
6426
|
content: prompt,
|
|
@@ -6419,8 +6436,8 @@ var QtiInlineChoiceInteraction = class extends MenuAutoSizeMixin(Interaction) {
|
|
|
6419
6436
|
};
|
|
6420
6437
|
})
|
|
6421
6438
|
];
|
|
6422
|
-
const hasSelected = nextOptions.some((
|
|
6423
|
-
this.options = hasSelected ? nextOptions : nextOptions.map((
|
|
6439
|
+
const hasSelected = nextOptions.some((o) => o.selected);
|
|
6440
|
+
this.options = hasSelected ? nextOptions : nextOptions.map((o, i) => ({ ...o, selected: i === 0 }));
|
|
6424
6441
|
this._pendingResponse = void 0;
|
|
6425
6442
|
this.#syncSlottedChoices();
|
|
6426
6443
|
this.updateMenuWidth();
|
|
@@ -6436,7 +6453,7 @@ var QtiInlineChoiceInteraction = class extends MenuAutoSizeMixin(Interaction) {
|
|
|
6436
6453
|
shouldAutoSizeMenu() {
|
|
6437
6454
|
if (!this.configContext?.inlineChoiceAutosize)
|
|
6438
6455
|
return false;
|
|
6439
|
-
return !Array.from(this.classList).some((
|
|
6456
|
+
return !Array.from(this.classList).some((c) => c.startsWith("qti-input-width-"));
|
|
6440
6457
|
}
|
|
6441
6458
|
/**
|
|
6442
6459
|
* The chevron sits in the trigger and not in the menu, so the menu never measures it.
|
|
@@ -6465,7 +6482,7 @@ var QtiInlineChoiceInteraction = class extends MenuAutoSizeMixin(Interaction) {
|
|
|
6465
6482
|
}
|
|
6466
6483
|
reset() {
|
|
6467
6484
|
this.#setDropdownOpen(false);
|
|
6468
|
-
this.options = this.options.map((option,
|
|
6485
|
+
this.options = this.options.map((option, i) => ({ ...option, selected: i === 0 }));
|
|
6469
6486
|
this.#syncSlottedChoices();
|
|
6470
6487
|
}
|
|
6471
6488
|
set response(value) {
|
|
@@ -6571,23 +6588,23 @@ var QtiInlineChoiceInteraction = class extends MenuAutoSizeMixin(Interaction) {
|
|
|
6571
6588
|
}
|
|
6572
6589
|
};
|
|
6573
6590
|
__decorate14([
|
|
6574
|
-
|
|
6591
|
+
state6()
|
|
6575
6592
|
], QtiInlineChoiceInteraction.prototype, "options", void 0);
|
|
6576
6593
|
__decorate14([
|
|
6577
|
-
|
|
6594
|
+
state6()
|
|
6578
6595
|
], QtiInlineChoiceInteraction.prototype, "_dropdownOpen", void 0);
|
|
6579
6596
|
__decorate14([
|
|
6580
|
-
|
|
6581
|
-
|
|
6597
|
+
consume3({ context: configContext, subscribe: true }),
|
|
6598
|
+
property13({ attribute: false })
|
|
6582
6599
|
], QtiInlineChoiceInteraction.prototype, "configContext", void 0);
|
|
6583
6600
|
__decorate14([
|
|
6584
|
-
|
|
6601
|
+
property13({ type: String, attribute: "data-prompt" })
|
|
6585
6602
|
], QtiInlineChoiceInteraction.prototype, "dataPrompt", void 0);
|
|
6586
6603
|
__decorate14([
|
|
6587
6604
|
watch("dataPrompt", { waitUntilFirstUpdate: true })
|
|
6588
6605
|
], QtiInlineChoiceInteraction.prototype, "_handleDataPromptChange", void 0);
|
|
6589
6606
|
__decorate14([
|
|
6590
|
-
|
|
6607
|
+
property13({
|
|
6591
6608
|
type: Boolean,
|
|
6592
6609
|
reflect: true,
|
|
6593
6610
|
converter: {
|
|
@@ -6598,20 +6615,25 @@ __decorate14([
|
|
|
6598
6615
|
})
|
|
6599
6616
|
], QtiInlineChoiceInteraction.prototype, "required", void 0);
|
|
6600
6617
|
__decorate14([
|
|
6601
|
-
|
|
6618
|
+
property13({ type: Number, attribute: "min-choices" })
|
|
6602
6619
|
], QtiInlineChoiceInteraction.prototype, "minChoices", void 0);
|
|
6603
6620
|
__decorate14([
|
|
6604
6621
|
watch(["required", "minChoices"], { waitUntilFirstUpdate: true })
|
|
6605
6622
|
], QtiInlineChoiceInteraction.prototype, "_handleRequiredChange", void 0);
|
|
6606
6623
|
__decorate14([
|
|
6607
|
-
|
|
6624
|
+
property13({ attribute: "response", reflect: false, noAccessor: true })
|
|
6608
6625
|
], QtiInlineChoiceInteraction.prototype, "response", null);
|
|
6609
6626
|
|
|
6627
|
+
// ../interactions/match-interaction/dist/qti-match-interaction.js
|
|
6628
|
+
import { html as html16, nothing as nothing3 } from "lit";
|
|
6629
|
+
import { property as property14, state as state7 } from "lit/decorators.js";
|
|
6630
|
+
|
|
6610
6631
|
// ../interactions/match-interaction/dist/qti-match-interaction.styles.js
|
|
6632
|
+
import { css as css16 } from "lit";
|
|
6611
6633
|
var qti_match_interaction_styles_default = [
|
|
6612
6634
|
boxSizing,
|
|
6613
6635
|
validationMessage,
|
|
6614
|
-
|
|
6636
|
+
css16`
|
|
6615
6637
|
/*
|
|
6616
6638
|
* A custom element is inline unless it says otherwise, and this one never did. Its shadow content
|
|
6617
6639
|
* is block-level, so block-in-inline generated the anonymous block boxes and it looked correct —
|
|
@@ -6721,9 +6743,10 @@ var qti_match_interaction_styles_default = [
|
|
|
6721
6743
|
];
|
|
6722
6744
|
|
|
6723
6745
|
// ../interactions/match-interaction/dist/qti-match-interaction-tabular.styles.js
|
|
6746
|
+
import { css as css17 } from "lit";
|
|
6724
6747
|
var qti_match_interaction_tabular_styles_default = [
|
|
6725
6748
|
boxSizing,
|
|
6726
|
-
|
|
6749
|
+
css17`
|
|
6727
6750
|
:host(.qti-match-tabular) slot:not([hidden]) {
|
|
6728
6751
|
display: contents;
|
|
6729
6752
|
}
|
|
@@ -6784,10 +6807,10 @@ var qti_match_interaction_tabular_styles_default = [
|
|
|
6784
6807
|
|
|
6785
6808
|
// ../interactions/match-interaction/dist/qti-match-interaction.js
|
|
6786
6809
|
var __decorate15 = function(decorators, target, key, desc) {
|
|
6787
|
-
var
|
|
6788
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
6789
|
-
else for (var
|
|
6790
|
-
return
|
|
6810
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6811
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6812
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6813
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6791
6814
|
};
|
|
6792
6815
|
var QtiMatchInteraction = class extends DragDropSlottedSortableMixin(DragDropSlottedMixin(Interaction, "qti-simple-match-set:first-of-type qti-simple-associable-choice, qti-simple-match-set:last-of-type > qti-simple-associable-choice > qti-simple-associable-choice", "qti-simple-match-set:last-of-type > qti-simple-associable-choice", "qti-simple-match-set:first-of-type"), '[qti-draggable="true"]') {
|
|
6793
6816
|
constructor() {
|
|
@@ -6797,18 +6820,18 @@ var QtiMatchInteraction = class extends DragDropSlottedSortableMixin(DragDropSlo
|
|
|
6797
6820
|
this.class = "";
|
|
6798
6821
|
this._response = [];
|
|
6799
6822
|
this.responseIdentifier = "";
|
|
6800
|
-
this.handleRadioClick = (
|
|
6801
|
-
const radio =
|
|
6823
|
+
this.handleRadioClick = (e) => {
|
|
6824
|
+
const radio = e.target;
|
|
6802
6825
|
if (this.lastCheckedRadio === radio) {
|
|
6803
6826
|
radio.checked = false;
|
|
6804
6827
|
this.lastCheckedRadio = null;
|
|
6805
|
-
this.handleRadioChange(
|
|
6828
|
+
this.handleRadioChange(e);
|
|
6806
6829
|
} else {
|
|
6807
6830
|
this.lastCheckedRadio = radio;
|
|
6808
6831
|
}
|
|
6809
6832
|
};
|
|
6810
|
-
this.handleRadioChange = (
|
|
6811
|
-
const checkbox =
|
|
6833
|
+
this.handleRadioChange = (e) => {
|
|
6834
|
+
const checkbox = e.target;
|
|
6812
6835
|
const value = checkbox.value;
|
|
6813
6836
|
const name = checkbox.name;
|
|
6814
6837
|
const type = checkbox.type;
|
|
@@ -6817,13 +6840,13 @@ var QtiMatchInteraction = class extends DragDropSlottedSortableMixin(DragDropSlo
|
|
|
6817
6840
|
this.response = [value];
|
|
6818
6841
|
} else if (this.response.indexOf(value) === -1) {
|
|
6819
6842
|
if (type === "radio") {
|
|
6820
|
-
this.response = (this.response || []).filter((
|
|
6843
|
+
this.response = (this.response || []).filter((v) => v.indexOf(name) === -1);
|
|
6821
6844
|
}
|
|
6822
6845
|
this.response = [...this.response, value];
|
|
6823
6846
|
}
|
|
6824
6847
|
this.lastCheckedRadio = checkbox;
|
|
6825
6848
|
} else {
|
|
6826
|
-
this.response = (this.response || []).filter((
|
|
6849
|
+
this.response = (this.response || []).filter((v) => v !== value);
|
|
6827
6850
|
this.lastCheckedRadio = null;
|
|
6828
6851
|
}
|
|
6829
6852
|
this.requestUpdate();
|
|
@@ -6890,27 +6913,27 @@ var QtiMatchInteraction = class extends DragDropSlottedSortableMixin(DragDropSlo
|
|
|
6890
6913
|
const sets = this.querySelectorAll(":scope > qti-simple-match-set");
|
|
6891
6914
|
const sourceSet = sets[0];
|
|
6892
6915
|
const targetSet = sets[1];
|
|
6893
|
-
const stripSizing = (
|
|
6894
|
-
|
|
6895
|
-
|
|
6896
|
-
|
|
6916
|
+
const stripSizing = (c) => {
|
|
6917
|
+
c.style.removeProperty("min-width");
|
|
6918
|
+
c.style.removeProperty("min-height");
|
|
6919
|
+
c.style.removeProperty("--qti-dropzone-min-height");
|
|
6897
6920
|
};
|
|
6898
6921
|
if (isTabular) {
|
|
6899
6922
|
sourceSet?.setAttribute("slot", "match-rows");
|
|
6900
6923
|
targetSet?.setAttribute("slot", "match-cols");
|
|
6901
|
-
this.sourceChoices?.forEach((
|
|
6902
|
-
stripSizing(
|
|
6903
|
-
|
|
6924
|
+
this.sourceChoices?.forEach((c) => {
|
|
6925
|
+
stripSizing(c);
|
|
6926
|
+
c.setAttribute("role", "rowheader");
|
|
6904
6927
|
});
|
|
6905
|
-
this.targetChoices?.forEach((
|
|
6906
|
-
stripSizing(
|
|
6907
|
-
|
|
6928
|
+
this.targetChoices?.forEach((c) => {
|
|
6929
|
+
stripSizing(c);
|
|
6930
|
+
c.setAttribute("role", "columnheader");
|
|
6908
6931
|
});
|
|
6909
6932
|
} else {
|
|
6910
6933
|
sourceSet?.removeAttribute("slot");
|
|
6911
6934
|
targetSet?.removeAttribute("slot");
|
|
6912
|
-
this.sourceChoices?.forEach((
|
|
6913
|
-
this.targetChoices?.forEach((
|
|
6935
|
+
this.sourceChoices?.forEach((c) => c.removeAttribute("role"));
|
|
6936
|
+
this.targetChoices?.forEach((c) => c.removeAttribute("role"));
|
|
6914
6937
|
}
|
|
6915
6938
|
}
|
|
6916
6939
|
validate() {
|
|
@@ -6926,11 +6949,11 @@ var QtiMatchInteraction = class extends DragDropSlottedSortableMixin(DragDropSlo
|
|
|
6926
6949
|
}
|
|
6927
6950
|
render() {
|
|
6928
6951
|
const isTabular = this.class.split(" ").includes("qti-match-tabular");
|
|
6929
|
-
return
|
|
6952
|
+
return html16`
|
|
6930
6953
|
<slot name="prompt"></slot>
|
|
6931
6954
|
<slot ?hidden=${isTabular}></slot>
|
|
6932
6955
|
|
|
6933
|
-
${isTabular ?
|
|
6956
|
+
${isTabular ? html16`
|
|
6934
6957
|
<div
|
|
6935
6958
|
part="grid"
|
|
6936
6959
|
role="grid"
|
|
@@ -6940,13 +6963,13 @@ var QtiMatchInteraction = class extends DragDropSlottedSortableMixin(DragDropSlo
|
|
|
6940
6963
|
<div part="cols-wrap" role="row"><slot name="match-cols" part="c-header"></slot></div>
|
|
6941
6964
|
<div part="rows-wrap"><slot name="match-rows" part="r-header"></slot></div>
|
|
6942
6965
|
<div part="checkbox-grid">
|
|
6943
|
-
${this.sourceChoices.map((row,
|
|
6966
|
+
${this.sourceChoices.map((row, r) => html16`
|
|
6944
6967
|
<div role="row" style="display: contents;">
|
|
6945
|
-
${this.targetChoices.map((col,
|
|
6968
|
+
${this.targetChoices.map((col, c) => {
|
|
6946
6969
|
const rowId = row.getAttribute("identifier");
|
|
6947
6970
|
const colId = col.getAttribute("identifier");
|
|
6948
6971
|
const value = `${rowId} ${colId}`;
|
|
6949
|
-
const selectedInRowCount = (this.response || []).filter((
|
|
6972
|
+
const selectedInRowCount = (this.response || []).filter((v) => v.split(" ")[0] === rowId).length || 0;
|
|
6950
6973
|
const checked = this.response?.includes(value) || false;
|
|
6951
6974
|
const type = row.matchMax === 1 ? "radio" : "checkbox";
|
|
6952
6975
|
const stateVariant = this.getCellStateVariant(value, checked);
|
|
@@ -6954,11 +6977,11 @@ var QtiMatchInteraction = class extends DragDropSlottedSortableMixin(DragDropSlo
|
|
|
6954
6977
|
const controlPart = `control ${type} ${checkedMarker} ${stateVariant}`.trim();
|
|
6955
6978
|
const controlMarkPart = `control-mark ${type} ${checkedMarker} ${stateVariant}`.trim();
|
|
6956
6979
|
const disable = row.matchMax === 1 ? false : row.matchMax !== 0 && selectedInRowCount >= row.matchMax && !checked;
|
|
6957
|
-
return
|
|
6980
|
+
return html16`
|
|
6958
6981
|
<label
|
|
6959
6982
|
part="input-cell"
|
|
6960
6983
|
role="gridcell"
|
|
6961
|
-
style="grid-row: ${
|
|
6984
|
+
style="grid-row: ${r + 1}; grid-column: ${c + 1}; display: flex; align-items: center; justify-content: center; cursor: pointer;"
|
|
6962
6985
|
>
|
|
6963
6986
|
<input
|
|
6964
6987
|
type=${type}
|
|
@@ -6967,8 +6990,8 @@ var QtiMatchInteraction = class extends DragDropSlottedSortableMixin(DragDropSlo
|
|
|
6967
6990
|
value=${value}
|
|
6968
6991
|
.checked=${checked}
|
|
6969
6992
|
.disabled=${disable}
|
|
6970
|
-
@change=${(
|
|
6971
|
-
@click=${(
|
|
6993
|
+
@change=${(e) => this.handleRadioChange(e)}
|
|
6994
|
+
@click=${(e) => row.matchMax === 1 ? this.handleRadioClick(e) : null}
|
|
6972
6995
|
/>
|
|
6973
6996
|
<span part=${controlPart} role=${type} aria-checked=${checked ? "true" : "false"}>
|
|
6974
6997
|
<span part=${controlMarkPart}></span>
|
|
@@ -6980,28 +7003,34 @@ var QtiMatchInteraction = class extends DragDropSlottedSortableMixin(DragDropSlo
|
|
|
6980
7003
|
`)}
|
|
6981
7004
|
</div>
|
|
6982
7005
|
</div>
|
|
6983
|
-
` :
|
|
7006
|
+
` : nothing3}
|
|
6984
7007
|
|
|
6985
7008
|
<div role="alert" part="message" id="validation-message"></div>
|
|
6986
7009
|
`;
|
|
6987
7010
|
}
|
|
6988
7011
|
};
|
|
6989
7012
|
__decorate15([
|
|
6990
|
-
|
|
7013
|
+
property14({ type: String })
|
|
6991
7014
|
], QtiMatchInteraction.prototype, "class", void 0);
|
|
6992
7015
|
__decorate15([
|
|
6993
|
-
|
|
7016
|
+
state7()
|
|
6994
7017
|
], QtiMatchInteraction.prototype, "_response", void 0);
|
|
6995
7018
|
__decorate15([
|
|
6996
|
-
|
|
7019
|
+
property14({ type: String, attribute: "response-identifier" })
|
|
6997
7020
|
], QtiMatchInteraction.prototype, "responseIdentifier", void 0);
|
|
6998
7021
|
|
|
7022
|
+
// ../interactions/order-interaction/dist/qti-order-interaction.js
|
|
7023
|
+
import { html as html17 } from "lit";
|
|
7024
|
+
import { repeat as repeat4 } from "lit/directives/repeat.js";
|
|
7025
|
+
import { property as property15, state as state8 } from "lit/decorators.js";
|
|
7026
|
+
|
|
6999
7027
|
// ../interactions/order-interaction/dist/qti-order-interaction.styles.js
|
|
7028
|
+
import { css as css18 } from "lit";
|
|
7000
7029
|
var qti_order_interaction_styles_default = [
|
|
7001
7030
|
boxSizing,
|
|
7002
7031
|
validationMessage,
|
|
7003
7032
|
dropRegion,
|
|
7004
|
-
|
|
7033
|
+
css18`
|
|
7005
7034
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
7006
7035
|
:host {
|
|
7007
7036
|
display: block;
|
|
@@ -7216,10 +7245,10 @@ var qti_order_interaction_styles_default = [
|
|
|
7216
7245
|
|
|
7217
7246
|
// ../interactions/order-interaction/dist/qti-order-interaction.js
|
|
7218
7247
|
var __decorate16 = function(decorators, target, key, desc) {
|
|
7219
|
-
var
|
|
7220
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
7221
|
-
else for (var
|
|
7222
|
-
return
|
|
7248
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7249
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7250
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7251
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7223
7252
|
};
|
|
7224
7253
|
var SlottedBase3 = DragDropSlottedMixin(Interaction, `qti-simple-choice`, `[part~='drop']`, `slot[part~='drags']`);
|
|
7225
7254
|
var QtiOrderInteraction = class extends DragDropSlottedSortableMixin(SlottedBase3, '[qti-draggable="true"]') {
|
|
@@ -7235,15 +7264,15 @@ var QtiOrderInteraction = class extends DragDropSlottedSortableMixin(SlottedBase
|
|
|
7235
7264
|
if (this.nrChoices < choices.length) {
|
|
7236
7265
|
this.nrChoices = choices.length;
|
|
7237
7266
|
}
|
|
7238
|
-
return
|
|
7267
|
+
return html17` <slot name="prompt"> </slot>
|
|
7239
7268
|
<div part="container">
|
|
7240
7269
|
<slot part="drags"> </slot>
|
|
7241
7270
|
<div part="drops">
|
|
7242
|
-
${[...Array(this.nrChoices)].map((_,
|
|
7243
|
-
const identifier = `droplist${
|
|
7271
|
+
${[...Array(this.nrChoices)].map((_, i) => {
|
|
7272
|
+
const identifier = `droplist${i}`;
|
|
7244
7273
|
const drags = this._dragDrop?.nodesByTarget?.[identifier] ?? [];
|
|
7245
|
-
return
|
|
7246
|
-
${
|
|
7274
|
+
return html17`<div role="region" part="drop" data-declarative-drops identifier=${identifier}>
|
|
7275
|
+
${repeat4(drags, (node) => node.getAttribute("identifier"), (node) => node)}
|
|
7247
7276
|
</div>`;
|
|
7248
7277
|
})}
|
|
7249
7278
|
</div>
|
|
@@ -7255,7 +7284,7 @@ var QtiOrderInteraction = class extends DragDropSlottedSortableMixin(SlottedBase
|
|
|
7255
7284
|
// you have to implement your own getResponse method in the superclass
|
|
7256
7285
|
// cause they are different for some interactions.
|
|
7257
7286
|
getValue(val) {
|
|
7258
|
-
return val?.map((
|
|
7287
|
+
return val?.map((v, i) => `${v} droplist${i}`) || [];
|
|
7259
7288
|
}
|
|
7260
7289
|
// some interactions have a different way of getting the response
|
|
7261
7290
|
// this is called from the drag and drop mixin class
|
|
@@ -7275,16 +7304,22 @@ var QtiOrderInteraction = class extends DragDropSlottedSortableMixin(SlottedBase
|
|
|
7275
7304
|
}
|
|
7276
7305
|
};
|
|
7277
7306
|
__decorate16([
|
|
7278
|
-
|
|
7307
|
+
state8()
|
|
7279
7308
|
], QtiOrderInteraction.prototype, "nrChoices", void 0);
|
|
7280
7309
|
__decorate16([
|
|
7281
|
-
|
|
7310
|
+
property15({ type: String })
|
|
7282
7311
|
], QtiOrderInteraction.prototype, "orientation", void 0);
|
|
7283
7312
|
|
|
7313
|
+
// ../interactions/portable-custom-interaction/dist/qti-portable-custom-interaction.js
|
|
7314
|
+
import { css as css20, html as html18 } from "lit";
|
|
7315
|
+
import { property as property16, state as state9 } from "lit/decorators.js";
|
|
7316
|
+
import { consume as consume4 } from "@lit/context";
|
|
7317
|
+
|
|
7284
7318
|
// ../interactions/portable-custom-interaction/dist/qti-portable-custom-interaction.styles.js
|
|
7319
|
+
import { css as css19 } from "lit";
|
|
7285
7320
|
var qti_portable_custom_interaction_styles_default = [
|
|
7286
7321
|
boxSizing,
|
|
7287
|
-
|
|
7322
|
+
css19`
|
|
7288
7323
|
:host {
|
|
7289
7324
|
display: block;
|
|
7290
7325
|
width: 100%;
|
|
@@ -7299,10 +7334,10 @@ var qti_portable_custom_interaction_styles_default = [
|
|
|
7299
7334
|
|
|
7300
7335
|
// ../interactions/portable-custom-interaction/dist/qti-portable-custom-interaction.js
|
|
7301
7336
|
var __decorate17 = function(decorators, target, key, desc) {
|
|
7302
|
-
var
|
|
7303
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
7304
|
-
else for (var
|
|
7305
|
-
return
|
|
7337
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7338
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7339
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7340
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7306
7341
|
};
|
|
7307
7342
|
var STATUSES_SHOWING_CORRECT_RESPONSE = ["solution", "review"];
|
|
7308
7343
|
function hasCorrectResponseValue(value) {
|
|
@@ -7385,30 +7420,30 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
7385
7420
|
this.#pciCustomValidityMessage = pciCustomValidity;
|
|
7386
7421
|
}
|
|
7387
7422
|
const stateRaw = data?.params?.state;
|
|
7388
|
-
let
|
|
7423
|
+
let state11;
|
|
7389
7424
|
if (stateRaw === void 0) {
|
|
7390
|
-
|
|
7425
|
+
state11 = void 0;
|
|
7391
7426
|
} else if (stateRaw === null) {
|
|
7392
|
-
|
|
7427
|
+
state11 = null;
|
|
7393
7428
|
} else if (typeof stateRaw === "string") {
|
|
7394
|
-
|
|
7429
|
+
state11 = stateRaw;
|
|
7395
7430
|
} else {
|
|
7396
7431
|
try {
|
|
7397
|
-
|
|
7432
|
+
state11 = `__qti_json__::${JSON.stringify(stateRaw)}`;
|
|
7398
7433
|
} catch {
|
|
7399
|
-
|
|
7434
|
+
state11 = null;
|
|
7400
7435
|
}
|
|
7401
7436
|
}
|
|
7402
7437
|
if (converted === null) {
|
|
7403
7438
|
const emptyResponse = this.responseVariable?.cardinality === "single" ? "" : [];
|
|
7404
7439
|
this.response = emptyResponse;
|
|
7405
7440
|
this.validate();
|
|
7406
|
-
this.saveResponse(emptyResponse,
|
|
7441
|
+
this.saveResponse(emptyResponse, state11);
|
|
7407
7442
|
break;
|
|
7408
7443
|
}
|
|
7409
7444
|
this.response = converted;
|
|
7410
7445
|
this.validate();
|
|
7411
|
-
this.saveResponse(converted,
|
|
7446
|
+
this.saveResponse(converted, state11);
|
|
7412
7447
|
break;
|
|
7413
7448
|
}
|
|
7414
7449
|
case "error":
|
|
@@ -7423,7 +7458,7 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
7423
7458
|
static {
|
|
7424
7459
|
this.styles = [
|
|
7425
7460
|
qti_portable_custom_interaction_styles_default,
|
|
7426
|
-
|
|
7461
|
+
css20`
|
|
7427
7462
|
:host {
|
|
7428
7463
|
display: block;
|
|
7429
7464
|
width: 100%;
|
|
@@ -7500,9 +7535,9 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
7500
7535
|
throw new Error("Require paths must be a JSON object.");
|
|
7501
7536
|
}
|
|
7502
7537
|
this.#parsedRequirePaths = parsedJson;
|
|
7503
|
-
} catch (
|
|
7504
|
-
console.error("Error parsing require paths JSON:",
|
|
7505
|
-
this._errorMessage = `Error parsing require paths JSON: ${
|
|
7538
|
+
} catch (e) {
|
|
7539
|
+
console.error("Error parsing require paths JSON:", e);
|
|
7540
|
+
this._errorMessage = `Error parsing require paths JSON: ${e.message}`;
|
|
7506
7541
|
this.#parsedRequirePaths = {};
|
|
7507
7542
|
}
|
|
7508
7543
|
}
|
|
@@ -7515,9 +7550,9 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
7515
7550
|
if (this.#parsedRequireShim === null && this.requireShimJson) {
|
|
7516
7551
|
try {
|
|
7517
7552
|
this.#parsedRequireShim = JSON.parse(this.requireShimJson);
|
|
7518
|
-
} catch (
|
|
7519
|
-
console.error("Error parsing require shim JSON:",
|
|
7520
|
-
this._errorMessage = `Error parsing require shim JSON: ${
|
|
7553
|
+
} catch (e) {
|
|
7554
|
+
console.error("Error parsing require shim JSON:", e);
|
|
7555
|
+
this._errorMessage = `Error parsing require shim JSON: ${e.message}`;
|
|
7521
7556
|
this.#parsedRequireShim = {};
|
|
7522
7557
|
}
|
|
7523
7558
|
}
|
|
@@ -7619,7 +7654,7 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
7619
7654
|
return this.recordToQtiVariableJSON(value);
|
|
7620
7655
|
}
|
|
7621
7656
|
if (cardinality !== "single") {
|
|
7622
|
-
const listValues = this.normalizeListValue(value).map((
|
|
7657
|
+
const listValues = this.normalizeListValue(value).map((v) => this.coerceBaseValue(v, baseType));
|
|
7623
7658
|
return { list: { [baseType]: listValues } };
|
|
7624
7659
|
}
|
|
7625
7660
|
return { base: { [baseType]: this.coerceBaseValue(value, baseType) } };
|
|
@@ -7642,16 +7677,16 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
7642
7677
|
*/
|
|
7643
7678
|
recordEntryFromValue(name, entryValue) {
|
|
7644
7679
|
if (Array.isArray(entryValue)) {
|
|
7645
|
-
const filtered = entryValue.filter((
|
|
7646
|
-
if (filtered.length && filtered.every((
|
|
7680
|
+
const filtered = entryValue.filter((v) => v !== null && v !== void 0);
|
|
7681
|
+
if (filtered.length && filtered.every((v) => typeof v === "boolean")) {
|
|
7647
7682
|
return { name, list: { boolean: filtered } };
|
|
7648
7683
|
}
|
|
7649
|
-
if (filtered.length && filtered.every((
|
|
7684
|
+
if (filtered.length && filtered.every((v) => typeof v === "number")) {
|
|
7650
7685
|
const numbers = filtered;
|
|
7651
|
-
const isIntegers = numbers.every((
|
|
7686
|
+
const isIntegers = numbers.every((n) => Number.isInteger(n));
|
|
7652
7687
|
return { name, list: { [isIntegers ? "integer" : "float"]: numbers } };
|
|
7653
7688
|
}
|
|
7654
|
-
return { name, list: { string: entryValue.map((
|
|
7689
|
+
return { name, list: { string: entryValue.map((v) => v === null || v === void 0 ? "" : String(v)) } };
|
|
7655
7690
|
}
|
|
7656
7691
|
if (typeof entryValue === "boolean") {
|
|
7657
7692
|
return { name, base: { boolean: entryValue } };
|
|
@@ -7727,7 +7762,7 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
7727
7762
|
const identifier = el.getAttribute("template-identifier") || el.getAttribute("identifier") || "";
|
|
7728
7763
|
if (!identifier)
|
|
7729
7764
|
return;
|
|
7730
|
-
const variable = this.context?.variables?.find((
|
|
7765
|
+
const variable = this.context?.variables?.find((v) => v.identifier === identifier);
|
|
7731
7766
|
if (!variable)
|
|
7732
7767
|
return;
|
|
7733
7768
|
const cardinality = variable.cardinality || "single";
|
|
@@ -7754,7 +7789,7 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
7754
7789
|
contextVariables[identifier] = record;
|
|
7755
7790
|
return;
|
|
7756
7791
|
}
|
|
7757
|
-
const variable = this.context?.variables?.find((
|
|
7792
|
+
const variable = this.context?.variables?.find((v) => v.identifier === identifier);
|
|
7758
7793
|
if (!variable)
|
|
7759
7794
|
return;
|
|
7760
7795
|
const cardinality = variable.cardinality || "single";
|
|
@@ -7780,9 +7815,9 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
7780
7815
|
const nestedProperties = { ...properties };
|
|
7781
7816
|
const setNestedValue = (root, path, value) => {
|
|
7782
7817
|
let cursor = root;
|
|
7783
|
-
for (let
|
|
7784
|
-
const segment = path[
|
|
7785
|
-
const isLast =
|
|
7818
|
+
for (let i = 0; i < path.length; i += 1) {
|
|
7819
|
+
const segment = path[i];
|
|
7820
|
+
const isLast = i === path.length - 1;
|
|
7786
7821
|
if (isLast) {
|
|
7787
7822
|
cursor[segment] = value;
|
|
7788
7823
|
return;
|
|
@@ -7823,7 +7858,7 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
7823
7858
|
if (Array.isArray(this.response)) {
|
|
7824
7859
|
if (this.response.length === 0)
|
|
7825
7860
|
return false;
|
|
7826
|
-
return this.response.some((
|
|
7861
|
+
return this.response.some((v) => v !== "" && v !== null && v !== void 0);
|
|
7827
7862
|
}
|
|
7828
7863
|
return this.response !== "";
|
|
7829
7864
|
}
|
|
@@ -7837,11 +7872,11 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
7837
7872
|
this.#setInteractionValidity(isValid, this.#pciCustomValidityMessage);
|
|
7838
7873
|
return isValid;
|
|
7839
7874
|
}
|
|
7840
|
-
set value(
|
|
7841
|
-
if (
|
|
7875
|
+
set value(v) {
|
|
7876
|
+
if (v === null) {
|
|
7842
7877
|
this.#value = [];
|
|
7843
7878
|
} else {
|
|
7844
|
-
this.#value = Array.isArray(
|
|
7879
|
+
this.#value = Array.isArray(v) ? v : v.split(",");
|
|
7845
7880
|
}
|
|
7846
7881
|
}
|
|
7847
7882
|
get value() {
|
|
@@ -7859,11 +7894,11 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
7859
7894
|
}
|
|
7860
7895
|
get boundTo() {
|
|
7861
7896
|
const responseVariable = {};
|
|
7862
|
-
const variable = this.context?.variables?.find((
|
|
7897
|
+
const variable = this.context?.variables?.find((v) => v.identifier === this.responseIdentifier);
|
|
7863
7898
|
if (variable) {
|
|
7864
|
-
const cardinality = this.context?.variables?.find((
|
|
7865
|
-
const baseType = this.context?.variables?.find((
|
|
7866
|
-
const value = this.context?.variables?.find((
|
|
7899
|
+
const cardinality = this.context?.variables?.find((v) => v.identifier === this.responseIdentifier)?.cardinality || "single";
|
|
7900
|
+
const baseType = this.context?.variables?.find((v) => v.identifier === this.responseIdentifier)?.baseType || "string";
|
|
7901
|
+
const value = this.context?.variables?.find((v) => v.identifier === this.responseIdentifier)?.value || null;
|
|
7867
7902
|
const responseVal = this.responseVariablesToQtiVariableJSON(value, cardinality, baseType);
|
|
7868
7903
|
responseVariable[this.responseIdentifier] = responseVal;
|
|
7869
7904
|
}
|
|
@@ -8987,9 +9022,9 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
8987
9022
|
// Add this property to store the previous state
|
|
8988
9023
|
#previousState;
|
|
8989
9024
|
render() {
|
|
8990
|
-
return
|
|
9025
|
+
return html18`
|
|
8991
9026
|
<slot></slot>
|
|
8992
|
-
${this._errorMessage ?
|
|
9027
|
+
${this._errorMessage ? html18`<div style="color:red">
|
|
8993
9028
|
<h1>Error</h1>
|
|
8994
9029
|
${this._errorMessage}
|
|
8995
9030
|
</div>` : ""}
|
|
@@ -8997,77 +9032,55 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
8997
9032
|
}
|
|
8998
9033
|
};
|
|
8999
9034
|
__decorate17([
|
|
9000
|
-
|
|
9035
|
+
property16({ type: String, attribute: "module" })
|
|
9001
9036
|
], QtiPortableCustomInteraction.prototype, "module", void 0);
|
|
9002
9037
|
__decorate17([
|
|
9003
|
-
|
|
9038
|
+
property16({ type: String, attribute: "custom-interaction-type-identifier" })
|
|
9004
9039
|
], QtiPortableCustomInteraction.prototype, "customInteractionTypeIdentifier", void 0);
|
|
9005
9040
|
__decorate17([
|
|
9006
|
-
|
|
9041
|
+
property16({ type: String, attribute: "data-require-paths" })
|
|
9007
9042
|
], QtiPortableCustomInteraction.prototype, "requirePathsJson", void 0);
|
|
9008
9043
|
__decorate17([
|
|
9009
|
-
|
|
9044
|
+
property16({ type: String, attribute: "data-require-shim" })
|
|
9010
9045
|
], QtiPortableCustomInteraction.prototype, "requireShimJson", void 0);
|
|
9011
9046
|
__decorate17([
|
|
9012
|
-
|
|
9047
|
+
property16({ type: String, attribute: "data-require-js-url" })
|
|
9013
9048
|
], QtiPortableCustomInteraction.prototype, "requireJsUrl", void 0);
|
|
9014
9049
|
__decorate17([
|
|
9015
|
-
|
|
9050
|
+
property16({ type: String, attribute: "data-base-url" })
|
|
9016
9051
|
], QtiPortableCustomInteraction.prototype, "baseUrl", void 0);
|
|
9017
9052
|
__decorate17([
|
|
9018
|
-
|
|
9053
|
+
property16({ type: Boolean, attribute: "data-use-default-paths" })
|
|
9019
9054
|
], QtiPortableCustomInteraction.prototype, "useDefaultPaths", void 0);
|
|
9020
9055
|
__decorate17([
|
|
9021
|
-
|
|
9056
|
+
property16({ type: String, attribute: "data-status" })
|
|
9022
9057
|
], QtiPortableCustomInteraction.prototype, "status", void 0);
|
|
9023
9058
|
__decorate17([
|
|
9024
|
-
|
|
9059
|
+
state9()
|
|
9025
9060
|
], QtiPortableCustomInteraction.prototype, "_errorMessage", void 0);
|
|
9026
9061
|
__decorate17([
|
|
9027
|
-
|
|
9028
|
-
|
|
9062
|
+
consume4({ context: itemContext, subscribe: true }),
|
|
9063
|
+
state9()
|
|
9029
9064
|
], QtiPortableCustomInteraction.prototype, "context", void 0);
|
|
9030
9065
|
__decorate17([
|
|
9031
|
-
|
|
9032
|
-
|
|
9066
|
+
consume4({ context: qtiContext, subscribe: true }),
|
|
9067
|
+
state9()
|
|
9033
9068
|
], QtiPortableCustomInteraction.prototype, "qtiContext", void 0);
|
|
9034
9069
|
__decorate17([
|
|
9035
|
-
|
|
9070
|
+
property16({ attribute: "response", reflect: false, converter: responseAttributeConverter({ emptyAs: null }) })
|
|
9036
9071
|
], QtiPortableCustomInteraction.prototype, "response", void 0);
|
|
9037
9072
|
|
|
9038
|
-
//
|
|
9039
|
-
|
|
9040
|
-
|
|
9041
|
-
|
|
9042
|
-
|
|
9043
|
-
if (super(t2), t2.type !== t.ATTRIBUTE || "style" !== t2.name || t2.strings?.length > 2) throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.");
|
|
9044
|
-
}
|
|
9045
|
-
render(t2) {
|
|
9046
|
-
return Object.keys(t2).reduce((e5, r2) => {
|
|
9047
|
-
const s = t2[r2];
|
|
9048
|
-
return null == s ? e5 : e5 + `${r2 = r2.includes("-") ? r2 : r2.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, "-$&").toLowerCase()}:${s};`;
|
|
9049
|
-
}, "");
|
|
9050
|
-
}
|
|
9051
|
-
update(e5, [r2]) {
|
|
9052
|
-
const { style: s } = e5.element;
|
|
9053
|
-
if (void 0 === this.ft) return this.ft = new Set(Object.keys(r2)), this.render(r2);
|
|
9054
|
-
for (const t2 of this.ft) null == r2[t2] && (this.ft.delete(t2), t2.includes("-") ? s.removeProperty(t2) : s[t2] = null);
|
|
9055
|
-
for (const t2 in r2) {
|
|
9056
|
-
const e6 = r2[t2];
|
|
9057
|
-
if (null != e6) {
|
|
9058
|
-
this.ft.add(t2);
|
|
9059
|
-
const r3 = "string" == typeof e6 && e6.endsWith(i4);
|
|
9060
|
-
t2.includes("-") || r3 ? s.setProperty(t2, r3 ? e6.slice(0, -11) : e6, r3 ? n3 : "") : s[t2] = e6;
|
|
9061
|
-
}
|
|
9062
|
-
}
|
|
9063
|
-
return E;
|
|
9064
|
-
}
|
|
9065
|
-
});
|
|
9073
|
+
// ../interactions/select-point-interaction/dist/qti-select-point-interaction.js
|
|
9074
|
+
import { html as html19, nothing as nothing4 } from "lit";
|
|
9075
|
+
import { property as property17, state as state10 } from "lit/decorators.js";
|
|
9076
|
+
import { repeat as repeat5 } from "lit/directives/repeat.js";
|
|
9077
|
+
import { styleMap } from "lit/directives/style-map.js";
|
|
9066
9078
|
|
|
9067
9079
|
// ../interactions/select-point-interaction/dist/qti-select-point-interaction.styles.js
|
|
9080
|
+
import { css as css21 } from "lit";
|
|
9068
9081
|
var qti_select_point_interaction_styles_default = [
|
|
9069
9082
|
boxSizing,
|
|
9070
|
-
|
|
9083
|
+
css21`
|
|
9071
9084
|
:host {
|
|
9072
9085
|
display: block;
|
|
9073
9086
|
--qti-select-point-marker-size: 1.5rem;
|
|
@@ -9107,10 +9120,10 @@ var qti_select_point_interaction_styles_default = [
|
|
|
9107
9120
|
|
|
9108
9121
|
// ../interactions/select-point-interaction/dist/qti-select-point-interaction.js
|
|
9109
9122
|
var __decorate18 = function(decorators, target, key, desc) {
|
|
9110
|
-
var
|
|
9111
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
9112
|
-
else for (var
|
|
9113
|
-
return
|
|
9123
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9124
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9125
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9126
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9114
9127
|
};
|
|
9115
9128
|
var QtiSelectPointInteraction = class extends Interaction {
|
|
9116
9129
|
constructor() {
|
|
@@ -9208,7 +9221,7 @@ var QtiSelectPointInteraction = class extends Interaction {
|
|
|
9208
9221
|
}
|
|
9209
9222
|
/** Extension hook for optional layers rendered above the response points. */
|
|
9210
9223
|
renderSupplementalLayer() {
|
|
9211
|
-
return
|
|
9224
|
+
return nothing4;
|
|
9212
9225
|
}
|
|
9213
9226
|
/** Positions overlay elements that carry `data-coord` and `data-shape`. */
|
|
9214
9227
|
positionOverlayElements(elements17) {
|
|
@@ -9221,22 +9234,22 @@ var QtiSelectPointInteraction = class extends Interaction {
|
|
|
9221
9234
|
const shape = element.dataset.shape;
|
|
9222
9235
|
if (!coords || !shape)
|
|
9223
9236
|
continue;
|
|
9224
|
-
positionShapes(shape, coords.split(",").map((
|
|
9237
|
+
positionShapes(shape, coords.split(",").map((c) => +c), img, element);
|
|
9225
9238
|
}
|
|
9226
9239
|
}
|
|
9227
9240
|
render() {
|
|
9228
9241
|
const rawResponse = this.response;
|
|
9229
9242
|
const responseList = Array.isArray(rawResponse) ? rawResponse : rawResponse ? [rawResponse] : [];
|
|
9230
|
-
return
|
|
9243
|
+
return html19` <slot name="prompt"></slot>
|
|
9231
9244
|
<point-container>
|
|
9232
|
-
${
|
|
9245
|
+
${repeat5(responseList.filter((point) => point), (point) => point, (point, index) => {
|
|
9233
9246
|
const [x, y] = point.split(" ").map(Number);
|
|
9234
9247
|
const leftPercentage = x / (this.#imageWidthOriginal || 1) * 100;
|
|
9235
9248
|
const topPercentage = y / (this.#imageHeightOriginal || 1) * 100;
|
|
9236
|
-
return
|
|
9249
|
+
return html19`
|
|
9237
9250
|
<button
|
|
9238
9251
|
part=${this.pointPart(point, index)}
|
|
9239
|
-
style=${
|
|
9252
|
+
style=${styleMap({
|
|
9240
9253
|
pointerEvents: this.maxChoices === 1 ? "none" : "auto",
|
|
9241
9254
|
position: "absolute",
|
|
9242
9255
|
left: `${leftPercentage}%`,
|
|
@@ -9244,9 +9257,9 @@ var QtiSelectPointInteraction = class extends Interaction {
|
|
|
9244
9257
|
})}
|
|
9245
9258
|
aria-label="Remove point at ${point}"
|
|
9246
9259
|
?disabled=${this.disabled}
|
|
9247
|
-
@click=${(
|
|
9248
|
-
|
|
9249
|
-
this.response = (this.response || []).filter((_,
|
|
9260
|
+
@click=${(e) => {
|
|
9261
|
+
e.stopPropagation();
|
|
9262
|
+
this.response = (this.response || []).filter((_, i) => i !== index);
|
|
9250
9263
|
this.saveResponse(this.response);
|
|
9251
9264
|
}}
|
|
9252
9265
|
></button>
|
|
@@ -9301,19 +9314,19 @@ var QtiSelectPointInteraction = class extends Interaction {
|
|
|
9301
9314
|
}
|
|
9302
9315
|
};
|
|
9303
9316
|
__decorate18([
|
|
9304
|
-
|
|
9317
|
+
property17({
|
|
9305
9318
|
type: Number,
|
|
9306
9319
|
attribute: "max-choices"
|
|
9307
9320
|
})
|
|
9308
9321
|
], QtiSelectPointInteraction.prototype, "maxChoices", void 0);
|
|
9309
9322
|
__decorate18([
|
|
9310
|
-
|
|
9323
|
+
property17({
|
|
9311
9324
|
type: Number,
|
|
9312
9325
|
attribute: "min-choices"
|
|
9313
9326
|
})
|
|
9314
9327
|
], QtiSelectPointInteraction.prototype, "minChoices", void 0);
|
|
9315
9328
|
__decorate18([
|
|
9316
|
-
|
|
9329
|
+
property17({
|
|
9317
9330
|
attribute: "response",
|
|
9318
9331
|
reflect: false,
|
|
9319
9332
|
converter: {
|
|
@@ -9330,19 +9343,24 @@ __decorate18([
|
|
|
9330
9343
|
})
|
|
9331
9344
|
], QtiSelectPointInteraction.prototype, "response", void 0);
|
|
9332
9345
|
__decorate18([
|
|
9333
|
-
|
|
9346
|
+
property17({ attribute: "area-mappings" })
|
|
9334
9347
|
], QtiSelectPointInteraction.prototype, "areaMappings", void 0);
|
|
9335
9348
|
__decorate18([
|
|
9336
|
-
|
|
9349
|
+
state10()
|
|
9337
9350
|
], QtiSelectPointInteraction.prototype, "_areaEntries", void 0);
|
|
9338
9351
|
__decorate18([
|
|
9339
9352
|
watch("areaMappings")
|
|
9340
9353
|
], QtiSelectPointInteraction.prototype, "_handleAreaMappingsChange", void 0);
|
|
9341
9354
|
|
|
9355
|
+
// ../interactions/slider-interaction/dist/qti-slider-interaction.js
|
|
9356
|
+
import { html as html20, nothing as nothing5 } from "lit";
|
|
9357
|
+
import { property as property18, query as query2 } from "lit/decorators.js";
|
|
9358
|
+
|
|
9342
9359
|
// ../interactions/slider-interaction/dist/qti-slider-interaction.styles.js
|
|
9360
|
+
import { css as css22 } from "lit";
|
|
9343
9361
|
var qti_slider_interaction_styles_default = [
|
|
9344
9362
|
boxSizing,
|
|
9345
|
-
|
|
9363
|
+
css22`
|
|
9346
9364
|
:host {
|
|
9347
9365
|
display: block;
|
|
9348
9366
|
--show-bounds: true;
|
|
@@ -9415,10 +9433,10 @@ var qti_slider_interaction_styles_default = [
|
|
|
9415
9433
|
|
|
9416
9434
|
// ../interactions/slider-interaction/dist/qti-slider-interaction.js
|
|
9417
9435
|
var __decorate19 = function(decorators, target, key, desc) {
|
|
9418
|
-
var
|
|
9419
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
9420
|
-
else for (var
|
|
9421
|
-
return
|
|
9436
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9437
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9438
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9439
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9422
9440
|
};
|
|
9423
9441
|
var QtiSliderInteraction = class extends Interaction {
|
|
9424
9442
|
constructor() {
|
|
@@ -9456,7 +9474,7 @@ var QtiSliderInteraction = class extends Interaction {
|
|
|
9456
9474
|
}
|
|
9457
9475
|
/** Extension hook for optional content rendered on the slider rail. */
|
|
9458
9476
|
renderRailSupplement() {
|
|
9459
|
-
return
|
|
9477
|
+
return nothing5;
|
|
9460
9478
|
}
|
|
9461
9479
|
#updateValue(newValue) {
|
|
9462
9480
|
const oldValue = this.#value;
|
|
@@ -9471,7 +9489,7 @@ var QtiSliderInteraction = class extends Interaction {
|
|
|
9471
9489
|
this.requestUpdate();
|
|
9472
9490
|
}
|
|
9473
9491
|
render() {
|
|
9474
|
-
return
|
|
9492
|
+
return html20`
|
|
9475
9493
|
<slot name="prompt"></slot>
|
|
9476
9494
|
<div id="slider" part="slider">
|
|
9477
9495
|
<div id="bounds" part="bounds">
|
|
@@ -9493,7 +9511,7 @@ var QtiSliderInteraction = class extends Interaction {
|
|
|
9493
9511
|
}
|
|
9494
9512
|
#onMouseDown(event) {
|
|
9495
9513
|
this.#startDrag(event.pageX);
|
|
9496
|
-
const handleMouseMove = (
|
|
9514
|
+
const handleMouseMove = (e) => this.#onDrag(e.pageX);
|
|
9497
9515
|
const handleMouseUp = () => {
|
|
9498
9516
|
document.removeEventListener("mousemove", handleMouseMove);
|
|
9499
9517
|
document.removeEventListener("mouseup", handleMouseUp);
|
|
@@ -9504,7 +9522,7 @@ var QtiSliderInteraction = class extends Interaction {
|
|
|
9504
9522
|
}
|
|
9505
9523
|
#onTouchStart(event) {
|
|
9506
9524
|
this.#startDrag(event.touches[0].pageX);
|
|
9507
|
-
const handleTouchMove = (
|
|
9525
|
+
const handleTouchMove = (e) => this.#onDrag(e.touches[0].pageX);
|
|
9508
9526
|
const handleTouchEnd = () => {
|
|
9509
9527
|
document.removeEventListener("touchmove", handleTouchMove);
|
|
9510
9528
|
document.removeEventListener("touchend", handleTouchEnd);
|
|
@@ -9528,56 +9546,32 @@ var QtiSliderInteraction = class extends Interaction {
|
|
|
9528
9546
|
}
|
|
9529
9547
|
};
|
|
9530
9548
|
__decorate19([
|
|
9531
|
-
|
|
9549
|
+
query2("#rail")
|
|
9532
9550
|
], QtiSliderInteraction.prototype, "_rail", void 0);
|
|
9533
9551
|
__decorate19([
|
|
9534
|
-
|
|
9552
|
+
property18({ type: Number, attribute: "lower-bound" })
|
|
9535
9553
|
], QtiSliderInteraction.prototype, "min", void 0);
|
|
9536
9554
|
__decorate19([
|
|
9537
|
-
|
|
9555
|
+
property18({ type: Number, attribute: "upper-bound" })
|
|
9538
9556
|
], QtiSliderInteraction.prototype, "max", void 0);
|
|
9539
9557
|
__decorate19([
|
|
9540
|
-
|
|
9558
|
+
property18({ type: Number, attribute: "step" })
|
|
9541
9559
|
], QtiSliderInteraction.prototype, "step", void 0);
|
|
9542
9560
|
__decorate19([
|
|
9543
|
-
|
|
9561
|
+
property18({ attribute: "response", reflect: false, noAccessor: true })
|
|
9544
9562
|
], QtiSliderInteraction.prototype, "response", null);
|
|
9545
9563
|
|
|
9546
|
-
//
|
|
9547
|
-
|
|
9548
|
-
|
|
9549
|
-
};
|
|
9550
|
-
|
|
9551
|
-
var n4 = e3(class extends f {
|
|
9552
|
-
render(i5) {
|
|
9553
|
-
return A;
|
|
9554
|
-
}
|
|
9555
|
-
update(i5, [s]) {
|
|
9556
|
-
const e5 = s !== this.G;
|
|
9557
|
-
return e5 && void 0 !== this.G && this.rt(void 0), (e5 || this.lt !== this.ct) && (this.G = s, this.ht = i5.options?.host, this.rt(this.ct = i5.element)), A;
|
|
9558
|
-
}
|
|
9559
|
-
rt(t2) {
|
|
9560
|
-
if (this.isConnected || (t2 = void 0), "function" == typeof this.G) {
|
|
9561
|
-
const i5 = this.ht ?? globalThis;
|
|
9562
|
-
let s = o4.get(i5);
|
|
9563
|
-
void 0 === s && (s = /* @__PURE__ */ new WeakMap(), o4.set(i5, s)), void 0 !== s.get(this.G) && this.G.call(this.ht, void 0), s.set(this.G, t2), void 0 !== t2 && this.G.call(this.ht, t2);
|
|
9564
|
-
} else this.G.value = t2;
|
|
9565
|
-
}
|
|
9566
|
-
get lt() {
|
|
9567
|
-
return "function" == typeof this.G ? o4.get(this.ht ?? globalThis)?.get(this.G) : this.G?.value;
|
|
9568
|
-
}
|
|
9569
|
-
disconnected() {
|
|
9570
|
-
this.lt === this.ct && this.rt(void 0);
|
|
9571
|
-
}
|
|
9572
|
-
reconnected() {
|
|
9573
|
-
this.rt(this.ct);
|
|
9574
|
-
}
|
|
9575
|
-
});
|
|
9564
|
+
// ../interactions/text-entry-interaction/dist/qti-text-entry-interaction.js
|
|
9565
|
+
import { html as html21 } from "lit";
|
|
9566
|
+
import { property as property19, query as query3 } from "lit/decorators.js";
|
|
9567
|
+
import { ifDefined as ifDefined3 } from "lit/directives/if-defined.js";
|
|
9568
|
+
import { createRef } from "lit/directives/ref.js";
|
|
9576
9569
|
|
|
9577
9570
|
// ../interactions/text-entry-interaction/dist/qti-text-entry-interaction.styles.js
|
|
9571
|
+
import { css as css23 } from "lit";
|
|
9578
9572
|
var qti_text_entry_interaction_styles_default = [
|
|
9579
9573
|
boxSizing,
|
|
9580
|
-
|
|
9574
|
+
css23`
|
|
9581
9575
|
:host {
|
|
9582
9576
|
display: inline-flex;
|
|
9583
9577
|
align-items: center;
|
|
@@ -9671,15 +9665,15 @@ var qti_text_entry_interaction_styles_default = [
|
|
|
9671
9665
|
|
|
9672
9666
|
// ../interactions/text-entry-interaction/dist/qti-text-entry-interaction.js
|
|
9673
9667
|
var __decorate20 = function(decorators, target, key, desc) {
|
|
9674
|
-
var
|
|
9675
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
9676
|
-
else for (var
|
|
9677
|
-
return
|
|
9668
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9669
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9670
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9671
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9678
9672
|
};
|
|
9679
9673
|
var QtiTextEntryInteraction = class extends Interaction {
|
|
9680
9674
|
constructor() {
|
|
9681
9675
|
super(...arguments);
|
|
9682
|
-
this.inputRef =
|
|
9676
|
+
this.inputRef = createRef();
|
|
9683
9677
|
this.response = null;
|
|
9684
9678
|
this._handleValueChange = () => {
|
|
9685
9679
|
this._internals.setFormValue(this.value);
|
|
@@ -9729,11 +9723,11 @@ var QtiTextEntryInteraction = class extends Interaction {
|
|
|
9729
9723
|
*/
|
|
9730
9724
|
/** The answer-key line, revealed above the field when the correct response is shown. */
|
|
9731
9725
|
renderAnswer() {
|
|
9732
|
-
return
|
|
9726
|
+
return html21`<div part="answer" aria-hidden="true"></div>`;
|
|
9733
9727
|
}
|
|
9734
9728
|
/** The field itself. */
|
|
9735
9729
|
renderInput() {
|
|
9736
|
-
return
|
|
9730
|
+
return html21`<input
|
|
9737
9731
|
part="input"
|
|
9738
9732
|
name="${this.responseIdentifier}"
|
|
9739
9733
|
spellcheck="false"
|
|
@@ -9745,9 +9739,9 @@ var QtiTextEntryInteraction = class extends Interaction {
|
|
|
9745
9739
|
@keyup="${this.textChanged}"
|
|
9746
9740
|
@change="${this.textChanged}"
|
|
9747
9741
|
type="${this.patternMask == "[0-9]*" ? "number" : "text"}"
|
|
9748
|
-
placeholder="${
|
|
9742
|
+
placeholder="${ifDefined3(this.placeholderText ? this.placeholderText : void 0)}"
|
|
9749
9743
|
.value="${this.response}"
|
|
9750
|
-
pattern="${
|
|
9744
|
+
pattern="${ifDefined3(this.patternMask ? this.patternMask : void 0)}"
|
|
9751
9745
|
maxlength=${1e3}
|
|
9752
9746
|
?disabled="${this.disabled}"
|
|
9753
9747
|
?readonly="${this.readonly}"
|
|
@@ -9755,10 +9749,10 @@ var QtiTextEntryInteraction = class extends Interaction {
|
|
|
9755
9749
|
}
|
|
9756
9750
|
/** Hidden until `Interaction.reportValidity` shows it. */
|
|
9757
9751
|
renderValidationMessage() {
|
|
9758
|
-
return
|
|
9752
|
+
return html21`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`;
|
|
9759
9753
|
}
|
|
9760
9754
|
render() {
|
|
9761
|
-
return
|
|
9755
|
+
return html21` ${this.renderAnswer()} ${this.renderInput()} ${this.renderValidationMessage()} `;
|
|
9762
9756
|
}
|
|
9763
9757
|
textChanged(event) {
|
|
9764
9758
|
if (this.disabled || this.readonly)
|
|
@@ -9778,22 +9772,22 @@ var QtiTextEntryInteraction = class extends Interaction {
|
|
|
9778
9772
|
}
|
|
9779
9773
|
};
|
|
9780
9774
|
__decorate20([
|
|
9781
|
-
|
|
9775
|
+
property19({ type: Number, attribute: "expected-length" })
|
|
9782
9776
|
], QtiTextEntryInteraction.prototype, "expectedLength", void 0);
|
|
9783
9777
|
__decorate20([
|
|
9784
|
-
|
|
9778
|
+
property19({ type: String, attribute: "pattern-mask" })
|
|
9785
9779
|
], QtiTextEntryInteraction.prototype, "patternMask", void 0);
|
|
9786
9780
|
__decorate20([
|
|
9787
|
-
|
|
9781
|
+
property19({ type: String, attribute: "placeholder-text" })
|
|
9788
9782
|
], QtiTextEntryInteraction.prototype, "placeholderText", void 0);
|
|
9789
9783
|
__decorate20([
|
|
9790
|
-
|
|
9784
|
+
property19({ type: String, attribute: "data-patternmask-message" })
|
|
9791
9785
|
], QtiTextEntryInteraction.prototype, "dataPatternmaskMessage", void 0);
|
|
9792
9786
|
__decorate20([
|
|
9793
|
-
|
|
9787
|
+
property19({ type: String, attribute: "response", reflect: false })
|
|
9794
9788
|
], QtiTextEntryInteraction.prototype, "response", void 0);
|
|
9795
9789
|
__decorate20([
|
|
9796
|
-
|
|
9790
|
+
query3("input")
|
|
9797
9791
|
], QtiTextEntryInteraction.prototype, "_input", void 0);
|
|
9798
9792
|
__decorate20([
|
|
9799
9793
|
watch("response", { waitUntilFirstUpdate: true })
|
|
@@ -9880,7 +9874,7 @@ var QtiPortableCustomInteractionTest = class extends QtiPortableCustomInteractio
|
|
|
9880
9874
|
setTestContext(newContext) {
|
|
9881
9875
|
this.context = newContext;
|
|
9882
9876
|
this.updateComplete.then(() => {
|
|
9883
|
-
this.value = newContext?.variables?.find((
|
|
9877
|
+
this.value = newContext?.variables?.find((v) => v.identifier === this.responseIdentifier).value;
|
|
9884
9878
|
});
|
|
9885
9879
|
}
|
|
9886
9880
|
/**
|
|
@@ -10299,7 +10293,6 @@ export {
|
|
|
10299
10293
|
QtiGapText,
|
|
10300
10294
|
QtiHotspotChoice,
|
|
10301
10295
|
QtiHottext,
|
|
10302
|
-
c2 as c,
|
|
10303
10296
|
dragDropContext,
|
|
10304
10297
|
QtiSimpleAssociableChoice,
|
|
10305
10298
|
QtiSimpleChoice,
|
|
@@ -10329,7 +10322,6 @@ export {
|
|
|
10329
10322
|
elements12,
|
|
10330
10323
|
QtiPortableCustomInteraction,
|
|
10331
10324
|
elements13,
|
|
10332
|
-
o3 as o,
|
|
10333
10325
|
QtiSelectPointInteraction,
|
|
10334
10326
|
elements14,
|
|
10335
10327
|
QtiSliderInteraction,
|
|
@@ -10337,27 +10329,4 @@ export {
|
|
|
10337
10329
|
QtiTextEntryInteraction,
|
|
10338
10330
|
elements16
|
|
10339
10331
|
};
|
|
10340
|
-
|
|
10341
|
-
|
|
10342
|
-
lit-html/node/directives/repeat.js:
|
|
10343
|
-
(**
|
|
10344
|
-
* @license
|
|
10345
|
-
* Copyright 2017 Google LLC
|
|
10346
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
10347
|
-
*)
|
|
10348
|
-
|
|
10349
|
-
lit-html/node/directives/style-map.js:
|
|
10350
|
-
(**
|
|
10351
|
-
* @license
|
|
10352
|
-
* Copyright 2018 Google LLC
|
|
10353
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
10354
|
-
*)
|
|
10355
|
-
|
|
10356
|
-
lit-html/node/directives/ref.js:
|
|
10357
|
-
(**
|
|
10358
|
-
* @license
|
|
10359
|
-
* Copyright 2020 Google LLC
|
|
10360
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
10361
|
-
*)
|
|
10362
|
-
*/
|
|
10363
|
-
//# sourceMappingURL=chunk-5SJS36BI.js.map
|
|
10332
|
+
//# sourceMappingURL=chunk-TWPXES3S.js.map
|