mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
fix(scripts): named slots omitted if default slot is present
This commit is contained in:
parent
f43b132088
commit
f17e4af481
2 changed files with 114 additions and 97 deletions
|
@ -77,13 +77,15 @@ export function generateIndex(components, groups, pkg) {
|
|||
|
||||
if (slots.size > 0) {
|
||||
if (slots.get("default")) {
|
||||
code += "- `<slot>...</slot>`\n";
|
||||
} else {
|
||||
slots.forEach((slot, name) => {
|
||||
if (slot.default) return;
|
||||
code += `- \`<slot name="${name}">...</slot>\`\n`;
|
||||
});
|
||||
code += "- **default**: `<div>...</div>`\n";
|
||||
}
|
||||
|
||||
slots.forEach((slot, name) => {
|
||||
if (slot.default) return;
|
||||
code += `- **"${name}"**: \`<div name="${name}" ${slot.attributes
|
||||
.map((attr) => `let:${attr.name}`)
|
||||
.join(" ")}>...</div>\`\n`;
|
||||
});
|
||||
} else {
|
||||
code += "No slots.\n\n";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue