/** * Expression parsing utilities. * * @remarks * Parses expression strings (from HTML attributes) to find root identifiers. * Used for reactive dependency tracking - only access state keys that * the expression actually references. * * @packageDocumentation */ /** * Find root identifiers in an expression. * * @remarks * These are the top-level variable references that need to come from state. * Used to enable precise reactive dependency tracking. * * @param expr - The expression string to parse * @returns Array of root identifier names * * @example * ```ts * findRoots('user.name') // ['user'] * findRoots('user.name + item.count') // ['user', 'item'] * findRoots('"hello.world"') // [] * findRoots('items.filter(x => x.active)') // ['items', 'x'] * ``` */ export declare function findRoots(expr: string): string[]; /** * A segment of parsed interpolation template. */ export interface Segment { /** Segment type: static text or expression */ type: 'static' | 'expr'; /** The segment value */ value: string; } /** * Parse interpolation syntax in a string. * * @remarks * Splits a template string with `{{ expr }}` markers into segments * of static text and expressions. Useful for directives * that support inline interpolation. * * @param template - The template string with interpolation markers * @returns Array of segments * * @example * ```ts * parseInterpolation('/users/{{ user.id }}/profile') * // [ * // { type: 'static', value: '/users/' }, * // { type: 'expr', value: 'user.id' }, * // { type: 'static', value: '/profile' } * // ] * ``` */ export declare function parseInterpolation(template: string): Segment[];