@lemonriver/core 1.1.0 → 1.3.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.
Files changed (98) hide show
  1. package/dist/{build-Dm7gVRhb.js → build-CSkdswfd.js} +1 -1
  2. package/dist/cli/bin.js +5 -5
  3. package/dist/{config-CubOIzrs.js → config-C5-myPY6.js} +129 -2
  4. package/dist/{dev-DgLeXPqp.js → dev-DHtYH8sw.js} +2 -2
  5. package/dist/{mcp-CjYDzcJa.js → mcp-B2UeO1un.js} +1 -1
  6. package/dist/{preview-CxXQpPk5.js → preview-C1B6-umF.js} +1 -1
  7. package/dist/{update-b1dSg_FW.js → update-DzL8fpcI.js} +1 -1
  8. package/dist/vite/index.js +1 -1
  9. package/package.json +5 -2
  10. package/release-notes.json +33 -0
  11. package/src/app/components/player.tsx +6 -1
  12. package/src/app/lemonriver/chrome/app-chrome.tsx +52 -0
  13. package/src/app/lemonriver/chrome/sidebar-extras.tsx +8 -1
  14. package/src/app/lemonriver/feedback/dialog.tsx +222 -0
  15. package/src/app/lemonriver/feedback/export.ts +21 -2
  16. package/src/app/lemonriver/feedback/first-success.ts +30 -0
  17. package/src/app/lemonriver/feedback/install.ts +18 -0
  18. package/src/app/lemonriver/feedback/model.ts +88 -0
  19. package/src/app/lemonriver/help/help-page.tsx +16 -1
  20. package/src/app/lemonriver/links.ts +16 -0
  21. package/src/app/lemonriver/present/dual-screen.ts +154 -0
  22. package/src/app/lemonriver/present/presenter-blocked-hint.tsx +28 -0
  23. package/src/app/lemonriver/present/wake-lock.ts +74 -0
  24. package/src/app/lemonriver/settings/backup-section.tsx +13 -0
  25. package/src/app/lemonriver/settings/settings-page.tsx +20 -0
  26. package/src/app/lemonriver/share/editor-share.tsx +6 -3
  27. package/src/app/lemonriver/share/share-dialog.tsx +2 -0
  28. package/src/app/lemonriver/text/en.ts +48 -0
  29. package/src/app/lemonriver/text/es.ts +45 -0
  30. package/src/app/lemonriver/text/ja.ts +44 -0
  31. package/src/app/lemonriver/text/types.ts +48 -0
  32. package/src/app/lemonriver/text/zh-cn.ts +48 -0
  33. package/src/app/lemonriver/text/zh-tw.ts +48 -0
  34. package/src/app/lemonriver/theme/pages.ts +4 -0
  35. package/src/app/lemonriver/update/release-notes.ts +22 -0
  36. package/src/app/lemonriver/update/update-prompt.tsx +28 -4
  37. package/src/app/routes/presenter.tsx +2 -0
  38. package/src/app/routes/slide.tsx +14 -1
  39. package/src/app/components/note-markdown.test.tsx +0 -42
  40. package/src/app/components/thumbnail-rail-scroll.test.ts +0 -60
  41. package/src/app/lemonriver/agent-prefs/prefs.test.ts +0 -173
  42. package/src/app/lemonriver/backup/guide.test.ts +0 -45
  43. package/src/app/lemonriver/backup/model.test.ts +0 -108
  44. package/src/app/lemonriver/backup/places.test.ts +0 -154
  45. package/src/app/lemonriver/board/blocks/classify.test.ts +0 -209
  46. package/src/app/lemonriver/board/layout.test.ts +0 -245
  47. package/src/app/lemonriver/board/model/agent-tasks.test.ts +0 -200
  48. package/src/app/lemonriver/board/model/apply-prompt.test.ts +0 -121
  49. package/src/app/lemonriver/board/model/cards.test.ts +0 -332
  50. package/src/app/lemonriver/board/model/changes.test.ts +0 -244
  51. package/src/app/lemonriver/board/model/filter.test.ts +0 -50
  52. package/src/app/lemonriver/board/model/history.test.ts +0 -71
  53. package/src/app/lemonriver/board/model/restructure.test.ts +0 -205
  54. package/src/app/lemonriver/board/model/self-check.test.ts +0 -329
  55. package/src/app/lemonriver/board/model/structure.test.ts +0 -350
  56. package/src/app/lemonriver/board/model/timing.test.ts +0 -113
  57. package/src/app/lemonriver/features.test.ts +0 -49
  58. package/src/app/lemonriver/feedback/pending-toast.test.ts +0 -44
  59. package/src/app/lemonriver/feedback/upload.test.ts +0 -26
  60. package/src/app/lemonriver/help/model.test.ts +0 -179
  61. package/src/app/lemonriver/home/brief.test.ts +0 -38
  62. package/src/app/lemonriver/home/drafts.test.ts +0 -23
  63. package/src/app/lemonriver/home/sorting.test.ts +0 -24
  64. package/src/app/lemonriver/home/time.test.ts +0 -33
  65. package/src/app/lemonriver/outline/files.test.ts +0 -90
  66. package/src/app/lemonriver/outline/model.test.ts +0 -751
  67. package/src/app/lemonriver/public-links.test.ts +0 -32
  68. package/src/app/lemonriver/routes.test.tsx +0 -54
  69. package/src/app/lemonriver/share/codes.test.ts +0 -49
  70. package/src/app/lemonriver/share/compare.test.ts +0 -199
  71. package/src/app/lemonriver/share/folder.test.ts +0 -42
  72. package/src/app/lemonriver/share/guide.test.ts +0 -78
  73. package/src/app/lemonriver/share/naming.test.ts +0 -70
  74. package/src/app/lemonriver/share/paths.test.ts +0 -116
  75. package/src/app/lemonriver/share/pdf.test.ts +0 -79
  76. package/src/app/lemonriver/templates/knobs.test.ts +0 -62
  77. package/src/app/lemonriver/templates/model.test.ts +0 -175
  78. package/src/app/lemonriver/templates/preview-content.test.ts +0 -117
  79. package/src/app/lemonriver/templates/recommend.test.ts +0 -71
  80. package/src/app/lemonriver/text/text.test.ts +0 -90
  81. package/src/app/lemonriver/theme/pages.test.ts +0 -74
  82. package/src/app/lemonriver/theme/themes.test.ts +0 -18
  83. package/src/app/lemonriver/trash/api.test.ts +0 -19
  84. package/src/app/lemonriver/update/prompt.test.ts +0 -84
  85. package/src/app/lemonriver/update/version.test.ts +0 -14
  86. package/src/app/lib/asset-filter.test.ts +0 -176
  87. package/src/app/lib/inspector/fiber.test.ts +0 -154
  88. package/src/app/lib/inspector/geometry.test.ts +0 -324
  89. package/src/app/lib/inspector/text-edit-timeline.test.ts +0 -121
  90. package/src/app/lib/note-markdown.test.ts +0 -147
  91. package/src/app/lib/pptx/css.test.ts +0 -205
  92. package/src/app/lib/pptx/ooxml.test.ts +0 -199
  93. package/src/app/lib/pptx/text-lines.test.ts +0 -82
  94. package/src/app/lib/print-ready.test.ts +0 -32
  95. package/src/app/lib/sdk.test.ts +0 -13
  96. package/src/app/lib/transition.test.ts +0 -31
  97. package/src/app/lib/use-document-title.test.ts +0 -14
  98. package/src/app/lib/utils.test.ts +0 -49
@@ -1,7 +1,26 @@
1
+ import { createElement } from 'react';
2
+ import { Button } from '@/components/ui/button';
1
3
  import type { Locale } from '../../../locale/types';
2
4
  import { lrTextFor } from '../text/all';
5
+ import { openFeedback } from './dialog';
3
6
 
4
7
  /** What to tell someone whose export just failed, under the official message. */
5
- export function exportFailedHint(t: Locale): string {
6
- return lrTextFor(t.id).feedback.exportFailedHint;
8
+ export function exportFailedHint(t: Locale) {
9
+ const lr = lrTextFor(t.id);
10
+ return createElement(
11
+ 'span',
12
+ { className: 'flex flex-col items-start gap-1.5' },
13
+ createElement('span', null, lr.feedback.exportFailedHint),
14
+ createElement(
15
+ Button,
16
+ {
17
+ type: 'button',
18
+ variant: 'outline',
19
+ size: 'sm',
20
+ onClick: () => openFeedback({ category: 'issue', errorKind: 'export' }),
21
+ ...({ 'data-lr-feedback-this': '' } as Record<string, string>),
22
+ },
23
+ lr.feedback.feedbackThis,
24
+ ),
25
+ );
7
26
  }
@@ -0,0 +1,30 @@
1
+ const ASKED_KEY = 'lemonriver:feedback-asked';
2
+
3
+ export function feedbackAsked(): boolean {
4
+ try {
5
+ return localStorage.getItem(ASKED_KEY) === '1';
6
+ } catch {
7
+ return true;
8
+ }
9
+ }
10
+
11
+ export function markFeedbackAsked(): void {
12
+ try {
13
+ localStorage.setItem(ASKED_KEY, '1');
14
+ } catch {}
15
+ }
16
+
17
+ type Listener = () => void;
18
+ let listener: Listener | null = null;
19
+
20
+ /** AppChrome owns the toast; everything that finishes an export just pings it. */
21
+ export function onFirstSuccess(notify: Listener): () => void {
22
+ listener = notify;
23
+ return () => {
24
+ if (listener === notify) listener = null;
25
+ };
26
+ }
27
+
28
+ export function noteSuccess(): void {
29
+ listener?.();
30
+ }
@@ -0,0 +1,18 @@
1
+ import type { InstallKind } from './model';
2
+
3
+ export type WorkspaceSignals = { install: InstallKind; os: string | null };
4
+
5
+ /** What the dev server can tell about this machine; the browser cannot. */
6
+ export async function workspaceSignals(): Promise<WorkspaceSignals> {
7
+ try {
8
+ const res = await fetch('/__lr/workspace');
9
+ if (!res.ok) return { install: 'unknown', os: null };
10
+ const body = (await res.json()) as { install?: unknown; os?: unknown };
11
+ return {
12
+ install: body.install === 'app' || body.install === 'cli' ? body.install : 'unknown',
13
+ os: typeof body.os === 'string' && body.os !== '' ? body.os : null,
14
+ };
15
+ } catch {
16
+ return { install: 'unknown', os: null };
17
+ }
18
+ }
@@ -0,0 +1,88 @@
1
+ import type { LrPage } from '../theme/pages';
2
+
3
+ export type FeedbackCategory = 'issue' | 'idea' | 'other';
4
+
5
+ export type FeedbackErrorKind = 'export' | 'update' | 'backup';
6
+
7
+ export type InstallKind = 'app' | 'cli' | 'unknown';
8
+
9
+ export type FeedbackPageKind =
10
+ | 'home'
11
+ | 'editor'
12
+ | 'board'
13
+ | 'outline'
14
+ | 'settings'
15
+ | 'help'
16
+ | 'other';
17
+
18
+ export type FeedbackRequest = {
19
+ category?: FeedbackCategory;
20
+ errorKind?: FeedbackErrorKind | null;
21
+ };
22
+
23
+ export type FeedbackInput = {
24
+ version: string;
25
+ /** The macOS label read from the browser, or null when it could not be read. */
26
+ os: string | null;
27
+ install: InstallKind;
28
+ page: LrPage;
29
+ errorKind: FeedbackErrorKind | null;
30
+ /**
31
+ * Whatever the failure carried. Never written into the text: it may hold a
32
+ * file path or a slide title, so only the kind above reaches the copy.
33
+ */
34
+ error?: unknown;
35
+ };
36
+
37
+ export type FeedbackLabels = {
38
+ fields: { version: string; os: string; install: string; page: string; error: string };
39
+ separator: string;
40
+ unknown: string;
41
+ installs: Record<InstallKind, string>;
42
+ pages: Record<FeedbackPageKind, string>;
43
+ errors: Record<FeedbackErrorKind, string>;
44
+ };
45
+
46
+ const PAGE_KINDS: Readonly<Record<string, FeedbackPageKind>> = {
47
+ home: 'home',
48
+ editor: 'editor',
49
+ board: 'board',
50
+ outline: 'outline',
51
+ settings: 'settings',
52
+ help: 'help',
53
+ };
54
+
55
+ export function feedbackPageKind(page: LrPage): FeedbackPageKind {
56
+ return PAGE_KINDS[page] ?? 'other';
57
+ }
58
+
59
+ /** The label for the version the dev server read; null drops to "unknown". */
60
+ export function osLabelFor(version: string | null): string | null {
61
+ return version === null || version === '' ? null : `macOS ${version}`;
62
+ }
63
+
64
+ /**
65
+ * The only description of a failure the feedback ever carries: which kind it
66
+ * was. Whatever else sits on the error (messages, paths, titles) is ignored.
67
+ */
68
+ export function errorKindOf(errorKind: FeedbackErrorKind | null | undefined): FeedbackErrorKind {
69
+ return errorKind === 'update' || errorKind === 'backup' ? errorKind : 'export';
70
+ }
71
+
72
+ export function buildFeedbackInfo(input: FeedbackInput, labels: FeedbackLabels): string {
73
+ const sep = labels.separator;
74
+ const lines = [
75
+ `${labels.fields.version}${sep}${input.version}`,
76
+ `${labels.fields.os}${sep}${input.os ?? labels.unknown}`,
77
+ `${labels.fields.install}${sep}${labels.installs[input.install]}`,
78
+ `${labels.fields.page}${sep}${labels.pages[feedbackPageKind(input.page)]}`,
79
+ ];
80
+ if (input.errorKind) {
81
+ lines.push(`${labels.fields.error}${sep}${labels.errors[input.errorKind]}`);
82
+ }
83
+ return lines.join('\n');
84
+ }
85
+
86
+ export function mailtoHref(email: string, subject: string, body: string): string {
87
+ return `mailto:${email}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(body)}`;
88
+ }
@@ -4,6 +4,7 @@ import { Link, useLocation } from 'react-router-dom';
4
4
  import { format } from '@/lib/use-locale';
5
5
  import { cn } from '@/lib/utils';
6
6
  import { markGuideSeen } from '../guide/state';
7
+ import { SUPPORT_URL } from '../links';
7
8
  import { useLrText } from '../text';
8
9
  import { useReduceMotionSetting } from '../theme/motion';
9
10
  import {
@@ -192,6 +193,17 @@ function Index({ help }: { help: HelpContent }) {
192
193
  );
193
194
  }
194
195
 
196
+ /** Appends the support line to the guide's last section, only when there is somewhere to go. */
197
+ function withSupport(sections: HelpSection[], text: string): HelpSection[] {
198
+ if (SUPPORT_URL === '') return sections;
199
+ const lastGuide = [...sections].reverse().find((section) => section.parent === 'guide');
200
+ if (!lastGuide) return sections;
201
+ const block: HelpBlock = { kind: 'p', text: `${text} ${SUPPORT_URL}` };
202
+ return sections.map((section) =>
203
+ section === lastGuide ? { ...section, blocks: [...section.blocks, block] } : section,
204
+ );
205
+ }
206
+
195
207
  export function HelpPage() {
196
208
  const lr = useLrText();
197
209
  const help = lr.help;
@@ -200,7 +212,10 @@ export function HelpPage() {
200
212
  const [query, setQuery] = useState('');
201
213
  const [highlight, setHighlight] = useState<string | null>(null);
202
214
 
203
- const sections = useMemo(() => filterHelpSections(help.sections, query), [help.sections, query]);
215
+ const sections = useMemo(
216
+ () => filterHelpSections(withSupport(help.sections, lr.settings.supportText), query),
217
+ [help.sections, query, lr.settings.supportText],
218
+ );
204
219
  const searching = query.trim() !== '';
205
220
 
206
221
  const anchor = location.hash.replace(/^#/, '');
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The only place the feedback and support destinations live. Empty means the
3
+ * matching control stays hidden; filling it in needs no other change.
4
+ *
5
+ * Dev builds also read `window.__lrLinks` so the browser tests can try both the
6
+ * set and the empty state without a rebuild. Production ignores it.
7
+ */
8
+ function link(key: 'form' | 'email' | 'support', fallback: string): string {
9
+ if (!import.meta.env.DEV) return fallback;
10
+ const overrides = (globalThis as { __lrLinks?: Record<string, string | undefined> }).__lrLinks;
11
+ return overrides?.[key] ?? fallback;
12
+ }
13
+
14
+ export const FEEDBACK_FORM_URL = link('form', 'https://wj.qq.com/s2/28661011/5ixj');
15
+ export const FEEDBACK_EMAIL = link('email', 'lemonriver.slide@gmail.com');
16
+ export const SUPPORT_URL = link('support', '');
@@ -0,0 +1,154 @@
1
+ export type ScreenLike = {
2
+ isCurrent?: boolean;
3
+ left: number;
4
+ top: number;
5
+ width: number;
6
+ height: number;
7
+ availLeft: number;
8
+ availTop: number;
9
+ availWidth: number;
10
+ availHeight: number;
11
+ };
12
+
13
+ type ScreenDetailsLike = {
14
+ screens: ScreenLike[];
15
+ currentScreen: ScreenLike;
16
+ };
17
+
18
+ type WindowManagementApi = {
19
+ getScreenDetails?: () => Promise<ScreenDetailsLike>;
20
+ screen: ScreenLike & { isExtended?: boolean };
21
+ open: (url: string, name: string, features: string) => unknown;
22
+ };
23
+
24
+ export type PresenterPopupNotice = { slideId: string; blocked: boolean };
25
+
26
+ function windowApi(): WindowManagementApi | null {
27
+ return typeof window === 'undefined' ? null : (window as unknown as WindowManagementApi);
28
+ }
29
+
30
+ export function pickAudienceScreen<T extends ScreenLike>(
31
+ screens: readonly T[],
32
+ current: T | null | undefined,
33
+ ): T | null {
34
+ const others = screens.filter((screen) => screen !== current && !screen.isCurrent);
35
+ if (others.length === 0) return null;
36
+ return others.reduce((largest, screen) =>
37
+ screen.width * screen.height > largest.width * largest.height ? screen : largest,
38
+ );
39
+ }
40
+
41
+ export function supportsAudienceScreens(): boolean {
42
+ const win = windowApi();
43
+ return Boolean(win?.getScreenDetails) && win?.screen?.isExtended === true;
44
+ }
45
+
46
+ export async function resolveAudienceScreen(): Promise<ScreenLike | null> {
47
+ const win = windowApi();
48
+ if (!win?.getScreenDetails) return null;
49
+ try {
50
+ const details = await win.getScreenDetails();
51
+ return pickAudienceScreen(details.screens, details.currentScreen);
52
+ } catch {
53
+ return null;
54
+ }
55
+ }
56
+
57
+ let audienceScreen: ScreenLike | null = null;
58
+ let audienceSlideId: string | null = null;
59
+ let presenterOpened = false;
60
+
61
+ export function clearAudiencePresentation(): void {
62
+ audienceScreen = null;
63
+ audienceSlideId = null;
64
+ presenterOpened = false;
65
+ setPopupNotice(null);
66
+ }
67
+
68
+ // The browser only grants one user-activated action per click. Entering
69
+ // fullscreen has to happen first and the presenter window only once it
70
+ // resolved, or the popup consumes the click and fullscreen is refused.
71
+ export function requestPresentFullscreen(el: Element): void {
72
+ const options = audienceScreen
73
+ ? ({ screen: audienceScreen } as unknown as FullscreenOptions)
74
+ : undefined;
75
+ const request = el.requestFullscreen?.(options);
76
+ if (!request) return;
77
+ request.then(
78
+ () => openAudiencePresenter(),
79
+ () => {},
80
+ );
81
+ }
82
+
83
+ function openAudiencePresenter(): void {
84
+ const slideId = audienceSlideId;
85
+ const win = windowApi();
86
+ if (!audienceScreen || !slideId || presenterOpened || !win) return;
87
+ presenterOpened = true;
88
+ const blocked = !openPresenterPopup(slideId, win.screen);
89
+ setPopupNotice({ slideId, blocked });
90
+ }
91
+
92
+ export function openPresenterPopup(slideId: string, current: ScreenLike): boolean {
93
+ const win = windowApi();
94
+ if (!win) return false;
95
+ const url = `${import.meta.env.BASE_URL}s/${encodeURIComponent(slideId)}/presenter`;
96
+ const left = Math.round(current.availLeft ?? current.left);
97
+ const top = Math.round(current.availTop ?? current.top);
98
+ const width = Math.round(current.availWidth || current.width);
99
+ const height = Math.round(current.availHeight || current.height);
100
+ const features = `popup,left=${left},top=${top},width=${width},height=${height}`;
101
+ try {
102
+ return win.open(url, `open-slide-presenter-${slideId}`, features) !== null;
103
+ } catch {
104
+ return false;
105
+ }
106
+ }
107
+
108
+ let popupNotice: PresenterPopupNotice | null = null;
109
+ const popupListeners = new Set<() => void>();
110
+
111
+ function setPopupNotice(next: PresenterPopupNotice | null) {
112
+ popupNotice = next;
113
+ for (const listener of popupListeners) listener();
114
+ }
115
+
116
+ export function subscribePresenterPopupNotice(listener: () => void): () => void {
117
+ popupListeners.add(listener);
118
+ return () => {
119
+ popupListeners.delete(listener);
120
+ };
121
+ }
122
+
123
+ export function getPresenterPopupNotice(): PresenterPopupNotice | null {
124
+ return popupNotice;
125
+ }
126
+
127
+ export function retryPresenterPopup(slideId: string): void {
128
+ const win = windowApi();
129
+ if (!win) return;
130
+ if (openPresenterPopup(slideId, win.screen)) setPopupNotice({ slideId, blocked: false });
131
+ }
132
+
133
+ export async function startAudiencePresentation(
134
+ slideId: string | undefined,
135
+ enter: () => void,
136
+ ): Promise<void> {
137
+ audienceScreen = null;
138
+ audienceSlideId = null;
139
+ presenterOpened = false;
140
+ const win = windowApi();
141
+ if (!slideId || !win || !supportsAudienceScreens()) {
142
+ enter();
143
+ return;
144
+ }
145
+ const audience = await resolveAudienceScreen();
146
+ if (!audience) {
147
+ enter();
148
+ return;
149
+ }
150
+ audienceScreen = audience;
151
+ audienceSlideId = slideId;
152
+ setPopupNotice({ slideId, blocked: false });
153
+ enter();
154
+ }
@@ -0,0 +1,28 @@
1
+ import { useSyncExternalStore } from 'react';
2
+ import { useLrText } from '../text';
3
+ import {
4
+ getPresenterPopupNotice,
5
+ retryPresenterPopup,
6
+ subscribePresenterPopupNotice,
7
+ } from './dual-screen';
8
+
9
+ export function PresenterBlockedHint({ slideId }: { slideId: string }) {
10
+ const notice = useSyncExternalStore(
11
+ subscribePresenterPopupNotice,
12
+ getPresenterPopupNotice,
13
+ getPresenterPopupNotice,
14
+ );
15
+ const lr = useLrText();
16
+ if (!notice?.blocked || notice.slideId !== slideId) return null;
17
+ return (
18
+ <div className="pointer-events-none fixed inset-x-0 top-4 z-[70] flex justify-center px-4">
19
+ <button
20
+ type="button"
21
+ onClick={() => retryPresenterPopup(slideId)}
22
+ className="pointer-events-auto rounded-[6px] border border-white/20 bg-black/80 px-4 py-2 text-[13px] text-white shadow-lg backdrop-blur hover:bg-black/90"
23
+ >
24
+ {lr.present.presenterBlocked}
25
+ </button>
26
+ </div>
27
+ );
28
+ }
@@ -0,0 +1,74 @@
1
+ import { useEffect } from 'react';
2
+
3
+ type WakeLockSentinel = {
4
+ released: boolean;
5
+ release: () => Promise<void>;
6
+ addEventListener?: (type: 'release', listener: () => void) => void;
7
+ };
8
+
9
+ type WakeLockApi = {
10
+ request: (type: 'screen') => Promise<WakeLockSentinel>;
11
+ };
12
+
13
+ type VisibilitySource = {
14
+ visibilityState: string;
15
+ addEventListener: (type: 'visibilitychange', listener: () => void) => void;
16
+ removeEventListener: (type: 'visibilitychange', listener: () => void) => void;
17
+ };
18
+
19
+ export type WakeLockDeps = {
20
+ navigator?: { wakeLock?: WakeLockApi } | null;
21
+ document?: VisibilitySource | null;
22
+ };
23
+
24
+ export function holdScreenWakeLock(active: boolean, deps: WakeLockDeps = {}): () => void {
25
+ const nav =
26
+ deps.navigator ??
27
+ (typeof navigator === 'undefined' ? null : (navigator as { wakeLock?: WakeLockApi }));
28
+ const doc =
29
+ deps.document ?? (typeof document === 'undefined' ? null : (document as VisibilitySource));
30
+ const wakeLock = nav?.wakeLock;
31
+ if (!active || !wakeLock || !doc) return () => {};
32
+
33
+ let sentinel: WakeLockSentinel | null = null;
34
+ let disposed = false;
35
+
36
+ const acquire = () => {
37
+ if (disposed || sentinel) return;
38
+ wakeLock.request('screen').then(
39
+ (next) => {
40
+ if (disposed || sentinel) {
41
+ next.release().catch(() => {});
42
+ return;
43
+ }
44
+ sentinel = next;
45
+ next.addEventListener?.('release', () => {
46
+ if (sentinel === next) sentinel = null;
47
+ });
48
+ },
49
+ () => {},
50
+ );
51
+ };
52
+
53
+ const onVisibilityChange = () => {
54
+ if (doc.visibilityState !== 'visible') return;
55
+ if (sentinel && !sentinel.released) return;
56
+ sentinel = null;
57
+ acquire();
58
+ };
59
+
60
+ acquire();
61
+ doc.addEventListener('visibilitychange', onVisibilityChange);
62
+
63
+ return () => {
64
+ disposed = true;
65
+ doc.removeEventListener('visibilitychange', onVisibilityChange);
66
+ const current = sentinel;
67
+ sentinel = null;
68
+ current?.release().catch(() => {});
69
+ };
70
+ }
71
+
72
+ export function useScreenWakeLock(active: boolean): void {
73
+ useEffect(() => holdScreenWakeLock(active), [active]);
74
+ }
@@ -32,6 +32,7 @@ import {
32
32
  type PrefsSnapshot,
33
33
  } from '../backup/model';
34
34
  import { placeLabel } from '../backup/places';
35
+ import { openFeedback } from '../feedback/dialog';
35
36
  import { helpAnchorForPlace } from '../help/model';
36
37
  import { useLrText } from '../text';
37
38
  import { useReduceMotionSetting } from '../theme/motion';
@@ -417,6 +418,18 @@ export function BackupSection() {
417
418
  {b.reveal}
418
419
  </button>
419
420
  )}
421
+
422
+ {!running && last && !last.ok && (
423
+ <Button
424
+ type="button"
425
+ variant="outline"
426
+ size="sm"
427
+ data-lr-feedback-this
428
+ onClick={() => openFeedback({ category: 'issue', errorKind: 'backup' })}
429
+ >
430
+ {lr.feedback.feedbackThis}
431
+ </Button>
432
+ )}
420
433
  </div>
421
434
 
422
435
  {notice !== '' && (
@@ -9,6 +9,7 @@ import { AgentProvidersSection } from '../agent-providers/section';
9
9
  import { HelperMascot, type HelperRole } from '../brand/mascot';
10
10
  import { isFeatureEnabled } from '../features';
11
11
  import { GUIDE_SEEN_KEY } from '../guide/state';
12
+ import { SUPPORT_URL } from '../links';
12
13
  import { useLrText } from '../text';
13
14
  import { setReduceMotionSetting, useReduceMotionSetting } from '../theme/motion';
14
15
  import { LR_THEME_CHOICES, type LrThemeChoice } from '../theme/themes';
@@ -279,6 +280,25 @@ export function SettingsPage() {
279
280
  </button>
280
281
  </section>
281
282
  )}
283
+
284
+ {SUPPORT_URL !== '' && (
285
+ <section
286
+ data-lr-settings-support
287
+ className="mt-5 rounded-[16px] border border-border bg-card px-6 py-5 shadow-[var(--lr-shadow-1)]"
288
+ >
289
+ <h2 className="text-[16px] font-semibold">{lr.settings.supportTitle}</h2>
290
+ <p className="mt-1 text-[14px] text-muted-foreground">{lr.settings.supportText}</p>
291
+ <a
292
+ data-lr-settings-support-link
293
+ href={SUPPORT_URL}
294
+ target="_blank"
295
+ rel="noreferrer"
296
+ className="mt-3 inline-block rounded-[10px] border border-border bg-card px-3 py-1.5 text-[13px] font-medium outline-none hover:border-[var(--lr-text-3)] focus-visible:ring-2 focus-visible:ring-ring/40"
297
+ >
298
+ {lr.settings.supportButton}
299
+ </a>
300
+ </section>
301
+ )}
282
302
  </div>
283
303
  );
284
304
  }
@@ -37,13 +37,16 @@ export function ShareHeaderButton({ onOpen }: { onOpen: () => void }) {
37
37
  render={
38
38
  <Button
39
39
  size="sm"
40
- variant="outline"
40
+ variant="ghost"
41
41
  aria-keyshortcuts="S"
42
+ aria-label={lr.share.open}
42
43
  onClick={onOpen}
43
- className="border-[var(--lr-accent)] bg-[var(--lr-accent-soft)] text-[var(--lr-on-secondary)] hover:border-[var(--lr-accent)] hover:bg-[var(--lr-accent-soft)]"
44
44
  >
45
45
  <Share2 className="size-3.5" />
46
- {lr.share.open}
46
+ <span className="hidden lg:inline">{lr.share.open}</span>
47
+ <kbd className="ml-1 hidden rounded-[3px] bg-foreground/10 px-1 font-mono text-[9.5px] tracking-[0.04em] lg:inline">
48
+ S
49
+ </kbd>
47
50
  </Button>
48
51
  }
49
52
  />
@@ -15,6 +15,7 @@ import { format, useLocale } from '@/lib/use-locale';
15
15
  import { CANVAS_HEIGHT, CANVAS_WIDTH, type SlideModule } from '../../lib/sdk';
16
16
  import { loadSlide } from '../../lib/slides';
17
17
  import { isFeatureEnabled } from '../features';
18
+ import { noteSuccess } from '../feedback/first-success';
18
19
  import { useLrText } from '../text';
19
20
  import { CaptureCancelled, captureDeck, toBase64 } from './capture';
20
21
  import { appVersion, packShare, revealShared } from './client';
@@ -153,6 +154,7 @@ export function ShareDialog({
153
154
  workFiles: packed.workFiles,
154
155
  });
155
156
  setPhase('done');
157
+ noteSuccess();
156
158
  } catch (err) {
157
159
  if (err instanceof CaptureCancelled || controller.signal.aborted) {
158
160
  setPhase('idle');
@@ -221,6 +221,10 @@ export const enHelp: LrText['help'] = {
221
221
  strong: 'My comments did nothing',
222
222
  text: ': comments are only notes until you tell the agent to “apply comments”.',
223
223
  },
224
+ {
225
+ strong: 'I want to suggest something or something went wrong',
226
+ text: ': choose “Feedback” in the sidebar.',
227
+ },
224
228
  ],
225
229
  },
226
230
  ],
@@ -954,6 +958,9 @@ export const en: LrText = {
954
958
  workspaceCopied: 'Copied',
955
959
  workspaceReveal: 'Show in Finder',
956
960
  workspaceCopiedToast: 'Workspace folder path copied',
961
+ supportTitle: 'Support LemonRiver',
962
+ supportText: 'LemonRiver is free to use. If it helps you, you can buy us a coffee.',
963
+ supportButton: 'Buy Me a Coffee',
957
964
  },
958
965
  agents: {
959
966
  title: 'Agents',
@@ -977,6 +984,42 @@ export const en: LrText = {
977
984
  uploadTooLargeHint: 'Compress the image or pick a smaller file, then upload again.',
978
985
  confirmWho: 'Lemon needs your call',
979
986
  confirmReview: 'Review needs your call',
987
+ sidebar: 'Feedback',
988
+ title: 'Feedback',
989
+ intro: 'These details go along with it. Your slides and file locations never do.',
990
+ categoryIssue: 'Something went wrong',
991
+ categoryIdea: 'A feature I want',
992
+ categoryOther: 'Something else',
993
+ fieldVersion: 'Version',
994
+ fieldOs: 'System',
995
+ fieldInstall: 'Installed with',
996
+ fieldPage: 'Page',
997
+ fieldError: 'Error',
998
+ separator: ': ',
999
+ unknown: 'Unknown',
1000
+ installApp: 'Installer',
1001
+ installCli: 'Command line',
1002
+ pageHome: 'Home',
1003
+ pageEditor: 'Editor',
1004
+ pageBoard: 'Story board',
1005
+ pageOutline: 'Outline',
1006
+ pageSettings: 'Settings',
1007
+ pageHelp: 'Help',
1008
+ pageOther: 'Another page',
1009
+ errorExport: 'Export failed',
1010
+ errorUpdate: 'Update failed',
1011
+ errorBackup: 'Backup failed',
1012
+ openForm: 'Open the form',
1013
+ sendEmail: 'Send email',
1014
+ copyInfo: 'Copy these details',
1015
+ copied: 'Copied. Paste it into the form.',
1016
+ noChannel: 'Feedback is not open yet.',
1017
+ mailSubject: 'LemonRiver feedback: {category}',
1018
+ mailBodyPlaceholder: '(Write your feedback here)',
1019
+ feedbackThis: 'Report this problem',
1020
+ firstSuccessTitle: 'Did that go smoothly?',
1021
+ smooth: 'Smooth',
1022
+ notSmooth: 'Not quite',
980
1023
  },
981
1024
  prefs: {
982
1025
  title: 'Agent preferences',
@@ -1041,6 +1084,8 @@ export const en: LrText = {
1041
1084
  'Restart the server now. Until you do, pages you have not opened yet may not open.',
1042
1085
  updatedManual:
1043
1086
  'Run the start command again. Until you do, pages you have not opened yet may not open.',
1087
+ releaseNotes: 'This version: {first}',
1088
+ releaseNotesMore: 'This version: {first} and {n} more',
1044
1089
  restartNeeded: 'LemonRiver has updated. Restart the server to open this page.',
1045
1090
  restart: 'Restart server',
1046
1091
  failed: "The update didn't go through",
@@ -1323,4 +1368,7 @@ export const en: LrText = {
1323
1368
  executablesHint: 'Only restore it if you made this backup yourself.',
1324
1369
  executablesConfirm: 'I made this backup myself',
1325
1370
  },
1371
+ present: {
1372
+ presenterBlocked: 'The presenter view was blocked by your browser. Click here to open it.',
1373
+ },
1326
1374
  };