feat(site): generated multipart component api reference (#468)

This commit is contained in:
Darius Cepulis
2026-02-09 12:20:45 +11:00
committed by GitHub
parent 3c4152fb58
commit 4b1e863883
31 changed files with 1413 additions and 327 deletions
@@ -7,6 +7,21 @@ export function kebabToPascal(str: string): string {
.join('');
}
/**
* Derive the kebab-case part segment from an `index.parts.ts` source path.
*
* Strips the leading `'./{componentKebab}-'` prefix to get the part segment.
* Example: `partKebabFromSource('./time-value', 'time')` -> `'value'`
*/
export function partKebabFromSource(source: string, componentKebab: string): string {
const prefix = `./${componentKebab}-`;
if (source.startsWith(prefix)) {
return source.slice(prefix.length);
}
// Fallback: strip leading './' and the component prefix
return source.replace(/^\.\//, '').replace(new RegExp(`^${componentKebab}-`), '');
}
export function sortProps(props: Record<string, PropDef>): Record<string, PropDef> {
const entries = Object.entries(props);