@steamfield/decks 1.0.0-rc.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/control-tray.css +84 -0
  3. package/dist/go-to-dialog.css +57 -0
  4. package/dist/{index-BURtH7IB.d.ts → index-D3Yj4yT6.d.ts} +11 -2
  5. package/dist/{index-BV_-6L5L.d.ts → index-DG8UcGQd.d.ts} +77 -1
  6. package/dist/{index-B2n69xrC.d.ts → index-zg-z6HTy.d.ts} +18 -2
  7. package/dist/index.d.ts +3 -3
  8. package/dist/index.js +2 -2
  9. package/dist/kit/term/live-term.module.css +36 -0
  10. package/dist/kit.d.ts +21 -6
  11. package/dist/kit.js +252 -8
  12. package/dist/live-term.module.css +36 -0
  13. package/dist/magic-move.css +30 -0
  14. package/dist/mark.css +34 -0
  15. package/dist/motion.d.ts +2 -2
  16. package/dist/motion.js +1 -1
  17. package/dist/node.d.ts +5 -1
  18. package/dist/node.js +1 -1
  19. package/dist/plugin/skills/building-a-deck/references/workflow.md +10 -0
  20. package/dist/plugin/skills/deck-design/references/layout.md +2 -0
  21. package/dist/plugin/skills/deck-motion/references/motion.md +38 -1
  22. package/dist/plugin/skills/working-with-decks/references/project.md +4 -0
  23. package/dist/presenter-view.css +14 -0
  24. package/dist/{prose-patterns-DPqjGBFu.js → prose-patterns-D-tdt0Ab.js} +3 -1
  25. package/dist/{prose-scan-BrWZ7gxZ.js → prose-scan-ni8g6pc-.js} +2 -2
  26. package/dist/{src-DizFoqYt.js → src--lhAQ29p.js} +348 -43
  27. package/dist/{src-C-OfT72W.js → src-BNyL3q7j.js} +212 -3
  28. package/dist/{src-CmQgaG1b.js → src-Cxck-eLP.js} +588 -68
  29. package/dist/term/shell_pty.py +38 -0
  30. package/dist/term/zsh/.zshrc +4 -0
  31. package/dist/term-protocol-B_qHRDEp.js +11 -0
  32. package/dist/xterm-host-C6OjffSm.js +282 -0
  33. package/docs/README.md +1 -0
  34. package/docs/cli.md +2 -1
  35. package/docs/code-blocks.md +31 -0
  36. package/docs/config.md +1 -0
  37. package/docs/getting-started.md +2 -1
  38. package/docs/kit.md +7 -6
  39. package/docs/migrating-from-slidev.md +4 -0
  40. package/docs/motion.md +25 -1
  41. package/docs/presenting.md +16 -1
  42. package/docs/slides.md +20 -1
  43. package/docs/terminal.md +97 -0
  44. package/package.json +4 -1
@@ -1,11 +1,13 @@
1
- import { Children, Suspense, createContext, isValidElement, lazy, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
1
+ import { Children, Suspense, createContext, isValidElement, lazy, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import { defaultKeybindingsHandlerIgnore, tinykeys } from "tinykeys";
4
+ import "./go-to-dialog.css";
4
5
  import { ErrorBoundary } from "react-error-boundary";
5
6
  import { flushSync } from "react-dom";
6
7
  import "./transition.css";
7
8
  import "./layers.css";
8
9
  import "./overview-view.css";
10
+ import "./control-tray.css";
9
11
  import "./play-view.css";
10
12
  import "./presenter-view.css";
11
13
  import styles from "./print-view.module.css";
@@ -173,6 +175,7 @@ function createSyncSession(options) {
173
175
  from: id
174
176
  });
175
177
  return {
178
+ getStamp: () => stamp,
176
179
  publish(state) {
177
180
  if (closed) return;
178
181
  stamp = {
@@ -222,6 +225,7 @@ function useDeck() {
222
225
  const clicks = useDeckSelector((state) => state.nav.click);
223
226
  const view = useDeckSelector((state) => state.view);
224
227
  const embedded = useDeckSelector((state) => state.embedded);
228
+ const syncStamp = useDeckSelector((state) => state.syncStamp);
225
229
  const actions = useMemo(() => ({
226
230
  next: () => store.dispatch({ type: "next" }),
227
231
  prev: () => store.dispatch({ type: "prev" }),
@@ -235,6 +239,7 @@ function useDeck() {
235
239
  }), [store]);
236
240
  const slides = source.manifest.slides;
237
241
  return {
242
+ syncStamp,
238
243
  slide,
239
244
  total: slides.length,
240
245
  clicks,
@@ -408,6 +413,69 @@ function useDeckAttention() {
408
413
  };
409
414
  }, [view]);
410
415
  }
416
+ // ../runtime/src/navigation/deck-actions.ts
417
+ function toggleFullscreen() {
418
+ if (!document.fullscreenEnabled) return false;
419
+ (document.fullscreenElement ? document.exitFullscreen() : document.documentElement.requestFullscreen()).catch(() => {});
420
+ return true;
421
+ }
422
+ function toggleOverview(store, home) {
423
+ const current = parseLocation(window.location.hash, window.location.search).view;
424
+ if (current === "print") return false;
425
+ store.setView(current === "overview" ? home.current : "overview");
426
+ return true;
427
+ }
428
+ function openPresenter(source) {
429
+ const state = parseLocation(window.location.hash, window.location.search);
430
+ if (state.view !== "play" || state.embedded) return false;
431
+ const channel = syncChannelId(source.manifest.name, window.location.pathname.replace(/index\.html$/, ""));
432
+ const presenter = window.open("", `react-decks-presenter:${channel}`, "popup,width=1280,height=800");
433
+ if (!presenter) return true;
434
+ if (presenter.location.href === "about:blank") {
435
+ const url = new URL(window.location.href);
436
+ url.hash = formatHash({
437
+ view: "presenter",
438
+ slide: state.slide,
439
+ click: state.click
440
+ });
441
+ presenter.location.href = url.href;
442
+ }
443
+ presenter.focus();
444
+ return true;
445
+ }
446
+ // ../runtime/src/navigation/go-to-state.ts
447
+ const states = /* @__PURE__ */ new WeakMap();
448
+ function stateFor(store) {
449
+ let state = states.get(store);
450
+ if (!state) {
451
+ state = {
452
+ open: false,
453
+ listeners: /* @__PURE__ */ new Set()
454
+ };
455
+ states.set(store, state);
456
+ }
457
+ return state;
458
+ }
459
+ function setOpen(store, open) {
460
+ const state = stateFor(store);
461
+ if (state.open === open) return;
462
+ state.open = open;
463
+ for (const listener of state.listeners) listener();
464
+ }
465
+ function showGoTo(store) {
466
+ setOpen(store, true);
467
+ }
468
+ function useGoTo() {
469
+ const { store } = useDeckContext();
470
+ const state = stateFor(store);
471
+ return {
472
+ open: useSyncExternalStore((listener) => {
473
+ state.listeners.add(listener);
474
+ return () => state.listeners.delete(listener);
475
+ }, () => state.open),
476
+ hide: useCallback(() => setOpen(store, false), [store])
477
+ };
478
+ }
411
479
  // ../runtime/src/navigation/deck-keys.ts
412
480
  function useDeckKeys() {
413
481
  const { source, store } = useDeckContext();
@@ -420,15 +488,10 @@ function useDeckKeys() {
420
488
  };
421
489
  const keys = {
422
490
  f(event) {
423
- if (!document.fullscreenEnabled) return;
424
- event.preventDefault();
425
- (document.fullscreenElement ? document.exitFullscreen() : document.documentElement.requestFullscreen()).catch(() => {});
491
+ if (toggleFullscreen()) event.preventDefault();
426
492
  },
427
493
  o(event) {
428
- const current = parseLocation(window.location.hash, window.location.search).view;
429
- if (current === "print") return;
430
- event.preventDefault();
431
- store.setView(current === "overview" ? home.current : "overview");
494
+ if (toggleOverview(store, home)) event.preventDefault();
432
495
  },
433
496
  Escape(event) {
434
497
  if (parseLocation(window.location.hash, window.location.search).view !== "overview") return;
@@ -436,22 +499,7 @@ function useDeckKeys() {
436
499
  store.setView(home.current);
437
500
  },
438
501
  p(event) {
439
- const state = parseLocation(window.location.hash, window.location.search);
440
- if (state.view !== "play" || state.embedded) return;
441
- event.preventDefault();
442
- const channel = syncChannelId(source.manifest.name, window.location.pathname.replace(/index\.html$/, ""));
443
- const presenter = window.open("", `react-decks-presenter:${channel}`, "popup,width=1280,height=800");
444
- if (!presenter) return;
445
- if (presenter.location.href === "about:blank") {
446
- const url = new URL(window.location.href);
447
- url.hash = formatHash({
448
- view: "presenter",
449
- slide: state.slide,
450
- click: state.click
451
- });
452
- presenter.location.href = url.href;
453
- }
454
- presenter.focus();
502
+ if (openPresenter(source)) event.preventDefault();
455
503
  }
456
504
  };
457
505
  if (view === "play" || view === "presenter") {
@@ -468,6 +516,11 @@ function useDeckKeys() {
468
516
  for (const key of ["Minus", "NumpadSubtract"]) keys[`${mod}+${key}`] = size(-1);
469
517
  keys[`${mod}+Digit0`] = size(0);
470
518
  }
519
+ const { embedded, bridge } = store.getState();
520
+ if (!embedded && !bridge) keys.g = (event) => {
521
+ event.preventDefault();
522
+ showGoTo(store);
523
+ };
471
524
  Object.assign(keys, {
472
525
  ArrowRight: bind({ type: "next" }),
473
526
  Space: bind({ type: "next" }),
@@ -495,6 +548,98 @@ function useDeckKeys() {
495
548
  store
496
549
  ]);
497
550
  }
551
+ // ../runtime/src/navigation/go-to-dialog.tsx
552
+ function GoToDialog() {
553
+ const { open } = useGoTo();
554
+ return open ? /* @__PURE__ */ jsx(OpenDialog, {}) : null;
555
+ }
556
+ function OpenDialog() {
557
+ const { slides, go } = useDeck();
558
+ const { hide } = useGoTo();
559
+ const [query, setQuery] = useState("");
560
+ const [selection, setSelection] = useState(0);
561
+ const dialog = useRef(null);
562
+ const input = useRef(null);
563
+ const selectedOption = useRef(null);
564
+ const id = useId();
565
+ const search = query.trim().toLowerCase();
566
+ const matches = slides.filter((meta) => /^\d+$/.test(search) ? meta.no === Number(search) : !search || meta.title?.toLowerCase().includes(search));
567
+ const selected = matches[Math.min(selection, matches.length - 1)];
568
+ useLayoutEffect(() => {
569
+ const element = dialog.current;
570
+ element?.showModal();
571
+ input.current?.focus();
572
+ return () => element?.close();
573
+ }, []);
574
+ useLayoutEffect(() => {
575
+ if (selected) selectedOption.current?.scrollIntoView?.({ block: "nearest" });
576
+ }, [selected]);
577
+ function choose(slide) {
578
+ go(slide);
579
+ hide();
580
+ }
581
+ return /* @__PURE__ */ jsxs("dialog", {
582
+ ref: dialog,
583
+ className: "rd-go-to",
584
+ "aria-label": "Go to slide",
585
+ onCancel: (event) => {
586
+ event.preventDefault();
587
+ hide();
588
+ },
589
+ onClick: (event) => {
590
+ if (event.target !== event.currentTarget) return;
591
+ const bounds = event.currentTarget.getBoundingClientRect();
592
+ if (event.clientX < bounds.left || event.clientX > bounds.right || event.clientY < bounds.top || event.clientY > bounds.bottom) hide();
593
+ },
594
+ onKeyDown: (event) => {
595
+ event.stopPropagation();
596
+ if (event.nativeEvent.isComposing) return;
597
+ if (event.key === "Escape") {
598
+ event.preventDefault();
599
+ hide();
600
+ } else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
601
+ event.preventDefault();
602
+ setSelection((index) => Math.max(0, Math.min(matches.length - 1, index + (event.key === "ArrowDown" ? 1 : -1))));
603
+ } else if (event.key === "Enter") {
604
+ event.preventDefault();
605
+ if (selected) choose(selected.no);
606
+ }
607
+ },
608
+ children: [
609
+ /* @__PURE__ */ jsx("label", {
610
+ htmlFor: `${id}-input`,
611
+ children: "Slide"
612
+ }),
613
+ /* @__PURE__ */ jsx("input", {
614
+ ref: input,
615
+ id: `${id}-input`,
616
+ type: "search",
617
+ value: query,
618
+ "aria-controls": `${id}-list`,
619
+ "aria-activedescendant": selected ? `${id}-${selected.no}` : void 0,
620
+ onChange: (event) => {
621
+ setQuery(event.target.value);
622
+ setSelection(0);
623
+ }
624
+ }),
625
+ /* @__PURE__ */ jsx("div", {
626
+ id: `${id}-list`,
627
+ role: "listbox",
628
+ "aria-label": "Slides",
629
+ children: matches.map((meta) => /* @__PURE__ */ jsx("button", {
630
+ ref: meta.no === selected?.no ? selectedOption : void 0,
631
+ id: `${id}-${meta.no}`,
632
+ type: "button",
633
+ role: "option",
634
+ tabIndex: -1,
635
+ "aria-selected": meta.no === selected?.no,
636
+ onClick: () => choose(meta.no),
637
+ children: meta.title ? `${meta.no} ${meta.title}` : meta.no
638
+ }, meta.id))
639
+ })
640
+ ]
641
+ });
642
+ }
498
643
  // ../runtime/src/source.ts
499
644
  const slideModules = /* @__PURE__ */ new WeakMap();
500
645
  function createSlideModules(source) {
@@ -803,10 +948,122 @@ function OverviewView() {
803
948
  }, meta.id))
804
949
  });
805
950
  }
951
+ // ../runtime/src/views/control-tray.tsx
952
+ function Icon({ path }) {
953
+ return /* @__PURE__ */ jsx("svg", {
954
+ viewBox: "0 0 24 24",
955
+ "aria-hidden": "true",
956
+ fill: "none",
957
+ stroke: "currentColor",
958
+ strokeWidth: "2",
959
+ children: /* @__PURE__ */ jsx("path", { d: path })
960
+ });
961
+ }
962
+ function ControlTray() {
963
+ const deck = useDeck();
964
+ const { source, store } = useDeckContext();
965
+ const { home } = usePresentation();
966
+ const touchReveal = useRef(false);
967
+ const [fullscreenEnabled, setFullscreenEnabled] = useState(false);
968
+ const [fullscreen, setFullscreen] = useState(false);
969
+ useLayoutEffect(() => {
970
+ const update = () => {
971
+ setFullscreenEnabled(Boolean(document.fullscreenEnabled));
972
+ setFullscreen(Boolean(document.fullscreenElement));
973
+ };
974
+ update();
975
+ document.addEventListener("fullscreenchange", update);
976
+ return () => document.removeEventListener("fullscreenchange", update);
977
+ }, []);
978
+ return /* @__PURE__ */ jsx("div", {
979
+ role: "toolbar",
980
+ "aria-label": "Deck controls",
981
+ className: "rd-tray",
982
+ tabIndex: -1,
983
+ onPointerDownCapture: (event) => {
984
+ touchReveal.current = event.pointerType === "touch" && !event.currentTarget.matches(":hover, :focus-within");
985
+ },
986
+ onClickCapture: (event) => {
987
+ if (!touchReveal.current || event.detail === 0) return;
988
+ touchReveal.current = false;
989
+ event.preventDefault();
990
+ event.stopPropagation();
991
+ event.currentTarget.focus();
992
+ },
993
+ onPointerLeave: (event) => {
994
+ const focused = document.activeElement;
995
+ if (focused instanceof HTMLElement && event.currentTarget.contains(focused)) focused.blur();
996
+ },
997
+ children: /* @__PURE__ */ jsxs("div", {
998
+ className: "rd-tray-buttons",
999
+ children: [
1000
+ /* @__PURE__ */ jsx("button", {
1001
+ type: "button",
1002
+ "aria-label": "Previous",
1003
+ disabled: deck.slide === 1 && deck.clicks === 0,
1004
+ onClick: deck.prev,
1005
+ children: /* @__PURE__ */ jsx(Icon, { path: "m15 6-6 6 6 6" })
1006
+ }),
1007
+ /* @__PURE__ */ jsx("button", {
1008
+ type: "button",
1009
+ "aria-label": "Next",
1010
+ disabled: deck.slide === deck.total && deck.clicks === deck.clicksTotal,
1011
+ onClick: deck.next,
1012
+ children: /* @__PURE__ */ jsx(Icon, { path: "m9 6 6 6-6 6" })
1013
+ }),
1014
+ /* @__PURE__ */ jsxs("button", {
1015
+ type: "button",
1016
+ "aria-label": "Go to slide",
1017
+ onClick: (event) => {
1018
+ event.currentTarget.blur();
1019
+ showGoTo(store);
1020
+ },
1021
+ children: [
1022
+ /* @__PURE__ */ jsx(Icon, { path: "M4 4h16v16H4z M8 8h8 M8 12h8 M8 16h4" }),
1023
+ deck.slide,
1024
+ " / ",
1025
+ deck.total
1026
+ ]
1027
+ }),
1028
+ /* @__PURE__ */ jsx("button", {
1029
+ type: "button",
1030
+ "aria-label": "Overview",
1031
+ onClick: () => toggleOverview(store, home),
1032
+ children: /* @__PURE__ */ jsx(Icon, { path: "M3 3h7v7H3z M14 3h7v7h-7z M3 14h7v7H3z M14 14h7v7h-7z" })
1033
+ }),
1034
+ /* @__PURE__ */ jsx("button", {
1035
+ type: "button",
1036
+ "aria-label": "Open presenter",
1037
+ onClick: () => openPresenter(source),
1038
+ children: /* @__PURE__ */ jsx(Icon, { path: "M3 4h18v13H3z M8 21h8 M12 17v4 M7 8h10 M7 12h6" })
1039
+ }),
1040
+ fullscreenEnabled && /* @__PURE__ */ jsx("button", {
1041
+ type: "button",
1042
+ "aria-label": fullscreen ? "Exit fullscreen" : "Enter fullscreen",
1043
+ onClick: toggleFullscreen,
1044
+ children: /* @__PURE__ */ jsx(Icon, { path: fullscreen ? "M3 8h5V3 M21 8h-5V3 M3 16h5v5 M21 16h-5v5" : "M8 3H3v5 M16 3h5v5 M3 16v5h5 M21 16v5h-5" })
1045
+ }),
1046
+ /* @__PURE__ */ jsx("button", {
1047
+ type: "button",
1048
+ "aria-label": "Smaller text",
1049
+ onClick: () => stepTextScale(source.manifest.name, -1),
1050
+ children: /* @__PURE__ */ jsx(Icon, { path: "m3 18 5-12 5 12 M5 14h6 M16 12h6" })
1051
+ }),
1052
+ /* @__PURE__ */ jsx("button", {
1053
+ type: "button",
1054
+ "aria-label": "Larger text",
1055
+ onClick: () => stepTextScale(source.manifest.name, 1),
1056
+ children: /* @__PURE__ */ jsx(Icon, { path: "m3 18 5-12 5 12 M5 14h6 M16 12h6 M19 9v6" })
1057
+ })
1058
+ ]
1059
+ })
1060
+ });
1061
+ }
806
1062
  // ../runtime/src/views/play-view.tsx
807
1063
  function PlayView() {
808
1064
  const { source, modules } = useDeckContext();
809
1065
  const slide = useDeckSelector((state) => state.nav.slide);
1066
+ const hideTray = useDeckSelector((state) => state.embedded || state.bridge);
810
1067
  useEffect(() => {
811
1068
  const preload = () => {
812
1069
  for (const module of modules.values()) module.load().catch(() => {});
@@ -818,15 +1075,15 @@ function PlayView() {
818
1075
  const id = window.setTimeout(preload, 0);
819
1076
  return () => window.clearTimeout(id);
820
1077
  }, [modules]);
821
- return /* @__PURE__ */ jsx("div", {
1078
+ return /* @__PURE__ */ jsxs("div", {
822
1079
  className: "rd-play-view",
823
- children: /* @__PURE__ */ jsx(SlideFrame, {
1080
+ children: [/* @__PURE__ */ jsx(SlideFrame, {
824
1081
  main: true,
825
1082
  children: source.manifest.slides.filter(({ no }) => Math.abs(no - slide) <= 1).map(({ no }) => /* @__PURE__ */ jsx(SlideHost, {
826
1083
  no,
827
1084
  context: "slide"
828
1085
  }, no))
829
- })
1086
+ }), !hideTray && /* @__PURE__ */ jsx(ControlTray, {})]
830
1087
  });
831
1088
  }
832
1089
  // ../runtime/src/views/presenter-view.tsx
@@ -836,7 +1093,7 @@ function PresenterView() {
836
1093
  const aspect = useDeckSelector((state) => state.audienceAspect);
837
1094
  const [notes, setNotes] = useState(null);
838
1095
  const revealNote = useCallback((element) => {
839
- element?.scrollIntoView?.({ block: "nearest" });
1096
+ element?.scrollIntoView?.({ block: "start" });
840
1097
  }, []);
841
1098
  const meta = source.manifest.slides[nav.slide - 1];
842
1099
  const next = navigate(nav, { type: "next" }, source.manifest);
@@ -1001,10 +1258,9 @@ function DeckView() {
1001
1258
  else html.setAttribute("data-deck-motion", previousMotion);
1002
1259
  };
1003
1260
  }, [view]);
1004
- if (view === "presenter") return /* @__PURE__ */ jsx(PresenterView, {});
1005
1261
  if (view === "overview") return /* @__PURE__ */ jsx(OverviewView, {});
1006
1262
  if (view === "print") return /* @__PURE__ */ jsx(PrintView, {});
1007
- return /* @__PURE__ */ jsx(PlayView, {});
1263
+ return /* @__PURE__ */ jsxs(Fragment, { children: [view === "presenter" ? /* @__PURE__ */ jsx(PresenterView, {}) : /* @__PURE__ */ jsx(PlayView, {}), /* @__PURE__ */ jsx(GoToDialog, {})] });
1008
1264
  }
1009
1265
  function Presentation() {
1010
1266
  const { store } = useDeckContext();
@@ -1333,10 +1589,16 @@ function createBroadcastTransport(channelId) {
1333
1589
  }
1334
1590
  // ../runtime/src/store/store.ts
1335
1591
  function createDeckStore(manifest, options) {
1592
+ const identity = {
1593
+ seq: 0,
1594
+ started: performance.timeOrigin + performance.now(),
1595
+ origin: typeof crypto.randomUUID === "function" ? crypto.randomUUID() : Array.from(crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16)), (byte) => byte.toString(16).padStart(2, "0")).join("")
1596
+ };
1336
1597
  function readLocation() {
1337
1598
  const location = parseLocation(window.location.hash, window.location.search);
1338
1599
  const nav = clampNav(location, manifest);
1339
1600
  return {
1601
+ syncStamp: identity,
1340
1602
  nav: {
1341
1603
  slide: nav.slide,
1342
1604
  click: nav.click
@@ -1375,8 +1637,8 @@ function createDeckStore(manifest, options) {
1375
1637
  }
1376
1638
  const positionChanged = (a, b) => a.slide !== b.slide || a.click !== b.click;
1377
1639
  let lastAspect = window.innerWidth / window.innerHeight;
1378
- function current() {
1379
- const { nav, view, audienceAspect } = logical;
1640
+ function current(state = logical) {
1641
+ const { nav, view, audienceAspect } = state;
1380
1642
  const aspect = view === "play" ? window.innerWidth / window.innerHeight : audienceAspect;
1381
1643
  return aspect === void 0 ? { nav } : {
1382
1644
  nav,
@@ -1384,8 +1646,8 @@ function createDeckStore(manifest, options) {
1384
1646
  };
1385
1647
  }
1386
1648
  const session = options?.transport ? createSyncSession({
1387
- id: typeof crypto.randomUUID === "function" ? crypto.randomUUID() : Array.from(crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16)), (byte) => byte.toString(16).padStart(2, "0")).join(""),
1388
- startedAt: performance.timeOrigin + performance.now(),
1649
+ id: identity.origin,
1650
+ startedAt: identity.started,
1389
1651
  transport: options.transport,
1390
1652
  current,
1391
1653
  onRemote(remote) {
@@ -1393,6 +1655,7 @@ function createDeckStore(manifest, options) {
1393
1655
  const nav = clampNav(remote.nav, manifest);
1394
1656
  const next = {
1395
1657
  ...previous,
1658
+ syncStamp: session?.getStamp() ?? previous.syncStamp,
1396
1659
  nav,
1397
1660
  ...remote.aspect === void 0 ? {} : { audienceAspect: remote.aspect }
1398
1661
  };
@@ -1401,21 +1664,26 @@ function createDeckStore(manifest, options) {
1401
1664
  present(next);
1402
1665
  }
1403
1666
  }) : void 0;
1404
- function publish() {
1405
- const state = current();
1667
+ function publish(next = logical) {
1668
+ const state = current(next);
1406
1669
  if (state.aspect !== void 0) lastAspect = state.aspect;
1407
1670
  session?.publish(state);
1671
+ return session?.getStamp() ?? {
1672
+ ...identity,
1673
+ seq: logical.syncStamp.seq + 1
1674
+ };
1408
1675
  }
1409
1676
  function onLocation() {
1410
1677
  const previous = logical;
1411
1678
  const next = {
1412
1679
  ...previous,
1413
- ...readLocation()
1680
+ ...readLocation(),
1681
+ syncStamp: previous.syncStamp
1414
1682
  };
1415
1683
  writeLocation(next, false);
1416
1684
  if (next.nav.slide !== previous.nav.slide || next.nav.click !== previous.nav.click || next.view !== previous.view || next.embedded !== previous.embedded || next.bridge !== previous.bridge) {
1685
+ if (positionChanged(next.nav, previous.nav)) next.syncStamp = publish(next);
1417
1686
  present(next);
1418
- if (positionChanged(next.nav, previous.nav)) publish();
1419
1687
  }
1420
1688
  }
1421
1689
  let resizeTimer;
@@ -1442,8 +1710,10 @@ function createDeckStore(manifest, options) {
1442
1710
  nav
1443
1711
  };
1444
1712
  writeLocation(next, nav.slide !== previous.nav.slide);
1445
- present(next);
1446
- publish();
1713
+ present({
1714
+ ...next,
1715
+ syncStamp: publish(next)
1716
+ });
1447
1717
  },
1448
1718
  setView(view, position) {
1449
1719
  const previous = logical;
@@ -1460,8 +1730,10 @@ function createDeckStore(manifest, options) {
1460
1730
  view
1461
1731
  }, false);
1462
1732
  writeLocation(next, nav.slide !== previous.nav.slide);
1463
- present(next);
1464
- if (moved) publish();
1733
+ present(moved ? {
1734
+ ...next,
1735
+ syncStamp: publish(next)
1736
+ } : next);
1465
1737
  },
1466
1738
  destroy() {
1467
1739
  if (options?.present) cancelPresentation(options.present);
@@ -1505,4 +1777,37 @@ function EmbedReady({ start }) {
1505
1777
  useLayoutEffect(start, [start]);
1506
1778
  return null;
1507
1779
  }
1508
- export { SlideFrame as _, Cover as a, useSlideScale as b, TwoCol as c, Deck as d, PresenterView as f, registerSettleProbe as g, SlideHost as h, Center as i, routeEmbedNavigation as l, OverviewView as m, createDeckStore as n, ImageSide as o, PlayView as p, createBroadcastTransport as r, Section as s, mountDeck as t, registerCaptionProvider as u, useDeck as v, stepState as x, useSlide as y };
1780
+ // ../runtime/src/slides/link.tsx
1781
+ /** A link to slide `to` (architecture section 4.5). */
1782
+ function Link({ to, children }) {
1783
+ const { total, view, go } = useDeck();
1784
+ const { renderContext } = useSlide();
1785
+ if (!Number.isInteger(to) || to < 1 || to > total) throw new Error(`Invalid slide ${to} in a deck with ${total} slides`);
1786
+ if (renderContext !== "slide" && renderContext !== "presenter") return /* @__PURE__ */ jsx("span", { children });
1787
+ return /* @__PURE__ */ jsx("a", {
1788
+ href: formatHash({
1789
+ view,
1790
+ slide: to,
1791
+ click: 0
1792
+ }),
1793
+ onClick: (event) => {
1794
+ if (event.button !== 0 || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;
1795
+ event.preventDefault();
1796
+ go(to);
1797
+ },
1798
+ children
1799
+ });
1800
+ }
1801
+ // ../runtime/src/slides/toc.tsx
1802
+ /** Every slide's title as a link, the current one marked (architecture section 4.5). */
1803
+ function Toc() {
1804
+ const { slides, slide } = useDeck();
1805
+ return /* @__PURE__ */ jsx("ol", { children: slides.map((meta) => /* @__PURE__ */ jsx("li", {
1806
+ "aria-current": meta.no === slide ? "page" : void 0,
1807
+ children: /* @__PURE__ */ jsx(Link, {
1808
+ to: meta.no,
1809
+ children: meta.title || meta.no
1810
+ })
1811
+ }, meta.id)) });
1812
+ }
1813
+ export { stepState as C, useSlideScale as S, SlideHost as _, createBroadcastTransport as a, useDeck as b, ImageSide as c, routeEmbedNavigation as d, registerCaptionProvider as f, OverviewView as g, PlayView as h, createDeckStore as i, Section as l, PresenterView as m, Link as n, Center as o, Deck as p, mountDeck as r, Cover as s, Toc as t, TwoCol as u, registerSettleProbe as v, useSlide as x, SlideFrame as y };