taleem-engine 1.0.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/package.json +51 -0
- package/readme.md +472 -0
- package/src/compiler/TaleemCompiler.js +122 -0
- package/src/compiler/animation-primtives/eqHighlightOne.js +41 -0
- package/src/compiler/animation-primtives/progressiveReveal.js +14 -0
- package/src/compiler/animation-primtives/runPrimitive.js +71 -0
- package/src/compiler/animation-primtives/showAllHighlightOne.js +34 -0
- package/src/compiler/animation-primtives/showOneAtATime.js +24 -0
- package/src/compiler/templates/compileBarChart.js +91 -0
- package/src/compiler/templates/compileBulletList.js +37 -0
- package/src/compiler/templates/compileEq.js +135 -0
- package/src/compiler/templates/compileFillImage.js +50 -0
- package/src/compiler/templates/compileFocusList.js +75 -0
- package/src/compiler/templates/compileImageGrid.js +60 -0
- package/src/compiler/templates/compileImageLeftBulletsRight.js +78 -0
- package/src/compiler/templates/compileImageRightBulletsLeft.js +79 -0
- package/src/compiler/templates/compileImageSlide.js +52 -0
- package/src/compiler/templates/compileImageStrip.js +60 -0
- package/src/compiler/templates/compileImageWithCaption.js +75 -0
- package/src/compiler/templates/compileImageWithTitle.js +75 -0
- package/src/compiler/templates/compileKeyIdeasSlide.js +62 -0
- package/src/compiler/templates/compileProgressbar.js +74 -0
- package/src/compiler/templates/compileQuoteSlide.js +72 -0
- package/src/compiler/templates/compileSkeletonSlide.js +80 -0
- package/src/compiler/templates/compileTable.js +70 -0
- package/src/compiler/templates/compileTextGrid.js +57 -0
- package/src/compiler/templates/compileTitleAndPara.js +79 -0
- package/src/compiler/templates/compileTitleAndSubtitle.js +84 -0
- package/src/compiler/templates/compileTwoColumnText.js +116 -0
- package/src/compiler/templates/helpers/addIdToItems.js +17 -0
- package/src/compiler/templates/helpers/buildSequentialStates.js +24 -0
- package/src/compiler/templates/index.js +108 -0
- package/src/compiler/utils/applyBackground.js +9 -0
- package/src/compiler/utils/assignMockTimings.js +47 -0
- package/src/compiler/utils/compileTimings.js +16 -0
- package/src/compiler/utils/getDeckImages.js +40 -0
- package/src/compiler/utils/resolveAssetPaths.js +42 -0
- package/src/compiler/utils/resolveBackground.js +29 -0
- package/src/dsl/Taleem.js +400 -0
- package/src/dsl/TimelineContext.js +256 -0
- package/src/dsl/slides/BarChart.js +31 -0
- package/src/dsl/slides/BulletListBuilder.js +23 -0
- package/src/dsl/slides/Eq.js +65 -0
- package/src/dsl/slides/FillImage.js +25 -0
- package/src/dsl/slides/FocusListBuilder.js +37 -0
- package/src/dsl/slides/ImageGrid.js +25 -0
- package/src/dsl/slides/ImageLeftBulletsRight.js +37 -0
- package/src/dsl/slides/ImageRightBulletsLeft.js +37 -0
- package/src/dsl/slides/ImageSlide.js +25 -0
- package/src/dsl/slides/ImageStrip.js +25 -0
- package/src/dsl/slides/ImageWithCaption.js +37 -0
- package/src/dsl/slides/ImageWithTitle.js +37 -0
- package/src/dsl/slides/KeyIdeasSlide.js +31 -0
- package/src/dsl/slides/Progressbar.js +31 -0
- package/src/dsl/slides/QuoteSlide.js +37 -0
- package/src/dsl/slides/SkeletonSlideBuilder.js +43 -0
- package/src/dsl/slides/Table.js +25 -0
- package/src/dsl/slides/TextGrid.js +25 -0
- package/src/dsl/slides/TitleAndPara.js +37 -0
- package/src/dsl/slides/TitleAndSubtitle.js +37 -0
- package/src/dsl/slides/TwoColumnText.js +61 -0
- package/src/index.js +4 -0
- package/src/primitives/index.js +0 -0
- package/src/types/index.js +0 -0
- package/src/utils/index.js +0 -0
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "taleem-engine",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Deterministic educational presentation engine",
|
|
5
|
+
"type": "module",
|
|
6
|
+
|
|
7
|
+
"main": "./src/index.js",
|
|
8
|
+
|
|
9
|
+
"exports": {
|
|
10
|
+
".": "./src/index.js"
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
"files": [
|
|
14
|
+
"src",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
|
|
18
|
+
"scripts": {
|
|
19
|
+
"test": "vitest",
|
|
20
|
+
"example": "node examples/golden-dsl.js"
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
"keywords": [
|
|
24
|
+
"presentation",
|
|
25
|
+
"slides",
|
|
26
|
+
"education",
|
|
27
|
+
"compiler",
|
|
28
|
+
"animation",
|
|
29
|
+
"learning",
|
|
30
|
+
"taleem"
|
|
31
|
+
],
|
|
32
|
+
|
|
33
|
+
"author": "Bilal Tariq",
|
|
34
|
+
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/bilza2023/taleem-engine.git"
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://github.com/bilza2023/taleem-engine/issues"
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
"homepage": "https://github.com/bilza2023/taleem-engine#readme",
|
|
47
|
+
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"vitest": "^4.1.5"
|
|
50
|
+
}
|
|
51
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
|
|
2
|
+
# Taleem Engine
|
|
3
|
+
|
|
4
|
+
`taleem-engine` is a deterministic educational presentation engine.
|
|
5
|
+
|
|
6
|
+
API documentation:
|
|
7
|
+
https://bilza2023.github.io/taleem-engine/
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
# Documentation
|
|
11
|
+
It provides a complete authoring pipeline:
|
|
12
|
+
|
|
13
|
+
```txt
|
|
14
|
+
DSL
|
|
15
|
+
→ Compiler
|
|
16
|
+
→ HTML
|
|
17
|
+
→ Actions
|
|
18
|
+
→ Groups
|
|
19
|
+
→ Player
|
|
20
|
+
````
|
|
21
|
+
|
|
22
|
+
The engine transforms structured slide definitions into deterministic presentation JSON that can be rendered by any compatible player.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
# Philosophy
|
|
27
|
+
|
|
28
|
+
Taleem is built around one core principle:
|
|
29
|
+
|
|
30
|
+
```txt
|
|
31
|
+
Author once.
|
|
32
|
+
Render anywhere.
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The engine itself:
|
|
36
|
+
|
|
37
|
+
* does NOT manipulate DOM
|
|
38
|
+
* does NOT run animations
|
|
39
|
+
* does NOT manage playback
|
|
40
|
+
* does NOT contain UI logic
|
|
41
|
+
|
|
42
|
+
Instead:
|
|
43
|
+
|
|
44
|
+
```txt
|
|
45
|
+
taleem-engine
|
|
46
|
+
=
|
|
47
|
+
pure compilation system
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The engine compiles declarative educational content into:
|
|
51
|
+
|
|
52
|
+
* HTML
|
|
53
|
+
* animation groups
|
|
54
|
+
* deterministic action timelines
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
# Installation
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npm install taleem-engine
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
# Quick Example
|
|
67
|
+
|
|
68
|
+
```js
|
|
69
|
+
import { Taleem }
|
|
70
|
+
from "taleem-engine";
|
|
71
|
+
|
|
72
|
+
const taleem =
|
|
73
|
+
new Taleem();
|
|
74
|
+
|
|
75
|
+
taleem
|
|
76
|
+
.at(0)
|
|
77
|
+
|
|
78
|
+
.titleAndSubtitle()
|
|
79
|
+
|
|
80
|
+
.title(
|
|
81
|
+
"Introduction",
|
|
82
|
+
0
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
.subtitle(
|
|
86
|
+
"Learning Taleem Engine",
|
|
87
|
+
3
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
taleem.end(10);
|
|
91
|
+
|
|
92
|
+
const presentation =
|
|
93
|
+
taleem.compile();
|
|
94
|
+
|
|
95
|
+
console.log(presentation);
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
# Core Architecture
|
|
101
|
+
|
|
102
|
+
```txt
|
|
103
|
+
Authoring DSL
|
|
104
|
+
↓
|
|
105
|
+
Slide Templates
|
|
106
|
+
↓
|
|
107
|
+
Animation Primitives
|
|
108
|
+
↓
|
|
109
|
+
Compiled Presentation JSON
|
|
110
|
+
↓
|
|
111
|
+
Player
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
# System Layers
|
|
117
|
+
|
|
118
|
+
# 1. DSL Layer
|
|
119
|
+
|
|
120
|
+
The DSL is the authoring API.
|
|
121
|
+
|
|
122
|
+
Example:
|
|
123
|
+
|
|
124
|
+
```js
|
|
125
|
+
taleem
|
|
126
|
+
.at(0)
|
|
127
|
+
|
|
128
|
+
.bulletList()
|
|
129
|
+
|
|
130
|
+
.bullet(
|
|
131
|
+
"Point one",
|
|
132
|
+
0
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
.bullet(
|
|
136
|
+
"Point two",
|
|
137
|
+
2
|
|
138
|
+
);
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
The DSL creates:
|
|
142
|
+
|
|
143
|
+
* structured slide definitions
|
|
144
|
+
* normalized timing intent
|
|
145
|
+
* canonical educational data
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
# 2. Templates
|
|
150
|
+
|
|
151
|
+
Templates compile slides into HTML.
|
|
152
|
+
|
|
153
|
+
Example:
|
|
154
|
+
|
|
155
|
+
```txt
|
|
156
|
+
bulletList
|
|
157
|
+
→ compileBulletList()
|
|
158
|
+
|
|
159
|
+
eq
|
|
160
|
+
→ compileEq()
|
|
161
|
+
|
|
162
|
+
imageGrid
|
|
163
|
+
→ compileImageGrid()
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Templates:
|
|
167
|
+
|
|
168
|
+
* generate HTML
|
|
169
|
+
* assign ids
|
|
170
|
+
* define primitive behavior
|
|
171
|
+
|
|
172
|
+
Templates do NOT:
|
|
173
|
+
|
|
174
|
+
* run animations
|
|
175
|
+
* manage playback
|
|
176
|
+
* manipulate DOM
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
# 3. Animation Primitives
|
|
181
|
+
|
|
182
|
+
Animation primitives generate deterministic state transitions.
|
|
183
|
+
|
|
184
|
+
Current primitives:
|
|
185
|
+
|
|
186
|
+
```txt
|
|
187
|
+
progressiveReveal
|
|
188
|
+
focusOne
|
|
189
|
+
eqHighlightOne
|
|
190
|
+
showOneAtATime
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Primitives generate:
|
|
194
|
+
|
|
195
|
+
```js
|
|
196
|
+
{
|
|
197
|
+
groups,
|
|
198
|
+
actions
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Example action:
|
|
203
|
+
|
|
204
|
+
```js
|
|
205
|
+
{
|
|
206
|
+
time: 10,
|
|
207
|
+
|
|
208
|
+
state: {
|
|
209
|
+
hidden: [],
|
|
210
|
+
focus: ["item-2"],
|
|
211
|
+
dim: ["item-1"]
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
# 4. Compiler
|
|
219
|
+
|
|
220
|
+
The compiler orchestrates the full pipeline.
|
|
221
|
+
|
|
222
|
+
Responsibilities:
|
|
223
|
+
|
|
224
|
+
* compile timings
|
|
225
|
+
* resolve asset paths
|
|
226
|
+
* compile templates
|
|
227
|
+
* run primitives
|
|
228
|
+
* generate final presentation JSON
|
|
229
|
+
|
|
230
|
+
Output:
|
|
231
|
+
|
|
232
|
+
```js
|
|
233
|
+
{
|
|
234
|
+
name,
|
|
235
|
+
background,
|
|
236
|
+
deck
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
# 5. Player
|
|
243
|
+
|
|
244
|
+
The player is intentionally dumb.
|
|
245
|
+
|
|
246
|
+
The player only:
|
|
247
|
+
|
|
248
|
+
* renders HTML
|
|
249
|
+
* applies classes
|
|
250
|
+
* executes actions
|
|
251
|
+
|
|
252
|
+
The player does NOT understand:
|
|
253
|
+
|
|
254
|
+
* educational semantics
|
|
255
|
+
* slide meaning
|
|
256
|
+
* authoring logic
|
|
257
|
+
* timing reasoning
|
|
258
|
+
|
|
259
|
+
All intelligence lives inside the engine.
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
# Supported Slides
|
|
264
|
+
|
|
265
|
+
```txt
|
|
266
|
+
titleAndSubtitle
|
|
267
|
+
titleAndPara
|
|
268
|
+
bulletList
|
|
269
|
+
twoColumnText
|
|
270
|
+
imageSlide
|
|
271
|
+
imageWithTitle
|
|
272
|
+
imageWithCaption
|
|
273
|
+
imageLeftBulletsRight
|
|
274
|
+
imageRightBulletsLeft
|
|
275
|
+
table
|
|
276
|
+
barChart
|
|
277
|
+
progressbar
|
|
278
|
+
quoteSlide
|
|
279
|
+
keyIdeasSlide
|
|
280
|
+
focusList
|
|
281
|
+
eq
|
|
282
|
+
fillImage
|
|
283
|
+
imageStrip
|
|
284
|
+
imageGrid
|
|
285
|
+
textGrid
|
|
286
|
+
skeleton
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
# Animation Model
|
|
292
|
+
|
|
293
|
+
Most slides use:
|
|
294
|
+
|
|
295
|
+
```txt
|
|
296
|
+
progressiveReveal
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
Specialized slides use:
|
|
300
|
+
|
|
301
|
+
```txt
|
|
302
|
+
focusOne
|
|
303
|
+
eqHighlightOne
|
|
304
|
+
showOneAtATime
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
This keeps the system:
|
|
308
|
+
|
|
309
|
+
* deterministic
|
|
310
|
+
* composable
|
|
311
|
+
* scalable
|
|
312
|
+
* minimal
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
# Asset Resolution
|
|
317
|
+
|
|
318
|
+
Images are intentionally authored simply:
|
|
319
|
+
|
|
320
|
+
```js
|
|
321
|
+
.image("image.png", 10)
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
During compilation:
|
|
325
|
+
|
|
326
|
+
```txt
|
|
327
|
+
resolveAssetPaths()
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
patches paths using:
|
|
331
|
+
|
|
332
|
+
```js
|
|
333
|
+
taleem.metaData.base =
|
|
334
|
+
"/content/images/";
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
Result:
|
|
338
|
+
|
|
339
|
+
```txt
|
|
340
|
+
/content/images/image.png
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
This keeps authoring clean while preserving deployment flexibility.
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
# Deterministic Output
|
|
348
|
+
|
|
349
|
+
The same input always produces the same output.
|
|
350
|
+
|
|
351
|
+
This allows Taleem presentations to support:
|
|
352
|
+
|
|
353
|
+
* HTML players
|
|
354
|
+
* React renderers
|
|
355
|
+
* Canvas renderers
|
|
356
|
+
* video export
|
|
357
|
+
* PDF export
|
|
358
|
+
* AI generation pipelines
|
|
359
|
+
* offline playback
|
|
360
|
+
* static export systems
|
|
361
|
+
|
|
362
|
+
without changing authoring syntax.
|
|
363
|
+
|
|
364
|
+
---
|
|
365
|
+
|
|
366
|
+
# Design Principles
|
|
367
|
+
|
|
368
|
+
## Deterministic
|
|
369
|
+
|
|
370
|
+
Same input → same output.
|
|
371
|
+
|
|
372
|
+
---
|
|
373
|
+
|
|
374
|
+
## Dumb Player
|
|
375
|
+
|
|
376
|
+
All intelligence lives in the compiler.
|
|
377
|
+
|
|
378
|
+
---
|
|
379
|
+
|
|
380
|
+
## Declarative Authoring
|
|
381
|
+
|
|
382
|
+
Authors describe:
|
|
383
|
+
|
|
384
|
+
* what exists
|
|
385
|
+
* when it appears
|
|
386
|
+
|
|
387
|
+
The engine handles execution.
|
|
388
|
+
|
|
389
|
+
---
|
|
390
|
+
|
|
391
|
+
## Minimal Primitive Set
|
|
392
|
+
|
|
393
|
+
A small primitive system powers the entire engine.
|
|
394
|
+
|
|
395
|
+
---
|
|
396
|
+
|
|
397
|
+
# Testing
|
|
398
|
+
|
|
399
|
+
The engine includes deterministic compiler tests powered by Vitest.
|
|
400
|
+
|
|
401
|
+
Run tests:
|
|
402
|
+
|
|
403
|
+
```bash
|
|
404
|
+
npm test
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
Current test coverage includes:
|
|
408
|
+
|
|
409
|
+
* golden deck compilation
|
|
410
|
+
* eq slide compilation
|
|
411
|
+
* timing resolution
|
|
412
|
+
* primitive generation
|
|
413
|
+
* asset resolution
|
|
414
|
+
|
|
415
|
+
---
|
|
416
|
+
|
|
417
|
+
# Current Status
|
|
418
|
+
|
|
419
|
+
`taleem-engine` now supports:
|
|
420
|
+
|
|
421
|
+
* full canonical slide coverage
|
|
422
|
+
* deterministic animation timelines
|
|
423
|
+
* educational focus systems
|
|
424
|
+
* equation walkthroughs
|
|
425
|
+
* progressive reveal systems
|
|
426
|
+
* asset resolution
|
|
427
|
+
* executable presentation JSON
|
|
428
|
+
|
|
429
|
+
The engine is production-ready for:
|
|
430
|
+
|
|
431
|
+
* educational decks
|
|
432
|
+
* AI-generated slides
|
|
433
|
+
* structured lessons
|
|
434
|
+
* Taleem ecosystem tooling
|
|
435
|
+
|
|
436
|
+
---
|
|
437
|
+
|
|
438
|
+
# Future Direction
|
|
439
|
+
|
|
440
|
+
Potential future expansions:
|
|
441
|
+
|
|
442
|
+
* themes
|
|
443
|
+
* narration metadata
|
|
444
|
+
* localization
|
|
445
|
+
* accessibility layers
|
|
446
|
+
* video export
|
|
447
|
+
* collaborative authoring
|
|
448
|
+
* interactive overlays
|
|
449
|
+
* AI-assisted lesson generation
|
|
450
|
+
|
|
451
|
+
The current architecture already supports these directions without major redesign.
|
|
452
|
+
|
|
453
|
+
---
|
|
454
|
+
|
|
455
|
+
# Final Summary
|
|
456
|
+
|
|
457
|
+
`taleem-engine` is not a slide renderer.
|
|
458
|
+
|
|
459
|
+
It is a:
|
|
460
|
+
|
|
461
|
+
```txt
|
|
462
|
+
deterministic educational presentation compiler
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
built around:
|
|
466
|
+
|
|
467
|
+
* declarative authoring
|
|
468
|
+
* deterministic state
|
|
469
|
+
* composable primitives
|
|
470
|
+
* player simplicity
|
|
471
|
+
* scalable educational storytelling
|
|
472
|
+
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// /src/compiler/index.js
|
|
2
|
+
|
|
3
|
+
import { compileTimings } from "./utils/compileTimings.js";
|
|
4
|
+
|
|
5
|
+
import { resolveAssetPaths } from "./utils/resolveAssetPaths.js";
|
|
6
|
+
|
|
7
|
+
import { templates } from "./templates/index.js";
|
|
8
|
+
|
|
9
|
+
import { runPrimitive } from "./animation-primtives/runPrimitive.js";
|
|
10
|
+
|
|
11
|
+
export function TaleemCompiler(
|
|
12
|
+
builder,
|
|
13
|
+
options = {}
|
|
14
|
+
) {
|
|
15
|
+
const {
|
|
16
|
+
assetBase =
|
|
17
|
+
builder.metaData.base || ""
|
|
18
|
+
} = options;
|
|
19
|
+
|
|
20
|
+
// --------------------------------------------------
|
|
21
|
+
// timings
|
|
22
|
+
// --------------------------------------------------
|
|
23
|
+
|
|
24
|
+
compileTimings(
|
|
25
|
+
builder.deck,
|
|
26
|
+
builder.presentationEnd
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
// --------------------------------------------------
|
|
30
|
+
// preprocess DSL slides
|
|
31
|
+
// IMPORTANT:
|
|
32
|
+
// resolve BEFORE html compilation
|
|
33
|
+
// --------------------------------------------------
|
|
34
|
+
|
|
35
|
+
if (assetBase) {
|
|
36
|
+
resolveAssetPaths(
|
|
37
|
+
{
|
|
38
|
+
background:
|
|
39
|
+
builder.backgroundData,
|
|
40
|
+
|
|
41
|
+
deck: builder.deck
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
assetBase
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// --------------------------------------------------
|
|
49
|
+
// compile slides
|
|
50
|
+
// --------------------------------------------------
|
|
51
|
+
const compiledDeck =
|
|
52
|
+
builder.deck.map(slide => {
|
|
53
|
+
const template =
|
|
54
|
+
templates[slide.type];
|
|
55
|
+
|
|
56
|
+
const compiled =
|
|
57
|
+
template(slide);
|
|
58
|
+
|
|
59
|
+
// --------------------------------------------------
|
|
60
|
+
// safe html cleanup
|
|
61
|
+
// preserves structural spacing
|
|
62
|
+
// --------------------------------------------------
|
|
63
|
+
|
|
64
|
+
compiled.html =
|
|
65
|
+
compiled.html
|
|
66
|
+
.replace(/\n+/g, " ")
|
|
67
|
+
.replace(/\t+/g, " ")
|
|
68
|
+
.replace(/>\s+</g, "><")
|
|
69
|
+
.replace(/\s{2,}/g, " ")
|
|
70
|
+
.trim();
|
|
71
|
+
|
|
72
|
+
const primitive =
|
|
73
|
+
runPrimitive({
|
|
74
|
+
type:
|
|
75
|
+
compiled.animation,
|
|
76
|
+
|
|
77
|
+
items:
|
|
78
|
+
compiled.primitiveItems
|
|
79
|
+
|
|
80
|
+
??
|
|
81
|
+
|
|
82
|
+
compiled.ids.map(
|
|
83
|
+
(id, index) => ({
|
|
84
|
+
id,
|
|
85
|
+
|
|
86
|
+
showAt:
|
|
87
|
+
slide.data[index]
|
|
88
|
+
.showAt
|
|
89
|
+
})
|
|
90
|
+
)
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
type: slide.type,
|
|
95
|
+
|
|
96
|
+
start: slide.start,
|
|
97
|
+
|
|
98
|
+
end: slide.end,
|
|
99
|
+
|
|
100
|
+
html: compiled.html,
|
|
101
|
+
|
|
102
|
+
groups:
|
|
103
|
+
primitive.groups,
|
|
104
|
+
|
|
105
|
+
actions:
|
|
106
|
+
primitive.actions
|
|
107
|
+
};
|
|
108
|
+
});
|
|
109
|
+
// --------------------------------------------------
|
|
110
|
+
// final presentation
|
|
111
|
+
// --------------------------------------------------
|
|
112
|
+
|
|
113
|
+
return {
|
|
114
|
+
name:
|
|
115
|
+
builder.metaData.name,
|
|
116
|
+
|
|
117
|
+
background:
|
|
118
|
+
builder.backgroundData,
|
|
119
|
+
|
|
120
|
+
deck: compiledDeck
|
|
121
|
+
};
|
|
122
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// /src/compiler/animation-primtives/eqHighlightOne.js
|
|
2
|
+
|
|
3
|
+
export function eqHighlightOne(
|
|
4
|
+
items
|
|
5
|
+
) {
|
|
6
|
+
return items.map(item => {
|
|
7
|
+
const otherLines =
|
|
8
|
+
items
|
|
9
|
+
.filter(
|
|
10
|
+
d => d.id !== item.id
|
|
11
|
+
)
|
|
12
|
+
.map(d => d.id);
|
|
13
|
+
|
|
14
|
+
const visibleSp =
|
|
15
|
+
item.spIds || [];
|
|
16
|
+
|
|
17
|
+
const hiddenSp =
|
|
18
|
+
items
|
|
19
|
+
.flatMap(
|
|
20
|
+
d => d.spIds || []
|
|
21
|
+
)
|
|
22
|
+
.filter(
|
|
23
|
+
id =>
|
|
24
|
+
!visibleSp.includes(id)
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
time: item.showAt,
|
|
29
|
+
|
|
30
|
+
state: {
|
|
31
|
+
focus: [item.id],
|
|
32
|
+
|
|
33
|
+
dim: otherLines,
|
|
34
|
+
|
|
35
|
+
visible: visibleSp,
|
|
36
|
+
|
|
37
|
+
hidden: hiddenSp
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
// /src/compiler/animation-primitives/progressiveReveal.js
|
|
3
|
+
|
|
4
|
+
export function progressiveReveal(items) {
|
|
5
|
+
const ids = items.map(item => item.id);
|
|
6
|
+
|
|
7
|
+
return items.map((item, index) => ({
|
|
8
|
+
time: item.showAt,
|
|
9
|
+
|
|
10
|
+
state: {
|
|
11
|
+
hidden: ids.slice(index + 1)
|
|
12
|
+
}
|
|
13
|
+
}));
|
|
14
|
+
}
|