@pie-element/simple-cloze 0.1.4-next.0 → 0.1.4-next.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/dist/author/index.js +25220 -16244
- package/dist/author/index.js.map +1 -1
- package/dist/browser/author/index.js +21813 -0
- package/dist/browser/author/index.js.map +1 -0
- package/dist/browser/client-Cas_f5u-.js +2315 -0
- package/dist/browser/client-Cas_f5u-.js.map +1 -0
- package/dist/browser/controller/index.js +52 -0
- package/dist/browser/controller/index.js.map +1 -0
- package/dist/browser/delivery/index.js +179 -0
- package/dist/browser/delivery/index.js.map +1 -0
- package/dist/browser/print/index.js +43 -0
- package/dist/browser/print/index.js.map +1 -0
- package/dist/runtime-support.js +3 -3
- package/dist/runtime-support.js.map +1 -1
- package/package.json +14 -2
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//#region src/controller/defaults.ts
|
|
2
|
+
var e = {
|
|
3
|
+
model: {
|
|
4
|
+
prompt: "<p>Enter your answer:</p>",
|
|
5
|
+
promptEnabled: !0,
|
|
6
|
+
correctAnswer: ""
|
|
7
|
+
},
|
|
8
|
+
configuration: { prompt: {
|
|
9
|
+
label: "Prompt",
|
|
10
|
+
settings: !0
|
|
11
|
+
} }
|
|
12
|
+
}, t = (e) => !e || typeof e == "object" && Object.keys(e).length === 0, n = (e, t) => {
|
|
13
|
+
if (!t?.response) return "unanswered";
|
|
14
|
+
let n = e?.correctAnswer || "";
|
|
15
|
+
return (t.response || "").trim().toLowerCase() === n.trim().toLowerCase() ? "correct" : "incorrect";
|
|
16
|
+
}, r = (e, n) => +!t(n), i = (e, r, i) => new Promise((a) => {
|
|
17
|
+
if (t(r)) {
|
|
18
|
+
a({
|
|
19
|
+
score: 0,
|
|
20
|
+
empty: !0
|
|
21
|
+
});
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
r = o(r), i.mode === "evaluate" ? a({ score: +(n(e, r) === "correct") }) : a({
|
|
25
|
+
score: void 0,
|
|
26
|
+
completed: void 0
|
|
27
|
+
});
|
|
28
|
+
}), a = (t = {}) => ({
|
|
29
|
+
...e.model,
|
|
30
|
+
...t
|
|
31
|
+
}), o = (e) => ({ ...e }), s = (e, t, r) => new Promise((i) => {
|
|
32
|
+
t ||= {};
|
|
33
|
+
let o = a(e), s = {
|
|
34
|
+
prompt: o.promptEnabled ? o.prompt : null,
|
|
35
|
+
disabled: r.mode !== "gather",
|
|
36
|
+
view: r.mode === "view",
|
|
37
|
+
env: r
|
|
38
|
+
};
|
|
39
|
+
r.mode === "evaluate" && (s.correctness = n(o, t), s.correctAnswer = o.correctAnswer), r.role === "instructor" && (r.mode === "view" || r.mode === "evaluate") ? s.teacherInstructions = o.teacherInstructionsEnabled ? o.teacherInstructions : null : s.teacherInstructions = null, i(s);
|
|
40
|
+
}), c = (e, t) => new Promise((n) => {
|
|
41
|
+
t.mode !== "evaluate" && t.role === "instructor" ? n({
|
|
42
|
+
id: "1",
|
|
43
|
+
response: e.correctAnswer || ""
|
|
44
|
+
}) : n(null);
|
|
45
|
+
}), l = (e = {}, t = {}) => {
|
|
46
|
+
let n = {};
|
|
47
|
+
return (!e.prompt || e.prompt.trim() === "" || e.prompt === "<p></p>") && (n.prompt = "Prompt is required"), n;
|
|
48
|
+
};
|
|
49
|
+
//#endregion
|
|
50
|
+
export { c as createCorrectResponseSession, a as createDefaultModel, n as getCorrectness, r as getPartialScore, s as model, o as normalizeSession, i as outcome, l as validate };
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/controller/defaults.ts","../../../src/controller/index.ts"],"sourcesContent":["export default {\n model: {\n prompt: '<p>Enter your answer:</p>',\n promptEnabled: true,\n correctAnswer: '',\n },\n configuration: {\n prompt: {\n label: 'Prompt',\n settings: true,\n },\n },\n};\n","import defaults from './defaults';\n\nconst isEmptySession = (session: unknown) =>\n !session || (typeof session === 'object' && Object.keys(session).length === 0);\n\nexport const getCorrectness = (question: any, session: any) => {\n if (!session?.response) {\n return 'unanswered';\n }\n\n const correctAnswer = question?.correctAnswer || '';\n const userAnswer = session.response || '';\n\n // Simple string comparison for now\n if (userAnswer.trim().toLowerCase() === correctAnswer.trim().toLowerCase()) {\n return 'correct';\n }\n\n return 'incorrect';\n};\n\nexport const getPartialScore = (_question: any, session: any) => {\n if (isEmptySession(session)) {\n return 0;\n }\n\n return 1;\n};\n\nexport const outcome = (question: any, session: any, env: any) =>\n new Promise((resolve) => {\n if (isEmptySession(session)) {\n resolve({ score: 0, empty: true });\n return;\n }\n\n session = normalizeSession(session);\n\n if (env.mode !== 'evaluate') {\n resolve({ score: undefined, completed: undefined });\n } else {\n const correctness = getCorrectness(question, session);\n const score = correctness === 'correct' ? 1 : 0;\n resolve({ score });\n }\n });\n\nexport const createDefaultModel = (model: any = {}) => ({ ...defaults.model, ...model });\n\nexport const normalizeSession = (s: any) => ({ ...s });\n\nexport const model = (question: any, session: any, env: any) => {\n return new Promise((resolve) => {\n session = session || {};\n const normalizedQuestion = createDefaultModel(question);\n\n const out: any = {\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n disabled: env.mode !== 'gather',\n view: env.mode === 'view',\n env,\n };\n\n if (env.mode === 'evaluate') {\n const correctness = getCorrectness(normalizedQuestion, session);\n out.correctness = correctness;\n out.correctAnswer = normalizedQuestion.correctAnswer;\n }\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled\n ? normalizedQuestion.teacherInstructions\n : null;\n } else {\n out.teacherInstructions = null;\n }\n\n resolve(out);\n });\n};\n\nexport const createCorrectResponseSession = (question: any, env: any) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n resolve({ id: '1', response: question.correctAnswer || '' });\n } else {\n resolve(null);\n }\n });\n};\n\nexport const validate = (model: any = {}, _config: any = {}) => {\n const errors: any = {};\n\n if (!model.prompt || model.prompt.trim() === '' || model.prompt === '<p></p>') {\n errors.prompt = 'Prompt is required';\n }\n\n return errors;\n};\n"],"mappings":";AAAA,IAAA,IAAe;CACb,OAAO;EACL,QAAQ;EACR,eAAe;EACf,eAAe;CACjB;CACA,eAAe,EACb,QAAQ;EACN,OAAO;EACP,UAAU;CACZ,EACF;AACF,GCVM,KAAkB,MACtB,CAAC,KAAY,OAAO,KAAY,YAAY,OAAO,KAAK,CAAO,EAAE,WAAW,GAEjE,KAAkB,GAAe,MAAiB;CAC7D,IAAI,CAAC,GAAS,UACZ,OAAO;CAGT,IAAM,IAAgB,GAAU,iBAAiB;CAQjD,QAPmB,EAAQ,YAAY,IAGxB,KAAK,EAAE,YAAY,MAAM,EAAc,KAAK,EAAE,YAAY,IAChE,YAGF;AACT,GAEa,KAAmB,GAAgB,MAC9C,EAAI,EAAe,CAAO,GAOf,KAAW,GAAe,GAAc,MACnD,IAAI,SAAS,MAAY;CACvB,IAAI,EAAe,CAAO,GAAG;EAC3B,EAAQ;GAAE,OAAO;GAAG,OAAO;EAAK,CAAC;EACjC;CACF;CAIA,AAFA,IAAU,EAAiB,CAAO,GAE9B,EAAI,SAAS,aAKf,EAAQ,EAAE,OAFU,IAAe,GAAU,CAC/B,MAAgB,WACd,CAAC,IAJjB,EAAQ;EAAE,OAAO,KAAA;EAAW,WAAW,KAAA;CAAU,CAAC;AAMtD,CAAC,GAEU,KAAsB,IAAa,CAAC,OAAO;CAAE,GAAG,EAAS;CAAO,GAAG;AAAM,IAEzE,KAAoB,OAAY,EAAE,GAAG,EAAE,IAEvC,KAAS,GAAe,GAAc,MAC1C,IAAI,SAAS,MAAY;CAC9B,MAAqB,CAAC;CACtB,IAAM,IAAqB,EAAmB,CAAQ,GAEhD,IAAW;EACf,QAAQ,EAAmB,gBAAgB,EAAmB,SAAS;EACvE,UAAU,EAAI,SAAS;EACvB,MAAM,EAAI,SAAS;EACnB;CACF;CAgBA,AAdI,EAAI,SAAS,eAEf,EAAI,cADgB,EAAe,GAAoB,CACrC,GAClB,EAAI,gBAAgB,EAAmB,gBAGrC,EAAI,SAAS,iBAAiB,EAAI,SAAS,UAAU,EAAI,SAAS,cACpE,EAAI,sBAAsB,EAAmB,6BACzC,EAAmB,sBACnB,OAEJ,EAAI,sBAAsB,MAG5B,EAAQ,CAAG;AACb,CAAC,GAGU,KAAgC,GAAe,MACnD,IAAI,SAAS,MAAY;CAC9B,AAAI,EAAI,SAAS,cAAc,EAAI,SAAS,eAC1C,EAAQ;EAAE,IAAI;EAAK,UAAU,EAAS,iBAAiB;CAAG,CAAC,IAE3D,EAAQ,IAAI;AAEhB,CAAC,GAGU,KAAY,IAAa,CAAC,GAAG,IAAe,CAAC,MAAM;CAC9D,IAAM,IAAc,CAAC;CAMrB,QAJI,CAAC,EAAM,UAAU,EAAM,OAAO,KAAK,MAAM,MAAM,EAAM,WAAW,eAClE,EAAO,SAAS,uBAGX;AACT"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { A as e, C as t, E as n, F as r, L as i, M as a, O as o, P as s, S as c, T as l, _ as u, b as d, c as f, d as p, f as m, g as h, h as g, i as _, j as v, o as y, r as b, t as x, u as S, w as C, x as w, y as T } from "../client-Cas_f5u-.js";
|
|
2
|
+
//#region ../../lib-svelte/delivery-events/dist/index2.js
|
|
3
|
+
var E = class e extends CustomEvent {
|
|
4
|
+
static {
|
|
5
|
+
this.TYPE = "model-set";
|
|
6
|
+
}
|
|
7
|
+
constructor(t, n, r) {
|
|
8
|
+
super(e.TYPE, {
|
|
9
|
+
bubbles: !0,
|
|
10
|
+
composed: !0,
|
|
11
|
+
detail: {
|
|
12
|
+
complete: n,
|
|
13
|
+
component: t,
|
|
14
|
+
hasModel: r
|
|
15
|
+
}
|
|
16
|
+
}), this.component = t, this.complete = n;
|
|
17
|
+
}
|
|
18
|
+
}, D = class e extends CustomEvent {
|
|
19
|
+
static {
|
|
20
|
+
this.TYPE = "session-changed";
|
|
21
|
+
}
|
|
22
|
+
constructor(t, n) {
|
|
23
|
+
super(e.TYPE, {
|
|
24
|
+
bubbles: !0,
|
|
25
|
+
composed: !0,
|
|
26
|
+
detail: {
|
|
27
|
+
complete: n,
|
|
28
|
+
component: t
|
|
29
|
+
}
|
|
30
|
+
}), this.component = t, this.complete = n;
|
|
31
|
+
}
|
|
32
|
+
}, O = (e) => {
|
|
33
|
+
let t = e;
|
|
34
|
+
return t ? typeof t.onSessionChange == "function" || typeof t.onAudioStarted == "function" || typeof t.onAudioEnded == "function" : !1;
|
|
35
|
+
};
|
|
36
|
+
function k(e, t = {}) {
|
|
37
|
+
let n = t.hostPredicate ?? O, r = e;
|
|
38
|
+
for (; r;) {
|
|
39
|
+
if (n(r)) return r;
|
|
40
|
+
r = r.parentElement;
|
|
41
|
+
}
|
|
42
|
+
if (typeof document < "u" && t.fallbackSelector) {
|
|
43
|
+
let e = document.querySelector(t.fallbackSelector);
|
|
44
|
+
if (n(e)) return e;
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
function A({ sourceEl: e, fallbackSelector: t, component: n, complete: r, session: i }) {
|
|
49
|
+
let a = k(e, { fallbackSelector: t });
|
|
50
|
+
return a ? typeof a.onSessionChange == "function" ? (a.onSessionChange(i), a) : (a.dispatchEvent(new D(n, r)), a) : null;
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/delivery/SimpleCloze.svelte
|
|
54
|
+
var j = new Set([
|
|
55
|
+
"$$slots",
|
|
56
|
+
"$$events",
|
|
57
|
+
"$$legacy",
|
|
58
|
+
"$$host"
|
|
59
|
+
]), M = T("<div class=\"mb-4 prose\"></div>"), N = d("<svg style=\"width: 25px; height: 25px;\" preserveAspectRatio=\"xMinYMin meet\" version=\"1.1\" viewBox=\"-283 359 34 35\"><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>"), P = d("<svg style=\"width: 25px; height: 25px;\" preserveAspectRatio=\"xMinYMin meet\" version=\"1.1\" viewBox=\"-129.5 127 34 35\"><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>"), F = T("<button type=\"button\" class=\"mb-3 flex items-center gap-2 cursor-pointer select-none\"><!> <span class=\"text-sm hover:underline\"> </span></button>"), I = T("<span class=\"correctness-icon svelte-1glps5n\" style=\"background-color: #0EA449;\"><svg style=\"width: 12px; height: 12px; color: white;\" fill=\"currentColor\" viewBox=\"0 0 24 24\"><path d=\"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z\"></path></svg></span>"), L = T("<span class=\"correctness-icon svelte-1glps5n\" style=\"background-color: #BF0D00;\"><svg style=\"width: 12px; height: 12px; color: white;\" fill=\"currentColor\" viewBox=\"0 0 24 24\"><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>"), R = T("<div class=\"p-4\"><!> <!> <div class=\"relative inline-block\"><!> <!> <input type=\"text\" placeholder=\"Enter your answer...\" class=\"outline-none px-3 py-2 rounded svelte-1glps5n\"/></div></div>"), z = {
|
|
60
|
+
hash: "svelte-1glps5n",
|
|
61
|
+
code: "\n /* Custom styles for correct answer display */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;}"
|
|
62
|
+
};
|
|
63
|
+
function B(d, x) {
|
|
64
|
+
r(x, !0), S(d, z), b(x, j);
|
|
65
|
+
let w = null, T = v(!1);
|
|
66
|
+
g(() => (w && (w.value = x?.session?.response || "", w.addEventListener("input", E)), () => {
|
|
67
|
+
w && w.removeEventListener("input", E);
|
|
68
|
+
})), l(() => {
|
|
69
|
+
if (w && !t(T)) {
|
|
70
|
+
let e = x?.session?.response || "";
|
|
71
|
+
w.value !== e && (w.value = e);
|
|
72
|
+
}
|
|
73
|
+
}), l(() => {
|
|
74
|
+
w && (t(T) && x?.model?.correctAnswer ? w.value = x.model.correctAnswer : t(T) || (w.value = x?.session?.response || ""));
|
|
75
|
+
});
|
|
76
|
+
function E(e) {
|
|
77
|
+
let t = e.target, n = t.value;
|
|
78
|
+
A({
|
|
79
|
+
sourceEl: t,
|
|
80
|
+
fallbackSelector: "simple-cloze",
|
|
81
|
+
component: "simple-cloze",
|
|
82
|
+
session: {
|
|
83
|
+
...x.session,
|
|
84
|
+
response: n
|
|
85
|
+
},
|
|
86
|
+
complete: n.trim().length > 0
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function D() {
|
|
90
|
+
e(T, !t(T));
|
|
91
|
+
}
|
|
92
|
+
let O = a(() => x?.model?.env?.mode === "evaluate"), k = a(() => x?.model?.correctness), B = a(() => t(k) === "correct"), V = a(() => t(k) === "incorrect");
|
|
93
|
+
var H = R(), U = n(H), W = (e) => {
|
|
94
|
+
var t = M();
|
|
95
|
+
p(t, () => x.model.prompt, !0), i(t), u(e, t);
|
|
96
|
+
};
|
|
97
|
+
m(U, (e) => {
|
|
98
|
+
x?.model?.prompt && e(W);
|
|
99
|
+
});
|
|
100
|
+
var G = o(U, 2), K = (e) => {
|
|
101
|
+
var r = F(), a = n(r), s = (e) => {
|
|
102
|
+
u(e, N());
|
|
103
|
+
}, l = (e) => {
|
|
104
|
+
u(e, P());
|
|
105
|
+
};
|
|
106
|
+
m(a, (e) => {
|
|
107
|
+
t(T) ? e(s) : e(l, -1);
|
|
108
|
+
});
|
|
109
|
+
var d = o(a, 2), f = n(d);
|
|
110
|
+
i(d), i(r), C(() => {
|
|
111
|
+
y(r, "aria-pressed", t(T)), h(f, `${t(T) ? "Hide" : "Show"} correct answer`);
|
|
112
|
+
}), c("click", r, D), u(e, r);
|
|
113
|
+
};
|
|
114
|
+
m(G, (e) => {
|
|
115
|
+
t(O) && t(V) && e(K);
|
|
116
|
+
});
|
|
117
|
+
var q = o(G, 2), J = n(q), Y = (e) => {
|
|
118
|
+
u(e, I());
|
|
119
|
+
};
|
|
120
|
+
m(J, (e) => {
|
|
121
|
+
t(O) && (t(B) || t(T)) && e(Y);
|
|
122
|
+
});
|
|
123
|
+
var X = o(J, 2), Z = (e) => {
|
|
124
|
+
u(e, L());
|
|
125
|
+
};
|
|
126
|
+
m(X, (e) => {
|
|
127
|
+
t(O) && t(V) && !t(T) && e(Z);
|
|
128
|
+
});
|
|
129
|
+
var Q = o(X, 2);
|
|
130
|
+
let $;
|
|
131
|
+
_(Q, (e) => w = e, () => w), i(q), i(H), C(() => {
|
|
132
|
+
Q.disabled = x?.model?.disabled, Q.readOnly = t(T), $ = f(Q, "", $, {
|
|
133
|
+
border: t(O) && (t(B) || t(T)) ? "solid 2px #0EA449" : t(O) && t(V) && !t(T) ? "solid 2px #BF0D00" : "solid 1px #d1d5db",
|
|
134
|
+
color: t(O) && (t(B) || t(V)) ? "black" : ""
|
|
135
|
+
});
|
|
136
|
+
}), u(d, H), s();
|
|
137
|
+
}
|
|
138
|
+
w(["click"]), x(B, {
|
|
139
|
+
model: { type: "Object" },
|
|
140
|
+
session: { type: "Object" }
|
|
141
|
+
}, [], []);
|
|
142
|
+
//#endregion
|
|
143
|
+
//#region src/delivery/index.ts
|
|
144
|
+
var V = B.element, H = class extends V {
|
|
145
|
+
_internalSession = null;
|
|
146
|
+
_model = null;
|
|
147
|
+
_isComplete = () => {
|
|
148
|
+
let e = this._internalSession?.response;
|
|
149
|
+
return typeof e == "string" && e.trim().length > 0;
|
|
150
|
+
};
|
|
151
|
+
_dispatchModelSet = () => {
|
|
152
|
+
this.dispatchEvent(new E(this.tagName.toLowerCase(), this._isComplete(), this._model !== void 0));
|
|
153
|
+
};
|
|
154
|
+
_dispatchSessionChanged = () => {
|
|
155
|
+
this.dispatchEvent(new D(this.tagName.toLowerCase(), this._isComplete()));
|
|
156
|
+
};
|
|
157
|
+
set model(e) {
|
|
158
|
+
this._model = e, super.model = e, this._dispatchModelSet();
|
|
159
|
+
}
|
|
160
|
+
get model() {
|
|
161
|
+
return this._model;
|
|
162
|
+
}
|
|
163
|
+
set session(e) {
|
|
164
|
+
this._internalSession = e, super.session = e, this._dispatchSessionChanged();
|
|
165
|
+
}
|
|
166
|
+
get session() {
|
|
167
|
+
return this._internalSession;
|
|
168
|
+
}
|
|
169
|
+
onSessionChange = (e) => {
|
|
170
|
+
this._internalSession = e, super.session = e, this._dispatchSessionChanged();
|
|
171
|
+
};
|
|
172
|
+
connectedCallback() {
|
|
173
|
+
super.connectedCallback(), this.onSessionChange = this.onSessionChange;
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
//#endregion
|
|
177
|
+
export { H as default };
|
|
178
|
+
|
|
179
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["t","e"],"sources":["../../../../../lib-svelte/delivery-events/dist/index2.js","../../../../../lib-svelte/delivery-events/dist/index3.js","../../../src/delivery/SimpleCloze.svelte","../../../src/delivery/index.ts"],"sourcesContent":["//#region ../../shared/player-events/dist/index.js\nvar e = 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}, t = 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 { e, t };\n","import { t as e } from \"./index2.js\";\n//#region src/session-bridge.ts\nvar t = (e) => {\n\tlet t = e;\n\treturn t ? typeof t.onSessionChange == \"function\" || typeof t.onAudioStarted == \"function\" || typeof t.onAudioEnded == \"function\" : !1;\n};\nfunction n(e, n = {}) {\n\tlet r = n.hostPredicate ?? t, i = e;\n\tfor (; i;) {\n\t\tif (r(i)) return i;\n\t\ti = i.parentElement;\n\t}\n\tif (typeof document < \"u\" && n.fallbackSelector) {\n\t\tlet e = document.querySelector(n.fallbackSelector);\n\t\tif (r(e)) return e;\n\t}\n\treturn null;\n}\nfunction r({ sourceEl: t, fallbackSelector: r, component: i, complete: a, session: o }) {\n\tlet s = n(t, { fallbackSelector: r });\n\treturn s ? typeof s.onSessionChange == \"function\" ? (s.onSessionChange(o), s) : (s.dispatchEvent(new e(i, a)), s) : null;\n}\n//#endregion\nexport { r as forwardSessionChange, n as resolveDeliveryHost };\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 { onMount } from 'svelte';\nimport { forwardSessionChange } from '@pie-lib/delivery-events-svelte';\n\n// Props using $props() in Svelte 5 custom element mode\nlet props = $props<{ model?: any; session?: any }>();\n\nlet inputElement: HTMLInputElement | null = null;\nlet showCorrectAnswer = $state(false);\n\nonMount(() => {\n if (inputElement) {\n // Set initial value from session\n inputElement.value = props?.session?.response || '';\n\n inputElement.addEventListener('input', handleInput);\n }\n\n return () => {\n if (inputElement) {\n inputElement.removeEventListener('input', handleInput);\n }\n };\n});\n\n// Update input value when session changes externally\n$effect(() => {\n if (inputElement && !showCorrectAnswer) {\n const sessionValue = props?.session?.response || '';\n if (inputElement.value !== sessionValue) {\n inputElement.value = sessionValue;\n }\n }\n});\n\n// Update input value when showing correct answer\n$effect(() => {\n if (inputElement) {\n if (showCorrectAnswer && props?.model?.correctAnswer) {\n inputElement.value = props.model.correctAnswer;\n } else if (!showCorrectAnswer) {\n inputElement.value = props?.session?.response || '';\n }\n }\n});\n\nfunction handleInput(event: Event) {\n const target = event.target as HTMLInputElement;\n const newValue = target.value;\n\n // Replace the session object so host players can detect updates reliably.\n const updatedSession = {\n ...props.session,\n response: newValue,\n };\n\n forwardSessionChange({\n sourceEl: target,\n fallbackSelector: 'simple-cloze',\n component: 'simple-cloze',\n session: updatedSession,\n complete: newValue.trim().length > 0,\n });\n}\n\nfunction toggleCorrectAnswer() {\n showCorrectAnswer = !showCorrectAnswer;\n}\n\n// Computed values\nconst isEvaluateMode = $derived(props?.model?.env?.mode === 'evaluate');\nconst correctness = $derived(props?.model?.correctness);\nconst isCorrect = $derived(correctness === 'correct');\nconst isIncorrect = $derived(correctness === 'incorrect');\n</script>\n\n<div class=\"p-4\">\n {#if props?.model?.prompt}\n <div class=\"mb-4 prose\">{@html props.model.prompt}</div>\n {/if}\n\n {#if isEvaluateMode && isIncorrect}\n <button\n type=\"button\"\n class=\"mb-3 flex items-center gap-2 cursor-pointer select-none\"\n onclick={toggleCorrectAnswer}\n aria-pressed={showCorrectAnswer}\n >\n {#if showCorrectAnswer}\n <!-- Hide correct answer icon (open state) -->\n <svg style=\"width: 25px; height: 25px;\" preserveAspectRatio=\"xMinYMin meet\" version=\"1.1\" viewBox=\"-283 359 34 35\">\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 <!-- Show correct answer icon (closed state) -->\n <svg style=\"width: 25px; height: 25px;\" preserveAspectRatio=\"xMinYMin meet\" version=\"1.1\" viewBox=\"-129.5 127 34 35\">\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 class=\"text-sm hover:underline\">\n {showCorrectAnswer ? 'Hide' : 'Show'} correct answer\n </span>\n </button>\n {/if}\n\n <div class=\"relative inline-block\">\n {#if isEvaluateMode && (isCorrect || showCorrectAnswer)}\n <span class=\"correctness-icon\" style=\"background-color: #0EA449;\">\n <svg style=\"width: 12px; height: 12px; color: white;\" fill=\"currentColor\" viewBox=\"0 0 24 24\">\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 {/if}\n {#if isEvaluateMode && isIncorrect && !showCorrectAnswer}\n <span class=\"correctness-icon\" style=\"background-color: #BF0D00;\">\n <svg style=\"width: 12px; height: 12px; color: white;\" fill=\"currentColor\" viewBox=\"0 0 24 24\">\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 placeholder=\"Enter your answer...\"\n disabled={props?.model?.disabled}\n readonly={showCorrectAnswer}\n class=\"outline-none px-3 py-2 rounded\"\n style:border={isEvaluateMode && (isCorrect || showCorrectAnswer) ? 'solid 2px #0EA449' : isEvaluateMode && isIncorrect && !showCorrectAnswer ? 'solid 2px #BF0D00' : 'solid 1px #d1d5db'}\n style:color={isEvaluateMode && (isCorrect || isIncorrect) ? 'black' : ''}\n />\n </div>\n</div>\n\n<style>\n /* Custom styles for correct answer display */\n 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 }\n</style>\n","// Import the Svelte component compiled as custom element\nimport SimpleClozeComponent from './SimpleCloze.svelte';\nimport { ModelSetEvent, SessionChangedEvent } 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 _internalSession: any = null;\n _model: any = null;\n\n _isComplete = () => {\n const response = this._internalSession?.response;\n return typeof response === 'string' && response.trim().length > 0;\n };\n\n _dispatchModelSet = () => {\n this.dispatchEvent(\n new ModelSetEvent(this.tagName.toLowerCase(), this._isComplete(), this._model !== undefined)\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._internalSession = s;\n super.session = s;\n this._dispatchSessionChanged();\n }\n\n get session() {\n return this._internalSession;\n }\n\n onSessionChange = (updatedSession: any) => {\n this._internalSession = 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()\n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WAAW,KAAA,CAAS,CAC7F;CACF;CAEA,gCAAgC;EAC9B,KAAK,cAAc,IAAI,EAAoB,KAAK,QAAQ,YAAY,GAAG,KAAK,YAAY,CAAC,CAAC;CAC5F;CAEA,IAAI,MAAM,GAAQ;EAGhB,AAFA,KAAK,SAAS,GACd,MAAM,QAAQ,GACd,KAAK,kBAAkB;CACzB;CAEA,IAAI,QAAQ;EACV,OAAO,KAAK;CACd;CAEA,IAAI,QAAQ,GAAQ;EAGlB,AAFA,KAAK,mBAAmB,GACxB,MAAM,UAAU,GAChB,KAAK,wBAAwB;CAC/B;CAEA,IAAI,UAAU;EACZ,OAAO,KAAK;CACd;CAEA,mBAAmB,MAAwB;EAGzC,AAFA,KAAK,mBAAmB,GACxB,MAAM,UAAU,GAChB,KAAK,wBAAwB;CAC/B;CAEA,oBAAoB;EAElB,AADA,MAAM,kBAAkB,GACxB,KAAc,kBAAkB,KAAK;CACvC;AACF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { A as e, C as t, E as n, F as r, I as i, L as a, N as o, P as s, T as c, _ as l, d as u, f as d, j as f, n as p, t as m, u as h, y as g } from "../client-Cas_f5u-.js";
|
|
2
|
+
//#region src/print/Print.svelte
|
|
3
|
+
var _ = g("<div class=\"mb-4 prose prose-sm svelte-1fx5wwa\"></div>"), v = g("<div class=\"p-4 print:p-0\"><!> <div class=\"inline-block\"><input type=\"text\" placeholder=\"______________________\" class=\"px-3 py-2 border-b-2 border-gray-400 bg-transparent print:border-black svelte-1fx5wwa\" style=\"border-top: none; border-left: none; border-right: none;\" disabled=\"\"/></div></div>"), y = {
|
|
4
|
+
hash: "svelte-1fx5wwa",
|
|
5
|
+
code: "\n @media print {input.svelte-1fx5wwa {border-color:black !important;}\n }.prose.svelte-1fx5wwa p {margin:0.5em 0;}.prose.svelte-1fx5wwa strong {font-weight:600;}"
|
|
6
|
+
};
|
|
7
|
+
function b(m, g) {
|
|
8
|
+
r(g, !0), h(m, y);
|
|
9
|
+
let b = p(g, "model", 7, null), x = f("");
|
|
10
|
+
c(() => {
|
|
11
|
+
e(x, b()?.prompt || "", !0);
|
|
12
|
+
});
|
|
13
|
+
var S = {
|
|
14
|
+
get model() {
|
|
15
|
+
return b();
|
|
16
|
+
},
|
|
17
|
+
set model(e = null) {
|
|
18
|
+
b(e), o();
|
|
19
|
+
}
|
|
20
|
+
}, C = v(), w = n(C), T = (e) => {
|
|
21
|
+
var n = _();
|
|
22
|
+
u(n, () => t(x), !0), a(n), l(e, n);
|
|
23
|
+
};
|
|
24
|
+
return d(w, (e) => {
|
|
25
|
+
t(x) && e(T);
|
|
26
|
+
}), i(2), a(C), l(m, C), s(S);
|
|
27
|
+
}
|
|
28
|
+
m(b, { model: { type: "Object" } }, [], []);
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/print/index.ts
|
|
31
|
+
var x = b.element, S = class extends x {
|
|
32
|
+
_model = null;
|
|
33
|
+
set model(e) {
|
|
34
|
+
this._model = e, super.model = e;
|
|
35
|
+
}
|
|
36
|
+
get model() {
|
|
37
|
+
return this._model;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
//#endregion
|
|
41
|
+
export { S as default };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/print/Print.svelte","../../../src/print/index.ts"],"sourcesContent":["<svelte:options\n customElement={{\n shadow: 'none',\n props: {\n model: { type: 'Object' }\n }\n }}\n/>\n\n<script lang=\"ts\">\n// Destructure props so Svelte can infer what to expose as custom element properties\nlet { model = null }: { model?: any } = $props();\n\nlet prompt = $state('');\n$effect(() => {\n prompt = model?.prompt || '';\n});\n</script>\n\n<div class=\"p-4 print:p-0\">\n {#if prompt}\n <div class=\"mb-4 prose prose-sm\">{@html prompt}</div>\n {/if}\n\n <div class=\"inline-block\">\n <input\n type=\"text\"\n placeholder=\"______________________\"\n class=\"px-3 py-2 border-b-2 border-gray-400 bg-transparent print:border-black\"\n style=\"border-top: none; border-left: none; border-right: none;\"\n disabled\n />\n </div>\n</div>\n\n<style>\n @media print {\n input {\n border-color: black !important;\n }\n }\n\n .prose :global(p) {\n margin: 0.5em 0;\n }\n .prose :global(strong) {\n font-weight: 600;\n }\n</style>\n","import PrintComponent from './Print.svelte';\n\nconst SvelteElementClass = (PrintComponent as any).element;\n\nclass SimpleClozePrint extends SvelteElementClass {\n private _model: any = null;\n\n set model(m: any) {\n this._model = m;\n super.model = m;\n }\n\n get model() {\n return this._model;\n }\n}\n\nexport default SimpleClozePrint;\n"],"mappings":";;;;;;iBASA;;CAEA,IAAI,IAAO,EAAA,GAAA,SAAA,GAAG,IAAI,GAEd,IAAS,EAAO,EAAE;CACtB,QAAc;IACZ,GAAS,EAAK,GAAE,UAAU,IAAE,EAAA;CAC9B,CAAC;;;;;gBALa,MAAI;;;IAQjB,IAAG,EAAA,SAAH,CAAG;MAEC,IAAG,EAAA;IAAH,SAAG,EAAoC,CAAM,GAAA,EAAA,KAA7C,CAAG,QAAH,CAAG;;;IADD,CAAM,KAAA,EAAA,CAAA;aADZ,CAAG,QAAH,CAAG;AAFI;;;;ACfR,IAAM,IAAsB,EAAuB,SAE7C,IAAN,cAA+B,EAAmB;CAChD,SAAsB;CAEtB,IAAI,MAAM,GAAQ;EAEhB,AADA,KAAK,SAAS,GACd,MAAM,QAAQ;CAChB;CAEA,IAAI,QAAQ;EACV,OAAO,KAAK;CACd;AACF"}
|
package/dist/runtime-support.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-support.js","names":[],"sources":["../src/runtime-support.ts"],"sourcesContent":["export const runtimeSupport = {\n schemaVersion: 1,\n packageName: '@pie-element/simple-cloze',\n supports: {\n esm: {\n delivery:
|
|
1
|
+
{"version":3,"file":"runtime-support.js","names":[],"sources":["../src/runtime-support.ts"],"sourcesContent":["export const runtimeSupport = {\n schemaVersion: 1,\n packageName: '@pie-element/simple-cloze',\n supports: {\n esm: {\n delivery: true,\n author: true,\n print: true,\n },\n },\n};\n\nexport default runtimeSupport;\n"],"mappings":";AAAA,IAAa,IAAiB;CAC5B,eAAe;CACf,aAAa;CACb,UAAU,EACR,KAAK;EACH,UAAU;EACV,QAAQ;EACR,OAAO;CACT,EACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/simple-cloze",
|
|
3
|
-
"version": "0.1.4-next.
|
|
3
|
+
"version": "0.1.4-next.2",
|
|
4
4
|
"description": "Simple cloze (text entry) demo/template PIE element built with Svelte 5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
"types": "./dist/delivery/index.d.ts",
|
|
19
19
|
"default": "./dist/delivery/index.js"
|
|
20
20
|
},
|
|
21
|
+
"./browser/delivery": {
|
|
22
|
+
"default": "./dist/browser/delivery/index.js"
|
|
23
|
+
},
|
|
21
24
|
"./controller": {
|
|
22
25
|
"types": "./dist/controller/index.d.ts",
|
|
23
26
|
"default": "./dist/controller/index.js"
|
|
@@ -26,10 +29,16 @@
|
|
|
26
29
|
"types": "./dist/controller/index.d.ts",
|
|
27
30
|
"default": "./dist/controller/index.js"
|
|
28
31
|
},
|
|
32
|
+
"./browser/controller": {
|
|
33
|
+
"default": "./dist/browser/controller/index.js"
|
|
34
|
+
},
|
|
29
35
|
"./author": {
|
|
30
36
|
"types": "./dist/author/index.d.ts",
|
|
31
37
|
"default": "./dist/author/index.js"
|
|
32
38
|
},
|
|
39
|
+
"./browser/author": {
|
|
40
|
+
"default": "./dist/browser/author/index.js"
|
|
41
|
+
},
|
|
33
42
|
"./configure": {
|
|
34
43
|
"types": "./dist/author/index.d.ts",
|
|
35
44
|
"default": "./dist/author/index.js"
|
|
@@ -38,6 +47,9 @@
|
|
|
38
47
|
"types": "./dist/print/index.d.ts",
|
|
39
48
|
"default": "./dist/print/index.js"
|
|
40
49
|
},
|
|
50
|
+
"./browser/print": {
|
|
51
|
+
"default": "./dist/browser/print/index.js"
|
|
52
|
+
},
|
|
41
53
|
"./runtime-support": {
|
|
42
54
|
"types": "./dist/runtime-support.d.ts",
|
|
43
55
|
"default": "./dist/runtime-support.js"
|
|
@@ -50,7 +62,7 @@
|
|
|
50
62
|
],
|
|
51
63
|
"sideEffects": false,
|
|
52
64
|
"scripts": {
|
|
53
|
-
"build": "vite build && vite build --config vite.delivery.config.ts && vite build --config vite.controller.config.ts && vite build --config vite.author.config.ts && vite build --config vite.print.config.ts && vite build --config vite.runtime-support.config.ts && vite build --config vite.config.iife.ts && tsc --emitDeclarationOnly",
|
|
65
|
+
"build": "vite build && vite build --config vite.delivery.config.ts && vite build --config vite.controller.config.ts && vite build --config vite.author.config.ts && vite build --config vite.print.config.ts && vite build --config ../../../tools/vite/svelte-element-browser.config.ts && vite build --config vite.runtime-support.config.ts && vite build --config vite.config.iife.ts && tsc --emitDeclarationOnly",
|
|
54
66
|
"dev": "vite",
|
|
55
67
|
"demo": "vite --mode demo",
|
|
56
68
|
"clean": "rm -rf dist tsconfig.tsbuildinfo"
|