Files
pad/web
xarmian d14bceb3e2 fix(web): render the Rich/Markdown mode toggle on the peeking side too (BUG-2263 follow-up) (#988)
The invisible-freeze work (PR #987) left ONE surface still gated on
`!peeking`: the editor's Rich⇄Markdown mode toggle. It was hidden on the
passive preview because it's a provider-LIFECYCLE control — switching to
Markdown nulls collabKey and DESTROYS the retained collab provider, which
retain-alive (D2) forbids WHILE peeking.

But under focus-follows-editing a click on the toggle fires the host's
pointerdown-capture activator FIRST, flipping activePane to that side
(peeking=false) before the click's onclick runs. So by the time the flip
executes, the side is already ACTIVE and tearing down its own provider is
normal active-side behavior — the "teardown while peeking" the gate feared
can't happen via a click. The onclick's existing `if (peeking) return`
guards (plus the `|| peeking` mid-flush rechecks) remain as the backstop
for a re-peek DURING the async flush (e.g. the user clicks the other side
mid-flip).

So drop the `{#if !peeking}` render gate — the toggle now renders on both
sides like every other invisible-freeze surface. Verified in the browser:
opening the pane shows the toggle on the peeking preview; clicking the
peeking master's "Markdown" button activates it and flips to raw mode in
ONE gesture, ProseMirror unmounts cleanly, exactly one typeable editor
throughout, zero console errors.

Tests: FreezeProbe renders mode-toggle unconditionally; masterFreeze
asserts it present while peeking; new host e2e opens the pane, confirms the
toggle on the peeking side, and asserts the one-gesture flip (a successful
flip proves activation preceded the guarded onclick).

Claude-Session: https://claude.ai/code/session_01EZ6yr6pAUFb1uffan912ra
2026-07-20 20:06:13 -04: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