taleem-player 1.0.17 → 1.0.18
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 -9
- package/dist/taleem-player.umd.js +29 -9
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -418,26 +418,21 @@ 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
|
-
|
|
429
|
-
}
|
|
430
|
-
const visibleLines = lines.slice(start);
|
|
431
|
-
const activeLine = activeIndex >= 0 && activeIndex < lines.length ? lines[activeIndex] : null;
|
|
425
|
+
const safeIndex = activeIndex < 0 ? 0 : activeIndex;
|
|
426
|
+
const visibleLines = lines.slice(0, safeIndex + 1);
|
|
427
|
+
const activeLine = safeIndex >= 0 && safeIndex < lines.length ? lines[safeIndex] : null;
|
|
432
428
|
const spItems = activeLine?.spItems ?? [];
|
|
433
429
|
return `
|
|
434
430
|
<section class="slide eq">
|
|
435
431
|
|
|
436
432
|
<ul class="eq-lines">
|
|
437
433
|
${visibleLines.map((line, index) => {
|
|
438
|
-
const realIndex = start + index;
|
|
439
434
|
return `
|
|
440
|
-
<li class="eq-line ${
|
|
435
|
+
<li class="eq-line ${index === safeIndex ? "highlighted" : ""}">
|
|
441
436
|
${line.content}
|
|
442
437
|
</li>
|
|
443
438
|
`;
|
|
@@ -741,11 +736,36 @@ function getDeckEndTime(deck) {
|
|
|
741
736
|
}
|
|
742
737
|
return deck.deck[deck.deck.length - 1].end;
|
|
743
738
|
}
|
|
739
|
+
|
|
740
|
+
// src/utils/getDeckImages.js
|
|
741
|
+
function getDeckImages(deck) {
|
|
742
|
+
const images = /* @__PURE__ */ new Set();
|
|
743
|
+
if (deck.background?.backgroundImage && typeof deck.background.backgroundImage === "string") {
|
|
744
|
+
images.add(deck.background.backgroundImage.split("/").pop());
|
|
745
|
+
}
|
|
746
|
+
if (!Array.isArray(deck.deck)) return [];
|
|
747
|
+
deck.deck.forEach((slide) => {
|
|
748
|
+
slide.data?.forEach((item) => {
|
|
749
|
+
if (item.name === "image" && typeof item.content === "string") {
|
|
750
|
+
images.add(item.content.split("/").pop());
|
|
751
|
+
}
|
|
752
|
+
if (Array.isArray(item.spItems)) {
|
|
753
|
+
item.spItems.forEach((sp) => {
|
|
754
|
+
if (sp.type === "spImage" && typeof sp.content === "string") {
|
|
755
|
+
images.add(sp.content.split("/").pop());
|
|
756
|
+
}
|
|
757
|
+
});
|
|
758
|
+
}
|
|
759
|
+
});
|
|
760
|
+
});
|
|
761
|
+
return Array.from(images);
|
|
762
|
+
}
|
|
744
763
|
export {
|
|
745
764
|
assignMockTimings,
|
|
746
765
|
createTaleemBrowser,
|
|
747
766
|
createTaleemPlayer,
|
|
748
767
|
getDeckEndTime,
|
|
768
|
+
getDeckImages,
|
|
749
769
|
registerSlide,
|
|
750
770
|
resolveAssetPaths,
|
|
751
771
|
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,21 @@ 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
|
-
|
|
460
|
-
}
|
|
461
|
-
const visibleLines = lines.slice(start);
|
|
462
|
-
const activeLine = activeIndex >= 0 && activeIndex < lines.length ? lines[activeIndex] : null;
|
|
457
|
+
const safeIndex = activeIndex < 0 ? 0 : activeIndex;
|
|
458
|
+
const visibleLines = lines.slice(0, safeIndex + 1);
|
|
459
|
+
const activeLine = safeIndex >= 0 && safeIndex < lines.length ? lines[safeIndex] : null;
|
|
463
460
|
const spItems = activeLine?.spItems ?? [];
|
|
464
461
|
return `
|
|
465
462
|
<section class="slide eq">
|
|
466
463
|
|
|
467
464
|
<ul class="eq-lines">
|
|
468
465
|
${visibleLines.map((line, index) => {
|
|
469
|
-
const realIndex = start + index;
|
|
470
466
|
return `
|
|
471
|
-
<li class="eq-line ${
|
|
467
|
+
<li class="eq-line ${index === safeIndex ? "highlighted" : ""}">
|
|
472
468
|
${line.content}
|
|
473
469
|
</li>
|
|
474
470
|
`;
|
|
@@ -772,5 +768,29 @@ var TaleemPlayer = (() => {
|
|
|
772
768
|
}
|
|
773
769
|
return deck.deck[deck.deck.length - 1].end;
|
|
774
770
|
}
|
|
771
|
+
|
|
772
|
+
// src/utils/getDeckImages.js
|
|
773
|
+
function getDeckImages(deck) {
|
|
774
|
+
const images = /* @__PURE__ */ new Set();
|
|
775
|
+
if (deck.background?.backgroundImage && typeof deck.background.backgroundImage === "string") {
|
|
776
|
+
images.add(deck.background.backgroundImage.split("/").pop());
|
|
777
|
+
}
|
|
778
|
+
if (!Array.isArray(deck.deck)) return [];
|
|
779
|
+
deck.deck.forEach((slide) => {
|
|
780
|
+
slide.data?.forEach((item) => {
|
|
781
|
+
if (item.name === "image" && typeof item.content === "string") {
|
|
782
|
+
images.add(item.content.split("/").pop());
|
|
783
|
+
}
|
|
784
|
+
if (Array.isArray(item.spItems)) {
|
|
785
|
+
item.spItems.forEach((sp) => {
|
|
786
|
+
if (sp.type === "spImage" && typeof sp.content === "string") {
|
|
787
|
+
images.add(sp.content.split("/").pop());
|
|
788
|
+
}
|
|
789
|
+
});
|
|
790
|
+
}
|
|
791
|
+
});
|
|
792
|
+
});
|
|
793
|
+
return Array.from(images);
|
|
794
|
+
}
|
|
775
795
|
return __toCommonJS(index_exports);
|
|
776
796
|
})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "taleem-player",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.18",
|
|
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"
|