slidetake 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -3
- package/dist/index.html +494 -41
- package/dist/slidetake.js +339 -74
- package/examples/embed.html +4 -1
- package/package.json +5 -2
package/dist/index.html
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Slidetake</title>
|
|
7
|
-
<meta name="description" content="
|
|
7
|
+
<meta name="description" content="Write in markdown. Present on a spatial canvas. Record without timeline editing: retake by slide, and get a frame-exact cut with YouTube chapters. Free and open source.">
|
|
8
8
|
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
|
|
9
9
|
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
|
|
10
10
|
<meta name="theme-color" content="#09090b">
|
|
11
11
|
<meta property="og:type" content="website">
|
|
12
12
|
<meta property="og:site_name" content="Slidetake">
|
|
13
|
-
<meta property="og:title" content="Slidetake: markdown
|
|
14
|
-
<meta property="og:description" content="
|
|
13
|
+
<meta property="og:title" content="Slidetake: write in markdown, record without timeline editing">
|
|
14
|
+
<meta property="og:description" content="Present markdown on a spatial canvas and record it take by take: retake by slide, keep the best attempt, get a frame-exact cut with YouTube chapters.">
|
|
15
15
|
<meta property="og:url" content="https://slidetake.com/">
|
|
16
16
|
<meta property="og:image" content="https://slidetake.com/og.jpg">
|
|
17
17
|
<meta property="og:image:width" content="1200">
|
|
@@ -37,8 +37,9 @@
|
|
|
37
37
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/gsap.min.js"></script>
|
|
38
38
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/12.0.2/marked.min.js"></script>
|
|
39
39
|
<style>
|
|
40
|
-
/*
|
|
41
|
-
|
|
40
|
+
/* Every colour comes from these tokens. Slidetake's own is terminal green: bright on zinc in dark mode,
|
|
41
|
+
deep on white in light mode. A host page passes its own (window.SLIDETAKE.colors) and a deck can carry
|
|
42
|
+
its own (accent: in its top block); see applyColors in app.js. */
|
|
42
43
|
:root{
|
|
43
44
|
--bg:#09090b;
|
|
44
45
|
--grid-dot:#1d1d21;
|
|
@@ -46,14 +47,14 @@
|
|
|
46
47
|
--panel-line:#27272a;
|
|
47
48
|
--node-bg:#18181b;
|
|
48
49
|
--node-border:#323238;
|
|
49
|
-
--accent:#
|
|
50
|
-
--accent-teal:#
|
|
50
|
+
--accent:#4ade80;
|
|
51
|
+
--accent-teal:#86efac; /* headings below h2 */
|
|
51
52
|
--text:#e4e4e7;
|
|
52
53
|
--text-muted:#a1a1aa;
|
|
53
54
|
--danger:#e0645c;
|
|
54
55
|
--code-bg:#0f0f12;
|
|
55
56
|
--overlay:rgba(17,17,19,.9); /* breadcrumbs, nav bar, minimap */
|
|
56
|
-
--on-accent:#
|
|
57
|
+
--on-accent:#052e16; /* text on an accent-filled button */
|
|
57
58
|
--card-shadow:0 6px 24px rgba(0,0,0,.35);
|
|
58
59
|
--brand-shadow:0 1px 6px rgba(0,0,0,.6);
|
|
59
60
|
--mono: 'IBM Plex Mono', ui-monospace, monospace;
|
|
@@ -63,16 +64,18 @@
|
|
|
63
64
|
/* Tokens derived from others are declared on body, not :root: a custom property resolves var() where
|
|
64
65
|
it is declared, so on :root these would freeze the default palette's colours. */
|
|
65
66
|
body{
|
|
66
|
-
--accent-line:#
|
|
67
|
+
--accent-line:#15803d; /* borders and connector lines on the active path */
|
|
67
68
|
--accent-ring:var(--accent); /* the current slide's border, glow and the progress bar */
|
|
68
69
|
--edge:var(--node-border); /* connector lines off the active path */
|
|
70
|
+
--header-bg:none; /* a host's band of colour behind the header (an image layer) */
|
|
71
|
+
--header-ink:var(--text); /* text on that band */
|
|
69
72
|
}
|
|
70
|
-
/* Light mode (L, mode: light, ?mode=light): #
|
|
73
|
+
/* Light mode (L, mode: light, ?mode=light): #15803d carries text (5.0:1 on white); the brighter green
|
|
71
74
|
only rings and lines, which never need to be read. */
|
|
72
75
|
body[data-mode="light"]{
|
|
73
76
|
--bg:#fafaf9; --grid-dot:#e7e5e4; --panel:#ffffff; --panel-line:#e4e4e7;
|
|
74
77
|
--node-bg:#ffffff; --node-border:#e4e4e7; --edge:#d4d4d8;
|
|
75
|
-
--accent:#
|
|
78
|
+
--accent:#15803d; --accent-teal:#166534; --accent-line:#4ade80; --accent-ring:#22c55e;
|
|
76
79
|
--text:#27272a; --text-muted:#71717a; --danger:#c2410c;
|
|
77
80
|
--code-bg:#f4f4f5; --overlay:rgba(255,255,255,.92); --on-accent:#ffffff;
|
|
78
81
|
--card-shadow:0 4px 18px rgba(24,24,27,.08); --brand-shadow:0 1px 4px rgba(255,255,255,.9);
|
|
@@ -98,10 +101,14 @@
|
|
|
98
101
|
min-height:56px;flex:none;
|
|
99
102
|
display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;
|
|
100
103
|
padding:8px 16px;
|
|
101
|
-
background:var(--panel);
|
|
104
|
+
background:var(--header-bg), var(--panel);
|
|
102
105
|
border-bottom:1px solid var(--panel-line);
|
|
103
106
|
z-index:20;
|
|
104
107
|
}
|
|
108
|
+
/* a host's coloured header band: its own ink for the text, buttons and borders on it */
|
|
109
|
+
body.st-header-color header{color:var(--header-ink);border-bottom-color:transparent;
|
|
110
|
+
--text:var(--header-ink);--text-muted:color-mix(in srgb, var(--header-ink) 72%, transparent);
|
|
111
|
+
--node-border:color-mix(in srgb, var(--header-ink) 28%, transparent);}
|
|
105
112
|
.brand{display:flex;align-items:baseline;gap:10px;}
|
|
106
113
|
.brand .mark{font-family:var(--display);font-weight:700;font-size:17px;letter-spacing:.02em;color:inherit;text-decoration:none;display:inline-flex;align-items:center;gap:7px;align-self:center;}
|
|
107
114
|
.brand .mark .logo{width:20px;height:20px;fill:var(--accent);flex:none;}
|
|
@@ -400,6 +407,65 @@
|
|
|
400
407
|
.node .r-hstack{display:flex;flex-direction:row;align-items:center;justify-content:center;}
|
|
401
408
|
.node .r-vstack{display:flex;flex-direction:column;align-items:center;justify-content:center;}
|
|
402
409
|
.node .body img{max-width:100%;height:auto;object-fit:contain;}
|
|
410
|
+
/* ---------- media from plain markdown (see applyMedia) ---------- */
|
|
411
|
+
.node .body figure.media{margin:0;}
|
|
412
|
+
.node .body figure.media img{display:block;width:100%;height:auto;max-height:70vh;object-fit:contain;border-radius:8px;}
|
|
413
|
+
.node .body figure.media figcaption{margin-top:8px;font-size:.82em;color:var(--text-muted);line-height:1.45;}
|
|
414
|
+
.node .body figure.yt .frame{position:relative;width:100%;aspect-ratio:16/9;border-radius:8px;overflow:hidden;background:#000;}
|
|
415
|
+
.node .body figure.yt.portrait .frame{aspect-ratio:9/16;max-height:70vh;width:auto;margin:0 auto;}
|
|
416
|
+
.node .body figure.yt iframe{position:absolute;inset:0;width:100%;height:100%;border:0;}
|
|
417
|
+
/* the video is always on show; its step only plays it */
|
|
418
|
+
.node .fragment.yt-play{opacity:1 !important;visibility:inherit !important;transform:none !important;}
|
|
419
|
+
.node.card-split .body{display:grid;grid-template-columns:minmax(0,1.25fr) minmax(0,1fr);gap:4px 22px;align-items:center;}
|
|
420
|
+
.node.card-split .body > :is(h1,h2,h3,h4,h5,h6){grid-column:1 / -1;}
|
|
421
|
+
.node.card-split .body .split-text > :first-child{margin-top:0;}
|
|
422
|
+
.node.card-split.media-last .body{grid-template-columns:minmax(0,1fr) minmax(0,1.25fr);}
|
|
423
|
+
.node .body .gallery{list-style:none;padding:0;margin:8px 0 0;display:grid;grid-template-columns:repeat(var(--cols,3),minmax(0,1fr));gap:14px;align-items:end;}
|
|
424
|
+
.node .body .gallery li{margin:0;}
|
|
425
|
+
.node .body .gallery figure.media img{max-height:calc(56vh / var(--rows,1));margin:0 auto;}
|
|
426
|
+
.node .body .gallery figure.media figcaption{font-size:.72em;text-align:center;}
|
|
427
|
+
/* a stepped gallery: the images stack in one place and each press brings the next */
|
|
428
|
+
.node .body .gallery.carousel{grid-template-columns:minmax(0,1fr);}
|
|
429
|
+
.node .body .gallery.carousel > li{grid-area:1/1;}
|
|
430
|
+
.node .body .gallery.carousel figure.media img{max-height:58vh;}
|
|
431
|
+
.node .body .gallery.carousel figure.media figcaption{font-size:.82em;}
|
|
432
|
+
.node .body .gallery.carousel figcaption[data-count]::before{content:attr(data-count) " ";color:var(--accent);font-weight:600;white-space:pre;}
|
|
433
|
+
.node .body .gallery.carousel:has(> li.visible) > li:not(.fragment){opacity:0;visibility:hidden;transition:opacity .45s ease, visibility 0s .45s;}
|
|
434
|
+
.node .body .gallery.carousel > li:not(.fragment){transition:opacity .45s ease;}
|
|
435
|
+
/* image cards: an image or carousel alone, laid out by the image's shape (see sizeCard) */
|
|
436
|
+
div.node.card-bleed{padding:0;overflow:hidden;}
|
|
437
|
+
.node.card-bleed .body .gallery{margin:0;}
|
|
438
|
+
.node.card-bleed .body figure.media img,
|
|
439
|
+
.node.card-bleed .body .gallery.carousel figure.media img{max-height:none;border-radius:0;background:var(--code-bg);}
|
|
440
|
+
.node.card-bleed .body figure.media figcaption{margin:0;text-align:left;font-size:.9em;}
|
|
441
|
+
/* landscape: the image spans the card; the heading sits above it, the caption below */
|
|
442
|
+
.node.img-landscape .crumb{margin:12px 18px 4px;}
|
|
443
|
+
.node.img-landscape .body > :is(h1,h2,h3,h4,h5,h6):first-child{margin:0 18px 10px;}
|
|
444
|
+
.node.img-landscape .body figure.media img{width:100%;height:var(--img-h);object-fit:contain;}
|
|
445
|
+
.node.img-landscape .body figure.media figcaption{padding:10px 18px 14px;}
|
|
446
|
+
/* portrait or near-square: the image on the right at the card's height; the heading and caption share the left */
|
|
447
|
+
div.node.img-portrait{height:540px;padding:20px calc(var(--img-w) + 26px) 22px 24px;}
|
|
448
|
+
.node.img-portrait .body{display:flex;flex-direction:column;height:100%;}
|
|
449
|
+
.node.img-portrait .crumb{margin-bottom:10px;}
|
|
450
|
+
.node.img-portrait .body > :is(h1,h2,h3,h4,h5,h6):first-child{font-size:22px;}
|
|
451
|
+
.node.img-portrait .body > .gallery, .node.img-portrait .body > figure.media{margin-top:auto;}
|
|
452
|
+
.node.img-portrait .body figure.media img{position:absolute;top:0;right:0;width:var(--img-w);height:540px;object-fit:contain;}
|
|
453
|
+
.node.img-portrait .body figure.media figcaption, .node.img-portrait .body .gallery.carousel figure.media figcaption{font-size:1.35em;line-height:1.45;color:var(--text);}
|
|
454
|
+
/* 16:9, or a full-screen card: the image fills the card, the heading and caption over it */
|
|
455
|
+
.node.img-overlay::before{content:"";position:absolute;inset:0 0 auto;height:96px;z-index:2;pointer-events:none;
|
|
456
|
+
background:linear-gradient(rgba(0,0,0,.72), rgba(0,0,0,0));border-radius:8px 8px 0 0;}
|
|
457
|
+
.node.img-overlay .crumb{position:absolute;top:12px;left:18px;right:18px;z-index:3;margin:0;color:rgba(255,255,255,.72);}
|
|
458
|
+
.node.img-overlay .body > :is(h1,h2,h3,h4,h5,h6):first-child{position:absolute;top:28px;left:18px;right:18px;z-index:3;margin:0;
|
|
459
|
+
color:#fff;text-shadow:0 1px 6px rgba(0,0,0,.6);}
|
|
460
|
+
.node.img-overlay .body figure.media{position:relative;}
|
|
461
|
+
.node.img-overlay .body figure.media img{width:100%;height:540px;object-fit:contain;}
|
|
462
|
+
.node.card-full.img-overlay .body figure.media img{object-fit:cover;}
|
|
463
|
+
.node.img-overlay .body figure.media figcaption{position:absolute;left:0;right:0;bottom:0;padding:36px 18px 14px;
|
|
464
|
+
color:#f4f4f5;background:linear-gradient(rgba(0,0,0,0), rgba(0,0,0,.78));}
|
|
465
|
+
.node.img-overlay .body .gallery.carousel figure.media figcaption::before{color:color-mix(in srgb, var(--accent) 55%, #fff);}
|
|
466
|
+
/* <!-- view: full -->: a 16:9 card that fills the screen, with the map and breadcrumbs out of the way */
|
|
467
|
+
div.node.card-full{height:540px;overflow:hidden;}
|
|
468
|
+
body.full-card #breadcrumbs, body.full-card #minimap{opacity:0;pointer-events:none;}
|
|
403
469
|
/* measure cards at their resting size, without grow/zoom transforms */
|
|
404
470
|
div.node.measuring .fragment{transform:none !important;transition:none !important;}
|
|
405
471
|
/* a card re-measured mid-entrance (a theme switch replays it) must not count a gsap "from" state such
|
|
@@ -411,6 +477,9 @@
|
|
|
411
477
|
.node .diagram{background:#f8fafc;border:1px solid var(--panel-line);border-radius:8px;padding:12px;margin:0 0 10px;overflow:auto;}
|
|
412
478
|
.node .diagram svg{display:block;width:100%;height:auto;max-height:640px;}
|
|
413
479
|
.node .diagram.err{background:none;color:var(--danger);font-family:var(--mono);font-size:12px;padding:0;}
|
|
480
|
+
/* D2 is drawn in the deck's own palette, so it needs no light backdrop */
|
|
481
|
+
.node .diagram.d2{background:none;border:none;padding:0;}
|
|
482
|
+
.node .diagram.d2 svg{max-height:62vh;}
|
|
414
483
|
.node .echarts-container{width:100%;height:360px;margin:0 0 10px;}
|
|
415
484
|
|
|
416
485
|
/* ---------- overlays ---------- */
|
|
@@ -469,22 +538,29 @@
|
|
|
469
538
|
html.embed .brand .trail a:hover{color:var(--accent);}
|
|
470
539
|
html.embed .brand .trail a:last-child{color:var(--accent);}
|
|
471
540
|
html.embed .brand .trail .sep{color:var(--text-muted);font-weight:400;}
|
|
472
|
-
#
|
|
473
|
-
font-family:var(--display);font-weight:700;font-size:
|
|
474
|
-
#
|
|
475
|
-
#
|
|
476
|
-
#
|
|
477
|
-
html.
|
|
541
|
+
#credit{display:inline-flex;align-items:center;gap:6px;padding:4px 6px;text-decoration:none;
|
|
542
|
+
font-family:var(--display);font-weight:700;font-size:14px;color:var(--text);}
|
|
543
|
+
#credit .logo{width:18px;height:18px;fill:var(--accent);}
|
|
544
|
+
#credit .word > span{color:var(--accent);}
|
|
545
|
+
#credit:hover{opacity:.85;}
|
|
546
|
+
html.embed #btn-help{display:none !important;}
|
|
547
|
+
/* a reader's page (embedded, not recording): no bottom bar, except the arrows on touch screens */
|
|
548
|
+
html.embed.no-record #navbar{display:none;}
|
|
549
|
+
@media (pointer:coarse){
|
|
550
|
+
html.embed.no-record #navbar{display:flex;}
|
|
551
|
+
html.embed.no-record #navbar > :not(.touch-only){display:none !important;}
|
|
552
|
+
}
|
|
553
|
+
html.no-record #btn-camera, html.no-record #btn-record, html.no-record #navbar .divider, html.no-record #pip, html.no-record #help tr.rec{display:none !important;}
|
|
478
554
|
/* the logo written into a heading: #  Slidetake */
|
|
479
555
|
.node .body :is(h1,h2) img[src$="favicon.svg"]{height:1em;width:auto;vertical-align:-.12em;margin-right:.25em;display:inline;}
|
|
480
556
|
#brand .st-mark{display:inline-flex;align-items:center;gap:8px;font-family:var(--display);font-weight:700;font-size:20px;color:var(--text);}
|
|
481
557
|
#brand .st-mark .logo{width:24px;height:24px;fill:var(--accent);}
|
|
482
558
|
#brand .st-mark .word > span{color:var(--accent);}
|
|
483
559
|
#brand img{height:40px;width:auto;display:block;}
|
|
484
|
-
/* optional
|
|
560
|
+
/* optional accent chip, as on the decks' title slides (brand_style: chip); plain text is the default */
|
|
485
561
|
#brand .chip{display:inline-block;padding:5px 22px;border-radius:30px;color:#fff;font-family:var(--body);
|
|
486
562
|
font-size:15px;font-weight:600;letter-spacing:.01em;text-shadow:none;
|
|
487
|
-
background:linear-gradient(90deg,
|
|
563
|
+
background:linear-gradient(90deg, var(--accent-line), color-mix(in srgb, var(--accent-line) 80%, #000));box-shadow:0 2px 10px rgba(0,0,0,.25);}
|
|
488
564
|
|
|
489
565
|
/* PIP camera: slides are laid out to keep clear of this box */
|
|
490
566
|
#pip{
|
|
@@ -553,6 +629,12 @@
|
|
|
553
629
|
</style>
|
|
554
630
|
</head>
|
|
555
631
|
<body>
|
|
632
|
+
<noscript>
|
|
633
|
+
<h1>Slidetake</h1>
|
|
634
|
+
<p><strong>Write in markdown. Present on a spatial canvas. Record without timeline editing.</strong></p>
|
|
635
|
+
<p>For developers and technical educators who explain things on video. Your headings become a map you move through; with OBS, every slide is a take, so a fumbled line is retaken on the spot, and Slidetake writes the frame-exact cut, YouTube chapters and description.</p>
|
|
636
|
+
<p>Slidetake needs JavaScript. Read the <a href="/help.md">guide</a>, the <a href="/llms.txt">summary</a>, or the source on <a href="https://github.com/slidetake/slidetake">GitHub</a>.</p>
|
|
637
|
+
</noscript>
|
|
556
638
|
|
|
557
639
|
<header>
|
|
558
640
|
<div class="brand">
|
|
@@ -583,7 +665,7 @@
|
|
|
583
665
|
</div>
|
|
584
666
|
<div id="breadcrumbs"></div>
|
|
585
667
|
<div id="navbar">
|
|
586
|
-
<button id="btn-keys" title="Keyboard shortcuts (
|
|
668
|
+
<button id="btn-keys" title="Keyboard shortcuts (K)">⌨<span class="lbl"> Keys</span></button>
|
|
587
669
|
<button id="nav-prev" class="touch-only" title="Previous (←)" aria-label="Previous">←</button>
|
|
588
670
|
<button id="nav-next" class="touch-only" title="Next (→)" aria-label="Next">→</button>
|
|
589
671
|
<div class="divider"></div>
|
|
@@ -628,6 +710,7 @@
|
|
|
628
710
|
<tr><td><kbd>E</kbd></td><td>editor: write, open, share</td></tr>
|
|
629
711
|
<tr><td><kbd>L</kbd></td><td>light / dark</td></tr>
|
|
630
712
|
<tr class="rec"><td><kbd>C</kbd> <kbd>V</kbd> <kbd>R</kbd></td><td>camera, camera layouts, record</td></tr>
|
|
713
|
+
<tr><td><kbd>K</kbd> <kbd>?</kbd></td><td>this card</td></tr>
|
|
631
714
|
</table>
|
|
632
715
|
<p>Drag to pan, scroll or pinch to zoom, click a card to fly to it.</p>
|
|
633
716
|
<p><a href="/help" target="_blank" rel="noopener">The full guide →</a> writing decks, sharing, recording, camera, review and cut.</p>
|
|
@@ -643,6 +726,7 @@
|
|
|
643
726
|
<li><a href="/new?template=blank"><strong>Blank</strong><span>A first card, a section and a detail.</span></a></li>
|
|
644
727
|
<li><a href="/new?template=talk"><strong>Talk</strong><span>Why it matters, the idea, trade-offs, summary.</span></a></li>
|
|
645
728
|
<li><a href="/new?template=recording"><strong>Recording</strong><span>Camera steps, an overview moment and a closing on camera.</span></a></li>
|
|
729
|
+
<li><a href="/examples"><strong>Examples</strong><span>Everything a deck can hold: diagrams, charts, images, YouTube.</span></a></li>
|
|
646
730
|
</ul>
|
|
647
731
|
<p>Or <strong>⇣ Load</strong> a deck from a link, or <strong>Open</strong> a file from this computer.</p>
|
|
648
732
|
</div>
|
|
@@ -769,20 +853,23 @@
|
|
|
769
853
|
"use strict";
|
|
770
854
|
(() => {
|
|
771
855
|
// src/sample.md
|
|
772
|
-
var sample_default = "---\ntitle: Slidetake \u2014 markdown
|
|
856
|
+
var sample_default = "---\ntitle: Slidetake \u2014 write in markdown, record without timeline editing\nbrand: slidetake\npip: bottom-right\n---\n\n<!-- camera: on, full, on -->\n\n#  Slidetake\n\n**Write in markdown. Present on a spatial canvas. Record without timeline editing.**\n\nFor developers and technical educators who explain things on video. You're inside a Slidetake deck right now: press \u2192 to walk it, **O** for the map.\n\n## \u2702\uFE0F Stop editing on a timeline\n\n**Retake by slide.** The slide is the timeline marker, so a fumbled line costs one press, not an editing session.\n\n### Every slide is a take\n\nStumbled on a slide? Press \u2190 and say it again. Every attempt is kept, and recording carries on.\n\n### Pick, don't scrub\n\nChoose the best take of each slide. Slidetake writes the frame-exact **ffmpeg** cut, the YouTube **chapters** and the description.\n\n## \u{1F5FA}\uFE0F A map, not a stack\n\n<!-- view: overview -->\n\nYour headings are the hierarchy: zoom out for the whole system, zoom in for one part. This slide just showed you the map.\n\n### Headings become cards\n\n`#` is the first card, `##` branches from it, `###` goes a level deeper. No layout to draw.\n\n### A path your viewer can follow\n\n\u2192 always walks the same order, and **path** lays it out as a staircase, so the audience never loses its place.\n\n## \u{1F3A5} The camera is part of the deck\n\n<!-- camera: on, full, on -->\n\nA comment in a slide moves you: corner, full screen, or off. Turn on **Camera** and watch this slide do it.\n\n### Broadcast-quality recording\n\n**[OBS](https://obsproject.com)** records at full quality; Slidetake drives it. No scenes to switch, no recording to watch.\n\n### One session, one finished video\n\nWrite, present and record in one sitting. What comes out is ready to upload.\n\n## \u270D\uFE0F Plain text in\n\nMarkdown you already know: headings, lists, tables, code, diagrams, charts, images and YouTube links. [See every example \u2192](/examples)\n\n### Your copy\n\nType in any deck, this one included, and it becomes your own copy. The original stays as it is.\n\n### Open and share\n\n**\u21E3 Load** a GitHub file or gist, start from a template, and **Share** a link with the deck inside it.\n\n## \u{1F49B} Free and open\n\nOpen source, Apache 2.0: [github.com/slidetake/slidetake](https://github.com/slidetake/slidetake).\n\nEverything else is in the guide: **[slidetake.com/help](/help)**.\n";
|
|
773
857
|
|
|
774
858
|
// src/help.md
|
|
775
|
-
var help_default = "---\ntitle: Slidetake help\nbrand: slidetake\npip: none\n---\n\n#  Slidetake help\n\nThe details behind the [home deck](/): writing, sharing, presenting, recording and the camera. Press \u2192 to read in order, \u2193 \u2191 to go into a section and back out, or **O** for the whole map.\n\n## \u270D\uFE0F Writing a deck\n\nA deck is an ordinary markdown file. **Every heading becomes a card**, and a heading branches off the nearest shallower heading above it.\n\n```md\n# Product \u2190 the first card\nIntro text.\n\n## Pricing \u2190 branches from Product\n### Enterprise \u2190 branches from Pricing\n## Roadmap {#plan} \u2190 branches from Product, id \"plan\"\n\nSee the [roadmap](#plan).\n```\n\n### Rules\n\n- Text before the first heading becomes a card of its own.\n- Headings inside fenced code blocks are ignored.\n- A card's id is its heading slugified (`## Moving around` \u2192 `moving-around`), or set one with `{#id}` at the end of the heading.\n- A link to `#id` flies to that card.\n\n### reveal.js decks\n\nDecks written for reveal.js open as they are: `---` starts a slide and `--` a vertical one beneath it, and the first slide becomes the root card.\n\nSupported: fragments (`fade-up`, `fade-in-then-out`, `grow`, \u2026, one per \u2192), `r-stack`, `<!-- .element: \u2026 -->`, `<section>` slides, `data-autoslide`, Graphviz `dot` diagrams, ECharts charts, `data-gsap` entrance animations and `title-scramble`.\n\n### Older +++ decks\n\nDecks that separate slides with `+++` and use `id`, `parent`, `x`, `y` frontmatter still load.\n\n### Wide content\n\nCards widen for wide tables, columns, diagrams and embeds; anything wider still is scaled to fit.\n\n## \u{1F517} Opening, editing and sharing\n\nEvery deck you open is **read-only**: Slidetake's own decks, templates, files on the web and shared links. Viewing one never changes anything.\n\n**Type in it**, and it becomes **your copy**, at `/edit`. Your copy lives in this browser, remembers where it came from, and is there whenever you come back: the **Your copy \u2192** button at the top takes you to it.\n\n### Where decks come from\n\nPress **\u270E Editor**, then **\u21E3 Load**, and paste a link: a GitHub file or folder, a gist, or any URL that lets other sites read it. Or link straight to a deck:\n\n| Link | Opens |\n|---|---|\n| `/gh/owner/repo/path/deck.md` | a GitHub file, default branch |\n| `/gh/owner/repo@branch/deck.md` | another branch or tag |\n| `/gist/<id>` | a gist's first markdown file |\n| `/?src=https://\u2026/deck.md` | anything else |\n| `/share#deflate:\u2026` | a shared deck, carried inside the link |\n| `/new` | a template: blank, talk or recording |\n\nImages next to the deck load as they are. **Open** opens a markdown file from your computer, straight into your copy.\n\n### Your copy\n\nThere's one working copy at a time. The editor bar says whose copy it is, and marks **edited** while it has changes you haven't saved or shared.\n\n- **Reset to original** throws your edits away and goes back to the deck you started from.\n- Starting a new copy, by typing in another deck or opening a file, asks first if the old one has edits you haven't kept.\n\n### Saving and sharing\n\n**Save** downloads your markdown as a file. **Share** copies a link: the short link while your copy still matches an online original, and otherwise a `/share#deflate:\u2026` link with the whole deck compressed inside it. That part of a link is never sent to a server, so nothing is uploaded. Shared links never include `?obs=`.\n\nFor a file from your computer whose images sit next to it online, add `base: https://\u2026/deck-folder/` to its top block.\n\n### Address options\n\n| Option | Does |\n|---|---|\n| `?edit=1` | opens the editor |\n| `?layout=tree` (radial, path, focus) | picks the layout |\n| `?mode=light` | light theme |\n| `?duration=10m` | talk length for the timer |\n| `#card-id` | opens at a card |\n\n## \u{1F9ED} Moving around\n\n| Key | Does |\n|---|---|\n| \u2192 \u2190 Space | next / previous step, in document order |\n| \u2193 \u2191 | first child / parent |\n| O | the whole map; O or Esc goes back to your slide |\n| 1 2 3 4 | tree, radial, path, focus |\n| F | fullscreen |\n| + \u2212 | bigger / smaller slides (remembered) |\n| E | editor |\n| L | light / dark |\n| ? | keys (also \u2328 in the bottom bar) |\n| C \xB7 V \xB7 R | camera, camera layouts, record |\n\nClick a card to fly to it. Drag to pan; scroll or pinch to zoom. On a touch screen, the bottom bar adds \u2190 \u2192 buttons.\n\n### Layouts\n\n**Tree** is a top-down chart and **radial** rings out from the root.\n\n**Path** is made for video: a staircase in presenting order. Each section is a row, and the next one starts just below where the last ended, so every move is a short step right or down.\n\n**Focus** doesn't travel at all: the next slide fades in where the last one was.\n\n### Steady text\n\nText keeps one size within a section and only changes when the section does. Charts and diagrams are fitted on their own.\n\n### Map moments\n\n`<!-- view: overview -->` on a slide pulls back to the whole map for a beat before flying in: a good start to a chapter.\n\n## \u{1F3AC} Presenting\n\n**F** goes fullscreen. The current slide fills the screen, and the cursor and controls hide after two seconds without the mouse moving.\n\n### Progress and talk timer\n\nWhile presenting, a thin bar along the bottom fills with every press.\n\nGive the deck a length, `duration: 10m` (or `90s`, `1h`, `12:30`), and a lighter layer of the same colour grows behind it with the clock: if the lighter stretch shows past the solid fill, you're behind; if it reaches the end, the bar pulses.\n\nThe timer is for you, so recordings show progress only, unless the deck says `timer: always`. `progress: off` hides the bar.\n\n## \u23FA\uFE0F Recording\n\nRecording needs **[OBS Studio](https://obsproject.com)** (free) with its WebSocket server on: in OBS, Tools \u2192 WebSocket Server Settings. OBS records; Slidetake drives it.\n\n### Connecting to OBS\n\nPress **\u25CF Record** and enter where OBS is: host, port and the password from OBS's WebSocket settings. Tick *Remember* to skip this next time.\n\n`?obs=localhost:4455` (or `?obs=host:port:password`) in the address fills this in and connects as the page opens.\n\n### A 16:9 screen\n\nYouTube is 16:9, and many laptop screens aren't. The Record dialog checks yours: if it isn't 16:9, move the window to a screen that is, physical or virtual (say 1920\xD71080), and press **F** there.\n\n### OBS on another computer\n\nFrom https://slidetake.com, OBS must be on the same computer (`localhost`): browsers block secure pages from reaching plain `ws://` addresses elsewhere. For OBS on another machine, serve a local copy of [`dist/index.html`](https://github.com/slidetake/slidetake) over http.\n\n### Taking a take\n\n**\u25CF Record** (or **R**) connects to OBS, counts down and starts recording. From then on the deck drives everything: camera layouts, reveals and slides follow \u2192 (a Bluetooth clicker works).\n\n- **\u2190** takes the current slide again, keeping every attempt\n- **B** pauses and resumes\n- one press past the last step stops OBS\n\nClicks, dragging and the map are locked so the take only moves forward.\n\n### Review and cut\n\nThen the review opens: every slide with its takes (the last one picked), previews from the OBS file, a ready-to-run **ffmpeg** command for the picked takes (frame-exact), and the YouTube title, description with **chapters** and links, and tags.\n\nSessions are kept in this browser, so a take can be reviewed again later from \u25CF Record.\n\n## \u{1F4F7} Camera\n\n**C** (or **Camera** in the bottom bar) turns your webcam on in its box; a plain screen recording then captures you and the slides together. The camera is off every time the page opens, and until it's on, the deck's camera settings are ignored, so readers get slides using the whole screen.\n\n### Deck settings\n\nAn optional block at the top of the file:\n\n```yaml\n---\nbrand: example.com/talks \u2190 text in the top-right corner\nlogo: https://\u2026/logo.png \u2190 image beside it\npip: bottom-right \u2190 camera corner, or none\npip_size: 24% \u2190 camera box width\npip_shape: rect \u2190 rect (16:9) or circle\npip_mirror: yes \u2190 mirror the webcam\ncamera: 24%, 40%, full, off \u2190 layouts V cycles through\n---\n```\n\nSlides are always placed clear of the brand and the camera box.\n\n### Camera per slide\n\nA comment in a slide changes the camera from that slide on:\n\n```md\n## Intro\n<!-- camera: full --> \u2190 camera fills the screen\n\n## Pricing\n<!-- camera: 18% flip --> \u2190 small, on the other side\n```\n\nWords you can combine: `on`, `off`, `full`, a size like `30%`, a corner, `flip`, `circle` / `rect`, `mirror` / `unmirror`.\n\n### Several steps on one slide\n\nList layouts with commas to step through them: `full, on` opens full screen on you, and the next \u2192 shrinks the camera to its corner and shows the slide. `on, full, on, off` ends a closing slide on you, then the slide again, then without the camera.\n\n**V** steps through the deck's `camera:` list for the current slide.\n\n## \u{1F4CB} Publish pack\n\nThe review fills the YouTube description from the deck's top block:\n\n| Key | Used for |\n|---|---|\n| `title` | the video title |\n| `summary` | the description's first paragraph |\n| `related` | a list of `[Title](url)` links |\n| `tags` | tags (any other list ending in `_tags` is added too) |\n| `permalink` or `site` | the link back to the deck |\n\n## \u{1F512} Your data\n\nYour draft and settings stay in this browser. Decks inside links live in the part of the address after `#`, which browsers never send to a server. Slidetake has no accounts and stores no decks.\n\nslidetake.com counts visits with Google Analytics. What it records leaves out the `#` part and `?obs=`, so neither your deck nor an OBS password reaches it. Copies you host yourself send nothing.\n\nSlidetake is open source: [github.com/slidetake/slidetake](https://github.com/slidetake/slidetake).\n";
|
|
859
|
+
var help_default = "---\ntitle: Slidetake help\nbrand: slidetake\npip: none\n---\n\n#  Slidetake help\n\nThe details behind the [home deck](/): writing, sharing, presenting, recording and the camera. Press \u2192 to read in order, \u2193 \u2191 to go into a section and back out, or **O** for the whole map.\n\n## \u270D\uFE0F Writing a deck\n\nA deck is an ordinary markdown file. **Every heading becomes a card**, and a heading branches off the nearest shallower heading above it.\n\n```md\n# Product \u2190 the first card\nIntro text.\n\n## Pricing \u2190 branches from Product\n### Enterprise \u2190 branches from Pricing\n## Roadmap {#plan} \u2190 branches from Product, id \"plan\"\n\nSee the [roadmap](#plan).\n```\n\n### Rules\n\n- Text before the first heading becomes a card of its own.\n- Headings inside fenced code blocks are ignored.\n- A card's id is its heading slugified (`## Moving around` \u2192 `moving-around`), or set one with `{#id}` at the end of the heading.\n- A link to `#id` flies to that card.\n\n### What a card can hold\n\nPlain markdown, and the layout follows from what's on the card. [See every one \u2192](/examples)\n\n| Write | Get |\n|---|---|\n| `<!-- steps -->` before a list | one item per press |\n| ` ```dot `, ` ```d2 ` | a Graphviz or D2 diagram |\n| ` ```echarts ` with JSON options | a chart, in the deck's colors for dark and light |\n| ` ```svg ` or `` | an SVG drawing |\n| an image alone | an image card: a phone shot sits beside the heading and caption, a landscape one spans the card between them, a 16:9 one fills it |\n| an image and text | a split card: the image sits on the side written first |\n| a list of images | a gallery; with `<!-- steps -->` a carousel, one image per press, laid out like an image card |\n| `<!-- view: full -->` in a card | the card fills the whole screen |\n| images in one paragraph | a grid, up to four a row |\n| a YouTube link alone on a line | the video: the next press plays it, leaving pauses it |\n\nThe first and last cards animate in on their own. The alt text of an image is its caption.\n\n### reveal.js decks\n\nDecks written for reveal.js open as they are: `---` starts a slide and `--` a vertical one beneath it, and the first slide becomes the root card.\n\nSupported: fragments (`fade-up`, `fade-in-then-out`, `grow`, \u2026, one per \u2192), `r-stack`, `<!-- .element: \u2026 -->`, `<section>` slides, `data-autoslide`, Graphviz `dot` diagrams, ECharts charts, `data-gsap` entrance animations and `title-scramble`.\n\n### Older +++ decks\n\nDecks that separate slides with `+++` and use `id`, `parent`, `x`, `y` frontmatter still load.\n\n### Wide content\n\nCards widen for wide tables, columns, diagrams and embeds; anything wider still is scaled to fit.\n\n## \u{1F517} Opening, editing and sharing\n\nEvery deck you open is **read-only**: Slidetake's own decks, templates, files on the web and shared links. Viewing one never changes anything.\n\n**Type in it**, and it becomes **your copy**, at `/edit`. Your copy lives in this browser, remembers where it came from, and is there whenever you come back: the **Your copy \u2192** button at the top takes you to it.\n\n### Where decks come from\n\nPress **\u270E Editor**, then **\u21E3 Load**, and paste a link: a GitHub file or folder, a gist, or any URL that lets other sites read it. Or link straight to a deck:\n\n| Link | Opens |\n|---|---|\n| `/gh/owner/repo/path/deck.md` | a GitHub file, default branch |\n| `/gh/owner/repo@branch/deck.md` | another branch or tag |\n| `/gist/<id>` | a gist's first markdown file |\n| `/?src=https://\u2026/deck.md` | anything else |\n| `/share#deflate:\u2026` | a shared deck, carried inside the link |\n| `/new` | a template: blank, talk or recording |\n\nImages next to the deck load as they are. **Open** opens a markdown file from your computer, straight into your copy.\n\n### Your copy\n\nThere's one working copy at a time. The editor bar says whose copy it is, and marks **edited** while it has changes you haven't saved or shared.\n\n- **Reset to original** throws your edits away and goes back to the deck you started from.\n- Starting a new copy, by typing in another deck or opening a file, asks first if the old one has edits you haven't kept.\n\n### Saving and sharing\n\n**Save** downloads your markdown as a file. **Share** copies a link: the short link while your copy still matches an online original, and otherwise a `/share#deflate:\u2026` link with the whole deck compressed inside it. That part of a link is never sent to a server, so nothing is uploaded. Shared links never include `?obs=`.\n\nFor a file from your computer whose images sit next to it online, add `base: https://\u2026/deck-folder/` to its top block.\n\n### Address options\n\n| Option | Does |\n|---|---|\n| `?edit=1` | opens the editor |\n| `?layout=tree` (radial, path, focus) | picks the layout |\n| `?mode=light` | light theme |\n| `?duration=10m` | talk length for the timer |\n| `#card-id` | opens at a card |\n\n## \u{1F9ED} Moving around\n\n| Key | Does |\n|---|---|\n| \u2192 \u2190 Space | next / previous step, in document order |\n| \u2193 \u2191 | first child / parent |\n| O | the whole map; O or Esc goes back to your slide |\n| 1 2 3 4 | tree, radial, path, focus |\n| F | fullscreen |\n| + \u2212 | bigger / smaller slides (remembered) |\n| E | editor |\n| L | light / dark |\n| K or ? | keys (also \u2328 Keys on screen) |\n| C \xB7 V \xB7 R | camera, camera layouts, record |\n\nClick a card to fly to it. Drag to pan; scroll or pinch to zoom. On a touch screen, the bottom bar adds \u2190 \u2192 buttons.\n\n### Layouts\n\n**Tree** is a top-down chart and **radial** rings out from the root.\n\n**Path** is made for video: a staircase in presenting order. Each section is a row, and the next one starts just below where the last ended, so every move is a short step right or down.\n\n**Focus** doesn't travel at all: the next slide fades in where the last one was.\n\n### Steady text\n\nText keeps one size within a section and only changes when the section does. Charts and diagrams are fitted on their own.\n\n### Map moments\n\n`<!-- view: overview -->` on a slide pulls back to the whole map for a beat before flying in: a good start to a chapter.\n\n## \u{1F3AC} Presenting\n\n**F** goes fullscreen. The current slide fills the screen, and the cursor and controls hide after two seconds without the mouse moving.\n\n### Progress and talk timer\n\nWhile presenting, a thin bar along the bottom fills with every press.\n\nGive the deck a length, `duration: 10m` (or `90s`, `1h`, `12:30`), and a lighter layer of the same colour grows behind it with the clock: if the lighter stretch shows past the solid fill, you're behind; if it reaches the end, the bar pulses.\n\nThe timer is for you, so recordings show progress only, unless the deck says `timer: always`. `progress: off` hides the bar.\n\n## \u23FA\uFE0F Recording\n\nRecording needs **[OBS Studio](https://obsproject.com)** (free) with its WebSocket server on: in OBS, Tools \u2192 WebSocket Server Settings. OBS records; Slidetake drives it.\n\n### Connecting to OBS\n\nPress **\u25CF Record** and enter where OBS is: host, port and the password from OBS's WebSocket settings. Tick *Remember* to skip this next time.\n\n`?obs=localhost:4455` (or `?obs=host:port:password`) in the address fills this in and connects as the page opens.\n\n### A 16:9 screen\n\nYouTube is 16:9, and many laptop screens aren't. The Record dialog checks yours: if it isn't 16:9, move the window to a screen that is, physical or virtual (say 1920\xD71080), and press **F** there.\n\n### OBS on another computer\n\nFrom https://slidetake.com, OBS must be on the same computer (`localhost`): browsers block secure pages from reaching plain `ws://` addresses elsewhere. For OBS on another machine, serve a local copy of [`dist/index.html`](https://github.com/slidetake/slidetake) over http.\n\n### Taking a take\n\n**\u25CF Record** (or **R**) connects to OBS, counts down and starts recording. From then on the deck drives everything: camera layouts, reveals and slides follow \u2192 (a Bluetooth clicker works).\n\n- **\u2190** takes the current slide again, keeping every attempt\n- **B** pauses and resumes\n- one press past the last step stops OBS\n\nClicks, dragging and the map are locked so the take only moves forward.\n\n### Review and cut\n\nThen the review opens: every slide with its takes (the last one picked), previews from the OBS file, a ready-to-run **ffmpeg** command for the picked takes (frame-exact), and the YouTube title, description with **chapters** and links, and tags.\n\nSessions are kept in this browser, so a take can be reviewed again later from \u25CF Record.\n\n## \u{1F4F7} Camera\n\n**C** (or **Camera** in the bottom bar) turns your webcam on in its box; a plain screen recording then captures you and the slides together. The camera is off every time the page opens, and until it's on, the deck's camera settings are ignored, so readers get slides using the whole screen.\n\n### Deck settings\n\nAn optional block at the top of the file:\n\n```yaml\n---\nbrand: example.com/talks \u2190 text in the top-right corner\nlogo: https://\u2026/logo.png \u2190 image beside it\npip: bottom-right \u2190 camera corner, or none\npip_size: 24% \u2190 camera box width\npip_shape: rect \u2190 rect (16:9) or circle\npip_mirror: yes \u2190 mirror the webcam\ncamera: 24%, 40%, full, off \u2190 layouts V cycles through\naccent: \"#3b82f6\" \u2190 the deck's colour, instead of Slidetake's green\n---\n```\n\n`accent` is one colour; Slidetake sets it bright for dark mode and deep enough to read on white for light mode, and uses it for text accents, lines, charts and diagrams.\n\nSlides are always placed clear of the brand and the camera box.\n\n### Camera per slide\n\nA comment in a slide changes the camera from that slide on:\n\n```md\n## Intro\n<!-- camera: full --> \u2190 camera fills the screen\n\n## Pricing\n<!-- camera: 18% flip --> \u2190 small, on the other side\n```\n\nWords you can combine: `on`, `off`, `full`, a size like `30%`, a corner, `flip`, `circle` / `rect`, `mirror` / `unmirror`.\n\n### Several steps on one slide\n\nList layouts with commas to step through them: `full, on` opens full screen on you, and the next \u2192 shrinks the camera to its corner and shows the slide. `on, full, on, off` ends a closing slide on you, then the slide again, then without the camera.\n\n**V** steps through the deck's `camera:` list for the current slide.\n\n## \u{1F4CB} Publish pack\n\nThe review fills the YouTube description from the deck's top block:\n\n| Key | Used for |\n|---|---|\n| `title` | the video title |\n| `summary` | the description's first paragraph |\n| `related` | a list of `[Title](url)` links |\n| `tags` | tags (any other list ending in `_tags` is added too) |\n| `permalink` or `site` | the link back to the deck |\n\n## \u{1F512} Your data\n\nYour draft and settings stay in this browser. Decks inside links live in the part of the address after `#`, which browsers never send to a server. Slidetake has no accounts and stores no decks.\n\nslidetake.com counts visits with Google Analytics. What it records leaves out the `#` part and `?obs=`, so neither your deck nor an OBS password reaches it. Copies you host yourself send nothing.\n\nSlidetake is open source: [github.com/slidetake/slidetake](https://github.com/slidetake/slidetake).\n";
|
|
776
860
|
|
|
777
|
-
//
|
|
861
|
+
// examples/blank.md
|
|
778
862
|
var blank_default = "---\ntitle: My deck\n---\n\n# My deck\n\nStart typing: this becomes your own copy, and the template stays as it is.\n\n## A section\n\nEvery heading is a card. `##` sections branch from the first card.\n\n### A detail\n\n`###` branches from the section above it.\n";
|
|
779
863
|
|
|
780
|
-
//
|
|
864
|
+
// examples/talk.md
|
|
781
865
|
var talk_default = "---\ntitle: Talk title\nduration: 15m\n---\n\n# Talk title\n\nOne line on what the audience will take away.\n\n## \u{1F9ED} Why this matters\n\n- The problem, in the audience's words\n- Why now\n- What changes if it's solved\n\n## \u{1F4A1} The idea\n\nThe one thing to remember, stated plainly.\n\n### How it works\n\nThree steps, a diagram or a table.\n\n### An example\n\nSomething concrete the audience will recognise.\n\n## \u2696\uFE0F Trade-offs\n\n- What it costs\n- When not to use it\n\n## \u2705 Summary\n\n- Point one\n- Point two\n- Point three\n\n## \u{1F64F} Thank you\n\nWhere to find you, and the link to these slides.\n";
|
|
782
866
|
|
|
783
|
-
//
|
|
867
|
+
// examples/recording.md
|
|
784
868
|
var recording_default = "---\ntitle: Video title\nduration: 10m\npip: bottom-right\npip_size: 24%\ncamera: 24%, 40%, full, off\n---\n\n<!-- camera: full, on -->\n\n# Video title\n\nOpens full screen on you; the next press shows this slide with you in the corner.\n\n## \u{1F4CC} Disclaimer\n\n<!-- camera: off, on -->\n\nOpens without the camera, so the text has the whole screen; the next press brings you back.\n\n## \u{1F9ED} Contents\n\n- Part one\n- Part two\n- Part three\n\n## \u{1F539} Part one\n\n<!-- view: overview -->\n\nThe overview comment pulls back to the whole map first: a good start to a chapter.\n\n### A detail\n\nSlides you talk over in the corner.\n\n## \u{1F538} Part two\n\n### A detail\n\n## \u{1F537} Part three\n\n### A detail\n\n## \u{1F64F} Thanks for watching\n\n<!-- camera: on, full, on, off -->\n\nEnds on you full screen, then back to the slide, then without the camera.\n";
|
|
785
869
|
|
|
870
|
+
// examples/showcase.md
|
|
871
|
+
var showcase_default = '---\ntitle: Slidetake examples\nbrand: slidetake\nduration: 10m\n---\n\n# Slidetake examples\n\nEverything a deck can hold, written in plain markdown. Open **\u270E Editor** to see the source of any card, or press **O** for the map.\n\n## \u270D\uFE0F Text\n\nParagraphs, **bold**, *italic*, `code`, [links](https://slidetake.com) and lists, as markdown writes them.\n\n- One point\n- Another point\n - A detail under it\n\n### Steps\n\nPut `<!-- steps -->` before a list and it reveals one item per press:\n\n<!-- steps -->\n- First, the problem\n- Then, the idea\n- Finally, the result\n\n### Quotes and tables\n\n> A quote stands out from the text around it.\n\n| Plan | Price | Users |\n|---|---:|---:|\n| Free | \u20B90 | 1 |\n| Team | \u20B9499 | 10 |\n\n### Code\n\n```python\ndef take(slide):\n return slide.best_attempt()\n```\n\n## \u{1F9ED} Diagrams\n\nWrite the diagram in a fenced block named after its language.\n\n### Graphviz\n\n```dot\ndigraph {\n rankdir=LR\n node [shape=box style=rounded]\n Markdown -> Deck -> Takes -> Video\n}\n```\n\n### D2\n\n```d2\ndirection: right\nwrite: Write {shape: rectangle}\npresent: Present\nrecord: Record\nwrite -> present -> record: one session\n```\n\n### SVG\n\n```svg\n<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 120">\n <rect x="10" y="20" width="90" height="80" rx="10" fill="#22c55e"/>\n <rect x="115" y="20" width="90" height="80" rx="10" fill="#22c55e" opacity=".7"/>\n <rect x="220" y="20" width="90" height="80" rx="10" fill="#22c55e" opacity=".4"/>\n</svg>\n```\n\n## \u{1F4CA} Charts\n\nECharts, as a fenced `echarts` block of JSON options.\n\n### A bar chart\n\n```echarts\n{\n "xAxis": {"type": "category", "data": ["Jan", "Feb", "Mar", "Apr", "May"]},\n "yAxis": {"type": "value"},\n "series": [{"type": "bar", "data": [12, 19, 15, 24, 30]}]\n}\n```\n\n### A donut\n\n```echarts\n{\n "series": [{"type": "pie", "radius": ["45%", "70%"],\n "data": [{"name": "Equity", "value": 85}, {"name": "Debt", "value": 5}, {"name": "Gold", "value": 10}]}]\n}\n```\n\n## \u{1F5BC}\uFE0F Images\n\nThe layout comes from what\'s on the slide; the alt text is the caption.\n\n### One image\n\n\n\n### Image and text\n\n\n\nAn image beside text makes a split card. Write the text first and the image moves to the right.\n\n### A gallery\n\nA list of images is a gallery. With `<!-- steps -->` it becomes a carousel: one image at a time, the next on each press.\n\n<!-- steps -->\n- \n- \n- \n\n### A grid\n\nSeveral images in one paragraph sit side by side, up to four a row:\n\n  \n\n### Full screen\n\n<!-- view: full -->\n\n\n\n## \u25B6\uFE0F YouTube\n\nA YouTube link alone on a line becomes the video. The next press plays it; leaving the slide pauses it.\n\nhttps://www.youtube.com/watch?v=jNQXAC9IVRw\n\n## \u{1F3A5} Camera and map\n\n<!-- camera: on, full, on -->\n<!-- view: overview -->\n\nTwo comments do what markdown can\'t: `<!-- camera: on, full, on -->` moves the presenter\'s camera, and `<!-- view: overview -->` shows the whole map first.\n\n## \u{1F680} Start your own\n\nPress **New** for a template (blank, talk or recording), or type in this deck to make it your copy.\n\nThe templates and this deck live in [examples/](https://github.com/slidetake/slidetake/tree/main/examples) on GitHub.\n';
|
|
872
|
+
|
|
786
873
|
// src/core/text.js
|
|
787
874
|
function slugify(s) {
|
|
788
875
|
return s.toLowerCase().replace(/[^\p{L}\p{N}]+/gu, "-").replace(/^-+|-+$/g, "") || "card";
|
|
@@ -962,7 +1049,8 @@
|
|
|
962
1049
|
const legacy = /^\+\+\+[ \t]*$/m.test(src);
|
|
963
1050
|
let deck2 = {};
|
|
964
1051
|
if (!legacy) ({ deck: deck2, body: src } = parseDeckSettings(src));
|
|
965
|
-
const
|
|
1052
|
+
const slideType = /^slides?$/i.test(String(deck2.layout || "")) || /^slides?$/i.test(String(deck2.type || ""));
|
|
1053
|
+
const reveal = !legacy && (splitOutsideFences(src, /^--\s*$/).length > 1 || slideType && splitOutsideFences(src, /^---\s*$/).length > 1);
|
|
966
1054
|
const errCount = legacy ? parseLegacy() : reveal ? parseReveal() : parseHeadings();
|
|
967
1055
|
nodes2.forEach((n) => {
|
|
968
1056
|
if (!n.parent || n.parent === n.id || !nodes2.has(n.parent)) n.parent = null;
|
|
@@ -1214,6 +1302,7 @@
|
|
|
1214
1302
|
return { kind: "url", url: RAW + [owner, repo, ref, ...rest].map(encodeURIComponent).join("/") };
|
|
1215
1303
|
}
|
|
1216
1304
|
if (parts.length === 1 && parts[0] === "help") return { kind: "builtin", id: "help" };
|
|
1305
|
+
if (parts.length === 1 && parts[0] === "examples") return { kind: "builtin", id: "showcase" };
|
|
1217
1306
|
if (parts[0] === "gist" && parts[1] && /^[\da-f]+$/i.test(parts[1])) {
|
|
1218
1307
|
return parts[2] ? { kind: "gist", id: parts[1], file: parts[2] } : { kind: "gist", id: parts[1] };
|
|
1219
1308
|
}
|
|
@@ -1222,6 +1311,7 @@
|
|
|
1222
1311
|
function shortLink(source) {
|
|
1223
1312
|
if (source.kind === "builtin") {
|
|
1224
1313
|
if (source.id === "home") return "/";
|
|
1314
|
+
if (source.id === "showcase") return "/examples";
|
|
1225
1315
|
if (source.id.startsWith("template:")) return "/new?template=" + source.id.slice(9);
|
|
1226
1316
|
return "/" + source.id;
|
|
1227
1317
|
}
|
|
@@ -1307,6 +1397,7 @@
|
|
|
1307
1397
|
case "builtin":
|
|
1308
1398
|
if (origin.id === "home") return "Home";
|
|
1309
1399
|
if (origin.id === "help") return "Help";
|
|
1400
|
+
if (origin.id === "showcase") return "the examples";
|
|
1310
1401
|
return "the " + origin.id.replace(/^template:/, "") + " template";
|
|
1311
1402
|
case "gist":
|
|
1312
1403
|
return "a gist" + (origin.file ? " (" + origin.file + ")" : "");
|
|
@@ -1351,6 +1442,37 @@
|
|
|
1351
1442
|
}
|
|
1352
1443
|
}
|
|
1353
1444
|
|
|
1445
|
+
// src/core/media.js
|
|
1446
|
+
function youtubeVideo(href) {
|
|
1447
|
+
let u;
|
|
1448
|
+
try {
|
|
1449
|
+
u = new URL(href);
|
|
1450
|
+
} catch (e) {
|
|
1451
|
+
return null;
|
|
1452
|
+
}
|
|
1453
|
+
const host = u.hostname.replace(/^(www\.|m\.)/, "");
|
|
1454
|
+
let id = null, portrait = false;
|
|
1455
|
+
if (host === "youtu.be") id = u.pathname.slice(1).split("/")[0];
|
|
1456
|
+
else if (host === "youtube.com" || host === "youtube-nocookie.com") {
|
|
1457
|
+
const parts = u.pathname.split("/").filter(Boolean);
|
|
1458
|
+
if (parts[0] === "watch") id = u.searchParams.get("v");
|
|
1459
|
+
else if (["shorts", "live", "embed"].includes(parts[0])) {
|
|
1460
|
+
id = parts[1] || null;
|
|
1461
|
+
portrait = parts[0] === "shorts";
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
if (!id || !/^[\w-]{6,}$/.test(id)) return null;
|
|
1465
|
+
return { id, start: parseStart(u.searchParams.get("t") || u.searchParams.get("start") || ""), portrait };
|
|
1466
|
+
}
|
|
1467
|
+
function parseStart(t) {
|
|
1468
|
+
if (/^\d+$/.test(t)) return +t;
|
|
1469
|
+
const m = t.match(/^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/);
|
|
1470
|
+
return m && t ? +(m[1] || 0) * 3600 + +(m[2] || 0) * 60 + +(m[3] || 0) : 0;
|
|
1471
|
+
}
|
|
1472
|
+
function embedUrl(v) {
|
|
1473
|
+
return "https://www.youtube-nocookie.com/embed/" + encodeURIComponent(v.id) + "?enablejsapi=1&rel=0&playsinline=1" + (v.start ? "&start=" + v.start : "");
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1354
1476
|
// src/core/cut.js
|
|
1355
1477
|
var evTime = (e) => e.obsT ?? e.t;
|
|
1356
1478
|
var sessionFps = (sess) => sess.fps || 60;
|
|
@@ -1448,7 +1570,7 @@
|
|
|
1448
1570
|
var RECORDING_UI = !EMBED || EMBED.recording === true || new URLSearchParams(location.search).has("obs");
|
|
1449
1571
|
document.documentElement.classList.toggle("no-record", !RECORDING_UI);
|
|
1450
1572
|
var reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1451
|
-
var BUILTIN = { home: sample_default, help: help_default, "template:blank": blank_default, "template:talk": talk_default, "template:recording": recording_default };
|
|
1573
|
+
var BUILTIN = { home: sample_default, help: help_default, showcase: showcase_default, "template:blank": blank_default, "template:talk": talk_default, "template:recording": recording_default };
|
|
1452
1574
|
var editor = document.getElementById("editor");
|
|
1453
1575
|
var stage = document.getElementById("stage");
|
|
1454
1576
|
var world = document.getElementById("world");
|
|
@@ -1459,6 +1581,8 @@
|
|
|
1459
1581
|
var mmSvg = document.getElementById("mm-svg");
|
|
1460
1582
|
var mmLabel = document.getElementById("mm-label");
|
|
1461
1583
|
var editorPane = document.getElementById("editor-pane");
|
|
1584
|
+
var BLEED_H = 540;
|
|
1585
|
+
var BLEED_BANDS = 96;
|
|
1462
1586
|
var NODE_W = 440;
|
|
1463
1587
|
var WIDE_W = 720;
|
|
1464
1588
|
var XWIDE_W = 960;
|
|
@@ -1520,11 +1644,74 @@
|
|
|
1520
1644
|
brandEl.hidden = !html;
|
|
1521
1645
|
applyPipState();
|
|
1522
1646
|
document.title = deck.title || "Slidetake";
|
|
1523
|
-
|
|
1524
|
-
if (palette) document.body.dataset.palette = palette;
|
|
1525
|
-
else delete document.body.dataset.palette;
|
|
1647
|
+
applyColors();
|
|
1526
1648
|
applyMode();
|
|
1527
1649
|
}
|
|
1650
|
+
var COLOR_TOKENS = {
|
|
1651
|
+
accent: "--accent",
|
|
1652
|
+
accentSoft: "--accent-teal",
|
|
1653
|
+
line: "--accent-line",
|
|
1654
|
+
ring: "--accent-ring",
|
|
1655
|
+
header: "--header-bg",
|
|
1656
|
+
headerText: "--header-ink",
|
|
1657
|
+
onAccent: "--on-accent"
|
|
1658
|
+
};
|
|
1659
|
+
function deckColors() {
|
|
1660
|
+
const a = String(deck.accent || "").trim();
|
|
1661
|
+
if (!a || !window.CSS || !CSS.supports("color", a)) return null;
|
|
1662
|
+
if (!CSS.supports("color", "oklch(from red l c h)")) return { accent: a, line: a };
|
|
1663
|
+
const at = (l) => "oklch(from " + a + " " + l + " c h)";
|
|
1664
|
+
return {
|
|
1665
|
+
dark: { accent: at(0.8), accentSoft: at(0.87), line: at(0.5) },
|
|
1666
|
+
light: { accent: at(0.45), accentSoft: at(0.4), line: at(0.75), ring: at(0.7) }
|
|
1667
|
+
};
|
|
1668
|
+
}
|
|
1669
|
+
function applyColors() {
|
|
1670
|
+
let css = "";
|
|
1671
|
+
const rule = (sel, o) => {
|
|
1672
|
+
const decl = Object.entries(o || {}).filter(([k, v]) => COLOR_TOKENS[k] && v && typeof v !== "object").map(([k, v]) => COLOR_TOKENS[k] + ":" + String(v).replace(/[;{}<>]/g, "")).join(";");
|
|
1673
|
+
if (decl) css += sel + "{" + decl + "}\n";
|
|
1674
|
+
};
|
|
1675
|
+
[EMBED && EMBED.colors, deckColors()].filter(Boolean).forEach((c) => {
|
|
1676
|
+
["dark", "light"].forEach((mode) => {
|
|
1677
|
+
const m = { ...c, ...c[mode] || {} }, dark = mode === "dark";
|
|
1678
|
+
if (m.accent && typeof m.accent === "string") {
|
|
1679
|
+
m.accentSoft = m.accentSoft || m.accent;
|
|
1680
|
+
m.line = m.line || "color-mix(in srgb, " + m.accent + (dark ? " 45%, #09090b)" : " 55%, #fff)");
|
|
1681
|
+
m.ring = m.ring || (dark ? m.accent : m.line);
|
|
1682
|
+
m.onAccent = m.onAccent || (dark ? "color-mix(in srgb, " + m.accent + " 15%, #000)" : "#fff");
|
|
1683
|
+
}
|
|
1684
|
+
rule(dark ? 'body:not([data-mode="light"])' : 'body[data-mode="light"]', m);
|
|
1685
|
+
});
|
|
1686
|
+
});
|
|
1687
|
+
let el = document.getElementById("st-colors");
|
|
1688
|
+
if (!el) {
|
|
1689
|
+
el = document.createElement("style");
|
|
1690
|
+
el.id = "st-colors";
|
|
1691
|
+
document.head.appendChild(el);
|
|
1692
|
+
}
|
|
1693
|
+
if (el.textContent !== css) el.textContent = css;
|
|
1694
|
+
document.body.classList.toggle("st-header-color", css.includes("--header-bg"));
|
|
1695
|
+
}
|
|
1696
|
+
var pixel = null;
|
|
1697
|
+
function tokenHex(name) {
|
|
1698
|
+
const probe = document.createElement("span");
|
|
1699
|
+
probe.style.color = "var(" + name + ")";
|
|
1700
|
+
document.body.appendChild(probe);
|
|
1701
|
+
const c = getComputedStyle(probe).color;
|
|
1702
|
+
probe.remove();
|
|
1703
|
+
pixel = pixel || Object.assign(document.createElement("canvas"), { width: 1, height: 1 }).getContext("2d", { willReadFrequently: true });
|
|
1704
|
+
pixel.clearRect(0, 0, 1, 1);
|
|
1705
|
+
pixel.fillStyle = "#000";
|
|
1706
|
+
pixel.fillStyle = c;
|
|
1707
|
+
pixel.fillRect(0, 0, 1, 1);
|
|
1708
|
+
return "#" + [...pixel.getImageData(0, 0, 1, 1).data.slice(0, 3)].map((x) => x.toString(16).padStart(2, "0")).join("");
|
|
1709
|
+
}
|
|
1710
|
+
function mixHex(a, b, t) {
|
|
1711
|
+
const p = (h) => [1, 3, 5].map((i) => parseInt(h.slice(i, i + 2), 16));
|
|
1712
|
+
const x = p(a), y = p(b);
|
|
1713
|
+
return "#" + x.map((v, i) => Math.round(v * t + y[i] * (1 - t)).toString(16).padStart(2, "0")).join("");
|
|
1714
|
+
}
|
|
1528
1715
|
var urlMode = new URLSearchParams(location.search).get("mode");
|
|
1529
1716
|
function currentMode() {
|
|
1530
1717
|
if (EMBED && EMBED.themeKey && !urlMode) {
|
|
@@ -1553,7 +1740,7 @@
|
|
|
1553
1740
|
document.documentElement.classList.toggle("dark", next === "dark");
|
|
1554
1741
|
} else save("slidetake:mode", next);
|
|
1555
1742
|
applyMode();
|
|
1556
|
-
if (world.querySelector(".echarts-container")) rebuild(true);
|
|
1743
|
+
if (world.querySelector(".echarts-container, .diagram.d2")) rebuild(true);
|
|
1557
1744
|
}
|
|
1558
1745
|
function cameraList() {
|
|
1559
1746
|
const raw = (deck.camera || "").replace(/^\[|\]$/g, "");
|
|
@@ -1769,6 +1956,110 @@
|
|
|
1769
1956
|
});
|
|
1770
1957
|
});
|
|
1771
1958
|
}
|
|
1959
|
+
function figureFor(img) {
|
|
1960
|
+
const fig = document.createElement("figure");
|
|
1961
|
+
fig.className = "media";
|
|
1962
|
+
img.replaceWith(fig);
|
|
1963
|
+
fig.appendChild(img);
|
|
1964
|
+
const alt = img.getAttribute("alt");
|
|
1965
|
+
if (alt) fig.insertAdjacentHTML("beforeend", "<figcaption>" + escapeHtml(alt) + "</figcaption>");
|
|
1966
|
+
return fig;
|
|
1967
|
+
}
|
|
1968
|
+
function youtubeFigure(v, caption) {
|
|
1969
|
+
const fig = document.createElement("figure");
|
|
1970
|
+
fig.className = "media yt fragment yt-play" + (v.portrait ? " portrait" : "");
|
|
1971
|
+
fig.innerHTML = '<div class="frame"><iframe src="' + embedUrl(v) + '" title="' + escapeHtml(caption || "YouTube video") + '" allow="autoplay; encrypted-media; picture-in-picture; fullscreen" allowfullscreen loading="lazy"></iframe></div>' + (caption ? "<figcaption>" + escapeHtml(caption) + "</figcaption>" : "");
|
|
1972
|
+
return fig;
|
|
1973
|
+
}
|
|
1974
|
+
function gridSize(el, n) {
|
|
1975
|
+
const cols = n <= 4 ? n : n <= 6 ? 3 : 4;
|
|
1976
|
+
el.style.setProperty("--cols", cols);
|
|
1977
|
+
el.style.setProperty("--rows", Math.ceil(n / cols));
|
|
1978
|
+
}
|
|
1979
|
+
var onlyImages = (p) => p.querySelector("img") && !p.textContent.trim() && [...p.children].every((c) => /^(IMG|BR)$/.test(c.tagName));
|
|
1980
|
+
function applyMedia(el, body) {
|
|
1981
|
+
body.querySelectorAll("pre > code.language-svg").forEach((code) => {
|
|
1982
|
+
const img = document.createElement("img");
|
|
1983
|
+
img.src = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(code.textContent.trim());
|
|
1984
|
+
img.alt = "";
|
|
1985
|
+
const p = document.createElement("p");
|
|
1986
|
+
p.appendChild(img);
|
|
1987
|
+
code.parentElement.replaceWith(p);
|
|
1988
|
+
});
|
|
1989
|
+
body.querySelectorAll(":scope > p").forEach((p) => {
|
|
1990
|
+
const only = p.children.length === 1 ? p.children[0] : null;
|
|
1991
|
+
if (!only) return;
|
|
1992
|
+
const href = only.tagName === "A" && p.textContent.trim() === only.textContent.trim() ? only.getAttribute("href") : only.tagName === "IMG" ? only.getAttribute("src") : null;
|
|
1993
|
+
const v = href && youtubeVideo(href);
|
|
1994
|
+
if (v) p.replaceWith(youtubeFigure(v, only.tagName === "IMG" ? only.getAttribute("alt") : ""));
|
|
1995
|
+
});
|
|
1996
|
+
body.querySelectorAll(":scope > ul, :scope > ol").forEach((list) => {
|
|
1997
|
+
const items = [...list.children];
|
|
1998
|
+
if (!items.length || !items.every((li) => li.querySelector("img") && !li.textContent.trim())) return;
|
|
1999
|
+
list.classList.add("gallery");
|
|
2000
|
+
items.forEach((li) => {
|
|
2001
|
+
const img = li.querySelector("img");
|
|
2002
|
+
li.innerHTML = "";
|
|
2003
|
+
li.appendChild(img);
|
|
2004
|
+
figureFor(img);
|
|
2005
|
+
});
|
|
2006
|
+
if (items.length > 1 && items.every((li) => li.classList.contains("fragment"))) {
|
|
2007
|
+
list.classList.add("carousel");
|
|
2008
|
+
items[0].classList.remove("fragment", "fade-up");
|
|
2009
|
+
items.forEach((li, i) => {
|
|
2010
|
+
li.classList.replace("fade-up", "current-visible");
|
|
2011
|
+
const cap = li.querySelector("figcaption");
|
|
2012
|
+
if (cap) cap.dataset.count = i + 1 + " / " + items.length;
|
|
2013
|
+
});
|
|
2014
|
+
} else gridSize(list, items.length);
|
|
2015
|
+
});
|
|
2016
|
+
body.querySelectorAll(":scope > p").forEach((p) => {
|
|
2017
|
+
if (!onlyImages(p)) return;
|
|
2018
|
+
const imgs = [...p.querySelectorAll("img")];
|
|
2019
|
+
if (imgs.length === 1) {
|
|
2020
|
+
p.replaceWith(imgs[0]);
|
|
2021
|
+
figureFor(imgs[0]);
|
|
2022
|
+
return;
|
|
2023
|
+
}
|
|
2024
|
+
const grid = document.createElement("div");
|
|
2025
|
+
grid.className = "gallery grid";
|
|
2026
|
+
p.replaceWith(grid);
|
|
2027
|
+
imgs.forEach((img) => {
|
|
2028
|
+
grid.appendChild(img);
|
|
2029
|
+
figureFor(img);
|
|
2030
|
+
});
|
|
2031
|
+
gridSize(grid, imgs.length);
|
|
2032
|
+
});
|
|
2033
|
+
const parts = [...body.children].filter((c) => !/^H[1-6]$/.test(c.tagName) && !(c.nodeType === 1 && c.tagName === "HR"));
|
|
2034
|
+
const media = parts.filter((c) => c.matches("figure.media"));
|
|
2035
|
+
if (media.length === 1 && parts.length === 1) el.classList.add("card-media");
|
|
2036
|
+
if (parts.length === 1 && (parts[0].matches("figure.media:not(.yt)") || parts[0].matches(".gallery.carousel"))) el.classList.add("card-bleed");
|
|
2037
|
+
const walker = document.createTreeWalker(body, NodeFilter.SHOW_COMMENT);
|
|
2038
|
+
while (walker.nextNode()) if (/^\s*view\s*:\s*full\s*$/i.test(walker.currentNode.data)) el.classList.add("card-full");
|
|
2039
|
+
else if (media.length === 1) {
|
|
2040
|
+
el.classList.add("card-split", parts.indexOf(media[0]) === 0 ? "media-first" : "media-last");
|
|
2041
|
+
const text = document.createElement("div");
|
|
2042
|
+
text.className = "split-text";
|
|
2043
|
+
parts.filter((c) => c !== media[0]).forEach((c) => text.appendChild(c));
|
|
2044
|
+
media[0].after(text);
|
|
2045
|
+
if (parts.indexOf(media[0]) !== 0) text.after(media[0]);
|
|
2046
|
+
}
|
|
2047
|
+
if (body.querySelector(".gallery")) el.classList.add("card-gallery");
|
|
2048
|
+
}
|
|
2049
|
+
function youtubeCommand(fig, func) {
|
|
2050
|
+
const f = fig.querySelector("iframe");
|
|
2051
|
+
if (f && f.contentWindow) f.contentWindow.postMessage(JSON.stringify({ event: "command", func, args: [] }), "*");
|
|
2052
|
+
}
|
|
2053
|
+
function applyStepsComments(root) {
|
|
2054
|
+
const walker = document.createTreeWalker(root, NodeFilter.SHOW_COMMENT);
|
|
2055
|
+
const found = [];
|
|
2056
|
+
while (walker.nextNode()) if (/^\s*steps\s*$/i.test(walker.currentNode.data)) found.push(walker.currentNode);
|
|
2057
|
+
found.forEach((c) => {
|
|
2058
|
+
let next = c.nextSibling;
|
|
2059
|
+
while (next && next.nodeType !== 1) next = next.nextSibling;
|
|
2060
|
+
if (next && /^(UL|OL)$/.test(next.tagName)) next.querySelectorAll(":scope > li").forEach((li) => li.classList.add("fragment", "fade-up"));
|
|
2061
|
+
});
|
|
2062
|
+
}
|
|
1772
2063
|
function collectFragments(root) {
|
|
1773
2064
|
const items = [...root.querySelectorAll(".fragment")].map((e, i) => ({ e, i, k: e.dataset.fragmentIndex }));
|
|
1774
2065
|
if (items.every((x) => x.k === void 0)) return items.map((x) => [x.e]);
|
|
@@ -1789,8 +2080,10 @@
|
|
|
1789
2080
|
if (!n || !n.frags) return;
|
|
1790
2081
|
if (snap) n.el.classList.add("snap");
|
|
1791
2082
|
n.frags.forEach((g, i) => g.forEach((e) => {
|
|
2083
|
+
const was = e.classList.contains("visible");
|
|
1792
2084
|
e.classList.toggle("visible", i < count);
|
|
1793
2085
|
e.classList.toggle("current-fragment", i === count - 1);
|
|
2086
|
+
if (e.classList.contains("yt-play") && was !== i < count && !snap) youtubeCommand(e, i < count ? "playVideo" : "pauseVideo");
|
|
1794
2087
|
}));
|
|
1795
2088
|
if (snap) {
|
|
1796
2089
|
void n.el.offsetWidth;
|
|
@@ -1830,9 +2123,27 @@
|
|
|
1830
2123
|
el.classList.add("measuring");
|
|
1831
2124
|
b.style.zoom = "";
|
|
1832
2125
|
let w = NODE_W;
|
|
1833
|
-
n.visual = !!b.querySelector("iframe, .echarts-container, pre > code.language-dot, .diagram");
|
|
2126
|
+
n.visual = !!b.querySelector("iframe, .echarts-container, pre > code.language-dot, pre > code.language-d2, pre > code.language-echarts, .diagram, figure.media");
|
|
1834
2127
|
if (n.visual) w = XWIDE_W;
|
|
1835
|
-
|
|
2128
|
+
const full = el.classList.contains("card-full");
|
|
2129
|
+
el.classList.remove("img-portrait", "img-landscape", "img-overlay");
|
|
2130
|
+
if (full) w = XWIDE_W;
|
|
2131
|
+
if (el.classList.contains("card-bleed")) {
|
|
2132
|
+
const aspect = Math.max(0, ...[...b.querySelectorAll("img")].map((i) => i.naturalWidth && i.naturalHeight ? i.naturalWidth / i.naturalHeight : 0)) || 16 / 9;
|
|
2133
|
+
if (full || Math.abs(aspect - 16 / 9) < 0.08) {
|
|
2134
|
+
el.classList.add("img-overlay");
|
|
2135
|
+
w = XWIDE_W;
|
|
2136
|
+
} else if (aspect < 1.3) {
|
|
2137
|
+
const iw = Math.min(Math.round(BLEED_H * aspect), XWIDE_W - 300);
|
|
2138
|
+
el.classList.add("img-portrait");
|
|
2139
|
+
el.style.setProperty("--img-w", iw + "px");
|
|
2140
|
+
w = Math.min(XWIDE_W, Math.max(WIDE_W, iw * 2));
|
|
2141
|
+
} else {
|
|
2142
|
+
el.classList.add("img-landscape");
|
|
2143
|
+
w = Math.round(Math.max(NODE_W, Math.min(XWIDE_W, (BLEED_H - BLEED_BANDS) * aspect)));
|
|
2144
|
+
el.style.setProperty("--img-h", Math.round(w / aspect) + "px");
|
|
2145
|
+
}
|
|
2146
|
+
} else if (b.querySelector('[style*="flex"], [style*="grid"], .r-hstack') || b.querySelectorAll("img").length >= 4) w = WIDE_W;
|
|
1836
2147
|
const tables = b.querySelectorAll("table");
|
|
1837
2148
|
if (tables.length) {
|
|
1838
2149
|
el.style.width = XWIDE_W + "px";
|
|
@@ -1867,6 +2178,73 @@
|
|
|
1867
2178
|
}
|
|
1868
2179
|
var VIZ_URL = "https://cdn.jsdelivr.net/npm/@viz-js/viz@3.4.0/lib/viz-standalone.js";
|
|
1869
2180
|
var ECHARTS_URL = "https://cdnjs.cloudflare.com/ajax/libs/echarts/5.5.0/echarts.min.js";
|
|
2181
|
+
var ECHARTS_THEME = {
|
|
2182
|
+
dark: {
|
|
2183
|
+
palette: ["#60a5fa", "#f472b6", "#a78bfa", "#fb923c", "#facc15", "#a1a1aa"],
|
|
2184
|
+
text: "#e4e4e7",
|
|
2185
|
+
muted: "#a1a1aa",
|
|
2186
|
+
line: "#3f3f46",
|
|
2187
|
+
split: "#27272a",
|
|
2188
|
+
tip: "#18181b"
|
|
2189
|
+
},
|
|
2190
|
+
light: {
|
|
2191
|
+
palette: ["#2563eb", "#db2777", "#7c3aed", "#ea580c", "#ca8a04", "#71717a"],
|
|
2192
|
+
text: "#27272a",
|
|
2193
|
+
muted: "#71717a",
|
|
2194
|
+
line: "#d4d4d8",
|
|
2195
|
+
split: "#e4e4e7",
|
|
2196
|
+
tip: "#ffffff"
|
|
2197
|
+
}
|
|
2198
|
+
};
|
|
2199
|
+
function chartTheme() {
|
|
2200
|
+
const mode = currentMode() === "light" ? "light" : "dark", accent = tokenHex(mode === "light" ? "--accent-ring" : "--accent");
|
|
2201
|
+
const name = "slidetake-" + mode + "-" + accent.slice(1);
|
|
2202
|
+
if (!chartThemes.has(name)) {
|
|
2203
|
+
registerChartTheme(name, ECHARTS_THEME[mode], accent);
|
|
2204
|
+
chartThemes.add(name);
|
|
2205
|
+
}
|
|
2206
|
+
return name;
|
|
2207
|
+
}
|
|
2208
|
+
var chartThemes = /* @__PURE__ */ new Set();
|
|
2209
|
+
function registerChartTheme(name, t, accent) {
|
|
2210
|
+
const axis = {
|
|
2211
|
+
axisLine: { lineStyle: { color: t.line } },
|
|
2212
|
+
axisTick: { lineStyle: { color: t.line } },
|
|
2213
|
+
axisLabel: { color: t.muted },
|
|
2214
|
+
splitLine: { lineStyle: { color: t.split } },
|
|
2215
|
+
nameTextStyle: { color: t.muted }
|
|
2216
|
+
};
|
|
2217
|
+
echarts.registerTheme(name, {
|
|
2218
|
+
color: [accent, ...t.palette],
|
|
2219
|
+
backgroundColor: "transparent",
|
|
2220
|
+
textStyle: { color: t.text, fontFamily: "'IBM Plex Sans', sans-serif" },
|
|
2221
|
+
title: { textStyle: { color: t.text }, subtextStyle: { color: t.muted } },
|
|
2222
|
+
legend: { textStyle: { color: t.text } },
|
|
2223
|
+
tooltip: { backgroundColor: t.tip, borderColor: t.line, textStyle: { color: t.text } },
|
|
2224
|
+
categoryAxis: axis,
|
|
2225
|
+
valueAxis: axis,
|
|
2226
|
+
logAxis: axis,
|
|
2227
|
+
timeAxis: axis,
|
|
2228
|
+
line: { symbolSize: 6, lineStyle: { width: 2.5 } }
|
|
2229
|
+
});
|
|
2230
|
+
}
|
|
2231
|
+
var D2_URL = "https://esm.sh/@terrastruct/d2@0.1.33";
|
|
2232
|
+
var d2 = null;
|
|
2233
|
+
var D2_NEUTRALS = {
|
|
2234
|
+
dark: { N1: "#e4e4e7", N2: "#a1a1aa", N3: "#a1a1aa", N4: "#323238", N5: "#27272a", N6: "#18181b", N7: "#09090b" },
|
|
2235
|
+
light: { N1: "#27272a", N2: "#71717a", N3: "#71717a", N4: "#e4e4e7", N5: "#e4e4e7", N6: "#f4f4f5", N7: "#ffffff" }
|
|
2236
|
+
};
|
|
2237
|
+
function d2Theme() {
|
|
2238
|
+
const mode = currentMode() === "light" ? "light" : "dark", card = tokenHex("--node-bg");
|
|
2239
|
+
const tint = mode === "dark" ? tokenHex("--accent") : tokenHex("--accent-line");
|
|
2240
|
+
const steps = mode === "dark" ? [0.58, 0.38, 0.25, 0.18, 0.12] : [0.7, 0.45, 0.25, 0.15, 0.08];
|
|
2241
|
+
const t = { ...D2_NEUTRALS[mode], B1: tokenHex("--accent") };
|
|
2242
|
+
steps.forEach((x, i) => {
|
|
2243
|
+
t["B" + (i + 2)] = mixHex(tint, card, x);
|
|
2244
|
+
});
|
|
2245
|
+
return t;
|
|
2246
|
+
}
|
|
2247
|
+
var withD2Defaults = (code) => /d2-config\s*:/.test(code) ? code : "vars: {\n d2-config: {\n layout-engine: elk\n }\n}\n" + code;
|
|
1870
2248
|
var scripts = {};
|
|
1871
2249
|
function loadScript(url) {
|
|
1872
2250
|
return scripts[url] || (scripts[url] = new Promise((resolve, reject) => {
|
|
@@ -1885,8 +2263,15 @@
|
|
|
1885
2263
|
async function renderRich() {
|
|
1886
2264
|
const gen = buildGen;
|
|
1887
2265
|
const dots = [...world.querySelectorAll(".node pre > code.language-dot")];
|
|
2266
|
+
world.querySelectorAll(".node pre > code.language-echarts").forEach((code) => {
|
|
2267
|
+
const div = document.createElement("div");
|
|
2268
|
+
div.className = "echarts-container";
|
|
2269
|
+
div.dataset.chart = code.textContent;
|
|
2270
|
+
code.parentElement.replaceWith(div);
|
|
2271
|
+
});
|
|
1888
2272
|
const charts = [...world.querySelectorAll(".node .echarts-container[data-chart]")];
|
|
1889
|
-
|
|
2273
|
+
const d2s = [...world.querySelectorAll(".node pre > code.language-d2")];
|
|
2274
|
+
if (!dots.length && !charts.length && !d2s.length) return;
|
|
1890
2275
|
const problems = [];
|
|
1891
2276
|
if (dots.length) {
|
|
1892
2277
|
try {
|
|
@@ -1908,10 +2293,39 @@
|
|
|
1908
2293
|
problems.push("diagrams");
|
|
1909
2294
|
}
|
|
1910
2295
|
}
|
|
2296
|
+
if (d2s.length) {
|
|
2297
|
+
try {
|
|
2298
|
+
if (!d2) {
|
|
2299
|
+
const mod = await import(
|
|
2300
|
+
/* runtime, not bundled */
|
|
2301
|
+
D2_URL
|
|
2302
|
+
);
|
|
2303
|
+
d2 = new mod.D2();
|
|
2304
|
+
}
|
|
2305
|
+
if (gen !== buildGen) return;
|
|
2306
|
+
const theme = d2Theme();
|
|
2307
|
+
for (const code of d2s) {
|
|
2308
|
+
const box = document.createElement("div");
|
|
2309
|
+
box.className = "diagram d2";
|
|
2310
|
+
try {
|
|
2311
|
+
const result = await d2.compile(withD2Defaults(code.textContent));
|
|
2312
|
+
box.innerHTML = await d2.render(result.diagram, { ...result.renderOptions || {}, themeOverrides: theme, darkThemeOverrides: theme });
|
|
2313
|
+
} catch (e) {
|
|
2314
|
+
box.className = "diagram err";
|
|
2315
|
+
box.textContent = "Diagram error: " + (e.message || e);
|
|
2316
|
+
}
|
|
2317
|
+
if (gen !== buildGen) return;
|
|
2318
|
+
code.parentElement.replaceWith(box);
|
|
2319
|
+
}
|
|
2320
|
+
} catch (e) {
|
|
2321
|
+
problems.push("D2 diagrams");
|
|
2322
|
+
}
|
|
2323
|
+
}
|
|
1911
2324
|
if (charts.length) {
|
|
1912
2325
|
try {
|
|
1913
2326
|
await loadScript(ECHARTS_URL);
|
|
1914
2327
|
if (gen !== buildGen) return;
|
|
2328
|
+
const theme = chartTheme();
|
|
1915
2329
|
charts.forEach((div) => {
|
|
1916
2330
|
let opt;
|
|
1917
2331
|
try {
|
|
@@ -1920,7 +2334,7 @@
|
|
|
1920
2334
|
div.textContent = "Chart data is not valid JSON.";
|
|
1921
2335
|
return;
|
|
1922
2336
|
}
|
|
1923
|
-
echarts.init(div,
|
|
2337
|
+
echarts.init(div, theme, { renderer: "svg" }).setOption(Object.assign({ backgroundColor: "transparent", animation: !reduceMotion }, opt));
|
|
1924
2338
|
});
|
|
1925
2339
|
} catch (e) {
|
|
1926
2340
|
problems.push("charts");
|
|
@@ -1984,6 +2398,8 @@
|
|
|
1984
2398
|
el.innerHTML = (crumb ? '<div class="crumb">' + escapeHtml(crumb) + "</div>" : "") + '<div class="body">' + n.html + "</div>" + (n.err ? '<div class="err-badge">!</div>' : "");
|
|
1985
2399
|
const body = el.querySelector(".body");
|
|
1986
2400
|
applyElementComments(body);
|
|
2401
|
+
applyStepsComments(body);
|
|
2402
|
+
applyMedia(el, body);
|
|
1987
2403
|
body.querySelectorAll("thead").forEach((h) => {
|
|
1988
2404
|
if (!h.textContent.trim()) h.remove();
|
|
1989
2405
|
});
|
|
@@ -2160,6 +2576,12 @@
|
|
|
2160
2576
|
function focusOn(id, instant) {
|
|
2161
2577
|
const n = nodes.get(id);
|
|
2162
2578
|
if (!n) return;
|
|
2579
|
+
document.body.classList.toggle("full-card", n.el.classList.contains("card-full"));
|
|
2580
|
+
if (n.el.classList.contains("card-full")) {
|
|
2581
|
+
const zoom2 = Math.min(stage.clientWidth / n._w, stage.clientHeight / n._h);
|
|
2582
|
+
flyTo({ x: n.cx, y: n.cy, zoom: zoom2 }, instant);
|
|
2583
|
+
return;
|
|
2584
|
+
}
|
|
2163
2585
|
const f = fitInSafe(n._w, n._h, slideFill);
|
|
2164
2586
|
const sec = sectionOf(id);
|
|
2165
2587
|
const peers = order.filter((x) => sectionOf(x) === sec && !nodes.get(x).visual).map((x) => {
|
|
@@ -2171,6 +2593,7 @@
|
|
|
2171
2593
|
flyTo(Object.assign(aimAt(n.cx, n.cy, f, zoom), { zoom }), instant);
|
|
2172
2594
|
}
|
|
2173
2595
|
function fitAll(instant) {
|
|
2596
|
+
document.body.classList.remove("full-card");
|
|
2174
2597
|
const all = [...nodes.values()];
|
|
2175
2598
|
if (!all.length) return;
|
|
2176
2599
|
const vw = stage.clientWidth, vh = stage.clientHeight;
|
|
@@ -2264,9 +2687,24 @@
|
|
|
2264
2687
|
scheduleAutoslide(n);
|
|
2265
2688
|
}
|
|
2266
2689
|
var TRANSFORM_PROPS = ["x", "y", "xPercent", "yPercent", "scale", "scaleX", "scaleY", "rotation", "rotate", "skewX", "skewY"];
|
|
2690
|
+
function autoEntrance(n) {
|
|
2691
|
+
if (!order.length || n.id !== order[0] && n.id !== order[order.length - 1]) return null;
|
|
2692
|
+
if (n.el.querySelector("[data-gsap], .title-scramble")) return null;
|
|
2693
|
+
return [...n.el.querySelector(".body").children].filter((el) => !el.classList.contains("fragment"));
|
|
2694
|
+
}
|
|
2267
2695
|
function playEntrances(n) {
|
|
2268
2696
|
if (n._played || !window.gsap || reduceMotion) return;
|
|
2269
2697
|
n._played = true;
|
|
2698
|
+
const auto = autoEntrance(n);
|
|
2699
|
+
if (auto && auto.length) {
|
|
2700
|
+
n._auto = auto;
|
|
2701
|
+
const [head, ...rest] = auto;
|
|
2702
|
+
if (/^H[1-3]$/.test(head.tagName) && !head.children.length) {
|
|
2703
|
+
head.classList.add("auto-scramble");
|
|
2704
|
+
scramble(head);
|
|
2705
|
+
} else rest.unshift(head);
|
|
2706
|
+
gsap.from(rest, { opacity: 0, y: 24, duration: 0.7, ease: "power2.out", delay: 0.5, stagger: 0.45 });
|
|
2707
|
+
}
|
|
2270
2708
|
n.el.querySelectorAll("[data-gsap]").forEach((el) => {
|
|
2271
2709
|
let cfg;
|
|
2272
2710
|
try {
|
|
@@ -2284,6 +2722,13 @@
|
|
|
2284
2722
|
if (!n || !n._played) return;
|
|
2285
2723
|
n._played = false;
|
|
2286
2724
|
if (!window.gsap) return;
|
|
2725
|
+
if (n._auto) {
|
|
2726
|
+
n._auto.forEach((el) => {
|
|
2727
|
+
gsap.killTweensOf(el);
|
|
2728
|
+
gsap.set(el, { clearProps: "opacity,transform" });
|
|
2729
|
+
});
|
|
2730
|
+
n._auto = null;
|
|
2731
|
+
}
|
|
2287
2732
|
n.el.querySelectorAll("[data-gsap]").forEach((el) => {
|
|
2288
2733
|
gsap.killTweensOf(el);
|
|
2289
2734
|
let cfg = {};
|
|
@@ -2294,7 +2739,7 @@
|
|
|
2294
2739
|
const props = new Set(Object.keys(Object.assign({}, cfg.from, cfg.to)).map((k) => TRANSFORM_PROPS.includes(k) ? "transform" : k));
|
|
2295
2740
|
if (props.size) gsap.set(el, { clearProps: [...props].join(",") });
|
|
2296
2741
|
});
|
|
2297
|
-
n.el.querySelectorAll(".title-scramble").forEach((el) => {
|
|
2742
|
+
n.el.querySelectorAll(".title-scramble, .auto-scramble").forEach((el) => {
|
|
2298
2743
|
if (el._scramble) el._scramble.kill();
|
|
2299
2744
|
if (el.dataset.text) el.textContent = el.dataset.text;
|
|
2300
2745
|
});
|
|
@@ -2373,6 +2818,7 @@
|
|
|
2373
2818
|
function leaveSlide() {
|
|
2374
2819
|
const prev = nodes.get(currentId);
|
|
2375
2820
|
if (!prev) return;
|
|
2821
|
+
prev.el.querySelectorAll("figure.yt").forEach((f) => youtubeCommand(f, "pauseVideo"));
|
|
2376
2822
|
applyFragments(prev, prev.frags.length, true);
|
|
2377
2823
|
resetEntrances(prev);
|
|
2378
2824
|
}
|
|
@@ -3523,7 +3969,7 @@
|
|
|
3523
3969
|
sizeStep(1);
|
|
3524
3970
|
} else if (k === "-" || k === "_") {
|
|
3525
3971
|
sizeStep(-1);
|
|
3526
|
-
} else if (k === "?") {
|
|
3972
|
+
} else if (k === "?" || k === "k" || k === "K") {
|
|
3527
3973
|
help.classList.add("open");
|
|
3528
3974
|
} else if (k === "Escape") {
|
|
3529
3975
|
if (!backFromOverview() && presenting) setPresent(false);
|
|
@@ -3631,9 +4077,16 @@
|
|
|
3631
4077
|
credit.title = "Made with Slidetake";
|
|
3632
4078
|
credit.setAttribute("aria-label", "Made with Slidetake");
|
|
3633
4079
|
credit.innerHTML = LOGO + '<span class="word">Slide<span>take</span></span>';
|
|
3634
|
-
const
|
|
3635
|
-
|
|
3636
|
-
|
|
4080
|
+
const actions = document.querySelector("header .hdr-actions");
|
|
4081
|
+
actions.insertBefore(credit, actions.firstChild);
|
|
4082
|
+
if (!RECORDING_UI) {
|
|
4083
|
+
actions.insertAdjacentHTML(
|
|
4084
|
+
"beforeend",
|
|
4085
|
+
'<button class="btn" id="hdr-keys" title="Keyboard shortcuts (K)">\u2328 Keys</button><button class="btn" id="hdr-full" title="Fullscreen (F)">\u26F6 Fullscreen</button>'
|
|
4086
|
+
);
|
|
4087
|
+
document.getElementById("hdr-keys").onclick = () => document.getElementById("help").classList.add("open");
|
|
4088
|
+
document.getElementById("hdr-full").onclick = () => setPresent(!presenting);
|
|
4089
|
+
}
|
|
3637
4090
|
}
|
|
3638
4091
|
var route = routeOf(location.pathname, location.search, location.hash);
|
|
3639
4092
|
var startId = route.page === "pick" ? "" : route.slide;
|