tailwind-styled-v4 5.1.27 → 5.1.29

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/CHANGELOG.md CHANGED
@@ -11,6 +11,40 @@ dan project ini mengikuti [Semantic Versioning](https://semver.org/spec/v2.0.0.h
11
11
 
12
12
  All Wave 1-3 features are published to npm and integrated in production (next-js-app example).
13
13
 
14
+ #### Wave 5.4: Boolean/Number/String Variant Type Safety (v5.0.18+ ✅ JULY 4, 2026)
15
+
16
+ - **Fixed: Variant Type Enforcement in `defaultVariants` and Props** ✅
17
+ - **Problem:** TypeScript now correctly enforces type matching between variant keys and `defaultVariants` values
18
+ - **Impact:** 20 `styles.ts` files + 3+ `page.tsx` files in example app had string `"false"` in boolean variant defaults, or passed string `"true"`/`"false"` to boolean props
19
+ - **What changed:** Example code updated to match correct types:
20
+ ```typescript
21
+ // Before (now errors)
22
+ defaultVariants: { active: "false" } // ❌ String
23
+ <Chip active={isOpen ? "true" : "false"} /> // ❌ Strings
24
+
25
+ // After (correct)
26
+ defaultVariants: { active: false } // ✅ Boolean
27
+ <Chip active={isOpen} /> // ✅ Boolean
28
+ ```
29
+ - **Type Safety Matrix:**
30
+ ```
31
+ Variant Keys | Type | defaultVariants | Usage
32
+ { true: "...", false: "" }| bool | active: false | <C active={bool} />
33
+ { 0: "...", 1: "..." } | num | level: 1 | <C level={num} />
34
+ { "x": "...", "y": "" } | str | mode: "x" | <C mode="string" />
35
+ ```
36
+ - **Steering Guide:** New `.kiro/steering/boolean-variants.md` documents:
37
+ - Type matching rules (boolean, number, string)
38
+ - Common mistakes and fixes
39
+ - Migration patterns
40
+ - Pre-shipping checklist
41
+ - **Affected files fixed:**
42
+ - 20 styles.ts: Changed `"false"` → `false` in defaultVariants
43
+ - 3+ page.tsx: Changed string ternaries to boolean expressions
44
+ - Specific files: All `learn/*/styles.ts` + css-functions-future, container-style-queries, popover-api
45
+ - **Validation:** `examples/next-js-app tsc --noEmit` → 0 errors ✅
46
+ - **Reference:** `known-issues.md` (2026-07-04 boolean variants entry), `.kiro/steering/boolean-variants.md` ⭐ (NEW)
47
+
14
48
  #### Wave 5.3: TypeScript Props Type Inference Fix (v5.0.18+ ✅ JULY 4, 2026)
15
49
 
16
50
  - **Fixed: `RuntimeProps` Type Now Supports All HTML Attributes (ARIA, data-*, event handlers, etc.)** ✅
@@ -976,12 +976,6 @@ function attachExtend(component, originalTag, base, config) {
976
976
  }
977
977
  });
978
978
  };
979
- component.animate = async (_opts) => {
980
- console.warn(
981
- '[tailwind-styled-v4] .animate() tidak tersedia di main bundle.\nGunakan: import { animate } from "tailwind-styled-v4/animate"'
982
- );
983
- return component;
984
- };
985
979
  component.withSub = (() => component);
986
980
  return component;
987
981
  }
@@ -1127,11 +1121,12 @@ function parseTemplate(strings, exprs) {
1127
1121
  return result;
1128
1122
  }
1129
1123
  function makeTag(tag) {
1130
- return ((stringsOrConfig, ...exprs) => {
1124
+ const impl = ((stringsOrConfig, ...exprs) => {
1131
1125
  if (!Array.isArray(stringsOrConfig) && typeof stringsOrConfig === "object" && stringsOrConfig !== null && !("raw" in stringsOrConfig)) {
1132
1126
  return createComponent(tag, stringsOrConfig);
1133
1127
  }
1134
- const parsed = parseTemplate(stringsOrConfig, exprs);
1128
+ const strings = stringsOrConfig;
1129
+ const parsed = parseTemplate(strings, exprs);
1135
1130
  const component = createComponent(tag, parsed.base);
1136
1131
  if (parsed.hasSubs) {
1137
1132
  for (const [name, classes] of Object.entries(parsed.subs)) {
@@ -1148,6 +1143,7 @@ function makeTag(tag) {
1148
1143
  }
1149
1144
  return component;
1150
1145
  });
1146
+ return impl;
1151
1147
  }
1152
1148
  var HTML_TAGS = [
1153
1149
  "html",