@open-slide/core 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,23 +9,23 @@ import { Separator } from '@/components/ui/separator';
9
9
  import { Player } from '../components/Player';
10
10
  import { SlideCanvas } from '../components/SlideCanvas';
11
11
  import { ThumbnailRail } from '../components/ThumbnailRail';
12
- import { loadDeck } from '../lib/decks';
13
- import type { DeckModule } from '../lib/sdk';
12
+ import { loadSlide } from '../lib/slides';
13
+ import type { SlideModule } from '../lib/sdk';
14
14
 
15
- export function Deck() {
16
- const { deckId = '' } = useParams();
15
+ export function Slide() {
16
+ const { slideId = '' } = useParams();
17
17
  const [searchParams, setSearchParams] = useSearchParams();
18
- const [deck, setDeck] = useState<DeckModule | null>(null);
18
+ const [slide, setSlide] = useState<SlideModule | null>(null);
19
19
  const [error, setError] = useState<string | null>(null);
20
20
  const [playing, setPlaying] = useState(false);
21
21
 
22
22
  useEffect(() => {
23
23
  let cancelled = false;
24
- setDeck(null);
24
+ setSlide(null);
25
25
  setError(null);
26
- loadDeck(deckId)
26
+ loadSlide(slideId)
27
27
  .then((mod) => {
28
- if (!cancelled) setDeck(mod);
28
+ if (!cancelled) setSlide(mod);
29
29
  })
30
30
  .catch((e) => {
31
31
  if (!cancelled) setError(String(e?.message ?? e));
@@ -33,9 +33,9 @@ export function Deck() {
33
33
  return () => {
34
34
  cancelled = true;
35
35
  };
36
- }, [deckId]);
36
+ }, [slideId]);
37
37
 
38
- const pages = useMemo(() => deck?.default ?? [], [deck]);
38
+ const pages = useMemo(() => slide?.default ?? [], [slide]);
39
39
  const pageCount = pages.length;
40
40
  const rawIndex = Number(searchParams.get('p') ?? '1') - 1;
41
41
  const index = Number.isFinite(rawIndex) ? Math.max(0, Math.min(pageCount - 1, rawIndex)) : 0;
@@ -79,7 +79,7 @@ export function Deck() {
79
79
  <Link to="/" className="text-sm font-medium text-primary hover:underline">
80
80
  ← Home
81
81
  </Link>
82
- <h2 className="mt-4 text-xl font-semibold text-foreground">Failed to load deck</h2>
82
+ <h2 className="mt-4 text-xl font-semibold text-foreground">Failed to load slide</h2>
83
83
  <pre className="mt-4 overflow-auto rounded-md border bg-card p-4 text-xs whitespace-pre-wrap shadow-sm">
84
84
  {error}
85
85
  </pre>
@@ -87,10 +87,10 @@ export function Deck() {
87
87
  );
88
88
  }
89
89
 
90
- if (!deck) {
90
+ if (!slide) {
91
91
  return (
92
92
  <div className="mx-auto max-w-3xl px-8 py-16 text-sm text-muted-foreground">
93
- Loading {deckId}…
93
+ Loading {slideId}…
94
94
  </div>
95
95
  );
96
96
  }
@@ -101,10 +101,10 @@ export function Deck() {
101
101
  <Link to="/" className="text-sm font-medium text-primary hover:underline">
102
102
  ← Home
103
103
  </Link>
104
- <h2 className="mt-4 text-xl font-semibold text-foreground">Empty deck</h2>
104
+ <h2 className="mt-4 text-xl font-semibold text-foreground">Empty slide</h2>
105
105
  <p className="mt-2 text-sm">
106
106
  <code className="rounded bg-muted px-1.5 py-0.5 font-mono text-xs">
107
- slides/{deckId}/index.tsx
107
+ slides/{slideId}/index.tsx
108
108
  </code>{' '}
109
109
  must{' '}
110
110
  <code className="rounded bg-muted px-1.5 py-0.5 font-mono text-xs">export default</code> a
@@ -121,10 +121,10 @@ export function Deck() {
121
121
  }
122
122
 
123
123
  const CurrentPage = pages[index];
124
- const title = deck.meta?.title ?? deckId;
124
+ const title = slide.meta?.title ?? slideId;
125
125
 
126
126
  return (
127
- <InspectorProvider deckId={deckId}>
127
+ <InspectorProvider slideId={slideId}>
128
128
  <div className="flex h-screen flex-col overflow-hidden bg-background">
129
129
  <header className="flex shrink-0 items-center gap-4 border-b bg-card px-5 py-3">
130
130
  <Button asChild variant="ghost" size="sm">
@@ -1,7 +1,7 @@
1
- declare module 'virtual:open-slide/decks' {
2
- import type { DeckModule } from './lib/sdk';
3
- export const deckIds: string[];
4
- export function loadDeck(id: string): Promise<DeckModule>;
1
+ declare module 'virtual:open-slide/slides' {
2
+ import type { SlideModule } from './lib/sdk';
3
+ export const slideIds: string[];
4
+ export function loadSlide(id: string): Promise<SlideModule>;
5
5
  }
6
6
 
7
7
  declare module 'virtual:open-slide/config' {
@@ -1,8 +0,0 @@
1
- import type { DeckModule } from './sdk';
2
- import { deckIds as ids, loadDeck as load } from 'virtual:open-slide/decks';
3
-
4
- export const deckIds: string[] = ids;
5
-
6
- export async function loadDeck(id: string): Promise<DeckModule> {
7
- return load(id);
8
- }