@lemonriver/core 0.1.1 → 0.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.
- package/dist/{build-f-fM2ZY4.js → build-Bqo69DWP.js} +1 -1
- package/dist/cli/bin.js +4 -4
- package/dist/{config-DO45GU3e.js → config-DJ5rkMMg.js} +3123 -523
- package/dist/{config-B6JaKJM4.d.ts → config-teo3kWz7.d.ts} +6 -2
- package/dist/{dev-CqS2xpgE.js → dev-B2FJD5bJ.js} +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -3
- package/dist/locale/index.d.ts +5 -2
- package/dist/locale/index.js +2 -2
- package/dist/{preview-BihgMlEl.js → preview-C93BOZL1.js} +1 -1
- package/dist/{types-BjW4glip.d.ts → types-DFK02XVv.d.ts} +120 -27
- package/dist/{update-C_R0ycVC.js → update-DsxZBtwv.js} +154 -90
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.js +1 -1
- package/dist/{zh-tw-Ci0jK8eg.js → zh-tw-DwTAZKa6.js} +1091 -104
- package/package.json +13 -6
- package/skills/apply-comments/SKILL.md +10 -6
- package/skills/create-slide/SKILL.md +2 -0
- package/skills/current-slide/SKILL.md +1 -0
- package/skills/slide-authoring/SKILL.md +31 -1
- package/src/agent/prompt.ts +141 -0
- package/src/agent/provider.ts +123 -0
- package/src/agent/types.ts +151 -0
- package/src/app/app.tsx +7 -18
- package/src/app/assets/open-slide.svg +39 -0
- package/src/app/components/agent/agent-dock.tsx +35 -0
- package/src/app/components/agent/agent-markdown.tsx +45 -0
- package/src/app/components/agent/agent-panel.tsx +695 -0
- package/src/app/components/agent/agent-presence.tsx +74 -0
- package/src/app/components/agent/composer.tsx +120 -0
- package/src/app/components/agent/connect-view.tsx +184 -0
- package/src/app/components/agent/history-view.tsx +136 -0
- package/src/app/components/agent/provider-logo.tsx +34 -0
- package/src/app/components/agent/transcript.tsx +620 -0
- package/src/app/components/asset-view.tsx +6 -6
- package/src/app/components/command/command-menu.tsx +2 -1
- package/src/app/components/command/slide-command-menu.tsx +10 -0
- package/src/app/components/icon-switcher-indicator.tsx +1 -1
- package/src/app/components/inspector/asset-picker-dialog.tsx +7 -5
- package/src/app/components/inspector/comment-layer.tsx +1012 -0
- package/src/app/components/inspector/image-crop-dialog.tsx +1 -5
- package/src/app/components/inspector/inspect-overlay.tsx +2 -39
- package/src/app/components/inspector/inspector-panel.tsx +12 -95
- package/src/app/components/inspector/inspector-provider.tsx +121 -47
- package/src/app/components/panel/editor-sidebar.tsx +85 -16
- package/src/app/components/panel/panel-shell.tsx +2 -2
- package/src/app/components/panel/resize-handle.tsx +129 -0
- package/src/app/components/player.tsx +0 -1
- package/src/app/components/preview-step-host.tsx +16 -0
- package/src/app/components/sidebar/sidebar-footer.tsx +1 -1
- package/src/app/components/sidebar/sidebar.tsx +4 -3
- package/src/app/components/style-panel/style-panel.tsx +3 -2
- package/src/app/components/themes/theme-detail.tsx +4 -2
- package/src/app/components/thumbnail-rail.tsx +77 -29
- package/src/app/favicon.ico +0 -0
- package/src/app/favicon.svg +39 -0
- package/src/app/index.html +2 -1
- package/src/app/lemonriver/agent/lemon.tsx +64 -0
- package/src/app/{components → lemonriver}/board/board-canvas.tsx +154 -23
- package/src/app/{routes/board.tsx → lemonriver/board/board-page.tsx} +63 -25
- package/src/app/{components → lemonriver}/board/board.css +51 -0
- package/src/app/{components → lemonriver}/board/layout.test.ts +53 -1
- package/src/app/{components → lemonriver}/board/layout.ts +51 -3
- package/src/app/lemonriver/board/model/cards.test.ts +239 -0
- package/src/app/lemonriver/board/model/cards.ts +234 -0
- package/src/app/lemonriver/board/model/structure.test.ts +101 -0
- package/src/app/lemonriver/board/model/structure.ts +82 -0
- package/src/app/lemonriver/board/page-node.tsx +481 -0
- package/src/app/lemonriver/board/use-board-cards.ts +210 -0
- package/src/app/{components → lemonriver}/board/use-board-columns.ts +7 -7
- package/src/app/{components → lemonriver}/board/use-page-order.ts +27 -15
- package/src/app/lemonriver/brand/app-icon.svg +44 -0
- package/src/app/lemonriver/brand/apple-touch-icon.png +0 -0
- package/src/app/lemonriver/brand/favicon-32.png +0 -0
- package/src/app/lemonriver/brand/mascot.tsx +59 -0
- package/src/app/lemonriver/brand/mascots/lemon-done.png +0 -0
- package/src/app/lemonriver/brand/mascots/lemon-idle.png +0 -0
- package/src/app/lemonriver/brand/mascots/lemon-needs-you.png +0 -0
- package/src/app/lemonriver/brand/mascots/lemon-thinking.png +0 -0
- package/src/app/lemonriver/brand/mascots/lemon-working.png +0 -0
- package/src/app/lemonriver/chrome/app-chrome.tsx +99 -0
- package/src/app/lemonriver/chrome/nav-row.tsx +34 -0
- package/src/app/lemonriver/chrome/not-found.tsx +34 -0
- package/src/app/lemonriver/chrome/sidebar-extras.tsx +57 -0
- package/src/app/lemonriver/chrome/use-slot.ts +23 -0
- package/src/app/lemonriver/features.test.ts +29 -0
- package/src/app/lemonriver/features.ts +26 -0
- package/src/app/lemonriver/feedback/export.ts +7 -0
- package/src/app/lemonriver/feedback/lemon-empty.tsx +54 -0
- package/src/app/lemonriver/feedback/offline-banner.tsx +41 -0
- package/src/app/lemonriver/feedback/pending-toast.test.ts +44 -0
- package/src/app/lemonriver/feedback/pending-toast.ts +39 -0
- package/src/app/lemonriver/feedback/toaster.tsx +34 -0
- package/src/app/lemonriver/feedback/upload.test.ts +26 -0
- package/src/app/lemonriver/feedback/upload.ts +19 -0
- package/src/app/lemonriver/home/brief-card.tsx +63 -0
- package/src/app/lemonriver/home/brief.test.ts +38 -0
- package/src/app/lemonriver/home/brief.ts +34 -0
- package/src/app/lemonriver/home/controls.tsx +93 -0
- package/src/app/lemonriver/home/deck-card.tsx +183 -0
- package/src/app/lemonriver/home/dialogs.tsx +292 -0
- package/src/app/lemonriver/home/home-page.tsx +335 -0
- package/src/app/lemonriver/home/sorting.test.ts +24 -0
- package/src/app/lemonriver/home/sorting.ts +59 -0
- package/src/app/lemonriver/home/time.test.ts +33 -0
- package/src/app/lemonriver/home/time.ts +33 -0
- package/src/app/lemonriver/home/use-deck-times.ts +27 -0
- package/src/app/lemonriver/home/use-delayed.ts +15 -0
- package/src/app/lemonriver/routes.test.tsx +37 -0
- package/src/app/lemonriver/routes.tsx +38 -0
- package/src/app/lemonriver/settings/settings-page.tsx +103 -0
- package/src/app/lemonriver/slide-extensions.tsx +73 -0
- package/src/app/lemonriver/text/all.ts +19 -0
- package/src/app/lemonriver/text/en.ts +106 -0
- package/src/app/lemonriver/text/es.ts +108 -0
- package/src/app/lemonriver/text/index.ts +9 -0
- package/src/app/lemonriver/text/ja.ts +106 -0
- package/src/app/lemonriver/text/text.test.ts +57 -0
- package/src/app/lemonriver/text/types.ts +111 -0
- package/src/app/lemonriver/text/zh-cn.ts +101 -0
- package/src/app/lemonriver/text/zh-tw.ts +101 -0
- package/src/app/lemonriver/theme/app.css +288 -0
- package/src/app/lemonriver/theme/controls.css +463 -0
- package/src/app/lemonriver/theme/index.css +3 -0
- package/src/app/lemonriver/theme/motion.ts +52 -0
- package/src/app/lemonriver/theme/pages.test.ts +66 -0
- package/src/app/lemonriver/theme/pages.ts +56 -0
- package/src/app/lemonriver/theme/theme-menu.tsx +64 -0
- package/src/app/lemonriver/theme/themes.test.ts +18 -0
- package/src/app/lemonriver/theme/themes.ts +16 -0
- package/src/app/lemonriver/theme/tokens.css +226 -0
- package/src/app/lemonriver/theme/use-theme.tsx +49 -0
- package/src/app/lemonriver/trash/api.test.ts +19 -0
- package/src/app/lemonriver/trash/api.ts +77 -0
- package/src/app/lemonriver/trash/trash-page.tsx +131 -0
- package/src/app/lib/agent/use-agent.ts +543 -0
- package/src/app/lib/inspector/freeze-motion.ts +61 -0
- package/src/app/lib/inspector/use-comments.ts +32 -3
- package/src/app/lib/locale-store.ts +6 -1
- package/src/app/lib/pptx/raster.ts +1 -1
- package/src/app/lib/print-ready.ts +9 -6
- package/src/app/lib/use-auto-grow.ts +15 -0
- package/src/app/lib/utils.ts +4 -0
- package/src/app/main.tsx +8 -1
- package/src/app/routes/home-shell.tsx +4 -2
- package/src/app/routes/home.tsx +43 -7
- package/src/app/routes/presenter.tsx +1 -16
- package/src/app/routes/preview.tsx +169 -0
- package/src/app/routes/slide.tsx +232 -188
- package/src/app/styles.css +235 -80
- package/src/editing/placeholder-id.ts +1 -0
- package/src/locale/en.ts +113 -26
- package/src/locale/es.ts +658 -0
- package/src/locale/index.ts +1 -0
- package/src/locale/ja.ts +106 -26
- package/src/locale/types.ts +119 -28
- package/src/locale/zh-cn.ts +106 -28
- package/src/locale/zh-tw.ts +106 -28
- package/src/app/assets/open-slide.png +0 -0
- package/src/app/components/board/page-node.tsx +0 -204
- package/src/app/components/inspector/comment-widget.tsx +0 -119
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { clamp, cn } from '@/lib/utils';
|
|
3
|
+
|
|
4
|
+
export function useStoredWidth(key: string, fallback: number, min: number, max: number) {
|
|
5
|
+
const [width, setWidth] = useState<number>(() => {
|
|
6
|
+
try {
|
|
7
|
+
const parsed = Number(window.localStorage.getItem(key) ?? Number.NaN);
|
|
8
|
+
return Number.isFinite(parsed) ? clamp(parsed, min, max) : fallback;
|
|
9
|
+
} catch {
|
|
10
|
+
return fallback;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
try {
|
|
15
|
+
window.localStorage.setItem(key, String(width));
|
|
16
|
+
} catch {}
|
|
17
|
+
}, [key, width]);
|
|
18
|
+
return [width, setWidth] as const;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// A vertical splitter on one edge of a panel. `edge` is the side of the panel
|
|
22
|
+
// it sits on, so dragging away from the panel always makes it wider.
|
|
23
|
+
export function ResizeHandle({
|
|
24
|
+
width,
|
|
25
|
+
min,
|
|
26
|
+
max,
|
|
27
|
+
defaultWidth,
|
|
28
|
+
edge,
|
|
29
|
+
label,
|
|
30
|
+
onResize,
|
|
31
|
+
onResizingChange,
|
|
32
|
+
className,
|
|
33
|
+
}: {
|
|
34
|
+
width: number;
|
|
35
|
+
min: number;
|
|
36
|
+
max: number;
|
|
37
|
+
defaultWidth: number;
|
|
38
|
+
edge: 'left' | 'right';
|
|
39
|
+
label: string;
|
|
40
|
+
onResize: (width: number) => void;
|
|
41
|
+
onResizingChange?: (resizing: boolean) => void;
|
|
42
|
+
className?: string;
|
|
43
|
+
}) {
|
|
44
|
+
const [resizing, setResizing] = useState(false);
|
|
45
|
+
const dragRef = useRef<{ startX: number; startWidth: number } | null>(null);
|
|
46
|
+
const direction = edge === 'right' ? 1 : -1;
|
|
47
|
+
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
onResizingChange?.(resizing);
|
|
50
|
+
if (!resizing) return;
|
|
51
|
+
const prev = {
|
|
52
|
+
cursor: document.body.style.cursor,
|
|
53
|
+
userSelect: document.body.style.userSelect,
|
|
54
|
+
};
|
|
55
|
+
document.body.style.cursor = 'col-resize';
|
|
56
|
+
document.body.style.userSelect = 'none';
|
|
57
|
+
return () => {
|
|
58
|
+
document.body.style.cursor = prev.cursor;
|
|
59
|
+
document.body.style.userSelect = prev.userSelect;
|
|
60
|
+
};
|
|
61
|
+
}, [resizing, onResizingChange]);
|
|
62
|
+
|
|
63
|
+
const onPointerDown = (e: React.PointerEvent<HTMLDivElement>) => {
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
66
|
+
dragRef.current = { startX: e.clientX, startWidth: width };
|
|
67
|
+
setResizing(true);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const onPointerMove = (e: React.PointerEvent<HTMLDivElement>) => {
|
|
71
|
+
if (!dragRef.current) return;
|
|
72
|
+
const delta = (e.clientX - dragRef.current.startX) * direction;
|
|
73
|
+
onResize(clamp(dragRef.current.startWidth + delta, min, max));
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const onPointerUp = (e: React.PointerEvent<HTMLDivElement>) => {
|
|
77
|
+
if (e.currentTarget.hasPointerCapture(e.pointerId)) {
|
|
78
|
+
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
79
|
+
}
|
|
80
|
+
dragRef.current = null;
|
|
81
|
+
setResizing(false);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const onKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {
|
|
85
|
+
const step = (e.shiftKey ? 32 : 8) * direction;
|
|
86
|
+
let next: number | null = null;
|
|
87
|
+
if (e.key === 'ArrowLeft') next = width - step;
|
|
88
|
+
else if (e.key === 'ArrowRight') next = width + step;
|
|
89
|
+
else if (e.key === 'Home') next = defaultWidth;
|
|
90
|
+
if (next === null) return;
|
|
91
|
+
e.preventDefault();
|
|
92
|
+
e.stopPropagation();
|
|
93
|
+
onResize(clamp(next, min, max));
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
// biome-ignore lint/a11y/useSemanticElements: focusable resize handle (splitter pattern), not a static <hr>
|
|
98
|
+
<div
|
|
99
|
+
role="separator"
|
|
100
|
+
aria-orientation="vertical"
|
|
101
|
+
aria-label={label}
|
|
102
|
+
aria-valuenow={width}
|
|
103
|
+
aria-valuemin={min}
|
|
104
|
+
aria-valuemax={max}
|
|
105
|
+
tabIndex={0}
|
|
106
|
+
onPointerDown={onPointerDown}
|
|
107
|
+
onPointerMove={onPointerMove}
|
|
108
|
+
onPointerUp={onPointerUp}
|
|
109
|
+
onPointerCancel={onPointerUp}
|
|
110
|
+
onKeyDown={onKeyDown}
|
|
111
|
+
onDoubleClick={() => onResize(defaultWidth)}
|
|
112
|
+
className={cn(
|
|
113
|
+
'group/resize absolute inset-y-0 z-20 w-1.5 cursor-col-resize touch-none outline-none',
|
|
114
|
+
'focus-visible:bg-brand/20',
|
|
115
|
+
className,
|
|
116
|
+
)}
|
|
117
|
+
>
|
|
118
|
+
<span
|
|
119
|
+
aria-hidden
|
|
120
|
+
className={cn(
|
|
121
|
+
'pointer-events-none absolute inset-y-0 w-px bg-brand opacity-0 transition-opacity duration-150',
|
|
122
|
+
edge === 'right' ? 'left-1/2 -translate-x-1/2' : 'left-0',
|
|
123
|
+
'group-hover/resize:opacity-100 group-focus-visible/resize:opacity-100',
|
|
124
|
+
resizing && 'opacity-100',
|
|
125
|
+
)}
|
|
126
|
+
/>
|
|
127
|
+
</div>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
@@ -402,7 +402,6 @@ export function Player({
|
|
|
402
402
|
controls && 'select-none',
|
|
403
403
|
controls && (hideCursor ? 'cursor-none' : 'cursor-default'),
|
|
404
404
|
)}
|
|
405
|
-
style={design ? { background: design.palette.bg } : undefined}
|
|
406
405
|
>
|
|
407
406
|
<SlideCanvas flat design={design}>
|
|
408
407
|
{/* Keyed per deck so a presenter-driven deck switch cuts instead of
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ReactNode, useRef } from 'react';
|
|
2
|
+
import { type StepController, StepHost } from '../lib/step-context';
|
|
3
|
+
|
|
4
|
+
export function PreviewStepHost({ revealed, children }: { revealed: number; children: ReactNode }) {
|
|
5
|
+
const noopControllerRef = useRef<StepController | null>(null);
|
|
6
|
+
return (
|
|
7
|
+
<StepHost
|
|
8
|
+
isActivePage={false}
|
|
9
|
+
entryDirection="jump"
|
|
10
|
+
controllerRef={noopControllerRef}
|
|
11
|
+
controlledRevealed={revealed}
|
|
12
|
+
>
|
|
13
|
+
{children}
|
|
14
|
+
</StepHost>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -3,11 +3,11 @@ import { Loader2, RefreshCw, RotateCw } from 'lucide-react';
|
|
|
3
3
|
import { useEffect, useState } from 'react';
|
|
4
4
|
import { toast } from 'sonner';
|
|
5
5
|
import { LanguageToggle } from '@/components/language-toggle';
|
|
6
|
-
import { ThemeToggle } from '@/components/theme-toggle';
|
|
7
6
|
import { Button } from '@/components/ui/button';
|
|
8
7
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';
|
|
9
8
|
import { format, useLocale } from '@/lib/use-locale';
|
|
10
9
|
import { useRestartServer } from '@/lib/use-restart-server';
|
|
10
|
+
import { ThemeToggle } from '../../lemonriver/theme/theme-menu';
|
|
11
11
|
|
|
12
12
|
type UpdateCheck = { current: string; latest: string | null; outdated: boolean };
|
|
13
13
|
type UpdateStatus = 'idle' | 'running' | 'done' | 'error';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Plus, Search } from 'lucide-react';
|
|
2
2
|
import { useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { toast } from 'sonner';
|
|
4
|
-
import logo from '@/assets/open-slide.png';
|
|
5
4
|
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
|
|
6
5
|
import type { Folder, FolderIcon } from '@/lib/sdk';
|
|
7
6
|
import { format, useLocale } from '@/lib/use-locale';
|
|
8
7
|
import { cn } from '@/lib/utils';
|
|
8
|
+
import logo from '../../lemonriver/brand/app-icon.svg';
|
|
9
9
|
import { COMMAND_MENU_SHORTCUT } from '../command/command-menu';
|
|
10
10
|
import { FolderIconChip, FolderItem } from './folder-item';
|
|
11
11
|
import { IconPicker, PRESET_COLORS } from './icon-picker';
|
|
@@ -135,14 +135,14 @@ export function Sidebar({
|
|
|
135
135
|
alt=""
|
|
136
136
|
aria-hidden
|
|
137
137
|
draggable={false}
|
|
138
|
-
className="size-6 shrink-0 select-none
|
|
138
|
+
className="size-6 shrink-0 select-none"
|
|
139
139
|
/>
|
|
140
140
|
<h1 className="font-heading text-[13.5px] font-semibold tracking-tight">
|
|
141
141
|
{t.home.appTitle}
|
|
142
142
|
</h1>
|
|
143
143
|
</div>
|
|
144
144
|
|
|
145
|
-
<div className="px-2 pb-3">
|
|
145
|
+
<div className="px-2 pb-3" data-lr-sidebar-top>
|
|
146
146
|
<button
|
|
147
147
|
type="button"
|
|
148
148
|
onClick={onOpenCommandMenu}
|
|
@@ -187,6 +187,7 @@ export function Sidebar({
|
|
|
187
187
|
onDropSlide={() => {}}
|
|
188
188
|
/>
|
|
189
189
|
)}
|
|
190
|
+
<div data-lr-sidebar-nav className="contents" />
|
|
190
191
|
</div>
|
|
191
192
|
|
|
192
193
|
<div className="mt-5 flex h-6 items-center justify-between pr-2.5 pl-4 pb-0.5">
|
|
@@ -197,12 +197,13 @@ export function DesignToggleButton({
|
|
|
197
197
|
size="sm"
|
|
198
198
|
variant={active ? 'default' : 'ghost'}
|
|
199
199
|
onClick={onToggle}
|
|
200
|
+
aria-label={t.stylePanel.designToggle}
|
|
200
201
|
data-design-ui
|
|
201
202
|
title={t.stylePanel.designToggleTitle}
|
|
202
203
|
>
|
|
203
204
|
<Palette className="size-3.5" />
|
|
204
|
-
<span className="hidden
|
|
205
|
-
<kbd className="ml-1 hidden rounded-[3px] bg-foreground/10 px-1 font-mono text-[9.5px] tracking-[0.04em]
|
|
205
|
+
<span className="hidden lg:inline">{t.stylePanel.designToggle}</span>
|
|
206
|
+
<kbd className="ml-1 hidden rounded-[3px] bg-foreground/10 px-1 font-mono text-[9.5px] tracking-[0.04em] lg:inline">
|
|
206
207
|
D
|
|
207
208
|
</kbd>
|
|
208
209
|
</Button>
|
|
@@ -4,6 +4,7 @@ import { Link } from 'react-router-dom';
|
|
|
4
4
|
import { Button } from '@/components/ui/button';
|
|
5
5
|
import { format, useLocale } from '@/lib/use-locale';
|
|
6
6
|
import { cn, pad2 } from '@/lib/utils';
|
|
7
|
+
import { EmptyLemon } from '../../lemonriver/agent/lemon';
|
|
7
8
|
import { SlidePageProvider } from '../../lib/page-context';
|
|
8
9
|
import type { SlideModule } from '../../lib/sdk';
|
|
9
10
|
import { loadSlide, slidesByTheme } from '../../lib/slides';
|
|
@@ -187,9 +188,10 @@ export function ThemeDetail({ themeId, onBack }: { themeId: string; onBack: () =
|
|
|
187
188
|
) : null}
|
|
188
189
|
</div>
|
|
189
190
|
{usedBySlideIds.length === 0 ? (
|
|
190
|
-
<
|
|
191
|
+
<div className="flex flex-col items-start gap-2 text-[12.5px] leading-relaxed text-muted-foreground">
|
|
192
|
+
<EmptyLemon />
|
|
191
193
|
{t.themes.usedByEmpty}
|
|
192
|
-
</
|
|
194
|
+
</div>
|
|
193
195
|
) : (
|
|
194
196
|
<ul className="flex flex-col gap-5">
|
|
195
197
|
{usedBySlideIds.map((id) => (
|
|
@@ -24,9 +24,9 @@ import {
|
|
|
24
24
|
type LucideIcon,
|
|
25
25
|
Sparkles,
|
|
26
26
|
Trash2,
|
|
27
|
-
Workflow,
|
|
28
27
|
} from 'lucide-react';
|
|
29
28
|
import { Fragment, useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
29
|
+
import { useOptionalInspector } from '@/components/inspector/inspector-provider';
|
|
30
30
|
import { Button } from '@/components/ui/button';
|
|
31
31
|
import {
|
|
32
32
|
ContextMenu,
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
} from '@/components/ui/context-menu';
|
|
38
38
|
import { ScrollArea } from '@/components/ui/scroll-area';
|
|
39
39
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';
|
|
40
|
-
import { format, useLocale } from '@/lib/use-locale';
|
|
40
|
+
import { format, plural, useLocale } from '@/lib/use-locale';
|
|
41
41
|
import { cn, pad2 } from '@/lib/utils';
|
|
42
42
|
import type { DesignSystem } from '../lib/design';
|
|
43
43
|
import { SlidePageProvider } from '../lib/page-context';
|
|
@@ -73,10 +73,38 @@ type Props = {
|
|
|
73
73
|
moduleTransition?: SlideTransition;
|
|
74
74
|
/** When provided, the vertical rail header renders a button that opens the overview grid. */
|
|
75
75
|
onOverview?: () => void;
|
|
76
|
-
/** When provided, the vertical rail header renders a button that opens the story board. */
|
|
77
|
-
onBoard?: () => void;
|
|
78
76
|
};
|
|
79
77
|
|
|
78
|
+
// Per-page pending comment counts, shown on the rail only while the
|
|
79
|
+
// comment tool is active.
|
|
80
|
+
function usePageCommentCounts(): Map<number, number> | null {
|
|
81
|
+
const inspector = useOptionalInspector();
|
|
82
|
+
if (!inspector?.commentMode) return null;
|
|
83
|
+
const counts = new Map<number, number>();
|
|
84
|
+
for (const comment of inspector.comments) {
|
|
85
|
+
if (comment.page === undefined) continue;
|
|
86
|
+
counts.set(comment.page, (counts.get(comment.page) ?? 0) + 1);
|
|
87
|
+
}
|
|
88
|
+
return counts;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function CommentCountBadge({ count, className }: { count: number; className?: string }) {
|
|
92
|
+
const t = useLocale();
|
|
93
|
+
return (
|
|
94
|
+
<span
|
|
95
|
+
role="img"
|
|
96
|
+
aria-label={format(plural(count, t.inspector.commentsCount), { count })}
|
|
97
|
+
data-page-comments={count}
|
|
98
|
+
className={cn(
|
|
99
|
+
'flex h-4 min-w-4 items-center justify-center rounded-full bg-brand px-1 font-mono text-[9.5px] font-semibold leading-none text-brand-foreground tabular-nums',
|
|
100
|
+
className,
|
|
101
|
+
)}
|
|
102
|
+
>
|
|
103
|
+
{count}
|
|
104
|
+
</span>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
80
108
|
const DEFAULT_VERTICAL_THUMB_WIDTH = 184;
|
|
81
109
|
const VERTICAL_RAIL_CHROME = 80;
|
|
82
110
|
const MIN_VERTICAL_THUMB_WIDTH = 120;
|
|
@@ -101,12 +129,12 @@ export function ThumbnailRail({
|
|
|
101
129
|
width,
|
|
102
130
|
moduleTransition,
|
|
103
131
|
onOverview,
|
|
104
|
-
onBoard,
|
|
105
132
|
}: Props) {
|
|
106
133
|
const activeRef = useRef<HTMLButtonElement | null>(null);
|
|
107
134
|
const virtualListRef = useRef<HTMLDivElement | null>(null);
|
|
108
135
|
const verticalViewportRef = useRef<HTMLElement | null>(null);
|
|
109
136
|
const focusCurrentAfterScrollRef = useRef(false);
|
|
137
|
+
const focusAfterArrowRef = useRef(false);
|
|
110
138
|
const [currentPosition, setCurrentPosition] = useState<ThumbnailOffscreenDirection>(null);
|
|
111
139
|
const t = useLocale();
|
|
112
140
|
|
|
@@ -176,6 +204,32 @@ export function ThumbnailRail({
|
|
|
176
204
|
return () => cancelAnimationFrame(frame);
|
|
177
205
|
}, [currentPosition]);
|
|
178
206
|
|
|
207
|
+
useLayoutEffect(() => {
|
|
208
|
+
if (!focusAfterArrowRef.current || !activeRef.current) return;
|
|
209
|
+
activeRef.current.focus({ preventScroll: true });
|
|
210
|
+
focusAfterArrowRef.current = false;
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
const onThumbnailArrowKeyDown = useCallback(
|
|
214
|
+
(event: React.KeyboardEvent<HTMLButtonElement>, index: number) => {
|
|
215
|
+
if (event.altKey || event.ctrlKey || event.metaKey || event.nativeEvent.isComposing) return;
|
|
216
|
+
const direction =
|
|
217
|
+
event.key === 'ArrowRight' || event.key === 'ArrowDown'
|
|
218
|
+
? 1
|
|
219
|
+
: event.key === 'ArrowLeft' || event.key === 'ArrowUp'
|
|
220
|
+
? -1
|
|
221
|
+
: 0;
|
|
222
|
+
if (!direction) return;
|
|
223
|
+
event.preventDefault();
|
|
224
|
+
event.stopPropagation();
|
|
225
|
+
const next = Math.min(Math.max(index + direction, 0), pages.length - 1);
|
|
226
|
+
if (next === index) return;
|
|
227
|
+
focusAfterArrowRef.current = true;
|
|
228
|
+
onSelect(next);
|
|
229
|
+
},
|
|
230
|
+
[onSelect, pages.length],
|
|
231
|
+
);
|
|
232
|
+
|
|
179
233
|
const renderThumb = useCallback(
|
|
180
234
|
(PageComp: Page, i: number) => {
|
|
181
235
|
const active = i === current;
|
|
@@ -199,6 +253,7 @@ export function ThumbnailRail({
|
|
|
199
253
|
active={active}
|
|
200
254
|
activeRef={active ? activeRef : undefined}
|
|
201
255
|
onSelect={() => onSelect(i)}
|
|
256
|
+
onArrowKeyDown={(event) => onThumbnailArrowKeyDown(event, i)}
|
|
202
257
|
ariaLabel={format(t.thumbnailRail.goToPageAria, { n: i + 1 })}
|
|
203
258
|
>
|
|
204
259
|
{inner}
|
|
@@ -208,6 +263,7 @@ export function ThumbnailRail({
|
|
|
208
263
|
type="button"
|
|
209
264
|
ref={active ? activeRef : undefined}
|
|
210
265
|
onClick={() => onSelect(i)}
|
|
266
|
+
onKeyDown={(event) => onThumbnailArrowKeyDown(event, i)}
|
|
211
267
|
aria-label={format(t.thumbnailRail.goToPageAria, { n: i + 1 })}
|
|
212
268
|
aria-current={active ? 'page' : undefined}
|
|
213
269
|
className={thumbButtonClass(active)}
|
|
@@ -239,6 +295,7 @@ export function ThumbnailRail({
|
|
|
239
295
|
moduleTransition,
|
|
240
296
|
onReorder,
|
|
241
297
|
onSelect,
|
|
298
|
+
onThumbnailArrowKeyDown,
|
|
242
299
|
pages.length,
|
|
243
300
|
scale,
|
|
244
301
|
thumbWidth,
|
|
@@ -260,6 +317,7 @@ export function ThumbnailRail({
|
|
|
260
317
|
actions={actions}
|
|
261
318
|
activeRef={activeRef}
|
|
262
319
|
onSelect={onSelect}
|
|
320
|
+
onArrowKeyDown={onThumbnailArrowKeyDown}
|
|
263
321
|
scale={scale}
|
|
264
322
|
thumbWidth={horizontalWidth}
|
|
265
323
|
/>
|
|
@@ -273,7 +331,7 @@ export function ThumbnailRail({
|
|
|
273
331
|
<div className="-mx-3 sticky top-0 z-10 bg-sidebar px-4 pt-3 pb-1">
|
|
274
332
|
<div className="flex items-center justify-between gap-2">
|
|
275
333
|
<span className="eyebrow">{t.thumbnailRail.pages}</span>
|
|
276
|
-
<div className="flex items-center gap-1.5">
|
|
334
|
+
<div className="flex items-center gap-1.5" data-lr-rail-actions="">
|
|
277
335
|
<span className="folio">{pad2(pages.length)}</span>
|
|
278
336
|
{onOverview && (
|
|
279
337
|
<Tooltip>
|
|
@@ -298,29 +356,6 @@ export function ThumbnailRail({
|
|
|
298
356
|
</TooltipContent>
|
|
299
357
|
</Tooltip>
|
|
300
358
|
)}
|
|
301
|
-
{onBoard && (
|
|
302
|
-
<Tooltip>
|
|
303
|
-
<TooltipTrigger
|
|
304
|
-
render={
|
|
305
|
-
<button
|
|
306
|
-
type="button"
|
|
307
|
-
onClick={onBoard}
|
|
308
|
-
aria-label={t.board.openBoard}
|
|
309
|
-
className={cn(
|
|
310
|
-
'flex size-5 items-center justify-center rounded-[3px] text-muted-foreground/70 outline-none',
|
|
311
|
-
'motion-safe:transition-colors hover:bg-muted hover:text-foreground',
|
|
312
|
-
'focus-visible:ring-1 focus-visible:ring-brand',
|
|
313
|
-
)}
|
|
314
|
-
>
|
|
315
|
-
<Workflow className="size-3.5" strokeWidth={1.75} />
|
|
316
|
-
</button>
|
|
317
|
-
}
|
|
318
|
-
/>
|
|
319
|
-
<TooltipContent side="bottom" sideOffset={6}>
|
|
320
|
-
{t.board.openBoard}
|
|
321
|
-
</TooltipContent>
|
|
322
|
-
</Tooltip>
|
|
323
|
-
)}
|
|
324
359
|
</div>
|
|
325
360
|
</div>
|
|
326
361
|
</div>
|
|
@@ -438,6 +473,7 @@ function HorizontalVirtualThumbList({
|
|
|
438
473
|
actions,
|
|
439
474
|
activeRef,
|
|
440
475
|
onSelect,
|
|
476
|
+
onArrowKeyDown,
|
|
441
477
|
scale,
|
|
442
478
|
thumbWidth,
|
|
443
479
|
}: {
|
|
@@ -447,6 +483,7 @@ function HorizontalVirtualThumbList({
|
|
|
447
483
|
actions?: ThumbnailActions;
|
|
448
484
|
activeRef: React.MutableRefObject<HTMLButtonElement | null>;
|
|
449
485
|
onSelect: (index: number) => void;
|
|
486
|
+
onArrowKeyDown: (event: React.KeyboardEvent<HTMLButtonElement>, index: number) => void;
|
|
450
487
|
scale: number;
|
|
451
488
|
thumbWidth: number;
|
|
452
489
|
}) {
|
|
@@ -516,15 +553,18 @@ function HorizontalVirtualThumbList({
|
|
|
516
553
|
}, [current, itemWidth, pages.length, thumbWidth]);
|
|
517
554
|
|
|
518
555
|
const visibleRange = clampVisibleRange(range, current, pages.length);
|
|
556
|
+
const commentCounts = usePageCommentCounts();
|
|
519
557
|
const visible = [];
|
|
520
558
|
for (let i = visibleRange.start; i < visibleRange.end; i++) {
|
|
521
559
|
const PageComp = pages[i];
|
|
522
560
|
const active = i === current;
|
|
561
|
+
const commentCount = commentCounts?.get(i) ?? 0;
|
|
523
562
|
const button = (
|
|
524
563
|
<button
|
|
525
564
|
type="button"
|
|
526
565
|
ref={active ? activeRef : undefined}
|
|
527
566
|
onClick={() => onSelect(i)}
|
|
567
|
+
onKeyDown={(event) => onArrowKeyDown(event, i)}
|
|
528
568
|
aria-label={format(t.thumbnailRail.goToPageAria, { n: i + 1 })}
|
|
529
569
|
aria-current={active ? 'page' : undefined}
|
|
530
570
|
className={cn(
|
|
@@ -555,6 +595,9 @@ function HorizontalVirtualThumbList({
|
|
|
555
595
|
</SlidePageProvider>
|
|
556
596
|
</SlideCanvas>
|
|
557
597
|
</div>
|
|
598
|
+
{commentCount > 0 && (
|
|
599
|
+
<CommentCountBadge count={commentCount} className="absolute -top-0.5 -right-1" />
|
|
600
|
+
)}
|
|
558
601
|
</button>
|
|
559
602
|
);
|
|
560
603
|
|
|
@@ -791,6 +834,7 @@ function ThumbContents({
|
|
|
791
834
|
}, [PageComp]);
|
|
792
835
|
|
|
793
836
|
const hasTransition = Boolean(PageComp.transition ?? moduleTransition);
|
|
837
|
+
const commentCount = usePageCommentCounts()?.get(index) ?? 0;
|
|
794
838
|
|
|
795
839
|
return (
|
|
796
840
|
<>
|
|
@@ -803,6 +847,7 @@ function ThumbContents({
|
|
|
803
847
|
>
|
|
804
848
|
{pad2(index + 1)}
|
|
805
849
|
</span>
|
|
850
|
+
{commentCount > 0 && <CommentCountBadge count={commentCount} />}
|
|
806
851
|
{(hasTransition || hasSteps) && (
|
|
807
852
|
<div className="flex flex-col items-end gap-0.5">
|
|
808
853
|
{hasTransition && (
|
|
@@ -948,6 +993,7 @@ function SortableThumb({
|
|
|
948
993
|
active,
|
|
949
994
|
activeRef,
|
|
950
995
|
onSelect,
|
|
996
|
+
onArrowKeyDown,
|
|
951
997
|
ariaLabel,
|
|
952
998
|
children,
|
|
953
999
|
...rest
|
|
@@ -956,6 +1002,7 @@ function SortableThumb({
|
|
|
956
1002
|
active: boolean;
|
|
957
1003
|
activeRef: React.MutableRefObject<HTMLButtonElement | null> | undefined;
|
|
958
1004
|
onSelect: () => void;
|
|
1005
|
+
onArrowKeyDown: React.KeyboardEventHandler<HTMLButtonElement>;
|
|
959
1006
|
ariaLabel: string;
|
|
960
1007
|
children: React.ReactNode;
|
|
961
1008
|
} & Omit<
|
|
@@ -980,6 +1027,7 @@ function SortableThumb({
|
|
|
980
1027
|
ref={setRef}
|
|
981
1028
|
type="button"
|
|
982
1029
|
onClick={onSelect}
|
|
1030
|
+
onKeyDownCapture={isDragging ? undefined : onArrowKeyDown}
|
|
983
1031
|
aria-label={ariaLabel}
|
|
984
1032
|
aria-current={active ? 'page' : undefined}
|
|
985
1033
|
style={{
|
package/src/app/favicon.ico
CHANGED
|
Binary file
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512" fill="none">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="tile" x1="256" y1="16" x2="256" y2="496" gradientUnits="userSpaceOnUse">
|
|
4
|
+
<stop offset="0" stop-color="#FFFFFF"/>
|
|
5
|
+
<stop offset="1" stop-color="#EFEBE6"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
<linearGradient id="tile-edge" x1="256" y1="16" x2="256" y2="496" gradientUnits="userSpaceOnUse">
|
|
8
|
+
<stop offset="0" stop-color="#FFFFFF"/>
|
|
9
|
+
<stop offset="0.5" stop-color="#FFFFFF" stop-opacity="0"/>
|
|
10
|
+
<stop offset="1" stop-color="#000000" stop-opacity="0.08"/>
|
|
11
|
+
</linearGradient>
|
|
12
|
+
<linearGradient id="slide" x1="256" y1="172" x2="256" y2="340" gradientUnits="userSpaceOnUse">
|
|
13
|
+
<stop offset="0" stop-color="#FF8A5E"/>
|
|
14
|
+
<stop offset="0.45" stop-color="#FE5226"/>
|
|
15
|
+
<stop offset="1" stop-color="#EE4316"/>
|
|
16
|
+
</linearGradient>
|
|
17
|
+
<linearGradient id="slide-edge" x1="256" y1="172" x2="256" y2="340" gradientUnits="userSpaceOnUse">
|
|
18
|
+
<stop offset="0" stop-color="#FFFFFF" stop-opacity="0.55"/>
|
|
19
|
+
<stop offset="0.35" stop-color="#FFFFFF" stop-opacity="0"/>
|
|
20
|
+
<stop offset="0.8" stop-color="#B8300C" stop-opacity="0"/>
|
|
21
|
+
<stop offset="1" stop-color="#B8300C" stop-opacity="0.5"/>
|
|
22
|
+
</linearGradient>
|
|
23
|
+
<radialGradient id="slide-sheen" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(196 184) rotate(32) scale(200 110)">
|
|
24
|
+
<stop offset="0" stop-color="#FFFFFF" stop-opacity="0.26"/>
|
|
25
|
+
<stop offset="1" stop-color="#FFFFFF" stop-opacity="0"/>
|
|
26
|
+
</radialGradient>
|
|
27
|
+
<filter id="lift" x="60" y="140" width="392" height="260" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
|
28
|
+
<feDropShadow dx="0" dy="18" stdDeviation="16" flood-color="#FE5226" flood-opacity="0.32"/>
|
|
29
|
+
<feDropShadow dx="0" dy="3" stdDeviation="3" flood-color="#8A2306" flood-opacity="0.22"/>
|
|
30
|
+
</filter>
|
|
31
|
+
</defs>
|
|
32
|
+
<rect x="16" y="16" width="480" height="480" rx="112" fill="url(#tile)"/>
|
|
33
|
+
<rect x="17.5" y="17.5" width="477" height="477" rx="110.5" stroke="url(#tile-edge)" stroke-width="3"/>
|
|
34
|
+
<g filter="url(#lift)">
|
|
35
|
+
<rect x="112" y="172" width="288" height="168" rx="34" fill="url(#slide)"/>
|
|
36
|
+
</g>
|
|
37
|
+
<rect x="112" y="172" width="288" height="168" rx="34" fill="url(#slide-sheen)"/>
|
|
38
|
+
<rect x="113.5" y="173.5" width="285" height="165" rx="32.5" stroke="url(#slide-edge)" stroke-width="3"/>
|
|
39
|
+
</svg>
|
package/src/app/index.html
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
|
-
<link rel="icon" href="./favicon.
|
|
5
|
+
<link rel="icon" href="./lemonriver/brand/favicon-32.png" sizes="32x32" type="image/png" />
|
|
6
|
+
<link rel="icon" href="./lemonriver/brand/app-icon.svg" type="image/svg+xml" />
|
|
6
7
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
8
|
<title>LemonRiver</title>
|
|
8
9
|
<style>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { AgentActivity } from '@/lib/agent/use-agent';
|
|
3
|
+
import { Mascot, type MascotState } from '../brand/mascot';
|
|
4
|
+
import { useLrText } from '../text';
|
|
5
|
+
|
|
6
|
+
const PHASE_STATE: Record<AgentActivity['phase'], MascotState> = {
|
|
7
|
+
thinking: 'thinking',
|
|
8
|
+
tool: 'working',
|
|
9
|
+
waiting: 'needs-you',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/** Lemon in the presence pill above the canvas: thinking, working, or waiting for you. */
|
|
13
|
+
export function PresenceLemon({ phase }: { phase: AgentActivity['phase'] }) {
|
|
14
|
+
return <Mascot state={PHASE_STATE[phase]} size={20} className="-my-1 -ml-1" />;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Lemon at the top of an idle agent panel. */
|
|
18
|
+
export function PanelLemon() {
|
|
19
|
+
return <Mascot state="idle" size={56} float className="mb-2" />;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function WorkingLemon() {
|
|
23
|
+
return <Mascot state="working" size={20} className="-my-1 mr-1 inline-block align-middle" />;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function ErrorLemon() {
|
|
27
|
+
return <Mascot state="needs-you" size={20} className="-my-1 mr-0.5 inline-block align-middle" />;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function ResultLemon({ aborted }: { aborted: boolean }) {
|
|
31
|
+
return (
|
|
32
|
+
<Mascot
|
|
33
|
+
state={aborted ? 'idle' : 'done'}
|
|
34
|
+
size={18}
|
|
35
|
+
className="-my-1 mr-1 inline-block align-middle"
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** The header of a question the agent asks: the design package's confirmation card. */
|
|
41
|
+
export function ConfirmWho() {
|
|
42
|
+
const lr = useLrText();
|
|
43
|
+
return (
|
|
44
|
+
<div className="mb-2 flex items-center gap-2 px-1.5 text-[12.5px] font-semibold">
|
|
45
|
+
<Mascot state="needs-you" size={36} />
|
|
46
|
+
{lr.feedback.confirmWho}
|
|
47
|
+
</div>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Lemon beside an empty state in the editor's compact panels. */
|
|
52
|
+
export function EmptyLemon({ size = 56 }: { size?: number }) {
|
|
53
|
+
return <Mascot state="idle" size={size} float />;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** The comment-mode hint pill, with Lemon in front. */
|
|
57
|
+
export function HintLemon({ children }: { children: ReactNode }) {
|
|
58
|
+
return (
|
|
59
|
+
<span className="inline-flex items-center gap-1.5">
|
|
60
|
+
<Mascot state="idle" size={16} className="-my-1" />
|
|
61
|
+
{children}
|
|
62
|
+
</span>
|
|
63
|
+
);
|
|
64
|
+
}
|