cabin_tailwind/utilities/
mod.rs1pub mod aspect;
2pub mod auto_cols;
3pub mod auto_rows;
4pub mod basis;
5pub mod bg;
6pub mod border;
7pub mod bottom;
8pub mod box_;
9pub mod break_;
10pub mod col;
11pub mod cursor;
12pub mod decoration;
13pub mod display;
14pub mod end;
15pub mod flex;
16pub mod font;
17pub mod from;
18pub mod gap;
19pub mod gap_x;
20pub mod gap_y;
21pub mod grid;
22pub mod h;
23pub mod inset;
24pub mod items;
25pub mod justify;
26pub mod leading;
27pub mod left;
28pub mod line;
29pub mod list;
30pub mod m;
31pub mod max_h;
32pub mod max_w;
33pub mod mb;
34pub mod me;
35pub mod min_h;
36pub mod min_w;
37pub mod ml;
38pub mod mr;
39pub mod ms;
40pub mod mt;
41pub mod mx;
42pub mod my;
43pub mod object;
44pub mod order;
45pub mod outline;
46pub mod overflow;
47pub mod p;
48pub mod pb;
49pub mod pl;
50pub mod place;
51pub mod position;
52pub mod pr;
53pub mod pt;
54pub mod px;
55pub mod py;
56pub mod right;
57pub mod ring;
58pub mod rounded;
59pub mod row;
60pub mod shadow;
61pub mod space;
62pub mod start;
63pub mod text;
64pub mod to;
65pub mod top;
66pub mod tracking;
67pub mod transition;
68pub mod via;
69pub mod w;
70pub mod whitespace;
71pub mod z;
72
73use std::fmt;
74
75pub use basis::unit as basis;
76pub use border::{px as border, PX as BORDER};
77pub use bottom::unit as bottom;
78pub use decoration::{LINE_THROUGH, NO_UNDERLINE, OVERLINE, UNDERLINE};
79pub use display::*;
80pub use end::unit as end;
81pub use flex::{NO_SHRINK, SHRINK};
82pub use font::{ITALIC, NOT_ITALIC};
83pub use from::percent as from;
84pub use gap::unit as gap;
85pub use gap_x::unit as gap_x;
86pub use gap_y::unit as gap_y;
87pub use h::unit as h;
88pub use inset::unit as inset;
89pub use leading::unit as leading;
90pub use left::unit as left;
91pub use m::unit as m;
92pub use max_h::unit as max_h;
93pub use max_w::unit as max_w;
94pub use mb::unit as mb;
95pub use me::unit as me;
96pub use min_h::unit as min_h;
97pub use min_w::unit as min_w;
98pub use ml::unit as ml;
99pub use mr::unit as mr;
100pub use ms::unit as ms;
101pub use mt::unit as mt;
102pub use mx::unit as mx;
103pub use my::unit as my;
104pub use order::order;
105pub use outline::{width as outline, SOLID as OUTLINE};
106pub use p::unit as p;
107pub use pb::unit as pb;
108pub use pl::unit as pl;
109pub use position::*;
110pub use pr::unit as pr;
111pub use pt::unit as pt;
112pub use px::unit as px;
113pub use py::unit as py;
114pub use right::unit as right;
115pub use ring::{width as ring, DEFAULT as RING};
116pub use rounded::DEFAULT as ROUNDED;
117pub use shadow::DEFAULT as SHADOW;
118pub use start::unit as start;
119pub use text::{CAPITALIZE, LOWERCASE, NORMAL_CASE, TRUNCATE, UPPERCASE};
120pub use to::percent as to;
121pub use top::unit as top;
122pub use transition::DEFAULT as TRANSITION;
123pub use via::percent as via;
124pub use w::unit as w;
125pub use z::index as z;
126
127use crate::{Length, Property, StaticClass, Utility};
128
129pub const GROUP: StaticClass = StaticClass("group");
130
131pub struct SrOnly(());
132pub struct NotSrOnly(());
133
134pub const SR_ONLY: SrOnly = SrOnly(());
136
137pub const NOT_SR_ONLY: NotSrOnly = NotSrOnly(());
139
140pub fn opacity(x: i16) -> Property<Length> {
144 Property("opacity", Length::Percent(f32::from(x)))
145}
146
147pub fn opacityf(x: f32) -> Property<Length> {
151 Property("opacity", Length::Percent(x))
152}
153
154impl Utility for SrOnly {
155 fn declarations(&self, f: &mut dyn fmt::Write) -> fmt::Result {
156 writeln!(f, "position: absolute;")?;
157 writeln!(f, "width: 1px;")?;
158 writeln!(f, "height: 1px;")?;
159 writeln!(f, "padding: 0;")?;
160 writeln!(f, "margin: -1px;")?;
161 writeln!(f, "overflow: hidden;")?;
162 writeln!(f, "clip: rect(0, 0, 0, 0);")?;
163 writeln!(f, "white-space: nowrap;")?;
164 writeln!(f, "border-width: 0;")?;
165 Ok(())
166 }
167}
168
169impl Utility for NotSrOnly {
170 fn declarations(&self, f: &mut dyn fmt::Write) -> fmt::Result {
171 writeln!(f, "position: static;")?;
172 writeln!(f, "width: auto;")?;
173 writeln!(f, "height: auto;")?;
174 writeln!(f, "padding: 0;")?;
175 writeln!(f, "margin: 0;")?;
176 writeln!(f, "overflow: visible;")?;
177 writeln!(f, "clip: auto;")?;
178 writeln!(f, "white-space: normal;")?;
179 Ok(())
180 }
181}