@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.
Files changed (110) hide show
  1. package/dist/{build-DYN-H65n.js → build-CSkdswfd.js} +1 -1
  2. package/dist/cli/bin.js +5 -5
  3. package/dist/{config-DW1wSoxa.js → config-C5-myPY6.js} +2087 -1439
  4. package/dist/{dev-_VDoRfAK.js → dev-DHtYH8sw.js} +2 -2
  5. package/dist/{mcp-CjYDzcJa.js → mcp-B2UeO1un.js} +1 -1
  6. package/dist/{preview-CYIGh3Z8.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 +19 -0
  11. package/src/app/components/command/slide-command-menu.tsx +0 -9
  12. package/src/app/lemonriver/backup/client.ts +25 -1
  13. package/src/app/lemonriver/backup/model.ts +63 -18
  14. package/src/app/lemonriver/board/board-page.tsx +2 -2
  15. package/src/app/lemonriver/chrome/app-chrome.tsx +52 -0
  16. package/src/app/lemonriver/chrome/sidebar-extras.tsx +8 -1
  17. package/src/app/lemonriver/feedback/dialog.tsx +222 -0
  18. package/src/app/lemonriver/feedback/export.ts +21 -2
  19. package/src/app/lemonriver/feedback/first-success.ts +30 -0
  20. package/src/app/lemonriver/feedback/install.ts +18 -0
  21. package/src/app/lemonriver/feedback/model.ts +88 -0
  22. package/src/app/lemonriver/help/help-page.tsx +16 -1
  23. package/src/app/lemonriver/help/model.ts +1 -1
  24. package/src/app/lemonriver/home/drafts.ts +57 -0
  25. package/src/app/lemonriver/home/home-page.tsx +94 -10
  26. package/src/app/lemonriver/home/organize-drafts.tsx +192 -0
  27. package/src/app/lemonriver/links.ts +16 -0
  28. package/src/app/lemonriver/outline/outline-page.tsx +8 -1
  29. package/src/app/lemonriver/settings/backup-restore-dialog.tsx +15 -1
  30. package/src/app/lemonriver/settings/backup-section.tsx +159 -28
  31. package/src/app/lemonriver/settings/settings-page.tsx +23 -0
  32. package/src/app/lemonriver/settings/workspace-card.tsx +53 -0
  33. package/src/app/lemonriver/settings/workspace.ts +37 -0
  34. package/src/app/lemonriver/share/editor-share.tsx +58 -0
  35. package/src/app/lemonriver/share/import-dialog.tsx +14 -0
  36. package/src/app/lemonriver/share/naming.ts +6 -1
  37. package/src/app/lemonriver/share/share-dialog.tsx +2 -0
  38. package/src/app/lemonriver/slide-extensions.tsx +37 -53
  39. package/src/app/lemonriver/text/en.ts +91 -11
  40. package/src/app/lemonriver/text/es.ts +81 -6
  41. package/src/app/lemonriver/text/ja.ts +80 -6
  42. package/src/app/lemonriver/text/types.ts +89 -6
  43. package/src/app/lemonriver/text/zh-cn.ts +92 -11
  44. package/src/app/lemonriver/text/zh-tw.ts +92 -11
  45. package/src/app/lemonriver/theme/pages.ts +4 -0
  46. package/src/app/lemonriver/update/beta-badge.tsx +69 -0
  47. package/src/app/lemonriver/update/release-notes.ts +22 -0
  48. package/src/app/lemonriver/update/update-prompt.tsx +28 -4
  49. package/src/app/lib/export-html.ts +5 -3
  50. package/src/app/lib/export-pptx.ts +5 -4
  51. package/src/app/routes/slide.tsx +6 -57
  52. package/src/app/components/note-markdown.test.tsx +0 -42
  53. package/src/app/components/thumbnail-rail-scroll.test.ts +0 -60
  54. package/src/app/lemonriver/agent-prefs/prefs.test.ts +0 -173
  55. package/src/app/lemonriver/backup/guide.test.ts +0 -45
  56. package/src/app/lemonriver/backup/model.test.ts +0 -96
  57. package/src/app/lemonriver/backup/places.test.ts +0 -154
  58. package/src/app/lemonriver/board/blocks/classify.test.ts +0 -209
  59. package/src/app/lemonriver/board/layout.test.ts +0 -245
  60. package/src/app/lemonriver/board/model/agent-tasks.test.ts +0 -200
  61. package/src/app/lemonriver/board/model/apply-prompt.test.ts +0 -121
  62. package/src/app/lemonriver/board/model/cards.test.ts +0 -332
  63. package/src/app/lemonriver/board/model/changes.test.ts +0 -244
  64. package/src/app/lemonriver/board/model/filter.test.ts +0 -50
  65. package/src/app/lemonriver/board/model/history.test.ts +0 -71
  66. package/src/app/lemonriver/board/model/restructure.test.ts +0 -205
  67. package/src/app/lemonriver/board/model/self-check.test.ts +0 -329
  68. package/src/app/lemonriver/board/model/structure.test.ts +0 -350
  69. package/src/app/lemonriver/board/model/timing.test.ts +0 -113
  70. package/src/app/lemonriver/features.test.ts +0 -49
  71. package/src/app/lemonriver/feedback/pending-toast.test.ts +0 -44
  72. package/src/app/lemonriver/feedback/upload.test.ts +0 -26
  73. package/src/app/lemonriver/help/model.test.ts +0 -179
  74. package/src/app/lemonriver/home/brief.test.ts +0 -38
  75. package/src/app/lemonriver/home/sorting.test.ts +0 -24
  76. package/src/app/lemonriver/home/time.test.ts +0 -33
  77. package/src/app/lemonriver/outline/files.test.ts +0 -90
  78. package/src/app/lemonriver/outline/model.test.ts +0 -751
  79. package/src/app/lemonriver/public-links.test.ts +0 -32
  80. package/src/app/lemonriver/routes.test.tsx +0 -54
  81. package/src/app/lemonriver/share/codes.test.ts +0 -49
  82. package/src/app/lemonriver/share/compare.test.ts +0 -199
  83. package/src/app/lemonriver/share/folder.test.ts +0 -42
  84. package/src/app/lemonriver/share/guide.test.ts +0 -78
  85. package/src/app/lemonriver/share/naming.test.ts +0 -59
  86. package/src/app/lemonriver/share/paths.test.ts +0 -116
  87. package/src/app/lemonriver/share/pdf.test.ts +0 -79
  88. package/src/app/lemonriver/templates/knobs.test.ts +0 -62
  89. package/src/app/lemonriver/templates/model.test.ts +0 -175
  90. package/src/app/lemonriver/templates/preview-content.test.ts +0 -117
  91. package/src/app/lemonriver/templates/recommend.test.ts +0 -71
  92. package/src/app/lemonriver/text/text.test.ts +0 -90
  93. package/src/app/lemonriver/theme/pages.test.ts +0 -74
  94. package/src/app/lemonriver/theme/themes.test.ts +0 -18
  95. package/src/app/lemonriver/trash/api.test.ts +0 -19
  96. package/src/app/lemonriver/update/prompt.test.ts +0 -84
  97. package/src/app/lemonriver/update/version.test.ts +0 -14
  98. package/src/app/lib/asset-filter.test.ts +0 -176
  99. package/src/app/lib/inspector/fiber.test.ts +0 -154
  100. package/src/app/lib/inspector/geometry.test.ts +0 -324
  101. package/src/app/lib/inspector/text-edit-timeline.test.ts +0 -121
  102. package/src/app/lib/note-markdown.test.ts +0 -147
  103. package/src/app/lib/pptx/css.test.ts +0 -205
  104. package/src/app/lib/pptx/ooxml.test.ts +0 -199
  105. package/src/app/lib/pptx/text-lines.test.ts +0 -82
  106. package/src/app/lib/print-ready.test.ts +0 -32
  107. package/src/app/lib/sdk.test.ts +0 -13
  108. package/src/app/lib/transition.test.ts +0 -31
  109. package/src/app/lib/use-document-title.test.ts +0 -14
  110. package/src/app/lib/utils.test.ts +0 -49
@@ -38,6 +38,7 @@ import {
38
38
  useAgentStatus,
39
39
  } from '@/lib/agent/use-agent';
40
40
  import { format, useLocale } from '@/lib/use-locale';
41
+ import { useSlideModule } from '@/lib/use-slide-module';
41
42
  import { cn } from '@/lib/utils';
42
43
  import { readPrefs } from '../agent-prefs/prefs';
43
44
  import { Mascot } from '../brand/mascot';
@@ -88,6 +89,7 @@ export function OutlineView() {
88
89
  const prefsLr = useLrText().prefs;
89
90
  const locale = useLocale();
90
91
  const navigate = useNavigate();
92
+ const { slide: deck } = useSlideModule(slideId);
91
93
  const { sessions } = useAgentSessions();
92
94
  const { provider } = useAgentStatus();
93
95
  const latestSession = sessions
@@ -281,7 +283,12 @@ export function OutlineView() {
281
283
  <div className="mx-auto w-full max-w-[820px] px-6 py-8">
282
284
  <button
283
285
  type="button"
284
- onClick={() => navigate('/')}
286
+ onClick={() =>
287
+ navigate(
288
+ (deck?.default.length ?? 0) === 0 ? '/' : `/s/${encodeURIComponent(slideId)}`,
289
+ { replace: true },
290
+ )
291
+ }
285
292
  className="mb-6 inline-flex items-center gap-1.5 text-[13px] text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/40"
286
293
  >
287
294
  <ArrowLeft className="size-3.5" />
@@ -306,7 +306,16 @@ export function BackupRestoreDialog({
306
306
  >
307
307
  <span className="w-full truncate text-[13.5px] font-medium">{item.name}</span>
308
308
  <span className="text-[12px] text-muted-foreground">
309
- {formatSize(item.size)} · {when(item.at, locale.id)}
309
+ {item.kind === 'snapshot'
310
+ ? format(b.snapshotLine, {
311
+ decks: item.decks ?? 0,
312
+ size: formatSize(item.size),
313
+ when: when(item.at, locale.id),
314
+ })
315
+ : format(b.zipLine, {
316
+ size: formatSize(item.size),
317
+ when: when(item.at, locale.id),
318
+ })}
310
319
  </span>
311
320
  </button>
312
321
  ))}
@@ -416,6 +425,11 @@ export function BackupRestoreDialog({
416
425
  {format(b.previewThemes, { n: chosen.preview.themes })}
417
426
  </p>
418
427
  )}
428
+ {(chosen.preview.skipped?.length ?? 0) > 0 && (
429
+ <p data-lr-backup-skipped className="text-[12.5px] text-muted-foreground">
430
+ {format(b.restoreSkipped, { n: chosen.preview.skipped?.length ?? 0 })}
431
+ </p>
432
+ )}
419
433
 
420
434
  <label className="flex items-center gap-2 text-[13px]">
421
435
  <input
@@ -7,8 +7,11 @@ import { Progress } from '@/components/ui/progress';
7
7
  import { format, useLocale } from '@/lib/use-locale';
8
8
  import { useAgentPrefs } from '../agent-prefs/use-prefs';
9
9
  import {
10
+ backupList,
10
11
  backupPlaces,
11
12
  backupSettings,
13
+ backupSummary,
14
+ exportBackup,
12
15
  pendingRestoreJob,
13
16
  pickBackupFolder,
14
17
  revealBackup,
@@ -21,13 +24,15 @@ import { formatSize } from '../backup/guide';
21
24
  import {
22
25
  BACKUP_TOO_LARGE,
23
26
  type BackupJob,
27
+ type BackupListItem,
24
28
  type BackupPlace,
25
29
  type BackupSettings,
26
- KEEP_CHOICES,
30
+ type BackupSummary,
27
31
  PREFS_KEYS,
28
32
  type PrefsSnapshot,
29
33
  } from '../backup/model';
30
34
  import { placeLabel } from '../backup/places';
35
+ import { openFeedback } from '../feedback/dialog';
31
36
  import { helpAnchorForPlace } from '../help/model';
32
37
  import { useLrText } from '../text';
33
38
  import { useReduceMotionSetting } from '../theme/motion';
@@ -117,6 +122,7 @@ export function BackupSection() {
117
122
 
118
123
  const [settings, setSettings] = useState<BackupSettings | null>(null);
119
124
  const [dir, setDir] = useState<string | null>(null);
125
+ const [summary, setSummary] = useState<BackupSummary | null>(null);
120
126
  const [places, setPlaces] = useState<BackupPlace[]>([]);
121
127
  const [pickerOpen, setPickerOpen] = useState(false);
122
128
  const [pasteMode, setPasteMode] = useState(false);
@@ -124,19 +130,25 @@ export function BackupSection() {
124
130
  const [notice, setNotice] = useState('');
125
131
  const [job, setJob] = useState<BackupJob | null>(null);
126
132
  const [restoreOpen, setRestoreOpen] = useState(false);
133
+ const [exportOpen, setExportOpen] = useState(false);
134
+ const [exportItems, setExportItems] = useState<BackupListItem[]>([]);
135
+ const [exportNotice, setExportNotice] = useState('');
136
+ const [exporting, setExporting] = useState(false);
127
137
 
128
138
  const running = job?.state === 'running';
129
139
 
130
140
  const load = useCallback(async () => {
131
- const [info, found] = await Promise.all([
141
+ const [info, found, totals] = await Promise.all([
132
142
  backupSettings().catch(() => null),
133
143
  backupPlaces().catch(() => [] as BackupPlace[]),
144
+ backupSummary().catch(() => null),
134
145
  ]);
135
146
  if (info) {
136
147
  setSettings(info.settings);
137
148
  setDir(info.dir);
138
149
  }
139
150
  setPlaces(found);
151
+ if (totals) setSummary(totals);
140
152
  }, []);
141
153
 
142
154
  useEffect(() => {
@@ -168,7 +180,11 @@ export function BackupSection() {
168
180
  return () => clearTimeout(timer);
169
181
  }, [theme.theme, reduceMotion, agentStamp, locale.id]);
170
182
 
171
- const patch = async (value: { folder?: string | null; auto?: boolean; keep?: number }) => {
183
+ const patch = async (value: {
184
+ folder?: string | null;
185
+ auto?: boolean;
186
+ skipLargeVideos?: boolean;
187
+ }) => {
172
188
  setNotice('');
173
189
  const saved = await saveBackupSettings(value);
174
190
  if (!saved.ok) {
@@ -225,8 +241,35 @@ export function BackupSection() {
225
241
  }
226
242
  };
227
243
 
244
+ const openExport = async () => {
245
+ setExportNotice('');
246
+ setExportItems([]);
247
+ setExportOpen(true);
248
+ const items = await backupList().catch(() => [] as BackupListItem[]);
249
+ setExportItems(items.filter((item) => item.kind === 'snapshot'));
250
+ };
251
+
252
+ const doExport = async (snapshot: string) => {
253
+ if (exporting) return;
254
+ setExporting(true);
255
+ setExportNotice('');
256
+ try {
257
+ const answer = await exportBackup(snapshot, locale.id);
258
+ if ('unsupported' in answer) {
259
+ setExportNotice(b.exportFailed);
260
+ return;
261
+ }
262
+ if ('cancelled' in answer) return;
263
+ const name = answer.path.split('/').pop() ?? answer.path;
264
+ setExportNotice(format(b.exportDone, { name, size: formatSize(answer.size) }));
265
+ } catch {
266
+ setExportNotice(b.exportFailed);
267
+ } finally {
268
+ setExporting(false);
269
+ }
270
+ };
271
+
228
272
  const last = settings?.last ?? null;
229
- const keep = settings?.keep ?? 7;
230
273
  const currentPlace = settings?.folder
231
274
  ? places.find((place) => place.path === settings.folder)
232
275
  : undefined;
@@ -278,31 +321,49 @@ export function BackupSection() {
278
321
  />
279
322
  </div>
280
323
 
324
+ <div className="mt-3 border-t border-border pt-3">
325
+ <p data-lr-backup-total className="text-[14px] font-semibold">
326
+ {format(b.totalSize, { size: formatSize(summary?.totalBytes ?? 0) })}
327
+ </p>
328
+ <p className="mt-0.5 text-[12px] text-muted-foreground">{b.retain}</p>
329
+ {summary !== null && summary.biggest.length > 0 && (
330
+ <div data-lr-backup-biggest className="mt-2">
331
+ <p className="text-[12px] font-semibold text-muted-foreground">{b.biggestTitle}</p>
332
+ <ul className="mt-1 list-disc break-all pl-4 text-[12px] text-muted-foreground">
333
+ {summary.biggest.map((file) => {
334
+ const name = file.rel.slice(file.rel.lastIndexOf('/') + 1);
335
+ return (
336
+ <li key={file.rel}>
337
+ {file.deck
338
+ ? format(b.biggestItemDeck, {
339
+ name,
340
+ size: formatSize(file.size),
341
+ deck: file.deck,
342
+ })
343
+ : format(b.biggestItem, { name, size: formatSize(file.size) })}
344
+ </li>
345
+ );
346
+ })}
347
+ </ul>
348
+ </div>
349
+ )}
350
+ </div>
351
+
281
352
  <div className="mt-3 flex items-center gap-4 border-t border-border pt-3">
282
353
  <div className="min-w-0 flex-1">
283
- <p className="text-[14px] font-semibold">{b.keep}</p>
284
- {last?.ok && last.size > 0 && (
285
- <p data-lr-backup-keep-size className="text-[12px] text-muted-foreground">
286
- {format(b.keepSize, {
287
- size: formatSize(last.size),
288
- n: keep,
289
- total: formatSize(last.size * keep),
290
- })}
291
- </p>
292
- )}
354
+ <p className="text-[14px] font-semibold">{b.skipVideos}</p>
355
+ <p className="text-[12px] text-muted-foreground">{b.skipVideosHint}</p>
293
356
  </div>
294
- <select
295
- data-lr-backup-keep
296
- value={keep}
297
- onChange={(event) => void patch({ keep: Number(event.target.value) })}
298
- className="rounded-[8px] border border-border bg-card px-2 py-1 text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-ring/40"
299
- >
300
- {KEEP_CHOICES.map((value) => (
301
- <option key={value} value={value}>
302
- {format(b.keepOption, { n: value })}
303
- </option>
304
- ))}
305
- </select>
357
+ <button
358
+ type="button"
359
+ role="switch"
360
+ aria-checked={settings?.skipLargeVideos === true}
361
+ aria-label={b.skipVideos}
362
+ data-lr-backup-skip-videos
363
+ disabled={!settings?.folder}
364
+ onClick={() => void patch({ skipLargeVideos: !(settings?.skipLargeVideos === true) })}
365
+ className="lr-switch outline-none focus-visible:ring-2 focus-visible:ring-ring/40 disabled:opacity-40"
366
+ />
306
367
  </div>
307
368
 
308
369
  <div className="mt-3 border-t border-border pt-3">
@@ -334,7 +395,10 @@ export function BackupSection() {
334
395
  }
335
396
  >
336
397
  {last.ok
337
- ? format(b.lastOk, { when: when(last.at, locale.id), size: formatSize(last.size) })
398
+ ? format(b.lastOk, {
399
+ when: when(last.at, locale.id),
400
+ added: formatSize(last.addedBytes),
401
+ })
338
402
  : failureText(last.error)}
339
403
  </p>
340
404
  )}
@@ -354,6 +418,18 @@ export function BackupSection() {
354
418
  {b.reveal}
355
419
  </button>
356
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
+ )}
357
433
  </div>
358
434
 
359
435
  {notice !== '' && (
@@ -362,6 +438,12 @@ export function BackupSection() {
362
438
  </p>
363
439
  )}
364
440
 
441
+ {!running && last?.ok && last.skipped.length > 0 && (
442
+ <p data-lr-backup-skipped className="mt-1 text-[12.5px] text-muted-foreground">
443
+ {format(b.skipped, { n: last.skipped.length })}
444
+ </p>
445
+ )}
446
+
365
447
  {!running && last && !last.ok && (
366
448
  <Link
367
449
  to="/help#cloud-faq"
@@ -393,7 +475,17 @@ export function BackupSection() {
393
475
  </div>
394
476
  )}
395
477
 
396
- <div className="mt-3 border-t border-border pt-3">
478
+ <div className="mt-3 flex flex-wrap items-center gap-2 border-t border-border pt-3">
479
+ <Button
480
+ type="button"
481
+ variant="outline"
482
+ size="sm"
483
+ data-lr-backup-export
484
+ disabled={!settings?.folder}
485
+ onClick={() => void openExport()}
486
+ >
487
+ {b.exportFull}
488
+ </Button>
397
489
  <Button
398
490
  type="button"
399
491
  variant="outline"
@@ -483,6 +575,45 @@ export function BackupSection() {
483
575
  </DialogContent>
484
576
  </Dialog>
485
577
 
578
+ <Dialog open={exportOpen} onOpenChange={setExportOpen}>
579
+ <DialogContent className="sm:max-w-[520px]" data-lr-backup-export-dialog>
580
+ <DialogHeader>
581
+ <DialogTitle>{b.exportTitle}</DialogTitle>
582
+ </DialogHeader>
583
+ <p className="text-[12.5px] text-muted-foreground">{b.exportHint}</p>
584
+ <div className="flex max-h-[46vh] flex-col gap-1 overflow-y-auto">
585
+ {exportItems.length === 0 ? (
586
+ <p className="text-[13px] text-muted-foreground">{b.noBackups}</p>
587
+ ) : (
588
+ exportItems.map((item) => (
589
+ <button
590
+ key={item.path}
591
+ type="button"
592
+ data-lr-backup-export-day={item.name}
593
+ disabled={exporting}
594
+ onClick={() => void doExport(item.path)}
595
+ className="flex flex-col items-start rounded-[10px] border border-border px-3 py-2 text-left outline-none hover:border-[var(--lr-text-3)] focus-visible:ring-2 focus-visible:ring-ring/40 disabled:opacity-50"
596
+ >
597
+ <span className="w-full truncate text-[13.5px] font-medium">{item.name}</span>
598
+ <span className="text-[12px] text-muted-foreground">
599
+ {format(b.snapshotLine, {
600
+ decks: item.decks ?? 0,
601
+ size: formatSize(item.size),
602
+ when: when(item.at, locale.id),
603
+ })}
604
+ </span>
605
+ </button>
606
+ ))
607
+ )}
608
+ </div>
609
+ {exportNotice !== '' && (
610
+ <p data-lr-backup-export-notice className="text-[12.5px] text-muted-foreground">
611
+ {exportNotice}
612
+ </p>
613
+ )}
614
+ </DialogContent>
615
+ </Dialog>
616
+
486
617
  <BackupRestoreDialog open={restoreOpen} onOpenChange={setRestoreOpen} />
487
618
  </section>
488
619
  );
@@ -9,11 +9,13 @@ 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';
15
16
  import { useTheme } from '../theme/use-theme';
16
17
  import { BackupSection } from './backup-section';
18
+ import { WorkspaceCard } from './workspace-card';
17
19
 
18
20
  const SWATCH: Record<LrThemeChoice, { bg: string; fg: string }> = {
19
21
  system: { bg: 'linear-gradient(90deg,#fafbf5 50%,#111412 50%)', fg: '#13240f' },
@@ -110,6 +112,8 @@ export function SettingsPage() {
110
112
  </p>
111
113
  </header>
112
114
 
115
+ <WorkspaceCard />
116
+
113
117
  <section className="rounded-[16px] border border-border bg-card px-6 py-5 shadow-[var(--lr-shadow-1)]">
114
118
  <h2 className="text-[16px] font-semibold">{lr.settings.appearance}</h2>
115
119
  <p className="mt-1 mb-4 text-[14px] text-muted-foreground">{lr.settings.appearanceHint}</p>
@@ -276,6 +280,25 @@ export function SettingsPage() {
276
280
  </button>
277
281
  </section>
278
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
+ )}
279
302
  </div>
280
303
  );
281
304
  }
@@ -0,0 +1,53 @@
1
+ import { Check, Copy, Folder } from 'lucide-react';
2
+ import { useEffect, useState } from 'react';
3
+ import { Button } from '@/components/ui/button';
4
+ import { useLrText } from '../text';
5
+ import { copyWorkspacePath, revealWorkspace, workspacePath } from './workspace';
6
+
7
+ export function WorkspaceCard() {
8
+ const t = useLrText().settings;
9
+ const [path, setPath] = useState<string | null>(null);
10
+ const [copied, setCopied] = useState(false);
11
+
12
+ useEffect(() => {
13
+ let live = true;
14
+ void workspacePath().then((value) => {
15
+ if (live) setPath(value);
16
+ });
17
+ return () => {
18
+ live = false;
19
+ };
20
+ }, []);
21
+
22
+ if (!path) return null;
23
+
24
+ async function copy() {
25
+ if (await copyWorkspacePath()) setCopied(true);
26
+ }
27
+
28
+ return (
29
+ <section
30
+ data-lr-workspace
31
+ className="mb-4 rounded-[16px] border border-border bg-card px-6 py-5 shadow-[var(--lr-shadow-1)]"
32
+ >
33
+ <h2 className="text-[16px] font-semibold">{t.workspaceTitle}</h2>
34
+ <p
35
+ data-lr-workspace-path
36
+ className="mt-2 select-text break-all font-mono text-[12.5px] text-foreground/90"
37
+ >
38
+ {path}
39
+ </p>
40
+ <div className="mt-3 flex flex-wrap gap-2">
41
+ <Button variant="outline" size="sm" onClick={() => void copy()}>
42
+ {copied ? <Check /> : <Copy />}
43
+ {copied ? t.workspaceCopied : t.workspaceCopy}
44
+ </Button>
45
+ <Button variant="outline" size="sm" onClick={revealWorkspace}>
46
+ <Folder />
47
+ {t.workspaceReveal}
48
+ </Button>
49
+ </div>
50
+ <p className="mt-3 text-[12.5px] text-muted-foreground">{t.workspaceHint}</p>
51
+ </section>
52
+ );
53
+ }
@@ -0,0 +1,37 @@
1
+ let cached: string | null = null;
2
+ let pending: Promise<string | null> | null = null;
3
+
4
+ /** The folder the dev server runs in; null when it cannot say. */
5
+ export function workspacePath(): Promise<string | null> {
6
+ if (cached) return Promise.resolve(cached);
7
+ pending ??= (async () => {
8
+ try {
9
+ const res = await fetch('/__lr/workspace');
10
+ if (!res.ok) return null;
11
+ const body = (await res.json()) as { path?: unknown };
12
+ if (typeof body.path !== 'string' || !body.path) return null;
13
+ cached = body.path;
14
+ return cached;
15
+ } catch {
16
+ return null;
17
+ } finally {
18
+ pending = null;
19
+ }
20
+ })();
21
+ return pending;
22
+ }
23
+
24
+ export async function copyWorkspacePath(): Promise<boolean> {
25
+ const path = await workspacePath();
26
+ if (!path) return false;
27
+ try {
28
+ await navigator.clipboard.writeText(path);
29
+ return true;
30
+ } catch {
31
+ return false;
32
+ }
33
+ }
34
+
35
+ export function revealWorkspace(): void {
36
+ void fetch('/__lr/workspace/reveal', { method: 'POST' }).catch(() => {});
37
+ }
@@ -0,0 +1,58 @@
1
+ import { Share2 } from 'lucide-react';
2
+ import { useEffect } from 'react';
3
+ import { Button } from '@/components/ui/button';
4
+ import { DropdownMenuItem } from '@/components/ui/dropdown-menu';
5
+ import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
6
+ import { useLrText } from '../text';
7
+
8
+ const SHARE_OPEN_EVENT = 'lemonriver:share-open';
9
+
10
+ /** The editor's more-menu cannot reach the dialog's state, so it asks for it. */
11
+ export function requestShare(): void {
12
+ window.dispatchEvent(new Event(SHARE_OPEN_EVENT));
13
+ }
14
+
15
+ export function useShareRequests(open: () => void): void {
16
+ useEffect(() => {
17
+ window.addEventListener(SHARE_OPEN_EVENT, open);
18
+ return () => window.removeEventListener(SHARE_OPEN_EVENT, open);
19
+ }, [open]);
20
+ }
21
+
22
+ export function ShareMenuEntry() {
23
+ const lr = useLrText();
24
+ return (
25
+ <DropdownMenuItem onClick={requestShare}>
26
+ <Share2 />
27
+ {lr.share.menuItem}
28
+ </DropdownMenuItem>
29
+ );
30
+ }
31
+
32
+ export function ShareHeaderButton({ onOpen }: { onOpen: () => void }) {
33
+ const lr = useLrText();
34
+ return (
35
+ <Tooltip>
36
+ <TooltipTrigger
37
+ render={
38
+ <Button
39
+ size="sm"
40
+ variant="ghost"
41
+ aria-keyshortcuts="S"
42
+ aria-label={lr.share.open}
43
+ onClick={onOpen}
44
+ >
45
+ <Share2 className="size-3.5" />
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>
50
+ </Button>
51
+ }
52
+ />
53
+ <TooltipContent side="bottom" sideOffset={6}>
54
+ {lr.share.openHint}
55
+ </TooltipContent>
56
+ </Tooltip>
57
+ );
58
+ }
@@ -221,9 +221,12 @@ function ThumbViewer({
221
221
 
222
222
  export function ImportDialog({
223
223
  inspection,
224
+ folderId = null,
224
225
  onClose,
225
226
  }: {
226
227
  inspection: InspectOk;
228
+ /** The folder the home page is showing; imported decks land there. */
229
+ folderId?: string | null;
227
230
  onClose: () => void;
228
231
  }) {
229
232
  const t = useLocale();
@@ -255,6 +258,17 @@ export function ImportDialog({
255
258
  picked.map((deck) => ({ slideId: deck.slideId, mode: mode[deck.slideId] ?? 'copy' })),
256
259
  );
257
260
  const first = result.imported[0];
261
+ if (folderId) {
262
+ await Promise.all(
263
+ result.imported.map((deck) =>
264
+ fetch('/__folders/assign', {
265
+ method: 'PUT',
266
+ headers: { 'content-type': 'application/json' },
267
+ body: JSON.stringify({ slideId: deck.slideId, folderId }),
268
+ }),
269
+ ),
270
+ );
271
+ }
258
272
  const firstDeck = decks.find((deck) => deck.slideId === first?.from);
259
273
  savePendingToast({
260
274
  kind: 'imported',
@@ -1,4 +1,4 @@
1
- const RESERVED = new Set(['/', '\\', ':', '*', '?', '"', '<', '>', '|']);
1
+ const RESERVED = new Set(['/', '\\', ':', ':', '*', '?', '"', '<', '>', '|']);
2
2
  const MAX_BASE = 80;
3
3
 
4
4
  function clean(raw: string): string {
@@ -29,6 +29,11 @@ export function dayStamp(now: number): string {
29
29
  return `${date.getFullYear()}-${two(date.getMonth() + 1)}-${two(date.getDate())}`;
30
30
  }
31
31
 
32
+ /** The deck's own name for an export, without its extension. */
33
+ export function exportBaseName(title: string | undefined, slideId: string): string {
34
+ return safeFileName(title ?? '', slideId);
35
+ }
36
+
32
37
  /** One deck is named after itself; a set of them is a backup with a date. */
33
38
  export function packageBaseName(decks: { title: string; slideId: string }[], now: number): string {
34
39
  if (decks.length === 1) {
@@ -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');