@pie-element/simple-cloze 0.1.4-next.7 → 0.1.4-next.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/author/index.d.ts +8 -6
- package/dist/author/index.js +70 -90
- package/dist/author/index.js.map +1 -1
- package/dist/browser/author/index.js +2768 -2737
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/delivery/index.js +154 -98
- package/dist/browser/delivery/index.js.map +1 -1
- package/dist/browser/{i18n-DJMxdTMU.js → i18n-BaF24Jzw.js} +3 -5
- package/dist/browser/i18n-BaF24Jzw.js.map +1 -0
- package/dist/browser/print/index.js +1 -1
- package/dist/delivery/index.d.ts +2 -25
- package/dist/delivery/index.js +120 -175
- package/dist/delivery/index.js.map +1 -1
- package/dist/index.iife.js +3 -3
- package/dist/index.js +2 -7471
- package/dist/print/index.js +2 -4
- package/dist/print/index.js.map +1 -1
- package/dist/runtime-support.js +5 -5
- package/dist/runtime-support.js.map +1 -1
- package/module/print.js +2 -4
- package/module/print.js.map +1 -1
- package/package.json +2 -4
- package/dist/browser/dist-CYpSKy-4.js +0 -80
- package/dist/browser/dist-CYpSKy-4.js.map +0 -1
- package/dist/browser/i18n-DJMxdTMU.js.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { A as e, C as t, E as n, F as r, M as i, N as a, O as o, S as s, T as c, _ as l, a as u, b as d, c as f, g as p, j as m, k as h, l as g, m as _, n as v, p as y, r as b, s as x, t as S, u as C, v as w, x as T, y as E } from "../client-BSTc3boO.js";
|
|
2
|
-
import {
|
|
3
|
-
import { n as A, r as te, t as j } from "../i18n-DJMxdTMU.js";
|
|
2
|
+
import { n as D, r as O, t as k } from "../i18n-BaF24Jzw.js";
|
|
4
3
|
//#region src/delivery/TeacherInstructions.svelte
|
|
5
|
-
var
|
|
4
|
+
var A = p("<div class=\"teacher-instructions pie-teacher-instructions svelte-1jhejbv\"><button type=\"button\" class=\"teacher-instructions-toggle pie-teacher-instructions-toggle svelte-1jhejbv\"> </button> <div class=\"teacher-instructions-content pie-teacher-instructions-content svelte-1jhejbv\"></div></div>"), j = {
|
|
6
5
|
hash: "svelte-1jhejbv",
|
|
7
6
|
code: ".teacher-instructions.svelte-1jhejbv {margin-bottom:1rem;}.teacher-instructions-toggle.svelte-1jhejbv {padding:0;border:0;border-bottom:1px dotted currentColor;background:transparent;font:inherit;color:var(--pie-primary, #3f51b5);cursor:pointer;}.teacher-instructions-toggle.svelte-1jhejbv:focus-visible {outline:2px solid var(--pie-button-focus-outline, #3b82f6);outline-offset:2px;}.teacher-instructions-content.svelte-1jhejbv {padding-top:1rem;}"
|
|
8
7
|
};
|
|
9
|
-
function
|
|
10
|
-
a(l, !0), f(s,
|
|
8
|
+
function M(s, l) {
|
|
9
|
+
a(l, !0), f(s, j);
|
|
11
10
|
let p = v(l, "html", 7), m = v(l, "language", 7), b = h(!1), x = `simple-cloze-teacher-instructions-${Math.random().toString(36).slice(2, 10)}`;
|
|
12
11
|
var S = {
|
|
13
12
|
get html() {
|
|
@@ -22,54 +21,50 @@ function P(s, l) {
|
|
|
22
21
|
set language(t) {
|
|
23
22
|
m(t), e();
|
|
24
23
|
}
|
|
25
|
-
}, C =
|
|
26
|
-
return g(
|
|
27
|
-
u(w, "aria-expanded", d(b)), u(w, "aria-controls", x), y(
|
|
28
|
-
}, [() =>
|
|
24
|
+
}, C = A(), w = t(C), O = c(w, !0), k = n(w, 2);
|
|
25
|
+
return g(k, p, !0), r(k), r(C), T((e) => {
|
|
26
|
+
u(w, "aria-expanded", d(b)), u(w, "aria-controls", x), y(O, e), u(k, "id", x), u(k, "hidden", !d(b));
|
|
27
|
+
}, [() => D(d(b) ? "hideTeacherInstructions" : "showTeacherInstructions", m())]), E("click", w, () => o(b, !d(b))), _(s, C), i(S);
|
|
29
28
|
}
|
|
30
|
-
w(["click"]), S(
|
|
29
|
+
w(["click"]), S(M, {
|
|
31
30
|
html: {},
|
|
32
31
|
language: {}
|
|
33
32
|
}, [], [], { mode: "open" });
|
|
34
33
|
//#endregion
|
|
35
34
|
//#region src/delivery/SimpleCloze.svelte
|
|
36
|
-
var
|
|
35
|
+
var ee = p("<div class=\"simple-cloze-prompt svelte-1glps5n\"></div>"), te = l("<svg preserveAspectRatio=\"xMinYMin meet\" version=\"1.1\" viewBox=\"-283 359 34 35\" focusable=\"false\" class=\"svelte-1glps5n\"><circle cx=\"-266\" cy=\"375.9\" r=\"14\" fill=\"#bce2ff\"></circle><path d=\"M-280.5,375.9c0-8,6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5s-6.5,14.5-14.5,14.5S-280.5,383.9-280.5,375.9z M-279.5,375.9c0,7.4,6.1,13.5,13.5,13.5c7.4,0,13.5-6.1,13.5-13.5s-6.1-13.5-13.5-13.5C-273.4,362.4-279.5,368.5-279.5,375.9z\" fill=\"#bce2ff\"></path><polygon points=\"-265.4,383.1 -258.6,377.2 -261.2,374.2 -264.3,376.9 -268.9,368.7 -272.4,370.6\" fill=\"#1a9cff\"></polygon></svg>"), ne = l("<svg preserveAspectRatio=\"xMinYMin meet\" version=\"1.1\" viewBox=\"-129.5 127 34 35\" focusable=\"false\" class=\"svelte-1glps5n\"><path style=\"fill: #D0CAC5; stroke: #E6E3E0; stroke-width: 0.75; stroke-miterlimit: 10;\" d=\"M-112.9,160.4c-8.5,0-15.5-6.9-15.5-15.5c0-8.5,6.9-15.5,15.5-15.5s15.5,6.9,15.5,15.5 C-97.4,153.5-104.3,160.4-112.9,160.4z\"></path><path style=\"fill: #B3ABA4; stroke: #CDC7C2; stroke-width: 0.5; stroke-miterlimit: 10;\" d=\"M-113.2,159c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-105.2,159-113.2,159z\"></path><circle cx=\"-114.2\" cy=\"143.5\" r=\"14\" fill=\"white\"></circle><path d=\"M-114.2,158c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-106.2,158-114.2,158z M-114.2,130c-7.4,0-13.5,6.1-13.5,13.5s6.1,13.5,13.5,13.5s13.5-6.1,13.5-13.5S-106.8,130-114.2,130z\" fill=\"#bce2ff\"></path><polygon points=\"-114.8,150.7 -121.6,144.8 -119,141.8 -115.9,144.5 -111.3,136.3 -107.8,138.2\" fill=\"#1a9cff\"></polygon></svg>"), re = p("<button type=\"button\" class=\"simple-cloze-toggle svelte-1glps5n\"><span class=\"simple-cloze-toggle-icon svelte-1glps5n\" aria-hidden=\"true\"><!></span> <span class=\"simple-cloze-toggle-label svelte-1glps5n\"> </span></button>"), ie = p("<span class=\"correctness-icon correctness-icon--correct svelte-1glps5n\" aria-hidden=\"true\"><svg fill=\"currentColor\" viewBox=\"0 0 24 24\" focusable=\"false\" class=\"svelte-1glps5n\"><path d=\"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z\"></path></svg></span>"), ae = p("<span class=\"correctness-icon correctness-icon--incorrect svelte-1glps5n\" aria-hidden=\"true\"><svg fill=\"currentColor\" viewBox=\"0 0 24 24\" focusable=\"false\" class=\"svelte-1glps5n\"><path d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z\"></path></svg></span>"), oe = p("<div class=\"simple-cloze-root svelte-1glps5n\"><!> <!> <!> <div class=\"simple-cloze-response svelte-1glps5n\"><!> <input type=\"text\" spellcheck=\"false\"/> <span class=\"sr-only svelte-1glps5n\" role=\"status\"> </span></div></div>"), se = {
|
|
37
36
|
hash: "svelte-1glps5n",
|
|
38
37
|
code: "\n /*\n * Self-contained: players ship no Tailwind, so nothing here relies on host\n * utility classes or a CSS reset. Colours are `--pie-*` theme variables with\n * the fallbacks `@pie-lib/render-ui`'s `color` module uses.\n */.simple-cloze-root.svelte-1glps5n {padding:1rem;color:var(--pie-text, black);}.simple-cloze-prompt.svelte-1glps5n {margin-bottom:1rem;}.simple-cloze-prompt.svelte-1glps5n p {margin:0.5em 0;}.simple-cloze-prompt.svelte-1glps5n strong {font-weight:600;}.simple-cloze-toggle.svelte-1glps5n {display:flex;align-items:center;gap:0.5rem;margin:0 0 0.75rem;padding:0;border:0;background:transparent;color:inherit;font:inherit;cursor:pointer;user-select:none;}.simple-cloze-toggle.svelte-1glps5n:hover .simple-cloze-toggle-label:where(.svelte-1glps5n) {text-decoration:underline;}.simple-cloze-toggle.svelte-1glps5n:focus-visible {outline:2px solid var(--pie-button-focus-outline, #3b82f6);outline-offset:2px;}.simple-cloze-toggle-icon.svelte-1glps5n {display:inline-flex;}.simple-cloze-toggle-icon.svelte-1glps5n svg:where(.svelte-1glps5n) {width:25px;height:25px;}.simple-cloze-toggle-label.svelte-1glps5n {font-size:0.875rem;line-height:1.25rem;}.simple-cloze-response.svelte-1glps5n {position:relative;display:inline-block;}.simple-cloze-input.svelte-1glps5n {box-sizing:border-box;margin:0;padding:0.5rem 0.75rem;\n /* The text colour, as ECR's input border: a light grey fails 3:1 (WCAG 1.4.11). */border:1px solid var(--pie-text, black);border-radius:0.25rem;background-color:transparent;color:var(--pie-text, black);font:inherit;}.simple-cloze-input.svelte-1glps5n:disabled {opacity:1;color:var(--pie-text, black);-webkit-text-fill-color:currentColor;}.simple-cloze-input.svelte-1glps5n:focus-visible {outline:2px solid var(--pie-button-focus-outline, #3b82f6);outline-offset:2px;}.simple-cloze-input--correct.svelte-1glps5n {border:2px solid var(--pie-correct-tertiary, #0ea449);}.simple-cloze-input--incorrect.svelte-1glps5n {border:2px solid var(--pie-incorrect-icon, #bf0d00);}.simple-cloze-input[readonly].svelte-1glps5n {font-weight:600;}.correctness-icon.svelte-1glps5n {position:absolute;top:-8px;left:-8px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;padding:2px;color:var(--pie-white, #ffffff);}.correctness-icon.svelte-1glps5n svg:where(.svelte-1glps5n) {width:12px;height:12px;}.correctness-icon--correct.svelte-1glps5n {background-color:var(--pie-correct-tertiary, #0ea449);}.correctness-icon--incorrect.svelte-1glps5n {background-color:var(--pie-incorrect-icon, #bf0d00);}.sr-only.svelte-1glps5n {position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;}"
|
|
39
38
|
};
|
|
40
|
-
function
|
|
41
|
-
a(p, !0), f(l,
|
|
42
|
-
let S = v(p, "model", 7, null), w = v(p, "session", 7, null),
|
|
39
|
+
function N(l, p) {
|
|
40
|
+
a(p, !0), f(l, se);
|
|
41
|
+
let S = v(p, "model", 7, null), w = v(p, "session", 7, null), A = v(p, "onSessionChange", 7), j = `simple-cloze-${Math.random().toString(36).slice(2, 10)}`, N = `${j}-prompt`, P = `${j}-feedback`, F = h(null), I = h(null), L = h(!1), R = m(() => S()?.mode === "evaluate"), z = m(() => S()?.correctness), B = m(() => d(z) === "correct"), V = m(() => d(z) === "incorrect"), ce = m(() => d(z) === "unanswered"), H = m(() => typeof S()?.prompt == "string" ? S().prompt : ""), U = m(() => typeof S()?.correctAnswer == "string" ? S().correctAnswer : ""), le = m(() => typeof w()?.value == "string" ? w().value : ""), W = m(() => d(R) && !d(B) && !!d(U).trim()), G = m(() => d(L) && d(W)), K = m(() => d(R) ? d(G) ? k("correctAnswerShown", S()?.language) : d(B) ? k("correct", S()?.language) : d(V) ? k("incorrect", S()?.language) : d(ce) ? k("unanswered", S()?.language) : "" : "");
|
|
43
42
|
s(() => {
|
|
44
|
-
d(
|
|
43
|
+
d(W) || o(L, !1);
|
|
45
44
|
}), s(() => {
|
|
46
|
-
if (!d(
|
|
47
|
-
let e = d(
|
|
48
|
-
d(
|
|
45
|
+
if (!d(I)) return;
|
|
46
|
+
let e = d(G) ? d(U) : d(le);
|
|
47
|
+
d(I).value !== e && (d(I).value = e);
|
|
49
48
|
}), s(() => {
|
|
50
|
-
if (!d(
|
|
49
|
+
if (!d(F) || !d(H)) return;
|
|
51
50
|
let e = (e) => console.warn("simple-cloze: MathJax render failed", e);
|
|
52
51
|
try {
|
|
53
|
-
Promise.resolve(
|
|
52
|
+
Promise.resolve(O(d(F))).catch(e);
|
|
54
53
|
} catch (t) {
|
|
55
54
|
e(t);
|
|
56
55
|
}
|
|
57
56
|
});
|
|
58
|
-
function
|
|
59
|
-
let t = e.target
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
...w(),
|
|
64
|
-
value: n
|
|
65
|
-
},
|
|
66
|
-
complete: n.trim().length > 0
|
|
57
|
+
function ue(e) {
|
|
58
|
+
let t = e.target.value;
|
|
59
|
+
A()?.({
|
|
60
|
+
...w(),
|
|
61
|
+
value: t
|
|
67
62
|
});
|
|
68
63
|
}
|
|
69
|
-
function
|
|
70
|
-
d(
|
|
64
|
+
function de() {
|
|
65
|
+
d(W) && o(L, !d(L));
|
|
71
66
|
}
|
|
72
|
-
var
|
|
67
|
+
var fe = {
|
|
73
68
|
get model() {
|
|
74
69
|
return S();
|
|
75
70
|
},
|
|
@@ -81,11 +76,17 @@ function F(l, p) {
|
|
|
81
76
|
},
|
|
82
77
|
set session(t = null) {
|
|
83
78
|
w(t), e();
|
|
79
|
+
},
|
|
80
|
+
get onSessionChange() {
|
|
81
|
+
return A();
|
|
82
|
+
},
|
|
83
|
+
set onSessionChange(t) {
|
|
84
|
+
A(t), e();
|
|
84
85
|
}
|
|
85
|
-
},
|
|
86
|
+
}, q = oe(), J = t(q), pe = (e) => {
|
|
86
87
|
{
|
|
87
88
|
let t = m(() => S()?.language);
|
|
88
|
-
|
|
89
|
+
M(e, {
|
|
89
90
|
get html() {
|
|
90
91
|
return S().teacherInstructions;
|
|
91
92
|
},
|
|
@@ -95,93 +96,148 @@ function F(l, p) {
|
|
|
95
96
|
});
|
|
96
97
|
}
|
|
97
98
|
};
|
|
98
|
-
C(
|
|
99
|
-
S()?.teacherInstructions && e(
|
|
99
|
+
C(J, (e) => {
|
|
100
|
+
S()?.teacherInstructions && e(pe);
|
|
100
101
|
});
|
|
101
|
-
var
|
|
102
|
-
var t =
|
|
103
|
-
g(t, () => d(
|
|
102
|
+
var Y = n(J, 2), me = (e) => {
|
|
103
|
+
var t = ee();
|
|
104
|
+
g(t, () => d(H), !0), r(t), b(t, (e) => o(F, e), () => d(F)), T(() => u(t, "id", N)), _(e, t);
|
|
104
105
|
};
|
|
105
|
-
C(
|
|
106
|
-
d(
|
|
106
|
+
C(Y, (e) => {
|
|
107
|
+
d(H) && e(me);
|
|
107
108
|
});
|
|
108
|
-
var
|
|
109
|
-
var i =
|
|
110
|
-
_(e,
|
|
109
|
+
var X = n(Y, 2), he = (e) => {
|
|
110
|
+
var i = re(), a = t(i), o = t(a), s = (e) => {
|
|
111
|
+
_(e, te());
|
|
111
112
|
}, l = (e) => {
|
|
112
|
-
_(e,
|
|
113
|
+
_(e, ne());
|
|
113
114
|
};
|
|
114
115
|
C(o, (e) => {
|
|
115
|
-
d(
|
|
116
|
+
d(G) ? e(s) : e(l, -1);
|
|
116
117
|
}), r(a);
|
|
117
118
|
var f = c(n(a, 2), !0);
|
|
118
119
|
r(i), T((e) => {
|
|
119
|
-
u(i, "aria-pressed", d(
|
|
120
|
-
}, [() =>
|
|
120
|
+
u(i, "aria-pressed", d(G)), y(f, e);
|
|
121
|
+
}, [() => D(d(G) ? "hideCorrectAnswer" : "showCorrectAnswer", S()?.language)]), E("click", i, de), _(e, i);
|
|
121
122
|
};
|
|
122
|
-
C(
|
|
123
|
-
d(
|
|
123
|
+
C(X, (e) => {
|
|
124
|
+
d(W) && e(he);
|
|
124
125
|
});
|
|
125
|
-
var
|
|
126
|
-
_(e,
|
|
127
|
-
},
|
|
128
|
-
_(e,
|
|
126
|
+
var Z = n(X, 2), Q = t(Z), ge = (e) => {
|
|
127
|
+
_(e, ie());
|
|
128
|
+
}, _e = (e) => {
|
|
129
|
+
_(e, ae());
|
|
129
130
|
};
|
|
130
|
-
C(
|
|
131
|
-
d(
|
|
131
|
+
C(Q, (e) => {
|
|
132
|
+
d(R) && (d(B) || d(G)) ? e(ge) : d(R) && d(V) && e(_e, 1);
|
|
132
133
|
});
|
|
133
|
-
var
|
|
134
|
-
let
|
|
135
|
-
b(
|
|
136
|
-
var
|
|
137
|
-
return r(
|
|
138
|
-
|
|
139
|
-
"simple-cloze-input--correct": d(
|
|
140
|
-
"simple-cloze-input--incorrect": d(
|
|
141
|
-
}), u(
|
|
142
|
-
}, [() =>
|
|
134
|
+
var $ = n(Q, 2);
|
|
135
|
+
let ve;
|
|
136
|
+
b($, (e) => o(I, e), () => d(I));
|
|
137
|
+
var ye = n($, 2), be = c(ye, !0);
|
|
138
|
+
return r(Z), r(q), T((e, t) => {
|
|
139
|
+
ve = x($, 1, "simple-cloze-input svelte-1glps5n", null, ve, {
|
|
140
|
+
"simple-cloze-input--correct": d(R) && (d(B) || d(G)),
|
|
141
|
+
"simple-cloze-input--incorrect": d(R) && d(V) && !d(G)
|
|
142
|
+
}), u($, "placeholder", e), u($, "aria-labelledby", d(H) ? N : void 0), u($, "aria-label", t), u($, "aria-describedby", d(K) ? P : void 0), $.disabled = S()?.disabled, $.readOnly = d(G), u(ye, "id", P), y(be, d(K));
|
|
143
|
+
}, [() => k("placeholder", S()?.language), () => d(H) ? void 0 : k("answerInput", S()?.language)]), E("input", $, ue), _(l, q), i(fe);
|
|
143
144
|
}
|
|
144
|
-
w(["click", "input"]), S(
|
|
145
|
+
w(["click", "input"]), S(N, {
|
|
145
146
|
model: { type: "Object" },
|
|
146
|
-
session: { type: "Object" }
|
|
147
|
+
session: { type: "Object" },
|
|
148
|
+
onSessionChange: {}
|
|
147
149
|
}, [], []);
|
|
148
150
|
//#endregion
|
|
149
|
-
//#region
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
};
|
|
162
|
-
_dispatchSessionChanged = () => {
|
|
163
|
-
this.dispatchEvent(new O(this.tagName.toLowerCase(), this._isComplete()));
|
|
164
|
-
};
|
|
165
|
-
set model(e) {
|
|
166
|
-
this._model = e, super.model = e, this._dispatchModelSet();
|
|
151
|
+
//#region ../../lib-svelte/delivery-events/dist/index2.js
|
|
152
|
+
function P(e) {
|
|
153
|
+
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
154
|
+
}
|
|
155
|
+
function F(e, t) {
|
|
156
|
+
if (e === t) return e;
|
|
157
|
+
if (!P(e) || !P(t) || Object.isFrozen(e) || !Object.isExtensible(e)) return t;
|
|
158
|
+
try {
|
|
159
|
+
for (let n of Object.keys(e)) n in t || delete e[n];
|
|
160
|
+
Object.assign(e, t);
|
|
161
|
+
} catch {
|
|
162
|
+
return t;
|
|
167
163
|
}
|
|
168
|
-
|
|
169
|
-
|
|
164
|
+
return e;
|
|
165
|
+
}
|
|
166
|
+
//#endregion
|
|
167
|
+
//#region ../../shared/player-events/dist/index.js
|
|
168
|
+
var I = class e extends CustomEvent {
|
|
169
|
+
static {
|
|
170
|
+
this.TYPE = "model-set";
|
|
170
171
|
}
|
|
171
|
-
|
|
172
|
-
|
|
172
|
+
constructor(t, n, r) {
|
|
173
|
+
super(e.TYPE, {
|
|
174
|
+
bubbles: !0,
|
|
175
|
+
composed: !0,
|
|
176
|
+
detail: {
|
|
177
|
+
complete: n,
|
|
178
|
+
component: t,
|
|
179
|
+
hasModel: r
|
|
180
|
+
}
|
|
181
|
+
}), this.component = t, this.complete = n;
|
|
173
182
|
}
|
|
174
|
-
|
|
175
|
-
|
|
183
|
+
}, L = class e extends CustomEvent {
|
|
184
|
+
static {
|
|
185
|
+
this.TYPE = "session-changed";
|
|
176
186
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
187
|
+
constructor(t, n) {
|
|
188
|
+
super(e.TYPE, {
|
|
189
|
+
bubbles: !0,
|
|
190
|
+
composed: !0,
|
|
191
|
+
detail: {
|
|
192
|
+
complete: n,
|
|
193
|
+
component: t
|
|
194
|
+
}
|
|
195
|
+
}), this.component = t, this.complete = n;
|
|
182
196
|
}
|
|
183
197
|
};
|
|
184
198
|
//#endregion
|
|
185
|
-
|
|
199
|
+
//#region ../../lib-svelte/delivery-events/dist/index3.js
|
|
200
|
+
function R(e, t) {
|
|
201
|
+
let n = e.element;
|
|
202
|
+
if (!n) throw TypeError("defineDeliveryElement: the component was not compiled with `customElement`");
|
|
203
|
+
class r extends n {
|
|
204
|
+
#e;
|
|
205
|
+
#t;
|
|
206
|
+
constructor() {
|
|
207
|
+
super(), this.onSessionChange = (e) => {
|
|
208
|
+
this.writeSession(e), this.dispatchSessionChanged();
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
set model(e) {
|
|
212
|
+
this.#e = e, super.model = e, queueMicrotask(() => {
|
|
213
|
+
this.dispatchEvent(new I(this.tagName.toLowerCase(), this.isComplete(), this.#e !== void 0));
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
get model() {
|
|
217
|
+
return this.#e;
|
|
218
|
+
}
|
|
219
|
+
set session(e) {
|
|
220
|
+
this.#t = e, super.session = e, this.dispatchSessionChanged();
|
|
221
|
+
}
|
|
222
|
+
get session() {
|
|
223
|
+
return this.#t;
|
|
224
|
+
}
|
|
225
|
+
isComplete() {
|
|
226
|
+
return t.isComplete(this.#e, this.#t);
|
|
227
|
+
}
|
|
228
|
+
writeSession(e) {
|
|
229
|
+
this.#t = F(this.#t, e), super.session = e;
|
|
230
|
+
}
|
|
231
|
+
dispatchSessionChanged() {
|
|
232
|
+
this.dispatchEvent(new L(this.tagName.toLowerCase(), this.isComplete()));
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return r;
|
|
236
|
+
}
|
|
237
|
+
//#endregion
|
|
238
|
+
//#region src/delivery/index.ts
|
|
239
|
+
var z = R(N, { isComplete: (e, t) => typeof t?.value == "string" && t.value.trim().length > 0 });
|
|
240
|
+
//#endregion
|
|
241
|
+
export { z as default };
|
|
186
242
|
|
|
187
243
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/delivery/TeacherInstructions.svelte","../../../src/delivery/SimpleCloze.svelte","../../../src/delivery/index.ts"],"sourcesContent":["<script lang=\"ts\">\nimport { tCommon } from '../i18n';\n\nlet { html, language }: { html: string; language?: string } = $props();\n\nlet expanded = $state(false);\nconst panelId = `simple-cloze-teacher-instructions-${Math.random().toString(36).slice(2, 10)}`;\n</script>\n\n<!-- Collapsed by default, as multiple-choice shows them; the controller sends them to instructors only. -->\n<div class=\"teacher-instructions pie-teacher-instructions\">\n <button\n type=\"button\"\n class=\"teacher-instructions-toggle pie-teacher-instructions-toggle\"\n aria-expanded={expanded}\n aria-controls={panelId}\n onclick={() => (expanded = !expanded)}\n >\n {tCommon(expanded ? 'hideTeacherInstructions' : 'showTeacherInstructions', language)}\n </button>\n <div id={panelId} class=\"teacher-instructions-content pie-teacher-instructions-content\" hidden={!expanded}>\n {@html html}\n </div>\n</div>\n\n<style>\n .teacher-instructions {\n margin-bottom: 1rem;\n }\n\n .teacher-instructions-toggle {\n padding: 0;\n border: 0;\n border-bottom: 1px dotted currentColor;\n background: transparent;\n font: inherit;\n color: var(--pie-primary, #3f51b5);\n cursor: pointer;\n }\n\n .teacher-instructions-toggle:focus-visible {\n outline: 2px solid var(--pie-button-focus-outline, #3b82f6);\n outline-offset: 2px;\n }\n\n .teacher-instructions-content {\n padding-top: 1rem;\n }\n</style>\n","<svelte:options\n customElement={{\n shadow: 'none',\n props: {\n model: { type: 'Object' },\n session: { type: 'Object' }\n }\n }}\n/>\n\n<script lang=\"ts\">\nimport { forwardSessionChange } from '@pie-lib/delivery-events-svelte';\nimport { renderMath } from '@pie-element/shared-math-rendering-mathjax';\nimport { t, tCommon } from '../i18n';\nimport TeacherInstructions from './TeacherInstructions.svelte';\n\nlet { model = null, session = null }: { model?: any; session?: any } = $props();\n\n// Per-instance ids: a page can hold several instances, and several versions of\n// this element, each with its own Svelte runtime.\nconst instanceId = `simple-cloze-${Math.random().toString(36).slice(2, 10)}`;\nconst promptId = `${instanceId}-prompt`;\nconst feedbackId = `${instanceId}-feedback`;\n\nlet promptElement: HTMLDivElement | null = $state(null);\nlet inputElement: HTMLInputElement | null = $state(null);\nlet showCorrectAnswer = $state(false);\n\nconst isEvaluateMode = $derived(model?.mode === 'evaluate');\nconst correctness = $derived(model?.correctness);\nconst isCorrect = $derived(correctness === 'correct');\nconst isIncorrect = $derived(correctness === 'incorrect');\nconst isUnanswered = $derived(correctness === 'unanswered');\nconst prompt = $derived(typeof model?.prompt === 'string' ? model.prompt : '');\nconst correctAnswer = $derived(typeof model?.correctAnswer === 'string' ? model.correctAnswer : '');\nconst sessionValue = $derived(typeof session?.value === 'string' ? session.value : '');\n// As in multiple-choice, any response short of correct can be revealed,\n// including none.\nconst canShowCorrectAnswer = $derived(isEvaluateMode && !isCorrect && !!correctAnswer.trim());\nconst showingCorrectAnswer = $derived(showCorrectAnswer && canShowCorrectAnswer);\n\nconst feedbackText = $derived.by(() => {\n if (!isEvaluateMode) return '';\n if (showingCorrectAnswer) return t('correctAnswerShown', model?.language);\n if (isCorrect) return t('correct', model?.language);\n if (isIncorrect) return t('incorrect', model?.language);\n if (isUnanswered) return t('unanswered', model?.language);\n return '';\n});\n\n// Leaving evaluate mode, or a response that turned correct, turns the reveal\n// off, so gather mode never starts on the answer key.\n$effect(() => {\n if (!canShowCorrectAnswer) {\n showCorrectAnswer = false;\n }\n});\n\n// The input shows the session value, or the answer key while it is revealed.\n// A player that resets or replaces the session clears or restores it.\n$effect(() => {\n if (!inputElement) return;\n const next = showingCorrectAnswer ? correctAnswer : sessionValue;\n if (inputElement.value !== next) {\n inputElement.value = next;\n }\n});\n\n// Typesets the prompt's math each time it renders. `renderMath` resolves once\n// MathJax has run, so a load failure arrives as a rejection.\n$effect(() => {\n if (!promptElement || !prompt) return;\n const warn = (err: unknown) => console.warn('simple-cloze: MathJax render failed', err);\n try {\n Promise.resolve(renderMath(promptElement)).catch(warn);\n } catch (err) {\n warn(err);\n }\n});\n\nfunction handleInput(event: Event) {\n const target = event.target as HTMLInputElement;\n const newValue = target.value;\n\n // The player owns the session's `id` and `element` (the versioned tag it\n // registered this element under), so neither is written here.\n forwardSessionChange({\n sourceEl: target,\n session: { ...session, value: newValue },\n complete: newValue.trim().length > 0,\n });\n}\n\nfunction toggleCorrectAnswer() {\n if (!canShowCorrectAnswer) return;\n showCorrectAnswer = !showCorrectAnswer;\n}\n</script>\n\n<div class=\"simple-cloze-root\">\n {#if model?.teacherInstructions}\n <TeacherInstructions html={model.teacherInstructions} language={model?.language} />\n {/if}\n\n {#if prompt}\n <div bind:this={promptElement} id={promptId} class=\"simple-cloze-prompt\">{@html prompt}</div>\n {/if}\n\n {#if canShowCorrectAnswer}\n <button\n type=\"button\"\n class=\"simple-cloze-toggle\"\n onclick={toggleCorrectAnswer}\n aria-pressed={showingCorrectAnswer}\n >\n <span class=\"simple-cloze-toggle-icon\" aria-hidden=\"true\">\n {#if showingCorrectAnswer}\n <svg preserveAspectRatio=\"xMinYMin meet\" version=\"1.1\" viewBox=\"-283 359 34 35\" focusable=\"false\">\n <circle cx=\"-266\" cy=\"375.9\" r=\"14\" fill=\"#bce2ff\" />\n <path d=\"M-280.5,375.9c0-8,6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5s-6.5,14.5-14.5,14.5S-280.5,383.9-280.5,375.9z M-279.5,375.9c0,7.4,6.1,13.5,13.5,13.5c7.4,0,13.5-6.1,13.5-13.5s-6.1-13.5-13.5-13.5C-273.4,362.4-279.5,368.5-279.5,375.9z\" fill=\"#bce2ff\" />\n <polygon points=\"-265.4,383.1 -258.6,377.2 -261.2,374.2 -264.3,376.9 -268.9,368.7 -272.4,370.6\" fill=\"#1a9cff\" />\n </svg>\n {:else}\n <svg preserveAspectRatio=\"xMinYMin meet\" version=\"1.1\" viewBox=\"-129.5 127 34 35\" focusable=\"false\">\n <path style=\"fill: #D0CAC5; stroke: #E6E3E0; stroke-width: 0.75; stroke-miterlimit: 10;\" d=\"M-112.9,160.4c-8.5,0-15.5-6.9-15.5-15.5c0-8.5,6.9-15.5,15.5-15.5s15.5,6.9,15.5,15.5 C-97.4,153.5-104.3,160.4-112.9,160.4z\" />\n <path style=\"fill: #B3ABA4; stroke: #CDC7C2; stroke-width: 0.5; stroke-miterlimit: 10;\" d=\"M-113.2,159c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-105.2,159-113.2,159z\" />\n <circle cx=\"-114.2\" cy=\"143.5\" r=\"14\" fill=\"white\" />\n <path d=\"M-114.2,158c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-106.2,158-114.2,158z M-114.2,130c-7.4,0-13.5,6.1-13.5,13.5s6.1,13.5,13.5,13.5s13.5-6.1,13.5-13.5S-106.8,130-114.2,130z\" fill=\"#bce2ff\" />\n <polygon points=\"-114.8,150.7 -121.6,144.8 -119,141.8 -115.9,144.5 -111.3,136.3 -107.8,138.2\" fill=\"#1a9cff\" />\n </svg>\n {/if}\n </span>\n <span class=\"simple-cloze-toggle-label\">\n {tCommon(showingCorrectAnswer ? 'hideCorrectAnswer' : 'showCorrectAnswer', model?.language)}\n </span>\n </button>\n {/if}\n\n <div class=\"simple-cloze-response\">\n {#if isEvaluateMode && (isCorrect || showingCorrectAnswer)}\n <span class=\"correctness-icon correctness-icon--correct\" aria-hidden=\"true\">\n <svg fill=\"currentColor\" viewBox=\"0 0 24 24\" focusable=\"false\">\n <path d=\"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z\"/>\n </svg>\n </span>\n {:else if isEvaluateMode && isIncorrect}\n <span class=\"correctness-icon correctness-icon--incorrect\" aria-hidden=\"true\">\n <svg fill=\"currentColor\" viewBox=\"0 0 24 24\" focusable=\"false\">\n <path d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z\"/>\n </svg>\n </span>\n {/if}\n <input\n bind:this={inputElement}\n type=\"text\"\n class=\"simple-cloze-input\"\n class:simple-cloze-input--correct={isEvaluateMode && (isCorrect || showingCorrectAnswer)}\n class:simple-cloze-input--incorrect={isEvaluateMode && isIncorrect && !showingCorrectAnswer}\n placeholder={t('placeholder', model?.language)}\n spellcheck=\"false\"\n aria-labelledby={prompt ? promptId : undefined}\n aria-label={prompt ? undefined : t('answerInput', model?.language)}\n aria-describedby={feedbackText ? feedbackId : undefined}\n disabled={model?.disabled}\n readonly={showingCorrectAnswer}\n oninput={handleInput}\n />\n <span id={feedbackId} class=\"sr-only\" role=\"status\">{feedbackText}</span>\n </div>\n</div>\n\n<style>\n /*\n * Self-contained: players ship no Tailwind, so nothing here relies on host\n * utility classes or a CSS reset. Colours are `--pie-*` theme variables with\n * the fallbacks `@pie-lib/render-ui`'s `color` module uses.\n */\n .simple-cloze-root {\n padding: 1rem;\n color: var(--pie-text, black);\n }\n\n .simple-cloze-prompt {\n margin-bottom: 1rem;\n }\n\n .simple-cloze-prompt :global(p) {\n margin: 0.5em 0;\n }\n\n .simple-cloze-prompt :global(strong) {\n font-weight: 600;\n }\n\n .simple-cloze-toggle {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n margin: 0 0 0.75rem;\n padding: 0;\n border: 0;\n background: transparent;\n color: inherit;\n font: inherit;\n cursor: pointer;\n user-select: none;\n }\n\n .simple-cloze-toggle:hover .simple-cloze-toggle-label {\n text-decoration: underline;\n }\n\n .simple-cloze-toggle:focus-visible {\n outline: 2px solid var(--pie-button-focus-outline, #3b82f6);\n outline-offset: 2px;\n }\n\n .simple-cloze-toggle-icon {\n display: inline-flex;\n }\n\n .simple-cloze-toggle-icon svg {\n width: 25px;\n height: 25px;\n }\n\n .simple-cloze-toggle-label {\n font-size: 0.875rem;\n line-height: 1.25rem;\n }\n\n .simple-cloze-response {\n position: relative;\n display: inline-block;\n }\n\n .simple-cloze-input {\n box-sizing: border-box;\n margin: 0;\n padding: 0.5rem 0.75rem;\n /* The text colour, as ECR's input border: a light grey fails 3:1 (WCAG 1.4.11). */\n border: 1px solid var(--pie-text, black);\n border-radius: 0.25rem;\n background-color: transparent;\n color: var(--pie-text, black);\n font: inherit;\n }\n\n .simple-cloze-input:disabled {\n opacity: 1;\n color: var(--pie-text, black);\n -webkit-text-fill-color: currentColor;\n }\n\n .simple-cloze-input:focus-visible {\n outline: 2px solid var(--pie-button-focus-outline, #3b82f6);\n outline-offset: 2px;\n }\n\n .simple-cloze-input--correct {\n border: 2px solid var(--pie-correct-tertiary, #0ea449);\n }\n\n .simple-cloze-input--incorrect {\n border: 2px solid var(--pie-incorrect-icon, #bf0d00);\n }\n\n .simple-cloze-input[readonly] {\n font-weight: 600;\n }\n\n .correctness-icon {\n position: absolute;\n top: -8px;\n left: -8px;\n border-radius: 50%;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n padding: 2px;\n color: var(--pie-white, #ffffff);\n }\n\n .correctness-icon svg {\n width: 12px;\n height: 12px;\n }\n\n .correctness-icon--correct {\n background-color: var(--pie-correct-tertiary, #0ea449);\n }\n\n .correctness-icon--incorrect {\n background-color: var(--pie-incorrect-icon, #bf0d00);\n }\n\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }\n</style>\n","// Import the Svelte component compiled as custom element\nimport SimpleClozeComponent from './SimpleCloze.svelte';\nimport {\n ModelSetEvent,\n SessionChangedEvent,\n writeSessionInPlace,\n} from '@pie-lib/delivery-events-svelte';\n\n// Get the base Svelte custom element class\nconst SvelteElementClass = (SimpleClozeComponent as any).element;\n\n// Create a wrapper that properly handles session updates\nclass SimpleClozeElement extends SvelteElementClass {\n /**\n * The session object the player handed us, which `session` returns. A player\n * reads the learner's response back off this object, so every update is\n * written into it; the component renders from a fresh copy so its `$derived`\n * reads re-run.\n */\n _playerSession: any = null;\n _model: any = null;\n\n _isComplete = () => {\n const value = this._playerSession?.value;\n return typeof value === 'string' && value.trim().length > 0;\n };\n\n /**\n * Dispatched a microtask later: on load a player sets the model and then the\n * session in the same task (`element.model = …; element.session = …`), and\n * `complete` can only report a restored response once the session is here.\n */\n _dispatchModelSet = () => {\n queueMicrotask(() => {\n this.dispatchEvent(\n new ModelSetEvent(this.tagName.toLowerCase(), this._isComplete(), this._model !== undefined)\n );\n });\n };\n\n _dispatchSessionChanged = () => {\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), this._isComplete()));\n };\n\n set model(m: any) {\n this._model = m;\n super.model = m;\n this._dispatchModelSet();\n }\n\n get model() {\n return this._model;\n }\n\n set session(s: any) {\n this._playerSession = s;\n super.session = s;\n this._dispatchSessionChanged();\n }\n\n get session() {\n return this._playerSession;\n }\n\n onSessionChange = (updatedSession: any) => {\n // A frozen or missing player session cannot be written into; the update\n // then replaces it, as `writeSessionInPlace` returns.\n this._playerSession = writeSessionInPlace(this._playerSession, updatedSession);\n super.session = updatedSession;\n this._dispatchSessionChanged();\n };\n\n connectedCallback() {\n super.connectedCallback();\n (this as any).onSessionChange = this.onSessionChange;\n }\n}\n\n// Export the custom element class\n// The demo loader will register it with customElements.define()\nexport default SimpleClozeElement;\n"],"mappings":";;;;;;;;iBAAA;;CAGA,IAAI,IAAM,EAAA,GAAA,QAAA,CAAA,GAAE,IAAQ,EAAA,GAAA,YAAA,CAAA,GAEhB,IAAW,EAAO,EAAK,GACrB,IAAO,qCAAwC,KAAK,OAAM,CAAA,CAAG,SAAS,EAAE,CAAA,CAAE,MAAM,GAAG,EAAE;;;;;;;;;;;;;;IAI1F,IAAG,EAAA,GACD,IAAA,EADF,CAAG,SACD,GAAA,EAAA,GASA,IAAG,EATH,GAAA,CAAA;UASA,GACQ,GAAI,EAAA,KADZ,CAAG,KAVL,CAAG;IACD,GAAA,i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AAmB,MAAwB;EAKzC,AAFA,KAAK,iBAAiB,EAAoB,KAAK,gBAAgB,CAAc,GAC7E,MAAM,UAAU,GAChB,KAAK,wBAAwB;CAC/B;CAEA,oBAAoB;EAElB,AADA,MAAM,kBAAkB,GACxB,KAAc,kBAAkB,KAAK;CACvC;AACF"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["#e","t","#t","e","n"],"sources":["../../../src/delivery/TeacherInstructions.svelte","../../../src/delivery/SimpleCloze.svelte","../../../../../lib-svelte/delivery-events/dist/index2.js","../../../../../shared/player-events/dist/index.js","../../../../../lib-svelte/delivery-events/dist/index3.js","../../../src/delivery/index.ts"],"sourcesContent":["<script lang=\"ts\">\nimport { tCommon } from '../i18n';\n\nlet { html, language }: { html: string; language?: string } = $props();\n\nlet expanded = $state(false);\nconst panelId = `simple-cloze-teacher-instructions-${Math.random().toString(36).slice(2, 10)}`;\n</script>\n\n<!-- Collapsed by default, as multiple-choice shows them; the controller sends them to instructors only. -->\n<div class=\"teacher-instructions pie-teacher-instructions\">\n <button\n type=\"button\"\n class=\"teacher-instructions-toggle pie-teacher-instructions-toggle\"\n aria-expanded={expanded}\n aria-controls={panelId}\n onclick={() => (expanded = !expanded)}\n >\n {tCommon(expanded ? 'hideTeacherInstructions' : 'showTeacherInstructions', language)}\n </button>\n <div id={panelId} class=\"teacher-instructions-content pie-teacher-instructions-content\" hidden={!expanded}>\n {@html html}\n </div>\n</div>\n\n<style>\n .teacher-instructions {\n margin-bottom: 1rem;\n }\n\n .teacher-instructions-toggle {\n padding: 0;\n border: 0;\n border-bottom: 1px dotted currentColor;\n background: transparent;\n font: inherit;\n color: var(--pie-primary, #3f51b5);\n cursor: pointer;\n }\n\n .teacher-instructions-toggle:focus-visible {\n outline: 2px solid var(--pie-button-focus-outline, #3b82f6);\n outline-offset: 2px;\n }\n\n .teacher-instructions-content {\n padding-top: 1rem;\n }\n</style>\n","<svelte:options\n customElement={{\n shadow: 'none',\n props: {\n model: { type: 'Object' },\n session: { type: 'Object' },\n onSessionChange: {}\n }\n }}\n/>\n\n<script lang=\"ts\">\nimport { renderMath } from '@pie-element/shared-math-rendering-mathjax';\nimport { t, tCommon } from '../i18n';\nimport TeacherInstructions from './TeacherInstructions.svelte';\n\nlet {\n model = null,\n session = null,\n onSessionChange,\n}: { model?: any; session?: any; onSessionChange?: (session: any) => void } = $props();\n\n// Per-instance ids: a page can hold several instances, and several versions of\n// this element, each with its own Svelte runtime.\nconst instanceId = `simple-cloze-${Math.random().toString(36).slice(2, 10)}`;\nconst promptId = `${instanceId}-prompt`;\nconst feedbackId = `${instanceId}-feedback`;\n\nlet promptElement: HTMLDivElement | null = $state(null);\nlet inputElement: HTMLInputElement | null = $state(null);\nlet showCorrectAnswer = $state(false);\n\nconst isEvaluateMode = $derived(model?.mode === 'evaluate');\nconst correctness = $derived(model?.correctness);\nconst isCorrect = $derived(correctness === 'correct');\nconst isIncorrect = $derived(correctness === 'incorrect');\nconst isUnanswered = $derived(correctness === 'unanswered');\nconst prompt = $derived(typeof model?.prompt === 'string' ? model.prompt : '');\nconst correctAnswer = $derived(typeof model?.correctAnswer === 'string' ? model.correctAnswer : '');\nconst sessionValue = $derived(typeof session?.value === 'string' ? session.value : '');\n// As in multiple-choice, any response short of correct can be revealed,\n// including none.\nconst canShowCorrectAnswer = $derived(isEvaluateMode && !isCorrect && !!correctAnswer.trim());\nconst showingCorrectAnswer = $derived(showCorrectAnswer && canShowCorrectAnswer);\n\nconst feedbackText = $derived.by(() => {\n if (!isEvaluateMode) return '';\n if (showingCorrectAnswer) return t('correctAnswerShown', model?.language);\n if (isCorrect) return t('correct', model?.language);\n if (isIncorrect) return t('incorrect', model?.language);\n if (isUnanswered) return t('unanswered', model?.language);\n return '';\n});\n\n// Leaving evaluate mode, or a response that turned correct, turns the reveal\n// off, so gather mode never starts on the answer key.\n$effect(() => {\n if (!canShowCorrectAnswer) {\n showCorrectAnswer = false;\n }\n});\n\n// The input shows the session value, or the answer key while it is revealed.\n// A player that resets or replaces the session clears or restores it.\n$effect(() => {\n if (!inputElement) return;\n const next = showingCorrectAnswer ? correctAnswer : sessionValue;\n if (inputElement.value !== next) {\n inputElement.value = next;\n }\n});\n\n// Typesets the prompt's math each time it renders. `renderMath` resolves once\n// MathJax has run, so a load failure arrives as a rejection.\n$effect(() => {\n if (!promptElement || !prompt) return;\n const warn = (err: unknown) => console.warn('simple-cloze: MathJax render failed', err);\n try {\n Promise.resolve(renderMath(promptElement)).catch(warn);\n } catch (err) {\n warn(err);\n }\n});\n\nfunction handleInput(event: Event) {\n const target = event.target as HTMLInputElement;\n const newValue = target.value;\n\n // The player owns the session's `id` and `element` (the versioned tag it\n // registered this element under), so neither is written here.\n onSessionChange?.({ ...session, value: newValue });\n}\n\nfunction toggleCorrectAnswer() {\n if (!canShowCorrectAnswer) return;\n showCorrectAnswer = !showCorrectAnswer;\n}\n</script>\n\n<div class=\"simple-cloze-root\">\n {#if model?.teacherInstructions}\n <TeacherInstructions html={model.teacherInstructions} language={model?.language} />\n {/if}\n\n {#if prompt}\n <div bind:this={promptElement} id={promptId} class=\"simple-cloze-prompt\">{@html prompt}</div>\n {/if}\n\n {#if canShowCorrectAnswer}\n <button\n type=\"button\"\n class=\"simple-cloze-toggle\"\n onclick={toggleCorrectAnswer}\n aria-pressed={showingCorrectAnswer}\n >\n <span class=\"simple-cloze-toggle-icon\" aria-hidden=\"true\">\n {#if showingCorrectAnswer}\n <svg preserveAspectRatio=\"xMinYMin meet\" version=\"1.1\" viewBox=\"-283 359 34 35\" focusable=\"false\">\n <circle cx=\"-266\" cy=\"375.9\" r=\"14\" fill=\"#bce2ff\" />\n <path d=\"M-280.5,375.9c0-8,6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5s-6.5,14.5-14.5,14.5S-280.5,383.9-280.5,375.9z M-279.5,375.9c0,7.4,6.1,13.5,13.5,13.5c7.4,0,13.5-6.1,13.5-13.5s-6.1-13.5-13.5-13.5C-273.4,362.4-279.5,368.5-279.5,375.9z\" fill=\"#bce2ff\" />\n <polygon points=\"-265.4,383.1 -258.6,377.2 -261.2,374.2 -264.3,376.9 -268.9,368.7 -272.4,370.6\" fill=\"#1a9cff\" />\n </svg>\n {:else}\n <svg preserveAspectRatio=\"xMinYMin meet\" version=\"1.1\" viewBox=\"-129.5 127 34 35\" focusable=\"false\">\n <path style=\"fill: #D0CAC5; stroke: #E6E3E0; stroke-width: 0.75; stroke-miterlimit: 10;\" d=\"M-112.9,160.4c-8.5,0-15.5-6.9-15.5-15.5c0-8.5,6.9-15.5,15.5-15.5s15.5,6.9,15.5,15.5 C-97.4,153.5-104.3,160.4-112.9,160.4z\" />\n <path style=\"fill: #B3ABA4; stroke: #CDC7C2; stroke-width: 0.5; stroke-miterlimit: 10;\" d=\"M-113.2,159c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-105.2,159-113.2,159z\" />\n <circle cx=\"-114.2\" cy=\"143.5\" r=\"14\" fill=\"white\" />\n <path d=\"M-114.2,158c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-106.2,158-114.2,158z M-114.2,130c-7.4,0-13.5,6.1-13.5,13.5s6.1,13.5,13.5,13.5s13.5-6.1,13.5-13.5S-106.8,130-114.2,130z\" fill=\"#bce2ff\" />\n <polygon points=\"-114.8,150.7 -121.6,144.8 -119,141.8 -115.9,144.5 -111.3,136.3 -107.8,138.2\" fill=\"#1a9cff\" />\n </svg>\n {/if}\n </span>\n <span class=\"simple-cloze-toggle-label\">\n {tCommon(showingCorrectAnswer ? 'hideCorrectAnswer' : 'showCorrectAnswer', model?.language)}\n </span>\n </button>\n {/if}\n\n <div class=\"simple-cloze-response\">\n {#if isEvaluateMode && (isCorrect || showingCorrectAnswer)}\n <span class=\"correctness-icon correctness-icon--correct\" aria-hidden=\"true\">\n <svg fill=\"currentColor\" viewBox=\"0 0 24 24\" focusable=\"false\">\n <path d=\"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z\"/>\n </svg>\n </span>\n {:else if isEvaluateMode && isIncorrect}\n <span class=\"correctness-icon correctness-icon--incorrect\" aria-hidden=\"true\">\n <svg fill=\"currentColor\" viewBox=\"0 0 24 24\" focusable=\"false\">\n <path d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z\"/>\n </svg>\n </span>\n {/if}\n <input\n bind:this={inputElement}\n type=\"text\"\n class=\"simple-cloze-input\"\n class:simple-cloze-input--correct={isEvaluateMode && (isCorrect || showingCorrectAnswer)}\n class:simple-cloze-input--incorrect={isEvaluateMode && isIncorrect && !showingCorrectAnswer}\n placeholder={t('placeholder', model?.language)}\n spellcheck=\"false\"\n aria-labelledby={prompt ? promptId : undefined}\n aria-label={prompt ? undefined : t('answerInput', model?.language)}\n aria-describedby={feedbackText ? feedbackId : undefined}\n disabled={model?.disabled}\n readonly={showingCorrectAnswer}\n oninput={handleInput}\n />\n <span id={feedbackId} class=\"sr-only\" role=\"status\">{feedbackText}</span>\n </div>\n</div>\n\n<style>\n /*\n * Self-contained: players ship no Tailwind, so nothing here relies on host\n * utility classes or a CSS reset. Colours are `--pie-*` theme variables with\n * the fallbacks `@pie-lib/render-ui`'s `color` module uses.\n */\n .simple-cloze-root {\n padding: 1rem;\n color: var(--pie-text, black);\n }\n\n .simple-cloze-prompt {\n margin-bottom: 1rem;\n }\n\n .simple-cloze-prompt :global(p) {\n margin: 0.5em 0;\n }\n\n .simple-cloze-prompt :global(strong) {\n font-weight: 600;\n }\n\n .simple-cloze-toggle {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n margin: 0 0 0.75rem;\n padding: 0;\n border: 0;\n background: transparent;\n color: inherit;\n font: inherit;\n cursor: pointer;\n user-select: none;\n }\n\n .simple-cloze-toggle:hover .simple-cloze-toggle-label {\n text-decoration: underline;\n }\n\n .simple-cloze-toggle:focus-visible {\n outline: 2px solid var(--pie-button-focus-outline, #3b82f6);\n outline-offset: 2px;\n }\n\n .simple-cloze-toggle-icon {\n display: inline-flex;\n }\n\n .simple-cloze-toggle-icon svg {\n width: 25px;\n height: 25px;\n }\n\n .simple-cloze-toggle-label {\n font-size: 0.875rem;\n line-height: 1.25rem;\n }\n\n .simple-cloze-response {\n position: relative;\n display: inline-block;\n }\n\n .simple-cloze-input {\n box-sizing: border-box;\n margin: 0;\n padding: 0.5rem 0.75rem;\n /* The text colour, as ECR's input border: a light grey fails 3:1 (WCAG 1.4.11). */\n border: 1px solid var(--pie-text, black);\n border-radius: 0.25rem;\n background-color: transparent;\n color: var(--pie-text, black);\n font: inherit;\n }\n\n .simple-cloze-input:disabled {\n opacity: 1;\n color: var(--pie-text, black);\n -webkit-text-fill-color: currentColor;\n }\n\n .simple-cloze-input:focus-visible {\n outline: 2px solid var(--pie-button-focus-outline, #3b82f6);\n outline-offset: 2px;\n }\n\n .simple-cloze-input--correct {\n border: 2px solid var(--pie-correct-tertiary, #0ea449);\n }\n\n .simple-cloze-input--incorrect {\n border: 2px solid var(--pie-incorrect-icon, #bf0d00);\n }\n\n .simple-cloze-input[readonly] {\n font-weight: 600;\n }\n\n .correctness-icon {\n position: absolute;\n top: -8px;\n left: -8px;\n border-radius: 50%;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n padding: 2px;\n color: var(--pie-white, #ffffff);\n }\n\n .correctness-icon svg {\n width: 12px;\n height: 12px;\n }\n\n .correctness-icon--correct {\n background-color: var(--pie-correct-tertiary, #0ea449);\n }\n\n .correctness-icon--incorrect {\n background-color: var(--pie-incorrect-icon, #bf0d00);\n }\n\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }\n</style>\n","//#region src/write-session-in-place.ts\nfunction e(e) {\n\treturn !!e && typeof e == \"object\" && !Array.isArray(e);\n}\nfunction t(t, n) {\n\tif (t === n) return t;\n\tif (!e(t) || !e(n) || Object.isFrozen(t) || !Object.isExtensible(t)) return n;\n\ttry {\n\t\tfor (let e of Object.keys(t)) e in n || delete t[e];\n\t\tObject.assign(t, n);\n\t} catch {\n\t\treturn n;\n\t}\n\treturn t;\n}\n//#endregion\nexport { t as writeSessionInPlace };\n","//#region src/session-notifier.ts\nvar e = \"commitPendingSession\", t = /* @__PURE__ */ new WeakMap();\nfunction n(e, n) {\n\tlet r = t.get(e);\n\tr || (r = /* @__PURE__ */ new Set(), t.set(e, r)), r.add(n);\n}\nfunction r(t) {\n\treturn Object.getOwnPropertyDescriptor(t, e) !== void 0;\n}\nfunction i(t) {\n\tif (r(t)) return;\n\tlet n = t[e];\n\tObject.defineProperty(t, e, {\n\t\tvalue: () => {\n\t\t\tif (typeof n == \"function\") try {\n\t\t\t\tn.call(t);\n\t\t\t} catch {}\n\t\t\to(t);\n\t\t},\n\t\tconfigurable: !0,\n\t\tenumerable: !1,\n\t\twritable: !0\n\t});\n}\nfunction a(e, t, r = {}) {\n\tlet a = r.delayMs, o = typeof a == \"function\" ? a : () => a ?? 0, s = r.maxWaitMs, c = null, l = null, u = !1, d = () => {\n\t\tc !== null && (clearTimeout(c), c = null), l !== null && (clearTimeout(l), l = null);\n\t}, f = () => {\n\t\td(), u && (u = !1, t());\n\t}, p = {\n\t\tnotify() {\n\t\t\tu = !0, c !== null && clearTimeout(c), c = setTimeout(f, Math.max(0, o())), s !== void 0 && l === null && (l = setTimeout(f, Math.max(0, s)));\n\t\t},\n\t\tflush() {\n\t\t\tif (!u) {\n\t\t\t\td();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tf();\n\t\t\t} catch (e) {\n\t\t\t\tconsole.warn(\"[session-notifier] a committed session-changed dispatch threw\", e);\n\t\t\t}\n\t\t}\n\t};\n\treturn n(e, p), i(e), p;\n}\nfunction o(e) {\n\tlet n = t.get(e);\n\tif (n) for (let e of [...n]) e.flush();\n}\n//#endregion\n//#region src/index.ts\nvar s = class e extends CustomEvent {\n\tstatic {\n\t\tthis.TYPE = \"model-set\";\n\t}\n\tconstructor(t, n, r) {\n\t\tsuper(e.TYPE, {\n\t\t\tbubbles: !0,\n\t\t\tcomposed: !0,\n\t\t\tdetail: {\n\t\t\t\tcomplete: n,\n\t\t\t\tcomponent: t,\n\t\t\t\thasModel: r\n\t\t\t}\n\t\t}), this.component = t, this.complete = n;\n\t}\n}, c = class e extends CustomEvent {\n\tstatic {\n\t\tthis.TYPE = \"session-changed\";\n\t}\n\tconstructor(t, n) {\n\t\tsuper(e.TYPE, {\n\t\t\tbubbles: !0,\n\t\t\tcomposed: !0,\n\t\t\tdetail: {\n\t\t\t\tcomplete: n,\n\t\t\t\tcomponent: t\n\t\t\t}\n\t\t}), this.component = t, this.complete = n;\n\t}\n};\n//#endregion\nexport { s as ModelSetEvent, e as SESSION_COMMIT_METHOD, c as SessionChangedEvent, a as createSessionNotifier, o as flushSessionNotifiers };\n","import { writeSessionInPlace as e } from \"./index2.js\";\nimport { ModelSetEvent as t, SessionChangedEvent as n } from \"@pie-element/shared-player-events\";\n//#region src/delivery-element.ts\nfunction r(r, i) {\n\tlet a = r.element;\n\tif (!a) throw TypeError(\"defineDeliveryElement: the component was not compiled with `customElement`\");\n\tclass o extends a {\n\t\t#e;\n\t\t#t;\n\t\tconstructor() {\n\t\t\tsuper(), this.onSessionChange = (e) => {\n\t\t\t\tthis.writeSession(e), this.dispatchSessionChanged();\n\t\t\t};\n\t\t}\n\t\tset model(e) {\n\t\t\tthis.#e = e, super.model = e, queueMicrotask(() => {\n\t\t\t\tthis.dispatchEvent(new t(this.tagName.toLowerCase(), this.isComplete(), this.#e !== void 0));\n\t\t\t});\n\t\t}\n\t\tget model() {\n\t\t\treturn this.#e;\n\t\t}\n\t\tset session(e) {\n\t\t\tthis.#t = e, super.session = e, this.dispatchSessionChanged();\n\t\t}\n\t\tget session() {\n\t\t\treturn this.#t;\n\t\t}\n\t\tisComplete() {\n\t\t\treturn i.isComplete(this.#e, this.#t);\n\t\t}\n\t\twriteSession(t) {\n\t\t\tthis.#t = e(this.#t, t), super.session = t;\n\t\t}\n\t\tdispatchSessionChanged() {\n\t\t\tthis.dispatchEvent(new n(this.tagName.toLowerCase(), this.isComplete()));\n\t\t}\n\t}\n\treturn o;\n}\n//#endregion\nexport { r as defineDeliveryElement };\n","import SimpleClozeComponent from './SimpleCloze.svelte';\nimport { defineDeliveryElement } from '@pie-lib/delivery-events-svelte';\nimport type { SimpleClozeQuestion, SimpleClozeSession } from '../controller/index.js';\n\n// The demo loader and players register it with customElements.define().\nconst SimpleClozeElement = defineDeliveryElement<SimpleClozeQuestion, SimpleClozeSession>(\n SimpleClozeComponent,\n {\n isComplete: (_model, session) =>\n typeof session?.value === 'string' && session.value.trim().length > 0,\n }\n);\n\nexport default SimpleClozeElement;\n"],"mappings":";;;;;;;iBAAA;;CAGA,IAAI,IAAM,EAAA,GAAA,QAAA,CAAA,GAAE,IAAQ,EAAA,GAAA,YAAA,CAAA,GAEhB,IAAW,EAAO,EAAK,GACrB,IAAO,qCAAwC,KAAK,OAAM,CAAA,CAAG,SAAS,EAAE,CAAA,CAAE,MAAM,GAAG,EAAE;;;;;;;;;;;;;;IAI1F,IAAG,EAAA,GACD,IAAA,EADF,CAAG,SACD,GAAA,EAAA,GASA,IAAG,EATH,GAAA,CAAA;UASA,GACQ,GAAI,EAAA,KADZ,CAAG,KAVL,CAAG;IACD,GAAA,iBAAA,EAGgB,CAAQ,CAAA,KAHxB,GAAA,iBAIgB,CAAO,cAKvB,GAAG,MAAK,CAAO,KAAf,GAAG,UAAA,CAAA,EAA6F,CAAQ,CAAA;WAFtG,EAAO,EAAC,CAAQ,IAAG,4BAA4B,2BAA2B,EAAQ,CAAA,CAAA,CAAA,cAPpF,SAAA,EAKiB,GAAQ,CAAA,EAAI,CAAQ,CAAA,CAAA,QANvC,CAAG;AAHI;;;;;;;;;;;iBCIR;;CAKA,IAAI,IACG,EAAA,GAA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cAAc;GACb,MAAM,GAAG,KAAK,mBAAmB,MAAM;IACtC,KAAK,aAAa,CAAC,GAAG,KAAK,uBAAuB;GACnD;EACD;EACA,IAAI,MAAM,GAAG;GACZ,KAAKA,KAAK,GAAG,MAAM,QAAQ,GAAG,qBAAqB;IAClD,KAAK,cAAc,IAAIC,EAAE,KAAK,QAAQ,YAAY,GAAG,KAAK,WAAW,GAAG,KAAKD,OAAO,KAAK,CAAC,CAAC;GAC5F,CAAC;EACF;EACA,IAAI,QAAQ;GACX,OAAO,KAAKA;EACb;EACA,IAAI,QAAQ,GAAG;GACd,KAAKE,KAAK,GAAG,MAAM,UAAU,GAAG,KAAK,uBAAuB;EAC7D;EACA,IAAI,UAAU;GACb,OAAO,KAAKA;EACb;EACA,aAAa;GACZ,OAAO,EAAE,WAAW,KAAKF,IAAI,KAAKE,EAAE;EACrC;EACA,aAAa,GAAG;GACf,KAAKA,KAAKC,EAAE,KAAKD,IAAID,CAAC,GAAG,MAAM,UAAUA;EAC1C;EACA,yBAAyB;GACxB,KAAK,cAAc,IAAIG,EAAE,KAAK,QAAQ,YAAY,GAAG,KAAK,WAAW,CAAC,CAAC;EACxE;CACD;CACA,OAAO;AACR;;;AClCA,IAAM,IAAqB,EACzB,GACA,EACE,aAAa,GAAQ,MACnB,OAAO,GAAS,SAAU,YAAY,EAAQ,MAAM,KAAK,CAAC,CAAC,SAAS,EACxE,CACF"}
|
|
@@ -150,8 +150,7 @@ var s = async (e) => {
|
|
|
150
150
|
listenSilentAlt: "Repeat instructions",
|
|
151
151
|
listenPlayingAlt: "Instructions are playing",
|
|
152
152
|
printAudio: "Audio:",
|
|
153
|
-
printTranscript: "Transcript:"
|
|
154
|
-
printKey: "(key)"
|
|
153
|
+
printTranscript: "Transcript:"
|
|
155
154
|
},
|
|
156
155
|
multipleChoice: {
|
|
157
156
|
minSelections: "Select at least {{minSelections}}.",
|
|
@@ -291,8 +290,7 @@ var s = async (e) => {
|
|
|
291
290
|
listenSilentAlt: "Escuchar. Repetir las instrucciones.",
|
|
292
291
|
listenPlayingAlt: "Escuchar. Estas son las instrucciones.",
|
|
293
292
|
printAudio: "Audio:",
|
|
294
|
-
printTranscript: "Transcripción:"
|
|
295
|
-
printKey: "(clave)"
|
|
293
|
+
printTranscript: "Transcripción:"
|
|
296
294
|
},
|
|
297
295
|
multipleChoice: {
|
|
298
296
|
minSelections: "Seleccione al menos {{minSelections}}.",
|
|
@@ -1609,4 +1607,4 @@ function pe(e, t) {
|
|
|
1609
1607
|
//#endregion
|
|
1610
1608
|
export { pe as n, s as r, fe as t };
|
|
1611
1609
|
|
|
1612
|
-
//# sourceMappingURL=i18n-
|
|
1610
|
+
//# sourceMappingURL=i18n-BaF24Jzw.js.map
|