LWC Metadata tweak

Issue #1932 resolved
Xander Victory created an issue

I’d like to propose another tweak to the Metadata xsd relating to LWC.

Existing:

<!-- IC2 END -->
<xsd:complexType name="Targets">
    <xsd:sequence>
        <xsd:element maxOccurs="unbounded" minOccurs="0" name="target" type="xsd:string"/>
    </xsd:sequence>
</xsd:complexType>

It’d be helpful to massage it to an enum, based on the defined values (targets section) - I frequently have to look them up

<xsd:complexType name="Targets">
    <xsd:sequence>
        <xsd:element maxOccurs="unbounded" minOccurs="0" name="target" type="LWCTarget"/>
    </xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="LWCTarget">
    <xsd:restriction base="xsd:string">
        <xsd:enumeration value="lightningCommunity__Default" />
        <xsd:enumeration value="lightningCommunity__Page" />
        <xsd:enumeration value="lightningCommunity__Page_Layout" />
        <xsd:enumeration value="lightningCommunity__Theme_Layout" />
        <xsd:enumeration value="lightningSnapin__ChatHeader" />
        <xsd:enumeration value="lightningSnapin__ChatMessage" />
        <xsd:enumeration value="lightningSnapin__Minimized" />
        <xsd:enumeration value="lightningSnapin__PreChat" />
        <xsd:enumeration value="lightning__AppPage" />
        <xsd:enumeration value="lightning__FlowScreen" />
        <xsd:enumeration value="lightning__HomePage" />
        <xsd:enumeration value="lightning__Inbox" />
        <xsd:enumeration value="lightning__RecordAction" />
        <xsd:enumeration value="lightning__RecordPage" />
        <xsd:enumeration value="lightning__Tab" />
        <xsd:enumeration value="lightning__UtilityBar" />
    </xsd:restriction>
</xsd:simpleType>

Comments (3)

  1. Scott Wells repo owner

    Ah, yeah...that seems like a good one as well. Today's release is ready to go, but I'll look at getting that into the next one. Keep things like this coming. I'd love to get the LWC HTML/JS stuff as tight as possible, especially given how fuzzy much of it can be without intellisense-style support.

  2. Scott Wells repo owner

    Change committed for inclusion in the next build. I actually went quite a bit beyond what was requested here and added support for everything detailed in the linked documentation where a known set of values can be specified. It should provide a much better direct authoring experience for targets and target configs now.

  3. Log in to comment