slidetake 0.1.0 → 0.1.1
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 +8 -1
- package/dist/index.html +423 -27
- package/dist/slidetake.js +320 -66
- 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">
|
|
@@ -400,6 +400,65 @@
|
|
|
400
400
|
.node .r-hstack{display:flex;flex-direction:row;align-items:center;justify-content:center;}
|
|
401
401
|
.node .r-vstack{display:flex;flex-direction:column;align-items:center;justify-content:center;}
|
|
402
402
|
.node .body img{max-width:100%;height:auto;object-fit:contain;}
|
|
403
|
+
/* ---------- media from plain markdown (see applyMedia) ---------- */
|
|
404
|
+
.node .body figure.media{margin:0;}
|
|
405
|
+
.node .body figure.media img{display:block;width:100%;height:auto;max-height:70vh;object-fit:contain;border-radius:8px;}
|
|
406
|
+
.node .body figure.media figcaption{margin-top:8px;font-size:.82em;color:var(--text-muted);line-height:1.45;}
|
|
407
|
+
.node .body figure.yt .frame{position:relative;width:100%;aspect-ratio:16/9;border-radius:8px;overflow:hidden;background:#000;}
|
|
408
|
+
.node .body figure.yt.portrait .frame{aspect-ratio:9/16;max-height:70vh;width:auto;margin:0 auto;}
|
|
409
|
+
.node .body figure.yt iframe{position:absolute;inset:0;width:100%;height:100%;border:0;}
|
|
410
|
+
/* the video is always on show; its step only plays it */
|
|
411
|
+
.node .fragment.yt-play{opacity:1 !important;visibility:inherit !important;transform:none !important;}
|
|
412
|
+
.node.card-split .body{display:grid;grid-template-columns:minmax(0,1.25fr) minmax(0,1fr);gap:4px 22px;align-items:center;}
|
|
413
|
+
.node.card-split .body > :is(h1,h2,h3,h4,h5,h6){grid-column:1 / -1;}
|
|
414
|
+
.node.card-split .body .split-text > :first-child{margin-top:0;}
|
|
415
|
+
.node.card-split.media-last .body{grid-template-columns:minmax(0,1fr) minmax(0,1.25fr);}
|
|
416
|
+
.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;}
|
|
417
|
+
.node .body .gallery li{margin:0;}
|
|
418
|
+
.node .body .gallery figure.media img{max-height:calc(56vh / var(--rows,1));margin:0 auto;}
|
|
419
|
+
.node .body .gallery figure.media figcaption{font-size:.72em;text-align:center;}
|
|
420
|
+
/* a stepped gallery: the images stack in one place and each press brings the next */
|
|
421
|
+
.node .body .gallery.carousel{grid-template-columns:minmax(0,1fr);}
|
|
422
|
+
.node .body .gallery.carousel > li{grid-area:1/1;}
|
|
423
|
+
.node .body .gallery.carousel figure.media img{max-height:58vh;}
|
|
424
|
+
.node .body .gallery.carousel figure.media figcaption{font-size:.82em;}
|
|
425
|
+
.node .body .gallery.carousel figcaption[data-count]::before{content:attr(data-count) " ";color:var(--accent);font-weight:600;white-space:pre;}
|
|
426
|
+
.node .body .gallery.carousel:has(> li.visible) > li:not(.fragment){opacity:0;visibility:hidden;transition:opacity .45s ease, visibility 0s .45s;}
|
|
427
|
+
.node .body .gallery.carousel > li:not(.fragment){transition:opacity .45s ease;}
|
|
428
|
+
/* image cards: an image or carousel alone, laid out by the image's shape (see sizeCard) */
|
|
429
|
+
div.node.card-bleed{padding:0;overflow:hidden;}
|
|
430
|
+
.node.card-bleed .body .gallery{margin:0;}
|
|
431
|
+
.node.card-bleed .body figure.media img,
|
|
432
|
+
.node.card-bleed .body .gallery.carousel figure.media img{max-height:none;border-radius:0;background:var(--code-bg);}
|
|
433
|
+
.node.card-bleed .body figure.media figcaption{margin:0;text-align:left;font-size:.9em;}
|
|
434
|
+
/* landscape: the image spans the card; the heading sits above it, the caption below */
|
|
435
|
+
.node.img-landscape .crumb{margin:12px 18px 4px;}
|
|
436
|
+
.node.img-landscape .body > :is(h1,h2,h3,h4,h5,h6):first-child{margin:0 18px 10px;}
|
|
437
|
+
.node.img-landscape .body figure.media img{width:100%;height:var(--img-h);object-fit:contain;}
|
|
438
|
+
.node.img-landscape .body figure.media figcaption{padding:10px 18px 14px;}
|
|
439
|
+
/* portrait or near-square: the image on the right at the card's height; the heading and caption share the left */
|
|
440
|
+
div.node.img-portrait{height:540px;padding:20px calc(var(--img-w) + 26px) 22px 24px;}
|
|
441
|
+
.node.img-portrait .body{display:flex;flex-direction:column;height:100%;}
|
|
442
|
+
.node.img-portrait .crumb{margin-bottom:10px;}
|
|
443
|
+
.node.img-portrait .body > :is(h1,h2,h3,h4,h5,h6):first-child{font-size:22px;}
|
|
444
|
+
.node.img-portrait .body > .gallery, .node.img-portrait .body > figure.media{margin-top:auto;}
|
|
445
|
+
.node.img-portrait .body figure.media img{position:absolute;top:0;right:0;width:var(--img-w);height:540px;object-fit:contain;}
|
|
446
|
+
.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);}
|
|
447
|
+
/* 16:9, or a full-screen card: the image fills the card, the heading and caption over it */
|
|
448
|
+
.node.img-overlay::before{content:"";position:absolute;inset:0 0 auto;height:96px;z-index:2;pointer-events:none;
|
|
449
|
+
background:linear-gradient(rgba(0,0,0,.72), rgba(0,0,0,0));border-radius:8px 8px 0 0;}
|
|
450
|
+
.node.img-overlay .crumb{position:absolute;top:12px;left:18px;right:18px;z-index:3;margin:0;color:rgba(255,255,255,.72);}
|
|
451
|
+
.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;
|
|
452
|
+
color:#fff;text-shadow:0 1px 6px rgba(0,0,0,.6);}
|
|
453
|
+
.node.img-overlay .body figure.media{position:relative;}
|
|
454
|
+
.node.img-overlay .body figure.media img{width:100%;height:540px;object-fit:contain;}
|
|
455
|
+
.node.card-full.img-overlay .body figure.media img{object-fit:cover;}
|
|
456
|
+
.node.img-overlay .body figure.media figcaption{position:absolute;left:0;right:0;bottom:0;padding:36px 18px 14px;
|
|
457
|
+
color:#f4f4f5;background:linear-gradient(rgba(0,0,0,0), rgba(0,0,0,.78));}
|
|
458
|
+
.node.img-overlay .body .gallery.carousel figure.media figcaption::before{color:#f5c542;}
|
|
459
|
+
/* <!-- view: full -->: a 16:9 card that fills the screen, with the map and breadcrumbs out of the way */
|
|
460
|
+
div.node.card-full{height:540px;overflow:hidden;}
|
|
461
|
+
body.full-card #breadcrumbs, body.full-card #minimap{opacity:0;pointer-events:none;}
|
|
403
462
|
/* measure cards at their resting size, without grow/zoom transforms */
|
|
404
463
|
div.node.measuring .fragment{transform:none !important;transition:none !important;}
|
|
405
464
|
/* a card re-measured mid-entrance (a theme switch replays it) must not count a gsap "from" state such
|
|
@@ -411,6 +470,9 @@
|
|
|
411
470
|
.node .diagram{background:#f8fafc;border:1px solid var(--panel-line);border-radius:8px;padding:12px;margin:0 0 10px;overflow:auto;}
|
|
412
471
|
.node .diagram svg{display:block;width:100%;height:auto;max-height:640px;}
|
|
413
472
|
.node .diagram.err{background:none;color:var(--danger);font-family:var(--mono);font-size:12px;padding:0;}
|
|
473
|
+
/* D2 is drawn in the deck's own palette, so it needs no light backdrop */
|
|
474
|
+
.node .diagram.d2{background:none;border:none;padding:0;}
|
|
475
|
+
.node .diagram.d2 svg{max-height:62vh;}
|
|
414
476
|
.node .echarts-container{width:100%;height:360px;margin:0 0 10px;}
|
|
415
477
|
|
|
416
478
|
/* ---------- overlays ---------- */
|
|
@@ -469,12 +531,19 @@
|
|
|
469
531
|
html.embed .brand .trail a:hover{color:var(--accent);}
|
|
470
532
|
html.embed .brand .trail a:last-child{color:var(--accent);}
|
|
471
533
|
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.
|
|
534
|
+
#credit{display:inline-flex;align-items:center;gap:6px;padding:4px 6px;text-decoration:none;
|
|
535
|
+
font-family:var(--display);font-weight:700;font-size:14px;color:var(--text);}
|
|
536
|
+
#credit .logo{width:18px;height:18px;fill:var(--accent);}
|
|
537
|
+
#credit .word > span{color:var(--accent);}
|
|
538
|
+
#credit:hover{opacity:.85;}
|
|
539
|
+
html.embed #btn-help{display:none !important;}
|
|
540
|
+
/* a reader's page (embedded, not recording): no bottom bar, except the arrows on touch screens */
|
|
541
|
+
html.embed.no-record #navbar{display:none;}
|
|
542
|
+
@media (pointer:coarse){
|
|
543
|
+
html.embed.no-record #navbar{display:flex;}
|
|
544
|
+
html.embed.no-record #navbar > :not(.touch-only){display:none !important;}
|
|
545
|
+
}
|
|
546
|
+
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
547
|
/* the logo written into a heading: #  Slidetake */
|
|
479
548
|
.node .body :is(h1,h2) img[src$="favicon.svg"]{height:1em;width:auto;vertical-align:-.12em;margin-right:.25em;display:inline;}
|
|
480
549
|
#brand .st-mark{display:inline-flex;align-items:center;gap:8px;font-family:var(--display);font-weight:700;font-size:20px;color:var(--text);}
|
|
@@ -553,6 +622,12 @@
|
|
|
553
622
|
</style>
|
|
554
623
|
</head>
|
|
555
624
|
<body>
|
|
625
|
+
<noscript>
|
|
626
|
+
<h1>Slidetake</h1>
|
|
627
|
+
<p><strong>Write in markdown. Present on a spatial canvas. Record without timeline editing.</strong></p>
|
|
628
|
+
<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>
|
|
629
|
+
<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>
|
|
630
|
+
</noscript>
|
|
556
631
|
|
|
557
632
|
<header>
|
|
558
633
|
<div class="brand">
|
|
@@ -583,7 +658,7 @@
|
|
|
583
658
|
</div>
|
|
584
659
|
<div id="breadcrumbs"></div>
|
|
585
660
|
<div id="navbar">
|
|
586
|
-
<button id="btn-keys" title="Keyboard shortcuts (
|
|
661
|
+
<button id="btn-keys" title="Keyboard shortcuts (K)">⌨<span class="lbl"> Keys</span></button>
|
|
587
662
|
<button id="nav-prev" class="touch-only" title="Previous (←)" aria-label="Previous">←</button>
|
|
588
663
|
<button id="nav-next" class="touch-only" title="Next (→)" aria-label="Next">→</button>
|
|
589
664
|
<div class="divider"></div>
|
|
@@ -628,6 +703,7 @@
|
|
|
628
703
|
<tr><td><kbd>E</kbd></td><td>editor: write, open, share</td></tr>
|
|
629
704
|
<tr><td><kbd>L</kbd></td><td>light / dark</td></tr>
|
|
630
705
|
<tr class="rec"><td><kbd>C</kbd> <kbd>V</kbd> <kbd>R</kbd></td><td>camera, camera layouts, record</td></tr>
|
|
706
|
+
<tr><td><kbd>K</kbd> <kbd>?</kbd></td><td>this card</td></tr>
|
|
631
707
|
</table>
|
|
632
708
|
<p>Drag to pan, scroll or pinch to zoom, click a card to fly to it.</p>
|
|
633
709
|
<p><a href="/help" target="_blank" rel="noopener">The full guide →</a> writing decks, sharing, recording, camera, review and cut.</p>
|
|
@@ -643,6 +719,7 @@
|
|
|
643
719
|
<li><a href="/new?template=blank"><strong>Blank</strong><span>A first card, a section and a detail.</span></a></li>
|
|
644
720
|
<li><a href="/new?template=talk"><strong>Talk</strong><span>Why it matters, the idea, trade-offs, summary.</span></a></li>
|
|
645
721
|
<li><a href="/new?template=recording"><strong>Recording</strong><span>Camera steps, an overview moment and a closing on camera.</span></a></li>
|
|
722
|
+
<li><a href="/examples"><strong>Examples</strong><span>Everything a deck can hold: diagrams, charts, images, YouTube.</span></a></li>
|
|
646
723
|
</ul>
|
|
647
724
|
<p>Or <strong>⇣ Load</strong> a deck from a link, or <strong>Open</strong> a file from this computer.</p>
|
|
648
725
|
</div>
|
|
@@ -769,20 +846,23 @@
|
|
|
769
846
|
"use strict";
|
|
770
847
|
(() => {
|
|
771
848
|
// src/sample.md
|
|
772
|
-
var sample_default = "---\ntitle: Slidetake \u2014 markdown
|
|
849
|
+
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
850
|
|
|
774
851
|
// 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";
|
|
852
|
+
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\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";
|
|
776
853
|
|
|
777
|
-
//
|
|
854
|
+
// examples/blank.md
|
|
778
855
|
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
856
|
|
|
780
|
-
//
|
|
857
|
+
// examples/talk.md
|
|
781
858
|
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
859
|
|
|
783
|
-
//
|
|
860
|
+
// examples/recording.md
|
|
784
861
|
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
862
|
|
|
863
|
+
// examples/showcase.md
|
|
864
|
+
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="#e0b024"/>\n <rect x="115" y="20" width="90" height="80" rx="10" fill="#e0b024" opacity=".7"/>\n <rect x="220" y="20" width="90" height="80" rx="10" fill="#e0b024" 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';
|
|
865
|
+
|
|
786
866
|
// src/core/text.js
|
|
787
867
|
function slugify(s) {
|
|
788
868
|
return s.toLowerCase().replace(/[^\p{L}\p{N}]+/gu, "-").replace(/^-+|-+$/g, "") || "card";
|
|
@@ -962,7 +1042,8 @@
|
|
|
962
1042
|
const legacy = /^\+\+\+[ \t]*$/m.test(src);
|
|
963
1043
|
let deck2 = {};
|
|
964
1044
|
if (!legacy) ({ deck: deck2, body: src } = parseDeckSettings(src));
|
|
965
|
-
const
|
|
1045
|
+
const slideType = /^slides?$/i.test(String(deck2.layout || "")) || /^slides?$/i.test(String(deck2.type || ""));
|
|
1046
|
+
const reveal = !legacy && (splitOutsideFences(src, /^--\s*$/).length > 1 || slideType && splitOutsideFences(src, /^---\s*$/).length > 1);
|
|
966
1047
|
const errCount = legacy ? parseLegacy() : reveal ? parseReveal() : parseHeadings();
|
|
967
1048
|
nodes2.forEach((n) => {
|
|
968
1049
|
if (!n.parent || n.parent === n.id || !nodes2.has(n.parent)) n.parent = null;
|
|
@@ -1214,6 +1295,7 @@
|
|
|
1214
1295
|
return { kind: "url", url: RAW + [owner, repo, ref, ...rest].map(encodeURIComponent).join("/") };
|
|
1215
1296
|
}
|
|
1216
1297
|
if (parts.length === 1 && parts[0] === "help") return { kind: "builtin", id: "help" };
|
|
1298
|
+
if (parts.length === 1 && parts[0] === "examples") return { kind: "builtin", id: "showcase" };
|
|
1217
1299
|
if (parts[0] === "gist" && parts[1] && /^[\da-f]+$/i.test(parts[1])) {
|
|
1218
1300
|
return parts[2] ? { kind: "gist", id: parts[1], file: parts[2] } : { kind: "gist", id: parts[1] };
|
|
1219
1301
|
}
|
|
@@ -1222,6 +1304,7 @@
|
|
|
1222
1304
|
function shortLink(source) {
|
|
1223
1305
|
if (source.kind === "builtin") {
|
|
1224
1306
|
if (source.id === "home") return "/";
|
|
1307
|
+
if (source.id === "showcase") return "/examples";
|
|
1225
1308
|
if (source.id.startsWith("template:")) return "/new?template=" + source.id.slice(9);
|
|
1226
1309
|
return "/" + source.id;
|
|
1227
1310
|
}
|
|
@@ -1307,6 +1390,7 @@
|
|
|
1307
1390
|
case "builtin":
|
|
1308
1391
|
if (origin.id === "home") return "Home";
|
|
1309
1392
|
if (origin.id === "help") return "Help";
|
|
1393
|
+
if (origin.id === "showcase") return "the examples";
|
|
1310
1394
|
return "the " + origin.id.replace(/^template:/, "") + " template";
|
|
1311
1395
|
case "gist":
|
|
1312
1396
|
return "a gist" + (origin.file ? " (" + origin.file + ")" : "");
|
|
@@ -1351,6 +1435,37 @@
|
|
|
1351
1435
|
}
|
|
1352
1436
|
}
|
|
1353
1437
|
|
|
1438
|
+
// src/core/media.js
|
|
1439
|
+
function youtubeVideo(href) {
|
|
1440
|
+
let u;
|
|
1441
|
+
try {
|
|
1442
|
+
u = new URL(href);
|
|
1443
|
+
} catch (e) {
|
|
1444
|
+
return null;
|
|
1445
|
+
}
|
|
1446
|
+
const host = u.hostname.replace(/^(www\.|m\.)/, "");
|
|
1447
|
+
let id = null, portrait = false;
|
|
1448
|
+
if (host === "youtu.be") id = u.pathname.slice(1).split("/")[0];
|
|
1449
|
+
else if (host === "youtube.com" || host === "youtube-nocookie.com") {
|
|
1450
|
+
const parts = u.pathname.split("/").filter(Boolean);
|
|
1451
|
+
if (parts[0] === "watch") id = u.searchParams.get("v");
|
|
1452
|
+
else if (["shorts", "live", "embed"].includes(parts[0])) {
|
|
1453
|
+
id = parts[1] || null;
|
|
1454
|
+
portrait = parts[0] === "shorts";
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
if (!id || !/^[\w-]{6,}$/.test(id)) return null;
|
|
1458
|
+
return { id, start: parseStart(u.searchParams.get("t") || u.searchParams.get("start") || ""), portrait };
|
|
1459
|
+
}
|
|
1460
|
+
function parseStart(t) {
|
|
1461
|
+
if (/^\d+$/.test(t)) return +t;
|
|
1462
|
+
const m = t.match(/^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/);
|
|
1463
|
+
return m && t ? +(m[1] || 0) * 3600 + +(m[2] || 0) * 60 + +(m[3] || 0) : 0;
|
|
1464
|
+
}
|
|
1465
|
+
function embedUrl(v) {
|
|
1466
|
+
return "https://www.youtube-nocookie.com/embed/" + encodeURIComponent(v.id) + "?enablejsapi=1&rel=0&playsinline=1" + (v.start ? "&start=" + v.start : "");
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1354
1469
|
// src/core/cut.js
|
|
1355
1470
|
var evTime = (e) => e.obsT ?? e.t;
|
|
1356
1471
|
var sessionFps = (sess) => sess.fps || 60;
|
|
@@ -1448,7 +1563,7 @@
|
|
|
1448
1563
|
var RECORDING_UI = !EMBED || EMBED.recording === true || new URLSearchParams(location.search).has("obs");
|
|
1449
1564
|
document.documentElement.classList.toggle("no-record", !RECORDING_UI);
|
|
1450
1565
|
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 };
|
|
1566
|
+
var BUILTIN = { home: sample_default, help: help_default, showcase: showcase_default, "template:blank": blank_default, "template:talk": talk_default, "template:recording": recording_default };
|
|
1452
1567
|
var editor = document.getElementById("editor");
|
|
1453
1568
|
var stage = document.getElementById("stage");
|
|
1454
1569
|
var world = document.getElementById("world");
|
|
@@ -1459,6 +1574,8 @@
|
|
|
1459
1574
|
var mmSvg = document.getElementById("mm-svg");
|
|
1460
1575
|
var mmLabel = document.getElementById("mm-label");
|
|
1461
1576
|
var editorPane = document.getElementById("editor-pane");
|
|
1577
|
+
var BLEED_H = 540;
|
|
1578
|
+
var BLEED_BANDS = 96;
|
|
1462
1579
|
var NODE_W = 440;
|
|
1463
1580
|
var WIDE_W = 720;
|
|
1464
1581
|
var XWIDE_W = 960;
|
|
@@ -1553,7 +1670,7 @@
|
|
|
1553
1670
|
document.documentElement.classList.toggle("dark", next === "dark");
|
|
1554
1671
|
} else save("slidetake:mode", next);
|
|
1555
1672
|
applyMode();
|
|
1556
|
-
if (world.querySelector(".echarts-container")) rebuild(true);
|
|
1673
|
+
if (world.querySelector(".echarts-container, .diagram.d2")) rebuild(true);
|
|
1557
1674
|
}
|
|
1558
1675
|
function cameraList() {
|
|
1559
1676
|
const raw = (deck.camera || "").replace(/^\[|\]$/g, "");
|
|
@@ -1769,6 +1886,110 @@
|
|
|
1769
1886
|
});
|
|
1770
1887
|
});
|
|
1771
1888
|
}
|
|
1889
|
+
function figureFor(img) {
|
|
1890
|
+
const fig = document.createElement("figure");
|
|
1891
|
+
fig.className = "media";
|
|
1892
|
+
img.replaceWith(fig);
|
|
1893
|
+
fig.appendChild(img);
|
|
1894
|
+
const alt = img.getAttribute("alt");
|
|
1895
|
+
if (alt) fig.insertAdjacentHTML("beforeend", "<figcaption>" + escapeHtml(alt) + "</figcaption>");
|
|
1896
|
+
return fig;
|
|
1897
|
+
}
|
|
1898
|
+
function youtubeFigure(v, caption) {
|
|
1899
|
+
const fig = document.createElement("figure");
|
|
1900
|
+
fig.className = "media yt fragment yt-play" + (v.portrait ? " portrait" : "");
|
|
1901
|
+
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>" : "");
|
|
1902
|
+
return fig;
|
|
1903
|
+
}
|
|
1904
|
+
function gridSize(el, n) {
|
|
1905
|
+
const cols = n <= 4 ? n : n <= 6 ? 3 : 4;
|
|
1906
|
+
el.style.setProperty("--cols", cols);
|
|
1907
|
+
el.style.setProperty("--rows", Math.ceil(n / cols));
|
|
1908
|
+
}
|
|
1909
|
+
var onlyImages = (p) => p.querySelector("img") && !p.textContent.trim() && [...p.children].every((c) => /^(IMG|BR)$/.test(c.tagName));
|
|
1910
|
+
function applyMedia(el, body) {
|
|
1911
|
+
body.querySelectorAll("pre > code.language-svg").forEach((code) => {
|
|
1912
|
+
const img = document.createElement("img");
|
|
1913
|
+
img.src = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(code.textContent.trim());
|
|
1914
|
+
img.alt = "";
|
|
1915
|
+
const p = document.createElement("p");
|
|
1916
|
+
p.appendChild(img);
|
|
1917
|
+
code.parentElement.replaceWith(p);
|
|
1918
|
+
});
|
|
1919
|
+
body.querySelectorAll(":scope > p").forEach((p) => {
|
|
1920
|
+
const only = p.children.length === 1 ? p.children[0] : null;
|
|
1921
|
+
if (!only) return;
|
|
1922
|
+
const href = only.tagName === "A" && p.textContent.trim() === only.textContent.trim() ? only.getAttribute("href") : only.tagName === "IMG" ? only.getAttribute("src") : null;
|
|
1923
|
+
const v = href && youtubeVideo(href);
|
|
1924
|
+
if (v) p.replaceWith(youtubeFigure(v, only.tagName === "IMG" ? only.getAttribute("alt") : ""));
|
|
1925
|
+
});
|
|
1926
|
+
body.querySelectorAll(":scope > ul, :scope > ol").forEach((list) => {
|
|
1927
|
+
const items = [...list.children];
|
|
1928
|
+
if (!items.length || !items.every((li) => li.querySelector("img") && !li.textContent.trim())) return;
|
|
1929
|
+
list.classList.add("gallery");
|
|
1930
|
+
items.forEach((li) => {
|
|
1931
|
+
const img = li.querySelector("img");
|
|
1932
|
+
li.innerHTML = "";
|
|
1933
|
+
li.appendChild(img);
|
|
1934
|
+
figureFor(img);
|
|
1935
|
+
});
|
|
1936
|
+
if (items.length > 1 && items.every((li) => li.classList.contains("fragment"))) {
|
|
1937
|
+
list.classList.add("carousel");
|
|
1938
|
+
items[0].classList.remove("fragment", "fade-up");
|
|
1939
|
+
items.forEach((li, i) => {
|
|
1940
|
+
li.classList.replace("fade-up", "current-visible");
|
|
1941
|
+
const cap = li.querySelector("figcaption");
|
|
1942
|
+
if (cap) cap.dataset.count = i + 1 + " / " + items.length;
|
|
1943
|
+
});
|
|
1944
|
+
} else gridSize(list, items.length);
|
|
1945
|
+
});
|
|
1946
|
+
body.querySelectorAll(":scope > p").forEach((p) => {
|
|
1947
|
+
if (!onlyImages(p)) return;
|
|
1948
|
+
const imgs = [...p.querySelectorAll("img")];
|
|
1949
|
+
if (imgs.length === 1) {
|
|
1950
|
+
p.replaceWith(imgs[0]);
|
|
1951
|
+
figureFor(imgs[0]);
|
|
1952
|
+
return;
|
|
1953
|
+
}
|
|
1954
|
+
const grid = document.createElement("div");
|
|
1955
|
+
grid.className = "gallery grid";
|
|
1956
|
+
p.replaceWith(grid);
|
|
1957
|
+
imgs.forEach((img) => {
|
|
1958
|
+
grid.appendChild(img);
|
|
1959
|
+
figureFor(img);
|
|
1960
|
+
});
|
|
1961
|
+
gridSize(grid, imgs.length);
|
|
1962
|
+
});
|
|
1963
|
+
const parts = [...body.children].filter((c) => !/^H[1-6]$/.test(c.tagName) && !(c.nodeType === 1 && c.tagName === "HR"));
|
|
1964
|
+
const media = parts.filter((c) => c.matches("figure.media"));
|
|
1965
|
+
if (media.length === 1 && parts.length === 1) el.classList.add("card-media");
|
|
1966
|
+
if (parts.length === 1 && (parts[0].matches("figure.media:not(.yt)") || parts[0].matches(".gallery.carousel"))) el.classList.add("card-bleed");
|
|
1967
|
+
const walker = document.createTreeWalker(body, NodeFilter.SHOW_COMMENT);
|
|
1968
|
+
while (walker.nextNode()) if (/^\s*view\s*:\s*full\s*$/i.test(walker.currentNode.data)) el.classList.add("card-full");
|
|
1969
|
+
else if (media.length === 1) {
|
|
1970
|
+
el.classList.add("card-split", parts.indexOf(media[0]) === 0 ? "media-first" : "media-last");
|
|
1971
|
+
const text = document.createElement("div");
|
|
1972
|
+
text.className = "split-text";
|
|
1973
|
+
parts.filter((c) => c !== media[0]).forEach((c) => text.appendChild(c));
|
|
1974
|
+
media[0].after(text);
|
|
1975
|
+
if (parts.indexOf(media[0]) !== 0) text.after(media[0]);
|
|
1976
|
+
}
|
|
1977
|
+
if (body.querySelector(".gallery")) el.classList.add("card-gallery");
|
|
1978
|
+
}
|
|
1979
|
+
function youtubeCommand(fig, func) {
|
|
1980
|
+
const f = fig.querySelector("iframe");
|
|
1981
|
+
if (f && f.contentWindow) f.contentWindow.postMessage(JSON.stringify({ event: "command", func, args: [] }), "*");
|
|
1982
|
+
}
|
|
1983
|
+
function applyStepsComments(root) {
|
|
1984
|
+
const walker = document.createTreeWalker(root, NodeFilter.SHOW_COMMENT);
|
|
1985
|
+
const found = [];
|
|
1986
|
+
while (walker.nextNode()) if (/^\s*steps\s*$/i.test(walker.currentNode.data)) found.push(walker.currentNode);
|
|
1987
|
+
found.forEach((c) => {
|
|
1988
|
+
let next = c.nextSibling;
|
|
1989
|
+
while (next && next.nodeType !== 1) next = next.nextSibling;
|
|
1990
|
+
if (next && /^(UL|OL)$/.test(next.tagName)) next.querySelectorAll(":scope > li").forEach((li) => li.classList.add("fragment", "fade-up"));
|
|
1991
|
+
});
|
|
1992
|
+
}
|
|
1772
1993
|
function collectFragments(root) {
|
|
1773
1994
|
const items = [...root.querySelectorAll(".fragment")].map((e, i) => ({ e, i, k: e.dataset.fragmentIndex }));
|
|
1774
1995
|
if (items.every((x) => x.k === void 0)) return items.map((x) => [x.e]);
|
|
@@ -1789,8 +2010,10 @@
|
|
|
1789
2010
|
if (!n || !n.frags) return;
|
|
1790
2011
|
if (snap) n.el.classList.add("snap");
|
|
1791
2012
|
n.frags.forEach((g, i) => g.forEach((e) => {
|
|
2013
|
+
const was = e.classList.contains("visible");
|
|
1792
2014
|
e.classList.toggle("visible", i < count);
|
|
1793
2015
|
e.classList.toggle("current-fragment", i === count - 1);
|
|
2016
|
+
if (e.classList.contains("yt-play") && was !== i < count && !snap) youtubeCommand(e, i < count ? "playVideo" : "pauseVideo");
|
|
1794
2017
|
}));
|
|
1795
2018
|
if (snap) {
|
|
1796
2019
|
void n.el.offsetWidth;
|
|
@@ -1830,9 +2053,27 @@
|
|
|
1830
2053
|
el.classList.add("measuring");
|
|
1831
2054
|
b.style.zoom = "";
|
|
1832
2055
|
let w = NODE_W;
|
|
1833
|
-
n.visual = !!b.querySelector("iframe, .echarts-container, pre > code.language-dot, .diagram");
|
|
2056
|
+
n.visual = !!b.querySelector("iframe, .echarts-container, pre > code.language-dot, pre > code.language-d2, pre > code.language-echarts, .diagram, figure.media");
|
|
1834
2057
|
if (n.visual) w = XWIDE_W;
|
|
1835
|
-
|
|
2058
|
+
const full = el.classList.contains("card-full");
|
|
2059
|
+
el.classList.remove("img-portrait", "img-landscape", "img-overlay");
|
|
2060
|
+
if (full) w = XWIDE_W;
|
|
2061
|
+
if (el.classList.contains("card-bleed")) {
|
|
2062
|
+
const aspect = Math.max(0, ...[...b.querySelectorAll("img")].map((i) => i.naturalWidth && i.naturalHeight ? i.naturalWidth / i.naturalHeight : 0)) || 16 / 9;
|
|
2063
|
+
if (full || Math.abs(aspect - 16 / 9) < 0.08) {
|
|
2064
|
+
el.classList.add("img-overlay");
|
|
2065
|
+
w = XWIDE_W;
|
|
2066
|
+
} else if (aspect < 1.3) {
|
|
2067
|
+
const iw = Math.min(Math.round(BLEED_H * aspect), XWIDE_W - 300);
|
|
2068
|
+
el.classList.add("img-portrait");
|
|
2069
|
+
el.style.setProperty("--img-w", iw + "px");
|
|
2070
|
+
w = Math.min(XWIDE_W, Math.max(WIDE_W, iw * 2));
|
|
2071
|
+
} else {
|
|
2072
|
+
el.classList.add("img-landscape");
|
|
2073
|
+
w = Math.round(Math.max(NODE_W, Math.min(XWIDE_W, (BLEED_H - BLEED_BANDS) * aspect)));
|
|
2074
|
+
el.style.setProperty("--img-h", Math.round(w / aspect) + "px");
|
|
2075
|
+
}
|
|
2076
|
+
} else if (b.querySelector('[style*="flex"], [style*="grid"], .r-hstack') || b.querySelectorAll("img").length >= 4) w = WIDE_W;
|
|
1836
2077
|
const tables = b.querySelectorAll("table");
|
|
1837
2078
|
if (tables.length) {
|
|
1838
2079
|
el.style.width = XWIDE_W + "px";
|
|
@@ -1867,6 +2108,83 @@
|
|
|
1867
2108
|
}
|
|
1868
2109
|
var VIZ_URL = "https://cdn.jsdelivr.net/npm/@viz-js/viz@3.4.0/lib/viz-standalone.js";
|
|
1869
2110
|
var ECHARTS_URL = "https://cdnjs.cloudflare.com/ajax/libs/echarts/5.5.0/echarts.min.js";
|
|
2111
|
+
var ECHARTS_THEME = {
|
|
2112
|
+
dark: {
|
|
2113
|
+
palette: ["#e0b024", "#60a5fa", "#34d399", "#f472b6", "#a78bfa", "#fb923c", "#a1a1aa"],
|
|
2114
|
+
text: "#e4e4e7",
|
|
2115
|
+
muted: "#a1a1aa",
|
|
2116
|
+
line: "#3f3f46",
|
|
2117
|
+
split: "#27272a",
|
|
2118
|
+
tip: "#18181b"
|
|
2119
|
+
},
|
|
2120
|
+
light: {
|
|
2121
|
+
palette: ["#c4930f", "#2563eb", "#059669", "#db2777", "#7c3aed", "#ea580c", "#71717a"],
|
|
2122
|
+
text: "#27272a",
|
|
2123
|
+
muted: "#71717a",
|
|
2124
|
+
line: "#d4d4d8",
|
|
2125
|
+
split: "#e4e4e7",
|
|
2126
|
+
tip: "#ffffff"
|
|
2127
|
+
}
|
|
2128
|
+
};
|
|
2129
|
+
function registerChartThemes() {
|
|
2130
|
+
Object.entries(ECHARTS_THEME).forEach(([mode, t]) => {
|
|
2131
|
+
const axis = {
|
|
2132
|
+
axisLine: { lineStyle: { color: t.line } },
|
|
2133
|
+
axisTick: { lineStyle: { color: t.line } },
|
|
2134
|
+
axisLabel: { color: t.muted },
|
|
2135
|
+
splitLine: { lineStyle: { color: t.split } },
|
|
2136
|
+
nameTextStyle: { color: t.muted }
|
|
2137
|
+
};
|
|
2138
|
+
echarts.registerTheme("slidetake-" + mode, {
|
|
2139
|
+
color: t.palette,
|
|
2140
|
+
backgroundColor: "transparent",
|
|
2141
|
+
textStyle: { color: t.text, fontFamily: "'IBM Plex Sans', sans-serif" },
|
|
2142
|
+
title: { textStyle: { color: t.text }, subtextStyle: { color: t.muted } },
|
|
2143
|
+
legend: { textStyle: { color: t.text } },
|
|
2144
|
+
tooltip: { backgroundColor: t.tip, borderColor: t.line, textStyle: { color: t.text } },
|
|
2145
|
+
categoryAxis: axis,
|
|
2146
|
+
valueAxis: axis,
|
|
2147
|
+
logAxis: axis,
|
|
2148
|
+
timeAxis: axis,
|
|
2149
|
+
line: { symbolSize: 6, lineStyle: { width: 2.5 } }
|
|
2150
|
+
});
|
|
2151
|
+
});
|
|
2152
|
+
}
|
|
2153
|
+
var D2_URL = "https://esm.sh/@terrastruct/d2@0.1.33";
|
|
2154
|
+
var d2 = null;
|
|
2155
|
+
var D2_THEME = {
|
|
2156
|
+
dark: {
|
|
2157
|
+
N1: "#e4e4e7",
|
|
2158
|
+
N2: "#a1a1aa",
|
|
2159
|
+
N3: "#a1a1aa",
|
|
2160
|
+
N4: "#323238",
|
|
2161
|
+
N5: "#27272a",
|
|
2162
|
+
N6: "#18181b",
|
|
2163
|
+
N7: "#09090b",
|
|
2164
|
+
B1: "#e0b024",
|
|
2165
|
+
B2: "#907320",
|
|
2166
|
+
B3: "#68551f",
|
|
2167
|
+
B4: "#483c1d",
|
|
2168
|
+
B5: "#38301c",
|
|
2169
|
+
B6: "#2c271c"
|
|
2170
|
+
},
|
|
2171
|
+
light: {
|
|
2172
|
+
N1: "#27272a",
|
|
2173
|
+
N2: "#71717a",
|
|
2174
|
+
N3: "#71717a",
|
|
2175
|
+
N4: "#e4e4e7",
|
|
2176
|
+
N5: "#e4e4e7",
|
|
2177
|
+
N6: "#f4f4f5",
|
|
2178
|
+
N7: "#ffffff",
|
|
2179
|
+
B1: "#7a5c12",
|
|
2180
|
+
B2: "#e5cf87",
|
|
2181
|
+
B3: "#eedfaf",
|
|
2182
|
+
B4: "#f5eccf",
|
|
2183
|
+
B5: "#f8f2df",
|
|
2184
|
+
B6: "#fbf7eb"
|
|
2185
|
+
}
|
|
2186
|
+
};
|
|
2187
|
+
var withD2Defaults = (code) => /d2-config\s*:/.test(code) ? code : "vars: {\n d2-config: {\n layout-engine: elk\n }\n}\n" + code;
|
|
1870
2188
|
var scripts = {};
|
|
1871
2189
|
function loadScript(url) {
|
|
1872
2190
|
return scripts[url] || (scripts[url] = new Promise((resolve, reject) => {
|
|
@@ -1885,8 +2203,15 @@
|
|
|
1885
2203
|
async function renderRich() {
|
|
1886
2204
|
const gen = buildGen;
|
|
1887
2205
|
const dots = [...world.querySelectorAll(".node pre > code.language-dot")];
|
|
2206
|
+
world.querySelectorAll(".node pre > code.language-echarts").forEach((code) => {
|
|
2207
|
+
const div = document.createElement("div");
|
|
2208
|
+
div.className = "echarts-container";
|
|
2209
|
+
div.dataset.chart = code.textContent;
|
|
2210
|
+
code.parentElement.replaceWith(div);
|
|
2211
|
+
});
|
|
1888
2212
|
const charts = [...world.querySelectorAll(".node .echarts-container[data-chart]")];
|
|
1889
|
-
|
|
2213
|
+
const d2s = [...world.querySelectorAll(".node pre > code.language-d2")];
|
|
2214
|
+
if (!dots.length && !charts.length && !d2s.length) return;
|
|
1890
2215
|
const problems = [];
|
|
1891
2216
|
if (dots.length) {
|
|
1892
2217
|
try {
|
|
@@ -1908,10 +2233,42 @@
|
|
|
1908
2233
|
problems.push("diagrams");
|
|
1909
2234
|
}
|
|
1910
2235
|
}
|
|
2236
|
+
if (d2s.length) {
|
|
2237
|
+
try {
|
|
2238
|
+
if (!d2) {
|
|
2239
|
+
const mod = await import(
|
|
2240
|
+
/* runtime, not bundled */
|
|
2241
|
+
D2_URL
|
|
2242
|
+
);
|
|
2243
|
+
d2 = new mod.D2();
|
|
2244
|
+
}
|
|
2245
|
+
if (gen !== buildGen) return;
|
|
2246
|
+
const theme = D2_THEME[currentMode()];
|
|
2247
|
+
for (const code of d2s) {
|
|
2248
|
+
const box = document.createElement("div");
|
|
2249
|
+
box.className = "diagram d2";
|
|
2250
|
+
try {
|
|
2251
|
+
const result = await d2.compile(withD2Defaults(code.textContent));
|
|
2252
|
+
box.innerHTML = await d2.render(result.diagram, { ...result.renderOptions || {}, themeOverrides: theme, darkThemeOverrides: theme });
|
|
2253
|
+
} catch (e) {
|
|
2254
|
+
box.className = "diagram err";
|
|
2255
|
+
box.textContent = "Diagram error: " + (e.message || e);
|
|
2256
|
+
}
|
|
2257
|
+
if (gen !== buildGen) return;
|
|
2258
|
+
code.parentElement.replaceWith(box);
|
|
2259
|
+
}
|
|
2260
|
+
} catch (e) {
|
|
2261
|
+
problems.push("D2 diagrams");
|
|
2262
|
+
}
|
|
2263
|
+
}
|
|
1911
2264
|
if (charts.length) {
|
|
1912
2265
|
try {
|
|
1913
2266
|
await loadScript(ECHARTS_URL);
|
|
1914
2267
|
if (gen !== buildGen) return;
|
|
2268
|
+
if (!echarts._slidetakeThemes) {
|
|
2269
|
+
registerChartThemes();
|
|
2270
|
+
echarts._slidetakeThemes = true;
|
|
2271
|
+
}
|
|
1915
2272
|
charts.forEach((div) => {
|
|
1916
2273
|
let opt;
|
|
1917
2274
|
try {
|
|
@@ -1920,7 +2277,7 @@
|
|
|
1920
2277
|
div.textContent = "Chart data is not valid JSON.";
|
|
1921
2278
|
return;
|
|
1922
2279
|
}
|
|
1923
|
-
echarts.init(div, currentMode() === "light" ?
|
|
2280
|
+
echarts.init(div, "slidetake-" + (currentMode() === "light" ? "light" : "dark"), { renderer: "svg" }).setOption(Object.assign({ backgroundColor: "transparent", animation: !reduceMotion }, opt));
|
|
1924
2281
|
});
|
|
1925
2282
|
} catch (e) {
|
|
1926
2283
|
problems.push("charts");
|
|
@@ -1984,6 +2341,8 @@
|
|
|
1984
2341
|
el.innerHTML = (crumb ? '<div class="crumb">' + escapeHtml(crumb) + "</div>" : "") + '<div class="body">' + n.html + "</div>" + (n.err ? '<div class="err-badge">!</div>' : "");
|
|
1985
2342
|
const body = el.querySelector(".body");
|
|
1986
2343
|
applyElementComments(body);
|
|
2344
|
+
applyStepsComments(body);
|
|
2345
|
+
applyMedia(el, body);
|
|
1987
2346
|
body.querySelectorAll("thead").forEach((h) => {
|
|
1988
2347
|
if (!h.textContent.trim()) h.remove();
|
|
1989
2348
|
});
|
|
@@ -2160,6 +2519,12 @@
|
|
|
2160
2519
|
function focusOn(id, instant) {
|
|
2161
2520
|
const n = nodes.get(id);
|
|
2162
2521
|
if (!n) return;
|
|
2522
|
+
document.body.classList.toggle("full-card", n.el.classList.contains("card-full"));
|
|
2523
|
+
if (n.el.classList.contains("card-full")) {
|
|
2524
|
+
const zoom2 = Math.min(stage.clientWidth / n._w, stage.clientHeight / n._h);
|
|
2525
|
+
flyTo({ x: n.cx, y: n.cy, zoom: zoom2 }, instant);
|
|
2526
|
+
return;
|
|
2527
|
+
}
|
|
2163
2528
|
const f = fitInSafe(n._w, n._h, slideFill);
|
|
2164
2529
|
const sec = sectionOf(id);
|
|
2165
2530
|
const peers = order.filter((x) => sectionOf(x) === sec && !nodes.get(x).visual).map((x) => {
|
|
@@ -2171,6 +2536,7 @@
|
|
|
2171
2536
|
flyTo(Object.assign(aimAt(n.cx, n.cy, f, zoom), { zoom }), instant);
|
|
2172
2537
|
}
|
|
2173
2538
|
function fitAll(instant) {
|
|
2539
|
+
document.body.classList.remove("full-card");
|
|
2174
2540
|
const all = [...nodes.values()];
|
|
2175
2541
|
if (!all.length) return;
|
|
2176
2542
|
const vw = stage.clientWidth, vh = stage.clientHeight;
|
|
@@ -2264,9 +2630,24 @@
|
|
|
2264
2630
|
scheduleAutoslide(n);
|
|
2265
2631
|
}
|
|
2266
2632
|
var TRANSFORM_PROPS = ["x", "y", "xPercent", "yPercent", "scale", "scaleX", "scaleY", "rotation", "rotate", "skewX", "skewY"];
|
|
2633
|
+
function autoEntrance(n) {
|
|
2634
|
+
if (!order.length || n.id !== order[0] && n.id !== order[order.length - 1]) return null;
|
|
2635
|
+
if (n.el.querySelector("[data-gsap], .title-scramble")) return null;
|
|
2636
|
+
return [...n.el.querySelector(".body").children].filter((el) => !el.classList.contains("fragment"));
|
|
2637
|
+
}
|
|
2267
2638
|
function playEntrances(n) {
|
|
2268
2639
|
if (n._played || !window.gsap || reduceMotion) return;
|
|
2269
2640
|
n._played = true;
|
|
2641
|
+
const auto = autoEntrance(n);
|
|
2642
|
+
if (auto && auto.length) {
|
|
2643
|
+
n._auto = auto;
|
|
2644
|
+
const [head, ...rest] = auto;
|
|
2645
|
+
if (/^H[1-3]$/.test(head.tagName) && !head.children.length) {
|
|
2646
|
+
head.classList.add("auto-scramble");
|
|
2647
|
+
scramble(head);
|
|
2648
|
+
} else rest.unshift(head);
|
|
2649
|
+
gsap.from(rest, { opacity: 0, y: 24, duration: 0.7, ease: "power2.out", delay: 0.5, stagger: 0.45 });
|
|
2650
|
+
}
|
|
2270
2651
|
n.el.querySelectorAll("[data-gsap]").forEach((el) => {
|
|
2271
2652
|
let cfg;
|
|
2272
2653
|
try {
|
|
@@ -2284,6 +2665,13 @@
|
|
|
2284
2665
|
if (!n || !n._played) return;
|
|
2285
2666
|
n._played = false;
|
|
2286
2667
|
if (!window.gsap) return;
|
|
2668
|
+
if (n._auto) {
|
|
2669
|
+
n._auto.forEach((el) => {
|
|
2670
|
+
gsap.killTweensOf(el);
|
|
2671
|
+
gsap.set(el, { clearProps: "opacity,transform" });
|
|
2672
|
+
});
|
|
2673
|
+
n._auto = null;
|
|
2674
|
+
}
|
|
2287
2675
|
n.el.querySelectorAll("[data-gsap]").forEach((el) => {
|
|
2288
2676
|
gsap.killTweensOf(el);
|
|
2289
2677
|
let cfg = {};
|
|
@@ -2294,7 +2682,7 @@
|
|
|
2294
2682
|
const props = new Set(Object.keys(Object.assign({}, cfg.from, cfg.to)).map((k) => TRANSFORM_PROPS.includes(k) ? "transform" : k));
|
|
2295
2683
|
if (props.size) gsap.set(el, { clearProps: [...props].join(",") });
|
|
2296
2684
|
});
|
|
2297
|
-
n.el.querySelectorAll(".title-scramble").forEach((el) => {
|
|
2685
|
+
n.el.querySelectorAll(".title-scramble, .auto-scramble").forEach((el) => {
|
|
2298
2686
|
if (el._scramble) el._scramble.kill();
|
|
2299
2687
|
if (el.dataset.text) el.textContent = el.dataset.text;
|
|
2300
2688
|
});
|
|
@@ -2373,6 +2761,7 @@
|
|
|
2373
2761
|
function leaveSlide() {
|
|
2374
2762
|
const prev = nodes.get(currentId);
|
|
2375
2763
|
if (!prev) return;
|
|
2764
|
+
prev.el.querySelectorAll("figure.yt").forEach((f) => youtubeCommand(f, "pauseVideo"));
|
|
2376
2765
|
applyFragments(prev, prev.frags.length, true);
|
|
2377
2766
|
resetEntrances(prev);
|
|
2378
2767
|
}
|
|
@@ -3523,7 +3912,7 @@
|
|
|
3523
3912
|
sizeStep(1);
|
|
3524
3913
|
} else if (k === "-" || k === "_") {
|
|
3525
3914
|
sizeStep(-1);
|
|
3526
|
-
} else if (k === "?") {
|
|
3915
|
+
} else if (k === "?" || k === "k" || k === "K") {
|
|
3527
3916
|
help.classList.add("open");
|
|
3528
3917
|
} else if (k === "Escape") {
|
|
3529
3918
|
if (!backFromOverview() && presenting) setPresent(false);
|
|
@@ -3631,9 +4020,16 @@
|
|
|
3631
4020
|
credit.title = "Made with Slidetake";
|
|
3632
4021
|
credit.setAttribute("aria-label", "Made with Slidetake");
|
|
3633
4022
|
credit.innerHTML = LOGO + '<span class="word">Slide<span>take</span></span>';
|
|
3634
|
-
const
|
|
3635
|
-
|
|
3636
|
-
|
|
4023
|
+
const actions = document.querySelector("header .hdr-actions");
|
|
4024
|
+
actions.insertBefore(credit, actions.firstChild);
|
|
4025
|
+
if (!RECORDING_UI) {
|
|
4026
|
+
actions.insertAdjacentHTML(
|
|
4027
|
+
"beforeend",
|
|
4028
|
+
'<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>'
|
|
4029
|
+
);
|
|
4030
|
+
document.getElementById("hdr-keys").onclick = () => document.getElementById("help").classList.add("open");
|
|
4031
|
+
document.getElementById("hdr-full").onclick = () => setPresent(!presenting);
|
|
4032
|
+
}
|
|
3637
4033
|
}
|
|
3638
4034
|
var route = routeOf(location.pathname, location.search, location.hash);
|
|
3639
4035
|
var startId = route.page === "pick" ? "" : route.slide;
|