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.
Files changed (65) hide show
  1. package/package.json +51 -0
  2. package/readme.md +472 -0
  3. package/src/compiler/TaleemCompiler.js +122 -0
  4. package/src/compiler/animation-primtives/eqHighlightOne.js +41 -0
  5. package/src/compiler/animation-primtives/progressiveReveal.js +14 -0
  6. package/src/compiler/animation-primtives/runPrimitive.js +71 -0
  7. package/src/compiler/animation-primtives/showAllHighlightOne.js +34 -0
  8. package/src/compiler/animation-primtives/showOneAtATime.js +24 -0
  9. package/src/compiler/templates/compileBarChart.js +91 -0
  10. package/src/compiler/templates/compileBulletList.js +37 -0
  11. package/src/compiler/templates/compileEq.js +135 -0
  12. package/src/compiler/templates/compileFillImage.js +50 -0
  13. package/src/compiler/templates/compileFocusList.js +75 -0
  14. package/src/compiler/templates/compileImageGrid.js +60 -0
  15. package/src/compiler/templates/compileImageLeftBulletsRight.js +78 -0
  16. package/src/compiler/templates/compileImageRightBulletsLeft.js +79 -0
  17. package/src/compiler/templates/compileImageSlide.js +52 -0
  18. package/src/compiler/templates/compileImageStrip.js +60 -0
  19. package/src/compiler/templates/compileImageWithCaption.js +75 -0
  20. package/src/compiler/templates/compileImageWithTitle.js +75 -0
  21. package/src/compiler/templates/compileKeyIdeasSlide.js +62 -0
  22. package/src/compiler/templates/compileProgressbar.js +74 -0
  23. package/src/compiler/templates/compileQuoteSlide.js +72 -0
  24. package/src/compiler/templates/compileSkeletonSlide.js +80 -0
  25. package/src/compiler/templates/compileTable.js +70 -0
  26. package/src/compiler/templates/compileTextGrid.js +57 -0
  27. package/src/compiler/templates/compileTitleAndPara.js +79 -0
  28. package/src/compiler/templates/compileTitleAndSubtitle.js +84 -0
  29. package/src/compiler/templates/compileTwoColumnText.js +116 -0
  30. package/src/compiler/templates/helpers/addIdToItems.js +17 -0
  31. package/src/compiler/templates/helpers/buildSequentialStates.js +24 -0
  32. package/src/compiler/templates/index.js +108 -0
  33. package/src/compiler/utils/applyBackground.js +9 -0
  34. package/src/compiler/utils/assignMockTimings.js +47 -0
  35. package/src/compiler/utils/compileTimings.js +16 -0
  36. package/src/compiler/utils/getDeckImages.js +40 -0
  37. package/src/compiler/utils/resolveAssetPaths.js +42 -0
  38. package/src/compiler/utils/resolveBackground.js +29 -0
  39. package/src/dsl/Taleem.js +400 -0
  40. package/src/dsl/TimelineContext.js +256 -0
  41. package/src/dsl/slides/BarChart.js +31 -0
  42. package/src/dsl/slides/BulletListBuilder.js +23 -0
  43. package/src/dsl/slides/Eq.js +65 -0
  44. package/src/dsl/slides/FillImage.js +25 -0
  45. package/src/dsl/slides/FocusListBuilder.js +37 -0
  46. package/src/dsl/slides/ImageGrid.js +25 -0
  47. package/src/dsl/slides/ImageLeftBulletsRight.js +37 -0
  48. package/src/dsl/slides/ImageRightBulletsLeft.js +37 -0
  49. package/src/dsl/slides/ImageSlide.js +25 -0
  50. package/src/dsl/slides/ImageStrip.js +25 -0
  51. package/src/dsl/slides/ImageWithCaption.js +37 -0
  52. package/src/dsl/slides/ImageWithTitle.js +37 -0
  53. package/src/dsl/slides/KeyIdeasSlide.js +31 -0
  54. package/src/dsl/slides/Progressbar.js +31 -0
  55. package/src/dsl/slides/QuoteSlide.js +37 -0
  56. package/src/dsl/slides/SkeletonSlideBuilder.js +43 -0
  57. package/src/dsl/slides/Table.js +25 -0
  58. package/src/dsl/slides/TextGrid.js +25 -0
  59. package/src/dsl/slides/TitleAndPara.js +37 -0
  60. package/src/dsl/slides/TitleAndSubtitle.js +37 -0
  61. package/src/dsl/slides/TwoColumnText.js +61 -0
  62. package/src/index.js +4 -0
  63. package/src/primitives/index.js +0 -0
  64. package/src/types/index.js +0 -0
  65. package/src/utils/index.js +0 -0
@@ -0,0 +1,400 @@
1
+ // /src/dsl/index.js
2
+
3
+ import TimelineContext from "./TimelineContext.js";
4
+
5
+ import { TaleemCompiler } from "../compiler/TaleemCompiler.js";
6
+
7
+ import BulletListBuilder from "./slides/BulletListBuilder.js";
8
+
9
+ import SkeletonSlideBuilder from "./slides/SkeletonSlideBuilder.js";
10
+
11
+ import FocusListBuilder from "./slides/FocusListBuilder.js";
12
+
13
+ import Eq from "./slides/Eq.js";
14
+
15
+ import Table from "./slides/Table.js";
16
+
17
+ import BarChart from "./slides/BarChart.js";
18
+
19
+ import Progressbar from "./slides/Progressbar.js";
20
+
21
+ import TitleAndSubtitle from "./slides/TitleAndSubtitle.js";
22
+
23
+ import TitleAndPara from "./slides/TitleAndPara.js";
24
+
25
+ import TwoColumnText from "./slides/TwoColumnText.js";
26
+
27
+ import ImageSlide from "./slides/ImageSlide.js";
28
+
29
+ import ImageWithTitle from "./slides/ImageWithTitle.js";
30
+
31
+ import ImageWithCaption from "./slides/ImageWithCaption.js";
32
+
33
+ import ImageLeftBulletsRight from "./slides/ImageLeftBulletsRight.js";
34
+
35
+ import ImageRightBulletsLeft from "./slides/ImageRightBulletsLeft.js";
36
+
37
+ import QuoteSlide from "./slides/QuoteSlide.js";
38
+
39
+ import KeyIdeasSlide from "./slides/KeyIdeasSlide.js";
40
+
41
+ import FillImage from "./slides/FillImage.js";
42
+
43
+ import ImageStrip from "./slides/ImageStrip.js";
44
+
45
+ import ImageGrid from "./slides/ImageGrid.js";
46
+
47
+ import TextGrid from "./slides/TextGrid.js";
48
+
49
+ /////////////////////////////////////////////////////
50
+
51
+ export default class Taleem {
52
+ constructor() {
53
+ this.metaData = {
54
+ name: "Untitled Deck",
55
+
56
+ base: ""
57
+ };
58
+
59
+ this.backgroundData = {
60
+ backgroundColor: "#111111",
61
+
62
+ backgroundImage: null,
63
+
64
+ backgroundImageOpacity: 0.3
65
+ };
66
+
67
+ this.deck = [];
68
+
69
+ this.presentationEnd = null;
70
+ }
71
+
72
+ at(time) {
73
+ return new TimelineContext(
74
+ this,
75
+ time
76
+ );
77
+ }
78
+
79
+ end(time) {
80
+ this.presentationEnd = time;
81
+
82
+ return this;
83
+ }
84
+
85
+ createSlide(type, start, end) {
86
+ const slide = {
87
+ type,
88
+
89
+ start,
90
+ end,
91
+
92
+ data: []
93
+ };
94
+
95
+ this.deck.push(slide);
96
+
97
+ return slide;
98
+ }
99
+
100
+ titleAndSubtitle(
101
+ start = null,
102
+ end = null
103
+ ) {
104
+ return new TitleAndSubtitle(
105
+ this.createSlide(
106
+ "titleAndSubtitle",
107
+ start,
108
+ end
109
+ ),
110
+ this
111
+ );
112
+ }
113
+
114
+ titleAndPara(
115
+ start = null,
116
+ end = null
117
+ ) {
118
+ return new TitleAndPara(
119
+ this.createSlide(
120
+ "titleAndPara",
121
+ start,
122
+ end
123
+ ),
124
+ this
125
+ );
126
+ }
127
+
128
+ bulletList(
129
+ start = null,
130
+ end = null
131
+ ) {
132
+ return new BulletListBuilder(
133
+ this.createSlide(
134
+ "bulletList",
135
+ start,
136
+ end
137
+ ),
138
+ this
139
+ );
140
+ }
141
+
142
+ twoColumnText(
143
+ start = null,
144
+ end = null
145
+ ) {
146
+ return new TwoColumnText(
147
+ this.createSlide(
148
+ "twoColumnText",
149
+ start,
150
+ end
151
+ ),
152
+ this
153
+ );
154
+ }
155
+
156
+ imageSlide(
157
+ start = null,
158
+ end = null
159
+ ) {
160
+ return new ImageSlide(
161
+ this.createSlide(
162
+ "imageSlide",
163
+ start,
164
+ end
165
+ ),
166
+ this
167
+ );
168
+ }
169
+
170
+ imageWithTitle(
171
+ start = null,
172
+ end = null
173
+ ) {
174
+ return new ImageWithTitle(
175
+ this.createSlide(
176
+ "imageWithTitle",
177
+ start,
178
+ end
179
+ ),
180
+ this
181
+ );
182
+ }
183
+
184
+ imageWithCaption(
185
+ start = null,
186
+ end = null
187
+ ) {
188
+ return new ImageWithCaption(
189
+ this.createSlide(
190
+ "imageWithCaption",
191
+ start,
192
+ end
193
+ ),
194
+ this
195
+ );
196
+ }
197
+
198
+ imageLeftBulletsRight(
199
+ start = null,
200
+ end = null
201
+ ) {
202
+ return new ImageLeftBulletsRight(
203
+ this.createSlide(
204
+ "imageLeftBulletsRight",
205
+ start,
206
+ end
207
+ ),
208
+ this
209
+ );
210
+ }
211
+
212
+ imageRightBulletsLeft(
213
+ start = null,
214
+ end = null
215
+ ) {
216
+ return new ImageRightBulletsLeft(
217
+ this.createSlide(
218
+ "imageRightBulletsLeft",
219
+ start,
220
+ end
221
+ ),
222
+ this
223
+ );
224
+ }
225
+
226
+ table(
227
+ start = null,
228
+ end = null
229
+ ) {
230
+ return new Table(
231
+ this.createSlide(
232
+ "table",
233
+ start,
234
+ end
235
+ ),
236
+ this
237
+ );
238
+ }
239
+
240
+ barChart(
241
+ start = null,
242
+ end = null
243
+ ) {
244
+ return new BarChart(
245
+ this.createSlide(
246
+ "barChart",
247
+ start,
248
+ end
249
+ ),
250
+ this
251
+ );
252
+ }
253
+
254
+ progressbar(
255
+ start = null,
256
+ end = null
257
+ ) {
258
+ return new Progressbar(
259
+ this.createSlide(
260
+ "progressbar",
261
+ start,
262
+ end
263
+ ),
264
+ this
265
+ );
266
+ }
267
+
268
+ quoteSlide(
269
+ start = null,
270
+ end = null
271
+ ) {
272
+ return new QuoteSlide(
273
+ this.createSlide(
274
+ "quoteSlide",
275
+ start,
276
+ end
277
+ ),
278
+ this
279
+ );
280
+ }
281
+
282
+ keyIdeasSlide(
283
+ start = null,
284
+ end = null
285
+ ) {
286
+ return new KeyIdeasSlide(
287
+ this.createSlide(
288
+ "keyIdeasSlide",
289
+ start,
290
+ end
291
+ ),
292
+ this
293
+ );
294
+ }
295
+
296
+ focusList(
297
+ start = null,
298
+ end = null
299
+ ) {
300
+ return new FocusListBuilder(
301
+ this.createSlide(
302
+ "focusList",
303
+ start,
304
+ end
305
+ ),
306
+ this
307
+ );
308
+ }
309
+
310
+ eq(
311
+ start = null,
312
+ end = null
313
+ ) {
314
+ return new Eq(
315
+ this.createSlide(
316
+ "eq",
317
+ start,
318
+ end
319
+ ),
320
+ this
321
+ );
322
+ }
323
+
324
+ fillImage(
325
+ start = null,
326
+ end = null
327
+ ) {
328
+ return new FillImage(
329
+ this.createSlide(
330
+ "fillImage",
331
+ start,
332
+ end
333
+ ),
334
+ this
335
+ );
336
+ }
337
+
338
+ imageStrip(
339
+ start = null,
340
+ end = null
341
+ ) {
342
+ return new ImageStrip(
343
+ this.createSlide(
344
+ "imageStrip",
345
+ start,
346
+ end
347
+ ),
348
+ this
349
+ );
350
+ }
351
+
352
+ imageGrid(
353
+ start = null,
354
+ end = null
355
+ ) {
356
+ return new ImageGrid(
357
+ this.createSlide(
358
+ "imageGrid",
359
+ start,
360
+ end
361
+ ),
362
+ this
363
+ );
364
+ }
365
+
366
+ textGrid(
367
+ start = null,
368
+ end = null
369
+ ) {
370
+ return new TextGrid(
371
+ this.createSlide(
372
+ "textGrid",
373
+ start,
374
+ end
375
+ ),
376
+ this
377
+ );
378
+ }
379
+
380
+ skeleton(
381
+ start = null,
382
+ end = null
383
+ ) {
384
+ return new SkeletonSlideBuilder(
385
+ this.createSlide(
386
+ "skeleton",
387
+ start,
388
+ end
389
+ ),
390
+ this
391
+ );
392
+ }
393
+
394
+ compile() {
395
+ return TaleemCompiler(this, {
396
+ assetBase:
397
+ this.metaData.base
398
+ });
399
+ }
400
+ }
@@ -0,0 +1,256 @@
1
+ // /src/dsl/TimelineContext.js
2
+
3
+ import BulletListBuilder from "./slides/BulletListBuilder.js";
4
+
5
+ import SkeletonSlideBuilder from "./slides/SkeletonSlideBuilder.js";
6
+
7
+ import FocusListBuilder from "./slides/FocusListBuilder.js";
8
+
9
+ import Eq from "./slides/Eq.js";
10
+
11
+ import Table from "./slides/Table.js";
12
+
13
+ import BarChart from "./slides/BarChart.js";
14
+
15
+ import Progressbar from "./slides/Progressbar.js";
16
+
17
+ import TitleAndSubtitle from "./slides/TitleAndSubtitle.js";
18
+
19
+ import TitleAndPara from "./slides/TitleAndPara.js";
20
+
21
+ import TwoColumnText from "./slides/TwoColumnText.js";
22
+
23
+ import ImageSlide from "./slides/ImageSlide.js";
24
+
25
+ import ImageWithTitle from "./slides/ImageWithTitle.js";
26
+
27
+ import ImageWithCaption from "./slides/ImageWithCaption.js";
28
+
29
+ import ImageLeftBulletsRight from "./slides/ImageLeftBulletsRight.js";
30
+
31
+ import ImageRightBulletsLeft from "./slides/ImageRightBulletsLeft.js";
32
+
33
+ import QuoteSlide from "./slides/QuoteSlide.js";
34
+
35
+ import KeyIdeasSlide from "./slides/KeyIdeasSlide.js";
36
+
37
+ import FillImage from "./slides/FillImage.js";
38
+
39
+ import ImageStrip from "./slides/ImageStrip.js";
40
+
41
+ import ImageGrid from "./slides/ImageGrid.js";
42
+
43
+ import TextGrid from "./slides/TextGrid.js";
44
+
45
+ export default class TimelineContext {
46
+ constructor(builder, time) {
47
+ this.builder = builder;
48
+
49
+ this.time = time;
50
+ }
51
+
52
+ createSlide(type) {
53
+ const slide = {
54
+ type,
55
+
56
+ start: this.time,
57
+
58
+ end: null,
59
+
60
+ data: []
61
+ };
62
+
63
+ this.builder.deck.push(slide);
64
+
65
+ return slide;
66
+ }
67
+
68
+ titleAndSubtitle() {
69
+ return new TitleAndSubtitle(
70
+ this.createSlide(
71
+ "titleAndSubtitle"
72
+ ),
73
+ this.builder
74
+ );
75
+ }
76
+
77
+ titleAndPara() {
78
+ return new TitleAndPara(
79
+ this.createSlide(
80
+ "titleAndPara"
81
+ ),
82
+ this.builder
83
+ );
84
+ }
85
+
86
+ bulletList() {
87
+ return new BulletListBuilder(
88
+ this.createSlide(
89
+ "bulletList"
90
+ ),
91
+ this.builder
92
+ );
93
+ }
94
+
95
+ twoColumnText() {
96
+ return new TwoColumnText(
97
+ this.createSlide(
98
+ "twoColumnText"
99
+ ),
100
+ this.builder
101
+ );
102
+ }
103
+
104
+ imageSlide() {
105
+ return new ImageSlide(
106
+ this.createSlide(
107
+ "imageSlide"
108
+ ),
109
+ this.builder
110
+ );
111
+ }
112
+
113
+ imageWithTitle() {
114
+ return new ImageWithTitle(
115
+ this.createSlide(
116
+ "imageWithTitle"
117
+ ),
118
+ this.builder
119
+ );
120
+ }
121
+
122
+ imageWithCaption() {
123
+ return new ImageWithCaption(
124
+ this.createSlide(
125
+ "imageWithCaption"
126
+ ),
127
+ this.builder
128
+ );
129
+ }
130
+
131
+ imageLeftBulletsRight() {
132
+ return new ImageLeftBulletsRight(
133
+ this.createSlide(
134
+ "imageLeftBulletsRight"
135
+ ),
136
+ this.builder
137
+ );
138
+ }
139
+
140
+ imageRightBulletsLeft() {
141
+ return new ImageRightBulletsLeft(
142
+ this.createSlide(
143
+ "imageRightBulletsLeft"
144
+ ),
145
+ this.builder
146
+ );
147
+ }
148
+
149
+ table() {
150
+ return new Table(
151
+ this.createSlide(
152
+ "table"
153
+ ),
154
+ this.builder
155
+ );
156
+ }
157
+
158
+ barChart() {
159
+ return new BarChart(
160
+ this.createSlide(
161
+ "barChart"
162
+ ),
163
+ this.builder
164
+ );
165
+ }
166
+
167
+ progressbar() {
168
+ return new Progressbar(
169
+ this.createSlide(
170
+ "progressbar"
171
+ ),
172
+ this.builder
173
+ );
174
+ }
175
+
176
+ quoteSlide() {
177
+ return new QuoteSlide(
178
+ this.createSlide(
179
+ "quoteSlide"
180
+ ),
181
+ this.builder
182
+ );
183
+ }
184
+
185
+ keyIdeasSlide() {
186
+ return new KeyIdeasSlide(
187
+ this.createSlide(
188
+ "keyIdeasSlide"
189
+ ),
190
+ this.builder
191
+ );
192
+ }
193
+
194
+ focusList() {
195
+ return new FocusListBuilder(
196
+ this.createSlide(
197
+ "focusList"
198
+ ),
199
+ this.builder
200
+ );
201
+ }
202
+
203
+ eq() {
204
+ return new Eq(
205
+ this.createSlide(
206
+ "eq"
207
+ ),
208
+ this.builder
209
+ );
210
+ }
211
+
212
+ fillImage() {
213
+ return new FillImage(
214
+ this.createSlide(
215
+ "fillImage"
216
+ ),
217
+ this.builder
218
+ );
219
+ }
220
+
221
+ imageStrip() {
222
+ return new ImageStrip(
223
+ this.createSlide(
224
+ "imageStrip"
225
+ ),
226
+ this.builder
227
+ );
228
+ }
229
+
230
+ imageGrid() {
231
+ return new ImageGrid(
232
+ this.createSlide(
233
+ "imageGrid"
234
+ ),
235
+ this.builder
236
+ );
237
+ }
238
+
239
+ textGrid() {
240
+ return new TextGrid(
241
+ this.createSlide(
242
+ "textGrid"
243
+ ),
244
+ this.builder
245
+ );
246
+ }
247
+
248
+ skeleton() {
249
+ return new SkeletonSlideBuilder(
250
+ this.createSlide(
251
+ "skeleton"
252
+ ),
253
+ this.builder
254
+ );
255
+ }
256
+ }
@@ -0,0 +1,31 @@
1
+ // /src/dsl/slides/BarChart.js
2
+
3
+ export default class BarChart {
4
+ constructor(slide, builder) {
5
+ this.slide = slide;
6
+
7
+ this.builder = builder;
8
+ }
9
+
10
+ bar(
11
+ label,
12
+ value,
13
+ showAt
14
+ ) {
15
+ this.slide.data.push({
16
+ name: "bar",
17
+
18
+ label,
19
+
20
+ value,
21
+
22
+ showAt
23
+ });
24
+
25
+ return this;
26
+ }
27
+
28
+ done() {
29
+ return this.builder;
30
+ }
31
+ }
@@ -0,0 +1,23 @@
1
+ // /src/dsl/slides/BulletListBuilder.js
2
+
3
+ export default class BulletListBuilder {
4
+ constructor(slide, builder) {
5
+ this.slide = slide;
6
+
7
+ this.builder = builder;
8
+ }
9
+
10
+ bullet(content, showAt) {
11
+ this.slide.data.push({
12
+ name: "bullet",
13
+ content,
14
+ showAt
15
+ });
16
+
17
+ return this;
18
+ }
19
+
20
+ done() {
21
+ return this.builder;
22
+ }
23
+ }