import { T as TokenBuilder, B as BuildTokensOptions, m as BuilderFormat, g as TokenDataMap, l as buildTokens, n as ProcessSetsOptions, a as ProcessResult, f as TokenData, o as ProcessOptions, h as TokenOperationResult, p as RefPath } from './types-BOyxzACN.cjs'; export { C as CreateTokenParams, b as CreateTokenResult, D as DeleteTokenParams, c as DeleteTokenResult, I as IssuesMap, d as ProcessorOutput, e as ProcessorResult, R as ResolveIssue, i as TokenResolver, U as UpdateTokenParams, j as UpdateTokenResult, V as ValidationIssue, k as ValidationSeverity } from './types-BOyxzACN.cjs'; import { l as InterpreterResult } from './interpreter-B7BcLEBz.cjs'; import './types-BMYcHiSq.cjs'; import '@tokens-studio/schema-validation'; type FlattenCallback = (key: string, value: InterpreterResult) => T; /** * Flatten a DictionarySymbol into key-value pairs * * @param result - The InterpreterResult to flatten (only DictionarySymbol will be flattened) * @param prefix - The prefix to prepend to keys * @param callback - Callback function that receives each flattened key-value pair * * @example * const result: Record = {}; * flattenChildrenObject(dictionarySymbol, "root", (key, value) => { * result[key] = value; * }); */ declare function flattenChildrenObject(result: InterpreterResult, prefix: string, callback: FlattenCallback): void; /** * Flatten a Map structure into key-value pairs * * @param map - The map to flatten (from Dictionary.value) * @param prefix - The prefix to prepend to keys * @param callback - Callback function that receives each flattened key-value pair * * @example * const result = new Map(); * flattenChildrenMap(dictionarySymbol.value, "root", (key, value) => { * result.set(key, value); * }); */ declare function flattenChildrenMap(map: Map, prefix: string, callback: FlattenCallback): void; declare class MapBuilder implements TokenBuilder> { readonly name = "map"; protected result: Map; private successfullyResolved; onResolve(tokenName: string, value: InterpreterResult): void; onError(tokenName: string, _error: Error, originalValue: string | unknown): void; getResult(): Map; getResolvedTokens(): Map; } /** * Nested Object Builder * * Builds a nested object structure incrementally as tokens are resolved. * Converts flat token paths to nested structure. * Example: "color.primary" -> { color: { primary: value } } */ declare class NestedObjectBuilder implements TokenBuilder> { readonly name = "nested"; private result; onResolve(tokenName: string, value: InterpreterResult): void; onError(tokenName: string, _error: Error, originalValue: string | unknown): void; getResult(): Record; } /** * Flat Object Builder * * Builds a flat key-value object incrementally as tokens are resolved. * Example: "color.primary" -> { "color.primary": value } */ declare class FlatObjectBuilder implements TokenBuilder> { readonly name = "flat"; private result; onResolve(tokenName: string, value: InterpreterResult): void; onError(tokenName: string, _error: Error, originalValue: string | unknown): void; getResult(): Record; } declare class StringMapBuilder extends MapBuilder { onResolve(tokenName: string, value: InterpreterResult): void; getResult(): Map; } declare const index_BuildTokensOptions: typeof BuildTokensOptions; declare const index_BuilderFormat: typeof BuilderFormat; type index_FlatObjectBuilder = FlatObjectBuilder; declare const index_FlatObjectBuilder: typeof FlatObjectBuilder; type index_FlattenCallback = FlattenCallback; type index_MapBuilder = MapBuilder; declare const index_MapBuilder: typeof MapBuilder; type index_NestedObjectBuilder = NestedObjectBuilder; declare const index_NestedObjectBuilder: typeof NestedObjectBuilder; type index_StringMapBuilder = StringMapBuilder; declare const index_StringMapBuilder: typeof StringMapBuilder; declare const index_TokenBuilder: typeof TokenBuilder; declare const index_TokenDataMap: typeof TokenDataMap; declare const index_buildTokens: typeof buildTokens; declare const index_flattenChildrenMap: typeof flattenChildrenMap; declare const index_flattenChildrenObject: typeof flattenChildrenObject; declare namespace index { export { index_BuildTokensOptions as BuildTokensOptions, index_BuilderFormat as BuilderFormat, index_FlatObjectBuilder as FlatObjectBuilder, type index_FlattenCallback as FlattenCallback, index_MapBuilder as MapBuilder, index_NestedObjectBuilder as NestedObjectBuilder, index_StringMapBuilder as StringMapBuilder, index_TokenBuilder as TokenBuilder, index_TokenDataMap as TokenDataMap, index_buildTokens as buildTokens, index_flattenChildrenMap as flattenChildrenMap, index_flattenChildrenObject as flattenChildrenObject }; } /** * Process flat token collection. * * @param tokens - Token input in various formats (Map or Record) * @param options - Processing options * @returns Processed tokens with resolved values * * @note Performance optimization: If you already have a `Map`, * you can skip this function and call `buildTokens` directly to avoid unnecessary flattening. */ declare function processTokens>(tokens: Map | Map | Record, options?: ProcessOptions): ProcessResult; /** * Process token sets with theme or set selection. */ declare function processTokenSets>(normalizedFiles: Record, options?: ProcessSetsOptions): ProcessResult; /** * Get all affected token paths from the dependants graph. * Returns the set of all tokens that depend on the changed token. */ declare function getAffectedTokens(result: TokenOperationResult): Set; /** * Get broken references from issues. * Filters issues for TOKEN_NOT_FOUND or DEPENDENCY_ERROR codes. */ declare function getBrokenReferences(result: TokenOperationResult): Set; /** * For rename operations: get tokens whose references were updated. * Pass the set of tokens that were modified during rename. */ declare function getRenamedReferences(_result: TokenOperationResult, modifiedTokens: Set): Set; /** * Get tokens from the dependants graph whose values actually changed. * Compares the old token values with the new result to filter only modified tokens. */ declare function getModifiedDependants(oldTokens: Map, result: TokenOperationResult): Set; /** * Token name validation. * * Must stay in sync with the Go and Ruby versions. The shared fixture * at tokenscript/test-suites/token-name-validation.json proves they agree. * Uses explicit whitespace chars (not \s) to ensure identical behavior * across Go/JS/Ruby regex engines. */ /** Returns true if a single name segment is valid: non-empty and contains no whitespace, braces, or brackets. */ declare function validateTokenName(name: string): boolean; /** Returns true if every segment of a dot-delimited token path is a valid token name. */ declare function validateTokenPath(path: string): boolean; export { BuildTokensOptions, type FlattenCallback, TokenBuilder, TokenData, TokenDataMap, TokenOperationResult, buildTokens, index as builders, flattenChildrenMap, flattenChildrenObject, getAffectedTokens, getBrokenReferences, getModifiedDependants, getRenamedReferences, processTokenSets, processTokens, validateTokenName, validateTokenPath };