taleem-slides 0.4.0 β†’ 0.5.0

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,7 +1,8 @@
1
1
 
2
+
2
3
  # πŸ“¦ taleem-slides
3
4
 
4
- ## ⚠️ Warning : Work in Progress β€” expect breaking changes
5
+ ## ⚠️ Warning: Work in Progress β€” expect breaking changes
5
6
 
6
7
  > **Pure slide template library for Taleem decks**
7
8
 
@@ -21,11 +22,13 @@ It does **not** manage time, indexes, playback, or decks.
21
22
  πŸ‘‰ **Official live display & reference implementation**
22
23
  **[https://bilza2023.github.io/taleem/](https://bilza2023.github.io/taleem/)**
23
24
 
24
- This is **not a mock demo**.This link is the **active display center** where:
25
+ This is **not a mock demo**.
26
+ This link is the **active display center** where:
27
+
28
+ * slide templates are rendered in real browsers
29
+ * visual behavior is validated
30
+ * browser / player integration is tested
25
31
 
26
- - slide templates are rendered in real browsers
27
- - visual behavior is validated
28
- - browser/player integration is tested
29
32
  ---
30
33
 
31
34
  ## ✨ Taleem.help Philosophy
@@ -38,7 +41,7 @@ The goal of the `taleem-*` libraries is simple:
38
41
  > Enable educators to create **JSON-based presentations**
39
42
  > and display them online using **free, open tools**.
40
43
 
41
- Key ideas:
44
+ ### Key ideas
42
45
 
43
46
  * Slides already encode *layout + structure*
44
47
  * Users provide **content only**
@@ -239,9 +242,122 @@ Both projects:
239
242
 
240
243
  ---
241
244
 
242
- If you want, next logical steps are:
245
+ ## πŸ”³ Deck Background Support (NEW)
246
+
247
+ `taleem-slides` also defines **how deck backgrounds are resolved**, while remaining fully **DOM-agnostic**.
248
+
249
+ A deck background is **optional** and applies to the **entire deck**, not individual slides.
250
+
251
+ ---
252
+
253
+ ### Background responsibility split
254
+
255
+ #### taleem-slides
256
+
257
+ * decides **what background should be used**
258
+ * exposes a **pure resolver function**
259
+ * returns **plain background data**
260
+
261
+ #### player / browser
262
+
263
+ * renders the background into the DOM
264
+ * applies styles and layout
265
+ * handles mounting and lifecycle
266
+
267
+ This keeps slide rendering **pure and portable**.
268
+
269
+ ---
270
+
271
+ ## 🎨 Background Resolution API
272
+
273
+ `taleem-slides` exports a small helper:
274
+
275
+ ```js
276
+ import { resolveBackground } from "taleem-slides";
277
+ ```
278
+
279
+ ### Purpose
280
+
281
+ `resolveBackground` answers one question only:
282
+
283
+ > **β€œWhat background should be used for this deck?”**
284
+
285
+ It does **not**:
286
+
287
+ * touch the DOM
288
+ * inject styles
289
+ * manage themes
290
+ * animate or time anything
291
+
292
+ ---
293
+
294
+ ### Input (conceptual)
295
+
296
+ ```ts
297
+ {
298
+ deckBackground?: {
299
+ backgroundColor?: string
300
+ backgroundImage?: string
301
+ backgroundImageOpacity?: number
302
+ },
303
+ themeSurfaceColor?: string
304
+ }
305
+ ```
306
+
307
+ ---
308
+
309
+ ### Output
310
+
311
+ ```ts
312
+ {
313
+ backgroundColor?: string
314
+ backgroundImage?: string
315
+ backgroundImageOpacity?: number
316
+ }
317
+ ```
318
+
319
+ ---
320
+
321
+ ### Resolution rules (locked)
322
+
323
+ * If the deck defines a background β†’ **use it**
324
+ * Otherwise β†’ **fall back to the theme’s surface color**
325
+
326
+ These rules are **format-level guarantees**, not rendering behavior.
327
+
328
+ ---
329
+
330
+ ## 🧠 Mental Model (Updated)
243
331
 
244
- * rewrite one slide as the **canonical reference**
245
- * or update taleem-browser to consume the new API cleanly
332
+ ```
333
+ deck JSON + render state + theme surface
334
+ ↓
335
+ taleem-slides
336
+ ↓
337
+ HTML + resolved background data
338
+ ↓
339
+ player / browser
340
+ ↓
341
+ DOM
342
+ ```
343
+
344
+ `taleem-slides` decides **what exists**.
345
+ The player / browser decides **how it appears**.
346
+
347
+ ---
348
+
349
+ ## πŸ”’ Design Principle (Extended)
350
+
351
+ > **taleem-slides renders HTML and resolves deck-level intent.
352
+ > It never touches the DOM and never manages playback.**
353
+
354
+ ---
355
+
356
+ ## βœ… What this achieves
246
357
 
247
- This README now correctly **anchors the entire ecosystem**.
358
+ * background rules are centralized
359
+ * players remain simple
360
+ * browsers stay dumb
361
+ * future renderers (CLI, SSR, export) stay possible
362
+
363
+ ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taleem-slides",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "description": "Convert json taleem schema into html for slides",
6
6
 
package/src/index.js CHANGED
@@ -2,3 +2,4 @@
2
2
 
3
3
  export { SlideTemplates } from "./SlideTemplates.js";
4
4
  export { getSlideTemplate } from "./getSlideTemplate.js";
5
+ export { resolveBackground } from "./resolveBackground.js";
@@ -0,0 +1,10 @@
1
+ export function resolveBackground({ deckBackground, theme }) {
2
+ if (deckBackground) return deckBackground;
3
+
4
+ return {
5
+ backgroundColor: theme.surfaceColor,
6
+ backgroundImage: null,
7
+ backgroundImageOpacity: 1
8
+ };
9
+ }
10
+