Files
pad/web
xarmian c0ec3adc4b feat(attachments): viewer toolbar with host-supplied context on every mount (TASK-2474)
The image Lightbox gains an action toolbar rendered from the shared
`attachmentActionsFor(ctx)` descriptor list (DR-5) — anchor/button per the
`element` discriminant, icon-only on desktop, labeled on phone (DR-18). Delete
reuses TASK-2473's shared confirm module: the module owns the confirmation GATE
(request()), the descriptor (actions.ts) still owns the delete + announce.

Context threading — one vocabulary at every Lightbox origin:
- Lightbox gains mutationsEnabled (default false → read-only toolbar),
  getItemContent, getLiveContent.
- AttachmentViewerHost, ItemAttachmentStrip and ItemTimeline each gain and
  forward the same three to their direct Lightbox mount.
- ItemDetail supplies all three from its own values: mutationsEnabled is
  canEdit && !peeking (NEVER the timeline's own canEdit, which ignores peeking),
  so a peeked pane's viewer shows no Delete.
- actions.ts AttachmentActionSubject.mime_type relaxed to string|null; Open
  needs a positively-previewable MIME (null → not offered), the rest ignore it.

Toolbar integrates with the 3b gesture machinery: registered in the pointerdown,
double-click AND wheel control-exclusion lists so a press/dblclick/wheel over it
never pans or zooms; z-index within the <100000 viewer sweep. The delete
drill-down is a role="menu" of role="menuitem" rows with roving tabindex (arrows
navigate, Tab exits to chrome), focus enters the first row on open, Escape backs
out before closing the viewer, and image-nav is suppressed while it is up. A
confirmed delete closes the viewer (guarded on identity + a destroyed latch); a
subject change or set-shrink abandons a pending confirmation.

Tests: toolbar renders on all three origins; the peeked-pane leg (timeline
canEdit true, mutationsEnabled false → no Delete); anchor fidelity; delete
drill-down + permission-withdrawn abandon; and the review-hardening cases
(wheel exclusion, role=menu roving, Escape back-out, image-change abandon).

Claude-Session: https://claude.ai/code/session_01WFBYxdBuSZs2tjipATxAZu
2026-08-08 14:40:27 +00:00
..
2026-03-26 01:52:36 +00:00
2026-03-26 01:52:36 +00:00
2026-03-26 01:52:36 +00:00
2026-03-26 01:52:36 +00:00
2026-03-26 01:52:36 +00:00

Pad Web UI

SvelteKit 2 + Svelte 5 frontend for Pad, compiled to static files and embedded into the Go binary.

Development

npm install
npm run dev          # Dev server at localhost:5173 (proxies API to localhost:7777)
npm run build        # Production build to build/
npm run check        # Type checking with svelte-check

When developing, run the Go backend separately with make dev from the project root.

Building for Production

Do not build in isolation. Always use make build from the project root — this builds the web frontend, then compiles the Go binary with the build output embedded via //go:embed.

Stack

  • Svelte 5 with runes ($state, $derived, $effect)
  • SvelteKit 2 with adapter-static (SPA mode)
  • Tiptap block editor with markdown round-trip
  • svelte-dnd-action for drag-and-drop in board/list views
  • SSE for real-time updates
  • TypeScript throughout

Structure

src/
  routes/                    SvelteKit pages
    +layout.svelte           App shell (sidebar + main)
    +page.svelte             Landing/redirect
    [workspace]/
      +page.svelte           Dashboard (collections, phases, activity)
      +layout.svelte         SSE connection per workspace
      [collection]/
        +page.svelte         Collection view (board/list)
      [collection]/[item]/
        +page.svelte         Item detail + editor
      conventions/            Purpose-built conventions page
      playbooks/              Purpose-built playbooks page
      settings/               Workspace settings
  lib/
    api/client.ts            HTTP API client
    components/
      layout/                Sidebar, navigation
      editor/                Tiptap editor, raw markdown editor
      fields/                FieldEditor, relation picker
      items/                 ItemCard, ItemDetail
      collections/           BoardView, ListView
      common/                StatusBadge, badges, modals
      search/                CommandPalette
      activity/              ActivityFeed
    stores/                  Svelte 5 reactive stores
      workspace.svelte.ts    Workspace state
      collections.svelte.ts  Collection + item state
      ui.svelte.ts           Sidebar, mobile state
    types/index.ts           TypeScript types and constants
  app.css                    Global styles and design tokens