Skip to content
Merged
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
10 changes: 8 additions & 2 deletions .agents/skills/verify-screens/features/camera-focus.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ A person pans with Hand, Shift-drag, the middle button or the wheel. They zoom w
- `cam-pan`: Hand, Shift-drag and the wheel pan by the screen delta, with no revision.
- `minimap`: the map is off by default. Turn it on to see the canvas and navigate by click or drag. The choice survives a reload.
- `cam-zoom`: zoom out and in around the centre; Cmd+0 goes to 100%; Fit all frames everything and turns auto-fit back on.
- `focus`: the Focus action, or the agent's `focus_item`, fits one frame and hides the others. Exit focus or Escape returns.
- `focus`: the Focus action, the toolbar toggle, or the agent's `focus_item` fits one frame and hides the others. The toggle, Exit focus, or Escape returns.
- `focus-wheel`: in focus with Move, the wheel over the live page pans the camera, as Hand does. A scroll area inside the page keeps the wheel while it can still scroll.
- `focus-large`: a 40-screen board opens at a readable zoom at the top, scrolls to both ends without leaving focus, hides other objects and restores the previous camera on exit.
- `wheel-root-overflow`: overflowing body content under a hidden or clipped viewport never traps the wheel, in focus or with only selection.
Expand All @@ -22,7 +22,7 @@ A person pans with Hand, Shift-drag, the middle button or the wheel. They zoom w

## How to get to it (user POV)

- Press H or hold Shift and drag. Use the zoom buttons, Cmd+wheel, the Focus action on a selected frame, and Escape.
- Press H or hold Shift and drag. Use the zoom buttons or Cmd+wheel. Select a frame and use Focus in the toolbar to enter or exit focus. The top-right Exit focus action and Escape also exit focus.
- Click the map icon in the zoom controls. Click the overview to jump or drag the viewport outline to pan.
- An agent calls `show_items`, `focus_item`, `get_view` and `open_screen`.

Expand Down Expand Up @@ -88,6 +88,12 @@ expect dom.minimap=null
```screens id=focus
add_object title=A files=fixture:plain x=0 y=0 height=300 as=@A
add_object title=B files=fixture:plain x=500 y=0 height=300 as=@B
click @A.title
mark overview view
click ui:"Focus selection"
wait view.focus=focused:@A dom.@B.visible=false
click ui:"Focus selection"
wait view.focus=none dom.@B.visible=true view.camera=mark:overview storage.rev=doc.rev
focus @A
expect view.focus=focused:@A dom.@B.visible=false
exit-focus
Expand Down
4 changes: 4 additions & 0 deletions .agents/skills/verify-screens/features/layers.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ focus @A
expect dom.layers=null
click ui:Layers
wait dom.layers.rows.size=6
click ui:Comments
expect view.comment.panelOpen=true dom.layers=null
click ui:Layers
wait view.comment.panelOpen=false dom.layers.rows.size=6
```

```screens id=layers-click
Expand Down
31 changes: 21 additions & 10 deletions packages/canvas/src/shell/ScreenCanvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export function ScreenCanvas({ client, viewId, onRuntime, leading, trailing }: {
useEffect(() => { setCompactLayersOpen(false); }, [focusId]);
// The optional index is independent of comment placement and the active bubble.
const commentsOpen = v.comment.panelOpen;
const toggleComments = () => rt.dispatch({ type: "command", command: { kind: "comments-panel", open: !commentsOpen } });
const layersOpen = compactCanvas ? compactLayersOpen : wideLayersOpen;
const toggleLayers = () => {
if (compactCanvas) { setCompactLayersOpen(!compactLayersOpen); return; }
Expand Down Expand Up @@ -241,10 +242,12 @@ export function ScreenCanvas({ client, viewId, onRuntime, leading, trailing }: {
<Icon name={t.id} />
</button>
))}
{/* Always present, so selecting never moves the tools; disabled without a single selected object. */}
<button className="tool" aria-label="Focus selection" title="Focus selection (F)"
disabled={!selectedItemId || base.items.find((i) => i.id === selectedItemId)?.kind !== "html-snapshot" || v.focus.mode === "focused"}
onClick={() => selectedItemId && rt.dispatch({ type: "command", command: { kind: "focus", itemId: selectedItemId } })}><Icon name="focus" /></button>
<button className="tool" aria-label="Focus selection" aria-pressed={focusId !== null} title={focusId ? "Exit focus (F)" : "Focus selection (F)"}
disabled={!focusId && (!selectedItemId || base.byId.get(selectedItemId)?.kind !== "html-snapshot")}
onClick={() => {
if (focusId) rt.dispatch({ type: "command", command: { kind: "exit-focus" } });
else if (selectedItemId) rt.dispatch({ type: "command", command: { kind: "focus", itemId: selectedItemId } });
}}><Icon name="focus" /></button>
<span className="shell-divider" />
<button className="tool" data-copy-image="" data-state={rt.copy?.state} aria-label={rt.copy?.state === "copied" ? "Copied" : "Copy as image (⇧⌘C)"} title="Copy as image (⇧⌘C)"
disabled={!copyableItem(v, base)} onClick={() => rt.dispatch({ type: "command", command: { kind: "copy-image" } })}>
Expand Down Expand Up @@ -287,13 +290,21 @@ export function ScreenCanvas({ client, viewId, onRuntime, leading, trailing }: {

{!presenting && <PresenceOverlay rt={rt} roster={st.roster} items={doc.items} following={v.following} />}
<div className="chrome top-right screens-stack screens-right">
<button className="button screens-comments-toggle" aria-label="Comments" aria-controls="screens-comments" aria-expanded={commentsOpen} onClick={() => rt.dispatch({ type: "command", command: { kind: "comments-panel", open: !commentsOpen } })}><Icon name="comment" />{base.threads.filter((t) => !t.resolved && (!presenting || (t.anchor.kind === "item" && v.focus.mode === "focused" && t.anchor.itemId === v.focus.itemId))).length || ""}</button>
<div className="shell screens-right-actions">
{!presenting && focusId && <>
<div className="screens-focus-actions" role="group" aria-label="Focus controls">
{base.layout === "slides" && <button className="button" aria-label="Slides" title="Slides" aria-expanded={filmOpen} onClick={toggleFilm}><Icon name="presentation" /><span>Slides</span></button>}
{editId && <button className="button" aria-label="Layers" title="Layers" aria-expanded={layersOpen && !commentsOpen} onClick={() => {
if (commentsOpen) toggleComments();
if (!commentsOpen || !layersOpen) toggleLayers();
}}><Icon name="panel" /><span>Layers</span></button>}
<button className="button" aria-label="Exit focus" title="Exit focus (Esc)" onClick={() => rt.dispatch({ type: "command", command: { kind: "exit-focus" } })}><Icon name="x" /><span>Exit focus</span></button>
</div>
<span className="shell-divider" />
</>}
<button className="button screens-comments-toggle" aria-label="Comments" title="Comments" aria-controls="screens-comments" aria-expanded={commentsOpen} onClick={toggleComments}><Icon name="comment" />{base.threads.filter((t) => !t.resolved && (!presenting || (t.anchor.kind === "item" && t.anchor.itemId === focusId))).length || ""}</button>
</div>
{!presenting && st.roster.length > 0 && <PresenceRoster rt={rt} roster={st.roster} skew={st.rosterSkew} items={doc.items} following={v.following} hidden={rt.hiddenParticipants} />}
{!presenting && v.focus.mode === "focused" && <div className="shell screens-focus-actions">
{base.layout === "slides" && <button className="button" aria-expanded={filmOpen} onClick={toggleFilm}>Slides</button>}
{!commentsOpen && st.committed?.items[v.focus.itemId]?.kind === "html-snapshot" && <button className="button" aria-expanded={layersOpen} onClick={toggleLayers}>Layers</button>}
<button className="button" onClick={() => rt.dispatch({ type: "command", command: { kind: "exit-focus" } })}>Exit focus</button>
</div>}
{!presenting && editId && <PieceEditor key={editId} rt={rt} itemId={editId} panel={focusId !== null && layersOpen && !commentsOpen} />}
{commentsOpen && <CommentsPanel rt={rt} doc={base} view={v} />}
</div>
Expand Down
21 changes: 15 additions & 6 deletions packages/canvas/src/shell/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ body { background: var(--window); color: var(--text); font: var(--text-md) / var
.screens-failure-actions .button.small { margin-left: 0; }

/* Header controls keep an opaque surface when objects or pages scroll underneath. */
.chrome.screens-canvas-head { max-width: calc(100% - 76px); padding: 3px; border-radius: var(--radius-pill); background: var(--surface); box-shadow: var(--shadow-panel); }
.chrome.screens-canvas-head, .screens-right-actions { padding: 3px; border-radius: var(--radius-pill); background: var(--surface); box-shadow: var(--shadow-panel); }
.chrome.screens-canvas-head { max-width: calc(100% - 76px); }
.stage:has(.screens-focus-actions) .screens-canvas-head { max-width: calc(100% - 280px); }
.chrome.screens-canvas-head > * { flex: none; }
.chrome.screens-canvas-head > .screen-name { display: block; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; line-height: var(--control-lg); }

Expand Down Expand Up @@ -199,12 +201,19 @@ body { background: var(--window); color: var(--text); font: var(--text-md) / var
.screens-details .field-row .screens-input { flex: 1; height: 24px; resize: none; }
.screens-details .screens-swatch { flex: none; width: 14px; height: 14px; border-radius: 4px; box-shadow: 0 0 0 0.5px var(--line); }

/* Focus actions sit on a slide of any color, so they share the toolbars' own surface instead of a translucent fill. */
.screens-focus-actions { gap: 2px; }
.screens-focus-actions .button { background: transparent; box-shadow: none; }
.screens-focus-actions .button[aria-expanded="true"] { background: var(--control-active); }
/* Focus controls and Comments share the top-right header. */
.screens-focus-actions { display: flex; gap: 2px; }
.screens-right-actions .button { background: transparent; box-shadow: none; white-space: nowrap; }
.screens-focus-actions .icon { display: none; }
.screens-right-actions .button[aria-expanded="true"] { background: var(--control-active); }
@media (hover: hover) {
.screens-focus-actions .button:hover { background: var(--control-hover); }
.screens-right-actions .button:hover { background: var(--control-hover); }
}
@media (max-width: 520px) {
.stage:has(.screens-focus-actions) .screens-canvas-head { max-width: calc(100% - 180px); }
.screens-focus-actions .button { width: var(--control-lg); padding: 0; }
.screens-focus-actions .icon { display: block; }
.screens-focus-actions .button > span { display: none; }
}

/* Slide filmstrip: below the stage while a slide is focused */
Expand Down
2 changes: 1 addition & 1 deletion plugins/screens/mcp.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"command": "npx",
"args": [
"-y",
"@rishirsv/screens@0.1.20",
"@rishirsv/screens@0.1.21",
"mcp"
]
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/screens/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
"name": "screens",
"version": "0.1.20",
"version": "0.1.21",
"description": "A local canvas where you and your agent create, arrange and comment on HTML designs.",
"author": {
"name": "Rishi Sharma"
Expand Down
2 changes: 1 addition & 1 deletion release/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rishirsv/screens",
"version": "0.1.20",
"version": "0.1.21",
"description": "A local canvas where you and your coding agent create, arrange and comment on HTML designs.",
"repository": {
"type": "git",
Expand Down
Loading