Files
pad/web
xarmian e79a9bbb95 feat(attachments): DR-5b mobile policy — tap-to-load and fetch-on-zoom-past-fit (TASK-2460)
Own the mobile cells of the DR-5b decision table (the classifier landed
in TASK-2459). Add a `deferred` loader phase for the mobile large/unknown
cell — no automatic request; the viewer shows a tap-to-load placeholder
sized to the image's aspect ratio (a neutral box when dimensions are
unknown), with explicit `pointer-events: auto` and focus-handoff since it
is replaced by the image it loads. A single deduplicated `loadOriginal`
serves BOTH triggers — the tap (deferred cell) and zoom-past-fit
(`scale > 1`, the painted thumb cell) — so a tap racing a zoom, a retry,
or a later pinch is one fetch, not two.

The fallback detector now runs on every first decode, desktop and mobile:
when `thumb-md` was served the original (fresh upload, WebP/AVIF), it
clears the deferred original so zoom-past-fit cannot re-download bytes
already held. The zoom-past-fit trigger gates on a `painted` flag (tracked,
never written by loadOriginal, so no self-write) — a zoom made before the
thumb paints upgrades the instant it does, rather than stranding the user
on the thumbnail. Zoom is disabled, not just no-op, while nothing is
decoded: the zoom keys short-circuit and drag no longer arms/captures over
the deferred placeholder. Retry after an on-demand original failure
re-requests the original directly rather than reverting to the affordance.
Breakpoint flips do not retro-fetch (platform is captured at load). Every
idle cleanup funnels through one `toIdle()` so the `painted === false in
idle` invariant can't drift, and every request edge restates the DR-16
gate.

Claude-Session: https://claude.ai/code/session_01WFBYxdBuSZs2tjipATxAZu
2026-08-08 06:27:25 +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