@csszyx/runtime 0.9.10 → 0.10.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.
- package/README.md +14 -22
- package/dist/index.cjs +969 -52
- package/dist/index.d.cts +253 -75
- package/dist/index.d.mts +253 -75
- package/dist/index.mjs +957 -52
- package/dist/lite.cjs +0 -4
- package/dist/lite.d.cts +1 -15
- package/dist/lite.d.mts +1 -15
- package/dist/lite.mjs +1 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -35,26 +35,26 @@ const className = _sz("a", null, "b", undefined, false, "c");
|
|
|
35
35
|
// Returns: "a b c"
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
### Conditional
|
|
38
|
+
### Conditional Classes
|
|
39
|
+
|
|
40
|
+
Plain JS conditionals compose with `_sz` — no dedicated helper needed:
|
|
39
41
|
|
|
40
42
|
```typescript
|
|
41
|
-
import {
|
|
43
|
+
import { _sz } from "@csszyx/runtime";
|
|
42
44
|
|
|
43
45
|
// Simple conditional
|
|
44
|
-
|
|
46
|
+
_sz("base", isActive && "active");
|
|
45
47
|
|
|
46
48
|
// With fallback
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
// Switch-like
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
]
|
|
56
|
-
"text-gray-500",
|
|
57
|
-
);
|
|
49
|
+
_sz("base", isActive ? "active" : "inactive");
|
|
50
|
+
|
|
51
|
+
// Switch-like — a plain object lookup
|
|
52
|
+
const className =
|
|
53
|
+
{
|
|
54
|
+
success: "text-green-500",
|
|
55
|
+
error: "text-red-500",
|
|
56
|
+
warning: "text-yellow-500",
|
|
57
|
+
}[status] ?? "text-gray-500";
|
|
58
58
|
```
|
|
59
59
|
|
|
60
60
|
### Merging Classes
|
|
@@ -141,14 +141,6 @@ Optimized two-argument version.
|
|
|
141
141
|
|
|
142
142
|
Optimized three-argument version.
|
|
143
143
|
|
|
144
|
-
#### `_szIf(condition, className, fallback?): string | false`
|
|
145
|
-
|
|
146
|
-
Conditional className application.
|
|
147
|
-
|
|
148
|
-
#### `_szSwitch(conditions, default?): string`
|
|
149
|
-
|
|
150
|
-
Switch-like className selection.
|
|
151
|
-
|
|
152
144
|
#### `_szMerge(...classes): string`
|
|
153
145
|
|
|
154
146
|
Merge className strings with duplicate removal.
|