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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
|
package tuigen
import (
"regexp"
)
type TailwindMapping struct {
Option string
NeedsImport string
IsTextStyle bool
TextMethod string
}
var tailwindClasses = map[string]TailwindMapping{
"block": {Option: "tui.WithDisplay(tui.DisplayBlock)", NeedsImport: "tui"},
"flex": {Option: "tui.WithDisplay(tui.DisplayFlex), tui.WithDirection(tui.Row)", NeedsImport: "tui"},
"flex-row": {Option: "tui.WithDisplay(tui.DisplayFlex), tui.WithDirection(tui.Row)", NeedsImport: "tui"},
"flex-col": {Option: "tui.WithDisplay(tui.DisplayFlex), tui.WithDirection(tui.Column)", NeedsImport: "tui"},
"flex-wrap": {Option: "tui.WithFlexWrap(tui.Wrap)", NeedsImport: "tui"},
"flex-wrap-reverse": {Option: "tui.WithFlexWrap(tui.WrapReverse)", NeedsImport: "tui"},
"flex-nowrap": {Option: "tui.WithFlexWrap(tui.WrapNone)", NeedsImport: "tui"},
"content-start": {Option: "tui.WithAlignContent(tui.ContentStart)", NeedsImport: "tui"},
"content-end": {Option: "tui.WithAlignContent(tui.ContentEnd)", NeedsImport: "tui"},
"content-center": {Option: "tui.WithAlignContent(tui.ContentCenter)", NeedsImport: "tui"},
"content-stretch": {Option: "tui.WithAlignContent(tui.ContentStretch)", NeedsImport: "tui"},
"content-between": {Option: "tui.WithAlignContent(tui.ContentSpaceBetween)", NeedsImport: "tui"},
"content-around": {Option: "tui.WithAlignContent(tui.ContentSpaceAround)", NeedsImport: "tui"},
"grow": {Option: "tui.WithFlexGrow(1)", NeedsImport: ""},
"grow-0": {Option: "tui.WithFlexGrow(0)", NeedsImport: ""},
"shrink": {Option: "tui.WithFlexShrink(1)", NeedsImport: ""},
"shrink-0": {Option: "tui.WithFlexShrink(0)", NeedsImport: ""},
"flex-1": {Option: "tui.WithFlexGrow(1), tui.WithFlexShrink(1)", NeedsImport: ""},
"flex-auto": {Option: "tui.WithFlexGrow(1), tui.WithFlexShrink(1)", NeedsImport: ""},
"flex-initial": {Option: "tui.WithFlexGrow(0), tui.WithFlexShrink(1)", NeedsImport: ""},
"flex-none": {Option: "tui.WithFlexGrow(0), tui.WithFlexShrink(0)", NeedsImport: ""},
"flex-grow": {Option: "tui.WithFlexGrow(1)", NeedsImport: ""},
"flex-shrink": {Option: "tui.WithFlexShrink(1)", NeedsImport: ""},
"justify-start": {Option: "tui.WithJustify(tui.JustifyStart)", NeedsImport: "tui"},
"justify-center": {Option: "tui.WithJustify(tui.JustifyCenter)", NeedsImport: "tui"},
"justify-end": {Option: "tui.WithJustify(tui.JustifyEnd)", NeedsImport: "tui"},
"justify-between": {Option: "tui.WithJustify(tui.JustifySpaceBetween)", NeedsImport: "tui"},
"justify-evenly": {Option: "tui.WithJustify(tui.JustifySpaceEvenly)", NeedsImport: "tui"},
"justify-around": {Option: "tui.WithJustify(tui.JustifySpaceAround)", NeedsImport: "tui"},
"items-start": {Option: "tui.WithAlign(tui.AlignStart)", NeedsImport: "tui"},
"items-center": {Option: "tui.WithAlign(tui.AlignCenter)", NeedsImport: "tui"},
"items-end": {Option: "tui.WithAlign(tui.AlignEnd)", NeedsImport: "tui"},
"items-stretch": {Option: "tui.WithAlign(tui.AlignStretch)", NeedsImport: "tui"},
"self-start": {Option: "tui.WithAlignSelf(tui.AlignStart)", NeedsImport: "tui"},
"self-end": {Option: "tui.WithAlignSelf(tui.AlignEnd)", NeedsImport: "tui"},
"self-center": {Option: "tui.WithAlignSelf(tui.AlignCenter)", NeedsImport: "tui"},
"self-stretch": {Option: "tui.WithAlignSelf(tui.AlignStretch)", NeedsImport: "tui"},
"text-left": {Option: "tui.WithTextAlign(tui.TextAlignLeft)", NeedsImport: ""},
"text-center": {Option: "tui.WithTextAlign(tui.TextAlignCenter)", NeedsImport: ""},
"text-right": {Option: "tui.WithTextAlign(tui.TextAlignRight)", NeedsImport: ""},
"border": {Option: "tui.WithBorder(tui.BorderSingle)", NeedsImport: "tui"},
"border-single": {Option: "tui.WithBorder(tui.BorderSingle)", NeedsImport: "tui"},
"border-rounded": {Option: "tui.WithBorder(tui.BorderRounded)", NeedsImport: "tui"},
"border-double": {Option: "tui.WithBorder(tui.BorderDouble)", NeedsImport: "tui"},
"border-thick": {Option: "tui.WithBorder(tui.BorderThick)", NeedsImport: "tui"},
"border-red": {Option: "tui.WithBorderStyle(tui.NewStyle().Foreground(tui.Red))", NeedsImport: "tui"},
"border-green": {Option: "tui.WithBorderStyle(tui.NewStyle().Foreground(tui.Green))", NeedsImport: "tui"},
"border-blue": {Option: "tui.WithBorderStyle(tui.NewStyle().Foreground(tui.Blue))", NeedsImport: "tui"},
"border-cyan": {Option: "tui.WithBorderStyle(tui.NewStyle().Foreground(tui.Cyan))", NeedsImport: "tui"},
"border-magenta": {Option: "tui.WithBorderStyle(tui.NewStyle().Foreground(tui.Magenta))", NeedsImport: "tui"},
"border-yellow": {Option: "tui.WithBorderStyle(tui.NewStyle().Foreground(tui.Yellow))", NeedsImport: "tui"},
"border-white": {Option: "tui.WithBorderStyle(tui.NewStyle().Foreground(tui.White))", NeedsImport: "tui"},
"border-black": {Option: "tui.WithBorderStyle(tui.NewStyle().Foreground(tui.Black))", NeedsImport: "tui"},
"font-bold": {IsTextStyle: true, TextMethod: "Bold()"},
"font-dim": {IsTextStyle: true, TextMethod: "Dim()"},
"text-dim": {IsTextStyle: true, TextMethod: "Dim()"},
"italic": {IsTextStyle: true, TextMethod: "Italic()"},
"underline": {IsTextStyle: true, TextMethod: "Underline()"},
"blink": {IsTextStyle: true, TextMethod: "Blink()"},
"reverse": {IsTextStyle: true, TextMethod: "Reverse()"},
"strikethrough": {IsTextStyle: true, TextMethod: "Strikethrough()"},
"text-red": {IsTextStyle: true, TextMethod: "Foreground(tui.Red)", NeedsImport: "tui"},
"text-green": {IsTextStyle: true, TextMethod: "Foreground(tui.Green)", NeedsImport: "tui"},
"text-blue": {IsTextStyle: true, TextMethod: "Foreground(tui.Blue)", NeedsImport: "tui"},
"text-cyan": {IsTextStyle: true, TextMethod: "Foreground(tui.Cyan)", NeedsImport: "tui"},
"text-magenta": {IsTextStyle: true, TextMethod: "Foreground(tui.Magenta)", NeedsImport: "tui"},
"text-yellow": {IsTextStyle: true, TextMethod: "Foreground(tui.Yellow)", NeedsImport: "tui"},
"text-white": {IsTextStyle: true, TextMethod: "Foreground(tui.White)", NeedsImport: "tui"},
"text-black": {IsTextStyle: true, TextMethod: "Foreground(tui.Black)", NeedsImport: "tui"},
"text-bright-red": {IsTextStyle: true, TextMethod: "Foreground(tui.BrightRed)", NeedsImport: "tui"},
"text-bright-green": {IsTextStyle: true, TextMethod: "Foreground(tui.BrightGreen)", NeedsImport: "tui"},
"text-bright-blue": {IsTextStyle: true, TextMethod: "Foreground(tui.BrightBlue)", NeedsImport: "tui"},
"text-bright-cyan": {IsTextStyle: true, TextMethod: "Foreground(tui.BrightCyan)", NeedsImport: "tui"},
"text-bright-magenta": {IsTextStyle: true, TextMethod: "Foreground(tui.BrightMagenta)", NeedsImport: "tui"},
"text-bright-yellow": {IsTextStyle: true, TextMethod: "Foreground(tui.BrightYellow)", NeedsImport: "tui"},
"text-bright-white": {IsTextStyle: true, TextMethod: "Foreground(tui.BrightWhite)", NeedsImport: "tui"},
"text-bright-black": {IsTextStyle: true, TextMethod: "Foreground(tui.BrightBlack)", NeedsImport: "tui"},
"bg-red": {Option: "tui.WithBackground(tui.NewStyle().Background(tui.Red))", NeedsImport: "tui"},
"bg-green": {Option: "tui.WithBackground(tui.NewStyle().Background(tui.Green))", NeedsImport: "tui"},
"bg-blue": {Option: "tui.WithBackground(tui.NewStyle().Background(tui.Blue))", NeedsImport: "tui"},
"bg-cyan": {Option: "tui.WithBackground(tui.NewStyle().Background(tui.Cyan))", NeedsImport: "tui"},
"bg-magenta": {Option: "tui.WithBackground(tui.NewStyle().Background(tui.Magenta))", NeedsImport: "tui"},
"bg-yellow": {Option: "tui.WithBackground(tui.NewStyle().Background(tui.Yellow))", NeedsImport: "tui"},
"bg-white": {Option: "tui.WithBackground(tui.NewStyle().Background(tui.White))", NeedsImport: "tui"},
"bg-black": {Option: "tui.WithBackground(tui.NewStyle().Background(tui.Black))", NeedsImport: "tui"},
"bg-bright-red": {Option: "tui.WithBackground(tui.NewStyle().Background(tui.BrightRed))", NeedsImport: "tui"},
"bg-bright-green": {Option: "tui.WithBackground(tui.NewStyle().Background(tui.BrightGreen))", NeedsImport: "tui"},
"bg-bright-blue": {Option: "tui.WithBackground(tui.NewStyle().Background(tui.BrightBlue))", NeedsImport: "tui"},
"bg-bright-cyan": {Option: "tui.WithBackground(tui.NewStyle().Background(tui.BrightCyan))", NeedsImport: "tui"},
"bg-bright-magenta": {Option: "tui.WithBackground(tui.NewStyle().Background(tui.BrightMagenta))", NeedsImport: "tui"},
"bg-bright-yellow": {Option: "tui.WithBackground(tui.NewStyle().Background(tui.BrightYellow))", NeedsImport: "tui"},
"bg-bright-white": {Option: "tui.WithBackground(tui.NewStyle().Background(tui.BrightWhite))", NeedsImport: "tui"},
"bg-bright-black": {Option: "tui.WithBackground(tui.NewStyle().Background(tui.BrightBlack))", NeedsImport: "tui"},
"overflow-scroll": {Option: "tui.WithScrollable(tui.ScrollBoth)", NeedsImport: ""},
"overflow-y-scroll": {Option: "tui.WithScrollable(tui.ScrollVertical)", NeedsImport: ""},
"overflow-x-scroll": {Option: "tui.WithScrollable(tui.ScrollHorizontal)", NeedsImport: ""},
"focusable": {Option: "tui.WithFocusable(true)", NeedsImport: ""},
"hidden": {Option: "tui.WithHidden(true)", NeedsImport: ""},
"overflow-hidden": {Option: "tui.WithOverflow(tui.OverflowHidden)", NeedsImport: "tui"},
"truncate": {Option: "tui.WithTruncate(true)", NeedsImport: ""},
"nowrap": {Option: "tui.WithWrap(false)", NeedsImport: ""},
"wrap": {Option: "tui.WithWrap(true)", NeedsImport: ""},
"scrollbar-hidden": {Option: "tui.WithScrollbarHidden(true)", NeedsImport: "tui"},
"scrollbar-red": {Option: "tui.WithScrollbarStyle(tui.NewStyle().Foreground(tui.Red))", NeedsImport: "tui"},
"scrollbar-green": {Option: "tui.WithScrollbarStyle(tui.NewStyle().Foreground(tui.Green))", NeedsImport: "tui"},
"scrollbar-blue": {Option: "tui.WithScrollbarStyle(tui.NewStyle().Foreground(tui.Blue))", NeedsImport: "tui"},
"scrollbar-cyan": {Option: "tui.WithScrollbarStyle(tui.NewStyle().Foreground(tui.Cyan))", NeedsImport: "tui"},
"scrollbar-magenta": {Option: "tui.WithScrollbarStyle(tui.NewStyle().Foreground(tui.Magenta))", NeedsImport: "tui"},
"scrollbar-yellow": {Option: "tui.WithScrollbarStyle(tui.NewStyle().Foreground(tui.Yellow))", NeedsImport: "tui"},
"scrollbar-white": {Option: "tui.WithScrollbarStyle(tui.NewStyle().Foreground(tui.White))", NeedsImport: "tui"},
"scrollbar-black": {Option: "tui.WithScrollbarStyle(tui.NewStyle().Foreground(tui.Black))", NeedsImport: "tui"},
"scrollbar-bright-red": {Option: "tui.WithScrollbarStyle(tui.NewStyle().Foreground(tui.BrightRed))", NeedsImport: "tui"},
"scrollbar-bright-green": {Option: "tui.WithScrollbarStyle(tui.NewStyle().Foreground(tui.BrightGreen))", NeedsImport: "tui"},
"scrollbar-bright-blue": {Option: "tui.WithScrollbarStyle(tui.NewStyle().Foreground(tui.BrightBlue))", NeedsImport: "tui"},
"scrollbar-bright-cyan": {Option: "tui.WithScrollbarStyle(tui.NewStyle().Foreground(tui.BrightCyan))", NeedsImport: "tui"},
"scrollbar-bright-magenta": {Option: "tui.WithScrollbarStyle(tui.NewStyle().Foreground(tui.BrightMagenta))", NeedsImport: "tui"},
"scrollbar-bright-yellow": {Option: "tui.WithScrollbarStyle(tui.NewStyle().Foreground(tui.BrightYellow))", NeedsImport: "tui"},
"scrollbar-bright-white": {Option: "tui.WithScrollbarStyle(tui.NewStyle().Foreground(tui.BrightWhite))", NeedsImport: "tui"},
"scrollbar-bright-black": {Option: "tui.WithScrollbarStyle(tui.NewStyle().Foreground(tui.BrightBlack))", NeedsImport: "tui"},
"scrollbar-thumb-red": {Option: "tui.WithScrollbarThumbStyle(tui.NewStyle().Foreground(tui.Red))", NeedsImport: "tui"},
"scrollbar-thumb-green": {Option: "tui.WithScrollbarThumbStyle(tui.NewStyle().Foreground(tui.Green))", NeedsImport: "tui"},
"scrollbar-thumb-blue": {Option: "tui.WithScrollbarThumbStyle(tui.NewStyle().Foreground(tui.Blue))", NeedsImport: "tui"},
"scrollbar-thumb-cyan": {Option: "tui.WithScrollbarThumbStyle(tui.NewStyle().Foreground(tui.Cyan))", NeedsImport: "tui"},
"scrollbar-thumb-magenta": {Option: "tui.WithScrollbarThumbStyle(tui.NewStyle().Foreground(tui.Magenta))", NeedsImport: "tui"},
"scrollbar-thumb-yellow": {Option: "tui.WithScrollbarThumbStyle(tui.NewStyle().Foreground(tui.Yellow))", NeedsImport: "tui"},
"scrollbar-thumb-white": {Option: "tui.WithScrollbarThumbStyle(tui.NewStyle().Foreground(tui.White))", NeedsImport: "tui"},
"scrollbar-thumb-black": {Option: "tui.WithScrollbarThumbStyle(tui.NewStyle().Foreground(tui.Black))", NeedsImport: "tui"},
"scrollbar-thumb-bright-red": {Option: "tui.WithScrollbarThumbStyle(tui.NewStyle().Foreground(tui.BrightRed))", NeedsImport: "tui"},
"scrollbar-thumb-bright-green": {Option: "tui.WithScrollbarThumbStyle(tui.NewStyle().Foreground(tui.BrightGreen))", NeedsImport: "tui"},
"scrollbar-thumb-bright-blue": {Option: "tui.WithScrollbarThumbStyle(tui.NewStyle().Foreground(tui.BrightBlue))", NeedsImport: "tui"},
"scrollbar-thumb-bright-cyan": {Option: "tui.WithScrollbarThumbStyle(tui.NewStyle().Foreground(tui.BrightCyan))", NeedsImport: "tui"},
"scrollbar-thumb-bright-magenta": {Option: "tui.WithScrollbarThumbStyle(tui.NewStyle().Foreground(tui.BrightMagenta))", NeedsImport: "tui"},
"scrollbar-thumb-bright-yellow": {Option: "tui.WithScrollbarThumbStyle(tui.NewStyle().Foreground(tui.BrightYellow))", NeedsImport: "tui"},
"scrollbar-thumb-bright-white": {Option: "tui.WithScrollbarThumbStyle(tui.NewStyle().Foreground(tui.BrightWhite))", NeedsImport: "tui"},
"scrollbar-thumb-bright-black": {Option: "tui.WithScrollbarThumbStyle(tui.NewStyle().Foreground(tui.BrightBlack))", NeedsImport: "tui"},
}
var (
gapPattern = regexp.MustCompile(`^gap-(\d+)$`)
paddingPattern = regexp.MustCompile(`^p-(\d+)$`)
paddingXPattern = regexp.MustCompile(`^px-(\d+)$`)
paddingYPattern = regexp.MustCompile(`^py-(\d+)$`)
marginPattern = regexp.MustCompile(`^m-(\d+)$`)
widthPattern = regexp.MustCompile(`^w-(\d+)$`)
heightPattern = regexp.MustCompile(`^h-(\d+)$`)
minWidthPattern = regexp.MustCompile(`^min-w-(\d+)$`)
maxWidthPattern = regexp.MustCompile(`^max-w-(\d+)$`)
minHeightPattern = regexp.MustCompile(`^min-h-(\d+)$`)
maxHeightPattern = regexp.MustCompile(`^max-h-(\d+)$`)
widthFractionPattern = regexp.MustCompile(`^w-(\d+)/(\d+)$`)
heightFractionPattern = regexp.MustCompile(`^h-(\d+)/(\d+)$`)
widthKeywordPattern = regexp.MustCompile(`^w-(full|auto)$`)
heightKeywordPattern = regexp.MustCompile(`^h-(full|auto)$`)
ptPattern = regexp.MustCompile(`^pt-(\d+)$`)
prPattern = regexp.MustCompile(`^pr-(\d+)$`)
pbPattern = regexp.MustCompile(`^pb-(\d+)$`)
plPattern = regexp.MustCompile(`^pl-(\d+)$`)
mtPattern = regexp.MustCompile(`^mt-(\d+)$`)
mrPattern = regexp.MustCompile(`^mr-(\d+)$`)
mbPattern = regexp.MustCompile(`^mb-(\d+)$`)
mlPattern = regexp.MustCompile(`^ml-(\d+)$`)
mxPattern = regexp.MustCompile(`^mx-(\d+)$`)
myPattern = regexp.MustCompile(`^my-(\d+)$`)
flexGrowPattern = regexp.MustCompile(`^flex-grow-(\d+)$`)
flexShrinkPattern = regexp.MustCompile(`^flex-shrink-(\d+)$`)
textGradientPattern = regexp.MustCompile(`^text-gradient-([\w-]+)-([\w-]+?)(?:-(h|v|dd|du))$|^text-gradient-([\w-]+)-([\w-]+)$`)
bgGradientPattern = regexp.MustCompile(`^bg-gradient-([\w-]+)-([\w-]+?)(?:-(h|v|dd|du))$|^bg-gradient-([\w-]+)-([\w-]+)$`)
borderGradientPattern = regexp.MustCompile(`^border-gradient-([\w-]+)-([\w-]+?)(?:-(h|v|dd|du))$|^border-gradient-([\w-]+)-([\w-]+)$`)
textHexPattern = regexp.MustCompile(`^text-\[#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})\]$`)
bgHexPattern = regexp.MustCompile(`^bg-\[#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})\]$`)
borderHexPattern = regexp.MustCompile(`^border-\[#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})\]$`)
scrollbarHexPattern = regexp.MustCompile(`^scrollbar-\[#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})\]$`)
scrollbarThumbHexPattern = regexp.MustCompile(`^scrollbar-thumb-\[#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})\]$`)
)
|