Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for ElementInternals state #246

Closed
KonnorRogers opened this issue Apr 24, 2024 · 6 comments · Fixed by #247
Closed

Support for ElementInternals state #246

KonnorRogers opened this issue Apr 24, 2024 · 6 comments · Fixed by #247

Comments

@KonnorRogers
Copy link
Contributor

KonnorRogers commented Apr 24, 2024

Would it be possible to add a tag for @state to document CSS Custom States?

@thepassle
Copy link
Member

Can you elaborate/show some examples/documentation?

@KonnorRogers
Copy link
Contributor Author

@thepassle

/** 
 * @state open - When the element is open
 */
class MyEl extends HTMLElement {
  constructor () {
    super()
    this.internals = this.attachInternals()
  }

  open () {
    this.internals.states.add("open")
  }
}

Example of CSS Custom states:

my-el { display: none; }

my-el:state(open) {
  display: block;
}

Also open to @customState since @state can be confused with the decorator from Lit

@thepassle
Copy link
Member

I think we should go with @csscustomstate or @cssstate to align with @csspart and @cssproperty

@KonnorRogers
Copy link
Contributor Author

Works for me.

@cssstate scared me because it seems really easy to typo.

@Lookwe69
Copy link

Why not @internalstate ?

@thepassle
Copy link
Member

because its not consistent with @csspart and @cssproperty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants