@learnmd/core 0.0.1-beta.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 +21 -0
- package/README.md +30 -0
- package/dist/components/LearnMDProvider.d.ts +33 -0
- package/dist/components/LearnMDProvider.d.ts.map +1 -0
- package/dist/components/LearnMDProvider.js +16 -0
- package/dist/components/LearnMDProvider.js.map +1 -0
- package/dist/gamification/index.d.ts +77 -0
- package/dist/gamification/index.d.ts.map +1 -0
- package/dist/gamification/index.js +402 -0
- package/dist/gamification/index.js.map +1 -0
- package/dist/i18n/index.d.ts +119 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +261 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/index.d.ts +81 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +77 -0
- package/dist/index.js.map +1 -0
- package/dist/parser/index.d.ts +57 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/parser/index.js +182 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/plugins/index.d.ts +150 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +291 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/pdf/index.d.ts +8 -0
- package/dist/plugins/pdf/index.d.ts.map +1 -0
- package/dist/plugins/pdf/index.js +53 -0
- package/dist/plugins/pdf/index.js.map +1 -0
- package/dist/router/index.d.ts +111 -0
- package/dist/router/index.d.ts.map +1 -0
- package/dist/router/index.js +268 -0
- package/dist/router/index.js.map +1 -0
- package/dist/storage/index.d.ts +110 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +390 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/types/index.d.ts +283 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +73 -0
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
import { openDB } from 'idb';
|
|
2
|
+
/**
|
|
3
|
+
* LocalStorage adapter for simple key-value storage
|
|
4
|
+
*/
|
|
5
|
+
export class LocalStorageAdapter {
|
|
6
|
+
constructor(prefix = 'learnmd') {
|
|
7
|
+
Object.defineProperty(this, "prefix", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
configurable: true,
|
|
10
|
+
writable: true,
|
|
11
|
+
value: void 0
|
|
12
|
+
});
|
|
13
|
+
this.prefix = prefix;
|
|
14
|
+
}
|
|
15
|
+
getKey(key) {
|
|
16
|
+
return `${this.prefix}:${key}`;
|
|
17
|
+
}
|
|
18
|
+
async get(key) {
|
|
19
|
+
try {
|
|
20
|
+
const item = localStorage.getItem(this.getKey(key));
|
|
21
|
+
if (!item)
|
|
22
|
+
return null;
|
|
23
|
+
return JSON.parse(item);
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
console.error('Error reading from localStorage:', error);
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
async set(key, value) {
|
|
31
|
+
try {
|
|
32
|
+
localStorage.setItem(this.getKey(key), JSON.stringify(value));
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
console.error('Error writing to localStorage:', error);
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
async remove(key) {
|
|
40
|
+
try {
|
|
41
|
+
localStorage.removeItem(this.getKey(key));
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
console.error('Error removing from localStorage:', error);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async clear() {
|
|
48
|
+
try {
|
|
49
|
+
const keys = Object.keys(localStorage).filter((key) => key.startsWith(`${this.prefix}:`));
|
|
50
|
+
keys.forEach((key) => localStorage.removeItem(key));
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
console.error('Error clearing localStorage:', error);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
async keys() {
|
|
57
|
+
const keys = [];
|
|
58
|
+
for (let i = 0; i < localStorage.length; i++) {
|
|
59
|
+
const key = localStorage.key(i);
|
|
60
|
+
if (key?.startsWith(`${this.prefix}:`)) {
|
|
61
|
+
keys.push(key.replace(`${this.prefix}:`, ''));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return keys;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* IndexedDB adapter for larger data storage (offline content)
|
|
69
|
+
*/
|
|
70
|
+
export class IndexedDBAdapter {
|
|
71
|
+
constructor(dbName = 'learnmd-db', dbVersion = 1) {
|
|
72
|
+
Object.defineProperty(this, "dbName", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
configurable: true,
|
|
75
|
+
writable: true,
|
|
76
|
+
value: void 0
|
|
77
|
+
});
|
|
78
|
+
Object.defineProperty(this, "dbVersion", {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
configurable: true,
|
|
81
|
+
writable: true,
|
|
82
|
+
value: void 0
|
|
83
|
+
});
|
|
84
|
+
Object.defineProperty(this, "db", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
configurable: true,
|
|
87
|
+
writable: true,
|
|
88
|
+
value: null
|
|
89
|
+
});
|
|
90
|
+
this.dbName = dbName;
|
|
91
|
+
this.dbVersion = dbVersion;
|
|
92
|
+
}
|
|
93
|
+
async getDB() {
|
|
94
|
+
if (this.db)
|
|
95
|
+
return this.db;
|
|
96
|
+
this.db = await openDB(this.dbName, this.dbVersion, {
|
|
97
|
+
upgrade(db) {
|
|
98
|
+
// Course content store
|
|
99
|
+
if (!db.objectStoreNames.contains('courses')) {
|
|
100
|
+
db.createObjectStore('courses', { keyPath: 'id' });
|
|
101
|
+
}
|
|
102
|
+
// Cached content store
|
|
103
|
+
if (!db.objectStoreNames.contains('cache')) {
|
|
104
|
+
db.createObjectStore('cache', { keyPath: 'key' });
|
|
105
|
+
}
|
|
106
|
+
// User data store
|
|
107
|
+
if (!db.objectStoreNames.contains('userData')) {
|
|
108
|
+
db.createObjectStore('userData', { keyPath: 'key' });
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
return this.db;
|
|
113
|
+
}
|
|
114
|
+
async get(key, storeName = 'userData') {
|
|
115
|
+
try {
|
|
116
|
+
const db = await this.getDB();
|
|
117
|
+
const tx = db.transaction(storeName, 'readonly');
|
|
118
|
+
const store = tx.objectStore(storeName);
|
|
119
|
+
const result = await store.get(key);
|
|
120
|
+
return result || null;
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
console.error('Error reading from IndexedDB:', error);
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
async set(key, value, storeName = 'userData') {
|
|
128
|
+
try {
|
|
129
|
+
const db = await this.getDB();
|
|
130
|
+
const tx = db.transaction(storeName, 'readwrite');
|
|
131
|
+
const store = tx.objectStore(storeName);
|
|
132
|
+
await store.put({ key, value, updatedAt: Date.now() });
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
console.error('Error writing to IndexedDB:', error);
|
|
136
|
+
throw error;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
async remove(key, storeName = 'userData') {
|
|
140
|
+
try {
|
|
141
|
+
const db = await this.getDB();
|
|
142
|
+
const tx = db.transaction(storeName, 'readwrite');
|
|
143
|
+
const store = tx.objectStore(storeName);
|
|
144
|
+
await store.delete(key);
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
console.error('Error removing from IndexedDB:', error);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
async clear(storeName = 'userData') {
|
|
151
|
+
try {
|
|
152
|
+
const db = await this.getDB();
|
|
153
|
+
const tx = db.transaction(storeName, 'readwrite');
|
|
154
|
+
const store = tx.objectStore(storeName);
|
|
155
|
+
await store.clear();
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
console.error('Error clearing IndexedDB:', error);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
async keys(storeName = 'userData') {
|
|
162
|
+
try {
|
|
163
|
+
const db = await this.getDB();
|
|
164
|
+
const tx = db.transaction(storeName, 'readonly');
|
|
165
|
+
const store = tx.objectStore(storeName);
|
|
166
|
+
const allKeys = await store.getAllKeys();
|
|
167
|
+
return allKeys;
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
console.error('Error getting keys from IndexedDB:', error);
|
|
171
|
+
return [];
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Cache course content for offline use
|
|
176
|
+
*/
|
|
177
|
+
async cacheCourse(courseId, content) {
|
|
178
|
+
await this.set(`course:${courseId}`, content, 'cache');
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Get cached course content
|
|
182
|
+
*/
|
|
183
|
+
async getCachedCourse(courseId) {
|
|
184
|
+
const cached = await this.get(`course:${courseId}`, 'cache');
|
|
185
|
+
return cached?.value ?? null;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Clear cache older than specified milliseconds
|
|
189
|
+
*/
|
|
190
|
+
async clearOldCache(maxAge) {
|
|
191
|
+
try {
|
|
192
|
+
const db = await this.getDB();
|
|
193
|
+
const tx = db.transaction('cache', 'readwrite');
|
|
194
|
+
const store = tx.objectStore('cache');
|
|
195
|
+
const allItems = await store.getAll();
|
|
196
|
+
const now = Date.now();
|
|
197
|
+
for (const item of allItems) {
|
|
198
|
+
if (item.updatedAt && now - item.updatedAt > maxAge) {
|
|
199
|
+
await store.delete(item.key);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
console.error('Error clearing old cache:', error);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Combined storage manager using both LocalStorage and IndexedDB
|
|
210
|
+
*/
|
|
211
|
+
export class StorageManager {
|
|
212
|
+
constructor() {
|
|
213
|
+
Object.defineProperty(this, "localStorage", {
|
|
214
|
+
enumerable: true,
|
|
215
|
+
configurable: true,
|
|
216
|
+
writable: true,
|
|
217
|
+
value: void 0
|
|
218
|
+
});
|
|
219
|
+
Object.defineProperty(this, "_indexedDB", {
|
|
220
|
+
enumerable: true,
|
|
221
|
+
configurable: true,
|
|
222
|
+
writable: true,
|
|
223
|
+
value: void 0
|
|
224
|
+
});
|
|
225
|
+
this.localStorage = new LocalStorageAdapter();
|
|
226
|
+
this._indexedDB = new IndexedDBAdapter();
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Get the IndexedDB adapter for advanced operations
|
|
230
|
+
*/
|
|
231
|
+
get indexedDB() {
|
|
232
|
+
return this._indexedDB;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Get user profile
|
|
236
|
+
*/
|
|
237
|
+
async getUserProfile() {
|
|
238
|
+
return this.localStorage.get('userProfile');
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Save user profile
|
|
242
|
+
*/
|
|
243
|
+
async saveUserProfile(profile) {
|
|
244
|
+
await this.localStorage.set('userProfile', profile);
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Get course progress
|
|
248
|
+
*/
|
|
249
|
+
async getCourseProgress(courseId) {
|
|
250
|
+
return this.localStorage.get(`progress:${courseId}`);
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Save course progress
|
|
254
|
+
*/
|
|
255
|
+
async saveCourseProgress(progress) {
|
|
256
|
+
await this.localStorage.set(`progress:${progress.courseId}`, progress);
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Get lesson progress
|
|
260
|
+
*/
|
|
261
|
+
async getLessonProgress(courseId, lessonSlug) {
|
|
262
|
+
const courseProgress = await this.getCourseProgress(courseId);
|
|
263
|
+
if (!courseProgress)
|
|
264
|
+
return null;
|
|
265
|
+
return courseProgress.lessons[lessonSlug] || null;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Update lesson progress
|
|
269
|
+
*/
|
|
270
|
+
async updateLessonProgress(courseId, lessonSlug, progress) {
|
|
271
|
+
let courseProgress = await this.getCourseProgress(courseId);
|
|
272
|
+
if (!courseProgress) {
|
|
273
|
+
courseProgress = {
|
|
274
|
+
courseId,
|
|
275
|
+
lessons: {},
|
|
276
|
+
completedLessons: [],
|
|
277
|
+
totalPoints: 0,
|
|
278
|
+
badges: [],
|
|
279
|
+
startedAt: Date.now(),
|
|
280
|
+
lastAccessedAt: Date.now(),
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
const existingProgress = courseProgress.lessons[lessonSlug] || {
|
|
284
|
+
lessonSlug,
|
|
285
|
+
completed: false,
|
|
286
|
+
timeSpent: 0,
|
|
287
|
+
lastAccessedAt: Date.now(),
|
|
288
|
+
};
|
|
289
|
+
courseProgress.lessons[lessonSlug] = {
|
|
290
|
+
...existingProgress,
|
|
291
|
+
...progress,
|
|
292
|
+
lastAccessedAt: Date.now(),
|
|
293
|
+
};
|
|
294
|
+
// Update completed lessons list
|
|
295
|
+
if (progress.completed && !courseProgress.completedLessons.includes(lessonSlug)) {
|
|
296
|
+
courseProgress.completedLessons.push(lessonSlug);
|
|
297
|
+
}
|
|
298
|
+
// Update total points
|
|
299
|
+
if (progress.points) {
|
|
300
|
+
courseProgress.totalPoints += progress.points;
|
|
301
|
+
}
|
|
302
|
+
courseProgress.lastAccessedAt = Date.now();
|
|
303
|
+
await this.saveCourseProgress(courseProgress);
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Mark lesson as completed
|
|
307
|
+
*/
|
|
308
|
+
async completeLesson(courseId, lessonSlug, quizScore, quizPassed) {
|
|
309
|
+
await this.updateLessonProgress(courseId, lessonSlug, {
|
|
310
|
+
completed: true,
|
|
311
|
+
completedAt: Date.now(),
|
|
312
|
+
quizScore,
|
|
313
|
+
quizPassed,
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Track time spent on lesson
|
|
318
|
+
*/
|
|
319
|
+
async trackTimeSpent(courseId, lessonSlug, seconds) {
|
|
320
|
+
const progress = await this.getLessonProgress(courseId, lessonSlug);
|
|
321
|
+
const currentTimeSpent = progress?.timeSpent || 0;
|
|
322
|
+
await this.updateLessonProgress(courseId, lessonSlug, {
|
|
323
|
+
timeSpent: currentTimeSpent + seconds,
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Get all course progress
|
|
328
|
+
*/
|
|
329
|
+
async getAllCourseProgress() {
|
|
330
|
+
const keys = await this.localStorage.keys();
|
|
331
|
+
const progressKeys = keys.filter((key) => key.startsWith('progress:'));
|
|
332
|
+
const result = {};
|
|
333
|
+
for (const key of progressKeys) {
|
|
334
|
+
const progress = await this.localStorage.get(key);
|
|
335
|
+
if (progress) {
|
|
336
|
+
result[key.replace('progress:', '')] = progress;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
return result;
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Reset course progress
|
|
343
|
+
*/
|
|
344
|
+
async resetCourseProgress(courseId) {
|
|
345
|
+
await this.localStorage.remove(`progress:${courseId}`);
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Clear all progress data
|
|
349
|
+
*/
|
|
350
|
+
async clearAllProgress() {
|
|
351
|
+
const keys = await this.localStorage.keys();
|
|
352
|
+
const progressKeys = keys.filter((key) => key.startsWith('progress:'));
|
|
353
|
+
for (const key of progressKeys) {
|
|
354
|
+
await this.localStorage.remove(key);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Export all data
|
|
359
|
+
*/
|
|
360
|
+
async exportData() {
|
|
361
|
+
const userProfile = await this.getUserProfile();
|
|
362
|
+
const courseProgress = await this.getAllCourseProgress();
|
|
363
|
+
return {
|
|
364
|
+
userProfile,
|
|
365
|
+
courseProgress,
|
|
366
|
+
exportedAt: Date.now(),
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Import data
|
|
371
|
+
*/
|
|
372
|
+
async importData(data) {
|
|
373
|
+
if (data.userProfile) {
|
|
374
|
+
await this.saveUserProfile(data.userProfile);
|
|
375
|
+
}
|
|
376
|
+
if (data.courseProgress) {
|
|
377
|
+
for (const [courseId, progress] of Object.entries(data.courseProgress)) {
|
|
378
|
+
progress.courseId = courseId;
|
|
379
|
+
await this.saveCourseProgress(progress);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Create storage manager instance
|
|
386
|
+
*/
|
|
387
|
+
export function createStorageManager() {
|
|
388
|
+
return new StorageManager();
|
|
389
|
+
}
|
|
390
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAqB,MAAM,KAAK,CAAC;AAGhD;;GAEG;AACH,MAAM,OAAO,mBAAmB;IAG9B,YAAY,MAAM,GAAG,SAAS;QAFtB;;;;;WAAe;QAGrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAEO,MAAM,CAAC,GAAW;QACxB,OAAO,GAAG,IAAI,CAAC,MAAM,IAAI,GAAG,EAAE,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,GAAG,CAAI,GAAW;QACtB,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;YACpD,IAAI,CAAC,IAAI;gBAAE,OAAO,IAAI,CAAC;YACvB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAM,CAAC;QAC/B,CAAC;QAAC,OAAO,KAAK,EAAE,CAA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AQ,CAAC,QAAQ,GAAG,QAAQ,CAAC;gBAC7B,MAAM,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;IACH,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO,IAAI,cAAc,EAAE,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Course metadata from frontmatter
|
|
3
|
+
*/
|
|
4
|
+
export interface CourseFrontmatter {
|
|
5
|
+
title: string | TranslatedString;
|
|
6
|
+
description?: string | TranslatedString;
|
|
7
|
+
duration?: string;
|
|
8
|
+
difficulty?: 'beginner' | 'intermediate' | 'advanced';
|
|
9
|
+
badge?: string;
|
|
10
|
+
points?: number;
|
|
11
|
+
cover?: string;
|
|
12
|
+
authors?: string[];
|
|
13
|
+
version?: string;
|
|
14
|
+
lastUpdated?: string;
|
|
15
|
+
prerequisites?: string[];
|
|
16
|
+
learningObjectives?: string[];
|
|
17
|
+
i18n?: I18nConfig;
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Translated string with language codes as keys
|
|
22
|
+
*/
|
|
23
|
+
export interface TranslatedString {
|
|
24
|
+
[lang: string]: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* i18n configuration for a course/lesson
|
|
28
|
+
*/
|
|
29
|
+
export interface I18nConfig {
|
|
30
|
+
defaultLanguage: string;
|
|
31
|
+
availableLanguages: string[];
|
|
32
|
+
translations?: Record<string, Record<string, string>>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Parsed lesson content
|
|
36
|
+
*/
|
|
37
|
+
export interface Lesson {
|
|
38
|
+
slug: string;
|
|
39
|
+
frontmatter: CourseFrontmatter;
|
|
40
|
+
content: string;
|
|
41
|
+
html?: string;
|
|
42
|
+
sections?: LessonSection[];
|
|
43
|
+
quiz?: Quiz;
|
|
44
|
+
order?: number;
|
|
45
|
+
moduleId?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Lesson section for navigation
|
|
49
|
+
*/
|
|
50
|
+
export interface LessonSection {
|
|
51
|
+
id: string;
|
|
52
|
+
title: string;
|
|
53
|
+
level: number;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Quiz configuration
|
|
57
|
+
*/
|
|
58
|
+
export interface Quiz {
|
|
59
|
+
id: string;
|
|
60
|
+
questions: QuizQuestion[];
|
|
61
|
+
passingScore?: number;
|
|
62
|
+
allowRetry?: boolean;
|
|
63
|
+
showCorrectAnswers?: boolean;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Quiz question
|
|
67
|
+
*/
|
|
68
|
+
export interface QuizQuestion {
|
|
69
|
+
id: string;
|
|
70
|
+
type: 'multiple-choice' | 'true-false' | 'input';
|
|
71
|
+
question: string | TranslatedString;
|
|
72
|
+
options?: Array<{
|
|
73
|
+
id: string;
|
|
74
|
+
label: string | TranslatedString;
|
|
75
|
+
}>;
|
|
76
|
+
correctAnswer: string | string[];
|
|
77
|
+
explanation?: string | TranslatedString;
|
|
78
|
+
points?: number;
|
|
79
|
+
i18n?: QuizI18n;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Quiz option for multiple choice questions
|
|
83
|
+
*/
|
|
84
|
+
export interface QuizOption {
|
|
85
|
+
id: string;
|
|
86
|
+
label: string | TranslatedString;
|
|
87
|
+
isCorrect?: boolean;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* i18n for quiz questions
|
|
91
|
+
*/
|
|
92
|
+
export interface QuizI18n {
|
|
93
|
+
[lang: string]: {
|
|
94
|
+
question?: string;
|
|
95
|
+
options?: {
|
|
96
|
+
id: string;
|
|
97
|
+
label: string;
|
|
98
|
+
}[];
|
|
99
|
+
explanation?: string;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Course structure
|
|
104
|
+
*/
|
|
105
|
+
export interface Course {
|
|
106
|
+
id: string;
|
|
107
|
+
title: string | TranslatedString;
|
|
108
|
+
description?: string | TranslatedString;
|
|
109
|
+
modules: CourseModule[];
|
|
110
|
+
lessons: Lesson[];
|
|
111
|
+
frontmatter: CourseFrontmatter;
|
|
112
|
+
basePath: string;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Course module (group of lessons)
|
|
116
|
+
*/
|
|
117
|
+
export interface CourseModule {
|
|
118
|
+
id: string;
|
|
119
|
+
title: string | TranslatedString;
|
|
120
|
+
description?: string | TranslatedString;
|
|
121
|
+
lessons: string[];
|
|
122
|
+
order?: number;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* User progress for a lesson
|
|
126
|
+
*/
|
|
127
|
+
export interface LessonProgress {
|
|
128
|
+
lessonSlug: string;
|
|
129
|
+
completed: boolean;
|
|
130
|
+
completedAt?: number;
|
|
131
|
+
quizScore?: number;
|
|
132
|
+
quizPassed?: boolean;
|
|
133
|
+
timeSpent: number;
|
|
134
|
+
lastAccessedAt: number;
|
|
135
|
+
points?: number;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* User progress for a course
|
|
139
|
+
*/
|
|
140
|
+
export interface CourseProgress {
|
|
141
|
+
courseId: string;
|
|
142
|
+
lessons: Record<string, LessonProgress>;
|
|
143
|
+
completedLessons: string[];
|
|
144
|
+
totalPoints: number;
|
|
145
|
+
badges: string[];
|
|
146
|
+
startedAt: number;
|
|
147
|
+
completedAt?: number;
|
|
148
|
+
lastAccessedAt: number;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* User profile with gamification
|
|
152
|
+
*/
|
|
153
|
+
export interface UserProfile {
|
|
154
|
+
id: string;
|
|
155
|
+
name?: string;
|
|
156
|
+
email?: string;
|
|
157
|
+
totalPoints: number;
|
|
158
|
+
badges: Badge[];
|
|
159
|
+
coursesProgress: Record<string, CourseProgress>;
|
|
160
|
+
streak: {
|
|
161
|
+
current: number;
|
|
162
|
+
longest: number;
|
|
163
|
+
lastActiveDate: string;
|
|
164
|
+
};
|
|
165
|
+
achievements: Achievement[];
|
|
166
|
+
createdAt: number;
|
|
167
|
+
updatedAt: number;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Badge earned by user
|
|
171
|
+
*/
|
|
172
|
+
export interface Badge {
|
|
173
|
+
id: string;
|
|
174
|
+
name: string | TranslatedString;
|
|
175
|
+
description: string | TranslatedString;
|
|
176
|
+
icon?: string;
|
|
177
|
+
earnedAt: number;
|
|
178
|
+
courseId?: string;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Achievement unlocked
|
|
182
|
+
*/
|
|
183
|
+
export interface Achievement {
|
|
184
|
+
id: string;
|
|
185
|
+
name: string | TranslatedString;
|
|
186
|
+
description: string | TranslatedString;
|
|
187
|
+
unlockedAt: number;
|
|
188
|
+
criteria: AchievementCriteria;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Achievement criteria
|
|
192
|
+
*/
|
|
193
|
+
export interface AchievementCriteria {
|
|
194
|
+
type: 'lessons_completed' | 'points_earned' | 'streak_days' | 'quizzes_passed';
|
|
195
|
+
value: number;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Plugin interface
|
|
199
|
+
*/
|
|
200
|
+
export interface Plugin {
|
|
201
|
+
name: string;
|
|
202
|
+
version: string;
|
|
203
|
+
onLoad: (ctx: PluginContext) => void | Promise<void>;
|
|
204
|
+
onUnload?: (ctx: PluginContext) => void | Promise<void>;
|
|
205
|
+
config?: PluginConfig;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Plugin context provided to plugins
|
|
209
|
+
*/
|
|
210
|
+
export interface PluginContext {
|
|
211
|
+
course: Course;
|
|
212
|
+
storage: StorageAdapter;
|
|
213
|
+
i18n: I18nAdapter;
|
|
214
|
+
registerComponent: (name: string, component: unknown) => void;
|
|
215
|
+
registerHook: (hook: string, fn: (...args: unknown[]) => unknown) => void;
|
|
216
|
+
config: Record<string, unknown>;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Plugin configuration
|
|
220
|
+
*/
|
|
221
|
+
export interface PluginConfig {
|
|
222
|
+
[key: string]: unknown;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Storage adapter interface
|
|
226
|
+
*/
|
|
227
|
+
export interface StorageAdapter {
|
|
228
|
+
get<T>(key: string): Promise<T | null>;
|
|
229
|
+
set<T>(key: string, value: T): Promise<void>;
|
|
230
|
+
remove(key: string): Promise<void>;
|
|
231
|
+
clear(): Promise<void>;
|
|
232
|
+
keys(): Promise<string[]>;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* i18n adapter interface
|
|
236
|
+
*/
|
|
237
|
+
export interface I18nAdapter {
|
|
238
|
+
currentLanguage: string;
|
|
239
|
+
availableLanguages: string[];
|
|
240
|
+
setLanguage(lang: string): void;
|
|
241
|
+
translate(key: string, lang?: string): string;
|
|
242
|
+
translateObject<T extends Record<string, unknown>>(obj: T, lang?: string): T;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Search result
|
|
246
|
+
*/
|
|
247
|
+
export interface SearchResult {
|
|
248
|
+
lessonSlug: string;
|
|
249
|
+
lessonTitle: string;
|
|
250
|
+
moduleId?: string;
|
|
251
|
+
moduleTitle?: string;
|
|
252
|
+
excerpt: string;
|
|
253
|
+
score: number;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Video embed configuration
|
|
257
|
+
*/
|
|
258
|
+
export interface VideoEmbedConfig {
|
|
259
|
+
provider: 'youtube' | 'vimeo' | 'onedrive' | 'googledrive' | 'custom';
|
|
260
|
+
id?: string;
|
|
261
|
+
url?: string;
|
|
262
|
+
title?: string;
|
|
263
|
+
startTime?: number;
|
|
264
|
+
endTime?: number;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Theme configuration
|
|
268
|
+
*/
|
|
269
|
+
export interface ThemeConfig {
|
|
270
|
+
primaryColor: string;
|
|
271
|
+
secondaryColor: string;
|
|
272
|
+
backgroundColor: string;
|
|
273
|
+
textColor: string;
|
|
274
|
+
fontFamily: string;
|
|
275
|
+
borderRadius: number;
|
|
276
|
+
darkMode: {
|
|
277
|
+
enabled: boolean;
|
|
278
|
+
primaryColor: string;
|
|
279
|
+
backgroundColor: string;
|
|
280
|
+
textColor: string;
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,GAAG,gBAAgB,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,UAAU,GAAG,cAAc,GAAG,UAAU,CAAC;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,eAA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