@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.
- package/bin.js +2 -0
- package/dist/{build-DJGuOT6x.js → build-Cav2jYyI.js} +1 -1
- package/dist/cli/bin.js +5 -5
- package/dist/{config-Opp2R1Jf.js → config-g-uy_P5U.js} +218 -39
- package/dist/{dev-0SG0ArzD.js → dev-CFmlBbLh.js} +1 -1
- package/dist/index.d.ts +7 -9
- package/dist/{preview-61Aawrlg.js → preview-CotwHU_d.js} +1 -1
- package/dist/vite/index.js +1 -1
- package/package.json +5 -3
- package/src/app/App.tsx +2 -2
- package/src/app/components/Player.tsx +4 -4
- package/src/app/components/ThumbnailRail.tsx +5 -5
- package/src/app/components/inspector/InspectOverlay.tsx +4 -4
- package/src/app/components/inspector/InspectorProvider.tsx +5 -5
- package/src/app/components/sidebar/FolderItem.tsx +191 -0
- package/src/app/components/sidebar/IconPicker.tsx +59 -0
- package/src/app/components/sidebar/Sidebar.tsx +118 -0
- package/src/app/components/ui/dropdown-menu.tsx +257 -0
- package/src/app/components/ui/popover.tsx +87 -0
- package/src/app/components/ui/tabs.tsx +89 -0
- package/src/app/lib/folders.ts +130 -0
- package/src/app/lib/inspector/fiber.ts +2 -2
- package/src/app/lib/inspector/useComments.ts +8 -8
- package/src/app/lib/sdk.ts +20 -5
- package/src/app/lib/slides.ts +8 -0
- package/src/app/routes/Home.tsx +151 -62
- package/src/app/routes/{Deck.tsx → Slide.tsx} +17 -17
- package/src/app/virtual.d.ts +4 -4
- package/src/app/lib/decks.ts +0 -8
|
@@ -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 {
|
|
13
|
-
import type {
|
|
12
|
+
import { loadSlide } from '../lib/slides';
|
|
13
|
+
import type { SlideModule } from '../lib/sdk';
|
|
14
14
|
|
|
15
|
-
export function
|
|
16
|
-
const {
|
|
15
|
+
export function Slide() {
|
|
16
|
+
const { slideId = '' } = useParams();
|
|
17
17
|
const [searchParams, setSearchParams] = useSearchParams();
|
|
18
|
-
const [
|
|
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
|
-
|
|
24
|
+
setSlide(null);
|
|
25
25
|
setError(null);
|
|
26
|
-
|
|
26
|
+
loadSlide(slideId)
|
|
27
27
|
.then((mod) => {
|
|
28
|
-
if (!cancelled)
|
|
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
|
-
}, [
|
|
36
|
+
}, [slideId]);
|
|
37
37
|
|
|
38
|
-
const pages = useMemo(() =>
|
|
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
|
|
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 (!
|
|
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 {
|
|
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
|
|
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/{
|
|
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 =
|
|
124
|
+
const title = slide.meta?.title ?? slideId;
|
|
125
125
|
|
|
126
126
|
return (
|
|
127
|
-
<InspectorProvider
|
|
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">
|
package/src/app/virtual.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
declare module 'virtual:open-slide/
|
|
2
|
-
import type {
|
|
3
|
-
export const
|
|
4
|
-
export function
|
|
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' {
|
package/src/app/lib/decks.ts
DELETED