Skip to content

Generated keyframe id  #346

@kof

Description

@kof

Currently keyframe id's we use in jss are global. The questions are:

  1. Do we want to generate a keyframe id to avoid conflicts?
  2. Do we want to allow user to define the keyframe id optionally and generate it by default?
  3. How would user access generated keyframe id?

Currently user can generate keyframe id like this, but I assume it is not very user friendly:

const identifier = Math.random()
export default {
  [`@keyframes ${identifier}`]: {
    from: {opacity: 0},
    to {opacity: 1}
  }
}

Todo

const sheet = jss.createStyleSheet({
  '@keyframes fadeIn': {
     from: {opacity: 0},
     to {opacity: 1}
  },
  button: {
    animationName: '$fadeIn',
  }
})

sheet.keyframes.fadeIn // @keyframes fadeIn-12378676134
  • generate id
  • register it in keyframes hash
  • docs
  • changelog
  • allow unscoped keyframes via global plugin
  • allow animation property?
  • if we could run ref replacer after jss-expand, we could also support animation: {name} syntax and we wouldn't have to support animationName if we could run it after camel case plugin
  • document inside of @global rule and global prefix
  • rename generateClassName

Metadata

Metadata

Assignees

Labels

complexity:highBest brains need to talk about it.enhancementNo kittens die if we don't do that.importantThe thing you do when you wake up!

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions