klsx 0.3.0 → 0.3.1

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.
Files changed (2) hide show
  1. package/README.md +23 -21
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -37,7 +37,7 @@ import { klsx } from 'klsx'
37
37
  klsx('foo', 'bar', 'baz')
38
38
  // => "foo bar baz"
39
39
 
40
- klsx({foo: 'string', bar: true, bux: null }, 'baz')
40
+ klsx({ foo: 'string', bar: true, bux: null }, 'baz')
41
41
  // => "foo bar baz"
42
42
 
43
43
  klsx(['foo', ['bar', true && 'baz']])
@@ -49,27 +49,29 @@ or importing the short alias `kx`:
49
49
  ### React
50
50
 
51
51
  ```jsx
52
- import React, { useState } from 'react';
52
+ import React, { useState } from 'react'
53
53
  import { kx } from 'klsx'
54
54
 
55
55
  const MyComponent = () => {
56
- const [isActive, setIsActive] = useState(false);
56
+ const [isActive, setIsActive] = useState(false)
57
57
  return (
58
58
  <div>
59
- <div className={kx('base-class', isActive ? 'active' : 'inactive')}>
59
+ <div className={kx('base-class', isActive ? 'active' : 'inactive')}>
60
60
  {/* ... */}
61
- </div>
61
+ </div>
62
62
 
63
- <div className={kx('base-class', {'active': isActive, 'inactive': !isActive})}>
63
+ <div className={kx('base-class', { active: isActive, inactive: !isActive })}>
64
64
  {/* ... */}
65
- </div>
66
-
67
- <div className={kx('base-class', [isActive && 'active', !isActive && 'inactive'])}>
65
+ </div>
66
+
67
+ <div
68
+ className={kx('base-class', [isActive && 'active', !isActive && 'inactive'])}
69
+ >
68
70
  {/* ... */}
69
- </div>
71
+ </div>
70
72
  </div>
71
- );
72
- };
73
+ )
74
+ }
73
75
  ```
74
76
 
75
77
  ### Migrate from `clsx`
@@ -81,9 +83,9 @@ From:
81
83
  ```typescript
82
84
  // clsx
83
85
 
84
- import { clsx, type ClassValue } from "clsx"
85
- import { twMerge } from "tailwind-merge"
86
-
86
+ import { clsx, type ClassValue } from 'clsx'
87
+ import { twMerge } from 'tailwind-merge'
88
+
87
89
  export function cn(...inputs: ClassValue[]) {
88
90
  return twMerge(clsx(inputs))
89
91
  }
@@ -94,10 +96,10 @@ To:
94
96
  ```typescript
95
97
  // KLSX
96
98
 
97
- import { klsx, type KlassValue } from "klsx"
98
- import { twMerge } from "tailwind-merge"
99
-
100
- export function cn(...inputs: ClassValue[]) {
99
+ import { klsx, type KlassValue } from 'klsx'
100
+ import { twMerge } from 'tailwind-merge'
101
+
102
+ export function cn(...inputs: KlassValue[]) {
101
103
  return twMerge(klsx(inputs))
102
104
  }
103
105
  ```
@@ -135,8 +137,8 @@ bun add -D prettier prettier-plugin-tailwindcss
135
137
  ```javascript
136
138
  /** @type {import('prettier').Config & import('prettier-plugin-tailwindcss').PluginOptions} */
137
139
  export default {
138
- plugins: ["prettier-plugin-tailwindcss"],
139
- tailwindFunctions: ['klsx', 'kx']
140
+ plugins: ['prettier-plugin-tailwindcss'],
141
+ tailwindFunctions: ['klsx', 'kx'],
140
142
  }
141
143
  ```
142
144
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "klsx",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "description": "Same as clsx but \"maybe\" better",
6
6
  "author": {