tailwind-styled-v4 5.1.12 → 5.1.14

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/dist/index.d.mts CHANGED
@@ -253,19 +253,34 @@ declare function cv<C extends ComponentConfig>(config: C, componentId?: string):
253
253
 
254
254
  /**
255
255
  * tailwind-styled-v4 v2 — cx / cn
256
- * Pure Node.js — requires native Rust binding.
256
+ *
257
+ * Native Rust binding dipakai di Node.js/SSR untuk performa maksimal.
258
+ *
259
+ * Browser fallback (Bug 2 — "Native binding 'resolveClassNames' is required
260
+ * but not available." crash di browser):
261
+ *
262
+ * getNativeBinding() return `null` di browser (bukan throw). Ketika itu terjadi
263
+ * kita gunakan pure-TS fallback yang semantiknya identik dengan implementasi Rust:
264
+ * - cn(): filter falsy + join spasi (identik dengan resolve_class_names di Rust)
265
+ * - cx(): conflict-aware merge via twMergeRawJs (port dari tw_merge.rs)
266
+ * - cxn(): flatten nested array + filter falsy + join spasi
267
+ *
268
+ * Server path TIDAK DIUBAH: throw Error tetap dijalankan jika native null di
269
+ * Node.js (menandakan miskonfigurasi). Fallback hanya aktif saat isBrowser=true.
257
270
  */
258
271
  type ClassValue = string | undefined | null | false | 0;
259
272
  /**
260
273
  * cn — simple class name joiner (no conflict resolution).
261
- * Delegates ke Rust `resolve_class_names`.
274
+ * Node.js: delegates ke Rust `resolve_class_names`.
275
+ * Browser: pure-TS fallback — filter falsy + join spasi.
262
276
  *
263
277
  * @example cn("p-4", isActive && "opacity-100") → "p-4 opacity-100"
264
278
  */
265
279
  declare function cn(...inputs: (ClassValue | ClassValue[])[]): string;
266
280
  /**
267
281
  * cx — conflict-aware class merger.
268
- * Delegates ke Rust `tw_merge_many`.
282
+ * Node.js: delegates ke Rust `tw_merge_many`.
283
+ * Browser: pure-TS fallback via twMergeRawJs (port algoritma Rust).
269
284
  *
270
285
  * @example cx("p-4 p-8") → "p-8"
271
286
  * @example cx("bg-red-500", "bg-blue-500") → "bg-blue-500"
package/dist/index.d.ts CHANGED
@@ -253,19 +253,34 @@ declare function cv<C extends ComponentConfig>(config: C, componentId?: string):
253
253
 
254
254
  /**
255
255
  * tailwind-styled-v4 v2 — cx / cn
256
- * Pure Node.js — requires native Rust binding.
256
+ *
257
+ * Native Rust binding dipakai di Node.js/SSR untuk performa maksimal.
258
+ *
259
+ * Browser fallback (Bug 2 — "Native binding 'resolveClassNames' is required
260
+ * but not available." crash di browser):
261
+ *
262
+ * getNativeBinding() return `null` di browser (bukan throw). Ketika itu terjadi
263
+ * kita gunakan pure-TS fallback yang semantiknya identik dengan implementasi Rust:
264
+ * - cn(): filter falsy + join spasi (identik dengan resolve_class_names di Rust)
265
+ * - cx(): conflict-aware merge via twMergeRawJs (port dari tw_merge.rs)
266
+ * - cxn(): flatten nested array + filter falsy + join spasi
267
+ *
268
+ * Server path TIDAK DIUBAH: throw Error tetap dijalankan jika native null di
269
+ * Node.js (menandakan miskonfigurasi). Fallback hanya aktif saat isBrowser=true.
257
270
  */
258
271
  type ClassValue = string | undefined | null | false | 0;
259
272
  /**
260
273
  * cn — simple class name joiner (no conflict resolution).
261
- * Delegates ke Rust `resolve_class_names`.
274
+ * Node.js: delegates ke Rust `resolve_class_names`.
275
+ * Browser: pure-TS fallback — filter falsy + join spasi.
262
276
  *
263
277
  * @example cn("p-4", isActive && "opacity-100") → "p-4 opacity-100"
264
278
  */
265
279
  declare function cn(...inputs: (ClassValue | ClassValue[])[]): string;
266
280
  /**
267
281
  * cx — conflict-aware class merger.
268
- * Delegates ke Rust `tw_merge_many`.
282
+ * Node.js: delegates ke Rust `tw_merge_many`.
283
+ * Browser: pure-TS fallback via twMergeRawJs (port algoritma Rust).
269
284
  *
270
285
  * @example cx("p-4 p-8") → "p-8"
271
286
  * @example cx("bg-red-500", "bg-blue-500") → "bg-blue-500"