histoire
Version:
A fast story book powered by Vite
29 lines • 1.54 kB
TypeScript
import type { CatalogStoryDto, CatalogVariantDto } from '@histoire/cli/protocol/catalog';
import type { CatalogSnapshot, CatalogStory } from '../../catalog/types.js';
/**
* Bounds display text with a visible ellipsis. IDs are never passed through here:
* an ID that does not survive exactly cannot identify a target.
* @param text Title or file label.
*/
export declare function boundDisplayText(text: string): string;
/**
* Story IDs shared by several stories in the snapshot. `lookupStory` refuses such IDs,
* so the terminal must not offer them as actionable targets either.
* @param snapshot Completed catalog.
*/
export declare function ambiguousStoryIds(snapshot: CatalogSnapshot): ReadonlySet<string>;
/**
* Projects one story to its display DTO: no source, content or absolute path.
* @param story Canonical metadata.
* @param ambiguous Story IDs shared by several stories.
* @param needle Normalized search text, empty when not searching.
*/
export declare function projectStory(story: CatalogStory, ambiguous: ReadonlySet<string>, needle: string): CatalogStoryDto;
/**
* Creates the variant projector of a story; flags IDs repeated inside the story.
* Counting happens once per read, projection per returned variant only.
* @param story Canonical metadata.
* @param needle Normalized search text, empty when not searching.
*/
export declare function createVariantProjector(story: CatalogStory, needle: string): (variant: CatalogStory['variants'][number]) => CatalogVariantDto;
//# sourceMappingURL=projection.d.ts.map