taleem-slides 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 +224 -0
- package/decks/angles_and_transversals.json +85 -0
- package/decks/congruent_triangles.json +169 -0
- package/decks/demo_deck.json +22 -0
- package/decks/eq_28aug2025.json +67 -0
- package/decks/goldstandar_eq_28aug25.json +69 -0
- package/decks/parallelogram_properties.json +164 -0
- package/decks/parallelogram_properties_no_sound.json +164 -0
- package/decks/posultate_and_SAS_postulate.json +76 -0
- package/decks/qanoon.md +136 -0
- package/decks/theorem_revision_ch10_11.fixed.json +265 -0
- package/decks/theorem_revision_ch10_11.json +269 -0
- package/decks/theorems9old_11.1.1.json +382 -0
- package/decks/theorems9old_11.1.2.json +162 -0
- package/decks/theorems9old_11.1.3.json +857 -0
- package/index.html +88 -0
- package/package.json +22 -0
- package/src/index.js +5 -0
- package/src/interpreter/slideBuilder.js +65 -0
- package/src/registry.js +57 -0
- package/src/slideManager/SlideManager.js +62 -0
- package/src/slides/BarChartSlide.js +44 -0
- package/src/slides/BigNumberSlide.js +24 -0
- package/src/slides/BulletListSlide.js +26 -0
- package/src/slides/ContactSlide.js +22 -0
- package/src/slides/CornerWordsSlide.js +27 -0
- package/src/slides/DonutChartSlide.js +28 -0
- package/src/slides/EqSlide.js +22 -0
- package/src/slides/FillImageSlide.js +24 -0
- package/src/slides/ImageLeftBulletsRightSlide.js +28 -0
- package/src/slides/ImageRightBulletsLeftSlide.js +28 -0
- package/src/slides/ImageSlide.js +22 -0
- package/src/slides/ImageWithCaptionSlide.js +26 -0
- package/src/slides/ImageWithTitleSlide.js +26 -0
- package/src/slides/QuoteSlide.js +24 -0
- package/src/slides/QuoteWithImageSlide.js +30 -0
- package/src/slides/StatisticSlide.js +26 -0
- package/src/slides/SvgPointerSlide.js +22 -0
- package/src/slides/TableSlide.js +27 -0
- package/src/slides/TitleAndParaSlide.js +26 -0
- package/src/slides/TitleAndSubtitleSlide.js +27 -0
- package/src/slides/TitleSlide.js +41 -0
- package/src/slides/TwoColumnTextSlide.js +27 -0
- package/tests/interpreter.test.js +47 -0
- package/tests/slides.barChart.test.js +64 -0
- package/tests/slides.bigNumber.test.js +28 -0
- package/tests/slides.bulletList.test.js +32 -0
- package/tests/slides.contactSlide.test.js +48 -0
- package/tests/slides.cornerWordsSlide.test.js +28 -0
- package/tests/slides.donutChart.test.js +28 -0
- package/tests/slides.eq.test.js +26 -0
- package/tests/slides.fillImage.test.js +28 -0
- package/tests/slides.imageLeftBulletsRight.test.js +28 -0
- package/tests/slides.imageRightBulletsLeft.test.js +26 -0
- package/tests/slides.imageSlide.test.js +28 -0
- package/tests/slides.imageWithCaption.test.js +44 -0
- package/tests/slides.imageWithTitle.test.js +45 -0
- package/tests/slides.quoteSlide.test.js +28 -0
- package/tests/slides.quoteWithImage.test.js +46 -0
- package/tests/slides.statistic.test.js +44 -0
- package/tests/slides.svgPointer.test.js +37 -0
- package/tests/slides.table.test.js +41 -0
- package/tests/slides.test.js +42 -0
- package/tests/slides.titleAndPara.test.js +35 -0
- package/tests/slides.titleAndSubtitle.test.js +32 -0
- package/tests/slides.twoColumnText.test.js +35 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { describe, test, expect } from "vitest";
|
|
2
|
+
import { ImageWithCaptionSlide } from "../src/slides/ImageWithCaptionSlide.js";
|
|
3
|
+
|
|
4
|
+
describe("imageWithCaption", () => {
|
|
5
|
+
test("builds with image and caption", () => {
|
|
6
|
+
const raw = {
|
|
7
|
+
type: "imageWithCaption",
|
|
8
|
+
data: [
|
|
9
|
+
{ name: "image", content: "photo.png" },
|
|
10
|
+
{ name: "caption", content: "A caption" }
|
|
11
|
+
]
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const slide = ImageWithCaptionSlide.fromJSON(raw);
|
|
15
|
+
const html = slide.render();
|
|
16
|
+
|
|
17
|
+
expect(html).toContain("photo.png");
|
|
18
|
+
expect(html).toContain("A caption");
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test("throws if image or caption missing", () => {
|
|
22
|
+
expect(() =>
|
|
23
|
+
ImageWithCaptionSlide.fromJSON({
|
|
24
|
+
type: "imageWithCaption",
|
|
25
|
+
data: [{ name: "image", content: "photo.png" }]
|
|
26
|
+
})
|
|
27
|
+
).toThrow("imageWithCaption: image and caption required");
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test("render output is deterministic", () => {
|
|
31
|
+
const raw = {
|
|
32
|
+
type: "imageWithCaption",
|
|
33
|
+
data: [
|
|
34
|
+
{ name: "image", content: "x.png" },
|
|
35
|
+
{ name: "caption", content: "Y" }
|
|
36
|
+
]
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const a = ImageWithCaptionSlide.fromJSON(raw);
|
|
40
|
+
const b = ImageWithCaptionSlide.fromJSON(raw);
|
|
41
|
+
|
|
42
|
+
expect(a.render()).toBe(b.render());
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
|
|
2
|
+
import { describe, test, expect } from "vitest";
|
|
3
|
+
import { ImageWithTitleSlide } from "../src/slides/ImageWithTitleSlide.js";
|
|
4
|
+
|
|
5
|
+
describe("imageWithTitle", () => {
|
|
6
|
+
test("builds with image and title", () => {
|
|
7
|
+
const raw = {
|
|
8
|
+
type: "imageWithTitle",
|
|
9
|
+
data: [
|
|
10
|
+
{ name: "image", content: "hero.png" },
|
|
11
|
+
{ name: "title", content: "Hello World" }
|
|
12
|
+
]
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const slide = ImageWithTitleSlide.fromJSON(raw);
|
|
16
|
+
const html = slide.render();
|
|
17
|
+
|
|
18
|
+
expect(html).toContain("hero.png");
|
|
19
|
+
expect(html).toContain("Hello World");
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test("throws if image or title missing", () => {
|
|
23
|
+
expect(() =>
|
|
24
|
+
ImageWithTitleSlide.fromJSON({
|
|
25
|
+
type: "imageWithTitle",
|
|
26
|
+
data: [{ name: "title", content: "Only title" }]
|
|
27
|
+
})
|
|
28
|
+
).toThrow("imageWithTitle: image and title required");
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test("render output is deterministic", () => {
|
|
32
|
+
const raw = {
|
|
33
|
+
type: "imageWithTitle",
|
|
34
|
+
data: [
|
|
35
|
+
{ name: "image", content: "a.png" },
|
|
36
|
+
{ name: "title", content: "B" }
|
|
37
|
+
]
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const a = ImageWithTitleSlide.fromJSON(raw);
|
|
41
|
+
const b = ImageWithTitleSlide.fromJSON(raw);
|
|
42
|
+
|
|
43
|
+
expect(a.render()).toBe(b.render());
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { describe, test, expect } from "vitest";
|
|
2
|
+
import { slideBuilder } from "../src/interpreter/slideBuilder.js";
|
|
3
|
+
|
|
4
|
+
describe("quoteSlide", () => {
|
|
5
|
+
test("builds with quote", () => {
|
|
6
|
+
const deck = {
|
|
7
|
+
version: "deck-v1",
|
|
8
|
+
deck: [{
|
|
9
|
+
type: "quoteSlide",
|
|
10
|
+
data: [{ name: "quote", content: "Hello" }]
|
|
11
|
+
}]
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const manager = slideBuilder(deck);
|
|
15
|
+
const html = manager.renderSlide(0);
|
|
16
|
+
|
|
17
|
+
expect(html).toContain("Hello");
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test("throws without quote", () => {
|
|
21
|
+
expect(() =>
|
|
22
|
+
slideBuilder({
|
|
23
|
+
version: "deck-v1",
|
|
24
|
+
deck: [{ type: "quoteSlide", data: [] }]
|
|
25
|
+
})
|
|
26
|
+
).toThrow();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { describe, test, expect } from "vitest";
|
|
2
|
+
import { QuoteWithImageSlide } from "../src/slides/QuoteWithImageSlide.js";
|
|
3
|
+
|
|
4
|
+
describe("quoteWithImage", () => {
|
|
5
|
+
test("builds with quote and image", () => {
|
|
6
|
+
const raw = {
|
|
7
|
+
type: "quoteWithImage",
|
|
8
|
+
data: [
|
|
9
|
+
{ name: "quote", content: "Stay hungry" },
|
|
10
|
+
{ name: "image", content: "img.png" },
|
|
11
|
+
{ name: "author", content: "Steve Jobs" }
|
|
12
|
+
]
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const slide = QuoteWithImageSlide.fromJSON(raw);
|
|
16
|
+
const html = slide.render();
|
|
17
|
+
|
|
18
|
+
expect(html).toContain("Stay hungry");
|
|
19
|
+
expect(html).toContain("img.png");
|
|
20
|
+
expect(html).toContain("Steve Jobs");
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test("throws if quote or image missing", () => {
|
|
24
|
+
expect(() =>
|
|
25
|
+
QuoteWithImageSlide.fromJSON({
|
|
26
|
+
type: "quoteWithImage",
|
|
27
|
+
data: [{ name: "quote", content: "Only quote" }]
|
|
28
|
+
})
|
|
29
|
+
).toThrow("quoteWithImage: quote and image required");
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test("render output is deterministic", () => {
|
|
33
|
+
const raw = {
|
|
34
|
+
type: "quoteWithImage",
|
|
35
|
+
data: [
|
|
36
|
+
{ name: "quote", content: "A" },
|
|
37
|
+
{ name: "image", content: "b.png" }
|
|
38
|
+
]
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const a = QuoteWithImageSlide.fromJSON(raw);
|
|
42
|
+
const b = QuoteWithImageSlide.fromJSON(raw);
|
|
43
|
+
|
|
44
|
+
expect(a.render()).toBe(b.render());
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { describe, test, expect } from "vitest";
|
|
2
|
+
import { StatisticSlide } from "../src/slides/StatisticSlide.js";
|
|
3
|
+
|
|
4
|
+
describe("statistic", () => {
|
|
5
|
+
test("builds with label and value", () => {
|
|
6
|
+
const raw = {
|
|
7
|
+
type: "statistic",
|
|
8
|
+
data: [
|
|
9
|
+
{ name: "label", content: "Users" },
|
|
10
|
+
{ name: "value", content: 120 }
|
|
11
|
+
]
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const slide = StatisticSlide.fromJSON(raw);
|
|
15
|
+
const html = slide.render();
|
|
16
|
+
|
|
17
|
+
expect(html).toContain("Users");
|
|
18
|
+
expect(html).toContain("120");
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test("throws if label or value missing", () => {
|
|
22
|
+
expect(() =>
|
|
23
|
+
StatisticSlide.fromJSON({
|
|
24
|
+
type: "statistic",
|
|
25
|
+
data: [{ name: "label", content: "Only label" }]
|
|
26
|
+
})
|
|
27
|
+
).toThrow("statistic: requires label and value");
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test("render output is deterministic", () => {
|
|
31
|
+
const raw = {
|
|
32
|
+
type: "statistic",
|
|
33
|
+
data: [
|
|
34
|
+
{ name: "label", content: "X" },
|
|
35
|
+
{ name: "value", content: 5 }
|
|
36
|
+
]
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const a = StatisticSlide.fromJSON(raw);
|
|
40
|
+
const b = StatisticSlide.fromJSON(raw);
|
|
41
|
+
|
|
42
|
+
expect(a.render()).toBe(b.render());
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { describe, test, expect } from "vitest";
|
|
2
|
+
import { SvgPointerSlide } from "../src/slides/SvgPointerSlide.js";
|
|
3
|
+
|
|
4
|
+
describe("svgPointer", () => {
|
|
5
|
+
test("builds with svg content", () => {
|
|
6
|
+
const raw = {
|
|
7
|
+
type: "svgPointer",
|
|
8
|
+
data: [{ name: "svg", content: "<svg></svg>" }]
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const slide = SvgPointerSlide.fromJSON(raw);
|
|
12
|
+
const html = slide.render();
|
|
13
|
+
|
|
14
|
+
expect(html).toContain("<svg>");
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test("throws if svg missing", () => {
|
|
18
|
+
expect(() =>
|
|
19
|
+
SvgPointerSlide.fromJSON({
|
|
20
|
+
type: "svgPointer",
|
|
21
|
+
data: []
|
|
22
|
+
})
|
|
23
|
+
).toThrow("svgPointer: svg required");
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test("render output is deterministic", () => {
|
|
27
|
+
const raw = {
|
|
28
|
+
type: "svgPointer",
|
|
29
|
+
data: [{ name: "svg", content: "<svg></svg>" }]
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const a = SvgPointerSlide.fromJSON(raw);
|
|
33
|
+
const b = SvgPointerSlide.fromJSON(raw);
|
|
34
|
+
|
|
35
|
+
expect(a.render()).toBe(b.render());
|
|
36
|
+
});
|
|
37
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { describe, test, expect } from "vitest";
|
|
2
|
+
import { TableSlide } from "../src/slides/TableSlide.js";
|
|
3
|
+
|
|
4
|
+
describe("table", () => {
|
|
5
|
+
test("builds with rows", () => {
|
|
6
|
+
const raw = {
|
|
7
|
+
type: "table",
|
|
8
|
+
data: [
|
|
9
|
+
{ name: "row", content: ["A", "B"] },
|
|
10
|
+
{ name: "row", content: ["C", "D"] }
|
|
11
|
+
]
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const slide = TableSlide.fromJSON(raw);
|
|
15
|
+
const html = slide.render();
|
|
16
|
+
|
|
17
|
+
expect(html).toContain("<td>A</td>");
|
|
18
|
+
expect(html).toContain("<td>D</td>");
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test("throws if no rows provided", () => {
|
|
22
|
+
expect(() =>
|
|
23
|
+
TableSlide.fromJSON({
|
|
24
|
+
type: "table",
|
|
25
|
+
data: []
|
|
26
|
+
})
|
|
27
|
+
).toThrow("table: requires at least one row");
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test("render output is deterministic", () => {
|
|
31
|
+
const raw = {
|
|
32
|
+
type: "table",
|
|
33
|
+
data: [{ name: "row", content: ["X"] }]
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const a = TableSlide.fromJSON(raw);
|
|
37
|
+
const b = TableSlide.fromJSON(raw);
|
|
38
|
+
|
|
39
|
+
expect(a.render()).toBe(b.render());
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { describe, test, expect } from "vitest";
|
|
2
|
+
import { slideBuilder } from "../src/interpreter/slideBuilder.js";
|
|
3
|
+
|
|
4
|
+
describe("TitleSlide", () => {
|
|
5
|
+
test("render() is deterministic", () => {
|
|
6
|
+
const deck = {
|
|
7
|
+
version: "deck-v1",
|
|
8
|
+
deck: [
|
|
9
|
+
{
|
|
10
|
+
type: "titleSlide",
|
|
11
|
+
data: [{ name: "title", content: "Deterministic" }]
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const manager = slideBuilder(deck);
|
|
17
|
+
|
|
18
|
+
const html1 = manager.renderSlide(0);
|
|
19
|
+
const html2 = manager.renderSlide(0);
|
|
20
|
+
|
|
21
|
+
expect(html1).toBe(html2);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test("rendered output is immutable (string)", () => {
|
|
25
|
+
const deck = {
|
|
26
|
+
version: "deck-v1",
|
|
27
|
+
deck: [
|
|
28
|
+
{
|
|
29
|
+
type: "titleSlide",
|
|
30
|
+
data: [{ name: "title", content: "Frozen" }]
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const manager = slideBuilder(deck);
|
|
36
|
+
const html = manager.renderSlide(0);
|
|
37
|
+
|
|
38
|
+
expect(() => {
|
|
39
|
+
html.type = "hack";
|
|
40
|
+
}).toThrow();
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { describe, test, expect } from "vitest";
|
|
2
|
+
import { slideBuilder } from "../src/interpreter/slideBuilder.js";
|
|
3
|
+
|
|
4
|
+
describe("titleAndPara", () => {
|
|
5
|
+
test("builds successfully", () => {
|
|
6
|
+
const deck = {
|
|
7
|
+
version: "deck-v1",
|
|
8
|
+
deck: [{
|
|
9
|
+
type: "titleAndPara",
|
|
10
|
+
data: [
|
|
11
|
+
{ name: "title", content: "Heading" },
|
|
12
|
+
{ name: "para", content: "Paragraph" }
|
|
13
|
+
]
|
|
14
|
+
}]
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const manager = slideBuilder(deck);
|
|
18
|
+
const html = manager.renderSlide(0);
|
|
19
|
+
|
|
20
|
+
expect(html).toContain("Heading");
|
|
21
|
+
expect(html).toContain("Paragraph");
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test("throws on missing para", () => {
|
|
25
|
+
expect(() =>
|
|
26
|
+
slideBuilder({
|
|
27
|
+
version: "deck-v1",
|
|
28
|
+
deck: [{
|
|
29
|
+
type: "titleAndPara",
|
|
30
|
+
data: [{ name: "title", content: "X" }]
|
|
31
|
+
}]
|
|
32
|
+
})
|
|
33
|
+
).toThrow();
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { describe, test, expect } from "vitest";
|
|
2
|
+
import { slideBuilder } from "../src/interpreter/slideBuilder.js";
|
|
3
|
+
|
|
4
|
+
describe("titleAndSubtitle", () => {
|
|
5
|
+
test("builds successfully", () => {
|
|
6
|
+
const deck = {
|
|
7
|
+
version: "deck-v1",
|
|
8
|
+
deck: [{
|
|
9
|
+
type: "titleAndSubtitle",
|
|
10
|
+
data: [
|
|
11
|
+
{ name: "title", content: "Hello" },
|
|
12
|
+
{ name: "subtitle", content: "World" }
|
|
13
|
+
]
|
|
14
|
+
}]
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const manager = slideBuilder(deck);
|
|
18
|
+
const html = manager.renderSlide(0);
|
|
19
|
+
|
|
20
|
+
expect(html).toContain("Hello");
|
|
21
|
+
expect(html).toContain("World");
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test("throws on missing data", () => {
|
|
25
|
+
expect(() =>
|
|
26
|
+
slideBuilder({
|
|
27
|
+
version: "deck-v1",
|
|
28
|
+
deck: [{ type: "titleAndSubtitle", data: [] }]
|
|
29
|
+
})
|
|
30
|
+
).toThrow();
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { describe, test, expect } from "vitest";
|
|
2
|
+
import { slideBuilder } from "../src/interpreter/slideBuilder.js";
|
|
3
|
+
|
|
4
|
+
describe("twoColumnText", () => {
|
|
5
|
+
test("builds with left and right", () => {
|
|
6
|
+
const deck = {
|
|
7
|
+
version: "deck-v1",
|
|
8
|
+
deck: [{
|
|
9
|
+
type: "twoColumnText",
|
|
10
|
+
data: [
|
|
11
|
+
{ name: "left", content: "L1" },
|
|
12
|
+
{ name: "right", content: "R1" }
|
|
13
|
+
]
|
|
14
|
+
}]
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const manager = slideBuilder(deck);
|
|
18
|
+
const html = manager.renderSlide(0);
|
|
19
|
+
|
|
20
|
+
expect(html).toContain("L1");
|
|
21
|
+
expect(html).toContain("R1");
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test("throws if one side missing", () => {
|
|
25
|
+
expect(() =>
|
|
26
|
+
slideBuilder({
|
|
27
|
+
version: "deck-v1",
|
|
28
|
+
deck: [{
|
|
29
|
+
type: "twoColumnText",
|
|
30
|
+
data: [{ name: "left", content: "Only" }]
|
|
31
|
+
}]
|
|
32
|
+
})
|
|
33
|
+
).toThrow();
|
|
34
|
+
});
|
|
35
|
+
});
|