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,10 +1,11 @@
"use client";
import * as React from "react";
import { ComponentProps } from "react";
import MonacoEditor from "@monaco-editor/react";
import { useTheme } from "next-themes";
export type EditorProps = React.ComponentPropsWithoutRef<typeof MonacoEditor>;
// @ts-expect-error react 19 beta error
export type EditorProps = ComponentProps<typeof MonacoEditor>;
/**
* NOTE: This component maybe doesn't shrink according to the container component's width
@@ -12,26 +13,28 @@ export type EditorProps = React.ComponentPropsWithoutRef<typeof MonacoEditor>;
* @see https://github.com/suren-atoyan/monaco-react/issues/346
*
*/
export const Editor = React.forwardRef<HTMLTextAreaElement, EditorProps>(
({ options, theme, ...props }, ref) => {
const { theme: appTheme } = useTheme();
const themeToUse = theme ?? (appTheme === "light" ? "light" : "vs-dark");
// @ts-expect-error react 19 beta error
export const Editor = ({ options, theme, ...props }: EditorProps) => {
const { theme: appTheme } = useTheme();
const themeToUse = theme ?? (appTheme === "light" ? "light" : "vs-dark");
return (
<MonacoEditor
{...{ ref }}
theme={themeToUse}
options={{
tabFocusMode: true,
detectIndentation: false,
minimap: { enabled: false },
automaticLayout: true,
scrollBeyondLastLine: false,
...options, // NOTE: merge shallowly
}}
{...props}
/>
);
}
);
Editor.displayName = "Editor";
return (
// @ts-expect-error react 19 beta error
<MonacoEditor
// @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,
detectIndentation: false,
minimap: { enabled: false },
automaticLayout: true,
scrollBeyondLastLine: false,
// @ts-expect-error react 19 beta error
...options, // NOTE: merge shallowly
}}
{...props}
/>
);
};