taleem-slides 0.5.0 β†’ 0.6.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.
Files changed (62) hide show
  1. package/README.md +88 -245
  2. package/package.json +5 -4
  3. package/src/SlideTemplates.js +0 -1
  4. package/src/slides/BarChartSlide.js +5 -5
  5. package/src/slides/BigNumberSlide.js +7 -6
  6. package/src/slides/BulletListSlide.js +5 -6
  7. package/src/slides/ContactSlide.js +3 -4
  8. package/src/slides/CornerWordsSlide.js +15 -10
  9. package/src/slides/DonutChartSlide.js +16 -16
  10. package/src/slides/EqSlide.js +13 -9
  11. package/src/slides/FillImageSlide.js +4 -2
  12. package/src/slides/ImageLeftBulletsRightSlide.js +6 -14
  13. package/src/slides/ImageRightBulletsLeftSlide.js +6 -14
  14. package/src/slides/ImageSlide.js +0 -1
  15. package/src/slides/ImageWithCaptionSlide.js +2 -1
  16. package/src/slides/ImageWithTitleSlide.js +2 -1
  17. package/src/slides/QuoteSlide.js +8 -5
  18. package/src/slides/QuoteWithImageSlide.js +2 -3
  19. package/src/slides/StatisticSlide.js +5 -6
  20. package/src/slides/TableSlide.js +17 -22
  21. package/src/slides/TitleAndParaSlide.js +1 -4
  22. package/src/slides/TitleAndSubtitleSlide.js +1 -6
  23. package/src/slides/TitleSlide.js +5 -5
  24. package/src/slides/TwoColumnTextSlide.js +7 -38
  25. package/tests/slide.title.test.js +15 -0
  26. package/tests/slides.barChart.test.js +15 -20
  27. package/tests/slides.bigNumber.test.js +8 -19
  28. package/tests/slides.bulletList.test.js +9 -23
  29. package/tests/slides.contactSlide.test.js +8 -18
  30. package/tests/slides.cornerWordsSlide.test.js +8 -14
  31. package/tests/slides.donutChart.test.js +10 -20
  32. package/tests/slides.eq.test.js +9 -20
  33. package/tests/slides.fillImage.test.js +8 -14
  34. package/tests/slides.imageLeftBulletsRight.test.js +9 -12
  35. package/tests/slides.imageRightBulletsLeft.test.js +9 -12
  36. package/tests/slides.imageSlide.test.js +8 -15
  37. package/tests/slides.imageWithCaption.test.js +8 -18
  38. package/tests/slides.imageWithTitle.test.js +8 -18
  39. package/tests/slides.quoteSlide.test.js +8 -19
  40. package/tests/slides.quoteWithImage.test.js +9 -18
  41. package/tests/slides.statistic.test.js +8 -18
  42. package/tests/slides.table.test.js +8 -33
  43. package/tests/slides.titleAndPara.test.js +8 -20
  44. package/tests/slides.titleAndSubtitle.test.js +8 -20
  45. package/tests/slides.twoColumnText.test.js +7 -20
  46. package/decks/angles_and_transversals.json +0 -85
  47. package/decks/congruent_triangles.json +0 -169
  48. package/decks/demo_deck.json +0 -22
  49. package/decks/eq_28aug2025.json +0 -67
  50. package/decks/goldstandar_eq_28aug25.json +0 -69
  51. package/decks/parallelogram_properties.json +0 -164
  52. package/decks/parallelogram_properties_no_sound.json +0 -164
  53. package/decks/posultate_and_SAS_postulate.json +0 -76
  54. package/decks/qanoon.md +0 -136
  55. package/decks/theorem_revision_ch10_11.fixed.json +0 -265
  56. package/decks/theorem_revision_ch10_11.json +0 -269
  57. package/decks/theorems9old_11.1.1.json +0 -382
  58. package/decks/theorems9old_11.1.2.json +0 -162
  59. package/decks/theorems9old_11.1.3.json +0 -857
  60. package/index.html +0 -88
  61. package/tests/slides.svgPointer.test.js +0 -25
  62. package/tests/slides.test.js +0 -28
package/README.md CHANGED
@@ -1,111 +1,71 @@
1
1
 
2
-
3
2
  # πŸ“¦ taleem-slides
4
3
 
5
- ## ⚠️ Warning: Work in Progress β€” expect breaking changes
6
-
7
- > **Pure slide template library for Taleem decks**
8
-
9
- `taleem-slides` is a **simple, deterministic template library** that turns
10
- **deck-style slide JSON** into **HTML**.
4
+ > **Simple HTML slide templates for JSON-based presentations**
11
5
 
12
- It does **one thing only**:
6
+ `taleem-slides` is a **small, focused library** that turns
7
+ **plain slide JSON** into **HTML**.
13
8
 
14
- > **Given slide data + render state β†’ return HTML**
9
+ You give it slide data.
10
+ It gives you HTML.
15
11
 
16
- It does **not** manage time, indexes, playback, or decks.
12
+ That’s it.
17
13
 
18
14
  ---
19
15
 
20
- ## 🌐 Live Display Center (Important)
21
-
22
- πŸ‘‰ **Official live display & reference implementation**
23
- **[https://bilza2023.github.io/taleem/](https://bilza2023.github.io/taleem/)**
24
-
25
- This is **not a mock demo**.
26
- This link is the **active display center** where:
27
-
28
- * slide templates are rendered in real browsers
29
- * visual behavior is validated
30
- * browser / player integration is tested
31
-
32
- ---
33
-
34
- ## ✨ Taleem.help Philosophy
35
-
36
- **Taleem.help** is an educational technology initiative focused on making
37
- **content-first learning tools**.
38
-
39
- The goal of the `taleem-*` libraries is simple:
16
+ ## 🌐 Live Docs, Demo & Reference (START HERE)
40
17
 
41
- > Enable educators to create **JSON-based presentations**
42
- > and display them online using **free, open tools**.
18
+ πŸ‘‰ **https://bilza2023.github.io/taleem**
43
19
 
44
- ### Key ideas
20
+ This site is the **official reference** for:
45
21
 
46
- * Slides already encode *layout + structure*
47
- * Users provide **content only**
48
- * There are **no configuration knobs**
49
- * What you see is what the template decides
22
+ - all supported slide types
23
+ - visual behavior
24
+ - real rendered output
25
+ - examples and demos
50
26
 
51
- This removal of choice is **intentional**.
52
-
53
- It makes the system:
54
-
55
- * easy to learn
56
- * hard to misuse
57
- * consistent across platforms
58
-
59
- If a different layout is needed, the solution is **not configuration** β€”
60
- it is **a new slide template**.
61
-
62
- Templates are cheap.
63
- Even hundreds of templates add no runtime cost.
27
+ If something is unclear in this README,
28
+ **the website is the final authority**.
64
29
 
65
30
  ---
66
31
 
67
- ## ✨ What this library is
68
-
69
- * A collection of **slide templates**
70
- * Each template:
32
+ ## βœ… What this library does
71
33
 
72
- * reads slide JSON
73
- * renders HTML
74
- * applies CSS classes based on a given state
75
- * Fully **stateless** and **pure**
76
-
77
- Think of it as:
78
-
79
- > *Handlebars / JSX for Taleem slides*
34
+ - Converts slide JSON into HTML
35
+ - Uses fixed, opinionated layouts
36
+ - Applies simple state-based CSS classes
37
+ - Works in any JS environment (browser, player, SSR)
80
38
 
81
39
  ---
82
40
 
83
- ## ❌ What this library is NOT
41
+ ## ❌ What this library does NOT do
84
42
 
85
43
  `taleem-slides` does **not**:
86
44
 
87
- * build decks
88
- * validate full decks
89
- * manage timing (`showAt`)
90
- * decide which slide is active
91
- * manage playback
92
- * mutate data
45
+ - play slides
46
+ - manage time or animations
47
+ - navigate slides
48
+ - validate full decks
49
+ - touch the DOM
50
+ - apply CSS styles
93
51
 
94
- All of that belongs elsewhere.
52
+ It only returns HTML strings.
95
53
 
96
54
  ---
97
55
 
98
56
  ## 🧠 Mental Model
99
57
 
100
58
  ```
101
- slide JSON + render state
102
- ↓
103
- slide template
104
- ↓
105
- HTML
106
- ```
107
59
 
108
- How the state is calculated is **not this library’s concern**.
60
+ slide data + render state
61
+ ↓
62
+ taleem-slides
63
+ ↓
64
+ HTML
65
+
66
+ ````
67
+
68
+ How slides are shown, timed, or styled is **your responsibility**.
109
69
 
110
70
  ---
111
71
 
@@ -113,77 +73,69 @@ How the state is calculated is **not this library’s concern**.
113
73
 
114
74
  ```bash
115
75
  npm install taleem-slides
116
- ```
76
+ ````
117
77
 
118
78
  ---
119
79
 
120
80
  ## πŸš€ Basic Usage
121
81
 
122
- ### 1️⃣ Import a template
82
+ ### 1️⃣ Get a slide template
123
83
 
124
84
  ```js
125
85
  import { getSlideTemplate } from "taleem-slides";
86
+
87
+ const Slide = getSlideTemplate("bulletList");
126
88
  ```
127
89
 
128
90
  ---
129
91
 
130
- ### 2️⃣ Load slide data (once)
92
+ ### 2️⃣ Load slide data
131
93
 
132
94
  ```js
133
- const SlideTemplate = getSlideTemplate("bulletList");
134
-
135
- const slide = SlideTemplate.fromJSON({
95
+ const slide = Slide.fromJSON({
136
96
  type: "bulletList",
137
97
  data: [
138
98
  { name: "bullet", content: "First point" },
139
- { name: "bullet", content: "Second point" },
140
- { name: "bullet", content: "Third point" }
99
+ { name: "bullet", content: "Second point" }
141
100
  ]
142
101
  });
143
102
  ```
144
103
 
145
- > `fromJSON()` only **reads and stores structure**.
146
- > No timing. No logic.
104
+ `fromJSON()` reads and stores structure only.
147
105
 
148
106
  ---
149
107
 
150
- ### 3️⃣ Render with state
108
+ ### 3️⃣ Render HTML
151
109
 
152
110
  ```js
153
111
  const html = slide.render({
154
- visibleCount: 2,
155
- activeIndex: 1
112
+ visibleCount: 1,
113
+ activeIndex: 0
156
114
  });
157
115
  ```
158
116
 
159
- This will:
160
-
161
- * render first 2 bullets
162
- * highlight the second bullet
163
- * dim the first
164
-
165
117
  ---
166
118
 
167
- ## 🎨 Render State Contract
119
+ ## 🎨 Render State (Simple)
168
120
 
169
- Templates accept a **render state object**.
121
+ Render state is just a plain object.
170
122
 
171
123
  Common fields:
172
124
 
173
125
  ```ts
174
126
  {
175
- visibleCount?: number; // how many items exist
176
- activeIndex?: number; // which item is highlighted
127
+ visibleCount?: number
128
+ activeIndex?: number
177
129
  }
178
130
  ```
179
131
 
180
- Slides may choose to use one or both.
132
+ Each slide uses only what it needs.
181
133
 
182
134
  ---
183
135
 
184
- ## 🎯 Class Name Contract
136
+ ## 🎯 CSS Class Contract
185
137
 
186
- Templates apply **standard class names only**:
138
+ Slides emit only these state classes:
187
139
 
188
140
  ```text
189
141
  .is-active
@@ -191,173 +143,64 @@ Templates apply **standard class names only**:
191
143
  .is-hidden
192
144
  ```
193
145
 
194
- Styling is handled entirely by the consuming app.
195
-
196
- ---
197
-
198
- ## 🧭 How this fits in the ecosystem
199
-
200
- `taleem-slides` is intentionally **small** and **focused**.
201
-
202
- It is used by higher-level projects:
203
-
204
- ### 🧩 Sister Projects
205
-
206
- * **taleem-browser**
207
- Index-based slide viewer (manual navigation)
208
-
209
- * **taleem-player**
210
- Time-based slide player (audio / video synced)
211
-
212
- Both projects:
213
-
214
- * compute render state (`activeIndex`, `visibleCount`)
215
- * pass it to `taleem-slides`
216
- * receive consistent HTML output
217
-
218
- ---
219
-
220
- ## πŸ§ͺ Demo & Reference Projects
221
-
222
- * 🌐 **Live Display Center**
223
- [https://bilza2023.github.io/taleem/](https://bilza2023.github.io/taleem/)
224
-
225
- * πŸ“ **GitHub Demo / Playground**
226
- *(link can be added here when ready)*
227
-
228
- ---
229
-
230
- ## 🧊 Stability & Versioning
231
-
232
- * Targets **deck-v1**
233
- * Breaking changes allowed during WIP phase
234
- * HTML output is intentionally simple and predictable
146
+ You control **all styling**.
235
147
 
236
148
  ---
237
149
 
238
- ## 🧠 Design Principle (Locked)
239
-
240
- > **taleem-slides renders HTML.
241
- > It does not decide *when* or *why*.**
242
-
243
- ---
244
-
245
- ## πŸ”³ Deck Background Support (NEW)
246
-
247
- `taleem-slides` also defines **how deck backgrounds are resolved**, while remaining fully **DOM-agnostic**.
248
-
249
- A deck background is **optional** and applies to the **entire deck**, not individual slides.
250
-
251
- ---
252
-
253
- ### Background responsibility split
254
-
255
- #### taleem-slides
256
-
257
- * decides **what background should be used**
258
- * exposes a **pure resolver function**
259
- * returns **plain background data**
260
-
261
- #### player / browser
262
-
263
- * renders the background into the DOM
264
- * applies styles and layout
265
- * handles mounting and lifecycle
266
-
267
- This keeps slide rendering **pure and portable**.
268
-
269
- ---
270
-
271
- ## 🎨 Background Resolution API
272
-
273
- `taleem-slides` exports a small helper:
150
+ ## 🧩 Supported Slide Types
274
151
 
275
- ```js
276
- import { resolveBackground } from "taleem-slides";
277
- ```
152
+ See the **live site** for visuals and examples:
278
153
 
279
- ### Purpose
154
+ πŸ‘‰ [https://bilza2023.github.io/taleem](https://bilza2023.github.io/taleem)
280
155
 
281
- `resolveBackground` answers one question only:
156
+ Supported categories include:
282
157
 
283
- > **β€œWhat background should be used for this deck?”**
158
+ * titles and text slides
159
+ * bullet lists and columns
160
+ * images and image+text layouts
161
+ * tables and charts
162
+ * quotes and stats
163
+ * equation slides
284
164
 
285
- It does **not**:
165
+ Layouts are **fixed by design**.
286
166
 
287
- * touch the DOM
288
- * inject styles
289
- * manage themes
290
- * animate or time anything
167
+ If you need a new layout, you add a new template.
291
168
 
292
169
  ---
293
170
 
294
- ### Input (conceptual)
171
+ ## πŸ§ͺ Stability & Guarantees
295
172
 
296
- ```ts
297
- {
298
- deckBackground?: {
299
- backgroundColor?: string
300
- backgroundImage?: string
301
- backgroundImageOpacity?: number
302
- },
303
- themeSurfaceColor?: string
304
- }
305
- ```
173
+ * Deterministic output
174
+ * No hidden state
175
+ * No configuration knobs
176
+ * Same input β†’ same HTML
306
177
 
307
178
  ---
308
179
 
309
- ### Output
180
+ ## πŸ”’ Design Principle
310
181
 
311
- ```ts
312
- {
313
- backgroundColor?: string
314
- backgroundImage?: string
315
- backgroundImageOpacity?: number
316
- }
317
- ```
182
+ > **This library renders HTML only.
183
+ > It does not decide when or how slides appear.**
318
184
 
319
185
  ---
320
186
 
321
- ### Resolution rules (locked)
187
+ ## πŸ“ Where this fits
322
188
 
323
- * If the deck defines a background β†’ **use it**
324
- * Otherwise β†’ **fall back to the theme’s surface color**
189
+ `taleem-slides` is meant to be used by:
325
190
 
326
- These rules are **format-level guarantees**, not rendering behavior.
191
+ * slide viewers
192
+ * presentation players
193
+ * educational tools
194
+ * static or dynamic renderers
327
195
 
328
- ---
329
-
330
- ## 🧠 Mental Model (Updated)
331
-
332
- ```
333
- deck JSON + render state + theme surface
334
- ↓
335
- taleem-slides
336
- ↓
337
- HTML + resolved background data
338
- ↓
339
- player / browser
340
- ↓
341
- DOM
342
- ```
343
-
344
- `taleem-slides` decides **what exists**.
345
- The player / browser decides **how it appears**.
196
+ It is intentionally small so it can be reused everywhere.
346
197
 
347
198
  ---
348
199
 
349
- ## πŸ”’ Design Principle (Extended)
200
+ ## βœ… Status
350
201
 
351
- > **taleem-slides renders HTML and resolves deck-level intent.
352
- > It never touches the DOM and never manages playback.**
202
+ * Actively used
203
+ * Fully tested
204
+ * Backed by live reference site
205
+ * Ready for production
353
206
 
354
- ---
355
-
356
- ## βœ… What this achieves
357
-
358
- * background rules are centralized
359
- * players remain simple
360
- * browsers stay dumb
361
- * future renderers (CLI, SSR, export) stay possible
362
-
363
- ---
package/package.json CHANGED
@@ -1,22 +1,23 @@
1
1
  {
2
2
  "name": "taleem-slides",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "description": "Convert json taleem schema into html for slides",
6
-
7
6
  "exports": {
8
7
  ".": "./src/index.js"
9
8
  },
10
-
11
9
  "scripts": {
12
10
  "test": "vitest run",
13
11
  "test:watch": "vitest",
14
12
  "test:ui": "vitest --ui",
15
13
  "lint": "echo \"no lint yet\""
16
14
  },
17
-
18
15
  "devDependencies": {
19
16
  "vite": "^5.0.0",
20
17
  "vitest": "^1.5.0"
18
+ },
19
+ "dependencies": {
20
+ "taleem-core": "^1.3.2",
21
+ "zod": "^4.3.5"
21
22
  }
22
23
  }
@@ -53,5 +53,4 @@ export const SlideTemplates = {
53
53
  contactSlide: ContactSlide,
54
54
 
55
55
  eq: EqSlide,
56
- svgPointer: SvgPointerSlide
57
56
  };
@@ -1,16 +1,16 @@
1
- // BarChartSlide.js
2
1
  export const BarChartSlide = {
3
2
  type: "barChart",
4
3
 
5
4
  fromJSON(raw) {
5
+ // Consume canonical deck-v1 shape directly
6
6
  const bars = raw.data
7
7
  ?.filter(d => d.name === "bar")
8
8
  .map(d => ({
9
- label: d.content.label,
10
- value: d.content.value
9
+ label: d.label,
10
+ value: d.value
11
11
  }));
12
12
 
13
- if (!bars?.length) {
13
+ if (!bars || bars.length === 0) {
14
14
  throw new Error("barChart: requires at least one bar");
15
15
  }
16
16
 
@@ -27,7 +27,7 @@ export const BarChartSlide = {
27
27
  const cls =
28
28
  i === activeIndex
29
29
  ? "is-active"
30
- : i < activeIndex
30
+ : activeIndex !== null && i < activeIndex
31
31
  ? "is-dim"
32
32
  : "";
33
33
  return `
@@ -1,22 +1,23 @@
1
- // BigNumberSlide.js
2
1
  export const BigNumberSlide = {
3
2
  type: "bigNumber",
4
3
 
5
4
  fromJSON(raw) {
6
- const value = raw.data?.find(d => d.name === "number")?.content;
7
- const label = raw.data?.find(d => d.name === "label")?.content;
5
+ const number = raw.data?.find(d => d.name === "number")?.content;
6
+ const label = raw.data?.find(d => d.name === "label")?.content;
8
7
 
9
- if (!value) throw new Error("bigNumber: number required");
8
+ if (!number) {
9
+ throw new Error("bigNumber: number required");
10
+ }
10
11
 
11
12
  return Object.freeze({
12
13
  type: "bigNumber",
13
- value,
14
+ number,
14
15
  label,
15
16
 
16
17
  render() {
17
18
  return `
18
19
  <section class="slide bigNumber">
19
- <div class="number">${value}</div>
20
+ <div class="number">${number}</div>
20
21
  ${label ? `<div class="label">${label}</div>` : ""}
21
22
  </section>
22
23
  `;
@@ -1,13 +1,12 @@
1
- // BulletListSlide.js
2
1
  export const BulletListSlide = {
3
2
  type: "bulletList",
4
3
 
5
4
  fromJSON(raw) {
6
5
  const bullets = raw.data
7
6
  ?.filter(d => d.name === "bullet")
8
- .map(d => ({ content: d.content }));
7
+ .map(d => d.content);
9
8
 
10
- if (!bullets?.length) {
9
+ if (!bullets || bullets.length === 0) {
11
10
  throw new Error("bulletList: requires at least one bullet");
12
11
  }
13
12
 
@@ -19,15 +18,15 @@ export const BulletListSlide = {
19
18
  return `
20
19
  <section class="slide bulletList">
21
20
  <ul>
22
- ${bullets.map((b, i) => {
21
+ ${bullets.map((text, i) => {
23
22
  if (i >= visibleCount) return "";
24
23
  const cls =
25
24
  i === activeIndex
26
25
  ? "is-active"
27
- : i < activeIndex
26
+ : activeIndex !== null && i < activeIndex
28
27
  ? "is-dim"
29
28
  : "";
30
- return `<li class="${cls}">${b.content}</li>`;
29
+ return `<li class="${cls}">${text}</li>`;
31
30
  }).join("")}
32
31
  </ul>
33
32
  </section>
@@ -1,11 +1,10 @@
1
- // ContactSlide.js
2
1
  export const ContactSlide = {
3
2
  type: "contactSlide",
4
3
 
5
4
  fromJSON(raw) {
6
- const items = raw.data?.map(d => ({ content: d.content }));
5
+ const items = raw.data?.map(d => d.content);
7
6
 
8
- if (!items?.length) {
7
+ if (!items || items.length === 0) {
9
8
  throw new Error("contactSlide: content required");
10
9
  }
11
10
 
@@ -16,7 +15,7 @@ export const ContactSlide = {
16
15
  render() {
17
16
  return `
18
17
  <section class="slide contactSlide">
19
- ${items.map(i => `<div>${i.content}</div>`).join("")}
18
+ ${items.map(text => `<div>${text}</div>`).join("")}
20
19
  </section>
21
20
  `;
22
21
  }
@@ -1,26 +1,31 @@
1
- // CornerWordsSlide.js
1
+
2
2
  export const CornerWordsSlide = {
3
3
  type: "cornerWordsSlide",
4
4
 
5
5
  fromJSON(raw) {
6
- const words = raw.data
7
- ?.filter(d => d.name === "word")
8
- .map(d => ({ content: d.content }));
6
+ const cards = raw.data
7
+ ?.filter(d => d.name === "card")
8
+ .map(d => ({ icon: d.icon, label: d.label }));
9
9
 
10
- if (!words?.length) {
11
- throw new Error("cornerWordsSlide: requires at least one word");
10
+ if (!cards || cards.length === 0) {
11
+ throw new Error("cornerWordsSlide: requires at least one card");
12
12
  }
13
13
 
14
14
  return Object.freeze({
15
15
  type: "cornerWordsSlide",
16
- words,
16
+ cards,
17
17
 
18
- render({ visibleCount = words.length } = {}) {
18
+ render({ visibleCount = cards.length } = {}) {
19
19
  return `
20
20
  <section class="slide cornerWordsSlide">
21
- ${words.map((w, i) => {
21
+ ${cards.map((c, i) => {
22
22
  if (i >= visibleCount) return "";
23
- return `<span class="corner-word corner-${i + 1}">${w.content}</span>`;
23
+ return `
24
+ <span class="corner-card corner-${i + 1}">
25
+ <span class="icon">${c.icon}</span>
26
+ <span class="label">${c.label}</span>
27
+ </span>
28
+ `;
24
29
  }).join("")}
25
30
  </section>
26
31
  `;