@pie-element/multiple-choice 13.3.5-next.6 → 13.3.5-next.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/{Radio-xWBQ-YBe.js → Radio-B-Cd30zs.js} +2101 -2099
- package/dist/browser/Radio-B-Cd30zs.js.map +1 -0
- package/dist/browser/author/index.js +27056 -34565
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/delivery/index.js +77 -27
- package/dist/browser/delivery/index.js.map +1 -1
- package/dist/browser/{main-wyY_k9tD.js → main-CSCv3-uB.js} +2 -2
- package/dist/browser/{main-wyY_k9tD.js.map → main-CSCv3-uB.js.map} +1 -1
- package/dist/browser/print/index.js +2 -2
- package/dist/delivery/index.js +21 -21
- package/dist/index.iife.js +21 -21
- package/module/print.js +3411 -3409
- package/module/print.js.map +1 -1
- package/package.json +6 -6
- package/dist/browser/Radio-xWBQ-YBe.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as e, M as t, Vt as n } from "../Radio-
|
|
2
|
-
import { t as r } from "../main-
|
|
1
|
+
import { F as e, M as t, Vt as n } from "../Radio-B-Cd30zs.js";
|
|
2
|
+
import { t as r } from "../main-CSCv3-uB.js";
|
|
3
3
|
import { c as i, l as a } from "../dist-CHbLnyuX.js";
|
|
4
4
|
import o from "react";
|
|
5
5
|
import { createRoot as s } from "react-dom/client";
|
package/dist/delivery/index.js
CHANGED
|
@@ -7,16 +7,16 @@ import { EnableAudioAutoplayImage as o } from "@pie-lib/render-ui";
|
|
|
7
7
|
import { createRoot as s } from "react-dom/client";
|
|
8
8
|
import { debounce as c } from "@pie-element/shared-lodash";
|
|
9
9
|
import l from "debug";
|
|
10
|
-
import { ModelSetEvent as u, SessionChangedEvent as d } from "@pie-element/shared-player-events";
|
|
11
|
-
import { renderMath as
|
|
10
|
+
import { ModelSetEvent as u, SessionChangedEvent as d, createSessionNotifier as f, flushSessionNotifiers as p } from "@pie-element/shared-player-events";
|
|
11
|
+
import { renderMath as m } from "@pie-element/shared-math-rendering-mathjax";
|
|
12
12
|
//#region src/delivery/index.ts
|
|
13
|
-
function
|
|
13
|
+
function h(e) {
|
|
14
14
|
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
return !e ||
|
|
16
|
+
function g(e, t) {
|
|
17
|
+
return !e || h(e) ? e : h(e.default) ? e.default : t && h(e[t]) ? e[t] : t && h(e[t]?.default) ? e[t].default : e;
|
|
18
18
|
}
|
|
19
|
-
var
|
|
19
|
+
var _ = g(o, "EnableAudioAutoplayImage") || g(b.EnableAudioAutoplayImage, "EnableAudioAutoplayImage"), v = a, y = v.default, b = y && typeof y == "object" ? y : v, x = l("pie-ui:multiple-choice"), S = (t, n, r, i) => {
|
|
20
20
|
let { autoplayAudioEnabled: a, completeAudioEnabled: o } = n || {};
|
|
21
21
|
if (a && o && !r && i) {
|
|
22
22
|
let e = i.querySelector("audio"), t = e && e.closest(".preview-prompt");
|
|
@@ -26,7 +26,7 @@ var h = m(o, "EnableAudioAutoplayImage") || m(v.EnableAudioAutoplayImage, "Enabl
|
|
|
26
26
|
let { choiceMode: s, minSelections: c = 1, maxSelections: l } = n || {}, u = t.value.length || 0;
|
|
27
27
|
return s === "radio" ? !!u : !(u < c || e(u, l));
|
|
28
28
|
};
|
|
29
|
-
function
|
|
29
|
+
function C(e) {
|
|
30
30
|
let t = e.closest("pie-player") || e.closest("pie-item-player");
|
|
31
31
|
if (!t) return {
|
|
32
32
|
baseHeadingLevel: void 0,
|
|
@@ -41,14 +41,14 @@ function x(e) {
|
|
|
41
41
|
includeSrHeading: o == null || o !== !1 && o !== "false"
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
let t =
|
|
44
|
+
function w(e) {
|
|
45
|
+
let t = C(e);
|
|
46
46
|
return {
|
|
47
47
|
baseHeadingLevel: e._baseHeadingLevel === void 0 ? t.baseHeadingLevel : e._baseHeadingLevel,
|
|
48
48
|
includeSrHeading: e._includeSrHeading === void 0 ? t.includeSrHeading : e._includeSrHeading
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
var
|
|
51
|
+
var T = class extends HTMLElement {
|
|
52
52
|
constructor() {
|
|
53
53
|
super(), this._model = null, this._session = null, this._options = null, this.audioComplete = !1, this._boundHandleKeyDown = this.handleKeyDown.bind(this), this._keyboardEventsEnabled = !1, this._audioInitialized = !1, this._root = null, this._mathObserver = null, this._mathRenderPending = !1, this._rerender = c(() => {
|
|
54
54
|
if (this._model && this._session) {
|
|
@@ -58,17 +58,17 @@ var C = class extends HTMLElement {
|
|
|
58
58
|
options: this._options,
|
|
59
59
|
onChoiceChanged: this._onChange.bind(this),
|
|
60
60
|
onShowCorrectToggle: this.onShowCorrectToggle.bind(this),
|
|
61
|
-
...
|
|
61
|
+
...w(this)
|
|
62
62
|
});
|
|
63
63
|
this.setAttribute("aria-label", this._model.choiceMode === "radio" ? "Multiple Choice Question" : "Multiple Correct Answer Question"), this.setAttribute("role", "region"), this.setLangAttribute(), this._initMathObserver(), this._root ||= s(this), this._root.render(e), this._model.keyboardEventsEnabled === !0 && !this._keyboardEventsEnabled && this.enableKeyboardEvents();
|
|
64
|
-
} else
|
|
64
|
+
} else x("skip");
|
|
65
65
|
}, 50, {
|
|
66
66
|
leading: !1,
|
|
67
67
|
trailing: !0
|
|
68
|
-
}), this.
|
|
69
|
-
this.dispatchEvent(new d(this.tagName.toLowerCase(),
|
|
70
|
-
}), this._dispatchModelSet = c(() => {
|
|
71
|
-
this.dispatchEvent(new u(this.tagName.toLowerCase(),
|
|
68
|
+
}), this._sessionNotifier = f(this, () => {
|
|
69
|
+
this.dispatchEvent(new d(this.tagName.toLowerCase(), S(this._session, this._model, this.audioComplete, this)));
|
|
70
|
+
}), this._dispatchResponseChanged = () => this._sessionNotifier.notify(), this._dispatchModelSet = c(() => {
|
|
71
|
+
this.dispatchEvent(new u(this.tagName.toLowerCase(), S(this._session, this._model, this.audioComplete, this), this._model !== void 0));
|
|
72
72
|
}, 50, {
|
|
73
73
|
leading: !1,
|
|
74
74
|
trailing: !0
|
|
@@ -76,7 +76,7 @@ var C = class extends HTMLElement {
|
|
|
76
76
|
}
|
|
77
77
|
_scheduleMathRender = () => {
|
|
78
78
|
this._mathRenderPending || (this._mathRenderPending = !0, requestAnimationFrame(() => {
|
|
79
|
-
this._mathObserver && this._mathObserver.disconnect(),
|
|
79
|
+
this._mathObserver && this._mathObserver.disconnect(), x("render complete - render math"), m(this), this._mathRenderPending = !1, setTimeout(() => {
|
|
80
80
|
this._mathObserver && this._mathObserver.observe(this, {
|
|
81
81
|
childList: !0,
|
|
82
82
|
subtree: !0
|
|
@@ -94,7 +94,7 @@ var C = class extends HTMLElement {
|
|
|
94
94
|
this._mathObserver &&= (this._mathObserver.disconnect(), null);
|
|
95
95
|
}
|
|
96
96
|
onShowCorrectToggle() {
|
|
97
|
-
|
|
97
|
+
m(this);
|
|
98
98
|
}
|
|
99
99
|
setLangAttribute() {
|
|
100
100
|
let e = this._model && typeof this._model.language ? this._model.language : "", t = e ? e.slice(0, 2) : "en";
|
|
@@ -139,7 +139,7 @@ var C = class extends HTMLElement {
|
|
|
139
139
|
cursor: "pointer"
|
|
140
140
|
});
|
|
141
141
|
let t = document.createElement("img");
|
|
142
|
-
return t.src =
|
|
142
|
+
return t.src = _, t.alt = "Click anywhere to enable audio autoplay", t.width = 500, t.height = 300, e.appendChild(t), e;
|
|
143
143
|
}
|
|
144
144
|
connectedCallback() {
|
|
145
145
|
this._initMathObserver(), this._initPlayerObserver(), this._rerender(), new MutationObserver((e, t) => {
|
|
@@ -192,7 +192,7 @@ var C = class extends HTMLElement {
|
|
|
192
192
|
this._playerObserver &&= (this._playerObserver.disconnect(), null);
|
|
193
193
|
}
|
|
194
194
|
disconnectedCallback() {
|
|
195
|
-
this._disconnectMathObserver(), this._disconnectPlayerObserver(), this._keyboardEventsEnabled &&= (window.removeEventListener("keydown", this._boundHandleKeyDown), !1), document.removeEventListener("click", this._enableAudio), this._audio &&= (this._audio.removeEventListener("playing", this._handlePlaying), this._audio.removeEventListener("ended", this._handleEnded), null), this._root &&= (this._root.unmount(), null);
|
|
195
|
+
p(this), this._disconnectMathObserver(), this._disconnectPlayerObserver(), this._keyboardEventsEnabled &&= (window.removeEventListener("keydown", this._boundHandleKeyDown), !1), document.removeEventListener("click", this._enableAudio), this._audio &&= (this._audio.removeEventListener("playing", this._handlePlaying), this._audio.removeEventListener("ended", this._handleEnded), null), this._root &&= (this._root.unmount(), null);
|
|
196
196
|
}
|
|
197
197
|
handleKeyDown(e) {
|
|
198
198
|
if (!this._model || !this._session) return;
|
|
@@ -212,4 +212,4 @@ var C = class extends HTMLElement {
|
|
|
212
212
|
}
|
|
213
213
|
};
|
|
214
214
|
//#endregion
|
|
215
|
-
export {
|
|
215
|
+
export { T as default, S as isComplete };
|