@open-slide/core 1.12.0 → 1.12.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/dist/{config-C2C3cut3.d.ts → config-x493taft.d.ts} +1 -1
- package/dist/{format-zplQGJPI.js → format-7j0EzhuV.js} +4 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/locale/index.d.ts +1 -1
- package/dist/locale/index.js +1 -1
- package/dist/{types-uNHQlioH.d.ts → types-CHmFPIG_.d.ts} +1 -0
- package/dist/vite/index.d.ts +2 -2
- package/package.json +5 -5
- package/src/app/components/inspector/inspector-panel.tsx +5 -1
- package/src/app/components/overview-grid.tsx +200 -69
- package/src/app/components/player.tsx +2 -0
- package/src/app/components/slide-canvas.tsx +1 -0
- package/src/app/lib/export-html.ts +1 -1
- package/src/app/routes/slide.tsx +171 -140
- package/src/locale/en.ts +1 -0
- package/src/locale/ja.ts +1 -0
- package/src/locale/types.ts +1 -0
- package/src/locale/zh-cn.ts +1 -0
- package/src/locale/zh-tw.ts +1 -0
|
@@ -99,6 +99,7 @@ const en = {
|
|
|
99
99
|
agentDisconnectedTooltip: "Lost connection to the dev server, so your agent can no longer see the current slide or inspector selection. Restart the dev server to restore the connection.",
|
|
100
100
|
download: "Download",
|
|
101
101
|
copyLink: "Copy link",
|
|
102
|
+
moreActions: "More actions",
|
|
102
103
|
toastCopyLinkSuccess: "Link copied to clipboard",
|
|
103
104
|
toastCopyLinkFailed: "Failed to copy link",
|
|
104
105
|
exportAsHtml: "Export as HTML",
|
|
@@ -496,6 +497,7 @@ const ja = {
|
|
|
496
497
|
backToHome: "ホームへ戻る",
|
|
497
498
|
download: "ダウンロード",
|
|
498
499
|
copyLink: "リンクをコピー",
|
|
500
|
+
moreActions: "その他の操作",
|
|
499
501
|
toastCopyLinkSuccess: "リンクをクリップボードにコピーしました",
|
|
500
502
|
toastCopyLinkFailed: "リンクのコピーに失敗しました",
|
|
501
503
|
exportAsHtml: "HTML として書き出し",
|
|
@@ -893,6 +895,7 @@ const zhCN = {
|
|
|
893
895
|
backToHome: "返回首页",
|
|
894
896
|
download: "下载",
|
|
895
897
|
copyLink: "复制链接",
|
|
898
|
+
moreActions: "更多操作",
|
|
896
899
|
toastCopyLinkSuccess: "已复制链接到剪贴板",
|
|
897
900
|
toastCopyLinkFailed: "复制链接失败",
|
|
898
901
|
exportAsHtml: "导出为 HTML",
|
|
@@ -1290,6 +1293,7 @@ const zhTW = {
|
|
|
1290
1293
|
backToHome: "返回首頁",
|
|
1291
1294
|
download: "下載",
|
|
1292
1295
|
copyLink: "複製連結",
|
|
1296
|
+
moreActions: "更多動作",
|
|
1293
1297
|
toastCopyLinkSuccess: "已複製連結到剪貼簿",
|
|
1294
1298
|
toastCopyLinkFailed: "複製連結失敗",
|
|
1295
1299
|
exportAsHtml: "匯出為 HTML",
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Locale, Plural } from "./types-
|
|
2
|
-
import { OpenSlideConfig } from "./config-
|
|
1
|
+
import { Locale, Plural } from "./types-CHmFPIG_.js";
|
|
2
|
+
import { OpenSlideConfig } from "./config-x493taft.js";
|
|
3
3
|
import { CSSProperties, ComponentType, HTMLAttributes, PropsWithChildren } from "react";
|
|
4
4
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
5
|
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { en, ja, zhCN, zhTW } from "./format-
|
|
1
|
+
import { en, ja, zhCN, zhTW } from "./format-7j0EzhuV.js";
|
|
2
2
|
import { cssVarsToString, defaultDesign, designToCssVars } from "./design-cpzS8aud.js";
|
|
3
3
|
import { Children, cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
4
4
|
import { toast } from "sonner";
|
package/dist/locale/index.d.ts
CHANGED
package/dist/locale/index.js
CHANGED
package/dist/vite/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-slide/core",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.1",
|
|
4
4
|
"description": "Runtime and CLI for open-slide — write slides in slides/, we handle the rest.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -70,8 +70,8 @@
|
|
|
70
70
|
"chalk": "^5.3.0",
|
|
71
71
|
"class-variance-authority": "^0.7.1",
|
|
72
72
|
"clsx": "^2.1.1",
|
|
73
|
-
"commander": "^
|
|
74
|
-
"emoji-picker-react": "^4.
|
|
73
|
+
"commander": "^15.0.0",
|
|
74
|
+
"emoji-picker-react": "^4.19.1",
|
|
75
75
|
"fast-glob": "^3.3.2",
|
|
76
76
|
"fflate": "^0.8.2",
|
|
77
77
|
"html-to-image": "^1.11.13",
|
|
@@ -81,8 +81,8 @@
|
|
|
81
81
|
"react": "^18.3.1",
|
|
82
82
|
"react-dom": "^18.3.1",
|
|
83
83
|
"react-image-crop": "^11.0.10",
|
|
84
|
-
"react-router-dom": "^
|
|
85
|
-
"shadcn": "^4.
|
|
84
|
+
"react-router-dom": "^7.18.0",
|
|
85
|
+
"shadcn": "^4.11.0",
|
|
86
86
|
"sonner": "^2.0.7",
|
|
87
87
|
"tailwind-merge": "^3.5.0",
|
|
88
88
|
"tailwindcss": "^4.2.2",
|
|
@@ -862,7 +862,11 @@ function AgentWatchingBadge() {
|
|
|
862
862
|
{connected ? t.inspector.agentWatching : t.inspector.agentNotWatching}
|
|
863
863
|
</button>
|
|
864
864
|
</TooltipTrigger>
|
|
865
|
-
<TooltipContent
|
|
865
|
+
<TooltipContent
|
|
866
|
+
side="bottom"
|
|
867
|
+
align="end"
|
|
868
|
+
className="w-max max-w-[min(520px,calc(100vw-2rem))] text-center leading-relaxed"
|
|
869
|
+
>
|
|
866
870
|
{connected ? t.inspector.agentWatchingTooltip : t.inspector.agentNotWatchingTooltip}
|
|
867
871
|
</TooltipContent>
|
|
868
872
|
</Tooltip>
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { X } from 'lucide-react';
|
|
2
|
-
import { useEffect, useRef, useState } from 'react';
|
|
1
|
+
import { ListOrdered, type LucideIcon, Sparkles, X } from 'lucide-react';
|
|
2
|
+
import { type Ref, useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';
|
|
3
4
|
import { format, useLocale } from '@/lib/use-locale';
|
|
4
5
|
import { cn } from '@/lib/utils';
|
|
5
6
|
import type { DesignSystem } from '../lib/design';
|
|
6
7
|
import { SlidePageProvider } from '../lib/page-context';
|
|
7
8
|
import type { Page } from '../lib/sdk';
|
|
8
9
|
import { CANVAS_HEIGHT, CANVAS_WIDTH } from '../lib/sdk';
|
|
10
|
+
import type { SlideTransition } from '../lib/transition';
|
|
9
11
|
import { SlideCanvas } from './slide-canvas';
|
|
10
12
|
|
|
11
13
|
const THUMB_W = 320;
|
|
@@ -21,6 +23,8 @@ type Props = {
|
|
|
21
23
|
onClose: () => void;
|
|
22
24
|
onSelect: (index: number) => void;
|
|
23
25
|
variant?: OverviewVariant;
|
|
26
|
+
moduleTransition?: SlideTransition;
|
|
27
|
+
tooltipContainer?: HTMLElement | null;
|
|
24
28
|
};
|
|
25
29
|
|
|
26
30
|
export function OverviewGrid({
|
|
@@ -31,6 +35,8 @@ export function OverviewGrid({
|
|
|
31
35
|
onClose,
|
|
32
36
|
onSelect,
|
|
33
37
|
variant = 'present',
|
|
38
|
+
moduleTransition,
|
|
39
|
+
tooltipContainer,
|
|
34
40
|
}: Props) {
|
|
35
41
|
const [focused, setFocused] = useState(current);
|
|
36
42
|
const gridRef = useRef<HTMLDivElement>(null);
|
|
@@ -124,78 +130,201 @@ export function OverviewGrid({
|
|
|
124
130
|
</div>
|
|
125
131
|
</div>
|
|
126
132
|
<div ref={gridRef} className="min-h-0 flex-1 overflow-auto px-8 pb-8">
|
|
127
|
-
<
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
>
|
|
162
|
-
<SlideCanvas
|
|
163
|
-
scale={THUMB_W / CANVAS_WIDTH}
|
|
164
|
-
center={false}
|
|
165
|
-
flat
|
|
166
|
-
freezeMotion
|
|
167
|
-
design={design}
|
|
168
|
-
>
|
|
169
|
-
<SlidePageProvider index={i} total={pages.length}>
|
|
170
|
-
<PageComp />
|
|
171
|
-
</SlidePageProvider>
|
|
172
|
-
</SlideCanvas>
|
|
173
|
-
{isCurrent && (
|
|
174
|
-
<span
|
|
175
|
-
aria-hidden
|
|
176
|
-
className="pointer-events-none absolute top-1.5 right-1.5 rounded-[3px] bg-[var(--brand,#ef4444)] px-1.5 py-0.5 font-mono text-[9.5px] tracking-[0.06em] uppercase text-white"
|
|
177
|
-
>
|
|
178
|
-
{t.present.nowBadge}
|
|
179
|
-
</span>
|
|
180
|
-
)}
|
|
181
|
-
</div>
|
|
182
|
-
<span
|
|
183
|
-
className={cn(
|
|
184
|
-
'font-mono text-[10.5px] tracking-[0.08em] tabular-nums uppercase',
|
|
185
|
-
isFocused || isCurrent ? styles.labelActive : styles.labelMuted,
|
|
186
|
-
)}
|
|
187
|
-
>
|
|
188
|
-
{(i + 1).toString().padStart(2, '0')}
|
|
189
|
-
</span>
|
|
190
|
-
</button>
|
|
191
|
-
);
|
|
192
|
-
})}
|
|
193
|
-
</div>
|
|
133
|
+
<TooltipProvider delayDuration={200}>
|
|
134
|
+
<div
|
|
135
|
+
className="grid justify-center gap-5"
|
|
136
|
+
style={{
|
|
137
|
+
gridTemplateColumns: `repeat(auto-fill, ${THUMB_W}px)`,
|
|
138
|
+
}}
|
|
139
|
+
>
|
|
140
|
+
{pages.map((PageComp, i) => {
|
|
141
|
+
const isFocused = i === focused;
|
|
142
|
+
const isCurrent = i === current;
|
|
143
|
+
return (
|
|
144
|
+
<OverviewThumb
|
|
145
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: pages list is render-stable
|
|
146
|
+
key={i}
|
|
147
|
+
buttonRef={isFocused ? focusedRef : undefined}
|
|
148
|
+
page={PageComp}
|
|
149
|
+
index={i}
|
|
150
|
+
total={pages.length}
|
|
151
|
+
design={design}
|
|
152
|
+
isFocused={isFocused}
|
|
153
|
+
isCurrent={isCurrent}
|
|
154
|
+
styles={styles}
|
|
155
|
+
moduleTransition={moduleTransition}
|
|
156
|
+
tooltipContainer={tooltipContainer}
|
|
157
|
+
onFocus={() => setFocused(i)}
|
|
158
|
+
onSelect={() => {
|
|
159
|
+
onSelect(i);
|
|
160
|
+
onClose();
|
|
161
|
+
}}
|
|
162
|
+
/>
|
|
163
|
+
);
|
|
164
|
+
})}
|
|
165
|
+
</div>
|
|
166
|
+
</TooltipProvider>
|
|
194
167
|
</div>
|
|
195
168
|
</div>
|
|
196
169
|
);
|
|
197
170
|
}
|
|
198
171
|
|
|
172
|
+
function OverviewThumb({
|
|
173
|
+
page: PageComp,
|
|
174
|
+
index,
|
|
175
|
+
total,
|
|
176
|
+
design,
|
|
177
|
+
isFocused,
|
|
178
|
+
isCurrent,
|
|
179
|
+
styles,
|
|
180
|
+
moduleTransition,
|
|
181
|
+
tooltipContainer,
|
|
182
|
+
onFocus,
|
|
183
|
+
onSelect,
|
|
184
|
+
buttonRef,
|
|
185
|
+
}: {
|
|
186
|
+
page: Page;
|
|
187
|
+
index: number;
|
|
188
|
+
total: number;
|
|
189
|
+
design?: DesignSystem;
|
|
190
|
+
isFocused: boolean;
|
|
191
|
+
isCurrent: boolean;
|
|
192
|
+
styles: OverviewStyles;
|
|
193
|
+
moduleTransition?: SlideTransition;
|
|
194
|
+
tooltipContainer?: HTMLElement | null;
|
|
195
|
+
onFocus: () => void;
|
|
196
|
+
onSelect: () => void;
|
|
197
|
+
buttonRef?: Ref<HTMLButtonElement>;
|
|
198
|
+
}) {
|
|
199
|
+
const t = useLocale();
|
|
200
|
+
const boxRef = useRef<HTMLDivElement | null>(null);
|
|
201
|
+
const [hasSteps, setHasSteps] = useState(false);
|
|
202
|
+
const hasTransition = Boolean(PageComp.transition ?? moduleTransition);
|
|
203
|
+
|
|
204
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: re-detect when the page at this slot changes
|
|
205
|
+
useEffect(() => {
|
|
206
|
+
setHasSteps(boxRef.current?.querySelector('[data-osd-step]') != null);
|
|
207
|
+
}, [PageComp]);
|
|
208
|
+
|
|
209
|
+
return (
|
|
210
|
+
<button
|
|
211
|
+
ref={buttonRef}
|
|
212
|
+
type="button"
|
|
213
|
+
onClick={onSelect}
|
|
214
|
+
onMouseEnter={onFocus}
|
|
215
|
+
onFocus={onFocus}
|
|
216
|
+
aria-label={format(t.present.overviewGoToAria, { n: index + 1 })}
|
|
217
|
+
aria-current={isCurrent ? 'true' : undefined}
|
|
218
|
+
className={cn(
|
|
219
|
+
'group/thumb flex flex-col items-start gap-2 rounded-[6px] p-1.5 outline-none transition-colors',
|
|
220
|
+
isFocused ? styles.thumbFocused : styles.thumbHover,
|
|
221
|
+
)}
|
|
222
|
+
>
|
|
223
|
+
<div
|
|
224
|
+
ref={boxRef}
|
|
225
|
+
className={cn(
|
|
226
|
+
'relative w-full overflow-hidden rounded-[4px] ring-1 transition-shadow',
|
|
227
|
+
styles.thumbSurface,
|
|
228
|
+
isFocused ? 'ring-2 ring-[var(--brand,#ef4444)]' : styles.thumbRing,
|
|
229
|
+
)}
|
|
230
|
+
style={{ height: THUMB_H }}
|
|
231
|
+
>
|
|
232
|
+
<SlideCanvas
|
|
233
|
+
scale={THUMB_W / CANVAS_WIDTH}
|
|
234
|
+
center={false}
|
|
235
|
+
flat
|
|
236
|
+
freezeMotion
|
|
237
|
+
design={design}
|
|
238
|
+
>
|
|
239
|
+
<SlidePageProvider index={index} total={total}>
|
|
240
|
+
<PageComp />
|
|
241
|
+
</SlidePageProvider>
|
|
242
|
+
</SlideCanvas>
|
|
243
|
+
{isCurrent && (
|
|
244
|
+
<span
|
|
245
|
+
aria-hidden
|
|
246
|
+
className="pointer-events-none absolute top-1.5 right-1.5 rounded-[3px] bg-[var(--brand,#ef4444)] px-1.5 py-0.5 font-mono text-[9.5px] tracking-[0.06em] uppercase text-white"
|
|
247
|
+
>
|
|
248
|
+
{t.present.nowBadge}
|
|
249
|
+
</span>
|
|
250
|
+
)}
|
|
251
|
+
</div>
|
|
252
|
+
<div className="flex h-4 w-full items-center justify-between gap-2">
|
|
253
|
+
<span
|
|
254
|
+
className={cn(
|
|
255
|
+
'font-mono text-[10.5px] tracking-[0.08em] tabular-nums uppercase',
|
|
256
|
+
isFocused || isCurrent ? styles.labelActive : styles.labelMuted,
|
|
257
|
+
)}
|
|
258
|
+
>
|
|
259
|
+
{(index + 1).toString().padStart(2, '0')}
|
|
260
|
+
</span>
|
|
261
|
+
{(hasTransition || hasSteps) && (
|
|
262
|
+
<span className="flex items-center gap-1">
|
|
263
|
+
{hasTransition && (
|
|
264
|
+
<OverviewIndicator
|
|
265
|
+
icon={Sparkles}
|
|
266
|
+
label={t.thumbnailRail.transitionIndicator}
|
|
267
|
+
className={styles.indicator}
|
|
268
|
+
tooltipContainer={tooltipContainer}
|
|
269
|
+
/>
|
|
270
|
+
)}
|
|
271
|
+
{hasSteps && (
|
|
272
|
+
<OverviewIndicator
|
|
273
|
+
icon={ListOrdered}
|
|
274
|
+
label={t.thumbnailRail.stepsIndicator}
|
|
275
|
+
className={styles.indicator}
|
|
276
|
+
tooltipContainer={tooltipContainer}
|
|
277
|
+
/>
|
|
278
|
+
)}
|
|
279
|
+
</span>
|
|
280
|
+
)}
|
|
281
|
+
</div>
|
|
282
|
+
</button>
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
function OverviewIndicator({
|
|
287
|
+
icon: Icon,
|
|
288
|
+
label,
|
|
289
|
+
className,
|
|
290
|
+
tooltipContainer,
|
|
291
|
+
}: {
|
|
292
|
+
icon: LucideIcon;
|
|
293
|
+
label: string;
|
|
294
|
+
className: string;
|
|
295
|
+
tooltipContainer?: HTMLElement | null;
|
|
296
|
+
}) {
|
|
297
|
+
return (
|
|
298
|
+
<Tooltip>
|
|
299
|
+
<TooltipTrigger asChild>
|
|
300
|
+
<span
|
|
301
|
+
role="img"
|
|
302
|
+
aria-label={label}
|
|
303
|
+
className={cn('flex size-4 items-center justify-center', className)}
|
|
304
|
+
>
|
|
305
|
+
<Icon className="size-3.5" strokeWidth={1.9} />
|
|
306
|
+
</span>
|
|
307
|
+
</TooltipTrigger>
|
|
308
|
+
<TooltipContent side="top" sideOffset={6} container={tooltipContainer ?? undefined}>
|
|
309
|
+
{label}
|
|
310
|
+
</TooltipContent>
|
|
311
|
+
</Tooltip>
|
|
312
|
+
);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
type OverviewStyles = {
|
|
316
|
+
surface: string;
|
|
317
|
+
eyebrow: string;
|
|
318
|
+
thumbFocused: string;
|
|
319
|
+
thumbHover: string;
|
|
320
|
+
thumbSurface: string;
|
|
321
|
+
thumbRing: string;
|
|
322
|
+
labelActive: string;
|
|
323
|
+
labelMuted: string;
|
|
324
|
+
indicator: string;
|
|
325
|
+
closeButton: string;
|
|
326
|
+
};
|
|
327
|
+
|
|
199
328
|
const presentStyles = {
|
|
200
329
|
surface: 'bg-black/95',
|
|
201
330
|
eyebrow: 'text-white/55',
|
|
@@ -205,6 +334,7 @@ const presentStyles = {
|
|
|
205
334
|
thumbRing: 'ring-white/10',
|
|
206
335
|
labelActive: 'text-white/85',
|
|
207
336
|
labelMuted: 'text-white/45',
|
|
337
|
+
indicator: 'text-white/45 transition-colors group-hover/thumb:text-white/75',
|
|
208
338
|
closeButton:
|
|
209
339
|
'text-white/55 hover:bg-white/10 hover:text-white focus-visible:ring-2 focus-visible:ring-white/40',
|
|
210
340
|
} as const;
|
|
@@ -218,6 +348,7 @@ const editorStyles = {
|
|
|
218
348
|
thumbRing: 'ring-hairline',
|
|
219
349
|
labelActive: 'text-foreground',
|
|
220
350
|
labelMuted: 'text-muted-foreground/60',
|
|
351
|
+
indicator: 'text-muted-foreground/60 transition-colors group-hover/thumb:text-muted-foreground',
|
|
221
352
|
closeButton:
|
|
222
353
|
'text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring',
|
|
223
354
|
} as const;
|
|
@@ -388,6 +388,8 @@ export function Player({
|
|
|
388
388
|
onClose={() => setOverviewOpen(false)}
|
|
389
389
|
onSelect={handleIndexChange}
|
|
390
390
|
variant="present"
|
|
391
|
+
moduleTransition={transition}
|
|
392
|
+
tooltipContainer={rootEl}
|
|
391
393
|
/>
|
|
392
394
|
<PresentHelpOverlay open={helpOpen} onOpenChange={setHelpOpen} container={rootEl} />
|
|
393
395
|
</div>
|
|
@@ -260,7 +260,7 @@ ${opts.externalLinks}
|
|
|
260
260
|
<style>
|
|
261
261
|
html, body { margin: 0; height: 100%; background: #000; overflow: hidden; font-family: system-ui, sans-serif; }
|
|
262
262
|
.os-stage { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
|
|
263
|
-
.os-frame { width: 1920px; height: 1080px; background: #fff; color: #000; transform-origin: center center; overflow: hidden; position: relative; }
|
|
263
|
+
.os-frame { width: 1920px; height: 1080px; flex-shrink: 0; background: #fff; color: #000; transform-origin: center center; overflow: hidden; position: relative; }
|
|
264
264
|
.os-page { position: absolute; inset: 0; }
|
|
265
265
|
.os-page[hidden] { display: none !important; }
|
|
266
266
|
.os-counter { position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); color: #fff; background: rgba(0,0,0,.5); padding: 2px 10px; border-radius: 999px; font-size: 12px; z-index: 10; font-variant-numeric: tabular-nums; }
|
package/src/app/routes/slide.tsx
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
Loader2,
|
|
12
12
|
Maximize,
|
|
13
13
|
MonitorSpeaker,
|
|
14
|
+
MoreHorizontal,
|
|
14
15
|
Play,
|
|
15
16
|
Presentation,
|
|
16
17
|
} from 'lucide-react';
|
|
@@ -376,6 +377,127 @@ export function Slide() {
|
|
|
376
377
|
|
|
377
378
|
const title = slide.meta?.title ?? slideId;
|
|
378
379
|
|
|
380
|
+
const copyLink = async () => {
|
|
381
|
+
try {
|
|
382
|
+
await navigator.clipboard.writeText(window.location.href);
|
|
383
|
+
toast.success(t.slide.toastCopyLinkSuccess);
|
|
384
|
+
setLinkCopied(true);
|
|
385
|
+
if (linkCopiedTimerRef.current) clearTimeout(linkCopiedTimerRef.current);
|
|
386
|
+
linkCopiedTimerRef.current = setTimeout(() => setLinkCopied(false), 1200);
|
|
387
|
+
} catch (err) {
|
|
388
|
+
console.error('[open-slide] copy link failed', err);
|
|
389
|
+
toast.error(t.slide.toastCopyLinkFailed);
|
|
390
|
+
}
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
const exportHtml = async () => {
|
|
394
|
+
if (!slide || exporting) return;
|
|
395
|
+
setExporting(true);
|
|
396
|
+
try {
|
|
397
|
+
await exportSlideAsHtml(slide, slideId);
|
|
398
|
+
} catch (err) {
|
|
399
|
+
console.error('[open-slide] export failed', err);
|
|
400
|
+
} finally {
|
|
401
|
+
setExporting(false);
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
const exportPdf = async () => {
|
|
406
|
+
if (!slide || exporting) return;
|
|
407
|
+
if (isSafari()) {
|
|
408
|
+
toast.error(t.slide.pdfExportSafariUnsupported, { duration: 5000 });
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
setExporting(true);
|
|
412
|
+
const toastId = `pdf-export-${slideId}`;
|
|
413
|
+
toast.custom(
|
|
414
|
+
() => (
|
|
415
|
+
<PdfProgressToast
|
|
416
|
+
progress={{ phase: 'processing', current: 0, total: pages.length, percent: 0 }}
|
|
417
|
+
/>
|
|
418
|
+
),
|
|
419
|
+
{ id: toastId, duration: Infinity },
|
|
420
|
+
);
|
|
421
|
+
try {
|
|
422
|
+
await exportSlideAsPdf(slide, slideId, (p) => {
|
|
423
|
+
toast.custom(() => <PdfProgressToast progress={p} />, { id: toastId, duration: Infinity });
|
|
424
|
+
});
|
|
425
|
+
} catch (err) {
|
|
426
|
+
console.error('[open-slide] pdf export failed', err);
|
|
427
|
+
toast.error(t.slide.pdfExportFailed, { id: toastId, duration: 4000 });
|
|
428
|
+
} finally {
|
|
429
|
+
setExporting(false);
|
|
430
|
+
toast.dismiss(toastId);
|
|
431
|
+
}
|
|
432
|
+
};
|
|
433
|
+
|
|
434
|
+
const exportImagePptx = async () => {
|
|
435
|
+
if (!slide || exporting) return;
|
|
436
|
+
setExporting(true);
|
|
437
|
+
const toastId = `pptx-export-${slideId}`;
|
|
438
|
+
toast.custom(
|
|
439
|
+
() => (
|
|
440
|
+
<PptxProgressToast
|
|
441
|
+
progress={{ phase: 'processing', current: 0, total: pages.length, percent: 0 }}
|
|
442
|
+
/>
|
|
443
|
+
),
|
|
444
|
+
{ id: toastId, duration: Infinity },
|
|
445
|
+
);
|
|
446
|
+
try {
|
|
447
|
+
await exportSlideAsImagePptx(slide, slideId, (p) => {
|
|
448
|
+
toast.custom(() => <PptxProgressToast progress={p} />, { id: toastId, duration: Infinity });
|
|
449
|
+
});
|
|
450
|
+
} catch (err) {
|
|
451
|
+
console.error('[open-slide] image pptx export failed', err);
|
|
452
|
+
toast.error(t.slide.imagePptxExportFailed, { id: toastId, duration: 4000 });
|
|
453
|
+
} finally {
|
|
454
|
+
setExporting(false);
|
|
455
|
+
toast.dismiss(toastId);
|
|
456
|
+
}
|
|
457
|
+
};
|
|
458
|
+
|
|
459
|
+
const exportMenuItems = (
|
|
460
|
+
<>
|
|
461
|
+
<DropdownMenuItem disabled={exporting} onSelect={exportHtml}>
|
|
462
|
+
<FileCode2 />
|
|
463
|
+
{t.slide.exportAsHtml}
|
|
464
|
+
</DropdownMenuItem>
|
|
465
|
+
<DropdownMenuItem disabled={exporting} onSelect={exportPdf}>
|
|
466
|
+
<FileText />
|
|
467
|
+
{t.slide.exportAsPdf}
|
|
468
|
+
</DropdownMenuItem>
|
|
469
|
+
<DropdownMenuSeparator />
|
|
470
|
+
<DropdownMenuItem disabled={exporting} onSelect={exportImagePptx}>
|
|
471
|
+
<FileImage />
|
|
472
|
+
{t.slide.exportAsImagePptx}
|
|
473
|
+
</DropdownMenuItem>
|
|
474
|
+
<TooltipProvider delayDuration={200}>
|
|
475
|
+
<Tooltip>
|
|
476
|
+
<TooltipTrigger asChild>
|
|
477
|
+
<div
|
|
478
|
+
aria-disabled
|
|
479
|
+
className="relative flex cursor-help items-center justify-between gap-2 rounded-[5px] px-2 py-1.5 text-[12.5px] opacity-45 select-none [&_svg]:size-3.5 [&_svg]:shrink-0 [&_svg]:opacity-80"
|
|
480
|
+
>
|
|
481
|
+
<span className="flex items-center gap-2">
|
|
482
|
+
<Presentation />
|
|
483
|
+
{t.slide.exportAsPptx}
|
|
484
|
+
</span>
|
|
485
|
+
<span className="rounded-[3px] bg-muted px-1.5 py-0.5 font-mono text-[9.5px] tracking-[0.04em] text-muted-foreground">
|
|
486
|
+
{t.slide.comingSoon}
|
|
487
|
+
</span>
|
|
488
|
+
</div>
|
|
489
|
+
</TooltipTrigger>
|
|
490
|
+
<TooltipContent
|
|
491
|
+
side="left"
|
|
492
|
+
className="w-max max-w-[min(520px,calc(100vw-2rem))] text-center leading-relaxed"
|
|
493
|
+
>
|
|
494
|
+
{t.slide.pptxComingSoonTooltip}
|
|
495
|
+
</TooltipContent>
|
|
496
|
+
</Tooltip>
|
|
497
|
+
</TooltipProvider>
|
|
498
|
+
</>
|
|
499
|
+
);
|
|
500
|
+
|
|
379
501
|
return (
|
|
380
502
|
<HistoryProvider>
|
|
381
503
|
<InspectorProvider slideId={slideId} pageIndex={index}>
|
|
@@ -383,7 +505,7 @@ export function Slide() {
|
|
|
383
505
|
<div className="flex h-dvh flex-col overflow-hidden bg-background text-foreground">
|
|
384
506
|
{/* Editorial toolbar — three zones, hairline separators, mono-folio center */}
|
|
385
507
|
<header className="relative flex h-12 shrink-0 items-center gap-2 border-b border-hairline bg-sidebar/85 px-2 backdrop-blur-md md:px-3">
|
|
386
|
-
<div className="flex
|
|
508
|
+
<div className="flex flex-1 items-center gap-1.5 md:flex-none md:gap-2">
|
|
387
509
|
{showSlideBrowser && (
|
|
388
510
|
<Button asChild variant="ghost" size="icon-sm" title={t.slide.home}>
|
|
389
511
|
<Link to="/" aria-label={t.slide.backToHome}>
|
|
@@ -416,32 +538,26 @@ export function Slide() {
|
|
|
416
538
|
{import.meta.env.DEV && <AgentConnectedBadge />}
|
|
417
539
|
</div>
|
|
418
540
|
|
|
419
|
-
{/*
|
|
420
|
-
|
|
541
|
+
{/* On md+ the title centers to the viewport via absolute positioning. On mobile the
|
|
542
|
+
two side groups each flex-1, so the in-flow title lands at the viewport center too —
|
|
543
|
+
and min-w-0 lets it truncate instead of overlapping the icons on narrow widths. */}
|
|
544
|
+
<div className="pointer-events-none relative flex min-w-0 justify-center px-2 md:absolute md:inset-x-0">
|
|
421
545
|
<div className="pointer-events-auto min-w-0 max-w-[34rem]">
|
|
422
546
|
<InlineTitleEditor title={title} onSubmit={(next) => renameSlide(slideId, next)} />
|
|
423
547
|
</div>
|
|
424
548
|
</div>
|
|
425
549
|
|
|
426
|
-
<div className="
|
|
550
|
+
<div className="flex flex-1 items-center justify-end gap-1 md:ml-auto md:flex-none">
|
|
427
551
|
{view === 'slides' && (
|
|
428
552
|
<button
|
|
429
553
|
type="button"
|
|
430
554
|
aria-label={t.slide.copyLink}
|
|
431
555
|
title={t.slide.copyLink}
|
|
432
|
-
className={cn(
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
setLinkCopied(true);
|
|
438
|
-
if (linkCopiedTimerRef.current) clearTimeout(linkCopiedTimerRef.current);
|
|
439
|
-
linkCopiedTimerRef.current = setTimeout(() => setLinkCopied(false), 1200);
|
|
440
|
-
} catch (err) {
|
|
441
|
-
console.error('[open-slide] copy link failed', err);
|
|
442
|
-
toast.error(t.slide.toastCopyLinkFailed);
|
|
443
|
-
}
|
|
444
|
-
}}
|
|
556
|
+
className={cn(
|
|
557
|
+
buttonVariants({ variant: 'ghost', size: 'icon-sm' }),
|
|
558
|
+
'hidden md:inline-flex',
|
|
559
|
+
)}
|
|
560
|
+
onClick={copyLink}
|
|
445
561
|
>
|
|
446
562
|
<span className="relative grid size-4 place-items-center">
|
|
447
563
|
<Link2
|
|
@@ -466,7 +582,10 @@ export function Slide() {
|
|
|
466
582
|
disabled={exporting}
|
|
467
583
|
aria-label={t.slide.download}
|
|
468
584
|
title={t.slide.download}
|
|
469
|
-
className={cn(
|
|
585
|
+
className={cn(
|
|
586
|
+
buttonVariants({ variant: 'ghost', size: 'icon-sm' }),
|
|
587
|
+
'hidden md:inline-flex',
|
|
588
|
+
)}
|
|
470
589
|
>
|
|
471
590
|
{exporting ? (
|
|
472
591
|
<Loader2 className="size-4 animate-spin" />
|
|
@@ -475,128 +594,35 @@ export function Slide() {
|
|
|
475
594
|
)}
|
|
476
595
|
</DropdownMenuTrigger>
|
|
477
596
|
<DropdownMenuContent align="end" className="min-w-[200px]">
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
const toastId = `pdf-export-${slideId}`;
|
|
505
|
-
toast.custom(
|
|
506
|
-
() => (
|
|
507
|
-
<PdfProgressToast
|
|
508
|
-
progress={{
|
|
509
|
-
phase: 'processing',
|
|
510
|
-
current: 0,
|
|
511
|
-
total: pages.length,
|
|
512
|
-
percent: 0,
|
|
513
|
-
}}
|
|
514
|
-
/>
|
|
515
|
-
),
|
|
516
|
-
{ id: toastId, duration: Infinity },
|
|
517
|
-
);
|
|
518
|
-
try {
|
|
519
|
-
await exportSlideAsPdf(slide, slideId, (p) => {
|
|
520
|
-
toast.custom(() => <PdfProgressToast progress={p} />, {
|
|
521
|
-
id: toastId,
|
|
522
|
-
duration: Infinity,
|
|
523
|
-
});
|
|
524
|
-
});
|
|
525
|
-
} catch (err) {
|
|
526
|
-
console.error('[open-slide] pdf export failed', err);
|
|
527
|
-
toast.error(t.slide.pdfExportFailed, { id: toastId, duration: 4000 });
|
|
528
|
-
} finally {
|
|
529
|
-
setExporting(false);
|
|
530
|
-
toast.dismiss(toastId);
|
|
531
|
-
}
|
|
532
|
-
}}
|
|
533
|
-
>
|
|
534
|
-
<FileText />
|
|
535
|
-
{t.slide.exportAsPdf}
|
|
536
|
-
</DropdownMenuItem>
|
|
537
|
-
<DropdownMenuSeparator />
|
|
538
|
-
<DropdownMenuItem
|
|
539
|
-
disabled={exporting}
|
|
540
|
-
onSelect={async () => {
|
|
541
|
-
if (!slide || exporting) return;
|
|
542
|
-
setExporting(true);
|
|
543
|
-
const toastId = `pptx-export-${slideId}`;
|
|
544
|
-
toast.custom(
|
|
545
|
-
() => (
|
|
546
|
-
<PptxProgressToast
|
|
547
|
-
progress={{
|
|
548
|
-
phase: 'processing',
|
|
549
|
-
current: 0,
|
|
550
|
-
total: pages.length,
|
|
551
|
-
percent: 0,
|
|
552
|
-
}}
|
|
553
|
-
/>
|
|
554
|
-
),
|
|
555
|
-
{ id: toastId, duration: Infinity },
|
|
556
|
-
);
|
|
557
|
-
try {
|
|
558
|
-
await exportSlideAsImagePptx(slide, slideId, (p) => {
|
|
559
|
-
toast.custom(() => <PptxProgressToast progress={p} />, {
|
|
560
|
-
id: toastId,
|
|
561
|
-
duration: Infinity,
|
|
562
|
-
});
|
|
563
|
-
});
|
|
564
|
-
} catch (err) {
|
|
565
|
-
console.error('[open-slide] image pptx export failed', err);
|
|
566
|
-
toast.error(t.slide.imagePptxExportFailed, {
|
|
567
|
-
id: toastId,
|
|
568
|
-
duration: 4000,
|
|
569
|
-
});
|
|
570
|
-
} finally {
|
|
571
|
-
setExporting(false);
|
|
572
|
-
toast.dismiss(toastId);
|
|
573
|
-
}
|
|
574
|
-
}}
|
|
575
|
-
>
|
|
576
|
-
<FileImage />
|
|
577
|
-
{t.slide.exportAsImagePptx}
|
|
597
|
+
{exportMenuItems}
|
|
598
|
+
</DropdownMenuContent>
|
|
599
|
+
</DropdownMenu>
|
|
600
|
+
)}
|
|
601
|
+
{view === 'slides' && (
|
|
602
|
+
<DropdownMenu>
|
|
603
|
+
<DropdownMenuTrigger
|
|
604
|
+
type="button"
|
|
605
|
+
disabled={exporting}
|
|
606
|
+
aria-label={t.slide.moreActions}
|
|
607
|
+
title={t.slide.moreActions}
|
|
608
|
+
className={cn(
|
|
609
|
+
buttonVariants({ variant: 'ghost', size: 'icon-sm' }),
|
|
610
|
+
'inline-flex md:hidden',
|
|
611
|
+
)}
|
|
612
|
+
>
|
|
613
|
+
{exporting ? (
|
|
614
|
+
<Loader2 className="size-4 animate-spin" />
|
|
615
|
+
) : (
|
|
616
|
+
<MoreHorizontal className="size-4" />
|
|
617
|
+
)}
|
|
618
|
+
</DropdownMenuTrigger>
|
|
619
|
+
<DropdownMenuContent align="end" className="min-w-[200px]">
|
|
620
|
+
<DropdownMenuItem onSelect={copyLink}>
|
|
621
|
+
<Link2 />
|
|
622
|
+
{t.slide.copyLink}
|
|
578
623
|
</DropdownMenuItem>
|
|
579
|
-
<
|
|
580
|
-
|
|
581
|
-
<TooltipTrigger asChild>
|
|
582
|
-
<div
|
|
583
|
-
aria-disabled
|
|
584
|
-
className="relative flex cursor-help items-center justify-between gap-2 rounded-[5px] px-2 py-1.5 text-[12.5px] opacity-45 select-none [&_svg]:size-3.5 [&_svg]:shrink-0 [&_svg]:opacity-80"
|
|
585
|
-
>
|
|
586
|
-
<span className="flex items-center gap-2">
|
|
587
|
-
<Presentation />
|
|
588
|
-
{t.slide.exportAsPptx}
|
|
589
|
-
</span>
|
|
590
|
-
<span className="rounded-[3px] bg-muted px-1.5 py-0.5 font-mono text-[9.5px] tracking-[0.04em] text-muted-foreground">
|
|
591
|
-
{t.slide.comingSoon}
|
|
592
|
-
</span>
|
|
593
|
-
</div>
|
|
594
|
-
</TooltipTrigger>
|
|
595
|
-
<TooltipContent side="left" className="max-w-[240px] leading-relaxed">
|
|
596
|
-
{t.slide.pptxComingSoonTooltip}
|
|
597
|
-
</TooltipContent>
|
|
598
|
-
</Tooltip>
|
|
599
|
-
</TooltipProvider>
|
|
624
|
+
{allowHtmlDownload && <DropdownMenuSeparator />}
|
|
625
|
+
{allowHtmlDownload && exportMenuItems}
|
|
600
626
|
</DropdownMenuContent>
|
|
601
627
|
</DropdownMenu>
|
|
602
628
|
)}
|
|
@@ -737,6 +763,7 @@ export function Slide() {
|
|
|
737
763
|
onClose={() => setOverviewOpen(false)}
|
|
738
764
|
onSelect={goTo}
|
|
739
765
|
variant="editor"
|
|
766
|
+
moduleTransition={slide.transition}
|
|
740
767
|
/>
|
|
741
768
|
</div>
|
|
742
769
|
</DesignProvider>
|
|
@@ -896,7 +923,11 @@ function AgentConnectedBadge() {
|
|
|
896
923
|
{connected ? t.slide.agentConnected : t.slide.agentDisconnected}
|
|
897
924
|
</button>
|
|
898
925
|
</TooltipTrigger>
|
|
899
|
-
<TooltipContent
|
|
926
|
+
<TooltipContent
|
|
927
|
+
side="bottom"
|
|
928
|
+
align="start"
|
|
929
|
+
className="w-max max-w-[min(520px,calc(100vw-2rem))] text-center leading-relaxed"
|
|
930
|
+
>
|
|
900
931
|
{connected ? t.slide.agentConnectedTooltip : t.slide.agentDisconnectedTooltip}
|
|
901
932
|
</TooltipContent>
|
|
902
933
|
</Tooltip>
|
package/src/locale/en.ts
CHANGED
|
@@ -106,6 +106,7 @@ export const en: Locale = {
|
|
|
106
106
|
'Lost connection to the dev server, so your agent can no longer see the current slide or inspector selection. Restart the dev server to restore the connection.',
|
|
107
107
|
download: 'Download',
|
|
108
108
|
copyLink: 'Copy link',
|
|
109
|
+
moreActions: 'More actions',
|
|
109
110
|
toastCopyLinkSuccess: 'Link copied to clipboard',
|
|
110
111
|
toastCopyLinkFailed: 'Failed to copy link',
|
|
111
112
|
exportAsHtml: 'Export as HTML',
|
package/src/locale/ja.ts
CHANGED
|
@@ -107,6 +107,7 @@ export const ja: Locale = {
|
|
|
107
107
|
backToHome: 'ホームへ戻る',
|
|
108
108
|
download: 'ダウンロード',
|
|
109
109
|
copyLink: 'リンクをコピー',
|
|
110
|
+
moreActions: 'その他の操作',
|
|
110
111
|
toastCopyLinkSuccess: 'リンクをクリップボードにコピーしました',
|
|
111
112
|
toastCopyLinkFailed: 'リンクのコピーに失敗しました',
|
|
112
113
|
exportAsHtml: 'HTML として書き出し',
|
package/src/locale/types.ts
CHANGED
package/src/locale/zh-cn.ts
CHANGED
package/src/locale/zh-tw.ts
CHANGED