Skip to content

Conversation

IDisposable
Copy link
Contributor

@IDisposable IDisposable commented May 14, 2025

Vite 5.2.0 -> 6.3.5
@vitejs/plugin-basic-ssl 1.2.0 -> 2.0.0
cva: 1.0.0-beta.1 -> 1.0.0-beta.3
focus-trap-react 10.2.3 -> 11.0.3
framer-motion 11.15.0 -> 12.11.0
@tailwindcss/postcss 4.1.6
@tailwindcss/vite 4.1.6
tailwind 3.4.17 -> 4.1.6
tailwind-merge 2.5.5 -> 3.3.0

Minor updates:
@headlessui/react 2.2.2 -> 2.2.3
@types/react 19.1.3 -> 19.1.4
@types/react-dom 19.1.3 -> 19.1.5
@typescript-eslint/eslint-plugin 8.32.0 -> 8.32.1
@typescript-eslint/parser 8.32.0 -> 8.32.1
react-simple-keyboard 3.8.71 -> 3.8.72

The new version of vite required an Node 22.15 (since that's current LTS and node 21.x is EOL)

The changes to css due to the tailwind 3 to 4 upgrade were done following the upgrade guide

Done in this order (important):
shadow-sm -> shadow-xs
shadow -> shadown-sm
rounded -> rounded-sm
outline-none -> outline-hidden
32rem_32rem_at_center -> center_at_32rem_32rem (revised order of gradient props)
ring-1 ring-black ring-opacity-5 -> ring-1 ring-black/50
flex-shrink-0 -> shrink-0
outline outline-1 -> outline-1

ALSO removed the extra opacity-0 on the any element that animates into view as that trips up latest tailwind causing the element to be invisible (also holds for the remote video)

FocusTrap is now not exported as the default, so change those imports

headlessui's Menu completely changed, so upgrade to the new syntax which necessitated a reorganization of the Header.tsx to enable the "menu" to still work

@IDisposable
Copy link
Contributor Author

This gets us current for everything except:

  • react-router-dom (6.22.3 -> 7.6.0) which looks like it might break stuff so holding for a bit
  • zustand (4.5.2 -> 5.0.4) really not sure how this is used, so don't want to risk it right now

@IDisposable IDisposable marked this pull request as draft May 14, 2025 01:04
@IDisposable IDisposable force-pushed the upgrade-vite-tailwind branch 4 times, most recently from 2ef0ee7 to 883e55b Compare May 14, 2025 06:14
Vite 5.2.0 -> 6.3.5
@vitejs/plugin-basic-ssl 1.2.0 -> 2.0.0
cva: 1.0.0-beta.1 -> 1.0.0-beta.3
focus-trap-react 10.2.3 -> 11.0.3
framer-motion 11.15.0 -> 12.11.0
@tailwindcss/postcss 4.1.6
@tailwindcss/vite 4.1.6
tailwind 3.4.17 -> 4.1.6
tailwind-merge 2.5.5 -> 3.3.0

Minor updates:
@headlessui/react 2.2.2 -> 2.2.3
@types/react 19.1.3 -> 19.1.4
@types/react-dom 19.1.3 -> 19.1.5
@typescript-eslint/eslint-plugin 8.32.0 -> 8.32.1
@typescript-eslint/parser 8.32.0 -> 8.32.1
react-simple-keyboard 3.8.71 -> 3.8.72

The new version of vite required an Node 22.15 (since that's current LTS and node 21.x is EOL)

The changes to css due to the tailwind 3 to 4 upgrade were done following [the upgrade guide](https://tailwindcss.com/docs/upgrade-guide#changes-from-v3)

Done in this order (important):
`shadow-sm` -> `shadow-xs`
`shadow` -> `shadown-sm`
`rounded` -> `rounded-sm`
`outline-none` -> `outline-hidden`
`32rem_32rem_at_center` -> `center_at_32rem_32rem` (revised order of gradient props)
`ring-1 ring-black ring-opacity-5` -> `ring-1 ring-black/50`
`flex-shrink-0` -> `shrink-0`
`flex-grow-0` -> `grow-0`
`outline outline-1` -> `outline-1`

ALSO removed the **extra** `opacity-0` on the video element (trips up latest tailwind causing the video to be invisible)

FocusTrap is now not exported as the default, so change those imports

headlessui's Menu completely changed, so upgrade to the new syntax which necessitated a reorganization of the Header.tsx to enable the "menu" to still work
@IDisposable IDisposable force-pushed the upgrade-vite-tailwind branch from 883e55b to 7616730 Compare May 14, 2025 06:17
@IDisposable IDisposable marked this pull request as ready for review May 14, 2025 06:18
@IDisposable IDisposable changed the title Upgrade UI vite and tailwind packages chore: Upgrade UI vite and tailwind packages May 14, 2025
"type": "module",
"engines": {
"node": "21.1.0"
"node": "22.15.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is required for current vite since node 21.1.0 is EoL
Jump to current LTS version of 22.x, current release is 22.15.0

"@headlessui/tailwindcss": "^0.2.2",
"@heroicons/react": "^2.2.0",
"@vitejs/plugin-basic-ssl": "^1.2.0",
"@vitejs/plugin-basic-ssl": "^2.0.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has to be upgraded for vite 6.x

"@xterm/addon-webgl": "^0.18.0",
"@xterm/xterm": "^5.5.0",
"cva": "^1.0.0-beta.1",
"cva": "^1.0.0-beta.3",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... odd there seems to be no tag on the cva repo for the old beta.1 release we referenced.

},
"dependencies": {
"@headlessui/react": "^2.2.2",
"@headlessui/react": "^2.2.3",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trivial

"eslint-import-resolver-alias": "^1.1.2",
"focus-trap-react": "^10.2.3",
"framer-motion": "^11.15.0",
"focus-trap-react": "^11.0.3",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This causes the syntax for importing FocusTrap to change (no longer exported as the module default), but trivial change.

"focus-trap-react": "^10.2.3",
"framer-motion": "^11.15.0",
"focus-trap-react": "^11.0.3",
"framer-motion": "^12.11.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a pretty large change, but review shows it to be safe and tests works fine

"react-icons": "^5.5.0",
"react-router-dom": "^6.22.3",
"react-simple-keyboard": "^3.8.71",
"react-simple-keyboard": "^3.8.72",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trivial

"react-xtermjs": "^1.0.10",
"recharts": "^2.15.3",
"tailwind-merge": "^2.5.5",
"tailwind-merge": "^3.3.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a medium change, but required no code churn and works fine.

},
"devDependencies": {
"@tailwindcss/forms": "^0.5.10",
"@tailwindcss/postcss": "^4.1.6",
Copy link
Contributor Author

@IDisposable IDisposable May 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now required because vite+tailwind+postcss is done differently now.

"@tailwindcss/typography": "^0.5.16",
"@types/react": "^19.1.3",
"@types/react-dom": "^19.1.3",
"@tailwindcss/vite": "^4.1.6",
Copy link
Contributor Author

@IDisposable IDisposable May 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now required because vite+tailwind+postcss is done differently now.

"@types/react": "^19.1.3",
"@types/react-dom": "^19.1.3",
"@tailwindcss/vite": "^4.1.6",
"@types/react": "^19.1.4",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trivial

"@types/validator": "^13.15.0",
"@typescript-eslint/eslint-plugin": "^8.32.0",
"@typescript-eslint/parser": "^8.32.0",
"@typescript-eslint/eslint-plugin": "^8.32.1",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trivial

"prettier": "^3.5.3",
"prettier-plugin-tailwindcss": "^0.6.11",
"tailwindcss": "^3.4.17",
"tailwindcss": "^4.1.6",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Major upgrade, changed the Menu
Menu.Button -> MenuButton
Menu.Items -> MenuItems
Menu.Item -> MenuItem

Additionally the menu no longer works with Card embedded as the parent for the items, so restructured the Header.tsx

"tailwindcss": "^4.1.6",
"typescript": "^5.8.3",
"vite": "^5.2.0",
"vite": "^6.3.5",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Major update, followed the upgrade process.

import { useNavigate } from "react-router-dom";
import { ArrowLeftEndOnRectangleIcon, ChevronDownIcon } from "@heroicons/react/16/solid";
import { Menu, MenuButton } from "@headlessui/react";
import { Button, Menu, MenuButton, MenuItem, MenuItems } from "@headlessui/react";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restructured due to the new Menu code. Using the headlessui's version of Button because it works more reliably with their MenuItem(s)


const usbState = useHidStore(state => state.usbState);

// for testing
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can delete this if desired, but helpful when testing to be able to "fake" the cloud login information.

<div className="hidden w-[159px] md:block">
<USBStateStatus
state={usbState}
<div className="hidden items-center gap-x-2 md:flex">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First big change here is putting the three right-side things in a single row so the heights line up.

anchor="bottom end"
className="right-0 mt-1 w-56 origin-top-right data-closed:opacity-0 focus:outline-hidden">
<MenuItem>
<Card className="overflow-hidden">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Big change here is putting the Card inside the MenuItem (of which there is now only one) because trying to wrap the Menu.Items in theCard completely breaks this version of headlessui.

<div className="absolute w-screen h-screen overflow-hidden isolate opacity-60">
<svg
className="absolute inset-x-0 top-0 -z-10 h-[64rem] w-full stroke-gray-300 [mask-image:radial-gradient(32rem_32rem_at_center,white,transparent)] dark:stroke-slate-300/20"
className="absolute inset-x-0 top-0 -z-10 h-[64rem] w-full stroke-gray-300 [mask-image:radial-gradient(center_at_32rem_32rem,white,transparent)] dark:stroke-slate-300/20"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The gradient syntax is now whined about unless it is in attachment then offset order...

hdmiError ||
peerConnectionState !== "connected",
"!opacity-60": showPointerLockBar,
"animate-slideUpFade border border-slate-800/30 opacity-0 shadow dark:border-slate-300/20":
Copy link
Contributor Author

@IDisposable IDisposable May 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that we no longer can or should declare the opacity-0 in the source, as the slideUpFade or fadeIn implies and enforces it. If you leave it in here, the contents of the all the little dialog boxes never appears when clicking.

This change happens a lot of places, and is required.

@tailwind base;
@tailwind components;
@tailwind utilities;
@import "tailwindcss";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New syntax for tailwind 4.x

@IDisposable IDisposable force-pushed the upgrade-vite-tailwind branch 2 times, most recently from 4cc3950 to ad8dd37 Compare May 14, 2025 08:59
@@ -0,0 +1,93 @@
const {
Copy link
Contributor Author

@IDisposable IDisposable May 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converted the .eslintrc.cjs to the new format. Followed the migration instructions

@IDisposable IDisposable force-pushed the upgrade-vite-tailwind branch from ad8dd37 to bccb03d Compare May 14, 2025 09:24
"zustand": "^4.5.2"
},
"devDependencies": {
"@eslint/compat": "^1.2.9",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are for new eslint

"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.20",
"globals": "^16.1.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For new eslint

import LoginRoute from "@routes/login";
import SetupRoute from "@routes/devices.$id.setup";
import DevicesRoute, { loader as DeviceListLoader } from "@routes/devices";
import DevicesRoute from "@routes/devices";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing the eslint warning about the export const loader requires a change here to follow the same pattern as other routes.

import * as SettingsIndexRoute from "./routes/devices.$id.settings._index";
import SettingsAdvancedRoute from "./routes/devices.$id.settings.advanced";
import * as SettingsAccessIndexRoute from "./routes/devices.$id.settings.access._index";
import SettingsAccessIndexRoute from "./routes/devices.$id.settings.access._index";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing the eslint warning about the export const loader requires a change here to follow the same pattern as other routes.

{
path: "devices",
element: <DevicesRoute />,
loader: DevicesRoute.loader },
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing the eslint warning about the export const loader requires a change here to follow the same pattern as other routes.

{
index: true,
element: <SettingsAccessIndexRoute.default />,
element: <SettingsAccessIndexRoute />,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing the eslint warning about the export const loader requires a change here to follow the same pattern as other routes.

{
index: true,
element: <SettingsAccessIndexRoute.default />,
element: <SettingsAccessIndexRoute />,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing the eslint warning about the export const loader requires a change here to follow the same pattern as other routes.

);
}

SettingsAccessIndexRoute.loader = loader;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing the eslint warning about the export const loader requires a change here to follow the same pattern as other routes.

);
}

DevicesRoute.loader = loader;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing the eslint warning about the export const loader requires a change here to follow the same pattern as other routes.

primaryLinks={[{ title: "Cloud Devices", to: "/devices" }]}
userEmail={user?.email}
picture={user?.picture}
kvmName={device?.name}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ensures we have the device's name in the deregister screen

primaryLinks={[{ title: "Cloud Devices", to: "/devices" }]}
userEmail={user?.email}
picture={user?.picture}
kvmName={device?.name}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ensures we have the device's name in the rename screen

} from "react-router-dom";
import { useInterval } from "usehooks-ts";
import FocusTrap from "focus-trap-react";
import { FocusTrap } from "focus-trap-react";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FocusTrap no longer exported as the default

@IDisposable IDisposable force-pushed the upgrade-vite-tailwind branch from 5e9d03d to d48c2ee Compare May 14, 2025 16:22
<div className="relative flex select-none items-center gap-x-3">
<div
className={cx("opacity-0 transition-opacity duration-200", {
className={cx("opacity-0 transition-opacity duration-200", {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a unique animation pattern, I think this one stays.

@IDisposable
Copy link
Contributor Author

Resolved merge conflicts, ready for review @ym @adamshiervani

Copy link
Contributor

@adamshiervani adamshiervani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A great PR as usual! Thanks, @IDisposable

@adamshiervani adamshiervani merged commit 7ccb8e6 into jetkvm:dev May 15, 2025
5 checks passed
@IDisposable IDisposable deleted the upgrade-vite-tailwind branch May 15, 2025 17:28
ym pushed a commit to ym/jetkvm-kvm that referenced this pull request Sep 26, 2025
* chore: Upgrade UI vite and tailwind packages

Vite 5.2.0 -> 6.3.5
@vitejs/plugin-basic-ssl 1.2.0 -> 2.0.0
cva: 1.0.0-beta.1 -> 1.0.0-beta.3
focus-trap-react 10.2.3 -> 11.0.3
framer-motion 11.15.0 -> 12.11.0
@tailwindcss/postcss 4.1.6
@tailwindcss/vite 4.1.6
tailwind 3.4.17 -> 4.1.6
tailwind-merge 2.5.5 -> 3.3.0

Minor updates:
@headlessui/react 2.2.2 -> 2.2.3
@types/react 19.1.3 -> 19.1.4
@types/react-dom 19.1.3 -> 19.1.5
@typescript-eslint/eslint-plugin 8.32.0 -> 8.32.1
@typescript-eslint/parser 8.32.0 -> 8.32.1
react-simple-keyboard 3.8.71 -> 3.8.72

The new version of vite required an Node 22.15 (since that's current LTS and node 21.x is EOL)

The changes to css due to the tailwind 3 to 4 upgrade were done following [the upgrade guide](https://tailwindcss.com/docs/upgrade-guide#changes-from-v3)

Done in this order (important):
`shadow-sm` -> `shadow-xs`
`shadow` -> `shadown-sm`
`rounded` -> `rounded-sm`
`outline-none` -> `outline-hidden`
`32rem_32rem_at_center` -> `center_at_32rem_32rem` (revised order of gradient props)
`ring-1 ring-black ring-opacity-5` -> `ring-1 ring-black/50`
`flex-shrink-0` -> `shrink-0`
`flex-grow-0` -> `grow-0`
`outline outline-1` -> `outline-1`

ALSO removed the **extra** `opacity-0` on the video element (trips up latest tailwind causing the video to be invisible)

FocusTrap is now not exported as the default, so change those imports

headlessui's Menu completely changed, so upgrade to the new syntax which necessitated a reorganization of the Header.tsx to enable the "menu" to still work

* Update eslint config and fix errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants