Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
perf(ui): replace class merging with cn (#148)
Leoc569b8fa4dca
diff --git a/apps/mobile/package.json b/apps/mobile/package.jsonindex 019f3174a..54c19e844 100644--- a/apps/mobile/package.json+++ b/apps/mobile/package.json@@ -56,7 +56,7 @@"@t3tools/mobile-terminal-native": "file:./modules/t3-terminal","@t3tools/shared": "workspace:*","@tabler/icons-react-native": "^3.44.0",- "clsx": "^2.1.1",+ "cn": "^0.2.4","diff": "8.0.3","effect": "catalog:","expo": "~56.0.12",@@ -106,7 +106,6 @@"react-native-webview": "^13.16.1","react-native-worklets": "0.8.3","shiki": "4.2.0",- "tailwind-merge": "^3.5.0","uniwind": "^1.6.2"},"devDependencies": {diff --git a/apps/mobile/src/lib/cn.test.ts b/apps/mobile/src/lib/cn.test.tsnew file mode 100644index 000000000..bd40d7b9e--- /dev/null+++ b/apps/mobile/src/lib/cn.test.ts@@ -0,0 +1,11 @@+import { describe, expect, it } from "vite-plus/test";+import { cn } from "./cn";++describe("cn", () => {+ it("joins conditional classes and resolves Tailwind conflicts", () => {+ const classesForState = (isActive: boolean) =>+ cn("px-2 text-black", isActive && "px-4", { "text-white": isActive, hidden: false });++ expect(classesForState(true)).toBe("px-4 text-white");+ });+});diff --git a/apps/mobile/src/lib/cn.ts b/apps/mobile/src/lib/cn.tsindex 365058ceb..fe0d16987 100644--- a/apps/mobile/src/lib/cn.ts+++ b/apps/mobile/src/lib/cn.ts@@ -1,6 +1 @@-import { type ClassValue, clsx } from "clsx";-import { twMerge } from "tailwind-merge";--export function cn(...inputs: ClassValue[]) {- return twMerge(clsx(inputs));-}+export { cn } from "cn";diff --git a/apps/web/package.json b/apps/web/package.jsonindex 26803265e..9857c7e9c 100644--- a/apps/web/package.json+++ b/apps/web/package.json@@ -35,7 +35,7 @@"@tanstack/react-pacer": "^0.19.4","@tanstack/react-router": "^1.160.2","class-variance-authority": "^0.7.1",- "clsx": "^2.1.1",+ "cn": "^0.2.4","culori": "^4.0.2","d3-scale": "^4.0.2","d3-shape": "^3.2.0",@@ -57,7 +57,6 @@"remark-breaks": "^4.0.0","remark-gfm": "^4.0.1","remark-math": "^6.0.0",- "tailwind-merge": "^3.4.0","zustand": "^5.0.11"},"devDependencies": {diff --git a/apps/web/src/components/dither-kit/lib.ts b/apps/web/src/components/dither-kit/lib.tsindex 6d6936209..f800be760 100644--- a/apps/web/src/components/dither-kit/lib.ts+++ b/apps/web/src/components/dither-kit/lib.ts@@ -1,9 +1,2 @@-// @ts-nocheck-import { type ClassValue, clsx } from "clsx";-import { twMerge } from "tailwind-merge";--/** Tailwind-aware className combiner — local copy so the chart pack is- * self-contained and portable as a registry. */-export function cn(...inputs: ClassValue[]) {- return twMerge(clsx(inputs));-}+/** Tailwind-aware class name combiner used by the chart registry. */+export { cn } from "cn";diff --git a/apps/web/src/lib/utils.test.ts b/apps/web/src/lib/utils.test.tsindex bf7986dd4..61564c058 100644--- a/apps/web/src/lib/utils.test.ts+++ b/apps/web/src/lib/utils.test.ts@@ -1,5 +1,14 @@import { describe, assert, it } from "vite-plus/test";-import { getLocalFileManagerName, isWindowsPlatform } from "./utils";+import { cn, getLocalFileManagerName, isWindowsPlatform } from "./utils";++describe("cn", () => {+ it("joins conditional classes and resolves Tailwind conflicts", () => {+ const classesForState = (isActive: boolean) =>+ cn("px-2 text-black", isActive && "px-4", { "text-white": isActive, hidden: false });++ assert.strictEqual(classesForState(true), "px-4 text-white");+ });+});describe("getLocalFileManagerName", () => {it.each([diff --git a/apps/web/src/lib/utils.ts b/apps/web/src/lib/utils.tsindex 07966d015..2454f97cb 100644--- a/apps/web/src/lib/utils.ts+++ b/apps/web/src/lib/utils.ts@@ -1,12 +1,8 @@import { CommandId, MessageId, ProjectId, ThreadId } from "@t3tools/contracts";-import { type CxOptions, cx } from "class-variance-authority";import * as Encoding from "effect/Encoding";-import { twMerge } from "tailwind-merge";import { DraftId } from "../composerDraftStore";-export function cn(...inputs: CxOptions) {- return twMerge(cx(inputs));-}+export { cn } from "cn";export function isMacPlatform(platform: string): boolean {return /mac|iphone|ipad|ipod/i.test(platform);diff --git a/apps/web/vite.config.ts b/apps/web/vite.config.tsindex ef98e1704..9e748a0a9 100644--- a/apps/web/vite.config.ts+++ b/apps/web/vite.config.ts@@ -211,7 +211,9 @@ export default defineConfig(() => {tsconfigPaths: true,dedupe: ["react", "react-dom", "effect"],alias: {+ clsx: "cn","react-grab": reactGrabEntry,+ "tailwind-merge": "cn",},},experimental: {diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex d7555f12e..e2cc34241 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -269,9 +269,9 @@ importers:'@tabler/icons-react-native':specifier: ^3.44.0version: 3.44.0([email protected]([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected]))([email protected])- clsx:- specifier: ^2.1.1- version: 2.1.1+ cn:+ specifier: ^0.2.4+ version: 0.2.4diff:specifier: 8.0.3version: 8.0.3@@ -419,9 +419,6 @@ importers:shiki:specifier: 4.2.0version: 4.2.0- tailwind-merge:- specifier: ^3.5.0- version: 3.6.0uniwind:specifier: ^1.6.2version: 1.7.0([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])@@ -646,9 +643,9 @@ importers:class-variance-authority:specifier: ^0.7.1version: 0.7.1- clsx:- specifier: ^2.1.1- version: 2.1.1+ cn:+ specifier: ^0.2.4+ version: 0.2.4culori:specifier: ^4.0.2version: 4.0.2@@ -712,9 +709,6 @@ importers:remark-math:specifier: ^6.0.0version: 6.0.0- tailwind-merge:- specifier: ^3.4.0- version: 3.6.0zustand:specifier: ^5.0.11@@ -7379,6 +7373,11 @@ packages:resolution: {integrity: sha512-rwHwUfXL40Chm1r08yrhU3qpUvdVlgkKNeyeGPOxnW8/SyVDvgRaed/Uz54AqWNaTCAThlj6QAs3TZcKI0xDEw==}engines: {node: '>=0.10.0'}+ resolution: {integrity: sha512-SzQvoh5FwizWtQg9+JueKdjWhlfCZMdu5DqNHm9q1wUlRVmKb9WXlepR9bTTbPwzEOyX1ujJ6lcCppmn3bNUCg==}+ engines: {node: '>=20'}+ hasBin: true+resolution: {integrity: sha512-xxodCmBen3iy2i0WtAK8FlFNrRzjUqjRsMfho58xT/wvZU1YTM3fCnRjcy1gJPMepaRlgm/0e6w8SpWHpn3/cA==}engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}@@ -12389,9 +12388,6 @@ packages:resolution: {integrity: sha512-yEFYrVhod+hdNyx7g5Bnkkb0G6si8HJurOoOEgC8B/O0uXLHlaey/65KRv6cuWBNhBgHKAROVpc7QyYqE5gFng==}engines: {node: '>=20'}- resolution: {integrity: sha512-uxL7qAVQriqRQPAyK3pj66VqskWqoZ37PW94jwOTwNfq/z9oyu1V+eqrZqtR2+fCiXdYOZe/Modt8GtvqNzu+w==}-resolution: {integrity: sha512-/tBrSQ36vCleJkAOsy9kbNTgaxvGbyOamC30PRePTQe/o1MFwEKHQk4Cn7BNGaPtjp+PuUrByJehM1hgxfq4sw==}@@ -21120,6 +21116,8 @@ snapshots:+ [email protected]: {}+dependencies:convert-to-spaces: 2.0.1@@ -27256,8 +27254,6 @@ snapshots:- [email protected]: {}-diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yamlindex cfae79434..6b853d0ff 100644--- a/pnpm-workspace.yaml+++ b/pnpm-workspace.yaml@@ -75,6 +75,7 @@ minimumReleaseAgeExclude:- "@mastra/[email protected]"- "@mastra/[email protected]"- "@mastra/[email protected]"overrides:# The SDK always receives the user's Claude executable, so its bundled binaries are unused.