@pie-element/ebsr 14.2.2-next.2 → 14.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +1547 -0
- package/CHANGELOG.md +2291 -0
- package/LICENSE.md +5 -0
- package/README.md +62 -0
- package/configure/CHANGELOG.json +992 -0
- package/configure/CHANGELOG.md +2154 -0
- package/configure/lib/defaults.js +229 -0
- package/configure/lib/defaults.js.map +1 -0
- package/configure/lib/index.js +154 -0
- package/configure/lib/index.js.map +1 -0
- package/configure/lib/main.js +222 -0
- package/configure/lib/main.js.map +1 -0
- package/configure/package.json +23 -0
- package/configure/src/__tests__/index.test.js +492 -0
- package/configure/src/defaults.js +173 -0
- package/configure/src/index.js +174 -0
- package/configure/src/main.jsx +235 -0
- package/controller/CHANGELOG.json +552 -0
- package/controller/CHANGELOG.md +1286 -0
- package/controller/lib/defaults.js +31 -0
- package/controller/lib/defaults.js.map +1 -0
- package/controller/lib/index.js +448 -0
- package/controller/lib/index.js.map +1 -0
- package/controller/lib/utils.js +18 -0
- package/controller/lib/utils.js.map +1 -0
- package/controller/package.json +18 -0
- package/controller/src/__tests__/index.test.js +591 -0
- package/controller/src/__tests__/utils.test.js +48 -0
- package/controller/src/defaults.js +25 -0
- package/controller/src/index.js +442 -0
- package/controller/src/utils.js +18 -0
- package/docs/config-schema.json +5787 -0
- package/docs/config-schema.json.md +4278 -0
- package/docs/demo/config.js +8 -0
- package/docs/demo/generate.js +52 -0
- package/docs/demo/index.html +2 -0
- package/docs/demo/session.js +14 -0
- package/docs/pie-schema.json +2911 -0
- package/docs/pie-schema.json.md +2142 -0
- package/ebsr.png +0 -0
- package/lib/index.js +207 -0
- package/lib/index.js.map +1 -0
- package/lib/print.js +186 -0
- package/lib/print.js.map +1 -0
- package/module/configure.js +1 -0
- package/module/controller.js +5664 -0
- package/module/demo.js +77 -0
- package/module/element.js +1 -0
- package/module/index.html +21 -0
- package/module/manifest.json +14 -0
- package/module/print-demo.js +115 -0
- package/module/print.html +18 -0
- package/module/print.js +1 -0
- package/package.json +19 -88
- package/src/__tests__/index.test.js +129 -0
- package/src/index.js +222 -0
- package/src/print.js +207 -0
- package/configure.js +0 -2
- package/controller.js +0 -1
- package/dist/author/defaults.d.ts +0 -348
- package/dist/author/defaults.js +0 -161
- package/dist/author/index.d.ts +0 -34
- package/dist/author/index.js +0 -78
- package/dist/author/main.d.ts +0 -22
- package/dist/author/main.js +0 -121
- package/dist/browser/author/index.js +0 -13947
- package/dist/browser/author/index.js.map +0 -1
- package/dist/browser/browser-CdX8WGiZ.js +0 -207
- package/dist/browser/browser-CdX8WGiZ.js.map +0 -1
- package/dist/browser/controller/index.js +0 -257
- package/dist/browser/controller/index.js.map +0 -1
- package/dist/browser/delivery/index.js +0 -133
- package/dist/browser/delivery/index.js.map +0 -1
- package/dist/browser/dist-CaWRqnXk.js +0 -62
- package/dist/browser/dist-CaWRqnXk.js.map +0 -1
- package/dist/browser/dist-D9ARZhQk.js +0 -1426
- package/dist/browser/dist-D9ARZhQk.js.map +0 -1
- package/dist/browser/dist-DQkngCcw.js +0 -36
- package/dist/browser/dist-DQkngCcw.js.map +0 -1
- package/dist/browser/print/index.js +0 -107
- package/dist/browser/print/index.js.map +0 -1
- package/dist/controller/defaults.d.ts +0 -15
- package/dist/controller/defaults.js +0 -26
- package/dist/controller/index.d.ts +0 -42
- package/dist/controller/index.js +0 -185
- package/dist/controller/utils.d.ts +0 -10
- package/dist/controller/utils.js +0 -8
- package/dist/delivery/index.d.ts +0 -26
- package/dist/delivery/index.js +0 -132
- package/dist/index.d.ts +0 -1
- package/dist/index.iife.d.ts +0 -8
- package/dist/index.iife.js +0 -165
- package/dist/index.js +0 -2
- package/dist/print/index.d.ts +0 -25
- package/dist/print/index.js +0 -106
- package/dist/runtime-support.d.ts +0 -12
- package/dist/runtime-support.js +0 -12
package/dist/controller/index.js
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import e from "./defaults.js";
|
|
2
|
-
import { isResponseCorrect as t } from "./utils.js";
|
|
3
|
-
import { get as n, isEmpty as r } from "@pie-element/shared-lodash";
|
|
4
|
-
import { getShuffledChoices as i, lockChoices as a, partialScoring as o } from "@pie-element/shared-controller-utils";
|
|
5
|
-
import s from "@pie-lib/translator";
|
|
6
|
-
//#region src/controller/index.ts
|
|
7
|
-
var { translator: c } = s, l = (e, t, n) => (r) => {
|
|
8
|
-
let i = {
|
|
9
|
-
label: r.label,
|
|
10
|
-
value: r.value
|
|
11
|
-
};
|
|
12
|
-
if (t.role === "instructor" && (t.mode === "view" || t.mode === "evaluate") ? i.rationale = e.rationaleEnabled ? r.rationale : null : i.rationale = null, t.mode === "evaluate" && (i.correct = !!r.correct, e.feedbackEnabled)) {
|
|
13
|
-
let e = r.feedback && r.feedback.type || "none";
|
|
14
|
-
e === "default" ? i.feedback = n[r.correct ? "correct" : "incorrect"] : e === "custom" && (i.feedback = r.feedback.value);
|
|
15
|
-
}
|
|
16
|
-
return i;
|
|
17
|
-
}, u = (e, n, r, i) => {
|
|
18
|
-
let a = Object.assign({
|
|
19
|
-
correct: "Correct",
|
|
20
|
-
incorrect: "Incorrect"
|
|
21
|
-
}, e.defaultFeedback), o = e.choices ? e.choices.map(l(e, i, a)) : [];
|
|
22
|
-
return {
|
|
23
|
-
...e,
|
|
24
|
-
choices: o,
|
|
25
|
-
disabled: i.mode !== "gather",
|
|
26
|
-
complete: { min: e.choices.filter((e) => e.correct).length },
|
|
27
|
-
responseCorrect: i.mode === "evaluate" ? t(e, n, r) : void 0
|
|
28
|
-
};
|
|
29
|
-
}, d = (e, t) => ({
|
|
30
|
-
...t,
|
|
31
|
-
...e,
|
|
32
|
-
choicesLayout: e.choicesLayout || e.verticalMode === !1 && "horizontal" || "vertical"
|
|
33
|
-
}), f = ({ partA: t = {}, partB: n = {}, language: r, ...i }) => ({
|
|
34
|
-
...e,
|
|
35
|
-
...i,
|
|
36
|
-
partA: d(t, {
|
|
37
|
-
...e.partA,
|
|
38
|
-
language: r
|
|
39
|
-
}),
|
|
40
|
-
partB: d(n, {
|
|
41
|
-
...e.partB,
|
|
42
|
-
language: r
|
|
43
|
-
})
|
|
44
|
-
});
|
|
45
|
-
async function p(e, t, o, s) {
|
|
46
|
-
let l = f(e), d = u(l.partA, "partA", t, o), p = u(l.partB, "partB", t, o), m = {}, h = (e) => (t, n, r) => new Promise((t) => {
|
|
47
|
-
m[e] = r.shuffledValues, t();
|
|
48
|
-
}), g = n(t, "value.partA"), _ = a(l.partA, g, o), { choices: v } = d || {}, { choices: y } = p || {};
|
|
49
|
-
!_ && v && v.length && (d.choices = await i(v, { shuffledValues: (t.shuffledValues || {}).partA }, h("partA"), "value"));
|
|
50
|
-
let b = n(t, "value.partB");
|
|
51
|
-
if (!a(l.partB, b, o) && y && y.length && (p.choices = await i(y, { shuffledValues: (t.shuffledValues || {}).partB }, h("partB"), "value")), r(m) || s && typeof s == "function" && s(t.id, t.element, { shuffledValues: m }).catch((e) => {
|
|
52
|
-
console.error("update session failed", e);
|
|
53
|
-
}), l.partLabels) {
|
|
54
|
-
let e = l.language;
|
|
55
|
-
d.partLabel = c.t("ebsr.part", {
|
|
56
|
-
lng: e,
|
|
57
|
-
index: l.partLabelType === "Letters" ? "A" : "1"
|
|
58
|
-
}), p.partLabel = c.t("ebsr.part", {
|
|
59
|
-
lng: e,
|
|
60
|
-
index: l.partLabelType === "Letters" ? "B" : "2"
|
|
61
|
-
});
|
|
62
|
-
} else d.partLabel = void 0, p.partLabel = void 0;
|
|
63
|
-
return o.role === "instructor" && (o.mode === "view" || o.mode === "evaluate") ? (d.teacherInstructions = l.partA.teacherInstructionsEnabled ? l.partA.teacherInstructions : null, p.teacherInstructions = l.partB.teacherInstructionsEnabled ? l.partB.teacherInstructions : null) : (d.teacherInstructions = null, p.teacherInstructions = null), d.prompt = l.partA.promptEnabled ? l.partA.prompt : null, p.prompt = l.partB.promptEnabled ? l.partB.prompt : null, new Promise((e) => {
|
|
64
|
-
e({
|
|
65
|
-
disabled: o.mode !== "gather",
|
|
66
|
-
mode: o.mode,
|
|
67
|
-
extraCSSRules: l.extraCSSRules,
|
|
68
|
-
partA: d,
|
|
69
|
-
partB: p
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
var m = (t = {}) => new Promise((n) => {
|
|
74
|
-
n({
|
|
75
|
-
...e,
|
|
76
|
-
...t
|
|
77
|
-
});
|
|
78
|
-
}), h = (e) => e.correct === !0, g = (e, t, n, r) => {
|
|
79
|
-
let { choices: i = [] } = e && e[n] || {}, a = i.length, { value: o } = t || {}, s = (e) => !!(o || []).find((t) => t === e.value), c = (e) => h(e) && !s(e), l = (e) => !h(e) && s(e), u = i.reduce((e, t) => c(t) || l(t) ? e - 1 : e, i.length);
|
|
80
|
-
return !r && u < a ? 0 : parseFloat(a ? (u / a).toFixed(2) : 0);
|
|
81
|
-
}, _ = (e, t, n) => {
|
|
82
|
-
let r = [];
|
|
83
|
-
if (!t || !t.value) return r.push("Student did not answer the question."), r;
|
|
84
|
-
let { value: i } = t, { partA: a, partB: s } = i, c = o.enabled(e, n);
|
|
85
|
-
r.push(`Scoring method: ${c ? "partial scoring" : "all-or-nothing scoring"}.`);
|
|
86
|
-
let l = e.partA.choiceMode === "radio" ? "multiple-choice (radio)" : "multiple-select (checkbox)";
|
|
87
|
-
r.push(`Part A question type: ${l}.`);
|
|
88
|
-
let u = a?.value || [], d = (e.partA.choices || []).filter((e) => e.correct).map((e) => e.value), f = u.filter((e) => d.includes(e)), p = u.filter((e) => !d.includes(e));
|
|
89
|
-
u.length && r.push(`Part A: student selected ${u.length} choice(s) (${f.length} correct, ${p.length} incorrect).`);
|
|
90
|
-
let m = g(e, a, "partA", c);
|
|
91
|
-
r.push(`Part A score: ${m}.`);
|
|
92
|
-
let h = e.partB.choiceMode === "radio" ? "multiple-choice (radio)" : "multiple-select (checkbox)";
|
|
93
|
-
r.push(`Part B question type: ${h}.`);
|
|
94
|
-
let _ = s?.value || [], v = (e.partB.choices || []).filter((e) => e.correct).map((e) => e.value), y = _.filter((e) => v.includes(e)), b = _.filter((e) => !v.includes(e));
|
|
95
|
-
_.length && r.push(`Part B: student selected ${_.length} choice(s) (${y.length} correct, ${b.length} incorrect).`);
|
|
96
|
-
let x = g(e, s, "partB", c);
|
|
97
|
-
if (r.push(`Part B score: ${x}.`), !c) r.push("Final score is awarded only if both Part A and Part B are completely correct."), r.push(`Final score: ${+(m === 1 && x === 1)}.`);
|
|
98
|
-
else {
|
|
99
|
-
r.push("With partial scoring enabled, Part A must be correct to earn any credit.");
|
|
100
|
-
let e = 0;
|
|
101
|
-
m === 1 && x === 1 ? e = 2 : m === 1 && x < 1 && (e = 1), r.push(`Final score: ${e}.`);
|
|
102
|
-
}
|
|
103
|
-
return r;
|
|
104
|
-
};
|
|
105
|
-
function v(e, t, n) {
|
|
106
|
-
return new Promise((r) => {
|
|
107
|
-
let { value: i } = t || {};
|
|
108
|
-
if ((!t || !i) && r({
|
|
109
|
-
score: 0,
|
|
110
|
-
scoreA: 0,
|
|
111
|
-
scoreB: 0,
|
|
112
|
-
empty: !0,
|
|
113
|
-
logTrace: ["Student did not answer the question."]
|
|
114
|
-
}), i) {
|
|
115
|
-
let { partA: a, partB: s } = i || {}, c = o.enabled(e, n), l = g(e, a, "partA", c), u = g(e, s, "partB", c), d = _(e, t, n);
|
|
116
|
-
r(c ? l === 1 ? u === 1 ? {
|
|
117
|
-
score: 2,
|
|
118
|
-
scoreA: l,
|
|
119
|
-
scoreB: u,
|
|
120
|
-
max: 2,
|
|
121
|
-
logTrace: d
|
|
122
|
-
} : {
|
|
123
|
-
score: 1,
|
|
124
|
-
scoreA: l,
|
|
125
|
-
scoreB: u,
|
|
126
|
-
max: 2,
|
|
127
|
-
logTrace: d
|
|
128
|
-
} : {
|
|
129
|
-
score: 0,
|
|
130
|
-
scoreA: l,
|
|
131
|
-
scoreB: u,
|
|
132
|
-
max: 2,
|
|
133
|
-
logTrace: d
|
|
134
|
-
} : {
|
|
135
|
-
score: +(l === 1 && u === 1),
|
|
136
|
-
scoreA: l,
|
|
137
|
-
scoreB: u,
|
|
138
|
-
max: 1,
|
|
139
|
-
logTrace: d
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
var y = (e) => {
|
|
145
|
-
let t = [];
|
|
146
|
-
return e.forEach((e) => {
|
|
147
|
-
let { correct: n, value: r } = e;
|
|
148
|
-
n && t.push(r);
|
|
149
|
-
}), t;
|
|
150
|
-
}, b = (e, t) => new Promise((n) => {
|
|
151
|
-
if (t.mode !== "evaluate" && t.role === "instructor") {
|
|
152
|
-
let { partA: t, partB: r } = e, i = y(t.choices), a = y(r.choices);
|
|
153
|
-
n({
|
|
154
|
-
value: {
|
|
155
|
-
partA: {
|
|
156
|
-
id: "partA",
|
|
157
|
-
value: i
|
|
158
|
-
},
|
|
159
|
-
partB: {
|
|
160
|
-
id: "partB",
|
|
161
|
-
value: a
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
id: "1"
|
|
165
|
-
});
|
|
166
|
-
} else n(null);
|
|
167
|
-
}), x = (e) => (e || "").replace(/(<(?!img|iframe|source)([^>]+)>)/gi, ""), S = (e = {}, t = {}) => {
|
|
168
|
-
let { choices: n } = e, { minAnswerChoices: i = 2, maxAnswerChoices: a } = t, o = [...n || []].reverse(), s = {}, c = {}, l = {}, u = !1;
|
|
169
|
-
["teacherInstructions", "prompt"].forEach((n) => {
|
|
170
|
-
t[n]?.required && !x(e[n]) && (s[n] = "This field is required.");
|
|
171
|
-
}), o.forEach((e, n) => {
|
|
172
|
-
let { correct: r, value: i, label: a, rationale: s } = e;
|
|
173
|
-
r && (u = !0), x(a) ? o.slice(n + 1).some((e) => e.label === a) && (c[i] = "Content should be unique.") : c[i] = "Content should not be empty.", t.rationale?.required && !x(s) && (l[i] = "This field is required.");
|
|
174
|
-
});
|
|
175
|
-
let d = (n || []).length;
|
|
176
|
-
return d < i ? s.answerChoices = `There should be at least ${i} choices defined.` : d > a && (s.answerChoices = `No more than ${a} choices should be defined.`), u || (s.correctResponse = "No correct response defined."), r(c) || (s.choices = c), r(l) || (s.rationale = l), s;
|
|
177
|
-
}, C = (e = {}, t = {}) => {
|
|
178
|
-
let { partA: n, partB: r } = e || {}, { partA: i, partB: a } = t || {};
|
|
179
|
-
return {
|
|
180
|
-
partA: S(n, i),
|
|
181
|
-
partB: S(r, a)
|
|
182
|
-
};
|
|
183
|
-
};
|
|
184
|
-
//#endregion
|
|
185
|
-
export { b as createCorrectResponseSession, m as createDefaultModel, _ as getLogTrace, p as model, f as normalize, v as outcome, C as validate };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/ebsr/controller/src/utils.js
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
export declare const getCorrectResponse: (choices: any) => any;
|
|
10
|
-
export declare const isResponseCorrect: (question: any, key: any, session: any) => boolean;
|
package/dist/controller/utils.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { isEqual as e } from "@pie-element/shared-lodash";
|
|
2
|
-
//#region src/controller/utils.ts
|
|
3
|
-
var t = (e) => e && e.filter((e) => e.correct).map((e) => e.value).sort(), n = (n, r, i) => {
|
|
4
|
-
let a = t(n.choices);
|
|
5
|
-
return i && i.value ? e((i.value[r].value || []).sort(), a) : !1;
|
|
6
|
-
};
|
|
7
|
-
//#endregion
|
|
8
|
-
export { n as isResponseCorrect };
|
package/dist/delivery/index.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/ebsr/src/index.js
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
export declare const isSessionComplete: (session: any) => boolean;
|
|
10
|
-
export default class Ebsr extends HTMLElement {
|
|
11
|
-
constructor();
|
|
12
|
-
onSessionUpdated: any;
|
|
13
|
-
set model(m: any);
|
|
14
|
-
set session(s: any);
|
|
15
|
-
get session(): any;
|
|
16
|
-
setPartModel(part: any, key: any): void;
|
|
17
|
-
setPartSession(part: any, key: any): void;
|
|
18
|
-
dispatchSessionChanged(partSession: any, key: any): void;
|
|
19
|
-
get partA(): Element | null;
|
|
20
|
-
get partB(): Element | null;
|
|
21
|
-
connectedCallback(): void;
|
|
22
|
-
disconnectedCallback(): void;
|
|
23
|
-
_initPlayerObserver(): void;
|
|
24
|
-
_disconnectPlayerObserver(): void;
|
|
25
|
-
_render(): void;
|
|
26
|
-
}
|
package/dist/delivery/index.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { SessionChangedEvent as e } from "@pie-element/shared-player-events";
|
|
2
|
-
import t from "@pie-element/multiple-choice";
|
|
3
|
-
import { get as n } from "@pie-element/shared-lodash";
|
|
4
|
-
import r from "debug";
|
|
5
|
-
//#region src/delivery/index.tsx
|
|
6
|
-
var i = e.TYPE, a = "ebsr-multiple-choice", o = r("pie-elements:ebsr"), s = class extends t {};
|
|
7
|
-
customElements.get(a) || customElements.define(a, s);
|
|
8
|
-
var c = (e) => Array.isArray(e) && e.length > 0, l = (e) => {
|
|
9
|
-
let t = n(e, "value.partA.value"), r = n(e, "value.partB.value");
|
|
10
|
-
return c(t) && c(r);
|
|
11
|
-
};
|
|
12
|
-
function u(e) {
|
|
13
|
-
let t = e.closest("pie-player") || e.closest("pie-item-player");
|
|
14
|
-
if (!t) return {
|
|
15
|
-
baseHeadingLevel: void 0,
|
|
16
|
-
includeSrHeading: !0
|
|
17
|
-
};
|
|
18
|
-
let n = (e, n, r) => {
|
|
19
|
-
let i = t[e];
|
|
20
|
-
return i ??= t.getAttribute(n) ?? t.getAttribute(r), i;
|
|
21
|
-
}, r = n("baseHeadingLevel", "base-heading-level", "baseheadinglevel"), i = parseInt(r, 10), a = Number.isFinite(i) && i >= 1 && i <= 6 ? i : void 0, o = n("includeSrHeading", "include-sr-heading", "includesrheading");
|
|
22
|
-
return {
|
|
23
|
-
baseHeadingLevel: a,
|
|
24
|
-
includeSrHeading: o == null ? !0 : o !== !1 && o !== "false"
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
var d = class extends HTMLElement {
|
|
28
|
-
constructor() {
|
|
29
|
-
super(), this._model = {}, this._session = {};
|
|
30
|
-
}
|
|
31
|
-
onSessionUpdated = (e) => {
|
|
32
|
-
if (e.target === this) return;
|
|
33
|
-
e.preventDefault(), e.stopImmediatePropagation();
|
|
34
|
-
let t = e.target.getAttribute("id");
|
|
35
|
-
if (t) {
|
|
36
|
-
let n = `part${t.toUpperCase()}`;
|
|
37
|
-
e.update && (this._model[n] = e.update), this.dispatchSessionChanged(e.srcElement._session, n);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
set model(e) {
|
|
41
|
-
this._model = e, customElements.whenDefined(a).then(() => {
|
|
42
|
-
this.setPartModel(this.partA, "partA"), this.setPartModel(this.partB, "partB");
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
set session(e) {
|
|
46
|
-
this._session = e, customElements.whenDefined(a).then(() => {
|
|
47
|
-
this.setPartSession(this.partA, "partA"), this.setPartSession(this.partB, "partB");
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
get session() {
|
|
51
|
-
return this._session;
|
|
52
|
-
}
|
|
53
|
-
setPartModel(e, t) {
|
|
54
|
-
if (this._model && this._model[t] && e) {
|
|
55
|
-
let { mode: n } = this._model;
|
|
56
|
-
e.model = {
|
|
57
|
-
...this._model[t],
|
|
58
|
-
mode: n,
|
|
59
|
-
keyMode: this._model[t].choicePrefix
|
|
60
|
-
};
|
|
61
|
-
let { includeSrHeading: r, baseHeadingLevel: i } = u(this);
|
|
62
|
-
e.includeSrHeading = r, e.baseHeadingLevel = i;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
setPartSession(e, t) {
|
|
66
|
-
if (this._session && this._model && e) {
|
|
67
|
-
let { value: n } = this._session;
|
|
68
|
-
e.session = n && n[t] ? n[t] : { id: t };
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
dispatchSessionChanged(t, n) {
|
|
72
|
-
this._session.value = {
|
|
73
|
-
...this._session.value,
|
|
74
|
-
[n]: t
|
|
75
|
-
}, o("[onSessionChanged] session: ", this._session);
|
|
76
|
-
let r = l(this._session);
|
|
77
|
-
this.dispatchEvent(new e(this.tagName.toLowerCase(), r));
|
|
78
|
-
}
|
|
79
|
-
get partA() {
|
|
80
|
-
return this.querySelector(`${a}#a`);
|
|
81
|
-
}
|
|
82
|
-
get partB() {
|
|
83
|
-
return this.querySelector(`${a}#b`);
|
|
84
|
-
}
|
|
85
|
-
connectedCallback() {
|
|
86
|
-
this._render(), this._initPlayerObserver(), this.addEventListener(i, this.onSessionUpdated);
|
|
87
|
-
}
|
|
88
|
-
disconnectedCallback() {
|
|
89
|
-
this._disconnectPlayerObserver(), this.removeEventListener(i, this.onSessionUpdated);
|
|
90
|
-
}
|
|
91
|
-
_initPlayerObserver() {
|
|
92
|
-
let e = this.closest("pie-player") || this.closest("pie-item-player");
|
|
93
|
-
e && (this._playerObserver = new MutationObserver(() => {
|
|
94
|
-
this._render();
|
|
95
|
-
}), this._playerObserver.observe(e, {
|
|
96
|
-
attributes: !0,
|
|
97
|
-
attributeFilter: [
|
|
98
|
-
"base-heading-level",
|
|
99
|
-
"baseheadinglevel",
|
|
100
|
-
"include-sr-heading",
|
|
101
|
-
"includesrheading"
|
|
102
|
-
]
|
|
103
|
-
}));
|
|
104
|
-
}
|
|
105
|
-
_disconnectPlayerObserver() {
|
|
106
|
-
this._playerObserver &&= (this._playerObserver.disconnect(), null);
|
|
107
|
-
}
|
|
108
|
-
_render() {
|
|
109
|
-
this.ariaLabel = "Two-Part Question", this.role = "region";
|
|
110
|
-
let { baseHeadingLevel: e, includeSrHeading: t } = u(this), n = e ? `h${Math.min(6, e)}` : "h2", r = t ? `<${n} class="srOnly">Two-Part Question</${n}>` : "";
|
|
111
|
-
this.innerHTML = `
|
|
112
|
-
<style>
|
|
113
|
-
.srOnly {
|
|
114
|
-
position: absolute;
|
|
115
|
-
width: 1px;
|
|
116
|
-
height: 1px;
|
|
117
|
-
padding: 0;
|
|
118
|
-
margin: -1px;
|
|
119
|
-
overflow: hidden;
|
|
120
|
-
left: -10000px;
|
|
121
|
-
top: auto;
|
|
122
|
-
}
|
|
123
|
-
${this._model?.extraCSSRules?.rules}
|
|
124
|
-
</style>
|
|
125
|
-
${r}
|
|
126
|
-
<${a} id="a"></${a}>
|
|
127
|
-
<${a} id="b"></${a}>
|
|
128
|
-
`, customElements.get(a) && (this.setPartModel(this.partA, "partA"), this.setPartModel(this.partB, "partB"), this.setPartSession(this.partA, "partA"), this.setPartSession(this.partB, "partB"));
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
//#endregion
|
|
132
|
-
export { d as default, l as isSessionComplete };
|
package/dist/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './delivery/index.js';
|
package/dist/index.iife.d.ts
DELETED