@open-slide/core 1.13.2 → 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.
@@ -1,4 +1,4 @@
1
- import { Locale } from "./types-CHmFPIG_.js";
1
+ import { Locale } from "./types-DucrShh9.js";
2
2
 
3
3
  //#region src/config.d.ts
4
4
  type OpenSlideBuildConfig = {
@@ -38,6 +38,8 @@ const en = {
38
38
  themes: "Themes",
39
39
  assets: "Assets",
40
40
  folders: "Folders",
41
+ slides: "Slides",
42
+ menu: "Menu",
41
43
  newFolder: "New folder",
42
44
  folderName: "Folder name",
43
45
  updateAvailable: "open-slide {version} is available — update the package to get the latest.",
@@ -120,6 +122,7 @@ const en = {
120
122
  assetsTab: "Assets",
121
123
  renameSlide: "Rename slide",
122
124
  loadingEyebrow: "Loading",
125
+ loadingAssetsEyebrow: "Loading assets",
123
126
  emptyEyebrow: "Empty",
124
127
  nothingToShow: "Nothing to show.",
125
128
  emptyHintPrefix: "",
@@ -147,7 +150,8 @@ const en = {
147
150
  currentTime: "Current time",
148
151
  elapsed: "Elapsed",
149
152
  jump: "Jump",
150
- loadingSlide: "Loading {slideId}…"
153
+ loadingSlide: "Loading {slideId}…",
154
+ loadingAssets: "Loading assets…"
151
155
  },
152
156
  present: {
153
157
  prevSlideAria: "Previous slide (←)",
@@ -436,6 +440,8 @@ const ja = {
436
440
  themes: "テーマ",
437
441
  assets: "アセット",
438
442
  folders: "フォルダ",
443
+ slides: "スライド",
444
+ menu: "メニュー",
439
445
  newFolder: "新規フォルダ",
440
446
  folderName: "フォルダ名",
441
447
  updateAvailable: "open-slide {version} が利用可能です — パッケージを更新して最新版を入手してください。",
@@ -518,6 +524,7 @@ const ja = {
518
524
  assetsTab: "アセット",
519
525
  renameSlide: "スライドの名前を変更",
520
526
  loadingEyebrow: "読み込み中",
527
+ loadingAssetsEyebrow: "アセットを読み込み中",
521
528
  emptyEyebrow: "空",
522
529
  nothingToShow: "表示する内容がありません。",
523
530
  emptyHintPrefix: "",
@@ -545,7 +552,8 @@ const ja = {
545
552
  currentTime: "現在時刻",
546
553
  elapsed: "経過時間",
547
554
  jump: "ジャンプ",
548
- loadingSlide: "{slideId} を読み込み中…"
555
+ loadingSlide: "{slideId} を読み込み中…",
556
+ loadingAssets: "アセットを読み込み中…"
549
557
  },
550
558
  present: {
551
559
  prevSlideAria: "前のスライド (←)",
@@ -834,6 +842,8 @@ const zhCN = {
834
842
  themes: "主题",
835
843
  assets: "素材",
836
844
  folders: "文件夹",
845
+ slides: "幻灯片",
846
+ menu: "菜单",
837
847
  newFolder: "新建文件夹",
838
848
  folderName: "文件夹名称",
839
849
  updateAvailable: "open-slide {version} 已发布,请更新软件包以获取最新版本。",
@@ -916,6 +926,7 @@ const zhCN = {
916
926
  assetsTab: "素材",
917
927
  renameSlide: "重命名幻灯片",
918
928
  loadingEyebrow: "加载中",
929
+ loadingAssetsEyebrow: "加载资源中",
919
930
  emptyEyebrow: "空白",
920
931
  nothingToShow: "没有可显示的内容。",
921
932
  emptyHintPrefix: "",
@@ -943,7 +954,8 @@ const zhCN = {
943
954
  currentTime: "当前时间",
944
955
  elapsed: "已用时",
945
956
  jump: "跳至",
946
- loadingSlide: "正在加载 {slideId}…"
957
+ loadingSlide: "正在加载 {slideId}…",
958
+ loadingAssets: "正在加载资源…"
947
959
  },
948
960
  present: {
949
961
  prevSlideAria: "上一张幻灯片 (←)",
@@ -1232,6 +1244,8 @@ const zhTW = {
1232
1244
  themes: "主題",
1233
1245
  assets: "素材",
1234
1246
  folders: "資料夾",
1247
+ slides: "投影片",
1248
+ menu: "選單",
1235
1249
  newFolder: "新增資料夾",
1236
1250
  folderName: "資料夾名稱",
1237
1251
  updateAvailable: "open-slide {version} 已發布,請更新套件以取得最新版本。",
@@ -1314,6 +1328,7 @@ const zhTW = {
1314
1328
  assetsTab: "素材",
1315
1329
  renameSlide: "重新命名投影片",
1316
1330
  loadingEyebrow: "載入中",
1331
+ loadingAssetsEyebrow: "載入資源中",
1317
1332
  emptyEyebrow: "空白",
1318
1333
  nothingToShow: "沒有可顯示的內容。",
1319
1334
  emptyHintPrefix: "",
@@ -1341,7 +1356,8 @@ const zhTW = {
1341
1356
  currentTime: "目前時間",
1342
1357
  elapsed: "已耗時",
1343
1358
  jump: "跳至",
1344
- loadingSlide: "正在載入 {slideId}…"
1359
+ loadingSlide: "正在載入 {slideId}…",
1360
+ loadingAssets: "正在載入資源…"
1345
1361
  },
1346
1362
  present: {
1347
1363
  prevSlideAria: "上一張投影片 (←)",
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { Locale, Plural } from "./types-CHmFPIG_.js";
2
- import { OpenSlideConfig } from "./config-x493taft.js";
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): react_jsx_runtime0.JSX.Element;
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): react_jsx_runtime1.JSX.Element;
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): react_jsx_runtime4.JSX.Element;
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): react_jsx_runtime5.JSX.Element;
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-7j0EzhuV.js";
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";
@@ -1,4 +1,4 @@
1
- import { Locale, Plural } from "../types-CHmFPIG_.js";
1
+ import { Locale, Plural } from "../types-DucrShh9.js";
2
2
 
3
3
  //#region src/locale/en.d.ts
4
4
  declare const en: Locale;
@@ -1,3 +1,3 @@
1
- import { en, format, ja, plural, zhCN, zhTW } from "../format-7j0EzhuV.js";
1
+ import { en, format, ja, plural, zhCN, zhTW } from "../format-CXtO6ORA.js";
2
2
 
3
3
  export { en, format, ja, plural, zhCN, zhTW };
@@ -42,6 +42,8 @@ type Locale = {
42
42
  themes: string;
43
43
  assets: string;
44
44
  folders: string;
45
+ slides: string;
46
+ menu: string;
45
47
  newFolder: string;
46
48
  folderName: string;
47
49
  updateAvailable: string;
@@ -128,6 +130,7 @@ type Locale = {
128
130
  assetsTab: string;
129
131
  renameSlide: string;
130
132
  loadingEyebrow: string;
133
+ loadingAssetsEyebrow: string;
131
134
  emptyEyebrow: string;
132
135
  nothingToShow: string;
133
136
  emptyHintPrefix: string;
@@ -157,6 +160,7 @@ type Locale = {
157
160
  jump: string;
158
161
  /** template: "Loading {slideId}…" */
159
162
  loadingSlide: string;
163
+ loadingAssets: string;
160
164
  };
161
165
  present: {
162
166
  prevSlideAria: string;
@@ -1,5 +1,5 @@
1
- import "../types-CHmFPIG_.js";
2
- import { OpenSlideConfig } from "../config-x493taft.js";
1
+ import "../types-DucrShh9.js";
2
+ import { OpenSlideConfig } from "../config-CvzwK0tq.js";
3
3
  import { InlineConfig } from "vite";
4
4
 
5
5
  //#region src/vite/config.d.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-slide/core",
3
- "version": "1.13.2",
3
+ "version": "1.13.4",
4
4
  "description": "Runtime and CLI for open-slide — write slides in slides/, we handle the rest.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -16,13 +16,17 @@ const FRAME_MORPH_MS = 180;
16
16
  const LAYOUT_TRACK_MS = PANEL_TRANSITION_MS + FRAME_MORPH_MS;
17
17
 
18
18
  export function InspectOverlay() {
19
- const { active, activate, slideId, selected, setSelected, cancel, openCrop } = useInspector();
19
+ const { active, slideId, selected, setSelected, cancel, openCrop } = useInspector();
20
20
  const overlayRef = useRef<HTMLDivElement>(null);
21
21
  const [hover, setHover] = useState<Highlight | null>(null);
22
22
 
23
23
  useEffect(() => {
24
+ if (!active) {
25
+ setHover(null);
26
+ return;
27
+ }
28
+
24
29
  const onKey = (e: KeyboardEvent) => {
25
- if (!active) return;
26
30
  if (e.key === 'Escape') {
27
31
  e.preventDefault();
28
32
  e.stopPropagation();
@@ -31,66 +35,52 @@ export function InspectOverlay() {
31
35
  };
32
36
 
33
37
  const onMove = (e: PointerEvent) => {
34
- if (!active) return;
35
38
  if (e.target instanceof Element && e.target.closest('[data-inspector-ui]')) {
36
39
  return setHover(null);
37
40
  }
38
- const hit = findInspectorHitAtPoint(e.clientX, e.clientY, slideId);
41
+ const el = pickInspectorTarget(pickElement(e.clientX, e.clientY));
42
+ if (!el) return setHover(null);
43
+ const hit = findSlideSource(el, slideId, { hostOnly: true });
39
44
  if (!hit) return setHover(null);
40
45
  setHover({ hit });
41
46
  };
42
47
 
43
- const onMouseDown = (e: MouseEvent) => {
44
- if (!active && e.detail < 2) return;
45
- if (e.target instanceof Element && e.target.closest('[data-inspector-ui]')) return;
46
- const hit = findInspectorHitAtPoint(e.clientX, e.clientY, slideId);
47
- if (!hit) return;
48
- e.preventDefault();
49
- };
50
-
51
48
  const onClick = (e: MouseEvent) => {
52
- if (!active) return;
53
49
  if (e.target instanceof Element && e.target.closest('[data-inspector-ui]')) return;
54
- const hit = findInspectorHitAtPoint(e.clientX, e.clientY, slideId);
50
+ const el = pickInspectorTarget(pickElement(e.clientX, e.clientY));
51
+ if (!el) return;
52
+ const hit = findSlideSource(el, slideId, { hostOnly: true });
55
53
  if (!hit) return;
56
54
  e.preventDefault();
57
55
  e.stopPropagation();
58
- clearTextSelection();
59
- activate();
60
56
  setSelected({ line: hit.line, column: hit.column, anchor: hit.anchor });
61
57
  setHover({ hit });
62
58
  };
63
59
 
64
60
  const onDblClick = (e: MouseEvent) => {
65
61
  if (e.target instanceof Element && e.target.closest('[data-inspector-ui]')) return;
66
- const hit = findInspectorHitAtPoint(e.clientX, e.clientY, slideId);
62
+ const el = pickInspectorTarget(pickElement(e.clientX, e.clientY));
63
+ if (!el) return;
64
+ const hit = findSlideSource(el, slideId, { hostOnly: true });
67
65
  if (!hit) return;
66
+ if (!(hit.anchor instanceof HTMLImageElement)) return;
68
67
  e.preventDefault();
69
68
  e.stopPropagation();
70
- clearTextSelection();
71
- if (!active) activate();
72
69
  setSelected({ line: hit.line, column: hit.column, anchor: hit.anchor });
73
- setHover({ hit });
74
- if (active && hit.anchor instanceof HTMLImageElement) openCrop(hit.anchor);
70
+ openCrop(hit.anchor);
75
71
  };
76
72
 
77
73
  window.addEventListener('pointermove', onMove, true);
78
- window.addEventListener('mousedown', onMouseDown, true);
79
74
  window.addEventListener('click', onClick, true);
80
75
  window.addEventListener('dblclick', onDblClick, true);
81
76
  window.addEventListener('keydown', onKey, true);
82
77
  return () => {
83
78
  window.removeEventListener('pointermove', onMove, true);
84
- window.removeEventListener('mousedown', onMouseDown, true);
85
79
  window.removeEventListener('click', onClick, true);
86
80
  window.removeEventListener('dblclick', onDblClick, true);
87
81
  window.removeEventListener('keydown', onKey, true);
88
82
  };
89
- }, [active, activate, slideId, setSelected, cancel, openCrop]);
90
-
91
- useEffect(() => {
92
- if (!active) setHover(null);
93
- }, [active]);
83
+ }, [active, slideId, setSelected, cancel, openCrop]);
94
84
 
95
85
  const hoverAnchor = hover?.hit.anchor.isConnected ? hover.hit.anchor : null;
96
86
  const selectedAnchor = selected?.anchor.isConnected ? selected.anchor : null;
@@ -329,17 +319,6 @@ function pickElement(x: number, y: number): HTMLElement | null {
329
319
  return null;
330
320
  }
331
321
 
332
- function findInspectorHitAtPoint(x: number, y: number, slideId: string): SlideSourceHit | null {
333
- const el = pickInspectorTarget(pickElement(x, y));
334
- if (!el) return null;
335
- return findSlideSource(el, slideId, { hostOnly: true });
336
- }
337
-
338
- function clearTextSelection() {
339
- const selection = window.getSelection();
340
- if (selection && !selection.isCollapsed) selection.removeAllRanges();
341
- }
342
-
343
322
  const INLINE_TEXT_TAGS = new Set([
344
323
  'B',
345
324
  'CODE',
@@ -244,7 +244,6 @@ function replayDomTextRangeStyles(el: HTMLElement, html: string, ops: TextRangeS
244
244
  type InspectorCtx = {
245
245
  slideId: string;
246
246
  active: boolean;
247
- activate: () => void;
248
247
  toggle: () => void;
249
248
  cancel: () => void;
250
249
  comments: SlideComment[];
@@ -285,14 +284,11 @@ export function InspectorProvider({
285
284
  pageIndex: number;
286
285
  children: ReactNode;
287
286
  }) {
288
- const [manualActive, setManualActive] = useState(false);
289
- const [heldActive, setHeldActive] = useState(false);
287
+ const [active, setActive] = useState(false);
290
288
  const [selected, setSelected] = useState<SelectedTarget | null>(null);
291
289
  const { comments, error, refetch, add, remove } = useComments(slideId);
292
290
  const { applyEdit, applyEdits } = useEditor(slideId);
293
291
  const history = useHistory();
294
- const active = manualActive || heldActive;
295
- const manualActiveRef = useRef(manualActive);
296
292
 
297
293
  const pendingRef = useRef<Map<string, Bucket>>(new Map());
298
294
  const instanceCounterRef = useRef(0);
@@ -919,24 +915,15 @@ export function InspectorProvider({
919
915
  return () => observer.disconnect();
920
916
  }, [selected]);
921
917
 
922
- const activate = useCallback(() => {
923
- manualActiveRef.current = true;
924
- setManualActive(true);
925
- }, []);
926
-
927
918
  const toggle = useCallback(() => {
928
- setManualActive((a) => {
929
- if (a && !heldActive) setSelected(null);
930
- const next = !a;
931
- manualActiveRef.current = next;
932
- return next;
919
+ setActive((a) => {
920
+ if (a) setSelected(null);
921
+ return !a;
933
922
  });
934
- }, [heldActive]);
923
+ }, []);
935
924
 
936
925
  const cancel = useCallback(() => {
937
- manualActiveRef.current = false;
938
- setManualActive(false);
939
- setHeldActive(false);
926
+ setActive(false);
940
927
  setSelected(null);
941
928
  }, []);
942
929
 
@@ -961,39 +948,6 @@ export function InspectorProvider({
961
948
  return () => window.removeEventListener('keydown', onKey);
962
949
  }, [toggle]);
963
950
 
964
- useEffect(() => {
965
- if (import.meta.env.PROD) return;
966
-
967
- const isApplePlatform = /Mac|iPhone|iPad|iPod/.test(
968
- `${navigator.platform} ${navigator.userAgent}`,
969
- );
970
- const holdKey = isApplePlatform ? 'Meta' : 'Control';
971
-
972
- const onKeyDown = (e: KeyboardEvent) => {
973
- if (e.repeat) return;
974
- if (e.target instanceof HTMLElement && e.target.matches('input, textarea')) return;
975
- if (e.key !== holdKey) return;
976
- setHeldActive(true);
977
- };
978
-
979
- const releaseHeld = (e?: KeyboardEvent) => {
980
- if (e && e.key !== holdKey) return;
981
- setHeldActive(false);
982
- if (!manualActiveRef.current) setSelected(null);
983
- };
984
-
985
- const onBlur = () => releaseHeld();
986
-
987
- window.addEventListener('keydown', onKeyDown, true);
988
- window.addEventListener('keyup', releaseHeld, true);
989
- window.addEventListener('blur', onBlur, true);
990
- return () => {
991
- window.removeEventListener('keydown', onKeyDown, true);
992
- window.removeEventListener('keyup', releaseHeld, true);
993
- window.removeEventListener('blur', onBlur, true);
994
- };
995
- }, []);
996
-
997
951
  const openCrop = useCallback((anchor: HTMLImageElement) => {
998
952
  const loc = anchor.dataset.slideLoc;
999
953
  if (!loc) return;
@@ -1019,7 +973,6 @@ export function InspectorProvider({
1019
973
  () => ({
1020
974
  slideId,
1021
975
  active,
1022
- activate,
1023
976
  toggle,
1024
977
  cancel,
1025
978
  comments,
@@ -1042,7 +995,6 @@ export function InspectorProvider({
1042
995
  [
1043
996
  slideId,
1044
997
  active,
1045
- activate,
1046
998
  toggle,
1047
999
  cancel,
1048
1000
  comments,
@@ -65,6 +65,9 @@ type Row =
65
65
  onChangeIcon: (icon: FolderIcon) => void;
66
66
  onDelete: () => void;
67
67
  }
68
+ | {
69
+ kind: 'all';
70
+ }
68
71
  | {
69
72
  kind: 'draft';
70
73
  }
@@ -95,7 +98,7 @@ export function FolderItem({
95
98
  const slideDragActive = useSlideDragActive();
96
99
  const t = useLocale();
97
100
 
98
- const acceptsSlideDrop = row.kind !== 'themes' && row.kind !== 'assets';
101
+ const acceptsSlideDrop = row.kind === 'draft' || row.kind === 'folder';
99
102
  const isSlideDrag = (e: React.DragEvent) =>
100
103
  acceptsSlideDrop && e.dataTransfer.types.includes(SLIDE_DND_MIME);
101
104
  const handleDragEnter = (e: React.DragEvent) => {
@@ -124,21 +127,25 @@ export function FolderItem({
124
127
  };
125
128
 
126
129
  const icon: FolderIcon =
127
- row.kind === 'draft'
128
- ? { type: 'emoji', value: '📝' }
129
- : row.kind === 'themes'
130
- ? { type: 'emoji', value: '🎨' }
131
- : row.kind === 'assets'
132
- ? { type: 'emoji', value: '🗂️' }
133
- : row.folder.icon;
130
+ row.kind === 'all'
131
+ ? { type: 'emoji', value: '🎞️' }
132
+ : row.kind === 'draft'
133
+ ? { type: 'emoji', value: '📝' }
134
+ : row.kind === 'themes'
135
+ ? { type: 'emoji', value: '🎨' }
136
+ : row.kind === 'assets'
137
+ ? { type: 'emoji', value: '🗂️' }
138
+ : row.folder.icon;
134
139
  const label =
135
- row.kind === 'draft'
136
- ? t.home.draft
137
- : row.kind === 'themes'
138
- ? t.home.themes
139
- : row.kind === 'assets'
140
- ? t.home.assets
141
- : row.folder.name;
140
+ row.kind === 'all'
141
+ ? t.home.slides
142
+ : row.kind === 'draft'
143
+ ? t.home.draft
144
+ : row.kind === 'themes'
145
+ ? t.home.themes
146
+ : row.kind === 'assets'
147
+ ? t.home.assets
148
+ : row.folder.name;
142
149
 
143
150
  const commitRename = () => {
144
151
  if (row.kind !== 'folder') return;
@@ -11,6 +11,7 @@ import { FolderIconChip, FolderItem } from './folder-item';
11
11
  import { IconPicker, PRESET_COLORS } from './icon-picker';
12
12
  import { SidebarFooter } from './sidebar-footer';
13
13
 
14
+ export const ALL_SLIDES_ID = '__all__';
14
15
  export const DRAFT_ID = 'draft';
15
16
  export const THEMES_ID = '__themes__';
16
17
  export const ASSETS_ID = '__assets__';
@@ -20,6 +21,7 @@ export const FOLDER_DND_MIME = 'application/x-folder-id';
20
21
  export function Sidebar({
21
22
  folders,
22
23
  countFor,
24
+ allCount,
23
25
  themesCount,
24
26
  assetsCount,
25
27
  selectedId,
@@ -34,6 +36,7 @@ export function Sidebar({
34
36
  }: {
35
37
  folders: Folder[];
36
38
  countFor: (folderId: string | null) => number;
39
+ allCount: number;
37
40
  themesCount: number;
38
41
  assetsCount: number;
39
42
  selectedId: string;
@@ -134,11 +137,11 @@ export function Sidebar({
134
137
 
135
138
  <div className="px-2">
136
139
  <FolderItem
137
- row={{ kind: 'draft' }}
138
- count={countFor(null)}
139
- selected={selectedId === DRAFT_ID}
140
- onSelect={() => onSelect(DRAFT_ID)}
141
- onDropSlide={onDropToDraft}
140
+ row={{ kind: 'all' }}
141
+ count={allCount}
142
+ selected={selectedId === ALL_SLIDES_ID}
143
+ onSelect={() => onSelect(ALL_SLIDES_ID)}
144
+ onDropSlide={() => {}}
142
145
  />
143
146
  <FolderItem
144
147
  row={{ kind: 'themes' }}
@@ -162,6 +165,13 @@ export function Sidebar({
162
165
  </div>
163
166
 
164
167
  <div className="flex-1 overflow-y-auto px-2 pb-2">
168
+ <FolderItem
169
+ row={{ kind: 'draft' }}
170
+ count={countFor(null)}
171
+ selected={selectedId === DRAFT_ID}
172
+ onSelect={() => onSelect(DRAFT_ID)}
173
+ onDropSlide={onDropToDraft}
174
+ />
165
175
  {folders.map((folder) => {
166
176
  const isDropTarget = dropTarget?.id === folder.id;
167
177
  const before = isDropTarget && dropTarget.before;
@@ -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
+ }
@@ -1,12 +1,21 @@
1
+ import { Menu } from 'lucide-react';
1
2
  import { useCallback, useMemo, useState } from 'react';
2
3
  import { Outlet, useLocation, useNavigate, useSearchParams } from 'react-router-dom';
3
4
  import { toast } from 'sonner';
5
+ import { LanguageToggle } from '@/components/language-toggle';
6
+ import { ThemeToggle } from '@/components/theme-toggle';
7
+ import {
8
+ DropdownMenu,
9
+ DropdownMenuContent,
10
+ DropdownMenuItem,
11
+ DropdownMenuTrigger,
12
+ } from '@/components/ui/dropdown-menu';
4
13
  import { useAssets } from '@/lib/assets';
5
14
  import { useFolders } from '@/lib/folders';
6
15
  import { format, useLocale } from '@/lib/use-locale';
7
16
  import { cn } from '@/lib/utils';
8
- import { MobileFolderPill } from '../components/sidebar/mobile-pill';
9
- import { ASSETS_ID, DRAFT_ID, Sidebar, THEMES_ID } from '../components/sidebar/sidebar';
17
+ import { FolderIconChip } from '../components/sidebar/folder-item';
18
+ import { ALL_SLIDES_ID, ASSETS_ID, Sidebar, THEMES_ID } from '../components/sidebar/sidebar';
10
19
  import type { FoldersManifest } from '../lib/sdk';
11
20
  import { slideIds } from '../lib/slides';
12
21
  import { themes as themeRegistry } from '../lib/themes';
@@ -16,8 +25,9 @@ export type HomeOutletContext = {
16
25
  loading: boolean;
17
26
  draftSlides: string[];
18
27
  slidesByFolder: Record<string, string[]>;
19
- /** Selected folder id when on `/`; equals DRAFT_ID, a folder id, or THEMES_ID. */
28
+ /** Selected view id: ALL_SLIDES_ID, DRAFT_ID, a folder id, THEMES_ID, or ASSETS_ID. */
20
29
  selectedId: string;
30
+ selectFolder: (id: string) => void;
21
31
  reportTitle: (slideId: string, title: string) => void;
22
32
  titleMap: Record<string, string>;
23
33
  assign: (slideId: string, folderId: string | null) => Promise<void>;
@@ -29,7 +39,7 @@ export type HomeOutletContext = {
29
39
  function pathToSelectedId(pathname: string, search: URLSearchParams): string {
30
40
  if (pathname === '/themes' || pathname.startsWith('/themes/')) return THEMES_ID;
31
41
  if (pathname === '/assets') return ASSETS_ID;
32
- return search.get('f') ?? DRAFT_ID;
42
+ return search.get('f') ?? ALL_SLIDES_ID;
33
43
  }
34
44
 
35
45
  export function HomeShell() {
@@ -63,7 +73,7 @@ export function HomeShell() {
63
73
  (id: string) => {
64
74
  if (id === THEMES_ID) navigate('/themes', { replace: true });
65
75
  else if (id === ASSETS_ID) navigate('/assets', { replace: true });
66
- else if (id === DRAFT_ID) navigate('/', { replace: true });
76
+ else if (id === ALL_SLIDES_ID) navigate('/', { replace: true });
67
77
  else navigate(`/?f=${encodeURIComponent(id)}`, { replace: true });
68
78
  },
69
79
  [navigate],
@@ -115,6 +125,7 @@ export function HomeShell() {
115
125
  draftSlides,
116
126
  slidesByFolder,
117
127
  selectedId,
128
+ selectFolder,
118
129
  reportTitle,
119
130
  titleMap,
120
131
  assign,
@@ -129,6 +140,7 @@ export function HomeShell() {
129
140
  <Sidebar
130
141
  folders={manifest.folders}
131
142
  countFor={countFor}
143
+ allCount={slideIds.length}
132
144
  themesCount={themeRegistry.length}
133
145
  assetsCount={globalAssets.length}
134
146
  selectedId={selectedId}
@@ -138,7 +150,7 @@ export function HomeShell() {
138
150
  onChangeIcon={(id, icon) => update(id, { icon })}
139
151
  onDelete={async (id) => {
140
152
  const name = manifest.folders.find((f) => f.id === id)?.name ?? id;
141
- if (selectedId === id) selectFolder(DRAFT_ID);
153
+ if (selectedId === id) selectFolder(ALL_SLIDES_ID);
142
154
  try {
143
155
  await remove(id);
144
156
  toast.success(format(t.home.toastFolderDeleted, { name }));
@@ -161,40 +173,50 @@ export function HomeShell() {
161
173
  <div className="paper relative flex min-w-0 flex-1 flex-col overflow-y-auto bg-canvas">
162
174
  <div className="flex items-center justify-between border-b border-hairline bg-sidebar px-4 py-3 md:hidden">
163
175
  <h1 className="font-heading text-lg font-bold tracking-tight">{t.home.appTitle}</h1>
164
- </div>
165
- <div className="border-b border-hairline bg-sidebar px-4 py-2 md:hidden">
166
- <div className="flex gap-2 overflow-x-auto pb-1">
167
- <MobileFolderPill
168
- icon={{ type: 'emoji', value: '📝' }}
169
- label={t.home.draft}
170
- count={countFor(null)}
171
- active={selectedId === DRAFT_ID}
172
- onClick={() => selectFolder(DRAFT_ID)}
173
- />
174
- <MobileFolderPill
175
- icon={{ type: 'emoji', value: '🎨' }}
176
- label={t.home.themes}
177
- count={themeRegistry.length}
178
- active={selectedId === THEMES_ID}
179
- onClick={() => selectFolder(THEMES_ID)}
180
- />
181
- <MobileFolderPill
182
- icon={{ type: 'emoji', value: '🗂️' }}
183
- label={t.home.assets}
184
- count={globalAssets.length}
185
- active={selectedId === ASSETS_ID}
186
- onClick={() => selectFolder(ASSETS_ID)}
187
- />
188
- {manifest.folders.map((f) => (
189
- <MobileFolderPill
190
- key={f.id}
191
- icon={f.icon}
192
- label={f.name}
193
- count={countFor(f.id)}
194
- active={selectedId === f.id}
195
- onClick={() => selectFolder(f.id)}
196
- />
197
- ))}
176
+ <div className="-mr-1.5 flex items-center gap-0.5">
177
+ <LanguageToggle />
178
+ <ThemeToggle />
179
+ <DropdownMenu>
180
+ <DropdownMenuTrigger asChild>
181
+ <button
182
+ type="button"
183
+ aria-label={t.home.menu}
184
+ className="flex size-8 items-center justify-center rounded-[6px] text-muted-foreground hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground"
185
+ >
186
+ <Menu className="size-4" />
187
+ </button>
188
+ </DropdownMenuTrigger>
189
+ <DropdownMenuContent align="end" className="min-w-[200px]">
190
+ <DropdownMenuItem
191
+ onSelect={() => selectFolder(ALL_SLIDES_ID)}
192
+ className={cn(
193
+ selectedId !== THEMES_ID &&
194
+ selectedId !== ASSETS_ID &&
195
+ 'bg-muted text-foreground',
196
+ )}
197
+ >
198
+ <FolderIconChip icon={{ type: 'emoji', value: '🎞️' }} />
199
+ <span className="flex-1 truncate">{t.home.slides}</span>
200
+ <span className="folio">{slideIds.length.toString().padStart(2, '0')}</span>
201
+ </DropdownMenuItem>
202
+ <DropdownMenuItem
203
+ onSelect={() => selectFolder(THEMES_ID)}
204
+ className={cn(selectedId === THEMES_ID && 'bg-muted text-foreground')}
205
+ >
206
+ <FolderIconChip icon={{ type: 'emoji', value: '🎨' }} />
207
+ <span className="flex-1 truncate">{t.home.themes}</span>
208
+ <span className="folio">{themeRegistry.length.toString().padStart(2, '0')}</span>
209
+ </DropdownMenuItem>
210
+ <DropdownMenuItem
211
+ onSelect={() => selectFolder(ASSETS_ID)}
212
+ className={cn(selectedId === ASSETS_ID && 'bg-muted text-foreground')}
213
+ >
214
+ <FolderIconChip icon={{ type: 'emoji', value: '🗂️' }} />
215
+ <span className="flex-1 truncate">{t.home.assets}</span>
216
+ <span className="folio">{globalAssets.length.toString().padStart(2, '0')}</span>
217
+ </DropdownMenuItem>
218
+ </DropdownMenuContent>
219
+ </DropdownMenu>
198
220
  </div>
199
221
  </div>
200
222
 
@@ -33,11 +33,11 @@ import {
33
33
  import { format, useLocale } from '@/lib/use-locale';
34
34
  import { cn } from '@/lib/utils';
35
35
  import { FolderIconChip, SLIDE_DND_MIME } from '../components/sidebar/folder-item';
36
- import { DRAFT_ID } from '../components/sidebar/sidebar';
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
39
  import type { Folder, FolderIcon, SlideModule } from '../lib/sdk';
40
- import { loadSlide, slideCreatedAt } from '../lib/slides';
40
+ import { loadSlide, slideCreatedAt, slideIds } from '../lib/slides';
41
41
  import type { HomeOutletContext } from './home-shell';
42
42
 
43
43
  type SortKey = 'created-desc' | 'created-asc' | 'title-asc' | 'title-desc';
@@ -76,6 +76,7 @@ export function Home() {
76
76
  draftSlides,
77
77
  slidesByFolder,
78
78
  selectedId,
79
+ selectFolder,
79
80
  reportTitle,
80
81
  titleMap,
81
82
  assign,
@@ -85,13 +86,21 @@ export function Home() {
85
86
  } = useOutletContext<HomeOutletContext>();
86
87
  const t = useLocale();
87
88
 
88
- const selectedFolder =
89
- selectedId === DRAFT_ID ? null : (manifest.folders.find((f) => f.id === selectedId) ?? null);
90
- const visibleSlides = selectedId === DRAFT_ID ? draftSlides : (slidesByFolder[selectedId] ?? []);
91
-
92
- const title = selectedFolder?.name ?? t.home.draft;
93
- const headerIcon = selectedFolder?.icon ?? { type: 'emoji' as const, value: '📝' };
89
+ const isAll = selectedId === ALL_SLIDES_ID;
94
90
  const isDraft = selectedId === DRAFT_ID;
91
+ const selectedFolder =
92
+ isAll || isDraft ? null : (manifest.folders.find((f) => f.id === selectedId) ?? null);
93
+ const visibleSlides = isAll
94
+ ? slideIds
95
+ : isDraft
96
+ ? draftSlides
97
+ : (slidesByFolder[selectedId] ?? []);
98
+
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
+ };
95
104
 
96
105
  const [query, setQuery] = useState('');
97
106
  const [sortKey, setSortKey] = useSortPref();
@@ -133,6 +142,48 @@ export function Home() {
133
142
  <h1 className="font-heading text-[32px] font-semibold leading-[1.05] tracking-[-0.025em] md:text-[44px]">
134
143
  {title}
135
144
  </h1>
145
+ <DropdownMenu>
146
+ <DropdownMenuTrigger asChild>
147
+ <button
148
+ type="button"
149
+ aria-label={t.home.folders}
150
+ 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
+ >
152
+ <ChevronDown className="size-4" />
153
+ </button>
154
+ </DropdownMenuTrigger>
155
+ <DropdownMenuContent align="start" className="min-w-[200px]">
156
+ <DropdownMenuItem
157
+ onSelect={() => selectFolder(ALL_SLIDES_ID)}
158
+ className={cn(isAll && 'bg-muted text-foreground')}
159
+ >
160
+ <FolderIconChip icon={{ type: 'emoji', value: '🎞️' }} />
161
+ <span className="flex-1 truncate">{t.home.slides}</span>
162
+ <span className="folio">{slideIds.length.toString().padStart(2, '0')}</span>
163
+ </DropdownMenuItem>
164
+ <DropdownMenuItem
165
+ onSelect={() => selectFolder(DRAFT_ID)}
166
+ className={cn(isDraft && 'bg-muted text-foreground')}
167
+ >
168
+ <FolderIconChip icon={{ type: 'emoji', value: '📝' }} />
169
+ <span className="flex-1 truncate">{t.home.draft}</span>
170
+ <span className="folio">{draftSlides.length.toString().padStart(2, '0')}</span>
171
+ </DropdownMenuItem>
172
+ {manifest.folders.map((f) => (
173
+ <DropdownMenuItem
174
+ key={f.id}
175
+ onSelect={() => selectFolder(f.id)}
176
+ className={cn(selectedId === f.id && 'bg-muted text-foreground')}
177
+ >
178
+ <FolderIconChip icon={f.icon} />
179
+ <span className="flex-1 truncate">{f.name}</span>
180
+ <span className="folio">
181
+ {(slidesByFolder[f.id]?.length ?? 0).toString().padStart(2, '0')}
182
+ </span>
183
+ </DropdownMenuItem>
184
+ ))}
185
+ </DropdownMenuContent>
186
+ </DropdownMenu>
136
187
  {!loading && (
137
188
  <span className="folio ml-1 self-end pb-2">
138
189
  {(isSearching ? filteredSlides.length : visibleSlides.length)
@@ -155,7 +206,7 @@ export function Home() {
155
206
  {loading ? (
156
207
  <HomeLoading />
157
208
  ) : visibleSlides.length === 0 ? (
158
- <EmptyState isDraft={isDraft} folderName={selectedFolder?.name} />
209
+ <EmptyState isDraft={isAll || isDraft} folderName={selectedFolder?.name} />
159
210
  ) : filteredSlides.length === 0 ? (
160
211
  <NoResultsState query={query} onClear={() => setQuery('')} />
161
212
  ) : (
@@ -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
@@ -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
@@ -42,6 +42,8 @@ export const en: Locale = {
42
42
  themes: 'Themes',
43
43
  assets: 'Assets',
44
44
  folders: 'Folders',
45
+ slides: 'Slides',
46
+ menu: 'Menu',
45
47
  newFolder: 'New folder',
46
48
  folderName: 'Folder name',
47
49
  updateAvailable: 'open-slide {version} is available — update the package to get the latest.',
@@ -129,6 +131,7 @@ export const en: Locale = {
129
131
  assetsTab: 'Assets',
130
132
  renameSlide: 'Rename slide',
131
133
  loadingEyebrow: 'Loading',
134
+ loadingAssetsEyebrow: 'Loading assets',
132
135
  emptyEyebrow: 'Empty',
133
136
  nothingToShow: 'Nothing to show.',
134
137
  emptyHintPrefix: '',
@@ -158,6 +161,7 @@ export const en: Locale = {
158
161
  elapsed: 'Elapsed',
159
162
  jump: 'Jump',
160
163
  loadingSlide: 'Loading {slideId}…',
164
+ loadingAssets: 'Loading assets…',
161
165
  },
162
166
 
163
167
  present: {
package/src/locale/ja.ts CHANGED
@@ -42,6 +42,8 @@ export const ja: Locale = {
42
42
  themes: 'テーマ',
43
43
  assets: 'アセット',
44
44
  folders: 'フォルダ',
45
+ slides: 'スライド',
46
+ menu: 'メニュー',
45
47
  newFolder: '新規フォルダ',
46
48
  folderName: 'フォルダ名',
47
49
  updateAvailable:
@@ -130,6 +132,7 @@ export const ja: Locale = {
130
132
  assetsTab: 'アセット',
131
133
  renameSlide: 'スライドの名前を変更',
132
134
  loadingEyebrow: '読み込み中',
135
+ loadingAssetsEyebrow: 'アセットを読み込み中',
133
136
  emptyEyebrow: '空',
134
137
  nothingToShow: '表示する内容がありません。',
135
138
  emptyHintPrefix: '',
@@ -159,6 +162,7 @@ export const ja: Locale = {
159
162
  elapsed: '経過時間',
160
163
  jump: 'ジャンプ',
161
164
  loadingSlide: '{slideId} を読み込み中…',
165
+ loadingAssets: 'アセットを読み込み中…',
162
166
  },
163
167
 
164
168
  present: {
@@ -42,6 +42,8 @@ export type Locale = {
42
42
  themes: string;
43
43
  assets: string;
44
44
  folders: string;
45
+ slides: string;
46
+ menu: string;
45
47
  newFolder: string;
46
48
  folderName: string;
47
49
  updateAvailable: string;
@@ -129,6 +131,7 @@ export type Locale = {
129
131
  assetsTab: string;
130
132
  renameSlide: string;
131
133
  loadingEyebrow: string;
134
+ loadingAssetsEyebrow: string;
132
135
  emptyEyebrow: string;
133
136
  nothingToShow: string;
134
137
  emptyHintPrefix: string;
@@ -159,6 +162,7 @@ export type Locale = {
159
162
  jump: string;
160
163
  /** template: "Loading {slideId}…" */
161
164
  loadingSlide: string;
165
+ loadingAssets: string;
162
166
  };
163
167
 
164
168
  present: {
@@ -42,6 +42,8 @@ export const zhCN: Locale = {
42
42
  themes: '主题',
43
43
  assets: '素材',
44
44
  folders: '文件夹',
45
+ slides: '幻灯片',
46
+ menu: '菜单',
45
47
  newFolder: '新建文件夹',
46
48
  folderName: '文件夹名称',
47
49
  updateAvailable: 'open-slide {version} 已发布,请更新软件包以获取最新版本。',
@@ -127,6 +129,7 @@ export const zhCN: Locale = {
127
129
  assetsTab: '素材',
128
130
  renameSlide: '重命名幻灯片',
129
131
  loadingEyebrow: '加载中',
132
+ loadingAssetsEyebrow: '加载资源中',
130
133
  emptyEyebrow: '空白',
131
134
  nothingToShow: '没有可显示的内容。',
132
135
  emptyHintPrefix: '',
@@ -156,6 +159,7 @@ export const zhCN: Locale = {
156
159
  elapsed: '已用时',
157
160
  jump: '跳至',
158
161
  loadingSlide: '正在加载 {slideId}…',
162
+ loadingAssets: '正在加载资源…',
159
163
  },
160
164
 
161
165
  present: {
@@ -42,6 +42,8 @@ export const zhTW: Locale = {
42
42
  themes: '主題',
43
43
  assets: '素材',
44
44
  folders: '資料夾',
45
+ slides: '投影片',
46
+ menu: '選單',
45
47
  newFolder: '新增資料夾',
46
48
  folderName: '資料夾名稱',
47
49
  updateAvailable: 'open-slide {version} 已發布,請更新套件以取得最新版本。',
@@ -127,6 +129,7 @@ export const zhTW: Locale = {
127
129
  assetsTab: '素材',
128
130
  renameSlide: '重新命名投影片',
129
131
  loadingEyebrow: '載入中',
132
+ loadingAssetsEyebrow: '載入資源中',
130
133
  emptyEyebrow: '空白',
131
134
  nothingToShow: '沒有可顯示的內容。',
132
135
  emptyHintPrefix: '',
@@ -156,6 +159,7 @@ export const zhTW: Locale = {
156
159
  elapsed: '已耗時',
157
160
  jump: '跳至',
158
161
  loadingSlide: '正在載入 {slideId}…',
162
+ loadingAssets: '正在載入資源…',
159
163
  },
160
164
 
161
165
  present: {
@@ -1,34 +0,0 @@
1
- import { cn } from '@/lib/utils';
2
- import type { FolderIcon } from '../../lib/sdk';
3
- import { FolderIconChip } from './folder-item';
4
-
5
- export function MobileFolderPill({
6
- icon,
7
- label,
8
- count,
9
- active,
10
- onClick,
11
- }: {
12
- icon: FolderIcon;
13
- label: string;
14
- count: number;
15
- active: boolean;
16
- onClick: () => void;
17
- }) {
18
- return (
19
- <button
20
- type="button"
21
- onClick={onClick}
22
- className={cn(
23
- 'flex shrink-0 items-center gap-1.5 rounded-[5px] border px-2.5 py-1 text-[11.5px] font-medium transition-colors',
24
- active
25
- ? 'border-foreground/40 bg-foreground text-background'
26
- : 'border-border bg-card text-muted-foreground hover:text-foreground',
27
- )}
28
- >
29
- <FolderIconChip icon={icon} className="size-3.5 text-sm" />
30
- <span className="max-w-[8rem] truncate">{label}</span>
31
- <span className="folio nums">{count.toString().padStart(2, '0')}</span>
32
- </button>
33
- );
34
- }