taleem-player 0.5.0 β†’ 0.7.0-rc

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 CHANGED
@@ -1,240 +1,263 @@
1
1
 
2
- # πŸ“¦ taleem-player
2
+ # Taleem Player
3
3
 
4
- **taleem-player** is a **headless, time-driven playback engine** for Taleem slide decks.
5
4
 
6
- It is designed for:
5
+ <img src="https://raw.githubusercontent.com/bilza2023/taleem-player/main/docs/images/taleem.webp" alt="Taleem Player β€” JSON to Web Presentations" />
7
6
 
8
- * timed presentations
9
- * narrated lessons
10
- * audio / video–synced slides
11
- * external playback control
7
+ **Taleem Player** is a JavaScript library that converts **JSON slide data** into **web-based presentations**.
12
8
 
13
- At its core, `taleem-player` does one thing well:
9
+ It provides multiple **modes** to display the same JSON presentation in different ways on the web.
14
10
 
15
- > **Given a valid deck and a clock, decide which slide should be active and when.**
11
+ ---
12
+ ###### Work in progress. Expect minor bugs, but no API breakages.
16
13
 
17
- It does **not** render slides.
18
- It does **not** define layouts.
19
- It does **not** ship CSS.
14
+ Demo and Documentation
20
15
 
21
- Those responsibilities belong elsewhere.
16
+ See Taleem Player in action:
22
17
 
23
- ---
18
+ πŸ‘‰ https://bilza2023.github.io/taleem/
24
19
 
25
- ## Core idea
20
+ This live demo lets you explore:
26
21
 
27
- A slide deck can be interpreted in **time**, not just order.
22
+ Browser Mode β€” instant, index-based slide rendering
28
23
 
29
- `taleem-player` treats a deck as a **timeline**, where each slide occupies a
30
- known interval:
24
+ Player Mode β€” time-driven, progressive presentations
31
25
 
32
- ```text
33
- [start ─────────── end)
34
- ```
26
+ Real Taleem slide JSON used in production
27
+
28
+ Shared CSS system powering all display modes
35
29
 
36
- At any given moment:
30
+ No screenshots. No mock data.
31
+ What you see is the real engine running in the browser.
32
+ ---
37
33
 
38
- * exactly one slide may be active
39
- * or no slide (before / after the timeline)
34
+ ## What it does
40
35
 
41
- The player’s job is to **resolve time β†’ slide** and notify a renderer.
36
+ * Takes **Taleem slide JSON**
37
+ * Renders it as a **web presentation**
38
+ * Supports **multiple display modes**
39
+ * Ships **ready-to-use CSS**
40
+ * Includes **utilities** for real-world usage
42
41
 
43
42
  ---
44
43
 
45
- ## What this library does
44
+ ## Installation
46
45
 
47
- `taleem-player`:
46
+ ```bash
47
+ npm install taleem-player
48
+ ```
48
49
 
49
- * Accepts a **deck-v1 JSON object**
50
- * Enforces **strict timing validity**
51
- * Owns a single DOM stage
52
- * Resolves the active slide for a given time
53
- * Calls an injected **renderer**
54
- * Supports **scrubbing, autoplay, pause, stop**
55
- * Is completely **renderer-agnostic**
50
+ ---
51
+
52
+ ## Display Modes
53
+
54
+ ### 1. Browser Mode
55
+
56
+ **Index-based slide viewer**.
56
57
 
57
- The public API is intentionally small:
58
+ Use this when you want:
59
+
60
+ * manual navigation
61
+ * previews
62
+ * galleries
63
+ * syllabus / editor views
64
+
65
+ #### API
58
66
 
59
67
  ```js
60
- player.renderAt(time)
61
- player.destroy()
68
+ import { createTaleemBrowser } from "taleem-player";
69
+
70
+ const browser = createTaleemBrowser({
71
+ mount: "#app",
72
+ deck
73
+ });
74
+
75
+ browser.render(0); // render slide by index
76
+ browser.getTotal(); // total number of slides
62
77
  ```
63
78
 
64
- Higher-level controls (play, pause, keyboard, UI) are built **on top**, not inside.
79
+ Characteristics:
80
+
81
+ * slide index driven
82
+ * no timing
83
+ * deterministic rendering
84
+ * same slide JSON as other modes
65
85
 
66
86
  ---
67
87
 
68
- ## What this library intentionally does NOT do
88
+ ### 2. Player Mode
69
89
 
70
- This is not accidental β€” it is a design boundary.
90
+ **Time-based slide player**.
71
91
 
72
- `taleem-player` does **not**:
92
+ Use this when you want:
73
93
 
74
- * define slide layouts
75
- * ship or inject CSS
76
- * depend on `taleem-slides`
77
- * interpret slide content
78
- * infer or auto-fix timings
79
- * manage audio or narration
80
- * expose internal state
81
- * depend on any framework
94
+ * narrated lessons
95
+ * video / audio sync
96
+ * timed presentations
82
97
 
83
- If a deck is invalid, the player **throws**.
84
- If rendering looks wrong, the renderer is responsible.
98
+ #### API
85
99
 
86
- ---
100
+ ```js
101
+ import { createTaleemPlayer } from "taleem-player";
87
102
 
88
- ## Strict timing model (important)
103
+ const player = createTaleemPlayer({
104
+ mount: "#app",
105
+ deckDemo and Documentation
89
106
 
90
- `taleem-player` only accepts **player-ready decks**.
107
+ Live demo and documentation are available here:
91
108
 
92
- Every slide **must** define:
109
+ πŸ‘‰ https://bilza2023.github.io/taleem/
93
110
 
94
- ```json
95
- {
96
- "start": number,
97
- "end": number
98
- }
99
- ```
111
+ The demo showcases:
100
112
 
101
- Rules:
113
+ browser mode rendering
102
114
 
103
- * `start` and `end` are **absolute seconds**
104
- * `end` must be greater than `start`
105
- * No implicit inheritance
106
- * No auto-injection
107
- * No browser-style forgiveness
115
+ player mode rendering
108
116
 
109
- This strictness is intentional and non-negotiable.
117
+ real Taleem slide JSON
110
118
 
111
- ---
119
+ shared CSS across modes
120
+ });
112
121
 
113
- ## Renderer contract
122
+ player.renderAt(12.5); // render slide at time (seconds)
123
+ player.destroy();
124
+ ```
114
125
 
115
- `taleem-player` does not know how slides look.
126
+ Characteristics:
116
127
 
117
- Instead, it calls a renderer with this contract:
128
+ * time driven
129
+ * external clock control
130
+ * no play / pause logic
131
+ * one active slide at a time
118
132
 
119
- ```js
120
- renderer.render({
121
- mount, // HTMLElement
122
- slide, // full slide JSON
123
- time // absolute time (seconds)
124
- })
125
- ```
133
+ ---
134
+ ## Browser Mode vs Player Mode
126
135
 
127
- That’s it.
136
+ Both modes render the same JSON presentation, but they serve very different purposes.
128
137
 
129
- How the slide is rendered β€” HTML, SVG, Canvas, WebGL β€” is **not the player’s concern**.
138
+ | Feature | Browser Mode | Player Mode |
139
+ |-------|-------------|-------------|
140
+ | Rendering model | Index-based | Time-based |
141
+ | Navigation | Manual (by slide index) | Progressive (by time) |
142
+ | Timing required | No | Yes (required) |
143
+ | Rendering behavior | One slide at a time | Slides change over time |
144
+ | Control source | Application-driven | External clock / media |
145
+ | Best suited for | Previews, galleries, editors | Narration, video, audio sync |
130
146
 
131
147
  ---
132
148
 
133
- ## Relationship to other Taleem libraries
149
+ ### Browser Mode
150
+
151
+ Use Browser Mode when you want direct access to slides.
152
+
153
+ **Characteristics**
154
+ - Index-based rendering
155
+ - No timing data required
156
+ - Deterministic output
157
+
158
+ **Ideal for**
159
+ - previews
160
+ - galleries
161
+ - editors
162
+ - syllabus pages
134
163
 
135
- `taleem-player` is part of a **layered system**.
136
164
 
137
- ### Lower-level
165
+ ⚠️ Important:
166
+ In Player Mode, the user must provide valid and ordered timings (start, end).
167
+ The library does not auto-fix or guess timings.
138
168
 
139
- **taleem-slides**
140
- Pure slide renderer.
141
- Converts slide JSON into HTML + CSS.
169
+ ---
142
170
 
143
- ### Higher-level
171
+ ## Utilities
144
172
 
145
- **Taleem demo app**
146
- Wires together:
173
+ Taleem Player includes small helper utilities for preparing decks.
147
174
 
148
- * `taleem-player`
149
- * `taleem-slides`
150
- * playback controls
151
- * UI
175
+ ### assignMockTimings
152
176
 
153
- ### Sibling
177
+ Convert a non-timed deck into a player-ready deck.
154
178
 
155
- **taleem-browser**
156
- Index-based slide viewer (no time).
179
+ ```js
180
+ import { assignMockTimings } from "taleem-player";
157
181
 
158
- Each library has **one responsibility**.
159
- They are composed β€” never merged.
182
+ const timedDeck = assignMockTimings(deck, 5);
183
+ ```
160
184
 
161
185
  ---
162
186
 
163
- ## Why this library exists
187
+ ### resolveAssetPaths
164
188
 
165
- `taleem-browser` treats slides as a **document**.
166
- `taleem-player` treats slides as a **timeline**.
189
+ Resolve image paths for deployment.
167
190
 
168
- Both are valid interpretations.
191
+ ```js
192
+ import { resolveAssetPaths } from "taleem-player";
169
193
 
170
- By separating them:
194
+ resolveAssetPaths(deck, "/images/");
195
+ ```
196
+
197
+ ---
171
198
 
172
- * timed playback does not pollute browsing logic
173
- * rendering does not pollute playback logic
174
- * decks remain portable JSON documents
199
+ ### resolveBackground
175
200
 
176
- This separation allows:
201
+ Normalize and resolve background configuration.
177
202
 
178
- * narration sync
179
- * recorded lessons
180
- * adaptive playback
181
- * multiple renderers
203
+ ```js
204
+ import { resolveBackground } from "taleem-player";
182
205
 
183
- without rewriting the core.
206
+ resolveBackground(deck, "/images/");
207
+ ```
184
208
 
185
209
  ---
186
210
 
187
- ## Typical usage (composition layer)
211
+ ## CSS
188
212
 
189
- ```js
190
- import { createTaleemPlayer } from "taleem-player";
191
- import { createSlidesRenderer } from "taleem-slides";
192
- import "taleem-slides/dist/taleem.css";
213
+ Taleem Player ships with built-in styles.
193
214
 
194
- const renderer = createSlidesRenderer();
215
+ ### Base styles
195
216
 
196
- const player = createTaleemPlayer({
197
- mount: "#app",
198
- deck,
199
- renderer
200
- });
217
+ ```js
218
+ import "taleem-player/css";
219
+ ```
201
220
 
202
- // external clock
203
- player.renderAt(12.5);
221
+ ### Themes
222
+
223
+ ```js
224
+ import "taleem-player/css/dark";
225
+ import "taleem-player/css/light";
226
+ import "taleem-player/css/paper";
204
227
  ```
205
228
 
206
- The **player** never imports slides.
207
- The **slides** never import the player.
208
- The **app** composes them.
229
+ CSS controls layout, visibility, and visual behavior.
230
+ Modes share the same CSS.
209
231
 
210
232
  ---
211
233
 
212
- ## Design philosophy (locked)
234
+ ## Input format
213
235
 
214
- * Time is external
215
- * Rendering is replaceable
216
- * Strictness beats convenience
217
- * Libraries stay small
218
- * Composition happens at the edge
236
+ Taleem Player does **not** define slide structure.
219
237
 
220
- > **A player decides *when*.
221
- > A renderer decides *how*.
222
- > An app decides *why*.**
238
+ It renders JSON produced for **taleem-slides**.
239
+
240
+ * Player Mode requires slides with `start` / `end`
241
+ * Browser Mode only needs ordered slides
223
242
 
224
243
  ---
225
244
 
226
- ## Project status
245
+ ## What Taleem Player does NOT do
246
+
247
+ * create slides
248
+ * edit JSON
249
+ * validate schemas
250
+ * manage time or playback
251
+ * handle audio or narration
252
+ * provide UI controls
227
253
 
228
- **Core complete and stable.**
254
+ Those belong to the **application**, not the library.
229
255
 
230
- Future work belongs in:
256
+ ---
231
257
 
232
- * demo applications
233
- * playback UI layers
234
- * renderers
235
- * authoring tools
258
+ ## Status
236
259
 
237
- The player itself should change rarely.
260
+ **Release Candidate (API stable)**
238
261
 
239
262
  ---
240
263