Syntax

Description: state is defined as any pseudo-class that alters the state of an element.

ctr('<#selector>', {
state: {
option: {
key: '<identifier>'
delay: '<value>' | 0s
duration: '<value>' | 0.5s
property: '<string>' | <list> | <scope:properties>
ease: '<value>' | cubic-bezier(0.42, 0, 0.58, 1)
}
on: {
<property:A>: <...>
<property:B>: <...>
}
non: {
<property:A>: <...>
<property:B>: <...>
}
}
})
<#selector>:
state:
option:
key: <identifier>
delay: <value> | 0s
duration: <value> | 0.5s
property: <string> | <list> | <scope:properties>
ease: <value> | cubic-bezier(0.42, 0, 0.58, 1)
on:
<property:A>: <...>
<property:B>: <...>
non:
<property:A>: <...>
<property:B>: <...>
<#selector>:<identifier> {
<property:A>: <...>;
<property:B>: <...>;
transition-delay: 0s, 0s;
transition-duration: 0.5s, 0.5s;
transition-property: <property:A>, <property:B>;
transition-timing-function: cubic-bezier(0.42, 0, 0.58, 1), cubic-bezier(0.42, 0, 0.58, 1);
}
<#selector>:not(<identifier>) {
<property:A>: <...>;
<property:B>: <...>;
transition-delay: 0s, 0s;
transition-duration: 0.5s, 0.5s;
transition-property: <property:A>, <property:B>;
transition-timing-function: cubic-bezier(0.42, 0, 0.58, 1), cubic-bezier(0.42, 0, 0.58, 1);
}
ctr('<#selector>', {
// State Identifier
<identifier>: {
on: {
<property:A>: <...>
<property:B>: <...>
}
non: {
<property:A>: <...>
<property:B>: <...>
}
}
})
<#selector>:
# State Identifier
<identifier>:
on:
<property:A>: <...>
<property:B>: <...>
non:
<property:A>: <...>
<property:B>: <...>
<#selector>:<identifier> {
<property:A>: <...>;
<property:B>: <...>;
}
<#selector>:not(<identifier>) {
<property:A>: <...>;
<property:B>: <...>;
}

Notes

On

Description: An on Object in a state creates a pseudo-class condition for the <identifier> and transition properties for the enclosed CSS.

Edit
ctr('.test', {
width: 200px
hover: {
on: {
opacity: 1
height: 400px
}
}
})
.test:
width: 200px
hover:
on:
opacity: 1
height: 400px
.test {
width: 200px;
}
.test:hover {
opacity: 1;
height: 400px;
transition-delay: 0s, 0s;
transition-duration: 0.5s, 0.5s;
transition-property: opacity, height;
transition-timing-function: cubic-bezier(0.42, 0, 0.58, 1), cubic-bezier(0.42, 0, 0.58, 1);
}
ctr('.test', {
  width: 200px
  hover: {
    on: {
      opacity: 1
      height: 400px
    }
  }
})
.test {
  width: 200px;
}
.test:hover {
  opacity: 1;
  height: 400px;
  transition-delay: 0s, 0s;
  transition-duration: 0.5s, 0.5s;
  transition-property: opacity, height;
  transition-timing-function: cubic-bezier(0.42, 0, 0.58, 1), cubic-bezier(0.42, 0, 0.58, 1);
}
.test:
  width: 200px
  hover:
    on:
      opacity: 1
      height: 400px

Notes

Non

Description: A non Object in a state creates a negation pseudo-class condition for the <identifier> and transition properties for the enclosed CSS.

Edit
ctr('.test', {
width: 200px
hover: {
non: {
opacity: 1
height: 400px
}
}
})
.test:
width: 200px
hover:
non:
opacity: 1
height: 400px
.test {
width: 200px;
}
.test:not(:hover) {
opacity: 1;
height: 400px;
transition-delay: 0s, 0s;
transition-duration: 0.5s, 0.5s;
transition-property: opacity, height;
transition-timing-function: cubic-bezier(0.42, 0, 0.58, 1), cubic-bezier(0.42, 0, 0.58, 1);
}
ctr('.test', {
  width: 200px
  hover: {
    non: {
      opacity: 1
      height: 400px
    }
  }
})
.test {
  width: 200px;
}
.test:not(:hover) {
  opacity: 1;
  height: 400px;
  transition-delay: 0s, 0s;
  transition-duration: 0.5s, 0.5s;
  transition-property: opacity, height;
  transition-timing-function: cubic-bezier(0.42, 0, 0.58, 1), cubic-bezier(0.42, 0, 0.58, 1);
}
.test:
  width: 200px
  hover:
    non:
      opacity: 1
      height: 400px

Notes

Static

Description: A static Object in a state creates a pseudo-class condition and a matching negation condition, absent of transition properties, for the enclosed CSS regardless of the <identifier>. Additionally, a static Object can be defined in an auxiliary state Object to omit the generation of transition properties.

Edit
ctr('.test', {
width: 200px
hover: {
static: {
opacity: 1
height: 400px
}
}
})
.test:
width: 200px
hover:
static:
opacity: 1
height: 400px
.test {
width: 200px;
}
.test:hover {
opacity: 1;
height: 400px;
}
.test:not(:hover) {
opacity: 1;
height: 400px;
}
ctr('.test', {
  width: 200px
  hover: {
    static: {
      opacity: 1
      height: 400px
    }
  }
})
.test {
  width: 200px;
}
.test:hover {
  opacity: 1;
  height: 400px;
}
.test:not(:hover) {
  opacity: 1;
  height: 400px;
}
.test:
  width: 200px
  hover:
    static:
      opacity: 1
      height: 400px
Edit
ctr('.test', {
width: 200px
hover: {
// in an auxiliary state
on: {
height: 400px
static: {
opacity: 1
}
}
}
})
.test:
width: 200px
hover:
# in an auxiliary state
on:
height: 400px
static:
opacity: 1
.test {
width: 200px;
}
.test:hover {
opacity: 1;
height: 400px;
transition-delay: 0s;
transition-duration: 0.5s;
transition-property: height;
transition-timing-function: cubic-bezier(0.42, 0, 0.58, 1);
}
ctr('.test', {
  width: 200px
  hover: {
    // in an auxiliary state
    on: {
      height: 400px
      static: {
        opacity: 1
      }
    }
  }
})
.test {
  width: 200px;
}
.test:hover {
  opacity: 1;
  height: 400px;
  transition-delay: 0s;
  transition-duration: 0.5s;
  transition-property: height;
  transition-timing-function: cubic-bezier(0.42, 0, 0.58, 1);
}
.test:
  width: 200px
  hover:
    # in an auxiliary state
    on:
      height: 400px
      static:
        opacity: 1

Notes

Static Identifier

Description: Any state <identifier> defined in global option stateOmitList is considered a static <identifier> and no transition properties are generated for the enclosed CSS.

Edit
ctr('.test', {
width: 200px
link: {
on: {
color: red
}
non: {
color: blue
}
}
})
.test:
width: 200px
link:
on:
color: red
non:
color: blue
.test {
width: 200px;
}
.test:link {
color: #f00;
}
.test:not(:link) {
color: #00f;
}
ctr('.test', {
  width: 200px
  link: {
    on: {
      color: red
    }
    non: {
      color: blue
    }
  }
})
.test {
  width: 200px;
}
.test:link {
  color: #f00;
}
.test:not(:link) {
  color: #00f;
}
.test:
  width: 200px
  link:
    on:
      color: red
    non:
      color: blue

Notes

Common

Description: A common Object in a state creates a pseudo-class condition and a matching negation condition for the <identifier>.

Edit
ctr('.test', {
width: 200px
hover: {
// merged into both on and non
common: {
option: {
duration: 1s
}
transform: {
translateZ: 0
}
}
on: {
transform: {
translateY: 20
}
}
non: {
transform: {
translateY: 0
}
}
}
})
.test:
width: 200px
hover:
# merged into both on and non
common:
option:
duration: 1s
transform:
translateZ: 0
on:
transform:
translateY: 20
non:
transform:
translateY: 0
.test {
width: 200px;
}
.test:hover {
transition-delay: 0s;
transition-duration: 1s;
transition-property: transform;
transform: translateZ(0) translateY(20);
transition-timing-function: cubic-bezier(0.42, 0, 0.58, 1);
}
.test:not(:hover) {
transition-delay: 0s;
transition-duration: 1s;
transition-property: transform;
transform: translateZ(0) translateY(0);
transition-timing-function: cubic-bezier(0.42, 0, 0.58, 1);
}
ctr('.test', {
  width: 200px
  hover: {
    // merged into both on and non
    common: {
      option: {
        duration: 1s
      }
      transform: {
        translateZ: 0
      }
    }
    on: {
      transform: {
        translateY: 20
      }
    }
    non: {
      transform: {
        translateY: 0
      }
    }
  }
})
.test {
  width: 200px;
}
.test:hover {
  transition-delay: 0s;
  transition-duration: 1s;
  transition-property: transform;
  transform: translateZ(0) translateY(20);
  transition-timing-function: cubic-bezier(0.42, 0, 0.58, 1);
}
.test:not(:hover) {
  transition-delay: 0s;
  transition-duration: 1s;
  transition-property: transform;
  transform: translateZ(0) translateY(0);
  transition-timing-function: cubic-bezier(0.42, 0, 0.58, 1);
}
.test:
  width: 200px
  hover:
    # merged into both on and non
    common:
      option:
        duration: 1s
      transform:
        translateZ: 0
    on:
      transform:
        translateY: 20
    non:
      transform:
        translateY: 0

Notes

Option

Description: An option Object in a state, on, non, or common Object alters the default transition values in the scope it is defined.

Edit
ctr('.test', {
width: 200px
hover: {
// option values applied to both on and non
option: {
// transition-duration
duration: 1s
// transition-delay
delay: 0.5s
// transition-timing-function
ease: 'ease-in'
}
on: {
background: red
opacity: 1
}
non: {
background: blue
opacity: 0.5
}
}
})
.test:
width: 200px
hover:
# option values applied to both on and non
option:
# transition-duration
duration: 1s
# transition-delay
delay: 0.5s
# transition-timing-function
ease: ease-in
on:
background: red
opacity: 1
non:
background: blue
opacity: 0.5
.test {
width: 200px;
}
.test:hover {
opacity: 1;
background: #f00;
transition-duration: 1s, 1s;
transition-delay: 0.5s, 0.5s;
transition-property: background, opacity;
transition-timing-function: ease-in, ease-in;
}
.test:not(:hover) {
opacity: 0.5;
background: #00f;
transition-duration: 1s, 1s;
transition-delay: 0.5s, 0.5s;
transition-property: background, opacity;
transition-timing-function: ease-in, ease-in;
}
ctr('.test', {
  width: 200px
  hover: {
    // option values applied to both on and non
    option: {
      // transition-duration
      duration: 1s
      // transition-delay
      delay: 0.5s
      // transition-timing-function
      ease: 'ease-in'
    }
    on: {
      background: red
      opacity: 1
    }
    non: {
      background: blue
      opacity: 0.5
    }
  }
})
.test {
  width: 200px;
}
.test:hover {
  opacity: 1;
  background: #f00;
  transition-duration: 1s, 1s;
  transition-delay: 0.5s, 0.5s;
  transition-property: background, opacity;
  transition-timing-function: ease-in, ease-in;
}
.test:not(:hover) {
  opacity: 0.5;
  background: #00f;
  transition-duration: 1s, 1s;
  transition-delay: 0.5s, 0.5s;
  transition-property: background, opacity;
  transition-timing-function: ease-in, ease-in;
}
.test:
  width: 200px
  hover:
    # option values applied to both on and non
    option:
      # transition-duration
      duration: 1s
      # transition-delay
      delay: 0.5s
      # transition-timing-function
      ease: ease-in
    on:
      background: red
      opacity: 1
    non:
      background: blue
      opacity: 0.5
Edit
ctr('.test', {
width: 200px
hover: {
// applied to both on and non
option: {
ease: 'ease-in'
delay: 0.25s
}
on: {
// option values only applied to on
option: {
duration: 1s
}
opacity: 1
background: red
}
non: {
// option values only applied to non
option: {
duration: 2s
// overrides option
ease: 'ease-out'
}
opacity: 0.5
background: blue
}
}
})
.test:
width: 200px
hover:
# applied to both on and non
option:
ease: ease-in
delay: 0.25s
on:
# option values only applied to on
option:
duration: 1s
opacity: 1
background: red
non:
# option values only applied to non
option:
duration: 2s
# overrides option
ease: ease-out
opacity: 0.5
background: blue
.test {
width: 200px;
}
.test:hover {
opacity: 1;
background: #f00;
transition-duration: 1s, 1s;
transition-delay: 0.25s, 0.25s;
transition-property: background, opacity;
transition-timing-function: ease-in, ease-in;
}
.test:not(:hover) {
opacity: 0.5;
background: #00f;
transition-duration: 2s, 2s;
transition-delay: 0.25s, 0.25s;
transition-property: background, opacity;
transition-timing-function: ease-out, ease-out;
}
ctr('.test', {
  width: 200px
  hover: {
    // applied to both on and non
    option: {
     ease: 'ease-in'
     delay: 0.25s
    }
    on: {
      // option values only applied to on
      option: {
        duration: 1s
      }
      opacity: 1
      background: red
    }
    non: {
      // option values only applied to non
      option: {
        duration: 2s
        // overrides option
        ease: 'ease-out'
      }
      opacity: 0.5
      background: blue
    }
  }
})
.test {
  width: 200px;
}
.test:hover {
  opacity: 1;
  background: #f00;
  transition-duration: 1s, 1s;
  transition-delay: 0.25s, 0.25s;
  transition-property: background, opacity;
  transition-timing-function: ease-in, ease-in;
}
.test:not(:hover) {
  opacity: 0.5;
  background: #00f;
  transition-duration: 2s, 2s;
  transition-delay: 0.25s, 0.25s;
  transition-property: background, opacity;
  transition-timing-function: ease-out, ease-out;
}
.test:
  width: 200px
  hover:
    # applied to both on and non
    option:
     ease: ease-in
     delay: 0.25s
    on:
      # option values only applied to on
      option:
        duration: 1s
      opacity: 1
      background: red
    non:
      # option values only applied to non
      option:
        duration: 2s
        # overrides option
        ease: ease-out
      opacity: 0.5
      background: blue

Notes

Implicit Auxiliary

Description: A state Object absent an auxiliary state such as on, non, or static is an implicit state. An implicit state creates a pseudo-class condition for the <identifier> and transition properties for the enclosed CSS as well as a negation condition absent of the raw CSS for the <identifier> at the scope level it is defined.

Edit
ctr('.test', {
width: 200px
hover: {
opacity: 1
height: 400px
}
})
.test:
width: 200px
hover:
opacity: 1
height: 400px
.test {
width: 200px;
}
.test:hover {
opacity: 1;
height: 400px;
transition-delay: 0s, 0s;
transition-duration: 0.5s, 0.5s;
transition-property: opacity, height;
transition-timing-function: cubic-bezier(0.42, 0, 0.58, 1), cubic-bezier(0.42, 0, 0.58, 1);
}
.test:not(:hover) {
transition-delay: 0s, 0s;
transition-duration: 0.5s, 0.5s;
transition-property: opacity, height;
transition-timing-function: cubic-bezier(0.42, 0, 0.58, 1), cubic-bezier(0.42, 0, 0.58, 1);
}
ctr('.test', {
  width: 200px
  hover: {
    opacity: 1
    height: 400px
  }
})
.test {
  width: 200px;
}
.test:hover {
  opacity: 1;
  height: 400px;
  transition-delay: 0s, 0s;
  transition-duration: 0.5s, 0.5s;
  transition-property: opacity, height;
  transition-timing-function: cubic-bezier(0.42, 0, 0.58, 1), cubic-bezier(0.42, 0, 0.58, 1);
}
.test:not(:hover) {
  transition-delay: 0s, 0s;
  transition-duration: 0.5s, 0.5s;
  transition-property: opacity, height;
  transition-timing-function: cubic-bezier(0.42, 0, 0.58, 1), cubic-bezier(0.42, 0, 0.58, 1);
}
.test:
  width: 200px
  hover:
    opacity: 1
    height: 400px

Notes