taleem-browser 0.2.0 → 1.0.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,228 +1,251 @@
1
1
 
2
2
  # taleem-browser
3
3
 
4
- **taleem-browser** provides a simple and reliable way to display **JSON-based slide decks** in the browser.
4
+ **taleem-browser** is a small, reliable JavaScript library for displaying
5
+ **JSON-based Taleem slide decks** in the browser.
5
6
 
6
- It is designed for:
7
- - students
8
- - teachers
9
- - academics
10
- - anyone who wants structured, content-driven slides without complex tools
7
+ It is intentionally simple.
11
8
 
12
- At its core, `taleem-browser` does one thing well:
9
+ > **Given a valid deck and an index, it renders that slide into the DOM.**
13
10
 
14
- > **Take a slide deck written in JSON and display it as slides.**
11
+ No timing.
12
+ No autoplay.
13
+ No hidden state.
15
14
 
16
- You give it a valid deck, and it renders the slides — one at a time — into the page.
15
+ ---
17
16
 
18
- That’s it.
17
+ ## Why taleem-browser exists
19
18
 
20
- There is no autoplay, no animation system, and no timing dependency.
21
- Slides always render, regardless of how simple or complex the deck is.
19
+ Most slide systems mix too many responsibilities:
20
+ - rendering
21
+ - timing
22
+ - navigation
23
+ - animation
24
+ - state
25
+ - UI controls
22
26
 
23
- ---
27
+ `taleem-browser` deliberately avoids this.
28
+
29
+ It treats a slide deck as a **document**, not a video.
30
+
31
+ This makes it:
32
+ - predictable
33
+ - easy to debug
34
+ - easy to test
35
+ - safe for educational content
36
+ - reusable in any UI or framework
24
37
 
25
- ## Core idea
38
+ ---
26
39
 
27
- A slide deck is treated as a **document**, not a video or animation.
40
+ ## What it is
28
41
 
29
- Slides are shown in a fixed order, and the browser moves between them by position (previous, next, or jump to a slide).
42
+ `taleem-browser` is:
30
43
 
31
- This makes slide creation:
32
- - predictable
33
- - easy to debug
34
- - safe to modify
35
- - suitable for learning and teaching material
44
+ - an **index-based slide viewer**
45
+ - a **thin DOM wrapper**
46
+ - a **consumer of Taleem decks**
47
+ - a **renderer, not a player**
36
48
 
37
- You focus on **content and structure**.
38
- `taleem-browser` handles display and navigation.
49
+ You decide *which slide index to show*.
50
+ The browser renders it.
39
51
 
40
52
  ---
41
53
 
42
- ## What this library does
54
+ ## What it does
43
55
 
44
56
  `taleem-browser`:
45
57
 
46
58
  - Accepts a **deck JSON object**
47
- - Uses `taleem-slides` to render slides into HTML
48
- - Owns a single DOM mount point
59
+ - Uses **taleem-slides** to convert slide JSON into HTML
60
+ - Injects a fixed DOM structure into a mount point
49
61
  - Displays **exactly one slide at a time**
50
- - Navigates slides by **index**
51
- - Always succeeds at rendering valid content
62
+ - Renders slides **by numeric index**
63
+ - Never mutates the deck
64
+ - Throws immediately on invalid slide types
52
65
 
53
- The public API is intentionally small:
66
+ The API is intentionally small and stable.
54
67
 
55
- ```js
56
- browser.next()
57
- browser.prev()
58
- browser.goTo(index)
59
- browser.render()
68
+ ---
69
+
70
+ ## Installation
71
+
72
+ ```bash
73
+ npm install taleem-browser
60
74
  ````
61
75
 
62
- That’s the entire contract.
76
+ ---
77
+
78
+ ## Basic usage
79
+
80
+ ```js
81
+ import { createTaleemBrowser } from "taleem-browser";
82
+ import deck from "./deck.json";
83
+
84
+ const browser = createTaleemBrowser({
85
+ mount: "#app",
86
+ deck
87
+ });
63
88
 
64
- There are **no state getters** and **no lifecycle hooks** exposed.
65
- The browser is controlled purely by commands, and verified by what appears in the DOM.
89
+ browser.render(0); // render first slide
90
+ browser.render(1); // render second slide
91
+ ```
66
92
 
67
93
  ---
68
94
 
69
- ## What this library intentionally does NOT do
95
+ ## Public API
70
96
 
71
- This is not an omission — it is a design choice.
97
+ ### `createTaleemBrowser(options)`
72
98
 
73
- `taleem-browser` does **not**:
99
+ Creates a browser instance.
74
100
 
75
- * interpret `start`, `end`, or `showAt`
76
- * manage time, intervals, or autoplay
77
- * perform animations or transitions
78
- * sync audio or narration
79
- * expose internal state (index, total, slides)
80
- * depend on any framework (React, Svelte, Vue, etc.)
81
- * grow configuration options endlessly
101
+ ```ts
102
+ createTaleemBrowser({
103
+ mount: HTMLElement | string,
104
+ deck: TaleemDeck
105
+ })
106
+ ```
107
+
108
+ #### Parameters
109
+
110
+ * `mount`
111
+ A DOM element or a CSS selector where slides will be rendered.
82
112
 
83
- These concerns belong to **different layers or different libraries**.
113
+ * `deck`
114
+ A **valid Taleem deck JSON object**.
84
115
 
85
116
  ---
86
117
 
87
- ## Styling
118
+ ### `browser.render(index)`
88
119
 
89
- Canonical slide styles live in:
120
+ Renders the slide at the given index.
90
121
 
91
- ```
92
- src/styles/taleem.css
122
+ ```js
123
+ browser.render(3);
93
124
  ```
94
125
 
95
- They are bundled and shipped as part of the release assets.
126
+ * Index is zero-based
127
+ * Out-of-range indexes are ignored
128
+ * Rendering always replaces previous slide content
96
129
 
97
- The browser does not generate styles dynamically.
98
- Styling is deterministic, inspectable, and override-friendly.
130
+ ---
131
+
132
+ ### `browser.getTotal()`
133
+
134
+ Returns the total number of slides in the deck.
135
+
136
+ ```js
137
+ const total = browser.getTotal();
138
+ ```
99
139
 
100
140
  ---
101
141
 
102
- ## Relationship to other Taleem libraries
142
+ ## DOM contract
103
143
 
104
- `taleem-browser` is part of a small, layered ecosystem.
144
+ `taleem-browser` injects the following structure into the mount element:
105
145
 
106
- ### Lower-level libraries
146
+ ```html
147
+ <div class="taleem-browser-bg"></div>
148
+ <div class="taleem-browser-slide"></div>
149
+ ```
107
150
 
108
- **taleem-core**
109
- Defines deck schemas, validation rules, and core concepts.
110
- 📄 API reference:
111
- [https://github.com/bilza2023/taleem-core/blob/master/docs/api.md](https://github.com/bilza2023/taleem-core/blob/master/docs/api.md)
151
+ ### Meaning
112
152
 
113
- **taleem-slides**
114
- Converts slide JSON into HTML.
115
- This is the renderer used internally by `taleem-browser`.
116
- 🔗 Repository:
117
- [https://github.com/bilza2023/taleem-slides](https://github.com/bilza2023/taleem-slides)
153
+ * `.taleem-browser-bg`
154
+ Deck-level background layer
118
155
 
119
- `taleem-browser` sits **above** these libraries so users do not need to wire renderers or schemas manually.
156
+ * `.taleem-browser-slide`
157
+ Container for the rendered slide HTML
120
158
 
121
- If you want low-level control over rendering, use `taleem-slides` directly.
122
- If you want a **ready-to-use slide viewer**, use `taleem-browser`.
159
+ These class names are **public and stable** and may be styled by consumers.
123
160
 
124
161
  ---
125
162
 
126
- ## Example deck (gold standard)
163
+ ## Styling
127
164
 
128
- A complete, production-quality example deck is available here:
165
+ `taleem-browser` does **not** generate slide styles.
129
166
 
130
- 🔗 **Demo gold-standard deck**
131
- [https://github.com/bilza2023/taleem/blob/master/decks/demo-gold.json](https://github.com/bilza2023/taleem/blob/master/decks/demo-gold.json)
167
+ Slide HTML and CSS are defined by **taleem-slides** and/or the consuming application.
132
168
 
133
- This deck is used as a reference for:
169
+ This ensures:
134
170
 
135
- * slide layout
136
- * spacing
137
- * typography
138
- * JSON structure
171
+ * deterministic output
172
+ * inspectable markup
173
+ * no runtime styling surprises
139
174
 
140
175
  ---
141
176
 
142
- ## Advanced playback (out of scope)
177
+ ## What this library intentionally does NOT do
143
178
 
144
- Timed playback, animations, narration, or video-like behavior are **explicitly out of scope** for this library.
179
+ This is a design choice, not a limitation.
145
180
 
146
- Timing-related fields such as `start`, `end`, and `showAt` are treated as **metadata**, not requirements.
181
+ `taleem-browser` does **not**:
147
182
 
148
- For deeper reading on timing concepts and EQ-style slides:
183
+ * interpret timing (`start`, `end`, `showAt`)
184
+ * manage playback or autoplay
185
+ * handle animations or transitions
186
+ * validate slide field content
187
+ * expose internal state
188
+ * provide UI controls
189
+ * depend on any framework (React, Svelte, Vue, etc.)
149
190
 
150
- * 📄 EQ slide format (advanced, optional):
151
- [https://github.com/bilza2023/taleem-core/blob/master/docs/eq.md](https://github.com/bilza2023/taleem-core/blob/master/docs/eq.md)
191
+ These concerns belong to **other layers**.
152
192
 
153
- * 📄 Timing rules (for playback layers, not the browser):
154
- [https://github.com/bilza2023/taleem-core/blob/master/docs/timings.md](https://github.com/bilza2023/taleem-core/blob/master/docs/timings.md)
193
+ ---
155
194
 
156
- A future playback layer (e.g. `taleem-player`) may interpret these fields, but `taleem-browser` never depends on them.
195
+ ## Relationship to other Taleem libraries
157
196
 
158
- ---
197
+ `taleem-browser` is part of a layered ecosystem.
159
198
 
160
- ## Project discipline (important)
199
+ ### taleem-core
161
200
 
162
- To keep the core strong, we follow strict rules.
201
+ Defines deck schemas and validation rules.
163
202
 
164
- ### ❌ Things we do NOT do
203
+ ### taleem-slides
165
204
 
166
- * Do **not** add new slide types casually
167
- * Do **not** add timing or playback logic
168
- * Do **not** blur browser and player responsibilities
169
- * Do **not** expose internal state
170
- * Do **not** grow the API
171
- * Do **not** chase frameworks or trends
205
+ Converts slide JSON into HTML templates.
206
+ Used internally by `taleem-browser`.
172
207
 
173
- ### Things we focus on
208
+ `taleem-browser` sits **above** these libraries to provide
209
+ a ready-to-use, index-based slide viewer.
174
210
 
175
- * More example decks
176
- * CSS and rendering bug fixes
177
- * Navigation correctness
178
- * Documentation clarity
179
- * Stability over novelty
211
+ If you need:
180
212
 
181
- Every “no” protects the core.
213
+ * schema validation use `taleem-core`
214
+ * raw HTML rendering → use `taleem-slides`
215
+ * timed playback or narration → use a playback layer (e.g. `taleem-player`)
182
216
 
183
217
  ---
184
218
 
185
- ## Minimal usage
219
+ ## Testing philosophy
186
220
 
187
- ```js
188
- import { createTaleemBrowser } from "taleem-browser";
189
- import deck from "./deck.json";
221
+ `taleem-browser` tests **do not validate decks or slides**.
190
222
 
191
- const browser = createTaleemBrowser({
192
- mount: "#app",
193
- deck
194
- });
223
+ Tests use a **minimal, known-valid deck** to verify:
195
224
 
196
- browser.next();
197
- browser.prev();
198
- browser.goTo(3);
199
- ```
225
+ * DOM injection
226
+ * template resolution
227
+ * deterministic rendering
228
+ * index-based behavior
229
+
230
+ Slide correctness is explicitly **out of scope** for this library.
200
231
 
201
232
  ---
202
233
 
203
234
  ## Design philosophy
204
235
 
205
- * Slides are **content-first**
236
+ * Slides are documents
206
237
  * Index is more fundamental than time
207
- * Rendering should never fail
208
- * Static viewing is the default
209
- * Playback is an optional interpretation
238
+ * Rendering should be deterministic
239
+ * State belongs to the caller
240
+ * Small libraries stay correct longer
210
241
 
211
- > **Slides are documents.
212
- > Timing is an optional playback layer.**
242
+ > **Render by index.
243
+ > Everything else is interpretation.**
213
244
 
214
245
  ---
215
246
 
216
- ## Related project (optional)
217
-
218
- `taleem-browser` is actively used in the **Taleem demo project**, which showcases real decks, layouts, and usage patterns as they evolve.
219
-
220
- The demo project is provided as a reference, not a dependency:
221
-
222
- [https://github.com/bilza2023/taleem](https://github.com/bilza2023/taleem)
247
+ ## License
223
248
 
224
- ---
249
+ MIT
225
250
 
226
- ## License
227
251
 
228
- MIT