@lemonriver/core 1.0.2 → 1.2.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-DYN-H65n.js → build-CSkdswfd.js} +1 -1
- package/dist/cli/bin.js +5 -5
- package/dist/{config-DW1wSoxa.js → config-C5-myPY6.js} +2087 -1439
- package/dist/{dev-_VDoRfAK.js → dev-DHtYH8sw.js} +2 -2
- package/dist/{mcp-CjYDzcJa.js → mcp-B2UeO1un.js} +1 -1
- package/dist/{preview-CYIGh3Z8.js → preview-C1B6-umF.js} +1 -1
- package/dist/{update-b1dSg_FW.js → update-DzL8fpcI.js} +1 -1
- package/dist/vite/index.js +1 -1
- package/package.json +5 -2
- package/release-notes.json +19 -0
- package/src/app/components/command/slide-command-menu.tsx +0 -9
- package/src/app/lemonriver/backup/client.ts +25 -1
- package/src/app/lemonriver/backup/model.ts +63 -18
- package/src/app/lemonriver/board/board-page.tsx +2 -2
- package/src/app/lemonriver/chrome/app-chrome.tsx +52 -0
- package/src/app/lemonriver/chrome/sidebar-extras.tsx +8 -1
- package/src/app/lemonriver/feedback/dialog.tsx +222 -0
- package/src/app/lemonriver/feedback/export.ts +21 -2
- package/src/app/lemonriver/feedback/first-success.ts +30 -0
- package/src/app/lemonriver/feedback/install.ts +18 -0
- package/src/app/lemonriver/feedback/model.ts +88 -0
- package/src/app/lemonriver/help/help-page.tsx +16 -1
- package/src/app/lemonriver/help/model.ts +1 -1
- package/src/app/lemonriver/home/drafts.ts +57 -0
- package/src/app/lemonriver/home/home-page.tsx +94 -10
- package/src/app/lemonriver/home/organize-drafts.tsx +192 -0
- package/src/app/lemonriver/links.ts +16 -0
- package/src/app/lemonriver/outline/outline-page.tsx +8 -1
- package/src/app/lemonriver/settings/backup-restore-dialog.tsx +15 -1
- package/src/app/lemonriver/settings/backup-section.tsx +159 -28
- package/src/app/lemonriver/settings/settings-page.tsx +23 -0
- package/src/app/lemonriver/settings/workspace-card.tsx +53 -0
- package/src/app/lemonriver/settings/workspace.ts +37 -0
- package/src/app/lemonriver/share/editor-share.tsx +58 -0
- package/src/app/lemonriver/share/import-dialog.tsx +14 -0
- package/src/app/lemonriver/share/naming.ts +6 -1
- package/src/app/lemonriver/share/share-dialog.tsx +2 -0
- package/src/app/lemonriver/slide-extensions.tsx +37 -53
- package/src/app/lemonriver/text/en.ts +91 -11
- package/src/app/lemonriver/text/es.ts +81 -6
- package/src/app/lemonriver/text/ja.ts +80 -6
- package/src/app/lemonriver/text/types.ts +89 -6
- package/src/app/lemonriver/text/zh-cn.ts +92 -11
- package/src/app/lemonriver/text/zh-tw.ts +92 -11
- package/src/app/lemonriver/theme/pages.ts +4 -0
- package/src/app/lemonriver/update/beta-badge.tsx +69 -0
- package/src/app/lemonriver/update/release-notes.ts +22 -0
- package/src/app/lemonriver/update/update-prompt.tsx +28 -4
- package/src/app/lib/export-html.ts +5 -3
- package/src/app/lib/export-pptx.ts +5 -4
- package/src/app/routes/slide.tsx +6 -57
- package/src/app/components/note-markdown.test.tsx +0 -42
- package/src/app/components/thumbnail-rail-scroll.test.ts +0 -60
- package/src/app/lemonriver/agent-prefs/prefs.test.ts +0 -173
- package/src/app/lemonriver/backup/guide.test.ts +0 -45
- package/src/app/lemonriver/backup/model.test.ts +0 -96
- package/src/app/lemonriver/backup/places.test.ts +0 -154
- package/src/app/lemonriver/board/blocks/classify.test.ts +0 -209
- package/src/app/lemonriver/board/layout.test.ts +0 -245
- package/src/app/lemonriver/board/model/agent-tasks.test.ts +0 -200
- package/src/app/lemonriver/board/model/apply-prompt.test.ts +0 -121
- package/src/app/lemonriver/board/model/cards.test.ts +0 -332
- package/src/app/lemonriver/board/model/changes.test.ts +0 -244
- package/src/app/lemonriver/board/model/filter.test.ts +0 -50
- package/src/app/lemonriver/board/model/history.test.ts +0 -71
- package/src/app/lemonriver/board/model/restructure.test.ts +0 -205
- package/src/app/lemonriver/board/model/self-check.test.ts +0 -329
- package/src/app/lemonriver/board/model/structure.test.ts +0 -350
- package/src/app/lemonriver/board/model/timing.test.ts +0 -113
- package/src/app/lemonriver/features.test.ts +0 -49
- package/src/app/lemonriver/feedback/pending-toast.test.ts +0 -44
- package/src/app/lemonriver/feedback/upload.test.ts +0 -26
- package/src/app/lemonriver/help/model.test.ts +0 -179
- package/src/app/lemonriver/home/brief.test.ts +0 -38
- package/src/app/lemonriver/home/sorting.test.ts +0 -24
- package/src/app/lemonriver/home/time.test.ts +0 -33
- package/src/app/lemonriver/outline/files.test.ts +0 -90
- package/src/app/lemonriver/outline/model.test.ts +0 -751
- package/src/app/lemonriver/public-links.test.ts +0 -32
- package/src/app/lemonriver/routes.test.tsx +0 -54
- package/src/app/lemonriver/share/codes.test.ts +0 -49
- package/src/app/lemonriver/share/compare.test.ts +0 -199
- package/src/app/lemonriver/share/folder.test.ts +0 -42
- package/src/app/lemonriver/share/guide.test.ts +0 -78
- package/src/app/lemonriver/share/naming.test.ts +0 -59
- package/src/app/lemonriver/share/paths.test.ts +0 -116
- package/src/app/lemonriver/share/pdf.test.ts +0 -79
- package/src/app/lemonriver/templates/knobs.test.ts +0 -62
- package/src/app/lemonriver/templates/model.test.ts +0 -175
- package/src/app/lemonriver/templates/preview-content.test.ts +0 -117
- package/src/app/lemonriver/templates/recommend.test.ts +0 -71
- package/src/app/lemonriver/text/text.test.ts +0 -90
- package/src/app/lemonriver/theme/pages.test.ts +0 -74
- package/src/app/lemonriver/theme/themes.test.ts +0 -18
- package/src/app/lemonriver/trash/api.test.ts +0 -19
- package/src/app/lemonriver/update/prompt.test.ts +0 -84
- package/src/app/lemonriver/update/version.test.ts +0 -14
- package/src/app/lib/asset-filter.test.ts +0 -176
- package/src/app/lib/inspector/fiber.test.ts +0 -154
- package/src/app/lib/inspector/geometry.test.ts +0 -324
- package/src/app/lib/inspector/text-edit-timeline.test.ts +0 -121
- package/src/app/lib/note-markdown.test.ts +0 -147
- package/src/app/lib/pptx/css.test.ts +0 -205
- package/src/app/lib/pptx/ooxml.test.ts +0 -199
- package/src/app/lib/pptx/text-lines.test.ts +0 -82
- package/src/app/lib/print-ready.test.ts +0 -32
- package/src/app/lib/sdk.test.ts +0 -13
- package/src/app/lib/transition.test.ts +0 -31
- package/src/app/lib/use-document-title.test.ts +0 -14
- package/src/app/lib/utils.test.ts +0 -49
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { H as PKG_NAMES } from "./update-DzL8fpcI.js";
|
|
2
2
|
import { a as printUrls, c as startupDuration, i as printShortcutsHint, n as formatError, r as printHeader, s as shortcutsEnabled, t as createCliLogger } from "./cli/bin.js";
|
|
3
|
-
import { n as DEV_SUPERVISED_ENV, t as createViteConfig } from "./config-
|
|
3
|
+
import { n as DEV_SUPERVISED_ENV, t as createViteConfig } from "./config-C5-myPY6.js";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { existsSync } from "node:fs";
|
|
6
6
|
import { fork } from "node:child_process";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as SLIDE_ID_RE } from "./update-
|
|
1
|
+
import { b as SLIDE_ID_RE } from "./update-DzL8fpcI.js";
|
|
2
2
|
import { o as readVersion } from "./cli/bin.js";
|
|
3
3
|
import { t as callDevServer } from "./client-DpO_eR9X.js";
|
|
4
4
|
import { createInterface } from "node:readline";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as printUrls, c as startupDuration, i as printShortcutsHint, r as printHeader, s as shortcutsEnabled, t as createCliLogger } from "./cli/bin.js";
|
|
2
|
-
import { t as createViteConfig } from "./config-
|
|
2
|
+
import { t as createViteConfig } from "./config-C5-myPY6.js";
|
|
3
3
|
import { mergeConfig, preview as preview$1 } from "vite";
|
|
4
4
|
//#region src/cli/preview.ts
|
|
5
5
|
async function preview(opts = {}) {
|
|
@@ -1097,4 +1097,4 @@ function registerUpdateRoutes(server, ctx) {
|
|
|
1097
1097
|
});
|
|
1098
1098
|
}
|
|
1099
1099
|
//#endregion
|
|
1100
|
-
export { reorderNotesArrayInSource as A,
|
|
1100
|
+
export { reorderNotesArrayInSource as A, BIN_NAME as B, duplicatePageInDefaultExportInSource as C, removePageFromDefaultExportInSource as D, removeNotesElementInSource as E, validateSlideName as F, PKG_NAMES as H, declaredFrameworkSpecifier as I, readFrameworkDependency as L, rmSlideDir as M, slugifyTitle as N, renameSlideDir as O, updateMetaTitleInSource as P, isLoopbackRequest as R, duplicateNotesElementInSource as S, readMetaTitleInSource as T, isFrameworkSpecifier as U, CONFIG_FILES as V, writeManifest as _, json as a, SLIDE_ID_RE as b, readSlideSource as c, foldersManifestPath as d, newFolderId as f, validateReorder as g, validateName as h, BodyTooLargeError as i, resolveSlideEntry as j, reorderDefaultExportPagesInSource as k, resolveSlideEntryPath as l, validateIcon as m, registerUpdateRoutes as n, makeContext as o, readManifest as p, runCommand as r, readBody as s, detectPackageManager as t, FOLDER_ID_RE as u, shortId as v, duplicateSlideDir as w, createBlankSlideDir as x, BLANK_SLIDE_TITLE as y, validateMutationRequest as z };
|
package/dist/vite/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createViteConfig } from "../config-
|
|
1
|
+
import { t as createViteConfig } from "../config-C5-myPY6.js";
|
|
2
2
|
export { createViteConfig };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lemonriver/core",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "The LemonRiver runtime: deck viewer, story board, present mode, agent panel and export.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"bin.js",
|
|
29
29
|
"dist",
|
|
30
30
|
"env.d.ts",
|
|
31
|
-
"src/app",
|
|
31
|
+
"src/app/**/*.*",
|
|
32
32
|
"src/locale",
|
|
33
33
|
"src/agent/prompt.ts",
|
|
34
34
|
"src/agent/provider.ts",
|
|
@@ -36,7 +36,10 @@
|
|
|
36
36
|
"src/editing/placeholder-id.ts",
|
|
37
37
|
"!src/**/*.test.ts",
|
|
38
38
|
"!src/**/*.test.tsx",
|
|
39
|
+
"!src/**/__tests__/**",
|
|
40
|
+
"!src/**/__fixtures__/**",
|
|
39
41
|
"skills",
|
|
42
|
+
"release-notes.json",
|
|
40
43
|
"README.md"
|
|
41
44
|
],
|
|
42
45
|
"engines": {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"1.2.0": {
|
|
3
|
+
"zh-CN": [
|
|
4
|
+
"侧栏多了「反馈」,可以填问卷或发邮件告诉我们遇到的问题和想要的功能。",
|
|
5
|
+
"编辑页右上角的「分享」按钮改成和旁边按钮一样的样式。",
|
|
6
|
+
"更新完成后,这里会告诉你新版本改了什么。"
|
|
7
|
+
],
|
|
8
|
+
"zh-TW": [
|
|
9
|
+
"側欄多了「回饋」,可以填問卷或寄郵件告訴我們遇到的問題和想要的功能。",
|
|
10
|
+
"編輯頁右上角的「分享」按鈕改成和旁邊按鈕一樣的樣式。",
|
|
11
|
+
"更新完成後,這裡會告訴你新版本改了什麼。"
|
|
12
|
+
],
|
|
13
|
+
"en": [
|
|
14
|
+
"A new Feedback entry in the sidebar lets you tell us about problems and ideas by form or email.",
|
|
15
|
+
"The Share button in the editor now looks like the buttons beside it.",
|
|
16
|
+
"After an update, this notice tells you what the new version changed."
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
FileImage,
|
|
6
6
|
FileText,
|
|
7
7
|
Grid2x2,
|
|
8
|
-
Link2,
|
|
9
8
|
Maximize,
|
|
10
9
|
MonitorSpeaker,
|
|
11
10
|
Palette,
|
|
@@ -24,7 +23,6 @@ export type SlideCommandHandlers = {
|
|
|
24
23
|
onPresentWindow: () => void;
|
|
25
24
|
onPresentFullscreen: () => void;
|
|
26
25
|
onPresenterView: () => void;
|
|
27
|
-
onCopyLink: () => void;
|
|
28
26
|
onOverview: () => void;
|
|
29
27
|
onToggleDesignPanel: () => void;
|
|
30
28
|
onToggleAgentPanel: () => void;
|
|
@@ -82,13 +80,6 @@ export function SlideCommandMenu({
|
|
|
82
80
|
];
|
|
83
81
|
|
|
84
82
|
const deck: CommandSpec[] = [
|
|
85
|
-
{
|
|
86
|
-
id: 'copy-link',
|
|
87
|
-
label: t.slide.copyLink,
|
|
88
|
-
icon: <Link2 />,
|
|
89
|
-
keywords: ['copy', 'link', 'url', 'share'],
|
|
90
|
-
run: handlers.onCopyLink,
|
|
91
|
-
},
|
|
92
83
|
{
|
|
93
84
|
id: 'overview',
|
|
94
85
|
label: t.commandMenu.overview,
|
|
@@ -4,6 +4,7 @@ import type {
|
|
|
4
4
|
BackupPlace,
|
|
5
5
|
BackupPreview,
|
|
6
6
|
BackupSettings,
|
|
7
|
+
BackupSummary,
|
|
7
8
|
PrefsSnapshot,
|
|
8
9
|
} from './model';
|
|
9
10
|
|
|
@@ -28,7 +29,7 @@ export async function backupSettings(): Promise<{ settings: BackupSettings; dir:
|
|
|
28
29
|
export async function saveBackupSettings(patch: {
|
|
29
30
|
folder?: string | null;
|
|
30
31
|
auto?: boolean;
|
|
31
|
-
|
|
32
|
+
skipLargeVideos?: boolean;
|
|
32
33
|
}): Promise<{ ok: true; settings: BackupSettings } | { ok: false; code: string }> {
|
|
33
34
|
const response = await fetch('/__lr/backup/settings', {
|
|
34
35
|
method: 'POST',
|
|
@@ -77,6 +78,29 @@ export async function backupList(): Promise<BackupListItem[]> {
|
|
|
77
78
|
return data.backups;
|
|
78
79
|
}
|
|
79
80
|
|
|
81
|
+
export async function backupSummary(): Promise<BackupSummary> {
|
|
82
|
+
const data = await call<{ summary: BackupSummary }>('GET', '/__lr/backup/summary');
|
|
83
|
+
return data.summary;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export type ExportAnswer =
|
|
87
|
+
| { ok: true; path: string; size: number }
|
|
88
|
+
| { cancelled: true }
|
|
89
|
+
| { unsupported: true };
|
|
90
|
+
|
|
91
|
+
export async function exportBackup(snapshot: string, locale: string): Promise<ExportAnswer> {
|
|
92
|
+
const response = await fetch('/__lr/backup/export', {
|
|
93
|
+
method: 'POST',
|
|
94
|
+
headers: { 'content-type': 'application/json' },
|
|
95
|
+
body: JSON.stringify({ snapshot, locale }),
|
|
96
|
+
});
|
|
97
|
+
const data = (await response.json().catch(() => ({}))) as ExportAnswer & { error?: string };
|
|
98
|
+
if (response.status === 501 || 'unsupported' in data) return { unsupported: true };
|
|
99
|
+
if ('cancelled' in data) return { cancelled: true };
|
|
100
|
+
if (!response.ok || !('path' in data)) throw new Error(data?.error ?? `HTTP ${response.status}`);
|
|
101
|
+
return data;
|
|
102
|
+
}
|
|
103
|
+
|
|
80
104
|
export type InspectAnswer =
|
|
81
105
|
| { ok: true; path: string; preview: BackupPreview }
|
|
82
106
|
| { ok: false; code: string; detail: string };
|
|
@@ -6,8 +6,9 @@ export const BACKUP_FOLDER_NAME = 'LemonRiver 备份';
|
|
|
6
6
|
export const BACKUP_SETTINGS_FILE = 'backup.json';
|
|
7
7
|
export const BACKUP_PARTIAL_SUFFIX = '.partial';
|
|
8
8
|
|
|
9
|
-
export const
|
|
10
|
-
export const
|
|
9
|
+
export const KEEP_DAYS = 30;
|
|
10
|
+
export const LARGE_VIDEO_BYTES = 100 * 1024 * 1024;
|
|
11
|
+
const VIDEO_EXTENSIONS = new Set(['mp4', 'mov', 'webm', 'm4v', 'avi', 'mkv']);
|
|
11
12
|
export const DAY_MS = 24 * 60 * 60 * 1000;
|
|
12
13
|
const MIN_RETRY_MS = 60 * 60 * 1000;
|
|
13
14
|
|
|
@@ -52,21 +53,59 @@ export function isCompressedFile(name: string): boolean {
|
|
|
52
53
|
return ALREADY_COMPRESSED.has(name.slice(dot + 1).toLowerCase());
|
|
53
54
|
}
|
|
54
55
|
|
|
56
|
+
/** A video big enough that copying it into every backup would matter. */
|
|
57
|
+
export function isLargeVideo(name: string, size: number): boolean {
|
|
58
|
+
if (size <= LARGE_VIDEO_BYTES) return false;
|
|
59
|
+
const dot = name.lastIndexOf('.');
|
|
60
|
+
if (dot <= 0) return false;
|
|
61
|
+
return VIDEO_EXTENSIONS.has(name.slice(dot + 1).toLowerCase());
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type BackupSkipped = { rel: string; size: number; reason: 'large-video' };
|
|
65
|
+
|
|
55
66
|
export type BackupLast = {
|
|
56
67
|
at: number;
|
|
57
68
|
path: string;
|
|
58
69
|
size: number;
|
|
70
|
+
addedBytes: number;
|
|
59
71
|
ok: boolean;
|
|
60
72
|
error: string | null;
|
|
61
73
|
warnings: string[];
|
|
74
|
+
skipped: BackupSkipped[];
|
|
62
75
|
};
|
|
63
76
|
|
|
64
77
|
export type BackupSettings = {
|
|
65
78
|
folder: string | null;
|
|
66
79
|
auto: boolean;
|
|
67
|
-
|
|
80
|
+
skipLargeVideos: boolean;
|
|
81
|
+
last: BackupLast | null;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/** One file in a snapshot, addressed by the sha256 of its contents. */
|
|
85
|
+
export type BackupSnapshotFile = { sha256: string; size: number };
|
|
86
|
+
|
|
87
|
+
export const SNAPSHOT_FORMAT = 'lemonriver-backup';
|
|
88
|
+
export const SNAPSHOT_VERSION = 1;
|
|
89
|
+
|
|
90
|
+
export type BackupSnapshot = {
|
|
91
|
+
format: typeof SNAPSHOT_FORMAT;
|
|
92
|
+
version: typeof SNAPSHOT_VERSION;
|
|
93
|
+
createdAt: number;
|
|
94
|
+
app: { name: string; version: string };
|
|
95
|
+
files: Record<string, BackupSnapshotFile>;
|
|
96
|
+
decks: ShareDeckEntry[];
|
|
97
|
+
folders: Record<string, unknown>;
|
|
98
|
+
prefs: PrefsSnapshot;
|
|
99
|
+
skipped: BackupSkipped[];
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export type BackupBiggestFile = { rel: string; size: number; deck: string | null };
|
|
103
|
+
|
|
104
|
+
export type BackupSummary = {
|
|
105
|
+
totalBytes: number;
|
|
68
106
|
last: BackupLast | null;
|
|
69
|
-
|
|
107
|
+
biggest: BackupBiggestFile[];
|
|
108
|
+
skipLargeVideos: boolean;
|
|
70
109
|
};
|
|
71
110
|
|
|
72
111
|
export type BackupPlaceKind =
|
|
@@ -95,6 +134,7 @@ export type BackupJob = {
|
|
|
95
134
|
size?: number;
|
|
96
135
|
error?: string;
|
|
97
136
|
warnings?: string[];
|
|
137
|
+
skipped?: BackupSkipped[];
|
|
98
138
|
restored?: string[];
|
|
99
139
|
assetsKept?: number;
|
|
100
140
|
themesKept?: number;
|
|
@@ -120,6 +160,7 @@ export type BackupPreview = {
|
|
|
120
160
|
prefs: boolean;
|
|
121
161
|
size: number;
|
|
122
162
|
executables: string[];
|
|
163
|
+
skipped?: BackupSkipped[];
|
|
123
164
|
};
|
|
124
165
|
|
|
125
166
|
export type BackupListItem = {
|
|
@@ -127,15 +168,15 @@ export type BackupListItem = {
|
|
|
127
168
|
path: string;
|
|
128
169
|
size: number;
|
|
129
170
|
at: number;
|
|
130
|
-
|
|
171
|
+
kind: 'snapshot' | 'zip';
|
|
172
|
+
decks: number | null;
|
|
131
173
|
};
|
|
132
174
|
|
|
133
175
|
const EMPTY_SETTINGS: BackupSettings = {
|
|
134
176
|
folder: null,
|
|
135
177
|
auto: false,
|
|
136
|
-
|
|
178
|
+
skipLargeVideos: false,
|
|
137
179
|
last: null,
|
|
138
|
-
written: [],
|
|
139
180
|
};
|
|
140
181
|
|
|
141
182
|
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
@@ -151,6 +192,18 @@ function readWarnings(raw: unknown): string[] {
|
|
|
151
192
|
return raw.filter((item): item is string => typeof item === 'string' && item !== '');
|
|
152
193
|
}
|
|
153
194
|
|
|
195
|
+
function readSkipped(raw: unknown): BackupSkipped[] {
|
|
196
|
+
if (!Array.isArray(raw)) return [];
|
|
197
|
+
const out: BackupSkipped[] = [];
|
|
198
|
+
for (const item of raw) {
|
|
199
|
+
if (!isRecord(item) || typeof item.rel !== 'string' || item.rel === '') continue;
|
|
200
|
+
if (typeof item.size !== 'number' || item.size < 0) continue;
|
|
201
|
+
if (item.reason !== 'large-video') continue;
|
|
202
|
+
out.push({ rel: item.rel, size: item.size, reason: item.reason });
|
|
203
|
+
}
|
|
204
|
+
return out;
|
|
205
|
+
}
|
|
206
|
+
|
|
154
207
|
function readLast(raw: unknown): BackupLast | null {
|
|
155
208
|
if (!isRecord(raw)) return null;
|
|
156
209
|
if (typeof raw.at !== 'number' || !Number.isFinite(raw.at)) return null;
|
|
@@ -158,9 +211,11 @@ function readLast(raw: unknown): BackupLast | null {
|
|
|
158
211
|
at: raw.at,
|
|
159
212
|
path: typeof raw.path === 'string' ? raw.path : '',
|
|
160
213
|
size: typeof raw.size === 'number' && raw.size >= 0 ? raw.size : 0,
|
|
214
|
+
addedBytes: typeof raw.addedBytes === 'number' && raw.addedBytes >= 0 ? raw.addedBytes : 0,
|
|
161
215
|
ok: raw.ok === true,
|
|
162
216
|
error: typeof raw.error === 'string' && raw.error !== '' ? raw.error : null,
|
|
163
217
|
warnings: readWarnings(raw.warnings),
|
|
218
|
+
skipped: readSkipped(raw.skipped),
|
|
164
219
|
};
|
|
165
220
|
}
|
|
166
221
|
|
|
@@ -170,21 +225,11 @@ export function sanitizeSettings(raw: unknown): BackupSettings {
|
|
|
170
225
|
typeof raw.folder === 'string' && isAbsolutePath(raw.folder)
|
|
171
226
|
? raw.folder.replace(/\/+$/, '')
|
|
172
227
|
: null;
|
|
173
|
-
const keep =
|
|
174
|
-
typeof raw.keep === 'number' && (KEEP_CHOICES as readonly number[]).includes(raw.keep)
|
|
175
|
-
? raw.keep
|
|
176
|
-
: DEFAULT_KEEP;
|
|
177
|
-
const written = Array.isArray(raw.written)
|
|
178
|
-
? raw.written.filter(
|
|
179
|
-
(name): name is string => typeof name === 'string' && name !== '' && !name.includes('/'),
|
|
180
|
-
)
|
|
181
|
-
: [];
|
|
182
228
|
return {
|
|
183
229
|
folder,
|
|
184
230
|
auto: raw.auto === true,
|
|
185
|
-
|
|
231
|
+
skipLargeVideos: raw.skipLargeVideos === true,
|
|
186
232
|
last: readLast(raw.last),
|
|
187
|
-
written: [...new Set(written)],
|
|
188
233
|
};
|
|
189
234
|
}
|
|
190
235
|
|
|
@@ -1096,7 +1096,7 @@ export function Board() {
|
|
|
1096
1096
|
|
|
1097
1097
|
const openPage = useCallback(
|
|
1098
1098
|
(index: number) => {
|
|
1099
|
-
navigate(`/s/${encodeURIComponent(slideId)}?p=${index + 1}
|
|
1099
|
+
navigate(`/s/${encodeURIComponent(slideId)}?p=${index + 1}`, { replace: true });
|
|
1100
1100
|
},
|
|
1101
1101
|
[navigate, slideId],
|
|
1102
1102
|
);
|
|
@@ -1147,7 +1147,7 @@ export function Board() {
|
|
|
1147
1147
|
variant="ghost"
|
|
1148
1148
|
size="icon-sm"
|
|
1149
1149
|
aria-label={lr.board.backToDeck}
|
|
1150
|
-
onClick={() => navigate(`/s/${encodeURIComponent(slideId)}
|
|
1150
|
+
onClick={() => navigate(`/s/${encodeURIComponent(slideId)}`, { replace: true })}
|
|
1151
1151
|
>
|
|
1152
1152
|
<ChevronLeft />
|
|
1153
1153
|
</Button>
|
|
@@ -2,6 +2,13 @@ import { useEffect } from 'react';
|
|
|
2
2
|
import { useLocation, useNavigate } from 'react-router-dom';
|
|
3
3
|
import { toast } from 'sonner';
|
|
4
4
|
import { format } from '@/lib/use-locale';
|
|
5
|
+
import { FeedbackHost, openFeedback } from '../feedback/dialog';
|
|
6
|
+
import {
|
|
7
|
+
feedbackAsked,
|
|
8
|
+
markFeedbackAsked,
|
|
9
|
+
noteSuccess,
|
|
10
|
+
onFirstSuccess,
|
|
11
|
+
} from '../feedback/first-success';
|
|
5
12
|
import { OfflineBanner } from '../feedback/offline-banner';
|
|
6
13
|
import { takePendingToast } from '../feedback/pending-toast';
|
|
7
14
|
import { Toaster } from '../feedback/toaster';
|
|
@@ -94,6 +101,49 @@ function useMcpResponder() {
|
|
|
94
101
|
useEffect(() => installMcpResponder(), []);
|
|
95
102
|
}
|
|
96
103
|
|
|
104
|
+
const FIRST_SUCCESS_TOAST = 'lr-feedback-first';
|
|
105
|
+
|
|
106
|
+
function useFirstSuccessPrompt() {
|
|
107
|
+
const lr = useLrText();
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
const notify = () => {
|
|
110
|
+
if (feedbackAsked()) return;
|
|
111
|
+
markFeedbackAsked();
|
|
112
|
+
toast(lr.feedback.firstSuccessTitle, {
|
|
113
|
+
id: FIRST_SUCCESS_TOAST,
|
|
114
|
+
duration: 12000,
|
|
115
|
+
action: {
|
|
116
|
+
label: lr.feedback.smooth,
|
|
117
|
+
onClick: () => toast.dismiss(FIRST_SUCCESS_TOAST),
|
|
118
|
+
},
|
|
119
|
+
cancel: {
|
|
120
|
+
label: lr.feedback.notSmooth,
|
|
121
|
+
onClick: () => {
|
|
122
|
+
toast.dismiss(FIRST_SUCCESS_TOAST);
|
|
123
|
+
openFeedback({ category: 'issue' });
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
const off = onFirstSuccess(notify);
|
|
129
|
+
// Exports leave no callback of ours behind: the browser download pops up an
|
|
130
|
+
// anchor with `download`, and the PDF path ends with afterprint.
|
|
131
|
+
const onClick = (event: MouseEvent) => {
|
|
132
|
+
if ((event.target as Element | null)?.closest?.('a[download]')) noteSuccess();
|
|
133
|
+
};
|
|
134
|
+
const onAfterPrint = () => {
|
|
135
|
+
if (document.getElementById('os-print-root')) noteSuccess();
|
|
136
|
+
};
|
|
137
|
+
document.addEventListener('click', onClick, true);
|
|
138
|
+
window.addEventListener('afterprint', onAfterPrint);
|
|
139
|
+
return () => {
|
|
140
|
+
off();
|
|
141
|
+
document.removeEventListener('click', onClick, true);
|
|
142
|
+
window.removeEventListener('afterprint', onAfterPrint);
|
|
143
|
+
};
|
|
144
|
+
}, [lr]);
|
|
145
|
+
}
|
|
146
|
+
|
|
97
147
|
/** Everything LemonRiver adds around the routes. Sits where the official toaster was. */
|
|
98
148
|
export function AppChrome() {
|
|
99
149
|
const reduceMotion = useReduceMotionSetting();
|
|
@@ -102,6 +152,7 @@ export function AppChrome() {
|
|
|
102
152
|
useDecksChangedReload();
|
|
103
153
|
usePendingToast();
|
|
104
154
|
useMcpResponder();
|
|
155
|
+
useFirstSuccessPrompt();
|
|
105
156
|
|
|
106
157
|
useEffect(() => {
|
|
107
158
|
applyReduceMotion(reduceMotion);
|
|
@@ -113,6 +164,7 @@ export function AppChrome() {
|
|
|
113
164
|
{import.meta.env.DEV && <OfflineBanner />}
|
|
114
165
|
<SidebarExtras />
|
|
115
166
|
<UpdatePrompt />
|
|
167
|
+
<FeedbackHost />
|
|
116
168
|
</>
|
|
117
169
|
);
|
|
118
170
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { BookOpen, LayoutTemplate, Plus, Settings, Trash2 } from 'lucide-react';
|
|
1
|
+
import { BookOpen, LayoutTemplate, MessageSquare, Plus, Settings, Trash2 } from 'lucide-react';
|
|
2
2
|
import { createPortal } from 'react-dom';
|
|
3
3
|
import { useLocation, useNavigate } from 'react-router-dom';
|
|
4
4
|
import { Button } from '@/components/ui/button';
|
|
5
5
|
import { useCreateDeck } from '@/lib/agent/use-agent';
|
|
6
6
|
import { isFeatureEnabled } from '../features';
|
|
7
|
+
import { openFeedback } from '../feedback/dialog';
|
|
7
8
|
import { useTemplateLibrary } from '../templates/use-library';
|
|
8
9
|
import { useLrText } from '../text';
|
|
9
10
|
import { pageForPath } from '../theme/pages';
|
|
@@ -60,6 +61,12 @@ export function SidebarExtras() {
|
|
|
60
61
|
onSelect={() => navigate('/help#guide')}
|
|
61
62
|
/>
|
|
62
63
|
)}
|
|
64
|
+
<NavRow
|
|
65
|
+
icon={<MessageSquare className="size-4" strokeWidth={1.75} />}
|
|
66
|
+
label={lr.feedback.sidebar}
|
|
67
|
+
current={false}
|
|
68
|
+
onSelect={() => openFeedback()}
|
|
69
|
+
/>
|
|
63
70
|
{isFeatureEnabled('settings') && (
|
|
64
71
|
<NavRow
|
|
65
72
|
icon={<Settings className="size-4" strokeWidth={1.75} />}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import { useLocation } from 'react-router-dom';
|
|
3
|
+
import { Button } from '@/components/ui/button';
|
|
4
|
+
import {
|
|
5
|
+
Dialog,
|
|
6
|
+
DialogContent,
|
|
7
|
+
DialogDescription,
|
|
8
|
+
DialogFooter,
|
|
9
|
+
DialogHeader,
|
|
10
|
+
DialogTitle,
|
|
11
|
+
} from '@/components/ui/dialog';
|
|
12
|
+
import { format } from '@/lib/use-locale';
|
|
13
|
+
import { FEEDBACK_EMAIL, FEEDBACK_FORM_URL } from '../links';
|
|
14
|
+
import { appVersion } from '../share/client';
|
|
15
|
+
import { useLrText } from '../text';
|
|
16
|
+
import { pageForPath } from '../theme/pages';
|
|
17
|
+
import { workspaceSignals } from './install';
|
|
18
|
+
import {
|
|
19
|
+
buildFeedbackInfo,
|
|
20
|
+
type FeedbackCategory,
|
|
21
|
+
type FeedbackErrorKind,
|
|
22
|
+
type FeedbackRequest,
|
|
23
|
+
type InstallKind,
|
|
24
|
+
mailtoHref,
|
|
25
|
+
osLabelFor,
|
|
26
|
+
} from './model';
|
|
27
|
+
|
|
28
|
+
const OPEN_EVENT = 'lemonriver:feedback-open';
|
|
29
|
+
|
|
30
|
+
export function openFeedback(request: FeedbackRequest = {}): void {
|
|
31
|
+
window.dispatchEvent(new CustomEvent(OPEN_EVENT, { detail: request }));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const CATEGORIES: FeedbackCategory[] = ['issue', 'idea', 'other'];
|
|
35
|
+
|
|
36
|
+
export function FeedbackHost() {
|
|
37
|
+
const lr = useLrText();
|
|
38
|
+
const { pathname } = useLocation();
|
|
39
|
+
const [request, setRequest] = useState<(FeedbackRequest & { page: string }) | null>(null);
|
|
40
|
+
const [category, setCategory] = useState<FeedbackCategory>('other');
|
|
41
|
+
const [version, setVersion] = useState('');
|
|
42
|
+
const [install, setInstall] = useState<InstallKind>('unknown');
|
|
43
|
+
const [osVersion, setOsVersion] = useState<string | null>(null);
|
|
44
|
+
const [copied, setCopied] = useState(false);
|
|
45
|
+
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
const onOpen = (event: Event) => {
|
|
48
|
+
const detail = (event as CustomEvent<FeedbackRequest>).detail ?? {};
|
|
49
|
+
setCategory(detail.category ?? 'other');
|
|
50
|
+
setCopied(false);
|
|
51
|
+
setRequest({ ...detail, page: pathname });
|
|
52
|
+
void appVersion()
|
|
53
|
+
.then(setVersion)
|
|
54
|
+
.catch(() => setVersion(''));
|
|
55
|
+
void workspaceSignals()
|
|
56
|
+
.then((signals) => {
|
|
57
|
+
setInstall(signals.install);
|
|
58
|
+
setOsVersion(signals.os);
|
|
59
|
+
})
|
|
60
|
+
.catch(() => {
|
|
61
|
+
setInstall('unknown');
|
|
62
|
+
setOsVersion(null);
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
window.addEventListener(OPEN_EVENT, onOpen);
|
|
66
|
+
return () => window.removeEventListener(OPEN_EVENT, onOpen);
|
|
67
|
+
}, [pathname]);
|
|
68
|
+
|
|
69
|
+
const f = lr.feedback;
|
|
70
|
+
const info = useMemo(
|
|
71
|
+
() =>
|
|
72
|
+
buildFeedbackInfo(
|
|
73
|
+
{
|
|
74
|
+
version: version || f.unknown,
|
|
75
|
+
os: osLabelFor(osVersion),
|
|
76
|
+
install,
|
|
77
|
+
page: pageForPath(request?.page ?? '/'),
|
|
78
|
+
errorKind: (request?.errorKind as FeedbackErrorKind | null | undefined) ?? null,
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
fields: {
|
|
82
|
+
version: f.fieldVersion,
|
|
83
|
+
os: f.fieldOs,
|
|
84
|
+
install: f.fieldInstall,
|
|
85
|
+
page: f.fieldPage,
|
|
86
|
+
error: f.fieldError,
|
|
87
|
+
},
|
|
88
|
+
separator: f.separator,
|
|
89
|
+
unknown: f.unknown,
|
|
90
|
+
installs: { app: f.installApp, cli: f.installCli, unknown: f.unknown },
|
|
91
|
+
pages: {
|
|
92
|
+
home: f.pageHome,
|
|
93
|
+
editor: f.pageEditor,
|
|
94
|
+
board: f.pageBoard,
|
|
95
|
+
outline: f.pageOutline,
|
|
96
|
+
settings: f.pageSettings,
|
|
97
|
+
help: f.pageHelp,
|
|
98
|
+
other: f.pageOther,
|
|
99
|
+
},
|
|
100
|
+
errors: { export: f.errorExport, update: f.errorUpdate, backup: f.errorBackup },
|
|
101
|
+
},
|
|
102
|
+
),
|
|
103
|
+
[version, install, osVersion, request, f],
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
const categoryLabel =
|
|
107
|
+
category === 'issue' ? f.categoryIssue : category === 'idea' ? f.categoryIdea : f.categoryOther;
|
|
108
|
+
|
|
109
|
+
const copy = async () => {
|
|
110
|
+
try {
|
|
111
|
+
await navigator.clipboard.writeText(info);
|
|
112
|
+
} catch {}
|
|
113
|
+
setCopied(true);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const openForm = () => {
|
|
117
|
+
window.open(FEEDBACK_FORM_URL, '_blank', 'noopener');
|
|
118
|
+
void copy();
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const close = (next: boolean) => {
|
|
122
|
+
if (!next) setRequest(null);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
return (
|
|
126
|
+
<Dialog open={request !== null} onOpenChange={close}>
|
|
127
|
+
<DialogContent className="sm:max-w-[520px]" data-lr-feedback-dialog>
|
|
128
|
+
<DialogHeader>
|
|
129
|
+
<DialogTitle>{f.title}</DialogTitle>
|
|
130
|
+
<DialogDescription>{f.intro}</DialogDescription>
|
|
131
|
+
</DialogHeader>
|
|
132
|
+
|
|
133
|
+
<fieldset className="flex flex-wrap gap-1.5" aria-label={f.title}>
|
|
134
|
+
{CATEGORIES.map((kind) => {
|
|
135
|
+
const label =
|
|
136
|
+
kind === 'issue'
|
|
137
|
+
? f.categoryIssue
|
|
138
|
+
: kind === 'idea'
|
|
139
|
+
? f.categoryIdea
|
|
140
|
+
: f.categoryOther;
|
|
141
|
+
return (
|
|
142
|
+
<button
|
|
143
|
+
key={kind}
|
|
144
|
+
type="button"
|
|
145
|
+
aria-pressed={category === kind}
|
|
146
|
+
data-lr-feedback-category={kind}
|
|
147
|
+
onClick={() => setCategory(kind)}
|
|
148
|
+
className={
|
|
149
|
+
category === kind
|
|
150
|
+
? 'min-h-8 rounded-full border border-[var(--lr-accent)] bg-[var(--lr-accent-soft)] px-3 py-1 text-[12.5px] font-medium text-foreground'
|
|
151
|
+
: 'min-h-8 rounded-full border border-border bg-card px-3 py-1 text-[12.5px] font-medium text-muted-foreground hover:border-[var(--lr-text-3)]'
|
|
152
|
+
}
|
|
153
|
+
>
|
|
154
|
+
{label}
|
|
155
|
+
</button>
|
|
156
|
+
);
|
|
157
|
+
})}
|
|
158
|
+
</fieldset>
|
|
159
|
+
|
|
160
|
+
<pre
|
|
161
|
+
data-lr-feedback-info
|
|
162
|
+
className="mt-1 whitespace-pre-wrap break-words rounded-[8px] border border-border bg-muted/40 px-3 py-2 font-mono text-[12px] leading-relaxed text-muted-foreground"
|
|
163
|
+
>
|
|
164
|
+
{info}
|
|
165
|
+
</pre>
|
|
166
|
+
|
|
167
|
+
{copied && (
|
|
168
|
+
<p data-lr-feedback-copied className="text-[12.5px] text-muted-foreground">
|
|
169
|
+
{f.copied}
|
|
170
|
+
</p>
|
|
171
|
+
)}
|
|
172
|
+
|
|
173
|
+
{!FEEDBACK_FORM_URL && !FEEDBACK_EMAIL && (
|
|
174
|
+
<p data-lr-feedback-no-channel className="text-[12.5px] text-muted-foreground">
|
|
175
|
+
{f.noChannel}
|
|
176
|
+
</p>
|
|
177
|
+
)}
|
|
178
|
+
|
|
179
|
+
<DialogFooter className="sm:justify-start">
|
|
180
|
+
{FEEDBACK_FORM_URL !== '' && (
|
|
181
|
+
<Button
|
|
182
|
+
type="button"
|
|
183
|
+
variant="outline"
|
|
184
|
+
size="sm"
|
|
185
|
+
data-lr-feedback-form
|
|
186
|
+
onClick={openForm}
|
|
187
|
+
>
|
|
188
|
+
{f.openForm}
|
|
189
|
+
</Button>
|
|
190
|
+
)}
|
|
191
|
+
{FEEDBACK_EMAIL !== '' && (
|
|
192
|
+
<Button
|
|
193
|
+
variant="outline"
|
|
194
|
+
size="sm"
|
|
195
|
+
data-lr-feedback-email
|
|
196
|
+
render={
|
|
197
|
+
<a
|
|
198
|
+
href={mailtoHref(
|
|
199
|
+
FEEDBACK_EMAIL,
|
|
200
|
+
format(f.mailSubject, { category: categoryLabel }),
|
|
201
|
+
`${info}\n\n${f.mailBodyPlaceholder}`,
|
|
202
|
+
)}
|
|
203
|
+
/>
|
|
204
|
+
}
|
|
205
|
+
>
|
|
206
|
+
{f.sendEmail}
|
|
207
|
+
</Button>
|
|
208
|
+
)}
|
|
209
|
+
<Button
|
|
210
|
+
type="button"
|
|
211
|
+
variant="outline"
|
|
212
|
+
size="sm"
|
|
213
|
+
data-lr-feedback-copy
|
|
214
|
+
onClick={() => void copy()}
|
|
215
|
+
>
|
|
216
|
+
{f.copyInfo}
|
|
217
|
+
</Button>
|
|
218
|
+
</DialogFooter>
|
|
219
|
+
</DialogContent>
|
|
220
|
+
</Dialog>
|
|
221
|
+
);
|
|
222
|
+
}
|