tailwind.py 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001
  1. from __future__ import annotations
  2. from typing import TYPE_CHECKING, List, Optional, Union, overload
  3. if TYPE_CHECKING:
  4. from .element import Element
  5. from .tailwind_types.accent_color import AccentColor
  6. from .tailwind_types.align_content import AlignContent
  7. from .tailwind_types.align_items import AlignItems
  8. from .tailwind_types.align_self import AlignSelf
  9. from .tailwind_types.animation import Animation
  10. from .tailwind_types.appearance import Appearance
  11. from .tailwind_types.aspect_ratio import AspectRatio
  12. from .tailwind_types.backdrop_blur import BackdropBlur
  13. from .tailwind_types.backdrop_brightness import BackdropBrightness
  14. from .tailwind_types.backdrop_contrast import BackdropContrast
  15. from .tailwind_types.backdrop_grayscale import BackdropGrayscale
  16. from .tailwind_types.backdrop_hue_rotate import BackdropHueRotate
  17. from .tailwind_types.backdrop_invert import BackdropInvert
  18. from .tailwind_types.backdrop_opacity import BackdropOpacity
  19. from .tailwind_types.backdrop_saturate import BackdropSaturate
  20. from .tailwind_types.backdrop_sepia import BackdropSepia
  21. from .tailwind_types.background_attachment import BackgroundAttachment
  22. from .tailwind_types.background_blend_mode import BackgroundBlendMode
  23. from .tailwind_types.background_clip import BackgroundClip
  24. from .tailwind_types.background_color import BackgroundColor
  25. from .tailwind_types.background_image import BackgroundImage
  26. from .tailwind_types.background_origin import BackgroundOrigin
  27. from .tailwind_types.background_position import BackgroundPosition
  28. from .tailwind_types.background_repeat import BackgroundRepeat
  29. from .tailwind_types.background_size import BackgroundSize
  30. from .tailwind_types.blur import Blur
  31. from .tailwind_types.border_collapse import BorderCollapse
  32. from .tailwind_types.border_color import BorderColor
  33. from .tailwind_types.border_radius import BorderRadius
  34. from .tailwind_types.border_spacing import BorderSpacing
  35. from .tailwind_types.border_style import BorderStyle
  36. from .tailwind_types.border_width import BorderWidth
  37. from .tailwind_types.box_decoration_break import BoxDecorationBreak
  38. from .tailwind_types.box_shadow import BoxShadow
  39. from .tailwind_types.box_shadow_color import BoxShadowColor
  40. from .tailwind_types.box_sizing import BoxSizing
  41. from .tailwind_types.break_after import BreakAfter
  42. from .tailwind_types.break_before import BreakBefore
  43. from .tailwind_types.break_inside import BreakInside
  44. from .tailwind_types.brightness import Brightness
  45. from .tailwind_types.caption_side import CaptionSide
  46. from .tailwind_types.caret_color import CaretColor
  47. from .tailwind_types.clear import Clear
  48. from .tailwind_types.columns import Columns
  49. from .tailwind_types.content import Content
  50. from .tailwind_types.contrast import Contrast
  51. from .tailwind_types.cursor import Cursor
  52. from .tailwind_types.display import Display
  53. from .tailwind_types.divide_color import DivideColor
  54. from .tailwind_types.divide_style import DivideStyle
  55. from .tailwind_types.divide_width import DivideWidth
  56. from .tailwind_types.drop_shadow import DropShadow
  57. from .tailwind_types.fill import Fill
  58. from .tailwind_types.flex import Flex
  59. from .tailwind_types.flex_basis import FlexBasis
  60. from .tailwind_types.flex_direction import FlexDirection
  61. from .tailwind_types.flex_grow import FlexGrow
  62. from .tailwind_types.flex_shrink import FlexShrink
  63. from .tailwind_types.flex_wrap import FlexWrap
  64. from .tailwind_types.floats import Floats
  65. from .tailwind_types.font_family import FontFamily
  66. from .tailwind_types.font_size import FontSize
  67. from .tailwind_types.font_smoothing import FontSmoothing
  68. from .tailwind_types.font_style import FontStyle
  69. from .tailwind_types.font_variant_numeric import FontVariantNumeric
  70. from .tailwind_types.font_weight import FontWeight
  71. from .tailwind_types.gap import Gap
  72. from .tailwind_types.gradient_color_stops import GradientColorStops
  73. from .tailwind_types.grayscale import Grayscale
  74. from .tailwind_types.grid_auto_columns import GridAutoColumns
  75. from .tailwind_types.grid_auto_flow import GridAutoFlow
  76. from .tailwind_types.grid_auto_rows import GridAutoRows
  77. from .tailwind_types.grid_column_start_end import GridColumnStartEnd
  78. from .tailwind_types.grid_row_start_end import GridRowStartEnd
  79. from .tailwind_types.grid_template_columns import GridTemplateColumns
  80. from .tailwind_types.grid_template_rows import GridTemplateRows
  81. from .tailwind_types.height import Height
  82. from .tailwind_types.hue_rotate import HueRotate
  83. from .tailwind_types.hyphens import Hyphens
  84. from .tailwind_types.invert import Invert
  85. from .tailwind_types.isolation import Isolation
  86. from .tailwind_types.justify_content import JustifyContent
  87. from .tailwind_types.justify_items import JustifyItems
  88. from .tailwind_types.justify_self import JustifySelf
  89. from .tailwind_types.letter_spacing import LetterSpacing
  90. from .tailwind_types.line_clamp import LineClamp
  91. from .tailwind_types.line_height import LineHeight
  92. from .tailwind_types.list_style_image import ListStyleImage
  93. from .tailwind_types.list_style_position import ListStylePosition
  94. from .tailwind_types.list_style_type import ListStyleType
  95. from .tailwind_types.margin import Margin
  96. from .tailwind_types.max_height import MaxHeight
  97. from .tailwind_types.max_width import MaxWidth
  98. from .tailwind_types.min_height import MinHeight
  99. from .tailwind_types.min_width import MinWidth
  100. from .tailwind_types.mix_blend_mode import MixBlendMode
  101. from .tailwind_types.object_fit import ObjectFit
  102. from .tailwind_types.object_position import ObjectPosition
  103. from .tailwind_types.opacity import Opacity
  104. from .tailwind_types.order import Order
  105. from .tailwind_types.outline_color import OutlineColor
  106. from .tailwind_types.outline_offset import OutlineOffset
  107. from .tailwind_types.outline_style import OutlineStyle
  108. from .tailwind_types.outline_width import OutlineWidth
  109. from .tailwind_types.overflow import Overflow
  110. from .tailwind_types.overscroll_behavior import OverscrollBehavior
  111. from .tailwind_types.padding import Padding
  112. from .tailwind_types.place_content import PlaceContent
  113. from .tailwind_types.place_items import PlaceItems
  114. from .tailwind_types.place_self import PlaceSelf
  115. from .tailwind_types.pointer_events import PointerEvents
  116. from .tailwind_types.position import Position
  117. from .tailwind_types.resize import Resize
  118. from .tailwind_types.ring_color import RingColor
  119. from .tailwind_types.ring_offset_color import RingOffsetColor
  120. from .tailwind_types.ring_offset_width import RingOffsetWidth
  121. from .tailwind_types.ring_width import RingWidth
  122. from .tailwind_types.rotate import Rotate
  123. from .tailwind_types.saturate import Saturate
  124. from .tailwind_types.scale import Scale
  125. from .tailwind_types.screen_readers import ScreenReaders
  126. from .tailwind_types.scroll_behavior import ScrollBehavior
  127. from .tailwind_types.scroll_margin import ScrollMargin
  128. from .tailwind_types.scroll_padding import ScrollPadding
  129. from .tailwind_types.scroll_snap_align import ScrollSnapAlign
  130. from .tailwind_types.scroll_snap_stop import ScrollSnapStop
  131. from .tailwind_types.scroll_snap_type import ScrollSnapType
  132. from .tailwind_types.sepia import Sepia
  133. from .tailwind_types.skew import Skew
  134. from .tailwind_types.space_between import SpaceBetween
  135. from .tailwind_types.stroke import Stroke
  136. from .tailwind_types.stroke_width import StrokeWidth
  137. from .tailwind_types.table_layout import TableLayout
  138. from .tailwind_types.text_align import TextAlign
  139. from .tailwind_types.text_color import TextColor
  140. from .tailwind_types.text_decoration import TextDecoration
  141. from .tailwind_types.text_decoration_color import TextDecorationColor
  142. from .tailwind_types.text_decoration_style import TextDecorationStyle
  143. from .tailwind_types.text_decoration_thickness import TextDecorationThickness
  144. from .tailwind_types.text_indent import TextIndent
  145. from .tailwind_types.text_overflow import TextOverflow
  146. from .tailwind_types.text_transform import TextTransform
  147. from .tailwind_types.text_underline_offset import TextUnderlineOffset
  148. from .tailwind_types.top_right_bottom_left import TopRightBottomLeft
  149. from .tailwind_types.touch_action import TouchAction
  150. from .tailwind_types.transform_origin import TransformOrigin
  151. from .tailwind_types.transition_delay import TransitionDelay
  152. from .tailwind_types.transition_duration import TransitionDuration
  153. from .tailwind_types.transition_property import TransitionProperty
  154. from .tailwind_types.transition_timing_function import TransitionTimingFunction
  155. from .tailwind_types.translate import Translate
  156. from .tailwind_types.user_select import UserSelect
  157. from .tailwind_types.vertical_align import VerticalAlign
  158. from .tailwind_types.visibility import Visibility
  159. from .tailwind_types.whitespace import Whitespace
  160. from .tailwind_types.width import Width
  161. from .tailwind_types.will_change import WillChange
  162. from .tailwind_types.word_break import WordBreak
  163. from .tailwind_types.z_index import ZIndex
  164. class PseudoElement:
  165. def __init__(self) -> None:
  166. self._classes: List[str] = []
  167. def classes(self, add: str) -> None:
  168. self._classes.append(add)
  169. class Tailwind:
  170. def __init__(self, _element: Optional['Element'] = None) -> None:
  171. self.element: Union[PseudoElement, Element] = PseudoElement() if _element is None else _element
  172. @overload
  173. def __call__(self, tailwind: Tailwind) -> Tailwind:
  174. ...
  175. @overload
  176. def __call__(self, *classes: str) -> Tailwind:
  177. ...
  178. def __call__(self, *args) -> Tailwind:
  179. if not args:
  180. return self
  181. if isinstance(args[0], Tailwind):
  182. args[0].apply(self.element)
  183. else:
  184. self.element.classes(' '.join(args))
  185. return self
  186. def apply(self, element: 'Element') -> None:
  187. element._classes.extend(self.element._classes)
  188. element.update()
  189. def aspect_ratio(self, value: AspectRatio) -> 'Tailwind':
  190. """Utilities for controlling the aspect ratio of an element."""
  191. self.element.classes('aspect-' + value)
  192. return self
  193. def container(self) -> 'Tailwind':
  194. """A component for fixing an element's width to the current breakpoint."""
  195. self.element.classes('container')
  196. return self
  197. def columns(self, value: Columns) -> 'Tailwind':
  198. """Utilities for controlling the number of columns within an element."""
  199. self.element.classes('columns-' + value)
  200. return self
  201. def break_after(self, value: BreakAfter) -> 'Tailwind':
  202. """Utilities for controlling how a column or page should break after an element."""
  203. self.element.classes('break-after-' + value)
  204. return self
  205. def break_before(self, value: BreakBefore) -> 'Tailwind':
  206. """Utilities for controlling how a column or page should break before an element."""
  207. self.element.classes('break-before-' + value)
  208. return self
  209. def break_inside(self, value: BreakInside) -> 'Tailwind':
  210. """Utilities for controlling how a column or page should break within an element."""
  211. self.element.classes('break-inside-' + value)
  212. return self
  213. def box_decoration_break(self, value: BoxDecorationBreak) -> 'Tailwind':
  214. """Utilities for controlling how element fragments should be rendered across multiple lines, columns, or pages."""
  215. self.element.classes('box-decoration-' + value)
  216. return self
  217. def box_sizing(self, value: BoxSizing) -> 'Tailwind':
  218. """Utilities for controlling how the browser should calculate an element's total size."""
  219. self.element.classes('box-' + value)
  220. return self
  221. def display(self, value: Display) -> 'Tailwind':
  222. """Utilities for controlling the display box type of an element."""
  223. self.element.classes('' + value)
  224. return self
  225. def floats(self, value: Floats) -> 'Tailwind':
  226. """Utilities for controlling the wrapping of content around an element."""
  227. self.element.classes('float-' + value)
  228. return self
  229. def clear(self, value: Clear) -> 'Tailwind':
  230. """Utilities for controlling the wrapping of content around an element."""
  231. self.element.classes('clear-' + value)
  232. return self
  233. def isolation(self, value: Isolation) -> 'Tailwind':
  234. """Utilities for controlling whether an element should explicitly create a new stacking context."""
  235. self.element.classes('' + value)
  236. return self
  237. def object_fit(self, value: ObjectFit) -> 'Tailwind':
  238. """Utilities for controlling how a replaced element's content should be resized."""
  239. self.element.classes('object-' + value)
  240. return self
  241. def object_position(self, value: ObjectPosition) -> 'Tailwind':
  242. """Utilities for controlling how a replaced element's content should be positioned within its container."""
  243. self.element.classes('object-' + value)
  244. return self
  245. def overflow(self, value: Overflow) -> 'Tailwind':
  246. """Utilities for controlling how an element handles content that is too large for the container."""
  247. self.element.classes('overflow-' + value)
  248. return self
  249. def overscroll_behavior(self, value: OverscrollBehavior) -> 'Tailwind':
  250. """Utilities for controlling how the browser behaves when reaching the boundary of a scrolling area."""
  251. self.element.classes('overscroll-' + value)
  252. return self
  253. def position(self, value: Position) -> 'Tailwind':
  254. """Utilities for controlling how an element is positioned in the DOM."""
  255. self.element.classes('' + value)
  256. return self
  257. def top_right_bottom_left(self, value: TopRightBottomLeft) -> 'Tailwind':
  258. """Utilities for controlling the placement of positioned elements."""
  259. self.element.classes('' + value)
  260. return self
  261. def visibility(self, value: Visibility) -> 'Tailwind':
  262. """Utilities for controlling the visibility of an element."""
  263. self.element.classes('' + value)
  264. return self
  265. def z_index(self, value: ZIndex) -> 'Tailwind':
  266. """Utilities for controlling the stack order of an element."""
  267. self.element.classes('z-' + value)
  268. return self
  269. def flex_basis(self, value: FlexBasis) -> 'Tailwind':
  270. """Utilities for controlling the initial size of flex items."""
  271. self.element.classes('basis-' + value)
  272. return self
  273. def flex_direction(self, value: FlexDirection) -> 'Tailwind':
  274. """Utilities for controlling the direction of flex items."""
  275. self.element.classes('flex-' + value)
  276. return self
  277. def flex_wrap(self, value: FlexWrap) -> 'Tailwind':
  278. """Utilities for controlling how flex items wrap."""
  279. self.element.classes('flex-' + value)
  280. return self
  281. def flex(self, value: Flex) -> 'Tailwind':
  282. """Utilities for controlling how flex items both grow and shrink."""
  283. self.element.classes('flex-' + value)
  284. return self
  285. def flex_grow(self, value: FlexGrow) -> 'Tailwind':
  286. """Utilities for controlling how flex items grow."""
  287. self.element.classes('grow-' + value)
  288. return self
  289. def flex_shrink(self, value: FlexShrink) -> 'Tailwind':
  290. """Utilities for controlling how flex items shrink."""
  291. self.element.classes('shrink-' + value)
  292. return self
  293. def order(self, value: Order) -> 'Tailwind':
  294. """Utilities for controlling the order of flex and grid items."""
  295. self.element.classes('order-' + value)
  296. return self
  297. def grid_template_columns(self, value: GridTemplateColumns) -> 'Tailwind':
  298. """Utilities for specifying the columns in a grid layout."""
  299. self.element.classes('grid-cols-' + value)
  300. return self
  301. def grid_column_start_end(self, value: GridColumnStartEnd) -> 'Tailwind':
  302. """Utilities for controlling how elements are sized and placed across grid columns."""
  303. self.element.classes('col-' + value)
  304. return self
  305. def grid_template_rows(self, value: GridTemplateRows) -> 'Tailwind':
  306. """Utilities for specifying the rows in a grid layout."""
  307. self.element.classes('grid-rows-' + value)
  308. return self
  309. def grid_row_start_end(self, value: GridRowStartEnd) -> 'Tailwind':
  310. """Utilities for controlling how elements are sized and placed across grid rows."""
  311. self.element.classes('row-' + value)
  312. return self
  313. def grid_auto_flow(self, value: GridAutoFlow) -> 'Tailwind':
  314. """Utilities for controlling how elements in a grid are auto-placed."""
  315. self.element.classes('grid-flow-' + value)
  316. return self
  317. def grid_auto_columns(self, value: GridAutoColumns) -> 'Tailwind':
  318. """Utilities for controlling the size of implicitly-created grid columns."""
  319. self.element.classes('auto-cols-' + value)
  320. return self
  321. def grid_auto_rows(self, value: GridAutoRows) -> 'Tailwind':
  322. """Utilities for controlling the size of implicitly-created grid rows."""
  323. self.element.classes('auto-rows-' + value)
  324. return self
  325. def gap(self, value: Gap) -> 'Tailwind':
  326. """Utilities for controlling gutters between grid and flexbox items."""
  327. self.element.classes('gap-' + value)
  328. return self
  329. def justify_content(self, value: JustifyContent) -> 'Tailwind':
  330. """Utilities for controlling how flex and grid items are positioned along a container's main axis."""
  331. self.element.classes('justify-' + value)
  332. return self
  333. def justify_items(self, value: JustifyItems) -> 'Tailwind':
  334. """Utilities for controlling how grid items are aligned along their inline axis."""
  335. self.element.classes('justify-items-' + value)
  336. return self
  337. def justify_self(self, value: JustifySelf) -> 'Tailwind':
  338. """Utilities for controlling how an individual grid item is aligned along its inline axis."""
  339. self.element.classes('justify-self-' + value)
  340. return self
  341. def align_content(self, value: AlignContent) -> 'Tailwind':
  342. """Utilities for controlling how rows are positioned in multi-row flex and grid containers."""
  343. self.element.classes('content-' + value)
  344. return self
  345. def align_items(self, value: AlignItems) -> 'Tailwind':
  346. """Utilities for controlling how flex and grid items are positioned along a container's cross axis."""
  347. self.element.classes('items-' + value)
  348. return self
  349. def align_self(self, value: AlignSelf) -> 'Tailwind':
  350. """Utilities for controlling how an individual flex or grid item is positioned along its container's cross axis."""
  351. self.element.classes('self-' + value)
  352. return self
  353. def place_content(self, value: PlaceContent) -> 'Tailwind':
  354. """Utilities for controlling how content is justified and aligned at the same time."""
  355. self.element.classes('place-content-' + value)
  356. return self
  357. def place_items(self, value: PlaceItems) -> 'Tailwind':
  358. """Utilities for controlling how items are justified and aligned at the same time."""
  359. self.element.classes('place-items-' + value)
  360. return self
  361. def place_self(self, value: PlaceSelf) -> 'Tailwind':
  362. """Utilities for controlling how an individual item is justified and aligned at the same time."""
  363. self.element.classes('place-self-' + value)
  364. return self
  365. def padding(self, value: Padding) -> 'Tailwind':
  366. """Utilities for controlling an element's padding."""
  367. self.element.classes('' + value)
  368. return self
  369. def margin(self, value: Margin) -> 'Tailwind':
  370. """Utilities for controlling an element's margin."""
  371. self.element.classes('' + value)
  372. return self
  373. def space_between(self, value: SpaceBetween) -> 'Tailwind':
  374. """Utilities for controlling the space between child elements."""
  375. self.element.classes('space-' + value)
  376. return self
  377. def width(self, value: Width) -> 'Tailwind':
  378. """Utilities for setting the width of an element."""
  379. self.element.classes('w-' + value)
  380. return self
  381. def min_width(self, value: MinWidth) -> 'Tailwind':
  382. """Utilities for setting the minimum width of an element."""
  383. self.element.classes('min-w-' + value)
  384. return self
  385. def max_width(self, value: MaxWidth) -> 'Tailwind':
  386. """Utilities for setting the maximum width of an element."""
  387. self.element.classes('max-w-' + value)
  388. return self
  389. def height(self, value: Height) -> 'Tailwind':
  390. """Utilities for setting the height of an element."""
  391. self.element.classes('h-' + value)
  392. return self
  393. def min_height(self, value: MinHeight) -> 'Tailwind':
  394. """Utilities for setting the minimum height of an element."""
  395. self.element.classes('min-h-' + value)
  396. return self
  397. def max_height(self, value: MaxHeight) -> 'Tailwind':
  398. """Utilities for setting the maximum height of an element."""
  399. self.element.classes('max-h-' + value)
  400. return self
  401. def font_family(self, value: FontFamily) -> 'Tailwind':
  402. """Utilities for controlling the font family of an element."""
  403. self.element.classes('font-' + value)
  404. return self
  405. def font_size(self, value: FontSize) -> 'Tailwind':
  406. """Utilities for controlling the font size of an element."""
  407. self.element.classes('text-' + value)
  408. return self
  409. def font_smoothing(self, value: FontSmoothing) -> 'Tailwind':
  410. """Utilities for controlling the font smoothing of an element."""
  411. self.element.classes('' + value)
  412. return self
  413. def font_style(self, value: FontStyle) -> 'Tailwind':
  414. """Utilities for controlling the style of text."""
  415. self.element.classes('' + value)
  416. return self
  417. def font_weight(self, value: FontWeight) -> 'Tailwind':
  418. """Utilities for controlling the font weight of an element."""
  419. self.element.classes('font-' + value)
  420. return self
  421. def font_variant_numeric(self, value: FontVariantNumeric) -> 'Tailwind':
  422. """Utilities for controlling the variant of numbers."""
  423. self.element.classes('' + value)
  424. return self
  425. def letter_spacing(self, value: LetterSpacing) -> 'Tailwind':
  426. """Utilities for controlling the tracking (letter spacing) of an element."""
  427. self.element.classes('tracking-' + value)
  428. return self
  429. def line_clamp(self, value: LineClamp) -> 'Tailwind':
  430. """Utilities for clamping text to a specific number of lines."""
  431. self.element.classes('line-clamp-' + value)
  432. return self
  433. def line_height(self, value: LineHeight) -> 'Tailwind':
  434. """Utilities for controlling the leading (line height) of an element."""
  435. self.element.classes('leading-' + value)
  436. return self
  437. def list_style_image(self, value: ListStyleImage) -> 'Tailwind':
  438. """Utilities for controlling the marker images for list items."""
  439. self.element.classes('list-image' + value)
  440. return self
  441. def list_style_position(self, value: ListStylePosition) -> 'Tailwind':
  442. """Utilities for controlling the position of bullets/numbers in lists."""
  443. self.element.classes('list-' + value)
  444. return self
  445. def list_style_type(self, value: ListStyleType) -> 'Tailwind':
  446. """Utilities for controlling the bullet/number style of a list."""
  447. self.element.classes('list-' + value)
  448. return self
  449. def text_align(self, value: TextAlign) -> 'Tailwind':
  450. """Utilities for controlling the alignment of text."""
  451. self.element.classes('text-' + value)
  452. return self
  453. def text_color(self, value: TextColor) -> 'Tailwind':
  454. """Utilities for controlling the text color of an element."""
  455. self.element.classes('text-' + value)
  456. return self
  457. def text_decoration(self, value: TextDecoration) -> 'Tailwind':
  458. """Utilities for controlling the decoration of text."""
  459. self.element.classes('' + value)
  460. return self
  461. def text_decoration_color(self, value: TextDecorationColor) -> 'Tailwind':
  462. """Utilities for controlling the color of text decorations."""
  463. self.element.classes('decoration-' + value)
  464. return self
  465. def text_decoration_style(self, value: TextDecorationStyle) -> 'Tailwind':
  466. """Utilities for controlling the style of text decorations."""
  467. self.element.classes('decoration-' + value)
  468. return self
  469. def text_decoration_thickness(self, value: TextDecorationThickness) -> 'Tailwind':
  470. """Utilities for controlling the thickness of text decorations."""
  471. self.element.classes('decoration-' + value)
  472. return self
  473. def text_underline_offset(self, value: TextUnderlineOffset) -> 'Tailwind':
  474. """Utilities for controlling the offset of a text underline."""
  475. self.element.classes('underline-offset-' + value)
  476. return self
  477. def text_transform(self, value: TextTransform) -> 'Tailwind':
  478. """Utilities for controlling the transformation of text."""
  479. self.element.classes('' + value)
  480. return self
  481. def text_overflow(self, value: TextOverflow) -> 'Tailwind':
  482. """Utilities for controlling text overflow in an element."""
  483. self.element.classes('' + value)
  484. return self
  485. def text_indent(self, value: TextIndent) -> 'Tailwind':
  486. """Utilities for controlling the amount of empty space shown before text in a block."""
  487. self.element.classes('indent-' + value)
  488. return self
  489. def vertical_align(self, value: VerticalAlign) -> 'Tailwind':
  490. """Utilities for controlling the vertical alignment of an inline or table-cell box."""
  491. self.element.classes('align-' + value)
  492. return self
  493. def whitespace(self, value: Whitespace) -> 'Tailwind':
  494. """Utilities for controlling an element's white-space property."""
  495. self.element.classes('whitespace-' + value)
  496. return self
  497. def word_break(self, value: WordBreak) -> 'Tailwind':
  498. """Utilities for controlling word breaks in an element."""
  499. self.element.classes('break-' + value)
  500. return self
  501. def hyphens(self, value: Hyphens) -> 'Tailwind':
  502. """Utilities for controlling how words should be hyphenated."""
  503. self.element.classes('hyphens-' + value)
  504. return self
  505. def content(self, value: Content) -> 'Tailwind':
  506. """Utilities for controlling the content of the before and after pseudo-elements."""
  507. self.element.classes('content' + value)
  508. return self
  509. def background_attachment(self, value: BackgroundAttachment) -> 'Tailwind':
  510. """Utilities for controlling how a background image behaves when scrolling."""
  511. self.element.classes('bg-' + value)
  512. return self
  513. def background_clip(self, value: BackgroundClip) -> 'Tailwind':
  514. """Utilities for controlling the bounding box of an element's background."""
  515. self.element.classes('bg-clip-' + value)
  516. return self
  517. def background_color(self, value: BackgroundColor) -> 'Tailwind':
  518. """Utilities for controlling an element's background color."""
  519. self.element.classes('bg-' + value)
  520. return self
  521. def background_origin(self, value: BackgroundOrigin) -> 'Tailwind':
  522. """Utilities for controlling how an element's background is positioned relative to borders, padding, and content."""
  523. self.element.classes('bg-origin-' + value)
  524. return self
  525. def background_position(self, value: BackgroundPosition) -> 'Tailwind':
  526. """Utilities for controlling the position of an element's background image."""
  527. self.element.classes('bg-' + value)
  528. return self
  529. def background_repeat(self, value: BackgroundRepeat) -> 'Tailwind':
  530. """Utilities for controlling the repetition of an element's background image."""
  531. self.element.classes('bg-' + value)
  532. return self
  533. def background_size(self, value: BackgroundSize) -> 'Tailwind':
  534. """Utilities for controlling the background size of an element's background image."""
  535. self.element.classes('bg-' + value)
  536. return self
  537. def background_image(self, value: BackgroundImage) -> 'Tailwind':
  538. """Utilities for controlling an element's background image."""
  539. self.element.classes('bg-' + value)
  540. return self
  541. def gradient_color_stops(self, value: GradientColorStops) -> 'Tailwind':
  542. """Utilities for controlling the color stops in background gradients."""
  543. self.element.classes('' + value)
  544. return self
  545. def border_radius(self, value: BorderRadius) -> 'Tailwind':
  546. """Utilities for controlling the border radius of an element."""
  547. self.element.classes('rounded-' + value)
  548. return self
  549. def border_width(self, value: BorderWidth) -> 'Tailwind':
  550. """Utilities for controlling the width of an element's borders."""
  551. self.element.classes('border-' + value)
  552. return self
  553. def border_color(self, value: BorderColor) -> 'Tailwind':
  554. """Utilities for controlling the color of an element's borders."""
  555. self.element.classes('border-' + value)
  556. return self
  557. def border_style(self, value: BorderStyle) -> 'Tailwind':
  558. """Utilities for controlling the style of an element's borders."""
  559. self.element.classes('border-' + value)
  560. return self
  561. def divide_width(self, value: DivideWidth) -> 'Tailwind':
  562. """Utilities for controlling the border width between elements."""
  563. self.element.classes('divide-' + value)
  564. return self
  565. def divide_color(self, value: DivideColor) -> 'Tailwind':
  566. """Utilities for controlling the border color between elements."""
  567. self.element.classes('divide-' + value)
  568. return self
  569. def divide_style(self, value: DivideStyle) -> 'Tailwind':
  570. """Utilities for controlling the border style between elements."""
  571. self.element.classes('divide-' + value)
  572. return self
  573. def outline_width(self, value: OutlineWidth) -> 'Tailwind':
  574. """Utilities for controlling the width of an element's outline."""
  575. self.element.classes('outline-' + value)
  576. return self
  577. def outline_color(self, value: OutlineColor) -> 'Tailwind':
  578. """Utilities for controlling the color of an element's outline."""
  579. self.element.classes('outline-' + value)
  580. return self
  581. def outline_style(self, value: OutlineStyle) -> 'Tailwind':
  582. """Utilities for controlling the style of an element's outline."""
  583. self.element.classes('outline-' + value)
  584. return self
  585. def outline_offset(self, value: OutlineOffset) -> 'Tailwind':
  586. """Utilities for controlling the offset of an element's outline."""
  587. self.element.classes('outline-offset-' + value)
  588. return self
  589. def ring_width(self, value: RingWidth) -> 'Tailwind':
  590. """Utilities for creating outline rings with box-shadows."""
  591. self.element.classes('ring-' + value)
  592. return self
  593. def ring_color(self, value: RingColor) -> 'Tailwind':
  594. """Utilities for setting the color of outline rings."""
  595. self.element.classes('ring-' + value)
  596. return self
  597. def ring_offset_width(self, value: RingOffsetWidth) -> 'Tailwind':
  598. """Utilities for simulating an offset when adding outline rings."""
  599. self.element.classes('ring-offset-' + value)
  600. return self
  601. def ring_offset_color(self, value: RingOffsetColor) -> 'Tailwind':
  602. """Utilities for setting the color of outline ring offsets."""
  603. self.element.classes('ring-offset-' + value)
  604. return self
  605. def box_shadow(self, value: BoxShadow) -> 'Tailwind':
  606. """Utilities for controlling the box shadow of an element."""
  607. self.element.classes('shadow-' + value)
  608. return self
  609. def box_shadow_color(self, value: BoxShadowColor) -> 'Tailwind':
  610. """Utilities for controlling the color of a box shadow."""
  611. self.element.classes('shadow-' + value)
  612. return self
  613. def opacity(self, value: Opacity) -> 'Tailwind':
  614. """Utilities for controlling the opacity of an element."""
  615. self.element.classes('opacity-' + value)
  616. return self
  617. def mix_blend_mode(self, value: MixBlendMode) -> 'Tailwind':
  618. """Utilities for controlling how an element should blend with the background."""
  619. self.element.classes('mix-blend-' + value)
  620. return self
  621. def background_blend_mode(self, value: BackgroundBlendMode) -> 'Tailwind':
  622. """Utilities for controlling how an element's background image should blend with its background color."""
  623. self.element.classes('bg-blend-' + value)
  624. return self
  625. def blur(self, value: Blur) -> 'Tailwind':
  626. """Utilities for applying blur filters to an element."""
  627. self.element.classes('blur-' + value)
  628. return self
  629. def brightness(self, value: Brightness) -> 'Tailwind':
  630. """Utilities for applying brightness filters to an element."""
  631. self.element.classes('brightness-' + value)
  632. return self
  633. def contrast(self, value: Contrast) -> 'Tailwind':
  634. """Utilities for applying contrast filters to an element."""
  635. self.element.classes('contrast-' + value)
  636. return self
  637. def drop_shadow(self, value: DropShadow) -> 'Tailwind':
  638. """Utilities for applying drop-shadow filters to an element."""
  639. self.element.classes('drop-shadow-' + value)
  640. return self
  641. def grayscale(self, value: Grayscale) -> 'Tailwind':
  642. """Utilities for applying grayscale filters to an element."""
  643. self.element.classes('grayscale-' + value)
  644. return self
  645. def hue_rotate(self, value: HueRotate) -> 'Tailwind':
  646. """Utilities for applying hue-rotate filters to an element."""
  647. self.element.classes('hue-rotate-' + value)
  648. return self
  649. def invert(self, value: Invert) -> 'Tailwind':
  650. """Utilities for applying invert filters to an element."""
  651. self.element.classes('invert-' + value)
  652. return self
  653. def saturate(self, value: Saturate) -> 'Tailwind':
  654. """Utilities for applying saturation filters to an element."""
  655. self.element.classes('saturate-' + value)
  656. return self
  657. def sepia(self, value: Sepia) -> 'Tailwind':
  658. """Utilities for applying sepia filters to an element."""
  659. self.element.classes('sepia-' + value)
  660. return self
  661. def backdrop_blur(self, value: BackdropBlur) -> 'Tailwind':
  662. """Utilities for applying backdrop blur filters to an element."""
  663. self.element.classes('backdrop-blur-' + value)
  664. return self
  665. def backdrop_brightness(self, value: BackdropBrightness) -> 'Tailwind':
  666. """Utilities for applying backdrop brightness filters to an element."""
  667. self.element.classes('backdrop-brightness-' + value)
  668. return self
  669. def backdrop_contrast(self, value: BackdropContrast) -> 'Tailwind':
  670. """Utilities for applying backdrop contrast filters to an element."""
  671. self.element.classes('backdrop-contrast-' + value)
  672. return self
  673. def backdrop_grayscale(self, value: BackdropGrayscale) -> 'Tailwind':
  674. """Utilities for applying backdrop grayscale filters to an element."""
  675. self.element.classes('backdrop-grayscale-' + value)
  676. return self
  677. def backdrop_hue_rotate(self, value: BackdropHueRotate) -> 'Tailwind':
  678. """Utilities for applying backdrop hue-rotate filters to an element."""
  679. self.element.classes('backdrop-hue-rotate-' + value)
  680. return self
  681. def backdrop_invert(self, value: BackdropInvert) -> 'Tailwind':
  682. """Utilities for applying backdrop invert filters to an element."""
  683. self.element.classes('backdrop-invert-' + value)
  684. return self
  685. def backdrop_opacity(self, value: BackdropOpacity) -> 'Tailwind':
  686. """Utilities for applying backdrop opacity filters to an element."""
  687. self.element.classes('backdrop-opacity-' + value)
  688. return self
  689. def backdrop_saturate(self, value: BackdropSaturate) -> 'Tailwind':
  690. """Utilities for applying backdrop saturation filters to an element."""
  691. self.element.classes('backdrop-saturate-' + value)
  692. return self
  693. def backdrop_sepia(self, value: BackdropSepia) -> 'Tailwind':
  694. """Utilities for applying backdrop sepia filters to an element."""
  695. self.element.classes('backdrop-sepia-' + value)
  696. return self
  697. def border_collapse(self, value: BorderCollapse) -> 'Tailwind':
  698. """Utilities for controlling whether table borders should collapse or be separated."""
  699. self.element.classes('border-' + value)
  700. return self
  701. def border_spacing(self, value: BorderSpacing) -> 'Tailwind':
  702. """Utilities for controlling the spacing between table borders."""
  703. self.element.classes('border-spacing-' + value)
  704. return self
  705. def table_layout(self, value: TableLayout) -> 'Tailwind':
  706. """Utilities for controlling the table layout algorithm."""
  707. self.element.classes('table-' + value)
  708. return self
  709. def caption_side(self, value: CaptionSide) -> 'Tailwind':
  710. """Utilities for controlling the alignment of a caption element inside of a table."""
  711. self.element.classes('caption-' + value)
  712. return self
  713. def transition_property(self, value: TransitionProperty) -> 'Tailwind':
  714. """Utilities for controlling which CSS properties transition."""
  715. self.element.classes('transition-' + value)
  716. return self
  717. def transition_duration(self, value: TransitionDuration) -> 'Tailwind':
  718. """Utilities for controlling the duration of CSS transitions."""
  719. self.element.classes('duration-' + value)
  720. return self
  721. def transition_timing_function(self, value: TransitionTimingFunction) -> 'Tailwind':
  722. """Utilities for controlling the easing of CSS transitions."""
  723. self.element.classes('ease-' + value)
  724. return self
  725. def transition_delay(self, value: TransitionDelay) -> 'Tailwind':
  726. """Utilities for controlling the delay of CSS transitions."""
  727. self.element.classes('delay-' + value)
  728. return self
  729. def animation(self, value: Animation) -> 'Tailwind':
  730. """Utilities for animating elements with CSS animations."""
  731. self.element.classes('animate-' + value)
  732. return self
  733. def scale(self, value: Scale) -> 'Tailwind':
  734. """Utilities for scaling elements with transform."""
  735. self.element.classes('scale-' + value)
  736. return self
  737. def rotate(self, value: Rotate) -> 'Tailwind':
  738. """Utilities for rotating elements with transform."""
  739. self.element.classes('rotate-' + value)
  740. return self
  741. def translate(self, value: Translate) -> 'Tailwind':
  742. """Utilities for translating elements with transform."""
  743. self.element.classes('translate-' + value)
  744. return self
  745. def skew(self, value: Skew) -> 'Tailwind':
  746. """Utilities for skewing elements with transform."""
  747. self.element.classes('skew-' + value)
  748. return self
  749. def transform_origin(self, value: TransformOrigin) -> 'Tailwind':
  750. """Utilities for specifying the origin for an element's transformations."""
  751. self.element.classes('origin-' + value)
  752. return self
  753. def accent_color(self, value: AccentColor) -> 'Tailwind':
  754. """Utilities for controlling the accented color of a form control."""
  755. self.element.classes('accent-' + value)
  756. return self
  757. def appearance(self, value: Appearance) -> 'Tailwind':
  758. """Utilities for suppressing native form control styling."""
  759. self.element.classes('appearance' + value)
  760. return self
  761. def cursor(self, value: Cursor) -> 'Tailwind':
  762. """Utilities for controlling the cursor style when hovering over an element."""
  763. self.element.classes('cursor-' + value)
  764. return self
  765. def caret_color(self, value: CaretColor) -> 'Tailwind':
  766. """Utilities for controlling the color of the text input cursor."""
  767. self.element.classes('caret-' + value)
  768. return self
  769. def pointer_events(self, value: PointerEvents) -> 'Tailwind':
  770. """Utilities for controlling whether an element responds to pointer events."""
  771. self.element.classes('pointer-events-' + value)
  772. return self
  773. def resize(self, value: Resize) -> 'Tailwind':
  774. """Utilities for controlling how an element can be resized."""
  775. self.element.classes('resize-' + value)
  776. return self
  777. def scroll_behavior(self, value: ScrollBehavior) -> 'Tailwind':
  778. """Utilities for controlling the scroll behavior of an element."""
  779. self.element.classes('scroll-' + value)
  780. return self
  781. def scroll_margin(self, value: ScrollMargin) -> 'Tailwind':
  782. """Utilities for controlling the scroll offset around items in a snap container."""
  783. self.element.classes('scroll-' + value)
  784. return self
  785. def scroll_padding(self, value: ScrollPadding) -> 'Tailwind':
  786. """Utilities for controlling an element's scroll offset within a snap container."""
  787. self.element.classes('scroll-' + value)
  788. return self
  789. def scroll_snap_align(self, value: ScrollSnapAlign) -> 'Tailwind':
  790. """Utilities for controlling the scroll snap alignment of an element."""
  791. self.element.classes('snap-' + value)
  792. return self
  793. def scroll_snap_stop(self, value: ScrollSnapStop) -> 'Tailwind':
  794. """Utilities for controlling whether you can skip past possible snap positions."""
  795. self.element.classes('snap-' + value)
  796. return self
  797. def scroll_snap_type(self, value: ScrollSnapType) -> 'Tailwind':
  798. """Utilities for controlling how strictly snap points are enforced in a snap container."""
  799. self.element.classes('snap-' + value)
  800. return self
  801. def touch_action(self, value: TouchAction) -> 'Tailwind':
  802. """Utilities for controlling how an element can be scrolled and zoomed on touchscreens."""
  803. self.element.classes('touch-' + value)
  804. return self
  805. def user_select(self, value: UserSelect) -> 'Tailwind':
  806. """Utilities for controlling whether the user can select text in an element."""
  807. self.element.classes('select-' + value)
  808. return self
  809. def will_change(self, value: WillChange) -> 'Tailwind':
  810. """Utilities for optimizing upcoming animations of elements that are expected to change."""
  811. self.element.classes('will-change-' + value)
  812. return self
  813. def fill(self, value: Fill) -> 'Tailwind':
  814. """Utilities for styling the fill of SVG elements."""
  815. self.element.classes('fill-' + value)
  816. return self
  817. def stroke(self, value: Stroke) -> 'Tailwind':
  818. """Utilities for styling the stroke of SVG elements."""
  819. self.element.classes('stroke-' + value)
  820. return self
  821. def stroke_width(self, value: StrokeWidth) -> 'Tailwind':
  822. """Utilities for styling the stroke width of SVG elements."""
  823. self.element.classes('stroke-' + value)
  824. return self
  825. def screen_readers(self, value: ScreenReaders) -> 'Tailwind':
  826. """Utilities for improving accessibility with screen readers."""
  827. self.element.classes('' + value)
  828. return self