custom-elements-manifest icon indicating copy to clipboard operation
custom-elements-manifest copied to clipboard

link events and attributes/properties

Open jogibear9988 opened this issue 3 years ago • 3 comments

@justinfagnani sometimes attributes&properties are linked to a specific event like it was in polymer. or in lit with this addon: https://github.com/morbidick/lit-element-notify

shouldn't this also be reflected in the schema?

jogibear9988 avatar May 09 '21 07:05 jogibear9988

#54

jogibear9988 avatar May 09 '21 07:05 jogibear9988

Also should we add this information in typescript somehow (with a comment, or a decorator), so a generator could extract this information directly into the manifest

jogibear9988 avatar May 27 '21 19:05 jogibear9988

This seems fine, but we need to figure out the use cases and the appropriate structure that meets them.

One could model this as class properties and methods having associated events. Maybe like:

events?: Array<EventReference>;
interface EventReference {
  name: string;

  type?: Type;

  /** Some note about when the event fires */
  description?: string;
}

This is general, but might it might be too general for some use cases. Like the Polymer-style property change events have a specific semantic across all properties - they fire when the property changes. With a general related events mechanism you couldn't assume that, and some properties may have multiple events. On the other hand I wouldn't want to bake in Polymer-style change events to a format describing a lot more than Polymer elements.

justinfagnani avatar Jul 02 '21 20:07 justinfagnani