taleem-player 1.0.17 → 1.0.19
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 +0 -1
- package/dist/taleem-player.esm.js +29 -10
- package/dist/taleem-player.umd.js +29 -10
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -418,26 +418,20 @@ var EqSlide = {
|
|
|
418
418
|
type: "eq",
|
|
419
419
|
fromJSON(raw) {
|
|
420
420
|
const lines = raw.data ?? [];
|
|
421
|
-
const maxVisible = 3;
|
|
422
421
|
return Object.freeze({
|
|
423
422
|
type: "eq",
|
|
424
423
|
lines,
|
|
425
424
|
render({ activeIndex = -1 } = {}) {
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
start = activeIndex - (maxVisible - 1);
|
|
429
|
-
}
|
|
430
|
-
const visibleLines = lines.slice(start);
|
|
431
|
-
const activeLine = activeIndex >= 0 && activeIndex < lines.length ? lines[activeIndex] : null;
|
|
425
|
+
const safeIndex = activeIndex >= 0 && activeIndex < lines.length ? activeIndex : 0;
|
|
426
|
+
const activeLine = lines[safeIndex] || null;
|
|
432
427
|
const spItems = activeLine?.spItems ?? [];
|
|
433
428
|
return `
|
|
434
429
|
<section class="slide eq">
|
|
435
430
|
|
|
436
431
|
<ul class="eq-lines">
|
|
437
|
-
${
|
|
438
|
-
const realIndex = start + index;
|
|
432
|
+
${lines.map((line, index) => {
|
|
439
433
|
return `
|
|
440
|
-
<li class="eq-line ${
|
|
434
|
+
<li class="eq-line ${index === safeIndex ? "highlighted" : ""}">
|
|
441
435
|
${line.content}
|
|
442
436
|
</li>
|
|
443
437
|
`;
|
|
@@ -741,11 +735,36 @@ function getDeckEndTime(deck) {
|
|
|
741
735
|
}
|
|
742
736
|
return deck.deck[deck.deck.length - 1].end;
|
|
743
737
|
}
|
|
738
|
+
|
|
739
|
+
// src/utils/getDeckImages.js
|
|
740
|
+
function getDeckImages(deck) {
|
|
741
|
+
const images = /* @__PURE__ */ new Set();
|
|
742
|
+
if (deck.background?.backgroundImage && typeof deck.background.backgroundImage === "string") {
|
|
743
|
+
images.add(deck.background.backgroundImage.split("/").pop());
|
|
744
|
+
}
|
|
745
|
+
if (!Array.isArray(deck.deck)) return [];
|
|
746
|
+
deck.deck.forEach((slide) => {
|
|
747
|
+
slide.data?.forEach((item) => {
|
|
748
|
+
if (item.name === "image" && typeof item.content === "string") {
|
|
749
|
+
images.add(item.content.split("/").pop());
|
|
750
|
+
}
|
|
751
|
+
if (Array.isArray(item.spItems)) {
|
|
752
|
+
item.spItems.forEach((sp) => {
|
|
753
|
+
if (sp.type === "spImage" && typeof sp.content === "string") {
|
|
754
|
+
images.add(sp.content.split("/").pop());
|
|
755
|
+
}
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
});
|
|
759
|
+
});
|
|
760
|
+
return Array.from(images);
|
|
761
|
+
}
|
|
744
762
|
export {
|
|
745
763
|
assignMockTimings,
|
|
746
764
|
createTaleemBrowser,
|
|
747
765
|
createTaleemPlayer,
|
|
748
766
|
getDeckEndTime,
|
|
767
|
+
getDeckImages,
|
|
749
768
|
registerSlide,
|
|
750
769
|
resolveAssetPaths,
|
|
751
770
|
resolveBackground
|
|
@@ -24,6 +24,7 @@ var TaleemPlayer = (() => {
|
|
|
24
24
|
createTaleemBrowser: () => createTaleemBrowser,
|
|
25
25
|
createTaleemPlayer: () => createTaleemPlayer,
|
|
26
26
|
getDeckEndTime: () => getDeckEndTime,
|
|
27
|
+
getDeckImages: () => getDeckImages,
|
|
27
28
|
registerSlide: () => registerSlide,
|
|
28
29
|
resolveAssetPaths: () => resolveAssetPaths,
|
|
29
30
|
resolveBackground: () => resolveBackground
|
|
@@ -449,26 +450,20 @@ var TaleemPlayer = (() => {
|
|
|
449
450
|
type: "eq",
|
|
450
451
|
fromJSON(raw) {
|
|
451
452
|
const lines = raw.data ?? [];
|
|
452
|
-
const maxVisible = 3;
|
|
453
453
|
return Object.freeze({
|
|
454
454
|
type: "eq",
|
|
455
455
|
lines,
|
|
456
456
|
render({ activeIndex = -1 } = {}) {
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
start = activeIndex - (maxVisible - 1);
|
|
460
|
-
}
|
|
461
|
-
const visibleLines = lines.slice(start);
|
|
462
|
-
const activeLine = activeIndex >= 0 && activeIndex < lines.length ? lines[activeIndex] : null;
|
|
457
|
+
const safeIndex = activeIndex >= 0 && activeIndex < lines.length ? activeIndex : 0;
|
|
458
|
+
const activeLine = lines[safeIndex] || null;
|
|
463
459
|
const spItems = activeLine?.spItems ?? [];
|
|
464
460
|
return `
|
|
465
461
|
<section class="slide eq">
|
|
466
462
|
|
|
467
463
|
<ul class="eq-lines">
|
|
468
|
-
${
|
|
469
|
-
const realIndex = start + index;
|
|
464
|
+
${lines.map((line, index) => {
|
|
470
465
|
return `
|
|
471
|
-
<li class="eq-line ${
|
|
466
|
+
<li class="eq-line ${index === safeIndex ? "highlighted" : ""}">
|
|
472
467
|
${line.content}
|
|
473
468
|
</li>
|
|
474
469
|
`;
|
|
@@ -772,5 +767,29 @@ var TaleemPlayer = (() => {
|
|
|
772
767
|
}
|
|
773
768
|
return deck.deck[deck.deck.length - 1].end;
|
|
774
769
|
}
|
|
770
|
+
|
|
771
|
+
// src/utils/getDeckImages.js
|
|
772
|
+
function getDeckImages(deck) {
|
|
773
|
+
const images = /* @__PURE__ */ new Set();
|
|
774
|
+
if (deck.background?.backgroundImage && typeof deck.background.backgroundImage === "string") {
|
|
775
|
+
images.add(deck.background.backgroundImage.split("/").pop());
|
|
776
|
+
}
|
|
777
|
+
if (!Array.isArray(deck.deck)) return [];
|
|
778
|
+
deck.deck.forEach((slide) => {
|
|
779
|
+
slide.data?.forEach((item) => {
|
|
780
|
+
if (item.name === "image" && typeof item.content === "string") {
|
|
781
|
+
images.add(item.content.split("/").pop());
|
|
782
|
+
}
|
|
783
|
+
if (Array.isArray(item.spItems)) {
|
|
784
|
+
item.spItems.forEach((sp) => {
|
|
785
|
+
if (sp.type === "spImage" && typeof sp.content === "string") {
|
|
786
|
+
images.add(sp.content.split("/").pop());
|
|
787
|
+
}
|
|
788
|
+
});
|
|
789
|
+
}
|
|
790
|
+
});
|
|
791
|
+
});
|
|
792
|
+
return Array.from(images);
|
|
793
|
+
}
|
|
775
794
|
return __toCommonJS(index_exports);
|
|
776
795
|
})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "taleem-player",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.19",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/taleem-player.umd.js",
|
|
6
6
|
"module": "./dist/taleem-player.esm.js",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"./css/dark": "./dist/css/themes/dark.css",
|
|
23
23
|
"./css/light": "./dist/css/themes/light.css",
|
|
24
24
|
"./css/paper": "./dist/css/themes/paper.css",
|
|
25
|
+
"./css/default": "./dist/css/themes/default.css",
|
|
25
26
|
"./css/app": "./dist/css/app/app.css"
|
|
26
27
|
},
|
|
27
28
|
"files": [
|
|
@@ -29,8 +30,8 @@
|
|
|
29
30
|
],
|
|
30
31
|
"scripts": {
|
|
31
32
|
"build": "node ./scripts/build.js",
|
|
32
|
-
"dev": "vite",
|
|
33
|
-
"test": "vitest run"
|
|
33
|
+
"dev" : "vite",
|
|
34
|
+
"test" : "vitest run"
|
|
34
35
|
},
|
|
35
36
|
"dependencies": {
|
|
36
37
|
"katex": "^0.16.28"
|