backport 1771

This commit is contained in:
Cory LaViska
2023-12-06 16:26:15 -05:00
parent 8acfc4c9de
commit fcf0a136f2
3 changed files with 15 additions and 3 deletions

View File

@@ -38,6 +38,7 @@ export default {
customElementsManifest.package = { name, description, version, author, homepage, license };
}
},
// Infer tag names because we no longer use @customElement decorators.
{
name: 'wa-infer-tag-names',
@@ -66,6 +67,7 @@ export default {
}
}
},
// Parse custom jsDoc tags
{
name: 'wa-custom-tags',
@@ -137,6 +139,7 @@ export default {
}
}
},
{
name: 'wa-react-event-names',
analyzePhase({ ts, node, moduleDoc }) {
@@ -155,6 +158,7 @@ export default {
}
}
},
{
name: 'wa-translate-module-paths',
packageLinkPhase({ customElementsManifest }) {
@@ -191,6 +195,7 @@ export default {
});
}
},
// Generate custom VS Code data
customElementVsCodePlugin({
outdir,
@@ -202,6 +207,7 @@ export default {
}
]
}),
customElementJetBrainsPlugin({
outdir: './dist',
excludeCss: true,

View File

@@ -160,7 +160,7 @@
</td>
<td>
{% if prop.type.text %}
<code>{{ prop.type.text | markdownInline | safe }}</code>
<code>{{ prop.type.text | trimPipes | markdownInline | safe }}</code>
{% else %}
-
{% endif %}
@@ -211,7 +211,7 @@
<td>{{ event.description | markdownInline | safe }}</td>
<td>
{% if event.type.text %}
<code>{{ event.type.text }}</code>
<code>{{ event.type.text | trimPipes }}</code>
{% else %}
-
{% endif %}
@@ -245,7 +245,7 @@
{% if method.parameters.length %}
<code>
{% for param in method.parameters %}
{{ param.name }}: {{ param.type.text }}{% if not loop.last %},{% endif %}
{{ param.name }}: {{ param.type.text | trimPipes }}{% if not loop.last %},{% endif %}
{% endfor %}
</code>
{% else %}

View File

@@ -96,6 +96,12 @@ module.exports = function (eleventyConfig) {
return webAwesomeFlavoredMarkdown.renderInline(content);
});
// Trims whitespace and pipes from the start and end of a string. Useful for CEM types, which can be pipe-delimited.
// With Prettier 3, this means a leading pipe will exist if the line wraps.
eleventyConfig.addFilter('trimPipes', content => {
return content.replace(/^(\s|\|)/g, '').replace(/(\s|\|)$/g, '');
});
eleventyConfig.addFilter('classNameToComponentName', className => {
let name = capitalCase(className.replace(/^Wa/, ''));
if (name === 'Qr Code') name = 'QR Code'; // manual override