@citolab/qti-components 10.0.0-next.2 → 10.0.0-next.21
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 +4334 -2688
- package/dist/base.d.ts +39 -13
- package/dist/base.js +14 -1
- package/dist/{chunk-RU6332MD.js → chunk-2A52V5TQ.js} +4 -4
- package/dist/{chunk-2KP5UU5A.js → chunk-55WWIRLN.js} +117 -92
- package/dist/chunk-55WWIRLN.js.map +1 -0
- package/dist/{chunk-MI7774NV.js → chunk-5BP2A7BI.js} +2 -2
- package/dist/{chunk-35WWWFS6.js → chunk-DAESCCLR.js} +2 -2
- package/dist/chunk-DJ7PB252.js +7 -0
- package/dist/chunk-DJ7PB252.js.map +1 -0
- package/dist/{chunk-TDWJ6WZA.js → chunk-GPC53O7P.js} +166 -10
- package/dist/chunk-GPC53O7P.js.map +1 -0
- package/dist/{chunk-6U3YPHXU.js → chunk-H6DO5UHC.js} +277 -154
- package/dist/chunk-H6DO5UHC.js.map +1 -0
- package/dist/chunk-J6VX4N7M.js +197 -0
- package/dist/chunk-J6VX4N7M.js.map +1 -0
- package/dist/{chunk-3ZNECUPV.js → chunk-JIDSFFFD.js} +2 -2
- package/dist/{chunk-FD4AB6TM.js → chunk-KQ2LED4X.js} +2 -2
- package/dist/{chunk-6K3QWJHH.js → chunk-LPYZVKHX.js} +48 -7
- package/dist/chunk-LPYZVKHX.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/{chunk-K3VKQ6QF.js → chunk-TB2OI3ED.js} +677 -1894
- package/dist/chunk-TB2OI3ED.js.map +1 -0
- package/dist/{chunk-GBZNFSFY.js → chunk-TSJGL6FI.js} +2 -2
- package/dist/{chunk-RSMYGGQK.js → chunk-TZCOXFPB.js} +1590 -610
- package/dist/chunk-TZCOXFPB.js.map +1 -0
- package/dist/chunk-UCXLDQYA.js +56 -0
- package/dist/chunk-UCXLDQYA.js.map +1 -0
- package/dist/chunk-WWY2H2YO.js +7 -0
- package/dist/chunk-WWY2H2YO.js.map +1 -0
- package/dist/{chunk-LFVPS7KB.js → chunk-XWRZP2RM.js} +2 -2
- package/dist/{chunk-TLAVOBEM.js → chunk-ZRORBAHB.js} +122 -3
- package/dist/chunk-ZRORBAHB.js.map +1 -0
- package/dist/computed.types.d-6Ht-HNRx.d.ts +80 -0
- package/dist/{config.context.d-BvU9r-Mg.d.ts → config.context.d-Dm11aAuw.d.ts} +21 -3
- package/dist/corrections.d.ts +137 -24
- package/dist/corrections.js +12 -12
- package/dist/corrections.js.map +1 -1
- package/dist/elements.d.ts +66 -73
- package/dist/elements.js +9 -6
- package/dist/index.d.ts +21 -17
- package/dist/index.js +47 -61
- package/dist/interactions.d.ts +98 -19
- package/dist/interactions.js +8 -3
- package/dist/item.css +1948 -1946
- package/dist/item.d.ts +8 -6
- package/dist/item.js +6 -5
- package/dist/item.types.d-Zc6ZQDhu.d.ts +25 -0
- package/dist/loader.d.ts +5 -3
- package/dist/loader.js +3 -2
- package/dist/processing.d.ts +19 -7
- package/dist/processing.js +4 -3
- package/dist/public-events.d-3dGip9pd.d.ts +105 -0
- package/dist/qti-components-jsx.d.ts +1780 -1727
- package/dist/{qti-condition-expression.d-VJH6cWxf.d.ts → qti-condition-expression.d-7Kd4LBxn.d.ts} +1 -1
- package/dist/{qti-expression.d-BPxEp8HU.d.ts → qti-expression.d-iH3w6mqf.d.ts} +2 -1
- package/dist/{qti-feedback.d-wMYNVkkj.d.ts → qti-feedback.d-CT0W-8Gm.d.ts} +8 -1
- package/dist/{qti-item.d-DgC1AQbY.d.ts → qti-item.d-CxP6KtCH.d.ts} +3 -2
- package/dist/{qti-rule-base.d-Bdzg8eGH.d.ts → qti-rule-base.d-CeKP0Ooi.d.ts} +2 -2
- package/dist/qti-test-state-CF9S8X9C.d.ts +68 -0
- package/dist/qti-test-state.d-D8Q89RzZ.d.ts +57 -0
- package/dist/{qti-test.d-DkpBNcsv.d.ts → qti-test.d-DBT-YpRu.d.ts} +124 -485
- package/dist/{qti-text-entry-interaction.d-q8u5BiVK.d.ts → qti-text-entry-interaction.d-m0EFv9no.d.ts} +221 -73
- package/dist/{qti-transform-test.d-BL7GGFJj.d.ts → qti-transform-test.d-Bb9vnLzP.d.ts} +1 -0
- package/dist/{interaction.d-g6XG0T0Z.d.ts → record.d-N1Bq7e1f.d.ts} +67 -4
- package/dist/{session.context.d-D5080LVx.d.ts → session.context.d-9gRdGK4T.d.ts} +7 -1
- package/dist/test-plugin-api.d.ts +134 -0
- package/dist/test-plugin-api.js +19 -0
- package/dist/test-plugin-api.js.map +1 -0
- package/dist/test.d.ts +26 -57
- package/dist/test.js +19 -48
- package/dist/transformers.d.ts +1 -1
- package/dist/transformers.js +2 -1
- package/dist/{item.types.d-B55QkJ92.d.ts → variables.d-DWHlTszN.d.ts} +8 -24
- package/package.json +16 -11
- package/dist/chunk-2KP5UU5A.js.map +0 -1
- package/dist/chunk-6K3QWJHH.js.map +0 -1
- package/dist/chunk-6U3YPHXU.js.map +0 -1
- package/dist/chunk-K3VKQ6QF.js.map +0 -1
- package/dist/chunk-RSMYGGQK.js.map +0 -1
- package/dist/chunk-TDWJ6WZA.js.map +0 -1
- package/dist/chunk-TLAVOBEM.js.map +0 -1
- package/dist/chunk-ZP6QQYSU.js +0 -7
- package/dist/chunk-ZP6QQYSU.js.map +0 -1
- package/dist/computed.types.d-gJrBeUMG.d.ts +0 -42
- /package/dist/{chunk-RU6332MD.js.map → chunk-2A52V5TQ.js.map} +0 -0
- /package/dist/{chunk-MI7774NV.js.map → chunk-5BP2A7BI.js.map} +0 -0
- /package/dist/{chunk-35WWWFS6.js.map → chunk-DAESCCLR.js.map} +0 -0
- /package/dist/{chunk-3ZNECUPV.js.map → chunk-JIDSFFFD.js.map} +0 -0
- /package/dist/{chunk-FD4AB6TM.js.map → chunk-KQ2LED4X.js.map} +0 -0
- /package/dist/{chunk-GBZNFSFY.js.map → chunk-TSJGL6FI.js.map} +0 -0
- /package/dist/{chunk-LFVPS7KB.js.map → chunk-XWRZP2RM.js.map} +0 -0
|
@@ -6,15 +6,20 @@ import {
|
|
|
6
6
|
boxSizing,
|
|
7
7
|
configContext,
|
|
8
8
|
dropRegion,
|
|
9
|
+
hasState,
|
|
10
|
+
inferRecordFieldBaseType,
|
|
9
11
|
interactionContext,
|
|
12
|
+
isRecordValue,
|
|
10
13
|
itemContext,
|
|
11
14
|
parseResponseAttribute,
|
|
12
15
|
qtiContext,
|
|
16
|
+
readRecordFieldValues,
|
|
13
17
|
removeDoubleSlashes,
|
|
14
18
|
responseAttributeConverter,
|
|
15
19
|
serializeResponseAttribute,
|
|
20
|
+
setState,
|
|
16
21
|
validationMessage
|
|
17
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-GPC53O7P.js";
|
|
18
23
|
|
|
19
24
|
// ../interactions/core/dist/elements/qti-associable-hotspot/qti-associable-hotspot.js
|
|
20
25
|
import { LitElement, html } from "lit";
|
|
@@ -49,6 +54,12 @@ var qti_associable_hotspot_styles_default = [
|
|
|
49
54
|
width: 100%;
|
|
50
55
|
height: 100%;
|
|
51
56
|
}
|
|
57
|
+
|
|
58
|
+
/* A placed chip keeps the box it had in the bank, even in a hotspot narrower than it (a boxed
|
|
59
|
+
word on a small region): shrinking would wrap or squeeze its text (drag-drop.invariance). */
|
|
60
|
+
[part~='chip'] {
|
|
61
|
+
flex-shrink: 0;
|
|
62
|
+
}
|
|
52
63
|
`
|
|
53
64
|
];
|
|
54
65
|
|
|
@@ -207,6 +218,10 @@ var qti_gap_img_styles_default = [
|
|
|
207
218
|
align-items: center;
|
|
208
219
|
justify-content: center;
|
|
209
220
|
user-select: none;
|
|
221
|
+
/* In graphic-gap-match the picture's authored size is in the graphic's coordinate space, so it
|
|
222
|
+
scales with the graphic and keeps fitting its hotspot. The interaction publishes the factor;
|
|
223
|
+
anywhere else it is unset and the chip keeps its size. */
|
|
224
|
+
zoom: var(--qti-graphic-scale, 1);
|
|
210
225
|
}
|
|
211
226
|
`
|
|
212
227
|
];
|
|
@@ -269,8 +284,11 @@ var ariaBooleanConverter = {
|
|
|
269
284
|
toAttribute: (value) => value ? "true" : "false",
|
|
270
285
|
fromAttribute: (value) => value === "true"
|
|
271
286
|
};
|
|
272
|
-
function ActiveElementMixin(Base, type) {
|
|
287
|
+
function ActiveElementMixin(Base, type, { activateOn = "click" } = {}) {
|
|
273
288
|
class QtiChoice extends Base {
|
|
289
|
+
/* Set when a press already activated, so the `click` that follows on release does not toggle it
|
|
290
|
+
back. Reset by every pointer-down, so a press that never ends in a click cannot leak. */
|
|
291
|
+
#pressActivated;
|
|
274
292
|
#appliedChoiceRole;
|
|
275
293
|
/**
|
|
276
294
|
* Apply what the interaction published. No provider (standalone) means no role.
|
|
@@ -318,7 +336,22 @@ function ActiveElementMixin(Base, type) {
|
|
|
318
336
|
this.tabIndex = 0;
|
|
319
337
|
this.disabled = false;
|
|
320
338
|
this.readonly = false;
|
|
339
|
+
this.#pressActivated = false;
|
|
321
340
|
this.#appliedChoiceRole = null;
|
|
341
|
+
this._onMouseDown = (event) => {
|
|
342
|
+
if (this.disabled)
|
|
343
|
+
event.preventDefault();
|
|
344
|
+
};
|
|
345
|
+
this._onPointerDown = (event) => {
|
|
346
|
+
this.#pressActivated = false;
|
|
347
|
+
if (activateOn !== "press" || event.button !== 0 || !event.isPrimary)
|
|
348
|
+
return;
|
|
349
|
+
if (this.hasAttribute("data-draggable") || this.disabled || this.readonly)
|
|
350
|
+
return;
|
|
351
|
+
this.#pressActivated = true;
|
|
352
|
+
this.focus();
|
|
353
|
+
this._activate();
|
|
354
|
+
};
|
|
322
355
|
this.internals = this.attachInternals();
|
|
323
356
|
}
|
|
324
357
|
/* `PropertyValues`, not `PropertyValues<this>`: the polymorphic `this` narrows the
|
|
@@ -343,6 +376,8 @@ function ActiveElementMixin(Base, type) {
|
|
|
343
376
|
}
|
|
344
377
|
this.addEventListener("keyup", this._onKeyUp);
|
|
345
378
|
this.addEventListener("click", this._onClick);
|
|
379
|
+
this.addEventListener("pointerdown", this._onPointerDown);
|
|
380
|
+
this.addEventListener("mousedown", this._onMouseDown);
|
|
346
381
|
this.dispatchEvent(new CustomEvent(`register-${type}`, {
|
|
347
382
|
bubbles: true,
|
|
348
383
|
composed: true
|
|
@@ -352,6 +387,8 @@ function ActiveElementMixin(Base, type) {
|
|
|
352
387
|
super.disconnectedCallback();
|
|
353
388
|
this.removeEventListener("keyup", this._onKeyUp);
|
|
354
389
|
this.removeEventListener("click", this._onClick);
|
|
390
|
+
this.removeEventListener("pointerdown", this._onPointerDown);
|
|
391
|
+
this.removeEventListener("mousedown", this._onMouseDown);
|
|
355
392
|
this.dispatchEvent(new CustomEvent(`unregister-${type}`, {
|
|
356
393
|
bubbles: true,
|
|
357
394
|
composed: true
|
|
@@ -366,6 +403,10 @@ function ActiveElementMixin(Base, type) {
|
|
|
366
403
|
}
|
|
367
404
|
}
|
|
368
405
|
_onClick() {
|
|
406
|
+
if (this.#pressActivated) {
|
|
407
|
+
this.#pressActivated = false;
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
369
410
|
if (this.disabled || this.readonly)
|
|
370
411
|
return;
|
|
371
412
|
this.focus();
|
|
@@ -435,7 +476,7 @@ var qti_gap_text_styles_default = [
|
|
|
435
476
|
/*
|
|
436
477
|
* Centred wherever it lives — this is the one-line follow-up the note here used to promise.
|
|
437
478
|
*
|
|
438
|
-
* It read :host(:not([part~='
|
|
479
|
+
* It read :host(:not([part~='chip'])), which reproduced an older accident: the centring rule
|
|
439
480
|
* used to be a document selector ('qti-gap-match-interaction qti-gap-text'), and a placed chip
|
|
440
481
|
* lives inside qti-gap's shadow root where no document selector reaches. So a chip in the bank was
|
|
441
482
|
* centred and the same chip in a gap was not, and the stylesheet gave no hint why.
|
|
@@ -537,6 +578,15 @@ var QtiHotspotChoice = class extends ActiveElementMixin(LitElement5, "qti-hotspo
|
|
|
537
578
|
static {
|
|
538
579
|
this.styles = qti_hotspot_choice_styles_default;
|
|
539
580
|
}
|
|
581
|
+
updated(changed) {
|
|
582
|
+
super.updated(changed);
|
|
583
|
+
if (changed.has("order")) {
|
|
584
|
+
if (this.order === void 0 || this.order === null)
|
|
585
|
+
this.removeAttribute("data-order");
|
|
586
|
+
else
|
|
587
|
+
this.setAttribute("data-order", String(this.order));
|
|
588
|
+
}
|
|
589
|
+
}
|
|
540
590
|
};
|
|
541
591
|
__decorate6([
|
|
542
592
|
property6({ attribute: "aria-ordervalue", type: Number, reflect: true })
|
|
@@ -594,9 +644,15 @@ var styles = css7`
|
|
|
594
644
|
* An option row: one line, clipped, with its text centred against the row's min-height. All four
|
|
595
645
|
* were in the theme, set on this host from the document — which is also why the 'display: block'
|
|
596
646
|
* this file declared never took effect.
|
|
647
|
+
*
|
|
648
|
+
* Block-level flex, not inline-flex. The rows are stacked by being full-width, but inline-level
|
|
649
|
+
* rows still sit on ONE line in the menu's max-content pass, and the menu is a shrink-to-fit
|
|
650
|
+
* popover: it came out as wide as all options side by side (measured: rows "vind" + "vindt" gave
|
|
651
|
+
* a 107px menu under a 76px field). Block rows each start their own line, so the menu is as wide
|
|
652
|
+
* as its widest row, or the field it anchors to.
|
|
597
653
|
*/
|
|
598
654
|
:host {
|
|
599
|
-
display:
|
|
655
|
+
display: flex;
|
|
600
656
|
align-items: center;
|
|
601
657
|
white-space: nowrap;
|
|
602
658
|
overflow: hidden;
|
|
@@ -713,9 +769,9 @@ var qti_simple_associable_choice_styles_default = [
|
|
|
713
769
|
* draggable chip; in match's last match-set it is a drop target. In tabular match it is neither —
|
|
714
770
|
* drag-drop is off and it is a row or column header in a grid.
|
|
715
771
|
*
|
|
716
|
-
* So the drop-target rules key on :state(
|
|
772
|
+
* So the drop-target rules key on :state(drop), which the interaction sets on exactly the
|
|
717
773
|
* elements it tracks as droppables. Keying on the *absence* of a chip marker instead
|
|
718
|
-
* (:not(:state(
|
|
774
|
+
* (:not(:state(chip))) swept up every tabular header cell and gave each one a 4rem minimum.
|
|
719
775
|
*
|
|
720
776
|
* A state rather than an attribute, and this used to be written both ways. An attribute cannot
|
|
721
777
|
* be used by every host: the editor renders these choices inside a ProseMirror document, whose
|
|
@@ -724,7 +780,7 @@ var qti_simple_associable_choice_styles_default = [
|
|
|
724
780
|
* that observer, so the state is the form that works everywhere and the [qti-droppable]
|
|
725
781
|
* attribute that used to accompany it is gone. Positive opt-in, so tabular headers are untouched.
|
|
726
782
|
*/
|
|
727
|
-
:host(:is(:state(
|
|
783
|
+
:host(:is(:state(drop), [data-state~='drop'])) {
|
|
728
784
|
/*
|
|
729
785
|
* The CARD token, not the slot one. This element is a droppable only in match, and match
|
|
730
786
|
* publishes no measurement — so reading --qti-dropzone-min-height here meant reading a name
|
|
@@ -750,7 +806,7 @@ var qti_simple_associable_choice_styles_default = [
|
|
|
750
806
|
justify-content: space-between;
|
|
751
807
|
}
|
|
752
808
|
|
|
753
|
-
:host(:is(:state(
|
|
809
|
+
:host(:is(:state(drop), [data-state~='drop'])) [part~='drop'] {
|
|
754
810
|
/*
|
|
755
811
|
* Match's dropzones are NOT auto-sized from the chips: a match target is a category, and
|
|
756
812
|
* should look able to hold several answers rather than hugging the widest one. So this reads
|
|
@@ -790,7 +846,7 @@ var qti_simple_associable_choice_styles_default = [
|
|
|
790
846
|
}
|
|
791
847
|
|
|
792
848
|
/* The label sits against the drop region below it. */
|
|
793
|
-
:host(:is(:state(
|
|
849
|
+
:host(:is(:state(drop), [data-state~='drop'])) [part~='label'] {
|
|
794
850
|
align-content: flex-end;
|
|
795
851
|
}
|
|
796
852
|
|
|
@@ -800,12 +856,12 @@ var qti_simple_associable_choice_styles_default = [
|
|
|
800
856
|
* bank. The <slot> this replaced collapsed to nothing by accident; a div has to be told.
|
|
801
857
|
*
|
|
802
858
|
* Two conditions, because a chip identifies itself two ways:
|
|
803
|
-
* :state(
|
|
804
|
-
* [part~='
|
|
859
|
+
* :state(chip) a chip in the light-DOM bank, from the interaction's draggablesSelector
|
|
860
|
+
* [part~='chip'] a chip a drop target renders, where that selector cannot reach it — match's
|
|
805
861
|
* selector names a light-DOM ancestry the placed clone no longer has
|
|
806
862
|
*/
|
|
807
|
-
:host(:is(:state(
|
|
808
|
-
:host([part~='
|
|
863
|
+
:host(:is(:state(chip), [data-state~='chip'])) [part~='drop'],
|
|
864
|
+
:host([part~='chip']) [part~='drop'] {
|
|
809
865
|
display: none;
|
|
810
866
|
}
|
|
811
867
|
|
|
@@ -968,7 +1024,7 @@ var __decorate9 = function(decorators, target, key, desc) {
|
|
|
968
1024
|
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;
|
|
969
1025
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
970
1026
|
};
|
|
971
|
-
var QtiSimpleChoice = class extends ActiveElementMixin(LitElement10, "qti-simple-choice") {
|
|
1027
|
+
var QtiSimpleChoice = class extends ActiveElementMixin(LitElement10, "qti-simple-choice", { activateOn: "press" }) {
|
|
972
1028
|
constructor() {
|
|
973
1029
|
super(...arguments);
|
|
974
1030
|
this.templateIdentifier = null;
|
|
@@ -978,17 +1034,11 @@ var QtiSimpleChoice = class extends ActiveElementMixin(LitElement10, "qti-simple
|
|
|
978
1034
|
static {
|
|
979
1035
|
this.styles = qti_simple_choice_styles_default;
|
|
980
1036
|
}
|
|
981
|
-
static {
|
|
982
|
-
this.shadowRootOptions = {
|
|
983
|
-
...LitElement10.shadowRootOptions,
|
|
984
|
-
delegatesFocus: true
|
|
985
|
-
};
|
|
986
|
-
}
|
|
987
1037
|
get checked() {
|
|
988
1038
|
return this["internals"].states.has("checked");
|
|
989
1039
|
}
|
|
990
1040
|
render() {
|
|
991
|
-
return html10`<div part="control"
|
|
1041
|
+
return html10`<div part="control"><div part="control-mark"></div></div>
|
|
992
1042
|
${this.marker ? html10`<div id="label" part="marker">${this.marker}</div>` : nothing}
|
|
993
1043
|
<slot part="label"></slot>`;
|
|
994
1044
|
}
|
|
@@ -1068,7 +1118,7 @@ function applyDropzoneAutoSizing(host, draggables, droppables, dragContainers, o
|
|
|
1068
1118
|
}
|
|
1069
1119
|
});
|
|
1070
1120
|
}
|
|
1071
|
-
var DropzoneAutoSizeMixin = (superClass, draggablesSelector, droppablesSelector, dragContainersSelector = 'slot[part
|
|
1121
|
+
var DropzoneAutoSizeMixin = (superClass, draggablesSelector, droppablesSelector, dragContainersSelector = 'slot[part~="bank"]') => {
|
|
1072
1122
|
class DropzoneAutoSizeElement extends superClass {
|
|
1073
1123
|
constructor() {
|
|
1074
1124
|
super(...arguments);
|
|
@@ -1254,22 +1304,22 @@ var [Observable, Subscriber] = (() => {
|
|
|
1254
1304
|
const AsyncFromSyncIteratorPrototype = {
|
|
1255
1305
|
next(...args) {
|
|
1256
1306
|
const O = this;
|
|
1257
|
-
const
|
|
1258
|
-
if (!
|
|
1307
|
+
const state17 = privateState.get(O);
|
|
1308
|
+
if (!state17?.syncIteratorRecord)
|
|
1259
1309
|
throw new TypeError(
|
|
1260
1310
|
"AsyncFromSyncIteratorPrototype.next called on invalid object"
|
|
1261
1311
|
);
|
|
1262
|
-
const { syncIteratorRecord } =
|
|
1312
|
+
const { syncIteratorRecord } = state17;
|
|
1263
1313
|
return pTry(() => syncIteratorRecord.next(...args));
|
|
1264
1314
|
},
|
|
1265
1315
|
return(...args) {
|
|
1266
1316
|
const O = this;
|
|
1267
|
-
const
|
|
1268
|
-
if (!
|
|
1317
|
+
const state17 = privateState.get(O);
|
|
1318
|
+
if (!state17?.syncIteratorRecord)
|
|
1269
1319
|
throw new TypeError(
|
|
1270
1320
|
"AsyncFromSyncIteratorPrototype.return called on invalid object"
|
|
1271
1321
|
);
|
|
1272
|
-
const { syncIteratorRecord } =
|
|
1322
|
+
const { syncIteratorRecord } = state17;
|
|
1273
1323
|
return pTry(() => {
|
|
1274
1324
|
if (!syncIteratorRecord.return) return { value: void 0, done: true };
|
|
1275
1325
|
return syncIteratorRecord.return(...args);
|
|
@@ -1277,12 +1327,12 @@ var [Observable, Subscriber] = (() => {
|
|
|
1277
1327
|
},
|
|
1278
1328
|
throw(...args) {
|
|
1279
1329
|
const O = this;
|
|
1280
|
-
const
|
|
1281
|
-
if (!
|
|
1330
|
+
const state17 = privateState.get(O);
|
|
1331
|
+
if (!state17?.syncIteratorRecord)
|
|
1282
1332
|
throw new TypeError(
|
|
1283
1333
|
"AsyncFromSyncIteratorPrototype.throw called on invalid object"
|
|
1284
1334
|
);
|
|
1285
|
-
const { syncIteratorRecord } =
|
|
1335
|
+
const { syncIteratorRecord } = state17;
|
|
1286
1336
|
return pTry(() => {
|
|
1287
1337
|
if (!syncIteratorRecord.throw) {
|
|
1288
1338
|
syncIteratorRecord.return();
|
|
@@ -1348,11 +1398,11 @@ var [Observable, Subscriber] = (() => {
|
|
|
1348
1398
|
}
|
|
1349
1399
|
}
|
|
1350
1400
|
function closeASubscription(subscriber, reason) {
|
|
1351
|
-
const
|
|
1352
|
-
if (!
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
for (const teardown of
|
|
1401
|
+
const state17 = privateState.get(subscriber);
|
|
1402
|
+
if (!state17?.active) return;
|
|
1403
|
+
state17.active = false;
|
|
1404
|
+
state17.subscriptionController.abort(reason);
|
|
1405
|
+
for (const teardown of state17.teardowns.reverse()) {
|
|
1356
1406
|
if (isBrowserContext() && !isDocumentFullyActive(document)) return;
|
|
1357
1407
|
try {
|
|
1358
1408
|
teardown();
|
|
@@ -1433,10 +1483,10 @@ var [Observable, Subscriber] = (() => {
|
|
|
1433
1483
|
if (!(this instanceof Subscriber2))
|
|
1434
1484
|
throw new TypeError("illegal invocation");
|
|
1435
1485
|
if (!arguments.length) throw new TypeError("too few arguments");
|
|
1436
|
-
const
|
|
1437
|
-
if (!
|
|
1486
|
+
const state17 = privateState.get(this);
|
|
1487
|
+
if (!state17?.active) return;
|
|
1438
1488
|
if (isBrowserContext() && !isDocumentFullyActive(document)) return;
|
|
1439
|
-
const internalObservers = new Set(
|
|
1489
|
+
const internalObservers = new Set(state17.observers);
|
|
1440
1490
|
for (const observer of internalObservers) {
|
|
1441
1491
|
observer.next(value);
|
|
1442
1492
|
}
|
|
@@ -1446,14 +1496,14 @@ var [Observable, Subscriber] = (() => {
|
|
|
1446
1496
|
if (!(this instanceof Subscriber2))
|
|
1447
1497
|
throw new TypeError("illegal invocation");
|
|
1448
1498
|
if (!arguments.length) throw new TypeError("too few arguments");
|
|
1449
|
-
const
|
|
1450
|
-
if (!
|
|
1499
|
+
const state17 = privateState.get(this);
|
|
1500
|
+
if (!state17?.active) {
|
|
1451
1501
|
reportError(error);
|
|
1452
1502
|
return;
|
|
1453
1503
|
}
|
|
1454
1504
|
if (isBrowserContext() && !isDocumentFullyActive(document)) return;
|
|
1455
1505
|
closeASubscription(this, error);
|
|
1456
|
-
const internalObservers = new Set(
|
|
1506
|
+
const internalObservers = new Set(state17.observers);
|
|
1457
1507
|
for (const observer of internalObservers) {
|
|
1458
1508
|
observer.error(error);
|
|
1459
1509
|
}
|
|
@@ -1462,11 +1512,11 @@ var [Observable, Subscriber] = (() => {
|
|
|
1462
1512
|
complete() {
|
|
1463
1513
|
if (!(this instanceof Subscriber2))
|
|
1464
1514
|
throw new TypeError("illegal invocation");
|
|
1465
|
-
const
|
|
1466
|
-
if (!
|
|
1515
|
+
const state17 = privateState.get(this);
|
|
1516
|
+
if (!state17?.active) return;
|
|
1467
1517
|
if (isBrowserContext() && !isDocumentFullyActive(document)) return;
|
|
1468
1518
|
closeASubscription(this);
|
|
1469
|
-
const internalObservers = new Set(
|
|
1519
|
+
const internalObservers = new Set(state17.observers);
|
|
1470
1520
|
for (const observer of internalObservers) {
|
|
1471
1521
|
observer.complete();
|
|
1472
1522
|
}
|
|
@@ -1479,9 +1529,9 @@ var [Observable, Subscriber] = (() => {
|
|
|
1479
1529
|
throw new TypeError(`Parameter 1 is not of type 'Function'`);
|
|
1480
1530
|
}
|
|
1481
1531
|
if (isBrowserContext() && !isDocumentFullyActive(document)) return;
|
|
1482
|
-
const
|
|
1483
|
-
if (
|
|
1484
|
-
|
|
1532
|
+
const state17 = privateState.get(this);
|
|
1533
|
+
if (state17?.active)
|
|
1534
|
+
state17.teardowns.push(teardown);
|
|
1485
1535
|
else teardown();
|
|
1486
1536
|
}
|
|
1487
1537
|
get active() {
|
|
@@ -2536,7 +2586,7 @@ function containsPoint(zone, x, y) {
|
|
|
2536
2586
|
return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;
|
|
2537
2587
|
}
|
|
2538
2588
|
function closestCornersWithInventoryPriorityCollision(dropzones, clientX, clientY, dragElement, dragContainers) {
|
|
2539
|
-
const identifiedDragContainers = dragContainers && dragContainers.length > 0 ? dropzones.filter((zone) => dragContainers.includes(zone)) : dropzones.filter((zone) => zone.tagName === "SLOT" && zone.hasAttribute("part") && zone.getAttribute("part")?.includes("
|
|
2589
|
+
const identifiedDragContainers = dragContainers && dragContainers.length > 0 ? dropzones.filter((zone) => dragContainers.includes(zone)) : dropzones.filter((zone) => zone.tagName === "SLOT" && zone.hasAttribute("part") && zone.getAttribute("part")?.split(/\s+/).includes("bank"));
|
|
2540
2590
|
const allRegularDroppables = dropzones.filter((zone) => !identifiedDragContainers.includes(zone));
|
|
2541
2591
|
const regularDroppables = allRegularDroppables;
|
|
2542
2592
|
if (identifiedDragContainers.length === 0 && regularDroppables.length === 0)
|
|
@@ -2645,10 +2695,10 @@ function findDraggableTarget(event, draggablesSelector) {
|
|
|
2645
2695
|
const composedPath = event.composedPath ? event.composedPath() : [event.target];
|
|
2646
2696
|
for (const element of composedPath) {
|
|
2647
2697
|
if (element instanceof HTMLElement && element.tagName !== "SLOT") {
|
|
2648
|
-
if (element.matches(draggablesSelector) || element.hasAttribute("
|
|
2698
|
+
if (element.matches(draggablesSelector) || element.hasAttribute("data-draggable")) {
|
|
2649
2699
|
return element;
|
|
2650
2700
|
}
|
|
2651
|
-
const closest = element.closest(draggablesSelector) || element.closest('[
|
|
2701
|
+
const closest = element.closest(draggablesSelector) || element.closest('[data-draggable="true"]');
|
|
2652
2702
|
if (closest) {
|
|
2653
2703
|
return closest;
|
|
2654
2704
|
}
|
|
@@ -2665,50 +2715,61 @@ function isDraggableDisabled(target) {
|
|
|
2665
2715
|
return internals?.states?.has("disabled") ?? false;
|
|
2666
2716
|
}
|
|
2667
2717
|
var internalsOf = (el) => el?.internals;
|
|
2668
|
-
function setDragChipState(el,
|
|
2669
|
-
|
|
2670
|
-
if (!states)
|
|
2671
|
-
return;
|
|
2672
|
-
if (on)
|
|
2673
|
-
states.add(state14);
|
|
2674
|
-
else
|
|
2675
|
-
states.delete(state14);
|
|
2718
|
+
function setDragChipState(el, state17, on) {
|
|
2719
|
+
setState(internalsOf(el)?.states, state17, on);
|
|
2676
2720
|
}
|
|
2677
|
-
function hasDragChipState(el,
|
|
2678
|
-
return internalsOf(el)?.states
|
|
2721
|
+
function hasDragChipState(el, state17) {
|
|
2722
|
+
return hasState(internalsOf(el)?.states, state17);
|
|
2679
2723
|
}
|
|
2680
2724
|
function clearDragChipStates(el) {
|
|
2681
|
-
setDragChipState(el, "
|
|
2682
|
-
setDragChipState(el, "
|
|
2683
|
-
setDragChipState(el, "return-
|
|
2725
|
+
setDragChipState(el, "lifted", false);
|
|
2726
|
+
setDragChipState(el, "used", false);
|
|
2727
|
+
setDragChipState(el, "return-target", false);
|
|
2684
2728
|
}
|
|
2685
2729
|
function isDragChipHidden(el) {
|
|
2686
|
-
return hasDragChipState(el, "
|
|
2730
|
+
return hasDragChipState(el, "lifted") || hasDragChipState(el, "used");
|
|
2687
2731
|
}
|
|
2732
|
+
var DROP_FLAG_ALIASES = {
|
|
2733
|
+
filled: [],
|
|
2734
|
+
full: [],
|
|
2735
|
+
"drag-active": ["active", "enabled"],
|
|
2736
|
+
"drag-over": ["hover"]
|
|
2737
|
+
};
|
|
2688
2738
|
function setDropFlag(el, flag, on) {
|
|
2689
2739
|
if (!el)
|
|
2690
2740
|
return;
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
else
|
|
2694
|
-
el.removeAttribute(flag);
|
|
2695
|
-
const states = internalsOf(el)?.states;
|
|
2696
|
-
if (states) {
|
|
2741
|
+
const names = [flag, ...DROP_FLAG_ALIASES[flag]];
|
|
2742
|
+
for (const name of names) {
|
|
2697
2743
|
if (on)
|
|
2698
|
-
|
|
2744
|
+
el.setAttribute(name, "");
|
|
2699
2745
|
else
|
|
2700
|
-
|
|
2746
|
+
el.removeAttribute(name);
|
|
2747
|
+
}
|
|
2748
|
+
const states = internalsOf(el)?.states;
|
|
2749
|
+
if (states) {
|
|
2750
|
+
setState(states, flag, on, DROP_FLAG_ALIASES[flag]);
|
|
2701
2751
|
return;
|
|
2702
2752
|
}
|
|
2703
2753
|
const tokens = new Set((el.getAttribute("part") ?? "").split(/\s+/).filter(Boolean));
|
|
2704
|
-
if (!tokens.has("drop"))
|
|
2754
|
+
if (!tokens.has("drop") && !tokens.has("bank"))
|
|
2705
2755
|
return;
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2756
|
+
for (const name of names) {
|
|
2757
|
+
if (on)
|
|
2758
|
+
tokens.add(name);
|
|
2759
|
+
else
|
|
2760
|
+
tokens.delete(name);
|
|
2761
|
+
}
|
|
2710
2762
|
el.setAttribute("part", [...tokens].join(" "));
|
|
2711
2763
|
}
|
|
2764
|
+
function setDropFull(el, full) {
|
|
2765
|
+
if (!el)
|
|
2766
|
+
return;
|
|
2767
|
+
if (full)
|
|
2768
|
+
el.setAttribute("disabled", "");
|
|
2769
|
+
else
|
|
2770
|
+
el.removeAttribute("disabled");
|
|
2771
|
+
setDropFlag(el, "full", full);
|
|
2772
|
+
}
|
|
2712
2773
|
function setDropFilled(el, filled) {
|
|
2713
2774
|
setDropFlag(el, "filled", filled);
|
|
2714
2775
|
}
|
|
@@ -2771,7 +2832,7 @@ var resolveDragCloneHost = (dragSource, preferredHost) => {
|
|
|
2771
2832
|
return hostFor(fullscreenElement);
|
|
2772
2833
|
return host;
|
|
2773
2834
|
};
|
|
2774
|
-
var measureFixedFrame = (host) => {
|
|
2835
|
+
var measureFixedFrame = (host, ownZoom = 1) => {
|
|
2775
2836
|
const ownerDocument = host.ownerDocument ?? document;
|
|
2776
2837
|
const probe = ownerDocument.createElement("div");
|
|
2777
2838
|
probe.style.cssText = `position:fixed;left:0;top:0;width:${PROBE_SIZE}px;height:${PROBE_SIZE}px;margin:0;padding:0;border:0;visibility:hidden;pointer-events:none;`;
|
|
@@ -2780,7 +2841,9 @@ var measureFixedFrame = (host) => {
|
|
|
2780
2841
|
probe.remove();
|
|
2781
2842
|
return {
|
|
2782
2843
|
origin: { x: rect.left, y: rect.top },
|
|
2783
|
-
|
|
2844
|
+
// The clone's own `zoom` (copied from the chip with the rest of its computed style) multiplies
|
|
2845
|
+
// its left/top/width/height on top of whatever scales the host, so it is part of the frame.
|
|
2846
|
+
scale: { x: (rect.width / PROBE_SIZE || 1) * ownZoom, y: (rect.height / PROBE_SIZE || 1) * ownZoom }
|
|
2784
2847
|
};
|
|
2785
2848
|
};
|
|
2786
2849
|
var toFrameCoordinates = (frame, x, y) => ({
|
|
@@ -2801,7 +2864,7 @@ function patchWindow(window2) {
|
|
|
2801
2864
|
patchedWindows.add(window2);
|
|
2802
2865
|
}
|
|
2803
2866
|
var hasStates = (el) => !!el.internals?.states;
|
|
2804
|
-
var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dragContainersSelector = 'slot[part
|
|
2867
|
+
var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dragContainersSelector = 'slot[part~="bank"]', defaultCollisionAlgorithm = "pointerWithin") => {
|
|
2805
2868
|
class DragDropCoreElement extends superClass {
|
|
2806
2869
|
constructor() {
|
|
2807
2870
|
super(...arguments);
|
|
@@ -2821,6 +2884,8 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
2821
2884
|
returnAnchorItems: []
|
|
2822
2885
|
};
|
|
2823
2886
|
this.cloneFrame = IDENTITY_FIXED_FRAME;
|
|
2887
|
+
this.cursorBeforeDrag = null;
|
|
2888
|
+
this.cloneZoom = 1;
|
|
2824
2889
|
this.subscriptions = [];
|
|
2825
2890
|
this.dragSubscriptions = [];
|
|
2826
2891
|
this.lastPointerDownAt = 0;
|
|
@@ -2918,8 +2983,8 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
2918
2983
|
const collect = (selector, scope) => Array.from(scope?.querySelectorAll(selector) ?? []);
|
|
2919
2984
|
const lightDraggables = collect(draggablesSelector, this);
|
|
2920
2985
|
const shadowDraggables = collect(draggablesSelector, this.shadowRoot);
|
|
2921
|
-
const lightClones = collect('[
|
|
2922
|
-
const shadowClones = collect('[
|
|
2986
|
+
const lightClones = collect('[data-draggable="true"]:not([data-drag-clone])', this);
|
|
2987
|
+
const shadowClones = collect('[data-draggable="true"]:not([data-drag-clone])', this.shadowRoot);
|
|
2923
2988
|
const registeredDraggables = this.registeredMatching(draggablesSelector);
|
|
2924
2989
|
this.trackedDraggables = Array.from(/* @__PURE__ */ new Set([...lightDraggables, ...shadowDraggables, ...lightClones, ...shadowClones, ...registeredDraggables]));
|
|
2925
2990
|
const lightDroppables = collect(droppablesSelector, this);
|
|
@@ -2938,20 +3003,14 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
2938
3003
|
for (const el of this.#statefulRoleElements) {
|
|
2939
3004
|
if (currentStateful.has(el))
|
|
2940
3005
|
continue;
|
|
2941
|
-
el.internals.states
|
|
2942
|
-
el.internals.states
|
|
3006
|
+
setState(el.internals.states, "chip", false);
|
|
3007
|
+
setState(el.internals.states, "drop", false);
|
|
2943
3008
|
}
|
|
2944
3009
|
for (const el of currentStateful) {
|
|
2945
3010
|
const isDrag = dragRoleSet.has(el);
|
|
2946
3011
|
const isDrop = !isDrag && effectiveDroppableSet.has(el);
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
else
|
|
2950
|
-
el.internals.states.delete("drag");
|
|
2951
|
-
if (isDrop)
|
|
2952
|
-
el.internals.states.add("droppable");
|
|
2953
|
-
else
|
|
2954
|
-
el.internals.states.delete("droppable");
|
|
3012
|
+
setState(el.internals.states, "chip", isDrag);
|
|
3013
|
+
setState(el.internals.states, "drop", isDrop);
|
|
2955
3014
|
}
|
|
2956
3015
|
this.#statefulRoleElements = currentStateful;
|
|
2957
3016
|
this.trackedDraggables.forEach((draggable) => {
|
|
@@ -2963,7 +3022,7 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
2963
3022
|
draggable.style.touchAction = "none";
|
|
2964
3023
|
draggable.style.webkitUserSelect = "none";
|
|
2965
3024
|
draggable.style.webkitTouchCallout = "none";
|
|
2966
|
-
draggable.setAttribute("
|
|
3025
|
+
draggable.setAttribute("data-draggable", "true");
|
|
2967
3026
|
draggable.setAttribute("tabindex", "0");
|
|
2968
3027
|
} else {
|
|
2969
3028
|
draggable.style.cursor = "";
|
|
@@ -2971,7 +3030,7 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
2971
3030
|
draggable.style.touchAction = "";
|
|
2972
3031
|
draggable.style.webkitUserSelect = "";
|
|
2973
3032
|
draggable.style.webkitTouchCallout = "";
|
|
2974
|
-
draggable.removeAttribute("
|
|
3033
|
+
draggable.removeAttribute("data-draggable");
|
|
2975
3034
|
if (draggable.getAttribute("tabindex") === "0") {
|
|
2976
3035
|
draggable.removeAttribute("tabindex");
|
|
2977
3036
|
}
|
|
@@ -3083,6 +3142,8 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
3083
3142
|
if (target && ["Space", "Enter"].includes(e.code) && !hostDisabled && !targetDisabled) {
|
|
3084
3143
|
e.preventDefault();
|
|
3085
3144
|
target.setAttribute("data-keyboard-dragging", "true");
|
|
3145
|
+
setDragChipState(target, "lifted", true);
|
|
3146
|
+
this.activateAllDroppables(this.trackedDroppables.some((d) => d.contains(target) || !!d.shadowRoot?.contains(target)));
|
|
3086
3147
|
keyboardState = {
|
|
3087
3148
|
dragging: true,
|
|
3088
3149
|
dragElement: target,
|
|
@@ -3119,7 +3180,7 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
3119
3180
|
this.handleInvalidDrop(keyboardState.dragElement);
|
|
3120
3181
|
}
|
|
3121
3182
|
}
|
|
3122
|
-
this.
|
|
3183
|
+
this.endKeyboardDrag();
|
|
3123
3184
|
this.saveResponse();
|
|
3124
3185
|
keyboardState = {
|
|
3125
3186
|
dragging: false,
|
|
@@ -3132,7 +3193,7 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
3132
3193
|
}
|
|
3133
3194
|
case "Escape": {
|
|
3134
3195
|
e.preventDefault();
|
|
3135
|
-
this.
|
|
3196
|
+
this.endKeyboardDrag();
|
|
3136
3197
|
keyboardState = {
|
|
3137
3198
|
dragging: false,
|
|
3138
3199
|
dragElement: null,
|
|
@@ -3144,9 +3205,9 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
3144
3205
|
}
|
|
3145
3206
|
}
|
|
3146
3207
|
}
|
|
3147
|
-
this.allDropzones.forEach((zone) => zone
|
|
3208
|
+
this.allDropzones.forEach((zone) => setDropFlag(zone, "drag-over", false));
|
|
3148
3209
|
if (keyboardState.dragging && keyboardState.dropElement) {
|
|
3149
|
-
keyboardState.dropElement
|
|
3210
|
+
setDropFlag(keyboardState.dropElement, "drag-over", true);
|
|
3150
3211
|
if (keyboardState.dropElement.hasAttribute("tabindex") && keyboardState.dropElement.getAttribute("tabindex") !== "-1") {
|
|
3151
3212
|
keyboardState.dropElement.focus();
|
|
3152
3213
|
}
|
|
@@ -3188,22 +3249,28 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
3188
3249
|
this.dragState.dragClone?.setAttribute("data-drag-origin", "droppable");
|
|
3189
3250
|
this.removeChipFromDroppable(sourceDroppable, dragElement);
|
|
3190
3251
|
this.cacheInteractiveElements();
|
|
3252
|
+
setDropFull(sourceDroppable, false);
|
|
3191
3253
|
if (sourceDroppable) {
|
|
3192
3254
|
sourceDroppable.setAttribute("data-drag-source", "true");
|
|
3193
3255
|
}
|
|
3194
3256
|
const identifier = dragElement.getAttribute("identifier");
|
|
3195
3257
|
if (identifier) {
|
|
3196
3258
|
const anchors = findInventoryItems(this.trackedDragContainers, identifier);
|
|
3197
|
-
anchors.forEach((item) => setDragChipState(item, "return-
|
|
3259
|
+
anchors.forEach((item) => setDragChipState(item, "return-target", true));
|
|
3198
3260
|
this.dragState.returnAnchorItems = anchors;
|
|
3199
3261
|
}
|
|
3200
3262
|
} else {
|
|
3201
3263
|
this.dragState.dragClone?.setAttribute("data-drag-origin", "inventory");
|
|
3202
|
-
setDragChipState(dragElement, "
|
|
3264
|
+
setDragChipState(dragElement, "lifted", true);
|
|
3203
3265
|
}
|
|
3204
3266
|
this.updateClonePosition(startX, startY);
|
|
3205
|
-
this.activateAllDroppables();
|
|
3267
|
+
this.activateAllDroppables(isCloneInDroppable);
|
|
3206
3268
|
this.watchDragCloneHost();
|
|
3269
|
+
if (eventSource === "pointer") {
|
|
3270
|
+
const root = this.ownerDocument.documentElement;
|
|
3271
|
+
this.cursorBeforeDrag = root.style.cursor;
|
|
3272
|
+
root.style.cursor = "grabbing";
|
|
3273
|
+
}
|
|
3207
3274
|
this.setupMoveObservables(inputType, eventSource);
|
|
3208
3275
|
}
|
|
3209
3276
|
setupMoveObservables(inputType, eventSource = "pointer") {
|
|
@@ -3330,9 +3397,9 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
3330
3397
|
const MIN_TARGET_SWITCH_INTERVAL = 50;
|
|
3331
3398
|
if (dropTarget !== this.dragState.currentTarget) {
|
|
3332
3399
|
if (dropTarget === null || timeSinceLastChange >= MIN_TARGET_SWITCH_INTERVAL) {
|
|
3333
|
-
this.allDropzones.forEach((zone) => setDropFlag(zone, "
|
|
3400
|
+
this.allDropzones.forEach((zone) => setDropFlag(zone, "drag-over", false));
|
|
3334
3401
|
if (dropTarget) {
|
|
3335
|
-
setDropFlag(dropTarget, "
|
|
3402
|
+
setDropFlag(dropTarget, "drag-over", true);
|
|
3336
3403
|
}
|
|
3337
3404
|
this.dragState.currentTarget = dropTarget;
|
|
3338
3405
|
this.dragState.lastTargetChangeTime = now;
|
|
@@ -3352,7 +3419,7 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
3352
3419
|
const canDrop = !!dragSource && !!dropTarget && this.allowDrop(dragSource, dropTarget);
|
|
3353
3420
|
if (canDrop && dragSource && dropTarget) {
|
|
3354
3421
|
this.handleDrop(dragSource, dropTarget);
|
|
3355
|
-
setDragChipState(dragSource, "
|
|
3422
|
+
setDragChipState(dragSource, "lifted", false);
|
|
3356
3423
|
} else {
|
|
3357
3424
|
this.handleInvalidDrop(dragSource);
|
|
3358
3425
|
}
|
|
@@ -3360,7 +3427,7 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
3360
3427
|
dragClone.remove();
|
|
3361
3428
|
}
|
|
3362
3429
|
(this.dragState.returnAnchorItems || []).forEach((item) => {
|
|
3363
|
-
setDragChipState(item, "return-
|
|
3430
|
+
setDragChipState(item, "return-target", false);
|
|
3364
3431
|
});
|
|
3365
3432
|
if (this.dragState.touchCleanup) {
|
|
3366
3433
|
this.dragState.touchCleanup();
|
|
@@ -3387,11 +3454,13 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
3387
3454
|
const clone = element.cloneNode(true);
|
|
3388
3455
|
const computedStyles = window.getComputedStyle(element);
|
|
3389
3456
|
for (let i = 0; i < computedStyles.length; i++) {
|
|
3390
|
-
const
|
|
3391
|
-
clone.style.setProperty(
|
|
3457
|
+
const property28 = computedStyles[i];
|
|
3458
|
+
clone.style.setProperty(property28, computedStyles.getPropertyValue(property28));
|
|
3392
3459
|
}
|
|
3460
|
+
clone.style.removeProperty("box-shadow");
|
|
3393
3461
|
const host = resolveDragCloneHost(element.isConnected ? element : this, this.dragCloneRoot());
|
|
3394
|
-
this.
|
|
3462
|
+
this.cloneZoom = parseFloat(computedStyles.zoom) || 1;
|
|
3463
|
+
this.cloneFrame = measureFixedFrame(host, this.cloneZoom);
|
|
3395
3464
|
clone.style.position = "fixed";
|
|
3396
3465
|
clone.style.width = `${rect.width / this.cloneFrame.scale.x}px`;
|
|
3397
3466
|
clone.style.height = `${rect.height / this.cloneFrame.scale.y}px`;
|
|
@@ -3399,8 +3468,7 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
3399
3468
|
clone.style.pointerEvents = "none";
|
|
3400
3469
|
clone.style.touchAction = "none";
|
|
3401
3470
|
clone.style.userSelect = "none";
|
|
3402
|
-
clone.
|
|
3403
|
-
clone.removeAttribute("qti-draggable");
|
|
3471
|
+
clone.removeAttribute("data-draggable");
|
|
3404
3472
|
clone.removeAttribute("tabindex");
|
|
3405
3473
|
clone.setAttribute("data-drag-clone", "true");
|
|
3406
3474
|
clone.setAttribute("data-drag-interaction", this.tagName.toLowerCase());
|
|
@@ -3450,7 +3518,7 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
3450
3518
|
if (host === dragClone.parentNode)
|
|
3451
3519
|
return;
|
|
3452
3520
|
host.appendChild(dragClone);
|
|
3453
|
-
this.cloneFrame = measureFixedFrame(host);
|
|
3521
|
+
this.cloneFrame = measureFixedFrame(host, this.cloneZoom);
|
|
3454
3522
|
if (lastCoordinates) {
|
|
3455
3523
|
this.updateClonePosition(lastCoordinates.x, lastCoordinates.y);
|
|
3456
3524
|
}
|
|
@@ -3464,29 +3532,44 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
3464
3532
|
}
|
|
3465
3533
|
});
|
|
3466
3534
|
}
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3535
|
+
/**
|
|
3536
|
+
* A drag is in progress: the host and every target carry `drag-active` (CONTRACT.md §3). The
|
|
3537
|
+
* bank carries it only when the chip comes from a target: then the bank can take it back, and
|
|
3538
|
+
* lights up as a place to drop. A chip lifted out of the bank itself gives the bank nothing to
|
|
3539
|
+
* say. The host's old pair `dragzone-enabled` + `dragzone-active` is set alongside for one major.
|
|
3540
|
+
*/
|
|
3541
|
+
activateAllDroppables(fromDroppable = false) {
|
|
3542
|
+
this.setDragActive(true);
|
|
3470
3543
|
this.allDropzones.forEach((zone) => {
|
|
3471
|
-
|
|
3472
|
-
setDropFlag(zone, "active",
|
|
3544
|
+
const isBank = this.trackedDragContainers.includes(zone);
|
|
3545
|
+
setDropFlag(zone, "drag-active", fromDroppable || !isBank);
|
|
3473
3546
|
});
|
|
3474
3547
|
}
|
|
3475
3548
|
deactivateAllDroppables() {
|
|
3476
|
-
this.
|
|
3477
|
-
this.setInternalsState("dragzone-active", false);
|
|
3549
|
+
this.setDragActive(false);
|
|
3478
3550
|
this.allDropzones.forEach((zone) => {
|
|
3479
|
-
setDropFlag(zone, "
|
|
3480
|
-
setDropFlag(zone, "
|
|
3481
|
-
|
|
3551
|
+
setDropFlag(zone, "drag-active", false);
|
|
3552
|
+
setDropFlag(zone, "drag-over", false);
|
|
3553
|
+
});
|
|
3554
|
+
}
|
|
3555
|
+
/** The keyboard drag is over, dropped or cancelled: clear what the pick-up set. */
|
|
3556
|
+
endKeyboardDrag() {
|
|
3557
|
+
this.trackedDraggables.forEach((d) => {
|
|
3558
|
+
if (d.hasAttribute("data-keyboard-dragging"))
|
|
3559
|
+
setDragChipState(d, "lifted", false);
|
|
3560
|
+
d.removeAttribute("data-keyboard-dragging");
|
|
3482
3561
|
});
|
|
3562
|
+
this.deactivateAllDroppables();
|
|
3563
|
+
}
|
|
3564
|
+
setDragActive(on) {
|
|
3565
|
+
setState(this._internals?.states, "drag-active", on, ["dragzone-active", "dragzone-enabled"]);
|
|
3483
3566
|
}
|
|
3484
3567
|
resetDragState() {
|
|
3485
3568
|
if (this.dragState.activationTimeout) {
|
|
3486
3569
|
clearTimeout(this.dragState.activationTimeout);
|
|
3487
3570
|
}
|
|
3488
3571
|
(this.dragState.returnAnchorItems || []).forEach((item) => {
|
|
3489
|
-
setDragChipState(item, "return-
|
|
3572
|
+
setDragChipState(item, "return-target", false);
|
|
3490
3573
|
});
|
|
3491
3574
|
if (this.dragState.touchCleanup) {
|
|
3492
3575
|
try {
|
|
@@ -3506,6 +3589,11 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
3506
3589
|
});
|
|
3507
3590
|
this.dragSubscriptions = [];
|
|
3508
3591
|
this.cloneFrame = IDENTITY_FIXED_FRAME;
|
|
3592
|
+
this.cloneZoom = 1;
|
|
3593
|
+
if (this.cursorBeforeDrag !== null) {
|
|
3594
|
+
this.ownerDocument.documentElement.style.cursor = this.cursorBeforeDrag;
|
|
3595
|
+
this.cursorBeforeDrag = null;
|
|
3596
|
+
}
|
|
3509
3597
|
this.dragState = {
|
|
3510
3598
|
dragging: false,
|
|
3511
3599
|
dragSource: null,
|
|
@@ -3520,14 +3608,14 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
3520
3608
|
returnAnchorItems: []
|
|
3521
3609
|
};
|
|
3522
3610
|
}
|
|
3523
|
-
setInternalsState(
|
|
3611
|
+
setInternalsState(state17, enabled) {
|
|
3524
3612
|
const internals = this._internals;
|
|
3525
3613
|
if (!internals?.states)
|
|
3526
3614
|
return;
|
|
3527
3615
|
if (enabled) {
|
|
3528
|
-
internals.states.add(
|
|
3616
|
+
internals.states.add(state17);
|
|
3529
3617
|
} else {
|
|
3530
|
-
internals.states.delete(
|
|
3618
|
+
internals.states.delete(state17);
|
|
3531
3619
|
}
|
|
3532
3620
|
}
|
|
3533
3621
|
cleanup() {
|
|
@@ -3544,8 +3632,8 @@ var DragDropCoreMixin = (superClass, draggablesSelector, droppablesSelector, dra
|
|
|
3544
3632
|
for (const el of this.#statefulRoleElements) {
|
|
3545
3633
|
if (!hasStates(el))
|
|
3546
3634
|
continue;
|
|
3547
|
-
el.internals.states
|
|
3548
|
-
el.internals.states
|
|
3635
|
+
setState(el.internals.states, "chip", false);
|
|
3636
|
+
setState(el.internals.states, "drop", false);
|
|
3549
3637
|
}
|
|
3550
3638
|
this.#statefulRoleElements.clear();
|
|
3551
3639
|
this.resetDragState();
|
|
@@ -3653,15 +3741,14 @@ var __decorate11 = function(decorators, target, key, desc) {
|
|
|
3653
3741
|
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;
|
|
3654
3742
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3655
3743
|
};
|
|
3656
|
-
var DragDropSlottedMixin = (superClass, draggablesSelector, droppablesSelector, dragContainersSelector = 'slot[part
|
|
3744
|
+
var DragDropSlottedMixin = (superClass, draggablesSelector, droppablesSelector, dragContainersSelector = 'slot[part~="bank"]', collisionAlgorithm = "closestCornersWithInventoryPriority") => {
|
|
3657
3745
|
const AutoSized = DropzoneAutoSizeMixin(superClass, draggablesSelector, droppablesSelector, dragContainersSelector);
|
|
3658
3746
|
const Core = DragDropCoreMixin(AutoSized, draggablesSelector, droppablesSelector, dragContainersSelector, collisionAlgorithm);
|
|
3659
3747
|
class DragDropSlottedElement extends Core {
|
|
3660
3748
|
constructor() {
|
|
3661
3749
|
super(...arguments);
|
|
3662
3750
|
this.minAssociations = 1;
|
|
3663
|
-
this.
|
|
3664
|
-
this._maxAssociationsDefaultApplied = false;
|
|
3751
|
+
this.maxAssociations = 0;
|
|
3665
3752
|
this._response = [];
|
|
3666
3753
|
this._dragDrop = { dragsByTarget: {}, countByTarget: {}, nodesByTarget: {} };
|
|
3667
3754
|
this.#placement = /* @__PURE__ */ new WeakMap();
|
|
@@ -3675,22 +3762,6 @@ var DragDropSlottedMixin = (superClass, draggablesSelector, droppablesSelector,
|
|
|
3675
3762
|
this._enableFlipAnimations = true;
|
|
3676
3763
|
this._pendingResponse = void 0;
|
|
3677
3764
|
}
|
|
3678
|
-
get maxAssociations() {
|
|
3679
|
-
if (!this._maxAssociationsDefaultApplied) {
|
|
3680
|
-
this._maxAssociationsDefaultApplied = true;
|
|
3681
|
-
const tagName = this.tagName?.toLowerCase() || "";
|
|
3682
|
-
const isGapMatchInteraction = tagName === "qti-graphic-gap-match-interaction" || tagName === "qti-gap-match-interaction";
|
|
3683
|
-
if (isGapMatchInteraction && !this.hasAttribute("max-associations") && this._maxAssociations === 0) {
|
|
3684
|
-
this._maxAssociations = 1;
|
|
3685
|
-
}
|
|
3686
|
-
}
|
|
3687
|
-
return this._maxAssociations;
|
|
3688
|
-
}
|
|
3689
|
-
set maxAssociations(value) {
|
|
3690
|
-
const oldValue = this._maxAssociations;
|
|
3691
|
-
this._maxAssociations = value;
|
|
3692
|
-
this.requestUpdate("maxAssociations", oldValue);
|
|
3693
|
-
}
|
|
3694
3765
|
/**
|
|
3695
3766
|
* The one place that reads placement out of the DOM.
|
|
3696
3767
|
*
|
|
@@ -3780,7 +3851,7 @@ var DragDropSlottedMixin = (superClass, draggablesSelector, droppablesSelector,
|
|
|
3780
3851
|
if (!targetId)
|
|
3781
3852
|
continue;
|
|
3782
3853
|
const bySelector = this.chipsIn(droppable);
|
|
3783
|
-
const byAttribute = this.isDeclarativeTarget(droppable) ? bySelector : Array.from(droppable.querySelectorAll('[
|
|
3854
|
+
const byAttribute = this.isDeclarativeTarget(droppable) ? bySelector : Array.from(droppable.querySelectorAll('[data-draggable="true"]'));
|
|
3784
3855
|
dragsByTarget[targetId] = bySelector.map((chip) => chip.getAttribute("identifier")).filter((id) => Boolean(id));
|
|
3785
3856
|
countByTarget[targetId] = Math.max(bySelector.length, byAttribute.length);
|
|
3786
3857
|
nodesByTarget[targetId] = bySelector;
|
|
@@ -3883,6 +3954,8 @@ var DragDropSlottedMixin = (superClass, draggablesSelector, droppablesSelector,
|
|
|
3883
3954
|
this._response = typeof value === "string" && value.length > 0 ? [value] : [];
|
|
3884
3955
|
}
|
|
3885
3956
|
this._internals.setFormValue(JSON.stringify(this._response));
|
|
3957
|
+
if (this.trackedDroppables?.length)
|
|
3958
|
+
this.validate();
|
|
3886
3959
|
}
|
|
3887
3960
|
afterCache() {
|
|
3888
3961
|
this.updateMinDimensionsForDropZones();
|
|
@@ -3954,7 +4027,7 @@ var DragDropSlottedMixin = (superClass, draggablesSelector, droppablesSelector,
|
|
|
3954
4027
|
this.updateInventoryBasedOnMatchMax(identifier);
|
|
3955
4028
|
}
|
|
3956
4029
|
this.validate();
|
|
3957
|
-
this.reportValidity();
|
|
4030
|
+
this.reportValidity({ trigger: "change" });
|
|
3958
4031
|
}
|
|
3959
4032
|
handleInvalidDrop(dragSource) {
|
|
3960
4033
|
const sourceDroppable = this.dragState.sourceDroppable;
|
|
@@ -3968,7 +4041,7 @@ var DragDropSlottedMixin = (superClass, draggablesSelector, droppablesSelector,
|
|
|
3968
4041
|
this.dropDraggableInDroppable(dragSource, inventoryReturnTarget);
|
|
3969
4042
|
} else if (sourceDroppable && this.trackedDroppables.includes(sourceDroppable)) {
|
|
3970
4043
|
this.dropDraggableInDroppable(dragSource, sourceDroppable, this.dragState.dragClone?.getBoundingClientRect());
|
|
3971
|
-
} else if (hasDragChipState(dragSource, "
|
|
4044
|
+
} else if (hasDragChipState(dragSource, "lifted")) {
|
|
3972
4045
|
this.restoreInventoryItem(dragSource, this.dragState.dragClone?.getBoundingClientRect());
|
|
3973
4046
|
const identifier = dragSource.getAttribute("identifier");
|
|
3974
4047
|
if (identifier) {
|
|
@@ -3982,7 +4055,7 @@ var DragDropSlottedMixin = (superClass, draggablesSelector, droppablesSelector,
|
|
|
3982
4055
|
const attemptedDisabledTarget = !!currentTarget && currentTarget.hasAttribute("disabled") && !currentTarget.hasAttribute("data-drag-source");
|
|
3983
4056
|
this._dropBlockedDueToMax = attemptedDisabledTarget && maxReached;
|
|
3984
4057
|
this.validate();
|
|
3985
|
-
this.reportValidity();
|
|
4058
|
+
this.reportValidity({ trigger: "change" });
|
|
3986
4059
|
}
|
|
3987
4060
|
/**
|
|
3988
4061
|
* Fly a chip home from wherever it was last seen on screen.
|
|
@@ -4051,10 +4124,10 @@ var DragDropSlottedMixin = (superClass, draggablesSelector, droppablesSelector,
|
|
|
4051
4124
|
const parsedMatchMax = parseInt(droppable.getAttribute("match-max") || "1", 10);
|
|
4052
4125
|
const matchMax = Number.isNaN(parsedMatchMax) ? 1 : parsedMatchMax;
|
|
4053
4126
|
const allowsMultiple = matchMax === 0 || matchMax > 1;
|
|
4054
|
-
const existingChildren = Array.from(droppable.querySelectorAll('[
|
|
4127
|
+
const existingChildren = Array.from(droppable.querySelectorAll('[data-draggable="true"]'));
|
|
4055
4128
|
const flipStates = this.enableFlipAnimations && existingChildren.length > 0 ? captureMultipleFlipStates(existingChildren) : null;
|
|
4056
4129
|
if (!allowsMultiple) {
|
|
4057
|
-
const existing = this.chipsIn(droppable)[0] ?? (this.isDeclarativeTarget(droppable) ? null : droppable.querySelector('[
|
|
4130
|
+
const existing = this.chipsIn(droppable)[0] ?? (this.isDeclarativeTarget(droppable) ? null : droppable.querySelector('[data-draggable="true"]'));
|
|
4058
4131
|
if (existing) {
|
|
4059
4132
|
const existingId = existing.getAttribute("identifier");
|
|
4060
4133
|
const evictedFrom = existing.getBoundingClientRect();
|
|
@@ -4073,11 +4146,15 @@ var DragDropSlottedMixin = (superClass, draggablesSelector, droppablesSelector,
|
|
|
4073
4146
|
const cleanClone = draggable.cloneNode(true);
|
|
4074
4147
|
cleanClone.removeAttribute("style");
|
|
4075
4148
|
cleanClone.removeAttribute("data-keyboard-dragging");
|
|
4076
|
-
cleanClone.setAttribute("
|
|
4149
|
+
cleanClone.setAttribute("data-draggable", "true");
|
|
4077
4150
|
cleanClone.setAttribute("tabindex", "0");
|
|
4078
4151
|
if (this.isDeclarativeTarget(droppable)) {
|
|
4079
|
-
cleanClone.setAttribute("part", "drag");
|
|
4080
|
-
cleanClone.setAttribute("exportparts",
|
|
4152
|
+
cleanClone.setAttribute("part", cleanClone.localName === "qti-gap-text" ? "chip text drag drag-text" : "chip drag");
|
|
4153
|
+
cleanClone.setAttribute("exportparts", [
|
|
4154
|
+
"control: chip-control, control: drag-control, label: chip-label, label: drag-label",
|
|
4155
|
+
"correction, candidate-correct, candidate-incorrect, candidate-partial",
|
|
4156
|
+
"correction-correct, correction-incorrect, correction-partially-correct"
|
|
4157
|
+
].join(", "));
|
|
4081
4158
|
this.placeChip(droppable, cleanClone);
|
|
4082
4159
|
} else if (droppable.tagName === "SLOT") {
|
|
4083
4160
|
cleanClone.setAttribute("slot", droppable.getAttribute("name") || "");
|
|
@@ -4098,16 +4175,7 @@ var DragDropSlottedMixin = (superClass, draggablesSelector, droppablesSelector,
|
|
|
4098
4175
|
const deltaX = dragClonePosition.left - finalPosition.left;
|
|
4099
4176
|
const deltaY = dragClonePosition.top - finalPosition.top;
|
|
4100
4177
|
if (deltaX !== 0 || deltaY !== 0) {
|
|
4101
|
-
cleanClone.animate([
|
|
4102
|
-
{
|
|
4103
|
-
transform: `translate(${deltaX}px, ${deltaY}px)`,
|
|
4104
|
-
opacity: 0.8
|
|
4105
|
-
},
|
|
4106
|
-
{
|
|
4107
|
-
transform: "translate(0, 0)",
|
|
4108
|
-
opacity: 1
|
|
4109
|
-
}
|
|
4110
|
-
], {
|
|
4178
|
+
cleanClone.animate([{ transform: `translate(${deltaX}px, ${deltaY}px)` }, { transform: "translate(0, 0)" }], {
|
|
4111
4179
|
duration: this.flipAnimationConfig.duration || 200,
|
|
4112
4180
|
easing: this.flipAnimationConfig.easing || "ease",
|
|
4113
4181
|
fill: "both"
|
|
@@ -4147,7 +4215,7 @@ var DragDropSlottedMixin = (superClass, draggablesSelector, droppablesSelector,
|
|
|
4147
4215
|
const returning = new Set(inventoryItems);
|
|
4148
4216
|
const shiftingItems = [];
|
|
4149
4217
|
this.trackedDragContainers.forEach((container) => {
|
|
4150
|
-
container.querySelectorAll('[
|
|
4218
|
+
container.querySelectorAll('[data-draggable="true"]').forEach((item) => !returning.has(item) && shiftingItems.push(item));
|
|
4151
4219
|
});
|
|
4152
4220
|
const flipStates = this.enableFlipAnimations && shiftingItems.length > 0 ? captureMultipleFlipStates(shiftingItems) : null;
|
|
4153
4221
|
inventoryItems.forEach((item) => {
|
|
@@ -4170,21 +4238,17 @@ var DragDropSlottedMixin = (superClass, draggablesSelector, droppablesSelector,
|
|
|
4170
4238
|
return count + droppable.querySelectorAll(`[identifier="${identifier}"]`).length;
|
|
4171
4239
|
}, 0);
|
|
4172
4240
|
inventoryItems.forEach((item) => {
|
|
4173
|
-
setDragChipState(item, "
|
|
4241
|
+
setDragChipState(item, "used", matchMax !== 0 && placedInDropzones >= matchMax);
|
|
4174
4242
|
});
|
|
4175
4243
|
}
|
|
4176
4244
|
checkAllMaxAssociations() {
|
|
4177
4245
|
const totalAssociations = this.totalAssociationsFromState();
|
|
4178
|
-
const disableAtMax = this.resolveDisableAfterMaxReached({ defaultWhenUnset:
|
|
4246
|
+
const disableAtMax = this.resolveDisableAfterMaxReached({ defaultWhenUnset: false });
|
|
4179
4247
|
const maxReached = this.maxAssociations > 0 && totalAssociations >= this.maxAssociations;
|
|
4180
4248
|
this.trackedDroppables.forEach((droppable) => {
|
|
4181
4249
|
const isDragSource = droppable.hasAttribute("data-drag-source");
|
|
4182
4250
|
const isAtCapacity = this.droppableAtCapacityFromState(droppable);
|
|
4183
|
-
|
|
4184
|
-
droppable.setAttribute("disabled", "");
|
|
4185
|
-
} else {
|
|
4186
|
-
droppable.removeAttribute("disabled");
|
|
4187
|
-
}
|
|
4251
|
+
setDropFull(droppable, (isAtCapacity || disableAtMax && maxReached) && !isDragSource);
|
|
4188
4252
|
});
|
|
4189
4253
|
}
|
|
4190
4254
|
saveResponse(value) {
|
|
@@ -4218,6 +4282,9 @@ var DragDropSlottedMixin = (superClass, draggablesSelector, droppablesSelector,
|
|
|
4218
4282
|
});
|
|
4219
4283
|
this.resetDragState();
|
|
4220
4284
|
this.cacheInteractiveElements();
|
|
4285
|
+
this.trackedDroppables.forEach((droppable) => setDropFull(droppable, false));
|
|
4286
|
+
this.checkAllMaxAssociations();
|
|
4287
|
+
this.resetValidityReport();
|
|
4221
4288
|
this._response = [];
|
|
4222
4289
|
this._internals.setFormValue(JSON.stringify(this._response));
|
|
4223
4290
|
if (save) {
|
|
@@ -4231,13 +4298,17 @@ var DragDropSlottedMixin = (superClass, draggablesSelector, droppablesSelector,
|
|
|
4231
4298
|
const belowMin = this.minAssociations > 0 && totalAssociations < this.minAssociations;
|
|
4232
4299
|
let validityMessage = "";
|
|
4233
4300
|
let isValid = true;
|
|
4301
|
+
let kind = "other";
|
|
4234
4302
|
if (exceedsMax) {
|
|
4303
|
+
kind = "max";
|
|
4235
4304
|
validityMessage = this.getFirstMessageAttribute(["data-max-associations-message", "data-max-selections-message"]) || this.dataset.maxAssociationsMessage || this.dataset.maxSelectionsMessage || `You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`;
|
|
4236
4305
|
isValid = false;
|
|
4237
4306
|
} else if (atMaxCapacity && this._dropBlockedDueToMax && this.shouldTreatBlockedMaxAsInvalid()) {
|
|
4307
|
+
kind = "max";
|
|
4238
4308
|
validityMessage = this.getFirstMessageAttribute(["data-max-associations-message", "data-max-selections-message"]) || this.dataset.maxAssociationsMessage || this.dataset.maxSelectionsMessage || `You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`;
|
|
4239
4309
|
isValid = false;
|
|
4240
4310
|
} else if (belowMin) {
|
|
4311
|
+
kind = "min";
|
|
4241
4312
|
validityMessage = this.getFirstMessageAttribute(["data-min-associations-message", "data-min-selections-message"]) || this.dataset.minAssociationsMessage || this.dataset.minSelectionsMessage || `Please select at least ${this.minAssociations} ${this.minAssociations === 1 ? "association" : "associations"}.`;
|
|
4242
4313
|
isValid = false;
|
|
4243
4314
|
this._dropBlockedDueToMax = false;
|
|
@@ -4245,11 +4316,11 @@ var DragDropSlottedMixin = (superClass, draggablesSelector, droppablesSelector,
|
|
|
4245
4316
|
this._dropBlockedDueToMax = false;
|
|
4246
4317
|
}
|
|
4247
4318
|
const validityAnchor = this.trackedDroppables[0] ?? this.trackedDraggables[0] ?? this;
|
|
4248
|
-
this.setInteractionValidity(isValid, validityMessage, validityAnchor, { suppressInline: true });
|
|
4319
|
+
this.setInteractionValidity(isValid, validityMessage, validityAnchor, { suppressInline: true, kind });
|
|
4249
4320
|
return isValid;
|
|
4250
4321
|
}
|
|
4251
|
-
reportValidity() {
|
|
4252
|
-
return super.reportValidity();
|
|
4322
|
+
reportValidity(options) {
|
|
4323
|
+
return super.reportValidity(options);
|
|
4253
4324
|
}
|
|
4254
4325
|
}
|
|
4255
4326
|
__decorate11([
|
|
@@ -4257,7 +4328,7 @@ var DragDropSlottedMixin = (superClass, draggablesSelector, droppablesSelector,
|
|
|
4257
4328
|
], DragDropSlottedElement.prototype, "minAssociations", void 0);
|
|
4258
4329
|
__decorate11([
|
|
4259
4330
|
property11({ type: Number, reflect: true, attribute: "max-associations" })
|
|
4260
|
-
], DragDropSlottedElement.prototype, "maxAssociations",
|
|
4331
|
+
], DragDropSlottedElement.prototype, "maxAssociations", void 0);
|
|
4261
4332
|
__decorate11([
|
|
4262
4333
|
provide({ context: dragDropContext })
|
|
4263
4334
|
], DragDropSlottedElement.prototype, "_dragDrop", void 0);
|
|
@@ -4318,6 +4389,7 @@ function resetSortableDragContext(context) {
|
|
|
4318
4389
|
function createDropPlaceholder(source, rect, config = {}) {
|
|
4319
4390
|
const mergedConfig = { ...defaultPlaceholderConfig, ...config };
|
|
4320
4391
|
const placeholder = document.createElement("div");
|
|
4392
|
+
placeholder.setAttribute("data-drop-preview", "true");
|
|
4321
4393
|
placeholder.setAttribute("data-drop-placeholder", "true");
|
|
4322
4394
|
placeholder.style.width = `${rect.width}px`;
|
|
4323
4395
|
placeholder.style.height = `${rect.height}px`;
|
|
@@ -4340,7 +4412,7 @@ function isElementInContainer(element, containers) {
|
|
|
4340
4412
|
}
|
|
4341
4413
|
|
|
4342
4414
|
// ../interactions/core/dist/mixins/drag-drop-observables/drag-drop-slotted-sortable.mixin.js
|
|
4343
|
-
var DragDropSlottedSortableMixin = (superClass, sortableItemSelector = '[
|
|
4415
|
+
var DragDropSlottedSortableMixin = (superClass, sortableItemSelector = '[data-draggable="true"]') => {
|
|
4344
4416
|
class DragDropSlottedSortableElement extends superClass {
|
|
4345
4417
|
constructor() {
|
|
4346
4418
|
super(...arguments);
|
|
@@ -4497,7 +4569,7 @@ var DragDropSlottedSortableMixin = (superClass, sortableItemSelector = '[qti-dra
|
|
|
4497
4569
|
if (this.#slotAllowsMultiple(slot) && this.#isSlotAtCapacity(slot)) {
|
|
4498
4570
|
return;
|
|
4499
4571
|
}
|
|
4500
|
-
slot
|
|
4572
|
+
setDropFull(slot, false);
|
|
4501
4573
|
this.#temporarilyEnabledSlots.add(slot);
|
|
4502
4574
|
}
|
|
4503
4575
|
});
|
|
@@ -4575,15 +4647,19 @@ var qti_associate_interaction_styles_default = [
|
|
|
4575
4647
|
then compresses the chips instead of moving them down: a bank of six squeezed the last chip
|
|
4576
4648
|
until only its grip was left, at no width the author could see coming. A chip is a fixed
|
|
4577
4649
|
thing, so the only place the overflow can go is the next line. */
|
|
4578
|
-
|
|
4650
|
+
[part~='bank'] {
|
|
4651
|
+
/* The bank, the same in every drag-drop interaction: flush with the container (no padding, no
|
|
4652
|
+
margin, no edge of its own), chips a --qti-gap apart. Its lit and ringed looks while a chip is
|
|
4653
|
+
in flight are the theme's ('::part(bank drag-active)', '::part(bank drag-over)'). */
|
|
4579
4654
|
display: flex;
|
|
4580
4655
|
flex-wrap: wrap;
|
|
4581
4656
|
align-items: flex-start;
|
|
4582
4657
|
flex: 1;
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4658
|
+
gap: var(--qti-gap, 0.5rem);
|
|
4659
|
+
padding: 0;
|
|
4660
|
+
margin: 0;
|
|
4661
|
+
border: 0;
|
|
4662
|
+
border-radius: var(--qti-radius-box, 0.2rem);
|
|
4587
4663
|
}
|
|
4588
4664
|
|
|
4589
4665
|
/* Drop target. --qti-dropzone-min-height is published by the interaction from the measured
|
|
@@ -4603,7 +4679,7 @@ var qti_associate_interaction_styles_default = [
|
|
|
4603
4679
|
gap: 0.5rem;
|
|
4604
4680
|
}
|
|
4605
4681
|
|
|
4606
|
-
:host::part(
|
|
4682
|
+
:host::part(row) {
|
|
4607
4683
|
display: flex;
|
|
4608
4684
|
justify-content: space-between;
|
|
4609
4685
|
background: linear-gradient(
|
|
@@ -4631,7 +4707,7 @@ var __decorate12 = function(decorators, target, key, desc) {
|
|
|
4631
4707
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4632
4708
|
};
|
|
4633
4709
|
var SlottedBase = DragDropSlottedMixin(Interaction, "qti-simple-associable-choice", `[part~='drop']`, `slot[name='qti-simple-associable-choice']`, "pointerWithin");
|
|
4634
|
-
var QtiAssociateInteraction = class extends DragDropSlottedSortableMixin(SlottedBase, '[
|
|
4710
|
+
var QtiAssociateInteraction = class extends DragDropSlottedSortableMixin(SlottedBase, '[data-draggable="true"]') {
|
|
4635
4711
|
static {
|
|
4636
4712
|
this.styles = qti_associate_interaction_styles_default;
|
|
4637
4713
|
}
|
|
@@ -4715,9 +4791,9 @@ var QtiAssociateInteraction = class extends DragDropSlottedSortableMixin(Slotted
|
|
|
4715
4791
|
}
|
|
4716
4792
|
render() {
|
|
4717
4793
|
return html11` <slot name="prompt"></slot>
|
|
4718
|
-
<slot part="drags" name="qti-simple-associable-choice"></slot>
|
|
4794
|
+
<slot part="bank drags" name="qti-simple-associable-choice"></slot>
|
|
4719
4795
|
<div part="drops">
|
|
4720
|
-
${this._childrenMap.length > 0 && Array.from({ length: this.#rowCount }, (_, index) => html11`<div part="drop-row">
|
|
4796
|
+
${this._childrenMap.length > 0 && Array.from({ length: this.#rowCount }, (_, index) => html11`<div part="row drop-row">
|
|
4721
4797
|
${this.#renderDrop(`droplist${index}_left`, `left${index}`)}
|
|
4722
4798
|
${this.#renderDrop(`droplist${index}_right`, `right${index}`)}
|
|
4723
4799
|
</div>`)}
|
|
@@ -4830,7 +4906,7 @@ var ChoicesMixin = (superClass, selector) => {
|
|
|
4830
4906
|
}
|
|
4831
4907
|
});
|
|
4832
4908
|
this._determineInputType();
|
|
4833
|
-
const validIdentifiers = new Set(this._choiceElements.map((c) => c.identifier));
|
|
4909
|
+
const validIdentifiers = new Set(this._choiceElements.map((c) => c.getAttribute("identifier") ?? c.identifier));
|
|
4834
4910
|
if (Array.isArray(this.response)) {
|
|
4835
4911
|
const filteredResponse = this.response.filter((id) => validIdentifiers.has(id));
|
|
4836
4912
|
if (filteredResponse.length !== this.response.length) {
|
|
@@ -4846,19 +4922,22 @@ var ChoicesMixin = (superClass, selector) => {
|
|
|
4846
4922
|
const selectedCount = selectedChoices.length;
|
|
4847
4923
|
let isValid = true;
|
|
4848
4924
|
let validityMessage = "";
|
|
4925
|
+
let kind = "other";
|
|
4849
4926
|
if (this.maxChoices !== 0 && selectedCount > this.maxChoices) {
|
|
4850
4927
|
isValid = false;
|
|
4928
|
+
kind = "max";
|
|
4851
4929
|
validityMessage = this.dataset.maxSelectionsMessage || `Please select no more than ${this.maxChoices} ${this.maxChoices === 1 ? "option" : "options"}.`;
|
|
4852
4930
|
} else if (selectedCount < this.minChoices) {
|
|
4853
4931
|
isValid = false;
|
|
4932
|
+
kind = "min";
|
|
4854
4933
|
validityMessage = this.dataset.minSelectionsMessage || `Please select at least ${this.minChoices} ${this.minChoices === 1 ? "option" : "options"}.`;
|
|
4855
4934
|
}
|
|
4856
4935
|
const anchor = this._choiceElements.find((c) => this.contains(c)) || this;
|
|
4857
|
-
this.setInteractionValidity(isValid, validityMessage, anchor, { suppressInline: true });
|
|
4936
|
+
this.setInteractionValidity(isValid, validityMessage, anchor, { suppressInline: true, kind });
|
|
4858
4937
|
return isValid;
|
|
4859
4938
|
}
|
|
4860
|
-
reportValidity() {
|
|
4861
|
-
return super.reportValidity();
|
|
4939
|
+
reportValidity(options) {
|
|
4940
|
+
return super.reportValidity(options);
|
|
4862
4941
|
}
|
|
4863
4942
|
/**
|
|
4864
4943
|
* Publish the role the choices should take. Each choice subscribes to
|
|
@@ -4922,7 +5001,7 @@ var ChoicesMixin = (superClass, selector) => {
|
|
|
4922
5001
|
const selectedIdentifiers = selectedChoices.map((choice) => choice.identifier);
|
|
4923
5002
|
this.response = this.maxChoices === 1 ? selectedIdentifiers[0] || "" : selectedIdentifiers;
|
|
4924
5003
|
this.validate();
|
|
4925
|
-
this.reportValidity();
|
|
5004
|
+
this.reportValidity({ trigger: "change" });
|
|
4926
5005
|
this.saveResponse(this.response);
|
|
4927
5006
|
}
|
|
4928
5007
|
/**
|
|
@@ -5112,13 +5191,15 @@ var qti_choice_interaction_styles_default = [
|
|
|
5112
5191
|
display: block;
|
|
5113
5192
|
}
|
|
5114
5193
|
|
|
5115
|
-
|
|
5194
|
+
/* No gap of its own: a choice carries its own padding, which already spaces a list. A theme sets
|
|
5195
|
+
--qti-choice-gap where the choices are drawn as separate boxes and need air between them. */
|
|
5196
|
+
[part~='choices'] {
|
|
5116
5197
|
display: grid;
|
|
5117
|
-
gap:
|
|
5198
|
+
gap: var(--qti-choice-gap, 0);
|
|
5118
5199
|
}
|
|
5119
5200
|
|
|
5120
5201
|
/* Define the number of columns dynamically */
|
|
5121
|
-
:host([class*='qti-choices-stacking-']) [part
|
|
5202
|
+
:host([class*='qti-choices-stacking-']) [part~='choices'] {
|
|
5122
5203
|
grid-template-columns: repeat(var(--stacking-count, 1), 1fr);
|
|
5123
5204
|
}
|
|
5124
5205
|
|
|
@@ -5147,24 +5228,24 @@ var qti_choice_interaction_styles_default = [
|
|
|
5147
5228
|
}
|
|
5148
5229
|
|
|
5149
5230
|
/* Orientation styles */
|
|
5150
|
-
:host(.qti-orientation-horizontal) [part
|
|
5231
|
+
:host(.qti-orientation-horizontal) [part~='choices'] {
|
|
5151
5232
|
grid-auto-flow: dense column;
|
|
5152
5233
|
grid-auto-columns: 1fr;
|
|
5153
5234
|
}
|
|
5154
5235
|
|
|
5155
|
-
:host(.qti-orientation-vertical) [part
|
|
5236
|
+
:host(.qti-orientation-vertical) [part~='choices'] {
|
|
5156
5237
|
grid-auto-flow: row;
|
|
5157
5238
|
}
|
|
5158
5239
|
|
|
5159
5240
|
/* Vertical and horizontal stacking logic */
|
|
5160
|
-
:host(.qti-orientation-vertical[class*='qti-choices-stacking-']) [part
|
|
5241
|
+
:host(.qti-orientation-vertical[class*='qti-choices-stacking-']) [part~='choices'] {
|
|
5161
5242
|
grid-auto-flow: dense column;
|
|
5162
5243
|
grid-auto-columns: 1fr;
|
|
5163
5244
|
grid-template-columns: repeat(var(--stacking-count), 1fr);
|
|
5164
5245
|
grid-template-rows: repeat(calc(var(--item-count) / var(--stacking-count)), 1fr);
|
|
5165
5246
|
}
|
|
5166
5247
|
|
|
5167
|
-
:host(.qti-orientation-horizontal[class*='qti-choices-stacking-']) [part
|
|
5248
|
+
:host(.qti-orientation-horizontal[class*='qti-choices-stacking-']) [part~='choices'] {
|
|
5168
5249
|
grid-auto-flow: row;
|
|
5169
5250
|
grid-template-columns: repeat(var(--stacking-count), 1fr);
|
|
5170
5251
|
grid-template-rows: unset;
|
|
@@ -5199,7 +5280,7 @@ var QtiChoiceInteraction = class extends VocabularyMixin(ChoicesMixin(Interactio
|
|
|
5199
5280
|
render() {
|
|
5200
5281
|
return html12`
|
|
5201
5282
|
<slot part="prompt" name="prompt"></slot>
|
|
5202
|
-
<slot part="slot" @slotchange=${this.#handleSlotChange}></slot>
|
|
5283
|
+
<slot part="choices slot" @slotchange=${this.#handleSlotChange}></slot>
|
|
5203
5284
|
<div part="message" role="alert" id="validation-message"></div>
|
|
5204
5285
|
`;
|
|
5205
5286
|
}
|
|
@@ -5736,8 +5817,9 @@ __decorate16([
|
|
|
5736
5817
|
], QtiCustomInteraction.prototype, "_errorMessage", void 0);
|
|
5737
5818
|
|
|
5738
5819
|
// ../interactions/end-attempt-interaction/dist/qti-end-attempt-interaction.js
|
|
5820
|
+
import { consume as consume5 } from "@lit/context";
|
|
5739
5821
|
import { html as html14, LitElement as LitElement11 } from "lit";
|
|
5740
|
-
import { property as property16 } from "lit/decorators.js";
|
|
5822
|
+
import { property as property16, state as state7 } from "lit/decorators.js";
|
|
5741
5823
|
|
|
5742
5824
|
// ../interactions/end-attempt-interaction/dist/qti-end-attempt-interaction.styles.js
|
|
5743
5825
|
var qti_end_attempt_interaction_styles_default = [boxSizing];
|
|
@@ -5759,14 +5841,29 @@ var QtiEndAttemptInteraction = class extends LitElement11 {
|
|
|
5759
5841
|
static {
|
|
5760
5842
|
this.styles = qti_end_attempt_interaction_styles_default;
|
|
5761
5843
|
}
|
|
5844
|
+
/** The item says no attempt can end here: it is locked, shown for reading, or an adaptive item that is done. */
|
|
5845
|
+
get #closedByItem() {
|
|
5846
|
+
const context = this._itemContext;
|
|
5847
|
+
if (!context)
|
|
5848
|
+
return false;
|
|
5849
|
+
if (context.disabled || context.readonly)
|
|
5850
|
+
return true;
|
|
5851
|
+
const adaptive = this.closest("qti-assessment-item")?.getAttribute("adaptive") === "true";
|
|
5852
|
+
const completionStatus = context.variables?.find((v) => v.identifier === "completionStatus")?.value;
|
|
5853
|
+
return adaptive && completionStatus === "completed";
|
|
5854
|
+
}
|
|
5762
5855
|
render() {
|
|
5763
|
-
return html14`<button ?disabled=${this.disabled} part="button" @click=${this.endAttempt}
|
|
5856
|
+
return html14`<button ?disabled=${this.disabled || this.#closedByItem} part="button" @click=${this.endAttempt}>
|
|
5857
|
+
${this.title}
|
|
5858
|
+
</button>`;
|
|
5764
5859
|
}
|
|
5765
5860
|
endAttempt(_) {
|
|
5861
|
+
if (this.disabled || this.#closedByItem)
|
|
5862
|
+
return;
|
|
5766
5863
|
this.dispatchEvent(new CustomEvent("end-attempt", {
|
|
5767
5864
|
bubbles: true,
|
|
5768
5865
|
composed: true,
|
|
5769
|
-
detail: { responseIdentifier: this.responseIdentifier, countAttempt: this.countAttempt
|
|
5866
|
+
detail: { responseIdentifier: this.responseIdentifier, countAttempt: this.countAttempt !== "false" }
|
|
5770
5867
|
}));
|
|
5771
5868
|
}
|
|
5772
5869
|
};
|
|
@@ -5776,6 +5873,10 @@ __decorate17([
|
|
|
5776
5873
|
__decorate17([
|
|
5777
5874
|
property16({ reflect: true, type: Boolean })
|
|
5778
5875
|
], QtiEndAttemptInteraction.prototype, "disabled", void 0);
|
|
5876
|
+
__decorate17([
|
|
5877
|
+
consume5({ context: itemContext, subscribe: true }),
|
|
5878
|
+
state7()
|
|
5879
|
+
], QtiEndAttemptInteraction.prototype, "_itemContext", void 0);
|
|
5779
5880
|
__decorate17([
|
|
5780
5881
|
property16({ type: String, attribute: "count-attempt" })
|
|
5781
5882
|
], QtiEndAttemptInteraction.prototype, "countAttempt", void 0);
|
|
@@ -5786,7 +5887,7 @@ __decorate17([
|
|
|
5786
5887
|
// ../interactions/extended-text-interaction/dist/qti-extended-text-interaction.js
|
|
5787
5888
|
import { html as html15 } from "lit";
|
|
5788
5889
|
import { ifDefined } from "lit/directives/if-defined.js";
|
|
5789
|
-
import { property as property17, state as
|
|
5890
|
+
import { property as property17, state as state8 } from "lit/decorators.js";
|
|
5790
5891
|
|
|
5791
5892
|
// ../interactions/extended-text-interaction/dist/qti-extended-text-interaction.styles.js
|
|
5792
5893
|
import { css as css14 } from "lit";
|
|
@@ -5903,18 +6004,20 @@ var QtiExtendedTextInteraction = class extends Interaction {
|
|
|
5903
6004
|
} else {
|
|
5904
6005
|
isValid = textarea.checkValidity();
|
|
5905
6006
|
}
|
|
6007
|
+
let kind = "other";
|
|
5906
6008
|
if (isValid && !this.response && this.minStrings >= 1) {
|
|
5907
6009
|
isValid = false;
|
|
6010
|
+
kind = "min";
|
|
5908
6011
|
}
|
|
5909
6012
|
if (!isValid && !validityMessage) {
|
|
5910
6013
|
validityMessage = textarea.validationMessage || "Invalid value.";
|
|
5911
6014
|
}
|
|
5912
|
-
this.setInteractionValidity(isValid, validityMessage, textarea, { suppressInline: true });
|
|
6015
|
+
this.setInteractionValidity(isValid, validityMessage, textarea, { suppressInline: true, kind });
|
|
5913
6016
|
return isValid;
|
|
5914
6017
|
}
|
|
5915
|
-
reportValidity() {
|
|
6018
|
+
reportValidity(options) {
|
|
5916
6019
|
this.validate();
|
|
5917
|
-
return super.reportValidity();
|
|
6020
|
+
return super.reportValidity(options);
|
|
5918
6021
|
}
|
|
5919
6022
|
/*
|
|
5920
6023
|
* The template in named pieces, so a subclass can recompose it.
|
|
@@ -5944,7 +6047,7 @@ var QtiExtendedTextInteraction = class extends Interaction {
|
|
|
5944
6047
|
@keyup="${this.textChanged}"
|
|
5945
6048
|
@change="${this.textChanged}"
|
|
5946
6049
|
@blur="${(_) => {
|
|
5947
|
-
this.reportValidity();
|
|
6050
|
+
this.reportValidity({ trigger: "change" });
|
|
5948
6051
|
}}"
|
|
5949
6052
|
placeholder="${ifDefined(this.placeholderText ? this.placeholderText : void 0)}"
|
|
5950
6053
|
rows="${this._rows}"
|
|
@@ -5967,11 +6070,12 @@ var QtiExtendedTextInteraction = class extends Interaction {
|
|
|
5967
6070
|
if (this.response !== input.value) {
|
|
5968
6071
|
this.value = input.value;
|
|
5969
6072
|
this.saveResponse(input.value);
|
|
6073
|
+
this.reportValidity({ trigger: "change" });
|
|
5970
6074
|
}
|
|
5971
6075
|
}
|
|
5972
6076
|
};
|
|
5973
6077
|
__decorate18([
|
|
5974
|
-
|
|
6078
|
+
state8()
|
|
5975
6079
|
], QtiExtendedTextInteraction.prototype, "_rows", void 0);
|
|
5976
6080
|
__decorate18([
|
|
5977
6081
|
property17({ type: Number, attribute: "expected-length" })
|
|
@@ -6045,34 +6149,42 @@ var qti_gap_match_interaction_styles_default = [
|
|
|
6045
6149
|
}
|
|
6046
6150
|
/* Wraps, for the reason spelled out on associate's identical bank: nowrap does not overflow, it
|
|
6047
6151
|
shrinks, and a squeezed chip is worse than a second line. */
|
|
6048
|
-
[
|
|
6152
|
+
[part~='bank'] {
|
|
6153
|
+
/* The bank, the same in every drag-drop interaction: flush with the container (no padding, no
|
|
6154
|
+
margin, no edge of its own), chips a --qti-gap apart. Its lit and ringed looks while a chip is
|
|
6155
|
+
in flight are the theme's ('::part(bank drag-active)', '::part(bank drag-over)'). */
|
|
6049
6156
|
display: flex;
|
|
6050
6157
|
flex-wrap: wrap;
|
|
6051
6158
|
align-items: flex-start;
|
|
6052
6159
|
flex: 1;
|
|
6053
|
-
|
|
6054
|
-
padding: 0
|
|
6055
|
-
|
|
6056
|
-
|
|
6160
|
+
gap: var(--qti-gap, 0.5rem);
|
|
6161
|
+
padding: 0;
|
|
6162
|
+
margin: 0;
|
|
6163
|
+
border: 0;
|
|
6164
|
+
border-radius: var(--qti-radius-box, 0.2rem);
|
|
6057
6165
|
}
|
|
6058
6166
|
|
|
6059
6167
|
/* An answer key shows the answer, not the bank you would have dragged it from. The attribute is
|
|
6060
6168
|
set on the clone by the correct-response mixin; the theme used to do this with a
|
|
6061
6169
|
'.full-correct-response' descendant selector, from the document. */
|
|
6062
|
-
:host([answer-key]) [part~='
|
|
6170
|
+
:host([answer-key]) [part~='bank'] {
|
|
6063
6171
|
display: none;
|
|
6064
6172
|
}
|
|
6065
6173
|
`
|
|
6066
6174
|
];
|
|
6067
6175
|
|
|
6068
6176
|
// ../interactions/gap-match-interaction/dist/qti-gap-match-interaction.js
|
|
6069
|
-
var QtiGapMatchInteraction = class extends DragDropSlottedSortableMixin(DragDropSlottedMixin(Interaction, "qti-gap-text", "qti-gap", `slot[part~='drags']`), '[
|
|
6177
|
+
var QtiGapMatchInteraction = class extends DragDropSlottedSortableMixin(DragDropSlottedMixin(Interaction, "qti-gap-text", "qti-gap", `slot[part~='drags']`), '[data-draggable="true"]') {
|
|
6178
|
+
constructor() {
|
|
6179
|
+
super(...arguments);
|
|
6180
|
+
this.maxAssociations = 1;
|
|
6181
|
+
}
|
|
6070
6182
|
static {
|
|
6071
6183
|
this.styles = qti_gap_match_interaction_styles_default;
|
|
6072
6184
|
}
|
|
6073
6185
|
render() {
|
|
6074
6186
|
return html16`<slot name="prompt"> </slot>
|
|
6075
|
-
<slot part="drags" name="drags"></slot>
|
|
6187
|
+
<slot part="bank drags" name="drags"></slot>
|
|
6076
6188
|
<slot part="drops"></slot>
|
|
6077
6189
|
<div role="alert" part="message" id="validation-message"></div>`;
|
|
6078
6190
|
}
|
|
@@ -6080,7 +6192,7 @@ var QtiGapMatchInteraction = class extends DragDropSlottedSortableMixin(DragDrop
|
|
|
6080
6192
|
|
|
6081
6193
|
// ../interactions/graphic-associate-interaction/dist/qti-graphic-associate-interaction.js
|
|
6082
6194
|
import { html as html17, nothing as nothing2, svg } from "lit";
|
|
6083
|
-
import { property as property18, queryAssignedElements, state as
|
|
6195
|
+
import { property as property18, queryAssignedElements, state as state9 } from "lit/decorators.js";
|
|
6084
6196
|
import { ifDefined as ifDefined2 } from "lit/directives/if-defined.js";
|
|
6085
6197
|
import { repeat as repeat5 } from "lit/directives/repeat.js";
|
|
6086
6198
|
|
|
@@ -6309,6 +6421,25 @@ var qti_graphic_associate_interaction_styles_default = [
|
|
|
6309
6421
|
position: absolute;
|
|
6310
6422
|
top: 0px;
|
|
6311
6423
|
left: 0px;
|
|
6424
|
+
/* Lines take clicks; the empty canvas lets them through to the points underneath. */
|
|
6425
|
+
pointer-events: none;
|
|
6426
|
+
}
|
|
6427
|
+
/* A wide invisible stroke over each line, so removing one does not take a 3px aim. */
|
|
6428
|
+
line[data-hit] {
|
|
6429
|
+
stroke: transparent;
|
|
6430
|
+
stroke-width: 16px;
|
|
6431
|
+
stroke-linecap: round;
|
|
6432
|
+
pointer-events: stroke;
|
|
6433
|
+
cursor: pointer;
|
|
6434
|
+
outline: none;
|
|
6435
|
+
}
|
|
6436
|
+
/* A line under the pointer or keyboard focus shows that it can be removed. */
|
|
6437
|
+
line[data-hit]:hover,
|
|
6438
|
+
line[data-hit]:focus-visible {
|
|
6439
|
+
stroke: color-mix(in srgb, currentColor 18%, transparent);
|
|
6440
|
+
}
|
|
6441
|
+
::slotted(qti-associable-hotspot) {
|
|
6442
|
+
cursor: pointer;
|
|
6312
6443
|
}
|
|
6313
6444
|
`
|
|
6314
6445
|
];
|
|
@@ -6326,23 +6457,55 @@ var QtiGraphicAssociateInteraction = class extends Interaction {
|
|
|
6326
6457
|
}
|
|
6327
6458
|
#hotspots;
|
|
6328
6459
|
#startPoint;
|
|
6329
|
-
#endPoint;
|
|
6330
6460
|
constructor() {
|
|
6331
6461
|
super();
|
|
6332
6462
|
this.#hotspots = [];
|
|
6333
6463
|
this.#startPoint = null;
|
|
6334
|
-
this.#endPoint = null;
|
|
6335
6464
|
this._response = [];
|
|
6465
|
+
this.minAssociations = 0;
|
|
6466
|
+
this.maxAssociations = 1;
|
|
6336
6467
|
this.addEventListener("qti-register-hotspot", this.#positionHotspotOnRegister);
|
|
6337
6468
|
}
|
|
6338
6469
|
reset() {
|
|
6470
|
+
this.resetValidityReport();
|
|
6339
6471
|
this._response = [];
|
|
6472
|
+
this._internals.setFormValue(null);
|
|
6473
|
+
this.validate();
|
|
6474
|
+
this.#startPoint = null;
|
|
6475
|
+
this.#syncHotspotStates();
|
|
6340
6476
|
}
|
|
6341
6477
|
validate() {
|
|
6342
|
-
|
|
6478
|
+
const count = this.#getResponseArray().length;
|
|
6479
|
+
const exceedsMax = this.maxAssociations > 0 && count > this.maxAssociations;
|
|
6480
|
+
const belowMin = count < this.minAssociations;
|
|
6481
|
+
let kind = "other";
|
|
6482
|
+
let message = "";
|
|
6483
|
+
if (exceedsMax) {
|
|
6484
|
+
kind = "max";
|
|
6485
|
+
message = this.dataset.maxAssociationsMessage || this.dataset.maxSelectionsMessage || `You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`;
|
|
6486
|
+
} else if (belowMin) {
|
|
6487
|
+
kind = "min";
|
|
6488
|
+
message = this.dataset.minAssociationsMessage || this.dataset.minSelectionsMessage || `Please select at least ${this.minAssociations} ${this.minAssociations === 1 ? "association" : "associations"}.`;
|
|
6489
|
+
}
|
|
6490
|
+
const isValid = !exceedsMax && !belowMin;
|
|
6491
|
+
this.setInteractionValidity(isValid, message, this, { suppressInline: true, kind });
|
|
6492
|
+
return isValid;
|
|
6493
|
+
}
|
|
6494
|
+
reportValidity(options) {
|
|
6495
|
+
return super.reportValidity(options);
|
|
6343
6496
|
}
|
|
6344
6497
|
set response(val) {
|
|
6345
6498
|
this._response = this.#normalizeResponse(val);
|
|
6499
|
+
this.#responseChanged(false);
|
|
6500
|
+
this.#syncHotspotStates();
|
|
6501
|
+
}
|
|
6502
|
+
/** The form value and the validity follow every change; a candidate's change also reports. */
|
|
6503
|
+
#responseChanged(byCandidate) {
|
|
6504
|
+
const lines = this.#getResponseArray();
|
|
6505
|
+
this._internals.setFormValue(lines.length ? JSON.stringify(lines) : null);
|
|
6506
|
+
this.validate();
|
|
6507
|
+
if (byCandidate)
|
|
6508
|
+
this.reportValidity({ trigger: "change" });
|
|
6346
6509
|
}
|
|
6347
6510
|
get response() {
|
|
6348
6511
|
return this._response;
|
|
@@ -6361,36 +6524,61 @@ var QtiGraphicAssociateInteraction = class extends Interaction {
|
|
|
6361
6524
|
}
|
|
6362
6525
|
render() {
|
|
6363
6526
|
return html17`<slot name="prompt"></slot>
|
|
6364
|
-
<line-container
|
|
6527
|
+
<line-container
|
|
6528
|
+
@click=${(e) => {
|
|
6529
|
+
if (this.#startPoint && !e.composedPath().some((n) => this.#hotspots.includes(n))) {
|
|
6530
|
+
this.#cancel();
|
|
6531
|
+
}
|
|
6532
|
+
}}
|
|
6533
|
+
>
|
|
6365
6534
|
<svg
|
|
6366
6535
|
width=${ifDefined2(this.grImage[0]?.width)}
|
|
6367
6536
|
height=${ifDefined2(this.grImage[0]?.height)}
|
|
6368
6537
|
viewbox="0 0 ${this.grImage[0]?.width} ${this.grImage[0]?.height}"
|
|
6369
6538
|
>
|
|
6370
|
-
${repeat5(this.#getResponseArray(), (line) => line, (line, index) =>
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
e
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6539
|
+
${repeat5(this.#getResponseArray(), (line) => line, (line, index) => {
|
|
6540
|
+
const [a, b] = line.split(" ");
|
|
6541
|
+
const from = this.querySelector(`[identifier=${a}]`);
|
|
6542
|
+
const to = this.querySelector(`[identifier=${b}]`);
|
|
6543
|
+
if (!from || !to)
|
|
6544
|
+
return nothing2;
|
|
6545
|
+
const x1 = parseInt(from.style.left);
|
|
6546
|
+
const y1 = parseInt(from.style.top);
|
|
6547
|
+
const x2 = parseInt(to.style.left);
|
|
6548
|
+
const y2 = parseInt(to.style.top);
|
|
6549
|
+
const remove = (e) => {
|
|
6550
|
+
e.stopPropagation();
|
|
6551
|
+
this.#removeLine(index);
|
|
6552
|
+
};
|
|
6553
|
+
return svg`
|
|
6554
|
+
<line part="line" x1=${x1} y1=${y1} x2=${x2} y2=${y2} stroke="currentColor" stroke-width="3" />
|
|
6555
|
+
<line
|
|
6556
|
+
data-hit
|
|
6557
|
+
x1=${x1}
|
|
6558
|
+
y1=${y1}
|
|
6559
|
+
x2=${x2}
|
|
6560
|
+
y2=${y2}
|
|
6561
|
+
tabindex=${this.disabled || this.readonly ? -1 : 0}
|
|
6562
|
+
role="button"
|
|
6563
|
+
aria-label=${`Remove line ${a} \u2013 ${b}`}
|
|
6564
|
+
@click=${remove}
|
|
6565
|
+
@keydown=${(e) => {
|
|
6566
|
+
if (["Enter", " ", "Delete", "Backspace"].includes(e.key)) {
|
|
6567
|
+
e.preventDefault();
|
|
6568
|
+
remove(e);
|
|
6569
|
+
}
|
|
6570
|
+
}}
|
|
6571
|
+
><title>Remove line ${a} – ${b}</title></line>
|
|
6572
|
+
`;
|
|
6573
|
+
})}
|
|
6386
6574
|
${this.renderSupplementalLines()}
|
|
6387
6575
|
${this.#startPoint && svg`<line
|
|
6388
6576
|
part="point"
|
|
6389
6577
|
x1=${this.startCoord.x}
|
|
6390
6578
|
y1=${this.startCoord.y}
|
|
6391
|
-
x2=${this.mouseCoord.x}
|
|
6392
|
-
y2=${this.mouseCoord.y}
|
|
6393
|
-
stroke="
|
|
6579
|
+
x2=${(this.mouseCoord ?? this.startCoord).x}
|
|
6580
|
+
y2=${(this.mouseCoord ?? this.startCoord).y}
|
|
6581
|
+
stroke="currentColor"
|
|
6394
6582
|
stroke-width="3"
|
|
6395
6583
|
/>`}
|
|
6396
6584
|
</svg>
|
|
@@ -6424,26 +6612,91 @@ var QtiGraphicAssociateInteraction = class extends Interaction {
|
|
|
6424
6612
|
this.#hotspots.forEach((hotspot) => {
|
|
6425
6613
|
hotspot.style.left = hotspot.getAttribute("coords").split(",")[0] + "px";
|
|
6426
6614
|
hotspot.style.top = hotspot.getAttribute("coords").split(",")[1] + "px";
|
|
6427
|
-
hotspot.
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
this
|
|
6437
|
-
this._response = [
|
|
6438
|
-
...this._response,
|
|
6439
|
-
`${this.#startPoint.getAttribute("identifier")} ${this.#endPoint.getAttribute("identifier")}`
|
|
6440
|
-
];
|
|
6441
|
-
this.saveResponse(this.response);
|
|
6442
|
-
this.#startPoint = null;
|
|
6443
|
-
this.#endPoint = null;
|
|
6615
|
+
hotspot.tabIndex = 0;
|
|
6616
|
+
hotspot.setAttribute("role", "button");
|
|
6617
|
+
if (!hotspot.hasAttribute("aria-label")) {
|
|
6618
|
+
hotspot.setAttribute("aria-label", hotspot.getAttribute("hotspot-label") || hotspot.getAttribute("identifier"));
|
|
6619
|
+
}
|
|
6620
|
+
hotspot.addEventListener("click", () => this.#pick(hotspot));
|
|
6621
|
+
hotspot.addEventListener("keydown", (event) => {
|
|
6622
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
6623
|
+
event.preventDefault();
|
|
6624
|
+
this.#pick(hotspot);
|
|
6444
6625
|
}
|
|
6445
6626
|
});
|
|
6446
6627
|
});
|
|
6628
|
+
this.addEventListener("keydown", (event) => {
|
|
6629
|
+
if (event.key === "Escape" && this.#startPoint)
|
|
6630
|
+
this.#cancel();
|
|
6631
|
+
});
|
|
6632
|
+
this.#syncHotspotStates();
|
|
6633
|
+
}
|
|
6634
|
+
/** A point clicked or activated: start a line, finish one, or cancel by picking the start again. */
|
|
6635
|
+
#pick(hotspot) {
|
|
6636
|
+
if (this.disabled || this.readonly)
|
|
6637
|
+
return;
|
|
6638
|
+
if (!this.#startPoint) {
|
|
6639
|
+
if (this.#isFull(hotspot))
|
|
6640
|
+
return;
|
|
6641
|
+
this.#startPoint = hotspot;
|
|
6642
|
+
this.startCoord = this.#centre(hotspot);
|
|
6643
|
+
this.mouseCoord = this.startCoord;
|
|
6644
|
+
this.#syncHotspotStates();
|
|
6645
|
+
return;
|
|
6646
|
+
}
|
|
6647
|
+
if (hotspot === this.#startPoint) {
|
|
6648
|
+
this.#cancel();
|
|
6649
|
+
return;
|
|
6650
|
+
}
|
|
6651
|
+
const a = this.#startPoint.getAttribute("identifier");
|
|
6652
|
+
const b = hotspot.getAttribute("identifier");
|
|
6653
|
+
const current = this.#getResponseArray();
|
|
6654
|
+
const exists = current.some((pair) => this.#samePair(pair, a, b));
|
|
6655
|
+
const roomLeft = this.maxAssociations === 0 || current.length < this.maxAssociations;
|
|
6656
|
+
if (!exists && roomLeft && !this.#isFull(hotspot)) {
|
|
6657
|
+
this._response = [...current, `${a} ${b}`];
|
|
6658
|
+
this.saveResponse(this.response);
|
|
6659
|
+
this.#responseChanged(true);
|
|
6660
|
+
}
|
|
6661
|
+
this.#cancel();
|
|
6662
|
+
}
|
|
6663
|
+
#cancel() {
|
|
6664
|
+
this.#startPoint = null;
|
|
6665
|
+
this.#syncHotspotStates();
|
|
6666
|
+
this.requestUpdate();
|
|
6667
|
+
}
|
|
6668
|
+
#removeLine(index) {
|
|
6669
|
+
if (this.disabled || this.readonly)
|
|
6670
|
+
return;
|
|
6671
|
+
this._response = this.#getResponseArray().filter((_, i) => i !== index);
|
|
6672
|
+
this.saveResponse(this.response);
|
|
6673
|
+
this.#responseChanged(true);
|
|
6674
|
+
this.#syncHotspotStates();
|
|
6675
|
+
}
|
|
6676
|
+
/** Pairs are undirected: "A B" is "B A". */
|
|
6677
|
+
#samePair(pair, a, b) {
|
|
6678
|
+
const [x, y] = pair.split(" ");
|
|
6679
|
+
return x === a && y === b || x === b && y === a;
|
|
6680
|
+
}
|
|
6681
|
+
/** Lines this point takes part in, against its `match-max` (0 = no limit). */
|
|
6682
|
+
#isFull(hotspot) {
|
|
6683
|
+
const max = Number(hotspot.getAttribute("match-max") ?? 0);
|
|
6684
|
+
if (!max)
|
|
6685
|
+
return false;
|
|
6686
|
+
const id = hotspot.getAttribute("identifier");
|
|
6687
|
+
return this.#getResponseArray().filter((pair) => pair.split(" ").includes(id)).length >= max;
|
|
6688
|
+
}
|
|
6689
|
+
#centre(hotspot) {
|
|
6690
|
+
const [x, y] = (hotspot.getAttribute("coords") ?? "0,0").split(",").map((n) => parseInt(n));
|
|
6691
|
+
return { x, y };
|
|
6692
|
+
}
|
|
6693
|
+
/** `checked` on the chosen start point, `full` on a point at its `match-max`. */
|
|
6694
|
+
#syncHotspotStates() {
|
|
6695
|
+
for (const hotspot of this.#hotspots) {
|
|
6696
|
+
const states = hotspot.internals?.states;
|
|
6697
|
+
setState(states, "checked", hotspot === this.#startPoint);
|
|
6698
|
+
setState(states, "full", this.#isFull(hotspot));
|
|
6699
|
+
}
|
|
6447
6700
|
}
|
|
6448
6701
|
disconnectedCallback() {
|
|
6449
6702
|
super.disconnectedCallback();
|
|
@@ -6451,17 +6704,23 @@ var QtiGraphicAssociateInteraction = class extends Interaction {
|
|
|
6451
6704
|
}
|
|
6452
6705
|
};
|
|
6453
6706
|
__decorate19([
|
|
6454
|
-
|
|
6707
|
+
state9()
|
|
6455
6708
|
], QtiGraphicAssociateInteraction.prototype, "startCoord", void 0);
|
|
6456
6709
|
__decorate19([
|
|
6457
|
-
|
|
6710
|
+
state9()
|
|
6458
6711
|
], QtiGraphicAssociateInteraction.prototype, "mouseCoord", void 0);
|
|
6459
6712
|
__decorate19([
|
|
6460
6713
|
queryAssignedElements({ selector: "img" })
|
|
6461
6714
|
], QtiGraphicAssociateInteraction.prototype, "grImage", void 0);
|
|
6462
6715
|
__decorate19([
|
|
6463
|
-
|
|
6716
|
+
state9()
|
|
6464
6717
|
], QtiGraphicAssociateInteraction.prototype, "_response", void 0);
|
|
6718
|
+
__decorate19([
|
|
6719
|
+
property18({ type: Number, attribute: "min-associations" })
|
|
6720
|
+
], QtiGraphicAssociateInteraction.prototype, "minAssociations", void 0);
|
|
6721
|
+
__decorate19([
|
|
6722
|
+
property18({ type: Number, attribute: "max-associations" })
|
|
6723
|
+
], QtiGraphicAssociateInteraction.prototype, "maxAssociations", void 0);
|
|
6465
6724
|
__decorate19([
|
|
6466
6725
|
property18({
|
|
6467
6726
|
attribute: "response",
|
|
@@ -6473,6 +6732,7 @@ __decorate19([
|
|
|
6473
6732
|
|
|
6474
6733
|
// ../interactions/graphic-gap-match-interaction/dist/qti-graphic-gap-match-interaction.js
|
|
6475
6734
|
import { html as html18 } from "lit";
|
|
6735
|
+
import { state as state10 } from "lit/decorators.js";
|
|
6476
6736
|
|
|
6477
6737
|
// ../interactions/graphic-gap-match-interaction/dist/qti-graphic-gap-match-interaction.styles.js
|
|
6478
6738
|
import { css as css17 } from "lit";
|
|
@@ -6535,15 +6795,19 @@ var qti_graphic_gap_match_interaction_styles_default = [
|
|
|
6535
6795
|
}
|
|
6536
6796
|
/* [part='drops'] , */
|
|
6537
6797
|
|
|
6538
|
-
[
|
|
6798
|
+
[part~='bank'] {
|
|
6799
|
+
/* The bank, the same in every drag-drop interaction: flush with the container (no padding, no
|
|
6800
|
+
margin, no edge of its own), chips a --qti-gap apart. Its lit and ringed looks while a chip is
|
|
6801
|
+
in flight are the theme's ('::part(bank drag-active)', '::part(bank drag-over)'). */
|
|
6539
6802
|
display: flex;
|
|
6540
|
-
align-items: flex-start;
|
|
6541
6803
|
flex-wrap: wrap;
|
|
6804
|
+
align-items: flex-start;
|
|
6542
6805
|
flex: 1;
|
|
6543
|
-
|
|
6544
|
-
padding: 0
|
|
6545
|
-
|
|
6546
|
-
|
|
6806
|
+
gap: var(--qti-gap, 0.5rem);
|
|
6807
|
+
padding: 0;
|
|
6808
|
+
margin: 0;
|
|
6809
|
+
border: 0;
|
|
6810
|
+
border-radius: var(--qti-radius-box, 0.2rem);
|
|
6547
6811
|
}
|
|
6548
6812
|
/*
|
|
6549
6813
|
* Fluid, like the hotspot interaction's graphic: an item declares the graphic at the size its
|
|
@@ -6568,15 +6832,35 @@ var qti_graphic_gap_match_interaction_styles_default = [
|
|
|
6568
6832
|
];
|
|
6569
6833
|
|
|
6570
6834
|
// ../interactions/graphic-gap-match-interaction/dist/qti-graphic-gap-match-interaction.js
|
|
6571
|
-
var
|
|
6572
|
-
var
|
|
6835
|
+
var __decorate20 = function(decorators, target, key, desc) {
|
|
6836
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6837
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6838
|
+
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;
|
|
6839
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6840
|
+
};
|
|
6841
|
+
var SlottedBase2 = DragDropSlottedMixin(Interaction, "qti-gap-img, qti-gap-text", "qti-associable-hotspot", `slot[part~='bank']`);
|
|
6842
|
+
var QtiGraphicGapMatchInteraction = class extends DragDropSlottedSortableMixin(SlottedBase2, '[data-draggable="true"]') {
|
|
6843
|
+
constructor() {
|
|
6844
|
+
super(...arguments);
|
|
6845
|
+
this.maxAssociations = 1;
|
|
6846
|
+
this.autoSizeDropzones = false;
|
|
6847
|
+
this._graphicScale = 1;
|
|
6848
|
+
this.#graphicObserver = null;
|
|
6849
|
+
this.#observedGraphic = null;
|
|
6850
|
+
this.#positionHotspotOnRegister = (e) => {
|
|
6851
|
+
this.#positionHotspot(e.target);
|
|
6852
|
+
};
|
|
6853
|
+
}
|
|
6573
6854
|
static {
|
|
6574
6855
|
this.styles = qti_graphic_gap_match_interaction_styles_default;
|
|
6575
6856
|
}
|
|
6857
|
+
#graphicObserver;
|
|
6858
|
+
#observedGraphic;
|
|
6576
6859
|
render() {
|
|
6860
|
+
const scale = `--qti-graphic-scale: ${this._graphicScale}`;
|
|
6577
6861
|
return html18` <slot name="prompt"></slot>
|
|
6578
|
-
<slot part="image"></slot>
|
|
6579
|
-
<slot part="drags" name="drags" class="hover-border"></slot>
|
|
6862
|
+
<slot part="image" style=${scale}></slot>
|
|
6863
|
+
<slot part="bank drags" name="drags" class="hover-border" style=${scale}></slot>
|
|
6580
6864
|
<div role="alert" part="message" id="validation-message"></div>`;
|
|
6581
6865
|
}
|
|
6582
6866
|
shouldReturnToInventoryOnInventoryDrop() {
|
|
@@ -6624,11 +6908,30 @@ var QtiGraphicGapMatchInteraction = class extends DragDropSlottedSortableMixin(S
|
|
|
6624
6908
|
if (!graphic || !coords || !shape)
|
|
6625
6909
|
return;
|
|
6626
6910
|
this.#keepDeclaredRatio(graphic);
|
|
6911
|
+
this.#observeGraphic(graphic);
|
|
6627
6912
|
positionShapes(shape, coords.split(",").map((s) => parseFloat(s)), graphic, hotspot);
|
|
6628
6913
|
}
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6914
|
+
/**
|
|
6915
|
+
* Tracks the graphic's rendered width. The authored chip sizes live in the same coordinate space
|
|
6916
|
+
* as the `coords` — an item that draws a 275x126 hotspot for a 275x126 tile means the tile to fill
|
|
6917
|
+
* it — so the chips scale by the same factor as the drop areas.
|
|
6918
|
+
*/
|
|
6919
|
+
#observeGraphic(graphic) {
|
|
6920
|
+
if (this.#observedGraphic === graphic)
|
|
6921
|
+
return;
|
|
6922
|
+
this.#graphicObserver?.disconnect();
|
|
6923
|
+
this.#observedGraphic = graphic;
|
|
6924
|
+
this.#graphicObserver = new ResizeObserver(() => {
|
|
6925
|
+
const declared = parseFloat(graphic.getAttribute("width") ?? "");
|
|
6926
|
+
const rendered = graphic.getBoundingClientRect().width;
|
|
6927
|
+
const scale = declared > 0 && rendered > 0 ? Math.min(1, rendered / declared) : 1;
|
|
6928
|
+
const rounded = Math.round(scale * 1e3) / 1e3;
|
|
6929
|
+
if (rounded !== this._graphicScale)
|
|
6930
|
+
this._graphicScale = rounded;
|
|
6931
|
+
});
|
|
6932
|
+
this.#graphicObserver.observe(graphic);
|
|
6933
|
+
}
|
|
6934
|
+
#positionHotspotOnRegister;
|
|
6632
6935
|
connectedCallback() {
|
|
6633
6936
|
super.connectedCallback();
|
|
6634
6937
|
this.addEventListener("qti-register-hotspot", this.#positionHotspotOnRegister);
|
|
@@ -6637,8 +6940,14 @@ var QtiGraphicGapMatchInteraction = class extends DragDropSlottedSortableMixin(S
|
|
|
6637
6940
|
disconnectedCallback() {
|
|
6638
6941
|
super.disconnectedCallback();
|
|
6639
6942
|
this.removeEventListener("qti-register-hotspot", this.#positionHotspotOnRegister);
|
|
6943
|
+
this.#graphicObserver?.disconnect();
|
|
6944
|
+
this.#graphicObserver = null;
|
|
6945
|
+
this.#observedGraphic = null;
|
|
6640
6946
|
}
|
|
6641
6947
|
};
|
|
6948
|
+
__decorate20([
|
|
6949
|
+
state10()
|
|
6950
|
+
], QtiGraphicGapMatchInteraction.prototype, "_graphicScale", void 0);
|
|
6642
6951
|
|
|
6643
6952
|
// ../interactions/graphic-order-interaction/dist/qti-graphic-order-interaction.js
|
|
6644
6953
|
import { html as html19 } from "lit";
|
|
@@ -6691,7 +7000,7 @@ var qti_graphic_order_interaction_styles_default = [
|
|
|
6691
7000
|
];
|
|
6692
7001
|
|
|
6693
7002
|
// ../interactions/graphic-order-interaction/dist/qti-graphic-order-interaction.js
|
|
6694
|
-
var
|
|
7003
|
+
var __decorate21 = function(decorators, target, key, desc) {
|
|
6695
7004
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6696
7005
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6697
7006
|
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;
|
|
@@ -6742,9 +7051,11 @@ var QtiGraphicOrderInteraction = class _QtiGraphicOrderInteraction extends Choic
|
|
|
6742
7051
|
ordered.push(identifier);
|
|
6743
7052
|
}
|
|
6744
7053
|
this.response = ordered;
|
|
6745
|
-
this.validate();
|
|
6746
|
-
this.reportValidity();
|
|
6747
7054
|
this.saveResponse(this.response);
|
|
7055
|
+
void this.updateComplete.then(() => {
|
|
7056
|
+
this.validate();
|
|
7057
|
+
this.reportValidity({ trigger: "change" });
|
|
7058
|
+
});
|
|
6748
7059
|
}
|
|
6749
7060
|
/** The response as the ordered identifier list this interaction always treats it as. */
|
|
6750
7061
|
#orderedResponse() {
|
|
@@ -6826,10 +7137,10 @@ var QtiGraphicOrderInteraction = class _QtiGraphicOrderInteraction extends Choic
|
|
|
6826
7137
|
this.removeEventListener("register-qti-hotspot-choice", this.#positionHotspotOnRegister);
|
|
6827
7138
|
}
|
|
6828
7139
|
};
|
|
6829
|
-
|
|
7140
|
+
__decorate21([
|
|
6830
7141
|
property19({ type: Number, attribute: "max-choices" })
|
|
6831
7142
|
], QtiGraphicOrderInteraction.prototype, "maxChoices", void 0);
|
|
6832
|
-
|
|
7143
|
+
__decorate21([
|
|
6833
7144
|
watch("response")
|
|
6834
7145
|
], QtiGraphicOrderInteraction.prototype, "handleOrderedResponseChange", null);
|
|
6835
7146
|
|
|
@@ -6924,6 +7235,8 @@ var QtiHotspotInteraction = class extends ChoicesMixin(Interaction, "qti-hotspot
|
|
|
6924
7235
|
}
|
|
6925
7236
|
async #positionHotspot(hotspot) {
|
|
6926
7237
|
const img = this.querySelector("img");
|
|
7238
|
+
if (!img)
|
|
7239
|
+
return;
|
|
6927
7240
|
const coords = hotspot.getAttribute("coords");
|
|
6928
7241
|
const shape = hotspot.getAttribute("shape");
|
|
6929
7242
|
const coordsNumber = coords.split(",").map((s) => parseInt(s));
|
|
@@ -6974,8 +7287,9 @@ var QtiHottextInteraction = class extends ChoicesMixin(Interaction, "qti-hottext
|
|
|
6974
7287
|
|
|
6975
7288
|
// ../interactions/inline-choice-interaction/dist/qti-inline-choice-interaction.js
|
|
6976
7289
|
import { html as html22 } from "lit";
|
|
6977
|
-
import { property as property20, state as
|
|
6978
|
-
import {
|
|
7290
|
+
import { property as property20, state as state11 } from "lit/decorators.js";
|
|
7291
|
+
import { ifDefined as ifDefined3 } from "lit/directives/if-defined.js";
|
|
7292
|
+
import { consume as consume6 } from "@lit/context";
|
|
6979
7293
|
|
|
6980
7294
|
// ../interactions/core/dist/mixins/menu-auto-size/menu-auto-size.mixin.js
|
|
6981
7295
|
var MenuAutoSizeMixin = (superClass, menuSelector = "[part='menu']", triggerSelector = "[part='trigger']", customProperty = "--qti-inline-choice-width") => {
|
|
@@ -7100,7 +7414,7 @@ var MenuAutoSizeMixin = (superClass, menuSelector = "[part='menu']", triggerSele
|
|
|
7100
7414
|
if (!menu)
|
|
7101
7415
|
return widest;
|
|
7102
7416
|
const menuStyle = getComputedStyle(menu);
|
|
7103
|
-
return widest + parseFloat(menuStyle.paddingLeft) + parseFloat(menuStyle.paddingRight)
|
|
7417
|
+
return widest + parseFloat(menuStyle.paddingLeft) + parseFloat(menuStyle.paddingRight);
|
|
7104
7418
|
});
|
|
7105
7419
|
}
|
|
7106
7420
|
/**
|
|
@@ -7262,7 +7576,13 @@ var own = css21`
|
|
|
7262
7576
|
vertical-align: baseline;
|
|
7263
7577
|
}
|
|
7264
7578
|
|
|
7579
|
+
/*
|
|
7580
|
+
* min-height: 1lh — one line of the trigger's own line-height. An empty value (data-prompt="")
|
|
7581
|
+
* is an empty span, which has no line box and collapsed the field to the chevron's height
|
|
7582
|
+
* (measured: 20px empty vs 28px with text). Now the field is a line tall either way.
|
|
7583
|
+
*/
|
|
7265
7584
|
[part='value'] {
|
|
7585
|
+
min-height: 1lh;
|
|
7266
7586
|
min-width: 0;
|
|
7267
7587
|
overflow: hidden;
|
|
7268
7588
|
text-overflow: ellipsis;
|
|
@@ -7270,11 +7590,23 @@ var own = css21`
|
|
|
7270
7590
|
text-align: left;
|
|
7271
7591
|
}
|
|
7272
7592
|
|
|
7593
|
+
/*
|
|
7594
|
+
* A zero-width space before the value and the option text, so an empty one (data-prompt="") still
|
|
7595
|
+
* has a line box and therefore a text baseline. Without it the inline-grid trigger has no baseline
|
|
7596
|
+
* and the browser sits its bottom edge on the sentence's baseline: the empty field rode high and
|
|
7597
|
+
* made the line taller (measured: paragraph 39px empty vs 32.5px answered). No width, not
|
|
7598
|
+
* selectable, and the empty alt text keeps it out of the accessible name.
|
|
7599
|
+
*/
|
|
7600
|
+
[part='value']::before,
|
|
7601
|
+
[part='option-content']::before {
|
|
7602
|
+
content: '\\200B' / '';
|
|
7603
|
+
}
|
|
7604
|
+
|
|
7273
7605
|
/* ── Chevron icon ─────────────────────────────────────────────────────────────
|
|
7274
7606
|
Rendered as a CSS mask so the theme controls its colour via color:.
|
|
7275
7607
|
The span in the template is empty; this CSS provides the visual.
|
|
7276
7608
|
*/
|
|
7277
|
-
[part~='
|
|
7609
|
+
[part~='icon'] {
|
|
7278
7610
|
flex: 0 0 auto;
|
|
7279
7611
|
display: inline-block;
|
|
7280
7612
|
width: 1em;
|
|
@@ -7286,7 +7618,7 @@ var own = css21`
|
|
|
7286
7618
|
transform-origin: center;
|
|
7287
7619
|
}
|
|
7288
7620
|
|
|
7289
|
-
[part~='
|
|
7621
|
+
[part~='open'] {
|
|
7290
7622
|
transform: rotate(180deg);
|
|
7291
7623
|
}
|
|
7292
7624
|
|
|
@@ -7320,7 +7652,26 @@ var own = css21`
|
|
|
7320
7652
|
text-overflow: ellipsis;
|
|
7321
7653
|
}
|
|
7322
7654
|
|
|
7655
|
+
/* The empty prompt row while nothing is chosen (see renderMenu). The rule above sets display, which
|
|
7656
|
+
beats the UA's [hidden] rule, so hidden has to be restated here. */
|
|
7657
|
+
button[part~='option'][hidden] {
|
|
7658
|
+
display: none;
|
|
7659
|
+
}
|
|
7660
|
+
|
|
7661
|
+
/* The clear row's x glyph: a mask like the chevron, so the theme colours it with color:. */
|
|
7662
|
+
[part='clear-icon'] {
|
|
7663
|
+
display: inline-block;
|
|
7664
|
+
width: 1em;
|
|
7665
|
+
height: 1em;
|
|
7666
|
+
vertical-align: middle;
|
|
7667
|
+
background-color: currentColor;
|
|
7668
|
+
mask: var(--qti-times-mask) no-repeat center / contain;
|
|
7669
|
+
-webkit-mask: var(--qti-times-mask) no-repeat center / contain;
|
|
7670
|
+
}
|
|
7671
|
+
|
|
7672
|
+
/* min-height: 1lh, so an empty prompt row is as tall as the other rows — see [part='value']. */
|
|
7323
7673
|
[part='option-content'] {
|
|
7674
|
+
min-height: 1lh;
|
|
7324
7675
|
flex: 1 1 auto;
|
|
7325
7676
|
min-width: 0;
|
|
7326
7677
|
overflow: hidden;
|
|
@@ -7349,7 +7700,7 @@ var styles2 = own;
|
|
|
7349
7700
|
var qti_inline_choice_interaction_styles_default = styles2;
|
|
7350
7701
|
|
|
7351
7702
|
// ../interactions/inline-choice-interaction/dist/qti-inline-choice-interaction.js
|
|
7352
|
-
var
|
|
7703
|
+
var __decorate22 = function(decorators, target, key, desc) {
|
|
7353
7704
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7354
7705
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7355
7706
|
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;
|
|
@@ -7370,7 +7721,7 @@ var QtiInlineChoiceInteraction = class extends MenuAutoSizeMixin(Interaction) {
|
|
|
7370
7721
|
this.minChoices = 0;
|
|
7371
7722
|
this._handleRequiredChange = () => {
|
|
7372
7723
|
this.validate();
|
|
7373
|
-
this.reportValidity();
|
|
7724
|
+
this.reportValidity({ trigger: "change" });
|
|
7374
7725
|
};
|
|
7375
7726
|
this._pendingResponse = void 0;
|
|
7376
7727
|
this.#onTriggerClick = (event) => {
|
|
@@ -7473,14 +7824,34 @@ var QtiInlineChoiceInteraction = class extends MenuAutoSizeMixin(Interaction) {
|
|
|
7473
7824
|
>
|
|
7474
7825
|
<span part="value">${selected?.content}</span>
|
|
7475
7826
|
<span
|
|
7476
|
-
part="${this._dropdownOpen ? "dropdown-icon dropdown-icon-open" : "dropdown-icon"}"
|
|
7827
|
+
part="${this._dropdownOpen ? "icon open dropdown-icon dropdown-icon-open" : "icon dropdown-icon"}"
|
|
7477
7828
|
aria-hidden="true"
|
|
7478
7829
|
></span>
|
|
7479
7830
|
</button>
|
|
7480
7831
|
`;
|
|
7481
7832
|
}
|
|
7482
|
-
/**
|
|
7833
|
+
/**
|
|
7834
|
+
* The popover listbox. Its first row is the prompt — the way back to "nothing chosen", as the
|
|
7835
|
+
* spec's figure of an open dropdown shows it. With an empty prompt there is nothing to read, so:
|
|
7836
|
+
* while nothing is chosen the row is hidden (it would read as an empty option, and there is
|
|
7837
|
+
* nothing to clear), and once something is chosen it is a clear button — an x glyph named by
|
|
7838
|
+
* `data-clear-label`. Either way selecting it does the same: `#selectValue('')`.
|
|
7839
|
+
*/
|
|
7483
7840
|
renderMenu() {
|
|
7841
|
+
const prompt = this.options[0];
|
|
7842
|
+
const promptEmpty = this.#promptIsEmpty();
|
|
7843
|
+
const nothingChosen = prompt?.selected ?? true;
|
|
7844
|
+
const hidden = promptEmpty && nothingChosen;
|
|
7845
|
+
const clear = promptEmpty && !nothingChosen;
|
|
7846
|
+
const parts = [
|
|
7847
|
+
"option",
|
|
7848
|
+
"prompt",
|
|
7849
|
+
prompt?.selected ? "selected" : "",
|
|
7850
|
+
clear ? "clear" : "",
|
|
7851
|
+
"option-prompt",
|
|
7852
|
+
prompt?.selected ? "option-selected" : "",
|
|
7853
|
+
clear ? "option-clear" : ""
|
|
7854
|
+
].filter(Boolean).join(" ");
|
|
7484
7855
|
return html22`
|
|
7485
7856
|
<div
|
|
7486
7857
|
id="${this._menuId}"
|
|
@@ -7491,13 +7862,17 @@ var QtiInlineChoiceInteraction = class extends MenuAutoSizeMixin(Interaction) {
|
|
|
7491
7862
|
@keydown=${this.#onCustomMenuKeyDown}
|
|
7492
7863
|
>
|
|
7493
7864
|
<button
|
|
7494
|
-
part="${
|
|
7865
|
+
part="${parts}"
|
|
7495
7866
|
type="button"
|
|
7496
7867
|
role="option"
|
|
7497
|
-
|
|
7868
|
+
?hidden=${hidden}
|
|
7869
|
+
aria-label=${ifDefined3(clear ? this.dataClearLabel || "Clear" : void 0)}
|
|
7870
|
+
aria-selected="${prompt?.selected ? "true" : "false"}"
|
|
7498
7871
|
@click=${() => this.#selectValue("")}
|
|
7499
7872
|
>
|
|
7500
|
-
<span part="option-content"
|
|
7873
|
+
<span part="option-content"
|
|
7874
|
+
>${clear ? html22`<span part="clear-icon" aria-hidden="true"></span>` : prompt?.content}</span
|
|
7875
|
+
>
|
|
7501
7876
|
</button>
|
|
7502
7877
|
<slot @slotchange=${this.#onChoicesSlotChange}></slot>
|
|
7503
7878
|
</div>
|
|
@@ -7545,12 +7920,29 @@ var QtiInlineChoiceInteraction = class extends MenuAutoSizeMixin(Interaction) {
|
|
|
7545
7920
|
this.#syncSlottedChoices();
|
|
7546
7921
|
}
|
|
7547
7922
|
}
|
|
7923
|
+
/** True when the prompt row has no text of its own (`data-prompt=""`). */
|
|
7924
|
+
#promptIsEmpty() {
|
|
7925
|
+
const content = this.options[0]?.content;
|
|
7926
|
+
return typeof content === "string" && content.trim() === "";
|
|
7927
|
+
}
|
|
7928
|
+
/**
|
|
7929
|
+
* Leaves the prompt row out of the width measurement when the prompt is empty. That row is hidden
|
|
7930
|
+
* while nothing is chosen (measures 0) and a clear glyph once something is (measures a glyph), so
|
|
7931
|
+
* counting it would let the closed field change width on the first choice. Its text is empty
|
|
7932
|
+
* either way, so it has nothing to contribute.
|
|
7933
|
+
*/
|
|
7934
|
+
menuAutoSizeRows() {
|
|
7935
|
+
const rows = super.menuAutoSizeRows();
|
|
7936
|
+
if (!this.#promptIsEmpty())
|
|
7937
|
+
return rows;
|
|
7938
|
+
return rows.filter((row) => !row.matches('button[part~="option-prompt"]'));
|
|
7939
|
+
}
|
|
7548
7940
|
#selectedOption() {
|
|
7549
7941
|
return this.options.find((option) => option.selected) ?? this.options[0];
|
|
7550
7942
|
}
|
|
7551
7943
|
#updateOptions() {
|
|
7552
7944
|
const choices = Array.from(this.querySelectorAll("qti-inline-choice"));
|
|
7553
|
-
const prompt = this.dataPrompt
|
|
7945
|
+
const prompt = this.dataPrompt ?? this.configContext?.inlineChoicePrompt ?? "select";
|
|
7554
7946
|
const pendingValue = this._pendingResponse;
|
|
7555
7947
|
const currentlySelectedValue = pendingValue !== void 0 ? pendingValue ?? "" : this.options.find((o) => o.selected)?.value ?? "";
|
|
7556
7948
|
const nextOptions = [
|
|
@@ -7575,20 +7967,23 @@ var QtiInlineChoiceInteraction = class extends MenuAutoSizeMixin(Interaction) {
|
|
|
7575
7967
|
this.updateMenuWidth();
|
|
7576
7968
|
}
|
|
7577
7969
|
/**
|
|
7578
|
-
* Autosizing is
|
|
7579
|
-
* `qti-input-width-*` class always wins.
|
|
7970
|
+
* Autosizing is on unless a host turns it off (`configContext.inlineChoiceAutosize: false`), and an
|
|
7971
|
+
* explicit `qti-input-width-*` class always wins. On by default because without it the field sizes
|
|
7972
|
+
* to the option shown, so choosing a longer one widened the field and reflowed the sentence around
|
|
7973
|
+
* it: a state that changed layout.
|
|
7580
7974
|
*
|
|
7581
7975
|
* That second check has to live here rather than in CSS: the measurement is written as an inline
|
|
7582
7976
|
* style on the trigger, and the width classes set the same property on `:host`, so the cascade
|
|
7583
7977
|
* would hand it to the measurement every time. Not writing at all is what makes the class win.
|
|
7584
7978
|
*/
|
|
7585
7979
|
shouldAutoSizeMenu() {
|
|
7586
|
-
if (
|
|
7980
|
+
if (this.configContext?.inlineChoiceAutosize === false)
|
|
7587
7981
|
return false;
|
|
7588
7982
|
return !Array.from(this.classList).some((c) => c.startsWith("qti-input-width-"));
|
|
7589
7983
|
}
|
|
7590
7984
|
/**
|
|
7591
|
-
* The chevron sits in the trigger and not in the menu, so the menu never
|
|
7985
|
+
* The chevron (and the gap before it) sits in the trigger and not in the menu, so the menu never
|
|
7986
|
+
* measures it.
|
|
7592
7987
|
*
|
|
7593
7988
|
* `offsetWidth`, NOT `getBoundingClientRect().width`: the icon rotates when the menu opens, and a
|
|
7594
7989
|
* client rect reports the TRANSFORMED box — so a chevron caught mid-rotation measures wider than
|
|
@@ -7597,22 +7992,27 @@ var QtiInlineChoiceInteraction = class extends MenuAutoSizeMixin(Interaction) {
|
|
|
7597
7992
|
* up mid-animation.)
|
|
7598
7993
|
*/
|
|
7599
7994
|
menuAutoSizeExtraWidth() {
|
|
7600
|
-
const icon = this.renderRoot.querySelector('span[part~="
|
|
7601
|
-
|
|
7995
|
+
const icon = this.renderRoot.querySelector('span[part~="icon"]');
|
|
7996
|
+
if (!icon)
|
|
7997
|
+
return 0;
|
|
7998
|
+
const trigger = this.renderRoot.querySelector('button[part="trigger"]');
|
|
7999
|
+
const gap = trigger ? parseFloat(getComputedStyle(trigger).columnGap) || 0 : 0;
|
|
8000
|
+
return icon.offsetWidth + gap;
|
|
7602
8001
|
}
|
|
7603
8002
|
validate() {
|
|
7604
8003
|
const selectedOption = this.options.find((option) => option.selected);
|
|
7605
8004
|
const hasSelection = selectedOption ? selectedOption.value !== "" : false;
|
|
7606
8005
|
const answerDemanded = this.required || this.minChoices >= 1;
|
|
7607
8006
|
const isValid = hasSelection || !answerDemanded;
|
|
7608
|
-
const validityMessage = this.dataset.minChoicesMessage || "Please select an option.";
|
|
7609
|
-
this.setInteractionValidity(isValid, isValid ? "" : validityMessage, this, { suppressInline: true });
|
|
8007
|
+
const validityMessage = this.dataset.minSelectionsMessage || this.dataset.minChoicesMessage || "Please select an option.";
|
|
8008
|
+
this.setInteractionValidity(isValid, isValid ? "" : validityMessage, this, { suppressInline: true, kind: "min" });
|
|
7610
8009
|
return isValid;
|
|
7611
8010
|
}
|
|
7612
|
-
reportValidity() {
|
|
7613
|
-
return super.reportValidity();
|
|
8011
|
+
reportValidity(options) {
|
|
8012
|
+
return super.reportValidity(options);
|
|
7614
8013
|
}
|
|
7615
8014
|
reset() {
|
|
8015
|
+
this.resetValidityReport();
|
|
7616
8016
|
this.#setDropdownOpen(false);
|
|
7617
8017
|
this.options = this.options.map((option, i) => ({ ...option, selected: i === 0 }));
|
|
7618
8018
|
this.#syncSlottedChoices();
|
|
@@ -7634,7 +8034,7 @@ var QtiInlineChoiceInteraction = class extends MenuAutoSizeMixin(Interaction) {
|
|
|
7634
8034
|
this.options = this.options.map((option) => ({ ...option, selected: option.value === value }));
|
|
7635
8035
|
this.#syncSlottedChoices();
|
|
7636
8036
|
this.validate();
|
|
7637
|
-
this.reportValidity();
|
|
8037
|
+
this.reportValidity({ trigger: "change" });
|
|
7638
8038
|
this.saveResponse(value);
|
|
7639
8039
|
this.#setDropdownOpen(false);
|
|
7640
8040
|
}
|
|
@@ -7690,6 +8090,7 @@ var QtiInlineChoiceInteraction = class extends MenuAutoSizeMixin(Interaction) {
|
|
|
7690
8090
|
}
|
|
7691
8091
|
}
|
|
7692
8092
|
async #syncSlottedChoices() {
|
|
8093
|
+
this._internals.setFormValue(this.response);
|
|
7693
8094
|
await this.updateComplete;
|
|
7694
8095
|
const selectedValue = this.options.find((option) => option.selected)?.value ?? "";
|
|
7695
8096
|
const choices = Array.from(this.querySelectorAll("qti-inline-choice"));
|
|
@@ -7714,28 +8115,31 @@ var QtiInlineChoiceInteraction = class extends MenuAutoSizeMixin(Interaction) {
|
|
|
7714
8115
|
}
|
|
7715
8116
|
}
|
|
7716
8117
|
#allMenuOptions() {
|
|
7717
|
-
const promptOption = this.renderRoot.querySelector('button[part~="option"]');
|
|
8118
|
+
const promptOption = this.renderRoot.querySelector('button[part~="option"]:not([hidden])');
|
|
7718
8119
|
const slottedChoices = Array.from(this.querySelectorAll("qti-inline-choice"));
|
|
7719
8120
|
return [...promptOption ? [promptOption] : [], ...slottedChoices];
|
|
7720
8121
|
}
|
|
7721
8122
|
};
|
|
7722
|
-
|
|
7723
|
-
|
|
8123
|
+
__decorate22([
|
|
8124
|
+
state11()
|
|
7724
8125
|
], QtiInlineChoiceInteraction.prototype, "options", void 0);
|
|
7725
|
-
|
|
7726
|
-
|
|
8126
|
+
__decorate22([
|
|
8127
|
+
state11()
|
|
7727
8128
|
], QtiInlineChoiceInteraction.prototype, "_dropdownOpen", void 0);
|
|
7728
|
-
|
|
7729
|
-
|
|
8129
|
+
__decorate22([
|
|
8130
|
+
consume6({ context: configContext, subscribe: true }),
|
|
7730
8131
|
property20({ attribute: false })
|
|
7731
8132
|
], QtiInlineChoiceInteraction.prototype, "configContext", void 0);
|
|
7732
|
-
|
|
8133
|
+
__decorate22([
|
|
7733
8134
|
property20({ type: String, attribute: "data-prompt" })
|
|
7734
8135
|
], QtiInlineChoiceInteraction.prototype, "dataPrompt", void 0);
|
|
7735
|
-
|
|
8136
|
+
__decorate22([
|
|
8137
|
+
property20({ type: String, attribute: "data-clear-label" })
|
|
8138
|
+
], QtiInlineChoiceInteraction.prototype, "dataClearLabel", void 0);
|
|
8139
|
+
__decorate22([
|
|
7736
8140
|
watch("dataPrompt", { waitUntilFirstUpdate: true })
|
|
7737
8141
|
], QtiInlineChoiceInteraction.prototype, "_handleDataPromptChange", void 0);
|
|
7738
|
-
|
|
8142
|
+
__decorate22([
|
|
7739
8143
|
property20({
|
|
7740
8144
|
type: Boolean,
|
|
7741
8145
|
reflect: true,
|
|
@@ -7746,19 +8150,19 @@ __decorate21([
|
|
|
7746
8150
|
}
|
|
7747
8151
|
})
|
|
7748
8152
|
], QtiInlineChoiceInteraction.prototype, "required", void 0);
|
|
7749
|
-
|
|
8153
|
+
__decorate22([
|
|
7750
8154
|
property20({ type: Number, attribute: "min-choices" })
|
|
7751
8155
|
], QtiInlineChoiceInteraction.prototype, "minChoices", void 0);
|
|
7752
|
-
|
|
8156
|
+
__decorate22([
|
|
7753
8157
|
watch(["required", "minChoices"], { waitUntilFirstUpdate: true })
|
|
7754
8158
|
], QtiInlineChoiceInteraction.prototype, "_handleRequiredChange", void 0);
|
|
7755
|
-
|
|
8159
|
+
__decorate22([
|
|
7756
8160
|
property20({ attribute: "response", reflect: false, noAccessor: true })
|
|
7757
8161
|
], QtiInlineChoiceInteraction.prototype, "response", null);
|
|
7758
8162
|
|
|
7759
8163
|
// ../interactions/match-interaction/dist/qti-match-interaction.js
|
|
7760
8164
|
import { html as html23, nothing as nothing3 } from "lit";
|
|
7761
|
-
import { property as property21, state as
|
|
8165
|
+
import { property as property21, state as state12 } from "lit/decorators.js";
|
|
7762
8166
|
|
|
7763
8167
|
// ../interactions/match-interaction/dist/qti-match-interaction.styles.js
|
|
7764
8168
|
import { css as css22 } from "lit";
|
|
@@ -7882,6 +8286,25 @@ var qti_match_interaction_tabular_styles_default = [
|
|
|
7882
8286
|
:host(.qti-match-tabular) slot:not([hidden]) {
|
|
7883
8287
|
display: contents;
|
|
7884
8288
|
}
|
|
8289
|
+
/*
|
|
8290
|
+
* Each cell's radio or checkbox is a real input, visually hidden over the whole cell: it takes
|
|
8291
|
+
* Tab focus, the arrow keys move within a row's radio group and Space toggles a checkbox, all
|
|
8292
|
+
* natively. It was the hidden attribute, which took it out of the tab order, so the grid could not be
|
|
8293
|
+
* answered from a keyboard at all. The span beside it draws the control; the theme rings the
|
|
8294
|
+
* cell (::part(input-cell):focus-within).
|
|
8295
|
+
*/
|
|
8296
|
+
:host(.qti-match-tabular) [part~='input-cell'] {
|
|
8297
|
+
position: relative;
|
|
8298
|
+
}
|
|
8299
|
+
:host(.qti-match-tabular) [part~='input-cell'] > input {
|
|
8300
|
+
position: absolute;
|
|
8301
|
+
inset: 0;
|
|
8302
|
+
width: 100%;
|
|
8303
|
+
height: 100%;
|
|
8304
|
+
margin: 0;
|
|
8305
|
+
opacity: 0;
|
|
8306
|
+
cursor: pointer;
|
|
8307
|
+
}
|
|
7885
8308
|
:host(.qti-match-tabular) [part='grid'] {
|
|
7886
8309
|
display: grid;
|
|
7887
8310
|
/* Clips the cell rules — which are the grid's own background showing through a 1px gap — to the
|
|
@@ -7896,19 +8319,19 @@ var qti_match_interaction_tabular_styles_default = [
|
|
|
7896
8319
|
outer grid's tracks. This structure is shared with the editor's tabular
|
|
7897
8320
|
template so both can inherit the same theme CSS. No per-choice inline
|
|
7898
8321
|
style writes are needed — auto-flow + subgrid handle placement. */
|
|
7899
|
-
:host(.qti-match-tabular) [part
|
|
8322
|
+
:host(.qti-match-tabular) [part~='columns'] {
|
|
7900
8323
|
grid-column: 2 / -1;
|
|
7901
8324
|
grid-row: 1;
|
|
7902
8325
|
display: grid;
|
|
7903
8326
|
grid-template-columns: subgrid;
|
|
7904
8327
|
}
|
|
7905
|
-
:host(.qti-match-tabular) [part
|
|
8328
|
+
:host(.qti-match-tabular) [part~='rows'] {
|
|
7906
8329
|
grid-column: 1;
|
|
7907
8330
|
grid-row: 2 / -1;
|
|
7908
8331
|
display: grid;
|
|
7909
8332
|
grid-template-rows: subgrid;
|
|
7910
8333
|
}
|
|
7911
|
-
:host(.qti-match-tabular) [part
|
|
8334
|
+
:host(.qti-match-tabular) [part~='cells'] {
|
|
7912
8335
|
grid-column: 2 / -1;
|
|
7913
8336
|
grid-row: 2 / -1;
|
|
7914
8337
|
display: grid;
|
|
@@ -7919,6 +8342,20 @@ var qti_match_interaction_tabular_styles_default = [
|
|
|
7919
8342
|
display: contents;
|
|
7920
8343
|
}
|
|
7921
8344
|
|
|
8345
|
+
/*
|
|
8346
|
+
* qti-header-hidden (vocabulary §1.2.8.2): "Do not display the top row of the table where the
|
|
8347
|
+
* column headers are displayed." The whole row goes, the top-left cell with it.
|
|
8348
|
+
*/
|
|
8349
|
+
:host(.qti-match-tabular.qti-header-hidden) [part='grid'] {
|
|
8350
|
+
grid-template-rows: repeat(var(--qti-match-rows, 1), auto);
|
|
8351
|
+
}
|
|
8352
|
+
:host(.qti-match-tabular.qti-header-hidden) :is([part='corner'], [part~='columns']) {
|
|
8353
|
+
display: none;
|
|
8354
|
+
}
|
|
8355
|
+
:host(.qti-match-tabular.qti-header-hidden) :is([part~='rows'], [part~='cells']) {
|
|
8356
|
+
grid-row: 1 / -1;
|
|
8357
|
+
}
|
|
8358
|
+
|
|
7922
8359
|
/*
|
|
7923
8360
|
* The radio/checkbox box centres its own mark. qti-simple-choice.styles.ts does the same for
|
|
7924
8361
|
* the non-tabular control; here the cells are plain spans in this shadow root, so the rule
|
|
@@ -7938,16 +8375,18 @@ var qti_match_interaction_tabular_styles_default = [
|
|
|
7938
8375
|
];
|
|
7939
8376
|
|
|
7940
8377
|
// ../interactions/match-interaction/dist/qti-match-interaction.js
|
|
7941
|
-
var
|
|
8378
|
+
var __decorate23 = function(decorators, target, key, desc) {
|
|
7942
8379
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7943
8380
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7944
8381
|
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;
|
|
7945
8382
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7946
8383
|
};
|
|
7947
|
-
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"), '[
|
|
8384
|
+
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"), '[data-draggable="true"]') {
|
|
7948
8385
|
constructor() {
|
|
7949
8386
|
super(...arguments);
|
|
7950
8387
|
this.autoSizeDropzones = false;
|
|
8388
|
+
this.maxAssociations = 1;
|
|
8389
|
+
this.minAssociations = 0;
|
|
7951
8390
|
this.lastCheckedRadio = null;
|
|
7952
8391
|
this.class = "";
|
|
7953
8392
|
this._response = [];
|
|
@@ -8056,16 +8495,24 @@ var QtiMatchInteraction = class extends DragDropSlottedSortableMixin(DragDropSlo
|
|
|
8056
8495
|
this.sourceChoices?.forEach((c) => {
|
|
8057
8496
|
stripSizing(c);
|
|
8058
8497
|
c.setAttribute("role", "rowheader");
|
|
8498
|
+
c.tabIndex = -1;
|
|
8059
8499
|
});
|
|
8060
8500
|
this.targetChoices?.forEach((c) => {
|
|
8061
8501
|
stripSizing(c);
|
|
8062
8502
|
c.setAttribute("role", "columnheader");
|
|
8503
|
+
c.tabIndex = -1;
|
|
8063
8504
|
});
|
|
8064
8505
|
} else {
|
|
8065
8506
|
sourceSet?.removeAttribute("slot");
|
|
8066
8507
|
targetSet?.removeAttribute("slot");
|
|
8067
|
-
this.sourceChoices?.forEach((c) =>
|
|
8068
|
-
|
|
8508
|
+
this.sourceChoices?.forEach((c) => {
|
|
8509
|
+
c.removeAttribute("role");
|
|
8510
|
+
c.tabIndex = c.disabled ? -1 : 0;
|
|
8511
|
+
});
|
|
8512
|
+
this.targetChoices?.forEach((c) => {
|
|
8513
|
+
c.removeAttribute("role");
|
|
8514
|
+
c.tabIndex = c.disabled ? -1 : 0;
|
|
8515
|
+
});
|
|
8069
8516
|
}
|
|
8070
8517
|
}
|
|
8071
8518
|
validate() {
|
|
@@ -8091,10 +8538,12 @@ var QtiMatchInteraction = class extends DragDropSlottedSortableMixin(DragDropSlo
|
|
|
8091
8538
|
role="grid"
|
|
8092
8539
|
style="--qti-match-rows: ${this.sourceChoices.length}; --qti-match-cols: ${this.targetChoices.length};"
|
|
8093
8540
|
>
|
|
8094
|
-
<div part="corner"
|
|
8095
|
-
<div part="cols-wrap" role="row"
|
|
8096
|
-
|
|
8097
|
-
|
|
8541
|
+
<div part="corner">${this.dataFirstColumnHeader ?? nothing3}</div>
|
|
8542
|
+
<div part="columns cols-wrap" role="row">
|
|
8543
|
+
<slot name="match-cols" part="column-header c-header"></slot>
|
|
8544
|
+
</div>
|
|
8545
|
+
<div part="rows rows-wrap"><slot name="match-rows" part="row-header r-header"></slot></div>
|
|
8546
|
+
<div part="cells checkbox-grid">
|
|
8098
8547
|
${this.sourceChoices.map((row, r) => html23`
|
|
8099
8548
|
<div role="row" style="display: contents;">
|
|
8100
8549
|
${this.targetChoices.map((col, c) => {
|
|
@@ -8111,13 +8560,12 @@ var QtiMatchInteraction = class extends DragDropSlottedSortableMixin(DragDropSlo
|
|
|
8111
8560
|
const disable = row.matchMax === 1 ? false : row.matchMax !== 0 && selectedInRowCount >= row.matchMax && !checked;
|
|
8112
8561
|
return html23`
|
|
8113
8562
|
<label
|
|
8114
|
-
part="input-cell"
|
|
8563
|
+
part="cell input-cell"
|
|
8115
8564
|
role="gridcell"
|
|
8116
8565
|
style="grid-row: ${r + 1}; grid-column: ${c + 1}; display: flex; align-items: center; justify-content: center; cursor: pointer;"
|
|
8117
8566
|
>
|
|
8118
8567
|
<input
|
|
8119
8568
|
type=${type}
|
|
8120
|
-
hidden
|
|
8121
8569
|
name=${rowId}
|
|
8122
8570
|
value=${value}
|
|
8123
8571
|
.checked=${checked}
|
|
@@ -8141,13 +8589,16 @@ var QtiMatchInteraction = class extends DragDropSlottedSortableMixin(DragDropSlo
|
|
|
8141
8589
|
`;
|
|
8142
8590
|
}
|
|
8143
8591
|
};
|
|
8144
|
-
|
|
8592
|
+
__decorate23([
|
|
8145
8593
|
property21({ type: String })
|
|
8146
8594
|
], QtiMatchInteraction.prototype, "class", void 0);
|
|
8147
|
-
|
|
8148
|
-
|
|
8595
|
+
__decorate23([
|
|
8596
|
+
property21({ type: String, attribute: "data-first-column-header" })
|
|
8597
|
+
], QtiMatchInteraction.prototype, "dataFirstColumnHeader", void 0);
|
|
8598
|
+
__decorate23([
|
|
8599
|
+
state12()
|
|
8149
8600
|
], QtiMatchInteraction.prototype, "_response", void 0);
|
|
8150
|
-
|
|
8601
|
+
__decorate23([
|
|
8151
8602
|
property21({ type: String, attribute: "response-identifier" })
|
|
8152
8603
|
], QtiMatchInteraction.prototype, "responseIdentifier", void 0);
|
|
8153
8604
|
|
|
@@ -8225,7 +8676,7 @@ var QtiMediaInteraction = class extends Interaction {
|
|
|
8225
8676
|
// ../interactions/order-interaction/dist/qti-order-interaction.js
|
|
8226
8677
|
import { html as html25 } from "lit";
|
|
8227
8678
|
import { repeat as repeat6 } from "lit/directives/repeat.js";
|
|
8228
|
-
import { property as property22, state as
|
|
8679
|
+
import { property as property22, state as state13 } from "lit/decorators.js";
|
|
8229
8680
|
|
|
8230
8681
|
// ../interactions/order-interaction/dist/qti-order-interaction.styles.js
|
|
8231
8682
|
import { css as css25 } from "lit";
|
|
@@ -8239,11 +8690,19 @@ var qti_order_interaction_styles_default = [
|
|
|
8239
8690
|
display: block;
|
|
8240
8691
|
}
|
|
8241
8692
|
|
|
8242
|
-
[part
|
|
8693
|
+
[part~='bank'] {
|
|
8694
|
+
/* The bank, the same in every drag-drop interaction: flush with the container (no padding, no
|
|
8695
|
+
margin, no edge of its own), chips a --qti-gap apart. Its lit and ringed looks while a chip is
|
|
8696
|
+
in flight are the theme's ('::part(bank drag-active)', '::part(bank drag-over)'). */
|
|
8243
8697
|
display: flex;
|
|
8698
|
+
flex-wrap: wrap;
|
|
8244
8699
|
align-items: flex-start;
|
|
8245
8700
|
flex: 1;
|
|
8246
|
-
|
|
8701
|
+
gap: var(--qti-gap, 0.5rem);
|
|
8702
|
+
padding: 0;
|
|
8703
|
+
margin: 0;
|
|
8704
|
+
border: 0;
|
|
8705
|
+
border-radius: var(--qti-radius-box, 0.2rem);
|
|
8247
8706
|
}
|
|
8248
8707
|
|
|
8249
8708
|
[part='drops'] {
|
|
@@ -8270,8 +8729,8 @@ var qti_order_interaction_styles_default = [
|
|
|
8270
8729
|
gap: 0.5rem;
|
|
8271
8730
|
}
|
|
8272
8731
|
|
|
8273
|
-
:host([orientation='horizontal']) [part
|
|
8274
|
-
:host(.qti-orientation-horizontal) [part
|
|
8732
|
+
:host([orientation='horizontal']) [part~='bank'],
|
|
8733
|
+
:host(.qti-orientation-horizontal) [part~='bank'] {
|
|
8275
8734
|
flex-direction: row;
|
|
8276
8735
|
}
|
|
8277
8736
|
/*
|
|
@@ -8284,8 +8743,8 @@ var qti_order_interaction_styles_default = [
|
|
|
8284
8743
|
* wrapped and the '.qti-orientation-horizontal' class did not. The theme's rule is gone and so
|
|
8285
8744
|
* is this one; both spellings now wrap, which is what the attribute already did.
|
|
8286
8745
|
*/
|
|
8287
|
-
:host([orientation='vertical']) [part
|
|
8288
|
-
:host(.qti-orientation-vertical) [part
|
|
8746
|
+
:host([orientation='vertical']) [part~='bank'],
|
|
8747
|
+
:host(.qti-orientation-vertical) [part~='bank'] {
|
|
8289
8748
|
flex-direction: column;
|
|
8290
8749
|
}
|
|
8291
8750
|
:host([orientation='vertical']) [part='drops'],
|
|
@@ -8337,7 +8796,7 @@ var qti_order_interaction_styles_default = [
|
|
|
8337
8796
|
* never done anything; it is left in the theme rather than deleted here, since removing it is a
|
|
8338
8797
|
* decision about how a long label should behave, not a relocation.
|
|
8339
8798
|
*/
|
|
8340
|
-
[part~='
|
|
8799
|
+
[part~='chip'] {
|
|
8341
8800
|
display: flex;
|
|
8342
8801
|
align-items: center;
|
|
8343
8802
|
overflow: visible;
|
|
@@ -8447,14 +8906,14 @@ var qti_order_interaction_styles_default = [
|
|
|
8447
8906
|
];
|
|
8448
8907
|
|
|
8449
8908
|
// ../interactions/order-interaction/dist/qti-order-interaction.js
|
|
8450
|
-
var
|
|
8909
|
+
var __decorate24 = function(decorators, target, key, desc) {
|
|
8451
8910
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8452
8911
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
8453
8912
|
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;
|
|
8454
8913
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
8455
8914
|
};
|
|
8456
8915
|
var SlottedBase3 = DragDropSlottedMixin(Interaction, `qti-simple-choice`, `[part~='drop']`, `slot[part~='drags']`);
|
|
8457
|
-
var QtiOrderInteraction = class extends DragDropSlottedSortableMixin(SlottedBase3, '[
|
|
8916
|
+
var QtiOrderInteraction = class extends DragDropSlottedSortableMixin(SlottedBase3, '[data-draggable="true"]') {
|
|
8458
8917
|
constructor() {
|
|
8459
8918
|
super(...arguments);
|
|
8460
8919
|
this.nrChoices = 0;
|
|
@@ -8469,7 +8928,7 @@ var QtiOrderInteraction = class extends DragDropSlottedSortableMixin(SlottedBase
|
|
|
8469
8928
|
}
|
|
8470
8929
|
return html25` <slot name="prompt"> </slot>
|
|
8471
8930
|
<div part="container">
|
|
8472
|
-
<slot part="drags"> </slot>
|
|
8931
|
+
<slot part="bank drags"> </slot>
|
|
8473
8932
|
<div part="drops">
|
|
8474
8933
|
${[...Array(this.nrChoices)].map((_, i) => {
|
|
8475
8934
|
const identifier = `droplist${i}`;
|
|
@@ -8506,17 +8965,20 @@ var QtiOrderInteraction = class extends DragDropSlottedSortableMixin(SlottedBase
|
|
|
8506
8965
|
this.childrenMap = Array.from(this.querySelectorAll("qti-simple-choice"));
|
|
8507
8966
|
}
|
|
8508
8967
|
};
|
|
8509
|
-
|
|
8510
|
-
|
|
8968
|
+
__decorate24([
|
|
8969
|
+
state13()
|
|
8511
8970
|
], QtiOrderInteraction.prototype, "nrChoices", void 0);
|
|
8512
|
-
|
|
8971
|
+
__decorate24([
|
|
8513
8972
|
property22({ type: String })
|
|
8514
8973
|
], QtiOrderInteraction.prototype, "orientation", void 0);
|
|
8515
8974
|
|
|
8516
8975
|
// ../interactions/portable-custom-interaction/dist/qti-portable-custom-interaction.js
|
|
8517
8976
|
import { css as css27, html as html26 } from "lit";
|
|
8518
|
-
import { property as property23, state as
|
|
8519
|
-
import { consume as
|
|
8977
|
+
import { property as property23, state as state14 } from "lit/decorators.js";
|
|
8978
|
+
import { consume as consume7 } from "@lit/context";
|
|
8979
|
+
|
|
8980
|
+
// ../qti-theme/dist/native-css.js
|
|
8981
|
+
var native_css_default = "@layer qti-base {\n/* https://www.imsglobal.org/sites/default/files/spec/qti/v3/guide/img/qti3p0.css */\n/* ============================\n QTI 3 shared css\n 1. Display\n 2. Special Flex styles\n 3. Margin\n 4. Padding\n 5. Horizontal Alignment styles\n 6. Vertical Alignment styles\n 7. Height\n 8. Width\n 9. Text-Indent\n 10. List Style\n 11. Layout\n 12. Other QTI 3 presentation utilities\n ============================ */\n\n/* ==========\n Display css\n =========== */\n\n.qti-display-inline {\n display: inline;\n}\n\n.qti-display-inline-block {\n display: inline-block;\n}\n\n.qti-display-block {\n display: block;\n}\n\n.qti-display-flex {\n display: flex;\n}\n\n.qti-display-inline-flex {\n display: inline-flex;\n}\n\n.qti-display-grid {\n display: grid;\n}\n\n.qti-display-inline-grid {\n display: inline-grid;\n}\n\n.qti-display-table {\n display: table;\n}\n\n.qti-display-table-cell {\n display: table-cell;\n}\n\n.qti-display-table-row {\n display: table-row;\n}\n\n.qti-display-list-item {\n display: list-item;\n}\n\n.qti-display-inherit {\n display: inherit;\n}\n\n/* \n * hidden to screen readers and sighted\n */\n.qti-hidden {\n display: none;\n}\n\n/*\n * visible to screen readers, hidden to sighted\n */\n.qti-visually-hidden {\n position: fixed !important;\n overflow: hidden;\n clip: rect(1px 1px 1px 1px);\n height: 1px;\n width: 1px;\n border: 0;\n margin: -1px;\n}\n\n/* =============================\n Special flex styles\n ============================= */\n\n.qti-flex-direction-column {\n flex-direction: column;\n}\n\n.qti-flex-direction-row {\n flex-direction: row;\n}\n\n.qti-flex-grow-1 {\n flex-grow: 1;\n}\n\n.qti-flex-grow-0 {\n flex-grow: 0;\n}\n\n/* =========\n Margin css\n ========== */\n\n/**\n * For margin Top and Bottom and Left and Right\n */\n.qti-margin-0 {\n margin: 0 !important;\n}\n\n.qti-margin-1 {\n margin: 0.25rem !important;\n}\n\n.qti-margin-2 {\n margin: 0.5rem !important;\n}\n\n.qti-margin-3 {\n margin: 1rem !important;\n}\n\n.qti-margin-4 {\n margin: 1.5rem !important;\n}\n\n.qti-margin-5 {\n margin: 3rem !important;\n}\n\n.qti-margin-auto {\n margin: auto !important;\n}\n\n/*\n For margin Left and Right\n */\n.qti-margin-x-0 {\n margin-right: 0 !important;\n margin-left: 0 !important;\n}\n\n.qti-margin-x-1 {\n margin-right: 0.25rem !important;\n margin-left: 0.25rem !important;\n}\n\n.qti-margin-x-2 {\n margin-right: 0.5rem !important;\n margin-left: 0.5rem !important;\n}\n\n.qti-margin-x-3 {\n margin-right: 1rem !important;\n margin-left: 1rem !important;\n}\n\n.qti-margin-x-4 {\n margin-right: 1.5rem !important;\n margin-left: 1.5rem !important;\n}\n\n.qti-margin-x-5 {\n margin-right: 3rem !important;\n margin-left: 3rem !important;\n}\n\n.qti-margin-x-auto {\n margin-right: auto !important;\n margin-left: auto !important;\n}\n\n/*\n For margin Top and Bottom\n */\n.qti-margin-y-0 {\n margin-top: 0 !important;\n margin-bottom: 0 !important;\n}\n\n.qti-margin-y-1 {\n margin-top: 0.25rem !important;\n margin-bottom: 0.25rem !important;\n}\n\n.qti-margin-y-2 {\n margin-top: 0.5rem !important;\n margin-bottom: 0.5rem !important;\n}\n\n.qti-margin-y-3 {\n margin-top: 1rem !important;\n margin-bottom: 1rem !important;\n}\n\n.qti-margin-y-4 {\n margin-top: 1.5rem !important;\n margin-bottom: 1.5rem !important;\n}\n\n.qti-margin-y-5 {\n margin-top: 3rem !important;\n margin-bottom: 3rem !important;\n}\n\n.qti-margin-y-auto {\n margin-top: auto !important;\n margin-bottom: auto !important;\n}\n\n/*\n For margin Top\n */\n.qti-margin-t-0 {\n margin-top: 0 !important;\n}\n\n.qti-margin-t-1 {\n margin-top: 0.25rem !important;\n}\n\n.qti-margin-t-2 {\n margin-top: 0.5rem !important;\n}\n\n.qti-margin-t-3 {\n margin-top: 1rem !important;\n}\n\n.qti-margin-t-4 {\n margin-top: 1.5rem !important;\n}\n\n.qti-margin-t-5 {\n margin-top: 3rem !important;\n}\n\n.qti-margin-t-auto {\n margin-top: auto !important;\n}\n\n/* \n For margin Bottom\n */\n.qti-margin-b-0 {\n margin-bottom: 0 !important;\n}\n\n.qti-margin-b-1 {\n margin-bottom: 0.25rem !important;\n}\n\n.qti-margin-b-2 {\n margin-bottom: 0.5rem !important;\n}\n\n.qti-margin-b-3 {\n margin-bottom: 1rem !important;\n}\n\n.qti-margin-b-4 {\n margin-bottom: 1.5rem !important;\n}\n\n.qti-margin-b-5 {\n margin-bottom: 3rem !important;\n}\n\n.qti-margin-b-auto {\n margin-bottom: auto !important;\n}\n\n/*\n For margin Start LTR\n */\n.qti-margin-s-0 {\n margin-left: 0 !important;\n}\n\n.qti-margin-s-1 {\n margin-left: 0.25rem !important;\n}\n\n.qti-margin-s-2 {\n margin-left: 0.5rem !important;\n}\n\n.qti-margin-s-3 {\n margin-left: 1rem !important;\n}\n\n.qti-margin-s-4 {\n margin-left: 1.5rem !important;\n}\n\n.qti-margin-s-5 {\n margin-left: 3rem !important;\n}\n\n.qti-margin-s-auto {\n margin-left: auto !important;\n}\n\n/* \n For margin End LTR\n */\n.qti-margin-e-0 {\n margin-right: 0 !important;\n}\n\n.qti-margin-e-1 {\n margin-right: 0.25rem !important;\n}\n\n.qti-margin-e-2 {\n margin-right: 0.5rem !important;\n}\n\n.qti-margin-e-3 {\n margin-right: 1rem !important;\n}\n\n.qti-margin-e-4 {\n margin-right: 1.5rem !important;\n}\n\n.qti-margin-e-5 {\n margin-right: 3rem !important;\n}\n\n.qti-margin-e-auto {\n margin-right: auto !important;\n}\n\n/* =========\n Padding css\n ========== */\n\n/*\n For padding Top and Bottom and Left and Right\n */\n.qti-padding-0 {\n padding: 0 !important;\n}\n\n.qti-padding-1 {\n padding: 0.25rem !important;\n}\n\n.qti-padding-2 {\n padding: 0.5rem !important;\n}\n\n.qti-padding-3 {\n padding: 1rem !important;\n}\n\n.qti-padding-4 {\n padding: 1.5rem !important;\n}\n\n.qti-padding-5 {\n padding: 3rem !important;\n}\n\n/*\n For padding Left and Right\n */\n.qti-padding-x-0 {\n padding-right: 0 !important;\n padding-left: 0 !important;\n}\n\n.qti-padding-x-1 {\n padding-right: 0.25rem !important;\n padding-left: 0.25rem !important;\n}\n\n.qti-padding-x-2 {\n padding-right: 0.5rem !important;\n padding-left: 0.5rem !important;\n}\n\n.qti-padding-x-3 {\n padding-right: 1rem !important;\n padding-left: 1rem !important;\n}\n\n.qti-padding-x-4 {\n padding-right: 1.5rem !important;\n padding-left: 1.5rem !important;\n}\n\n.qti-padding-x-5 {\n padding-right: 3rem !important;\n padding-left: 3rem !important;\n}\n\n/*\n For padding Top and Bottom\n */\n.qti-padding-y-0 {\n padding-top: 0 !important;\n padding-bottom: 0 !important;\n}\n\n.qti-padding-y-1 {\n padding-top: 0.25rem !important;\n padding-bottom: 0.25rem !important;\n}\n\n.qti-padding-y-2 {\n padding-top: 0.5rem !important;\n padding-bottom: 0.5rem !important;\n}\n\n.qti-padding-y-3 {\n padding-top: 1rem !important;\n padding-bottom: 1rem !important;\n}\n\n.qti-padding-y-4 {\n padding-top: 1.5rem !important;\n padding-bottom: 1.5rem !important;\n}\n\n.qti-padding-y-5 {\n padding-top: 3rem !important;\n padding-bottom: 3rem !important;\n}\n\n/*\n For padding Top\n */\n.qti-padding-t-0 {\n padding-top: 0 !important;\n}\n\n.qti-padding-t-1 {\n padding-top: 0.25rem !important;\n}\n\n.qti-padding-t-2 {\n padding-top: 0.5rem !important;\n}\n\n.qti-padding-t-3 {\n padding-top: 1rem !important;\n}\n\n.qti-padding-t-4 {\n padding-top: 1.5rem !important;\n}\n\n.qti-padding-t-5 {\n padding-top: 3rem !important;\n}\n\n/*\n For padding Bottom\n */\n.qti-padding-b-0 {\n padding-bottom: 0 !important;\n}\n\n.qti-padding-b-1 {\n padding-bottom: 0.25rem !important;\n}\n\n.qti-padding-b-2 {\n padding-bottom: 0.5rem !important;\n}\n\n.qti-padding-b-3 {\n padding-bottom: 1rem !important;\n}\n\n.qti-padding-b-4 {\n padding-bottom: 1.5rem !important;\n}\n\n.qti-padding-b-5 {\n padding-bottom: 3rem !important;\n}\n\n/*\n For padding Start LTR\n */\n.qti-padding-s-0 {\n padding-left: 0 !important;\n}\n\n.qti-padding-s-1 {\n padding-left: 0.25rem !important;\n}\n\n.qti-padding-s-2 {\n padding-left: 0.5rem !important;\n}\n\n.qti-padding-s-3 {\n padding-left: 1rem !important;\n}\n\n.qti-padding-s-4 {\n padding-left: 1.5rem !important;\n}\n\n.qti-padding-s-5 {\n padding-left: 3rem !important;\n}\n\n/*\n For padding End LTR\n */\n.qti-padding-e-0 {\n padding-right: 0 !important;\n}\n\n.qti-padding-e-1 {\n padding-right: 0.25rem !important;\n}\n\n.qti-padding-e-2 {\n padding-right: 0.5rem !important;\n}\n\n.qti-padding-e-3 {\n padding-right: 1rem !important;\n}\n\n.qti-padding-e-4 {\n padding-right: 1.5rem !important;\n}\n\n.qti-padding-e-5 {\n padding-right: 3rem !important;\n}\n\n/* ====================\n Horizontal alignment\n ==================== */\n\n.qti-align-left {\n text-align: left;\n}\n\n.qti-align-center {\n text-align: center;\n}\n\n.qti-align-right {\n text-align: right;\n}\n\n/* ==================\n Vertical alignment\n ================== */\n\n.qti-valign-top {\n vertical-align: top;\n}\n\n.qti-valign-middle {\n vertical-align: middle;\n}\n\n.qti-valign-baseline {\n vertical-align: baseline;\n}\n\n.qti-valign-bottom {\n vertical-align: bottom;\n}\n\n/* =============\n Height styles\n ============= */\n\n.qti-height-0 {\n height: 0;\n}\n\n.qti-height-px {\n height: 1px;\n}\n\n.qti-height-0p5 {\n height: 0.125rem;\n}\n\n.qti-height-1 {\n height: 0.25rem;\n}\n\n.qti-height-1p5 {\n height: 0.375rem;\n}\n\n.qti-height-2 {\n height: 0.5rem;\n}\n\n.qti-height-2p5 {\n height: 0.625rem;\n}\n\n.qti-height-3 {\n height: 0.75rem;\n}\n\n.qti-height-3p5 {\n height: 0.875rem;\n}\n\n.qti-height-4 {\n height: 1rem;\n}\n\n.qti-height-5 {\n height: 1.25rem;\n}\n\n.qti-height-6 {\n height: 1.5rem;\n}\n\n.qti-height-7 {\n height: 1.75rem;\n}\n\n.qti-height-8 {\n height: 2rem;\n}\n\n.qti-height-9 {\n height: 2.25rem;\n}\n\n.qti-height-10 {\n height: 2.5rem;\n}\n\n.qti-height-11 {\n height: 2.75rem;\n}\n\n.qti-height-12 {\n height: 3rem;\n}\n\n.qti-height-14 {\n height: 3.5rem;\n}\n\n.qti-height-16 {\n height: 4rem;\n}\n\n.qti-height-20 {\n height: 5rem;\n}\n\n.qti-height-24 {\n height: 6rem;\n}\n\n.qti-height-28 {\n height: 7rem;\n}\n\n.qti-height-32 {\n height: 8rem;\n}\n\n.qti-height-36 {\n height: 9rem;\n}\n\n.qti-height-40 {\n height: 10rem;\n}\n\n.qti-height-44 {\n height: 11rem;\n}\n\n.qti-height-48 {\n height: 12rem;\n}\n\n.qti-height-52 {\n height: 13rem;\n}\n\n.qti-height-56 {\n height: 14rem;\n}\n\n.qti-height-60 {\n height: 15rem;\n}\n\n.qti-height-64 {\n height: 16rem;\n}\n\n.qti-height-72 {\n height: 18rem;\n}\n\n.qti-height-80 {\n height: 20rem;\n}\n\n.qti-height-96 {\n height: 24rem;\n}\n\n.qti-height-1-2 {\n height: 50%;\n}\n\n.qti-height-1-3 {\n height: 33.3333%;\n}\n\n.qti-height-2-3 {\n height: 66.6667%;\n}\n\n.qti-height-1-4 {\n height: 25%;\n}\n\n.qti-height-2-4 {\n height: 50%;\n}\n\n.qti-height-3-4 {\n height: 75%;\n}\n\n.qti-height-1-5 {\n height: 20%;\n}\n\n.qti-height-2-5 {\n height: 40%;\n}\n\n.qti-height-3-5 {\n height: 60%;\n}\n\n.qti-height-4-5 {\n height: 80%;\n}\n\n.qti-height-1-6 {\n height: 16.6667%;\n}\n\n.qti-height-2-6 {\n height: 33.3333%;\n}\n\n.qti-height-3-6 {\n height: 50%;\n}\n\n.qti-height-4-6 {\n height: 66.6667%;\n}\n\n.qti-height-5-6 {\n height: 83.3333%;\n}\n\n.qti-height-auto {\n height: auto;\n}\n\n.qti-height-full {\n height: 100%;\n}\n\n/* ============\n Width styles\n ============ */\n\n.qti-width-0 {\n width: 0;\n}\n\n.qti-width-px {\n width: 1px;\n}\n\n.qti-width-0p5 {\n width: 0.125rem;\n}\n\n.qti-width-1 {\n width: 0.25rem;\n}\n\n.qti-width-1p5 {\n width: 0.375rem;\n}\n\n.qti-width-2 {\n width: 0.5rem;\n}\n\n.qti-width-2p5 {\n width: 0.625rem;\n}\n\n.qti-width-3 {\n width: 0.75rem;\n}\n\n.qti-width-3p5 {\n width: 0.875rem;\n}\n\n.qti-width-4 {\n width: 1rem;\n}\n\n.qti-width-5 {\n width: 1.25rem;\n}\n\n.qti-width-6 {\n width: 1.5rem;\n}\n\n.qti-width-7 {\n width: 1.75rem;\n}\n\n.qti-width-8 {\n width: 2rem;\n}\n\n.qti-width-9 {\n width: 2.25rem;\n}\n\n.qti-width-10 {\n width: 2.5rem;\n}\n\n.qti-width-11 {\n width: 2.75rem;\n}\n\n.qti-width-12 {\n width: 3rem;\n}\n\n.qti-width-14 {\n width: 3.5rem;\n}\n\n.qti-width-16 {\n width: 4rem;\n}\n\n.qti-width-20 {\n width: 5rem;\n}\n\n.qti-width-24 {\n width: 6rem;\n}\n\n.qti-width-28 {\n width: 7rem;\n}\n\n.qti-width-32 {\n width: 8rem;\n}\n\n.qti-width-36 {\n width: 9rem;\n}\n\n.qti-width-40 {\n width: 10rem;\n}\n\n.qti-width-44 {\n width: 11rem;\n}\n\n.qti-width-48 {\n width: 12rem;\n}\n\n.qti-width-52 {\n width: 13rem;\n}\n\n.qti-width-56 {\n width: 14rem;\n}\n\n.qti-width-60 {\n width: 15rem;\n}\n\n.qti-width-64 {\n width: 16rem;\n}\n\n.qti-width-72 {\n width: 18rem;\n}\n\n.qti-width-80 {\n width: 20rem;\n}\n\n.qti-width-96 {\n width: 24rem;\n}\n\n.qti-width-auto {\n width: auto;\n}\n\n.qti-width-1-2 {\n width: 50%;\n}\n\n.qti-width-1-3 {\n width: 33.3333%;\n}\n\n.qti-width-2-3 {\n width: 66.6667%;\n}\n\n.qti-width-1-4 {\n width: 25%;\n}\n\n.qti-width-2-4 {\n width: 50%;\n}\n\n.qti-width-3-4 {\n width: 75%;\n}\n\n.qti-width-1-5 {\n width: 20%;\n}\n\n.qti-width-2-5 {\n width: 40%;\n}\n\n.qti-width-3-5 {\n width: 60%;\n}\n\n.qti-width-4-5 {\n width: 80%;\n}\n\n.qti-width-1-6 {\n width: 16.6667%;\n}\n\n.qti-width-2-6 {\n width: 33.3333%;\n}\n\n.qti-width-3-6 {\n width: 50%;\n}\n\n.qti-width-4-6 {\n width: 66.6667%;\n}\n\n.qti-width-5-6 {\n width: 83.3333%;\n}\n\n.qti-width-1-12 {\n width: 8.3333%;\n}\n\n.qti-width-2-12 {\n width: 16.6667%;\n}\n\n.qti-width-3-12 {\n width: 25%;\n}\n\n.qti-width-4-12 {\n width: 33.3333%;\n}\n\n.qti-width-5-12 {\n width: 41.6667%;\n}\n\n.qti-width-6-12 {\n width: 50%;\n}\n\n.qti-width-7-12 {\n width: 58.3333%;\n}\n\n.qti-width-8-12 {\n width: 66.6667%;\n}\n\n.qti-width-9-12 {\n width: 75%;\n}\n\n.qti-width-10-12 {\n width: 83.3333%;\n}\n\n.qti-width-11-12 {\n width: 91.6667%;\n}\n\n.qti-width-full,\n.qti-fullwidth {\n width: 100%;\n}\n\n/* ==================\n Text Indent styles\n ================== */\n\n.qti-text-indent-0 {\n text-indent: 0;\n}\n\n.qti-text-indent-px {\n text-indent: 1px;\n}\n\n.qti-text-indent-0p5 {\n text-indent: 0.125rem;\n}\n\n.qti-text-indent-1 {\n text-indent: 0.25rem;\n}\n\n.qti-text-indent-1p5 {\n text-indent: 0.375rem;\n}\n\n.qti-text-indent-2 {\n text-indent: 0.5rem;\n}\n\n.qti-text-indent-2p5 {\n text-indent: 0.625rem;\n}\n\n.qti-text-indent-3 {\n text-indent: 0.75rem;\n}\n\n.qti-text-indent-3p5 {\n text-indent: 0.875rem;\n}\n\n.qti-text-indent-4 {\n text-indent: 1rem;\n}\n\n.qti-text-indent-5 {\n text-indent: 1.25rem;\n}\n\n.qti-text-indent-6 {\n text-indent: 1.5rem;\n}\n\n.qti-text-indent-7 {\n text-indent: 1.75rem;\n}\n\n.qti-text-indent-8 {\n text-indent: 2rem;\n}\n\n.qti-text-indent-12 {\n text-indent: 3rem;\n}\n\n.qti-text-indent-16 {\n text-indent: 4rem;\n}\n\n.qti-text-indent-20 {\n text-indent: 5rem;\n}\n\n.qti-text-indent-24 {\n text-indent: 6rem;\n}\n\n.qti-text-indent-28 {\n text-indent: 7rem;\n}\n\n.qti-text-indent-32 {\n text-indent: 8rem;\n}\n\n/* =================\n List Style styles\n ================= */\n\n.qti-list-style-type-none {\n list-style-type: none;\n}\n\n.qti-list-style-type-disc {\n list-style-type: disc;\n}\n\n.qti-list-style-type-circle {\n list-style-type: circle;\n}\n\n.qti-list-style-type-square {\n list-style-type: square;\n}\n\n.qti-list-style-type-decimal {\n list-style-type: decimal;\n}\n\n.qti-list-style-type-decimal-leading-zero {\n list-style-type: decimal-leading-zero;\n}\n\n.qti-list-style-type-lower-alpha {\n list-style-type: lower-alpha;\n}\n\n.qti-list-style-type-upper-alpha {\n list-style-type: upper-alpha;\n}\n\n.qti-list-style-type-lower-roman {\n list-style-type: lower-roman;\n}\n\n.qti-list-style-type-upper-roman {\n list-style-type: upper-roman;\n}\n\n.qti-list-style-type-lower-latin {\n list-style-type: lower-latin;\n}\n\n.qti-list-style-type-upper-latin {\n list-style-type: upper-latin;\n}\n\n.qti-list-style-type-lower-greek {\n list-style-type: lower-greek;\n}\n\n.qti-list-style-type-arabic-indic {\n list-style-type: arabic-indic;\n}\n\n.qti-list-style-type-armenian {\n list-style-type: armenian;\n}\n\n.qti-list-style-type-lower-armenian {\n list-style-type: lower-armenian;\n}\n\n.qti-list-style-type-upper-armenian {\n list-style-type: upper-armenian;\n}\n\n.qti-list-style-type-bengali {\n list-style-type: bengali;\n}\n\n.qti-list-style-type-cambodian {\n list-style-type: cambodian;\n}\n\n.qti-list-style-type-simp-chinese-formal {\n list-style-type: simp-chinese-formal;\n}\n\n.qti-list-style-type-simp-chinese-informal {\n list-style-type: simp-chinese-informal;\n}\n\n.qti-list-style-type-trad-chinese-formal {\n list-style-type: trad-chinese-formal;\n}\n\n.qti-list-style-type-trad-chinese-informal {\n list-style-type: trad-chinese-informal;\n}\n\n.qti-list-style-type-cjk-ideographic {\n list-style-type: cjk-ideographic;\n}\n\n.qti-list-style-type-cjk-heavenly-stem {\n list-style-type: cjk-heavenly-stem;\n}\n\n.qti-list-style-type-cjk-earthly-branch {\n list-style-type: cjk-earthly-branch;\n}\n\n.qti-list-style-type-devanagari {\n list-style-type: devanagari;\n}\n\n.qti-list-style-type-ethiopic-halehame-ti-er {\n list-style-type: ethiopic-halehame-ti-er;\n}\n\n.qti-list-style-type-ethiopic-halehame-ti-et {\n list-style-type: ethiopic-halehame-ti-et;\n}\n\n.qti-list-style-type-ethiopic-halehame-am {\n list-style-type: ethiopic-halehame-am;\n}\n\n.qti-list-style-type-ethiopic-halehame {\n list-style-type: ethiopic-halehame;\n}\n\n.qti-list-style-type-georgian {\n list-style-type: georgian;\n}\n\n.qti-list-style-type-gujarati {\n list-style-type: gujarati;\n}\n\n.qti-list-style-type-gurmukhi {\n list-style-type: gurmukhi;\n}\n\n.qti-list-style-type-hangul {\n list-style-type: hangul;\n}\n\n.qti-list-style-type-hangul-consonant {\n list-style-type: hangul-consonant;\n}\n\n.qti-list-style-type-hebrew {\n list-style-type: hebrew;\n}\n\n.qti-list-style-type-hiragana {\n list-style-type: hiragana;\n}\n\n.qti-list-style-type-hiragana-iroha {\n list-style-type: hiragana-iroha;\n}\n\n.qti-list-style-type-khmer {\n list-style-type: khmer;\n}\n\n.qti-list-style-type-korean-hangul-formal {\n list-style-type: korean-hangul-formal;\n}\n\n.qti-list-style-type-korean-hanja-formal {\n list-style-type: korean-hanja-formal;\n}\n\n.qti-list-style-type-korean-hanja-informal {\n list-style-type: korean-hanja-informal;\n}\n\n.qti-list-style-type-lao {\n list-style-type: lao;\n}\n\n.qti-list-style-type-malayalam {\n list-style-type: malayalam;\n}\n\n.qti-list-style-type-mongolian {\n list-style-type: mongolian;\n}\n\n.qti-list-style-type-myanmar {\n list-style-type: myanmar;\n}\n\n.qti-list-style-type-oriya {\n list-style-type: oriya;\n}\n\n.qti-list-style-type-persian {\n list-style-type: persian;\n}\n\n.qti-list-style-type-thai {\n list-style-type: thai;\n}\n\n.qti-list-style-type-tibetan {\n list-style-type: tibetan;\n}\n\n.qti-list-style-type-telugu {\n list-style-type: telugu;\n}\n\n.qti-list-style-type-urdu {\n list-style-type: urdu;\n}\n\n/* =========================\n Other QTI 3 Presentation Utilities\n ========================= */\n\n.qti-bordered {\n border: 1px solid var(--table-border-color);\n}\n\n.qti-underline {\n text-decoration: underline;\n text-decoration-color: var(--foreground);\n}\n\n.qti-italic {\n font-style: italic;\n}\n\n.qti-well {\n min-height: 20px;\n padding: 19px;\n margin-bottom: 20px;\n background-color: var(--well-bg);\n border: var(--well-border);\n border-radius: 4px;\n box-shadow: var(--well-box-shadow);\n}\n\n/* Set writing-mode to vertical-rl \n Typical for CJK vertical text */\n.qti-writing-mode-vertical-rl {\n writing-mode: vertical-rl;\n}\n\n/* Set writing-mode to vertical-lr\n Typical for Mongolian vertical text */\n.qti-writing-mode-vertical-lr {\n writing-mode: vertical-lr;\n}\n\n/* Set writing-mode to horizontal-tb \n Browser default */\n.qti-writing-mode-horizontal-tb {\n writing-mode: horizontal-tb;\n}\n\n/* Float an element left */\n.qti-float-left {\n float: left;\n}\n\n/* Float an element right */\n.qti-float-right {\n float: right;\n}\n\n/* Remove a float */\n.qti-float-none {\n float: none;\n}\n\n/* Clearfix Hack to apply to a container of \n floated content that overflows the container. */\n.qti-float-clearfix::after {\n content: '';\n clear: both;\n display: table;\n}\n\n.qti-float-clear-left\n .qti-float-clear-right\n .qti-float-clear-both\n \n /* Set text-orientation to upright */\n .qti-text-orientation-upright {\n text-orientation: upright;\n}\n}\n\n@layer qti-base {\n\n.qti-layout-row {\n /* The columns stack when the row is narrow, not the viewport: an item in a side-by-side player or a\n * narrow pane collapses too. The row is the container, so it is never shrink-to-fit (width: 100%). */\n container-type: inline-size;\n display: flex;\n flex-wrap: wrap;\n width: 100%;\n gap: 2.1276595745%;\n}\n\n.qti-layout-row [class*='qti-layout-col']:not(:empty) {\n box-sizing: border-box;\n}\n\n.qti-layout-row > [class*='qti-layout-col'] > :first-child {\n margin-block-start: 0; /* a heading or paragraph that opens a column starts at the column's top edge */\n}\n\n.qti-layout-row [class*='qti-layout-col']:empty {\n width: 0;\n overflow: hidden; /* to fully collapse if there\u2019s padding or borders */\n}\n\n.qti-layout-col1 {\n width: 6.3829787234%;\n}\n\n.qti-layout-col2 {\n width: 14.8936170213%;\n}\n\n.qti-layout-col3 {\n width: 23.4042553191%;\n}\n\n.qti-layout-col4 {\n width: 31.914893617%;\n}\n\n.qti-layout-col5 {\n width: 40.4255319149%;\n}\n\n.qti-layout-col6 {\n width: 48.9361702128%;\n}\n\n.qti-layout-col7 {\n width: 57.4468085106%;\n}\n\n.qti-layout-col8 {\n width: 65.9574468085%;\n}\n\n.qti-layout-col9 {\n width: 74.4680851064%;\n}\n\n.qti-layout-col10 {\n width: 82.9787234043%;\n}\n\n.qti-layout-col11 {\n width: 91.4893617021%;\n}\n\n.qti-layout-col12 {\n width: 100%;\n}\n\n.qti-layout-offset1 {\n margin-left: 8.5106382979%;\n}\n\n.qti-layout-offset2 {\n margin-left: 17.0212765957%;\n}\n\n.qti-layout-offset3 {\n margin-left: 25.5319148936%;\n}\n\n.qti-layout-offset4 {\n margin-left: 34.0425531915%;\n}\n\n.qti-layout-offset5 {\n margin-left: 42.5531914894%;\n}\n\n.qti-layout-offset6 {\n margin-left: 51.0638297872%;\n}\n\n.qti-layout-offset7 {\n margin-left: 59.5744680851%;\n}\n\n.qti-layout-offset8 {\n margin-left: 68.085106383%;\n}\n\n.qti-layout-offset9 {\n margin-left: 76.5957446809%;\n}\n\n.qti-layout-offset10 {\n margin-left: 85.1063829787%;\n}\n\n.qti-layout-offset11 {\n margin-left: 93.6170212766%;\n}\n\n@container (width <= 767px) {\n [class*='qti-layout-col'] {\n width: 100%;\n }\n}\n}\n";
|
|
8520
8982
|
|
|
8521
8983
|
// ../interactions/portable-custom-interaction/dist/qti-portable-custom-interaction.styles.js
|
|
8522
8984
|
import { css as css26 } from "lit";
|
|
@@ -8535,18 +8997,214 @@ var qti_portable_custom_interaction_styles_default = [
|
|
|
8535
8997
|
`
|
|
8536
8998
|
];
|
|
8537
8999
|
|
|
9000
|
+
// ../interactions/portable-custom-interaction/dist/file-response.js
|
|
9001
|
+
var isFileBaseType = (baseType) => baseType === "file";
|
|
9002
|
+
var isQtiFileData = (value) => typeof value === "object" && value !== null && typeof value.data === "string";
|
|
9003
|
+
var fileToDataUrl = (file) => {
|
|
9004
|
+
if (file === null || file === void 0 || file === "")
|
|
9005
|
+
return null;
|
|
9006
|
+
if (typeof file === "string")
|
|
9007
|
+
return file;
|
|
9008
|
+
if (!isQtiFileData(file) || file.data === "")
|
|
9009
|
+
return null;
|
|
9010
|
+
if (file.data.startsWith("data:"))
|
|
9011
|
+
return file.data;
|
|
9012
|
+
return `data:${file.mime || "application/octet-stream"};base64,${file.data}`;
|
|
9013
|
+
};
|
|
9014
|
+
var dataUrlToFile = (value) => {
|
|
9015
|
+
if (value === null || value === void 0 || value === "")
|
|
9016
|
+
return null;
|
|
9017
|
+
if (typeof value === "object")
|
|
9018
|
+
return isQtiFileData(value) ? value : null;
|
|
9019
|
+
const text = String(value);
|
|
9020
|
+
const match = /^data:([^;,]*)((?:;[^;,]*)*),([\s\S]*)$/.exec(text);
|
|
9021
|
+
if (!match)
|
|
9022
|
+
return { data: text, mime: "application/octet-stream" };
|
|
9023
|
+
const [, mime, params, payload] = match;
|
|
9024
|
+
if (params.split(";").includes("base64"))
|
|
9025
|
+
return { data: payload, mime: mime || "text/plain" };
|
|
9026
|
+
let binary = "";
|
|
9027
|
+
new TextEncoder().encode(decodeURIComponent(payload)).forEach((byte) => binary += String.fromCharCode(byte));
|
|
9028
|
+
return { data: btoa(binary), mime: mime || "text/plain" };
|
|
9029
|
+
};
|
|
9030
|
+
|
|
9031
|
+
// ../interactions/portable-custom-interaction/dist/record-response.js
|
|
9032
|
+
var PAIR_BASE_TYPES = /* @__PURE__ */ new Set(["point", "pair", "directedPair"]);
|
|
9033
|
+
var coerceBaseValue = (value, baseType) => {
|
|
9034
|
+
if (value === null || value === void 0)
|
|
9035
|
+
return value;
|
|
9036
|
+
if (isFileBaseType(baseType))
|
|
9037
|
+
return dataUrlToFile(value);
|
|
9038
|
+
switch (baseType) {
|
|
9039
|
+
case "integer": {
|
|
9040
|
+
if (typeof value === "number")
|
|
9041
|
+
return value;
|
|
9042
|
+
const parsed = parseInt(String(value), 10);
|
|
9043
|
+
return Number.isNaN(parsed) ? value : parsed;
|
|
9044
|
+
}
|
|
9045
|
+
case "float":
|
|
9046
|
+
case "duration": {
|
|
9047
|
+
if (typeof value === "number")
|
|
9048
|
+
return value;
|
|
9049
|
+
const parsed = parseFloat(String(value));
|
|
9050
|
+
return Number.isNaN(parsed) ? value : parsed;
|
|
9051
|
+
}
|
|
9052
|
+
case "boolean": {
|
|
9053
|
+
if (typeof value === "boolean")
|
|
9054
|
+
return value;
|
|
9055
|
+
if (typeof value === "string") {
|
|
9056
|
+
const lowered = value.toLowerCase();
|
|
9057
|
+
if (lowered === "true")
|
|
9058
|
+
return true;
|
|
9059
|
+
if (lowered === "false")
|
|
9060
|
+
return false;
|
|
9061
|
+
}
|
|
9062
|
+
return value;
|
|
9063
|
+
}
|
|
9064
|
+
case "point": {
|
|
9065
|
+
const parts = Array.isArray(value) ? value : String(value).trim().split(/[\s,]+/);
|
|
9066
|
+
const numbers = parts.map((part) => typeof part === "number" ? part : parseFloat(String(part)));
|
|
9067
|
+
return numbers.length === 2 && numbers.every(Number.isFinite) ? numbers : value;
|
|
9068
|
+
}
|
|
9069
|
+
case "pair":
|
|
9070
|
+
case "directedPair": {
|
|
9071
|
+
const parts = Array.isArray(value) ? value : String(value).trim().split(/\s+/);
|
|
9072
|
+
return parts.length === 2 ? parts.map(String) : value;
|
|
9073
|
+
}
|
|
9074
|
+
case "string":
|
|
9075
|
+
case "identifier":
|
|
9076
|
+
default:
|
|
9077
|
+
return String(value);
|
|
9078
|
+
}
|
|
9079
|
+
};
|
|
9080
|
+
var recordEntryFromValue = (name, entryValue, baseType) => {
|
|
9081
|
+
if (baseType) {
|
|
9082
|
+
if (Array.isArray(entryValue) && !PAIR_BASE_TYPES.has(baseType)) {
|
|
9083
|
+
return { name, list: { [baseType]: entryValue.map((v) => coerceBaseValue(v, baseType)) } };
|
|
9084
|
+
}
|
|
9085
|
+
if (entryValue === null || entryValue === void 0) {
|
|
9086
|
+
return { name, base: null };
|
|
9087
|
+
}
|
|
9088
|
+
return { name, base: { [baseType]: coerceBaseValue(entryValue, baseType) } };
|
|
9089
|
+
}
|
|
9090
|
+
if (Array.isArray(entryValue)) {
|
|
9091
|
+
const filtered = entryValue.filter((v) => v !== null && v !== void 0);
|
|
9092
|
+
if (filtered.length && filtered.every((v) => typeof v === "boolean")) {
|
|
9093
|
+
return { name, list: { boolean: filtered } };
|
|
9094
|
+
}
|
|
9095
|
+
if (filtered.length && filtered.every((v) => typeof v === "number")) {
|
|
9096
|
+
const numbers = filtered;
|
|
9097
|
+
const isIntegers = numbers.every((n) => Number.isInteger(n));
|
|
9098
|
+
return { name, list: { [isIntegers ? "integer" : "float"]: numbers } };
|
|
9099
|
+
}
|
|
9100
|
+
return { name, list: { string: entryValue.map((v) => v === null || v === void 0 ? "" : String(v)) } };
|
|
9101
|
+
}
|
|
9102
|
+
if (typeof entryValue === "boolean") {
|
|
9103
|
+
return { name, base: { boolean: entryValue } };
|
|
9104
|
+
}
|
|
9105
|
+
if (typeof entryValue === "number") {
|
|
9106
|
+
if (Number.isInteger(entryValue))
|
|
9107
|
+
return { name, base: { integer: entryValue } };
|
|
9108
|
+
return { name, base: { float: entryValue } };
|
|
9109
|
+
}
|
|
9110
|
+
if (entryValue === null || entryValue === void 0) {
|
|
9111
|
+
return { name, base: { string: "" } };
|
|
9112
|
+
}
|
|
9113
|
+
if (typeof entryValue === "object") {
|
|
9114
|
+
try {
|
|
9115
|
+
return { name, base: { string: JSON.stringify(entryValue) } };
|
|
9116
|
+
} catch {
|
|
9117
|
+
return { name, base: { string: String(entryValue) } };
|
|
9118
|
+
}
|
|
9119
|
+
}
|
|
9120
|
+
return { name, base: { string: String(entryValue) } };
|
|
9121
|
+
};
|
|
9122
|
+
var recordToQtiVariableJSON = (value, fieldBaseTypes = {}) => {
|
|
9123
|
+
if (!isRecordValue(value)) {
|
|
9124
|
+
return { record: [] };
|
|
9125
|
+
}
|
|
9126
|
+
const recordEntries = [];
|
|
9127
|
+
for (const [name, entryValue] of Object.entries(value)) {
|
|
9128
|
+
recordEntries.push(recordEntryFromValue(name, entryValue, fieldBaseTypes[name]));
|
|
9129
|
+
}
|
|
9130
|
+
return { record: recordEntries };
|
|
9131
|
+
};
|
|
9132
|
+
var recordFieldBaseTypes = (value, declared = {}) => {
|
|
9133
|
+
if (!isRecordValue(value))
|
|
9134
|
+
return { ...declared };
|
|
9135
|
+
const baseTypes = {};
|
|
9136
|
+
for (const [name, entryValue] of Object.entries(value)) {
|
|
9137
|
+
baseTypes[name] = declared[name] ?? inferRecordFieldBaseType(Array.isArray(entryValue) ? entryValue[0] : entryValue);
|
|
9138
|
+
}
|
|
9139
|
+
return baseTypes;
|
|
9140
|
+
};
|
|
9141
|
+
var recordResponseToQtiVariableJSON = (value, declared = {}) => recordToQtiVariableJSON(value, recordFieldBaseTypes(value, declared));
|
|
9142
|
+
var toQtiLiteral = (value) => {
|
|
9143
|
+
if (value === null || value === void 0)
|
|
9144
|
+
return null;
|
|
9145
|
+
if (Array.isArray(value))
|
|
9146
|
+
return value.map(String).join(" ");
|
|
9147
|
+
if (isQtiFileData(value))
|
|
9148
|
+
return fileToDataUrl(value);
|
|
9149
|
+
if (typeof value === "object") {
|
|
9150
|
+
try {
|
|
9151
|
+
return JSON.stringify(value);
|
|
9152
|
+
} catch {
|
|
9153
|
+
return String(value);
|
|
9154
|
+
}
|
|
9155
|
+
}
|
|
9156
|
+
return String(value);
|
|
9157
|
+
};
|
|
9158
|
+
var firstTypedValue = (typed) => {
|
|
9159
|
+
if (!typed)
|
|
9160
|
+
return void 0;
|
|
9161
|
+
for (const key of Object.keys(typed)) {
|
|
9162
|
+
const value = typed[key];
|
|
9163
|
+
if (value !== void 0 && value !== null)
|
|
9164
|
+
return value;
|
|
9165
|
+
}
|
|
9166
|
+
return void 0;
|
|
9167
|
+
};
|
|
9168
|
+
var recordFromQtiVariableJSON = (record) => {
|
|
9169
|
+
const value = {};
|
|
9170
|
+
for (const entry of record) {
|
|
9171
|
+
if (!entry || typeof entry.name !== "string" || !entry.name)
|
|
9172
|
+
continue;
|
|
9173
|
+
if (entry.list) {
|
|
9174
|
+
const items = firstTypedValue(entry.list);
|
|
9175
|
+
value[entry.name] = Array.isArray(items) ? items.map(toQtiLiteral).filter((v) => v !== null) : [];
|
|
9176
|
+
} else {
|
|
9177
|
+
value[entry.name] = toQtiLiteral(firstTypedValue(entry.base));
|
|
9178
|
+
}
|
|
9179
|
+
}
|
|
9180
|
+
return value;
|
|
9181
|
+
};
|
|
9182
|
+
|
|
9183
|
+
// ../interactions/portable-custom-interaction/dist/vendor/require-js.js
|
|
9184
|
+
var require_js_default = `/** vim: et:ts=4:sw=4:sts=4
|
|
9185
|
+
* @license RequireJS 2.3.8 Copyright jQuery Foundation and other contributors.
|
|
9186
|
+
* Released under MIT license, https://github.com/requirejs/requirejs/blob/master/LICENSE
|
|
9187
|
+
*/var requirejs,require,define;(function(global,setTimeout){var req,s,head,baseElement,dataMain,src,interactiveScript,currentlyAddingScript,mainScript,subPath,version="2.3.8",commentRegExp=/\\/\\*[\\s\\S]*?\\*\\/|([^:"'=]|^)\\/\\/.*$/mg,cjsRequireRegExp=/[^.]\\s*require\\s*\\(\\s*["']([^'"\\s]+)["']\\s*\\)/g,jsSuffixRegExp=/\\.js$/,currDirRegExp=/^\\.\\//,op=Object.prototype,ostring=op.toString,hasOwn=op.hasOwnProperty,isBrowser=!!(typeof window<"u"&&typeof navigator<"u"&&window.document),isWebWorker=!isBrowser&&typeof importScripts<"u",readyRegExp=isBrowser&&navigator.platform==="PLAYSTATION 3"?/^complete$/:/^(complete|loaded)$/,defContextName="_",isOpera=typeof opera<"u"&&opera.toString()==="[object Opera]",contexts={},cfg={},globalDefQueue=[],useInteractive=!1;function commentReplace(r,a){return a||""}function isFunction(r){return ostring.call(r)==="[object Function]"}function isArray(r){return ostring.call(r)==="[object Array]"}function each(r,a){if(r){var c;for(c=0;c<r.length&&!(r[c]&&a(r[c],c,r));c+=1);}}function eachReverse(r,a){if(r){var c;for(c=r.length-1;c>-1&&!(r[c]&&a(r[c],c,r));c-=1);}}function hasProp(r,a){return hasOwn.call(r,a)}function getOwn(r,a){return hasProp(r,a)&&r[a]}function eachProp(r,a){var c;for(c in r)if(hasProp(r,c)&&c!=="__proto__"&&c!=="constructor"&&a(r[c],c))break}function mixin(r,a,c,u){return a&&eachProp(a,function(h,q){(c||!hasProp(r,q))&&(u&&typeof h=="object"&&h&&!isArray(h)&&!isFunction(h)&&!(h instanceof RegExp)?(r[q]||(r[q]={}),mixin(r[q],h,c,u)):r[q]=h)}),r}function bind(r,a){return function(){return a.apply(r,arguments)}}function scripts(){return document.getElementsByTagName("script")}function defaultOnError(r){throw r}function getGlobal(r){if(!r)return r;var a=global;return each(r.split("."),function(c){a=a[c]}),a}function makeError(r,a,c,u){var h=new Error(a+\`
|
|
9188
|
+
https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireModules=u,c&&(h.originalError=c),h}if(typeof define<"u")return;if(typeof requirejs<"u"){if(isFunction(requirejs))return;cfg=requirejs,requirejs=void 0}typeof require<"u"&&!isFunction(require)&&(cfg=require,require=void 0);function newContext(r){var a,c,u,h,q,g={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},v={},B={},I={},M=[],w={},D={},L={},H=1,K=1;function X(e){var i,n;for(i=0;i<e.length;i++)if(n=e[i],n===".")e.splice(i,1),i-=1;else if(n===".."){if(i===0||i===1&&e[2]===".."||e[i-1]==="..")continue;i>0&&(e.splice(i-1,2),i-=2)}}function P(e,i,n){var o,t,f,d,l,p,b,E,m,x,R,A,O=i&&i.split("/"),k=g.map,j=k&&k["*"];if(e&&(e=e.split("/"),b=e.length-1,g.nodeIdCompat&&jsSuffixRegExp.test(e[b])&&(e[b]=e[b].replace(jsSuffixRegExp,"")),e[0].charAt(0)==="."&&O&&(A=O.slice(0,O.length-1),e=A.concat(e)),X(e),e=e.join("/")),n&&k&&(O||j)){f=e.split("/");e:for(d=f.length;d>0;d-=1){if(p=f.slice(0,d).join("/"),O){for(l=O.length;l>0;l-=1)if(t=getOwn(k,O.slice(0,l).join("/")),t&&(t=getOwn(t,p),t)){E=t,m=d;break e}}!x&&j&&getOwn(j,p)&&(x=getOwn(j,p),R=d)}!E&&x&&(E=x,m=R),E&&(f.splice(0,m,E),e=f.join("/"))}return o=getOwn(g.pkgs,e),o||e}function W(e){isBrowser&&each(scripts(),function(i){if(i.getAttribute("data-requiremodule")===e&&i.getAttribute("data-requirecontext")===u.contextName)return i.parentNode.removeChild(i),!0})}function Q(e){var i=getOwn(g.paths,e);if(i&&isArray(i)&&i.length>1)return i.shift(),u.require.undef(e),u.makeRequire(null,{skipMap:!0})([e]),!0}function G(e){var i,n=e?e.indexOf("!"):-1;return n>-1&&(i=e.substring(0,n),e=e.substring(n+1,e.length)),[i,e]}function S(e,i,n,o){var t,f,d,l,p=null,b=i?i.name:null,E=e,m=!0,x="";return e||(m=!1,e="_@r"+(H+=1)),l=G(e),p=l[0],e=l[1],p&&(p=P(p,b,o),f=getOwn(w,p)),e&&(p?n?x=e:f&&f.normalize?x=f.normalize(e,function(R){return P(R,b,o)}):x=e.indexOf("!")===-1?P(e,b,o):e:(x=P(e,b,o),l=G(x),p=l[0],x=l[1],n=!0,t=u.nameToUrl(x))),d=p&&!f&&!n?"_unnormalized"+(K+=1):"",{prefix:p,name:x,parentMap:i,unnormalized:!!d,url:t,originalName:E,isDefine:m,id:(p?p+"!"+x:x)+d}}function T(e){var i=e.id,n=getOwn(v,i);return n||(n=v[i]=new u.Module(e)),n}function C(e,i,n){var o=e.id,t=getOwn(v,o);hasProp(w,o)&&(!t||t.defineEmitComplete)?i==="defined"&&n(w[o]):(t=T(e),t.error&&i==="error"?n(t.error):t.on(i,n))}function y(e,i){var n=e.requireModules,o=!1;i?i(e):(each(n,function(t){var f=getOwn(v,t);f&&(f.error=e,f.events.error&&(o=!0,f.emit("error",e)))}),o||req.onError(e))}function F(){globalDefQueue.length&&(each(globalDefQueue,function(e){var i=e[0];typeof i=="string"&&(u.defQueueMap[i]=!0),M.push(e)}),globalDefQueue=[])}h={require:function(e){return e.require?e.require:e.require=u.makeRequire(e.map)},exports:function(e){if(e.usingExports=!0,e.map.isDefine)return e.exports?w[e.map.id]=e.exports:e.exports=w[e.map.id]={}},module:function(e){return e.module?e.module:e.module={id:e.map.id,uri:e.map.url,config:function(){return getOwn(g.config,e.map.id)||{}},exports:e.exports||(e.exports={})}}};function U(e){delete v[e],delete B[e]}function $(e,i,n){var o=e.map.id;e.error?e.emit("error",e.error):(i[o]=!0,each(e.depMaps,function(t,f){var d=t.id,l=getOwn(v,d);l&&!e.depMatched[f]&&!n[d]&&(getOwn(i,d)?(e.defineDep(f,w[d]),e.check()):$(l,i,n))}),n[o]=!0)}function z(){var e,i,n=g.waitSeconds*1e3,o=n&&u.startTime+n<new Date().getTime(),t=[],f=[],d=!1,l=!0;if(!a){if(a=!0,eachProp(B,function(p){var b=p.map,E=b.id;if(p.enabled&&(b.isDefine||f.push(p),!p.error)){if(!p.inited&&o)Q(E)?(i=!0,d=!0):(t.push(E),W(E));else if(!p.inited&&p.fetched&&b.isDefine&&(d=!0,!b.prefix))return l=!1}}),o&&t.length)return e=makeError("timeout","Load timeout for modules: "+t,null,t),e.contextName=u.contextName,y(e);l&&each(f,function(p){$(p,{},{})}),(!o||i)&&d&&(isBrowser||isWebWorker)&&!q&&(q=setTimeout(function(){q=0,z()},50)),a=!1}}c=function(e){this.events=getOwn(I,e.id)||{},this.map=e,this.shim=getOwn(g.shim,e.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0},c.prototype={init:function(e,i,n,o){o=o||{},!this.inited&&(this.factory=i,n?this.on("error",n):this.events.error&&(n=bind(this,function(t){this.emit("error",t)})),this.depMaps=e&&e.slice(0),this.errback=n,this.inited=!0,this.ignore=o.ignore,o.enabled||this.enabled?this.enable():this.check())},defineDep:function(e,i){this.depMatched[e]||(this.depMatched[e]=!0,this.depCount-=1,this.depExports[e]=i)},fetch:function(){if(!this.fetched){this.fetched=!0,u.startTime=new Date().getTime();var e=this.map;if(this.shim)u.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return e.prefix?this.callPlugin():this.load()}));else return e.prefix?this.callPlugin():this.load()}},load:function(){var e=this.map.url;D[e]||(D[e]=!0,u.load(this.map.id,e))},check:function(){if(!(!this.enabled||this.enabling)){var e,i,n=this.map.id,o=this.depExports,t=this.exports,f=this.factory;if(!this.inited)hasProp(u.defQueueMap,n)||this.fetch();else if(this.error)this.emit("error",this.error);else if(!this.defining){if(this.defining=!0,this.depCount<1&&!this.defined){if(isFunction(f)){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)try{t=u.execCb(n,f,o,t)}catch(l){e=l}else t=u.execCb(n,f,o,t);if(this.map.isDefine&&t===void 0&&(i=this.module,i?t=i.exports:this.usingExports&&(t=this.exports)),e)return e.requireMap=this.map,e.requireModules=this.map.isDefine?[this.map.id]:null,e.requireType=this.map.isDefine?"define":"require",y(this.error=e)}else t=f;if(this.exports=t,this.map.isDefine&&!this.ignore&&(w[n]=t,req.onResourceLoad)){var d=[];each(this.depMaps,function(l){d.push(l.normalizedMap||l)}),req.onResourceLoad(u,this.map,d)}U(n),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}},callPlugin:function(){var e=this.map,i=e.id,n=S(e.prefix);this.depMaps.push(n),C(n,"defined",bind(this,function(o){var t,f,d,l=getOwn(L,this.map.id),p=this.map.name,b=this.map.parentMap?this.map.parentMap.name:null,E=u.makeRequire(e.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){o.normalize&&(p=o.normalize(p,function(m){return P(m,b,!0)})||""),f=S(e.prefix+"!"+p,this.map.parentMap,!0),C(f,"defined",bind(this,function(m){this.map.normalizedMap=f,this.init([],function(){return m},null,{enabled:!0,ignore:!0})})),d=getOwn(v,f.id),d&&(this.depMaps.push(f),this.events.error&&d.on("error",bind(this,function(m){this.emit("error",m)})),d.enable());return}if(l){this.map.url=u.nameToUrl(l),this.load();return}t=bind(this,function(m){this.init([],function(){return m},null,{enabled:!0})}),t.error=bind(this,function(m){this.inited=!0,this.error=m,m.requireModules=[i],eachProp(v,function(x){x.map.id.indexOf(i+"_unnormalized")===0&&U(x.map.id)}),y(m)}),t.fromText=bind(this,function(m,x){var R=e.name,A=S(R),O=useInteractive;x&&(m=x),O&&(useInteractive=!1),T(A),hasProp(g.config,i)&&(g.config[R]=g.config[i]);try{req.exec(m)}catch(k){return y(makeError("fromtexteval","fromText eval for "+i+" failed: "+k,k,[i]))}O&&(useInteractive=!0),this.depMaps.push(A),u.completeLoad(R),E([R],t)}),o.load(e.name,E,t,g)})),u.enable(n,this),this.pluginMaps[n.id]=n},enable:function(){B[this.map.id]=this,this.enabled=!0,this.enabling=!0,each(this.depMaps,bind(this,function(e,i){var n,o,t;if(typeof e=="string"){if(e=S(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[i]=e,t=getOwn(h,e.id),t){this.depExports[i]=t(this);return}this.depCount+=1,C(e,"defined",bind(this,function(f){this.undefed||(this.defineDep(i,f),this.check())})),this.errback?C(e,"error",bind(this,this.errback)):this.events.error&&C(e,"error",bind(this,function(f){this.emit("error",f)}))}n=e.id,o=v[n],!hasProp(h,n)&&o&&!o.enabled&&u.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var i=getOwn(v,e.id);i&&!i.enabled&&u.enable(e,this)})),this.enabling=!1,this.check()},on:function(e,i){var n=this.events[e];n||(n=this.events[e]=[]),n.push(i)},emit:function(e,i){each(this.events[e],function(n){n(i)}),e==="error"&&delete this.events[e]}};function _(e){hasProp(w,e[0])||T(S(e[0],null,!0)).init(e[1],e[2])}function J(e,i,n,o){e.detachEvent&&!isOpera?o&&e.detachEvent(o,i):e.removeEventListener(n,i,!1)}function V(e){var i=e.currentTarget||e.srcElement;return J(i,u.onScriptLoad,"load","onreadystatechange"),J(i,u.onScriptError,"error"),{node:i,id:i&&i.getAttribute("data-requiremodule")}}function Y(){var e;for(F();M.length;){if(e=M.shift(),e[0]===null)return y(makeError("mismatch","Mismatched anonymous define() module: "+e[e.length-1]));_(e)}u.defQueueMap={}}return u={config:g,contextName:r,registry:v,defined:w,urlFetched:D,defQueue:M,defQueueMap:{},Module:c,makeModuleMap:S,nextTick:req.nextTick,onError:y,configure:function(e){if(e.baseUrl&&e.baseUrl.charAt(e.baseUrl.length-1)!=="/"&&(e.baseUrl+="/"),typeof e.urlArgs=="string"){var i=e.urlArgs;e.urlArgs=function(t,f){return(f.indexOf("?")===-1?"?":"&")+i}}var n=g.shim,o={paths:!0,bundles:!0,config:!0,map:!0};eachProp(e,function(t,f){o[f]?(g[f]||(g[f]={}),mixin(g[f],t,!0,!0)):g[f]=t}),e.bundles&&eachProp(e.bundles,function(t,f){each(t,function(d){d!==f&&(L[d]=f)})}),e.shim&&(eachProp(e.shim,function(t,f){isArray(t)&&(t={deps:t}),(t.exports||t.init)&&!t.exportsFn&&(t.exportsFn=u.makeShimExports(t)),n[f]=t}),g.shim=n),e.packages&&each(e.packages,function(t){var f,d;t=typeof t=="string"?{name:t}:t,d=t.name,f=t.location,f&&(g.paths[d]=t.location),g.pkgs[d]=t.name+"/"+(t.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}),eachProp(v,function(t,f){!t.inited&&!t.map.unnormalized&&(t.map=S(f,null,!0))}),(e.deps||e.callback)&&u.require(e.deps||[],e.callback)},makeShimExports:function(e){function i(){var n;return e.init&&(n=e.init.apply(global,arguments)),n||e.exports&&getGlobal(e.exports)}return i},makeRequire:function(e,i){i=i||{};function n(o,t,f){var d,l,p;return i.enableBuildCallback&&t&&isFunction(t)&&(t.__requireJsBuild=!0),typeof o=="string"?isFunction(t)?y(makeError("requireargs","Invalid require call"),f):e&&hasProp(h,o)?h[o](v[e.id]):req.get?req.get(u,o,e,n):(l=S(o,e,!1,!0),d=l.id,hasProp(w,d)?w[d]:y(makeError("notloaded",'Module name "'+d+'" has not been loaded yet for context: '+r+(e?"":". Use require([])")))):(Y(),u.nextTick(function(){Y(),p=T(S(null,e)),p.skipMap=i.skipMap,p.init(o,t,f,{enabled:!0}),z()}),n)}return mixin(n,{isBrowser,toUrl:function(o){var t,f=o.lastIndexOf("."),d=o.split("/")[0],l=d==="."||d==="..";return f!==-1&&(!l||f>1)&&(t=o.substring(f,o.length),o=o.substring(0,f)),u.nameToUrl(P(o,e&&e.id,!0),t,!0)},defined:function(o){return hasProp(w,S(o,e,!1,!0).id)},specified:function(o){return o=S(o,e,!1,!0).id,hasProp(w,o)||hasProp(v,o)}}),e||(n.undef=function(o){F();var t=S(o,e,!0),f=getOwn(v,o);f.undefed=!0,W(o),delete w[o],delete D[t.url],delete I[o],eachReverse(M,function(d,l){d[0]===o&&M.splice(l,1)}),delete u.defQueueMap[o],f&&(f.events.defined&&(I[o]=f.events),U(o))}),n},enable:function(e){var i=getOwn(v,e.id);i&&T(e).enable()},completeLoad:function(e){var i,n,o,t=getOwn(g.shim,e)||{},f=t.exports;for(F();M.length;){if(n=M.shift(),n[0]===null){if(n[0]=e,i)break;i=!0}else n[0]===e&&(i=!0);_(n)}if(u.defQueueMap={},o=getOwn(v,e),!i&&!hasProp(w,e)&&o&&!o.inited){if(g.enforceDefine&&(!f||!getGlobal(f)))return Q(e)?void 0:y(makeError("nodefine","No define call for "+e,null,[e]));_([e,t.deps||[],t.exportsFn])}z()},nameToUrl:function(e,i,n){var o,t,f,d,l,p,b,E=getOwn(g.pkgs,e);if(E&&(e=E),b=getOwn(L,e),b)return u.nameToUrl(b,i,n);if(req.jsExtRegExp.test(e))l=e+(i||"");else{for(o=g.paths,t=e.split("/"),f=t.length;f>0;f-=1)if(d=t.slice(0,f).join("/"),p=getOwn(o,d),p){isArray(p)&&(p=p[0]),t.splice(0,f,p);break}l=t.join("/"),l+=i||(/^data\\:|^blob\\:|\\?/.test(l)||n?"":".js"),l=(l.charAt(0)==="/"||l.match(/^[\\w\\+\\.\\-]+:/)?"":g.baseUrl)+l}return g.urlArgs&&!/^blob\\:/.test(l)?l+g.urlArgs(e,l):l},load:function(e,i){req.load(u,e,i)},execCb:function(e,i,n,o){return i.apply(o,n)},onScriptLoad:function(e){if(e.type==="load"||readyRegExp.test((e.currentTarget||e.srcElement).readyState)){interactiveScript=null;var i=V(e);u.completeLoad(i.id)}},onScriptError:function(e){var i=V(e);if(!Q(i.id)){var n=[];return eachProp(v,function(o,t){t.indexOf("_@r")!==0&&each(o.depMaps,function(f){if(f.id===i.id)return n.push(t),!0})}),y(makeError("scripterror",'Script error for "'+i.id+(n.length?'", needed by: '+n.join(", "):'"'),e,[i.id]))}}},u.require=u.makeRequire(),u}req=requirejs=function(r,a,c,u){var h,q,g=defContextName;return!isArray(r)&&typeof r!="string"&&(q=r,isArray(a)?(r=a,a=c,c=u):r=[]),q&&q.context&&(g=q.context),h=getOwn(contexts,g),h||(h=contexts[g]=req.s.newContext(g)),q&&h.configure(q),h.require(r,a,c)},req.config=function(r){return req(r)},req.nextTick=typeof setTimeout<"u"?function(r){setTimeout(r,4)}:function(r){r()},require||(require=req),req.version=version,req.jsExtRegExp=/^\\/|:|\\?|\\.js$/,req.isBrowser=isBrowser,s=req.s={contexts,newContext},req({}),each(["toUrl","undef","defined","specified"],function(r){req[r]=function(){var a=contexts[defContextName];return a.require[r].apply(a,arguments)}}),isBrowser&&(head=s.head=document.getElementsByTagName("head")[0],baseElement=document.getElementsByTagName("base")[0],baseElement&&(head=s.head=baseElement.parentNode)),req.onError=defaultOnError,req.createNode=function(r,a,c){var u=r.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");return u.type=r.scriptType||"text/javascript",u.charset="utf-8",u.async=!0,u},req.load=function(r,a,c){var u=r&&r.config||{},h;if(isBrowser)return h=req.createNode(u,a,c),h.setAttribute("data-requirecontext",r.contextName),h.setAttribute("data-requiremodule",a),h.attachEvent&&!(h.attachEvent.toString&&h.attachEvent.toString().indexOf("[native code")<0)&&!isOpera?(useInteractive=!0,h.attachEvent("onreadystatechange",r.onScriptLoad)):(h.addEventListener("load",r.onScriptLoad,!1),h.addEventListener("error",r.onScriptError,!1)),h.src=c,u.onNodeCreated&&u.onNodeCreated(h,u,a,c),currentlyAddingScript=h,baseElement?head.insertBefore(h,baseElement):head.appendChild(h),currentlyAddingScript=null,h;if(isWebWorker)try{setTimeout(function(){},0),importScripts(c),r.completeLoad(a)}catch(q){r.onError(makeError("importscripts","importScripts failed for "+a+" at "+c,q,[a]))}};function getInteractiveScript(){return interactiveScript&&interactiveScript.readyState==="interactive"||eachReverse(scripts(),function(r){if(r.readyState==="interactive")return interactiveScript=r}),interactiveScript}isBrowser&&!cfg.skipDataMain&&eachReverse(scripts(),function(r){if(head||(head=r.parentNode),dataMain=r.getAttribute("data-main"),dataMain)return mainScript=dataMain,!cfg.baseUrl&&mainScript.indexOf("!")===-1&&(src=mainScript.split("/"),mainScript=src.pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath),mainScript=mainScript.replace(jsSuffixRegExp,""),req.jsExtRegExp.test(mainScript)&&(mainScript=dataMain),cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript],!0}),define=function(r,a,c){var u,h;typeof r!="string"&&(c=a,a=r,r=null),isArray(a)||(c=a,a=null),!a&&isFunction(c)&&(a=[],c.length&&(c.toString().replace(commentRegExp,commentReplace).replace(cjsRequireRegExp,function(q,g){a.push(g)}),a=(c.length===1?["require"]:["require","exports","module"]).concat(a))),useInteractive&&(u=currentlyAddingScript||getInteractiveScript(),u&&(r||(r=u.getAttribute("data-requiremodule")),h=contexts[u.getAttribute("data-requirecontext")])),h?(h.defQueue.push([r,a,c]),h.defQueueMap[r]=!0):globalDefQueue.push([r,a,c])},define.amd={jQuery:!0},req.exec=function(text){return eval(text)},req(cfg)})(this,typeof setTimeout>"u"?void 0:setTimeout);`;
|
|
9189
|
+
|
|
8538
9190
|
// ../interactions/portable-custom-interaction/dist/qti-portable-custom-interaction.js
|
|
8539
|
-
var
|
|
9191
|
+
var __decorate25 = function(decorators, target, key, desc) {
|
|
8540
9192
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8541
9193
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
8542
9194
|
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;
|
|
8543
9195
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
8544
9196
|
};
|
|
9197
|
+
var inlineScriptText = (text) => text.replace(/<\/(script)/gi, "<\\/$1");
|
|
9198
|
+
var inlineStyleText = (text) => text.replace(/<\/(style)/gi, "<\\/$1");
|
|
8545
9199
|
var STATUSES_SHOWING_CORRECT_RESPONSE = ["solution", "review"];
|
|
8546
9200
|
function hasCorrectResponseValue(value) {
|
|
8547
9201
|
if (value === null || value === void 0)
|
|
8548
9202
|
return false;
|
|
8549
|
-
|
|
9203
|
+
if (Array.isArray(value))
|
|
9204
|
+
return value.length > 0;
|
|
9205
|
+
if (isRecordValue(value))
|
|
9206
|
+
return Object.keys(value).length > 0;
|
|
9207
|
+
return value !== "";
|
|
8550
9208
|
}
|
|
8551
9209
|
var QtiPortableCustomInteraction = class extends Interaction {
|
|
8552
9210
|
constructor() {
|
|
@@ -8557,7 +9215,7 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
8557
9215
|
this._iframeMessageOrigin = null;
|
|
8558
9216
|
this.requirePathsJson = "";
|
|
8559
9217
|
this.requireShimJson = "";
|
|
8560
|
-
this.requireJsUrl = "
|
|
9218
|
+
this.requireJsUrl = "";
|
|
8561
9219
|
this.baseUrl = "";
|
|
8562
9220
|
this.useDefaultPaths = false;
|
|
8563
9221
|
this.status = "interacting";
|
|
@@ -8596,7 +9254,6 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
8596
9254
|
case "resize":
|
|
8597
9255
|
if (typeof data.height === "number" && this.iframe) {
|
|
8598
9256
|
this.iframe.style.height = `${data.height}px`;
|
|
8599
|
-
this.iframe.style.width = `${data.width}px`;
|
|
8600
9257
|
}
|
|
8601
9258
|
break;
|
|
8602
9259
|
case "console":
|
|
@@ -8623,30 +9280,32 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
8623
9280
|
this.#pciCustomValidityMessage = pciCustomValidity;
|
|
8624
9281
|
}
|
|
8625
9282
|
const stateRaw = data?.params?.state;
|
|
8626
|
-
let
|
|
9283
|
+
let state17;
|
|
8627
9284
|
if (stateRaw === void 0) {
|
|
8628
|
-
|
|
9285
|
+
state17 = void 0;
|
|
8629
9286
|
} else if (stateRaw === null) {
|
|
8630
|
-
|
|
9287
|
+
state17 = null;
|
|
8631
9288
|
} else if (typeof stateRaw === "string") {
|
|
8632
|
-
|
|
9289
|
+
state17 = stateRaw;
|
|
8633
9290
|
} else {
|
|
8634
9291
|
try {
|
|
8635
|
-
|
|
9292
|
+
state17 = `__qti_json__::${JSON.stringify(stateRaw)}`;
|
|
8636
9293
|
} catch {
|
|
8637
|
-
|
|
9294
|
+
state17 = null;
|
|
8638
9295
|
}
|
|
8639
9296
|
}
|
|
8640
9297
|
if (converted === null) {
|
|
8641
|
-
const
|
|
9298
|
+
const cardinality = this.responseVariable?.cardinality;
|
|
9299
|
+
const emptyResponse = cardinality === "record" ? null : cardinality === "single" ? "" : [];
|
|
8642
9300
|
this.response = emptyResponse;
|
|
8643
9301
|
this.validate();
|
|
8644
|
-
this.saveResponse(emptyResponse,
|
|
9302
|
+
this.saveResponse(emptyResponse, state17);
|
|
8645
9303
|
break;
|
|
8646
9304
|
}
|
|
8647
|
-
|
|
9305
|
+
const response = converted;
|
|
9306
|
+
this.response = response;
|
|
8648
9307
|
this.validate();
|
|
8649
|
-
this.saveResponse(
|
|
9308
|
+
this.saveResponse(response, state17);
|
|
8650
9309
|
break;
|
|
8651
9310
|
}
|
|
8652
9311
|
case "error":
|
|
@@ -8774,9 +9433,13 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
8774
9433
|
return this.#getRequireShim();
|
|
8775
9434
|
}
|
|
8776
9435
|
/**
|
|
8777
|
-
* Converts QtiVariableJSON to a string
|
|
9436
|
+
* Converts QtiVariableJSON to a string, a string array, or for a record its field map
|
|
8778
9437
|
*/
|
|
8779
9438
|
#convertQtiVariableJSON(input) {
|
|
9439
|
+
if (input && Array.isArray(input.record)) {
|
|
9440
|
+
const record = recordFromQtiVariableJSON(input.record);
|
|
9441
|
+
return Object.keys(record).length ? record : null;
|
|
9442
|
+
}
|
|
8780
9443
|
for (const topLevelKey in input) {
|
|
8781
9444
|
if (input.hasOwnProperty(topLevelKey)) {
|
|
8782
9445
|
const nestedObject = input[topLevelKey];
|
|
@@ -8784,6 +9447,14 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
8784
9447
|
for (const nestedKey in nestedObject) {
|
|
8785
9448
|
if (nestedObject.hasOwnProperty(nestedKey)) {
|
|
8786
9449
|
const value = nestedObject[nestedKey];
|
|
9450
|
+
if (nestedKey === "file") {
|
|
9451
|
+
if (Array.isArray(value))
|
|
9452
|
+
return value.map(fileToDataUrl).filter((v) => v !== null);
|
|
9453
|
+
const dataUrl = fileToDataUrl(value);
|
|
9454
|
+
if (dataUrl !== null)
|
|
9455
|
+
return dataUrl;
|
|
9456
|
+
continue;
|
|
9457
|
+
}
|
|
8787
9458
|
if (Array.isArray(value)) {
|
|
8788
9459
|
return value.map(String);
|
|
8789
9460
|
} else if (value !== void 0 && value !== null) {
|
|
@@ -8803,44 +9474,6 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
8803
9474
|
const needle = tagName.toLowerCase();
|
|
8804
9475
|
return Array.from(this.children).filter((child) => child.tagName.toLowerCase() === needle);
|
|
8805
9476
|
}
|
|
8806
|
-
/**
|
|
8807
|
-
* Coerce a scalar value to the expected base-type when possible
|
|
8808
|
-
*/
|
|
8809
|
-
coerceBaseValue(value, baseType) {
|
|
8810
|
-
if (value === null || value === void 0)
|
|
8811
|
-
return value;
|
|
8812
|
-
switch (baseType) {
|
|
8813
|
-
case "integer": {
|
|
8814
|
-
if (typeof value === "number")
|
|
8815
|
-
return value;
|
|
8816
|
-
const parsed = parseInt(String(value), 10);
|
|
8817
|
-
return Number.isNaN(parsed) ? value : parsed;
|
|
8818
|
-
}
|
|
8819
|
-
case "float":
|
|
8820
|
-
case "duration": {
|
|
8821
|
-
if (typeof value === "number")
|
|
8822
|
-
return value;
|
|
8823
|
-
const parsed = parseFloat(String(value));
|
|
8824
|
-
return Number.isNaN(parsed) ? value : parsed;
|
|
8825
|
-
}
|
|
8826
|
-
case "boolean": {
|
|
8827
|
-
if (typeof value === "boolean")
|
|
8828
|
-
return value;
|
|
8829
|
-
if (typeof value === "string") {
|
|
8830
|
-
const lowered = value.toLowerCase();
|
|
8831
|
-
if (lowered === "true")
|
|
8832
|
-
return true;
|
|
8833
|
-
if (lowered === "false")
|
|
8834
|
-
return false;
|
|
8835
|
-
}
|
|
8836
|
-
return value;
|
|
8837
|
-
}
|
|
8838
|
-
case "string":
|
|
8839
|
-
case "identifier":
|
|
8840
|
-
default:
|
|
8841
|
-
return String(value);
|
|
8842
|
-
}
|
|
8843
|
-
}
|
|
8844
9477
|
/**
|
|
8845
9478
|
* Normalize an input into a list form
|
|
8846
9479
|
*/
|
|
@@ -8854,62 +9487,13 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
8854
9487
|
*/
|
|
8855
9488
|
variableToQtiVariableJSON(value, cardinality, baseType) {
|
|
8856
9489
|
if (cardinality === "record" || baseType === "record") {
|
|
8857
|
-
return
|
|
9490
|
+
return recordToQtiVariableJSON(value);
|
|
8858
9491
|
}
|
|
8859
9492
|
if (cardinality !== "single") {
|
|
8860
|
-
const listValues = this.normalizeListValue(value).map((v) =>
|
|
9493
|
+
const listValues = this.normalizeListValue(value).map((v) => coerceBaseValue(v, baseType));
|
|
8861
9494
|
return { list: { [baseType]: listValues } };
|
|
8862
9495
|
}
|
|
8863
|
-
return { base: { [baseType]:
|
|
8864
|
-
}
|
|
8865
|
-
/**
|
|
8866
|
-
* Convert a record object into QtiVariableJSON
|
|
8867
|
-
*/
|
|
8868
|
-
recordToQtiVariableJSON(value) {
|
|
8869
|
-
if (!value || typeof value !== "object") {
|
|
8870
|
-
return { record: [] };
|
|
8871
|
-
}
|
|
8872
|
-
const recordEntries = [];
|
|
8873
|
-
for (const [name, entryValue] of Object.entries(value)) {
|
|
8874
|
-
recordEntries.push(this.recordEntryFromValue(name, entryValue));
|
|
8875
|
-
}
|
|
8876
|
-
return { record: recordEntries };
|
|
8877
|
-
}
|
|
8878
|
-
/**
|
|
8879
|
-
* Build a record entry from an arbitrary value
|
|
8880
|
-
*/
|
|
8881
|
-
recordEntryFromValue(name, entryValue) {
|
|
8882
|
-
if (Array.isArray(entryValue)) {
|
|
8883
|
-
const filtered = entryValue.filter((v) => v !== null && v !== void 0);
|
|
8884
|
-
if (filtered.length && filtered.every((v) => typeof v === "boolean")) {
|
|
8885
|
-
return { name, list: { boolean: filtered } };
|
|
8886
|
-
}
|
|
8887
|
-
if (filtered.length && filtered.every((v) => typeof v === "number")) {
|
|
8888
|
-
const numbers = filtered;
|
|
8889
|
-
const isIntegers = numbers.every((n) => Number.isInteger(n));
|
|
8890
|
-
return { name, list: { [isIntegers ? "integer" : "float"]: numbers } };
|
|
8891
|
-
}
|
|
8892
|
-
return { name, list: { string: entryValue.map((v) => v === null || v === void 0 ? "" : String(v)) } };
|
|
8893
|
-
}
|
|
8894
|
-
if (typeof entryValue === "boolean") {
|
|
8895
|
-
return { name, base: { boolean: entryValue } };
|
|
8896
|
-
}
|
|
8897
|
-
if (typeof entryValue === "number") {
|
|
8898
|
-
if (Number.isInteger(entryValue))
|
|
8899
|
-
return { name, base: { integer: entryValue } };
|
|
8900
|
-
return { name, base: { float: entryValue } };
|
|
8901
|
-
}
|
|
8902
|
-
if (entryValue === null || entryValue === void 0) {
|
|
8903
|
-
return { name, base: { string: "" } };
|
|
8904
|
-
}
|
|
8905
|
-
if (typeof entryValue === "object") {
|
|
8906
|
-
try {
|
|
8907
|
-
return { name, base: { string: JSON.stringify(entryValue) } };
|
|
8908
|
-
} catch {
|
|
8909
|
-
return { name, base: { string: String(entryValue) } };
|
|
8910
|
-
}
|
|
8911
|
-
}
|
|
8912
|
-
return { name, base: { string: String(entryValue) } };
|
|
9496
|
+
return { base: { [baseType]: coerceBaseValue(value, baseType) } };
|
|
8913
9497
|
}
|
|
8914
9498
|
/**
|
|
8915
9499
|
* Extract default QTI_CONTEXT values from qti-context-declaration elements
|
|
@@ -8924,15 +9508,10 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
8924
9508
|
const defaultValueElement = declaration.querySelector("qti-default-value");
|
|
8925
9509
|
if (!defaultValueElement)
|
|
8926
9510
|
return;
|
|
8927
|
-
const
|
|
8928
|
-
|
|
8929
|
-
|
|
8930
|
-
|
|
8931
|
-
return;
|
|
8932
|
-
const baseType = valueElement.getAttribute("base-type") || "string";
|
|
8933
|
-
const textContent = valueElement.textContent?.trim() || "";
|
|
8934
|
-
defaults[fieldIdentifier] = this.coerceBaseValue(textContent, baseType);
|
|
8935
|
-
});
|
|
9511
|
+
const { value, baseTypes } = readRecordFieldValues(defaultValueElement.querySelectorAll("qti-value"));
|
|
9512
|
+
for (const [fieldIdentifier, textContent] of Object.entries(value)) {
|
|
9513
|
+
defaults[fieldIdentifier] = coerceBaseValue(textContent, baseTypes[fieldIdentifier] ?? "string");
|
|
9514
|
+
}
|
|
8936
9515
|
});
|
|
8937
9516
|
return defaults;
|
|
8938
9517
|
}
|
|
@@ -8951,7 +9530,7 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
8951
9530
|
environmentIdentifier: merged.environmentIdentifier ?? "",
|
|
8952
9531
|
...merged
|
|
8953
9532
|
};
|
|
8954
|
-
return
|
|
9533
|
+
return recordToQtiVariableJSON(normalized);
|
|
8955
9534
|
}
|
|
8956
9535
|
/**
|
|
8957
9536
|
* Collect template variables referenced by qti-template-variable children
|
|
@@ -9044,20 +9623,26 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
9044
9623
|
/**
|
|
9045
9624
|
* Converts response variables to QtiVariableJSON
|
|
9046
9625
|
*/
|
|
9047
|
-
responseVariablesToQtiVariableJSON(input, cardinality, baseType) {
|
|
9626
|
+
responseVariablesToQtiVariableJSON(input, cardinality, baseType, fieldBaseTypes) {
|
|
9627
|
+
if (cardinality === "record") {
|
|
9628
|
+
return recordResponseToQtiVariableJSON(input, fieldBaseTypes);
|
|
9629
|
+
}
|
|
9048
9630
|
if (cardinality !== "single") {
|
|
9049
9631
|
const list = { list: {} };
|
|
9050
|
-
list.list[baseType] = input;
|
|
9632
|
+
list.list[baseType] = isFileBaseType(baseType) ? this.normalizeListValue(input).map(dataUrlToFile).filter(Boolean) : input;
|
|
9051
9633
|
return list;
|
|
9052
9634
|
} else {
|
|
9053
9635
|
const base = { base: {} };
|
|
9054
|
-
base.base[baseType] = input;
|
|
9636
|
+
base.base[baseType] = isFileBaseType(baseType) ? dataUrlToFile(input) : input;
|
|
9055
9637
|
return base;
|
|
9056
9638
|
}
|
|
9057
9639
|
}
|
|
9058
9640
|
#hasNonEmptyResponse() {
|
|
9059
9641
|
if (this.response === null || this.response === void 0)
|
|
9060
9642
|
return false;
|
|
9643
|
+
if (isRecordValue(this.response)) {
|
|
9644
|
+
return Object.values(this.response).some((v) => v !== "" && v !== null && v !== void 0);
|
|
9645
|
+
}
|
|
9061
9646
|
if (Array.isArray(this.response)) {
|
|
9062
9647
|
if (this.response.length === 0)
|
|
9063
9648
|
return false;
|
|
@@ -9085,6 +9670,8 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
9085
9670
|
get value() {
|
|
9086
9671
|
if (this.#value === null || this.#value === void 0)
|
|
9087
9672
|
return null;
|
|
9673
|
+
if (isRecordValue(this.#value))
|
|
9674
|
+
return JSON.stringify(this.#value);
|
|
9088
9675
|
return Array.isArray(this.#value) ? this.#value.join(",") : String(this.#value);
|
|
9089
9676
|
}
|
|
9090
9677
|
set boundTo(newValue) {
|
|
@@ -9099,10 +9686,11 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
9099
9686
|
const responseVariable = {};
|
|
9100
9687
|
const variable = this.context?.variables?.find((v) => v.identifier === this.responseIdentifier);
|
|
9101
9688
|
if (variable) {
|
|
9102
|
-
const cardinality =
|
|
9103
|
-
const baseType =
|
|
9104
|
-
const value =
|
|
9105
|
-
const
|
|
9689
|
+
const cardinality = variable.cardinality || "single";
|
|
9690
|
+
const baseType = variable.baseType || "string";
|
|
9691
|
+
const value = variable.value || null;
|
|
9692
|
+
const fieldBaseTypes = variable.fieldBaseTypes;
|
|
9693
|
+
const responseVal = this.responseVariablesToQtiVariableJSON(value, cardinality, baseType, fieldBaseTypes);
|
|
9106
9694
|
responseVariable[this.responseIdentifier] = responseVal;
|
|
9107
9695
|
}
|
|
9108
9696
|
return responseVariable;
|
|
@@ -9181,6 +9769,11 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
9181
9769
|
};
|
|
9182
9770
|
const iframeName = `qti-pci-${this.responseIdentifier}-${Date.now()}`;
|
|
9183
9771
|
this.iframe.name = iframeName;
|
|
9772
|
+
const { sandbox, allow } = this.configContext?.pciIframe ?? {};
|
|
9773
|
+
if (sandbox !== void 0)
|
|
9774
|
+
this.iframe.setAttribute("sandbox", sandbox);
|
|
9775
|
+
if (allow)
|
|
9776
|
+
this.iframe.setAttribute("allow", allow);
|
|
9184
9777
|
const iframeContent = this.generateIframeContent();
|
|
9185
9778
|
this.iframe.srcdoc = iframeContent;
|
|
9186
9779
|
this.appendChild(this.iframe);
|
|
@@ -9272,11 +9865,9 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
9272
9865
|
const iframeBaseUrl = this.dataset.baseUrl ? this.dataset.baseUrl.startsWith("/") ? `${window.location.origin}${this.dataset.baseUrl}` : this.dataset.baseUrl : "";
|
|
9273
9866
|
const iframeBaseHref = iframeBaseUrl ? iframeBaseUrl.endsWith("/") ? iframeBaseUrl : `${iframeBaseUrl}/` : `${window.location.origin}/`;
|
|
9274
9867
|
const forwardConsole = this.dataset.forwardConsole === "true";
|
|
9275
|
-
const
|
|
9276
|
-
const
|
|
9277
|
-
const
|
|
9278
|
-
const componentsCdnUrl = this.dataset.componentsCdnUrl || defaultComponentsCdnUrl;
|
|
9279
|
-
const componentsCssUrl = this.dataset.componentsCssUrl || defaultComponentsCssUrl;
|
|
9868
|
+
const componentsCdnUrl = this.dataset.componentsCdnUrl;
|
|
9869
|
+
const componentsCssUrl = this.dataset.componentsCssUrl;
|
|
9870
|
+
const requireJsTag = this.requireJsUrl ? `<script src="${this.requireJsUrl}"></script>` : `<script>${inlineScriptText(require_js_default)}</script>`;
|
|
9280
9871
|
const fontStyles = `
|
|
9281
9872
|
font-family: ${parentStyles.getPropertyValue("font-family")};
|
|
9282
9873
|
font-size: ${parentStyles.getPropertyValue("font-size")};
|
|
@@ -9284,17 +9875,18 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
9284
9875
|
font-weight: ${parentStyles.getPropertyValue("font-weight")};
|
|
9285
9876
|
color: ${parentStyles.getPropertyValue("color")};
|
|
9286
9877
|
`;
|
|
9878
|
+
const langHost = this.closest("[lang], [xml\\:lang]");
|
|
9879
|
+
const iframeLang = [langHost?.getAttribute("lang"), langHost?.getAttribute("xml:lang"), document.documentElement.lang].map((l) => (l ?? "").trim()).find((l) => /^[A-Za-z]{1,8}(-[A-Za-z0-9]{1,8})*$/.test(l)) ?? "en";
|
|
9287
9880
|
return (
|
|
9288
9881
|
/* html */
|
|
9289
9882
|
`<!DOCTYPE html>
|
|
9290
|
-
<html lang="
|
|
9883
|
+
<html lang="${iframeLang}">
|
|
9291
9884
|
<head>
|
|
9292
9885
|
<meta charset="utf-8" />
|
|
9293
9886
|
<title>QTI PCI Container</title>
|
|
9294
9887
|
<base href="${iframeBaseHref}" />
|
|
9295
|
-
|
|
9296
|
-
|
|
9297
|
-
</script>
|
|
9888
|
+
${componentsCdnUrl ? `<script type="module">import '${componentsCdnUrl}';</script>` : ""}
|
|
9889
|
+
<style>${inlineStyleText(native_css_default)}</style>
|
|
9298
9890
|
<style>
|
|
9299
9891
|
body, html {
|
|
9300
9892
|
margin: 0;
|
|
@@ -9311,6 +9903,8 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
9311
9903
|
}
|
|
9312
9904
|
#pci-container {
|
|
9313
9905
|
width: 100%;
|
|
9906
|
+
/* Keeps the first and last child's margins inside, so scrollHeight is the full height. */
|
|
9907
|
+
display: flow-root;
|
|
9314
9908
|
}
|
|
9315
9909
|
qti-interaction-markup {
|
|
9316
9910
|
display: block;
|
|
@@ -9318,8 +9912,8 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
9318
9912
|
min-height: 50px;
|
|
9319
9913
|
}
|
|
9320
9914
|
</style>
|
|
9321
|
-
|
|
9322
|
-
|
|
9915
|
+
${componentsCssUrl ? `<link href="${componentsCssUrl}" rel="stylesheet" />` : ""}
|
|
9916
|
+
${requireJsTag}
|
|
9323
9917
|
<script>
|
|
9324
9918
|
const forwardConsole = ${forwardConsole ? "true" : "false"};
|
|
9325
9919
|
if (forwardConsole) {
|
|
@@ -10064,7 +10658,8 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
10064
10658
|
let previousHeight = 0;
|
|
10065
10659
|
const notifyResize = () => {
|
|
10066
10660
|
const container = document.getElementById('pci-container');
|
|
10067
|
-
|
|
10661
|
+
// The content's own height (subpixel, rounded up) or what overflows it, e.g. an open popup.
|
|
10662
|
+
const newHeight = Math.max(Math.ceil(container.getBoundingClientRect().height), container.scrollHeight);
|
|
10068
10663
|
if (newHeight !== previousHeight) {
|
|
10069
10664
|
previousHeight = newHeight;
|
|
10070
10665
|
clearTimeout(resizeTimeout);
|
|
@@ -10234,141 +10829,467 @@ var QtiPortableCustomInteraction = class extends Interaction {
|
|
|
10234
10829
|
`;
|
|
10235
10830
|
}
|
|
10236
10831
|
};
|
|
10237
|
-
|
|
10832
|
+
__decorate25([
|
|
10238
10833
|
property23({ type: String, attribute: "module" })
|
|
10239
10834
|
], QtiPortableCustomInteraction.prototype, "module", void 0);
|
|
10240
|
-
|
|
10835
|
+
__decorate25([
|
|
10241
10836
|
property23({ type: String, attribute: "custom-interaction-type-identifier" })
|
|
10242
10837
|
], QtiPortableCustomInteraction.prototype, "customInteractionTypeIdentifier", void 0);
|
|
10243
|
-
|
|
10838
|
+
__decorate25([
|
|
10244
10839
|
property23({ type: String, attribute: "data-require-paths" })
|
|
10245
10840
|
], QtiPortableCustomInteraction.prototype, "requirePathsJson", void 0);
|
|
10246
|
-
|
|
10841
|
+
__decorate25([
|
|
10247
10842
|
property23({ type: String, attribute: "data-require-shim" })
|
|
10248
10843
|
], QtiPortableCustomInteraction.prototype, "requireShimJson", void 0);
|
|
10249
|
-
|
|
10844
|
+
__decorate25([
|
|
10250
10845
|
property23({ type: String, attribute: "data-require-js-url" })
|
|
10251
10846
|
], QtiPortableCustomInteraction.prototype, "requireJsUrl", void 0);
|
|
10252
|
-
|
|
10847
|
+
__decorate25([
|
|
10253
10848
|
property23({ type: String, attribute: "data-base-url" })
|
|
10254
10849
|
], QtiPortableCustomInteraction.prototype, "baseUrl", void 0);
|
|
10255
|
-
|
|
10850
|
+
__decorate25([
|
|
10256
10851
|
property23({ type: Boolean, attribute: "data-use-default-paths" })
|
|
10257
10852
|
], QtiPortableCustomInteraction.prototype, "useDefaultPaths", void 0);
|
|
10258
|
-
|
|
10853
|
+
__decorate25([
|
|
10259
10854
|
property23({ type: String, attribute: "data-status" })
|
|
10260
10855
|
], QtiPortableCustomInteraction.prototype, "status", void 0);
|
|
10261
|
-
|
|
10262
|
-
|
|
10856
|
+
__decorate25([
|
|
10857
|
+
state14()
|
|
10263
10858
|
], QtiPortableCustomInteraction.prototype, "_errorMessage", void 0);
|
|
10264
|
-
|
|
10265
|
-
|
|
10266
|
-
|
|
10859
|
+
__decorate25([
|
|
10860
|
+
consume7({ context: itemContext, subscribe: true }),
|
|
10861
|
+
state14()
|
|
10267
10862
|
], QtiPortableCustomInteraction.prototype, "context", void 0);
|
|
10268
|
-
|
|
10269
|
-
|
|
10270
|
-
|
|
10863
|
+
__decorate25([
|
|
10864
|
+
consume7({ context: qtiContext, subscribe: true }),
|
|
10865
|
+
state14()
|
|
10271
10866
|
], QtiPortableCustomInteraction.prototype, "qtiContext", void 0);
|
|
10272
|
-
|
|
10867
|
+
__decorate25([
|
|
10273
10868
|
property23({ attribute: "response", reflect: false, converter: responseAttributeConverter({ emptyAs: null }) })
|
|
10274
10869
|
], QtiPortableCustomInteraction.prototype, "response", void 0);
|
|
10275
10870
|
|
|
10276
10871
|
// ../interactions/position-object-interaction/dist/qti-position-object-interaction.js
|
|
10277
|
-
import {
|
|
10872
|
+
import { html as html27, nothing as nothing4 } from "lit";
|
|
10873
|
+
import { property as property24, state as state15 } from "lit/decorators.js";
|
|
10874
|
+
import { repeat as repeat7 } from "lit/directives/repeat.js";
|
|
10875
|
+
import { styleMap } from "lit/directives/style-map.js";
|
|
10278
10876
|
|
|
10279
10877
|
// ../interactions/position-object-interaction/dist/qti-position-object-interaction.styles.js
|
|
10280
10878
|
import { css as css28 } from "lit";
|
|
10281
10879
|
var qti_position_object_interaction_styles_default = [
|
|
10282
10880
|
boxSizing,
|
|
10881
|
+
validationMessage,
|
|
10283
10882
|
css28`
|
|
10883
|
+
/* Not positioned on purpose: the placed copies are absolutely positioned against the stage
|
|
10884
|
+
(qti-position-object-stage), so they land on its image wherever this tray sits. */
|
|
10284
10885
|
:host {
|
|
10285
|
-
display: block;
|
|
10886
|
+
display: inline-block;
|
|
10887
|
+
vertical-align: top;
|
|
10888
|
+
margin-block-start: var(--qti-gap, 0.5rem);
|
|
10889
|
+
margin-inline-end: var(--qti-gap, 0.5rem);
|
|
10890
|
+
}
|
|
10891
|
+
|
|
10892
|
+
[part~='object'] {
|
|
10893
|
+
display: inline-flex;
|
|
10894
|
+
padding: var(--qti-size-field, 0.125rem);
|
|
10895
|
+
cursor: grab;
|
|
10896
|
+
touch-action: none;
|
|
10897
|
+
user-select: none;
|
|
10898
|
+
}
|
|
10899
|
+
[part~='object'][aria-disabled='true'] {
|
|
10900
|
+
cursor: default;
|
|
10286
10901
|
}
|
|
10287
10902
|
::slotted(img) {
|
|
10903
|
+
display: block;
|
|
10904
|
+
pointer-events: none;
|
|
10905
|
+
}
|
|
10906
|
+
|
|
10907
|
+
[part~='point'] {
|
|
10288
10908
|
position: absolute;
|
|
10289
|
-
cursor:
|
|
10909
|
+
cursor: grab;
|
|
10910
|
+
touch-action: none;
|
|
10290
10911
|
user-select: none;
|
|
10291
|
-
|
|
10292
|
-
|
|
10912
|
+
z-index: 1;
|
|
10913
|
+
}
|
|
10914
|
+
[part~='point'][data-ghost] {
|
|
10915
|
+
pointer-events: none;
|
|
10293
10916
|
}
|
|
10294
10917
|
`
|
|
10295
10918
|
];
|
|
10296
10919
|
|
|
10297
10920
|
// ../interactions/position-object-interaction/dist/qti-position-object-interaction.js
|
|
10298
|
-
var
|
|
10921
|
+
var __decorate26 = function(decorators, target, key, desc) {
|
|
10922
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10923
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
10924
|
+
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;
|
|
10925
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10926
|
+
};
|
|
10927
|
+
var CLICK_SLOP = 4;
|
|
10928
|
+
var QtiPositionObjectInteraction = class extends Interaction {
|
|
10929
|
+
constructor() {
|
|
10930
|
+
super(...arguments);
|
|
10931
|
+
this.maxChoices = 1;
|
|
10932
|
+
this.minChoices = 0;
|
|
10933
|
+
this.centerPoint = null;
|
|
10934
|
+
this.response = null;
|
|
10935
|
+
this._layout = 0;
|
|
10936
|
+
this._drag = null;
|
|
10937
|
+
this._armed = false;
|
|
10938
|
+
this.#stageImg = null;
|
|
10939
|
+
this.#resize = new ResizeObserver(() => this._layout++);
|
|
10940
|
+
this._handleResponseChange = () => {
|
|
10941
|
+
this._internals.setFormValue(serializeResponseAttribute(this.response) || null);
|
|
10942
|
+
this.validate();
|
|
10943
|
+
setState(this._internals.states, "used", this.#atMax());
|
|
10944
|
+
};
|
|
10945
|
+
this.#onMove = (event) => {
|
|
10946
|
+
if (!this._drag)
|
|
10947
|
+
return;
|
|
10948
|
+
const client = { x: event.clientX, y: event.clientY };
|
|
10949
|
+
const moved = this._drag.moved || Math.hypot(client.x - this._drag.start.x, client.y - this._drag.start.y) > CLICK_SLOP;
|
|
10950
|
+
this._drag = { ...this._drag, client, moved };
|
|
10951
|
+
};
|
|
10952
|
+
this.#onUp = (event) => {
|
|
10953
|
+
window.removeEventListener("pointermove", this.#onMove);
|
|
10954
|
+
const drag = this._drag;
|
|
10955
|
+
this._drag = null;
|
|
10956
|
+
if (!drag)
|
|
10957
|
+
return;
|
|
10958
|
+
if (!drag.moved) {
|
|
10959
|
+
if (drag.index === -1)
|
|
10960
|
+
this._armed = !this._armed;
|
|
10961
|
+
return;
|
|
10962
|
+
}
|
|
10963
|
+
const target = this.#toStage({ x: event.clientX, y: event.clientY });
|
|
10964
|
+
const points = this.#points();
|
|
10965
|
+
if (drag.index === -1) {
|
|
10966
|
+
if (target)
|
|
10967
|
+
this.#place(target);
|
|
10968
|
+
} else if (target) {
|
|
10969
|
+
points[drag.index] = target;
|
|
10970
|
+
this.#write(points);
|
|
10971
|
+
} else {
|
|
10972
|
+
this.#write(points.filter((_, i) => i !== drag.index));
|
|
10973
|
+
}
|
|
10974
|
+
};
|
|
10975
|
+
this.#onStageClick = (event) => {
|
|
10976
|
+
if (!this._armed || this.#locked)
|
|
10977
|
+
return;
|
|
10978
|
+
const target = this.#toStage({ x: event.clientX, y: event.clientY });
|
|
10979
|
+
if (!target)
|
|
10980
|
+
return;
|
|
10981
|
+
this._armed = false;
|
|
10982
|
+
this.#place(target);
|
|
10983
|
+
};
|
|
10984
|
+
}
|
|
10299
10985
|
static {
|
|
10300
10986
|
this.styles = qti_position_object_interaction_styles_default;
|
|
10301
10987
|
}
|
|
10988
|
+
#stageImg;
|
|
10989
|
+
#resize;
|
|
10990
|
+
#points() {
|
|
10991
|
+
return (this.response ?? []).map((entry) => {
|
|
10992
|
+
const [x, y] = entry.split(" ").map(Number);
|
|
10993
|
+
return { x, y };
|
|
10994
|
+
});
|
|
10995
|
+
}
|
|
10996
|
+
#write(points) {
|
|
10997
|
+
this.response = points.map((p) => `${Math.round(p.x)} ${Math.round(p.y)}`);
|
|
10998
|
+
this.saveResponse(this.response);
|
|
10999
|
+
this.validate();
|
|
11000
|
+
this.reportValidity({ trigger: "change" });
|
|
11001
|
+
}
|
|
11002
|
+
#atMax() {
|
|
11003
|
+
return this.maxChoices > 0 && (this.response?.length ?? 0) >= this.maxChoices;
|
|
11004
|
+
}
|
|
11005
|
+
validate() {
|
|
11006
|
+
const count = this.response?.length ?? 0;
|
|
11007
|
+
const exceedsMax = this.maxChoices > 0 && count > this.maxChoices;
|
|
11008
|
+
const belowMin = count < this.minChoices;
|
|
11009
|
+
let kind = "other";
|
|
11010
|
+
let message = "";
|
|
11011
|
+
if (exceedsMax) {
|
|
11012
|
+
kind = "max";
|
|
11013
|
+
message = this.dataset.maxSelectionsMessage || `Please place no more than ${this.maxChoices} ${this.maxChoices === 1 ? "position" : "positions"}.`;
|
|
11014
|
+
} else if (belowMin) {
|
|
11015
|
+
kind = "min";
|
|
11016
|
+
message = this.dataset.minSelectionsMessage || `Please place at least ${this.minChoices} ${this.minChoices === 1 ? "position" : "positions"}.`;
|
|
11017
|
+
}
|
|
11018
|
+
const isValid = !exceedsMax && !belowMin;
|
|
11019
|
+
this.setInteractionValidity(isValid, message, this, { suppressInline: true, kind });
|
|
11020
|
+
return isValid;
|
|
11021
|
+
}
|
|
11022
|
+
reportValidity(options) {
|
|
11023
|
+
return super.reportValidity(options);
|
|
11024
|
+
}
|
|
11025
|
+
reset() {
|
|
11026
|
+
this.resetValidityReport();
|
|
11027
|
+
this._armed = false;
|
|
11028
|
+
this.response = [];
|
|
11029
|
+
this._internals.setFormValue(null);
|
|
11030
|
+
}
|
|
11031
|
+
// ── Geometry ──────────────────────────────────────────────────────────────────────────────────
|
|
11032
|
+
get #stage() {
|
|
11033
|
+
return this.closest("qti-position-object-stage");
|
|
11034
|
+
}
|
|
11035
|
+
/** The stage image's own size: its `width`/`height` attributes, else its natural size. */
|
|
11036
|
+
#stageSize() {
|
|
11037
|
+
const img = this.#stageImg;
|
|
11038
|
+
if (!img)
|
|
11039
|
+
return { width: 1, height: 1 };
|
|
11040
|
+
return {
|
|
11041
|
+
width: parseFloat(img.getAttribute("width") ?? "") || img.naturalWidth || img.clientWidth || 1,
|
|
11042
|
+
height: parseFloat(img.getAttribute("height") ?? "") || img.naturalHeight || img.clientHeight || 1
|
|
11043
|
+
};
|
|
11044
|
+
}
|
|
11045
|
+
/** Stage-image units per CSS pixel. */
|
|
11046
|
+
#scale() {
|
|
11047
|
+
const rect = this.#stageImg?.getBoundingClientRect();
|
|
11048
|
+
if (!rect || rect.width === 0)
|
|
11049
|
+
return 1;
|
|
11050
|
+
return this.#stageSize().width / rect.width;
|
|
11051
|
+
}
|
|
11052
|
+
/** The object's own size and centre point, in the object's pixels. */
|
|
11053
|
+
#object() {
|
|
11054
|
+
const img = this.querySelector("img");
|
|
11055
|
+
const width = parseFloat(img?.getAttribute("width") ?? "") || img?.naturalWidth || 30;
|
|
11056
|
+
const height = parseFloat(img?.getAttribute("height") ?? "") || img?.naturalHeight || 30;
|
|
11057
|
+
const [cx, cy] = (this.centerPoint ?? "").split(/[\s,]+/).map(Number);
|
|
11058
|
+
return {
|
|
11059
|
+
width,
|
|
11060
|
+
height,
|
|
11061
|
+
centre: Number.isFinite(cx) && Number.isFinite(cy) ? { x: cx, y: cy } : { x: width / 2, y: height / 2 }
|
|
11062
|
+
};
|
|
11063
|
+
}
|
|
11064
|
+
/** A client position as a stage point, or null when it is off the stage image. */
|
|
11065
|
+
#toStage(client) {
|
|
11066
|
+
const rect = this.#stageImg?.getBoundingClientRect();
|
|
11067
|
+
if (!rect)
|
|
11068
|
+
return null;
|
|
11069
|
+
if (client.x < rect.left || client.x > rect.right || client.y < rect.top || client.y > rect.bottom)
|
|
11070
|
+
return null;
|
|
11071
|
+
const scale = this.#scale();
|
|
11072
|
+
return { x: (client.x - rect.left) * scale, y: (client.y - rect.top) * scale };
|
|
11073
|
+
}
|
|
11074
|
+
/** Where a copy whose centre point sits at a stage point is drawn, relative to the stage. */
|
|
11075
|
+
#styleFor(point) {
|
|
11076
|
+
const stageRect = this.#stage?.getBoundingClientRect();
|
|
11077
|
+
const imgRect = this.#stageImg?.getBoundingClientRect();
|
|
11078
|
+
if (!stageRect || !imgRect)
|
|
11079
|
+
return { display: "none" };
|
|
11080
|
+
const scale = this.#scale();
|
|
11081
|
+
const object = this.#object();
|
|
11082
|
+
return {
|
|
11083
|
+
left: `${imgRect.left - stageRect.left + point.x / scale - object.centre.x / scale}px`,
|
|
11084
|
+
top: `${imgRect.top - stageRect.top + point.y / scale - object.centre.y / scale}px`,
|
|
11085
|
+
width: `${object.width / scale}px`,
|
|
11086
|
+
height: `${object.height / scale}px`
|
|
11087
|
+
};
|
|
11088
|
+
}
|
|
11089
|
+
// ── Input ─────────────────────────────────────────────────────────────────────────────────────
|
|
11090
|
+
get #locked() {
|
|
11091
|
+
return this.disabled || this.readonly;
|
|
11092
|
+
}
|
|
11093
|
+
#place(point) {
|
|
11094
|
+
if (this.#atMax())
|
|
11095
|
+
return;
|
|
11096
|
+
this.#write([...this.#points(), point]);
|
|
11097
|
+
}
|
|
11098
|
+
#startDrag(event, index) {
|
|
11099
|
+
if (this.#locked || event.button !== 0)
|
|
11100
|
+
return;
|
|
11101
|
+
if (index === -1 && this.#atMax())
|
|
11102
|
+
return;
|
|
11103
|
+
event.preventDefault();
|
|
11104
|
+
const client = { x: event.clientX, y: event.clientY };
|
|
11105
|
+
this._drag = { index, client, start: client, moved: false };
|
|
11106
|
+
window.addEventListener("pointermove", this.#onMove);
|
|
11107
|
+
window.addEventListener("pointerup", this.#onUp, { once: true });
|
|
11108
|
+
}
|
|
11109
|
+
#onMove;
|
|
11110
|
+
#onUp;
|
|
11111
|
+
#onStageClick;
|
|
11112
|
+
#onObjectKey(event) {
|
|
11113
|
+
if (this.#locked)
|
|
11114
|
+
return;
|
|
11115
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
11116
|
+
event.preventDefault();
|
|
11117
|
+
if (this.#atMax())
|
|
11118
|
+
return;
|
|
11119
|
+
const { width, height } = this.#stageSize();
|
|
11120
|
+
this.#place({ x: width / 2, y: height / 2 });
|
|
11121
|
+
void this.updateComplete.then(() => {
|
|
11122
|
+
const copies = this.shadowRoot?.querySelectorAll('[part~="point"]');
|
|
11123
|
+
copies?.[copies.length - 1]?.focus();
|
|
11124
|
+
});
|
|
11125
|
+
} else if (event.key === "Escape") {
|
|
11126
|
+
this._armed = false;
|
|
11127
|
+
}
|
|
11128
|
+
}
|
|
11129
|
+
#onPointKey(event, index) {
|
|
11130
|
+
if (this.#locked)
|
|
11131
|
+
return;
|
|
11132
|
+
const step = event.shiftKey ? 10 : 1;
|
|
11133
|
+
const moves = {
|
|
11134
|
+
ArrowLeft: { x: -step, y: 0 },
|
|
11135
|
+
ArrowRight: { x: step, y: 0 },
|
|
11136
|
+
ArrowUp: { x: 0, y: -step },
|
|
11137
|
+
ArrowDown: { x: 0, y: step }
|
|
11138
|
+
};
|
|
11139
|
+
const points = this.#points();
|
|
11140
|
+
if (moves[event.key]) {
|
|
11141
|
+
event.preventDefault();
|
|
11142
|
+
const { width, height } = this.#stageSize();
|
|
11143
|
+
const p = points[index];
|
|
11144
|
+
points[index] = {
|
|
11145
|
+
x: Math.min(width, Math.max(0, p.x + moves[event.key].x)),
|
|
11146
|
+
y: Math.min(height, Math.max(0, p.y + moves[event.key].y))
|
|
11147
|
+
};
|
|
11148
|
+
this.#write(points);
|
|
11149
|
+
void this.updateComplete.then(() => this.shadowRoot?.querySelectorAll('[part~="point"]')[index]?.focus());
|
|
11150
|
+
} else if (event.key === "Delete" || event.key === "Backspace") {
|
|
11151
|
+
event.preventDefault();
|
|
11152
|
+
this.#write(points.filter((_, i) => i !== index));
|
|
11153
|
+
void this.updateComplete.then(() => this.shadowRoot?.querySelector('[part~="object"]')?.focus());
|
|
11154
|
+
}
|
|
11155
|
+
}
|
|
11156
|
+
// ── Lifecycle ─────────────────────────────────────────────────────────────────────────────────
|
|
11157
|
+
connectedCallback() {
|
|
11158
|
+
super.connectedCallback();
|
|
11159
|
+
this.#stageImg = this.#stage?.querySelector(":scope > img, :scope > picture img") ?? null;
|
|
11160
|
+
if (this.#stageImg) {
|
|
11161
|
+
this.#resize.observe(this.#stageImg);
|
|
11162
|
+
this.#stageImg.addEventListener("load", () => this._layout++);
|
|
11163
|
+
this.#stageImg.addEventListener("click", this.#onStageClick);
|
|
11164
|
+
}
|
|
11165
|
+
}
|
|
11166
|
+
disconnectedCallback() {
|
|
11167
|
+
super.disconnectedCallback();
|
|
11168
|
+
this.#resize.disconnect();
|
|
11169
|
+
this.#stageImg?.removeEventListener("click", this.#onStageClick);
|
|
11170
|
+
window.removeEventListener("pointermove", this.#onMove);
|
|
11171
|
+
}
|
|
11172
|
+
// ── Render ────────────────────────────────────────────────────────────────────────────────────
|
|
10302
11173
|
render() {
|
|
10303
|
-
|
|
11174
|
+
void this._layout;
|
|
11175
|
+
const src = this.querySelector("img")?.currentSrc || this.querySelector("img")?.src || "";
|
|
11176
|
+
const alt = this.querySelector("img")?.getAttribute("alt") || "object";
|
|
11177
|
+
const used = this.#atMax();
|
|
11178
|
+
const objectPart = ["object", this._armed ? "selected" : "", used ? "used" : ""].filter(Boolean).join(" ");
|
|
11179
|
+
const points = this.#points();
|
|
11180
|
+
const drag = this._drag;
|
|
11181
|
+
const dragPoint = drag && drag.moved && this.#stageImg ? (() => {
|
|
11182
|
+
const rect = this.#stageImg.getBoundingClientRect();
|
|
11183
|
+
const scale = this.#scale();
|
|
11184
|
+
return { x: (drag.client.x - rect.left) * scale, y: (drag.client.y - rect.top) * scale };
|
|
11185
|
+
})() : null;
|
|
11186
|
+
return html27`
|
|
11187
|
+
<div
|
|
11188
|
+
part=${objectPart}
|
|
11189
|
+
role="button"
|
|
11190
|
+
tabindex=${this.#locked || used ? -1 : 0}
|
|
11191
|
+
aria-disabled=${this.#locked || used ? "true" : "false"}
|
|
11192
|
+
aria-pressed=${this._armed ? "true" : "false"}
|
|
11193
|
+
aria-label=${`Place ${alt}`}
|
|
11194
|
+
@pointerdown=${(e) => this.#startDrag(e, -1)}
|
|
11195
|
+
@keydown=${(e) => this.#onObjectKey(e)}
|
|
11196
|
+
>
|
|
11197
|
+
<slot></slot>
|
|
11198
|
+
</div>
|
|
11199
|
+
${repeat7(points, (_, i) => i, (point, index) => {
|
|
11200
|
+
const shown = drag && drag.index === index && dragPoint ? dragPoint : point;
|
|
11201
|
+
return html27`<img
|
|
11202
|
+
part="point"
|
|
11203
|
+
src=${src}
|
|
11204
|
+
alt=${`${alt} at ${Math.round(point.x)}, ${Math.round(point.y)}`}
|
|
11205
|
+
role="button"
|
|
11206
|
+
tabindex=${this.#locked ? -1 : 0}
|
|
11207
|
+
draggable="false"
|
|
11208
|
+
style=${styleMap(this.#styleFor(shown))}
|
|
11209
|
+
@pointerdown=${(e) => this.#startDrag(e, index)}
|
|
11210
|
+
@keydown=${(e) => this.#onPointKey(e, index)}
|
|
11211
|
+
/>`;
|
|
11212
|
+
})}
|
|
11213
|
+
${drag && drag.index === -1 && dragPoint ? html27`<img part="point" data-ghost src=${src} alt="" style=${styleMap(this.#styleFor(dragPoint))} />` : nothing4}
|
|
11214
|
+
<div part="message" role="alert" id="validation-message" style="display:none;"></div>
|
|
11215
|
+
`;
|
|
10304
11216
|
}
|
|
10305
11217
|
};
|
|
11218
|
+
__decorate26([
|
|
11219
|
+
property24({ type: Number, attribute: "max-choices" })
|
|
11220
|
+
], QtiPositionObjectInteraction.prototype, "maxChoices", void 0);
|
|
11221
|
+
__decorate26([
|
|
11222
|
+
property24({ type: Number, attribute: "min-choices" })
|
|
11223
|
+
], QtiPositionObjectInteraction.prototype, "minChoices", void 0);
|
|
11224
|
+
__decorate26([
|
|
11225
|
+
property24({ type: String, attribute: "center-point" })
|
|
11226
|
+
], QtiPositionObjectInteraction.prototype, "centerPoint", void 0);
|
|
11227
|
+
__decorate26([
|
|
11228
|
+
property24({
|
|
11229
|
+
attribute: "response",
|
|
11230
|
+
reflect: false,
|
|
11231
|
+
converter: {
|
|
11232
|
+
fromAttribute: (value) => {
|
|
11233
|
+
const parsed = parseResponseAttribute(value);
|
|
11234
|
+
if (parsed === null)
|
|
11235
|
+
return null;
|
|
11236
|
+
return Array.isArray(parsed) ? parsed : [parsed];
|
|
11237
|
+
},
|
|
11238
|
+
toAttribute: (value) => serializeResponseAttribute(value)
|
|
11239
|
+
}
|
|
11240
|
+
})
|
|
11241
|
+
], QtiPositionObjectInteraction.prototype, "response", void 0);
|
|
11242
|
+
__decorate26([
|
|
11243
|
+
state15()
|
|
11244
|
+
], QtiPositionObjectInteraction.prototype, "_layout", void 0);
|
|
11245
|
+
__decorate26([
|
|
11246
|
+
state15()
|
|
11247
|
+
], QtiPositionObjectInteraction.prototype, "_drag", void 0);
|
|
11248
|
+
__decorate26([
|
|
11249
|
+
state15()
|
|
11250
|
+
], QtiPositionObjectInteraction.prototype, "_armed", void 0);
|
|
11251
|
+
__decorate26([
|
|
11252
|
+
watch("response")
|
|
11253
|
+
], QtiPositionObjectInteraction.prototype, "_handleResponseChange", void 0);
|
|
10306
11254
|
|
|
10307
11255
|
// ../interactions/position-object-interaction/dist/qti-position-object-stage.js
|
|
10308
|
-
import { LitElement as
|
|
11256
|
+
import { LitElement as LitElement12, html as html28 } from "lit";
|
|
10309
11257
|
|
|
10310
11258
|
// ../interactions/position-object-interaction/dist/qti-position-object-stage.styles.js
|
|
10311
11259
|
import { css as css29 } from "lit";
|
|
10312
11260
|
var qti_position_object_stage_styles_default = [
|
|
10313
11261
|
boxSizing,
|
|
10314
11262
|
css29`
|
|
11263
|
+
/* The containing block of every placed copy. */
|
|
10315
11264
|
:host {
|
|
10316
11265
|
display: inline-block;
|
|
10317
11266
|
position: relative;
|
|
10318
11267
|
}
|
|
11268
|
+
::slotted(img),
|
|
11269
|
+
::slotted(picture) {
|
|
11270
|
+
display: block;
|
|
11271
|
+
max-width: 100%;
|
|
11272
|
+
height: auto;
|
|
11273
|
+
user-select: none;
|
|
11274
|
+
}
|
|
10319
11275
|
`
|
|
10320
11276
|
];
|
|
10321
11277
|
|
|
10322
11278
|
// ../interactions/position-object-interaction/dist/qti-position-object-stage.js
|
|
10323
|
-
var QtiPositionObjectStage = class extends
|
|
11279
|
+
var QtiPositionObjectStage = class extends LitElement12 {
|
|
10324
11280
|
static {
|
|
10325
11281
|
this.styles = qti_position_object_stage_styles_default;
|
|
10326
11282
|
}
|
|
10327
11283
|
render() {
|
|
10328
11284
|
return html28`<slot></slot>`;
|
|
10329
11285
|
}
|
|
10330
|
-
constructor() {
|
|
10331
|
-
super();
|
|
10332
|
-
this.removeMoveListener = this.removeMoveListener.bind(this);
|
|
10333
|
-
this.dragElementHandler = this.dragElementHandler.bind(this);
|
|
10334
|
-
}
|
|
10335
|
-
// Define a function to handle the mousemove event on the draggable element
|
|
10336
|
-
dragElementHandler(event) {
|
|
10337
|
-
event.preventDefault();
|
|
10338
|
-
const deltaX = event.clientX - this.startX;
|
|
10339
|
-
const deltaY = event.clientY - this.startY;
|
|
10340
|
-
this.dragElement.style.left = this.dragElement.offsetLeft + deltaX + "px";
|
|
10341
|
-
this.dragElement.style.top = this.dragElement.offsetTop + deltaY + "px";
|
|
10342
|
-
this.startX = event.clientX;
|
|
10343
|
-
this.startY = event.clientY;
|
|
10344
|
-
}
|
|
10345
|
-
firstUpdated(a) {
|
|
10346
|
-
super.firstUpdated(a);
|
|
10347
|
-
this.dragElement = this.querySelector("qti-position-object-interaction>img");
|
|
10348
|
-
this.startX = 0;
|
|
10349
|
-
this.startY = 0;
|
|
10350
|
-
this.dragElement.addEventListener("mousedown", (event) => {
|
|
10351
|
-
this.startX = event.clientX;
|
|
10352
|
-
this.startY = event.clientY;
|
|
10353
|
-
document.addEventListener("mousemove", this.dragElementHandler, true);
|
|
10354
|
-
});
|
|
10355
|
-
document.addEventListener("mouseup", this.removeMoveListener);
|
|
10356
|
-
}
|
|
10357
|
-
removeMoveListener() {
|
|
10358
|
-
document.removeEventListener("mousemove", this.dragElementHandler, true);
|
|
10359
|
-
}
|
|
10360
|
-
disconnectedCallback() {
|
|
10361
|
-
super.disconnectedCallback();
|
|
10362
|
-
document.removeEventListener("mousemove", this.dragElementHandler);
|
|
10363
|
-
document.removeEventListener("mouseup", this.removeMoveListener);
|
|
10364
|
-
}
|
|
10365
11286
|
};
|
|
10366
11287
|
|
|
10367
11288
|
// ../interactions/select-point-interaction/dist/qti-select-point-interaction.js
|
|
10368
|
-
import { html as html29, nothing as
|
|
10369
|
-
import { property as
|
|
10370
|
-
import { repeat as
|
|
10371
|
-
import { styleMap } from "lit/directives/style-map.js";
|
|
11289
|
+
import { html as html29, nothing as nothing5 } from "lit";
|
|
11290
|
+
import { property as property25, state as state16 } from "lit/decorators.js";
|
|
11291
|
+
import { repeat as repeat8 } from "lit/directives/repeat.js";
|
|
11292
|
+
import { styleMap as styleMap2 } from "lit/directives/style-map.js";
|
|
10372
11293
|
|
|
10373
11294
|
// ../interactions/select-point-interaction/dist/qti-select-point-interaction.styles.js
|
|
10374
11295
|
import { css as css30 } from "lit";
|
|
@@ -10378,8 +11299,17 @@ var qti_select_point_interaction_styles_default = [
|
|
|
10378
11299
|
:host {
|
|
10379
11300
|
display: block;
|
|
10380
11301
|
--qti-select-point-marker-size: 1.5rem;
|
|
10381
|
-
|
|
10382
|
-
|
|
11302
|
+
/* Where the marker's shape points: -100% stands it on the point by its bottom (a pin's tip),
|
|
11303
|
+
-50% centres it (a ring, a star). A theme that changes the shape sets --qc-marker-anchor. */
|
|
11304
|
+
--qti-select-point-marker-anchor: var(--qc-marker-anchor, var(--cito-marker-anchor, -100%));
|
|
11305
|
+
/* The marker's shape: a pin by default, or the theme's --qc-icon-marker (a mask). */
|
|
11306
|
+
--qti-select-point-icon: var(
|
|
11307
|
+
--qc-icon-marker,
|
|
11308
|
+
var(
|
|
11309
|
+
--cito-icon-marker,
|
|
11310
|
+
url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 384 512'%3E%3Cpath d='M172.268 501.67C26.97 291.031 0 269.413 0 192 0 85.961 85.961 0 192 0s192 85.961 192 192c0 77.413-26.97 99.031-172.268 309.67-9.535 13.774-29.93 13.773-39.464 0zM192 272c44.183 0 80-35.817 80-80s-35.817-80-80-80-80 35.817-80 80 35.817 80 80 80z'/%3E%3C/svg%3E")
|
|
11311
|
+
)
|
|
11312
|
+
);
|
|
10383
11313
|
}
|
|
10384
11314
|
point-container {
|
|
10385
11315
|
display: block;
|
|
@@ -10405,6 +11335,26 @@ var qti_select_point_interaction_styles_default = [
|
|
|
10405
11335
|
background: transparent;
|
|
10406
11336
|
color: inherit;
|
|
10407
11337
|
cursor: pointer;
|
|
11338
|
+
|
|
11339
|
+
/*
|
|
11340
|
+
* A halo round the marker, so it stands out on any picture: white round a dark marker, black
|
|
11341
|
+
* round a light one. Derived from the marker colour by its lightness (relative colour
|
|
11342
|
+
* syntax), so setting one colour sets both; --qti-select-point-halo overrides it.
|
|
11343
|
+
*
|
|
11344
|
+
* The halo is two drop-shadows on this element, which hug the shape drawn by ::before. It
|
|
11345
|
+
* cannot sit on the masked shape itself: a mask clips its own element's filter away.
|
|
11346
|
+
*/
|
|
11347
|
+
--qti-select-point-halo-auto: oklch(
|
|
11348
|
+
from var(--qti-select-point-marker-color, currentColor) clamp(0, (0.7 - l) * 1000, 1) 0 0
|
|
11349
|
+
);
|
|
11350
|
+
filter: drop-shadow(0 0 1px var(--qti-select-point-halo, var(--qti-select-point-halo-auto)))
|
|
11351
|
+
drop-shadow(0 0 1px var(--qti-select-point-halo, var(--qti-select-point-halo-auto)));
|
|
11352
|
+
}
|
|
11353
|
+
|
|
11354
|
+
[part~='point']::before {
|
|
11355
|
+
content: '';
|
|
11356
|
+
position: absolute;
|
|
11357
|
+
inset: 0;
|
|
10408
11358
|
background-color: var(--qti-select-point-marker-color, currentColor);
|
|
10409
11359
|
-webkit-mask: var(--qti-select-point-icon) no-repeat center / contain;
|
|
10410
11360
|
mask: var(--qti-select-point-icon) no-repeat center / contain;
|
|
@@ -10413,7 +11363,7 @@ var qti_select_point_interaction_styles_default = [
|
|
|
10413
11363
|
];
|
|
10414
11364
|
|
|
10415
11365
|
// ../interactions/select-point-interaction/dist/qti-select-point-interaction.js
|
|
10416
|
-
var
|
|
11366
|
+
var __decorate27 = function(decorators, target, key, desc) {
|
|
10417
11367
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10418
11368
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
10419
11369
|
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;
|
|
@@ -10427,6 +11377,10 @@ var QtiSelectPointInteraction = class extends Interaction {
|
|
|
10427
11377
|
this.response = null;
|
|
10428
11378
|
this.areaMappings = null;
|
|
10429
11379
|
this._areaEntries = [];
|
|
11380
|
+
this._handleResponseChange = () => {
|
|
11381
|
+
this._internals.setFormValue(serializeResponseAttribute(this.response) || null);
|
|
11382
|
+
this.validate();
|
|
11383
|
+
};
|
|
10430
11384
|
this._handleAreaMappingsChange = () => {
|
|
10431
11385
|
this.#syncAreaEntriesFromAttribute();
|
|
10432
11386
|
};
|
|
@@ -10457,6 +11411,8 @@ var QtiSelectPointInteraction = class extends Interaction {
|
|
|
10457
11411
|
}
|
|
10458
11412
|
}
|
|
10459
11413
|
this.saveResponse(this.response);
|
|
11414
|
+
this.validate();
|
|
11415
|
+
this.reportValidity({ trigger: "change" });
|
|
10460
11416
|
};
|
|
10461
11417
|
this.#onResize = () => {
|
|
10462
11418
|
this.#calculateScale();
|
|
@@ -10515,7 +11471,7 @@ var QtiSelectPointInteraction = class extends Interaction {
|
|
|
10515
11471
|
}
|
|
10516
11472
|
/** Extension hook for optional layers rendered above the response points. */
|
|
10517
11473
|
renderSupplementalLayer() {
|
|
10518
|
-
return
|
|
11474
|
+
return nothing5;
|
|
10519
11475
|
}
|
|
10520
11476
|
/** Positions overlay elements that carry `data-coord` and `data-shape`. */
|
|
10521
11477
|
positionOverlayElements(elements32) {
|
|
@@ -10536,14 +11492,14 @@ var QtiSelectPointInteraction = class extends Interaction {
|
|
|
10536
11492
|
const responseList = Array.isArray(rawResponse) ? rawResponse : rawResponse ? [rawResponse] : [];
|
|
10537
11493
|
return html29` <slot name="prompt"></slot>
|
|
10538
11494
|
<point-container>
|
|
10539
|
-
${
|
|
11495
|
+
${repeat8(responseList.filter((point) => point), (point) => point, (point, index) => {
|
|
10540
11496
|
const [x, y] = point.split(" ").map(Number);
|
|
10541
11497
|
const leftPercentage = x / (this.#imageWidthOriginal || 1) * 100;
|
|
10542
11498
|
const topPercentage = y / (this.#imageHeightOriginal || 1) * 100;
|
|
10543
11499
|
return html29`
|
|
10544
11500
|
<button
|
|
10545
11501
|
part=${this.pointPart(point, index)}
|
|
10546
|
-
style=${
|
|
11502
|
+
style=${styleMap2({
|
|
10547
11503
|
pointerEvents: this.maxChoices === 1 ? "none" : "auto",
|
|
10548
11504
|
position: "absolute",
|
|
10549
11505
|
left: `${leftPercentage}%`,
|
|
@@ -10555,13 +11511,16 @@ var QtiSelectPointInteraction = class extends Interaction {
|
|
|
10555
11511
|
e.stopPropagation();
|
|
10556
11512
|
this.response = (this.response || []).filter((_, i) => i !== index);
|
|
10557
11513
|
this.saveResponse(this.response);
|
|
11514
|
+
this.validate();
|
|
11515
|
+
this.reportValidity({ trigger: "change" });
|
|
10558
11516
|
}}
|
|
10559
11517
|
></button>
|
|
10560
11518
|
`;
|
|
10561
11519
|
})}
|
|
10562
11520
|
${this.renderSupplementalLayer()}
|
|
10563
11521
|
<slot></slot>
|
|
10564
|
-
</point-container
|
|
11522
|
+
</point-container>
|
|
11523
|
+
<div part="message" role="alert" id="validation-message" style="display:none;"></div>`;
|
|
10565
11524
|
}
|
|
10566
11525
|
validate() {
|
|
10567
11526
|
const selectedCount = this.response?.length ?? 0;
|
|
@@ -10569,18 +11528,21 @@ var QtiSelectPointInteraction = class extends Interaction {
|
|
|
10569
11528
|
const belowMin = selectedCount < this.minChoices;
|
|
10570
11529
|
let isValid = true;
|
|
10571
11530
|
let validityMessage = "";
|
|
11531
|
+
let kind = "other";
|
|
10572
11532
|
if (exceedsMax) {
|
|
10573
11533
|
isValid = false;
|
|
11534
|
+
kind = "max";
|
|
10574
11535
|
validityMessage = this.dataset.maxSelectionsMessage || `Please select no more than ${this.maxChoices} ${this.maxChoices === 1 ? "point" : "points"}.`;
|
|
10575
11536
|
} else if (belowMin) {
|
|
10576
11537
|
isValid = false;
|
|
11538
|
+
kind = "min";
|
|
10577
11539
|
validityMessage = this.dataset.minSelectionsMessage || `Please select at least ${this.minChoices} ${this.minChoices === 1 ? "point" : "points"}.`;
|
|
10578
11540
|
}
|
|
10579
|
-
this.setInteractionValidity(isValid, validityMessage, this.#imgElement ?? this, { suppressInline: true });
|
|
11541
|
+
this.setInteractionValidity(isValid, validityMessage, this.#imgElement ?? this, { suppressInline: true, kind });
|
|
10580
11542
|
return isValid;
|
|
10581
11543
|
}
|
|
10582
|
-
reportValidity() {
|
|
10583
|
-
return super.reportValidity();
|
|
11544
|
+
reportValidity(options) {
|
|
11545
|
+
return super.reportValidity(options);
|
|
10584
11546
|
}
|
|
10585
11547
|
#calculateScale() {
|
|
10586
11548
|
this.#imageWidthOriginal = this.#imgElement.getAttribute("width") ? parseFloat(this.#imgElement.getAttribute("width")) : this.#imgElement.naturalWidth;
|
|
@@ -10594,6 +11556,7 @@ var QtiSelectPointInteraction = class extends Interaction {
|
|
|
10594
11556
|
this.#imgElement = this.querySelector("img");
|
|
10595
11557
|
if (this.#imgElement) {
|
|
10596
11558
|
this.#calculateScale();
|
|
11559
|
+
this.requestUpdate();
|
|
10597
11560
|
this.#imgElement.addEventListener("click", this.#onImageClick);
|
|
10598
11561
|
} else {
|
|
10599
11562
|
console.warn("No <img> element found in <qti-select-point-interaction>");
|
|
@@ -10607,20 +11570,20 @@ var QtiSelectPointInteraction = class extends Interaction {
|
|
|
10607
11570
|
}
|
|
10608
11571
|
}
|
|
10609
11572
|
};
|
|
10610
|
-
|
|
10611
|
-
|
|
11573
|
+
__decorate27([
|
|
11574
|
+
property25({
|
|
10612
11575
|
type: Number,
|
|
10613
11576
|
attribute: "max-choices"
|
|
10614
11577
|
})
|
|
10615
11578
|
], QtiSelectPointInteraction.prototype, "maxChoices", void 0);
|
|
10616
|
-
|
|
10617
|
-
|
|
11579
|
+
__decorate27([
|
|
11580
|
+
property25({
|
|
10618
11581
|
type: Number,
|
|
10619
11582
|
attribute: "min-choices"
|
|
10620
11583
|
})
|
|
10621
11584
|
], QtiSelectPointInteraction.prototype, "minChoices", void 0);
|
|
10622
|
-
|
|
10623
|
-
|
|
11585
|
+
__decorate27([
|
|
11586
|
+
property25({
|
|
10624
11587
|
attribute: "response",
|
|
10625
11588
|
reflect: false,
|
|
10626
11589
|
converter: {
|
|
@@ -10636,19 +11599,22 @@ __decorate25([
|
|
|
10636
11599
|
}
|
|
10637
11600
|
})
|
|
10638
11601
|
], QtiSelectPointInteraction.prototype, "response", void 0);
|
|
10639
|
-
|
|
10640
|
-
|
|
11602
|
+
__decorate27([
|
|
11603
|
+
property25({ attribute: "area-mappings" })
|
|
10641
11604
|
], QtiSelectPointInteraction.prototype, "areaMappings", void 0);
|
|
10642
|
-
|
|
10643
|
-
|
|
11605
|
+
__decorate27([
|
|
11606
|
+
state16()
|
|
10644
11607
|
], QtiSelectPointInteraction.prototype, "_areaEntries", void 0);
|
|
10645
|
-
|
|
11608
|
+
__decorate27([
|
|
11609
|
+
watch("response")
|
|
11610
|
+
], QtiSelectPointInteraction.prototype, "_handleResponseChange", void 0);
|
|
11611
|
+
__decorate27([
|
|
10646
11612
|
watch("areaMappings")
|
|
10647
11613
|
], QtiSelectPointInteraction.prototype, "_handleAreaMappingsChange", void 0);
|
|
10648
11614
|
|
|
10649
11615
|
// ../interactions/slider-interaction/dist/qti-slider-interaction.js
|
|
10650
|
-
import { html as html30, nothing as
|
|
10651
|
-
import { property as
|
|
11616
|
+
import { html as html30, nothing as nothing6 } from "lit";
|
|
11617
|
+
import { property as property26, query as query2 } from "lit/decorators.js";
|
|
10652
11618
|
|
|
10653
11619
|
// ../interactions/slider-interaction/dist/qti-slider-interaction.styles.js
|
|
10654
11620
|
import { css as css31 } from "lit";
|
|
@@ -10726,7 +11692,7 @@ var qti_slider_interaction_styles_default = [
|
|
|
10726
11692
|
];
|
|
10727
11693
|
|
|
10728
11694
|
// ../interactions/slider-interaction/dist/qti-slider-interaction.js
|
|
10729
|
-
var
|
|
11695
|
+
var __decorate28 = function(decorators, target, key, desc) {
|
|
10730
11696
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10731
11697
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
10732
11698
|
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;
|
|
@@ -10781,7 +11747,7 @@ var QtiSliderInteraction = class extends Interaction {
|
|
|
10781
11747
|
}
|
|
10782
11748
|
/** Extension hook for optional content rendered on the slider rail. */
|
|
10783
11749
|
renderRailSupplement() {
|
|
10784
|
-
return
|
|
11750
|
+
return nothing6;
|
|
10785
11751
|
}
|
|
10786
11752
|
/** Moves the knob to `newValue`, clamped to the bounds, or empties the slider. Returns whether it moved. */
|
|
10787
11753
|
#show(newValue) {
|
|
@@ -10822,7 +11788,7 @@ var QtiSliderInteraction = class extends Interaction {
|
|
|
10822
11788
|
|
|
10823
11789
|
<div id="rail" part="rail" @mousedown=${this.#onMouseDown} @touchstart=${this.#onTouchStart}>
|
|
10824
11790
|
<div id="knob" part="knob">
|
|
10825
|
-
${this.#value === null ?
|
|
11791
|
+
${this.#value === null ? nothing6 : html30`<div id="value" part="value">${this.#value}</div>`}
|
|
10826
11792
|
</div>
|
|
10827
11793
|
|
|
10828
11794
|
${this.renderRailSupplement()}
|
|
@@ -10866,26 +11832,26 @@ var QtiSliderInteraction = class extends Interaction {
|
|
|
10866
11832
|
this.dispatchEvent(new Event("change", { bubbles: true }));
|
|
10867
11833
|
}
|
|
10868
11834
|
};
|
|
10869
|
-
|
|
11835
|
+
__decorate28([
|
|
10870
11836
|
query2("#rail")
|
|
10871
11837
|
], QtiSliderInteraction.prototype, "_rail", void 0);
|
|
10872
|
-
|
|
10873
|
-
|
|
11838
|
+
__decorate28([
|
|
11839
|
+
property26({ type: Number, attribute: "lower-bound" })
|
|
10874
11840
|
], QtiSliderInteraction.prototype, "min", void 0);
|
|
10875
|
-
|
|
10876
|
-
|
|
11841
|
+
__decorate28([
|
|
11842
|
+
property26({ type: Number, attribute: "upper-bound" })
|
|
10877
11843
|
], QtiSliderInteraction.prototype, "max", void 0);
|
|
10878
|
-
|
|
10879
|
-
|
|
11844
|
+
__decorate28([
|
|
11845
|
+
property26({ type: Number, attribute: "step" })
|
|
10880
11846
|
], QtiSliderInteraction.prototype, "step", void 0);
|
|
10881
|
-
|
|
10882
|
-
|
|
11847
|
+
__decorate28([
|
|
11848
|
+
property26({ attribute: "response", reflect: false, noAccessor: true })
|
|
10883
11849
|
], QtiSliderInteraction.prototype, "response", null);
|
|
10884
11850
|
|
|
10885
11851
|
// ../interactions/text-entry-interaction/dist/qti-text-entry-interaction.js
|
|
10886
11852
|
import { html as html31 } from "lit";
|
|
10887
|
-
import { property as
|
|
10888
|
-
import { ifDefined as
|
|
11853
|
+
import { property as property27, query as query3 } from "lit/decorators.js";
|
|
11854
|
+
import { ifDefined as ifDefined4 } from "lit/directives/if-defined.js";
|
|
10889
11855
|
import { createRef } from "lit/directives/ref.js";
|
|
10890
11856
|
|
|
10891
11857
|
// ../interactions/text-entry-interaction/dist/qti-text-entry-interaction.styles.js
|
|
@@ -10985,7 +11951,7 @@ var qti_text_entry_interaction_styles_default = [
|
|
|
10985
11951
|
];
|
|
10986
11952
|
|
|
10987
11953
|
// ../interactions/text-entry-interaction/dist/qti-text-entry-interaction.js
|
|
10988
|
-
var
|
|
11954
|
+
var __decorate29 = function(decorators, target, key, desc) {
|
|
10989
11955
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10990
11956
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
10991
11957
|
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;
|
|
@@ -11028,13 +11994,15 @@ var QtiTextEntryInteraction = class extends Interaction {
|
|
|
11028
11994
|
} else {
|
|
11029
11995
|
isValid = this._input.checkValidity();
|
|
11030
11996
|
}
|
|
11997
|
+
let kind = "other";
|
|
11031
11998
|
if (isValid && this.response === "") {
|
|
11032
11999
|
isValid = false;
|
|
12000
|
+
kind = "min";
|
|
11033
12001
|
}
|
|
11034
12002
|
if (!isValid && !validityMessage) {
|
|
11035
12003
|
validityMessage = this._input.validationMessage || "Invalid value.";
|
|
11036
12004
|
}
|
|
11037
|
-
this.setInteractionValidity(isValid, validityMessage, this._input, { suppressInline: true });
|
|
12005
|
+
this.setInteractionValidity(isValid, validityMessage, this._input, { suppressInline: true, kind });
|
|
11038
12006
|
return isValid;
|
|
11039
12007
|
}
|
|
11040
12008
|
/*
|
|
@@ -11044,7 +12012,7 @@ var QtiTextEntryInteraction = class extends Interaction {
|
|
|
11044
12012
|
*/
|
|
11045
12013
|
/** The answer-key line, revealed above the field when the correct response is shown. */
|
|
11046
12014
|
renderAnswer() {
|
|
11047
|
-
return html31`<div part="answer" aria-hidden="true"></div>`;
|
|
12015
|
+
return html31`<div part="answer-key answer" aria-hidden="true"></div>`;
|
|
11048
12016
|
}
|
|
11049
12017
|
/** The field itself. */
|
|
11050
12018
|
renderInput() {
|
|
@@ -11054,15 +12022,15 @@ var QtiTextEntryInteraction = class extends Interaction {
|
|
|
11054
12022
|
spellcheck="false"
|
|
11055
12023
|
autocomplete="off"
|
|
11056
12024
|
@blur="${(_) => {
|
|
11057
|
-
this.reportValidity();
|
|
12025
|
+
this.reportValidity({ trigger: "change" });
|
|
11058
12026
|
}}"
|
|
11059
12027
|
@keydown="${(event) => event.stopImmediatePropagation()}"
|
|
11060
12028
|
@keyup="${this.textChanged}"
|
|
11061
12029
|
@change="${this.textChanged}"
|
|
11062
12030
|
type="${this.patternMask == "[0-9]*" ? "number" : "text"}"
|
|
11063
|
-
placeholder="${
|
|
12031
|
+
placeholder="${ifDefined4(this.placeholderText ? this.placeholderText : void 0)}"
|
|
11064
12032
|
.value="${this.response}"
|
|
11065
|
-
pattern="${
|
|
12033
|
+
pattern="${ifDefined4(this.patternMask ? this.patternMask : void 0)}"
|
|
11066
12034
|
maxlength=${1e3}
|
|
11067
12035
|
?disabled="${this.disabled}"
|
|
11068
12036
|
?readonly="${this.readonly}"
|
|
@@ -11084,33 +12052,33 @@ var QtiTextEntryInteraction = class extends Interaction {
|
|
|
11084
12052
|
this.saveResponse(input.value);
|
|
11085
12053
|
}
|
|
11086
12054
|
}
|
|
11087
|
-
reportValidity() {
|
|
12055
|
+
reportValidity(options) {
|
|
11088
12056
|
this.validate();
|
|
11089
|
-
return super.reportValidity();
|
|
12057
|
+
return super.reportValidity(options);
|
|
11090
12058
|
}
|
|
11091
12059
|
reset() {
|
|
11092
12060
|
this.response = "";
|
|
11093
12061
|
}
|
|
11094
12062
|
};
|
|
11095
|
-
|
|
11096
|
-
|
|
12063
|
+
__decorate29([
|
|
12064
|
+
property27({ type: Number, attribute: "expected-length" })
|
|
11097
12065
|
], QtiTextEntryInteraction.prototype, "expectedLength", void 0);
|
|
11098
|
-
|
|
11099
|
-
|
|
12066
|
+
__decorate29([
|
|
12067
|
+
property27({ type: String, attribute: "pattern-mask" })
|
|
11100
12068
|
], QtiTextEntryInteraction.prototype, "patternMask", void 0);
|
|
11101
|
-
|
|
11102
|
-
|
|
12069
|
+
__decorate29([
|
|
12070
|
+
property27({ type: String, attribute: "placeholder-text" })
|
|
11103
12071
|
], QtiTextEntryInteraction.prototype, "placeholderText", void 0);
|
|
11104
|
-
|
|
11105
|
-
|
|
12072
|
+
__decorate29([
|
|
12073
|
+
property27({ type: String, attribute: "data-patternmask-message" })
|
|
11106
12074
|
], QtiTextEntryInteraction.prototype, "dataPatternmaskMessage", void 0);
|
|
11107
|
-
|
|
11108
|
-
|
|
12075
|
+
__decorate29([
|
|
12076
|
+
property27({ type: String, attribute: "response", reflect: false })
|
|
11109
12077
|
], QtiTextEntryInteraction.prototype, "response", void 0);
|
|
11110
|
-
|
|
12078
|
+
__decorate29([
|
|
11111
12079
|
query3("input")
|
|
11112
12080
|
], QtiTextEntryInteraction.prototype, "_input", void 0);
|
|
11113
|
-
|
|
12081
|
+
__decorate29([
|
|
11114
12082
|
watch("response", { waitUntilFirstUpdate: true })
|
|
11115
12083
|
], QtiTextEntryInteraction.prototype, "_handleValueChange", void 0);
|
|
11116
12084
|
|
|
@@ -11141,8 +12109,10 @@ var QtiUploadInteraction = class extends Interaction {
|
|
|
11141
12109
|
#file = null;
|
|
11142
12110
|
#base64 = null;
|
|
11143
12111
|
reset() {
|
|
12112
|
+
this.resetValidityReport();
|
|
11144
12113
|
this.#file = null;
|
|
11145
12114
|
this.#base64 = null;
|
|
12115
|
+
this._internals.setFormValue(null);
|
|
11146
12116
|
this.saveResponse(null);
|
|
11147
12117
|
}
|
|
11148
12118
|
validate() {
|
|
@@ -11154,6 +12124,7 @@ var QtiUploadInteraction = class extends Interaction {
|
|
|
11154
12124
|
set response(base64) {
|
|
11155
12125
|
if (typeof base64 === "string") {
|
|
11156
12126
|
this.#base64 = base64;
|
|
12127
|
+
this._internals.setFormValue(base64);
|
|
11157
12128
|
this.saveResponse(base64);
|
|
11158
12129
|
} else if (base64 === null) {
|
|
11159
12130
|
this.reset();
|
|
@@ -11170,7 +12141,13 @@ var QtiUploadInteraction = class extends Interaction {
|
|
|
11170
12141
|
return html32`
|
|
11171
12142
|
<div>
|
|
11172
12143
|
<slot name="prompt"></slot>
|
|
11173
|
-
<input
|
|
12144
|
+
<input
|
|
12145
|
+
type="file"
|
|
12146
|
+
part="input"
|
|
12147
|
+
@change="${this.#onFileChange}"
|
|
12148
|
+
?disabled="${this.disabled}"
|
|
12149
|
+
?readonly="${this.readonly}"
|
|
12150
|
+
/>
|
|
11174
12151
|
</div>
|
|
11175
12152
|
`;
|
|
11176
12153
|
}
|
|
@@ -11179,6 +12156,7 @@ var QtiUploadInteraction = class extends Interaction {
|
|
|
11179
12156
|
if (input.files && input.files.length > 0) {
|
|
11180
12157
|
this.#file = input.files[0];
|
|
11181
12158
|
this.#base64 = await this.#convertToBase64(this.#file);
|
|
12159
|
+
this._internals.setFormValue(this.#base64);
|
|
11182
12160
|
this.saveResponse(this.#base64);
|
|
11183
12161
|
this.dispatchEvent(new CustomEvent("qti-interaction-response", {
|
|
11184
12162
|
detail: { response: this.#base64 }
|
|
@@ -11819,6 +12797,8 @@ export {
|
|
|
11819
12797
|
elements24 as elements14,
|
|
11820
12798
|
QtiOrderInteraction,
|
|
11821
12799
|
elements25 as elements15,
|
|
12800
|
+
inlineScriptText,
|
|
12801
|
+
inlineStyleText,
|
|
11822
12802
|
QtiPortableCustomInteraction,
|
|
11823
12803
|
elements26 as elements16,
|
|
11824
12804
|
QtiPositionObjectInteraction,
|
|
@@ -11834,4 +12814,4 @@ export {
|
|
|
11834
12814
|
elements31 as elements21,
|
|
11835
12815
|
qtiInteractionElements
|
|
11836
12816
|
};
|
|
11837
|
-
//# sourceMappingURL=chunk-
|
|
12817
|
+
//# sourceMappingURL=chunk-TZCOXFPB.js.map
|