From d5e41bfa4df7941051ccf9bea2fbf3e21cf4bf12 Mon Sep 17 00:00:00 2001 From: Darius Cepulis Date: Thu, 12 Feb 2026 10:16:50 -0600 Subject: [PATCH] fix(site): use first-match-wins for multipart primary selection (#519) --- site/scripts/api-docs-builder/src/index.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/site/scripts/api-docs-builder/src/index.ts b/site/scripts/api-docs-builder/src/index.ts index 68740553..eb4a0d3a 100644 --- a/site/scripts/api-docs-builder/src/index.ts +++ b/site/scripts/api-docs-builder/src/index.ts @@ -254,8 +254,14 @@ function discoverParts(source: ComponentSource, program: ts.Program): PartSource const subPartElementFile = path.join(htmlDir, `${componentKebab}-${kebab}-element.ts`); const hasSubPartElement = fs.existsSync(subPartElementFile); - // Primary part: no matching sub-part element, but main element exists - const isPrimary = !hasSubPartElement && !!source.htmlPath; + // Primary part: no matching sub-part element, main element exists, and first match wins. + const isPrimary = !hasSubPartElement && !!source.htmlPath && !hasPrimary; + + if (!hasSubPartElement && !!source.htmlPath && hasPrimary) { + log.warn( + `${source.name}: Part "${partExport.name}" also matches primary criteria and was skipped (first-match-wins)` + ); + } if (isPrimary) hasPrimary = true;