Update to Hilla 24

This commit is contained in:
grimsi
2024-08-22 10:55:22 +02:00
parent 042c326380
commit cb073c6bcf
52 changed files with 5944 additions and 4078 deletions
+1 -1
View File
@@ -45,5 +45,5 @@ out/
/backend/src/main/resources/static/ /backend/src/main/resources/static/
/docker/docker-compose.yml /docker/docker-compose.yml
/.gameyfin/ /.gameyfin/
/frontend/generated /src/main/frontend/generated/
/db/ /db/
+1
View File
@@ -2,6 +2,7 @@
<configuration default="false" name="GameyfinApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true"> <configuration default="false" name="GameyfinApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
<option name="ACTIVE_PROFILES" value="dev" /> <option name="ACTIVE_PROFILES" value="dev" />
<module name="gameyfin.main" /> <module name="gameyfin.main" />
<option name="SHORTEN_COMMAND_LINE" value="ARGS_FILE" />
<option name="SPRING_BOOT_MAIN_CLASS" value="de.grimsi.gameyfin.GameyfinApplication" /> <option name="SPRING_BOOT_MAIN_CLASS" value="de.grimsi.gameyfin.GameyfinApplication" />
<extension name="coverage"> <extension name="coverage">
<pattern> <pattern>
+1 -1
View File
@@ -4,7 +4,7 @@
<option name="executionName" /> <option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" /> <option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" /> <option name="scriptParameters" value="--stacktrace" />
<option name="taskDescriptions"> <option name="taskDescriptions">
<list /> <list />
</option> </option>
+13 -11
View File
@@ -1,10 +1,15 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.dsl.JvmTarget
val springCloudVersion by extra("2023.0.3")
val vaadinVersion by extra("24.4.5")
plugins { plugins {
val kotlinVersion = "2.0.0" val kotlinVersion = "2.0.10"
id("org.springframework.boot") version "3.3.0" val vaadinVersion = "24.4.5"
id("io.spring.dependency-management") version "1.1.5"
id("dev.hilla") version "2.5.6" id("org.springframework.boot") version "3.3.2"
id("io.spring.dependency-management") version "1.1.6"
id("com.vaadin") version vaadinVersion
kotlin("jvm") version kotlinVersion kotlin("jvm") version kotlinVersion
kotlin("plugin.spring") version kotlinVersion kotlin("plugin.spring") version kotlinVersion
kotlin("plugin.jpa") version kotlinVersion kotlin("plugin.jpa") version kotlinVersion
@@ -34,9 +39,6 @@ repositories {
} }
} }
extra["hillaVersion"] = "2.5.6"
val springCloudVersion by extra("2023.0.2")
dependencies { dependencies {
// Spring Boot & Kotlin // Spring Boot & Kotlin
implementation("org.springframework.boot:spring-boot-starter-actuator") implementation("org.springframework.boot:spring-boot-starter-actuator")
@@ -46,9 +48,9 @@ dependencies {
implementation("jakarta.validation:jakarta.validation-api:3.0.2") implementation("jakarta.validation:jakarta.validation-api:3.0.2")
implementation("org.jetbrains.kotlin:kotlin-reflect") implementation("org.jetbrains.kotlin:kotlin-reflect")
// Hilla // Vaadin Hilla
api("dev.hilla:hilla-react") implementation("com.vaadin:vaadin")
api("dev.hilla:hilla-spring-boot-starter") api("com.vaadin:vaadin-spring-boot-starter")
// Logging // Logging
implementation("io.github.oshai:kotlin-logging-jvm:6.0.3") implementation("io.github.oshai:kotlin-logging-jvm:6.0.3")
@@ -69,7 +71,7 @@ dependencies {
dependencyManagement { dependencyManagement {
imports { imports {
mavenBom("dev.hilla:hilla-bom:${property("hillaVersion")}") mavenBom("com.vaadin:vaadin-bom:$vaadinVersion")
mavenBom("org.springframework.cloud:spring-cloud-dependencies:$springCloudVersion") mavenBom("org.springframework.cloud:spring-cloud-dependencies:$springCloudVersion")
} }
} }
+1 -1
View File
@@ -1,5 +1,5 @@
import {NextUIPluginConfig} from "@nextui-org/react"; import {NextUIPluginConfig} from "@nextui-org/react";
import {compileThemes, themes} from "./frontend/theming/themes" import {compileThemes, themes} from "./src/main/frontend/theming/themes"
export const NextUIConfig: NextUIPluginConfig = { export const NextUIConfig: NextUIPluginConfig = {
prefix: "gf", prefix: "gf",
+5721 -3919
View File
File diff suppressed because it is too large Load Diff
+129 -96
View File
@@ -3,96 +3,94 @@
"version": "2.0.0-ALPHA", "version": "2.0.0-ALPHA",
"type": "module", "type": "module",
"dependencies": { "dependencies": {
"@hilla/form": "2.5.6",
"@hilla/frontend": "2.5.6",
"@hilla/generator-typescript-cli": "2.5.6",
"@hilla/generator-typescript-core": "2.5.6",
"@hilla/generator-typescript-plugin-backbone": "2.5.6",
"@hilla/generator-typescript-plugin-barrel": "2.5.6",
"@hilla/generator-typescript-plugin-client": "2.5.6",
"@hilla/generator-typescript-plugin-model": "2.5.6",
"@hilla/generator-typescript-plugin-push": "2.5.6",
"@hilla/generator-typescript-plugin-subtypes": "2.5.6",
"@hilla/generator-typescript-utils": "2.5.6",
"@hilla/react-auth": "2.5.6",
"@hilla/react-components": "2.3.0",
"@hilla/react-crud": "2.5.6",
"@hilla/react-form": "2.5.6",
"@material-tailwind/react": "^2.1.9", "@material-tailwind/react": "^2.1.9",
"@nextui-org/react": "^2.3.6", "@nextui-org/react": "^2.4.6",
"@phosphor-icons/react": "^2.0.15", "@phosphor-icons/react": "^2.1.7",
"@polymer/polymer": "3.5.1", "@polymer/polymer": "3.5.1",
"@vaadin/bundles": "24.3.0", "@vaadin/bundles": "24.4.1",
"@vaadin/common-frontend": "0.0.19", "@vaadin/common-frontend": "0.0.19",
"@vaadin/hilla-file-router": "24.4.3",
"@vaadin/hilla-frontend": "24.4.3",
"@vaadin/hilla-lit-form": "24.4.3",
"@vaadin/hilla-react-auth": "24.4.3",
"@vaadin/hilla-react-crud": "24.4.3",
"@vaadin/hilla-react-form": "24.4.3",
"@vaadin/hilla-react-i18n": "24.4.3",
"@vaadin/hilla-react-signals": "24.4.3",
"@vaadin/polymer-legacy-adapter": "24.4.1",
"@vaadin/react-components": "24.4.1",
"@vaadin/react-components-pro": "24.4.1",
"@vaadin/router": "1.7.5", "@vaadin/router": "1.7.5",
"@vaadin/vaadin-development-mode-detector": "2.0.7",
"@vaadin/vaadin-lumo-styles": "24.4.1",
"@vaadin/vaadin-material-styles": "24.4.1",
"@vaadin/vaadin-themable-mixin": "24.4.1",
"@vaadin/vaadin-usage-statistics": "2.1.2",
"class-variance-authority": "^0.7.0", "class-variance-authority": "^0.7.0",
"classnames": "^2.3.2", "classnames": "^2.5.1",
"clsx": "^2.1.0", "clsx": "^2.1.1",
"construct-style-sheets-polyfill": "3.1.0", "construct-style-sheets-polyfill": "3.1.0",
"formik": "^2.4.5", "date-fns": "2.29.3",
"framer-motion": "^11.1.7", "formik": "^2.4.6",
"framer-motion": "^11.3.28",
"http-status-codes": "^2.3.0", "http-status-codes": "^2.3.0",
"lit": "3.1.0", "lit": "3.1.4",
"next-themes": "^0.3.0", "next-themes": "^0.3.0",
"react": "^18.2.0", "proj4": "2.11.0",
"react-dom": "^18.2.0", "react": "18.3.1",
"react-router-dom": "^6.4.2", "react-dom": "18.3.1",
"sonner": "^1.4.41", "react-router-dom": "6.23.1",
"tailwind-merge": "^2.3.0", "sonner": "^1.5.0",
"tailwind-merge": "^2.5.2",
"yup": "^1.4.0" "yup": "^1.4.0"
}, },
"devDependencies": { "devDependencies": {
"@lit-labs/react": "^1.1.0", "@babel/preset-react": "7.24.7",
"@rollup/plugin-replace": "5.0.4", "@lit-labs/react": "^2.1.3",
"@rollup/pluginutils": "5.0.5", "@rollup/plugin-replace": "5.0.7",
"@types/node": "^20.12.2", "@rollup/pluginutils": "5.1.0",
"@types/react": "18.2.42", "@types/node": "^22.4.0",
"@types/react-dom": "^18.0.8", "@types/react": "18.3.3",
"@vitejs/plugin-react": "4.2.0", "@types/react-dom": "18.3.0",
"@vitejs/plugin-react-swc": "3.5.0", "@vaadin/hilla-generator-cli": "24.4.3",
"async": "3.2.4", "@vaadin/hilla-generator-core": "24.4.3",
"autoprefixer": "^10.4.18", "@vaadin/hilla-generator-plugin-backbone": "24.4.3",
"glob": "10.3.3", "@vaadin/hilla-generator-plugin-barrel": "24.4.3",
"postcss": "^8.4.35", "@vaadin/hilla-generator-plugin-client": "24.4.3",
"@vaadin/hilla-generator-plugin-model": "24.4.3",
"@vaadin/hilla-generator-plugin-push": "24.4.3",
"@vaadin/hilla-generator-plugin-subtypes": "24.4.3",
"@vaadin/hilla-generator-utils": "24.4.3",
"@vitejs/plugin-react": "4.3.1",
"@vitejs/plugin-react-swc": "^3.7.0",
"async": "3.2.5",
"autoprefixer": "^10.4.20",
"glob": "10.4.1",
"postcss": "^8.4.41",
"postcss-import": "^16.1.0", "postcss-import": "^16.1.0",
"rollup-plugin-brotli": "3.1.0", "rollup-plugin-brotli": "3.1.0",
"rollup-plugin-visualizer": "5.9.2", "rollup-plugin-visualizer": "5.12.0",
"strip-css-comments": "5.0.0", "strip-css-comments": "5.0.0",
"tailwindcss": "^3.4.1", "tailwindcss": "^3.4.10",
"transform-ast": "2.4.4", "transform-ast": "2.4.4",
"typescript": "5.3.3", "typescript": "5.4.5",
"vite": "5.0.6", "vite": "5.3.3",
"vite-plugin-checker": "0.6.2", "vite-plugin-checker": "0.6.4",
"workbox-build": "7.0.0", "workbox-build": "7.1.1",
"workbox-core": "7.0.0", "workbox-core": "7.1.0",
"workbox-precaching": "7.0.0" "workbox-precaching": "7.1.0"
}, },
"overrides": { "overrides": {
"classnames": "$classnames", "classnames": "$classnames",
"react": "$react", "react": "$react",
"react-dom": "$react-dom", "react-dom": "18.3.1",
"react-router-dom": "$react-router-dom", "react-router-dom": "$react-router-dom",
"@vaadin/bundles": "$@vaadin/bundles", "@vaadin/bundles": "$@vaadin/bundles",
"@hilla/react-components": "$@hilla/react-components",
"@vaadin/common-frontend": "$@vaadin/common-frontend", "@vaadin/common-frontend": "$@vaadin/common-frontend",
"construct-style-sheets-polyfill": "$construct-style-sheets-polyfill", "construct-style-sheets-polyfill": "$construct-style-sheets-polyfill",
"lit": "$lit", "lit": "$lit",
"@vaadin/router": "$@vaadin/router", "@vaadin/router": "$@vaadin/router",
"@polymer/polymer": "$@polymer/polymer", "@polymer/polymer": "$@polymer/polymer",
"@hilla/react-auth": "$@hilla/react-auth",
"@hilla/generator-typescript-plugin-model": "$@hilla/generator-typescript-plugin-model",
"@hilla/generator-typescript-plugin-barrel": "$@hilla/generator-typescript-plugin-barrel",
"@hilla/react-form": "$@hilla/react-form",
"@hilla/generator-typescript-plugin-push": "$@hilla/generator-typescript-plugin-push",
"@hilla/generator-typescript-core": "$@hilla/generator-typescript-core",
"@hilla/generator-typescript-plugin-client": "$@hilla/generator-typescript-plugin-client",
"@hilla/generator-typescript-utils": "$@hilla/generator-typescript-utils",
"@hilla/frontend": "$@hilla/frontend",
"@hilla/form": "$@hilla/form",
"@hilla/generator-typescript-plugin-subtypes": "$@hilla/generator-typescript-plugin-subtypes",
"@hilla/react-crud": "$@hilla/react-crud",
"@hilla/generator-typescript-plugin-backbone": "$@hilla/generator-typescript-plugin-backbone",
"@hilla/generator-typescript-cli": "$@hilla/generator-typescript-cli",
"@phosphor-icons/react": "$@phosphor-icons/react", "@phosphor-icons/react": "$@phosphor-icons/react",
"formik": "$formik", "formik": "$formik",
"yup": "$yup", "yup": "$yup",
@@ -104,50 +102,85 @@
"framer-motion": "$framer-motion", "framer-motion": "$framer-motion",
"@material-tailwind/react": "$@material-tailwind/react", "@material-tailwind/react": "$@material-tailwind/react",
"sonner": "$sonner", "sonner": "$sonner",
"http-status-codes": "$http-status-codes" "http-status-codes": "$http-status-codes",
"@vaadin/polymer-legacy-adapter": "$@vaadin/polymer-legacy-adapter",
"@vaadin/vaadin-development-mode-detector": "$@vaadin/vaadin-development-mode-detector",
"@vaadin/vaadin-usage-statistics": "$@vaadin/vaadin-usage-statistics",
"@vaadin/react-components": "$@vaadin/react-components",
"@vaadin/react-components-pro": "$@vaadin/react-components-pro",
"@vaadin/hilla-frontend": "$@vaadin/hilla-frontend",
"@vaadin/hilla-react-auth": "$@vaadin/hilla-react-auth",
"@vaadin/hilla-react-crud": "$@vaadin/hilla-react-crud",
"@vaadin/hilla-file-router": "$@vaadin/hilla-file-router",
"@vaadin/hilla-react-i18n": "$@vaadin/hilla-react-i18n",
"@vaadin/hilla-lit-form": "$@vaadin/hilla-lit-form",
"@vaadin/hilla-react-form": "$@vaadin/hilla-react-form",
"@vaadin/hilla-react-signals": "$@vaadin/hilla-react-signals",
"date-fns": "$date-fns",
"proj4": "$proj4",
"@vaadin/vaadin-themable-mixin": "$@vaadin/vaadin-themable-mixin",
"@vaadin/vaadin-lumo-styles": "$@vaadin/vaadin-lumo-styles",
"@vaadin/vaadin-material-styles": "$@vaadin/vaadin-material-styles"
}, },
"vaadin": { "vaadin": {
"dependencies": { "dependencies": {
"@hilla/form": "2.5.6",
"@hilla/frontend": "2.5.6",
"@hilla/generator-typescript-cli": "2.5.6",
"@hilla/generator-typescript-core": "2.5.6",
"@hilla/generator-typescript-plugin-backbone": "2.5.6",
"@hilla/generator-typescript-plugin-barrel": "2.5.6",
"@hilla/generator-typescript-plugin-client": "2.5.6",
"@hilla/generator-typescript-plugin-model": "2.5.6",
"@hilla/generator-typescript-plugin-push": "2.5.6",
"@hilla/generator-typescript-plugin-subtypes": "2.5.6",
"@hilla/generator-typescript-utils": "2.5.6",
"@hilla/react-auth": "2.5.6",
"@hilla/react-components": "2.3.0",
"@hilla/react-crud": "2.5.6",
"@hilla/react-form": "2.5.6",
"@polymer/polymer": "3.5.1", "@polymer/polymer": "3.5.1",
"@vaadin/bundles": "24.3.0", "@vaadin/bundles": "24.4.1",
"@vaadin/common-frontend": "0.0.19", "@vaadin/common-frontend": "0.0.19",
"@vaadin/hilla-file-router": "24.4.3",
"@vaadin/hilla-frontend": "24.4.3",
"@vaadin/hilla-lit-form": "24.4.3",
"@vaadin/hilla-react-auth": "24.4.3",
"@vaadin/hilla-react-crud": "24.4.3",
"@vaadin/hilla-react-form": "24.4.3",
"@vaadin/hilla-react-i18n": "24.4.3",
"@vaadin/hilla-react-signals": "24.4.3",
"@vaadin/polymer-legacy-adapter": "24.4.1",
"@vaadin/react-components": "24.4.1",
"@vaadin/react-components-pro": "24.4.1",
"@vaadin/router": "1.7.5", "@vaadin/router": "1.7.5",
"@vaadin/vaadin-development-mode-detector": "2.0.7",
"@vaadin/vaadin-lumo-styles": "24.4.1",
"@vaadin/vaadin-material-styles": "24.4.1",
"@vaadin/vaadin-themable-mixin": "24.4.1",
"@vaadin/vaadin-usage-statistics": "2.1.2",
"construct-style-sheets-polyfill": "3.1.0", "construct-style-sheets-polyfill": "3.1.0",
"lit": "3.1.0" "date-fns": "2.29.3",
"lit": "3.1.4",
"proj4": "2.11.0",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-router-dom": "6.23.1"
}, },
"devDependencies": { "devDependencies": {
"@rollup/plugin-replace": "5.0.4", "@babel/preset-react": "7.24.7",
"@rollup/pluginutils": "5.0.5", "@rollup/plugin-replace": "5.0.7",
"@vitejs/plugin-react": "4.2.0", "@rollup/pluginutils": "5.1.0",
"@vitejs/plugin-react-swc": "3.5.0", "@types/react": "18.3.3",
"async": "3.2.4", "@types/react-dom": "18.3.0",
"glob": "10.3.3", "@vaadin/hilla-generator-cli": "24.4.3",
"@vaadin/hilla-generator-core": "24.4.3",
"@vaadin/hilla-generator-plugin-backbone": "24.4.3",
"@vaadin/hilla-generator-plugin-barrel": "24.4.3",
"@vaadin/hilla-generator-plugin-client": "24.4.3",
"@vaadin/hilla-generator-plugin-model": "24.4.3",
"@vaadin/hilla-generator-plugin-push": "24.4.3",
"@vaadin/hilla-generator-plugin-subtypes": "24.4.3",
"@vaadin/hilla-generator-utils": "24.4.3",
"@vitejs/plugin-react": "4.3.1",
"async": "3.2.5",
"glob": "10.4.1",
"rollup-plugin-brotli": "3.1.0", "rollup-plugin-brotli": "3.1.0",
"rollup-plugin-visualizer": "5.9.2", "rollup-plugin-visualizer": "5.12.0",
"strip-css-comments": "5.0.0", "strip-css-comments": "5.0.0",
"transform-ast": "2.4.4", "transform-ast": "2.4.4",
"typescript": "5.3.3", "typescript": "5.4.5",
"vite": "5.0.6", "vite": "5.3.3",
"vite-plugin-checker": "0.6.2", "vite-plugin-checker": "0.6.4",
"workbox-build": "7.0.0", "workbox-build": "7.1.1",
"workbox-core": "7.0.0", "workbox-core": "7.1.0",
"workbox-precaching": "7.0.0" "workbox-precaching": "7.1.0"
}, },
"hash": "e078b3ecf381b7be4b804c8e2cd928faa9accb3412cfb55cfb649f9633cd1d41" "hash": "3cde6bb06b49097b3e1b82b0ef939d58f6b445ea03b5e0bee9b1b90bc4d61334"
} }
} }
@@ -49,17 +49,23 @@ const Wizard = ({children, initialValues, onSubmit}: {
/*// @ts-ignore*/ /*// @ts-ignore*/
validationSchema={step.props.validationSchema} validationSchema={step.props.validationSchema}
> >
{formik => ( {(formik: { values: any; isSubmitting: any; }) => (
<Form className="flex flex-col h-full"> <Form className="flex flex-col h-full">
<div className="w-full mb-8"> <div className="w-full mb-8">
{/*<p>Step {stepNumber + 1} of {steps.length}</p>*/} {/*<p>Step {stepNumber + 1} of {steps.length}</p>*/}
<Stepper activeStep={stepNumber} activeLineClassName="bg-primary" <Stepper activeStep={stepNumber} activeLineClassName="bg-primary"
lineClassName="bg-foreground"> lineClassName="bg-foreground"
placeholder={undefined}
onPointerEnterCapture={undefined}
onPointerLeaveCapture={undefined}>
{steps.map((child, index) => ( {steps.map((child, index) => (
<Step key={index} <Step key={index}
className="bg-foreground text-background" className="bg-foreground text-background"
activeClassName="bg-primary" activeClassName="bg-primary"
completedClassName="bg-primary"> completedClassName="bg-primary"
placeholder={undefined}
onPointerEnterCapture={undefined}
onPointerLeaveCapture={undefined}>
{/*@ts-ignore*/} {/*@ts-ignore*/}
{child.props.icon} {child.props.icon}
</Step> </Step>
@@ -1,4 +1,4 @@
import {protectRoutes} from '@hilla/react-auth'; import {protectRoutes} from '@vaadin/hilla-react-auth';
import {createBrowserRouter, RouteObject} from 'react-router-dom'; import {createBrowserRouter, RouteObject} from 'react-router-dom';
import LoginView from "Frontend/views/LoginView"; import LoginView from "Frontend/views/LoginView";
import MainLayout from "Frontend/views/MainLayout"; import MainLayout from "Frontend/views/MainLayout";
@@ -1,4 +1,4 @@
import {configureAuth} from '@hilla/react-auth'; import {configureAuth} from '@vaadin/hilla-react-auth';
import {UserEndpoint} from 'Frontend/generated/endpoints'; import {UserEndpoint} from 'Frontend/generated/endpoints';
// Configure auth to use `UserInfoService.getUserInfo` // Configure auth to use `UserInfoService.getUserInfo`
@@ -1,4 +1,4 @@
import {Middleware, MiddlewareContext, MiddlewareNext} from '@hilla/frontend'; import {Middleware, MiddlewareContext, MiddlewareNext} from '@vaadin/hilla-frontend';
import {toast} from "sonner"; import {toast} from "sonner";
import {getReasonPhrase} from "http-status-codes"; import {getReasonPhrase} from "http-status-codes";
@@ -3,7 +3,7 @@ import {useEffect} from 'react';
import ProfileMenu from "Frontend/components/ProfileMenu"; import ProfileMenu from "Frontend/components/ProfileMenu";
import {Divider, Link, Navbar, NavbarBrand, NavbarContent, NavbarItem} from "@nextui-org/react"; import {Divider, Link, Navbar, NavbarBrand, NavbarContent, NavbarItem} from "@nextui-org/react";
import GameyfinLogo from "Frontend/components/theming/GameyfinLogo"; import GameyfinLogo from "Frontend/components/theming/GameyfinLogo";
import * as PackageJson from "../../package.json"; import * as PackageJson from "../../../../package.json";
import {Outlet, useNavigate} from "react-router-dom"; import {Outlet, useNavigate} from "react-router-dom";
export default function MainLayout() { export default function MainLayout() {
@@ -1,7 +1,7 @@
import {Link} from "react-router-dom"; import {Link} from "react-router-dom";
import {Button} from "@nextui-org/react"; import {Button} from "@nextui-org/react";
import {toast} from "sonner"; import {toast} from "sonner";
import {SystemEndpoint} from "Frontend/generated/endpoints"; import {SystemEndpoint} from "Frontend/generated/endpoints.js";
export default function TestView() { export default function TestView() {
return ( return (
@@ -14,7 +14,8 @@ export default function TestView() {
description: "Description", description: "Description",
action: { action: {
label: "OK", label: "OK",
onClick: () => {}, onClick: () => {
},
} }
})}>Toast (Normal)</Button> })}>Toast (Normal)</Button>
<Button onPress={ <Button onPress={
@@ -22,7 +23,8 @@ export default function TestView() {
description: "Description", description: "Description",
action: { action: {
label: "OK", label: "OK",
onClick: () => {}, onClick: () => {
},
} }
})}>Toast (Success)</Button> })}>Toast (Success)</Button>
<Button onPress={ <Button onPress={
@@ -30,7 +32,8 @@ export default function TestView() {
description: "Description", description: "Description",
action: { action: {
label: "OK", label: "OK",
onClick: () => {}, onClick: () => {
},
} }
})}>Toast (Error)</Button> })}>Toast (Error)</Button>
</div> </div>
@@ -7,8 +7,8 @@ import de.grimsi.gameyfin.users.UserService
import de.grimsi.gameyfin.users.dto.UserInfo import de.grimsi.gameyfin.users.dto.UserInfo
import de.grimsi.gameyfin.users.dto.UserRegistration import de.grimsi.gameyfin.users.dto.UserRegistration
import de.grimsi.gameyfin.users.entities.User import de.grimsi.gameyfin.users.entities.User
import dev.hilla.Endpoint import com.vaadin.hilla.Endpoint
import dev.hilla.exception.EndpointException import com.vaadin.hilla.exception.EndpointException
@Endpoint @Endpoint
class SetupEndpoint( class SetupEndpoint(
@@ -1,7 +1,7 @@
package de.grimsi.gameyfin.system package de.grimsi.gameyfin.system
import de.grimsi.gameyfin.config.Roles import de.grimsi.gameyfin.config.Roles
import dev.hilla.Endpoint import com.vaadin.hilla.Endpoint
import jakarta.annotation.security.RolesAllowed import jakarta.annotation.security.RolesAllowed
@Endpoint @Endpoint
@@ -4,7 +4,7 @@ import de.grimsi.gameyfin.config.Roles
import de.grimsi.gameyfin.users.dto.UserInfo import de.grimsi.gameyfin.users.dto.UserInfo
import de.grimsi.gameyfin.users.dto.UserRegistration import de.grimsi.gameyfin.users.dto.UserRegistration
import de.grimsi.gameyfin.users.entities.User import de.grimsi.gameyfin.users.entities.User
import dev.hilla.Endpoint import com.vaadin.hilla.Endpoint
import jakarta.annotation.security.PermitAll import jakarta.annotation.security.PermitAll
import org.springframework.security.core.Authentication import org.springframework.security.core.Authentication
import org.springframework.security.core.GrantedAuthority import org.springframework.security.core.GrantedAuthority
+4 -4
View File
@@ -4,7 +4,7 @@
// You might want to change the configurations to fit your preferences // You might want to change the configurations to fit your preferences
// For more information about the configurations, please refer to http://www.typescriptlang.org/docs/handbook/tsconfig-json.html // For more information about the configurations, please refer to http://www.typescriptlang.org/docs/handbook/tsconfig-json.html
{ {
"_version": "9", "_version": "9.1",
"compilerOptions": { "compilerOptions": {
"sourceMap": true, "sourceMap": true,
"jsx": "react-jsx", "jsx": "react-jsx",
@@ -22,7 +22,7 @@
"noUnusedParameters": false, "noUnusedParameters": false,
"experimentalDecorators": true, "experimentalDecorators": true,
"useDefineForClassFields": false, "useDefineForClassFields": false,
"baseUrl": "frontend", "baseUrl": "src/main/frontend",
"paths": { "paths": {
"@vaadin/flow-frontend": [ "@vaadin/flow-frontend": [
"generated/jar-resources" "generated/jar-resources"
@@ -36,10 +36,10 @@
} }
}, },
"include": [ "include": [
"frontend/**/*", "src/main/frontend/**/*",
"types.d.ts" "types.d.ts"
], ],
"exclude": [ "exclude": [
"frontend/generated/jar-resources/**" "src/main/frontend/generated/jar-resources/**"
] ]
} }
Vendored
+11
View File
@@ -59,3 +59,14 @@ declare module '*.webp' {
const ref: string; const ref: string;
export default ref; export default ref;
} }
declare module '*.css?inline' {
import type { CSSResultGroup } from 'lit';
const content: CSSResultGroup;
export default content;
}
declare module 'csstype' {
interface Properties {
[index: `--${string}`]: any;
}
}
+1 -7
View File
@@ -1,7 +1,6 @@
import reactSwc from '@vitejs/plugin-react-swc'; import reactSwc from '@vitejs/plugin-react-swc';
import type {UserConfigFn} from 'vite'; import type {UserConfigFn} from 'vite';
import {overrideVaadinConfig} from './vite.generated'; import {overrideVaadinConfig} from './vite.generated';
import path from "path";
const customConfig: UserConfigFn = (env) => ({ const customConfig: UserConfigFn = (env) => ({
// Here you can add custom Vite parameters // Here you can add custom Vite parameters
@@ -10,12 +9,7 @@ const customConfig: UserConfigFn = (env) => ({
reactSwc({ reactSwc({
tsDecorators: true, tsDecorators: true,
}), }),
], ]
resolve: {
alias: {
"@": path.resolve(__dirname, "./frontend"),
},
},
}); });
export default overrideVaadinConfig(customConfig); export default overrideVaadinConfig(customConfig);
+30 -16
View File
@@ -11,6 +11,7 @@ import * as net from 'net';
import { processThemeResources } from './build/plugins/application-theme-plugin/theme-handle.js'; import { processThemeResources } from './build/plugins/application-theme-plugin/theme-handle.js';
import { rewriteCssUrls } from './build/plugins/theme-loader/theme-loader-utils.js'; import { rewriteCssUrls } from './build/plugins/theme-loader/theme-loader-utils.js';
import { addFunctionComponentSourceLocationBabel } from './build/plugins/react-function-location-plugin/react-function-location-plugin.js';
import settings from './build/vaadin-dev-server-settings.json'; import settings from './build/vaadin-dev-server-settings.json';
import { import {
AssetInfo, AssetInfo,
@@ -33,6 +34,9 @@ import postcssLit from './build/plugins/rollup-plugin-postcss-lit-custom/rollup-
import { createRequire } from 'module'; import { createRequire } from 'module';
import { visualizer } from 'rollup-plugin-visualizer'; import { visualizer } from 'rollup-plugin-visualizer';
import reactPlugin from '@vitejs/plugin-react';
import vitePluginFileSystemRouter from '@vaadin/hilla-file-router/vite-plugin.js';
// Make `require` compatible with ES modules // Make `require` compatible with ES modules
const require = createRequire(import.meta.url); const require = createRequire(import.meta.url);
@@ -605,7 +609,6 @@ function themePlugin(opts): PluginOption {
if (!id.startsWith(settings.themeFolder)) { if (!id.startsWith(settings.themeFolder)) {
return; return;
} }
for (const location of [themeResourceFolder, frontendFolder]) { for (const location of [themeResourceFolder, frontendFolder]) {
const result = await this.resolve(path.resolve(location, id)); const result = await this.resolve(path.resolve(location, id));
if (result) { if (result) {
@@ -622,8 +625,9 @@ function themePlugin(opts): PluginOption {
) { ) {
return; return;
} }
const [themeName] = bareId.substring(themeFolder.length + 1).split('/'); const resourceThemeFolder = bareId.startsWith(themeFolder) ? themeFolder : themeOptions.themeResourceFolder;
return rewriteCssUrls(raw, path.dirname(bareId), path.resolve(themeFolder, themeName), console, opts); const [themeName] = bareId.substring(resourceThemeFolder.length + 1).split('/');
return rewriteCssUrls(raw, path.dirname(bareId), path.resolve(resourceThemeFolder, themeName), console, opts);
} }
}; };
} }
@@ -644,8 +648,6 @@ function runWatchDog(watchDogPort, watchDogHost) {
client.connect(watchDogPort, watchDogHost || 'localhost'); client.connect(watchDogPort, watchDogHost || 'localhost');
} }
let spaMiddlewareForceRemoved = false;
const allowedFrontendFolders = [frontendFolder, nodeModulesFolder]; const allowedFrontendFolders = [frontendFolder, nodeModulesFolder];
function showRecompileReason(): PluginOption { function showRecompileReason(): PluginOption {
@@ -716,9 +718,11 @@ export const vaadinConfig: UserConfigFn = (env) => {
} }
}, },
build: { build: {
minify: productionMode,
outDir: buildOutputFolder, outDir: buildOutputFolder,
emptyOutDir: devBundle, emptyOutDir: devBundle,
assetsDir: 'VAADIN/build', assetsDir: 'VAADIN/build',
target: ["esnext", "safari15"],
rollupOptions: { rollupOptions: {
input: { input: {
indexhtml: projectIndexHtml, indexhtml: projectIndexHtml,
@@ -759,7 +763,7 @@ export const vaadinConfig: UserConfigFn = (env) => {
devMode && showRecompileReason(), devMode && showRecompileReason(),
settings.offlineEnabled && buildSWPlugin({ devMode }), settings.offlineEnabled && buildSWPlugin({ devMode }),
!devMode && statsExtracterPlugin(), !devMode && statsExtracterPlugin(),
devBundle && preserveUsageStats(), !productionMode && preserveUsageStats(),
themePlugin({ devMode }), themePlugin({ devMode }),
postcssLit({ postcssLit({
include: ['**/*.css', /.*\/.*\.css\?.*/], include: ['**/*.css', /.*\/.*\.css\?.*/],
@@ -771,20 +775,29 @@ export const vaadinConfig: UserConfigFn = (env) => {
new RegExp('.*/.*\\?html-proxy.*') new RegExp('.*/.*\\?html-proxy.*')
] ]
}), }),
// The React plugin provides fast refresh and debug source info
reactPlugin({
include: '**/*.tsx',
babel: {
// We need to use babel to provide the source information for it to be correct
// (otherwise Babel will slightly rewrite the source file and esbuild generate source info for the modified file)
presets: [['@babel/preset-react', { runtime: 'automatic', development: !productionMode }]],
// React writes the source location for where components are used, this writes for where they are defined
plugins: [
!productionMode && addFunctionComponentSourceLocationBabel()
].filter(Boolean)
}
}),
{ {
name: 'vaadin:force-remove-html-middleware', name: 'vaadin:force-remove-html-middleware',
transformIndexHtml: { configureServer(server) {
order: 'pre', return () => {
handler(_html, { server }) {
if (server && !spaMiddlewareForceRemoved) {
server.middlewares.stack = server.middlewares.stack.filter((mw) => { server.middlewares.stack = server.middlewares.stack.filter((mw) => {
const handleName = '' + mw.handle; const handleName = `${mw.handle}`;
return !handleName.includes('viteHtmlFallbackMiddleware'); return !handleName.includes('viteHtmlFallbackMiddleware');
}); });
spaMiddlewareForceRemoved = true; };
} },
}
}
}, },
hasExportedWebComponents && { hasExportedWebComponents && {
name: 'vaadin:inject-entrypoints-to-web-component-html', name: 'vaadin:inject-entrypoints-to-web-component-html',
@@ -819,7 +832,7 @@ export const vaadinConfig: UserConfigFn = (env) => {
if (devMode) { if (devMode) {
scripts.push({ scripts.push({
tag: 'script', tag: 'script',
attrs: { type: 'module', src: `/generated/vite-devmode.ts` }, attrs: { type: 'module', src: `/generated/vite-devmode.ts`, onerror: "document.location.reload()" },
injectTo: 'head' injectTo: 'head'
}); });
} }
@@ -836,6 +849,7 @@ export const vaadinConfig: UserConfigFn = (env) => {
typescript: true typescript: true
}), }),
productionMode && visualizer({ brotliSize: true, filename: bundleSizeFile }) productionMode && visualizer({ brotliSize: true, filename: bundleSizeFile })
, vitePluginFileSystemRouter({isDevMode: devMode})
] ]
}; };
}; };