GeezerVison is showing github.com — feat(share): SSR'd diffs · Stephanvs/opencode@15facd8
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: bun.lock +3-2Lines changed: 3 additions & 2 deletions Collapse file Copy file name to clipboardExpand all lines: package.json +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 30 | 30 | "@tsconfig/bun": "1.0.9", | 31 | 31 | "@cloudflare/workers-types": "4.20251008.0", | 32 | 32 | "@openauthjs/openauth": "0.0.0-20250322224806", | 33 | | - "@pierre/precision-diffs": "0.5.4", | | 33 | + "@pierre/precision-diffs": "0.5.5", | 34 | 34 | "@tailwindcss/vite": "4.1.11", | 35 | 35 | "diff": "8.0.2", | 36 | 36 | "ai": "5.0.97", | |
Collapse file Copy file name to clipboardExpand all lines: packages/enterprise/package.json +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 13 | 13 | "dependencies": { | 14 | 14 | "@opencode-ai/util": "workspace:*", | 15 | 15 | "@opencode-ai/ui": "workspace:*", | | 16 | + "@pierre/precision-diffs": "catalog:", | 16 | 17 | "@solidjs/router": "catalog:", | 17 | 18 | "@solidjs/start": "catalog:", | 18 | 19 | "@solidjs/meta": "catalog:", | |
Collapse file Copy file name to clipboardExpand all lines: packages/enterprise/src/app.tsx +7-9Lines changed: 7 additions & 9 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -3,21 +3,19 @@ import { FileRoutes } from "@solidjs/start/router" | 3 | 3 | import { Fonts } from "@opencode-ai/ui/fonts" | 4 | 4 | import { MetaProvider } from "@solidjs/meta" | 5 | 5 | import { MarkedProvider } from "@opencode-ai/ui/context/marked" | 6 | | -import "./app.css" | 7 | 6 | import { Suspense } from "solid-js" | | 7 | +import "./app.css" | 8 | 8 |
| 9 | 9 | export default function App() { | 10 | 10 | return ( | 11 | 11 | <Router | 12 | 12 | root={(props) => ( | 13 | | - <Suspense> | 14 | | - <MarkedProvider> | 15 | | - <MetaProvider> | 16 | | - <Fonts /> | 17 | | - {props.children} | 18 | | - </MetaProvider> | 19 | | - </MarkedProvider> | 20 | | - </Suspense> | | 13 | + <MarkedProvider> | | 14 | + <MetaProvider> | | 15 | + <Fonts /> | | 16 | + <Suspense>{props.children}</Suspense> | | 17 | + </MetaProvider> | | 18 | + </MarkedProvider> | 21 | 19 | )} | 22 | 20 | > | 23 | 21 | <FileRoutes /> | |
Collapse file Copy file name to clipboardExpand all lines: packages/enterprise/src/routes/share/[shareID].tsx +40-3Lines changed: 40 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -2,8 +2,8 @@ import { FileDiff, Message, Model, Part, Session, SessionStatus, UserMessage } f | 2 | 2 | import { SessionTurn } from "@opencode-ai/ui/session-turn" | 3 | 3 | import { SessionReview } from "@opencode-ai/ui/session-review" | 4 | 4 | import { DataProvider } from "@opencode-ai/ui/context" | 5 | | -import { createAsync, query, RouteDefinition, useParams } from "@solidjs/router" | 6 | | -import { createEffect, createMemo, ErrorBoundary, For, Match, Show, Suspense, Switch } from "solid-js" | | 5 | +import { createAsync, query, useParams } from "@solidjs/router" | | 6 | +import { createEffect, createMemo, ErrorBoundary, For, Match, Show, Switch } from "solid-js" | 7 | 7 | import { Share } from "~/core/share" | 8 | 8 | import { Logo, Mark } from "@opencode-ai/ui/logo" | 9 | 9 | import { IconButton } from "@opencode-ai/ui/icon-button" | @@ -16,6 +16,7 @@ import { createStore } from "solid-js/store" | 16 | 16 | import z from "zod" | 17 | 17 | import NotFound from "../[...404]" | 18 | 18 | import { Tabs } from "@opencode-ai/ui/tabs" | | 19 | +import { HunkData, preloadMultiFileDiff, PreloadMultiFileDiffResult } from "@pierre/precision-diffs/ssr" | 19 | 20 |
| 20 | 21 | const SessionDataMissingError = NamedError.create( | 21 | 22 | "SessionDataMissingError", | @@ -36,6 +37,9 @@ const getData = query(async (shareID) => { | 36 | 37 | session_diff: { | 37 | 38 | [sessionID: string]: FileDiff[] | 38 | 39 | } | | 40 | + session_diff_preload: { | | 41 | + [sessionID: string]: PreloadMultiFileDiffResult<any>[] | | 42 | + } | 39 | 43 | session_status: { | 40 | 44 | [sessionID: string]: SessionStatus | 41 | 45 | } | @@ -54,6 +58,9 @@ const getData = query(async (shareID) => { | 54 | 58 | session_diff: { | 55 | 59 | [share.sessionID]: [], | 56 | 60 | }, | | 61 | + session_diff_preload: { | | 62 | + [share.sessionID]: [], | | 63 | + }, | 57 | 64 | session_status: { | 58 | 65 | [share.sessionID]: { | 59 | 66 | type: "idle", | @@ -70,6 +77,29 @@ const getData = query(async (shareID) => { | 70 | 77 | break | 71 | 78 | case "session_diff": | 72 | 79 | result.session_diff[share.sessionID] = item.data | | 80 | + result.session_diff_preload[share.sessionID] = await Promise.all( | | 81 | + item.data.map(async (diff) => | | 82 | + preloadMultiFileDiff<any>({ | | 83 | + oldFile: { name: diff.file, contents: diff.before }, | | 84 | + newFile: { name: diff.file, contents: diff.after }, | | 85 | + options: { | | 86 | + theme: "OpenCode", | | 87 | + themeType: "system", | | 88 | + disableLineNumbers: false, | | 89 | + overflow: "wrap", | | 90 | + diffStyle: "unified", | | 91 | + diffIndicators: "bars", | | 92 | + disableBackground: false, | | 93 | + expansionLineCount: 20, | | 94 | + lineDiffType: "word-alt", | | 95 | + maxLineDiffLength: 1000, | | 96 | + maxLineLengthForHighlighting: 1000, | | 97 | + disableFileHeader: true, | | 98 | + }, | | 99 | + // annotations, | | 100 | + }), | | 101 | + ), | | 102 | + ) | 73 | 103 | break | 74 | 104 | case "message": | 75 | 105 | result.message[item.data.sessionID] = result.message[item.data.sessionID] ?? [] | @@ -141,7 +171,14 @@ export default function () { | 141 | 171 | const provider = createMemo(() => activeMessage()?.model?.providerID) | 142 | 172 | const modelID = createMemo(() => activeMessage()?.model?.modelID) | 143 | 173 | const model = createMemo(() => data().model[data().sessionID]?.find((m) => m.id === modelID())) | 144 | | - const diffs = createMemo(() => data().session_diff[data().sessionID] ?? []) | | 174 | + const diffs = createMemo(() => { | | 175 | + const diffs = data().session_diff[data().sessionID] ?? [] | | 176 | + const preloaded = data().session_diff_preload[data().sessionID] ?? [] | | 177 | + return diffs.map((diff) => ({ | | 178 | + ...diff, | | 179 | + preloaded: preloaded.find((d) => d.newFile.name === diff.file), | | 180 | + })) | | 181 | + }) | 145 | 182 |
| 146 | 183 | const title = () => ( | 147 | 184 | <div class="flex flex-col gap-4 shrink-0"> | |
Collapse file Copy file name to clipboardExpand all lines: packages/ui/src/components/diff-changes.css +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 6 | 6 |
| 7 | 7 | [data-slot="diff-changes-additions"] { | 8 | 8 | font-family: var(--font-family-mono); | | 9 | + font-feature-settings: var(--font-family-mono--font-feature-settings); | 9 | 10 | font-size: var(--font-size-small); | 10 | 11 | font-style: normal; | 11 | 12 | font-weight: var(--font-weight-regular); | | 17 | 18 |
| 18 | 19 | [data-slot="diff-changes-deletions"] { | 19 | 20 | font-family: var(--font-family-mono); | | 21 | + font-feature-settings: var(--font-family-mono--font-feature-settings); | 20 | 22 | font-size: var(--font-size-small); | 21 | 23 | font-style: normal; | 22 | 24 | font-weight: var(--font-weight-regular); | |
Collapse file Copy file name to clipboardExpand all lines: packages/ui/src/components/diff.css +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 22 | 22 | width: var(--pjs-column-content-width); | 23 | 23 | left: var(--pjs-column-number-width); | 24 | 24 | padding-left: 8px; | | 25 | + user-select: none; | | 26 | + cursor: default; | | 27 | + text-align: left; | 25 | 28 |
| 26 | 29 | [data-slot="diff-hunk-separator-content-span"] { | 27 | 30 | mix-blend-mode: var(--text-mix-blend-mode); | |
|