@thanh01.pmt/presentation-kit 0.2.18 → 0.3.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 (56) hide show
  1. package/README.md +26 -0
  2. package/dist/ai/index.cjs +16 -15
  3. package/dist/ai/index.cjs.map +1 -1
  4. package/dist/ai/index.d.cts +3 -2
  5. package/dist/ai/index.d.ts +3 -2
  6. package/dist/ai/index.js +2 -1
  7. package/dist/ai/index.js.map +1 -1
  8. package/dist/assets/fonts/NOTICE.md +25 -0
  9. package/dist/assets/fonts/SOURCES.json +47 -0
  10. package/dist/assets/fonts/fira-code.woff2 +0 -0
  11. package/dist/assets/fonts/inter.woff2 +0 -0
  12. package/dist/assets/fonts/jetbrains-mono.woff2 +0 -0
  13. package/dist/assets/fonts/playfair-display.woff2 +0 -0
  14. package/dist/assets/fonts/plus-jakarta-sans.woff2 +0 -0
  15. package/dist/assets/fonts/space-grotesk.woff2 +0 -0
  16. package/dist/chunk-3Q4RMZVQ.cjs +867 -0
  17. package/dist/chunk-3Q4RMZVQ.cjs.map +1 -0
  18. package/dist/{chunk-DDOUFYLK.js → chunk-I5RG2L3M.js} +3 -3
  19. package/dist/{chunk-DDOUFYLK.js.map → chunk-I5RG2L3M.js.map} +1 -1
  20. package/dist/{chunk-JJQDQIRG.js → chunk-INAOTYLK.cjs} +294 -854
  21. package/dist/chunk-INAOTYLK.cjs.map +1 -0
  22. package/dist/{chunk-DIHFQ5LF.cjs → chunk-JBGGQGSQ.cjs} +4 -4
  23. package/dist/{chunk-DIHFQ5LF.cjs.map → chunk-JBGGQGSQ.cjs.map} +1 -1
  24. package/dist/{chunk-SFBEDDGU.cjs → chunk-OCP2TAY2.js} +279 -878
  25. package/dist/chunk-OCP2TAY2.js.map +1 -0
  26. package/dist/chunk-V6X7D44H.js +854 -0
  27. package/dist/chunk-V6X7D44H.js.map +1 -0
  28. package/dist/{click-css-Bcc1CkTN.d.cts → click-css-C8VciwZ6.d.cts} +1 -1
  29. package/dist/{click-css-B2s9B_uP.d.ts → click-css-COIiFo1I.d.ts} +1 -1
  30. package/dist/index.cjs +90 -69
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.d.cts +46 -5
  33. package/dist/index.d.ts +46 -5
  34. package/dist/index.js +5 -4
  35. package/dist/index.js.map +1 -1
  36. package/dist/node/index.cjs +117 -0
  37. package/dist/node/index.cjs.map +1 -0
  38. package/dist/node/index.d.cts +36 -0
  39. package/dist/node/index.d.ts +36 -0
  40. package/dist/node/index.js +105 -0
  41. package/dist/node/index.js.map +1 -0
  42. package/dist/{presets-D_hfPJX9.d.ts → presets-DPRGtpO-.d.ts} +1 -1
  43. package/dist/{presets-BYvgAAkJ.d.cts → presets-MIi91wZg.d.cts} +1 -1
  44. package/dist/react/index.cjs +17 -16
  45. package/dist/react/index.cjs.map +1 -1
  46. package/dist/react/index.d.cts +4 -3
  47. package/dist/react/index.d.ts +4 -3
  48. package/dist/react/index.js +4 -3
  49. package/dist/react/index.js.map +1 -1
  50. package/dist/{types-C3d04zzP.d.cts → types-CvxCxWus.d.cts} +1 -67
  51. package/dist/{types-C3d04zzP.d.ts → types-CvxCxWus.d.ts} +1 -67
  52. package/dist/types-k_eae8UV.d.cts +74 -0
  53. package/dist/types-k_eae8UV.d.ts +74 -0
  54. package/package.json +8 -2
  55. package/dist/chunk-JJQDQIRG.js.map +0 -1
  56. package/dist/chunk-SFBEDDGU.cjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import yaml from 'js-yaml';
1
+ 'use strict';
2
2
 
3
3
  // src/plugins/shiki.ts
4
4
  var highlighterPromise = null;
@@ -74,853 +74,6 @@ async function highlightCodeBlocks(html, theme = "dark") {
74
74
  }
75
75
  );
76
76
  }
77
- function serializeLayoutToComment(layout) {
78
- if (!layout.boxes || layout.boxes.length === 0) return "";
79
- const cleanData = {
80
- boxes: layout.boxes.map((box) => {
81
- const b = {
82
- id: box.id,
83
- target: box.target || `h1`,
84
- pos: [
85
- Math.round(box.pos[0]),
86
- Math.round(box.pos[1]),
87
- Math.round(box.pos[2]),
88
- Math.round(box.pos[3])
89
- ]
90
- };
91
- if (box.fontSize) b.fontSize = box.fontSize;
92
- if (box.color) b.color = box.color;
93
- if (box.textAlign) b.textAlign = box.textAlign;
94
- if (box.style) b.style = box.style;
95
- return b;
96
- })
97
- };
98
- const yamlStr = yaml.dump(cleanData, {
99
- indent: 2,
100
- lineWidth: -1,
101
- noRefs: true
102
- }).trim();
103
- return `<!-- layout:
104
- ${yamlStr.split("\n").join("\n ")}
105
- -->`;
106
- }
107
- function splitMarkdownSlides(markdown) {
108
- const lines = markdown.split("\n");
109
- let frontmatter = null;
110
- const slideBuffers = [];
111
- let currentBuffer = [];
112
- let inCodeFence = false;
113
- let lineIdx = 0;
114
- if (lines.length > 0 && lines[0].trim() === "---") {
115
- const fmBuffer = [lines[0]];
116
- lineIdx = 1;
117
- while (lineIdx < lines.length) {
118
- const line = lines[lineIdx];
119
- fmBuffer.push(line);
120
- if (line.trim() === "---") {
121
- frontmatter = fmBuffer.join("\n");
122
- lineIdx++;
123
- break;
124
- }
125
- lineIdx++;
126
- }
127
- }
128
- for (let i = lineIdx; i < lines.length; i++) {
129
- const line = lines[i];
130
- if (/^```/.test(line.trim())) {
131
- inCodeFence = !inCodeFence;
132
- currentBuffer.push(line);
133
- continue;
134
- }
135
- if (!inCodeFence && line.trim() === "---") {
136
- slideBuffers.push(currentBuffer);
137
- currentBuffer = [];
138
- continue;
139
- }
140
- currentBuffer.push(line);
141
- }
142
- slideBuffers.push(currentBuffer);
143
- const slides = slideBuffers.map((b) => b.join("\n"));
144
- return { frontmatter, slides };
145
- }
146
- function updateSlideLayoutInMarkdown(markdown, slideIndex, layout) {
147
- const { frontmatter, slides } = splitMarkdownSlides(markdown);
148
- if (slideIndex < 0 || slideIndex >= slides.length) {
149
- return markdown;
150
- }
151
- let slideContent = slides[slideIndex];
152
- const layoutCommentRegex = /<!--\s*layout:\s*[\s\S]*?-->/i;
153
- const newComment = layout && layout.boxes && layout.boxes.length > 0 ? serializeLayoutToComment(layout) : "";
154
- if (layoutCommentRegex.test(slideContent)) {
155
- if (newComment) {
156
- slideContent = slideContent.replace(layoutCommentRegex, newComment);
157
- } else {
158
- slideContent = slideContent.replace(layoutCommentRegex, "").trim();
159
- }
160
- } else if (newComment) {
161
- const trimmed = slideContent.trimStart();
162
- slideContent = `${newComment}
163
-
164
- ${trimmed}`;
165
- }
166
- slides[slideIndex] = slideContent;
167
- const joinedSlides = slides.join("\n---\n");
168
- if (frontmatter) {
169
- return `${frontmatter}
170
-
171
- ${joinedSlides}`;
172
- }
173
- return joinedSlides;
174
- }
175
- function updateSlideTextInMarkdown(markdown, slideIndex, oldText, newText) {
176
- const { frontmatter, slides } = splitMarkdownSlides(markdown);
177
- if (slideIndex < 0 || slideIndex >= slides.length) {
178
- return markdown;
179
- }
180
- const cleanOld = oldText.trim();
181
- const cleanNew = newText.trim();
182
- if (!cleanOld || cleanOld === cleanNew) return markdown;
183
- let slideContent = slides[slideIndex];
184
- if (slideContent.includes(cleanOld)) {
185
- slideContent = slideContent.replace(cleanOld, cleanNew);
186
- } else {
187
- const lines = slideContent.split("\n");
188
- let replaced = false;
189
- for (let i = 0; i < lines.length; i++) {
190
- const line = lines[i];
191
- const stripped = line.replace(/^[#\s\-\*\>]+/, "").replace(/[*_`]/g, "").trim();
192
- if (stripped === cleanOld) {
193
- const prefixMatch = line.match(/^([#\s\-\*\>]+)/);
194
- const prefix = prefixMatch ? prefixMatch[1] : "";
195
- lines[i] = `${prefix}${cleanNew}`;
196
- replaced = true;
197
- break;
198
- }
199
- }
200
- if (replaced) {
201
- slideContent = lines.join("\n");
202
- } else {
203
- const escaped = cleanOld.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
204
- const regex = new RegExp(escaped, "i");
205
- if (regex.test(slideContent)) {
206
- slideContent = slideContent.replace(regex, cleanNew);
207
- } else {
208
- const words = cleanOld.split(/\s+/).filter((w) => w.length > 2);
209
- if (words.length > 0) {
210
- const pattern = words.map((w) => w.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("[\\s\\S]*?");
211
- const fuzzyRegex = new RegExp(pattern, "i");
212
- if (fuzzyRegex.test(slideContent)) {
213
- slideContent = slideContent.replace(fuzzyRegex, cleanNew);
214
- }
215
- }
216
- }
217
- }
218
- }
219
- slides[slideIndex] = slideContent;
220
- const joinedSlides = slides.join("\n---\n");
221
- if (frontmatter) {
222
- return `${frontmatter}
223
-
224
- ${joinedSlides}`;
225
- }
226
- return joinedSlides;
227
- }
228
- function removeSlideElementFromMarkdown(markdown, slideIndex, options) {
229
- const { frontmatter, slides } = splitMarkdownSlides(markdown);
230
- if (slideIndex < 0 || slideIndex >= slides.length) {
231
- return markdown;
232
- }
233
- let slideContent = slides[slideIndex];
234
- const cleanContent = options.content?.trim();
235
- if (cleanContent) {
236
- const lines = slideContent.split("\n");
237
- let removed = false;
238
- const updatedLines = lines.filter((line) => {
239
- if (removed) return true;
240
- const stripped = line.replace(/^[#\s\-\*\>]+/, "").replace(/[*_`]/g, "").trim();
241
- if (stripped === cleanContent || line.includes(cleanContent)) {
242
- removed = true;
243
- return false;
244
- }
245
- return true;
246
- });
247
- if (removed) {
248
- slideContent = updatedLines.join("\n");
249
- }
250
- }
251
- const layoutCommentRegex = /<!--\s*layout:\s*([\s\S]*?)-->/i;
252
- const match = slideContent.match(layoutCommentRegex);
253
- if (match && match[1]) {
254
- try {
255
- const parsed = yaml.load(match[1]);
256
- if (parsed && Array.isArray(parsed.boxes)) {
257
- const remainingBoxes = parsed.boxes.filter((b) => {
258
- if (options.boxId && b.id === options.boxId) return false;
259
- if (options.target && b.target === options.target) return false;
260
- return true;
261
- });
262
- if (remainingBoxes.length > 0) {
263
- const yamlStr = yaml.dump({ boxes: remainingBoxes }, { indent: 2, lineWidth: -1, noRefs: true }).trim();
264
- slideContent = slideContent.replace(layoutCommentRegex, `<!-- layout:
265
- ${yamlStr.split("\n").join("\n ")}
266
- -->`);
267
- } else {
268
- slideContent = slideContent.replace(layoutCommentRegex, "").trim();
269
- }
270
- }
271
- } catch {
272
- }
273
- }
274
- slides[slideIndex] = slideContent;
275
- const joinedSlides = slides.join("\n---\n");
276
- if (frontmatter) {
277
- return `${frontmatter}
278
-
279
- ${joinedSlides}`;
280
- }
281
- return joinedSlides;
282
- }
283
-
284
- // src/core/layout/presets.ts
285
- var SLIDE_LAYOUT_PRESETS = [
286
- {
287
- id: "title-hero",
288
- name: "Title & Speaker Cover",
289
- category: "cover",
290
- description: "High-impact opening slide with large title, subtitle, and speaker credentials.",
291
- layout: {
292
- boxes: [
293
- {
294
- id: "title",
295
- target: "h1",
296
- pos: [100, 180, 1080, 140],
297
- fontSize: "3rem",
298
- textAlign: "center"
299
- },
300
- {
301
- id: "subtitle",
302
- target: "h3",
303
- pos: [100, 350, 1080, 70],
304
- fontSize: "1.5rem",
305
- textAlign: "center"
306
- },
307
- {
308
- id: "speaker-meta",
309
- target: "p",
310
- pos: [100, 460, 1080, 80],
311
- fontSize: "1.1rem",
312
- textAlign: "center"
313
- }
314
- ]
315
- },
316
- markdownSnippet: `<!-- layout:
317
- boxes:
318
- - id: title
319
- target: h1
320
- pos: [100, 180, 1080, 140]
321
- fontSize: 3rem
322
- textAlign: center
323
- - id: subtitle
324
- target: h3
325
- pos: [100, 350, 1080, 70]
326
- fontSize: 1.5rem
327
- textAlign: center
328
- - id: speaker-meta
329
- target: p
330
- pos: [100, 460, 1080, 80]
331
- fontSize: 1.1rem
332
- textAlign: center
333
- -->
334
-
335
- # \u{1F680} Engineering Scalable Cloud Systems
336
- ### Principles, Bottlenecks, and Real-World Architecture Patterns
337
-
338
- **Presenter:** Senior Systems Architect | **Duration:** 45 mins | **Level:** Intermediate
339
-
340
- <!--
341
- Presenter Notes:
342
- - Welcome the audience and outline today's primary engineering goals.
343
- - Spark curiosity with an opening hook about scaling under high concurrency.
344
- -->`
345
- },
346
- {
347
- id: "two-column-split",
348
- name: "Two-Column Comparison",
349
- category: "split",
350
- description: "Balanced side-by-side comparison for legacy vs modern patterns or pros vs cons.",
351
- layout: {
352
- boxes: [
353
- {
354
- id: "heading",
355
- target: "h2",
356
- pos: [80, 50, 1120, 70],
357
- fontSize: "2rem"
358
- },
359
- {
360
- id: "col-left",
361
- target: ".columns-2 > div:first-child",
362
- pos: [80, 150, 530, 510]
363
- },
364
- {
365
- id: "col-right",
366
- target: ".columns-2 > div:last-child",
367
- pos: [670, 150, 530, 510]
368
- }
369
- ]
370
- },
371
- markdownSnippet: `<!-- layout:
372
- boxes:
373
- - id: heading
374
- target: h2
375
- pos: [80, 50, 1120, 70]
376
- fontSize: 2rem
377
- - id: col-left
378
- target: '.columns-2 > div:first-child'
379
- pos: [80, 150, 530, 510]
380
- - id: col-right
381
- target: '.columns-2 > div:last-child'
382
- pos: [670, 150, 530, 510]
383
- -->
384
-
385
- ## \u2696\uFE0F Monolithic Polling vs Event-Driven Architecture
386
-
387
- <div class="columns-2">
388
- <div>
389
-
390
- ### \u{1F534} Legacy Polling
391
- - Heavy database CPU overhead on idle cycles
392
- - High network latency between updates
393
- - Prone to cascading timeouts during spikes
394
-
395
- </div>
396
- <div>
397
-
398
- ### \u{1F7E2} Event-Driven Streams
399
- - Real-time event propagation via webhooks
400
- - Zero idle compute waste with serverless consumers
401
- - Automatic backpressure and queue isolation
402
-
403
- </div>
404
- </div>
405
-
406
- <!--
407
- Presenter Notes:
408
- - Emphasize the core failure mode of periodic polling under sudden load spikes.
409
- - Ask the room if anyone has experienced database lockups caused by polling loops.
410
- -->`
411
- },
412
- {
413
- id: "code-explainer",
414
- name: "Code Walkthrough & Analysis",
415
- category: "code",
416
- description: "Syntax-highlighted code block on the left with step-by-step key annotations on the right.",
417
- layout: {
418
- boxes: [
419
- {
420
- id: "heading",
421
- target: "h2",
422
- pos: [80, 45, 1120, 65],
423
- fontSize: "1.9rem"
424
- },
425
- {
426
- id: "code-box",
427
- target: ".columns-2 > div:first-child",
428
- pos: [80, 135, 630, 535]
429
- },
430
- {
431
- id: "notes-box",
432
- target: ".columns-2 > div:last-child",
433
- pos: [740, 135, 460, 535]
434
- }
435
- ]
436
- },
437
- markdownSnippet: `<!-- layout:
438
- boxes:
439
- - id: heading
440
- target: h2
441
- pos: [80, 45, 1120, 65]
442
- fontSize: 1.9rem
443
- - id: code-box
444
- target: '.columns-2 > div:first-child'
445
- pos: [80, 135, 630, 535]
446
- - id: notes-box
447
- target: '.columns-2 > div:last-child'
448
- pos: [740, 135, 460, 535]
449
- -->
450
-
451
- ## \u{1F4BB} Robust Async Transaction Pipeline
452
-
453
- <div class="columns-2">
454
- <div>
455
-
456
- \`\`\`ts
457
- // Process payment with idempotency guarantee
458
- export async function processPayment(order: Order) {
459
- const isValid = await validateOrder(order);
460
- if (!isValid) throw new Error("ValidationFailed");
461
-
462
- const receipt = await chargeCard(order);
463
- return sendConfirmation(receipt);
464
- }
465
- \`\`\`
466
-
467
- </div>
468
- <div>
469
-
470
- ### \u{1F50D} Key Engineering Invariants:
471
- 1. **Early Guard Clause:** Validates payload immediately at line 3 before triggering external calls.
472
- 2. **Deterministic Sequence:** Enforces strict order of operations using native \`await\`.
473
- 3. **Audit Trail:** Returns immutable payment receipt upon successful execution.
474
-
475
- </div>
476
- </div>
477
-
478
- <!--
479
- Presenter Notes:
480
- - Walk through lines 1 to 7 sequentially.
481
- - Cold-call check: "What happens if line 6 throws a network timeout?"
482
- - Cognitive scaffolding: Highlight the importance of idempotency keys in payment APIs.
483
- -->`
484
- },
485
- {
486
- id: "metrics-3-card",
487
- name: "3-Metric Key Results Grid",
488
- category: "metrics",
489
- description: "Three high-visibility KPI stat cards for benchmarks, impact, and success criteria.",
490
- layout: {
491
- boxes: [
492
- {
493
- id: "heading",
494
- target: "h2",
495
- pos: [80, 50, 1120, 70],
496
- fontSize: "2rem",
497
- textAlign: "center"
498
- },
499
- {
500
- id: "metric-1",
501
- target: ".columns-3 > div:nth-child(1)",
502
- pos: [80, 165, 340, 485]
503
- },
504
- {
505
- id: "metric-2",
506
- target: ".columns-3 > div:nth-child(2)",
507
- pos: [470, 165, 340, 485]
508
- },
509
- {
510
- id: "metric-3",
511
- target: ".columns-3 > div:nth-child(3)",
512
- pos: [860, 165, 340, 485]
513
- }
514
- ]
515
- },
516
- markdownSnippet: `<!-- layout:
517
- boxes:
518
- - id: heading
519
- target: h2
520
- pos: [80, 50, 1120, 70]
521
- fontSize: 2rem
522
- textAlign: center
523
- - id: metric-1
524
- target: '.columns-3 > div:nth-child(1)'
525
- pos: [80, 165, 340, 485]
526
- - id: metric-2
527
- target: '.columns-3 > div:nth-child(2)'
528
- pos: [470, 165, 340, 485]
529
- - id: metric-3
530
- target: '.columns-3 > div:nth-child(3)'
531
- pos: [860, 165, 340, 485]
532
- -->
533
-
534
- ## \u{1F4CA} Performance & Reliability Benchmarks
535
-
536
- <div class="columns-3">
537
- <div>
538
-
539
- # \u26A1 99.99%
540
- ### SLA Availability
541
- High-availability multi-region cluster with automated failover routing.
542
-
543
- </div>
544
- <div>
545
-
546
- # \u{1F680} 15ms
547
- ### P99 Latency
548
- Sub-20ms roundtrip response time via distributed edge caching.
549
-
550
- </div>
551
- <div>
552
-
553
- # \u{1F6E1}\uFE0F Zero
554
- ### Unhandled Breaches
555
- Full SOC2 Type II compliance and end-to-end payload encryption.
556
-
557
- </div>
558
- </div>
559
-
560
- <!--
561
- Presenter Notes:
562
- - Highlight the 15ms P99 latency target as the primary technical milestone.
563
- - Connect these metrics directly to the architecture decisions discussed next.
564
- -->`
565
- },
566
- {
567
- id: "process-flow",
568
- name: "Architecture & Process Flow",
569
- category: "diagram",
570
- description: "Multi-stage workflow with responsive Mermaid diagram and phase summaries.",
571
- layout: {
572
- boxes: [
573
- {
574
- id: "heading",
575
- target: "h2",
576
- pos: [80, 45, 1120, 65],
577
- fontSize: "1.9rem"
578
- },
579
- {
580
- id: "diagram-box",
581
- target: "pre.mermaid, .mermaid",
582
- pos: [80, 130, 1120, 310]
583
- },
584
- {
585
- id: "summary-box",
586
- target: "ul, p",
587
- pos: [80, 465, 1120, 205]
588
- }
589
- ]
590
- },
591
- markdownSnippet: `<!-- layout:
592
- boxes:
593
- - id: heading
594
- target: h2
595
- pos: [80, 45, 1120, 65]
596
- fontSize: 1.9rem
597
- - id: diagram-box
598
- target: 'pre.mermaid, .mermaid'
599
- pos: [80, 130, 1120, 310]
600
- - id: summary-box
601
- target: 'ul, p'
602
- pos: [80, 465, 1120, 205]
603
- -->
604
-
605
- ## \u{1F504} End-to-End Data Ingestion Pipeline
606
-
607
- \`\`\`mermaid
608
- graph LR
609
- A[1. Client Ingress] --> B[2. API Gateway]
610
- B --> C[3. Auth Verifier]
611
- C --> D[4. Distributed DB]
612
- style A fill:#0284c7,stroke:#38bdf8,stroke-width:2px,color:#fff
613
- style B fill:#1e293b,stroke:#64748b,stroke-width:2px,color:#fff
614
- style C fill:#059669,stroke:#34d399,stroke-width:2px,color:#fff
615
- style D fill:#7c3aed,stroke:#a78bfa,stroke-width:2px,color:#fff
616
- \`\`\`
617
-
618
- - **Ingress & Gateway:** Rate-limits traffic and applies reverse-proxy load balancing.
619
- - **Verification & Storage:** Decodes cryptographic JWT tokens before transactional write commit.
620
-
621
- <!--
622
- Presenter Notes:
623
- - Trace each hop across the diagram from left to right.
624
- - Ask: "Where should rate limiting be applied to prevent DDoS attacks?"
625
- -->`
626
- },
627
- {
628
- id: "quote-highlight",
629
- name: "Core Principle & Quote Highlight",
630
- category: "quote",
631
- description: "Prominent quote callout for fundamental engineering rules or memorable mantras.",
632
- layout: {
633
- boxes: [
634
- {
635
- id: "heading",
636
- target: "h2",
637
- pos: [100, 100, 1080, 80],
638
- fontSize: "2.2rem",
639
- textAlign: "center"
640
- },
641
- {
642
- id: "quote-box",
643
- target: "blockquote",
644
- pos: [140, 230, 1e3, 360],
645
- fontSize: "1.4rem"
646
- }
647
- ]
648
- },
649
- markdownSnippet: `<!-- layout:
650
- boxes:
651
- - id: heading
652
- target: h2
653
- pos: [100, 100, 1080, 80]
654
- fontSize: 2.2rem
655
- textAlign: center
656
- - id: quote-box
657
- target: blockquote
658
- pos: [140, 230, 1000, 360]
659
- fontSize: 1.4rem
660
- -->
661
-
662
- ## \u{1F4A1} Foundational Architecture Principle
663
-
664
- > "Simplicity is prerequisite for reliability. A well-engineered distributed system is one where a new engineer can understand the request flow within their first hour."
665
- >
666
- > \u2014 **Edsger W. Dijkstra**
667
-
668
- <!--
669
- Presenter Notes:
670
- - Pause for 5 seconds of silence to let the quote sink in.
671
- - Ask: "How do our current architectural choices reflect this principle?"
672
- -->`
673
- },
674
- {
675
- id: "quiz-checkpoint",
676
- name: "Interactive Formative Checkpoint",
677
- category: "assessment",
678
- description: "Interactive multiple-choice diagnostic checkpoint with A/B/C/D voting options.",
679
- layout: {
680
- boxes: [
681
- {
682
- id: "heading",
683
- target: "h2",
684
- pos: [80, 45, 1120, 65],
685
- fontSize: "1.9rem"
686
- },
687
- {
688
- id: "question-callout",
689
- target: "blockquote",
690
- pos: [80, 130, 1120, 110],
691
- fontSize: "1.2rem"
692
- },
693
- {
694
- id: "options-list",
695
- target: "ul",
696
- pos: [80, 260, 1120, 390],
697
- fontSize: "1.15rem"
698
- }
699
- ]
700
- },
701
- markdownSnippet: `<!-- layout:
702
- boxes:
703
- - id: heading
704
- target: h2
705
- pos: [80, 45, 1120, 65]
706
- fontSize: 1.9rem
707
- - id: question-callout
708
- target: blockquote
709
- pos: [80, 130, 1120, 110]
710
- fontSize: 1.2rem
711
- - id: options-list
712
- target: ul
713
- pos: [80, 260, 1120, 390]
714
- fontSize: 1.15rem
715
- -->
716
-
717
- ## \u{1F3AF} Formative Checkpoint: Verify Your Understanding
718
-
719
- > **Question:** In an event-driven architecture, which pattern guarantees that messages are never permanently lost if a downstream consumer crashes?
720
-
721
- - **A.** Direct HTTP POST call with a short 2-second timeout
722
- - **B.** Persistent Message Broker with Dead-Letter Queue (DLQ) & retry policy
723
- - **C.** In-memory client RAM cache without disk persistence
724
- - **D.** Discarding failed packets and prompting the user to re-submit
725
-
726
- <!--
727
- Presenter Notes:
728
- - Give students 30 seconds to vote on option A, B, C, or D.
729
- - Correct answer: B.
730
- - Explain why options A and C introduce catastrophic data loss in production.
731
- -->`
732
- },
733
- {
734
- id: "tiered-practice-3cards",
735
- name: "Tiered Differentiation (Bronze / Silver / Gold)",
736
- category: "content",
737
- description: "Three progressive competency tiers allowing self-paced learning acceleration.",
738
- layout: {
739
- boxes: [
740
- {
741
- id: "heading",
742
- target: "h2",
743
- pos: [80, 45, 1120, 65],
744
- fontSize: "1.9rem"
745
- },
746
- {
747
- id: "tier-bronze",
748
- target: ".columns-3 > div:nth-child(1)",
749
- pos: [80, 140, 350, 520]
750
- },
751
- {
752
- id: "tier-silver",
753
- target: ".columns-3 > div:nth-child(2)",
754
- pos: [465, 140, 350, 520]
755
- },
756
- {
757
- id: "tier-gold",
758
- target: ".columns-3 > div:nth-child(3)",
759
- pos: [850, 140, 350, 520]
760
- }
761
- ]
762
- },
763
- markdownSnippet: `<!-- layout:
764
- boxes:
765
- - id: heading
766
- target: h2
767
- pos: [80, 45, 1120, 65]
768
- fontSize: 1.9rem
769
- - id: tier-bronze
770
- target: '.columns-3 > div:nth-child(1)'
771
- pos: [80, 140, 350, 520]
772
- - id: tier-silver
773
- target: '.columns-3 > div:nth-child(2)'
774
- pos: [465, 140, 350, 520]
775
- - id: tier-gold
776
- target: '.columns-3 > div:nth-child(3)'
777
- pos: [850, 140, 350, 520]
778
- -->
779
-
780
- ## \u{1F6E0}\uFE0F Hands-On Challenge: 3-Tier Differentiation
781
-
782
- <div class="columns-3">
783
- <div>
784
-
785
- ### \u{1F949} Bronze Tier
786
- - Implement basic handler logic
787
- - Pass 3 baseline unit tests
788
- - *Goal: Foundational mastery*
789
-
790
- </div>
791
- <div>
792
-
793
- ### \u{1F948} Silver Tier
794
- - Add boundary error handling
795
- - Enforce O(N) memory complexity
796
- - *Goal: Production-ready code*
797
-
798
- </div>
799
- <div>
800
-
801
- ### \u{1F947} Gold Tier
802
- - Design distributed retry queue
803
- - Add 95% automated test coverage
804
- - *Goal: Architectural leadership*
805
-
806
- </div>
807
- </div>
808
-
809
- <!--
810
- Presenter Notes:
811
- - All learners begin at Bronze to establish baseline competency.
812
- - Accelerate self-directed learners to Silver and Gold as they complete each tier.
813
- -->`
814
- },
815
- {
816
- id: "agenda-timeline",
817
- name: "Session Agenda & Milestones",
818
- category: "content",
819
- description: "Structured time-budgeted agenda mapping stages to measurable deliverables.",
820
- layout: {
821
- boxes: [
822
- {
823
- id: "heading",
824
- target: "h2",
825
- pos: [80, 45, 1120, 65],
826
- fontSize: "1.9rem"
827
- },
828
- {
829
- id: "table-box",
830
- target: "table",
831
- pos: [80, 140, 1120, 520]
832
- }
833
- ]
834
- },
835
- markdownSnippet: `<!-- layout:
836
- boxes:
837
- - id: heading
838
- target: h2
839
- pos: [80, 45, 1120, 65]
840
- fontSize: 1.9rem
841
- - id: table-box
842
- target: table
843
- pos: [80, 140, 1120, 520]
844
- -->
845
-
846
- ## \u{1F5FA}\uFE0F Milestone Roadmap & Time Budget
847
-
848
- | Allocated Time | Session Stage | Core Learning Focus | Deliverable Milestone |
849
- |:---:|---|---|---|
850
- | **05 mins** | Warm-Up | Real-World Scenario & Context | Identify system bottleneck |
851
- | **15 mins** | Concept Discovery | Core Architectural Patterns | Deconstruct message queue models |
852
- | **20 mins** | Hands-On Lab | Tiered Code Implementation | Complete Bronze + Silver tasks |
853
- | **05 mins** | Wrap-Up | Formative Checkpoint & Debrief | Consolidate key principles |
854
-
855
- <!--
856
- Presenter Notes:
857
- - Walk through the time budget so students understand expectations and pacing.
858
- -->`
859
- },
860
- {
861
- id: "takeaways-summary",
862
- name: "Key Takeaways & Wrap-up",
863
- category: "content",
864
- description: "Three memorable synthesis takeaways with actionable next steps.",
865
- layout: {
866
- boxes: [
867
- {
868
- id: "heading",
869
- target: "h2",
870
- pos: [80, 50, 1120, 70],
871
- fontSize: "2rem"
872
- },
873
- {
874
- id: "list-box",
875
- target: "ol",
876
- pos: [80, 150, 1120, 340],
877
- fontSize: "1.25rem"
878
- },
879
- {
880
- id: "callout-next",
881
- target: "blockquote",
882
- pos: [80, 520, 1120, 140],
883
- fontSize: "1.1rem"
884
- }
885
- ]
886
- },
887
- markdownSnippet: `<!-- layout:
888
- boxes:
889
- - id: heading
890
- target: h2
891
- pos: [80, 50, 1120, 70]
892
- fontSize: 2rem
893
- - id: list-box
894
- target: ol
895
- pos: [80, 150, 1120, 340]
896
- fontSize: 1.25rem
897
- - id: callout-next
898
- target: blockquote
899
- pos: [80, 520, 1120, 140]
900
- fontSize: 1.1rem
901
- -->
902
-
903
- ## \u{1F3C1} Key Takeaways & Action Items
904
-
905
- 1. **Decouple Before Scaling:** Separate producer rate from consumer processing capacity.
906
- 2. **Design for Failure:** Always configure retries, backoff intervals, and dead-letter queues.
907
- 3. **Measure End-to-End:** Track P99 latency and error rates across all distributed boundaries.
908
-
909
- > \u{1F4DD} **Next Action Item:** Complete the Silver Tier refactoring challenge before our next peer-review session.
910
-
911
- <!--
912
- Presenter Notes:
913
- - Deliver a crisp 2-minute wrap-up reinforcing the 3 core takeaways.
914
- - Acknowledge strong peer collaboration during the hands-on lab.
915
- -->`
916
- }
917
- ];
918
- function getSlideLayoutPresetById(id) {
919
- return SLIDE_LAYOUT_PRESETS.find((p) => p.id === id);
920
- }
921
- function getSlideLayoutPresetsByCategory(category) {
922
- return SLIDE_LAYOUT_PRESETS.filter((p) => p.category === category);
923
- }
924
77
 
925
78
  // src/html-engine/themes.ts
926
79
  var HTML_THEMES = {
@@ -1347,6 +500,133 @@ var HTML_SLIDE_PRESETS = {
1347
500
  }
1348
501
  };
1349
502
 
503
+ // src/html-engine/utilities.ts
504
+ var FONT_SIZES = [
505
+ // class, var, fallback px, line-height
506
+ ["xs", "--font-size-xs", "14px", "1.4"],
507
+ ["sm", "--font-size-sm", "16px", "1.45"],
508
+ ["base", "--font-size-base", "18px", "1.5"],
509
+ ["lg", "--font-size-lg", "20px", "1.5"],
510
+ ["xl", "--font-size-xl", "22px", "1.5"],
511
+ ["2xl", "--font-size-2xl", "26px", "1.4"],
512
+ ["3xl", "--font-size-3xl", "32px", "1.3"],
513
+ ["4xl", "--font-size-4xl", "38px", "1.25"],
514
+ ["6xl", "--font-size-6xl", "58px", "1.15"],
515
+ ["8xl", "--font-size-8xl", "96px", "1.05"]
516
+ ];
517
+ var SPACING = {
518
+ "0.5": "0.125rem",
519
+ "1": "0.25rem",
520
+ "1.5": "0.375rem",
521
+ "2": "0.5rem",
522
+ "2.5": "0.625rem",
523
+ "3": "0.75rem",
524
+ "4": "1rem",
525
+ "5": "1.25rem",
526
+ "6": "1.5rem",
527
+ "7": "1.75rem",
528
+ "8": "2rem",
529
+ "10": "2.5rem",
530
+ "12": "3rem",
531
+ "16": "4rem",
532
+ "20": "5rem",
533
+ "24": "6rem"
534
+ };
535
+ function sp(value) {
536
+ return `calc(${SPACING[value]} * var(--scale-spacing-eff, 1))`;
537
+ }
538
+ function fontSizeRules() {
539
+ return FONT_SIZES.map(
540
+ ([cls, cssVar, fallback, lh]) => `.text-${cls}{font-size:var(${cssVar}, ${fallback});line-height:${lh}}`
541
+ ).join("\n");
542
+ }
543
+ function spacingRules() {
544
+ const out = [];
545
+ for (const value of Object.keys(SPACING)) {
546
+ out.push(`.p-${value}{padding:${sp(value)}}`);
547
+ out.push(`.px-${value}{padding-left:${sp(value)};padding-right:${sp(value)}}`);
548
+ out.push(`.py-${value}{padding-top:${sp(value)};padding-bottom:${sp(value)}}`);
549
+ out.push(`.pt-${value}{padding-top:${sp(value)}}`);
550
+ out.push(`.pb-${value}{padding-bottom:${sp(value)}}`);
551
+ out.push(`.mt-${value}{margin-top:${sp(value)}}`);
552
+ out.push(`.mb-${value}{margin-bottom:${sp(value)}}`);
553
+ out.push(`.my-${value}{margin-top:${sp(value)};margin-bottom:${sp(value)}`);
554
+ out.push(`.gap-${value}{gap:${sp(value)}}`);
555
+ }
556
+ return out.join("\n");
557
+ }
558
+ function sizeRules() {
559
+ const out = [];
560
+ for (const value of Object.keys(SPACING)) {
561
+ out.push(`.w-${value}{width:${sp(value)}}`);
562
+ out.push(`.h-${value}{height:${sp(value)}}`);
563
+ }
564
+ return out.join("\n");
565
+ }
566
+ var SLIDE_UTILITY_CSS = `
567
+ /* preflight \u2014 the presets were authored against Tailwind's reset (no default
568
+ margins, no list markers, border-box everywhere), so it has to come along. */
569
+ .slide-page *,.slide-page *::before,.slide-page *::after{box-sizing:border-box;border-width:0;border-style:solid}
570
+ .slide-page h1,.slide-page h2,.slide-page h3,.slide-page h4,.slide-page h5,.slide-page h6,
571
+ .slide-page p,.slide-page ul,.slide-page ol,.slide-page li,.slide-page figure,.slide-page blockquote,
572
+ .slide-page pre,.slide-page dl,.slide-page dd{margin:0;padding:0}
573
+ .slide-page ul,.slide-page ol{list-style:none}
574
+ .slide-page img,.slide-page svg,.slide-page video{display:block;max-width:100%}
575
+ .slide-page button{font:inherit;background:none;border:0;cursor:pointer;color:inherit}
576
+ .slide-page table{border-collapse:collapse}
577
+ .slide-page a{color:inherit;text-decoration:inherit}
578
+ /* layout */
579
+ .flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.inline-block{display:inline-block}
580
+ .flex-col{flex-direction:column}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.shrink-0{flex-shrink:0}
581
+ .grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}
582
+ .grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}
583
+ .grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}
584
+ .col-span-5{grid-column:span 5/span 5}.col-span-7{grid-column:span 7/span 7}
585
+ .items-start{align-items:flex-start}.items-center{align-items:center}.items-stretch{align-items:stretch}
586
+ .justify-center{justify-content:center}.justify-between{justify-content:space-between}
587
+ .relative{position:relative}.overflow-hidden{overflow:hidden}.z-10{z-index:10}
588
+ .h-full{height:100%}.w-full{width:100%}.min-h-0{min-height:0}.my-auto{margin-top:auto;margin-bottom:auto}
589
+ .text-center{text-align:center}
590
+ /* typography */
591
+ .font-medium{font-weight:500}.font-semibold{font-weight:600}.font-bold{font-weight:700}
592
+ .font-extrabold{font-weight:800}.font-black{font-weight:900}.font-mono{font-family:var(--font-code)}
593
+ .tracking-tighter{letter-spacing:-0.05em}.tracking-tight{letter-spacing:-0.025em}
594
+ .tracking-wider{letter-spacing:0.05em}.tracking-widest{letter-spacing:0.1em}
595
+ .uppercase{text-transform:uppercase}
596
+ .leading-tight{line-height:1.25}.leading-snug{line-height:1.375}.leading-relaxed{line-height:1.625}
597
+ .max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}
598
+ ${fontSizeRules()}
599
+ /* spacing (scaled by the density editor) */
600
+ ${spacingRules()}
601
+ ${sizeRules()}
602
+ .space-y-3 > * + *{margin-top:${sp("3")}}
603
+ .space-y-4 > * + *{margin-top:${sp("4")}}
604
+ .space-y-6 > * + *{margin-top:${sp("6")}}
605
+ /* surfaces & color (theme-variable driven) */
606
+ .rounded{border-radius:0.25rem}.rounded-xl{border-radius:0.75rem}.rounded-full{border-radius:9999px}
607
+ .border{border-width:1px;border-style:solid;border-color:var(--border)}
608
+ .border-t{border-top-width:1px;border-top-style:solid;border-top-color:var(--border)}
609
+ .border-b{border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:var(--border)}
610
+ .border-current{border-color:currentColor}
611
+ .shadow{box-shadow:0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.08)}
612
+ .shadow-sm{box-shadow:0 1px 2px rgba(0,0,0,.08)}
613
+ .shadow-lg{box-shadow:0 10px 15px -3px rgba(0,0,0,.15),0 4px 6px -4px rgba(0,0,0,.1)}
614
+ .opacity-60{opacity:.6}.opacity-65{opacity:.65}.opacity-75{opacity:.75}
615
+ .opacity-80{opacity:.8}.opacity-85{opacity:.85}.opacity-90{opacity:.9}
616
+ .bg-red-500\\/70{background-color:rgba(239,68,68,.7)}
617
+ .bg-yellow-500\\/70{background-color:rgba(234,179,8,.7)}
618
+ .bg-green-500\\/70{background-color:rgba(34,197,94,.7)}
619
+ /* theme color utilities (previously provided by tailwind.config extend) */
620
+ .text-primary{color:var(--primary)}.text-muted{color:var(--text-muted)}.text-themeText{color:var(--text)}
621
+ .bg-themeBg{background-color:var(--bg)}.bg-themeBgSecondary{background-color:var(--bg-secondary)}
622
+ .bg-themePrimary{background-color:var(--primary)}.border-themeBorder{border-color:var(--border)}
623
+ `.trim();
624
+ function listUtilityClasses() {
625
+ return Array.from(SLIDE_UTILITY_CSS.matchAll(/\.([a-zA-Z0-9\\/_.-]+)(?=[{,: >])/g)).map(
626
+ (m) => m[1].replace(/\\\//g, "/")
627
+ );
628
+ }
629
+
1350
630
  // src/html-engine/shell.ts
1351
631
  function generateHtmlShell(options) {
1352
632
  const { title, theme, slidesHtml, slideCount, customHeadTags = "", deckId = "" } = options;
@@ -1358,12 +638,16 @@ function generateHtmlShell(options) {
1358
638
  <title>${title}</title>
1359
639
 
1360
640
  <!-- Fonts -->
641
+ <!-- DECK_FONT_BLOCK_START -->${options?.fontFaceCss ? `
642
+ <style>
643
+ ${options.fontFaceCss}
644
+ </style>` : `
1361
645
  <link rel="preconnect" href="https://fonts.googleapis.com">
1362
646
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
1363
- <link href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&family=Plus+Jakarta+Sans:wght@500;700;800&family=Space+Grotesk:wght@500;700&display=swap" rel="stylesheet">
647
+ <link href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&family=Plus+Jakarta+Sans:wght@500;700;800&family=Space+Grotesk:wght@500;700&display=swap" rel="stylesheet">`}<!-- DECK_FONT_BLOCK_END -->
1364
648
 
1365
- <!-- Core Presentation Styling & 1920x1080 Scaled Tailwind Configuration -->
1366
- <script src="https://cdn.tailwindcss.com"></script>
649
+ <!-- Core Presentation Styling & 1920x1080 Scaled Layout Utilities (inlined) -->
650
+ <style>${SLIDE_UTILITY_CSS}</style>
1367
651
  <script>
1368
652
  window.tailwind = window.tailwind || {};
1369
653
  tailwind.config = {
@@ -1513,6 +797,59 @@ function generateHtmlShell(options) {
1513
797
  opacity: 1;
1514
798
  }
1515
799
 
800
+ /* \u2500\u2500 Bespoke (authored) slides \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
801
+ The frontend-slides mode hands the model the whole slide surface, so the
802
+ shell owns only what must stay invariant: full-stage sizing, border-box
803
+ maths, theme type defaults, and one orchestrated entrance. */
804
+ .bespoke-slide {
805
+ position: relative;
806
+ width: 100%;
807
+ height: 100%;
808
+ overflow: hidden;
809
+ }
810
+
811
+ .bespoke-slide,
812
+ .bespoke-slide *,
813
+ .bespoke-slide *::before,
814
+ .bespoke-slide *::after {
815
+ box-sizing: border-box;
816
+ }
817
+
818
+ .bespoke-slide h1,
819
+ .bespoke-slide h2 {
820
+ font-family: var(--font-display);
821
+ letter-spacing: -0.02em;
822
+ }
823
+
824
+ .bespoke-slide img,
825
+ .bespoke-slide svg {
826
+ max-width: 100%;
827
+ height: auto;
828
+ }
829
+
830
+ .slide-page.active .bespoke-slide > * {
831
+ animation: bespokeReveal 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
832
+ }
833
+
834
+ .slide-page.active .bespoke-slide > *:nth-child(2) { animation-delay: 0.08s; }
835
+ .slide-page.active .bespoke-slide > *:nth-child(3) { animation-delay: 0.16s; }
836
+ .slide-page.active .bespoke-slide > *:nth-child(4) { animation-delay: 0.24s; }
837
+ .slide-page.active .bespoke-slide > *:nth-child(5) { animation-delay: 0.32s; }
838
+ .slide-page.active .bespoke-slide > *:nth-child(n + 6) { animation-delay: 0.4s; }
839
+
840
+ @keyframes bespokeReveal {
841
+ from { opacity: 0; transform: translateY(14px); }
842
+ to { opacity: 1; transform: none; }
843
+ }
844
+
845
+ @media (prefers-reduced-motion: reduce) {
846
+ .slide-page.active .bespoke-slide > * {
847
+ animation: none;
848
+ opacity: 1;
849
+ transform: none;
850
+ }
851
+ }
852
+
1516
853
  /* Top Progress Bar */
1517
854
  #progress-bar {
1518
855
  position: absolute;
@@ -3655,6 +2992,85 @@ main();`;
3655
2992
  return slots;
3656
2993
  }
3657
2994
 
2995
+ // src/html-engine/sanitize.ts
2996
+ var CONTAINER_TAGS = ["script", "iframe", "object", "embed", "applet", "form", "button", "textarea", "select", "template"];
2997
+ var VOID_TAGS = ["link", "meta", "base", "input"];
2998
+ var CONTAINER_ELEMENT_RE = new RegExp(
2999
+ `<(${CONTAINER_TAGS.join("|")})\\b[\\s\\S]*?<\\/\\1\\s*>`,
3000
+ "gi"
3001
+ );
3002
+ var STRAY_TAG_RE = new RegExp(`<\\/?(?:${[...CONTAINER_TAGS, ...VOID_TAGS].join("|")})\\b[^>]*>`, "gi");
3003
+ var EVENT_ATTR_RE = /\s+on[a-z]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi;
3004
+ var EXTERNAL_URL_RE = /^(?:https?:)?\/\//i;
3005
+ var CSS_URL_RE = /url\(\s*(?:"([^"]*)"|'([^']*)'|([^)'"\s]*))\s*\)/gi;
3006
+ var CSS_IMPORT_RE = /@import[^;]+;/gi;
3007
+ function isOffBoxUrl(url) {
3008
+ const value = url.trim();
3009
+ if (!value) return false;
3010
+ return EXTERNAL_URL_RE.test(value) || /^javascript:/i.test(value) || /^data:(?!image\/)/i.test(value);
3011
+ }
3012
+ function sanitizeSlideHtml(raw) {
3013
+ const removed = [];
3014
+ let html = String(raw ?? "");
3015
+ html = html.replace(CONTAINER_ELEMENT_RE, (_match, tag) => {
3016
+ removed.push(`<${String(tag).toLowerCase()}>`);
3017
+ return "";
3018
+ });
3019
+ html = html.replace(STRAY_TAG_RE, (match) => {
3020
+ const tag = (match.match(/^<\/?\s*([a-z]+)/i) || [])[1]?.toLowerCase();
3021
+ if (tag) removed.push(`<${tag}>`);
3022
+ return "";
3023
+ });
3024
+ const beforeEvents = html.length;
3025
+ html = html.replace(EVENT_ATTR_RE, "");
3026
+ if (html.length !== beforeEvents) removed.push("inline event handler");
3027
+ html = html.replace(CSS_URL_RE, (match, dq, sq, bare) => {
3028
+ if (!isOffBoxUrl(String(dq ?? sq ?? bare ?? ""))) return match;
3029
+ removed.push("external url()");
3030
+ return "none";
3031
+ });
3032
+ const beforeImports = html.length;
3033
+ html = html.replace(CSS_IMPORT_RE, "");
3034
+ if (html.length !== beforeImports) removed.push("@import");
3035
+ html = html.replace(/\s+(href|src|srcset|poster)\s*=\s*("([^"]*)"|'([^']*)')/gi, (match, attr, _q, dq, sq) => {
3036
+ const value = String(dq ?? sq ?? "").trim();
3037
+ if (!isOffBoxUrl(value)) return match;
3038
+ removed.push(`${attr}="${value.slice(0, 60)}"`);
3039
+ return "";
3040
+ });
3041
+ return { html: html.trim(), removed: Array.from(new Set(removed)) };
3042
+ }
3043
+ function validateBespokeSlideHtml(raw, contract = {}) {
3044
+ const maxChars = contract.maxChars ?? 16e3;
3045
+ const minChars = contract.minChars ?? 120;
3046
+ const issues = [];
3047
+ const html = String(raw ?? "").trim();
3048
+ if (!html) return { valid: false, issues: ["slide html is empty"] };
3049
+ if (html.length > maxChars) issues.push(`slide html exceeds ${maxChars} chars (${html.length})`);
3050
+ if (html.replace(/<[^>]*>/g, "").replace(/\s+/g, "").length < minChars) {
3051
+ issues.push("slide has too little text content to teach anything");
3052
+ }
3053
+ if (!/<h[12]\b/i.test(html)) {
3054
+ issues.push("slide has no <h1>/<h2> \u2014 typographic hierarchy is required");
3055
+ }
3056
+ const { html: clean, removed } = sanitizeSlideHtml(html);
3057
+ if (removed.length > 0) {
3058
+ issues.push(`slide is not self-contained (stripped: ${removed.join(", ")})`);
3059
+ }
3060
+ if (/<script\b/i.test(clean)) issues.push("slide still contains a script tag after sanitizing");
3061
+ if (/\b(todo|tbd|lorem ipsum|<code>)\b/i.test(clean) && !/<pre\b/i.test(clean)) {
3062
+ issues.push("slide contains placeholder text");
3063
+ }
3064
+ if (/<html\b|<body\b|<section\b[^>]*class="[^"]*slide-page/i.test(clean)) {
3065
+ issues.push("slide markup carries deck-level structure (html/body/section.slide-page)");
3066
+ }
3067
+ return { valid: issues.length === 0, issues };
3068
+ }
3069
+ function buildBespokeSlideMarkup(raw) {
3070
+ const { html } = sanitizeSlideHtml(raw);
3071
+ return `<div class="bespoke-slide">${html}</div>`;
3072
+ }
3073
+
3658
3074
  // src/html-engine/compiler.ts
3659
3075
  var SHIKI_LANGS = /* @__PURE__ */ new Set([
3660
3076
  "javascript",
@@ -3705,6 +3121,16 @@ function compileHtmlDeck(deckData, options) {
3705
3121
  const slides = deckData.slides || [];
3706
3122
  const slideCount = Math.max(slides.length, 1);
3707
3123
  const renderedSlides = slides.map((slide, index) => {
3124
+ if (typeof slide.html === "string" && slide.html.trim()) {
3125
+ const notesAttr2 = slide.notes ? ` data-notes="${encodeURIComponent(slide.notes)}"` : "";
3126
+ const customClass2 = slide.customClass ? ` ${slide.customClass}` : "";
3127
+ return `
3128
+ <!-- Slide ${index + 1}: authored html -->
3129
+ <section class="slide-page${customClass2}" data-index="${index}" data-layout="bespoke"${notesAttr2}>
3130
+ ${buildBespokeSlideMarkup(slide.html)}
3131
+ </section>
3132
+ `;
3133
+ }
3708
3134
  const preset = HTML_SLIDE_PRESETS[slide.layoutId] || HTML_SLIDE_PRESETS["hero-cover"];
3709
3135
  const normalizedSlots = normalizeSlideSlots(slide);
3710
3136
  let innerHtml = preset.template(normalizedSlots, theme);
@@ -3765,6 +3191,20 @@ async function compileHtmlDeckAsync(deckData, options) {
3765
3191
  }
3766
3192
  }
3767
3193
 
3768
- export { HTML_SLIDE_PRESETS, HTML_THEMES, SLIDE_LAYOUT_PRESETS, compileHtmlDeck, compileHtmlDeckAsync, generateHtmlShell, getHighlighter, getSlideLayoutPresetById, getSlideLayoutPresetsByCategory, highlightCodeBlocks, highlightDeckCodeBlocks, normalizeSlideSlots, removeSlideElementFromMarkdown, resolveHtmlTheme, serializeLayoutToComment, splitMarkdownSlides, updateSlideLayoutInMarkdown, updateSlideTextInMarkdown };
3769
- //# sourceMappingURL=chunk-JJQDQIRG.js.map
3770
- //# sourceMappingURL=chunk-JJQDQIRG.js.map
3194
+ exports.HTML_SLIDE_PRESETS = HTML_SLIDE_PRESETS;
3195
+ exports.HTML_THEMES = HTML_THEMES;
3196
+ exports.SLIDE_UTILITY_CSS = SLIDE_UTILITY_CSS;
3197
+ exports.buildBespokeSlideMarkup = buildBespokeSlideMarkup;
3198
+ exports.compileHtmlDeck = compileHtmlDeck;
3199
+ exports.compileHtmlDeckAsync = compileHtmlDeckAsync;
3200
+ exports.generateHtmlShell = generateHtmlShell;
3201
+ exports.getHighlighter = getHighlighter;
3202
+ exports.highlightCodeBlocks = highlightCodeBlocks;
3203
+ exports.highlightDeckCodeBlocks = highlightDeckCodeBlocks;
3204
+ exports.listUtilityClasses = listUtilityClasses;
3205
+ exports.normalizeSlideSlots = normalizeSlideSlots;
3206
+ exports.resolveHtmlTheme = resolveHtmlTheme;
3207
+ exports.sanitizeSlideHtml = sanitizeSlideHtml;
3208
+ exports.validateBespokeSlideHtml = validateBespokeSlideHtml;
3209
+ //# sourceMappingURL=chunk-INAOTYLK.cjs.map
3210
+ //# sourceMappingURL=chunk-INAOTYLK.cjs.map