@open-slide/core 2.3.1 → 2.4.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 (89) hide show
  1. package/dist/{build-8lRsgsO4.js → build-D7GwYl8d.js} +1 -1
  2. package/dist/cli/bin.js +4 -4
  3. package/dist/{config-CDrYgaEj.d.ts → config-CfhtJxQH.d.ts} +1 -1
  4. package/dist/{config-D2Mq1vSW.js → config-D4uPk_tM.js} +383 -138
  5. package/dist/{dev-BvefEp1Q.js → dev-DyCDMbHB.js} +10 -10
  6. package/dist/index.d.ts +2 -2
  7. package/dist/index.js +9 -1
  8. package/dist/locale/index.d.ts +1 -1
  9. package/dist/locale/index.js +1 -1
  10. package/dist/{preview-D8ognobz.js → preview-DjIFvt0K.js} +1 -1
  11. package/dist/{types-DFK02XVv.d.ts → types-ZfArJF0d.d.ts} +21 -13
  12. package/dist/{update-BivdNgL3.js → update-BKhRM7o4.js} +30 -3
  13. package/dist/vite/index.d.ts +1 -1
  14. package/dist/vite/index.js +1 -1
  15. package/dist/{zh-tw-B1pkKQsc.js → zh-tw-D7LfGVmA.js} +220 -65
  16. package/package.json +5 -6
  17. package/src/agent/provider.ts +8 -1
  18. package/src/agent/types.ts +17 -2
  19. package/src/app/app.tsx +2 -0
  20. package/src/app/components/agent/agent-markdown.tsx +3 -6
  21. package/src/app/components/agent/agent-panel.tsx +36 -258
  22. package/src/app/components/agent/agent-presence.tsx +1 -1
  23. package/src/app/components/agent/composer.tsx +52 -24
  24. package/src/app/components/agent/effort-slider.tsx +172 -0
  25. package/src/app/components/agent/model-menu.tsx +170 -0
  26. package/src/app/components/agent/permission-menu.tsx +88 -0
  27. package/src/app/components/agent/transcript.tsx +23 -31
  28. package/src/app/components/command/home-command-menu.tsx +4 -1
  29. package/src/app/components/command/slide-command-menu.tsx +4 -1
  30. package/src/app/components/export-progress-toast.tsx +3 -1
  31. package/src/app/components/inspector/asset-picker-dialog.tsx +1 -1
  32. package/src/app/components/inspector/comment-layer.tsx +3 -3
  33. package/src/app/components/inspector/inline-text-editor.tsx +1 -12
  34. package/src/app/components/inspector/inspect-overlay.tsx +9 -1
  35. package/src/app/components/inspector/inspector-panel.tsx +8 -35
  36. package/src/app/components/inspector/inspector-provider.tsx +177 -36
  37. package/src/app/components/inspector/page-panel.tsx +270 -0
  38. package/src/app/components/language-toggle.tsx +13 -11
  39. package/src/app/components/note-markdown.test.tsx +12 -6
  40. package/src/app/components/note-markdown.tsx +16 -21
  41. package/src/app/components/overview-grid.tsx +3 -3
  42. package/src/app/components/panel/editor-sidebar.tsx +43 -8
  43. package/src/app/components/panel/panel-shell.tsx +9 -5
  44. package/src/app/components/panel/save-card.tsx +1 -1
  45. package/src/app/components/player.tsx +105 -23
  46. package/src/app/components/present/curtain.tsx +52 -0
  47. package/src/app/components/present/last-slide-hint.tsx +36 -0
  48. package/src/app/components/sidebar/folder-item.tsx +4 -1
  49. package/src/app/components/sidebar/sidebar.tsx +11 -8
  50. package/src/app/components/slide-canvas.tsx +1 -1
  51. package/src/app/components/style-panel/design-provider.tsx +48 -11
  52. package/src/app/components/style-panel/use-design.ts +6 -1
  53. package/src/app/components/theme-toggle.tsx +16 -22
  54. package/src/app/components/thumbnail-rail.tsx +69 -50
  55. package/src/app/components/ui/context-menu.tsx +9 -10
  56. package/src/app/components/ui/dialog.tsx +2 -4
  57. package/src/app/components/ui/dropdown-menu.tsx +9 -10
  58. package/src/app/components/ui/popover.tsx +1 -1
  59. package/src/app/components/ui/select.tsx +2 -2
  60. package/src/app/components/ui/sonner.tsx +2 -2
  61. package/src/app/index.html +7 -0
  62. package/src/app/lib/agent/use-agent.ts +131 -37
  63. package/src/app/lib/desktop-host.ts +31 -0
  64. package/src/app/lib/desktop-routes.test.ts +54 -0
  65. package/src/app/lib/desktop-routes.ts +22 -0
  66. package/src/app/lib/desktop.ts +106 -0
  67. package/src/app/lib/export-pdf.ts +15 -7
  68. package/src/app/lib/inspector/color.ts +51 -0
  69. package/src/app/lib/inspector/fiber.ts +6 -0
  70. package/src/app/lib/inspector/use-editor.ts +2 -1
  71. package/src/app/lib/inspector/use-notes.test.ts +209 -0
  72. package/src/app/lib/inspector/use-notes.ts +331 -57
  73. package/src/app/lib/inspector/use-visual-editor.ts +9 -1
  74. package/src/app/lib/locale-store.ts +14 -2
  75. package/src/app/lib/note-markdown.test.ts +69 -5
  76. package/src/app/lib/note-markdown.ts +97 -22
  77. package/src/app/lib/transition.test.ts +84 -1
  78. package/src/app/lib/transition.ts +43 -0
  79. package/src/app/lib/unsaved.test.ts +253 -0
  80. package/src/app/lib/unsaved.ts +155 -0
  81. package/src/app/routes/home.tsx +14 -6
  82. package/src/app/routes/slide.tsx +184 -130
  83. package/src/app/styles.css +421 -1
  84. package/src/locale/en.ts +41 -15
  85. package/src/locale/es.ts +41 -17
  86. package/src/locale/ja.ts +41 -15
  87. package/src/locale/types.ts +20 -14
  88. package/src/locale/zh-cn.ts +41 -14
  89. package/src/locale/zh-tw.ts +41 -14
@@ -0,0 +1,270 @@
1
+ import { MousePointer2 } from 'lucide-react';
2
+ import { useCallback, useEffect, useState } from 'react';
3
+ import { ColorField, Field } from '@/components/panel/panel-fields';
4
+ import { isTransparent, opaqueHex } from '@/lib/inspector/color';
5
+ import { findSlideSource, jsxOwnerType } from '@/lib/inspector/fiber';
6
+ import { readCanvas, readFrame } from '@/lib/inspector/visual-dom';
7
+ import type { Page } from '@/lib/sdk';
8
+ import { describeTransition, type SlideTransition } from '@/lib/transition';
9
+ import { format, plural, useLocale } from '@/lib/use-locale';
10
+ import { type SelectedTarget, useInspector } from './inspector-provider';
11
+
12
+ export type PageInfo = {
13
+ index: number;
14
+ total: number;
15
+ component: Page | undefined;
16
+ transition: SlideTransition | undefined;
17
+ inheritedTransition: boolean;
18
+ themed: boolean;
19
+ };
20
+
21
+ type BackgroundSource = 'page' | 'theme' | 'shared' | 'complex' | 'unknown';
22
+
23
+ type PageState = {
24
+ color: string | null;
25
+ preview: string | null;
26
+ source: BackgroundSource;
27
+ target: SelectedTarget | null;
28
+ // Only an inline background can be reset; one from a class stays put.
29
+ inline: boolean;
30
+ steps: number;
31
+ };
32
+
33
+ export function PagePanel({ page }: { page: PageInfo }) {
34
+ const t = useLocale();
35
+ const { slideId, bufferOps } = useInspector();
36
+ const state = usePageState(page.index, page.component, slideId);
37
+ const transition = page.transition ? describeTransition(page.transition) : null;
38
+
39
+ const setBackground = (value: string | null) => {
40
+ if (!state?.target) return;
41
+ const { line, column, anchor } = state.target;
42
+ bufferOps(line, column, anchor, [
43
+ { kind: 'set-style', key: 'background', value: null },
44
+ { kind: 'set-style', key: 'backgroundColor', value },
45
+ ]);
46
+ };
47
+
48
+ const backgroundCaption =
49
+ state?.source === 'theme'
50
+ ? t.inspector.pageBackgroundTheme
51
+ : state?.source === 'shared'
52
+ ? t.inspector.pageBackgroundShared
53
+ : state?.source === 'complex'
54
+ ? t.inspector.pageBackgroundComplex
55
+ : null;
56
+
57
+ return (
58
+ <div data-page-panel className="flex min-h-full flex-col">
59
+ <div className="px-3.5 pt-3.5 pb-1 text-[12px] font-medium">
60
+ {format(t.inspector.pageLabel, { page: page.index + 1, total: page.total })}
61
+ </div>
62
+ <div className="flex flex-col gap-3 px-3.5 py-4">
63
+ <div className="flex flex-col gap-1">
64
+ {state?.target && state.source !== 'complex' ? (
65
+ <ColorField
66
+ label={t.inspector.pageBackground}
67
+ value={state.color ?? '#ffffff'}
68
+ dim={!state.color}
69
+ onChange={setBackground}
70
+ onClear={page.themed && state.inline ? () => setBackground(null) : undefined}
71
+ />
72
+ ) : (
73
+ <Field label={t.inspector.pageBackground}>
74
+ <span className="flex size-7 shrink-0 items-center justify-center rounded-[5px] border border-border bg-background">
75
+ <span
76
+ className="size-4 rounded-[3px] ring-1 ring-foreground/10 ring-inset"
77
+ style={{
78
+ backgroundColor: state?.color ?? 'transparent',
79
+ backgroundImage: state?.preview ?? undefined,
80
+ }}
81
+ />
82
+ </span>
83
+ {!state?.preview && (
84
+ <span className="nums font-mono text-[11px] text-foreground/80 uppercase">
85
+ {state?.color ?? '—'}
86
+ </span>
87
+ )}
88
+ </Field>
89
+ )}
90
+ {backgroundCaption && <Caption>{backgroundCaption}</Caption>}
91
+ </div>
92
+ <div className="flex flex-col gap-1">
93
+ <Field label={t.inspector.pageTransition}>
94
+ <span className="truncate text-[12px]">
95
+ {transition ? (
96
+ <>
97
+ {t.inspector.transitionKinds[transition.kind]}
98
+ <span className="nums text-muted-foreground"> · {transition.duration}ms</span>
99
+ </>
100
+ ) : (
101
+ <span className="text-muted-foreground">{t.inspector.pageNone}</span>
102
+ )}
103
+ </span>
104
+ </Field>
105
+ {transition && page.inheritedTransition && (
106
+ <Caption>{t.inspector.pageTransitionInherited}</Caption>
107
+ )}
108
+ </div>
109
+ <Field label={t.inspector.pageSteps}>
110
+ <span className="nums text-[12px]">
111
+ {state && state.steps > 0 ? (
112
+ format(plural(state.steps, t.inspector.pageStepsCount), { count: state.steps })
113
+ ) : (
114
+ <span className="text-muted-foreground">{t.inspector.pageNone}</span>
115
+ )}
116
+ </span>
117
+ </Field>
118
+ </div>
119
+ <p className="mt-auto flex items-start gap-2 border-t border-hairline px-3.5 py-3 text-[11px] leading-relaxed text-muted-foreground">
120
+ <MousePointer2 aria-hidden className="mt-0.5 size-3 shrink-0" />
121
+ {t.inspector.emptySelectionHint}
122
+ </p>
123
+ </div>
124
+ );
125
+ }
126
+
127
+ function Caption({ children }: { children: React.ReactNode }) {
128
+ return <p className="pl-20 text-[11px] text-muted-foreground">{children}</p>;
129
+ }
130
+
131
+ function usePageState(index: number, component: Page | undefined, slideId: string) {
132
+ const [state, setState] = useState<PageState | null>(null);
133
+ const read = useCallback(
134
+ () => setState(readPageState(index, component, slideId)),
135
+ [index, component, slideId],
136
+ );
137
+
138
+ useEffect(() => {
139
+ read();
140
+ const canvas = readCanvas();
141
+ if (!canvas) return;
142
+ let raf = 0;
143
+ const observer = new MutationObserver(() => {
144
+ cancelAnimationFrame(raf);
145
+ raf = requestAnimationFrame(read);
146
+ });
147
+ observer.observe(canvas.root, {
148
+ subtree: true,
149
+ childList: true,
150
+ attributes: true,
151
+ attributeFilter: ['style', 'class', 'data-osd-step', 'data-osd-current-page'],
152
+ });
153
+ observer.observe(document.documentElement, { attributes: true, attributeFilter: ['class'] });
154
+ return () => {
155
+ cancelAnimationFrame(raf);
156
+ observer.disconnect();
157
+ };
158
+ }, [read]);
159
+
160
+ return state;
161
+ }
162
+
163
+ function readPageState(
164
+ index: number,
165
+ component: Page | undefined,
166
+ slideId: string,
167
+ ): PageState | null {
168
+ const canvas = readCanvas();
169
+ const layer = canvas?.root.querySelector<HTMLElement>(`[data-osd-current-page="${index}"]`);
170
+ if (!canvas || !layer) return null;
171
+
172
+ const covers = (el: HTMLElement) => {
173
+ const frame = readFrame(el, canvas);
174
+ return (
175
+ Math.abs(frame.x) < 1 &&
176
+ Math.abs(frame.y) < 1 &&
177
+ frame.width >= canvas.width - 1 &&
178
+ frame.height >= canvas.height - 1
179
+ );
180
+ };
181
+ const chain: HTMLElement[] = [];
182
+ let ambiguous = false;
183
+ let level: HTMLElement | null = layer;
184
+ while (level) {
185
+ const candidates: HTMLElement[] = Array.from(level.children).filter(
186
+ (child): child is HTMLElement => child instanceof HTMLElement && covers(child),
187
+ );
188
+ let next: HTMLElement | undefined =
189
+ candidates.length > 1 ? topmost(candidates, canvas.rect) : candidates[0];
190
+ if (!next && candidates.length > 0) {
191
+ ambiguous = true;
192
+ next = candidates.at(-1);
193
+ }
194
+ if (next) chain.push(next);
195
+ level = next ?? null;
196
+ }
197
+
198
+ // Only JSX written in this page's own component is safe to edit: a shared
199
+ // frame component would carry the change onto every page that uses it.
200
+ const ownTarget = (el: HTMLElement): SelectedTarget | null => {
201
+ if (!component || jsxOwnerType(el) !== component) return null;
202
+ const hit = findSlideSource(el, slideId, { hostOnly: true });
203
+ return hit?.anchor === el ? hit : null;
204
+ };
205
+
206
+ const steps = layer.querySelectorAll('[data-osd-step]').length;
207
+ const painted = [...chain].reverse().find((el) => {
208
+ const style = getComputedStyle(el);
209
+ return !isTransparent(style.backgroundColor) || style.backgroundImage !== 'none';
210
+ });
211
+
212
+ const themeBackground = layer.parentElement
213
+ ? getComputedStyle(layer.parentElement).backgroundColor
214
+ : '';
215
+ const themeColor = opaqueHex(themeBackground);
216
+ if (ambiguous) {
217
+ const style = painted ? getComputedStyle(painted) : null;
218
+ const image = style?.backgroundImage ?? 'none';
219
+ return {
220
+ color: style ? opaqueHex(style.backgroundColor) : themeColor,
221
+ preview: image === 'none' ? null : image,
222
+ source: 'unknown',
223
+ target: null,
224
+ inline: false,
225
+ steps,
226
+ };
227
+ }
228
+ if (!painted) {
229
+ const target = chain.map(ownTarget).find(Boolean) ?? null;
230
+ return { color: themeColor, preview: null, source: 'theme', target, inline: false, steps };
231
+ }
232
+
233
+ const style = getComputedStyle(painted);
234
+ const target = ownTarget(painted);
235
+ const color = opaqueHex(style.backgroundColor);
236
+ const complex = style.backgroundImage !== 'none';
237
+ // A page that writes its own background owns it even when it matches the
238
+ // theme, so it can still be reset to follow later theme changes.
239
+ const ownBackground = Boolean(
240
+ target && (painted.style.background || painted.style.backgroundColor),
241
+ );
242
+ return {
243
+ color,
244
+ preview: complex ? style.backgroundImage : null,
245
+ source: complex
246
+ ? 'complex'
247
+ : ownBackground
248
+ ? 'page'
249
+ : color && color === themeColor
250
+ ? 'theme'
251
+ : target
252
+ ? 'page'
253
+ : 'shared',
254
+ target,
255
+ inline: ownBackground,
256
+ steps,
257
+ };
258
+ }
259
+
260
+ // Hit testing lists elements in paint order, so the browser settles which
261
+ // overlapping sibling is actually visible. A sibling it skips, such as one
262
+ // with `pointer-events: none`, leaves the order unknown.
263
+ function topmost(candidates: HTMLElement[], rect: DOMRect): HTMLElement | undefined {
264
+ const x = (Math.max(rect.left, 0) + Math.min(rect.right, window.innerWidth)) / 2;
265
+ const y = (Math.max(rect.top, 0) + Math.min(rect.bottom, window.innerHeight)) / 2;
266
+ const stack = document.elementsFromPoint(x, y);
267
+ const order = candidates.map((el) => stack.indexOf(el));
268
+ if (order.some((index) => index < 0)) return undefined;
269
+ return candidates[order.indexOf(Math.min(...order))];
270
+ }
@@ -4,10 +4,11 @@ import { buttonVariants } from '@/components/ui/button';
4
4
  import {
5
5
  DropdownMenu,
6
6
  DropdownMenuContent,
7
- DropdownMenuItem,
7
+ DropdownMenuRadioGroup,
8
+ DropdownMenuRadioItem,
8
9
  DropdownMenuTrigger,
9
10
  } from '@/components/ui/dropdown-menu';
10
- import { LOCALE_OPTIONS, setLocale } from '@/lib/locale-store';
11
+ import { LOCALE_OPTIONS, type LocaleId, setLocale } from '@/lib/locale-store';
11
12
  import { useLocale } from '@/lib/use-locale';
12
13
  import { cn } from '@/lib/utils';
13
14
 
@@ -30,15 +31,16 @@ export function LanguageToggle() {
30
31
  </DropdownMenuTrigger>
31
32
  </IconTooltip>
32
33
  <DropdownMenuContent align="end" className="min-w-[140px]">
33
- {LOCALE_OPTIONS.map((option) => (
34
- <DropdownMenuItem
35
- key={option.id}
36
- onClick={() => setLocale(option.id)}
37
- data-active={t.id === option.id}
38
- >
39
- {option.label}
40
- </DropdownMenuItem>
41
- ))}
34
+ <DropdownMenuRadioGroup
35
+ value={t.id}
36
+ onValueChange={(value) => setLocale(value as LocaleId)}
37
+ >
38
+ {LOCALE_OPTIONS.map((option) => (
39
+ <DropdownMenuRadioItem key={option.id} value={option.id} closeOnClick>
40
+ {option.label}
41
+ </DropdownMenuRadioItem>
42
+ ))}
43
+ </DropdownMenuRadioGroup>
42
44
  </DropdownMenuContent>
43
45
  </DropdownMenu>
44
46
  );
@@ -7,9 +7,9 @@ const render = (text: string) => renderToStaticMarkup(<NoteMarkdown text={text}
7
7
  describe('NoteMarkdown', () => {
8
8
  it('renders inline markdown as semantic elements', () => {
9
9
  const html = render('a **bold** and *soft* `cmd`');
10
- expect(html).toContain('<strong class="font-semibold">bold</strong>');
10
+ expect(html).toContain('<strong>bold</strong>');
11
11
  expect(html).toContain('<em>soft</em>');
12
- expect(html).toContain('>cmd</code>');
12
+ expect(html).toContain('<code>cmd</code>');
13
13
  });
14
14
 
15
15
  it('renders headings demoted to h4–h6', () => {
@@ -21,8 +21,12 @@ describe('NoteMarkdown', () => {
21
21
  });
22
22
 
23
23
  it('renders lists with the right element', () => {
24
- expect(render('- a\n- b')).toMatch(/<ul[^>]*>.*<li>a<\/li><li>b<\/li>.*<\/ul>/);
25
- expect(render('1. a\n2. b')).toMatch(/<ol[^>]*>.*<li>a<\/li><li>b<\/li>.*<\/ol>/);
24
+ expect(render('- a\n- b')).toContain('<ul><li>a</li><li>b</li></ul>');
25
+ expect(render('1. a\n2. b')).toContain('<ol><li>a</li><li>b</li></ol>');
26
+ });
27
+
28
+ it('renders nested lists inside their parent item and keeps the start number', () => {
29
+ expect(render('2. A\n - a1')).toContain('<ol start="2"><li>A<ul><li>a1</li></ul></li></ol>');
26
30
  });
27
31
 
28
32
  it('joins paragraph lines with <br/> and splits paragraphs', () => {
@@ -36,7 +40,9 @@ describe('NoteMarkdown', () => {
36
40
  expect(html).not.toContain('<em>');
37
41
  });
38
42
 
39
- it('preserves whitespace via a pre-wrap wrapper', () => {
40
- expect(render('x')).toContain('whitespace-pre-wrap');
43
+ it('wraps output in the md container with any extra class', () => {
44
+ expect(renderToStaticMarkup(<NoteMarkdown text="x" className="extra" />)).toBe(
45
+ '<div class="md extra"><p>x</p></div>',
46
+ );
41
47
  });
42
48
  });
@@ -1,7 +1,6 @@
1
1
  import { Fragment, type ReactNode, useMemo } from 'react';
2
2
  import { type NoteBlock, type NoteInline, parseNoteMarkdown } from '@/lib/note-markdown';
3
-
4
- const CODE_CLASS = 'rounded-[3px] bg-foreground/12 px-[0.3em] py-[0.1em] font-mono text-[0.9em]';
3
+ import { cn } from '@/lib/utils';
5
4
 
6
5
  function renderInline(nodes: NoteInline[]): ReactNode {
7
6
  return nodes.map((node, i) => {
@@ -12,9 +11,7 @@ function renderInline(nodes: NoteInline[]): ReactNode {
12
11
  case 'strong':
13
12
  return (
14
13
  // biome-ignore lint/suspicious/noArrayIndexKey: static parse output, never reordered
15
- <strong key={i} className="font-semibold">
16
- {renderInline(node.children)}
17
- </strong>
14
+ <strong key={i}>{renderInline(node.children)}</strong>
18
15
  );
19
16
  case 'em':
20
17
  return (
@@ -24,9 +21,7 @@ function renderInline(nodes: NoteInline[]): ReactNode {
24
21
  case 'code':
25
22
  return (
26
23
  // biome-ignore lint/suspicious/noArrayIndexKey: static parse output, never reordered
27
- <code key={i} className={CODE_CLASS}>
28
- {node.text}
29
- </code>
24
+ <code key={i}>{node.text}</code>
30
25
  );
31
26
  default:
32
27
  return node satisfies never;
@@ -34,7 +29,9 @@ function renderInline(nodes: NoteInline[]): ReactNode {
34
29
  });
35
30
  }
36
31
 
37
- const HEADING_SIZES = { 1: 'text-[1.25em]', 2: 'text-[1.12em]', 3: 'text-[1.05em]' } as const;
32
+ function renderBlocks(blocks: NoteBlock[]): ReactNode {
33
+ return blocks.map(renderBlock);
34
+ }
38
35
 
39
36
  function renderBlock(block: NoteBlock, key: number): ReactNode {
40
37
  switch (block.type) {
@@ -42,26 +39,24 @@ function renderBlock(block: NoteBlock, key: number): ReactNode {
42
39
  // h4–h6 so note headings stay below the app's own UI headings in the
43
40
  // presenter window's document outline.
44
41
  const Tag = `h${block.level + 3}` as 'h4' | 'h5' | 'h6';
45
- return (
46
- <Tag key={key} className={`font-semibold ${HEADING_SIZES[block.level]}`}>
47
- {renderInline(block.children)}
48
- </Tag>
49
- );
42
+ return <Tag key={key}>{renderInline(block.children)}</Tag>;
50
43
  }
51
44
  case 'list': {
52
45
  const Tag = block.ordered ? 'ol' : 'ul';
53
46
  return (
54
- <Tag
55
- key={key}
56
- className={`space-y-[0.2em] pl-[1.4em] ${block.ordered ? 'list-decimal' : 'list-disc'}`}
57
- >
47
+ <Tag key={key} start={block.ordered && block.start !== 1 ? block.start : undefined}>
58
48
  {block.items.map((item, i) => (
59
49
  // biome-ignore lint/suspicious/noArrayIndexKey: static parse output, never reordered
60
- <li key={i}>{renderInline(item)}</li>
50
+ <li key={i}>
51
+ {renderInline(item.content)}
52
+ {renderBlocks(item.children)}
53
+ </li>
61
54
  ))}
62
55
  </Tag>
63
56
  );
64
57
  }
58
+ case 'rule':
59
+ return <hr key={key} />;
65
60
  case 'paragraph':
66
61
  return (
67
62
  <p key={key}>
@@ -79,7 +74,7 @@ function renderBlock(block: NoteBlock, key: number): ReactNode {
79
74
  }
80
75
  }
81
76
 
82
- export function NoteMarkdown({ text }: { text: string }) {
77
+ export function NoteMarkdown({ text, className }: { text: string; className?: string }) {
83
78
  const blocks = useMemo(() => parseNoteMarkdown(text), [text]);
84
- return <div className="space-y-[0.65em] whitespace-pre-wrap">{blocks.map(renderBlock)}</div>;
79
+ return <div className={cn('md', className)}>{renderBlocks(blocks)}</div>;
85
80
  }
@@ -112,7 +112,7 @@ export function OverviewGrid({
112
112
  aria-modal="true"
113
113
  aria-label={t.present.overviewDialogAria}
114
114
  className={cn(
115
- 'absolute inset-0 z-50 flex flex-col backdrop-blur-sm',
115
+ 'absolute inset-0 z-50 flex flex-col backdrop-blur-2xl backdrop-saturate-150',
116
116
  'motion-safe:animate-in motion-safe:fade-in-0 motion-safe:duration-150',
117
117
  styles.surface,
118
118
  )}
@@ -335,7 +335,7 @@ type OverviewStyles = {
335
335
  };
336
336
 
337
337
  const presentStyles = {
338
- surface: 'bg-black/95',
338
+ surface: 'bg-black/80',
339
339
  eyebrow: 'text-white/55',
340
340
  thumbFocused: 'bg-white/10',
341
341
  thumbHover: 'hover:bg-white/5',
@@ -349,7 +349,7 @@ const presentStyles = {
349
349
  } as const;
350
350
 
351
351
  const editorStyles = {
352
- surface: 'bg-background/95',
352
+ surface: 'bg-background/80',
353
353
  eyebrow: 'text-muted-foreground',
354
354
  thumbFocused: 'bg-muted',
355
355
  thumbHover: 'hover:bg-muted/60',
@@ -1,10 +1,12 @@
1
- import { type ReactNode, useState } from 'react';
1
+ import { type CSSProperties, type ReactNode, useEffect, useState } from 'react';
2
2
  import { AGENT_DOCK_W } from '@/components/agent/agent-dock';
3
3
  import { InspectorPanel } from '@/components/inspector/inspector-panel';
4
4
  import { useInspector } from '@/components/inspector/inspector-provider';
5
+ import type { PageInfo } from '@/components/inspector/page-panel';
5
6
  import { useDesignPanelState } from '@/components/style-panel/design-provider';
6
7
  import { DesignPanel } from '@/components/style-panel/style-panel';
7
8
  import { useLocale } from '@/lib/use-locale';
9
+ import { cn } from '@/lib/utils';
8
10
  import { PANEL_TRANSITION_MS, PANEL_W, usePanelMount } from './panel-shell';
9
11
  import { ResizeHandle, useStoredWidth } from './resize-handle';
10
12
 
@@ -22,11 +24,13 @@ export function EditorSidebar({
22
24
  onCloseDesign,
23
25
  agentOpen = false,
24
26
  agent,
27
+ page,
25
28
  }: {
26
29
  designOpen: boolean;
27
30
  onCloseDesign: () => void;
28
31
  agentOpen?: boolean;
29
32
  agent?: ReactNode;
33
+ page?: PageInfo;
30
34
  }) {
31
35
  const t = useLocale();
32
36
  const { active, panelOpen } = useInspector();
@@ -64,7 +68,9 @@ export function EditorSidebar({
64
68
  const [agentMounted, setAgentMounted] = useState(false);
65
69
  if (isAgent && !agentMounted) setAgentMounted(true);
66
70
  const open = mode !== null;
67
- const { mounted, animVisible } = usePanelMount(open);
71
+ const { mounted, animVisible } = usePanelMount(open, { animateInitial: false });
72
+ const [firstRender, setFirstRender] = useState(true);
73
+ useEffect(() => setFirstRender(false), []);
68
74
 
69
75
  if (!mounted) return null;
70
76
 
@@ -97,23 +103,52 @@ export function EditorSidebar({
97
103
  />
98
104
  )}
99
105
  {agentMounted && (
100
- <div
101
- className="sidebar-swap h-full shrink-0"
106
+ <SwapPane
107
+ animate={!firstRender}
108
+ className="h-full shrink-0"
102
109
  style={{ width: agentWidth }}
103
110
  hidden={!isAgent}
104
111
  >
105
112
  {agent}
106
- </div>
113
+ </SwapPane>
107
114
  )}
108
115
  {!isAgent && (
109
- <div className="sidebar-swap flex h-full shrink-0" style={{ width: editorWidth }}>
116
+ <SwapPane
117
+ animate={!firstRender}
118
+ className="flex h-full shrink-0"
119
+ style={{ width: editorWidth }}
120
+ >
110
121
  {lastEditor === 'design' ? (
111
122
  <DesignPanel onClose={onCloseDesign} />
112
123
  ) : (
113
- <InspectorPanel preferredTab={preferredTab} onTabChange={setPreferredTab} />
124
+ <InspectorPanel preferredTab={preferredTab} onTabChange={setPreferredTab} page={page} />
114
125
  )}
115
- </div>
126
+ </SwapPane>
116
127
  )}
117
128
  </div>
118
129
  );
119
130
  }
131
+
132
+ // Fixed at mount, since toggling the fade on a showing pane would replay it; a
133
+ // hidden pane can pick it up, as it only plays once shown again.
134
+ function SwapPane({
135
+ animate,
136
+ hidden = false,
137
+ className,
138
+ style,
139
+ children,
140
+ }: {
141
+ animate: boolean;
142
+ hidden?: boolean;
143
+ className?: string;
144
+ style?: CSSProperties;
145
+ children: ReactNode;
146
+ }) {
147
+ const [fade, setFade] = useState(animate);
148
+ if (hidden && !fade) setFade(true);
149
+ return (
150
+ <div className={cn(fade && 'sidebar-swap', className)} style={style} hidden={hidden}>
151
+ {children}
152
+ </div>
153
+ );
154
+ }
@@ -6,8 +6,8 @@ export const PANEL_TRANSITION_MS = 240;
6
6
 
7
7
  // Defer the width expansion to the next frame so the browser paints once
8
8
  // at width=0 first; otherwise the transition has no starting frame.
9
- export function useAnimatedOpen(open: boolean): boolean {
10
- const [animVisible, setAnimVisible] = useState(false);
9
+ export function useAnimatedOpen(open: boolean, initial = false): boolean {
10
+ const [animVisible, setAnimVisible] = useState(initial);
11
11
  useEffect(() => {
12
12
  if (open) {
13
13
  const id = requestAnimationFrame(() => setAnimVisible(true));
@@ -20,8 +20,12 @@ export function useAnimatedOpen(open: boolean): boolean {
20
20
 
21
21
  // Stay mounted through the close-out width transition so the panel
22
22
  // visibly collapses instead of vanishing.
23
- export function usePanelMount(open: boolean): { mounted: boolean; animVisible: boolean } {
24
- const [mounted, setMounted] = useState(false);
23
+ export function usePanelMount(
24
+ open: boolean,
25
+ { animateInitial = true }: { animateInitial?: boolean } = {},
26
+ ): { mounted: boolean; animVisible: boolean } {
27
+ const [startOpen] = useState(() => open && !animateInitial);
28
+ const [mounted, setMounted] = useState(startOpen);
25
29
  useEffect(() => {
26
30
  if (open) {
27
31
  setMounted(true);
@@ -30,7 +34,7 @@ export function usePanelMount(open: boolean): { mounted: boolean; animVisible: b
30
34
  const t = setTimeout(() => setMounted(false), PANEL_TRANSITION_MS);
31
35
  return () => clearTimeout(t);
32
36
  }, [open]);
33
- const animVisible = useAnimatedOpen(open && mounted);
37
+ const animVisible = useAnimatedOpen(open && mounted, startOpen);
34
38
  return { mounted, animVisible };
35
39
  }
36
40
 
@@ -73,7 +73,7 @@ export function SaveCard({
73
73
  : 'translate-y-2 scale-[0.98] opacity-0',
74
74
  )}
75
75
  >
76
- <div className="pointer-events-auto flex h-9 items-center gap-1 rounded-[8px] border border-border bg-popover/95 py-0.5 pr-0.5 pl-1 shadow-overlay backdrop-blur-md">
76
+ <div className="pointer-events-auto flex h-9 items-center gap-1 rounded-[8px] border border-border bg-material py-0.5 pr-0.5 pl-1 shadow-overlay backdrop-blur-xl backdrop-saturate-150">
77
77
  {showHistory && (
78
78
  <div className="flex items-center">
79
79
  <Button