Skip to main content

StyledExt

Trait StyledExt 

Source
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§

Source

fn style_ext_mut(&mut self) -> &mut StyleExt

获取内部 StyleExt 可变引用。

Provided Methods§

Source

fn hover(self, f: impl FnOnce(StyleRefinement) -> StyleRefinement) -> Self

GPUI 风格悬停态样式闭包(如 .hover(|s| s.bg(rgb(0xf5f5f5)).border_color(rgb(0x171717))))。

Source

fn active(self, f: impl FnOnce(StyleRefinement) -> StyleRefinement) -> Self

GPUI 风格按下态样式闭包(如 .active(|s| s.bg(rgb(0xe5e5e5))))。

Source

fn active_style( self, f: impl FnOnce(StyleRefinement) -> StyleRefinement, ) -> Self

按下态样式闭包显式别名(避免与少数自带 .active(id) 固有方法的导航组件冲突)。

Source

fn focus(self, f: impl FnOnce(StyleRefinement) -> StyleRefinement) -> Self

GPUI 风格聚焦态样式闭包(如 .focus(|s| s.border_1().border_color(rgb(0x3b82f6))))。

Source

fn overflow_hidden(self) -> Self

启用溢出裁剪(等价 CSS overflow: hidden)。

Source

fn overflow_visible(self) -> Self

关闭溢出裁剪(等价 CSS overflow: visible)。

Source

fn overflow_scroll(self) -> Self

启用自动测量边界的滚动视口(等价 CSS overflow: auto/scroll)。

Source

fn overflow_y_scroll(self) -> Self

启用垂直方向自动滚动视口(等价 CSS overflow-y: auto/scroll)。

Source

fn overflow_x_scroll(self) -> Self

启用水平方向自动滚动视口(等价 CSS overflow-x: auto/scroll)。

Source

fn scrollable(self, max_scroll: i16) -> Self

启用指定最大滚动距离的可滚动视口。

Source

fn transition(self) -> Self

默认过渡动画(150ms 颜色 + 不透明度 + 几何边界)。

Source

fn transition_colors(self) -> Self

颜色过渡简写(150ms 背景/边框/文本色平滑过渡)。

Source

fn transition_opacity(self) -> Self

不透明度过渡简写(150ms 淡入淡出)。

Source

fn transition_all(self) -> Self

全属性过渡简写(150ms 颜色 + 边界 + 不透明度)。

Source

fn transition_none(self) -> Self

显式禁用过渡动画(等价 CSS transition: none)。

Source

fn animate_color(self, duration: Duration) -> Self

设置颜色跨帧过渡时长。

Source

fn animate_bg(self, duration: Duration) -> Self

设置背景色跨帧过渡时长。

Source

fn animate_bounds(self, duration: Duration) -> Self

设置几何边界跨帧过渡时长。

Source

fn animate_opacity(self, duration: Duration) -> Self

设置不透明度跨帧过渡时长。

Source

fn animate_all(self, duration: Duration) -> Self

设置全属性跨帧过渡时长。

Source

fn duration(self, duration: Duration) -> Self

调整过渡动画时长。

Source

fn duration_75(self) -> Self

Source

fn duration_100(self) -> Self

Source

fn duration_150(self) -> Self

Source

fn duration_200(self) -> Self

Source

fn duration_300(self) -> Self

Source

fn duration_500(self) -> Self

Source

fn ease(self, easing: Easing) -> Self

调整过渡动画缓动曲线。

Source

fn ease_linear(self) -> Self

Source

fn ease_in(self) -> Self

Source

fn ease_out(self) -> Self

Source

fn ease_in_out(self) -> Self

Source

fn ease_spring(self) -> Self

Source

fn delay(self, delay: Duration) -> Self

设置动画延迟时间。

Source

fn loop_mode(self, mode: LoopMode) -> Self

声明动画循环模式。

Source

fn fade_in(self, duration: Duration) -> Self

声明入场淡入动画。

Source

fn slide_in(self, dx: i16, dy: i16, duration: Duration) -> Self

声明入场滑入淡入动画。

Source

fn text_color(self, color: Color) -> Self

设置容器级可继承文本颜色。

Source

fn text_size(self, px: u8) -> Self

设置容器级可继承字号(像素)。

Source

fn text_xs(self) -> Self

Source

fn text_sm(self) -> Self

Source

fn text_base(self) -> Self

Source

fn text_lg(self) -> Self

Source

fn text_xl(self) -> Self

Source

fn text_2xl(self) -> Self

Source

fn text_3xl(self) -> Self

Source

fn opacity(self, alpha: u8) -> Self

设置组件整体不透明度(0..=255)。

Source

fn opacity_f(self, alpha: f32) -> Self

浮点不透明度简写(0.0..=1.0)。

Source

fn shadow(self, blur: u8, offset_x: i8, offset_y: i8, color: Color) -> Self

设置解析式 SDF 外阴影。

Source

fn shadow_none(self) -> Self

Source

fn shadow_sm(self) -> Self

Source

fn shadow_md(self) -> Self

Source

fn shadow_lg(self) -> Self

Source

fn shadow_xl(self) -> Self

Source

fn cursor(self, cursor: CursorShape) -> Self

显式设置鼠标悬停光标形状。

Source

fn cursor_shape(self, cursor: CursorShape) -> Self

鼠标光标形状显式别名(避免与 TextInput::cursor(byte_offset) 冲突)。

Source

fn cursor_pointer(self) -> Self

Source

fn cursor_default(self) -> Self

Source

fn cursor_text(self) -> Self

Source

fn cursor_not_allowed(self) -> Self

Source

fn cursor_grab(self) -> Self

Source

fn cursor_grabbing(self) -> Self

Source

fn mx(self, px: i16) -> Self

Source

fn my(self, px: i16) -> Self

Source

fn mt(self, px: i16) -> Self

Source

fn mb(self, px: i16) -> Self

Source

fn ml(self, px: i16) -> Self

Source

fn mr(self, px: i16) -> Self

Source

fn mx_0(self) -> Self

Source

fn mx_1(self) -> Self

Source

fn mx_2(self) -> Self

Source

fn mx_3(self) -> Self

Source

fn mx_4(self) -> Self

Source

fn my_0(self) -> Self

Source

fn my_1(self) -> Self

Source

fn my_2(self) -> Self

Source

fn my_3(self) -> Self

Source

fn my_4(self) -> Self

Source

fn mt_1(self) -> Self

Source

fn mt_2(self) -> Self

Source

fn mt_3(self) -> Self

Source

fn mt_4(self) -> Self

Source

fn mb_1(self) -> Self

Source

fn mb_2(self) -> Self

Source

fn mb_3(self) -> Self

Source

fn mb_4(self) -> Self

Source

fn ml_1(self) -> Self

Source

fn ml_2(self) -> Self

Source

fn ml_3(self) -> Self

Source

fn ml_4(self) -> Self

Source

fn mr_1(self) -> Self

Source

fn mr_2(self) -> Self

Source

fn mr_3(self) -> Self

Source

fn mr_4(self) -> Self

Source

fn min_w(self, px: i16) -> Self

Source

fn max_w(self, px: i16) -> Self

Source

fn min_h(self, px: i16) -> Self

Source

fn max_h(self, px: i16) -> Self

Source

fn align_self(self, align: AlignItems) -> Self

Source

fn self_start(self) -> Self

Source

fn self_center(self) -> Self

Source

fn self_end(self) -> Self

Source

fn self_stretch(self) -> Self

Source

fn items_baseline(self) -> Self

Source

fn z_index(self, z: i8) -> Self

Source

fn relative(self) -> Self

语义化相对定位标记(Velox 子节点天然相对父容器定位)。

Source

fn block(self) -> Self

块级垂直容器简写(等价 .flex_col())。

Source

fn inline_flex(self) -> Self

行内弹性容器简写(等价 .flex_row())。

Source

fn rounded_corners(self, radii: CornerRadii) -> Self

Source

fn rounded_t(self, r: u8) -> Self

Source

fn rounded_b(self, r: u8) -> Self

Source

fn rounded_l(self, r: u8) -> Self

Source

fn rounded_r(self, r: u8) -> Self

Source

fn blend_mode(self, mode: BlendMode) -> Self

Source

fn isolate(self) -> Self

Source

fn blur(self, radius: u8) -> Self

Source

fn color_matrix(self, matrix: ColorMatrix) -> Self

Source

fn grayscale(self, amount: f32) -> Self

Source

fn sepia(self, amount: f32) -> Self

Source

fn saturate(self, amount: f32) -> Self

Source

fn brightness(self, amount: f32) -> Self

Source

fn contrast(self, amount: f32) -> Self

Source

fn hue_rotate(self, deg: f32) -> Self

Source

fn invert(self, amount: f32) -> Self

Source

fn drop_shadow(self, blur: u8, offset_x: i8, offset_y: i8, color: Color) -> Self

Source

fn backdrop_filter(self, filter: BackdropFilter) -> Self

Source

fn backdrop_blur(self, radius: u8) -> Self

Source

fn backdrop_acrylic(self, blur_radius: u8, tint: Color) -> Self

Source

fn transform(self, t: Transform2D) -> Self

Source

fn rotate_deg(self, deg: f32) -> Self

Source

fn scale(self, sx: f32, sy: f32) -> Self

Source

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".

Implementors§