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