diff --git a/packages/app/src/custom-elements.d.ts b/packages/app/src/custom-elements.d.ts index e4ea0d6cebd..04bb10434b6 120000 --- a/packages/app/src/custom-elements.d.ts +++ b/packages/app/src/custom-elements.d.ts @@ -1 +1,17 @@ -../../ui/src/custom-elements.d.ts \ No newline at end of file +import { DIFFS_TAG_NAME } from "@pierre/diffs" + +/** + * TypeScript declaration for the custom element. + * This tells TypeScript that is a valid JSX element in SolidJS. + * Required for using the @pierre/diffs web component in .tsx files. + */ + +declare module "solid-js" { + namespace JSX { + interface IntrinsicElements { + [DIFFS_TAG_NAME]: HTMLAttributes + } + } +} + +export { } \ No newline at end of file diff --git a/packages/desktop/scripts/predev.ts b/packages/desktop/scripts/predev.ts index 21821519770..3d0cd5e92b1 100644 --- a/packages/desktop/scripts/predev.ts +++ b/packages/desktop/scripts/predev.ts @@ -6,7 +6,7 @@ const RUST_TARGET = Bun.env.TAURI_ENV_TARGET_TRIPLE const sidecarConfig = getCurrentSidecar(RUST_TARGET) -const binaryPath = `../opencode/dist/${sidecarConfig.ocBinary}/bin/opencode` +const binaryPath = `../opencode/dist/${sidecarConfig.ocBinary}/bin/opencode${process.platform === "win32" ? ".exe" : ""}` await $`cd ../opencode && bun run build --single` diff --git a/packages/ui/src/components/diff.tsx b/packages/ui/src/components/diff.tsx index 75dde044049..eb7ea0a2245 100644 --- a/packages/ui/src/components/diff.tsx +++ b/packages/ui/src/components/diff.tsx @@ -1,7 +1,9 @@ import { FileDiff } from "@pierre/diffs" -import { createEffect, createMemo, onCleanup, splitProps } from "solid-js" +import { createEffect, createMemo, onCleanup, splitProps, createSignal } from "solid-js" import { createDefaultOptions, type DiffProps, styleVariables } from "../pierre" import { workerPool } from "../pierre/worker" +import { Spinner } from "./spinner" +import { Show } from "solid-js" // interface ThreadMetadata { // threadId: string @@ -12,6 +14,7 @@ import { workerPool } from "../pierre/worker" export function Diff(props: DiffProps) { let container!: HTMLDivElement const [local, others] = splitProps(props, ["before", "after", "class", "classList", "annotations"]) + const [isRendering, setIsRendering] = createSignal(false) const fileDiff = createMemo( () => @@ -27,20 +30,36 @@ export function Diff(props: DiffProps) { const cleanupFunctions: Array<() => void> = [] createEffect(() => { - container.innerHTML = "" - fileDiff().render({ - oldFile: local.before, - newFile: local.after, - lineAnnotations: local.annotations, - containerWrapper: container, - }) + setIsRendering(true) + + try { + container.innerHTML = "" + fileDiff().render({ + oldFile: local.before, + newFile: local.after, + lineAnnotations: local.annotations, + containerWrapper: container, + }) + } finally { + setIsRendering(false) + } }) onCleanup(() => { - // Clean up FileDiff event handlers and dispose SolidJS components + // Clean up FileDiff event handlers and dispose SolidJS components fileDiff()?.cleanUp() cleanupFunctions.forEach((dispose) => dispose()) }) - return
+ return ( +
+ +
+ + Rendering diff... +
+
+
+
+ ) }