lit
lit copied to clipboard
[labs/gen-manifest] produce events/atrributes for mixins
Should this be an RFC?
- [X] This is not a substantial change
Which package is this a feature request for?
Analyzer (@lit-labs/analyzer)
Description
Hi,
I have a question/suggestion regarding custom-elements.json manifst generation.
@lit-labs/cli gen --manifest
produces a manifest where mixins for a component class are listed and linked in the class description (mixins
field).
If I read this comment correctly, downstream tooling is supposed to resolve these references (i.e. inherited, or "mixed-in" traits). They are not flattened to the class description in the manifest. This makes sense.
However, if a mixin contributes events, properties, etc.. these should be at least listed as part of the mixin description in the manifest then. From what I have tried and from what I can tell from the code, currently, mixins are (correctly) treaded as functions. I also could not find test fixtures that cover this. So currently I don't see a way to transitively extract all mixin contributions to a component class from the manifest. In practice discovering annotations from either the mixin function, the class that is constructed within the mixin, or the returned interface could be a way to transport things like @fires annotations and properties.
Alternatives and Workarounds
- Looking through the code, I get the impression that there are, in principle, plans to add dedicated emission code for mixins. Is this understanding correct?
- If not, is there currently a way to annotate mixins so that events, attributes and properties which they contribute can be discovered in the manifest?
On a side note if many hops are required to collect all the metadata for a component in a custom-elements.json manifest it maybe does make sense to have mode where the data is flattened, for the sake of simplicity for users..