@lxpack/runtime 0.2.1 → 0.3.0
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/README.md +1 -1
- package/dist/analytics/factory.d.ts +4 -0
- package/dist/analytics/factory.d.ts.map +1 -0
- package/dist/analytics/noop.d.ts +10 -0
- package/dist/analytics/noop.d.ts.map +1 -0
- package/dist/analytics/reporter.d.ts +9 -0
- package/dist/analytics/reporter.d.ts.map +1 -0
- package/dist/analytics/xapi-reporter.d.ts +23 -0
- package/dist/analytics/xapi-reporter.d.ts.map +1 -0
- package/dist/client.js +2665 -1604
- package/dist/flow-conditions.d.ts +1 -0
- package/dist/flow-conditions.d.ts.map +1 -1
- package/dist/flow.d.ts +1 -0
- package/dist/flow.d.ts.map +1 -1
- package/dist/lms/factory.d.ts +2 -2
- package/dist/lms/factory.d.ts.map +1 -1
- package/dist/progress/size-policy.d.ts.map +1 -1
- package/dist/quiz/score.d.ts.map +1 -1
- package/dist/quiz/types.d.ts +8 -0
- package/dist/quiz/types.d.ts.map +1 -0
- package/dist/runtime.d.ts +3 -0
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +440 -96
- package/dist/scorm-api.d.ts +4 -1
- package/dist/scorm-api.d.ts.map +1 -1
- package/dist/scorm12.js +245 -9
- package/dist/scorm2004-api.d.ts +1 -0
- package/dist/scorm2004-api.d.ts.map +1 -1
- package/dist/scorm2004.d.ts +1 -1
- package/dist/scorm2004.d.ts.map +1 -1
- package/dist/scorm2004.js +36 -23
- package/dist/size-policy-DIyTdXTZ.js +143 -0
- package/dist/types.d.ts +10 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -2
- package/dist/scorm12-DpGWvsHb.js +0 -375
package/dist/scorm-api.d.ts
CHANGED
|
@@ -69,7 +69,10 @@ export declare class Scorm12Simulator implements ScormApiLike {
|
|
|
69
69
|
private loadFromStorage;
|
|
70
70
|
private saveToStorage;
|
|
71
71
|
}
|
|
72
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* @deprecated Use `createScormConnection` or `installScormAPI` instead.
|
|
74
|
+
* Kept for backward compatibility with pre-0.2 import paths.
|
|
75
|
+
*/
|
|
73
76
|
export declare class Scorm12API extends Scorm12Simulator {
|
|
74
77
|
constructor();
|
|
75
78
|
}
|
package/dist/scorm-api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scorm-api.d.ts","sourceRoot":"","sources":["../src/scorm-api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,SAAS;IACxB,YAAY,EAAE,eAAe,GAAG,YAAY,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACjF,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,aAAa,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtC,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAClC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACrC,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACpD,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAClC,eAAe,IAAI,MAAM,CAAC;IAC1B,iBAAiB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9C,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC9C;AAKD,OAAO,EAAE,sBAAsB,EAAE,M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package/dist/scorm12.js
CHANGED
|
@@ -1,11 +1,247 @@
|
|
|
1
|
-
|
|
1
|
+
var u = Object.defineProperty;
|
|
2
|
+
var d = (r, t, e) => t in r ? u(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
3
|
+
var s = (r, t, e) => d(r, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { t as S } from "./size-policy-DIyTdXTZ.js";
|
|
5
|
+
import { S as T } from "./size-policy-DIyTdXTZ.js";
|
|
6
|
+
const i = "0", a = "301", n = "302", h = "lxpack_scorm12_preview";
|
|
7
|
+
function m(r = 500) {
|
|
8
|
+
let t = window, e = 0;
|
|
9
|
+
for (; t && e < r; ) {
|
|
10
|
+
try {
|
|
11
|
+
const c = t.API;
|
|
12
|
+
if (c && typeof c.LMSInitialize == "function")
|
|
13
|
+
return c;
|
|
14
|
+
} catch {
|
|
15
|
+
}
|
|
16
|
+
try {
|
|
17
|
+
if (t.parent && t.parent !== t)
|
|
18
|
+
t = t.parent;
|
|
19
|
+
else if (t.opener && !t.opener.closed)
|
|
20
|
+
t = t.opener;
|
|
21
|
+
else
|
|
22
|
+
break;
|
|
23
|
+
} catch {
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
e++;
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
class f {
|
|
31
|
+
constructor(t) {
|
|
32
|
+
s(this, "api");
|
|
33
|
+
s(this, "initialized", !1);
|
|
34
|
+
s(this, "terminated", !1);
|
|
35
|
+
s(this, "lastError", i);
|
|
36
|
+
this.api = t;
|
|
37
|
+
}
|
|
38
|
+
LMSInitialize() {
|
|
39
|
+
if (this.initialized)
|
|
40
|
+
return this.lastError = a, "false";
|
|
41
|
+
const t = this.api.LMSInitialize("");
|
|
42
|
+
return t === "true" && (this.initialized = !0, this.terminated = !1, this.lastError = i), t;
|
|
43
|
+
}
|
|
44
|
+
LMSFinish() {
|
|
45
|
+
if (!this.initialized || this.terminated)
|
|
46
|
+
return this.lastError = n, "false";
|
|
47
|
+
const t = this.api.LMSFinish("");
|
|
48
|
+
return t === "true" && (this.terminated = !0, this.lastError = i), t;
|
|
49
|
+
}
|
|
50
|
+
LMSGetValue(t) {
|
|
51
|
+
return !this.initialized || this.terminated ? (this.lastError = a, "") : (this.lastError = i, this.api.LMSGetValue(t));
|
|
52
|
+
}
|
|
53
|
+
LMSSetValue(t, e) {
|
|
54
|
+
return !this.initialized || this.terminated ? (this.lastError = a, "false") : (this.lastError = i, this.api.LMSSetValue(t, e));
|
|
55
|
+
}
|
|
56
|
+
LMSCommit() {
|
|
57
|
+
return !this.initialized || this.terminated ? (this.lastError = a, "false") : (this.lastError = i, this.api.LMSCommit(""));
|
|
58
|
+
}
|
|
59
|
+
LMSGetLastError() {
|
|
60
|
+
return this.lastError;
|
|
61
|
+
}
|
|
62
|
+
LMSGetErrorString(t) {
|
|
63
|
+
const e = t ?? this.lastError;
|
|
64
|
+
return e === a ? "Not initialized" : e === n ? "Already terminated" : this.api.LMSGetErrorString(e);
|
|
65
|
+
}
|
|
66
|
+
LMSGetDiagnostic(t) {
|
|
67
|
+
return this.api.LMSGetDiagnostic(t ?? this.lastError);
|
|
68
|
+
}
|
|
69
|
+
setLessonStatus(t) {
|
|
70
|
+
this.LMSSetValue("cmi.core.lesson_status", t);
|
|
71
|
+
}
|
|
72
|
+
setScore(t, e = 100) {
|
|
73
|
+
this.LMSSetValue("cmi.core.score.raw", String(t)), this.LMSSetValue("cmi.core.score.max", String(e)), this.LMSSetValue("cmi.core.score.min", "0");
|
|
74
|
+
}
|
|
75
|
+
setSuspendData(t) {
|
|
76
|
+
const e = l(t);
|
|
77
|
+
this.LMSSetValue("cmi.suspend_data", e);
|
|
78
|
+
}
|
|
79
|
+
setLessonLocation(t) {
|
|
80
|
+
this.LMSSetValue("cmi.core.lesson_location", t);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
class o {
|
|
84
|
+
constructor(t = {}) {
|
|
85
|
+
s(this, "data", {
|
|
86
|
+
lessonStatus: "not attempted",
|
|
87
|
+
scoreRaw: 0,
|
|
88
|
+
scoreMin: 0,
|
|
89
|
+
scoreMax: 100,
|
|
90
|
+
suspendData: "",
|
|
91
|
+
lessonLocation: "",
|
|
92
|
+
entry: "ab-initio",
|
|
93
|
+
exit: "",
|
|
94
|
+
sessionTime: "00:00:00"
|
|
95
|
+
});
|
|
96
|
+
s(this, "initialized", !1);
|
|
97
|
+
s(this, "terminated", !1);
|
|
98
|
+
s(this, "lastError", i);
|
|
99
|
+
s(this, "persistToStorage");
|
|
100
|
+
this.persistToStorage = t.persistToStorage ?? !1, t.initialData && (this.data = { ...this.data, ...t.initialData }), this.persistToStorage && this.loadFromStorage();
|
|
101
|
+
}
|
|
102
|
+
LMSInitialize() {
|
|
103
|
+
return this.initialized ? (this.lastError = a, "false") : (this.initialized = !0, this.terminated = !1, this.lastError = i, "true");
|
|
104
|
+
}
|
|
105
|
+
LMSFinish() {
|
|
106
|
+
return !this.initialized || this.terminated ? (this.lastError = n, "false") : (this.data.exit = "suspend", this.terminated = !0, this.saveToStorage(), this.lastError = i, "true");
|
|
107
|
+
}
|
|
108
|
+
LMSGetValue(t) {
|
|
109
|
+
if (!this.initialized || this.terminated)
|
|
110
|
+
return this.lastError = a, "";
|
|
111
|
+
switch (this.lastError = i, t) {
|
|
112
|
+
case "cmi.core.lesson_status":
|
|
113
|
+
return this.data.lessonStatus;
|
|
114
|
+
case "cmi.core.score.raw":
|
|
115
|
+
return String(this.data.scoreRaw);
|
|
116
|
+
case "cmi.core.score.min":
|
|
117
|
+
return String(this.data.scoreMin);
|
|
118
|
+
case "cmi.core.score.max":
|
|
119
|
+
return String(this.data.scoreMax);
|
|
120
|
+
case "cmi.suspend_data":
|
|
121
|
+
return this.data.suspendData;
|
|
122
|
+
case "cmi.core.lesson_location":
|
|
123
|
+
return this.data.lessonLocation;
|
|
124
|
+
case "cmi.core.student_id":
|
|
125
|
+
return "lxpack-learner";
|
|
126
|
+
case "cmi.core.student_name":
|
|
127
|
+
return "LXPack Learner";
|
|
128
|
+
case "cmi.core.entry":
|
|
129
|
+
return this.data.entry;
|
|
130
|
+
case "cmi.core.exit":
|
|
131
|
+
return this.data.exit;
|
|
132
|
+
case "cmi.core.session_time":
|
|
133
|
+
return this.data.sessionTime;
|
|
134
|
+
default:
|
|
135
|
+
return "";
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
LMSSetValue(t, e) {
|
|
139
|
+
if (!this.initialized || this.terminated)
|
|
140
|
+
return this.lastError = a, "false";
|
|
141
|
+
switch (this.lastError = i, t) {
|
|
142
|
+
case "cmi.core.lesson_status":
|
|
143
|
+
this.data.lessonStatus = e;
|
|
144
|
+
break;
|
|
145
|
+
case "cmi.core.score.raw":
|
|
146
|
+
this.data.scoreRaw = Number(e);
|
|
147
|
+
break;
|
|
148
|
+
case "cmi.core.score.min":
|
|
149
|
+
this.data.scoreMin = Number(e);
|
|
150
|
+
break;
|
|
151
|
+
case "cmi.core.score.max":
|
|
152
|
+
this.data.scoreMax = Number(e);
|
|
153
|
+
break;
|
|
154
|
+
case "cmi.suspend_data":
|
|
155
|
+
this.data.suspendData = l(e);
|
|
156
|
+
break;
|
|
157
|
+
case "cmi.core.lesson_location":
|
|
158
|
+
this.data.lessonLocation = e;
|
|
159
|
+
break;
|
|
160
|
+
case "cmi.core.exit":
|
|
161
|
+
this.data.exit = e;
|
|
162
|
+
break;
|
|
163
|
+
case "cmi.core.session_time":
|
|
164
|
+
this.data.sessionTime = e;
|
|
165
|
+
break;
|
|
166
|
+
default:
|
|
167
|
+
return "false";
|
|
168
|
+
}
|
|
169
|
+
return this.saveToStorage(), "true";
|
|
170
|
+
}
|
|
171
|
+
LMSCommit() {
|
|
172
|
+
return !this.initialized || this.terminated ? (this.lastError = a, "false") : (this.saveToStorage(), this.lastError = i, "true");
|
|
173
|
+
}
|
|
174
|
+
LMSGetLastError() {
|
|
175
|
+
return this.lastError;
|
|
176
|
+
}
|
|
177
|
+
LMSGetErrorString(t) {
|
|
178
|
+
const e = t ?? this.lastError;
|
|
179
|
+
return e === a ? "Not initialized" : e === n ? "Already terminated" : "No error";
|
|
180
|
+
}
|
|
181
|
+
LMSGetDiagnostic() {
|
|
182
|
+
return "";
|
|
183
|
+
}
|
|
184
|
+
setLessonStatus(t) {
|
|
185
|
+
this.data.lessonStatus = t, this.saveToStorage();
|
|
186
|
+
}
|
|
187
|
+
setScore(t, e = 100) {
|
|
188
|
+
this.data.scoreRaw = t, this.data.scoreMax = e, this.data.scoreMin = 0, this.saveToStorage();
|
|
189
|
+
}
|
|
190
|
+
setSuspendData(t) {
|
|
191
|
+
this.data.suspendData = l(t), this.saveToStorage();
|
|
192
|
+
}
|
|
193
|
+
setLessonLocation(t) {
|
|
194
|
+
this.data.lessonLocation = t, this.saveToStorage();
|
|
195
|
+
}
|
|
196
|
+
loadFromStorage() {
|
|
197
|
+
try {
|
|
198
|
+
const t = localStorage.getItem(h);
|
|
199
|
+
t && (this.data = { ...this.data, ...JSON.parse(t) });
|
|
200
|
+
} catch {
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
saveToStorage() {
|
|
204
|
+
if (this.persistToStorage)
|
|
205
|
+
try {
|
|
206
|
+
localStorage.setItem(h, JSON.stringify(this.data));
|
|
207
|
+
} catch {
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
class E extends o {
|
|
212
|
+
constructor() {
|
|
213
|
+
super({ persistToStorage: !0 });
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
function l(r) {
|
|
217
|
+
return S(r);
|
|
218
|
+
}
|
|
219
|
+
function p(r) {
|
|
220
|
+
if (r === "preview")
|
|
221
|
+
return new o({ persistToStorage: !0 });
|
|
222
|
+
if (r === "scorm12") {
|
|
223
|
+
const t = m();
|
|
224
|
+
return t ? new f(t) : (console.warn(
|
|
225
|
+
"[lxpack] No LMS SCORM API found; using in-memory simulator (progress will not persist to LMS)"
|
|
226
|
+
), new o({ persistToStorage: !1 }));
|
|
227
|
+
}
|
|
228
|
+
return new o({ persistToStorage: !1 });
|
|
229
|
+
}
|
|
230
|
+
function g(r = "preview") {
|
|
231
|
+
const t = p(r);
|
|
232
|
+
if (r === "preview") {
|
|
233
|
+
const e = window;
|
|
234
|
+
e.API = t;
|
|
235
|
+
}
|
|
236
|
+
return t;
|
|
237
|
+
}
|
|
2
238
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
239
|
+
T as SCORM_SUSPEND_DATA_MAX,
|
|
240
|
+
E as Scorm12API,
|
|
241
|
+
f as Scorm12Adapter,
|
|
242
|
+
o as Scorm12Simulator,
|
|
243
|
+
p as createScormConnection,
|
|
244
|
+
m as findLmsApi,
|
|
245
|
+
g as installScormAPI,
|
|
246
|
+
l as trimSuspendData
|
|
11
247
|
};
|
package/dist/scorm2004-api.d.ts
CHANGED
|
@@ -54,4 +54,5 @@ export declare class Scorm2004Adapter implements Scorm2004ApiLike {
|
|
|
54
54
|
}
|
|
55
55
|
export type Scorm2004Connection = Scorm2004Simulator | Scorm2004Adapter;
|
|
56
56
|
export declare function createScorm2004Connection(mode: "preview" | "scorm2004"): Scorm2004Connection;
|
|
57
|
+
export declare function installScorm2004API(mode?: "preview" | "scorm2004"): Scorm2004Connection;
|
|
57
58
|
//# sourceMappingURL=scorm2004-api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scorm2004-api.d.ts","sourceRoot":"","sources":["../src/scorm2004-api.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"scorm2004-api.d.ts","sourceRoot":"","sources":["../src/scorm2004-api.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,WAAW,gBAAgB;IAC/B,UAAU,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC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,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;CAGrC;AAED,qBAAa,gBAAiB,YAAW,gBAAgB;IACvD,OAAO,CAAC,GAAG,CAAmB;gBAElB,GAAG,EAAE,gBAAgB;IAIjC,UAAU,IAAI,MAAM;IAIpB,SAAS,IAAI,MAAM;IAInB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAIjC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAMhD,MAAM,IAAI,MAAM;IAIhB,YAAY,IAAI,MAAM;IAItB,cAAc,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM;IAI1C,aAAa,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM;IAIzC,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAIlC,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAInC,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAIzC,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAItC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;CAGrC;AAED,MAAM,MAAM,mBAAmB,GAAG,kBAAkB,GAAG,gBAAgB,CAAC;AAExE,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,SAAS,GAAG,WAAW,GAC5B,mBAAmB,CAarB;AAED,wBAAgB,mBAAmB,CACjC,IAAI,GAAE,SAAS,GAAG,WAAuB,GACxC,mBAAmB,CASrB"}
|
package/dist/scorm2004.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { createScorm2004Connection, findScorm2004Api, Scorm2004Adapter, Scorm2004Simulator, type Scorm2004ApiLike, type Scorm2004Connection, } from "./scorm2004-api.js";
|
|
1
|
+
export { createScorm2004Connection, findScorm2004Api, installScorm2004API, Scorm2004Adapter, Scorm2004Simulator, type Scorm2004ApiLike, type Scorm2004Connection, } from "./scorm2004-api.js";
|
|
2
2
|
//# sourceMappingURL=scorm2004.d.ts.map
|
package/dist/scorm2004.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scorm2004.d.ts","sourceRoot":"","sources":["../src/scorm2004.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,GACzB,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"scorm2004.d.ts","sourceRoot":"","sources":["../src/scorm2004.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,GACzB,MAAM,oBAAoB,CAAC"}
|
package/dist/scorm2004.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var a = (i, t, e) =>
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
var c = Object.defineProperty;
|
|
2
|
+
var u = (i, t, e) => t in i ? c(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
3
|
+
var a = (i, t, e) => u(i, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { t as s } from "./size-policy-DIyTdXTZ.js";
|
|
5
|
+
const l = "0", n = "lxpack_scorm2004_preview";
|
|
6
|
+
function m(i = 500) {
|
|
6
7
|
let t = window, e = 0;
|
|
7
8
|
for (; t && e < i; ) {
|
|
8
9
|
try {
|
|
@@ -25,7 +26,7 @@ function u(i = 500) {
|
|
|
25
26
|
}
|
|
26
27
|
return null;
|
|
27
28
|
}
|
|
28
|
-
class
|
|
29
|
+
class o {
|
|
29
30
|
constructor(t) {
|
|
30
31
|
a(this, "initialized", !1);
|
|
31
32
|
a(this, "terminated", !1);
|
|
@@ -40,7 +41,7 @@ class n {
|
|
|
40
41
|
a(this, "persistToStorage");
|
|
41
42
|
if (this.persistToStorage = (t == null ? void 0 : t.persistToStorage) ?? !1, this.persistToStorage)
|
|
42
43
|
try {
|
|
43
|
-
const e = localStorage.getItem(
|
|
44
|
+
const e = localStorage.getItem(n);
|
|
44
45
|
e && (this.data = { ...this.data, ...JSON.parse(e) });
|
|
45
46
|
} catch {
|
|
46
47
|
}
|
|
@@ -48,7 +49,7 @@ class n {
|
|
|
48
49
|
save() {
|
|
49
50
|
if (this.persistToStorage)
|
|
50
51
|
try {
|
|
51
|
-
localStorage.setItem(
|
|
52
|
+
localStorage.setItem(n, JSON.stringify(this.data));
|
|
52
53
|
} catch {
|
|
53
54
|
}
|
|
54
55
|
}
|
|
@@ -62,13 +63,13 @@ class n {
|
|
|
62
63
|
return !this.initialized || this.terminated ? "" : this.data[t] ?? "";
|
|
63
64
|
}
|
|
64
65
|
SetValue(t, e) {
|
|
65
|
-
return !this.initialized || this.terminated ? "false" : (this.data[t] = e, this.save(), "true");
|
|
66
|
+
return !this.initialized || this.terminated ? "false" : (this.data[t] = t === "cmi.suspend_data" ? s(e) : e, this.save(), "true");
|
|
66
67
|
}
|
|
67
68
|
Commit() {
|
|
68
69
|
return !this.initialized || this.terminated ? "false" : (this.save(), "true");
|
|
69
70
|
}
|
|
70
71
|
GetLastError() {
|
|
71
|
-
return
|
|
72
|
+
return l;
|
|
72
73
|
}
|
|
73
74
|
GetErrorString() {
|
|
74
75
|
return "No error";
|
|
@@ -77,7 +78,7 @@ class n {
|
|
|
77
78
|
return "";
|
|
78
79
|
}
|
|
79
80
|
setSuspendData(t) {
|
|
80
|
-
this.data["cmi.suspend_data"] = t;
|
|
81
|
+
this.data["cmi.suspend_data"] = s(t);
|
|
81
82
|
}
|
|
82
83
|
setLocation(t) {
|
|
83
84
|
this.data["cmi.location"] = t;
|
|
@@ -92,7 +93,7 @@ class n {
|
|
|
92
93
|
this.data["cmi.score.scaled"] = String(Math.max(0, Math.min(1, t)));
|
|
93
94
|
}
|
|
94
95
|
}
|
|
95
|
-
class
|
|
96
|
+
class p {
|
|
96
97
|
constructor(t) {
|
|
97
98
|
a(this, "api");
|
|
98
99
|
this.api = t;
|
|
@@ -107,7 +108,8 @@ class l {
|
|
|
107
108
|
return this.api.GetValue(t);
|
|
108
109
|
}
|
|
109
110
|
SetValue(t, e) {
|
|
110
|
-
|
|
111
|
+
const r = t === "cmi.suspend_data" ? s(e) : e;
|
|
112
|
+
return this.api.SetValue(t, r);
|
|
111
113
|
}
|
|
112
114
|
Commit() {
|
|
113
115
|
return this.api.Commit("");
|
|
@@ -122,7 +124,7 @@ class l {
|
|
|
122
124
|
return this.api.GetDiagnostic(t);
|
|
123
125
|
}
|
|
124
126
|
setSuspendData(t) {
|
|
125
|
-
this.api.SetValue("cmi.suspend_data", t);
|
|
127
|
+
this.api.SetValue("cmi.suspend_data", s(t));
|
|
126
128
|
}
|
|
127
129
|
setLocation(t) {
|
|
128
130
|
this.api.SetValue("cmi.location", t);
|
|
@@ -137,17 +139,28 @@ class l {
|
|
|
137
139
|
this.api.SetValue("cmi.score.scaled", String(Math.max(0, Math.min(1, t))));
|
|
138
140
|
}
|
|
139
141
|
}
|
|
140
|
-
function
|
|
142
|
+
function d(i) {
|
|
141
143
|
if (i === "preview")
|
|
142
|
-
return new
|
|
143
|
-
const t =
|
|
144
|
-
return t ? new
|
|
144
|
+
return new o({ persistToStorage: !0 });
|
|
145
|
+
const t = m();
|
|
146
|
+
return t ? new p(t) : (console.warn(
|
|
145
147
|
"[lxpack] No SCORM 2004 API found; using in-memory simulator"
|
|
146
|
-
), new
|
|
148
|
+
), new o({ persistToStorage: !1 }));
|
|
149
|
+
}
|
|
150
|
+
function f(i = "preview") {
|
|
151
|
+
const t = d(
|
|
152
|
+
i === "preview" ? "preview" : "scorm2004"
|
|
153
|
+
);
|
|
154
|
+
if (i === "preview") {
|
|
155
|
+
const e = window;
|
|
156
|
+
e.API_1484_11 = t;
|
|
157
|
+
}
|
|
158
|
+
return t;
|
|
147
159
|
}
|
|
148
160
|
export {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
161
|
+
p as Scorm2004Adapter,
|
|
162
|
+
o as Scorm2004Simulator,
|
|
163
|
+
d as createScorm2004Connection,
|
|
164
|
+
m as findScorm2004Api,
|
|
165
|
+
f as installScorm2004API
|
|
153
166
|
};
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
const D = 4096;
|
|
2
|
+
function c(s) {
|
|
3
|
+
var n;
|
|
4
|
+
const e = {
|
|
5
|
+
c: s.currentLessonId,
|
|
6
|
+
l: s.completedLessons,
|
|
7
|
+
a: s.assessmentScores,
|
|
8
|
+
s: s.suspendData
|
|
9
|
+
};
|
|
10
|
+
return (n = e.l) != null && n.length || delete e.l, (!e.a || !Object.keys(e.a).length) && delete e.a, (!e.s || !Object.keys(e.s).length) && delete e.s, e;
|
|
11
|
+
}
|
|
12
|
+
function l(s, e) {
|
|
13
|
+
return {
|
|
14
|
+
currentLessonId: s.c ?? e.currentLessonId,
|
|
15
|
+
completedLessons: Array.isArray(s.l) ? s.l : e.completedLessons,
|
|
16
|
+
assessmentScores: s.a && typeof s.a == "object" ? s.a : e.assessmentScores,
|
|
17
|
+
suspendData: s.s && typeof s.s == "object" ? s.s : e.suspendData
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function d(s) {
|
|
21
|
+
if (!s || typeof s != "object") return !1;
|
|
22
|
+
const e = s;
|
|
23
|
+
return "currentLessonId" in e || "completedLessons" in e || "assessmentScores" in e;
|
|
24
|
+
}
|
|
25
|
+
function f(s, e) {
|
|
26
|
+
return {
|
|
27
|
+
currentLessonId: s.currentLessonId ?? e.currentLessonId,
|
|
28
|
+
completedLessons: Array.isArray(s.completedLessons) ? s.completedLessons : e.completedLessons,
|
|
29
|
+
assessmentScores: s.assessmentScores && typeof s.assessmentScores == "object" ? s.assessmentScores : e.assessmentScores,
|
|
30
|
+
suspendData: s.suspendData && typeof s.suspendData == "object" ? s.suspendData : e.suspendData
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function p(s, e) {
|
|
34
|
+
try {
|
|
35
|
+
const n = JSON.parse(s);
|
|
36
|
+
return d(n) ? {
|
|
37
|
+
progress: f(n, e),
|
|
38
|
+
parsed: !0
|
|
39
|
+
} : { progress: l(n, e), parsed: !0 };
|
|
40
|
+
} catch {
|
|
41
|
+
return { progress: e, parsed: !1 };
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function o(s, e) {
|
|
45
|
+
return JSON.stringify(c(s)).length <= e;
|
|
46
|
+
}
|
|
47
|
+
function S(s, e) {
|
|
48
|
+
const n = { ...s.suspendData }, r = Object.keys(n).filter((i) => i.startsWith("interaction_")).sort();
|
|
49
|
+
for (const i of r) {
|
|
50
|
+
delete n[i];
|
|
51
|
+
const t = { ...s, suspendData: n };
|
|
52
|
+
if (o(t, e))
|
|
53
|
+
return t;
|
|
54
|
+
}
|
|
55
|
+
return { ...s, suspendData: n };
|
|
56
|
+
}
|
|
57
|
+
function L(s) {
|
|
58
|
+
return s.startsWith("interaction_") || s.startsWith("v:") || s.startsWith("assessment_attempts_") || s.startsWith("assessment_passing_");
|
|
59
|
+
}
|
|
60
|
+
function h(s, e) {
|
|
61
|
+
const n = { ...s.suspendData }, r = Object.keys(n).filter((t) => !L(t)).sort();
|
|
62
|
+
for (const t of r) {
|
|
63
|
+
delete n[t];
|
|
64
|
+
const a = { ...s, suspendData: n };
|
|
65
|
+
if (o(a, e))
|
|
66
|
+
return a;
|
|
67
|
+
}
|
|
68
|
+
const i = Object.keys(n).filter((t) => t.startsWith("v:")).sort();
|
|
69
|
+
for (const t of i) {
|
|
70
|
+
delete n[t];
|
|
71
|
+
const a = { ...s, suspendData: n };
|
|
72
|
+
if (o(a, e))
|
|
73
|
+
return a;
|
|
74
|
+
}
|
|
75
|
+
return { ...s, suspendData: n };
|
|
76
|
+
}
|
|
77
|
+
function u(s) {
|
|
78
|
+
const e = {};
|
|
79
|
+
for (const [n, r] of Object.entries(s.suspendData))
|
|
80
|
+
(n.startsWith("assessment_attempts_") || n.startsWith("assessment_passing_")) && (e[n] = r);
|
|
81
|
+
return e;
|
|
82
|
+
}
|
|
83
|
+
function m(s, e) {
|
|
84
|
+
let n = {
|
|
85
|
+
currentLessonId: s.currentLessonId,
|
|
86
|
+
completedLessons: [...s.completedLessons],
|
|
87
|
+
assessmentScores: { ...s.assessmentScores },
|
|
88
|
+
suspendData: u(s)
|
|
89
|
+
};
|
|
90
|
+
if (o(n, e))
|
|
91
|
+
return JSON.stringify(c(n));
|
|
92
|
+
for (; n.completedLessons.length > 0; )
|
|
93
|
+
if (n.completedLessons.pop(), o(n, e))
|
|
94
|
+
return JSON.stringify(c(n));
|
|
95
|
+
const r = Object.keys(n.assessmentScores);
|
|
96
|
+
for (; r.length > 0; )
|
|
97
|
+
if (delete n.assessmentScores[r.pop()], o(n, e))
|
|
98
|
+
return JSON.stringify(c(n));
|
|
99
|
+
n = {
|
|
100
|
+
currentLessonId: s.currentLessonId,
|
|
101
|
+
completedLessons: [],
|
|
102
|
+
assessmentScores: {},
|
|
103
|
+
suspendData: u(s)
|
|
104
|
+
};
|
|
105
|
+
const i = JSON.stringify(c(n));
|
|
106
|
+
if (i.length <= e)
|
|
107
|
+
return i;
|
|
108
|
+
const t = JSON.stringify({
|
|
109
|
+
c: s.currentLessonId.slice(0, Math.max(0, e - 20))
|
|
110
|
+
});
|
|
111
|
+
return t.length <= e ? t : JSON.stringify({ c: "" });
|
|
112
|
+
}
|
|
113
|
+
function y(s, e = 4096) {
|
|
114
|
+
if (o(s, e))
|
|
115
|
+
return JSON.stringify(c(s));
|
|
116
|
+
let n = S(s, e);
|
|
117
|
+
return o(n, e) || (n = h(n, e), o(n, e)) ? JSON.stringify(c(n)) : (console.warn(
|
|
118
|
+
`[lxpack] suspend_data exceeds ${e} chars; using minimal progress snapshot`
|
|
119
|
+
), m(s, e));
|
|
120
|
+
}
|
|
121
|
+
function g(s, e = 4096) {
|
|
122
|
+
if (s.length <= e) return s;
|
|
123
|
+
console.warn(
|
|
124
|
+
`[lxpack] suspend_data exceeds ${e} chars; using minimal progress snapshot`
|
|
125
|
+
);
|
|
126
|
+
try {
|
|
127
|
+
const n = {
|
|
128
|
+
currentLessonId: "",
|
|
129
|
+
completedLessons: [],
|
|
130
|
+
assessmentScores: {},
|
|
131
|
+
suspendData: {}
|
|
132
|
+
}, { progress: r } = p(s, n);
|
|
133
|
+
return y(r, e);
|
|
134
|
+
} catch {
|
|
135
|
+
return JSON.stringify({ c: "" });
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
export {
|
|
139
|
+
D as S,
|
|
140
|
+
p,
|
|
141
|
+
y as s,
|
|
142
|
+
g as t
|
|
143
|
+
};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { AssessmentRuntimeConfig, CourseManifest, LearnerAssessment, Lesson, QuestionFeedback, RuntimeAssessmentBundle } from "@lxpack/validators";
|
|
2
|
+
/** Preview LMS persistence: localStorage vs SCORM 1.2/2004 simulators. */
|
|
3
|
+
export type PreviewScormMode = "local" | "scorm12" | "scorm2004";
|
|
2
4
|
export interface CourseProgress {
|
|
3
5
|
currentLessonId: string;
|
|
4
6
|
completedLessons: string[];
|
|
@@ -8,8 +10,15 @@ export interface CourseProgress {
|
|
|
8
10
|
export interface RuntimeConfig {
|
|
9
11
|
manifest: CourseManifest;
|
|
10
12
|
baseUrl: string;
|
|
11
|
-
mode: "preview" | "standalone" | "scorm12" | "scorm2004";
|
|
13
|
+
mode: "preview" | "standalone" | "scorm12" | "scorm2004" | "xapi" | "cmi5";
|
|
14
|
+
/** When mode is preview: local (default) or SCORM API simulators. */
|
|
15
|
+
previewScormMode?: PreviewScormMode;
|
|
12
16
|
activityId?: string;
|
|
17
|
+
activityIri?: string;
|
|
18
|
+
xapi?: {
|
|
19
|
+
previewLog?: boolean;
|
|
20
|
+
mockLrs?: boolean;
|
|
21
|
+
};
|
|
13
22
|
progress?: CourseProgress;
|
|
14
23
|
assessments?: RuntimeAssessmentBundle["assessments"];
|
|
15
24
|
answerKeys?: RuntimeAssessmentBundle["answerKeys"];
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,cAAc,EACd,iBAAiB,EACjB,MAAM,EACN,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,cAAc;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,cAAc,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,SAAS,GAAG,YAAY,GAAG,SAAS,GAAG,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,cAAc,EACd,iBAAiB,EACjB,MAAM,EACN,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,oBAAoB,CAAC;AAE5B,0EAA0E;AAC1E,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,SAAS,GAAG,WAAW,CAAC;AAEjE,MAAM,WAAW,cAAc;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,WAAW,EAAE,MAAM,CAAC,MAAM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C,gBAAgB,EAAE,CAChB,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,MAAM,KACjB,IAAI,CAAC;CACX;AAED,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lxpack/runtime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Web-native course runtime for LXPack",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -45,9 +45,11 @@
|
|
|
45
45
|
"dist"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
+
"dompurify": "^3.4.5",
|
|
48
49
|
"marked": "^15.0.7",
|
|
49
50
|
"yaml": "^2.7.0",
|
|
50
|
-
"@lxpack/validators": "0.
|
|
51
|
+
"@lxpack/validators": "0.3.0",
|
|
52
|
+
"@lxpack/xapi": "0.3.0"
|
|
51
53
|
},
|
|
52
54
|
"devDependencies": {
|
|
53
55
|
"@types/node": "^22.13.10",
|