@open-slide/core 2.0.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/{build-DOgOEZZA.js → build-DTmKJyjX.js} +1 -1
  2. package/dist/cli/bin.js +4 -4
  3. package/dist/{config-hT1o6Jct.js → config-Ces2X_3T.js} +159 -17
  4. package/dist/{config-GMR1QUlM.d.ts → config-CpmGqpQi.d.ts} +1 -1
  5. package/dist/{dev-_YkLNJRt.js → dev-ldYag-pR.js} +1 -1
  6. package/dist/index.d.ts +2 -2
  7. package/dist/index.js +4 -3
  8. package/dist/locale/index.d.ts +5 -2
  9. package/dist/locale/index.js +2 -2
  10. package/dist/{preview-pABcGTQh.js → preview-GYMbZvvk.js} +1 -1
  11. package/dist/{types-BcbaKTNY.d.ts → types-CvAqFqsY.d.ts} +10 -5
  12. package/dist/{update-moCkSyvg.js → update-CPBitJQq.js} +24 -14
  13. package/dist/vite/index.d.ts +1 -1
  14. package/dist/vite/index.js +1 -1
  15. package/dist/{zh-tw-DlZoAc2-.js → zh-tw-B7_Oqv2q.js} +550 -17
  16. package/package.json +3 -3
  17. package/skills/apply-comments/SKILL.md +10 -6
  18. package/skills/create-slide/SKILL.md +2 -0
  19. package/skills/current-slide/SKILL.md +1 -0
  20. package/skills/slide-authoring/SKILL.md +31 -1
  21. package/src/app/app.tsx +2 -0
  22. package/src/app/assets/open-slide.svg +39 -0
  23. package/src/app/components/command/command-menu.tsx +1 -3
  24. package/src/app/components/history-provider.tsx +25 -3
  25. package/src/app/components/icon-switcher-indicator.tsx +1 -1
  26. package/src/app/components/inspector/comment-layer.tsx +992 -0
  27. package/src/app/components/inspector/inspect-overlay.tsx +2 -39
  28. package/src/app/components/inspector/inspector-panel.tsx +9 -92
  29. package/src/app/components/inspector/inspector-provider.tsx +299 -67
  30. package/src/app/components/panel/editor-sidebar.tsx +1 -1
  31. package/src/app/components/panel/save-card.tsx +6 -2
  32. package/src/app/components/preview-step-host.tsx +16 -0
  33. package/src/app/components/sidebar/sidebar.tsx +2 -2
  34. package/src/app/components/slide-transition-layer.tsx +1 -1
  35. package/src/app/components/style-panel/style-panel.tsx +3 -2
  36. package/src/app/components/thumbnail-rail.tsx +76 -1
  37. package/src/app/favicon.ico +0 -0
  38. package/src/app/favicon.svg +39 -0
  39. package/src/app/index.html +2 -1
  40. package/src/app/lib/inspector/freeze-motion.ts +61 -0
  41. package/src/app/lib/inspector/use-comments.ts +32 -3
  42. package/src/app/lib/keys.ts +3 -0
  43. package/src/app/lib/locale-store.ts +6 -1
  44. package/src/app/lib/print-ready.ts +9 -6
  45. package/src/app/routes/presenter.tsx +1 -16
  46. package/src/app/routes/preview.tsx +169 -0
  47. package/src/app/routes/slide.tsx +119 -70
  48. package/src/app/styles.css +64 -80
  49. package/src/locale/en.ts +7 -4
  50. package/src/locale/es.ts +550 -0
  51. package/src/locale/index.ts +1 -0
  52. package/src/locale/ja.ts +7 -5
  53. package/src/locale/types.ts +10 -5
  54. package/src/locale/zh-cn.ts +7 -4
  55. package/src/locale/zh-tw.ts +7 -4
  56. package/src/app/assets/open-slide.png +0 -0
  57. package/src/app/components/inspector/comment-widget.tsx +0 -119
@@ -284,10 +284,9 @@ export const zhTW: Locale = {
284
284
  agentNotWatching: 'Agent 沒在關注',
285
285
  agentNotWatchingTooltip:
286
286
  '已和 dev server 斷線,agent 看不到你選的元素了。請重新啟動 dev server 來恢復連線。',
287
- leaveComment: '留言',
287
+ commentMode: '留言',
288
288
  commentPlaceholder: '描述你希望代理進行的修改…',
289
- commentShortcutHint: '⌘/ 聚焦 · ⌘↵ 新增',
290
- addComment: '新增 comment',
289
+ commentPost: '送出',
291
290
  unsavedChanges: {
292
291
  one: '{count} 項未儲存的變更',
293
292
  other: '{count} 項未儲存的變更',
@@ -297,10 +296,14 @@ export const zhTW: Locale = {
297
296
  other: '{count} 則留言',
298
297
  },
299
298
  commentLineLabel: '第 {n} 行',
300
- commentsEmpty: '還沒有留言。選取物件後,在格式面板中開啟「留言」。',
299
+ commentRegionLabel: '範圍',
300
+ commentEmptyHint: '點選元件或拖曳框選一個範圍來留言。',
301
301
  commentsApplyHintPrefix: '在你的代理中執行 ',
302
302
  commentsApplyHintSuffix: ' 以套用這些變更。',
303
303
  commentDeleteAria: '刪除',
304
+ commentUpdateFailed: '無法更新留言:',
305
+ commentAddFailed: '無法新增留言:',
306
+ commentRegionNoTarget: '找不到可以附加這個範圍的元件。',
304
307
  saveFailed: '儲存失敗:',
305
308
  decreaseFontSize: '縮小字級',
306
309
  increaseFontSize: '放大字級',
Binary file
@@ -1,119 +0,0 @@
1
- import { MessageSquare, Trash2, X } from 'lucide-react';
2
- import { useEffect, useRef, useState } from 'react';
3
- import { usePanelMount } from '@/components/panel/panel-shell';
4
- import { format, plural, useLocale } from '@/lib/use-locale';
5
- import { cn } from '@/lib/utils';
6
- import { useInspector } from './inspector-provider';
7
-
8
- export function CommentWidget() {
9
- const t = useLocale();
10
- const { comments, remove, error } = useInspector();
11
- const [open, setOpen] = useState(false);
12
- const count = comments.length;
13
- const ref = useRef<HTMLDivElement>(null);
14
- const panelRef = useRef<HTMLDivElement>(null);
15
- const fabRef = useRef<HTMLButtonElement>(null);
16
- const { mounted, animVisible } = usePanelMount(open);
17
-
18
- useEffect(() => {
19
- if (!open) return;
20
- const onPointerDown = (e: PointerEvent) => {
21
- if (!ref.current?.contains(e.target as Node)) setOpen(false);
22
- };
23
- document.addEventListener('pointerdown', onPointerDown);
24
- return () => document.removeEventListener('pointerdown', onPointerDown);
25
- }, [open]);
26
-
27
- // The panel stays mounted through its close fade; hand focus back to the
28
- // toggle so it doesn't sit on a control that's about to unmount.
29
- useEffect(() => {
30
- if (open) return;
31
- if (panelRef.current?.contains(document.activeElement)) fabRef.current?.focus();
32
- }, [open]);
33
-
34
- return (
35
- <div
36
- ref={ref}
37
- data-inspector-ui
38
- className="absolute right-4 bottom-4 z-20 flex flex-col items-end gap-2"
39
- >
40
- {mounted && (
41
- <div
42
- ref={panelRef}
43
- aria-hidden={!animVisible}
44
- className={cn(
45
- 'w-80 origin-bottom-right rounded-[8px] border bg-card shadow-overlay',
46
- 'motion-safe:transition-[opacity,translate,scale] motion-safe:duration-200 motion-safe:ease-swift',
47
- animVisible
48
- ? 'translate-y-0 scale-100 opacity-100'
49
- : 'pointer-events-none translate-y-1.5 scale-95 opacity-0',
50
- )}
51
- >
52
- <div className="flex items-center justify-between border-b px-3 py-2">
53
- <span className="text-xs font-semibold">
54
- {format(plural(count, t.inspector.commentsCount), { count })}
55
- </span>
56
- <button
57
- type="button"
58
- aria-label={t.common.close}
59
- className="-m-1 rounded-[5px] p-1 text-muted-foreground transition-[color,scale] duration-150 hover:text-foreground active:scale-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40"
60
- onClick={() => setOpen(false)}
61
- >
62
- <X className="size-3.5" />
63
- </button>
64
- </div>
65
- {error && <p className="px-3 py-2 text-xs text-destructive">{error}</p>}
66
- {count === 0 ? (
67
- <p className="px-3 py-6 text-center text-xs text-muted-foreground">
68
- {t.inspector.commentsEmpty}
69
- </p>
70
- ) : (
71
- <>
72
- <ul className="max-h-72 overflow-auto">
73
- {comments.map((c) => (
74
- <li
75
- key={c.id}
76
- className="flex items-start gap-2 border-b px-3 py-2 last:border-0"
77
- >
78
- <div className="min-w-0 flex-1">
79
- <div className="text-[10px] font-mono text-muted-foreground">
80
- {format(t.inspector.commentLineLabel, { n: c.line })}
81
- </div>
82
- <div className="mt-0.5 text-xs break-words">{c.note}</div>
83
- </div>
84
- <button
85
- type="button"
86
- onClick={() => remove(c.id)}
87
- className="shrink-0 rounded-[5px] p-1 text-muted-foreground transition-[color,background-color,scale] duration-150 hover:bg-muted hover:text-destructive active:scale-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40"
88
- aria-label={t.inspector.commentDeleteAria}
89
- title={t.inspector.commentDeleteAria}
90
- >
91
- <Trash2 className="size-3.5" />
92
- </button>
93
- </li>
94
- ))}
95
- </ul>
96
- <div className="border-t px-3 py-2 text-[11px] text-muted-foreground">
97
- {t.inspector.commentsApplyHintPrefix}
98
- <code className="rounded bg-muted px-1 py-0.5 font-mono text-foreground">
99
- /apply-comments
100
- </code>
101
- {t.inspector.commentsApplyHintSuffix}
102
- </div>
103
- </>
104
- )}
105
- </div>
106
- )}
107
- <button
108
- ref={fabRef}
109
- type="button"
110
- onClick={() => setOpen((o) => !o)}
111
- className="flex items-center gap-2 rounded-full border bg-card px-3 py-2 text-xs font-medium shadow-floating transition-[background-color,scale] duration-150 hover:bg-muted active:scale-[0.96] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40"
112
- aria-expanded={open}
113
- >
114
- <MessageSquare className="size-4" />
115
- <span className="nums">{count}</span>
116
- </button>
117
- </div>
118
- );
119
- }