open-wc / custom-elements-manifest

Custom Elements Manifest is a file format that describes custom elements in your project.
https://custom-elements-manifest.open-wc.org/
243 stars 45 forks source link

Add support for custom states #247

Closed KonnorRogers closed 7 months ago

KonnorRogers commented 7 months ago

Fixes #246

I went with @customState instead of @state to disambiguate from @state() decorator from Lit.

netlify[bot] commented 7 months ago

Deploy Preview for custom-elements-manifest-analyzer ready!

Name Link
Latest commit fc085e386f8b0be81c6ce042d57583acd9c9dead
Latest deploy log https://app.netlify.com/sites/custom-elements-manifest-analyzer/deploys/66394eb0be10930008350907
Deploy Preview https://deploy-preview-247--custom-elements-manifest-analyzer.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

thepassle commented 7 months ago

should we also analyze for this.internals.states.add("foo")?

During class analysis we can see if this.attachInternals() is assigned to something, keep that something in memory, and then see if <whatever>.states.add("foo") is being called with a string ("foo") on it?

vospascal commented 7 months ago

Fixes #246

I went with @customState instead of @state to disambiguate from @state() decorator from Lit.

this for me feels correct but also not attached to a name as long as its specific enough if your looking bit in to the future there going to be more exposed things other then parts and these customState/cssState might be hard to keep these consistant like cross-root-aria proposal if the exportids is uses then you would get ids :)

KonnorRogers commented 7 months ago

should we also analyze for this.internals.states.add("foo")?

During class analysis we can see if this.attachInternals() is assigned to something, keep that something in memory, and then see if <whatever>.states.add("foo") is being called with a string ("foo") on it?

Sounds similar to how events are "discovered", so I don't see why not

thepassle commented 7 months ago

@KonnorRogers https://github.com/webcomponents/custom-elements-manifest/pull/128 was merged, can you update this PR? :)

KonnorRogers commented 7 months ago

@thepassle updated to use @cssstate and @cssState pushing to cssStates array.

I also updated the README to reflect the new supported tag.

I also added a new fixture directory for it.

thepassle commented 7 months ago

Thanks for the PR! Published in 0.10.0