1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
* Author: Oyelowo Oyedayo
* Email: oyelowo.oss@gmail.com
* Copyright (c) 2025 Oyelowo Oyedayo
* Licensed under the MIT license
*/
pub use tw as twust;
// // use twust_macro::xtw;
//
// #[macro_export]
// macro_rules! tw {
// // Case: Single string
// ($single:literal) => {
// $single
// };
// ($($class:literal),*) => {
// concat!($($class, " "),*)
// };
//
// ([$($class:expr),*]) => {
// concat!($($class, " "),*)
// };
// }
//
// fn main() {
// let _classnames_single = tw!("scroll-m-14 flex supports-grid:grid supports-[display:grid]:grid");
// let _classnames_array = tw!["scroll-m-14", "flex", "supports-grid:grid", "supports-[display:grid]:grid"];
// let _classnames_array2 = tw!(["scroll-m-14", "flex", "supports-grid:grid", "supports-[display:grid]:grid"]);
// // let _classnames_array2 = twx!(["scroll-m-14", "flex", "supports-grid:grid", "supports-[display:grid]:grid"]);
// // let _classnames_array2 = twx!(["scroll-m-14", "flex", "supports-grid:grid", "supports-[display:grid]:grid"]);
// }
//
/// Typechecks tailwindcss classnames at compile time.
///
/// ## Features:
/// - Supports **single string** literals (`tw!("class1 class2")`)
/// - Supports **multiple string arguments** (`tw!["class1", "class2"]`)
/// - Supports **arrays of strings** (`tw!(["class1", "class2"])`)
///
///
/// ## Example Usage
///
/// ```rust, ignore
/// use twust::tw;
///
/// let single_class = tw!("scroll-m-14 flex supports-grid:grid supports-[display:grid]:grid");
/// let multiple_classes = tw!["scroll-m-14", "flex", "supports-grid:grid", "supports-[display:grid]:grid"];
/// let array_classes = tw!(["scroll-m-14", "flex", "supports-grid:grid", "supports-[display:grid]:grid"]);
///
/// assert_eq!(single_class, "scroll-m-14 flex supports-grid:grid supports-[display:grid]:grid");
/// assert_eq!(multiple_classes, "scroll-m-14 flex supports-grid:grid supports-[display:grid]:grid");
/// assert_eq!(array_classes, "scroll-m-14 flex supports-grid:grid supports-[display:grid]:grid");
/// ```
///
/// ## Notes
/// - The macro supports **both** `tw!(...)` and `tw![...]` syntax.
/// - It ensures at compile time that only string literals are used for class names.