@lxpack/runtime 0.1.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/LICENSE +190 -0
- package/dist/client.js +6684 -0
- package/dist/runtime.d.ts +32 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +411 -0
- package/dist/scorm-api.d.ts +81 -0
- package/dist/scorm-api.d.ts.map +1 -0
- package/dist/styles.css +246 -0
- package/dist/types.d.ts +28 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +58 -0
package/dist/styles.css
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--lxpack-bg: #0f1419;
|
|
3
|
+
--lxpack-surface: #1a2332;
|
|
4
|
+
--lxpack-border: #2d3a4f;
|
|
5
|
+
--lxpack-text: #e8edf4;
|
|
6
|
+
--lxpack-muted: #8b9cb3;
|
|
7
|
+
--lxpack-accent: #3b82f6;
|
|
8
|
+
--lxpack-accent-hover: #2563eb;
|
|
9
|
+
--lxpack-success: #22c55e;
|
|
10
|
+
--lxpack-radius: 8px;
|
|
11
|
+
--lxpack-font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
*,
|
|
15
|
+
*::before,
|
|
16
|
+
*::after {
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
body {
|
|
21
|
+
margin: 0;
|
|
22
|
+
font-family: var(--lxpack-font);
|
|
23
|
+
background: var(--lxpack-bg);
|
|
24
|
+
color: var(--lxpack-text);
|
|
25
|
+
line-height: 1.6;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.lxpack-layout {
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: column;
|
|
31
|
+
min-height: 100vh;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.lxpack-header {
|
|
35
|
+
padding: 1rem 1.5rem;
|
|
36
|
+
border-bottom: 1px solid var(--lxpack-border);
|
|
37
|
+
background: var(--lxpack-surface);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.lxpack-title {
|
|
41
|
+
margin: 0;
|
|
42
|
+
font-size: 1.25rem;
|
|
43
|
+
font-weight: 600;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.lxpack-version {
|
|
47
|
+
margin: 0.25rem 0 0;
|
|
48
|
+
font-size: 0.875rem;
|
|
49
|
+
color: var(--lxpack-muted);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.lxpack-body {
|
|
53
|
+
display: flex;
|
|
54
|
+
flex: 1;
|
|
55
|
+
min-height: 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.lxpack-nav {
|
|
59
|
+
width: 220px;
|
|
60
|
+
flex-shrink: 0;
|
|
61
|
+
padding: 1rem;
|
|
62
|
+
border-right: 1px solid var(--lxpack-border);
|
|
63
|
+
background: var(--lxpack-surface);
|
|
64
|
+
display: flex;
|
|
65
|
+
flex-direction: column;
|
|
66
|
+
gap: 0.25rem;
|
|
67
|
+
overflow-y: auto;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.lxpack-nav-item {
|
|
71
|
+
display: block;
|
|
72
|
+
width: 100%;
|
|
73
|
+
padding: 0.5rem 0.75rem;
|
|
74
|
+
text-align: left;
|
|
75
|
+
background: transparent;
|
|
76
|
+
border: 1px solid transparent;
|
|
77
|
+
border-radius: var(--lxpack-radius);
|
|
78
|
+
color: var(--lxpack-text);
|
|
79
|
+
font: inherit;
|
|
80
|
+
cursor: pointer;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.lxpack-nav-item:hover {
|
|
84
|
+
background: var(--lxpack-bg);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.lxpack-nav-item.active {
|
|
88
|
+
border-color: var(--lxpack-accent);
|
|
89
|
+
background: color-mix(in srgb, var(--lxpack-accent) 15%, transparent);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.lxpack-nav-item.completed::after {
|
|
93
|
+
content: " ✓";
|
|
94
|
+
color: var(--lxpack-success);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.lxpack-content {
|
|
98
|
+
flex: 1;
|
|
99
|
+
padding: 1.5rem;
|
|
100
|
+
overflow-y: auto;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.lxpack-markdown h1,
|
|
104
|
+
.lxpack-markdown h2,
|
|
105
|
+
.lxpack-markdown h3 {
|
|
106
|
+
margin-top: 1.5em;
|
|
107
|
+
margin-bottom: 0.5em;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.lxpack-markdown h1:first-child {
|
|
111
|
+
margin-top: 0;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.lxpack-markdown code {
|
|
115
|
+
background: var(--lxpack-surface);
|
|
116
|
+
padding: 0.125em 0.375em;
|
|
117
|
+
border-radius: 4px;
|
|
118
|
+
font-size: 0.9em;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.lxpack-markdown pre {
|
|
122
|
+
background: var(--lxpack-surface);
|
|
123
|
+
padding: 1rem;
|
|
124
|
+
border-radius: var(--lxpack-radius);
|
|
125
|
+
overflow-x: auto;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.lxpack-interaction-frame {
|
|
129
|
+
width: 100%;
|
|
130
|
+
min-height: 480px;
|
|
131
|
+
border: 1px solid var(--lxpack-border);
|
|
132
|
+
border-radius: var(--lxpack-radius);
|
|
133
|
+
background: #fff;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.lxpack-footer {
|
|
137
|
+
padding: 1rem 1.5rem;
|
|
138
|
+
border-top: 1px solid var(--lxpack-border);
|
|
139
|
+
background: var(--lxpack-surface);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.lxpack-progress-bar {
|
|
143
|
+
height: 6px;
|
|
144
|
+
background: var(--lxpack-bg);
|
|
145
|
+
border-radius: 3px;
|
|
146
|
+
overflow: hidden;
|
|
147
|
+
margin-bottom: 1rem;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.lxpack-progress-fill {
|
|
151
|
+
height: 100%;
|
|
152
|
+
width: 0%;
|
|
153
|
+
background: var(--lxpack-accent);
|
|
154
|
+
transition: width 0.3s ease;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.lxpack-nav-buttons {
|
|
158
|
+
display: flex;
|
|
159
|
+
gap: 0.5rem;
|
|
160
|
+
flex-wrap: wrap;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.lxpack-nav-buttons button {
|
|
164
|
+
padding: 0.5rem 1rem;
|
|
165
|
+
font: inherit;
|
|
166
|
+
border-radius: var(--lxpack-radius);
|
|
167
|
+
border: 1px solid var(--lxpack-border);
|
|
168
|
+
background: var(--lxpack-bg);
|
|
169
|
+
color: var(--lxpack-text);
|
|
170
|
+
cursor: pointer;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.lxpack-nav-buttons button:hover:not(:disabled) {
|
|
174
|
+
border-color: var(--lxpack-accent);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.lxpack-nav-buttons button:disabled {
|
|
178
|
+
opacity: 0.5;
|
|
179
|
+
cursor: not-allowed;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.lxpack-complete-btn {
|
|
183
|
+
margin-left: auto;
|
|
184
|
+
background: var(--lxpack-accent) !important;
|
|
185
|
+
border-color: var(--lxpack-accent) !important;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.lxpack-complete-btn:hover:not(:disabled) {
|
|
189
|
+
background: var(--lxpack-accent-hover) !important;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.lxpack-error {
|
|
193
|
+
color: #f87171;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.lxpack-assessment {
|
|
197
|
+
max-width: 640px;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.lxpack-assessment h2 {
|
|
201
|
+
margin-top: 0;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.lxpack-question {
|
|
205
|
+
border: 1px solid var(--lxpack-border);
|
|
206
|
+
border-radius: var(--lxpack-radius);
|
|
207
|
+
padding: 1rem;
|
|
208
|
+
margin-bottom: 1rem;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.lxpack-choice {
|
|
212
|
+
display: block;
|
|
213
|
+
margin: 0.5rem 0;
|
|
214
|
+
cursor: pointer;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.lxpack-assessment-feedback {
|
|
218
|
+
margin-top: 1rem;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.lxpack-success-text {
|
|
222
|
+
color: var(--lxpack-success);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.lxpack-nav-assessment {
|
|
226
|
+
font-style: italic;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.lxpack-description {
|
|
230
|
+
color: var(--lxpack-muted);
|
|
231
|
+
margin: 0.25rem 0 0;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
@media (max-width: 768px) {
|
|
235
|
+
.lxpack-body {
|
|
236
|
+
flex-direction: column;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.lxpack-nav {
|
|
240
|
+
width: 100%;
|
|
241
|
+
flex-direction: row;
|
|
242
|
+
flex-wrap: wrap;
|
|
243
|
+
border-right: none;
|
|
244
|
+
border-bottom: 1px solid var(--lxpack-border);
|
|
245
|
+
}
|
|
246
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { CourseManifest, Lesson } from "@lxpack/validators";
|
|
2
|
+
export interface CourseProgress {
|
|
3
|
+
currentLessonId: string;
|
|
4
|
+
completedLessons: string[];
|
|
5
|
+
assessmentScores: Record<string, number>;
|
|
6
|
+
suspendData: Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
export interface RuntimeConfig {
|
|
9
|
+
manifest: CourseManifest;
|
|
10
|
+
baseUrl: string;
|
|
11
|
+
mode: "preview" | "standalone" | "scorm12";
|
|
12
|
+
progress?: CourseProgress;
|
|
13
|
+
}
|
|
14
|
+
export interface TrackEvent {
|
|
15
|
+
type: string;
|
|
16
|
+
id?: string;
|
|
17
|
+
data?: Record<string, unknown>;
|
|
18
|
+
}
|
|
19
|
+
export interface LxpackAPI {
|
|
20
|
+
track: (event: TrackEvent) => void;
|
|
21
|
+
completeLesson: (lessonId: string) => void;
|
|
22
|
+
getProgress: () => CourseProgress;
|
|
23
|
+
setVariable: (key: string, value: unknown) => void;
|
|
24
|
+
getVariable: (key: string) => unknown;
|
|
25
|
+
submitAssessment: (assessmentId: string, score: number, passingScore: number) => void;
|
|
26
|
+
}
|
|
27
|
+
export type { CourseManifest, Lesson };
|
|
28
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,oBAAoB,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,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,CAAC;IAC3C,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IACnC,cAAc,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,WAAW,EAAE,MAAM,cAAc,CAAC;IAClC,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnD,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IACtC,gBAAgB,EAAE,CAChB,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,MAAM,KACjB,IAAI,CAAC;CACX;AAED,YAAY,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lxpack/runtime",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Web-native course runtime for LXPack",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/eddiethedean/lxpack.git",
|
|
9
|
+
"directory": "packages/runtime"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/eddiethedean/lxpack/issues"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/eddiethedean/lxpack#readme",
|
|
15
|
+
"keywords": [
|
|
16
|
+
"lxpack",
|
|
17
|
+
"scorm",
|
|
18
|
+
"lms",
|
|
19
|
+
"elearning",
|
|
20
|
+
"runtime"
|
|
21
|
+
],
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=20"
|
|
24
|
+
},
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"type": "module",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/runtime.d.ts",
|
|
32
|
+
"import": "./dist/runtime.js"
|
|
33
|
+
},
|
|
34
|
+
"./client": "./dist/client.js"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"dist"
|
|
38
|
+
],
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"marked": "^15.0.7",
|
|
41
|
+
"yaml": "^2.7.0",
|
|
42
|
+
"@lxpack/validators": "0.1.0"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/node": "^22.13.10",
|
|
46
|
+
"happy-dom": "^17.4.4",
|
|
47
|
+
"typescript": "^5.8.3",
|
|
48
|
+
"vite": "^6.2.2",
|
|
49
|
+
"vitest": "^3.1.1"
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"build": "vite build && vite build -c vite.runtime.config.ts && tsc -p tsconfig.build.json --emitDeclarationOnly && cp src/styles.css dist/styles.css",
|
|
53
|
+
"dev": "vite build --watch",
|
|
54
|
+
"typecheck": "tsc --noEmit",
|
|
55
|
+
"test": "vitest run",
|
|
56
|
+
"test:coverage": "vitest run --coverage"
|
|
57
|
+
}
|
|
58
|
+
}
|