//#region src/utilities/diacritics.d.ts /** * @module utilities/diacritics * * @remarks * Accent-folding search primitives. Pure string transforms — no DOM, no state, * no reactivity. Powers the `ignoreAccents` option of `toHighlight` and any * filter that wants a plain query to reach accented text. */ /** * A `[start, end]` index pair where `end` is exclusive (matches * `String.prototype.slice` convention). * * @example * ```ts * import type { MatchRange } from '@vuetify/v0' * * const ranges: MatchRange[] = [[0, 5], [12, 17]] * ``` */ type MatchRange = readonly [number, number]; /** * Which side of a comparison has its accents folded before matching. * * - `'query'` — folds the query, so typing `café` finds plain `cafe` * - `'target'` — folds the text, so typing `cafe` finds accented `café` * - `true` — both sides fold, so any accent variant matches any other * - `false` — neither folds, exact match only * * `'query'` and `'target'` fold only one side, but a spelling that already * agrees on both sides still matches verbatim — folding one side never * hides a match the other side already has. They still don't fold each * other's accents together, so `café` won't match `cafè` under either. */ type IgnoreAccents = boolean | 'query' | 'target'; interface FindMatchRangesOptions { ignoreCase?: boolean; ignoreAccents?: IgnoreAccents; matchAll?: boolean; } /** * Finds `[start, end]` index pairs where `query` occurs in `text`, optionally * folding accents on either side. Returned indices always address the original * `text`, even when folding or case-conversion changed its length. * * Directional folding (`'query'` or `'target'`) only transforms one side, but * a spelling that's already identical on both sides — accents and all — is * merged in verbatim, so folding one side never hides a match the other side * already has. * * @param text The string to search. * @param query The term to look for. An empty query yields no ranges. * @param options Optional `ignoreCase`, `ignoreAccents`, `matchAll`. * @returns Ranges into `text`, where `end` is exclusive. * * @example * ```ts * import { findMatchRanges } from '@vuetify/v0' * * findMatchRanges('Zürich', 'zurich', { ignoreCase: true, ignoreAccents: true }) * // [[0, 6]] * * findMatchRanges('Łódź', 'Lo', { ignoreAccents: 'target' }) * // [[0, 2]] * * findMatchRanges('… Kraków …', 'Kraków', { ignoreAccents: 'query' }) * // [[2, 8]] — typing the exact accented name always finds itself * ``` */ declare function findMatchRanges(text: string, query: string, options?: FindMatchRangesOptions): MatchRange[]; //#endregion export { FindMatchRangesOptions, IgnoreAccents, MatchRange, findMatchRanges };