@lemonriver/core 0.7.0 → 1.0.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 (66) hide show
  1. package/README.md +3 -1
  2. package/dist/{build-CKwrex8y.js → build-CiT4CNey.js} +1 -1
  3. package/dist/cli/bin.js +12 -5
  4. package/dist/client-DpO_eR9X.js +57 -0
  5. package/dist/{config-B1_gk0sy.js → config-BI3VRI2n.js} +7186 -5275
  6. package/dist/{dev-DZ2Yzl2p.js → dev-DpzBn_sf.js} +3 -3
  7. package/dist/index.js +1 -1
  8. package/dist/locale/index.js +1 -1
  9. package/dist/mcp-CjYDzcJa.js +262 -0
  10. package/dist/{preview-hMDcuHfP.js → preview-Dro8hl5_.js} +2 -2
  11. package/dist/{update-CMRxtTc9.js → update-b1dSg_FW.js} +17 -17
  12. package/dist/vite/index.js +1 -1
  13. package/dist/{zh-tw-DcrDeKxr.js → zh-tw-BhYyMx0-.js} +40 -40
  14. package/package.json +1 -1
  15. package/skills/slide-authoring/SKILL.md +2 -0
  16. package/src/app/lemonriver/agent-providers/section.tsx +13 -4
  17. package/src/app/lemonriver/backup/client.ts +177 -0
  18. package/src/app/lemonriver/backup/guide.test.ts +45 -0
  19. package/src/app/lemonriver/backup/guide.ts +138 -0
  20. package/src/app/lemonriver/backup/model.test.ts +96 -0
  21. package/src/app/lemonriver/backup/model.ts +255 -0
  22. package/src/app/lemonriver/backup/places.test.ts +154 -0
  23. package/src/app/lemonriver/backup/places.ts +74 -0
  24. package/src/app/lemonriver/board/blocks/snapshot.ts +10 -2
  25. package/src/app/lemonriver/board/self-check-runner.tsx +60 -15
  26. package/src/app/lemonriver/board/use-self-check.ts +1 -1
  27. package/src/app/lemonriver/chrome/app-chrome.tsx +6 -0
  28. package/src/app/lemonriver/chrome/sidebar-extras.tsx +9 -1
  29. package/src/app/lemonriver/features.test.ts +5 -0
  30. package/src/app/lemonriver/features.ts +11 -1
  31. package/src/app/lemonriver/guide/guide-prompt.tsx +89 -0
  32. package/src/app/lemonriver/guide/state.ts +29 -0
  33. package/src/app/lemonriver/guide/use-guide.ts +17 -0
  34. package/src/app/lemonriver/help/help-page.tsx +267 -0
  35. package/src/app/lemonriver/help/model.test.ts +179 -0
  36. package/src/app/lemonriver/help/model.ts +105 -0
  37. package/src/app/lemonriver/home/home-page.tsx +25 -7
  38. package/src/app/lemonriver/mcp/respond.ts +47 -0
  39. package/src/app/lemonriver/mcp/screenshot.tsx +155 -0
  40. package/src/app/lemonriver/mcp/self-check.tsx +65 -0
  41. package/src/app/lemonriver/outline/describe-page.tsx +3 -1
  42. package/src/app/lemonriver/routes.test.tsx +4 -2
  43. package/src/app/lemonriver/routes.tsx +2 -0
  44. package/src/app/lemonriver/settings/backup-restore-dialog.tsx +525 -0
  45. package/src/app/lemonriver/settings/backup-section.tsx +489 -0
  46. package/src/app/lemonriver/settings/settings-page.tsx +25 -3
  47. package/src/app/lemonriver/share/client.ts +6 -0
  48. package/src/app/lemonriver/share/freeze.ts +13 -5
  49. package/src/app/lemonriver/share/import-dialog.tsx +14 -0
  50. package/src/app/lemonriver/share/paths.test.ts +41 -0
  51. package/src/app/lemonriver/share/paths.ts +45 -11
  52. package/src/app/lemonriver/share/share-dialog.tsx +54 -1
  53. package/src/app/lemonriver/text/en.ts +742 -4
  54. package/src/app/lemonriver/text/es.ts +97 -4
  55. package/src/app/lemonriver/text/ja.ts +94 -4
  56. package/src/app/lemonriver/text/types.ts +103 -1
  57. package/src/app/lemonriver/text/zh-cn.ts +711 -3
  58. package/src/app/lemonriver/text/zh-tw.ts +711 -3
  59. package/src/app/lemonriver/update/beta-badge.tsx +3 -0
  60. package/src/app/lemonriver/update/version.test.ts +14 -0
  61. package/src/app/lemonriver/update/version.ts +5 -0
  62. package/src/locale/en.ts +8 -8
  63. package/src/locale/es.ts +10 -8
  64. package/src/locale/ja.ts +9 -8
  65. package/src/locale/zh-cn.ts +9 -8
  66. package/src/locale/zh-tw.ts +9 -8
@@ -1,4 +1,4 @@
1
- import type { ShareCode } from './model.ts';
1
+ import type { ShareCode, ShareKind } from './model.ts';
2
2
 
3
3
  /** Slide ids are the same shape the editor uses for a deck folder. */
4
4
  export const SHARE_SLIDE_ID_RE = /^[a-z0-9_-]+$/i;
@@ -43,6 +43,17 @@ const SLIDE_EXTENSIONS = new Set([
43
43
  'key',
44
44
  'numbers',
45
45
  'pages',
46
+ 'vtt',
47
+ 'srt',
48
+ 'excalidraw',
49
+ 'yaml',
50
+ 'yml',
51
+ 'xml',
52
+ 'tsv',
53
+ 'lottie',
54
+ 'riv',
55
+ 'glb',
56
+ 'gltf',
46
57
  ]);
47
58
 
48
59
  const BLOCKED_SLIDE_FILES =
@@ -63,7 +74,7 @@ function looksLikeLicence(name: string): boolean {
63
74
  );
64
75
  }
65
76
 
66
- function structuralProblem(rel: string): PathProblem | null {
77
+ function structuralProblem(rel: string, allowHidden: boolean): PathProblem | null {
67
78
  if (rel === '') return { code: 'bad-path', detail: 'empty path' };
68
79
  if (rel.includes('\0')) return { code: 'bad-path', detail: 'path holds a null byte' };
69
80
  if (rel.includes('\\')) return { code: 'bad-path', detail: 'backslash in path' };
@@ -73,8 +84,8 @@ function structuralProblem(rel: string): PathProblem | null {
73
84
  for (const segment of rel.split('/')) {
74
85
  if (segment === '') return { code: 'bad-path', detail: 'empty path segment' };
75
86
  if (segment === '.' || segment === '..') return { code: 'bad-path', detail: 'path climbs out' };
76
- // `.` and `..` belong to the rule above; this one is about hidden files.
77
- if (segment.startsWith('.') && segment !== '..') {
87
+ // A backup keeps a workspace exactly as it is, hidden files included.
88
+ if (!allowHidden && segment.startsWith('.')) {
78
89
  return { code: 'bad-path', detail: `hidden segment "${segment}"` };
79
90
  }
80
91
  if (segment.toLowerCase() === 'node_modules') {
@@ -84,6 +95,13 @@ function structuralProblem(rel: string): PathProblem | null {
84
95
  return null;
85
96
  }
86
97
 
98
+ function blockedConfigProblem(name: string): PathProblem | null {
99
+ if (BLOCKED_SLIDE_FILES.test(name)) {
100
+ return { code: 'blocked-file', detail: `${name} would configure the other machine` };
101
+ }
102
+ return null;
103
+ }
104
+
87
105
  function slideFileProblem(rest: string): PathProblem | null {
88
106
  const name = rest.slice(rest.lastIndexOf('/') + 1);
89
107
  if (BLOCKED_SLIDE_FILES.test(name)) {
@@ -99,10 +117,11 @@ function slideFileProblem(rest: string): PathProblem | null {
99
117
 
100
118
  /**
101
119
  * One rule for both ends: what may sit under `LemonRiver-files/`. Anything the
102
- * packer would refuse is also refused on the way in.
120
+ * packer would refuse is also refused on the way in. A backup carries the
121
+ * workspace's own global assets and prefs, which a share package never does.
103
122
  */
104
- export function packagePathProblem(rel: string): PathProblem | null {
105
- const structural = structuralProblem(rel);
123
+ export function packagePathProblem(rel: string, kind: ShareKind = 'share'): PathProblem | null {
124
+ const structural = structuralProblem(rel, kind === 'backup');
106
125
  if (structural) return structural;
107
126
 
108
127
  const segments = rel.split('/');
@@ -112,6 +131,16 @@ export function packagePathProblem(rel: string): PathProblem | null {
112
131
  return segments.length === 1 ? null : { code: 'bad-path', detail: 'manifest.json is a file' };
113
132
  }
114
133
 
134
+ if (kind === 'backup' && head === 'workspace.json') {
135
+ return segments.length === 1 ? null : { code: 'bad-path', detail: 'workspace.json is a file' };
136
+ }
137
+
138
+ // A backup carries the workspace's own files as they are: any name, any depth.
139
+ if (kind === 'backup' && (head === 'assets' || head === 'themes')) {
140
+ if (rest.length === 0) return { code: 'bad-path', detail: `${head} holds files` };
141
+ return null;
142
+ }
143
+
115
144
  if (head === 'board') {
116
145
  if (rest.length !== 1 || !rest[0].endsWith('.json')) {
117
146
  return { code: 'bad-path', detail: 'board holds <slideId>.json only' };
@@ -122,7 +151,10 @@ export function packagePathProblem(rel: string): PathProblem | null {
122
151
  }
123
152
 
124
153
  if (head === 'themes') {
125
- if (rest.length !== 1) return { code: 'bad-path', detail: 'themes holds files only' };
154
+ if (rest.length === 2 && rest[0].endsWith('-assets')) {
155
+ return slideFileProblem(rest[1]);
156
+ }
157
+ if (rest.length !== 1) return { code: 'bad-path', detail: 'themes holds files and one folder' };
126
158
  const name = rest[0];
127
159
  if (name.endsWith('.demo.tsx')) {
128
160
  const id = name.slice(0, -'.demo.tsx'.length);
@@ -152,14 +184,16 @@ export function packagePathProblem(rel: string): PathProblem | null {
152
184
  if (!SHARE_SLIDE_ID_RE.test(rest[0])) {
153
185
  return { code: 'bad-path', detail: `bad slide id "${rest[0]}"` };
154
186
  }
155
- return slideFileProblem(rest.slice(1).join('/'));
187
+ const file = rest.slice(1).join('/');
188
+ if (kind === 'backup') return blockedConfigProblem(file.slice(file.lastIndexOf('/') + 1));
189
+ return slideFileProblem(file);
156
190
  }
157
191
 
158
192
  return { code: 'bad-path', detail: `"${head}" is not part of a package` };
159
193
  }
160
194
 
161
- export function isPackagePath(rel: string): boolean {
162
- return packagePathProblem(rel) === null;
195
+ export function isPackagePath(rel: string, kind: ShareKind = 'share'): boolean {
196
+ return packagePathProblem(rel, kind) === null;
163
197
  }
164
198
 
165
199
  /** The deck a package path belongs to, or null for manifest and themes. */
@@ -1,5 +1,6 @@
1
1
  import { Share2 } from 'lucide-react';
2
2
  import { useEffect, useRef, useState } from 'react';
3
+ import { Link } from 'react-router-dom';
3
4
  import { Button } from '@/components/ui/button';
4
5
  import {
5
6
  Dialog,
@@ -13,6 +14,7 @@ import { Progress } from '@/components/ui/progress';
13
14
  import { format, useLocale } from '@/lib/use-locale';
14
15
  import { CANVAS_HEIGHT, CANVAS_WIDTH, type SlideModule } from '../../lib/sdk';
15
16
  import { loadSlide } from '../../lib/slides';
17
+ import { isFeatureEnabled } from '../features';
16
18
  import { useLrText } from '../text';
17
19
  import { CaptureCancelled, captureDeck, toBase64 } from './capture';
18
20
  import { appVersion, packShare, revealShared } from './client';
@@ -22,7 +24,14 @@ import { buildImagePdf } from './pdf';
22
24
 
23
25
  type Phase = 'idle' | 'working' | 'done' | 'failed';
24
26
 
25
- type Result = { name: string; path: string; size: number; warnings: string[] };
27
+ type Result = {
28
+ name: string;
29
+ path: string;
30
+ size: number;
31
+ warnings: string[];
32
+ skipped: string[];
33
+ workFiles: number;
34
+ };
26
35
 
27
36
  const MAX_LISTED_FILES = 10;
28
37
 
@@ -140,6 +149,8 @@ export function ShareDialog({
140
149
  path: packed.path,
141
150
  size: packed.size,
142
151
  warnings: packed.warnings,
152
+ skipped: packed.skipped,
153
+ workFiles: packed.workFiles,
143
154
  });
144
155
  setPhase('done');
145
156
  } catch (err) {
@@ -216,6 +227,36 @@ export function ShareDialog({
216
227
  </div>
217
228
  )}
218
229
 
230
+ {phase === 'done' && result && (result.workFiles > 0 || result.skipped.length > 0) && (
231
+ <div
232
+ data-lr-share-skipped
233
+ className="rounded-[8px] border border-border bg-muted/40 px-3 py-2 text-[13px]"
234
+ >
235
+ <p className="font-semibold">
236
+ {format(lr.share.skippedTitle, { n: result.workFiles + result.skipped.length })}
237
+ </p>
238
+ {result.workFiles > 0 && (
239
+ <p className="mt-1 text-muted-foreground">
240
+ {format(lr.share.workFiles, { n: result.workFiles })}
241
+ </p>
242
+ )}
243
+ {result.skipped.length > 0 && (
244
+ <ul className="mt-1 list-disc pl-4 text-muted-foreground">
245
+ {result.skipped.slice(0, MAX_LISTED_FILES).map((path) => (
246
+ <li key={path} className="break-all">
247
+ {path}
248
+ </li>
249
+ ))}
250
+ {result.skipped.length > MAX_LISTED_FILES && (
251
+ <li>
252
+ {format(lr.share.moreFiles, { n: result.skipped.length - MAX_LISTED_FILES })}
253
+ </li>
254
+ )}
255
+ </ul>
256
+ )}
257
+ </div>
258
+ )}
259
+
219
260
  {phase === 'failed' && failure && (
220
261
  <div data-lr-share-failed className="text-[13px] text-destructive">
221
262
  <p className="font-semibold">{lr.share.failed}</p>
@@ -237,6 +278,18 @@ export function ShareDialog({
237
278
  </div>
238
279
  )}
239
280
 
281
+ {isFeatureEnabled('help') && phase !== 'working' && (
282
+ <p className="text-[12.5px]">
283
+ <Link
284
+ to="/help#share"
285
+ data-lr-share-help
286
+ className="text-muted-foreground underline-offset-2 hover:text-foreground hover:underline"
287
+ >
288
+ {lr.share.helpLink}
289
+ </Link>
290
+ </p>
291
+ )}
292
+
240
293
  <DialogFooter>
241
294
  {phase === 'idle' && (
242
295
  <>