UNPKG

@xcons/widget

Version:

XCon Studio widget utilities with advanced template rendering, reactive binding system and registry pattern support

125 lines (124 loc) 3.38 kB
export declare class ExpressionEvaluator { private expressionCache; private widgetInstance?; constructor(widgetInstance?: any); /** * Set widget instance for property resolution */ setWidgetInstance(widgetInstance: any): void; /** * Compile expression to function */ compileExpression(expression: string): Function; /** * Evaluate expression with context and widget instance */ evaluateExpression(expression: string, context?: any, widgetInstance?: any): any; /** * NEW: Evaluate logical NOT operator * Example: !isActive, !showOverlay */ private evaluateLogicalNOT; /** * NEW: Evaluate object literal expression * Example: {'show-overlay': showOverlay, 'active': isActive} */ private evaluateObjectLiteral; /** * NEW: Parse object literal pairs */ private parseObjectPairs; /** * Clean key by removing quotes and whitespace */ private cleanKey; /** * NEW: Evaluate array literal * Example: [item1, item2, item3] */ private evaluateArrayLiteral; /** * Parse array items */ private parseArrayItems; /** * Check if expression is string concatenation */ private isStringConcatenation; /** * NEW: Evaluate string concatenation * Example: 'position-' + position */ private evaluateStringConcatenation; /** * Check if expression is mathematical */ private isMathematicalExpression; /** * NEW: Evaluate mathematical expression * Example: value1 + value2, count * 2 */ private evaluateMathematicalExpression; /** * Check if expression is comparison */ private isComparisonExpression; /** * NEW: Evaluate comparison expression * Example: value > 5, count === 10 */ private evaluateComparisonExpression; /** * DÜZELTME: Evaluate logical expression * JavaScript mantığına uygun çalışır: * - || operatörü ilk truthy değeri döndürür (boolean değil!) * - && operatörü ilk falsy değeri döndürür, yoksa son değeri döndürür */ private evaluateLogicalExpression; /** * YENİ: Logical expression'ı güvenli şekilde split et * String/object içindeki operatörleri görmezden gelir */ private splitLogicalExpression; /** * NEW: Evaluate ternary expression * Example: isActive ? 'active' : 'inactive' */ private evaluateTernaryExpression; /** * Evaluate single expression (for complex expressions with OR/AND) */ evaluateSingleExpression(expression: string, context?: any, widgetInstance?: any): any; /** * Resolve property from context (for loop variables) */ private resolveFromContext; /** * Check if property is a service property */ private isServiceProperty; /** * Resolve service property */ private resolveServiceProperty; /** * Resolve widget property */ private resolveWidgetProperty; /** * Get property by path */ private getProperty; /** * Clear expression cache */ clearCache(): void; /** * Get cache size */ getCacheSize(): number; /** * Check if expression is cached */ isCached(expression: string): boolean; }