@open-slide/core 1.19.0 → 2.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{build-CaV_vhIw.js → build-CfAxF6Dm.js} +2 -5
- package/dist/cli/bin.d.ts +1 -1
- package/dist/cli/bin.js +139 -13
- package/dist/{config-CDHB8Oow.d.ts → config-AtA2Bqtn.d.ts} +4 -4
- package/dist/{config-GA6NMgs_.js → config-C_VI2EpT.js} +545 -776
- package/dist/{design-cpzS8aud.js → design-Cpqx7SJs.js} +1 -2
- package/dist/{dev-D57ui2yV.js → dev-BChELmc-.js} +4 -7
- package/dist/index.d.ts +7 -37
- package/dist/index.js +51 -54
- package/dist/locale/index.d.ts +2 -8
- package/dist/locale/index.js +13 -3
- package/dist/{preview-D40Zw_o0.js → preview-CcCQa268.js} +3 -7
- package/dist/{types-8HghULIe.d.ts → types-BzPSOxe-.d.ts} +5 -9
- package/dist/vite/index.d.ts +1 -4
- package/dist/vite/index.js +2 -4
- package/dist/{format-74A3B6zu.js → zh-tw-BxZ_pYqe.js} +13 -49
- package/package.json +12 -12
- package/skills/create-slide/SKILL.md +4 -1
- package/skills/slide-authoring/SKILL.md +25 -2
- package/src/app/app.tsx +18 -15
- package/src/app/assets/open-slide.png +0 -0
- package/src/app/components/asset-view.tsx +46 -39
- package/src/app/components/command/command-menu.tsx +5 -1
- package/src/app/components/command/command.tsx +4 -2
- package/src/app/components/command/home-command-menu.tsx +6 -6
- package/src/app/components/export-progress-toast.tsx +80 -0
- package/src/app/components/history-provider.tsx +1 -5
- package/src/app/components/icon-tooltip.tsx +24 -15
- package/src/app/components/image-placeholder.tsx +4 -12
- package/src/app/components/inspector/asset-picker-dialog.tsx +24 -32
- package/src/app/components/inspector/comment-widget.tsx +33 -7
- package/src/app/components/inspector/image-crop-dialog.tsx +9 -6
- package/src/app/components/inspector/inline-text-editor.tsx +798 -0
- package/src/app/components/inspector/inspect-overlay.tsx +35 -76
- package/src/app/components/inspector/inspector-panel.tsx +31 -53
- package/src/app/components/inspector/inspector-provider.tsx +53 -36
- package/src/app/components/language-toggle.tsx +2 -3
- package/src/app/components/notes-drawer.tsx +4 -7
- package/src/app/components/overview-grid.tsx +15 -8
- package/src/app/components/panel/panel-shell.tsx +1 -3
- package/src/app/components/panel/save-card.tsx +12 -3
- package/src/app/components/player.tsx +5 -6
- package/src/app/components/present/blackout-overlay.tsx +16 -3
- package/src/app/components/present/control-bar.tsx +21 -13
- package/src/app/components/present/jump-input.tsx +27 -5
- package/src/app/components/present/laser-pointer.tsx +34 -11
- package/src/app/components/present/progress-bar.tsx +1 -1
- package/src/app/components/present/use-presenter-channel.ts +0 -1
- package/src/app/components/present/use-touch-swipe.ts +9 -2
- package/src/app/components/sidebar/folder-item.tsx +48 -21
- package/src/app/components/sidebar/icon-picker.tsx +1 -1
- package/src/app/components/sidebar/sidebar-footer.tsx +20 -7
- package/src/app/components/sidebar/sidebar.tsx +91 -64
- package/src/app/components/slide-canvas.tsx +2 -6
- package/src/app/components/slide-transition-layer.tsx +48 -76
- package/src/app/components/style-panel/design-provider.tsx +1 -14
- package/src/app/components/style-panel/style-panel.tsx +16 -12
- package/src/app/components/style-panel/use-design.ts +1 -28
- package/src/app/components/theme-toggle.tsx +4 -5
- package/src/app/components/themes/theme-detail.tsx +11 -8
- package/src/app/components/themes/themes-gallery.tsx +13 -8
- package/src/app/components/thumbnail-rail.tsx +14 -15
- package/src/app/index.html +21 -0
- package/src/app/lib/assets.ts +6 -7
- package/src/app/lib/dom.ts +42 -0
- package/src/app/lib/export-html.ts +10 -25
- package/src/app/lib/export-pdf.ts +11 -28
- package/src/app/lib/export-pptx.ts +6 -36
- package/src/app/lib/folders.ts +51 -46
- package/src/app/lib/inspector/inline-text.ts +31 -0
- package/src/app/lib/inspector/pick-target.ts +38 -0
- package/src/app/lib/inspector/use-comments.ts +1 -1
- package/src/app/lib/keys.ts +18 -0
- package/src/app/lib/last-home-location.ts +18 -0
- package/src/app/lib/print-ready.ts +2 -4
- package/src/app/lib/slides.ts +7 -4
- package/src/app/lib/text-diff.ts +19 -0
- package/src/app/lib/use-click-page-navigation.ts +2 -6
- package/src/app/lib/use-is-mobile.ts +2 -14
- package/src/app/lib/use-media-query.ts +20 -0
- package/src/app/lib/use-prefers-reduced-motion.ts +5 -13
- package/src/app/lib/use-slide-module.ts +1 -1
- package/src/app/lib/use-wheel-page-navigation.ts +1 -1
- package/src/app/lib/utils.test.ts +25 -1
- package/src/app/lib/utils.ts +8 -0
- package/src/app/routes/home-shell.tsx +71 -64
- package/src/app/routes/home.tsx +50 -58
- package/src/app/routes/presenter.tsx +14 -23
- package/src/app/routes/slide.tsx +90 -77
- package/src/app/routes/themes.tsx +7 -8
- package/src/app/styles.css +40 -44
- package/src/locale/en.ts +2 -7
- package/src/locale/ja.ts +2 -7
- package/src/locale/types.ts +2 -7
- package/src/locale/zh-cn.ts +2 -7
- package/src/locale/zh-tw.ts +2 -7
- package/dist/sync-BCJDRIqo.js +0 -139
- package/dist/sync-j9_QPovT.js +0 -3
- package/src/app/components/pdf-progress-toast.tsx +0 -32
- package/src/app/components/pptx-progress-toast.tsx +0 -32
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Menu } from 'lucide-react';
|
|
2
|
-
import { useCallback, useMemo, useState } from 'react';
|
|
2
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
3
3
|
import { Outlet, useLocation, useNavigate, useSearchParams } from 'react-router-dom';
|
|
4
4
|
import { toast } from 'sonner';
|
|
5
5
|
import { LanguageToggle } from '@/components/language-toggle';
|
|
@@ -10,13 +10,14 @@ import {
|
|
|
10
10
|
DropdownMenuItem,
|
|
11
11
|
DropdownMenuTrigger,
|
|
12
12
|
} from '@/components/ui/dropdown-menu';
|
|
13
|
-
import { useAssets } from '@/lib/assets';
|
|
13
|
+
import { GLOBAL_ASSET_SCOPE, useAssets } from '@/lib/assets';
|
|
14
14
|
import { useFolders } from '@/lib/folders';
|
|
15
|
+
import { rememberHomeLocation } from '@/lib/last-home-location';
|
|
15
16
|
import { format, useLocale } from '@/lib/use-locale';
|
|
16
|
-
import { cn } from '@/lib/utils';
|
|
17
|
+
import { cn, pad2 } from '@/lib/utils';
|
|
17
18
|
import { CommandMenuTrigger } from '../components/command/command-menu';
|
|
18
19
|
import { HomeCommandMenu } from '../components/command/home-command-menu';
|
|
19
|
-
import {
|
|
20
|
+
import { SystemViewIcon } from '../components/sidebar/folder-item';
|
|
20
21
|
import { ALL_SLIDES_ID, ASSETS_ID, Sidebar, THEMES_ID } from '../components/sidebar/sidebar';
|
|
21
22
|
import type { FoldersManifest } from '../lib/sdk';
|
|
22
23
|
import { slideIds } from '../lib/slides';
|
|
@@ -64,6 +65,10 @@ export function HomeShell() {
|
|
|
64
65
|
|
|
65
66
|
const selectedId = pathToSelectedId(location.pathname, searchParams);
|
|
66
67
|
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
rememberHomeLocation(location.pathname, location.search);
|
|
70
|
+
}, [location.pathname, location.search]);
|
|
71
|
+
|
|
67
72
|
const [commandOpen, setCommandOpen] = useState(false);
|
|
68
73
|
const openCommandMenu = useCallback(() => setCommandOpen(true), []);
|
|
69
74
|
|
|
@@ -84,8 +89,8 @@ export function HomeShell() {
|
|
|
84
89
|
[navigate],
|
|
85
90
|
);
|
|
86
91
|
|
|
87
|
-
const { assets: globalAssets } = useAssets(
|
|
88
|
-
const isAssetsRoute =
|
|
92
|
+
const { assets: globalAssets } = useAssets(GLOBAL_ASSET_SCOPE);
|
|
93
|
+
const isAssetsRoute = selectedId === ASSETS_ID;
|
|
89
94
|
|
|
90
95
|
const { draftSlides, slidesByFolder } = useMemo(() => {
|
|
91
96
|
const byFolder: Record<string, string[]> = {};
|
|
@@ -140,7 +145,7 @@ export function HomeShell() {
|
|
|
140
145
|
};
|
|
141
146
|
|
|
142
147
|
return (
|
|
143
|
-
<div className="flex h-dvh overflow-hidden bg-
|
|
148
|
+
<div className="flex h-dvh overflow-hidden bg-sidebar text-foreground">
|
|
144
149
|
<div className="hidden md:block">
|
|
145
150
|
<Sidebar
|
|
146
151
|
folders={manifest.folders}
|
|
@@ -176,69 +181,71 @@ export function HomeShell() {
|
|
|
176
181
|
/>
|
|
177
182
|
</div>
|
|
178
183
|
|
|
179
|
-
<div className="relative flex min-w-0 flex-1 flex-col
|
|
180
|
-
<div className="flex
|
|
181
|
-
<
|
|
182
|
-
|
|
183
|
-
<
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
<
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
184
|
+
<div className="relative flex min-w-0 flex-1 flex-col md:py-2 md:pr-2">
|
|
185
|
+
<div className="relative flex min-w-0 flex-1 flex-col overflow-y-auto bg-background md:rounded-[10px] md:shadow-edge md:ring-1 md:ring-foreground/[0.06]">
|
|
186
|
+
<div className="flex items-center justify-between border-b border-hairline bg-sidebar px-4 py-3 md:hidden">
|
|
187
|
+
<h1 className="font-heading text-lg font-bold tracking-tight">{t.home.appTitle}</h1>
|
|
188
|
+
<div className="-mr-1.5 flex items-center gap-0.5">
|
|
189
|
+
<CommandMenuTrigger onClick={openCommandMenu} />
|
|
190
|
+
<LanguageToggle />
|
|
191
|
+
<ThemeToggle />
|
|
192
|
+
<DropdownMenu>
|
|
193
|
+
<DropdownMenuTrigger
|
|
194
|
+
render={
|
|
195
|
+
<button
|
|
196
|
+
type="button"
|
|
197
|
+
aria-label={t.home.menu}
|
|
198
|
+
className="flex size-8 items-center justify-center rounded-[6px] text-muted-foreground outline-none transition-[background-color,color,scale] duration-100 hover:bg-muted hover:text-foreground active:scale-95 focus-visible:ring-2 focus-visible:ring-ring/30 aria-expanded:bg-muted aria-expanded:text-foreground"
|
|
199
|
+
>
|
|
200
|
+
<Menu className="size-4" />
|
|
201
|
+
</button>
|
|
202
|
+
}
|
|
203
|
+
/>
|
|
204
|
+
<DropdownMenuContent align="end" className="min-w-[200px]">
|
|
205
|
+
<DropdownMenuItem
|
|
206
|
+
onClick={() => selectFolder(ALL_SLIDES_ID)}
|
|
207
|
+
className={cn(
|
|
208
|
+
selectedId !== THEMES_ID &&
|
|
209
|
+
selectedId !== ASSETS_ID &&
|
|
210
|
+
'bg-muted text-foreground',
|
|
211
|
+
)}
|
|
193
212
|
>
|
|
194
|
-
<
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
<DropdownMenuContent align="end" className="min-w-[200px]">
|
|
199
|
-
<DropdownMenuItem
|
|
200
|
-
onClick={() => selectFolder(ALL_SLIDES_ID)}
|
|
201
|
-
className={cn(
|
|
202
|
-
selectedId !== THEMES_ID &&
|
|
203
|
-
selectedId !== ASSETS_ID &&
|
|
204
|
-
'bg-muted text-foreground',
|
|
205
|
-
)}
|
|
206
|
-
>
|
|
207
|
-
<FolderIconChip icon={{ type: 'emoji', value: '🎞️' }} />
|
|
208
|
-
<span className="flex-1 truncate">{t.home.slides}</span>
|
|
209
|
-
<span className="folio">{slideIds.length.toString().padStart(2, '0')}</span>
|
|
210
|
-
</DropdownMenuItem>
|
|
211
|
-
<DropdownMenuItem
|
|
212
|
-
onClick={() => selectFolder(THEMES_ID)}
|
|
213
|
-
className={cn(selectedId === THEMES_ID && 'bg-muted text-foreground')}
|
|
214
|
-
>
|
|
215
|
-
<FolderIconChip icon={{ type: 'emoji', value: '🎨' }} />
|
|
216
|
-
<span className="flex-1 truncate">{t.home.themes}</span>
|
|
217
|
-
<span className="folio">{themeRegistry.length.toString().padStart(2, '0')}</span>
|
|
218
|
-
</DropdownMenuItem>
|
|
219
|
-
{import.meta.env.DEV && (
|
|
213
|
+
<SystemViewIcon kind="all" className="text-muted-foreground" />
|
|
214
|
+
<span className="flex-1 truncate">{t.home.slides}</span>
|
|
215
|
+
<span className="folio">{pad2(slideIds.length)}</span>
|
|
216
|
+
</DropdownMenuItem>
|
|
220
217
|
<DropdownMenuItem
|
|
221
|
-
onClick={() => selectFolder(
|
|
222
|
-
className={cn(selectedId ===
|
|
218
|
+
onClick={() => selectFolder(THEMES_ID)}
|
|
219
|
+
className={cn(selectedId === THEMES_ID && 'bg-muted text-foreground')}
|
|
223
220
|
>
|
|
224
|
-
<
|
|
225
|
-
<span className="flex-1 truncate">{t.home.
|
|
226
|
-
<span className="folio">{
|
|
221
|
+
<SystemViewIcon kind="themes" className="text-muted-foreground" />
|
|
222
|
+
<span className="flex-1 truncate">{t.home.themes}</span>
|
|
223
|
+
<span className="folio">{pad2(themeRegistry.length)}</span>
|
|
227
224
|
</DropdownMenuItem>
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
225
|
+
{import.meta.env.DEV && (
|
|
226
|
+
<DropdownMenuItem
|
|
227
|
+
onClick={() => selectFolder(ASSETS_ID)}
|
|
228
|
+
className={cn(selectedId === ASSETS_ID && 'bg-muted text-foreground')}
|
|
229
|
+
>
|
|
230
|
+
<SystemViewIcon kind="assets" className="text-muted-foreground" />
|
|
231
|
+
<span className="flex-1 truncate">{t.home.assets}</span>
|
|
232
|
+
<span className="folio">{pad2(globalAssets.length)}</span>
|
|
233
|
+
</DropdownMenuItem>
|
|
234
|
+
)}
|
|
235
|
+
</DropdownMenuContent>
|
|
236
|
+
</DropdownMenu>
|
|
237
|
+
</div>
|
|
231
238
|
</div>
|
|
232
|
-
</div>
|
|
233
239
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
240
|
+
<div
|
|
241
|
+
className={cn(
|
|
242
|
+
isAssetsRoute
|
|
243
|
+
? 'flex min-h-0 flex-1 flex-col'
|
|
244
|
+
: 'mx-auto w-full max-w-[1180px] px-5 py-8 md:px-10 md:py-12',
|
|
245
|
+
)}
|
|
246
|
+
>
|
|
247
|
+
<Outlet context={ctx} />
|
|
248
|
+
</div>
|
|
242
249
|
</div>
|
|
243
250
|
</div>
|
|
244
251
|
|
package/src/app/routes/home.tsx
CHANGED
|
@@ -31,12 +31,12 @@ import {
|
|
|
31
31
|
DropdownMenuTrigger,
|
|
32
32
|
} from '@/components/ui/dropdown-menu';
|
|
33
33
|
import { format, useLocale } from '@/lib/use-locale';
|
|
34
|
-
import { cn } from '@/lib/utils';
|
|
35
|
-
import { FolderIconChip, SLIDE_DND_MIME } from '../components/sidebar/folder-item';
|
|
34
|
+
import { cn, pad2 } from '@/lib/utils';
|
|
35
|
+
import { FolderIconChip, SLIDE_DND_MIME, SystemViewIcon } from '../components/sidebar/folder-item';
|
|
36
36
|
import { ALL_SLIDES_ID, DRAFT_ID } from '../components/sidebar/sidebar';
|
|
37
37
|
import { SlideCanvas } from '../components/slide-canvas';
|
|
38
38
|
import { SlidePageProvider } from '../lib/page-context';
|
|
39
|
-
import type { Folder,
|
|
39
|
+
import type { Folder, SlideModule } from '../lib/sdk';
|
|
40
40
|
import { loadSlide, slideCreatedAt, slideIds } from '../lib/slides';
|
|
41
41
|
import type { HomeOutletContext } from './home-shell';
|
|
42
42
|
|
|
@@ -97,10 +97,6 @@ export function Home() {
|
|
|
97
97
|
: (slidesByFolder[selectedId] ?? []);
|
|
98
98
|
|
|
99
99
|
const title = selectedFolder?.name ?? (isAll ? t.home.slides : t.home.draft);
|
|
100
|
-
const headerIcon = selectedFolder?.icon ?? {
|
|
101
|
-
type: 'emoji' as const,
|
|
102
|
-
value: isAll ? '🎞️' : '📝',
|
|
103
|
-
};
|
|
104
100
|
|
|
105
101
|
const [query, setQuery] = useState('');
|
|
106
102
|
const [sortKey, setSortKey] = useSortPref();
|
|
@@ -136,10 +132,14 @@ export function Home() {
|
|
|
136
132
|
|
|
137
133
|
return (
|
|
138
134
|
<>
|
|
139
|
-
<header className="mb-
|
|
140
|
-
<div className="flex flex-wrap items-center gap-
|
|
141
|
-
|
|
142
|
-
|
|
135
|
+
<header className="mb-6 md:mb-8">
|
|
136
|
+
<div className="flex flex-wrap items-center gap-2.5">
|
|
137
|
+
{selectedFolder ? (
|
|
138
|
+
<FolderIconChip icon={selectedFolder.icon} className="size-5 text-[16px]" />
|
|
139
|
+
) : (
|
|
140
|
+
<SystemViewIcon kind={isAll ? 'all' : 'draft'} className="text-muted-foreground" />
|
|
141
|
+
)}
|
|
142
|
+
<h1 className="font-heading text-[19px] font-semibold leading-none tracking-[-0.015em] md:text-[21px]">
|
|
143
143
|
{title}
|
|
144
144
|
</h1>
|
|
145
145
|
<DropdownMenu>
|
|
@@ -148,7 +148,7 @@ export function Home() {
|
|
|
148
148
|
<button
|
|
149
149
|
type="button"
|
|
150
150
|
aria-label={t.home.folders}
|
|
151
|
-
className="flex size-7 items-center justify-center rounded-[6px] border border-border bg-card text-muted-foreground hover:text-foreground aria-expanded:border-foreground/40 aria-expanded:text-foreground md:hidden"
|
|
151
|
+
className="flex size-7 items-center justify-center rounded-[6px] border border-border bg-card text-muted-foreground outline-none transition-[background-color,color,scale] duration-100 hover:bg-muted hover:text-foreground active:scale-95 focus-visible:ring-2 focus-visible:ring-ring/30 aria-expanded:border-foreground/40 aria-expanded:text-foreground md:hidden"
|
|
152
152
|
>
|
|
153
153
|
<ChevronDown className="size-4" />
|
|
154
154
|
</button>
|
|
@@ -159,17 +159,17 @@ export function Home() {
|
|
|
159
159
|
onClick={() => selectFolder(ALL_SLIDES_ID)}
|
|
160
160
|
className={cn(isAll && 'bg-muted text-foreground')}
|
|
161
161
|
>
|
|
162
|
-
<
|
|
162
|
+
<SystemViewIcon kind="all" className="text-muted-foreground" />
|
|
163
163
|
<span className="flex-1 truncate">{t.home.slides}</span>
|
|
164
|
-
<span className="folio">{slideIds.length
|
|
164
|
+
<span className="folio">{pad2(slideIds.length)}</span>
|
|
165
165
|
</DropdownMenuItem>
|
|
166
166
|
<DropdownMenuItem
|
|
167
167
|
onClick={() => selectFolder(DRAFT_ID)}
|
|
168
168
|
className={cn(isDraft && 'bg-muted text-foreground')}
|
|
169
169
|
>
|
|
170
|
-
<
|
|
170
|
+
<SystemViewIcon kind="draft" className="text-muted-foreground" />
|
|
171
171
|
<span className="flex-1 truncate">{t.home.draft}</span>
|
|
172
|
-
<span className="folio">{draftSlides.length
|
|
172
|
+
<span className="folio">{pad2(draftSlides.length)}</span>
|
|
173
173
|
</DropdownMenuItem>
|
|
174
174
|
{manifest.folders.map((f) => (
|
|
175
175
|
<DropdownMenuItem
|
|
@@ -179,23 +179,15 @@ export function Home() {
|
|
|
179
179
|
>
|
|
180
180
|
<FolderIconChip icon={f.icon} />
|
|
181
181
|
<span className="flex-1 truncate">{f.name}</span>
|
|
182
|
-
<span className="folio">
|
|
183
|
-
{(slidesByFolder[f.id]?.length ?? 0).toString().padStart(2, '0')}
|
|
184
|
-
</span>
|
|
182
|
+
<span className="folio">{pad2(slidesByFolder[f.id]?.length ?? 0)}</span>
|
|
185
183
|
</DropdownMenuItem>
|
|
186
184
|
))}
|
|
187
185
|
</DropdownMenuContent>
|
|
188
186
|
</DropdownMenu>
|
|
189
187
|
{!loading && (
|
|
190
|
-
<span className="folio ml-
|
|
191
|
-
{(isSearching ? filteredSlides.length : visibleSlides.length)
|
|
192
|
-
|
|
193
|
-
.padStart(2, '0')}
|
|
194
|
-
{isSearching && (
|
|
195
|
-
<span className="opacity-40">
|
|
196
|
-
/{visibleSlides.length.toString().padStart(2, '0')}
|
|
197
|
-
</span>
|
|
198
|
-
)}
|
|
188
|
+
<span className="folio ml-0.5">
|
|
189
|
+
{pad2(isSearching ? filteredSlides.length : visibleSlides.length)}
|
|
190
|
+
{isSearching && <span className="opacity-40">/{pad2(visibleSlides.length)}</span>}
|
|
199
191
|
</span>
|
|
200
192
|
)}
|
|
201
193
|
<div className="ml-auto flex w-full items-center gap-2 md:w-auto">
|
|
@@ -213,8 +205,12 @@ export function Home() {
|
|
|
213
205
|
<NoResultsState query={query} onClear={() => setQuery('')} />
|
|
214
206
|
) : (
|
|
215
207
|
<ul className="grid grid-cols-[repeat(auto-fill,minmax(240px,1fr))] gap-x-6 gap-y-9 md:grid-cols-[repeat(auto-fill,minmax(300px,1fr))]">
|
|
216
|
-
{sortedSlides.map((id) => (
|
|
217
|
-
<li
|
|
208
|
+
{sortedSlides.map((id, i) => (
|
|
209
|
+
<li
|
|
210
|
+
key={id}
|
|
211
|
+
className="rise-in"
|
|
212
|
+
style={{ animationDelay: `${Math.min(i, 11) * 30}ms` }}
|
|
213
|
+
>
|
|
218
214
|
<SlideCard
|
|
219
215
|
id={id}
|
|
220
216
|
folders={manifest.folders}
|
|
@@ -266,7 +262,7 @@ function SearchInput({ value, onChange }: { value: string; onChange: (value: str
|
|
|
266
262
|
type="button"
|
|
267
263
|
onClick={() => onChange('')}
|
|
268
264
|
aria-label={t.home.clearSearch}
|
|
269
|
-
className="absolute right-1.5 top-1/2 flex size-5 -translate-y-1/2 items-center justify-center rounded-[4px] text-muted-foreground hover:bg-muted hover:text-foreground"
|
|
265
|
+
className="absolute right-1.5 top-1/2 flex size-5 -translate-y-1/2 items-center justify-center rounded-[4px] text-muted-foreground outline-none transition-[background-color,color,scale] duration-100 hover:bg-muted hover:text-foreground active:scale-90 focus-visible:ring-2 focus-visible:ring-ring/30"
|
|
270
266
|
>
|
|
271
267
|
<X className="size-3" />
|
|
272
268
|
</button>
|
|
@@ -296,7 +292,7 @@ function SortControl({ value, onChange }: { value: SortKey; onChange: (next: Sor
|
|
|
296
292
|
<button
|
|
297
293
|
type="button"
|
|
298
294
|
aria-label={`${t.home.sortLabel}: ${labels[value]}`}
|
|
299
|
-
className="flex h-8 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-[6px] border border-border bg-background pl-2 pr-1.5 text-[12.5px] font-medium text-foreground outline-none hover:bg-muted focus-visible:border-foreground/40 focus-visible:ring-2 focus-visible:ring-ring/30"
|
|
295
|
+
className="flex h-8 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-[6px] border border-border bg-background pl-2 pr-1.5 text-[12.5px] font-medium text-foreground outline-none transition-[background-color,translate] duration-100 hover:bg-muted active:translate-y-px focus-visible:border-foreground/40 focus-visible:ring-2 focus-visible:ring-ring/30"
|
|
300
296
|
>
|
|
301
297
|
<FieldIcon k={value} className="size-3.5 text-muted-foreground" />
|
|
302
298
|
<span>{labels[value]}</span>
|
|
@@ -343,12 +339,10 @@ function HomeLoading() {
|
|
|
343
339
|
function NoResultsState({ query, onClear }: { query: string; onClear: () => void }) {
|
|
344
340
|
const t = useLocale();
|
|
345
341
|
return (
|
|
346
|
-
<div className="rounded-[
|
|
342
|
+
<div className="rounded-[8px] border border-dashed border-border px-8 py-20">
|
|
347
343
|
<div className="mx-auto flex max-w-md flex-col items-center text-center">
|
|
348
|
-
<
|
|
349
|
-
|
|
350
|
-
</div>
|
|
351
|
-
<p className="mt-4 font-heading text-[15px] font-semibold tracking-tight">
|
|
344
|
+
<Search className="size-5 text-muted-foreground/60" aria-hidden />
|
|
345
|
+
<p className="mt-4 font-heading text-[14px] font-semibold tracking-tight">
|
|
352
346
|
{t.home.noMatches}
|
|
353
347
|
</p>
|
|
354
348
|
<p className="mt-1.5 text-[13px] leading-relaxed text-muted-foreground">
|
|
@@ -371,14 +365,12 @@ function EmptyState({ isDraft, folderName }: { isDraft: boolean; folderName?: st
|
|
|
371
365
|
folderName ?? t.home.folderEmptyTitle,
|
|
372
366
|
);
|
|
373
367
|
return (
|
|
374
|
-
<div className="rounded-[
|
|
368
|
+
<div className="rounded-[8px] border border-dashed border-border px-8 py-20">
|
|
375
369
|
<div className="mx-auto flex max-w-md flex-col items-center text-center">
|
|
376
|
-
<
|
|
377
|
-
<FolderPlus className="size-5" />
|
|
378
|
-
</div>
|
|
370
|
+
<FolderPlus className="size-5 text-muted-foreground/60" aria-hidden />
|
|
379
371
|
{isDraft ? (
|
|
380
372
|
<>
|
|
381
|
-
<p className="mt-4 font-heading text-[
|
|
373
|
+
<p className="mt-4 font-heading text-[14px] font-semibold tracking-tight">
|
|
382
374
|
{t.home.noSlidesYet}
|
|
383
375
|
</p>
|
|
384
376
|
<p className="mt-1.5 text-[13px] leading-relaxed text-muted-foreground">
|
|
@@ -391,7 +383,7 @@ function EmptyState({ isDraft, folderName }: { isDraft: boolean; folderName?: st
|
|
|
391
383
|
</>
|
|
392
384
|
) : (
|
|
393
385
|
<>
|
|
394
|
-
<p className="mt-4 font-heading text-[
|
|
386
|
+
<p className="mt-4 font-heading text-[14px] font-semibold tracking-tight">
|
|
395
387
|
{folderEmptyTitle}
|
|
396
388
|
</p>
|
|
397
389
|
<p className="mt-1.5 text-[13px] leading-relaxed text-muted-foreground">
|
|
@@ -510,11 +502,14 @@ function SlideCard({
|
|
|
510
502
|
onDragEnd={() => setDragging(false)}
|
|
511
503
|
className={cn('group relative motion-safe:transition-opacity', dragging && 'opacity-40')}
|
|
512
504
|
>
|
|
513
|
-
<Link
|
|
505
|
+
<Link
|
|
506
|
+
to={`/s/${id}`}
|
|
507
|
+
className="block rounded-[6px] outline-none focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:ring-offset-2 focus-visible:ring-offset-background"
|
|
508
|
+
>
|
|
514
509
|
{/* Slide thumb — tight border, grey baseboard, no shadcn rounded-xl */}
|
|
515
|
-
<div className="relative aspect-video overflow-hidden rounded-[6px] border border-hairline bg-card shadow-edge ring-1 ring-foreground/[0.04] group-hover:shadow-floating group-hover:ring-foreground/20 motion-safe:transition-[box-shadow,--tw-ring-color] motion-safe:duration-200">
|
|
510
|
+
<div className="relative aspect-video overflow-hidden rounded-[6px] border border-hairline bg-card shadow-edge ring-1 ring-foreground/[0.04] group-hover:shadow-floating group-hover:ring-foreground/20 motion-safe:transition-[box-shadow,--tw-ring-color,scale] motion-safe:duration-200 group-active:scale-[0.99]">
|
|
516
511
|
{FirstPage ? (
|
|
517
|
-
<div className="h-full w-full
|
|
512
|
+
<div className="h-full w-full">
|
|
518
513
|
<SlideCanvas flat freezeMotion design={slide?.design}>
|
|
519
514
|
<SlidePageProvider index={0} total={slide?.default.length ?? 1}>
|
|
520
515
|
<FirstPage />
|
|
@@ -546,17 +541,14 @@ function SlideCard({
|
|
|
546
541
|
</div>
|
|
547
542
|
|
|
548
543
|
{import.meta.env.DEV && (
|
|
549
|
-
<div className="absolute right-2 top-2">
|
|
544
|
+
<div className="absolute right-2 top-2 z-20">
|
|
550
545
|
<DropdownMenu>
|
|
551
546
|
<DropdownMenuTrigger
|
|
552
547
|
render={
|
|
553
548
|
<button
|
|
554
549
|
type="button"
|
|
555
|
-
onClick={(e) =>
|
|
556
|
-
|
|
557
|
-
e.preventDefault();
|
|
558
|
-
}}
|
|
559
|
-
className="flex size-7 items-center justify-center rounded-[5px] bg-card/90 text-foreground shadow-edge ring-1 ring-border opacity-0 backdrop-blur hover:bg-card group-hover:opacity-100 aria-expanded:opacity-100 motion-safe:transition-opacity"
|
|
550
|
+
onClick={(e) => e.stopPropagation()}
|
|
551
|
+
className="flex size-7 items-center justify-center rounded-[5px] bg-card/90 text-foreground shadow-edge ring-1 ring-border opacity-0 outline-none backdrop-blur hover:bg-card group-hover:opacity-100 focus-visible:opacity-100 focus-visible:ring-ring/40 aria-expanded:opacity-100 motion-safe:transition-opacity motion-safe:duration-150"
|
|
560
552
|
aria-label={tCard.home.slideActions}
|
|
561
553
|
>
|
|
562
554
|
<MoreHorizontal className="size-3.5" />
|
|
@@ -749,7 +741,7 @@ function MoveDialog({
|
|
|
749
741
|
</DialogHeader>
|
|
750
742
|
<div className="max-h-[320px] overflow-y-auto rounded-[6px] border border-border bg-background">
|
|
751
743
|
<FolderOption
|
|
752
|
-
|
|
744
|
+
chip={<SystemViewIcon kind="draft" className="text-muted-foreground" />}
|
|
753
745
|
label={t.home.draft}
|
|
754
746
|
active={selected === null}
|
|
755
747
|
onClick={() => setSelected(null)}
|
|
@@ -757,7 +749,7 @@ function MoveDialog({
|
|
|
757
749
|
{folders.map((f) => (
|
|
758
750
|
<FolderOption
|
|
759
751
|
key={f.id}
|
|
760
|
-
icon={f.icon}
|
|
752
|
+
chip={<FolderIconChip icon={f.icon} />}
|
|
761
753
|
label={f.name}
|
|
762
754
|
active={selected === f.id}
|
|
763
755
|
onClick={() => setSelected(f.id)}
|
|
@@ -778,12 +770,12 @@ function MoveDialog({
|
|
|
778
770
|
}
|
|
779
771
|
|
|
780
772
|
function FolderOption({
|
|
781
|
-
|
|
773
|
+
chip,
|
|
782
774
|
label,
|
|
783
775
|
active,
|
|
784
776
|
onClick,
|
|
785
777
|
}: {
|
|
786
|
-
|
|
778
|
+
chip: React.ReactNode;
|
|
787
779
|
label: string;
|
|
788
780
|
active: boolean;
|
|
789
781
|
onClick: () => void;
|
|
@@ -794,11 +786,11 @@ function FolderOption({
|
|
|
794
786
|
type="button"
|
|
795
787
|
onClick={onClick}
|
|
796
788
|
className={cn(
|
|
797
|
-
'flex w-full items-center gap-2 border-b border-hairline px-3 py-2 text-left text-[13px] transition-colors last:border-b-0',
|
|
789
|
+
'flex w-full items-center gap-2 border-b border-hairline px-3 py-2 text-left text-[13px] outline-none transition-colors duration-100 last:border-b-0 focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-brand active:bg-muted',
|
|
798
790
|
active ? 'bg-muted text-foreground' : 'hover:bg-muted/60',
|
|
799
791
|
)}
|
|
800
792
|
>
|
|
801
|
-
|
|
793
|
+
{chip}
|
|
802
794
|
<span className="truncate">{label}</span>
|
|
803
795
|
{active && (
|
|
804
796
|
<span className="ml-auto inline-flex items-center gap-1 text-[10.5px] text-brand">
|
|
@@ -20,8 +20,9 @@ import {
|
|
|
20
20
|
import { useNavigate, useParams } from 'react-router-dom';
|
|
21
21
|
import { Button } from '@/components/ui/button';
|
|
22
22
|
import { Dialog, DialogContent, DialogTitle, DialogTrigger } from '@/components/ui/dialog';
|
|
23
|
+
import { hasModifier, isBackwardKey, isForwardKey, isTypingTarget } from '@/lib/keys';
|
|
23
24
|
import { format, useLocale } from '@/lib/use-locale';
|
|
24
|
-
import { cn } from '@/lib/utils';
|
|
25
|
+
import { cn, pad2 } from '@/lib/utils';
|
|
25
26
|
import {
|
|
26
27
|
type PresenterState,
|
|
27
28
|
usePresenterChannel,
|
|
@@ -78,9 +79,6 @@ export function Presenter() {
|
|
|
78
79
|
if (!channel.available || requestedRef.current) return;
|
|
79
80
|
requestedRef.current = true;
|
|
80
81
|
channel.send({ type: 'request-state' });
|
|
81
|
-
// If nothing answers within a beat, surface the "no projection" hint.
|
|
82
|
-
const t = setTimeout(() => setHasProjection((v) => v), 600);
|
|
83
|
-
return () => clearTimeout(t);
|
|
84
82
|
}, [channel, slideId]);
|
|
85
83
|
|
|
86
84
|
const navigate = useNavigate();
|
|
@@ -105,17 +103,12 @@ export function Presenter() {
|
|
|
105
103
|
const onKey = (e: KeyboardEvent) => {
|
|
106
104
|
// The deck-switcher menu owns its own arrow-key navigation.
|
|
107
105
|
if (e.defaultPrevented) return;
|
|
108
|
-
if (e.target
|
|
109
|
-
if (e
|
|
110
|
-
if (
|
|
111
|
-
e.key === 'ArrowRight' ||
|
|
112
|
-
e.key === 'ArrowDown' ||
|
|
113
|
-
e.key === ' ' ||
|
|
114
|
-
e.key === 'PageDown'
|
|
115
|
-
) {
|
|
106
|
+
if (isTypingTarget(e.target)) return;
|
|
107
|
+
if (hasModifier(e)) return;
|
|
108
|
+
if (isForwardKey(e)) {
|
|
116
109
|
e.preventDefault();
|
|
117
110
|
goNext();
|
|
118
|
-
} else if (e
|
|
111
|
+
} else if (isBackwardKey(e)) {
|
|
119
112
|
e.preventDefault();
|
|
120
113
|
goPrev();
|
|
121
114
|
} else if (e.key === 'b' || e.key === 'B') {
|
|
@@ -232,6 +225,7 @@ export function Presenter() {
|
|
|
232
225
|
aria-hidden
|
|
233
226
|
className={cn(
|
|
234
227
|
'pointer-events-none absolute inset-0 grid place-items-center text-[11px] tracking-[0.08em] uppercase',
|
|
228
|
+
'motion-safe:animate-in motion-safe:fade-in-0 motion-safe:duration-150',
|
|
235
229
|
blackout === 'black' ? 'bg-black text-white/35' : 'bg-white text-black/35',
|
|
236
230
|
)}
|
|
237
231
|
>
|
|
@@ -323,9 +317,9 @@ function PresenterTopBar({
|
|
|
323
317
|
<Clock />
|
|
324
318
|
<ElapsedClock startedAt={startedAt} />
|
|
325
319
|
<div className="font-mono text-[18px] tabular-nums">
|
|
326
|
-
<span className="text-foreground">{(index + 1)
|
|
320
|
+
<span className="text-foreground">{pad2(index + 1)}</span>
|
|
327
321
|
<span className="text-foreground/30"> / </span>
|
|
328
|
-
<span className="text-muted-foreground">{total
|
|
322
|
+
<span className="text-muted-foreground">{pad2(total)}</span>
|
|
329
323
|
</div>
|
|
330
324
|
</div>
|
|
331
325
|
</header>
|
|
@@ -456,7 +450,7 @@ function DeckSwitcher({
|
|
|
456
450
|
onClick={() => select(id)}
|
|
457
451
|
onMouseMove={() => setActiveIndex(i)}
|
|
458
452
|
className={cn(
|
|
459
|
-
'flex w-full items-center gap-3 rounded-[6px] p-2 text-left',
|
|
453
|
+
'flex w-full items-center gap-3 rounded-[6px] p-2 text-left outline-none transition-[background-color,scale] duration-100 active:scale-[0.99] focus-visible:ring-1 focus-visible:ring-ring/40',
|
|
460
454
|
i === active && 'bg-muted',
|
|
461
455
|
)}
|
|
462
456
|
>
|
|
@@ -478,9 +472,9 @@ function DeckSwitcher({
|
|
|
478
472
|
<div className="truncate text-[13px] font-medium text-foreground">
|
|
479
473
|
{mod?.meta?.title ?? id}
|
|
480
474
|
</div>
|
|
481
|
-
<div className="mt-0.5 truncate font-mono text-[10.5px] text-muted-foreground">
|
|
475
|
+
<div className="mt-0.5 truncate font-mono text-[10.5px] tabular-nums text-muted-foreground">
|
|
482
476
|
{id}
|
|
483
|
-
{mod && ` · ${mod.default.length
|
|
477
|
+
{mod && ` · ${pad2(mod.default.length)}`}
|
|
484
478
|
</div>
|
|
485
479
|
</div>
|
|
486
480
|
{id === slideId && <Check className="size-3.5 shrink-0 text-muted-foreground" />}
|
|
@@ -647,7 +641,7 @@ function PresenterJumpControl({
|
|
|
647
641
|
placeholder={(current + 1).toString()}
|
|
648
642
|
className="h-8 w-20 rounded-[5px] border border-border bg-card px-2 font-mono text-[12px] tabular-nums outline-none focus-visible:border-foreground/30"
|
|
649
643
|
/>
|
|
650
|
-
<span className="font-mono text-[11px] text-muted-foreground">/ {total}</span>
|
|
644
|
+
<span className="font-mono text-[11px] tabular-nums text-muted-foreground">/ {total}</span>
|
|
651
645
|
</form>
|
|
652
646
|
);
|
|
653
647
|
}
|
|
@@ -698,10 +692,7 @@ function ElapsedClock({ startedAt }: { startedAt: number }) {
|
|
|
698
692
|
const h = Math.floor(elapsed / 3600);
|
|
699
693
|
const m = Math.floor((elapsed % 3600) / 60);
|
|
700
694
|
const s = elapsed % 60;
|
|
701
|
-
const text =
|
|
702
|
-
h > 0
|
|
703
|
-
? `${h}:${m.toString().padStart(2, '0')}:${s.toString().padStart(2, '0')}`
|
|
704
|
-
: `${m.toString().padStart(2, '0')}:${s.toString().padStart(2, '0')}`;
|
|
695
|
+
const text = h > 0 ? `${h}:${pad2(m)}:${pad2(s)}` : `${pad2(m)}:${pad2(s)}`;
|
|
705
696
|
return (
|
|
706
697
|
<time
|
|
707
698
|
title={t.presenter.elapsed}
|