@open-slide/core 1.13.3 → 1.13.4
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-BK_GvWH8.d.ts → config-CvzwK0tq.d.ts} +1 -1
- package/dist/{format-sYcnWvKw.js → format-CXtO6ORA.js} +12 -4
- package/dist/index.d.ts +8 -8
- package/dist/index.js +1 -1
- package/dist/locale/index.d.ts +1 -1
- package/dist/locale/index.js +1 -1
- package/dist/{types-CXTTzrhF.d.ts → types-DucrShh9.d.ts} +2 -0
- package/dist/vite/index.d.ts +2 -2
- package/package.json +1 -1
- package/src/app/components/slide-preload-layer.tsx +180 -0
- package/src/app/routes/presenter.tsx +31 -0
- package/src/app/routes/slide.tsx +34 -0
- package/src/locale/en.ts +2 -0
- package/src/locale/ja.ts +2 -0
- package/src/locale/types.ts +2 -0
- package/src/locale/zh-cn.ts +2 -0
- package/src/locale/zh-tw.ts +2 -0
|
@@ -122,6 +122,7 @@ const en = {
|
|
|
122
122
|
assetsTab: "Assets",
|
|
123
123
|
renameSlide: "Rename slide",
|
|
124
124
|
loadingEyebrow: "Loading",
|
|
125
|
+
loadingAssetsEyebrow: "Loading assets",
|
|
125
126
|
emptyEyebrow: "Empty",
|
|
126
127
|
nothingToShow: "Nothing to show.",
|
|
127
128
|
emptyHintPrefix: "",
|
|
@@ -149,7 +150,8 @@ const en = {
|
|
|
149
150
|
currentTime: "Current time",
|
|
150
151
|
elapsed: "Elapsed",
|
|
151
152
|
jump: "Jump",
|
|
152
|
-
loadingSlide: "Loading {slideId}…"
|
|
153
|
+
loadingSlide: "Loading {slideId}…",
|
|
154
|
+
loadingAssets: "Loading assets…"
|
|
153
155
|
},
|
|
154
156
|
present: {
|
|
155
157
|
prevSlideAria: "Previous slide (←)",
|
|
@@ -522,6 +524,7 @@ const ja = {
|
|
|
522
524
|
assetsTab: "アセット",
|
|
523
525
|
renameSlide: "スライドの名前を変更",
|
|
524
526
|
loadingEyebrow: "読み込み中",
|
|
527
|
+
loadingAssetsEyebrow: "アセットを読み込み中",
|
|
525
528
|
emptyEyebrow: "空",
|
|
526
529
|
nothingToShow: "表示する内容がありません。",
|
|
527
530
|
emptyHintPrefix: "",
|
|
@@ -549,7 +552,8 @@ const ja = {
|
|
|
549
552
|
currentTime: "現在時刻",
|
|
550
553
|
elapsed: "経過時間",
|
|
551
554
|
jump: "ジャンプ",
|
|
552
|
-
loadingSlide: "{slideId} を読み込み中…"
|
|
555
|
+
loadingSlide: "{slideId} を読み込み中…",
|
|
556
|
+
loadingAssets: "アセットを読み込み中…"
|
|
553
557
|
},
|
|
554
558
|
present: {
|
|
555
559
|
prevSlideAria: "前のスライド (←)",
|
|
@@ -922,6 +926,7 @@ const zhCN = {
|
|
|
922
926
|
assetsTab: "素材",
|
|
923
927
|
renameSlide: "重命名幻灯片",
|
|
924
928
|
loadingEyebrow: "加载中",
|
|
929
|
+
loadingAssetsEyebrow: "加载资源中",
|
|
925
930
|
emptyEyebrow: "空白",
|
|
926
931
|
nothingToShow: "没有可显示的内容。",
|
|
927
932
|
emptyHintPrefix: "",
|
|
@@ -949,7 +954,8 @@ const zhCN = {
|
|
|
949
954
|
currentTime: "当前时间",
|
|
950
955
|
elapsed: "已用时",
|
|
951
956
|
jump: "跳至",
|
|
952
|
-
loadingSlide: "正在加载 {slideId}…"
|
|
957
|
+
loadingSlide: "正在加载 {slideId}…",
|
|
958
|
+
loadingAssets: "正在加载资源…"
|
|
953
959
|
},
|
|
954
960
|
present: {
|
|
955
961
|
prevSlideAria: "上一张幻灯片 (←)",
|
|
@@ -1322,6 +1328,7 @@ const zhTW = {
|
|
|
1322
1328
|
assetsTab: "素材",
|
|
1323
1329
|
renameSlide: "重新命名投影片",
|
|
1324
1330
|
loadingEyebrow: "載入中",
|
|
1331
|
+
loadingAssetsEyebrow: "載入資源中",
|
|
1325
1332
|
emptyEyebrow: "空白",
|
|
1326
1333
|
nothingToShow: "沒有可顯示的內容。",
|
|
1327
1334
|
emptyHintPrefix: "",
|
|
@@ -1349,7 +1356,8 @@ const zhTW = {
|
|
|
1349
1356
|
currentTime: "目前時間",
|
|
1350
1357
|
elapsed: "已耗時",
|
|
1351
1358
|
jump: "跳至",
|
|
1352
|
-
loadingSlide: "正在載入 {slideId}…"
|
|
1359
|
+
loadingSlide: "正在載入 {slideId}…",
|
|
1360
|
+
loadingAssets: "正在載入資源…"
|
|
1353
1361
|
},
|
|
1354
1362
|
present: {
|
|
1355
1363
|
prevSlideAria: "上一張投影片 (←)",
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Locale, Plural } from "./types-
|
|
2
|
-
import { OpenSlideConfig } from "./config-
|
|
1
|
+
import { Locale, Plural } from "./types-DucrShh9.js";
|
|
2
|
+
import { OpenSlideConfig } from "./config-CvzwK0tq.js";
|
|
3
3
|
import { CSSProperties, ComponentType, HTMLAttributes, PropsWithChildren, ReactNode } from "react";
|
|
4
|
-
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
|
-
import * as react_jsx_runtime1 from "react/jsx-runtime";
|
|
6
4
|
import * as react_jsx_runtime4 from "react/jsx-runtime";
|
|
7
5
|
import * as react_jsx_runtime5 from "react/jsx-runtime";
|
|
6
|
+
import * as react_jsx_runtime2 from "react/jsx-runtime";
|
|
7
|
+
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
8
8
|
|
|
9
9
|
//#region src/app/components/image-placeholder.d.ts
|
|
10
10
|
type ImagePlaceholderProps = {
|
|
@@ -21,7 +21,7 @@ declare function ImagePlaceholder({
|
|
|
21
21
|
style,
|
|
22
22
|
className,
|
|
23
23
|
...rest
|
|
24
|
-
}: ImagePlaceholderProps):
|
|
24
|
+
}: ImagePlaceholderProps): react_jsx_runtime4.JSX.Element;
|
|
25
25
|
|
|
26
26
|
//#endregion
|
|
27
27
|
//#region src/app/components/shared-element.d.ts
|
|
@@ -36,7 +36,7 @@ declare function unstable_SharedElement({
|
|
|
36
36
|
children,
|
|
37
37
|
className,
|
|
38
38
|
style
|
|
39
|
-
}: unstable_SharedElementProps):
|
|
39
|
+
}: unstable_SharedElementProps): react_jsx_runtime5.JSX.Element;
|
|
40
40
|
|
|
41
41
|
//#endregion
|
|
42
42
|
//#region src/app/lib/design.d.ts
|
|
@@ -117,7 +117,7 @@ declare const CANVAS_HEIGHT = 1080;
|
|
|
117
117
|
type StepsProps = PropsWithChildren;
|
|
118
118
|
declare function Steps({
|
|
119
119
|
children
|
|
120
|
-
}: StepsProps):
|
|
120
|
+
}: StepsProps): react_jsx_runtime2.JSX.Element;
|
|
121
121
|
type StepProps = PropsWithChildren<{
|
|
122
122
|
duration?: number;
|
|
123
123
|
}>;
|
|
@@ -128,7 +128,7 @@ declare function Step({
|
|
|
128
128
|
children,
|
|
129
129
|
duration,
|
|
130
130
|
_revealed
|
|
131
|
-
}: InternalStepProps):
|
|
131
|
+
}: InternalStepProps): react_jsx_runtime3.JSX.Element;
|
|
132
132
|
|
|
133
133
|
//#endregion
|
|
134
134
|
export { CANVAS_HEIGHT, CANVAS_WIDTH, DesignFonts, DesignPalette, DesignSystem, DesignTypeScale, ImagePlaceholder, ImagePlaceholderProps, Locale, OpenSlideConfig, Page, Plural, SharedElementTransition, SlideMeta, SlideModule, SlideTransition, Step, StepProps, Steps, StepsProps, TransitionPhase, cssVarsToString, defaultDesign, designToCssVars, unstable_SharedElement, unstable_SharedElementProps, useSlidePageNumber };
|
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-CXtO6ORA.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
|
@@ -130,6 +130,7 @@ type Locale = {
|
|
|
130
130
|
assetsTab: string;
|
|
131
131
|
renameSlide: string;
|
|
132
132
|
loadingEyebrow: string;
|
|
133
|
+
loadingAssetsEyebrow: string;
|
|
133
134
|
emptyEyebrow: string;
|
|
134
135
|
nothingToShow: string;
|
|
135
136
|
emptyHintPrefix: string;
|
|
@@ -159,6 +160,7 @@ type Locale = {
|
|
|
159
160
|
jump: string;
|
|
160
161
|
/** template: "Loading {slideId}…" */
|
|
161
162
|
loadingSlide: string;
|
|
163
|
+
loadingAssets: string;
|
|
162
164
|
};
|
|
163
165
|
present: {
|
|
164
166
|
prevSlideAria: string;
|
package/dist/vite/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { type DesignSystem, designToCssVars } from '../lib/design';
|
|
3
|
+
import { SlidePageProvider } from '../lib/page-context';
|
|
4
|
+
import { CANVAS_HEIGHT, CANVAS_WIDTH, type Page } from '../lib/sdk';
|
|
5
|
+
import { type StepController, StepHost } from '../lib/step-context';
|
|
6
|
+
|
|
7
|
+
const PAGES_PER_FRAME = 2;
|
|
8
|
+
const SETTLE_TIMEOUT_MS = 15_000;
|
|
9
|
+
|
|
10
|
+
type Props = {
|
|
11
|
+
pages: Page[];
|
|
12
|
+
index: number;
|
|
13
|
+
design?: DesignSystem;
|
|
14
|
+
/** Also warm the page at `index` — for use while no page is live yet. */
|
|
15
|
+
includeCurrent?: boolean;
|
|
16
|
+
onDone?: () => void;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// Per-document registry so a deck gates the UI on its first open only —
|
|
20
|
+
// revisits within the same tab skip straight to the slides.
|
|
21
|
+
const warmedDecks = new Set<string>();
|
|
22
|
+
|
|
23
|
+
export function isDeckWarmed(slideId: string): boolean {
|
|
24
|
+
return warmedDecks.has(slideId);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function markDeckWarmed(slideId: string): void {
|
|
28
|
+
warmedDecks.add(slideId);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function nextFrame(): Promise<void> {
|
|
32
|
+
return new Promise((resolve) => requestAnimationFrame(() => resolve()));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function waitForImages(root: HTMLElement): Promise<unknown> {
|
|
36
|
+
const pending = Array.from(root.querySelectorAll('img'))
|
|
37
|
+
.filter((img) => !img.complete)
|
|
38
|
+
.map(
|
|
39
|
+
(img) =>
|
|
40
|
+
new Promise<void>((resolve) => {
|
|
41
|
+
img.addEventListener('load', () => resolve(), { once: true });
|
|
42
|
+
img.addEventListener('error', () => resolve(), { once: true });
|
|
43
|
+
}),
|
|
44
|
+
);
|
|
45
|
+
return Promise.all(pending);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function saveDataEnabled(): boolean {
|
|
49
|
+
if (typeof navigator === 'undefined') return false;
|
|
50
|
+
const connection = (navigator as Navigator & { connection?: { saveData?: boolean } }).connection;
|
|
51
|
+
return connection?.saveData === true;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Nearest upcoming pages first, wrapping around.
|
|
55
|
+
function computeWarmupOrder(pages: Page[], index: number, includeCurrent: boolean): number[] {
|
|
56
|
+
if (saveDataEnabled()) return [];
|
|
57
|
+
const start = Math.max(0, Math.min(pages.length - 1, index));
|
|
58
|
+
const result: number[] = [];
|
|
59
|
+
for (let step = includeCurrent ? 0 : 1; step < pages.length; step++) {
|
|
60
|
+
result.push((start + step) % pages.length);
|
|
61
|
+
}
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Mounts every non-visible page of the deck in a hidden layer so the browser
|
|
67
|
+
* fetches their images and font faces before the audience navigates to them —
|
|
68
|
+
* without this, each page's assets only start downloading on entry, which
|
|
69
|
+
* shows up as font flashes and image pop-in mid-presentation.
|
|
70
|
+
*
|
|
71
|
+
* Pages mount a few per frame to keep the first slide's paint smooth, stay
|
|
72
|
+
* `visibility: hidden` (layout still runs, so text triggers font loads and
|
|
73
|
+
* boxes trigger background-image loads), and the whole layer unmounts once
|
|
74
|
+
* fonts and images have settled — by then everything sits in the HTTP cache.
|
|
75
|
+
*/
|
|
76
|
+
export function SlidePreloadLayer({ pages, index, design, includeCurrent = false, onDone }: Props) {
|
|
77
|
+
// Warm-up order is captured on mount, not on every index change — later
|
|
78
|
+
// navigation must not restart the sequence. But the deck itself can change
|
|
79
|
+
// under a reused component instance (a client-side slide switch keeps this
|
|
80
|
+
// route mounted, and the editor mutates `pages` on reorder/add/delete), so
|
|
81
|
+
// recompute from scratch whenever the `pages` identity changes.
|
|
82
|
+
const [deck, setDeck] = useState(pages);
|
|
83
|
+
const [order, setOrder] = useState<number[]>(() =>
|
|
84
|
+
computeWarmupOrder(pages, index, includeCurrent),
|
|
85
|
+
);
|
|
86
|
+
const [mountedCount, setMountedCount] = useState(0);
|
|
87
|
+
const [done, setDone] = useState(order.length === 0);
|
|
88
|
+
const rootRef = useRef<HTMLDivElement | null>(null);
|
|
89
|
+
const controllerRef = useRef<StepController | null>(null);
|
|
90
|
+
|
|
91
|
+
if (deck !== pages) {
|
|
92
|
+
const nextOrder = computeWarmupOrder(pages, index, includeCurrent);
|
|
93
|
+
setDeck(pages);
|
|
94
|
+
setOrder(nextOrder);
|
|
95
|
+
setMountedCount(0);
|
|
96
|
+
setDone(nextOrder.length === 0);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const onDoneRef = useRef(onDone);
|
|
100
|
+
onDoneRef.current = onDone;
|
|
101
|
+
useEffect(() => {
|
|
102
|
+
if (done) onDoneRef.current?.();
|
|
103
|
+
}, [done]);
|
|
104
|
+
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
if (done || mountedCount >= order.length) return;
|
|
107
|
+
const raf = requestAnimationFrame(() => {
|
|
108
|
+
setMountedCount((n) => Math.min(order.length, n + PAGES_PER_FRAME));
|
|
109
|
+
});
|
|
110
|
+
return () => cancelAnimationFrame(raf);
|
|
111
|
+
}, [done, mountedCount, order.length]);
|
|
112
|
+
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
if (done || mountedCount < order.length) return;
|
|
115
|
+
let cancelled = false;
|
|
116
|
+
const settle = async () => {
|
|
117
|
+
// Two frames of layout so newly mounted text has kicked off its font
|
|
118
|
+
// requests before `document.fonts.ready` takes a snapshot.
|
|
119
|
+
await nextFrame();
|
|
120
|
+
await nextFrame();
|
|
121
|
+
const root = rootRef.current;
|
|
122
|
+
await Promise.all([
|
|
123
|
+
'fonts' in document ? document.fonts.ready : Promise.resolve(),
|
|
124
|
+
root ? waitForImages(root) : Promise.resolve(),
|
|
125
|
+
]);
|
|
126
|
+
};
|
|
127
|
+
const timeout = new Promise<void>((resolve) => setTimeout(resolve, SETTLE_TIMEOUT_MS));
|
|
128
|
+
Promise.race([settle(), timeout]).then(() => {
|
|
129
|
+
if (!cancelled) setDone(true);
|
|
130
|
+
});
|
|
131
|
+
return () => {
|
|
132
|
+
cancelled = true;
|
|
133
|
+
};
|
|
134
|
+
}, [done, mountedCount, order.length]);
|
|
135
|
+
|
|
136
|
+
if (done) return null;
|
|
137
|
+
|
|
138
|
+
return (
|
|
139
|
+
<div
|
|
140
|
+
ref={rootRef}
|
|
141
|
+
aria-hidden
|
|
142
|
+
data-osd-freeze-motion=""
|
|
143
|
+
style={{
|
|
144
|
+
position: 'absolute',
|
|
145
|
+
inset: 0,
|
|
146
|
+
overflow: 'hidden',
|
|
147
|
+
visibility: 'hidden',
|
|
148
|
+
pointerEvents: 'none',
|
|
149
|
+
...(design ? designToCssVars(design) : {}),
|
|
150
|
+
}}
|
|
151
|
+
>
|
|
152
|
+
{order.slice(0, mountedCount).map((pageIndex) => {
|
|
153
|
+
const PageComponent = pages[pageIndex];
|
|
154
|
+
if (!PageComponent) return null;
|
|
155
|
+
return (
|
|
156
|
+
<div
|
|
157
|
+
key={pageIndex}
|
|
158
|
+
style={{
|
|
159
|
+
position: 'absolute',
|
|
160
|
+
top: 0,
|
|
161
|
+
left: 0,
|
|
162
|
+
width: CANVAS_WIDTH,
|
|
163
|
+
height: CANVAS_HEIGHT,
|
|
164
|
+
}}
|
|
165
|
+
>
|
|
166
|
+
<SlidePageProvider index={pageIndex} total={pages.length}>
|
|
167
|
+
<StepHost
|
|
168
|
+
isActivePage={false}
|
|
169
|
+
entryDirection="backward"
|
|
170
|
+
controllerRef={controllerRef}
|
|
171
|
+
>
|
|
172
|
+
<PageComponent />
|
|
173
|
+
</StepHost>
|
|
174
|
+
</SlidePageProvider>
|
|
175
|
+
</div>
|
|
176
|
+
);
|
|
177
|
+
})}
|
|
178
|
+
</div>
|
|
179
|
+
);
|
|
180
|
+
}
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
usePresenterChannel,
|
|
10
10
|
} from '../components/present/use-presenter-channel';
|
|
11
11
|
import { SlideCanvas } from '../components/slide-canvas';
|
|
12
|
+
import { isDeckWarmed, markDeckWarmed, SlidePreloadLayer } from '../components/slide-preload-layer';
|
|
12
13
|
import { SlidePageProvider } from '../lib/page-context';
|
|
13
14
|
import { CANVAS_HEIGHT, CANVAS_WIDTH } from '../lib/sdk';
|
|
14
15
|
import { type StepController, StepHost } from '../lib/step-context';
|
|
@@ -28,6 +29,11 @@ export function Presenter() {
|
|
|
28
29
|
const [hasProjection, setHasProjection] = useState(false);
|
|
29
30
|
const requestedRef = useRef(false);
|
|
30
31
|
const t = useLocale();
|
|
32
|
+
const [, setWarmedTick] = useState(0);
|
|
33
|
+
const handleAssetsWarmed = useCallback(() => {
|
|
34
|
+
markDeckWarmed(slideId);
|
|
35
|
+
setWarmedTick((n) => n + 1);
|
|
36
|
+
}, [slideId]);
|
|
31
37
|
|
|
32
38
|
const channel = usePresenterChannel(slideId, (msg) => {
|
|
33
39
|
if (msg.type === 'state') {
|
|
@@ -130,6 +136,31 @@ export function Presenter() {
|
|
|
130
136
|
const CurrentPage = pages[index];
|
|
131
137
|
const NextPage = hasNext ? pages[nextPageIndex] : null;
|
|
132
138
|
|
|
139
|
+
// Hold the loader while a hidden layer warms the whole deck's images and
|
|
140
|
+
// fonts, so the previews first paint with every asset already in cache.
|
|
141
|
+
if (!isDeckWarmed(slideId)) {
|
|
142
|
+
return (
|
|
143
|
+
<div className="dark grid h-dvh place-items-center bg-background text-muted-foreground">
|
|
144
|
+
<div className="flex flex-col items-center gap-4">
|
|
145
|
+
<div className="relative h-px w-56 overflow-hidden bg-border">
|
|
146
|
+
<span
|
|
147
|
+
aria-hidden
|
|
148
|
+
className="line-loader-bar absolute inset-y-[-0.5px] left-0 w-1/4 bg-foreground"
|
|
149
|
+
/>
|
|
150
|
+
</div>
|
|
151
|
+
<div className="text-[11.5px]">{t.presenter.loadingAssets}</div>
|
|
152
|
+
</div>
|
|
153
|
+
<SlidePreloadLayer
|
|
154
|
+
pages={pages}
|
|
155
|
+
index={index}
|
|
156
|
+
design={slide.design}
|
|
157
|
+
includeCurrent
|
|
158
|
+
onDone={handleAssetsWarmed}
|
|
159
|
+
/>
|
|
160
|
+
</div>
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
133
164
|
return (
|
|
134
165
|
<div className="dark flex h-dvh w-screen flex-col overflow-hidden bg-background text-foreground">
|
|
135
166
|
<PresenterTopBar
|
package/src/app/routes/slide.tsx
CHANGED
|
@@ -55,6 +55,7 @@ import { PdfProgressToast } from '../components/pdf-progress-toast';
|
|
|
55
55
|
import { openPresenterWindow, Player } from '../components/player';
|
|
56
56
|
import { PptxProgressToast } from '../components/pptx-progress-toast';
|
|
57
57
|
import { SlideCanvas } from '../components/slide-canvas';
|
|
58
|
+
import { isDeckWarmed, markDeckWarmed, SlidePreloadLayer } from '../components/slide-preload-layer';
|
|
58
59
|
import { SlideTransitionLayer } from '../components/slide-transition-layer';
|
|
59
60
|
import { type ThumbnailActions, ThumbnailRail } from '../components/thumbnail-rail';
|
|
60
61
|
import { exportSlideAsHtml } from '../lib/export-html';
|
|
@@ -77,6 +78,11 @@ export function Slide() {
|
|
|
77
78
|
const linkCopiedTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
78
79
|
const [designOpen, setDesignOpen] = useState(false);
|
|
79
80
|
const [overviewOpen, setOverviewOpen] = useState(false);
|
|
81
|
+
const [, setWarmedTick] = useState(0);
|
|
82
|
+
const handleAssetsWarmed = useCallback(() => {
|
|
83
|
+
markDeckWarmed(slideId);
|
|
84
|
+
setWarmedTick((n) => n + 1);
|
|
85
|
+
}, [slideId]);
|
|
80
86
|
|
|
81
87
|
useEffect(() => {
|
|
82
88
|
return () => {
|
|
@@ -347,6 +353,34 @@ export function Slide() {
|
|
|
347
353
|
);
|
|
348
354
|
}
|
|
349
355
|
|
|
356
|
+
// Hold the loader while a hidden layer warms the whole deck's images and
|
|
357
|
+
// fonts, so the slide UI first paints with every asset already in cache.
|
|
358
|
+
if (view !== 'assets' && !isDeckWarmed(slideId)) {
|
|
359
|
+
return (
|
|
360
|
+
<div className="grid min-h-dvh place-items-center px-8 text-muted-foreground">
|
|
361
|
+
<div className="flex flex-col items-center gap-4">
|
|
362
|
+
<div className="relative h-px w-56 overflow-hidden bg-hairline">
|
|
363
|
+
<span
|
|
364
|
+
aria-hidden
|
|
365
|
+
className="line-loader-bar absolute inset-y-[-0.5px] left-0 w-1/4 bg-foreground"
|
|
366
|
+
/>
|
|
367
|
+
</div>
|
|
368
|
+
<div className="flex flex-wrap items-baseline justify-center gap-x-2 text-[11.5px]">
|
|
369
|
+
<span className="eyebrow">{t.slide.loadingAssetsEyebrow}</span>
|
|
370
|
+
<span className="font-mono">{slideId}</span>
|
|
371
|
+
</div>
|
|
372
|
+
</div>
|
|
373
|
+
<SlidePreloadLayer
|
|
374
|
+
pages={pages}
|
|
375
|
+
index={index}
|
|
376
|
+
design={slide.design}
|
|
377
|
+
includeCurrent
|
|
378
|
+
onDone={handleAssetsWarmed}
|
|
379
|
+
/>
|
|
380
|
+
</div>
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
|
|
350
384
|
if (!showSlideUi) {
|
|
351
385
|
return (
|
|
352
386
|
<Player
|
package/src/locale/en.ts
CHANGED
|
@@ -131,6 +131,7 @@ export const en: Locale = {
|
|
|
131
131
|
assetsTab: 'Assets',
|
|
132
132
|
renameSlide: 'Rename slide',
|
|
133
133
|
loadingEyebrow: 'Loading',
|
|
134
|
+
loadingAssetsEyebrow: 'Loading assets',
|
|
134
135
|
emptyEyebrow: 'Empty',
|
|
135
136
|
nothingToShow: 'Nothing to show.',
|
|
136
137
|
emptyHintPrefix: '',
|
|
@@ -160,6 +161,7 @@ export const en: Locale = {
|
|
|
160
161
|
elapsed: 'Elapsed',
|
|
161
162
|
jump: 'Jump',
|
|
162
163
|
loadingSlide: 'Loading {slideId}…',
|
|
164
|
+
loadingAssets: 'Loading assets…',
|
|
163
165
|
},
|
|
164
166
|
|
|
165
167
|
present: {
|
package/src/locale/ja.ts
CHANGED
|
@@ -132,6 +132,7 @@ export const ja: Locale = {
|
|
|
132
132
|
assetsTab: 'アセット',
|
|
133
133
|
renameSlide: 'スライドの名前を変更',
|
|
134
134
|
loadingEyebrow: '読み込み中',
|
|
135
|
+
loadingAssetsEyebrow: 'アセットを読み込み中',
|
|
135
136
|
emptyEyebrow: '空',
|
|
136
137
|
nothingToShow: '表示する内容がありません。',
|
|
137
138
|
emptyHintPrefix: '',
|
|
@@ -161,6 +162,7 @@ export const ja: Locale = {
|
|
|
161
162
|
elapsed: '経過時間',
|
|
162
163
|
jump: 'ジャンプ',
|
|
163
164
|
loadingSlide: '{slideId} を読み込み中…',
|
|
165
|
+
loadingAssets: 'アセットを読み込み中…',
|
|
164
166
|
},
|
|
165
167
|
|
|
166
168
|
present: {
|
package/src/locale/types.ts
CHANGED
|
@@ -131,6 +131,7 @@ export type Locale = {
|
|
|
131
131
|
assetsTab: string;
|
|
132
132
|
renameSlide: string;
|
|
133
133
|
loadingEyebrow: string;
|
|
134
|
+
loadingAssetsEyebrow: string;
|
|
134
135
|
emptyEyebrow: string;
|
|
135
136
|
nothingToShow: string;
|
|
136
137
|
emptyHintPrefix: string;
|
|
@@ -161,6 +162,7 @@ export type Locale = {
|
|
|
161
162
|
jump: string;
|
|
162
163
|
/** template: "Loading {slideId}…" */
|
|
163
164
|
loadingSlide: string;
|
|
165
|
+
loadingAssets: string;
|
|
164
166
|
};
|
|
165
167
|
|
|
166
168
|
present: {
|
package/src/locale/zh-cn.ts
CHANGED
|
@@ -129,6 +129,7 @@ export const zhCN: Locale = {
|
|
|
129
129
|
assetsTab: '素材',
|
|
130
130
|
renameSlide: '重命名幻灯片',
|
|
131
131
|
loadingEyebrow: '加载中',
|
|
132
|
+
loadingAssetsEyebrow: '加载资源中',
|
|
132
133
|
emptyEyebrow: '空白',
|
|
133
134
|
nothingToShow: '没有可显示的内容。',
|
|
134
135
|
emptyHintPrefix: '',
|
|
@@ -158,6 +159,7 @@ export const zhCN: Locale = {
|
|
|
158
159
|
elapsed: '已用时',
|
|
159
160
|
jump: '跳至',
|
|
160
161
|
loadingSlide: '正在加载 {slideId}…',
|
|
162
|
+
loadingAssets: '正在加载资源…',
|
|
161
163
|
},
|
|
162
164
|
|
|
163
165
|
present: {
|
package/src/locale/zh-tw.ts
CHANGED
|
@@ -129,6 +129,7 @@ export const zhTW: Locale = {
|
|
|
129
129
|
assetsTab: '素材',
|
|
130
130
|
renameSlide: '重新命名投影片',
|
|
131
131
|
loadingEyebrow: '載入中',
|
|
132
|
+
loadingAssetsEyebrow: '載入資源中',
|
|
132
133
|
emptyEyebrow: '空白',
|
|
133
134
|
nothingToShow: '沒有可顯示的內容。',
|
|
134
135
|
emptyHintPrefix: '',
|
|
@@ -158,6 +159,7 @@ export const zhTW: Locale = {
|
|
|
158
159
|
elapsed: '已耗時',
|
|
159
160
|
jump: '跳至',
|
|
160
161
|
loadingSlide: '正在載入 {slideId}…',
|
|
162
|
+
loadingAssets: '正在載入資源…',
|
|
161
163
|
},
|
|
162
164
|
|
|
163
165
|
present: {
|