bosia 0.1.18 → 0.1.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -148,7 +148,7 @@ import type { RequestEvent, LoadEvent, Handle } from "bosia";
148
148
 
149
149
  | Export | Description |
150
150
  |--------|-------------|
151
- | `cn(...classes)` | Tailwind class merge utility (clsx + tailwind-merge) |
151
+ | `cn(...classes)` | Tailwind class merge utility (built-in class merging + tailwind-merge) |
152
152
  | `sequence(...handlers)` | Compose multiple `Handle` middleware functions |
153
153
  | `RequestEvent` | Type for API route and hook handlers |
154
154
  | `LoadEvent` | Type for `load()` in `+page.server.ts` / `+layout.server.ts` |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bosia",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "type": "module",
5
5
  "description": "A fast, batteries-included fullstack framework — SSR · Svelte 5 Runes · Bun · ElysiaJS. File-based routing inspired by SvelteKit. No Node.js, no Vite, no adapters.",
6
6
  "keywords": [
@@ -47,7 +47,6 @@
47
47
  "@clack/prompts": "^1.1.0",
48
48
  "@tailwindcss/cli": "^4.2.1",
49
49
  "bun-plugin-svelte": "^0.0.6",
50
- "clsx": "^2.1.1",
51
50
  "elysia": "^1.4.26",
52
51
  "svelte": "^5.53.6",
53
52
  "tailwind-merge": "^3.5.0",
package/src/cli/add.ts CHANGED
@@ -157,8 +157,30 @@ export async function addComponent(name: string, root = false, options?: Install
157
157
 
158
158
  // ─── Ensure $lib/utils.ts exists ─────────────────────────────
159
159
 
160
- const UTILS_CONTENT = `import { clsx, type ClassValue } from "clsx";
161
- import { twMerge } from "tailwind-merge";
160
+ const UTILS_CONTENT = `import { twMerge } from "tailwind-merge";
161
+
162
+ type ClassDictionary = Record<string, any>;
163
+ type ClassArray = ClassValue[];
164
+ type ClassValue = ClassArray | ClassDictionary | string | number | bigint | null | boolean | undefined;
165
+
166
+ function clsx(...inputs: ClassValue[]): string {
167
+ let str = '';
168
+ for (const input of inputs) {
169
+ if (!input) continue;
170
+ if (typeof input === 'string' || typeof input === 'number') {
171
+ str && (str += ' ');
172
+ str += input;
173
+ } else if (Array.isArray(input)) {
174
+ const inner = clsx(...input);
175
+ if (inner) { str && (str += ' '); str += inner; }
176
+ } else if (typeof input === 'object') {
177
+ for (const k in input) {
178
+ if ((input as ClassDictionary)[k]) { str && (str += ' '); str += k; }
179
+ }
180
+ }
181
+ }
182
+ return str;
183
+ }
162
184
 
163
185
  export function cn(...inputs: ClassValue[]) {
164
186
  return twMerge(clsx(inputs));
package/src/lib/utils.ts CHANGED
@@ -1,6 +1,28 @@
1
- import { clsx, type ClassValue } from "clsx";
2
1
  import { twMerge } from "tailwind-merge";
3
2
 
3
+ type ClassDictionary = Record<string, any>;
4
+ type ClassArray = ClassValue[];
5
+ type ClassValue = ClassArray | ClassDictionary | string | number | bigint | null | boolean | undefined;
6
+
7
+ function clsx(...inputs: ClassValue[]): string {
8
+ let str = '';
9
+ for (const input of inputs) {
10
+ if (!input) continue;
11
+ if (typeof input === 'string' || typeof input === 'number') {
12
+ str && (str += ' ');
13
+ str += input;
14
+ } else if (Array.isArray(input)) {
15
+ const inner = clsx(...input);
16
+ if (inner) { str && (str += ' '); str += inner; }
17
+ } else if (typeof input === 'object') {
18
+ for (const k in input) {
19
+ if ((input as ClassDictionary)[k]) { str && (str += ' '); str += k; }
20
+ }
21
+ }
22
+ }
23
+ return str;
24
+ }
25
+
4
26
  export function cn(...inputs: ClassValue[]) {
5
27
  return twMerge(clsx(inputs));
6
28
  }
@@ -11,7 +11,6 @@
11
11
  "dependencies": {
12
12
  "bosia": "^{{BOSIA_VERSION}}",
13
13
  "svelte": "^5.20.0",
14
- "clsx": "^2.1.1",
15
14
  "tailwind-merge": "^3.5.0"
16
15
  },
17
16
  "devDependencies": {
@@ -10,7 +10,6 @@
10
10
  "dependencies": {
11
11
  "bosia": "^{{BOSIA_VERSION}}",
12
12
  "svelte": "^5.20.0",
13
- "clsx": "^2.1.1",
14
13
  "tailwind-merge": "^3.5.0"
15
14
  },
16
15
  "devDependencies": {
@@ -10,7 +10,6 @@
10
10
  "dependencies": {
11
11
  "bosia": "^{{BOSIA_VERSION}}",
12
12
  "svelte": "^5.20.0",
13
- "clsx": "^2.1.1",
14
13
  "tailwind-merge": "^3.5.0"
15
14
  },
16
15
  "devDependencies": {