chore: upgrade to react 19 beta and next 14 canary

This commit is contained in:
2024-05-19 14:53:00 +02:00
parent fe429295ef
commit 63e0be09e6
65 changed files with 2626 additions and 1898 deletions

View File

@@ -1,30 +1,31 @@
"use client";
import { ComponentPropsWithoutRef, forwardRef } from "react";
import { ComponentProps } from "react";
import { DiffEditor as MonacoDiffEditor } from "@monaco-editor/react";
import { useTheme } from "next-themes";
export type EditorProps = ComponentPropsWithoutRef<typeof MonacoDiffEditor>;
// @ts-expect-error react 19 beta error
export type DiffEditorProps = ComponentProps<typeof MonacoDiffEditor>;
// @ts-expect-error react 19 beta error
export const DiffEditor = ({ options, theme, ...props }: DiffEditorProps) => {
const { theme: appTheme } = useTheme();
const themeToUse = theme ?? (appTheme === "light" ? "light" : "vs-dark");
export const DiffEditor = forwardRef<HTMLTextAreaElement, EditorProps>(
({ options, theme, ...props }, ref) => {
const { theme: appTheme } = useTheme();
const themeToUse = theme ?? (appTheme === "light" ? "light" : "vs-dark");
return (
<MonacoDiffEditor
{...{ ref }}
theme={themeToUse}
options={{
tabFocusMode: true,
automaticLayout: true,
scrollBeyondLastLine: false,
...options, // NOTE: merge shallowly
}}
{...props}
/>
);
}
);
DiffEditor.displayName = "Editor";
return (
// @ts-expect-error react 19 beta error
<MonacoDiffEditor
// @ts-expect-error react 19 beta error
theme={themeToUse}
// @ts-expect-error react 19 beta error
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
options={{
tabFocusMode: true,
automaticLayout: true,
scrollBeyondLastLine: false,
// @ts-expect-error react 19 beta error
...options, // NOTE: merge shallowly
}}
{...props}
/>
);
};