Files
moon-gpui/src/style/styled.mbt
T

1046 lines
23 KiB
MoonBit

// Hand-written `Styled` methods, ported from gpui/src/styled.rs and the small
// gpui_macros style macros (visibility, position, overflow, border color,
// box shadow).
//
// The `Styled` trait itself is generated from this file by
// tools/gen_style.py: every `impl Styled with fn NAME(self : Self, ...) -> Self`
// block here becomes a trait method. Parameters must carry type annotations.
// Rerun the generator after adding or renaming a method.
///|
let ellipsis : String = "…"
///|
fn update_text(
style : StyleRefinement,
f : (TextStyleRefinement) -> TextStyleRefinement,
) -> Unit {
style.text = f(style.text)
}
///|
fn update_underline(
style : StyleRefinement,
f : (UnderlineStyle) -> UnderlineStyle,
) -> Unit {
let current = match style.text.underline {
Some(underline) => underline
Option::None => Default::default()
}
style.text = { ..style.text, underline: Some(f(current)), }
}
///|
fn update_grid_location(
style : StyleRefinement,
f : (@geometry.GridLocation) -> @geometry.GridLocation,
) -> Unit {
let current = match style.grid_location {
Some(location) => location
Option::None => Default::default()
}
style.grid_location = Some(f(current))
}
// --- visibility / display -------------------------------------------------
///|
/// Paints the element (the default).
impl Styled with fn visible(self : Self) -> Self {
self.style().visibility = Some(Visible)
self
}
///|
/// Lays out the element but does not paint it.
impl Styled with fn invisible(self : Self) -> Self {
self.style().visibility = Some(Hidden)
self
}
///|
/// `display: block`.
impl Styled with fn block(self : Self) -> Self {
self.style().display = Some(Block)
self
}
///|
/// `display: flex`.
impl Styled with fn flex(self : Self) -> Self {
self.style().display = Some(Flex)
self
}
///|
/// `display: grid`.
impl Styled with fn grid(self : Self) -> Self {
self.style().display = Some(Grid)
self
}
///|
/// `display: none`: removes the element from layout.
impl Styled with fn hidden(self : Self) -> Self {
self.style().display = Some(Display::None)
self
}
// --- position / overflow ----------------------------------------------------
///|
/// `position: relative`.
impl Styled with fn relative(self : Self) -> Self {
self.style().position = Some(Relative)
self
}
///|
/// `position: absolute`.
impl Styled with fn absolute(self : Self) -> Self {
self.style().position = Some(Absolute)
self
}
///|
/// Clips overflowing content on both axes.
impl Styled with fn overflow_hidden(self : Self) -> Self {
let style = self.style()
style.overflow = { x: Some(Hidden), y: Some(Hidden), }
self
}
///|
/// Clips overflowing content horizontally.
impl Styled with fn overflow_x_hidden(self : Self) -> Self {
let style = self.style()
style.overflow = { ..style.overflow, x: Some(Hidden), }
self
}
///|
/// Clips overflowing content vertically.
impl Styled with fn overflow_y_hidden(self : Self) -> Self {
let style = self.style()
style.overflow = { ..style.overflow, y: Some(Hidden), }
self
}
///|
/// Space reserved for scrollbars.
impl Styled with fn scrollbar_width(
self : Self,
width : &@geometry.IntoAbsoluteLength,
) -> Self {
self.style().scrollbar_width = Some(width.into_absolute_length())
self
}
// --- cursor / border / shadow ------------------------------------------------
///|
/// The cursor shown while hovering.
impl Styled with fn cursor(self : Self, cursor : CursorStyle) -> Self {
self.style().mouse_cursor = Some(cursor)
self
}
///|
/// The border color.
impl Styled with fn border_color(self : Self, color : &@color.IntoHsla) -> Self {
self.style().border_color = Some(color.into_hsla())
self
}
///|
/// Dashed borders.
impl Styled with fn border_dashed(self : Self) -> Self {
self.style().border_style = Some(Dashed)
self
}
///|
/// Sets the box shadows.
impl Styled with fn shadow(self : Self, shadows : Array[BoxShadow]) -> Self {
self.style().box_shadow = Some(shadows)
self
}
///|
/// Removes all box shadows.
impl Styled with fn shadow_none(self : Self) -> Self {
self.style().box_shadow = Some([])
self
}
///|
fn shadow_color(alpha : Double) -> @color.Hsla {
@color.hsla(0.0, 0.0, 0.0, alpha)
}
///|
fn shadow_at(y : Double, alpha : Double) -> BoxShadow {
BoxShadow::new(@geometry.px(0.0), @geometry.px(y), shadow_color(alpha))
}
///|
/// Tailwind `shadow-2xs`.
impl Styled with fn shadow_2xs(self : Self) -> Self {
self.style().box_shadow = Some([shadow_at(1.0, 0.05)])
self
}
///|
/// Tailwind `shadow-xs`.
impl Styled with fn shadow_xs(self : Self) -> Self {
self.style().box_shadow = Some([
shadow_at(1.0, 0.05).blur_radius(@geometry.px(2.0)),
])
self
}
///|
/// Tailwind `shadow-sm`.
impl Styled with fn shadow_sm(self : Self) -> Self {
self.style().box_shadow = Some([
shadow_at(1.0, 0.1).blur_radius(@geometry.px(3.0)),
shadow_at(1.0, 0.1)
.blur_radius(@geometry.px(2.0))
.spread_radius(@geometry.px(-1.0)),
])
self
}
///|
/// Tailwind `shadow-md`.
impl Styled with fn shadow_md(self : Self) -> Self {
self.style().box_shadow = Some([
shadow_at(4.0, 0.1)
.blur_radius(@geometry.px(6.0))
.spread_radius(@geometry.px(-1.0)),
shadow_at(2.0, 0.1)
.blur_radius(@geometry.px(4.0))
.spread_radius(@geometry.px(-2.0)),
])
self
}
///|
/// Tailwind `shadow-lg`.
impl Styled with fn shadow_lg(self : Self) -> Self {
self.style().box_shadow = Some([
shadow_at(10.0, 0.1)
.blur_radius(@geometry.px(15.0))
.spread_radius(@geometry.px(-3.0)),
shadow_at(4.0, 0.1)
.blur_radius(@geometry.px(6.0))
.spread_radius(@geometry.px(-4.0)),
])
self
}
///|
/// Tailwind `shadow-xl`.
impl Styled with fn shadow_xl(self : Self) -> Self {
self.style().box_shadow = Some([
shadow_at(20.0, 0.1)
.blur_radius(@geometry.px(25.0))
.spread_radius(@geometry.px(-5.0)),
shadow_at(8.0, 0.1)
.blur_radius(@geometry.px(10.0))
.spread_radius(@geometry.px(-6.0)),
])
self
}
///|
/// Tailwind `shadow-2xl`.
impl Styled with fn shadow_2xl(self : Self) -> Self {
self.style().box_shadow = Some([
shadow_at(25.0, 0.25)
.blur_radius(@geometry.px(50.0))
.spread_radius(@geometry.px(-12.0)),
])
self
}
// --- flex -----------------------------------------------------------------------
///|
/// `flex-direction: column`.
impl Styled with fn flex_col(self : Self) -> Self {
self.style().flex_direction = Some(Column)
self
}
///|
/// `flex-direction: column-reverse`.
impl Styled with fn flex_col_reverse(self : Self) -> Self {
self.style().flex_direction = Some(ColumnReverse)
self
}
///|
/// `flex-direction: row`.
impl Styled with fn flex_row(self : Self) -> Self {
self.style().flex_direction = Some(Row)
self
}
///|
/// `flex-direction: row-reverse`.
impl Styled with fn flex_row_reverse(self : Self) -> Self {
self.style().flex_direction = Some(RowReverse)
self
}
///|
/// Grow and shrink, ignoring the initial size (`flex: 1 1 0%`).
impl Styled with fn flex_1(self : Self) -> Self {
let style = self.style()
style.flex_grow = Some(1.0)
style.flex_shrink = Some(1.0)
style.flex_basis = Some(@geometry.relative(0.0).to_length())
self
}
///|
/// Grow and shrink from the initial size (`flex: 1 1 auto`).
impl Styled with fn flex_auto(self : Self) -> Self {
let style = self.style()
style.flex_grow = Some(1.0)
style.flex_shrink = Some(1.0)
style.flex_basis = Some(Auto)
self
}
///|
/// Shrink but do not grow (`flex: 0 1 auto`).
impl Styled with fn flex_initial(self : Self) -> Self {
let style = self.style()
style.flex_grow = Some(0.0)
style.flex_shrink = Some(1.0)
style.flex_basis = Some(Auto)
self
}
///|
/// Neither grow nor shrink (`flex: none`).
impl Styled with fn flex_none(self : Self) -> Self {
let style = self.style()
style.flex_grow = Some(0.0)
style.flex_shrink = Some(0.0)
style.flex_basis = Some(Auto)
self
}
///|
/// The initial main size.
impl Styled with fn flex_basis(self : Self, basis : &@geometry.IntoLength) -> Self {
self.style().flex_basis = Some(basis.into_length())
self
}
///|
impl Styled with fn flex_grow(self : Self, grow : Double) -> Self {
self.style().flex_grow = Some(grow)
self
}
///|
impl Styled with fn flex_grow_0(self : Self) -> Self {
self.style().flex_grow = Some(0.0)
self
}
///|
impl Styled with fn flex_grow_1(self : Self) -> Self {
self.style().flex_grow = Some(1.0)
self
}
///|
impl Styled with fn flex_shrink(self : Self, shrink : Double) -> Self {
self.style().flex_shrink = Some(shrink)
self
}
///|
impl Styled with fn flex_shrink_0(self : Self) -> Self {
self.style().flex_shrink = Some(0.0)
self
}
///|
impl Styled with fn flex_shrink_1(self : Self) -> Self {
self.style().flex_shrink = Some(1.0)
self
}
///|
impl Styled with fn flex_wrap(self : Self) -> Self {
self.style().flex_wrap = Some(Wrap)
self
}
///|
impl Styled with fn flex_wrap_reverse(self : Self) -> Self {
self.style().flex_wrap = Some(WrapReverse)
self
}
///|
impl Styled with fn flex_nowrap(self : Self) -> Self {
self.style().flex_wrap = Some(NoWrap)
self
}
// --- alignment --------------------------------------------------------------
///|
impl Styled with fn items_start(self : Self) -> Self {
self.style().align_items = Some(FlexStart)
self
}
///|
impl Styled with fn items_end(self : Self) -> Self {
self.style().align_items = Some(FlexEnd)
self
}
///|
impl Styled with fn items_center(self : Self) -> Self {
self.style().align_items = Some(Center)
self
}
///|
impl Styled with fn items_baseline(self : Self) -> Self {
self.style().align_items = Some(Baseline)
self
}
///|
impl Styled with fn items_stretch(self : Self) -> Self {
self.style().align_items = Some(Stretch)
self
}
///|
impl Styled with fn self_start(self : Self) -> Self {
self.style().align_self = Some(Start)
self
}
///|
impl Styled with fn self_end(self : Self) -> Self {
self.style().align_self = Some(End)
self
}
///|
impl Styled with fn self_flex_start(self : Self) -> Self {
self.style().align_self = Some(FlexStart)
self
}
///|
impl Styled with fn self_flex_end(self : Self) -> Self {
self.style().align_self = Some(FlexEnd)
self
}
///|
impl Styled with fn self_center(self : Self) -> Self {
self.style().align_self = Some(Center)
self
}
///|
impl Styled with fn self_baseline(self : Self) -> Self {
self.style().align_self = Some(Baseline)
self
}
///|
impl Styled with fn self_stretch(self : Self) -> Self {
self.style().align_self = Some(Stretch)
self
}
///|
impl Styled with fn justify_start(self : Self) -> Self {
self.style().justify_content = Some(AlignContent::Start)
self
}
///|
impl Styled with fn justify_end(self : Self) -> Self {
self.style().justify_content = Some(AlignContent::End)
self
}
///|
impl Styled with fn justify_center(self : Self) -> Self {
self.style().justify_content = Some(AlignContent::Center)
self
}
///|
impl Styled with fn justify_between(self : Self) -> Self {
self.style().justify_content = Some(SpaceBetween)
self
}
///|
impl Styled with fn justify_around(self : Self) -> Self {
self.style().justify_content = Some(SpaceAround)
self
}
///|
impl Styled with fn justify_evenly(self : Self) -> Self {
self.style().justify_content = Some(SpaceEvenly)
self
}
///|
/// Resets `align-content` to its initial value.
impl Styled with fn content_normal(self : Self) -> Self {
self.style().align_content = Option::None
self
}
///|
impl Styled with fn content_center(self : Self) -> Self {
self.style().align_content = Some(AlignContent::Center)
self
}
///|
impl Styled with fn content_start(self : Self) -> Self {
self.style().align_content = Some(AlignContent::FlexStart)
self
}
///|
impl Styled with fn content_end(self : Self) -> Self {
self.style().align_content = Some(AlignContent::FlexEnd)
self
}
///|
impl Styled with fn content_between(self : Self) -> Self {
self.style().align_content = Some(SpaceBetween)
self
}
///|
impl Styled with fn content_around(self : Self) -> Self {
self.style().align_content = Some(SpaceAround)
self
}
///|
impl Styled with fn content_evenly(self : Self) -> Self {
self.style().align_content = Some(SpaceEvenly)
self
}
///|
impl Styled with fn content_stretch(self : Self) -> Self {
self.style().align_content = Some(AlignContent::Stretch)
self
}
///|
/// Preferred width / height ratio.
impl Styled with fn aspect_ratio(self : Self, ratio : Double) -> Self {
self.style().aspect_ratio = Some(ratio)
self
}
///|
impl Styled with fn aspect_square(self : Self) -> Self {
self.style().aspect_ratio = Some(1.0)
self
}
// --- background / opacity ---------------------------------------------------
///|
/// The background fill: an `Hsla`, `Rgba`, `Background` or `Fill`.
impl Styled with fn bg(self : Self, fill : &IntoFill) -> Self {
self.style().background = Some(fill.into_fill())
self
}
///|
impl Styled with fn opacity(self : Self, opacity : Double) -> Self {
self.style().opacity = Some(opacity)
self
}
// --- text -------------------------------------------------------------------
///|
impl Styled with fn whitespace_normal(self : Self) -> Self {
update_text(self.style(), fn(t) { { ..t, white_space: Some(Normal), } })
self
}
///|
impl Styled with fn whitespace_nowrap(self : Self) -> Self {
update_text(self.style(), fn(t) { { ..t, white_space: Some(Nowrap), } })
self
}
///|
/// Truncates overflowing text at the end with "…".
impl Styled with fn text_ellipsis(self : Self) -> Self {
update_text(self.style(), fn(t) {
{ ..t, text_overflow: Some(Truncate(ellipsis)), }
})
self
}
///|
/// Truncates overflowing text at the start with "…".
impl Styled with fn text_ellipsis_start(self : Self) -> Self {
update_text(self.style(), fn(t) {
{ ..t, text_overflow: Some(TruncateStart(ellipsis)), }
})
self
}
///|
/// Truncates overflowing text in the middle with "…".
impl Styled with fn text_ellipsis_middle(self : Self) -> Self {
update_text(self.style(), fn(t) {
{ ..t, text_overflow: Some(TruncateMiddle(ellipsis)), }
})
self
}
///|
impl Styled with fn text_overflow(self : Self, overflow : TextOverflow) -> Self {
update_text(self.style(), fn(t) { { ..t, text_overflow: Some(overflow), } })
self
}
///|
impl Styled with fn text_align(self : Self, align : TextAlign) -> Self {
update_text(self.style(), fn(t) { { ..t, text_align: Some(align), } })
self
}
///|
impl Styled with fn text_left(self : Self) -> Self {
self.text_align(Left)
}
///|
impl Styled with fn text_center(self : Self) -> Self {
self.text_align(TextAlign::Center)
}
///|
impl Styled with fn text_right(self : Self) -> Self {
self.text_align(Right)
}
///|
/// One line, clipped, with an ellipsis.
impl Styled with fn truncate(self : Self) -> Self {
self.overflow_hidden().whitespace_nowrap().text_ellipsis()
}
///|
/// At most `lines` lines; also clips overflow.
impl Styled with fn line_clamp(self : Self, lines : Int32) -> Self {
update_text(self.style(), fn(t) { { ..t, line_clamp: Some(lines), } })
self.overflow_hidden()
}
///|
impl Styled with fn text_color(self : Self, color : &@color.IntoHsla) -> Self {
let color = color.into_hsla()
update_text(self.style(), fn(t) { { ..t, color: Some(color), } })
self
}
///|
impl Styled with fn text_bg(self : Self, color : &@color.IntoHsla) -> Self {
let color = color.into_hsla()
update_text(self.style(), fn(t) { { ..t, background_color: Some(color), } })
self
}
///|
impl Styled with fn font_weight(self : Self, weight : @font.FontWeight) -> Self {
update_text(self.style(), fn(t) { { ..t, font_weight: Some(weight), } })
self
}
///|
impl Styled with fn text_size(self : Self, size : &@geometry.IntoAbsoluteLength) -> Self {
let size = size.into_absolute_length()
update_text(self.style(), fn(t) { { ..t, font_size: Some(size), } })
self
}
///|
fn set_font_size(style : StyleRefinement, size : Double) -> Unit {
update_text(style, fn(t) {
{ ..t, font_size: Some(@geometry.rems(size).to_absolute()), }
})
}
///|
/// 0.75rem.
impl Styled with fn text_xs(self : Self) -> Self {
set_font_size(self.style(), 0.75)
self
}
///|
/// 0.875rem.
impl Styled with fn text_sm(self : Self) -> Self {
set_font_size(self.style(), 0.875)
self
}
///|
/// 1rem.
impl Styled with fn text_base(self : Self) -> Self {
set_font_size(self.style(), 1.0)
self
}
///|
/// 1.125rem.
impl Styled with fn text_lg(self : Self) -> Self {
set_font_size(self.style(), 1.125)
self
}
///|
/// 1.25rem.
impl Styled with fn text_xl(self : Self) -> Self {
set_font_size(self.style(), 1.25)
self
}
///|
/// 1.5rem.
impl Styled with fn text_2xl(self : Self) -> Self {
set_font_size(self.style(), 1.5)
self
}
///|
/// 1.875rem.
impl Styled with fn text_3xl(self : Self) -> Self {
set_font_size(self.style(), 1.875)
self
}
///|
impl Styled with fn italic(self : Self) -> Self {
update_text(self.style(), fn(t) { { ..t, font_style: Some(Italic), } })
self
}
///|
impl Styled with fn not_italic(self : Self) -> Self {
update_text(self.style(), fn(t) {
{ ..t, font_style: Some(@font.FontStyle::Normal), }
})
self
}
///|
/// A 1px underline in the text color.
impl Styled with fn underline(self : Self) -> Self {
update_text(self.style(), fn(t) {
{
..t,
underline: Some({ ..Default::default(), thickness: @geometry.px(1.0), }),
}
})
self
}
///|
/// A 1px strikethrough in the text color.
impl Styled with fn line_through(self : Self) -> Self {
update_text(self.style(), fn(t) {
{
..t,
strikethrough: Some({
..Default::default(),
thickness: @geometry.px(1.0),
}),
}
})
self
}
///|
/// Removes the underline.
impl Styled with fn text_decoration_none(self : Self) -> Self {
update_text(self.style(), fn(t) { { ..t, underline: Option::None, } })
self
}
///|
impl Styled with fn text_decoration_color(self : Self, color : &@color.IntoHsla) -> Self {
let color = color.into_hsla()
update_underline(self.style(), fn(u) { { ..u, color: Some(color), } })
self
}
///|
impl Styled with fn text_decoration_solid(self : Self) -> Self {
update_underline(self.style(), fn(u) { { ..u, wavy: false, } })
self
}
///|
impl Styled with fn text_decoration_wavy(self : Self) -> Self {
update_underline(self.style(), fn(u) { { ..u, wavy: true, } })
self
}
///|
fn set_underline_thickness(style : StyleRefinement, thickness : Double) -> Unit {
update_underline(style, fn(u) { { ..u, thickness: @geometry.px(thickness), } })
}
///|
impl Styled with fn text_decoration_0(self : Self) -> Self {
set_underline_thickness(self.style(), 0.0)
self
}
///|
impl Styled with fn text_decoration_1(self : Self) -> Self {
set_underline_thickness(self.style(), 1.0)
self
}
///|
impl Styled with fn text_decoration_2(self : Self) -> Self {
set_underline_thickness(self.style(), 2.0)
self
}
///|
impl Styled with fn text_decoration_4(self : Self) -> Self {
set_underline_thickness(self.style(), 4.0)
self
}
///|
impl Styled with fn text_decoration_8(self : Self) -> Self {
set_underline_thickness(self.style(), 8.0)
self
}
///|
impl Styled with fn font_family(self : Self, family : String) -> Self {
update_text(self.style(), fn(t) { { ..t, font_family: Some(family), } })
self
}
///|
impl Styled with fn font_features(self : Self, features : @font.FontFeatures) -> Self {
update_text(self.style(), fn(t) { { ..t, font_features: Some(features), } })
self
}
///|
/// Sets family, features, weight, style and fallbacks from `font`.
impl Styled with fn font(self : Self, font : @font.Font) -> Self {
update_text(self.style(), fn(t) {
{
..t,
font_family: Some(font.family),
font_features: Some(font.features),
font_weight: Some(font.weight),
font_style: Some(font.style),
font_fallbacks: font.fallbacks,
}
})
self
}
///|
/// Line height; fractions are relative to the font size.
impl Styled with fn line_height(
self : Self,
line_height : &@geometry.IntoDefiniteLength,
) -> Self {
let line_height = line_height.into_definite_length()
update_text(self.style(), fn(t) { { ..t, line_height: Some(line_height), } })
self
}
// --- grid -------------------------------------------------------------------
///|
impl Styled with fn grid_cols(self : Self, cols : Int32) -> Self {
self.style().grid_cols = Some({ repeat: cols, min_size: Zero, })
self
}
///|
impl Styled with fn grid_cols_min_content(self : Self, cols : Int32) -> Self {
self.style().grid_cols = Some({ repeat: cols, min_size: MinContent, })
self
}
///|
impl Styled with fn grid_cols_max_content(self : Self, cols : Int32) -> Self {
self.style().grid_cols = Some({ repeat: cols, min_size: MaxContent, })
self
}
///|
impl Styled with fn grid_rows(self : Self, rows : Int32) -> Self {
self.style().grid_rows = Some({ repeat: rows, min_size: Zero, })
self
}
///|
impl Styled with fn grid_rows_min_content(self : Self, rows : Int32) -> Self {
self.style().grid_rows = Some({ repeat: rows, min_size: MinContent, })
self
}
///|
impl Styled with fn grid_rows_max_content(self : Self, rows : Int32) -> Self {
self.style().grid_rows = Some({ repeat: rows, min_size: MaxContent, })
self
}
///|
impl Styled with fn col_start(self : Self, start : Int32) -> Self {
update_grid_location(self.style(), fn(l) {
{ ..l, column: { ..l.column, start: Line(start), }, }
})
self
}
///|
impl Styled with fn col_start_auto(self : Self) -> Self {
update_grid_location(self.style(), fn(l) {
{ ..l, column: { ..l.column, start: Auto, }, }
})
self
}
///|
impl Styled with fn col_end(self : Self, end : Int32) -> Self {
update_grid_location(self.style(), fn(l) {
{ ..l, column: { ..l.column, end: Line(end), }, }
})
self
}
///|
impl Styled with fn col_end_auto(self : Self) -> Self {
update_grid_location(self.style(), fn(l) {
{ ..l, column: { ..l.column, end: Auto, }, }
})
self
}
///|
impl Styled with fn col_span(self : Self, span : Int32) -> Self {
update_grid_location(self.style(), fn(l) {
{ ..l, column: { start: Span(span), end: Span(span), }, }
})
self
}
///|
impl Styled with fn col_span_full(self : Self) -> Self {
update_grid_location(self.style(), fn(l) {
{ ..l, column: { start: Line(1), end: Line(-1), }, }
})
self
}
///|
impl Styled with fn row_start(self : Self, start : Int32) -> Self {
update_grid_location(self.style(), fn(l) {
{ ..l, row: { ..l.row, start: Line(start), }, }
})
self
}
///|
impl Styled with fn row_start_auto(self : Self) -> Self {
update_grid_location(self.style(), fn(l) {
{ ..l, row: { ..l.row, start: Auto, }, }
})
self
}
///|
impl Styled with fn row_end(self : Self, end : Int32) -> Self {
update_grid_location(self.style(), fn(l) {
{ ..l, row: { ..l.row, end: Line(end), }, }
})
self
}
///|
impl Styled with fn row_end_auto(self : Self) -> Self {
update_grid_location(self.style(), fn(l) {
{ ..l, row: { ..l.row, end: Auto, }, }
})
self
}
///|
impl Styled with fn row_span(self : Self, span : Int32) -> Self {
update_grid_location(self.style(), fn(l) {
{ ..l, row: { start: Span(span), end: Span(span), }, }
})
self
}
///|
impl Styled with fn row_span_full(self : Self) -> Self {
update_grid_location(self.style(), fn(l) {
{ ..l, row: { start: Line(1), end: Line(-1), }, }
})
self
}
// --- debugging --------------------------------------------------------------
///|
/// Paints a debug outline around this element.
impl Styled with fn debug(self : Self) -> Self {
self.style().debug = Some(true)
self
}
///|
/// Paints debug outlines around every descendant.
impl Styled with fn debug_below(self : Self) -> Self {
self.style().debug_below = Some(true)
self
}
// --- StyleRefinement is itself Styled ---------------------------------------
///|
pub impl Styled for StyleRefinement with fn style(self) {
self
}