@open-slide/core 2.0.0-beta.2 → 2.0.0-beta.5

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 (51) hide show
  1. package/README.md +1 -1
  2. package/dist/{build-Bzy-qlGc.js → build-Cu5_qRyE.js} +1 -1
  3. package/dist/cli/bin.js +3 -3
  4. package/dist/{config-nbSvY7z_.js → config-BQ6rD2iE.js} +226 -27
  5. package/dist/{config-DjWifhaA.d.ts → config-GMR1QUlM.d.ts} +1 -1
  6. package/dist/{dev-MXa5Tod4.js → dev-BK641O5e.js} +1 -1
  7. package/dist/index.d.ts +2 -2
  8. package/dist/index.js +1 -1
  9. package/dist/locale/index.d.ts +1 -1
  10. package/dist/locale/index.js +1 -1
  11. package/dist/{preview-DEpQcKz3.js → preview-BuCI-RMW.js} +1 -1
  12. package/dist/{types-BWg-Dtbg.d.ts → types-BcbaKTNY.d.ts} +60 -0
  13. package/dist/vite/index.d.ts +1 -1
  14. package/dist/vite/index.js +1 -1
  15. package/dist/{zh-tw-DlKyeNX7.js → zh-tw-B51sMTg3.js} +267 -31
  16. package/package.json +5 -5
  17. package/src/app/components/asset-view.tsx +448 -0
  18. package/src/app/components/history-provider.tsx +68 -44
  19. package/src/app/components/icon-switcher-indicator.tsx +10 -0
  20. package/src/app/components/inspector/arrange-panel.tsx +449 -0
  21. package/src/app/components/inspector/inline-text-editor.tsx +170 -284
  22. package/src/app/components/inspector/inspect-overlay.tsx +642 -295
  23. package/src/app/components/inspector/inspector-panel.tsx +434 -427
  24. package/src/app/components/inspector/inspector-provider.tsx +564 -293
  25. package/src/app/components/inspector/save-bar.tsx +36 -0
  26. package/src/app/components/panel/editor-sidebar.tsx +50 -0
  27. package/src/app/components/panel/panel-fields.tsx +204 -16
  28. package/src/app/components/panel/panel-shell.tsx +3 -18
  29. package/src/app/components/style-panel/style-panel.tsx +4 -69
  30. package/src/app/lib/assets.ts +33 -0
  31. package/src/app/lib/inspector/geometry.test.ts +324 -0
  32. package/src/app/lib/inspector/geometry.ts +207 -0
  33. package/src/app/lib/inspector/text-edit-timeline.test.ts +121 -0
  34. package/src/app/lib/inspector/text-edit-timeline.ts +12 -0
  35. package/src/app/lib/inspector/text-selection.ts +117 -0
  36. package/src/app/lib/inspector/use-editor.ts +1 -1
  37. package/src/app/lib/inspector/use-visual-editor.ts +429 -0
  38. package/src/app/lib/inspector/visual-dom.ts +255 -0
  39. package/src/app/lib/keys.ts +9 -0
  40. package/src/app/lib/pptx/css.test.ts +33 -0
  41. package/src/app/lib/pptx/css.ts +12 -0
  42. package/src/app/lib/pptx/measure.ts +1 -19
  43. package/src/app/lib/use-document-title.test.ts +14 -0
  44. package/src/app/lib/use-document-title.ts +16 -0
  45. package/src/app/routes/presenter.tsx +2 -0
  46. package/src/app/routes/slide.tsx +36 -9
  47. package/src/locale/en.ts +70 -8
  48. package/src/locale/ja.ts +72 -7
  49. package/src/locale/types.ts +60 -0
  50. package/src/locale/zh-cn.ts +68 -8
  51. package/src/locale/zh-tw.ts +68 -8
@@ -0,0 +1,255 @@
1
+ import type { SelectedTarget } from '@/components/inspector/inspector-provider';
2
+ import { findSlideSource } from './fiber';
3
+ import {
4
+ type Point,
5
+ type Rect,
6
+ rectContains,
7
+ rectsIntersect,
8
+ solveResizeDimensions,
9
+ } from './geometry';
10
+ import type { EditOp } from './use-editor';
11
+
12
+ export type Canvas = {
13
+ root: HTMLElement;
14
+ rect: DOMRect;
15
+ scale: number;
16
+ width: number;
17
+ height: number;
18
+ };
19
+
20
+ export function readCanvas(): Canvas | null {
21
+ const root = document.querySelector<HTMLElement>('[data-inspector-root] [data-osd-canvas]');
22
+ if (!root) return null;
23
+ const rect = root.getBoundingClientRect();
24
+ const width = root.offsetWidth;
25
+ const height = root.offsetHeight;
26
+ if (!width || !height || !rect.width) return null;
27
+ return { root, rect, scale: rect.width / width, width, height };
28
+ }
29
+
30
+ export function readFrame(anchor: HTMLElement, canvas: Canvas): Rect {
31
+ const rect = anchor.getBoundingClientRect();
32
+ return {
33
+ x: (rect.left - canvas.rect.left) / canvas.scale,
34
+ y: (rect.top - canvas.rect.top) / canvas.scale,
35
+ width: rect.width / canvas.scale,
36
+ height: rect.height / canvas.scale,
37
+ };
38
+ }
39
+
40
+ export function readRotation(anchor: HTMLElement): number {
41
+ const value = getComputedStyle(anchor).rotate;
42
+ if (value === 'none') return 0;
43
+ const angle = value.split(' ').at(-1) ?? '0';
44
+ const n = Number.parseFloat(angle) || 0;
45
+ return angle.endsWith('grad')
46
+ ? n * 0.9
47
+ : angle.endsWith('rad')
48
+ ? (n * 180) / Math.PI
49
+ : angle.endsWith('turn')
50
+ ? n * 360
51
+ : n;
52
+ }
53
+
54
+ export function editableTargets(canvas: Canvas, slideId: string): SelectedTarget[] {
55
+ const anchors = new Set<HTMLElement>();
56
+ const targets: SelectedTarget[] = [];
57
+ for (const element of canvas.root.querySelectorAll<HTMLElement>('[data-slide-loc]')) {
58
+ const hit = findSlideSource(element, slideId, { hostOnly: true });
59
+ if (!hit || anchors.has(hit.anchor) || hit.anchor.closest('[aria-hidden="true"]')) continue;
60
+ const rect = hit.anchor.getBoundingClientRect();
61
+ const style = getComputedStyle(hit.anchor);
62
+ if (!rect.width || !rect.height || style.visibility === 'hidden' || style.display === 'none')
63
+ continue;
64
+ anchors.add(hit.anchor);
65
+ targets.push(hit);
66
+ }
67
+ return targets;
68
+ }
69
+
70
+ export function independentTargets(targets: SelectedTarget[]): SelectedTarget[] {
71
+ return targets.filter(
72
+ (target, index) =>
73
+ targets.findIndex((other) => other.anchor === target.anchor) === index &&
74
+ !targets.some(
75
+ (other) => other.anchor !== target.anchor && other.anchor.contains(target.anchor),
76
+ ),
77
+ );
78
+ }
79
+
80
+ // A partially covered ancestor yields to the children the marquee also
81
+ // touches, so sweeping across a few cards picks the cards, not their wrapper.
82
+ export function marqueeTargets(
83
+ rect: Rect,
84
+ candidates: Array<{ target: SelectedTarget; frame: Rect }>,
85
+ ): SelectedTarget[] {
86
+ const hits = candidates.filter(({ frame }) => rectsIntersect(rect, frame));
87
+ return hits
88
+ .filter(
89
+ ({ target, frame }) =>
90
+ rectContains(rect, frame) ||
91
+ !hits.some(
92
+ (other) =>
93
+ other.target.anchor !== target.anchor && target.anchor.contains(other.target.anchor),
94
+ ),
95
+ )
96
+ .map(({ target }) => target);
97
+ }
98
+
99
+ export function canTransform(target: SelectedTarget, canvas: Canvas): boolean {
100
+ const style = getComputedStyle(target.anchor);
101
+ const rect = target.anchor.getBoundingClientRect();
102
+ return (
103
+ target.anchor.isConnected &&
104
+ canvas.root.contains(target.anchor) &&
105
+ style.display !== 'contents' &&
106
+ rect.width > 0 &&
107
+ rect.height > 0 &&
108
+ (style.display !== 'inline' || target.anchor instanceof HTMLImageElement) &&
109
+ canvas.root.querySelectorAll(`[data-slide-loc="${target.line}:${target.column}"]`).length === 1
110
+ );
111
+ }
112
+
113
+ export type TransformSnapshot = {
114
+ target: SelectedTarget;
115
+ frame: Rect;
116
+ style: string | null;
117
+ translate: Point;
118
+ basis: { a: number; b: number; c: number; d: number };
119
+ rotation: number;
120
+ width: number;
121
+ height: number;
122
+ };
123
+
124
+ export function captureTransform(target: SelectedTarget, canvas: Canvas): TransformSnapshot {
125
+ const { anchor } = target;
126
+ const style = anchor.getAttribute('style');
127
+ const frame = readFrame(anchor, canvas);
128
+ const rotation = readRotation(anchor);
129
+ const computed = getComputedStyle(anchor);
130
+ const width = Number.parseFloat(computed.width) || anchor.offsetWidth;
131
+ const height = Number.parseFloat(computed.height) || anchor.offsetHeight;
132
+ const before = anchor.getBoundingClientRect();
133
+ // Probe the browser's coordinate basis so nested transforms and percentage translations survive.
134
+ anchor.style.transition = 'none';
135
+ anchor.style.translate = '0px 0px';
136
+ const zero = anchor.getBoundingClientRect();
137
+ anchor.style.translate = '100px 0px';
138
+ const x = anchor.getBoundingClientRect();
139
+ anchor.style.translate = '0px 100px';
140
+ const y = anchor.getBoundingClientRect();
141
+ restoreStyle(anchor, style);
142
+ const basis = {
143
+ a: (x.x - zero.x) / 100,
144
+ b: (x.y - zero.y) / 100,
145
+ c: (y.x - zero.x) / 100,
146
+ d: (y.y - zero.y) / 100,
147
+ };
148
+ const translate = localDelta(basis, { x: before.x - zero.x, y: before.y - zero.y });
149
+ return { target, frame, style, translate, basis, rotation, width, height };
150
+ }
151
+
152
+ function localDelta(basis: TransformSnapshot['basis'], delta: Point): Point {
153
+ const determinant = basis.a * basis.d - basis.b * basis.c;
154
+ if (Math.abs(determinant) < 0.000001) return { x: 0, y: 0 };
155
+ return {
156
+ x: (basis.d * delta.x - basis.c * delta.y) / determinant,
157
+ y: (basis.a * delta.y - basis.b * delta.x) / determinant,
158
+ };
159
+ }
160
+
161
+ export function styleOp(key: string, value: string): EditOp {
162
+ return { kind: 'set-style', key, value };
163
+ }
164
+
165
+ export function moveOps(snapshot: TransformSnapshot, delta: Point, canvas: Canvas): EditOp[] {
166
+ const local = localDelta(snapshot.basis, {
167
+ x: delta.x * canvas.scale,
168
+ y: delta.y * canvas.scale,
169
+ });
170
+ return [
171
+ styleOp(
172
+ 'translate',
173
+ `${round(snapshot.translate.x + local.x)}px ${round(snapshot.translate.y + local.y)}px`,
174
+ ),
175
+ ];
176
+ }
177
+
178
+ export function sizeOps(
179
+ snapshot: TransformSnapshot,
180
+ frame: Rect,
181
+ canvas: Canvas,
182
+ fixedPoint: Point = { x: 0, y: 0 },
183
+ ): EditOp[] {
184
+ const anchor = snapshot.target.anchor;
185
+ restoreTransform(snapshot);
186
+ const constraints = [
187
+ styleOp('minWidth', '0px'),
188
+ styleOp('minHeight', '0px'),
189
+ styleOp('maxWidth', 'none'),
190
+ styleOp('maxHeight', 'none'),
191
+ styleOp('flexShrink', '0'),
192
+ styleOp('flexGrow', '0'),
193
+ styleOp('flexBasis', 'auto'),
194
+ ];
195
+ const dimensions = (width: number, height: number) => [
196
+ styleOp('width', `${round(Math.max(8, width))}px`),
197
+ styleOp('height', `${round(Math.max(8, height))}px`),
198
+ ];
199
+ anchor.style.transition = 'none';
200
+ previewOps(anchor, [
201
+ ...constraints,
202
+ ...dimensions(snapshot.width, snapshot.height),
203
+ ...moveOps(snapshot, { x: 0, y: 0 }, canvas),
204
+ ]);
205
+ const base = readFrame(anchor, canvas);
206
+ previewOps(anchor, dimensions(snapshot.width + 100, snapshot.height));
207
+ const wider = readFrame(anchor, canvas);
208
+ previewOps(anchor, dimensions(snapshot.width, snapshot.height + 100));
209
+ const taller = readFrame(anchor, canvas);
210
+ const basis = {
211
+ a: (wider.width - base.width) / 100,
212
+ b: (wider.height - base.height) / 100,
213
+ c: (taller.width - base.width) / 100,
214
+ d: (taller.height - base.height) / 100,
215
+ };
216
+ const size = solveResizeDimensions(snapshot, basis, {
217
+ x: frame.width - base.width,
218
+ y: frame.height - base.height,
219
+ });
220
+ const ops = [...constraints, ...dimensions(size.width, size.height)];
221
+ previewOps(anchor, ops);
222
+ const measured = readFrame(anchor, canvas);
223
+ const position = moveOps(
224
+ snapshot,
225
+ {
226
+ x: frame.x + (frame.width - measured.width) * fixedPoint.x - measured.x,
227
+ y: frame.y + (frame.height - measured.height) * fixedPoint.y - measured.y,
228
+ },
229
+ canvas,
230
+ );
231
+ restoreTransform(snapshot);
232
+ return [...ops, ...position];
233
+ }
234
+
235
+ export function previewOps(anchor: HTMLElement, ops: EditOp[]) {
236
+ const style = anchor.style as unknown as Record<string, string>;
237
+ for (const op of ops) if (op.kind === 'set-style') style[op.key] = op.value ?? '';
238
+ }
239
+
240
+ export function restoreTransform(snapshot: TransformSnapshot) {
241
+ restoreStyle(snapshot.target.anchor, snapshot.style);
242
+ }
243
+
244
+ function restoreStyle(anchor: HTMLElement, style: string | null) {
245
+ if (style === null) anchor.removeAttribute('style');
246
+ else anchor.setAttribute('style', style);
247
+ anchor.style.transition = 'none';
248
+ anchor.getBoundingClientRect();
249
+ if (style === null) anchor.removeAttribute('style');
250
+ else anchor.setAttribute('style', style);
251
+ }
252
+
253
+ export function round(value: number): number {
254
+ return Math.round(value * 100) / 100;
255
+ }
@@ -4,6 +4,15 @@ export function isTypingTarget(target: EventTarget | null): boolean {
4
4
  );
5
5
  }
6
6
 
7
+ export function isShortcutControlTarget(target: EventTarget | null): boolean {
8
+ return (
9
+ target instanceof Element &&
10
+ !!target.closest(
11
+ 'button, a, input, textarea, select, summary, [role="dialog"], [role="menu"], [role="listbox"], [role="tablist"], [data-inspector-ui], [data-design-ui]',
12
+ )
13
+ );
14
+ }
15
+
7
16
  // Single-letter shortcuts bail on this so browser combos (⌘P, ⌘F…) still work.
8
17
  export function hasModifier(e: KeyboardEvent): boolean {
9
18
  return e.altKey || e.ctrlKey || e.metaKey;
@@ -2,6 +2,7 @@ import { describe, expect, it } from 'vitest';
2
2
  import {
3
3
  applyTextTransform,
4
4
  decompose,
5
+ geometryFor,
5
6
  gradientLineLength,
6
7
  multiply,
7
8
  normalizeRadii,
@@ -170,3 +171,35 @@ describe('misc', () => {
170
171
  expect(applyTextTransform('Hello', 'none')).toBe('Hello');
171
172
  });
172
173
  });
174
+
175
+ describe('geometryFor', () => {
176
+ const uniform = (x: number, y = x): Parameters<typeof geometryFor>[0] => [
177
+ { x, y },
178
+ { x, y },
179
+ { x, y },
180
+ { x, y },
181
+ ];
182
+ it('keeps a pill as a rounded rectangle', () => {
183
+ const radii = normalizeRadii(uniform(9999), 540, 56);
184
+ expect(geometryFor(radii, 540, 56)).toEqual({ kind: 'roundRect', radius: 28 });
185
+ });
186
+ it('treats a fully rounded square as an ellipse', () => {
187
+ const radii = normalizeRadii(uniform(9999), 64, 64);
188
+ expect(geometryFor(radii, 64, 64)).toEqual({ kind: 'ellipse' });
189
+ });
190
+ it('treats 50% corners on a wide box as an ellipse', () => {
191
+ expect(geometryFor(uniform(100, 30), 200, 60)).toEqual({ kind: 'ellipse' });
192
+ });
193
+ it('maps small uniform corners to a rounded rectangle', () => {
194
+ expect(geometryFor(uniform(12), 300, 80)).toEqual({ kind: 'roundRect', radius: 12 });
195
+ });
196
+ it('falls back to a custom path for mixed or elliptical corners', () => {
197
+ const mixed = uniform(12);
198
+ mixed[2] = { x: 0, y: 0 };
199
+ expect(geometryFor(mixed, 300, 80).kind).toBe('custom');
200
+ expect(geometryFor(uniform(40, 10), 300, 80).kind).toBe('custom');
201
+ });
202
+ it('maps no radius to a plain rectangle', () => {
203
+ expect(geometryFor(uniform(0), 300, 80)).toEqual({ kind: 'rect' });
204
+ });
205
+ });
@@ -1,3 +1,5 @@
1
+ import type { Geometry } from './scene';
2
+
1
3
  export type Rgba = { r: number; g: number; b: number; a: number };
2
4
  export type ColorParser = (value: string) => Rgba | null;
3
5
 
@@ -430,6 +432,16 @@ export function hasRadius(radii: Radii): boolean {
430
432
  return radii.some((c) => c.x > 0.01 && c.y > 0.01);
431
433
  }
432
434
 
435
+ export function geometryFor(radii: Radii, w: number, h: number): Geometry {
436
+ if (!hasRadius(radii)) return { kind: 'rect' };
437
+ const [tl, ...rest] = radii;
438
+ const uniform = rest.every((c) => Math.abs(c.x - tl.x) < 0.5 && Math.abs(c.y - tl.y) < 0.5);
439
+ if (!uniform) return { kind: 'custom', radii };
440
+ if (tl.x >= w / 2 - 0.5 && tl.y >= h / 2 - 0.5) return { kind: 'ellipse' };
441
+ if (Math.abs(tl.x - tl.y) < 0.5) return { kind: 'roundRect', radius: tl.x };
442
+ return { kind: 'custom', radii };
443
+ }
444
+
433
445
  export function parseBlurPx(filter: string): number {
434
446
  if (!filter || filter === 'none') return 0;
435
447
  let total = 0;
@@ -4,7 +4,7 @@ import {
4
4
  applyToPoint,
5
5
  type ColorParser,
6
6
  decompose,
7
- hasRadius,
7
+ geometryFor,
8
8
  IDENTITY,
9
9
  isIdentity,
10
10
  isVisibleColor,
@@ -605,24 +605,6 @@ function radiiOf(cs: CSSStyleDeclaration, w: number, h: number): Radii {
605
605
  );
606
606
  }
607
607
 
608
- function geometryFor(radii: Radii, w: number, h: number): Geometry {
609
- if (!hasRadius(radii)) return { kind: 'rect' };
610
- const [tl, tr, br, bl] = radii;
611
- const same =
612
- Math.abs(tl.x - tr.x) < 0.5 &&
613
- Math.abs(tl.x - br.x) < 0.5 &&
614
- Math.abs(tl.x - bl.x) < 0.5 &&
615
- Math.abs(tl.y - tr.y) < 0.5 &&
616
- Math.abs(tl.y - br.y) < 0.5 &&
617
- Math.abs(tl.y - bl.y) < 0.5;
618
- if (same && Math.abs(tl.x - tl.y) < 0.5) {
619
- if (tl.x >= Math.min(w, h) / 2 - 0.5) return { kind: 'ellipse' };
620
- return { kind: 'roundRect', radius: tl.x };
621
- }
622
- if (same && tl.x >= w / 2 - 0.5 && tl.y >= h / 2 - 0.5) return { kind: 'ellipse' };
623
- return { kind: 'custom', radii };
624
- }
625
-
626
608
  function shrinkRadii(radii: Radii, by: number): Radii {
627
609
  return radii.map((c) => ({ x: Math.max(0, c.x - by), y: Math.max(0, c.y - by) })) as Radii;
628
610
  }
@@ -0,0 +1,14 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { DEFAULT_DOCUMENT_TITLE, resolveDocumentTitle } from './use-document-title.ts';
3
+
4
+ describe('resolveDocumentTitle', () => {
5
+ it('uses the deck title', () => {
6
+ expect(resolveDocumentTitle('Quarterly Product Review')).toBe('Quarterly Product Review');
7
+ });
8
+
9
+ it('falls back when the deck has no title', () => {
10
+ expect(resolveDocumentTitle()).toBe(DEFAULT_DOCUMENT_TITLE);
11
+ expect(resolveDocumentTitle('')).toBe(DEFAULT_DOCUMENT_TITLE);
12
+ expect(resolveDocumentTitle(' ')).toBe(DEFAULT_DOCUMENT_TITLE);
13
+ });
14
+ });
@@ -0,0 +1,16 @@
1
+ import { useEffect } from 'react';
2
+
3
+ export const DEFAULT_DOCUMENT_TITLE = 'open-slide';
4
+
5
+ export function resolveDocumentTitle(title?: string): string {
6
+ return title?.trim() || DEFAULT_DOCUMENT_TITLE;
7
+ }
8
+
9
+ export function useDocumentTitle(title?: string) {
10
+ useEffect(() => {
11
+ document.title = resolveDocumentTitle(title);
12
+ return () => {
13
+ document.title = DEFAULT_DOCUMENT_TITLE;
14
+ };
15
+ }, [title]);
16
+ }
@@ -21,6 +21,7 @@ import { useNavigate, useParams } from 'react-router-dom';
21
21
  import { Button } from '@/components/ui/button';
22
22
  import { Dialog, DialogContent, DialogTitle, DialogTrigger } from '@/components/ui/dialog';
23
23
  import { hasModifier, isBackwardKey, isForwardKey, isTypingTarget } from '@/lib/keys';
24
+ import { useDocumentTitle } from '@/lib/use-document-title';
24
25
  import { format, useLocale } from '@/lib/use-locale';
25
26
  import { cn, pad2 } from '@/lib/utils';
26
27
  import {
@@ -38,6 +39,7 @@ import { useSlideModule } from '../lib/use-slide-module';
38
39
  export function Presenter() {
39
40
  const { slideId = '' } = useParams();
40
41
  const { slide, error } = useSlideModule(slideId);
42
+ useDocumentTitle(slide?.meta?.title);
41
43
 
42
44
  // Presenter view is a passive mirror of the projection window. It only
43
45
  // tracks the index it last heard about; navigation buttons send commands
@@ -32,15 +32,16 @@ import { HistoryProvider } from '@/components/history-provider';
32
32
  import { CommentWidget } from '@/components/inspector/comment-widget';
33
33
  import { InlineEditLayer } from '@/components/inspector/inline-text-editor';
34
34
  import { InspectOverlay } from '@/components/inspector/inspect-overlay';
35
- import { InspectorPanel } from '@/components/inspector/inspector-panel';
36
35
  import {
36
+ InspectModeSwitcher,
37
37
  InspectorProvider,
38
- InspectToggleButton,
38
+ InspectPanelButton,
39
39
  useInspector,
40
40
  } from '@/components/inspector/inspector-provider';
41
41
  import { SaveBar } from '@/components/inspector/save-bar';
42
+ import { EditorSidebar } from '@/components/panel/editor-sidebar';
42
43
  import { DesignProvider } from '@/components/style-panel/design-provider';
43
- import { DesignPanel, DesignToggleButton } from '@/components/style-panel/style-panel';
44
+ import { DesignToggleButton } from '@/components/style-panel/style-panel';
44
45
  import { Button, buttonVariants } from '@/components/ui/button';
45
46
  import {
46
47
  DropdownMenu,
@@ -53,10 +54,17 @@ import {
53
54
  import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs';
54
55
  import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';
55
56
  import { useFolders } from '@/lib/folders';
56
- import { hasModifier, isBackwardKey, isForwardKey, isTypingTarget } from '@/lib/keys';
57
+ import {
58
+ hasModifier,
59
+ isBackwardKey,
60
+ isForwardKey,
61
+ isShortcutControlTarget,
62
+ isTypingTarget,
63
+ } from '@/lib/keys';
57
64
  import { readLastHomeLocation } from '@/lib/last-home-location';
58
65
  import { useAgentSocketConnected } from '@/lib/use-agent-socket';
59
66
  import { useClickPageNavigation } from '@/lib/use-click-page-navigation';
67
+ import { useDocumentTitle } from '@/lib/use-document-title';
60
68
  import { useIsMobile } from '@/lib/use-is-mobile';
61
69
  import { format, useLocale } from '@/lib/use-locale';
62
70
  import { useWheelPageNavigation } from '@/lib/use-wheel-page-navigation';
@@ -101,6 +109,7 @@ export function Slide() {
101
109
  }
102
110
  }, [navigate]);
103
111
  const { slide, error } = useSlideModule(slideId);
112
+ useDocumentTitle(slide?.meta?.title);
104
113
  const [playMode, setPlayMode] = useState<'window' | 'fullscreen' | null>(null);
105
114
  // Last deck the Player showed. During a presenter-driven deck switch the
106
115
  // route's slideId changes while the new module loads and warms; rendering
@@ -296,7 +305,14 @@ export function Slide() {
296
305
  // page-nav handler too would race it and skip <Steps> reveals, so bail out.
297
306
  if (playMode || !showSlideUi) return;
298
307
  const onKey = (e: KeyboardEvent) => {
299
- if (isTypingTarget(e.target)) return;
308
+ if (
309
+ isTypingTarget(e.target) ||
310
+ isShortcutControlTarget(e.target) ||
311
+ e.isComposing ||
312
+ e.keyCode === 229 ||
313
+ e.defaultPrevented
314
+ )
315
+ return;
300
316
  // Letter shortcuts only fire bare so browser combos (Cmd/Ctrl-P, ⌘F…) stay intact.
301
317
  if (hasModifier(e)) return;
302
318
  // Toggle overview from either state — the overview's own capture-phase
@@ -593,7 +609,12 @@ export function Slide() {
593
609
 
594
610
  return (
595
611
  <HistoryProvider>
596
- <InspectorProvider slideId={slideId} pageIndex={index}>
612
+ <InspectorProvider
613
+ slideId={slideId}
614
+ pageIndex={index}
615
+ panelHidden={designOpen}
616
+ onPanelOpen={() => setDesignOpen(false)}
617
+ >
597
618
  <SelectionReporter />
598
619
  <div className="flex h-dvh flex-col overflow-hidden bg-sidebar text-foreground">
599
620
  {/* Toolbar sits directly on the chrome ground — three zones, mono-folio center */}
@@ -645,6 +666,10 @@ export function Slide() {
645
666
  </div>
646
667
 
647
668
  <div className="flex flex-1 items-center justify-end gap-1 md:ml-auto md:flex-none">
669
+ {view === 'slides' && <InspectModeSwitcher />}
670
+ {import.meta.env.DEV && view === 'slides' && (
671
+ <span aria-hidden className="mx-0.5 hidden h-5 w-px bg-hairline md:block" />
672
+ )}
648
673
  {view === 'slides' && (
649
674
  <button
650
675
  type="button"
@@ -730,7 +755,7 @@ export function Slide() {
730
755
  {view === 'slides' && (
731
756
  <DesignToggleButton active={designOpen} onToggle={() => setDesignOpen((v) => !v)} />
732
757
  )}
733
- {view === 'slides' && <InspectToggleButton />}
758
+ {view === 'slides' && <InspectPanelButton />}
734
759
  <span aria-hidden className="mx-0.5 hidden h-5 w-px bg-hairline md:block" />
735
760
  {view === 'slides' && (
736
761
  <div className="inline-flex items-stretch">
@@ -843,8 +868,10 @@ export function Slide() {
843
868
  actions={thumbnailActions}
844
869
  />
845
870
  </div>
846
- <InspectorPanel />
847
- <DesignPanel open={designOpen} onClose={() => setDesignOpen(false)} />
871
+ <EditorSidebar
872
+ designOpen={designOpen}
873
+ onCloseDesign={() => setDesignOpen(false)}
874
+ />
848
875
  </div>
849
876
  {import.meta.env.DEV && (
850
877
  <NotesDrawer
package/src/locale/en.ts CHANGED
@@ -197,6 +197,54 @@ export const en: Locale = {
197
197
  },
198
198
 
199
199
  inspector: {
200
+ format: 'Format',
201
+ editMode: 'Edit',
202
+ previewMode: 'Preview',
203
+ closeFormatPanel: 'Close Format panel',
204
+ editText: 'Edit on slide',
205
+ emptySelectionTitle: 'Select an object',
206
+ emptySelectionHint: 'Click an object to format it. Double-click text to edit.',
207
+ textSelectionHint: 'Formatting applies to the selected text.',
208
+ elementText: 'Text',
209
+ elementImage: 'Image',
210
+ elementShape: 'Shape',
211
+ sourceSection: 'Source',
212
+ rotateHandle: 'Rotate element',
213
+ resizeHandle: 'Resize {handle}',
214
+ arrangeSection: 'Arrange',
215
+ selectionCount: '{count} elements selected',
216
+ positionLabel: 'Position',
217
+ positionX: 'Horizontal position',
218
+ positionY: 'Vertical position',
219
+ widthLabel: 'Width',
220
+ heightLabel: 'Height',
221
+ rotationLabel: 'Rotation',
222
+ alignToLabel: 'Align to',
223
+ alignToSelection: 'Selection',
224
+ alignToSlide: 'Slide',
225
+ alignLeft: 'Align left',
226
+ alignCenter: 'Align horizontal centers',
227
+ alignRight: 'Align right',
228
+ alignTop: 'Align top',
229
+ alignMiddle: 'Align vertical centers',
230
+ alignBottom: 'Align bottom',
231
+ distributeLabel: 'Distribute',
232
+ distributeHorizontal: 'Distribute horizontally',
233
+ distributeVertical: 'Distribute vertically',
234
+ layerLabel: 'Layer',
235
+ bringToFront: 'Bring to front',
236
+ bringForward: 'Bring forward',
237
+ sendBackward: 'Send backward',
238
+ sendToBack: 'Send to back',
239
+ smartGuides: 'Smart guides',
240
+ selectParent: 'Select parent',
241
+ visualEditorHint:
242
+ 'Shift-click to select more. ⌘A selects all. Arrows move 1 px; Shift moves 10 px. Alt ignores guides. Shift constrains drag or keeps resize proportions.',
243
+ sharedLayoutHint:
244
+ 'This element shares its JSX definition with other instances. Select a unique parent container to arrange it independently.',
245
+ inlineLayoutHint: 'Select the parent container to move or resize inline content.',
246
+ layerLayoutHint:
247
+ 'Some nested content cannot be positioned independently. Select a positioned parent to change layers.',
200
248
  inspect: 'Inspect',
201
249
  deselect: 'Deselect',
202
250
  agentWatching: 'Agent is watching',
@@ -214,12 +262,12 @@ export const en: Locale = {
214
262
  elementTextPlaceholder: 'Element text',
215
263
  sizeLabel: 'Size',
216
264
  weightLabel: 'Weight',
217
- weightLight: 'Light · 300',
218
- weightRegular: 'Regular · 400',
219
- weightMedium: 'Medium · 500',
220
- weightSemibold: 'Semibold · 600',
221
- weightBold: 'Bold · 700',
222
- weightExtrabold: 'Extrabold · 800',
265
+ weightLight: 'Light',
266
+ weightRegular: 'Regular',
267
+ weightMedium: 'Medium',
268
+ weightSemibold: 'Semibold',
269
+ weightBold: 'Bold',
270
+ weightExtrabold: 'Extrabold',
223
271
  styleLabel: 'Style',
224
272
  boldAria: 'Bold',
225
273
  italicAria: 'Italic',
@@ -239,7 +287,7 @@ export const en: Locale = {
239
287
  cropFitCover: 'Fill',
240
288
  cropFitContain: 'Fit',
241
289
  cropApply: 'Apply',
242
- leaveComment: 'Leave a comment',
290
+ leaveComment: 'Comment',
243
291
  commentPlaceholder: 'Describe a change for the agent…',
244
292
  commentShortcutHint: '⌘/ to focus · ⌘↵ to add',
245
293
  addComment: 'Add comment',
@@ -252,7 +300,7 @@ export const en: Locale = {
252
300
  other: '{count} comments',
253
301
  },
254
302
  commentLineLabel: 'line {n}',
255
- commentsEmpty: 'No comments yet. Toggle Inspect and click a slide element.',
303
+ commentsEmpty: 'No comments yet. Select an object and open Comment in the Format panel.',
256
304
  commentsApplyHintPrefix: 'Run ',
257
305
  commentsApplyHintSuffix: ' in your agent to apply these.',
258
306
  commentDeleteAria: 'Delete',
@@ -321,6 +369,7 @@ export const en: Locale = {
321
369
  noMatchingAssetsHint: 'Try adjusting your search or filters.',
322
370
  clearFilters: 'Clear filters',
323
371
  searchLogos: 'Search logos',
372
+ searchFonts: 'Search fonts',
324
373
  upload: 'Upload',
325
374
  dropToUpload: 'Drop to upload',
326
375
  loading: 'Loading…',
@@ -358,6 +407,18 @@ export const en: Locale = {
358
407
  logoSearchEmptyHintSuffix: '.',
359
408
  logoVariantLight: 'Light',
360
409
  logoVariantDark: 'Dark',
410
+ fontSearchTitle: 'Search Google Fonts',
411
+ fontSearchPoweredByPrefix: 'Powered by ',
412
+ fontSearchPlaceholder: 'Search font families…',
413
+ fontSearchPreviewPlaceholder: 'Preview text',
414
+ fontSearchErrorTitle: "Couldn't reach Google Fonts",
415
+ fontSearchErrorBody: 'Check your connection and try again.',
416
+ fontSearchNoResults: 'No fonts for "{query}"',
417
+ fontSearchEmpty: 'No fonts available',
418
+ fontSearchEmptyHintPrefix: 'Try a different family name, or browse the full catalog at ',
419
+ fontSearchEmptyHintSuffix: '.',
420
+ fontWeightLabel: 'Weight',
421
+ fontPreviewSample: 'The quick brown fox jumps over the lazy dog 0123456789',
361
422
  toastUploadFailed: 'Upload failed ({status})',
362
423
  toastReplaced: 'Replaced {name}',
363
424
  toastUploadedAs: 'Uploaded as {name}',
@@ -367,6 +428,7 @@ export const en: Locale = {
367
428
  toastDeleteFailed: 'Delete failed ({status})',
368
429
  toastDeleted: 'Deleted {name}',
369
430
  toastDownloadFailed: 'Failed to download logo',
431
+ toastFontDownloadFailed: 'Failed to download font',
370
432
  toastSearchFailed: 'Search failed',
371
433
  },
372
434