diff options
| author | Adam <[email protected]> | 2025-10-27 06:48:03 -0500 |
|---|---|---|
| committer | Adam <[email protected]> | 2025-10-27 15:37:06 -0500 |
| commit | 0acae8211afb1194035a1801a7cd9d9ed1d66eae (patch) | |
| tree | 114156f27996290df64b362af809c778e416b9fc /packages | |
| parent | 0af450575647fc906f017b0065fe3aca227c369f (diff) | |
| download | opencode-0acae8211afb1194035a1801a7cd9d9ed1d66eae.tar.gz opencode-0acae8211afb1194035a1801a7cd9d9ed1d66eae.zip | |
wip: desktop work
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/desktop/src/components/diff.tsx | 27 | ||||
| -rw-r--r-- | packages/ui/package.json | 2 |
2 files changed, 23 insertions, 6 deletions
diff --git a/packages/desktop/src/components/diff.tsx b/packages/desktop/src/components/diff.tsx index d8457b528..b3d6d7e25 100644 --- a/packages/desktop/src/components/diff.tsx +++ b/packages/desktop/src/components/diff.tsx @@ -2,8 +2,9 @@ import { type FileContents, FileDiff, type DiffLineAnnotation, + type HunkData, DiffFileRendererOptions, - registerCustomTheme, + // registerCustomTheme, } from "@pierre/precision-diffs" import { ComponentProps, createEffect, splitProps } from "solid-js" @@ -15,8 +16,7 @@ export type DiffProps<T = {}> = Omit<DiffFileRendererOptions<T>, "themes"> & { classList?: ComponentProps<"div">["classList"] } -// @ts-expect-error -registerCustomTheme("opencode", () => import("./theme.json")) +// registerCustomTheme("opencode", () => import("./theme.json")) // interface ThreadMetadata { // threadId: string @@ -49,7 +49,7 @@ export function Diff<T>(props: DiffProps<T>) { // annotations and a container element to hold the diff createEffect(() => { const instance = new FileDiff<T>({ - theme: "opencode", + theme: "pierre-light", // Or can also provide a 'themes' prop, which allows the code to adapt // to your OS light or dark theme // themes: { dark: 'pierre-night', light: 'pierre-light' }, @@ -97,7 +97,24 @@ export function Diff<T>(props: DiffProps<T>) { // // 'simple': // Just a subtle bar separator between each hunk - hunkSeparators: "line-info", + // hunkSeparators: "line-info", + hunkSeparators(hunkData: HunkData) { + const fragment = document.createDocumentFragment() + const numCol = document.createElement("div") + numCol.textContent = `${hunkData.lines}` + numCol.style.position = "sticky" + numCol.style.left = "0" + numCol.style.backgroundColor = "var(--pjs-bg)" + numCol.style.zIndex = "2" + fragment.appendChild(numCol) + const contentCol = document.createElement("div") + contentCol.textContent = "unmodified lines" + contentCol.style.position = "sticky" + contentCol.style.width = "var(--pjs-column-content-width)" + contentCol.style.left = "var(--pjs-column-number-width)" + fragment.appendChild(contentCol) + return fragment + }, // On lines that have both additions and deletions, we can run a // separate diff check to mark parts of the lines that change. // 'none': diff --git a/packages/ui/package.json b/packages/ui/package.json index bf75293aa..cdb9eee1c 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -24,7 +24,7 @@ }, "dependencies": { "@kobalte/core": "catalog:", - "@pierre/precision-diffs": "0.0.2-alpha.1-1", + "@pierre/precision-diffs": "catalog:", "@solidjs/meta": "catalog:", "fuzzysort": "catalog:", "luxon": "catalog:", |
