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 +160 -126
- package/dist/taleem-browser.esm.js +260 -315
- package/dist/taleem-browser.umd.js +260 -315
- package/package.json +9 -6
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
|
-
|
|
2
|
+
# taleem-browser
|
|
12
3
|
|
|
13
|
-
|
|
4
|
+
**taleem-browser** is a small, reliable JavaScript library for displaying
|
|
5
|
+
**JSON-based Taleem slide decks** in the browser.
|
|
14
6
|
|
|
15
|
-
|
|
7
|
+
It is intentionally simple.
|
|
16
8
|
|
|
17
|
-
|
|
9
|
+
> **Given a valid deck and an index, it renders that slide into the DOM.**
|
|
18
10
|
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
No timing.
|
|
12
|
+
No autoplay.
|
|
13
|
+
No hidden state.
|
|
21
14
|
|
|
22
15
|
---
|
|
23
16
|
|
|
24
|
-
##
|
|
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
|
-
|
|
27
|
+
`taleem-browser` deliberately avoids this.
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
It treats a slide deck as a **document**, not a video.
|
|
29
30
|
|
|
30
|
-
This makes
|
|
31
|
+
This makes it:
|
|
31
32
|
- predictable
|
|
32
33
|
- easy to debug
|
|
33
|
-
-
|
|
34
|
-
-
|
|
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
|
-
|
|
37
|
-
|
|
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
|
|
54
|
+
## What it does
|
|
43
55
|
|
|
44
56
|
`taleem-browser`:
|
|
45
57
|
|
|
46
58
|
- Accepts a **deck JSON object**
|
|
47
|
-
-
|
|
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
|
-
browser.next()
|
|
57
|
-
browser.prev()
|
|
58
|
-
browser.goTo(index)
|
|
68
|
+
---
|
|
59
69
|
|
|
60
|
-
|
|
61
|
-
browser.getTotal()
|
|
70
|
+
## Installation
|
|
62
71
|
|
|
63
|
-
|
|
64
|
-
browser
|
|
72
|
+
```bash
|
|
73
|
+
npm install taleem-browser
|
|
65
74
|
````
|
|
66
75
|
|
|
67
|
-
That’s the entire contract.
|
|
68
|
-
|
|
69
76
|
---
|
|
70
77
|
|
|
71
|
-
##
|
|
72
|
-
|
|
73
|
-
This is not an omission — it is a design choice.
|
|
78
|
+
## Basic usage
|
|
74
79
|
|
|
75
|
-
|
|
80
|
+
```js
|
|
81
|
+
import { createTaleemBrowser } from "taleem-browser";
|
|
82
|
+
import deck from "./deck.json";
|
|
76
83
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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
|
-
|
|
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
|
-
##
|
|
95
|
+
## Public API
|
|
91
96
|
|
|
92
|
-
`
|
|
97
|
+
### `createTaleemBrowser(options)`
|
|
93
98
|
|
|
94
|
-
|
|
99
|
+
Creates a browser instance.
|
|
95
100
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
101
|
+
```ts
|
|
102
|
+
createTaleemBrowser({
|
|
103
|
+
mount: HTMLElement | string,
|
|
104
|
+
deck: TaleemDeck
|
|
105
|
+
})
|
|
106
|
+
```
|
|
100
107
|
|
|
101
|
-
|
|
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
|
-
`
|
|
110
|
+
* `mount`
|
|
111
|
+
A DOM element or a CSS selector where slides will be rendered.
|
|
108
112
|
|
|
109
|
-
|
|
110
|
-
|
|
113
|
+
* `deck`
|
|
114
|
+
A **valid Taleem deck JSON object**.
|
|
111
115
|
|
|
112
116
|
---
|
|
113
117
|
|
|
114
|
-
|
|
118
|
+
### `browser.render(index)`
|
|
119
|
+
|
|
120
|
+
Renders the slide at the given index.
|
|
121
|
+
|
|
122
|
+
```js
|
|
123
|
+
browser.render(3);
|
|
124
|
+
```
|
|
115
125
|
|
|
116
|
-
|
|
126
|
+
* Index is zero-based
|
|
127
|
+
* Out-of-range indexes are ignored
|
|
128
|
+
* Rendering always replaces previous slide content
|
|
129
|
+
|
|
130
|
+
---
|
|
117
131
|
|
|
118
|
-
|
|
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
|
-
|
|
134
|
+
Returns the total number of slides in the deck.
|
|
122
135
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
* JSON structure
|
|
136
|
+
```js
|
|
137
|
+
const total = browser.getTotal();
|
|
138
|
+
```
|
|
127
139
|
|
|
128
140
|
---
|
|
129
141
|
|
|
130
|
-
##
|
|
142
|
+
## DOM contract
|
|
131
143
|
|
|
132
|
-
|
|
144
|
+
`taleem-browser` injects the following structure into the mount element:
|
|
133
145
|
|
|
134
|
-
|
|
146
|
+
```html
|
|
147
|
+
<div class="taleem-browser-bg"></div>
|
|
148
|
+
<div class="taleem-browser-slide"></div>
|
|
149
|
+
```
|
|
135
150
|
|
|
136
|
-
|
|
151
|
+
### Meaning
|
|
137
152
|
|
|
138
|
-
*
|
|
139
|
-
|
|
153
|
+
* `.taleem-browser-bg`
|
|
154
|
+
Deck-level background layer
|
|
140
155
|
|
|
141
|
-
*
|
|
142
|
-
|
|
156
|
+
* `.taleem-browser-slide`
|
|
157
|
+
Container for the rendered slide HTML
|
|
143
158
|
|
|
144
|
-
|
|
159
|
+
These class names are **public and stable** and may be styled by consumers.
|
|
145
160
|
|
|
146
161
|
---
|
|
147
162
|
|
|
148
|
-
##
|
|
163
|
+
## Styling
|
|
149
164
|
|
|
150
|
-
|
|
165
|
+
`taleem-browser` does **not** generate slide styles.
|
|
151
166
|
|
|
152
|
-
|
|
167
|
+
Slide HTML and CSS are defined by **taleem-slides** and/or the consuming application.
|
|
153
168
|
|
|
154
|
-
|
|
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
|
-
|
|
171
|
+
* deterministic output
|
|
172
|
+
* inspectable markup
|
|
173
|
+
* no runtime styling surprises
|
|
162
174
|
|
|
163
|
-
|
|
164
|
-
* CSS and rendering bug fixes
|
|
165
|
-
* Navigation correctness
|
|
166
|
-
* Documentation clarity
|
|
167
|
-
* Stability over novelty
|
|
175
|
+
---
|
|
168
176
|
|
|
169
|
-
|
|
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
|
-
##
|
|
195
|
+
## Relationship to other Taleem libraries
|
|
174
196
|
|
|
175
|
-
|
|
176
|
-
import { createTaleemBrowser } from "taleem-browser";
|
|
177
|
-
import deck from "./deck.json";
|
|
197
|
+
`taleem-browser` is part of a layered ecosystem.
|
|
178
198
|
|
|
179
|
-
|
|
180
|
-
mount: "#app",
|
|
181
|
-
deck
|
|
182
|
-
});
|
|
199
|
+
### taleem-core
|
|
183
200
|
|
|
184
|
-
|
|
185
|
-
browser.prev();
|
|
186
|
-
browser.goTo(3);
|
|
187
|
-
```
|
|
201
|
+
Defines deck schemas and validation rules.
|
|
188
202
|
|
|
189
|
-
|
|
203
|
+
### taleem-slides
|
|
190
204
|
|
|
191
|
-
|
|
205
|
+
Converts slide JSON into HTML templates.
|
|
206
|
+
Used internally by `taleem-browser`.
|
|
192
207
|
|
|
193
|
-
|
|
194
|
-
|
|
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
|
-
|
|
200
|
-
|
|
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
|
-
|
|
219
|
+
## Testing philosophy
|
|
220
|
+
|
|
221
|
+
`taleem-browser` tests **do not validate decks or slides**.
|
|
205
222
|
|
|
206
|
-
|
|
223
|
+
Tests use a **minimal, known-valid deck** to verify:
|
|
207
224
|
|
|
208
|
-
|
|
225
|
+
* DOM injection
|
|
226
|
+
* template resolution
|
|
227
|
+
* deterministic rendering
|
|
228
|
+
* index-based behavior
|
|
209
229
|
|
|
210
|
-
|
|
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
|
+
|