TS Fixes + Demo Cleanup

This commit is contained in:
David Haz
2025-09-01 09:53:42 +03:00
parent af455f62d5
commit 74b276c357
91 changed files with 107 additions and 392 deletions

View File

@@ -59,14 +59,20 @@ let intervalId: ReturnType<typeof setInterval> | null = null;
const splitIntoCharacters = (text: string): string[] => {
if (typeof Intl !== 'undefined' && 'Segmenter' in Intl) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const segmenter = new (Intl as any).Segmenter('en', { granularity: 'grapheme' });
const IntlWithSegmenter = Intl as typeof Intl & {
Segmenter: new (
locales?: string | string[],
options?: { granularity: 'grapheme' | 'word' | 'sentence' }
) => {
segment: (text: string) => Iterable<{ segment: string }>;
};
};
const segmenter = new IntlWithSegmenter.Segmenter('en', { granularity: 'grapheme' });
return [...segmenter.segment(text)].map(({ segment }) => segment);
}
return [...text];
};
const elements = computed((): WordElement[] => {
const currentText = props.texts[currentTextIndex.value];