From 0030bcbd33f5c4db60aac826552042e46b51c691 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 5 Feb 2020 00:23:22 +0100 Subject: Rename module `style` to `css` in `iced_web` --- web/src/css.rs | 162 +++++++++++++++++++++++++++++++++++++++++++ web/src/element.rs | 6 +- web/src/lib.rs | 10 +-- web/src/style.rs | 162 ------------------------------------------- web/src/widget.rs | 4 +- web/src/widget/button.rs | 10 +-- web/src/widget/checkbox.rs | 4 +- web/src/widget/column.rs | 16 ++--- web/src/widget/container.rs | 14 ++-- web/src/widget/image.rs | 4 +- web/src/widget/radio.rs | 4 +- web/src/widget/row.rs | 16 ++--- web/src/widget/scrollable.rs | 8 +-- web/src/widget/slider.rs | 4 +- web/src/widget/space.rs | 8 +-- web/src/widget/text.rs | 10 +-- web/src/widget/text_input.rs | 10 +-- 17 files changed, 226 insertions(+), 226 deletions(-) create mode 100644 web/src/css.rs delete mode 100644 web/src/style.rs (limited to 'web') diff --git a/web/src/css.rs b/web/src/css.rs new file mode 100644 index 00000000..df0938da --- /dev/null +++ b/web/src/css.rs @@ -0,0 +1,162 @@ +//! Style your widgets. +use crate::{bumpalo, Align, Color, Length}; + +use std::collections::BTreeMap; + +/// A CSS rule of a VDOM node. +#[derive(Debug)] +pub enum Rule { + /// Container with vertical distribution + Column, + + /// Container with horizonal distribution + Row, + + /// Padding of the container + Padding(u16), + + /// Spacing between elements + Spacing(u16), +} + +impl Rule { + /// Returns the class name of the [`Style`]. + /// + /// [`Style`]: enum.Style.html + pub fn class<'a>(&self) -> String { + match self { + Rule::Column => String::from("c"), + Rule::Row => String::from("r"), + Rule::Padding(padding) => format!("p-{}", padding), + Rule::Spacing(spacing) => format!("s-{}", spacing), + } + } + + /// Returns the declaration of the [`Style`]. + /// + /// [`Style`]: enum.Style.html + pub fn declaration<'a>(&self, bump: &'a bumpalo::Bump) -> &'a str { + let class = self.class(); + + match self { + Rule::Column => { + let body = "{ display: flex; flex-direction: column; }"; + + bumpalo::format!(in bump, ".{} {}", class, body).into_bump_str() + } + Rule::Row => { + let body = "{ display: flex; flex-direction: row; }"; + + bumpalo::format!(in bump, ".{} {}", class, body).into_bump_str() + } + Rule::Padding(padding) => bumpalo::format!( + in bump, + ".{} {{ box-sizing: border-box; padding: {}px }}", + class, + padding + ) + .into_bump_str(), + Rule::Spacing(spacing) => bumpalo::format!( + in bump, + ".c.{} > * {{ margin-bottom: {}px }} \ + .r.{} > * {{ margin-right: {}px }} \ + .c.{} > *:last-child {{ margin-bottom: 0 }} \ + .r.{} > *:last-child {{ margin-right: 0 }}", + class, + spacing, + class, + spacing, + class, + class + ) + .into_bump_str(), + } + } +} + +/// A cascading style sheet. +#[derive(Debug)] +pub struct Css<'a> { + rules: BTreeMap, +} + +impl<'a> Css<'a> { + /// Creates an empty style [`Sheet`]. + /// + /// [`Sheet`]: struct.Sheet.html + pub fn new() -> Self { + Css { + rules: BTreeMap::new(), + } + } + + /// Inserts the [`rule`] in the [`Sheet`], if it was not previously + /// inserted. + /// + /// It returns the class name of the provided [`Rule`]. + /// + /// [`Sheet`]: struct.Sheet.html + /// [`Rule`]: enum.Rule.html + pub fn insert(&mut self, bump: &'a bumpalo::Bump, rule: Rule) -> String { + let class = rule.class(); + + if !self.rules.contains_key(&class) { + let _ = self.rules.insert(class.clone(), rule.declaration(bump)); + } + + class + } + + /// Produces the VDOM node of the style [`Sheet`]. + /// + /// [`Sheet`]: struct.Sheet.html + pub fn node(self, bump: &'a bumpalo::Bump) -> dodrio::Node<'a> { + use dodrio::builder::*; + + let mut declarations = bumpalo::collections::Vec::new_in(bump); + + declarations.push(text("html { height: 100% }")); + declarations.push(text( + "body { height: 100%; margin: 0; padding: 0; font-family: sans-serif }", + )); + declarations.push(text("p { margin: 0 }")); + declarations.push(text( + "button { border: none; cursor: pointer; outline: none }", + )); + + for declaration in self.rules.values() { + declarations.push(text(*declaration)); + } + + style(bump).children(declarations).finish() + } +} + +/// Returns the style value for the given [`Length`]. +/// +/// [`Length`]: ../enum.Length.html +pub fn length(length: Length) -> String { + match length { + Length::Shrink => String::from("auto"), + Length::Units(px) => format!("{}px", px), + Length::Fill | Length::FillPortion(_) => String::from("100%"), + } +} + +/// Returns the style value for the given [`Color`]. +/// +/// [`Color`]: ../struct.Color.html +pub fn color(Color { r, g, b, a }: Color) -> String { + format!("rgba({}, {}, {}, {})", 255.0 * r, 255.0 * g, 255.0 * b, a) +} + +/// Returns the style value for the given [`Align`]. +/// +/// [`Align`]: ../enum.Align.html +pub fn align(align: Align) -> &'static str { + match align { + Align::Start => "flex-start", + Align::Center => "center", + Align::End => "flex-end", + } +} diff --git a/web/src/element.rs b/web/src/element.rs index 0315d7d6..93e73713 100644 --- a/web/src/element.rs +++ b/web/src/element.rs @@ -1,4 +1,4 @@ -use crate::{style, Bus, Color, Widget}; +use crate::{Bus, Color, Css, Widget}; use dodrio::bumpalo; use std::rc::Rc; @@ -57,7 +57,7 @@ impl<'a, Message> Element<'a, Message> { &self, bump: &'b bumpalo::Bump, bus: &Bus, - style_sheet: &mut style::Sheet<'b>, + style_sheet: &mut Css<'b>, ) -> dodrio::Node<'b> { self.widget.node(bump, bus, style_sheet) } @@ -89,7 +89,7 @@ where &self, bump: &'b bumpalo::Bump, bus: &Bus, - style_sheet: &mut style::Sheet<'b>, + style_sheet: &mut Css<'b>, ) -> dodrio::Node<'b> { self.widget .node(bump, &bus.map(self.mapper.clone()), style_sheet) diff --git a/web/src/lib.rs b/web/src/lib.rs index 0b9c0c3d..7b54a07a 100644 --- a/web/src/lib.rs +++ b/web/src/lib.rs @@ -63,11 +63,12 @@ mod bus; mod element; mod hasher; -pub mod style; +pub mod css; pub mod subscription; pub mod widget; pub use bus::Bus; +pub use css::Css; pub use dodrio; pub use element::Element; pub use hasher::Hasher; @@ -76,7 +77,6 @@ pub use iced_core::{ VerticalAlignment, }; pub use iced_futures::{executor, futures, Command}; -pub use style::Style; pub use subscription::Subscription; #[doc(no_inline)] @@ -241,13 +241,13 @@ where let mut ui = self.application.borrow_mut(); let element = ui.view(); - let mut style_sheet = style::Sheet::new(); + let mut css = Css::new(); - let node = element.widget.node(bump, &self.bus, &mut style_sheet); + let node = element.widget.node(bump, &self.bus, &mut css); div(bump) .attr("style", "width: 100%; height: 100%") - .children(vec![style_sheet.node(bump), node]) + .children(vec![css.node(bump), node]) .finish() } } diff --git a/web/src/style.rs b/web/src/style.rs deleted file mode 100644 index 4f72b22c..00000000 --- a/web/src/style.rs +++ /dev/null @@ -1,162 +0,0 @@ -//! Style your widgets. -use crate::{bumpalo, Align, Color, Length}; - -use std::collections::BTreeMap; - -/// The style of a VDOM node. -#[derive(Debug)] -pub enum Style { - /// Container with vertical distribution - Column, - - /// Container with horizonal distribution - Row, - - /// Padding of the container - Padding(u16), - - /// Spacing between elements - Spacing(u16), -} - -impl Style { - /// Returns the class name of the [`Style`]. - /// - /// [`Style`]: enum.Style.html - pub fn class<'a>(&self) -> String { - match self { - Style::Column => String::from("c"), - Style::Row => String::from("r"), - Style::Padding(padding) => format!("p-{}", padding), - Style::Spacing(spacing) => format!("s-{}", spacing), - } - } - - /// Returns the declaration of the [`Style`]. - /// - /// [`Style`]: enum.Style.html - pub fn declaration<'a>(&self, bump: &'a bumpalo::Bump) -> &'a str { - let class = self.class(); - - match self { - Style::Column => { - let body = "{ display: flex; flex-direction: column; }"; - - bumpalo::format!(in bump, ".{} {}", class, body).into_bump_str() - } - Style::Row => { - let body = "{ display: flex; flex-direction: row; }"; - - bumpalo::format!(in bump, ".{} {}", class, body).into_bump_str() - } - Style::Padding(padding) => bumpalo::format!( - in bump, - ".{} {{ box-sizing: border-box; padding: {}px }}", - class, - padding - ) - .into_bump_str(), - Style::Spacing(spacing) => bumpalo::format!( - in bump, - ".c.{} > * {{ margin-bottom: {}px }} \ - .r.{} > * {{ margin-right: {}px }} \ - .c.{} > *:last-child {{ margin-bottom: 0 }} \ - .r.{} > *:last-child {{ margin-right: 0 }}", - class, - spacing, - class, - spacing, - class, - class - ) - .into_bump_str(), - } - } -} - -/// A sheet of styles. -#[derive(Debug)] -pub struct Sheet<'a> { - styles: BTreeMap, -} - -impl<'a> Sheet<'a> { - /// Creates an empty style [`Sheet`]. - /// - /// [`Sheet`]: struct.Sheet.html - pub fn new() -> Self { - Self { - styles: BTreeMap::new(), - } - } - - /// Inserts the [`Style`] in the [`Sheet`], if it was not previously - /// inserted. - /// - /// It returns the class name of the provided [`Style`]. - /// - /// [`Sheet`]: struct.Sheet.html - /// [`Style`]: enum.Style.html - pub fn insert(&mut self, bump: &'a bumpalo::Bump, style: Style) -> String { - let class = style.class(); - - if !self.styles.contains_key(&class) { - let _ = self.styles.insert(class.clone(), style.declaration(bump)); - } - - class - } - - /// Produces the VDOM node of the style [`Sheet`]. - /// - /// [`Sheet`]: struct.Sheet.html - pub fn node(self, bump: &'a bumpalo::Bump) -> dodrio::Node<'a> { - use dodrio::builder::*; - - let mut declarations = bumpalo::collections::Vec::new_in(bump); - - declarations.push(text("html { height: 100% }")); - declarations.push(text( - "body { height: 100%; margin: 0; padding: 0; font-family: sans-serif }", - )); - declarations.push(text("p { margin: 0 }")); - declarations.push(text( - "button { border: none; cursor: pointer; outline: none }", - )); - - for declaration in self.styles.values() { - declarations.push(text(*declaration)); - } - - style(bump).children(declarations).finish() - } -} - -/// Returns the style value for the given [`Length`]. -/// -/// [`Length`]: ../enum.Length.html -pub fn length(length: Length) -> String { - match length { - Length::Shrink => String::from("auto"), - Length::Units(px) => format!("{}px", px), - Length::Fill | Length::FillPortion(_) => String::from("100%"), - } -} - -/// Returns the style value for the given [`Color`]. -/// -/// [`Color`]: ../struct.Color.html -pub fn color(Color { r, g, b, a }: Color) -> String { - format!("rgba({}, {}, {}, {})", 255.0 * r, 255.0 * g, 255.0 * b, a) -} - -/// Returns the style value for the given [`Align`]. -/// -/// [`Align`]: ../enum.Align.html -pub fn align(align: Align) -> &'static str { - match align { - Align::Start => "flex-start", - Align::Center => "center", - Align::End => "flex-end", - } -} diff --git a/web/src/widget.rs b/web/src/widget.rs index 0ac536bd..2e80346e 100644 --- a/web/src/widget.rs +++ b/web/src/widget.rs @@ -14,7 +14,7 @@ //! ``` //! //! [`Widget`]: trait.Widget.html -use crate::{style, Bus}; +use crate::{Bus, Css}; use dodrio::bumpalo; pub mod button; @@ -64,6 +64,6 @@ pub trait Widget { &self, bump: &'b bumpalo::Bump, _bus: &Bus, - style_sheet: &mut style::Sheet<'b>, + style_sheet: &mut Css<'b>, ) -> dodrio::Node<'b>; } diff --git a/web/src/widget/button.rs b/web/src/widget/button.rs index 6fef48ce..f3b3e69a 100644 --- a/web/src/widget/button.rs +++ b/web/src/widget/button.rs @@ -4,7 +4,7 @@ //! //! [`Button`]: struct.Button.html //! [`State`]: struct.State.html -use crate::{style, Background, Bus, Element, Length, Style, Widget}; +use crate::{css, Background, Bus, Css, Element, Length, Widget}; use dodrio::bumpalo; @@ -126,18 +126,18 @@ where &self, bump: &'b bumpalo::Bump, bus: &Bus, - style_sheet: &mut style::Sheet<'b>, + style_sheet: &mut Css<'b>, ) -> dodrio::Node<'b> { use dodrio::builder::*; - let width = style::length(self.width); + let width = css::length(self.width); let padding_class = - style_sheet.insert(bump, Style::Padding(self.padding)); + style_sheet.insert(bump, css::Rule::Padding(self.padding)); let background = match self.background { None => String::from("none"), Some(background) => match background { - Background::Color(color) => style::color(color), + Background::Color(color) => css::color(color), }, }; diff --git a/web/src/widget/checkbox.rs b/web/src/widget/checkbox.rs index 1e864875..d1d30048 100644 --- a/web/src/widget/checkbox.rs +++ b/web/src/widget/checkbox.rs @@ -1,4 +1,4 @@ -use crate::{style, Bus, Color, Element, Widget}; +use crate::{Bus, Color, Css, Element, Widget}; use dodrio::bumpalo; use std::rc::Rc; @@ -68,7 +68,7 @@ where &self, bump: &'b bumpalo::Bump, bus: &Bus, - _style_sheet: &mut style::Sheet<'b>, + _style_sheet: &mut Css<'b>, ) -> dodrio::Node<'b> { use dodrio::builder::*; diff --git a/web/src/widget/column.rs b/web/src/widget/column.rs index 9aa988ff..8e36231a 100644 --- a/web/src/widget/column.rs +++ b/web/src/widget/column.rs @@ -1,4 +1,4 @@ -use crate::{style, Align, Bus, Element, Length, Style, Widget}; +use crate::{css, Align, Bus, Css, Element, Length, Widget}; use dodrio::bumpalo; use std::u32; @@ -112,7 +112,7 @@ impl<'a, Message> Widget for Column<'a, Message> { &self, bump: &'b bumpalo::Bump, publish: &Bus, - style_sheet: &mut style::Sheet<'b>, + style_sheet: &mut Css<'b>, ) -> dodrio::Node<'b> { use dodrio::builder::*; @@ -122,18 +122,18 @@ impl<'a, Message> Widget for Column<'a, Message> { .map(|element| element.widget.node(bump, publish, style_sheet)) .collect(); - let column_class = style_sheet.insert(bump, Style::Column); + let column_class = style_sheet.insert(bump, css::Rule::Column); let spacing_class = - style_sheet.insert(bump, Style::Spacing(self.spacing)); + style_sheet.insert(bump, css::Rule::Spacing(self.spacing)); let padding_class = - style_sheet.insert(bump, Style::Padding(self.padding)); + style_sheet.insert(bump, css::Rule::Padding(self.padding)); - let width = style::length(self.width); - let height = style::length(self.height); + let width = css::length(self.width); + let height = css::length(self.height); - let align_items = style::align(self.align_items); + let align_items = css::align(self.align_items); // TODO: Complete styling div(bump) diff --git a/web/src/widget/container.rs b/web/src/widget/container.rs index bdc88979..55995795 100644 --- a/web/src/widget/container.rs +++ b/web/src/widget/container.rs @@ -1,4 +1,4 @@ -use crate::{bumpalo, style, Align, Bus, Element, Length, Style, Widget}; +use crate::{bumpalo, css, Align, Bus, Css, Element, Length, Widget}; /// An element decorating some content. /// @@ -94,17 +94,17 @@ where &self, bump: &'b bumpalo::Bump, bus: &Bus, - style_sheet: &mut style::Sheet<'b>, + style_sheet: &mut Css<'b>, ) -> dodrio::Node<'b> { use dodrio::builder::*; - let column_class = style_sheet.insert(bump, Style::Column); + let column_class = style_sheet.insert(bump, css::Rule::Column); - let width = style::length(self.width); - let height = style::length(self.height); + let width = css::length(self.width); + let height = css::length(self.height); - let align_items = style::align(self.horizontal_alignment); - let justify_content = style::align(self.vertical_alignment); + let align_items = css::align(self.horizontal_alignment); + let justify_content = css::align(self.vertical_alignment); let node = div(bump) .attr( diff --git a/web/src/widget/image.rs b/web/src/widget/image.rs index 413b663e..17e9b0f7 100644 --- a/web/src/widget/image.rs +++ b/web/src/widget/image.rs @@ -1,4 +1,4 @@ -use crate::{style, Bus, Element, Length, Widget}; +use crate::{Bus, Css, Element, Length, Widget}; use dodrio::bumpalo; @@ -57,7 +57,7 @@ impl Widget for Image { &self, bump: &'b bumpalo::Bump, _bus: &Bus, - _style_sheet: &mut style::Sheet<'b>, + _style_sheet: &mut Css<'b>, ) -> dodrio::Node<'b> { use dodrio::builder::*; diff --git a/web/src/widget/radio.rs b/web/src/widget/radio.rs index 6dd0ad45..4570639c 100644 --- a/web/src/widget/radio.rs +++ b/web/src/widget/radio.rs @@ -1,4 +1,4 @@ -use crate::{style, Bus, Color, Element, Widget}; +use crate::{Bus, Color, Css, Element, Widget}; use dodrio::bumpalo; @@ -76,7 +76,7 @@ where &self, bump: &'b bumpalo::Bump, bus: &Bus, - _style_sheet: &mut style::Sheet<'b>, + _style_sheet: &mut Css<'b>, ) -> dodrio::Node<'b> { use dodrio::builder::*; diff --git a/web/src/widget/row.rs b/web/src/widget/row.rs index c26cb91b..6e184cab 100644 --- a/web/src/widget/row.rs +++ b/web/src/widget/row.rs @@ -1,4 +1,4 @@ -use crate::{style, Align, Bus, Element, Length, Style, Widget}; +use crate::{css, Align, Bus, Css, Element, Length, Widget}; use dodrio::bumpalo; use std::u32; @@ -113,7 +113,7 @@ impl<'a, Message> Widget for Row<'a, Message> { &self, bump: &'b bumpalo::Bump, publish: &Bus, - style_sheet: &mut style::Sheet<'b>, + style_sheet: &mut Css<'b>, ) -> dodrio::Node<'b> { use dodrio::builder::*; @@ -123,18 +123,18 @@ impl<'a, Message> Widget for Row<'a, Message> { .map(|element| element.widget.node(bump, publish, style_sheet)) .collect(); - let row_class = style_sheet.insert(bump, Style::Row); + let row_class = style_sheet.insert(bump, css::Rule::Row); let spacing_class = - style_sheet.insert(bump, Style::Spacing(self.spacing)); + style_sheet.insert(bump, css::Rule::Spacing(self.spacing)); let padding_class = - style_sheet.insert(bump, Style::Padding(self.padding)); + style_sheet.insert(bump, css::Rule::Padding(self.padding)); - let width = style::length(self.width); - let height = style::length(self.height); + let width = css::length(self.width); + let height = css::length(self.height); - let justify_content = style::align(self.align_items); + let justify_content = css::align(self.align_items); // TODO: Complete styling div(bump) diff --git a/web/src/widget/scrollable.rs b/web/src/widget/scrollable.rs index f146e007..19810531 100644 --- a/web/src/widget/scrollable.rs +++ b/web/src/widget/scrollable.rs @@ -1,5 +1,5 @@ //! Navigate an endless amount of content with a scrollbar. -use crate::{bumpalo, style, Align, Bus, Column, Element, Length, Widget}; +use crate::{bumpalo, css, Align, Bus, Column, Css, Element, Length, Widget}; /// A widget that can vertically display an infinite amount of content with a /// scrollbar. @@ -105,12 +105,12 @@ where &self, bump: &'b bumpalo::Bump, bus: &Bus, - style_sheet: &mut style::Sheet<'b>, + style_sheet: &mut Css<'b>, ) -> dodrio::Node<'b> { use dodrio::builder::*; - let width = style::length(self.width); - let height = style::length(self.height); + let width = css::length(self.width); + let height = css::length(self.height); let node = div(bump) .attr( diff --git a/web/src/widget/slider.rs b/web/src/widget/slider.rs index 25c57933..843003e6 100644 --- a/web/src/widget/slider.rs +++ b/web/src/widget/slider.rs @@ -4,7 +4,7 @@ //! //! [`Slider`]: struct.Slider.html //! [`State`]: struct.State.html -use crate::{style, Bus, Element, Length, Widget}; +use crate::{Bus, Css, Element, Length, Widget}; use dodrio::bumpalo; use std::{ops::RangeInclusive, rc::Rc}; @@ -88,7 +88,7 @@ where &self, bump: &'b bumpalo::Bump, bus: &Bus, - _style_sheet: &mut style::Sheet<'b>, + _style_sheet: &mut Css<'b>, ) -> dodrio::Node<'b> { use dodrio::builder::*; use wasm_bindgen::JsCast; diff --git a/web/src/widget/space.rs b/web/src/widget/space.rs index baf4c80b..4ce52595 100644 --- a/web/src/widget/space.rs +++ b/web/src/widget/space.rs @@ -1,4 +1,4 @@ -use crate::{style, Bus, Element, Length, Widget}; +use crate::{css, Bus, Css, Element, Length, Widget}; use dodrio::bumpalo; /// An amount of empty space. @@ -44,12 +44,12 @@ impl<'a, Message> Widget for Space { &self, bump: &'b bumpalo::Bump, _publish: &Bus, - _style_sheet: &mut style::Sheet<'b>, + _css: &mut Css<'b>, ) -> dodrio::Node<'b> { use dodrio::builder::*; - let width = style::length(self.width); - let height = style::length(self.height); + let width = css::length(self.width); + let height = css::length(self.height); let style = bumpalo::format!( in bump, diff --git a/web/src/widget/text.rs b/web/src/widget/text.rs index 5b0bee55..c5b07747 100644 --- a/web/src/widget/text.rs +++ b/web/src/widget/text.rs @@ -1,5 +1,5 @@ use crate::{ - style, Bus, Color, Element, Font, HorizontalAlignment, Length, + css, Bus, Color, Css, Element, Font, HorizontalAlignment, Length, VerticalAlignment, Widget, }; use dodrio::bumpalo; @@ -112,15 +112,15 @@ impl<'a, Message> Widget for Text { &self, bump: &'b bumpalo::Bump, _publish: &Bus, - _style_sheet: &mut style::Sheet<'b>, + _style_sheet: &mut Css<'b>, ) -> dodrio::Node<'b> { use dodrio::builder::*; let content = bumpalo::format!(in bump, "{}", self.content); - let color = style::color(self.color.unwrap_or(Color::BLACK)); + let color = css::color(self.color.unwrap_or(Color::BLACK)); - let width = style::length(self.width); - let height = style::length(self.height); + let width = css::length(self.width); + let height = css::length(self.height); let text_align = match self.horizontal_alignment { HorizontalAlignment::Left => "left", diff --git a/web/src/widget/text_input.rs b/web/src/widget/text_input.rs index 078e05b2..1fea787a 100644 --- a/web/src/widget/text_input.rs +++ b/web/src/widget/text_input.rs @@ -4,7 +4,7 @@ //! //! [`TextInput`]: struct.TextInput.html //! [`State`]: struct.State.html -use crate::{bumpalo, style, Bus, Element, Length, Style, Widget}; +use crate::{bumpalo, css, Bus, Css, Element, Length, Widget}; use std::rc::Rc; /// A field that can be filled with text. @@ -133,15 +133,15 @@ where &self, bump: &'b bumpalo::Bump, bus: &Bus, - style_sheet: &mut style::Sheet<'b>, + style_sheet: &mut Css<'b>, ) -> dodrio::Node<'b> { use dodrio::builder::*; use wasm_bindgen::JsCast; - let width = style::length(self.width); - let max_width = style::length(self.max_width); + let width = css::length(self.width); + let max_width = css::length(self.max_width); let padding_class = - style_sheet.insert(bump, Style::Padding(self.padding)); + style_sheet.insert(bump, css::Rule::Padding(self.padding)); let on_change = self.on_change.clone(); let event_bus = bus.clone(); -- cgit