4.0.8 • Published 5 years ago

rinss v4.0.8

Weekly downloads
3
License
MIT
Repository
-
Last release
5 years ago

Rinss: CSS-in-JS library that simplifies complex styles

Rinss is a tiny library (7.27KB gzipped) that automatically prefixes your styles for browsers with market shares larger than 0.1% (down to IE8). In addition, it supports the following tricks:

inline animations

{
    '.test0': {
        width: { from: 100, to: 200 }
    },
    '.test1': {
        background: { '0%': 'red', '50%': 'green', '100%': 'blue' }
    },
    '.test2': {
        height: {
            from: 100,
            to: 200,
            duration: 1000,
            delay: 100,
            easing: 'ease',
            count: 1,
            direction: 'reverse',
            fill: 'both', 
            state: 'running'
        }
    }
}

compiles to

@keyframes rinss-keyframes-0-0 {
    0% {
        width: 100px;
    }
    100% {
        width: 200px;
    }
}
.test0 {
    animation: rinss-keyframes-0-0 350ms both;
}
@keyframes rinss-keyframes-0-1 {
    0% {
        background: red;
    }
    50% {
        background: green;
    }
    100% {
        background: blue;
    }
}
.test1 {
    animation: rinss-keyframes-0-1 350ms both;
}
@keyframes rinss-keyframes-0-2 {
    0% {
        height: 100px;
    }
    100% {
        height: 200px;
    }
}
.test2 {
    animation: rinss-keyframes-0-2 1000ms 100ms ease 1 reverse both running;
}

inline transitions

{
    '.test0': {
        width: { to: 200 }
    },
    '.test1': {
        height: { to: 200, duration: 1000, delay: 100, easing: 'ease' }
    }
}

compiles to

.test0 {
    width: 200px;
    transition: width 350ms;
}
.test1 {
    height: 200px;
    transition: height 1000ms 100ms ease;
}

Independent transforms (CSS Transforms Level 2)

{
    '.test0': {
        translateX: 100,
        scale: 2,
        rotate: 45
    },
    '.test1': {
        translateX: { from: 0, to: 100 },
        scale: 2,
        rotate: 45
    }
}

compiles to

.test0 {
    transform: translateX(100px) scale(2) rotate(45deg);
}
.test1 {
    animation: rinss-keyframes-0-0 350ms both;
}
@keyframes rinss-keyframes-0-0 {
    0% {
        transform: translateX(0px) scale(2) rotate(45deg);
    }
    100% {
        transform: translateX(100px) scale(2) rotate(45deg);
    }
}

scoped media queries

{
    '.test0': {
        width: 200,
        '@media (max-width: 600px)': {
            width: 100
        }
    },
    '.test1': {
        background: 'red',
        '@media (max-width: 600px)': {
            background: 'blue'
        }
    }
}

compiles to

.test0 {
    width: 200px;
}
.test1 {
    background: red;
}
@media (max-width: 600px) {
    .test0 {
        width: 100px;
    }
    .test1 {
        background: blue;
    }
}

nested selectors

{
    '.test0': {
        width: 100,
        '.test1': {
            height: 100,
            ':hover': {
                height: { to: 300 }
            },
            '@media (max-width: 600px)': {
                height: 200
            }
        }
    }
}

compiles to

.test0 {
    width: 100px;
}
.test0 .test1 {
    height: 100px;
}
.test0 .test1:hover {
    height: 300px;
    transition: height 350ms;
}
@media (max-width: 600px) {
    .test0 .test1 {
        height: 200px;
    }
}

Example

import rinss from 'rinss';

const classes = rinss.create({
    button: {
        fontSize: 12,
        ':hover': {
            background: 'blue'
        }
    },
    ctaButton: {
        extend: 'button',
        ':hover': {
            background: 'green'
        }
    },
    '@media (min-width: 1024px)': {
        button: {
            width: 200
        }
    }
});

document.body.innerHTML = `
  <button class="${ classes.button }">Button</button>
  <button class="${ classes.ctaButton }">CTA Button</button>
`
4.0.8

5 years ago

4.0.5

5 years ago

4.0.7

5 years ago

4.0.6

5 years ago

4.0.4

5 years ago

4.0.3

5 years ago

4.0.2

5 years ago

4.0.1

5 years ago

4.0.0

5 years ago

3.5.9

6 years ago

3.5.8

6 years ago

3.5.7

6 years ago

3.5.6

6 years ago

3.5.5

6 years ago

3.5.4

6 years ago

3.5.3

6 years ago

3.5.2

6 years ago

3.5.1

6 years ago

3.5.0

6 years ago

3.4.2

6 years ago

3.4.1

6 years ago

3.4.0

6 years ago

3.3.4

6 years ago

3.3.3

6 years ago

3.3.2

6 years ago

3.3.1

6 years ago

3.3.0

6 years ago

3.3.0-alpha.0

6 years ago

3.2.9

6 years ago

3.2.8

6 years ago

3.2.7

6 years ago

3.2.7-alpha.0

6 years ago

3.2.6

6 years ago

3.2.5

6 years ago

3.2.4

6 years ago

3.2.3

6 years ago

3.2.2

6 years ago

3.2.1

6 years ago

3.2.0

6 years ago

3.1.1

6 years ago

3.1.0

6 years ago

3.0.4

6 years ago

3.0.3

6 years ago

3.0.2

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

3.0.0-alpha.0

6 years ago

2.3.11

6 years ago

2.3.10

6 years ago

2.3.9

6 years ago

2.3.8

6 years ago

2.3.7

6 years ago

2.3.6

6 years ago

2.3.5

6 years ago

2.3.4

6 years ago

2.3.3

6 years ago

2.3.2

6 years ago

2.3.1

6 years ago

2.3.0

6 years ago

2.2.39

6 years ago

2.2.38

6 years ago

2.2.37

6 years ago

2.2.36

6 years ago

2.2.35

6 years ago

2.2.34

6 years ago

2.2.32

6 years ago

2.2.31

6 years ago

2.2.30

6 years ago

2.2.30-alpha.0

6 years ago

2.2.29

6 years ago

2.2.28

6 years ago

2.2.27

6 years ago

2.2.26

6 years ago

2.2.25

6 years ago

2.2.24

6 years ago

2.2.23

6 years ago

2.2.22

6 years ago

2.2.21

6 years ago

2.2.20

6 years ago

2.2.19

6 years ago

2.2.18

6 years ago

2.2.17

6 years ago

2.2.16

6 years ago

2.2.15

6 years ago

2.2.14

6 years ago

2.2.13

6 years ago

2.2.12

6 years ago

2.2.11

6 years ago

2.2.10

6 years ago

2.2.9

6 years ago

2.2.8

6 years ago

2.2.7

6 years ago

2.2.6

6 years ago

2.2.5

6 years ago

2.2.4

6 years ago

2.2.3

6 years ago

2.2.2

6 years ago

2.2.1

6 years ago

2.2.0

6 years ago

2.1.29

6 years ago

2.1.28

6 years ago

2.1.27

6 years ago

2.1.26

6 years ago

2.1.25

6 years ago

2.1.24

6 years ago

2.1.23

6 years ago

2.1.22

6 years ago

2.1.21

6 years ago

2.1.20

6 years ago

2.1.19

6 years ago

2.1.18

6 years ago

2.1.17

6 years ago

2.1.16

6 years ago

2.1.15

6 years ago

2.1.14

6 years ago

2.1.13

6 years ago

2.1.12

6 years ago

2.1.11

6 years ago

2.1.10

6 years ago

2.1.9

6 years ago

2.1.8

6 years ago

2.1.7

6 years ago

2.1.6

6 years ago

2.1.6-alpha.1

6 years ago

2.1.6-alpha.0

6 years ago

2.1.5

6 years ago

2.1.4

6 years ago

2.1.3

6 years ago

2.1.2

6 years ago

2.1.1

6 years ago

2.1.0

6 years ago

2.0.9

6 years ago

2.0.8

6 years ago

2.0.8-alpha.5

6 years ago

2.0.8-alpha.4

6 years ago

2.0.8-alpha.3

6 years ago

2.0.8-alpha.2

6 years ago

2.0.8-alpha.1

6 years ago

2.0.8-alpha.0

6 years ago

2.0.7

6 years ago

2.0.7-alpha.0

6 years ago

2.0.6

6 years ago

2.0.5

6 years ago

2.0.5-alpha.6

6 years ago

2.0.5-alpha.5

6 years ago

2.0.5-alpha.3

6 years ago

2.0.5-alpha.2

6 years ago

2.0.5-alpha.1

6 years ago

2.0.4

6 years ago

2.0.3

6 years ago

2.0.3-alpha.1

6 years ago

2.0.3-alpha.0

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

2.0.0-alpha.29

6 years ago

2.0.0-alpha.28

6 years ago

2.0.0-alpha.27

6 years ago

2.0.0-alpha.26

6 years ago

2.0.0-alpha.25

6 years ago

2.0.0-alpha.24

6 years ago

2.0.0-alpha.23

6 years ago

2.0.0-alpha.22

6 years ago

2.0.0-alpha.21

6 years ago

2.0.0-alpha.20

6 years ago

2.0.0-alpha.19

6 years ago

2.0.0-alpha.18

6 years ago

2.0.0-alpha.17

6 years ago

2.0.0-alpha.16

6 years ago

2.0.0-alpha.15

6 years ago

2.0.0-alpha.14

6 years ago

2.0.0-alpha.13

6 years ago

2.0.0-alpha.12

6 years ago

2.0.0-alpha.11

6 years ago

2.0.0-alpha.10

6 years ago

2.0.0-alpha.9

6 years ago

2.0.0-alpha.8

6 years ago

2.0.0-alpha.7

6 years ago

2.0.0-alpha.6

6 years ago

2.0.0-alpha.5

6 years ago

2.0.0-alpha.4

6 years ago

2.0.0-alpha.3

6 years ago

2.0.0-alpha.2

6 years ago

2.0.0-alpha.1

6 years ago

2.0.0-alpha.0

6 years ago

1.7.3

6 years ago

1.7.3-alpha.0

6 years ago

1.7.2

6 years ago

1.7.1

6 years ago

1.7.0

6 years ago

1.6.9

6 years ago

1.6.8

6 years ago

1.6.7

6 years ago

1.6.6

6 years ago

1.6.5

6 years ago

1.6.4

6 years ago

1.6.3

6 years ago

1.6.2

6 years ago

1.6.1

6 years ago

1.6.0

6 years ago

1.5.9

6 years ago

1.5.8

6 years ago

1.5.7

7 years ago

1.5.6

7 years ago

1.5.5

7 years ago

1.5.4

7 years ago

1.5.3

7 years ago

1.5.2

7 years ago

1.5.1

7 years ago

1.5.0

7 years ago

1.4.9

7 years ago

1.4.8

7 years ago

1.4.7

7 years ago

1.4.6

7 years ago

1.4.5

7 years ago

1.4.4

7 years ago

1.4.3

7 years ago

1.4.2

7 years ago

1.4.1

7 years ago

1.4.0

7 years ago

1.3.9

7 years ago

1.3.8

7 years ago

1.3.7

7 years ago

1.3.6

7 years ago

1.3.5

7 years ago

1.3.4

7 years ago

1.3.3-alpha.1

7 years ago

1.3.3-alpha.0

7 years ago

1.3.2

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.9

7 years ago

1.2.8

7 years ago

1.2.7

7 years ago

1.2.6

7 years ago

1.2.5

7 years ago

1.2.4

7 years ago

1.2.3

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.10

7 years ago

1.1.9

7 years ago

1.1.8

7 years ago

1.1.7

7 years ago

1.1.6

7 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.1-alpha.1

7 years ago

1.1.1-alpha.0

7 years ago

1.1.0

7 years ago

1.1.0-alpha.6

7 years ago

1.1.0-alpha.5

7 years ago

1.1.0-alpha.4

7 years ago

1.1.0-alpha.3

7 years ago

1.1.0-alpha.2

7 years ago

1.1.0-alpha.1

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago