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 +156 -133
- package/dist/taleem-browser.esm.js +260 -315
- package/dist/taleem-browser.umd.js +260 -315
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,228 +1,251 @@
|
|
|
1
1
|
|
|
2
2
|
# taleem-browser
|
|
3
3
|
|
|
4
|
-
**taleem-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
|
|
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
|
-
|
|
9
|
+
> **Given a valid deck and an index, it renders that slide into the DOM.**
|
|
13
10
|
|
|
14
|
-
|
|
11
|
+
No timing.
|
|
12
|
+
No autoplay.
|
|
13
|
+
No hidden state.
|
|
15
14
|
|
|
16
|
-
|
|
15
|
+
---
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
## Why taleem-browser exists
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
38
|
+
---
|
|
26
39
|
|
|
27
|
-
|
|
40
|
+
## What it is
|
|
28
41
|
|
|
29
|
-
|
|
42
|
+
`taleem-browser` is:
|
|
30
43
|
|
|
31
|
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
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
|
|
38
|
-
|
|
49
|
+
You decide *which slide index to show*.
|
|
50
|
+
The browser renders it.
|
|
39
51
|
|
|
40
52
|
---
|
|
41
53
|
|
|
42
|
-
## What
|
|
54
|
+
## What it does
|
|
43
55
|
|
|
44
56
|
`taleem-browser`:
|
|
45
57
|
|
|
46
58
|
- Accepts a **deck JSON object**
|
|
47
|
-
- Uses
|
|
48
|
-
-
|
|
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
|
-
-
|
|
51
|
-
-
|
|
62
|
+
- Renders slides **by numeric index**
|
|
63
|
+
- Never mutates the deck
|
|
64
|
+
- Throws immediately on invalid slide types
|
|
52
65
|
|
|
53
|
-
The
|
|
66
|
+
The API is intentionally small and stable.
|
|
54
67
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Installation
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npm install taleem-browser
|
|
60
74
|
````
|
|
61
75
|
|
|
62
|
-
|
|
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
|
-
|
|
65
|
-
|
|
89
|
+
browser.render(0); // render first slide
|
|
90
|
+
browser.render(1); // render second slide
|
|
91
|
+
```
|
|
66
92
|
|
|
67
93
|
---
|
|
68
94
|
|
|
69
|
-
##
|
|
95
|
+
## Public API
|
|
70
96
|
|
|
71
|
-
|
|
97
|
+
### `createTaleemBrowser(options)`
|
|
72
98
|
|
|
73
|
-
|
|
99
|
+
Creates a browser instance.
|
|
74
100
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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
|
-
|
|
113
|
+
* `deck`
|
|
114
|
+
A **valid Taleem deck JSON object**.
|
|
84
115
|
|
|
85
116
|
---
|
|
86
117
|
|
|
87
|
-
|
|
118
|
+
### `browser.render(index)`
|
|
88
119
|
|
|
89
|
-
|
|
120
|
+
Renders the slide at the given index.
|
|
90
121
|
|
|
91
|
-
```
|
|
92
|
-
|
|
122
|
+
```js
|
|
123
|
+
browser.render(3);
|
|
93
124
|
```
|
|
94
125
|
|
|
95
|
-
|
|
126
|
+
* Index is zero-based
|
|
127
|
+
* Out-of-range indexes are ignored
|
|
128
|
+
* Rendering always replaces previous slide content
|
|
96
129
|
|
|
97
|
-
|
|
98
|
-
|
|
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
|
-
##
|
|
142
|
+
## DOM contract
|
|
103
143
|
|
|
104
|
-
`taleem-browser`
|
|
144
|
+
`taleem-browser` injects the following structure into the mount element:
|
|
105
145
|
|
|
106
|
-
|
|
146
|
+
```html
|
|
147
|
+
<div class="taleem-browser-bg"></div>
|
|
148
|
+
<div class="taleem-browser-slide"></div>
|
|
149
|
+
```
|
|
107
150
|
|
|
108
|
-
|
|
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
|
-
|
|
114
|
-
|
|
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
|
-
|
|
156
|
+
* `.taleem-browser-slide`
|
|
157
|
+
Container for the rendered slide HTML
|
|
120
158
|
|
|
121
|
-
|
|
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
|
-
##
|
|
163
|
+
## Styling
|
|
127
164
|
|
|
128
|
-
|
|
165
|
+
`taleem-browser` does **not** generate slide styles.
|
|
129
166
|
|
|
130
|
-
|
|
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
|
|
169
|
+
This ensures:
|
|
134
170
|
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
* JSON structure
|
|
171
|
+
* deterministic output
|
|
172
|
+
* inspectable markup
|
|
173
|
+
* no runtime styling surprises
|
|
139
174
|
|
|
140
175
|
---
|
|
141
176
|
|
|
142
|
-
##
|
|
177
|
+
## What this library intentionally does NOT do
|
|
143
178
|
|
|
144
|
-
|
|
179
|
+
This is a design choice, not a limitation.
|
|
145
180
|
|
|
146
|
-
|
|
181
|
+
`taleem-browser` does **not**:
|
|
147
182
|
|
|
148
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
195
|
+
## Relationship to other Taleem libraries
|
|
157
196
|
|
|
158
|
-
|
|
197
|
+
`taleem-browser` is part of a layered ecosystem.
|
|
159
198
|
|
|
160
|
-
|
|
199
|
+
### taleem-core
|
|
161
200
|
|
|
162
|
-
|
|
201
|
+
Defines deck schemas and validation rules.
|
|
163
202
|
|
|
164
|
-
###
|
|
203
|
+
### taleem-slides
|
|
165
204
|
|
|
166
|
-
|
|
167
|
-
|
|
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
|
-
|
|
208
|
+
`taleem-browser` sits **above** these libraries to provide
|
|
209
|
+
a ready-to-use, index-based slide viewer.
|
|
174
210
|
|
|
175
|
-
|
|
176
|
-
* CSS and rendering bug fixes
|
|
177
|
-
* Navigation correctness
|
|
178
|
-
* Documentation clarity
|
|
179
|
-
* Stability over novelty
|
|
211
|
+
If you need:
|
|
180
212
|
|
|
181
|
-
|
|
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
|
-
##
|
|
219
|
+
## Testing philosophy
|
|
186
220
|
|
|
187
|
-
|
|
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
|
-
|
|
192
|
-
mount: "#app",
|
|
193
|
-
deck
|
|
194
|
-
});
|
|
223
|
+
Tests use a **minimal, known-valid deck** to verify:
|
|
195
224
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
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
|
|
236
|
+
* Slides are documents
|
|
206
237
|
* Index is more fundamental than time
|
|
207
|
-
* Rendering should
|
|
208
|
-
*
|
|
209
|
-
*
|
|
238
|
+
* Rendering should be deterministic
|
|
239
|
+
* State belongs to the caller
|
|
240
|
+
* Small libraries stay correct longer
|
|
210
241
|
|
|
211
|
-
> **
|
|
212
|
-
>
|
|
242
|
+
> **Render by index.
|
|
243
|
+
> Everything else is interpretation.**
|
|
213
244
|
|
|
214
245
|
---
|
|
215
246
|
|
|
216
|
-
##
|
|
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
|