[][src]Crate jss

JSS Rust

Implementation of JSS for Rust. Use css styles without css with identical properties. Part of Rise-UI project.

Documentation

Usage

Add to your Cargo.toml.

[dependencies]
jss = { git = "https://github.com/rise-ui/jss-rs" }
extern crate jss;

Examples

Simple JSON element parsing example

extern crate failure;
extern crate jss;

use jss::traits::*;
use jss::types::*;

fn main() -> Result<(), failure::Error> {
    let source = r#"
  {
    "borderTopRightRadius": 10,
    "borderTopStyle": "solid",
    "alignContent": "center",
    "borderTopWidth": 10,
     
    "filter": [
      "blur(20)"
    ],
    "transform": [
      "translate(10px,10%)",
      "rotate(40deg,15rad)"
    ]
  }
  "#;

    let style = StyleBuilder::default().source(source).parse()?;
    println!("{:#?}", style);

    Ok(())
}

Or if you need YAML...

extern crate failure;
extern crate jss;

use jss::traits::*;
use jss::types::*;

fn main() -> Result<(), failure::Error> {
    let source = r#"
---
borderTopRightRadius: 10
borderTopStyle: solid
alignContent: center
borderTopWidth: 10
filter:
- blur(20)
transform:
- translate(10px,10%)
- rotate(40deg,15rad)
  "#;

    let style = StyleBuilder::default().source(source).source_type(SourceFormat::Yaml).parse()?;
    println!("{:#?}", style);

    Ok(())
}

Modules

animation

Animations module for create simple tick based animations for one or more properties

parser
properties
traits
types

All common functional types

utils

Various utils