upgrade to react 19

This commit is contained in:
dswbx
2025-03-11 08:44:49 +01:00
parent 2d7257d2bc
commit 8df30f4dae
11 changed files with 437 additions and 1137 deletions

View File

@@ -36,9 +36,10 @@
"@codemirror/lang-html": "^6.4.9", "@codemirror/lang-html": "^6.4.9",
"@codemirror/lang-json": "^6.0.1", "@codemirror/lang-json": "^6.0.1",
"@codemirror/lang-liquid": "^6.2.1", "@codemirror/lang-liquid": "^6.2.1",
"@hello-pangea/dnd": "^17.0.0", "@hello-pangea/dnd": "^18.0.1",
"@libsql/client": "^0.14.0", "@libsql/client": "^0.14.0",
"@mantine/core": "^7.13.4", "@mantine/core": "^7.17.1",
"@mantine/hooks": "^7.17.1",
"@sinclair/typebox": "^0.32.34", "@sinclair/typebox": "^0.32.34",
"@tanstack/react-form": "^1.0.5", "@tanstack/react-form": "^1.0.5",
"@uiw/react-codemirror": "^4.23.6", "@uiw/react-codemirror": "^4.23.6",
@@ -63,18 +64,20 @@
"@aws-sdk/client-s3": "^3.613.0", "@aws-sdk/client-s3": "^3.613.0",
"@bluwy/giget-core": "^0.1.2", "@bluwy/giget-core": "^0.1.2",
"@dagrejs/dagre": "^1.1.4", "@dagrejs/dagre": "^1.1.4",
"@mantine/modals": "^7.13.4",
"@mantine/notifications": "^7.13.4",
"@hono/typebox-validator": "^0.2.6", "@hono/typebox-validator": "^0.2.6",
"@hono/vite-dev-server": "^0.17.0", "@hono/vite-dev-server": "^0.17.0",
"@hono/zod-validator": "^0.4.1", "@hono/zod-validator": "^0.4.1",
"@hookform/resolvers": "^3.9.1", "@hookform/resolvers": "^3.9.1",
"@libsql/kysely-libsql": "^0.4.1", "@libsql/kysely-libsql": "^0.4.1",
"@mantine/modals": "^7.17.1",
"@mantine/notifications": "^7.17.1",
"@rjsf/core": "5.22.2", "@rjsf/core": "5.22.2",
"@tabler/icons-react": "3.18.0", "@tabler/icons-react": "3.18.0",
"@types/node": "^22.10.0", "@types/node": "^22.10.0",
"@types/react": "^18.3.12", "react": "^19.0.0",
"@types/react-dom": "^18.3.1", "react-dom": "^19.0.0",
"@types/react": "^19.0.1",
"@types/react-dom": "^19.0.4",
"@vitejs/plugin-react": "^4.3.3", "@vitejs/plugin-react": "^4.3.3",
"autoprefixer": "^10.4.20", "autoprefixer": "^10.4.20",
"clsx": "^2.1.1", "clsx": "^2.1.1",
@@ -105,8 +108,8 @@
"@hono/node-server": "^1.13.7" "@hono/node-server": "^1.13.7"
}, },
"peerDependencies": { "peerDependencies": {
"react": ">=18", "react": "^19.x",
"react-dom": ">=18" "react-dom": "^19.x"
}, },
"main": "./dist/index.js", "main": "./dist/index.js",
"module": "./dist/index.js", "module": "./dist/index.js",
@@ -228,4 +231,4 @@
"bun", "bun",
"node" "node"
] ]
} }

View File

@@ -41,7 +41,7 @@ export function BkndProvider({
useState<Pick<BkndContext, "version" | "schema" | "config" | "permissions" | "fallback">>(); useState<Pick<BkndContext, "version" | "schema" | "config" | "permissions" | "fallback">>();
const [fetched, setFetched] = useState(false); const [fetched, setFetched] = useState(false);
const [error, setError] = useState<boolean>(); const [error, setError] = useState<boolean>();
const errorShown = useRef<boolean>(); const errorShown = useRef<boolean>(false);
const fetching = useRef<Fetching>(Fetching.None); const fetching = useRef<Fetching>(Fetching.None);
const [local_version, set_local_version] = useState(0); const [local_version, set_local_version] = useState(0);
const api = useApi(); const api = useApi();

View File

@@ -19,7 +19,7 @@ type CanvasProps = ReactFlowProps & {
externalProvider?: boolean; externalProvider?: boolean;
backgroundStyle?: "lines" | "dots"; backgroundStyle?: "lines" | "dots";
minimap?: boolean | MiniMapProps; minimap?: boolean | MiniMapProps;
children?: JSX.Element | ReactNode; children?: Element | ReactNode;
onDropNewNode?: (base: any) => any; onDropNewNode?: (base: any) => any;
onDropNewEdge?: (base: any) => any; onDropNewEdge?: (base: any) => any;
}; };

View File

@@ -74,6 +74,7 @@ export default function ArrayFieldTemplate<
{items.map( {items.map(
({ key, children, ...itemProps }: ArrayFieldTemplateItemType<T, S, F>) => { ({ key, children, ...itemProps }: ArrayFieldTemplateItemType<T, S, F>) => {
const newChildren = cloneElement(children, { const newChildren = cloneElement(children, {
// @ts-ignore
...children.props, ...children.props,
name: undefined, name: undefined,
title: undefined, title: undefined,

View File

@@ -4,6 +4,7 @@ import {
type ComponentPropsWithoutRef, type ComponentPropsWithoutRef,
Fragment, Fragment,
type ReactElement, type ReactElement,
type ReactNode,
cloneElement, cloneElement,
useState, useState,
} from "react"; } from "react";
@@ -11,7 +12,7 @@ import { twMerge } from "tailwind-merge";
import { useEvent } from "ui/hooks/use-event"; import { useEvent } from "ui/hooks/use-event";
export type DropdownItem = export type DropdownItem =
| (() => JSX.Element) | (() => ReactNode)
| { | {
label: string | ReactElement; label: string | ReactElement;
icon?: any; icon?: any;

View File

@@ -2,6 +2,7 @@ import type { DB } from "core";
import { import {
type ComponentPropsWithRef, type ComponentPropsWithRef,
type ComponentPropsWithoutRef, type ComponentPropsWithoutRef,
type ReactNode,
type RefObject, type RefObject,
memo, memo,
useEffect, useEffect,
@@ -27,7 +28,7 @@ export type FileState = {
export type FileStateWithData = FileState & { data: DB["media"] }; export type FileStateWithData = FileState & { data: DB["media"] };
export type DropzoneRenderProps = { export type DropzoneRenderProps = {
wrapperRef: RefObject<HTMLDivElement>; wrapperRef: RefObject<HTMLDivElement | null>;
inputProps: ComponentPropsWithRef<"input">; inputProps: ComponentPropsWithRef<"input">;
state: { state: {
files: FileState[]; files: FileState[];
@@ -59,7 +60,7 @@ export type DropzoneProps = {
show?: boolean; show?: boolean;
text?: string; text?: string;
}; };
children?: (props: DropzoneRenderProps) => JSX.Element; children?: (props: DropzoneRenderProps) => ReactNode;
}; };
function handleUploadError(e: unknown) { function handleUploadError(e: unknown) {
@@ -459,7 +460,7 @@ const UploadPlaceholder = ({ onClick, text = "Upload files" }) => {
export type PreviewComponentProps = { export type PreviewComponentProps = {
file: FileState; file: FileState;
fallback?: (props: { file: FileState }) => JSX.Element; fallback?: (props: { file: FileState }) => ReactNode;
className?: string; className?: string;
onClick?: () => void; onClick?: () => void;
onTouchStart?: () => void; onTouchStart?: () => void;
@@ -486,7 +487,7 @@ type PreviewProps = {
handleUpload: (file: FileState) => Promise<void>; handleUpload: (file: FileState) => Promise<void>;
handleDelete: (file: FileState) => Promise<void>; handleDelete: (file: FileState) => Promise<void>;
}; };
const Preview: React.FC<PreviewProps> = ({ file, handleUpload, handleDelete }) => { const Preview = ({ file, handleUpload, handleDelete }: PreviewProps) => {
const dropdownItems = [ const dropdownItems = [
["initial", "uploaded"].includes(file.state) && { ["initial", "uploaded"].includes(file.state) && {
label: "Delete", label: "Delete",

View File

@@ -1,4 +1,3 @@
import { ucFirstAllSnakeToPascalWithSpaces } from "core/utils";
import { useMemo } from "react"; import { useMemo } from "react";
import { TbArrowLeft, TbDots } from "react-icons/tb"; import { TbArrowLeft, TbDots } from "react-icons/tb";
import { Link, useLocation } from "wouter"; import { Link, useLocation } from "wouter";
@@ -7,7 +6,7 @@ import { Dropdown } from "../../components/overlay/Dropdown";
import { useEvent } from "../../hooks/use-event"; import { useEvent } from "../../hooks/use-event";
type Breadcrumb = { type Breadcrumb = {
label: string | JSX.Element; label: string | Element;
onClick?: () => void; onClick?: () => void;
href?: string; href?: string;
}; };

View File

@@ -1,4 +1,5 @@
import type { FieldApi, ReactFormExtendedApi } from "@tanstack/react-form"; import type { FieldApi, ReactFormExtendedApi } from "@tanstack/react-form";
import type { JSX } from "react";
import { import {
type Entity, type Entity,
type EntityData, type EntityData,

View File

@@ -1,5 +1,6 @@
import type { IconType } from "react-icons"; import type { IconType } from "react-icons";
import { TemplateMediaComponent, TemplateMediaMeta } from "./media"; import { TemplateMediaComponent, TemplateMediaMeta } from "./media";
import type { ReactNode } from "react";
export type StepTemplate = { export type StepTemplate = {
id: string; id: string;
@@ -8,8 +9,6 @@ export type StepTemplate = {
Icon: IconType; Icon: IconType;
}; };
const Templates: [() => JSX.Element, StepTemplate][] = [ const Templates: [() => ReactNode, StepTemplate][] = [[TemplateMediaComponent, TemplateMediaMeta]];
[TemplateMediaComponent, TemplateMediaMeta],
];
export default Templates; export default Templates;

View File

@@ -8,8 +8,7 @@
}, },
"formatter": { "formatter": {
"enabled": true, "enabled": true,
"indentStyle": "space", "indentStyle": "space"
"ignore": ["**/package.json"]
}, },
"javascript": { "javascript": {
"formatter": { "formatter": {
@@ -23,6 +22,13 @@
"indentWidth": 3 "indentWidth": 3
} }
}, },
"json": {
"formatter": {
"indentWidth": 2,
"lineWidth": 80,
"indentStyle": "space"
}
},
"files": { "files": {
"ignore": [ "ignore": [
"**/node_modules/**", "**/node_modules/**",

1517
bun.lock

File diff suppressed because it is too large Load Diff