@lemonriver/core 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{build-Df_xwIpg.js → build-Nl7EeJ6x.js} +1 -1
- package/dist/cli/bin.js +4 -4
- package/dist/{config-rMGCkz6i.d.ts → config-CYNOR93W.d.ts} +1 -1
- package/dist/{config-BjWCLoMQ.js → config-CpC0nM3r.js} +3152 -1837
- package/dist/{dev-Ctsx9IeO.js → dev-BB3THd5I.js} +2 -2
- 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/{preview-CJgcqsPk.js → preview-BGjgTg7H.js} +1 -1
- package/dist/{types-8VUyA2bu.d.ts → types-tdaXSyah.d.ts} +1 -35
- package/dist/{update-BKOA3Z6o.js → update-DsxZBtwv.js} +2 -70
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.js +1 -1
- package/dist/{zh-tw-CeLrYwRE.js → zh-tw-DcrDeKxr.js} +11 -172
- package/package.json +1 -1
- package/src/agent/prompt.ts +2 -0
- package/src/app/app.tsx +5 -18
- package/src/app/components/agent/agent-panel.tsx +5 -0
- package/src/app/components/agent/agent-presence.tsx +2 -2
- package/src/app/components/agent/history-view.tsx +3 -2
- package/src/app/components/agent/transcript.tsx +15 -4
- package/src/app/components/asset-view.tsx +6 -6
- package/src/app/components/command/command-menu.tsx +2 -1
- package/src/app/components/inspector/asset-picker-dialog.tsx +7 -5
- package/src/app/components/inspector/comment-layer.tsx +2 -1
- package/src/app/components/inspector/inspector-panel.tsx +2 -2
- package/src/app/components/player.tsx +105 -23
- package/src/app/components/present/curtain.tsx +52 -0
- package/src/app/components/present/last-slide-hint.tsx +36 -0
- package/src/app/components/sidebar/sidebar-footer.tsx +7 -2
- package/src/app/components/sidebar/sidebar.tsx +3 -2
- package/src/app/components/themes/theme-detail.tsx +4 -2
- package/src/app/components/thumbnail-rail.tsx +2 -28
- package/src/app/index.html +2 -2
- package/src/app/lemonriver/agent/lemon.tsx +79 -0
- package/src/app/lemonriver/agent-prefs/prefs.test.ts +173 -0
- package/src/app/lemonriver/agent-prefs/prefs.ts +137 -0
- package/src/app/lemonriver/agent-prefs/use-prefs.ts +36 -0
- package/src/app/{components → lemonriver}/board/board-canvas.tsx +17 -17
- package/src/app/{routes/board.tsx → lemonriver/board/board-page.tsx} +16 -15
- package/src/app/{components → lemonriver}/board/layout.ts +1 -1
- package/src/app/lemonriver/board/model/cards.test.ts +239 -0
- package/src/app/lemonriver/board/model/cards.ts +234 -0
- package/src/app/lemonriver/board/model/structure.test.ts +101 -0
- package/src/app/lemonriver/board/model/structure.ts +82 -0
- package/src/app/{components → lemonriver}/board/page-node.tsx +34 -31
- package/src/app/{components → lemonriver}/board/use-board-cards.ts +6 -6
- package/src/app/{components → lemonriver}/board/use-board-columns.ts +7 -7
- package/src/app/{components → lemonriver}/board/use-page-order.ts +10 -6
- package/src/app/lemonriver/brand/app-icon.svg +44 -0
- package/src/app/lemonriver/brand/apple-touch-icon.png +0 -0
- package/src/app/lemonriver/brand/favicon-32.png +0 -0
- package/src/app/lemonriver/brand/mascot.tsx +145 -0
- package/src/app/lemonriver/brand/mascots/design-done.png +0 -0
- package/src/app/lemonriver/brand/mascots/design-idle.png +0 -0
- package/src/app/lemonriver/brand/mascots/design-needs-you.png +0 -0
- package/src/app/lemonriver/brand/mascots/design-working.png +0 -0
- package/src/app/lemonriver/brand/mascots/lemon-done.png +0 -0
- package/src/app/lemonriver/brand/mascots/lemon-idle.png +0 -0
- package/src/app/lemonriver/brand/mascots/lemon-needs-you.png +0 -0
- package/src/app/lemonriver/brand/mascots/lemon-thinking.png +0 -0
- package/src/app/lemonriver/brand/mascots/lemon-working.png +0 -0
- package/src/app/lemonriver/brand/mascots/outline-done.png +0 -0
- package/src/app/lemonriver/brand/mascots/outline-idle.png +0 -0
- package/src/app/lemonriver/brand/mascots/outline-needs-you.png +0 -0
- package/src/app/lemonriver/brand/mascots/outline-working.png +0 -0
- package/src/app/lemonriver/brand/mascots/research-done.png +0 -0
- package/src/app/lemonriver/brand/mascots/research-idle.png +0 -0
- package/src/app/lemonriver/brand/mascots/research-needs-you.png +0 -0
- package/src/app/lemonriver/brand/mascots/research-working.png +0 -0
- package/src/app/lemonriver/brand/mascots/review-done.png +0 -0
- package/src/app/lemonriver/brand/mascots/review-idle.png +0 -0
- package/src/app/lemonriver/brand/mascots/review-needs-you.png +0 -0
- package/src/app/lemonriver/brand/mascots/review-working.png +0 -0
- package/src/app/lemonriver/chrome/app-chrome.tsx +101 -0
- package/src/app/lemonriver/chrome/nav-row.tsx +34 -0
- package/src/app/lemonriver/chrome/not-found.tsx +34 -0
- package/src/app/lemonriver/chrome/sidebar-extras.tsx +57 -0
- package/src/app/lemonriver/chrome/use-slot.ts +23 -0
- package/src/app/lemonriver/features.test.ts +34 -0
- package/src/app/lemonriver/features.ts +27 -0
- package/src/app/lemonriver/feedback/export.ts +7 -0
- package/src/app/lemonriver/feedback/lemon-empty.tsx +54 -0
- package/src/app/lemonriver/feedback/offline-banner.tsx +41 -0
- package/src/app/lemonriver/feedback/pending-toast.test.ts +44 -0
- package/src/app/lemonriver/feedback/pending-toast.ts +39 -0
- package/src/app/lemonriver/feedback/toaster.tsx +34 -0
- package/src/app/lemonriver/feedback/upload.test.ts +26 -0
- package/src/app/lemonriver/feedback/upload.ts +19 -0
- package/src/app/lemonriver/home/brief-card.tsx +70 -0
- package/src/app/lemonriver/home/brief.test.ts +38 -0
- package/src/app/lemonriver/home/brief.ts +34 -0
- package/src/app/lemonriver/home/controls.tsx +93 -0
- package/src/app/lemonriver/home/deck-card.tsx +183 -0
- package/src/app/lemonriver/home/dialogs.tsx +292 -0
- package/src/app/lemonriver/home/home-page.tsx +339 -0
- package/src/app/lemonriver/home/sorting.test.ts +24 -0
- package/src/app/lemonriver/home/sorting.ts +59 -0
- package/src/app/lemonriver/home/time.test.ts +33 -0
- package/src/app/lemonriver/home/time.ts +33 -0
- package/src/app/lemonriver/home/use-deck-times.ts +27 -0
- package/src/app/lemonriver/home/use-delayed.ts +15 -0
- package/src/app/lemonriver/onboarding/onboarding.tsx +182 -0
- package/src/app/lemonriver/outline/build-team.tsx +278 -0
- package/src/app/lemonriver/outline/describe-page.tsx +380 -0
- package/src/app/lemonriver/outline/files.test.ts +90 -0
- package/src/app/lemonriver/outline/files.ts +69 -0
- package/src/app/lemonriver/outline/model.test.ts +633 -0
- package/src/app/lemonriver/outline/model.ts +443 -0
- package/src/app/lemonriver/outline/outline-page.tsx +504 -0
- package/src/app/lemonriver/outline/pending-pages.tsx +39 -0
- package/src/app/lemonriver/outline/rule.ts +3 -0
- package/src/app/lemonriver/outline/steps.tsx +43 -0
- package/src/app/lemonriver/outline/use-build-driver.ts +258 -0
- package/src/app/lemonriver/routes.test.tsx +37 -0
- package/src/app/lemonriver/routes.tsx +66 -0
- package/src/app/lemonriver/settings/settings-page.tsx +314 -0
- package/src/app/lemonriver/slide-extensions.tsx +80 -0
- package/src/app/lemonriver/text/all.ts +19 -0
- package/src/app/lemonriver/text/en.ts +255 -0
- package/src/app/lemonriver/text/es.ts +256 -0
- package/src/app/lemonriver/text/index.ts +9 -0
- package/src/app/lemonriver/text/ja.ts +256 -0
- package/src/app/lemonriver/text/text.test.ts +90 -0
- package/src/app/lemonriver/text/types.ts +280 -0
- package/src/app/lemonriver/text/zh-cn.ts +247 -0
- package/src/app/lemonriver/text/zh-tw.ts +247 -0
- package/src/app/lemonriver/theme/app.css +299 -0
- package/src/app/lemonriver/theme/controls.css +463 -0
- package/src/app/lemonriver/theme/index.css +3 -0
- package/src/app/lemonriver/theme/motion.ts +52 -0
- package/src/app/lemonriver/theme/pages.test.ts +70 -0
- package/src/app/lemonriver/theme/pages.ts +65 -0
- package/src/app/lemonriver/theme/theme-menu.tsx +64 -0
- package/src/app/lemonriver/theme/themes.test.ts +18 -0
- package/src/app/lemonriver/theme/themes.ts +16 -0
- package/src/app/lemonriver/theme/tokens.css +226 -0
- package/src/app/lemonriver/theme/use-theme.tsx +49 -0
- package/src/app/lemonriver/trash/api.test.ts +19 -0
- package/src/app/lemonriver/trash/api.ts +77 -0
- package/src/app/lemonriver/trash/trash-page.tsx +131 -0
- package/src/app/lemonriver/update/beta-badge.tsx +26 -0
- package/src/app/lemonriver/update/prompt.test.ts +84 -0
- package/src/app/lemonriver/update/prompt.ts +48 -0
- package/src/app/lemonriver/update/update-prompt.tsx +113 -0
- package/src/app/lib/pptx/raster.ts +1 -1
- package/src/app/main.tsx +8 -1
- package/src/app/routes/home-shell.tsx +4 -2
- package/src/app/routes/home.tsx +13 -5
- package/src/app/routes/slide.tsx +81 -28
- package/src/app/styles.css +1 -0
- package/src/locale/en.ts +1 -35
- package/src/locale/es.ts +1 -34
- package/src/locale/ja.ts +1 -34
- package/src/locale/types.ts +1 -36
- package/src/locale/zh-cn.ts +4 -37
- package/src/locale/zh-tw.ts +4 -37
- /package/src/app/{components → lemonriver}/board/board.css +0 -0
- /package/src/app/{components → lemonriver}/board/layout.test.ts +0 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import {
|
|
3
|
+
promptsOnPage,
|
|
4
|
+
readSnooze,
|
|
5
|
+
SNOOZE_KEY,
|
|
6
|
+
SNOOZE_MS,
|
|
7
|
+
type Snooze,
|
|
8
|
+
saveSnooze,
|
|
9
|
+
shouldPrompt,
|
|
10
|
+
type UpdateCheck,
|
|
11
|
+
} from './prompt';
|
|
12
|
+
|
|
13
|
+
function memoryStorage(): Storage {
|
|
14
|
+
const map = new Map<string, string>();
|
|
15
|
+
return {
|
|
16
|
+
get length() {
|
|
17
|
+
return map.size;
|
|
18
|
+
},
|
|
19
|
+
clear: () => map.clear(),
|
|
20
|
+
getItem: (k) => map.get(k) ?? null,
|
|
21
|
+
key: (i) => [...map.keys()][i] ?? null,
|
|
22
|
+
removeItem: (k) => {
|
|
23
|
+
map.delete(k);
|
|
24
|
+
},
|
|
25
|
+
setItem: (k, v) => {
|
|
26
|
+
map.set(k, v);
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const outdated: UpdateCheck = { current: '0.3.0', latest: '9.9.9', outdated: true };
|
|
32
|
+
|
|
33
|
+
describe('shouldPrompt', () => {
|
|
34
|
+
it('stays quiet without an update', () => {
|
|
35
|
+
expect(shouldPrompt(null, null, 0)).toBe(false);
|
|
36
|
+
expect(shouldPrompt({ ...outdated, outdated: false }, null, 0)).toBe(false);
|
|
37
|
+
expect(shouldPrompt({ ...outdated, latest: null }, null, 0)).toBe(false);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('prompts for an outdated version with no snooze', () => {
|
|
41
|
+
expect(shouldPrompt(outdated, null, 0)).toBe(true);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('respects a snooze on the same version until it expires', () => {
|
|
45
|
+
const snooze: Snooze = { version: '9.9.9', until: 1000 };
|
|
46
|
+
expect(shouldPrompt(outdated, snooze, 999)).toBe(false);
|
|
47
|
+
expect(shouldPrompt(outdated, snooze, 1000)).toBe(true);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('prompts again as soon as a newer version ships', () => {
|
|
51
|
+
const snooze: Snooze = { version: '9.9.9', until: 1000 };
|
|
52
|
+
expect(shouldPrompt({ ...outdated, latest: '9.9.10' }, snooze, 0)).toBe(true);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
describe('snooze storage', () => {
|
|
57
|
+
it('round-trips the version and its deadline', () => {
|
|
58
|
+
const storage = memoryStorage();
|
|
59
|
+
saveSnooze(storage, '9.9.9', 5000);
|
|
60
|
+
expect(readSnooze(storage)).toEqual({ version: '9.9.9', until: 5000 + SNOOZE_MS });
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('ignores anything it did not write', () => {
|
|
64
|
+
const storage = memoryStorage();
|
|
65
|
+
storage.setItem(SNOOZE_KEY, 'not json');
|
|
66
|
+
expect(readSnooze(storage)).toBeNull();
|
|
67
|
+
storage.setItem(SNOOZE_KEY, '{"version":"9.9.9"}');
|
|
68
|
+
expect(readSnooze(storage)).toBeNull();
|
|
69
|
+
storage.setItem(SNOOZE_KEY, '{"version":9,"until":1}');
|
|
70
|
+
expect(readSnooze(storage)).toBeNull();
|
|
71
|
+
storage.setItem(SNOOZE_KEY, '{"version":"9.9.9","until":"soon"}');
|
|
72
|
+
expect(readSnooze(storage)).toBeNull();
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
describe('promptsOnPage', () => {
|
|
77
|
+
it('asks on the pages people read and stays off the captures', () => {
|
|
78
|
+
expect(promptsOnPage('/')).toBe(true);
|
|
79
|
+
expect(promptsOnPage('/s/alpha')).toBe(true);
|
|
80
|
+
expect(promptsOnPage('/trash')).toBe(true);
|
|
81
|
+
expect(promptsOnPage('/s/alpha/preview')).toBe(false);
|
|
82
|
+
expect(promptsOnPage('/s/alpha/presenter')).toBe(false);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { pageForPath } from '../theme/pages';
|
|
2
|
+
|
|
3
|
+
export const UPDATE_CHECK_INTERVAL_MS = 60 * 60 * 1000;
|
|
4
|
+
export const SNOOZE_MS = 24 * 60 * 60 * 1000;
|
|
5
|
+
export const SNOOZE_KEY = 'lemonriver:update-snooze';
|
|
6
|
+
|
|
7
|
+
export type UpdateCheck = { current: string; latest: string | null; outdated: boolean };
|
|
8
|
+
export type Snooze = { version: string; until: number };
|
|
9
|
+
|
|
10
|
+
export function shouldPrompt(
|
|
11
|
+
check: UpdateCheck | null,
|
|
12
|
+
snooze: Snooze | null,
|
|
13
|
+
now: number,
|
|
14
|
+
): boolean {
|
|
15
|
+
if (!check || !check.outdated || !check.latest) return false;
|
|
16
|
+
const snoozed = snooze !== null && snooze.version === check.latest && now < snooze.until;
|
|
17
|
+
return !snoozed;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function readSnooze(storage: Storage): Snooze | null {
|
|
21
|
+
let raw: string | null = null;
|
|
22
|
+
try {
|
|
23
|
+
raw = storage.getItem(SNOOZE_KEY);
|
|
24
|
+
} catch {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
if (!raw) return null;
|
|
28
|
+
try {
|
|
29
|
+
const value = JSON.parse(raw) as Record<string, unknown> | null;
|
|
30
|
+
if (!value || typeof value !== 'object') return null;
|
|
31
|
+
if (typeof value.version !== 'string') return null;
|
|
32
|
+
if (typeof value.until !== 'number' || !Number.isFinite(value.until)) return null;
|
|
33
|
+
return { version: value.version, until: value.until };
|
|
34
|
+
} catch {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function saveSnooze(storage: Storage, version: string, now: number): void {
|
|
40
|
+
try {
|
|
41
|
+
storage.setItem(SNOOZE_KEY, JSON.stringify({ version, until: now + SNOOZE_MS }));
|
|
42
|
+
} catch {}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function promptsOnPage(pathname: string): boolean {
|
|
46
|
+
const page = pageForPath(pathname);
|
|
47
|
+
return page !== 'preview' && page !== 'presenter';
|
|
48
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import { useLocation } from 'react-router-dom';
|
|
3
|
+
import { toast } from 'sonner';
|
|
4
|
+
import { format } from '@/lib/use-locale';
|
|
5
|
+
import { useRestartServer } from '@/lib/use-restart-server';
|
|
6
|
+
import { useLrText } from '../text';
|
|
7
|
+
import {
|
|
8
|
+
promptsOnPage,
|
|
9
|
+
readSnooze,
|
|
10
|
+
saveSnooze,
|
|
11
|
+
shouldPrompt,
|
|
12
|
+
UPDATE_CHECK_INTERVAL_MS,
|
|
13
|
+
type UpdateCheck,
|
|
14
|
+
} from './prompt';
|
|
15
|
+
|
|
16
|
+
const TOAST_ID = 'lemonriver-update';
|
|
17
|
+
|
|
18
|
+
export function UpdatePrompt() {
|
|
19
|
+
const { pathname } = useLocation();
|
|
20
|
+
const lr = useLrText();
|
|
21
|
+
const { canRestart, restartServer } = useRestartServer();
|
|
22
|
+
const phase = useRef<'idle' | 'busy' | 'done'>('idle');
|
|
23
|
+
const settled = useRef<string | null>(null);
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (!import.meta.env.DEV) return;
|
|
27
|
+
if (!promptsOnPage(pathname)) {
|
|
28
|
+
toast.dismiss(TOAST_ID);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
let cancelled = false;
|
|
33
|
+
|
|
34
|
+
function snooze(latest: string) {
|
|
35
|
+
saveSnooze(localStorage, latest, Date.now());
|
|
36
|
+
toast.dismiss(TOAST_ID);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function runUpdate(latest: string) {
|
|
40
|
+
if (phase.current === 'busy') return;
|
|
41
|
+
phase.current = 'busy';
|
|
42
|
+
toast.loading(lr.update.updating, { id: TOAST_ID, duration: Infinity });
|
|
43
|
+
|
|
44
|
+
let ok = false;
|
|
45
|
+
try {
|
|
46
|
+
const res = await fetch('/__update-package', { method: 'POST' });
|
|
47
|
+
ok = res.ok;
|
|
48
|
+
} catch {
|
|
49
|
+
ok = false;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (!ok) {
|
|
53
|
+
phase.current = 'idle';
|
|
54
|
+
if (cancelled) return;
|
|
55
|
+
toast.error(lr.update.failed, {
|
|
56
|
+
id: TOAST_ID,
|
|
57
|
+
duration: Infinity,
|
|
58
|
+
description: lr.update.failedHint,
|
|
59
|
+
action: { label: lr.update.retry, onClick: () => void runUpdate(latest) },
|
|
60
|
+
cancel: { label: lr.update.later, onClick: () => snooze(latest) },
|
|
61
|
+
});
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
phase.current = 'done';
|
|
66
|
+
settled.current = latest;
|
|
67
|
+
if (cancelled) return;
|
|
68
|
+
toast.success(format(lr.update.updated, { version: latest }), {
|
|
69
|
+
id: TOAST_ID,
|
|
70
|
+
duration: Infinity,
|
|
71
|
+
description: canRestart ? lr.update.updatedHint : lr.update.updatedManual,
|
|
72
|
+
action: canRestart
|
|
73
|
+
? { label: lr.update.restart, onClick: () => void restartServer() }
|
|
74
|
+
: undefined,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function showPrompt(check: UpdateCheck) {
|
|
79
|
+
const latest = check.latest as string;
|
|
80
|
+
toast.warning(format(lr.update.title, { version: latest }), {
|
|
81
|
+
id: TOAST_ID,
|
|
82
|
+
duration: Infinity,
|
|
83
|
+
description: format(lr.update.hint, { current: check.current }),
|
|
84
|
+
action: { label: lr.update.now, onClick: () => void runUpdate(latest) },
|
|
85
|
+
cancel: { label: lr.update.later, onClick: () => snooze(latest) },
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async function check() {
|
|
90
|
+
let data: UpdateCheck | null = null;
|
|
91
|
+
try {
|
|
92
|
+
const res = await fetch('/__update-check');
|
|
93
|
+
if (!res.ok) return;
|
|
94
|
+
data = (await res.json()) as UpdateCheck;
|
|
95
|
+
} catch {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
if (cancelled || !shouldPrompt(data, readSnooze(localStorage), Date.now())) return;
|
|
99
|
+
if (phase.current === 'busy') return;
|
|
100
|
+
if (phase.current === 'done' && settled.current === data.latest) return;
|
|
101
|
+
showPrompt(data);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
void check();
|
|
105
|
+
const timer = setInterval(() => void check(), UPDATE_CHECK_INTERVAL_MS);
|
|
106
|
+
return () => {
|
|
107
|
+
cancelled = true;
|
|
108
|
+
clearInterval(timer);
|
|
109
|
+
};
|
|
110
|
+
}, [pathname, lr, canRestart, restartServer]);
|
|
111
|
+
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
@@ -103,7 +103,7 @@ export class Rasterizer {
|
|
|
103
103
|
}
|
|
104
104
|
} catch (err) {
|
|
105
105
|
console.warn(
|
|
106
|
-
'[
|
|
106
|
+
'[open-slide] pptx export: could not rasterize an element, skipping it',
|
|
107
107
|
err,
|
|
108
108
|
);
|
|
109
109
|
} finally {
|
package/src/app/main.tsx
CHANGED
|
@@ -2,12 +2,19 @@ import { ThemeProvider } from 'next-themes';
|
|
|
2
2
|
import { StrictMode } from 'react';
|
|
3
3
|
import { createRoot } from 'react-dom/client';
|
|
4
4
|
import { App } from './app';
|
|
5
|
+
import { LR_THEMES } from './lemonriver/theme/themes';
|
|
5
6
|
import './styles.css';
|
|
6
7
|
|
|
7
8
|
// biome-ignore lint/style/noNonNullAssertion: #root is guaranteed by index.html
|
|
8
9
|
createRoot(document.getElementById('root')!).render(
|
|
9
10
|
<StrictMode>
|
|
10
|
-
<ThemeProvider
|
|
11
|
+
<ThemeProvider
|
|
12
|
+
attribute="class"
|
|
13
|
+
defaultTheme="system"
|
|
14
|
+
enableSystem
|
|
15
|
+
disableTransitionOnChange
|
|
16
|
+
themes={LR_THEMES}
|
|
17
|
+
>
|
|
11
18
|
<App />
|
|
12
19
|
</ThemeProvider>
|
|
13
20
|
</StrictMode>,
|
|
@@ -3,7 +3,6 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
|
3
3
|
import { Outlet, useLocation, useNavigate, useSearchParams } from 'react-router-dom';
|
|
4
4
|
import { toast } from 'sonner';
|
|
5
5
|
import { LanguageToggle } from '@/components/language-toggle';
|
|
6
|
-
import { ThemeToggle } from '@/components/theme-toggle';
|
|
7
6
|
import {
|
|
8
7
|
DropdownMenu,
|
|
9
8
|
DropdownMenuContent,
|
|
@@ -19,6 +18,8 @@ import { CommandMenuTrigger } from '../components/command/command-menu';
|
|
|
19
18
|
import { HomeCommandMenu } from '../components/command/home-command-menu';
|
|
20
19
|
import { SystemViewIcon } from '../components/sidebar/folder-item';
|
|
21
20
|
import { ALL_SLIDES_ID, ASSETS_ID, Sidebar, THEMES_ID } from '../components/sidebar/sidebar';
|
|
21
|
+
import { lemonRiverViewFor } from '../lemonriver/theme/pages';
|
|
22
|
+
import { ThemeToggle } from '../lemonriver/theme/theme-menu';
|
|
22
23
|
import type { FoldersManifest } from '../lib/sdk';
|
|
23
24
|
import { slideIds } from '../lib/slides';
|
|
24
25
|
import { themes as themeRegistry } from '../lib/themes';
|
|
@@ -63,7 +64,8 @@ export function HomeShell() {
|
|
|
63
64
|
const [searchParams] = useSearchParams();
|
|
64
65
|
const t = useLocale();
|
|
65
66
|
|
|
66
|
-
const selectedId =
|
|
67
|
+
const selectedId =
|
|
68
|
+
lemonRiverViewFor(location.pathname) ?? pathToSelectedId(location.pathname, searchParams);
|
|
67
69
|
|
|
68
70
|
useEffect(() => {
|
|
69
71
|
rememberHomeLocation(location.pathname, location.search);
|
package/src/app/routes/home.tsx
CHANGED
|
@@ -323,10 +323,12 @@ function SortControl({ value, onChange }: { value: SortKey; onChange: (next: Sor
|
|
|
323
323
|
);
|
|
324
324
|
}
|
|
325
325
|
|
|
326
|
+
// Offered even before an agent is connected: the new deck opens the agent
|
|
327
|
+
// panel, which walks first-time users through installing one.
|
|
326
328
|
function useCreateDeckWithAgent() {
|
|
327
|
-
const { provider } = useAgentStatus();
|
|
329
|
+
const { enabled, provider } = useAgentStatus();
|
|
328
330
|
const start = useCreateDeck();
|
|
329
|
-
if (!
|
|
331
|
+
if (!enabled) return null;
|
|
330
332
|
return { provider, start };
|
|
331
333
|
}
|
|
332
334
|
|
|
@@ -339,7 +341,11 @@ function NewDeckButton() {
|
|
|
339
341
|
size="sm"
|
|
340
342
|
className="h-8 shrink-0"
|
|
341
343
|
onClick={agent.start}
|
|
342
|
-
title={
|
|
344
|
+
title={
|
|
345
|
+
agent.provider
|
|
346
|
+
? format(t.agent.createDeckWith, { provider: agent.provider.name })
|
|
347
|
+
: t.agent.createDeck
|
|
348
|
+
}
|
|
343
349
|
>
|
|
344
350
|
<Plus />
|
|
345
351
|
{t.agent.createDeck}
|
|
@@ -404,8 +410,10 @@ function EmptyState({ isDraft, folderName }: { isDraft: boolean; folderName?: st
|
|
|
404
410
|
</p>
|
|
405
411
|
{agent ? (
|
|
406
412
|
<Button size="sm" className="mt-4" onClick={agent.start}>
|
|
407
|
-
<ProviderLogo provider={agent.provider.id} />
|
|
408
|
-
{
|
|
413
|
+
{agent.provider ? <ProviderLogo provider={agent.provider.id} /> : <Plus />}
|
|
414
|
+
{agent.provider
|
|
415
|
+
? format(t.agent.createDeckWith, { provider: agent.provider.name })
|
|
416
|
+
: t.agent.createDeck}
|
|
409
417
|
</Button>
|
|
410
418
|
) : (
|
|
411
419
|
<p className="mt-1.5 text-[13px] leading-relaxed text-muted-foreground">
|
package/src/app/routes/slide.tsx
CHANGED
|
@@ -87,10 +87,18 @@ import { PdfProgressToast, PptxProgressToast } from '../components/export-progre
|
|
|
87
87
|
import { NotesDrawer } from '../components/notes-drawer';
|
|
88
88
|
import { OverviewGrid } from '../components/overview-grid';
|
|
89
89
|
import { openPresenterWindow, Player } from '../components/player';
|
|
90
|
+
import {
|
|
91
|
+
afterPaint,
|
|
92
|
+
CURTAIN_FADE_MS,
|
|
93
|
+
PresentCurtain,
|
|
94
|
+
whenFullscreenSettled,
|
|
95
|
+
} from '../components/present/curtain';
|
|
90
96
|
import { SlideCanvas } from '../components/slide-canvas';
|
|
91
97
|
import { isDeckWarmed, markDeckWarmed, SlidePreloadLayer } from '../components/slide-preload-layer';
|
|
92
98
|
import { SlideTransitionLayer } from '../components/slide-transition-layer';
|
|
93
99
|
import { type ThumbnailActions, ThumbnailRail } from '../components/thumbnail-rail';
|
|
100
|
+
import { exportFailedHint } from '../lemonriver/feedback/export';
|
|
101
|
+
import { SlideExtensions } from '../lemonriver/slide-extensions';
|
|
94
102
|
import { exportSlideAsHtml } from '../lib/export-html';
|
|
95
103
|
import { exportSlideAsPdf, isSafari, type PdfExportProgress } from '../lib/export-pdf';
|
|
96
104
|
import {
|
|
@@ -166,6 +174,55 @@ export function Slide() {
|
|
|
166
174
|
const narrowToolbar = useMediaQuery('(max-width: 639.98px)');
|
|
167
175
|
const prefersReducedMotion = usePrefersReducedMotion();
|
|
168
176
|
|
|
177
|
+
// 'entering' darkens the editor before the Player mounts; 'leaving' keeps
|
|
178
|
+
// the editor dark after the Player unmounts, then fades it back in.
|
|
179
|
+
const [curtain, setCurtain] = useState<'entering' | 'leaving' | null>(null);
|
|
180
|
+
const curtainTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
181
|
+
useEffect(
|
|
182
|
+
() => () => {
|
|
183
|
+
if (curtainTimerRef.current) clearTimeout(curtainTimerRef.current);
|
|
184
|
+
},
|
|
185
|
+
[],
|
|
186
|
+
);
|
|
187
|
+
const present = useCallback(
|
|
188
|
+
(mode: 'window' | 'fullscreen') => {
|
|
189
|
+
if (prefersReducedMotion) {
|
|
190
|
+
setPlayMode(mode);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
if (curtainTimerRef.current) return;
|
|
194
|
+
setCurtain('entering');
|
|
195
|
+
// Fullscreen is requested when the Player mounts; the delay stays well
|
|
196
|
+
// inside the browser's transient user-activation window.
|
|
197
|
+
curtainTimerRef.current = setTimeout(() => {
|
|
198
|
+
curtainTimerRef.current = null;
|
|
199
|
+
setCurtain(null);
|
|
200
|
+
setPlayMode(mode);
|
|
201
|
+
}, CURTAIN_FADE_MS);
|
|
202
|
+
},
|
|
203
|
+
[prefersReducedMotion],
|
|
204
|
+
);
|
|
205
|
+
const exitPresent = useCallback(() => {
|
|
206
|
+
setPlayMode(null);
|
|
207
|
+
if (!prefersReducedMotion) setCurtain('leaving');
|
|
208
|
+
}, [prefersReducedMotion]);
|
|
209
|
+
useEffect(() => {
|
|
210
|
+
if (curtain !== 'leaving' || playMode) return;
|
|
211
|
+
let cancelPaint = () => {};
|
|
212
|
+
const reveal = () => {
|
|
213
|
+
cancelPaint = afterPaint(() => setCurtain(null));
|
|
214
|
+
};
|
|
215
|
+
if (!document.fullscreenElement) {
|
|
216
|
+
reveal();
|
|
217
|
+
return () => cancelPaint();
|
|
218
|
+
}
|
|
219
|
+
const cancelWait = whenFullscreenSettled(reveal);
|
|
220
|
+
return () => {
|
|
221
|
+
cancelWait();
|
|
222
|
+
cancelPaint();
|
|
223
|
+
};
|
|
224
|
+
}, [curtain, playMode]);
|
|
225
|
+
|
|
169
226
|
const modulePages = useMemo(() => slide?.default ?? [], [slide]);
|
|
170
227
|
const [pages, setPages] = useState<typeof modulePages>(modulePages);
|
|
171
228
|
useEffect(() => {
|
|
@@ -335,7 +392,7 @@ export function Slide() {
|
|
|
335
392
|
// When showSlideUi is false the read-only <Player> is rendered and owns
|
|
336
393
|
// keyboard navigation (including step-aware advance/retreat). Attaching this
|
|
337
394
|
// page-nav handler too would race it and skip <Steps> reveals, so bail out.
|
|
338
|
-
if (playMode || !showSlideUi) return;
|
|
395
|
+
if (playMode || curtain || !showSlideUi) return;
|
|
339
396
|
const onKey = (e: KeyboardEvent) => {
|
|
340
397
|
if (
|
|
341
398
|
isTypingTarget(e.target) ||
|
|
@@ -354,11 +411,6 @@ export function Slide() {
|
|
|
354
411
|
setOverviewOpen((v) => !v);
|
|
355
412
|
return;
|
|
356
413
|
}
|
|
357
|
-
if (import.meta.env.DEV && !overviewOpen && (e.key === 'b' || e.key === 'B')) {
|
|
358
|
-
e.preventDefault();
|
|
359
|
-
navigate(`/s/${encodeURIComponent(slideId)}/board`);
|
|
360
|
-
return;
|
|
361
|
-
}
|
|
362
414
|
// Once overview owns focus, swallow everything else here — its
|
|
363
415
|
// capture-phase listener drives the focused thumbnail.
|
|
364
416
|
if (overviewOpen) return;
|
|
@@ -373,12 +425,12 @@ export function Slide() {
|
|
|
373
425
|
return;
|
|
374
426
|
}
|
|
375
427
|
if (e.key === 'f' || e.key === 'F') {
|
|
376
|
-
|
|
428
|
+
present('fullscreen');
|
|
377
429
|
} else if (e.key === 'Enter') {
|
|
378
|
-
|
|
430
|
+
present('window');
|
|
379
431
|
} else if (e.key === 'p' || e.key === 'P') {
|
|
380
432
|
if (slideId) openPresenterWindow(slideId);
|
|
381
|
-
|
|
433
|
+
present('window');
|
|
382
434
|
} else if (import.meta.env.DEV && (e.key === 'd' || e.key === 'D')) {
|
|
383
435
|
setDesignOpen((v) => !v);
|
|
384
436
|
} else if (import.meta.env.DEV && (e.key === 'a' || e.key === 'A')) {
|
|
@@ -387,7 +439,7 @@ export function Slide() {
|
|
|
387
439
|
};
|
|
388
440
|
window.addEventListener('keydown', onKey);
|
|
389
441
|
return () => window.removeEventListener('keydown', onKey);
|
|
390
|
-
}, [index, goTo, playMode, slideId, overviewOpen,
|
|
442
|
+
}, [index, goTo, playMode, curtain, slideId, overviewOpen, toggleAgent, present]);
|
|
391
443
|
|
|
392
444
|
if (error) {
|
|
393
445
|
return (
|
|
@@ -428,8 +480,9 @@ export function Slide() {
|
|
|
428
480
|
transition={presented.slide.transition}
|
|
429
481
|
index={presented.index}
|
|
430
482
|
onIndexChange={presentReady ? goTo : noop}
|
|
431
|
-
onExit={
|
|
483
|
+
onExit={exitPresent}
|
|
432
484
|
controls
|
|
485
|
+
curtain={!prefersReducedMotion}
|
|
433
486
|
slideId={presented.slideId}
|
|
434
487
|
onSwitchSlide={switchPresentedSlide}
|
|
435
488
|
fullscreen={playMode === 'fullscreen'}
|
|
@@ -544,7 +597,7 @@ export function Slide() {
|
|
|
544
597
|
if (linkCopiedTimerRef.current) clearTimeout(linkCopiedTimerRef.current);
|
|
545
598
|
linkCopiedTimerRef.current = setTimeout(() => setLinkCopied(false), 1200);
|
|
546
599
|
} catch (err) {
|
|
547
|
-
console.error('[
|
|
600
|
+
console.error('[open-slide] copy link failed', err);
|
|
548
601
|
toast.error(t.slide.toastCopyLinkFailed);
|
|
549
602
|
}
|
|
550
603
|
};
|
|
@@ -555,7 +608,7 @@ export function Slide() {
|
|
|
555
608
|
try {
|
|
556
609
|
await exportSlideAsHtml(slide, slideId);
|
|
557
610
|
} catch (err) {
|
|
558
|
-
console.error('[
|
|
611
|
+
console.error('[open-slide] export failed', err);
|
|
559
612
|
} finally {
|
|
560
613
|
setExporting(false);
|
|
561
614
|
}
|
|
@@ -579,9 +632,13 @@ export function Slide() {
|
|
|
579
632
|
await opts.run(show);
|
|
580
633
|
toast.dismiss(toastId);
|
|
581
634
|
} catch (err) {
|
|
582
|
-
console.error(`[
|
|
635
|
+
console.error(`[open-slide] ${opts.kind} export failed`, err);
|
|
583
636
|
// Reuses the progress toast's id, so it must outlive this handler.
|
|
584
|
-
toast.error(opts.failedMessage, {
|
|
637
|
+
toast.error(opts.failedMessage, {
|
|
638
|
+
id: toastId,
|
|
639
|
+
duration: 6000,
|
|
640
|
+
description: exportFailedHint(t),
|
|
641
|
+
});
|
|
585
642
|
} finally {
|
|
586
643
|
setExporting(false);
|
|
587
644
|
}
|
|
@@ -806,7 +863,7 @@ export function Slide() {
|
|
|
806
863
|
size="sm"
|
|
807
864
|
variant="brand"
|
|
808
865
|
aria-label={t.slide.present}
|
|
809
|
-
onClick={() =>
|
|
866
|
+
onClick={() => present(isMobile ? 'window' : 'fullscreen')}
|
|
810
867
|
className="rounded-r-none px-2.5 lg:px-3"
|
|
811
868
|
>
|
|
812
869
|
<Play className="size-3.5 fill-current" />
|
|
@@ -826,12 +883,12 @@ export function Slide() {
|
|
|
826
883
|
</DropdownMenuTrigger>
|
|
827
884
|
<DropdownMenuContent align="end" className="min-w-[200px]">
|
|
828
885
|
<DropdownMenuGroup>
|
|
829
|
-
<DropdownMenuItem onClick={() =>
|
|
886
|
+
<DropdownMenuItem onClick={() => present('window')}>
|
|
830
887
|
<Play />
|
|
831
888
|
{t.slide.presentInWindow}
|
|
832
889
|
<DropdownMenuShortcut>↵</DropdownMenuShortcut>
|
|
833
890
|
</DropdownMenuItem>
|
|
834
|
-
<DropdownMenuItem onClick={() =>
|
|
891
|
+
<DropdownMenuItem onClick={() => present('fullscreen')}>
|
|
835
892
|
<Maximize />
|
|
836
893
|
{t.slide.presentFullscreen}
|
|
837
894
|
<DropdownMenuShortcut>F</DropdownMenuShortcut>
|
|
@@ -839,7 +896,7 @@ export function Slide() {
|
|
|
839
896
|
<DropdownMenuItem
|
|
840
897
|
onClick={() => {
|
|
841
898
|
if (slideId) openPresenterWindow(slideId);
|
|
842
|
-
|
|
899
|
+
present('window');
|
|
843
900
|
}}
|
|
844
901
|
>
|
|
845
902
|
<MonitorSpeaker />
|
|
@@ -862,6 +919,7 @@ export function Slide() {
|
|
|
862
919
|
<DesignProvider slideId={slideId}>
|
|
863
920
|
<div className="relative flex min-h-0 flex-1 flex-col">
|
|
864
921
|
<div className="flex min-h-0 flex-1 flex-col md:flex-row">
|
|
922
|
+
<SlideExtensions slideId={slideId} overviewOpen={overviewOpen} />
|
|
865
923
|
<ResizableRail
|
|
866
924
|
pages={pages}
|
|
867
925
|
design={slide.design}
|
|
@@ -871,11 +929,6 @@ export function Slide() {
|
|
|
871
929
|
actions={thumbnailActions}
|
|
872
930
|
moduleTransition={slide.transition}
|
|
873
931
|
onOverview={() => setOverviewOpen(true)}
|
|
874
|
-
onBoard={
|
|
875
|
-
import.meta.env.DEV
|
|
876
|
-
? () => navigate(`/s/${encodeURIComponent(slideId)}/board`)
|
|
877
|
-
: undefined
|
|
878
|
-
}
|
|
879
932
|
/>
|
|
880
933
|
<main
|
|
881
934
|
ref={slideViewportRef}
|
|
@@ -967,11 +1020,11 @@ export function Slide() {
|
|
|
967
1020
|
currentIndex={index}
|
|
968
1021
|
exporting={exporting}
|
|
969
1022
|
handlers={{
|
|
970
|
-
onPresentWindow: () =>
|
|
971
|
-
onPresentFullscreen: () =>
|
|
1023
|
+
onPresentWindow: () => present('window'),
|
|
1024
|
+
onPresentFullscreen: () => present('fullscreen'),
|
|
972
1025
|
onPresenterView: () => {
|
|
973
1026
|
if (slideId) openPresenterWindow(slideId);
|
|
974
|
-
|
|
1027
|
+
present('window');
|
|
975
1028
|
},
|
|
976
1029
|
onCopyLink: copyLink,
|
|
977
1030
|
onOverview: () => setOverviewOpen(true),
|
|
@@ -986,6 +1039,7 @@ export function Slide() {
|
|
|
986
1039
|
/>
|
|
987
1040
|
)}
|
|
988
1041
|
</div>
|
|
1042
|
+
<PresentCurtain opaque={curtain !== null} className="fixed z-[1000]" />
|
|
989
1043
|
</InspectorProvider>
|
|
990
1044
|
</HistoryProvider>
|
|
991
1045
|
);
|
|
@@ -1005,7 +1059,6 @@ function ResizableRail(props: {
|
|
|
1005
1059
|
actions?: ThumbnailActions;
|
|
1006
1060
|
moduleTransition?: SlideModule['transition'];
|
|
1007
1061
|
onOverview?: () => void;
|
|
1008
|
-
onBoard?: () => void;
|
|
1009
1062
|
}) {
|
|
1010
1063
|
const t = useLocale();
|
|
1011
1064
|
const [width, setWidth] = useStoredWidth(
|
package/src/app/styles.css
CHANGED
package/src/locale/en.ts
CHANGED
|
@@ -178,6 +178,7 @@ export const en: Locale = {
|
|
|
178
178
|
helpAria: 'Keyboard shortcuts (?)',
|
|
179
179
|
exitAria: 'Exit (Esc)',
|
|
180
180
|
elapsedTime: 'Elapsed time',
|
|
181
|
+
lastSlideHint: 'Last slide · Press Esc to exit',
|
|
181
182
|
helpEyebrow: 'Present mode',
|
|
182
183
|
helpTitle: 'Keyboard shortcuts',
|
|
183
184
|
shortcutNext: 'Next slide',
|
|
@@ -454,41 +455,6 @@ export const en: Locale = {
|
|
|
454
455
|
scrollDownToCurrentPage: 'Scroll down to current page {n}',
|
|
455
456
|
},
|
|
456
457
|
|
|
457
|
-
board: {
|
|
458
|
-
title: 'Story board',
|
|
459
|
-
openBoard: 'Story board (B)',
|
|
460
|
-
backToDeck: 'Back to deck',
|
|
461
|
-
hint: 'Drag a card to reorder · Double-click to edit the page · Drag the dot to link two cards',
|
|
462
|
-
loading: 'Loading deck…',
|
|
463
|
-
columnFallback: 'Part {n}',
|
|
464
|
-
moveToEnd: 'Move to end',
|
|
465
|
-
reorderFailed: 'Could not reorder pages',
|
|
466
|
-
zoomIn: 'Zoom in',
|
|
467
|
-
zoomOut: 'Zoom out',
|
|
468
|
-
fitView: 'Fit to view',
|
|
469
|
-
saveFailed: 'Could not save the board layout',
|
|
470
|
-
renameColumn: 'Rename this column',
|
|
471
|
-
columnTitlePlaceholder: 'Column name',
|
|
472
|
-
addPage: 'Add a page to this column (copies the last one)',
|
|
473
|
-
notesPlaceholder: 'Speaker notes…',
|
|
474
|
-
/** template: "Added a blank page at {n}" */
|
|
475
|
-
toastInserted: 'Added a blank page at {n}',
|
|
476
|
-
insertFailed: 'Could not add a page',
|
|
477
|
-
cardTitlePlaceholder: 'Name this card',
|
|
478
|
-
renameCard: 'Rename this card',
|
|
479
|
-
status: 'Status',
|
|
480
|
-
statusNone: 'No status',
|
|
481
|
-
statusTodo: 'To do',
|
|
482
|
-
statusDoing: 'In progress',
|
|
483
|
-
statusReview: 'In review',
|
|
484
|
-
statusDone: 'Done',
|
|
485
|
-
memoPlaceholder: 'Work memo — stays on the board…',
|
|
486
|
-
linkHandle: 'Drag onto another card to link them',
|
|
487
|
-
showLinks: 'Show links',
|
|
488
|
-
hideLinks: 'Hide links',
|
|
489
|
-
removeLink: 'Remove this link',
|
|
490
|
-
},
|
|
491
|
-
|
|
492
458
|
pdfToast: {
|
|
493
459
|
title: 'Exporting PDF',
|
|
494
460
|
processing: 'Processing page {current} of {total}',
|