taleem-player 0.5.0 → 0.6.0-rc.1

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,33 +1,54 @@
1
1
 
2
2
  # 📦 taleem-player
3
3
 
4
- **taleem-player** is a **headless, time-driven playback engine** for Taleem slide decks.
4
+ **taleem-player** is a **time-driven player** for **Taleem slides**.
5
+
6
+ It plays slide decks rendered by `taleem-slides`, using **time** instead of index.
5
7
 
6
8
  It is designed for:
7
9
 
8
- * timed presentations
9
10
  * narrated lessons
11
+ * timed presentations
10
12
  * audio / video–synced slides
11
13
  * external playback control
12
14
 
13
- At its core, `taleem-player` does one thing well:
15
+ At its core, `taleem-player` does one thing:
16
+
17
+ > **Given a player-ready deck and a time value, render the correct Taleem slide.**
18
+
19
+ It does **not** author decks.
20
+ It does **not** fix data.
21
+ It does **not** manage time.
22
+
23
+ ---
24
+
25
+ ## 🌐 Live Docs, Demo & Reference (START HERE)
14
26
 
15
- > **Given a valid deck and a clock, decide which slide should be active and when.**
27
+ 👉 **[https://bilza2023.github.io/taleem](https://bilza2023.github.io/taleem)**
16
28
 
17
- It does **not** render slides.
18
- It does **not** define layouts.
19
- It does **not** ship CSS.
29
+ This website is the **official reference** for the Taleem system.
20
30
 
21
- Those responsibilities belong elsewhere.
31
+ It shows:
32
+
33
+ * all supported slide types
34
+ * real visual behavior
35
+ * actual rendered output
36
+ * examples and demos
37
+
38
+ If anything in this README feels unclear:
39
+
40
+ > **The website is the final authority.**
41
+
42
+ The README explains *rules*.
43
+ The website shows *results*.
22
44
 
23
45
  ---
24
46
 
25
47
  ## Core idea
26
48
 
27
- A slide deck can be interpreted in **time**, not just order.
49
+ Slides are not just ordered they are placed on a **timeline**.
28
50
 
29
- `taleem-player` treats a deck as a **timeline**, where each slide occupies a
30
- known interval:
51
+ `taleem-player` treats a deck as time intervals:
31
52
 
32
53
  ```text
33
54
  [start ─────────── end)
@@ -35,10 +56,12 @@ known interval:
35
56
 
36
57
  At any given moment:
37
58
 
38
- * exactly one slide may be active
39
- * or no slide (before / after the timeline)
59
+ * one slide may be active
60
+ * or no slide (before or after the timeline)
40
61
 
41
- The player’s job is to **resolve time → slide** and notify a renderer.
62
+ The player’s job is simple:
63
+
64
+ > **time → slide → render**
42
65
 
43
66
  ---
44
67
 
@@ -46,48 +69,45 @@ The player’s job is to **resolve time → slide** and notify a renderer.
46
69
 
47
70
  `taleem-player`:
48
71
 
49
- * Accepts a **deck-v1 JSON object**
50
- * Enforces **strict timing validity**
72
+ * Accepts a **player-ready deck-v1**
73
+ * Assumes **valid timing**
51
74
  * 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**
75
+ * Resolves which slide is active at a given time
76
+ * Renders slides using **taleem-slides**
77
+ * Exposes a **minimal API**
56
78
 
57
- The public API is intentionally small:
79
+ Public API:
58
80
 
59
81
  ```js
60
82
  player.renderAt(time)
61
83
  player.destroy()
62
84
  ```
63
85
 
64
- Higher-level controls (play, pause, keyboard, UI) are built **on top**, not inside.
86
+ Time always comes from **outside**.
65
87
 
66
88
  ---
67
89
 
68
90
  ## What this library intentionally does NOT do
69
91
 
70
- This is not accidental — it is a design boundary.
71
-
72
92
  `taleem-player` does **not**:
73
93
 
94
+ * validate deck schemas
95
+ * auto-generate timings
96
+ * fix broken decks
74
97
  * define slide layouts
75
- * ship or inject CSS
76
- * depend on `taleem-slides`
77
- * interpret slide content
78
- * infer or auto-fix timings
98
+ * ship CSS
79
99
  * manage audio or narration
80
- * expose internal state
81
- * depend on any framework
100
+ * play / pause / autoplay
101
+ * own clocks or intervals
82
102
 
83
- If a deck is invalid, the player **throws**.
84
- If rendering looks wrong, the renderer is responsible.
103
+ If a deck is wrong, the player may break.
104
+ This is intentional.
85
105
 
86
106
  ---
87
107
 
88
108
  ## Strict timing model (important)
89
109
 
90
- `taleem-player` only accepts **player-ready decks**.
110
+ > **NOTE: taleem-player assumes a *player-ready deck*.**
91
111
 
92
112
  Every slide **must** define:
93
113
 
@@ -100,141 +120,96 @@ Every slide **must** define:
100
120
 
101
121
  Rules:
102
122
 
103
- * `start` and `end` are **absolute seconds**
123
+ * time unit is **seconds**
124
+ * fractional seconds are allowed (e.g. `3.1`, `3.75`)
104
125
  * `end` must be greater than `start`
105
- * No implicit inheritance
106
- * No auto-injection
107
- * No browser-style forgiveness
126
+ * timings must be monotonic
127
+ * no auto-injection
128
+ * no browser forgiveness
108
129
 
109
- This strictness is intentional and non-negotiable.
130
+ Deck preparation happens **before** the player
131
+ (e.g. via tooling like `assignMockTimings`).
110
132
 
111
133
  ---
112
134
 
113
- ## Renderer contract
135
+ ## Rendering model
114
136
 
115
- `taleem-player` does not know how slides look.
137
+ `taleem-player` renders **Taleem slides**.
116
138
 
117
- Instead, it calls a renderer with this contract:
139
+ Internally it:
118
140
 
119
- ```js
120
- renderer.render({
121
- mount, // HTMLElement
122
- slide, // full slide JSON
123
- time // absolute time (seconds)
124
- })
125
- ```
126
-
127
- That’s it.
141
+ 1. Finds the active slide for the given time
142
+ 2. Computes minimal render state
143
+ 3. Uses `taleem-slides` to generate HTML
144
+ 4. Injects HTML into a single stage
128
145
 
129
- How the slide is rendered HTML, SVG, Canvas, WebGL — is **not the player’s concern**.
146
+ Rendering is **deterministic** and **stateless**.
130
147
 
131
148
  ---
132
149
 
133
150
  ## Relationship to other Taleem libraries
134
151
 
135
- `taleem-player` is part of a **layered system**.
152
+ `taleem-player` is part of a small, focused system.
136
153
 
137
- ### Lower-level
154
+ ### **taleem-core**
138
155
 
139
- **taleem-slides**
140
- Pure slide renderer.
141
- Converts slide JSON into HTML + CSS.
156
+ Defines schemas and canonical (golden) decks.
142
157
 
143
- ### Higher-level
158
+ ### **taleem-slides**
144
159
 
145
- **Taleem demo app**
146
- Wires together:
160
+ Renders slide JSON into HTML + CSS.
147
161
 
148
- * `taleem-player`
149
- * `taleem-slides`
150
- * playback controls
151
- * UI
162
+ ### **taleem-browser**
152
163
 
153
- ### Sibling
154
-
155
- **taleem-browser**
156
164
  Index-based slide viewer (no time).
157
165
 
158
- Each library has **one responsibility**.
159
- They are composed — never merged.
160
-
161
- ---
162
-
163
- ## Why this library exists
164
-
165
- `taleem-browser` treats slides as a **document**.
166
- `taleem-player` treats slides as a **timeline**.
166
+ ### **Apps / demos**
167
167
 
168
- Both are valid interpretations.
168
+ Own time, UI, controls, audio, narration.
169
169
 
170
- By separating them:
171
-
172
- * timed playback does not pollute browsing logic
173
- * rendering does not pollute playback logic
174
- * decks remain portable JSON documents
175
-
176
- This separation allows:
177
-
178
- * narration sync
179
- * recorded lessons
180
- * adaptive playback
181
- * multiple renderers
182
-
183
- without rewriting the core.
170
+ Each library does **one job**.
171
+ They are composed, not mixed.
184
172
 
185
173
  ---
186
174
 
187
- ## Typical usage (composition layer)
175
+ ## Typical usage
188
176
 
189
177
  ```js
190
178
  import { createTaleemPlayer } from "taleem-player";
191
- import { createSlidesRenderer } from "taleem-slides";
192
- import "taleem-slides/dist/taleem.css";
193
-
194
- const renderer = createSlidesRenderer();
195
179
 
196
180
  const player = createTaleemPlayer({
197
181
  mount: "#app",
198
- deck,
199
- renderer
182
+ deck // must be player-ready
200
183
  });
201
184
 
202
185
  // external clock
203
186
  player.renderAt(12.5);
204
187
  ```
205
188
 
206
- The **player** never imports slides.
207
- The **slides** never import the player.
208
- The **app** composes them.
189
+ `taleem-player` never controls time.
190
+ Time always belongs to the app.
209
191
 
210
192
  ---
211
193
 
212
194
  ## Design philosophy (locked)
213
195
 
214
196
  * Time is external
215
- * Rendering is replaceable
216
- * Strictness beats convenience
197
+ * Slides are deterministic
198
+ * Seconds are enough
217
199
  * Libraries stay small
218
- * Composition happens at the edge
200
+ * Control lives at the top
219
201
 
220
- > **A player decides *when*.
221
- > A renderer decides *how*.
222
- > An app decides *why*.**
202
+ > **The player decides *what* to show.**
203
+ > **The app decides *when* and *why*.**
223
204
 
224
205
  ---
225
206
 
226
207
  ## Project status
227
208
 
228
- **Core complete and stable.**
229
-
230
- Future work belongs in:
231
-
232
- * demo applications
233
- * playback UI layers
234
- * renderers
235
- * authoring tools
209
+ **Release Candidate (API locked).**
236
210
 
237
- The player itself should change rarely.
211
+ Only bug fixes should follow.
212
+ No new concepts belong here.
238
213
 
239
214
  ---
240
215