@open-slide/core 2.1.0 → 2.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-COxfoC_P.js → build-8lRsgsO4.js} +1 -1
- package/dist/cli/bin.js +4 -4
- package/dist/{config-DHPbCCnt.d.ts → config-CDrYgaEj.d.ts} +6 -2
- package/dist/{config-CNhYSo4C.js → config-D2Mq1vSW.js} +2162 -368
- package/dist/{dev-CujpTS3T.js → dev-BvefEp1Q.js} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/locale/index.d.ts +1 -1
- package/dist/locale/index.js +1 -1
- package/dist/{preview-kU5R6QXJ.js → preview-D8ognobz.js} +1 -1
- package/dist/{types-BGUi9COY.d.ts → types-DFK02XVv.d.ts} +119 -4
- package/dist/{update-CPBitJQq.js → update-BivdNgL3.js} +128 -7
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.js +1 -1
- package/dist/{zh-tw-BbFb4PZW.js → zh-tw-B1pkKQsc.js} +570 -20
- package/package.json +5 -5
- package/skills/apply-comments/SKILL.md +9 -6
- 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 +692 -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 +135 -0
- package/src/app/components/agent/provider-logo.tsx +34 -0
- package/src/app/components/agent/transcript.tsx +609 -0
- 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/comment-layer.tsx +1011 -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 +10 -93
- package/src/app/components/inspector/inspector-provider.tsx +120 -46
- 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/thumbnail-rail.tsx +39 -1
- 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/use-auto-grow.ts +15 -0
- package/src/app/lib/utils.ts +4 -0
- package/src/app/routes/home.tsx +43 -7
- package/src/app/routes/slide.tsx +109 -109
- package/src/app/styles.css +234 -80
- package/src/locale/en.ts +113 -4
- package/src/locale/es.ts +115 -5
- package/src/locale/ja.ts +106 -5
- package/src/locale/types.ts +118 -4
- package/src/locale/zh-cn.ts +103 -4
- package/src/locale/zh-tw.ts +103 -4
- package/src/app/components/inspector/comment-widget.tsx +0 -119
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-slide/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Runtime and CLI for open-slide — write slides in slides/, we handle the rest.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@fontsource-variable/geist": "^5.3.0",
|
|
69
69
|
"@tailwindcss/vite": "^4.3.3",
|
|
70
70
|
"@vitejs/plugin-react": "^6.1.1",
|
|
71
|
-
"chalk": "^6.0.
|
|
71
|
+
"chalk": "^6.0.1",
|
|
72
72
|
"class-variance-authority": "^0.7.1",
|
|
73
73
|
"clsx": "^2.1.1",
|
|
74
74
|
"cmdk": "^1.1.1",
|
|
@@ -83,13 +83,13 @@
|
|
|
83
83
|
"react-dom": "^19.2.8",
|
|
84
84
|
"react-image-crop": "^11.0.10",
|
|
85
85
|
"react-router-dom": "^7.18.4",
|
|
86
|
-
"shadcn": "^4.21.
|
|
86
|
+
"shadcn": "^4.21.4",
|
|
87
87
|
"sonner": "^2.0.7",
|
|
88
88
|
"tailwind-merge": "^3.5.0",
|
|
89
89
|
"tailwindcss": "^4.3.3",
|
|
90
90
|
"tw-animate-css": "^1.4.0",
|
|
91
|
-
"use-sync-external-store": "^1.
|
|
92
|
-
"vite": "^8.3.
|
|
91
|
+
"use-sync-external-store": "^1.7.0",
|
|
92
|
+
"vite": "^8.3.3"
|
|
93
93
|
},
|
|
94
94
|
"devDependencies": {
|
|
95
95
|
"@playwright/test": "~1.63.0",
|
|
@@ -5,7 +5,7 @@ description: Apply pending @slide-comment markers written by the open-slide insp
|
|
|
5
5
|
|
|
6
6
|
# Apply slide comments
|
|
7
7
|
|
|
8
|
-
The open-slide editor has
|
|
8
|
+
The open-slide editor has a comment mode that lets the user click a rendered page element, or drag across a region of the page, and attach a textual comment (e.g. *"make this red"*, *"change to 'Open Slide Rocks'"*). Each comment is persisted as an in-source JSX marker inside `slides/<slideId>/index.tsx`.
|
|
9
9
|
|
|
10
10
|
Your job: read those markers, perform the described edits, and delete the markers.
|
|
11
11
|
|
|
@@ -17,8 +17,10 @@ Your job: read those markers, perform the described edits, and delete the marker
|
|
|
17
17
|
{/* @slide-comment id="c-<8hex>" ts="<ISO>" text="<base64url(JSON)>" */}
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
-
|
|
21
|
-
- `text` is base64url-encoded JSON: `{"note": "...", "hint"?: "..."}`.
|
|
20
|
+
- Sits as the **first child inside** the JSX element it refers to (i.e. between that element's opening `>` and its other children). The marker is dropped *into* its target, not floated above it. Newly written markers get a line of their own; older ones may share a line with the content that follows them.
|
|
21
|
+
- `text` is base64url-encoded JSON: `{"note": "...", "hint"?: "...", "rect"?: {"x", "y", "w", "h"}, "page"?: n}`.
|
|
22
|
+
- `rect` is present when the comment was left on a dragged region rather than on an element. Values are pixels on the 1920×1080 page canvas, measured from the page's top-left corner. The marker still sits inside the deepest element that contains the region, but the note refers to what is *inside* that region — possibly several children, or only part of the enclosing element.
|
|
23
|
+
- `page` is the 0-based index (into the default export array) of the page the comment was left on.
|
|
22
24
|
- Detection regex (authoritative — use exactly this):
|
|
23
25
|
|
|
24
26
|
```
|
|
@@ -33,13 +35,14 @@ Your job: read those markers, perform the described edits, and delete the marker
|
|
|
33
35
|
|
|
34
36
|
2. **Read the file and find all markers.**
|
|
35
37
|
- Run the regex above against the whole file.
|
|
36
|
-
- For each match, base64url-decode `text` and `JSON.parse` it to get `{ note, hint? }`.
|
|
37
|
-
- Record each hit as `{ id, lineIndex (0-based), note, hint }`.
|
|
38
|
+
- For each match, base64url-decode `text` and `JSON.parse` it to get `{ note, hint?, rect?, page? }`.
|
|
39
|
+
- Record each hit as `{ id, lineIndex (0-based), note, hint, rect, page }`.
|
|
38
40
|
- If there are no markers, tell the user and stop.
|
|
39
41
|
|
|
40
42
|
3. **Understand each comment in context.**
|
|
41
43
|
- The targeted JSX element is the **enclosing** element of the marker — i.e. read upward from the marker line until you reach the unclosed JSX opening tag whose body the marker lives in. That element is the target. (For self-closing elements like `<img />`, the inspector hoists the marker to the nearest non-self-closing ancestor; in that case the comment usually refers to a child of the enclosing element rather than the enclosing element itself — use the `note` text to disambiguate.)
|
|
42
44
|
- Read enough surrounding code (parent element, sibling elements, inline styles) to apply the change faithfully. A comment inside a `<div>` with an inline `background` style usually refers to that element's styling, for example.
|
|
45
|
+
- When the payload has a `rect`, work out which children of the enclosing element fall inside that region (compare their positions and sizes against the rect on the 1920×1080 canvas) and apply the note to those — not to the whole enclosing element.
|
|
43
46
|
- If the `note` is ambiguous, do the smallest reasonable interpretation and mention the assumption in your summary.
|
|
44
47
|
|
|
45
48
|
4. **Apply edits in reverse line order.**
|
|
@@ -47,7 +50,7 @@ Your job: read those markers, perform the described edits, and delete the marker
|
|
|
47
50
|
- Processing top-down would invalidate line numbers for later markers as the file shrinks/grows.
|
|
48
51
|
|
|
49
52
|
5. **Remove each marker after applying its edit.**
|
|
50
|
-
- Delete the
|
|
53
|
+
- Delete the marker token. If nothing else is left on that line, delete the whole line including its trailing `\n`; if content shares the line, keep that content.
|
|
51
54
|
- Never leave a marker behind for an edit you applied — that signals a failure. Markers deliberately skipped per the edge cases below stay in place.
|
|
52
55
|
|
|
53
56
|
6. **Verify.**
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Sparkles } from 'lucide-react';
|
|
2
|
+
import { Button } from '@/components/ui/button';
|
|
3
|
+
import { useAgentDock, useAgentStatus } from '@/lib/agent/use-agent';
|
|
4
|
+
import { useLocale } from '@/lib/use-locale';
|
|
5
|
+
import { ProviderLogo } from './provider-logo';
|
|
6
|
+
|
|
7
|
+
export const AGENT_DOCK_W = 380;
|
|
8
|
+
|
|
9
|
+
export function AgentToggleButton() {
|
|
10
|
+
const t = useLocale();
|
|
11
|
+
const { open, toggle } = useAgentDock();
|
|
12
|
+
const { provider } = useAgentStatus();
|
|
13
|
+
if (import.meta.env.PROD) return null;
|
|
14
|
+
return (
|
|
15
|
+
<Button
|
|
16
|
+
size="sm"
|
|
17
|
+
variant={open ? 'default' : 'ghost'}
|
|
18
|
+
onClick={toggle}
|
|
19
|
+
aria-pressed={open}
|
|
20
|
+
aria-label={t.agent.openTitle}
|
|
21
|
+
title={t.agent.openTitle}
|
|
22
|
+
data-agent-ui
|
|
23
|
+
>
|
|
24
|
+
{provider ? (
|
|
25
|
+
<ProviderLogo provider={provider.id} className="size-3.5" />
|
|
26
|
+
) : (
|
|
27
|
+
<Sparkles className="size-3.5" />
|
|
28
|
+
)}
|
|
29
|
+
<span className="hidden lg:inline">{t.agent.open}</span>
|
|
30
|
+
<kbd className="ml-1 hidden rounded-[3px] bg-foreground/10 px-1 font-mono text-[9.5px] tracking-[0.04em] lg:inline">
|
|
31
|
+
A
|
|
32
|
+
</kbd>
|
|
33
|
+
</Button>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { NoteMarkdown } from '@/components/note-markdown';
|
|
3
|
+
|
|
4
|
+
type Segment = { type: 'text'; text: string } | { type: 'code'; code: string };
|
|
5
|
+
|
|
6
|
+
const FENCE = /^```[^\n]*\n([\s\S]*?)\n?```\s*$/m;
|
|
7
|
+
|
|
8
|
+
function splitFences(text: string): Segment[] {
|
|
9
|
+
const segments: Segment[] = [];
|
|
10
|
+
let rest = text;
|
|
11
|
+
while (rest) {
|
|
12
|
+
const m = FENCE.exec(rest);
|
|
13
|
+
if (!m) {
|
|
14
|
+
segments.push({ type: 'text', text: rest });
|
|
15
|
+
break;
|
|
16
|
+
}
|
|
17
|
+
const before = rest.slice(0, m.index);
|
|
18
|
+
if (before.trim()) segments.push({ type: 'text', text: before });
|
|
19
|
+
segments.push({ type: 'code', code: m[1] });
|
|
20
|
+
rest = rest.slice(m.index + m[0].length);
|
|
21
|
+
}
|
|
22
|
+
return segments;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function AgentMarkdown({ text }: { text: string }) {
|
|
26
|
+
const segments = useMemo(() => splitFences(text), [text]);
|
|
27
|
+
return (
|
|
28
|
+
<div className="space-y-2 text-[12.5px] leading-[1.55] [&_ol]:my-1 [&_ul]:my-1">
|
|
29
|
+
{segments.map((segment, i) =>
|
|
30
|
+
segment.type === 'code' ? (
|
|
31
|
+
<pre
|
|
32
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: static parse output, never reordered
|
|
33
|
+
key={i}
|
|
34
|
+
className="overflow-x-auto rounded-[6px] border border-hairline bg-muted/60 px-2.5 py-2 font-mono text-[11px] leading-relaxed"
|
|
35
|
+
>
|
|
36
|
+
<code>{segment.code}</code>
|
|
37
|
+
</pre>
|
|
38
|
+
) : (
|
|
39
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: static parse output, never reordered
|
|
40
|
+
<NoteMarkdown key={i} text={segment.text} />
|
|
41
|
+
),
|
|
42
|
+
)}
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
}
|