pub trait StyledExt: Styled + Sized {
Show 133 methods
// Required method
fn style_ext_mut(&mut self) -> &mut StyleExt;
// Provided methods
fn hover(self, f: impl FnOnce(StyleRefinement) -> StyleRefinement) -> Self { ... }
fn active(self, f: impl FnOnce(StyleRefinement) -> StyleRefinement) -> Self { ... }
fn active_style(
self,
f: impl FnOnce(StyleRefinement) -> StyleRefinement,
) -> Self { ... }
fn focus(self, f: impl FnOnce(StyleRefinement) -> StyleRefinement) -> Self { ... }
fn overflow_hidden(self) -> Self { ... }
fn overflow_visible(self) -> Self { ... }
fn overflow_scroll(self) -> Self { ... }
fn overflow_y_scroll(self) -> Self { ... }
fn overflow_x_scroll(self) -> Self { ... }
fn scrollable(self, max_scroll: i16) -> Self { ... }
fn transition(self) -> Self { ... }
fn transition_colors(self) -> Self { ... }
fn transition_opacity(self) -> Self { ... }
fn transition_all(self) -> Self { ... }
fn transition_none(self) -> Self { ... }
fn animate_color(self, duration: Duration) -> Self { ... }
fn animate_bg(self, duration: Duration) -> Self { ... }
fn animate_bounds(self, duration: Duration) -> Self { ... }
fn animate_opacity(self, duration: Duration) -> Self { ... }
fn animate_all(self, duration: Duration) -> Self { ... }
fn duration(self, duration: Duration) -> Self { ... }
fn duration_75(self) -> Self { ... }
fn duration_100(self) -> Self { ... }
fn duration_150(self) -> Self { ... }
fn duration_200(self) -> Self { ... }
fn duration_300(self) -> Self { ... }
fn duration_500(self) -> Self { ... }
fn ease(self, easing: Easing) -> Self { ... }
fn ease_linear(self) -> Self { ... }
fn ease_in(self) -> Self { ... }
fn ease_out(self) -> Self { ... }
fn ease_in_out(self) -> Self { ... }
fn ease_spring(self) -> Self { ... }
fn delay(self, delay: Duration) -> Self { ... }
fn loop_mode(self, mode: LoopMode) -> Self { ... }
fn fade_in(self, duration: Duration) -> Self { ... }
fn slide_in(self, dx: i16, dy: i16, duration: Duration) -> Self { ... }
fn text_color(self, color: Color) -> Self { ... }
fn text_size(self, px: u8) -> Self { ... }
fn text_xs(self) -> Self { ... }
fn text_sm(self) -> Self { ... }
fn text_base(self) -> Self { ... }
fn text_lg(self) -> Self { ... }
fn text_xl(self) -> Self { ... }
fn text_2xl(self) -> Self { ... }
fn text_3xl(self) -> Self { ... }
fn opacity(self, alpha: u8) -> Self { ... }
fn opacity_f(self, alpha: f32) -> Self { ... }
fn shadow(self, blur: u8, offset_x: i8, offset_y: i8, color: Color) -> Self { ... }
fn shadow_none(self) -> Self { ... }
fn shadow_sm(self) -> Self { ... }
fn shadow_md(self) -> Self { ... }
fn shadow_lg(self) -> Self { ... }
fn shadow_xl(self) -> Self { ... }
fn cursor(self, cursor: CursorShape) -> Self { ... }
fn cursor_shape(self, cursor: CursorShape) -> Self { ... }
fn cursor_pointer(self) -> Self { ... }
fn cursor_default(self) -> Self { ... }
fn cursor_text(self) -> Self { ... }
fn cursor_not_allowed(self) -> Self { ... }
fn cursor_grab(self) -> Self { ... }
fn cursor_grabbing(self) -> Self { ... }
fn mx(self, px: i16) -> Self { ... }
fn my(self, px: i16) -> Self { ... }
fn mt(self, px: i16) -> Self { ... }
fn mb(self, px: i16) -> Self { ... }
fn ml(self, px: i16) -> Self { ... }
fn mr(self, px: i16) -> Self { ... }
fn mx_0(self) -> Self { ... }
fn mx_1(self) -> Self { ... }
fn mx_2(self) -> Self { ... }
fn mx_3(self) -> Self { ... }
fn mx_4(self) -> Self { ... }
fn my_0(self) -> Self { ... }
fn my_1(self) -> Self { ... }
fn my_2(self) -> Self { ... }
fn my_3(self) -> Self { ... }
fn my_4(self) -> Self { ... }
fn mt_1(self) -> Self { ... }
fn mt_2(self) -> Self { ... }
fn mt_3(self) -> Self { ... }
fn mt_4(self) -> Self { ... }
fn mb_1(self) -> Self { ... }
fn mb_2(self) -> Self { ... }
fn mb_3(self) -> Self { ... }
fn mb_4(self) -> Self { ... }
fn ml_1(self) -> Self { ... }
fn ml_2(self) -> Self { ... }
fn ml_3(self) -> Self { ... }
fn ml_4(self) -> Self { ... }
fn mr_1(self) -> Self { ... }
fn mr_2(self) -> Self { ... }
fn mr_3(self) -> Self { ... }
fn mr_4(self) -> Self { ... }
fn min_w(self, px: i16) -> Self { ... }
fn max_w(self, px: i16) -> Self { ... }
fn min_h(self, px: i16) -> Self { ... }
fn max_h(self, px: i16) -> Self { ... }
fn align_self(self, align: AlignItems) -> Self { ... }
fn self_start(self) -> Self { ... }
fn self_center(self) -> Self { ... }
fn self_end(self) -> Self { ... }
fn self_stretch(self) -> Self { ... }
fn items_baseline(self) -> Self { ... }
fn z_index(self, z: i8) -> Self { ... }
fn relative(self) -> Self { ... }
fn block(self) -> Self { ... }
fn inline_flex(self) -> Self { ... }
fn rounded_corners(self, radii: CornerRadii) -> Self { ... }
fn rounded_t(self, r: u8) -> Self { ... }
fn rounded_b(self, r: u8) -> Self { ... }
fn rounded_l(self, r: u8) -> Self { ... }
fn rounded_r(self, r: u8) -> Self { ... }
fn blend_mode(self, mode: BlendMode) -> Self { ... }
fn isolate(self) -> Self { ... }
fn blur(self, radius: u8) -> Self { ... }
fn color_matrix(self, matrix: ColorMatrix) -> Self { ... }
fn grayscale(self, amount: f32) -> Self { ... }
fn sepia(self, amount: f32) -> Self { ... }
fn saturate(self, amount: f32) -> Self { ... }
fn brightness(self, amount: f32) -> Self { ... }
fn contrast(self, amount: f32) -> Self { ... }
fn hue_rotate(self, deg: f32) -> Self { ... }
fn invert(self, amount: f32) -> Self { ... }
fn drop_shadow(
self,
blur: u8,
offset_x: i8,
offset_y: i8,
color: Color,
) -> Self { ... }
fn backdrop_filter(self, filter: BackdropFilter) -> Self { ... }
fn backdrop_blur(self, radius: u8) -> Self { ... }
fn backdrop_acrylic(self, blur_radius: u8, tint: Color) -> Self { ... }
fn transform(self, t: Transform2D) -> Self { ... }
fn rotate_deg(self, deg: f32) -> Self { ... }
fn scale(self, sx: f32, sy: f32) -> Self { ... }
fn translate(self, tx: f32, ty: f32) -> Self { ... }
}Expand description
统一 gpui-kit / Tailwind 风格扩展修饰符 Trait(覆盖交互态闭包、过渡动画、溢出裁剪、容器文本继承、阴影、光标与外边距)。
所有 velox-base 无样式原语与 velox-component 主题化组件均实现此 Trait,
使任意组件均可像 div() 一样自由编写 .hover(|s| ...)、.transition_colors()、.overflow_hidden()、.text_xs() 等链式语法。
Required Methods§
Sourcefn style_ext_mut(&mut self) -> &mut StyleExt
fn style_ext_mut(&mut self) -> &mut StyleExt
获取内部 StyleExt 可变引用。
Provided Methods§
Sourcefn hover(self, f: impl FnOnce(StyleRefinement) -> StyleRefinement) -> Self
fn hover(self, f: impl FnOnce(StyleRefinement) -> StyleRefinement) -> Self
GPUI 风格悬停态样式闭包(如 .hover(|s| s.bg(rgb(0xf5f5f5)).border_color(rgb(0x171717))))。
Sourcefn active(self, f: impl FnOnce(StyleRefinement) -> StyleRefinement) -> Self
fn active(self, f: impl FnOnce(StyleRefinement) -> StyleRefinement) -> Self
GPUI 风格按下态样式闭包(如 .active(|s| s.bg(rgb(0xe5e5e5))))。
Sourcefn active_style(
self,
f: impl FnOnce(StyleRefinement) -> StyleRefinement,
) -> Self
fn active_style( self, f: impl FnOnce(StyleRefinement) -> StyleRefinement, ) -> Self
按下态样式闭包显式别名(避免与少数自带 .active(id) 固有方法的导航组件冲突)。
Sourcefn focus(self, f: impl FnOnce(StyleRefinement) -> StyleRefinement) -> Self
fn focus(self, f: impl FnOnce(StyleRefinement) -> StyleRefinement) -> Self
GPUI 风格聚焦态样式闭包(如 .focus(|s| s.border_1().border_color(rgb(0x3b82f6))))。
启用溢出裁剪(等价 CSS overflow: hidden)。
Sourcefn overflow_visible(self) -> Self
fn overflow_visible(self) -> Self
关闭溢出裁剪(等价 CSS overflow: visible)。
Sourcefn overflow_scroll(self) -> Self
fn overflow_scroll(self) -> Self
启用自动测量边界的滚动视口(等价 CSS overflow: auto/scroll)。
Sourcefn overflow_y_scroll(self) -> Self
fn overflow_y_scroll(self) -> Self
启用垂直方向自动滚动视口(等价 CSS overflow-y: auto/scroll)。
Sourcefn overflow_x_scroll(self) -> Self
fn overflow_x_scroll(self) -> Self
启用水平方向自动滚动视口(等价 CSS overflow-x: auto/scroll)。
Sourcefn scrollable(self, max_scroll: i16) -> Self
fn scrollable(self, max_scroll: i16) -> Self
启用指定最大滚动距离的可滚动视口。
Sourcefn transition(self) -> Self
fn transition(self) -> Self
默认过渡动画(150ms 颜色 + 不透明度 + 几何边界)。
Sourcefn transition_colors(self) -> Self
fn transition_colors(self) -> Self
颜色过渡简写(150ms 背景/边框/文本色平滑过渡)。
Sourcefn transition_opacity(self) -> Self
fn transition_opacity(self) -> Self
不透明度过渡简写(150ms 淡入淡出)。
Sourcefn transition_all(self) -> Self
fn transition_all(self) -> Self
全属性过渡简写(150ms 颜色 + 边界 + 不透明度)。
Sourcefn transition_none(self) -> Self
fn transition_none(self) -> Self
显式禁用过渡动画(等价 CSS transition: none)。
Sourcefn animate_color(self, duration: Duration) -> Self
fn animate_color(self, duration: Duration) -> Self
设置颜色跨帧过渡时长。
Sourcefn animate_bg(self, duration: Duration) -> Self
fn animate_bg(self, duration: Duration) -> Self
设置背景色跨帧过渡时长。
Sourcefn animate_bounds(self, duration: Duration) -> Self
fn animate_bounds(self, duration: Duration) -> Self
设置几何边界跨帧过渡时长。
Sourcefn animate_opacity(self, duration: Duration) -> Self
fn animate_opacity(self, duration: Duration) -> Self
设置不透明度跨帧过渡时长。
Sourcefn animate_all(self, duration: Duration) -> Self
fn animate_all(self, duration: Duration) -> Self
设置全属性跨帧过渡时长。
fn duration_75(self) -> Self
fn duration_100(self) -> Self
fn duration_150(self) -> Self
fn duration_200(self) -> Self
fn duration_300(self) -> Self
fn duration_500(self) -> Self
fn ease_linear(self) -> Self
fn ease_in(self) -> Self
fn ease_out(self) -> Self
fn ease_in_out(self) -> Self
fn ease_spring(self) -> Self
Sourcefn text_color(self, color: Color) -> Self
fn text_color(self, color: Color) -> Self
设置容器级可继承文本颜色。
fn text_xs(self) -> Self
fn text_sm(self) -> Self
fn text_base(self) -> Self
fn text_lg(self) -> Self
fn text_xl(self) -> Self
fn text_2xl(self) -> Self
fn text_3xl(self) -> Self
fn shadow_none(self) -> Self
fn shadow_sm(self) -> Self
fn shadow_md(self) -> Self
fn shadow_lg(self) -> Self
fn shadow_xl(self) -> Self
Sourcefn cursor(self, cursor: CursorShape) -> Self
fn cursor(self, cursor: CursorShape) -> Self
显式设置鼠标悬停光标形状。
Sourcefn cursor_shape(self, cursor: CursorShape) -> Self
fn cursor_shape(self, cursor: CursorShape) -> Self
鼠标光标形状显式别名(避免与 TextInput::cursor(byte_offset) 冲突)。
fn cursor_pointer(self) -> Self
fn cursor_default(self) -> Self
fn cursor_text(self) -> Self
fn cursor_not_allowed(self) -> Self
fn cursor_grab(self) -> Self
fn cursor_grabbing(self) -> Self
fn mx(self, px: i16) -> Self
fn my(self, px: i16) -> Self
fn mt(self, px: i16) -> Self
fn mb(self, px: i16) -> Self
fn ml(self, px: i16) -> Self
fn mr(self, px: i16) -> Self
fn mx_0(self) -> Self
fn mx_1(self) -> Self
fn mx_2(self) -> Self
fn mx_3(self) -> Self
fn mx_4(self) -> Self
fn my_0(self) -> Self
fn my_1(self) -> Self
fn my_2(self) -> Self
fn my_3(self) -> Self
fn my_4(self) -> Self
fn mt_1(self) -> Self
fn mt_2(self) -> Self
fn mt_3(self) -> Self
fn mt_4(self) -> Self
fn mb_1(self) -> Self
fn mb_2(self) -> Self
fn mb_3(self) -> Self
fn mb_4(self) -> Self
fn ml_1(self) -> Self
fn ml_2(self) -> Self
fn ml_3(self) -> Self
fn ml_4(self) -> Self
fn mr_1(self) -> Self
fn mr_2(self) -> Self
fn mr_3(self) -> Self
fn mr_4(self) -> Self
fn min_w(self, px: i16) -> Self
fn max_w(self, px: i16) -> Self
fn min_h(self, px: i16) -> Self
fn max_h(self, px: i16) -> Self
fn align_self(self, align: AlignItems) -> Self
fn self_start(self) -> Self
fn self_center(self) -> Self
fn self_end(self) -> Self
fn self_stretch(self) -> Self
fn items_baseline(self) -> Self
fn z_index(self, z: i8) -> Self
Sourcefn inline_flex(self) -> Self
fn inline_flex(self) -> Self
行内弹性容器简写(等价 .flex_row())。
fn rounded_corners(self, radii: CornerRadii) -> Self
fn rounded_t(self, r: u8) -> Self
fn rounded_b(self, r: u8) -> Self
fn rounded_l(self, r: u8) -> Self
fn rounded_r(self, r: u8) -> Self
fn blend_mode(self, mode: BlendMode) -> Self
fn isolate(self) -> Self
fn blur(self, radius: u8) -> Self
fn color_matrix(self, matrix: ColorMatrix) -> Self
fn grayscale(self, amount: f32) -> Self
fn sepia(self, amount: f32) -> Self
fn saturate(self, amount: f32) -> Self
fn brightness(self, amount: f32) -> Self
fn contrast(self, amount: f32) -> Self
fn hue_rotate(self, deg: f32) -> Self
fn invert(self, amount: f32) -> Self
fn drop_shadow(self, blur: u8, offset_x: i8, offset_y: i8, color: Color) -> Self
fn backdrop_filter(self, filter: BackdropFilter) -> Self
fn backdrop_blur(self, radius: u8) -> Self
fn backdrop_acrylic(self, blur_radius: u8, tint: Color) -> Self
fn transform(self, t: Transform2D) -> Self
fn rotate_deg(self, deg: f32) -> Self
fn scale(self, sx: f32, sy: f32) -> Self
fn translate(self, tx: f32, ty: f32) -> Self
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".