taleem-browser 0.1.1 → 0.1.3
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 +2 -0
- package/dist/taleem-browser.esm.js +705 -0
- package/dist/taleem-browser.umd.js +729 -0
- package/dist/taleem.css +255 -0
- package/package.json +25 -36
- package/src/index.js +0 -110
package/README.md
CHANGED
|
@@ -83,6 +83,8 @@ This is not an omission — it is a design choice.
|
|
|
83
83
|
|
|
84
84
|
These concerns belong to **different layers or different libraries**.
|
|
85
85
|
|
|
86
|
+
---
|
|
87
|
+
“Canonical slide styles live at src/styles/taleem.css and are shipped as a release asset.”
|
|
86
88
|
---
|
|
87
89
|
|
|
88
90
|
## Relationship to other Taleem libraries
|
|
@@ -0,0 +1,705 @@
|
|
|
1
|
+
// node_modules/taleem-slides/src/slides/TitleSlide.js
|
|
2
|
+
var TitleSlide = {
|
|
3
|
+
type: "titleSlide",
|
|
4
|
+
/**
|
|
5
|
+
* Build a TitleSlide from raw deck JSON
|
|
6
|
+
*/
|
|
7
|
+
fromJSON(rawSlide, index) {
|
|
8
|
+
if (!Array.isArray(rawSlide.data)) {
|
|
9
|
+
throw new Error(`TitleSlide: data must be an array`);
|
|
10
|
+
}
|
|
11
|
+
const titleItem = rawSlide.data.find((d) => d.name === "title");
|
|
12
|
+
if (!titleItem || typeof titleItem.content !== "string") {
|
|
13
|
+
throw new Error(`TitleSlide: missing or invalid title content`);
|
|
14
|
+
}
|
|
15
|
+
const title = titleItem.content;
|
|
16
|
+
return Object.freeze({
|
|
17
|
+
type: "titleSlide",
|
|
18
|
+
render() {
|
|
19
|
+
return `
|
|
20
|
+
<div class="slide titleSlide">
|
|
21
|
+
<h1>${title}</h1>
|
|
22
|
+
</div>
|
|
23
|
+
`;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// node_modules/taleem-slides/src/slides/TitleAndSubtitleSlide.js
|
|
30
|
+
var TitleAndSubtitleSlide = {
|
|
31
|
+
type: "titleAndSubtitle",
|
|
32
|
+
fromJSON(raw) {
|
|
33
|
+
const title = raw.data?.find((d) => d.name === "title")?.content;
|
|
34
|
+
const subtitle = raw.data?.find((d) => d.name === "subtitle")?.content;
|
|
35
|
+
if (!title || !subtitle) {
|
|
36
|
+
throw new Error("titleAndSubtitle: requires title and subtitle");
|
|
37
|
+
}
|
|
38
|
+
return Object.freeze({
|
|
39
|
+
type: "titleAndSubtitle",
|
|
40
|
+
render() {
|
|
41
|
+
return `
|
|
42
|
+
<section class="slide titleAndSubtitle">
|
|
43
|
+
<h1>${title}</h1>
|
|
44
|
+
<h2>${subtitle}</h2>
|
|
45
|
+
</section>
|
|
46
|
+
`;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// node_modules/taleem-slides/src/slides/TitleAndParaSlide.js
|
|
53
|
+
var TitleAndParaSlide = {
|
|
54
|
+
type: "titleAndPara",
|
|
55
|
+
fromJSON(raw) {
|
|
56
|
+
const title = raw.data?.find((d) => d.name === "title")?.content;
|
|
57
|
+
const para = raw.data?.find((d) => d.name === "para")?.content;
|
|
58
|
+
if (!title || !para) {
|
|
59
|
+
throw new Error("titleAndPara: requires title and para");
|
|
60
|
+
}
|
|
61
|
+
return Object.freeze({
|
|
62
|
+
type: "titleAndPara",
|
|
63
|
+
render() {
|
|
64
|
+
return `
|
|
65
|
+
<section class="slide titleAndPara">
|
|
66
|
+
<h1>${title}</h1>
|
|
67
|
+
<p>${para}</p>
|
|
68
|
+
</section>
|
|
69
|
+
`;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// node_modules/taleem-slides/src/slides/BulletListSlide.js
|
|
76
|
+
var BulletListSlide = {
|
|
77
|
+
type: "bulletList",
|
|
78
|
+
fromJSON(raw) {
|
|
79
|
+
const bullets = raw.data?.filter((d) => d.name === "bullet").map((d) => d.content);
|
|
80
|
+
if (!bullets || bullets.length === 0) {
|
|
81
|
+
throw new Error("bulletList: requires at least one bullet");
|
|
82
|
+
}
|
|
83
|
+
return Object.freeze({
|
|
84
|
+
type: "bulletList",
|
|
85
|
+
render() {
|
|
86
|
+
return `
|
|
87
|
+
<section class="slide bulletList">
|
|
88
|
+
<ul>
|
|
89
|
+
${bullets.map((b) => `<li>${b}</li>`).join("")}
|
|
90
|
+
</ul>
|
|
91
|
+
</section>
|
|
92
|
+
`;
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
// node_modules/taleem-slides/src/slides/TwoColumnTextSlide.js
|
|
99
|
+
var TwoColumnTextSlide = {
|
|
100
|
+
type: "twoColumnText",
|
|
101
|
+
fromJSON(raw) {
|
|
102
|
+
const left = raw.data?.filter((d) => d.name === "left").map((d) => d.content);
|
|
103
|
+
const right = raw.data?.filter((d) => d.name === "right").map((d) => d.content);
|
|
104
|
+
if (!left?.length || !right?.length) {
|
|
105
|
+
throw new Error("twoColumnText: requires left and right columns");
|
|
106
|
+
}
|
|
107
|
+
return Object.freeze({
|
|
108
|
+
type: "twoColumnText",
|
|
109
|
+
render() {
|
|
110
|
+
return `
|
|
111
|
+
<section class="slide twoColumnText">
|
|
112
|
+
<div class="col left">${left.join("<br/>")}</div>
|
|
113
|
+
<div class="col right">${right.join("<br/>")}</div>
|
|
114
|
+
</section>
|
|
115
|
+
`;
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
// node_modules/taleem-slides/src/slides/ImageSlide.js
|
|
122
|
+
var ImageSlide = {
|
|
123
|
+
type: "imageSlide",
|
|
124
|
+
fromJSON(raw) {
|
|
125
|
+
const src = raw.data?.find((d) => d.name === "image")?.content;
|
|
126
|
+
if (!src) throw new Error("imageSlide: image required");
|
|
127
|
+
return Object.freeze({
|
|
128
|
+
type: "imageSlide",
|
|
129
|
+
render() {
|
|
130
|
+
return `
|
|
131
|
+
<section class="slide imageSlide">
|
|
132
|
+
<img src="${src}" alt="" />
|
|
133
|
+
</section>
|
|
134
|
+
`;
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
// node_modules/taleem-slides/src/slides/FillImageSlide.js
|
|
141
|
+
var FillImageSlide = {
|
|
142
|
+
type: "fillImage",
|
|
143
|
+
fromJSON(raw) {
|
|
144
|
+
const image = raw.data?.find((d) => d.name === "image")?.content;
|
|
145
|
+
if (!image) {
|
|
146
|
+
throw new Error("fillImage: image required");
|
|
147
|
+
}
|
|
148
|
+
return Object.freeze({
|
|
149
|
+
type: "fillImage",
|
|
150
|
+
render() {
|
|
151
|
+
return `
|
|
152
|
+
<section class="slide fillImage">
|
|
153
|
+
<img src="${image}" alt="" />
|
|
154
|
+
</section>
|
|
155
|
+
`;
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
// node_modules/taleem-slides/src/slides/ImageWithTitleSlide.js
|
|
162
|
+
var ImageWithTitleSlide = {
|
|
163
|
+
type: "imageWithTitle",
|
|
164
|
+
fromJSON(raw) {
|
|
165
|
+
const src = raw.data?.find((d) => d.name === "image")?.content;
|
|
166
|
+
const title = raw.data?.find((d) => d.name === "title")?.content;
|
|
167
|
+
if (!src || !title) {
|
|
168
|
+
throw new Error("imageWithTitle: image and title required");
|
|
169
|
+
}
|
|
170
|
+
return Object.freeze({
|
|
171
|
+
type: "imageWithTitle",
|
|
172
|
+
render() {
|
|
173
|
+
return `
|
|
174
|
+
<section class="slide imageWithTitle">
|
|
175
|
+
<img src="${src}" alt="" />
|
|
176
|
+
<h1>${title}</h1>
|
|
177
|
+
</section>
|
|
178
|
+
`;
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
// node_modules/taleem-slides/src/slides/ImageWithCaptionSlide.js
|
|
185
|
+
var ImageWithCaptionSlide = {
|
|
186
|
+
type: "imageWithCaption",
|
|
187
|
+
fromJSON(raw) {
|
|
188
|
+
const src = raw.data?.find((d) => d.name === "image")?.content;
|
|
189
|
+
const caption = raw.data?.find((d) => d.name === "caption")?.content;
|
|
190
|
+
if (!src || !caption) {
|
|
191
|
+
throw new Error("imageWithCaption: image and caption required");
|
|
192
|
+
}
|
|
193
|
+
return Object.freeze({
|
|
194
|
+
type: "imageWithCaption",
|
|
195
|
+
render() {
|
|
196
|
+
return `
|
|
197
|
+
<figure class="slide imageWithCaption">
|
|
198
|
+
<img src="${src}" alt="" />
|
|
199
|
+
<figcaption>${caption}</figcaption>
|
|
200
|
+
</figure>
|
|
201
|
+
`;
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
// node_modules/taleem-slides/src/slides/ImageLeftBulletsRightSlide.js
|
|
208
|
+
var ImageLeftBulletsRightSlide = {
|
|
209
|
+
type: "imageLeftBulletsRight",
|
|
210
|
+
fromJSON(raw) {
|
|
211
|
+
const image = raw.data?.find((d) => d.name === "image")?.content;
|
|
212
|
+
const bullets = raw.data?.filter((d) => d.name === "bullet").map((d) => d.content);
|
|
213
|
+
if (!image || !bullets?.length) {
|
|
214
|
+
throw new Error("imageLeftBulletsRight: image and bullets required");
|
|
215
|
+
}
|
|
216
|
+
return Object.freeze({
|
|
217
|
+
type: "imageLeftBulletsRight",
|
|
218
|
+
render() {
|
|
219
|
+
return `
|
|
220
|
+
<section class="slide imageLeftBulletsRight">
|
|
221
|
+
<img src="${image}" alt="" />
|
|
222
|
+
<ul>
|
|
223
|
+
${bullets.map((b) => `<li>${b}</li>`).join("")}
|
|
224
|
+
</ul>
|
|
225
|
+
</section>
|
|
226
|
+
`;
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
// node_modules/taleem-slides/src/slides/ImageRightBulletsLeftSlide.js
|
|
233
|
+
var ImageRightBulletsLeftSlide = {
|
|
234
|
+
type: "imageRightBulletsLeft",
|
|
235
|
+
fromJSON(raw) {
|
|
236
|
+
const image = raw.data?.find((d) => d.name === "image")?.content;
|
|
237
|
+
const bullets = raw.data?.filter((d) => d.name === "bullet").map((d) => d.content);
|
|
238
|
+
if (!image || !bullets?.length) {
|
|
239
|
+
throw new Error("imageRightBulletsLeft: image and bullets required");
|
|
240
|
+
}
|
|
241
|
+
return Object.freeze({
|
|
242
|
+
type: "imageRightBulletsLeft",
|
|
243
|
+
render() {
|
|
244
|
+
return `
|
|
245
|
+
<section class="slide imageRightBulletsLeft">
|
|
246
|
+
<ul>
|
|
247
|
+
${bullets.map((b) => `<li>${b}</li>`).join("")}
|
|
248
|
+
</ul>
|
|
249
|
+
<img src="${image}" alt="" />
|
|
250
|
+
</section>
|
|
251
|
+
`;
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
// node_modules/taleem-slides/src/slides/TableSlide.js
|
|
258
|
+
var TableSlide = {
|
|
259
|
+
type: "table",
|
|
260
|
+
fromJSON(raw) {
|
|
261
|
+
const rows = raw.data?.filter((d) => d.name === "row").map((d) => d.content);
|
|
262
|
+
if (!rows || rows.length === 0) {
|
|
263
|
+
throw new Error("table: requires at least one row");
|
|
264
|
+
}
|
|
265
|
+
return Object.freeze({
|
|
266
|
+
type: "table",
|
|
267
|
+
render() {
|
|
268
|
+
return `
|
|
269
|
+
<table class="slide table">
|
|
270
|
+
${rows.map(
|
|
271
|
+
(row) => `<tr>${row.map((cell) => `<td>${cell}</td>`).join("")}</tr>`
|
|
272
|
+
).join("")}
|
|
273
|
+
</table>
|
|
274
|
+
`;
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
// node_modules/taleem-slides/src/slides/StatisticSlide.js
|
|
281
|
+
var StatisticSlide = {
|
|
282
|
+
type: "statistic",
|
|
283
|
+
fromJSON(raw) {
|
|
284
|
+
const label = raw.data?.find((d) => d.name === "label")?.content;
|
|
285
|
+
const value = raw.data?.find((d) => d.name === "value")?.content;
|
|
286
|
+
if (!label || value === void 0) {
|
|
287
|
+
throw new Error("statistic: requires label and value");
|
|
288
|
+
}
|
|
289
|
+
return Object.freeze({
|
|
290
|
+
type: "statistic",
|
|
291
|
+
render() {
|
|
292
|
+
return `
|
|
293
|
+
<section class="slide statistic">
|
|
294
|
+
<div class="stat-value">${value}</div>
|
|
295
|
+
<div class="stat-label">${label}</div>
|
|
296
|
+
</section>
|
|
297
|
+
`;
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
// node_modules/taleem-slides/src/slides/BigNumberSlide.js
|
|
304
|
+
var BigNumberSlide = {
|
|
305
|
+
type: "bigNumber",
|
|
306
|
+
fromJSON(raw) {
|
|
307
|
+
const value = raw.data?.find((d) => d.name === "number")?.content;
|
|
308
|
+
const label = raw.data?.find((d) => d.name === "label")?.content;
|
|
309
|
+
if (!value) throw new Error("bigNumber: number required");
|
|
310
|
+
return Object.freeze({
|
|
311
|
+
type: "bigNumber",
|
|
312
|
+
render() {
|
|
313
|
+
return `
|
|
314
|
+
<section class="slide bigNumber">
|
|
315
|
+
<div class="number">${value}</div>
|
|
316
|
+
${label ? `<div class="label">${label}</div>` : ""}
|
|
317
|
+
</section>
|
|
318
|
+
`;
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
// node_modules/taleem-slides/src/slides/BarChartSlide.js
|
|
325
|
+
var BarChartSlide = {
|
|
326
|
+
type: "barChart",
|
|
327
|
+
fromJSON(raw) {
|
|
328
|
+
const bars = raw.data?.filter((d) => d.name === "bar");
|
|
329
|
+
if (!bars || bars.length === 0) {
|
|
330
|
+
throw new Error("barChart: requires at least one bar");
|
|
331
|
+
}
|
|
332
|
+
bars.forEach((b, i) => {
|
|
333
|
+
if (typeof b.content !== "object" || typeof b.content.label !== "string" || typeof b.content.value !== "number") {
|
|
334
|
+
throw new Error(`barChart: invalid bar at index ${i}`);
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
return Object.freeze({
|
|
338
|
+
type: "barChart",
|
|
339
|
+
render() {
|
|
340
|
+
return `
|
|
341
|
+
<section class="slide barChart">
|
|
342
|
+
<ul class="bars">
|
|
343
|
+
${bars.map(
|
|
344
|
+
(b) => `
|
|
345
|
+
<li class="bar">
|
|
346
|
+
<span class="bar-label">${b.content.label}</span>
|
|
347
|
+
<span class="bar-value">${b.content.value}</span>
|
|
348
|
+
</li>
|
|
349
|
+
`
|
|
350
|
+
).join("")}
|
|
351
|
+
</ul>
|
|
352
|
+
</section>
|
|
353
|
+
`;
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
// node_modules/taleem-slides/src/slides/DonutChartSlide.js
|
|
360
|
+
var DonutChartSlide = {
|
|
361
|
+
type: "donutChart",
|
|
362
|
+
fromJSON(raw) {
|
|
363
|
+
const segments = raw.data?.filter((d) => d.name === "segment");
|
|
364
|
+
if (!segments || segments.length === 0) {
|
|
365
|
+
throw new Error("donutChart: requires at least one segment");
|
|
366
|
+
}
|
|
367
|
+
return Object.freeze({
|
|
368
|
+
type: "donutChart",
|
|
369
|
+
render() {
|
|
370
|
+
return `
|
|
371
|
+
<section class="slide donutChart">
|
|
372
|
+
<ul>
|
|
373
|
+
${segments.map(
|
|
374
|
+
(s) => `<li>${s.content.label}: ${s.content.value}</li>`
|
|
375
|
+
).join("")}
|
|
376
|
+
</ul>
|
|
377
|
+
</section>
|
|
378
|
+
`;
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
// node_modules/taleem-slides/src/slides/QuoteSlide.js
|
|
385
|
+
var QuoteSlide = {
|
|
386
|
+
type: "quoteSlide",
|
|
387
|
+
fromJSON(raw) {
|
|
388
|
+
const text = raw.data?.find((d) => d.name === "quote")?.content;
|
|
389
|
+
const author = raw.data?.find((d) => d.name === "author")?.content;
|
|
390
|
+
if (!text) throw new Error("quoteSlide: quote required");
|
|
391
|
+
return Object.freeze({
|
|
392
|
+
type: "quoteSlide",
|
|
393
|
+
render() {
|
|
394
|
+
return `
|
|
395
|
+
<blockquote class="slide quoteSlide">
|
|
396
|
+
<p>${text}</p>
|
|
397
|
+
${author ? `<footer>${author}</footer>` : ""}
|
|
398
|
+
</blockquote>
|
|
399
|
+
`;
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
// node_modules/taleem-slides/src/slides/QuoteWithImageSlide.js
|
|
406
|
+
var QuoteWithImageSlide = {
|
|
407
|
+
type: "quoteWithImage",
|
|
408
|
+
fromJSON(raw) {
|
|
409
|
+
const quote = raw.data?.find((d) => d.name === "quote")?.content;
|
|
410
|
+
const image = raw.data?.find((d) => d.name === "image")?.content;
|
|
411
|
+
const author = raw.data?.find((d) => d.name === "author")?.content;
|
|
412
|
+
if (!quote || !image) {
|
|
413
|
+
throw new Error("quoteWithImage: quote and image required");
|
|
414
|
+
}
|
|
415
|
+
return Object.freeze({
|
|
416
|
+
type: "quoteWithImage",
|
|
417
|
+
render() {
|
|
418
|
+
return `
|
|
419
|
+
<section class="slide quoteWithImage">
|
|
420
|
+
<img src="${image}" alt="" />
|
|
421
|
+
<blockquote>
|
|
422
|
+
<p>${quote}</p>
|
|
423
|
+
${author ? `<footer>${author}</footer>` : ""}
|
|
424
|
+
</blockquote>
|
|
425
|
+
</section>
|
|
426
|
+
`;
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
|
|
432
|
+
// node_modules/taleem-slides/src/slides/CornerWordsSlide.js
|
|
433
|
+
var CornerWordsSlide = {
|
|
434
|
+
type: "cornerWordsSlide",
|
|
435
|
+
fromJSON(raw) {
|
|
436
|
+
const words = raw.data?.filter((d) => d.name === "word").map((d) => d.content);
|
|
437
|
+
if (!words || words.length === 0) {
|
|
438
|
+
throw new Error("cornerWordsSlide: requires at least one word");
|
|
439
|
+
}
|
|
440
|
+
return Object.freeze({
|
|
441
|
+
type: "cornerWordsSlide",
|
|
442
|
+
render() {
|
|
443
|
+
return `
|
|
444
|
+
<section class="slide cornerWordsSlide">
|
|
445
|
+
${words.map(
|
|
446
|
+
(w, i) => `<span class="corner-word corner-${i + 1}">${w}</span>`
|
|
447
|
+
).join("")}
|
|
448
|
+
</section>
|
|
449
|
+
`;
|
|
450
|
+
}
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
};
|
|
454
|
+
|
|
455
|
+
// node_modules/taleem-slides/src/slides/ContactSlide.js
|
|
456
|
+
var ContactSlide = {
|
|
457
|
+
type: "contactSlide",
|
|
458
|
+
fromJSON(raw) {
|
|
459
|
+
const items = raw.data?.map((d) => `<div>${d.content}</div>`);
|
|
460
|
+
if (!items?.length) throw new Error("contactSlide: content required");
|
|
461
|
+
return Object.freeze({
|
|
462
|
+
type: "contactSlide",
|
|
463
|
+
render() {
|
|
464
|
+
return `
|
|
465
|
+
<section class="slide contactSlide">
|
|
466
|
+
${items.join("")}
|
|
467
|
+
</section>
|
|
468
|
+
`;
|
|
469
|
+
}
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
};
|
|
473
|
+
|
|
474
|
+
// node_modules/taleem-slides/src/slides/EqSlide.js
|
|
475
|
+
var EqSlide = {
|
|
476
|
+
type: "eq",
|
|
477
|
+
fromJSON(raw) {
|
|
478
|
+
if (!Array.isArray(raw.data)) {
|
|
479
|
+
throw new Error("eq: data must be array");
|
|
480
|
+
}
|
|
481
|
+
return Object.freeze({
|
|
482
|
+
type: "eq",
|
|
483
|
+
render() {
|
|
484
|
+
return `
|
|
485
|
+
<section class="slide eq">
|
|
486
|
+
${raw.data.map((d) => `<div>${d.content}</div>`).join("")}
|
|
487
|
+
</section>
|
|
488
|
+
`;
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
// node_modules/taleem-slides/src/slides/SvgPointerSlide.js
|
|
495
|
+
var SvgPointerSlide = {
|
|
496
|
+
type: "svgPointer",
|
|
497
|
+
fromJSON(raw) {
|
|
498
|
+
const svg = raw.data?.find((d) => d.name === "svg")?.content;
|
|
499
|
+
if (!svg) throw new Error("svgPointer: svg required");
|
|
500
|
+
return Object.freeze({
|
|
501
|
+
type: "svgPointer",
|
|
502
|
+
render() {
|
|
503
|
+
return `
|
|
504
|
+
<section class="slide svgPointer">
|
|
505
|
+
${svg}
|
|
506
|
+
</section>
|
|
507
|
+
`;
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
|
|
513
|
+
// node_modules/taleem-slides/src/registry.js
|
|
514
|
+
var registry = {
|
|
515
|
+
titleSlide: TitleSlide,
|
|
516
|
+
titleAndSubtitle: TitleAndSubtitleSlide,
|
|
517
|
+
titleAndPara: TitleAndParaSlide,
|
|
518
|
+
bulletList: BulletListSlide,
|
|
519
|
+
twoColumnText: TwoColumnTextSlide,
|
|
520
|
+
imageSlide: ImageSlide,
|
|
521
|
+
fillImage: FillImageSlide,
|
|
522
|
+
imageWithTitle: ImageWithTitleSlide,
|
|
523
|
+
imageWithCaption: ImageWithCaptionSlide,
|
|
524
|
+
imageLeftBulletsRight: ImageLeftBulletsRightSlide,
|
|
525
|
+
imageRightBulletsLeft: ImageRightBulletsLeftSlide,
|
|
526
|
+
table: TableSlide,
|
|
527
|
+
statistic: StatisticSlide,
|
|
528
|
+
bigNumber: BigNumberSlide,
|
|
529
|
+
barChart: BarChartSlide,
|
|
530
|
+
donutChart: DonutChartSlide,
|
|
531
|
+
quoteSlide: QuoteSlide,
|
|
532
|
+
quoteWithImage: QuoteWithImageSlide,
|
|
533
|
+
cornerWordsSlide: CornerWordsSlide,
|
|
534
|
+
contactSlide: ContactSlide,
|
|
535
|
+
eq: EqSlide,
|
|
536
|
+
svgPointer: SvgPointerSlide
|
|
537
|
+
};
|
|
538
|
+
|
|
539
|
+
// node_modules/taleem-slides/src/slideManager/SlideManager.js
|
|
540
|
+
var SlideManager = class {
|
|
541
|
+
#slides;
|
|
542
|
+
constructor(slides) {
|
|
543
|
+
if (!Array.isArray(slides)) {
|
|
544
|
+
throw new Error("SlideManager: slides must be an array");
|
|
545
|
+
}
|
|
546
|
+
this.#slides = slides;
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* Render a single slide by index.
|
|
550
|
+
*
|
|
551
|
+
* @param {number} index
|
|
552
|
+
* @param {number} [showAt]
|
|
553
|
+
* @returns {string} HTML
|
|
554
|
+
*/
|
|
555
|
+
renderSlide(index, showAt) {
|
|
556
|
+
const slide = this.#slides[index];
|
|
557
|
+
if (!slide) {
|
|
558
|
+
throw new Error(`SlideManager: invalid slide index ${index}`);
|
|
559
|
+
}
|
|
560
|
+
if (typeof slide.render !== "function") {
|
|
561
|
+
throw new Error(
|
|
562
|
+
`SlideManager: slide at index ${index} has no render() method`
|
|
563
|
+
);
|
|
564
|
+
}
|
|
565
|
+
return slide.render(showAt);
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Render all slides as a static HTML dump.
|
|
569
|
+
*
|
|
570
|
+
* @returns {string} HTML
|
|
571
|
+
*/
|
|
572
|
+
renderAll() {
|
|
573
|
+
return this.#slides.map((slide, index) => {
|
|
574
|
+
if (typeof slide.render !== "function") {
|
|
575
|
+
throw new Error(
|
|
576
|
+
`SlideManager: slide at index ${index} has no render() method`
|
|
577
|
+
);
|
|
578
|
+
}
|
|
579
|
+
return slide.render();
|
|
580
|
+
}).join("\n");
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
|
|
584
|
+
// node_modules/taleem-slides/src/interpreter/slideBuilder.js
|
|
585
|
+
function slideBuilder(deckV1Json) {
|
|
586
|
+
if (!deckV1Json || typeof deckV1Json !== "object") {
|
|
587
|
+
throw new Error("slideBuilder: input must be an object");
|
|
588
|
+
}
|
|
589
|
+
if (deckV1Json.version !== "deck-v1") {
|
|
590
|
+
throw new Error(
|
|
591
|
+
`slideBuilder: unsupported deck version "${deckV1Json.version}"`
|
|
592
|
+
);
|
|
593
|
+
}
|
|
594
|
+
if (!Array.isArray(deckV1Json.deck)) {
|
|
595
|
+
throw new Error("slideBuilder: deck must be an array");
|
|
596
|
+
}
|
|
597
|
+
const slides = deckV1Json.deck.map((rawSlide, index) => {
|
|
598
|
+
if (!rawSlide || typeof rawSlide !== "object") {
|
|
599
|
+
throw new Error(`slideBuilder: slide ${index} is not an object`);
|
|
600
|
+
}
|
|
601
|
+
const { type } = rawSlide;
|
|
602
|
+
if (!type || typeof type !== "string") {
|
|
603
|
+
throw new Error(`slideBuilder: slide ${index} has no valid type`);
|
|
604
|
+
}
|
|
605
|
+
const builder = registry[type];
|
|
606
|
+
if (!builder) {
|
|
607
|
+
throw new Error(
|
|
608
|
+
`slideBuilder: unsupported slide type "${type}" at index ${index}`
|
|
609
|
+
);
|
|
610
|
+
}
|
|
611
|
+
try {
|
|
612
|
+
return builder.fromJSON(rawSlide, index);
|
|
613
|
+
} catch (err) {
|
|
614
|
+
throw new Error(
|
|
615
|
+
`slideBuilder: failed to build slide "${type}" at index ${index}
|
|
616
|
+
${err.message}`
|
|
617
|
+
);
|
|
618
|
+
}
|
|
619
|
+
});
|
|
620
|
+
slides.forEach(Object.freeze);
|
|
621
|
+
Object.freeze(slides);
|
|
622
|
+
return new SlideManager(slides);
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
// src/release.js
|
|
626
|
+
var TALEEM_BROWSER_VERSION = "0.1.3";
|
|
627
|
+
var TALEEM_CSS_URL = "https://github.com/bilza2023/taleem-browser/releases/download/v0.1.3/taleem.css";
|
|
628
|
+
|
|
629
|
+
// src/index.js
|
|
630
|
+
function createTaleemBrowser({ mount, deck }) {
|
|
631
|
+
if (!mount) {
|
|
632
|
+
throw new Error("taleem-browser: mount is required");
|
|
633
|
+
}
|
|
634
|
+
if (!deck || !Array.isArray(deck.deck)) {
|
|
635
|
+
throw new Error("taleem-browser: valid deck object required");
|
|
636
|
+
}
|
|
637
|
+
const root = typeof mount === "string" ? document.querySelector(mount) : mount;
|
|
638
|
+
if (!root) {
|
|
639
|
+
throw new Error("taleem-browser: mount element not found");
|
|
640
|
+
}
|
|
641
|
+
let currentIndex = 0;
|
|
642
|
+
const total = deck.deck.length;
|
|
643
|
+
root.innerHTML = `
|
|
644
|
+
<div class="taleem-browser-bg"></div>
|
|
645
|
+
<div class="taleem-browser-slide"></div>
|
|
646
|
+
`;
|
|
647
|
+
const bgEl = root.querySelector(".taleem-browser-bg");
|
|
648
|
+
const slideEl = root.querySelector(".taleem-browser-slide");
|
|
649
|
+
applyBackground(bgEl, deck.background);
|
|
650
|
+
const manager = slideBuilder(deck);
|
|
651
|
+
function render() {
|
|
652
|
+
slideEl.innerHTML = manager.renderSlide(currentIndex);
|
|
653
|
+
}
|
|
654
|
+
function next() {
|
|
655
|
+
if (currentIndex < total - 1) {
|
|
656
|
+
currentIndex++;
|
|
657
|
+
render();
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
function prev() {
|
|
661
|
+
if (currentIndex > 0) {
|
|
662
|
+
currentIndex--;
|
|
663
|
+
render();
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
function goTo(index) {
|
|
667
|
+
if (index < 0 || index >= total) return;
|
|
668
|
+
currentIndex = index;
|
|
669
|
+
render();
|
|
670
|
+
}
|
|
671
|
+
function getIndex() {
|
|
672
|
+
return currentIndex;
|
|
673
|
+
}
|
|
674
|
+
function getTotal() {
|
|
675
|
+
return total;
|
|
676
|
+
}
|
|
677
|
+
function destroy() {
|
|
678
|
+
root.innerHTML = "";
|
|
679
|
+
}
|
|
680
|
+
render();
|
|
681
|
+
return {
|
|
682
|
+
next,
|
|
683
|
+
prev,
|
|
684
|
+
goTo,
|
|
685
|
+
getIndex,
|
|
686
|
+
getTotal,
|
|
687
|
+
render,
|
|
688
|
+
destroy
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
function applyBackground(el, bg = {}) {
|
|
692
|
+
el.style.position = "absolute";
|
|
693
|
+
el.style.inset = "0";
|
|
694
|
+
el.style.zIndex = "0";
|
|
695
|
+
el.style.backgroundColor = bg.backgroundColor || "#000";
|
|
696
|
+
el.style.backgroundImage = bg.backgroundImage ? `url(${bg.backgroundImage})` : "none";
|
|
697
|
+
el.style.backgroundSize = "cover";
|
|
698
|
+
el.style.backgroundPosition = "center";
|
|
699
|
+
el.style.opacity = bg.backgroundImageOpacity !== void 0 ? bg.backgroundImageOpacity : 1;
|
|
700
|
+
}
|
|
701
|
+
export {
|
|
702
|
+
TALEEM_BROWSER_VERSION,
|
|
703
|
+
TALEEM_CSS_URL,
|
|
704
|
+
createTaleemBrowser
|
|
705
|
+
};
|