Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ it looks.
- Click an element, click the background to pin a spot, or drag a box around an
area, then type the suggestion.
- **Copy prompt** puts every suggestion on the clipboard as one Markdown prompt,
each with its slide, its position and a selector for its element, ready to
paste into Claude Code or another coding agent.
each with its slide and a selector for its element, and a position for a
point or an area, ready to paste into Claude Code or another coding agent.
- Suggestions are kept per deck in the browser's `localStorage`. One whose
element has changed since is labelled **Changed**.

Expand Down
13 changes: 8 additions & 5 deletions skills/deck/assets/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ <h2>Copy prompt collects every suggestion</h2>
<p class="sub">Paste it into Claude Code or another coding agent. It names the file, the slide and the element.</p>
<div class="term">## 1. Slide 8: Speaker notes live inside the slide

Where: box x 120-1520, y 176-255, on `h2` "Speaker notes live inside the slide"
On `h2` "Speaker notes live inside the slide"

Element: `#stage &gt; section:nth-child(8) &gt; h2:nth-child(2)`

Expand Down Expand Up @@ -1979,14 +1979,17 @@ <h1>Start from template.html</h1>
const parts = decodeURIComponent(location.pathname).split('/');
const last = parts.pop() || 'index.html';
const file = last === 'index.html' ? [parts.filter(Boolean).pop(), last].filter(Boolean).join('/') : last;
// A position only for a point or an area drawn on the slide: an element clicked is found by its selector and its text,
// and its box in pixels would only be noise for the agent
const items = ed.items.filter(s => s.note.trim()), placed = s => !s.picked;
return `Improve the deck \`${file}\` with the suggestions below. Slides are the \`<section class="slide">\` elements, ` +
'numbered from 1 in document order. Positions are in the 1920×1080 slide frame, origin top left. ' +
'numbered from 1 in document order. ' + (items.some(placed) ? 'Positions are in the 1920×1080 slide frame, origin top left. ' : '') +
'Each Element is a CSS selector for it in the deck as it was when suggested. ' +
"Keep to the deck's existing conventions.\n\n" +
ed.items.filter(s => s.note.trim()).map((s, n) =>
items.map((s, n) =>
`## ${n + 1}. Slide ${s.slide + 1}${s.heading ? ': ' + s.heading : ''}\n\n` +
`Where: ${s.kind === 'pin' ? `point x ${s.x}, y ${s.y}` : `box x ${s.x}-${s.x + s.w}, y ${s.y}-${s.y + s.h}`}, ` +
`on \`${s.el}\`${s.text ? ` "${s.text}"` : ''}\n\n` +
(placed(s) ? `Where: ${s.kind === 'pin' ? `point x ${s.x}, y ${s.y}` : `box x ${s.x}-${s.x + s.w}, y ${s.y}-${s.y + s.h}`}, ` : 'On ') +
`\`${s.el}\`${s.text ? ` "${s.text}"` : ''}\n\n` +
`Element: \`${s.path}\`\n\n` +
(s.stale ? 'This element has changed since the suggestion was made, so it may already be done.\n\n' : '') +
`Suggestion: ${s.note.trim()}`).join('\n\n') + '\n';
Expand Down
11 changes: 7 additions & 4 deletions src/deck.js
Original file line number Diff line number Diff line change
Expand Up @@ -1370,14 +1370,17 @@
const parts = decodeURIComponent(location.pathname).split('/');
const last = parts.pop() || 'index.html';
const file = last === 'index.html' ? [parts.filter(Boolean).pop(), last].filter(Boolean).join('/') : last;
// A position only for a point or an area drawn on the slide: an element clicked is found by its selector and its text,
// and its box in pixels would only be noise for the agent
const items = ed.items.filter(s => s.note.trim()), placed = s => !s.picked;
return `Improve the deck \`${file}\` with the suggestions below. Slides are the \`<section class="slide">\` elements, ` +
'numbered from 1 in document order. Positions are in the 1920×1080 slide frame, origin top left. ' +
'numbered from 1 in document order. ' + (items.some(placed) ? 'Positions are in the 1920×1080 slide frame, origin top left. ' : '') +
'Each Element is a CSS selector for it in the deck as it was when suggested. ' +
"Keep to the deck's existing conventions.\n\n" +
ed.items.filter(s => s.note.trim()).map((s, n) =>
items.map((s, n) =>
`## ${n + 1}. Slide ${s.slide + 1}${s.heading ? ': ' + s.heading : ''}\n\n` +
`Where: ${s.kind === 'pin' ? `point x ${s.x}, y ${s.y}` : `box x ${s.x}-${s.x + s.w}, y ${s.y}-${s.y + s.h}`}, ` +
`on \`${s.el}\`${s.text ? ` "${s.text}"` : ''}\n\n` +
(placed(s) ? `Where: ${s.kind === 'pin' ? `point x ${s.x}, y ${s.y}` : `box x ${s.x}-${s.x + s.w}, y ${s.y}-${s.y + s.h}`}, ` : 'On ') +
`\`${s.el}\`${s.text ? ` "${s.text}"` : ''}\n\n` +
`Element: \`${s.path}\`\n\n` +
(s.stale ? 'This element has changed since the suggestion was made, so it may already be done.\n\n' : '') +
`Suggestion: ${s.note.trim()}`).join('\n\n') + '\n';
Expand Down
13 changes: 8 additions & 5 deletions template.html
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ <h2>Copy prompt collects every suggestion</h2>
<p class="sub">Paste it into Claude Code or another coding agent. It names the file, the slide and the element.</p>
<div class="term">## 1. Slide 8: Speaker notes live inside the slide

Where: box x 120-1520, y 176-255, on `h2` "Speaker notes live inside the slide"
On `h2` "Speaker notes live inside the slide"

Element: `#stage &gt; section:nth-child(8) &gt; h2:nth-child(2)`

Expand Down Expand Up @@ -1979,14 +1979,17 @@ <h1>Start from template.html</h1>
const parts = decodeURIComponent(location.pathname).split('/');
const last = parts.pop() || 'index.html';
const file = last === 'index.html' ? [parts.filter(Boolean).pop(), last].filter(Boolean).join('/') : last;
// A position only for a point or an area drawn on the slide: an element clicked is found by its selector and its text,
// and its box in pixels would only be noise for the agent
const items = ed.items.filter(s => s.note.trim()), placed = s => !s.picked;
return `Improve the deck \`${file}\` with the suggestions below. Slides are the \`<section class="slide">\` elements, ` +
'numbered from 1 in document order. Positions are in the 1920×1080 slide frame, origin top left. ' +
'numbered from 1 in document order. ' + (items.some(placed) ? 'Positions are in the 1920×1080 slide frame, origin top left. ' : '') +
'Each Element is a CSS selector for it in the deck as it was when suggested. ' +
"Keep to the deck's existing conventions.\n\n" +
ed.items.filter(s => s.note.trim()).map((s, n) =>
items.map((s, n) =>
`## ${n + 1}. Slide ${s.slide + 1}${s.heading ? ': ' + s.heading : ''}\n\n` +
`Where: ${s.kind === 'pin' ? `point x ${s.x}, y ${s.y}` : `box x ${s.x}-${s.x + s.w}, y ${s.y}-${s.y + s.h}`}, ` +
`on \`${s.el}\`${s.text ? ` "${s.text}"` : ''}\n\n` +
(placed(s) ? `Where: ${s.kind === 'pin' ? `point x ${s.x}, y ${s.y}` : `box x ${s.x}-${s.x + s.w}, y ${s.y}-${s.y + s.h}`}, ` : 'On ') +
`\`${s.el}\`${s.text ? ` "${s.text}"` : ''}\n\n` +
`Element: \`${s.path}\`\n\n` +
(s.stale ? 'This element has changed since the suggestion was made, so it may already be done.\n\n' : '') +
`Suggestion: ${s.note.trim()}`).join('\n\n') + '\n';
Expand Down
7 changes: 5 additions & 2 deletions test/deck.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -950,8 +950,11 @@ test.describe('suggest', () => {
expect(prompt).toContain('`' + fileName + '`');
expect(prompt).toContain('## 1. Slide 1');
expect(prompt).toContain('Suggestion: Make the heading shorter');
expect(prompt).toMatch(new RegExp('Where: box x \\d+-\\d+, y \\d+-\\d+, on `' + tag));
// an element clicked has no position, a point or an area drawn has one
expect(prompt).toMatch(new RegExp('\\nOn `' + tag));
expect(prompt).toMatch(/Where: point x \d+, y \d+/);
expect(prompt).toMatch(/Where: box x \d+-\d+, y \d+-\d+, `/);
expect(prompt).toContain('Positions are in the 1920×1080 slide frame');
expect(prompt).not.toContain('```'); // the selector and the text find it; no copy of its HTML
expect(prompt).not.toMatch(/e-hover|e-mark|edit-layer/);

Expand Down Expand Up @@ -1022,7 +1025,7 @@ test.describe('suggest', () => {
await expect(at).toHaveText('div.stat');
await page.keyboard.press('Enter');
const prompt = await copied(page);
expect(prompt).toContain('on `div.stat');
expect(prompt).toContain('On `div.stat');
expect(prompt).toContain('Suggestion: Make it bigger');
await expect(page.locator('.e-item')).toHaveCount(1);

Expand Down
Loading