lit icon indicating copy to clipboard operation
lit copied to clipboard

[labs/gen-manifest] produce events/atrributes for mixins

Open sijakret opened this issue 8 months ago • 0 comments

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

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..

sijakret avatar Jun 25 '24 13:06 sijakret