refactor: improve code formatting and consistency in processTemplateMacros utility
This commit is contained in:
		
							parent
							
								
									8f80a4842e
								
							
						
					
					
						commit
						828d6b0279
					
				| 
						 | 
					@ -165,7 +165,7 @@ export default function processTemplateMacros(
 | 
				
			||||||
				} else if (
 | 
									} else if (
 | 
				
			||||||
					options.availableFuncs.includes(handlerValue) &&
 | 
										options.availableFuncs.includes(handlerValue) &&
 | 
				
			||||||
					typeof (context as unknown as Record<string, unknown>)[
 | 
										typeof (context as unknown as Record<string, unknown>)[
 | 
				
			||||||
					handlerValue
 | 
											handlerValue
 | 
				
			||||||
					] === 'function'
 | 
										] === 'function'
 | 
				
			||||||
				) {
 | 
									) {
 | 
				
			||||||
					// Handle method reference: @click="handleClick"
 | 
										// Handle method reference: @click="handleClick"
 | 
				
			||||||
| 
						 | 
					@ -440,7 +440,7 @@ function processElementWithItemContext(
 | 
				
			||||||
	context: ListRenderingContext,
 | 
						context: ListRenderingContext,
 | 
				
			||||||
) {
 | 
					) {
 | 
				
			||||||
	// Store the item context of the element so that subsequent updates can find it
 | 
						// Store the item context of the element so that subsequent updates can find it
 | 
				
			||||||
	; (element as { _itemContext?: Record<string, unknown> })._itemContext =
 | 
						;(element as { _itemContext?: Record<string, unknown> })._itemContext =
 | 
				
			||||||
		itemContext
 | 
							itemContext
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Process bindings in text nodes
 | 
						// Process bindings in text nodes
 | 
				
			||||||
| 
						 | 
					@ -507,7 +507,8 @@ function processElementWithItemContext(
 | 
				
			||||||
						$el: element,
 | 
											$el: element,
 | 
				
			||||||
						setState: context.setState,
 | 
											setState: context.setState,
 | 
				
			||||||
						getState: context.getState,
 | 
											getState: context.getState,
 | 
				
			||||||
						triggerFunc: context.triggerFunc(eventName, event)
 | 
											triggerFunc: (eventName: string, ...args: unknown[]) =>
 | 
				
			||||||
 | 
												context.triggerFunc(eventName, ...args),
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					// Execute the expression
 | 
										// Execute the expression
 | 
				
			||||||
| 
						 | 
					@ -659,13 +660,13 @@ function setupListRendering(
 | 
				
			||||||
			// Determine the key for this item
 | 
								// Determine the key for this item
 | 
				
			||||||
			const key = keyAttr
 | 
								const key = keyAttr
 | 
				
			||||||
				? evaluateExpressionWithItemContext(
 | 
									? evaluateExpressionWithItemContext(
 | 
				
			||||||
					keyAttr,
 | 
											keyAttr,
 | 
				
			||||||
					{ [itemVar]: item },
 | 
											{ [itemVar]: item },
 | 
				
			||||||
					context,
 | 
											context,
 | 
				
			||||||
					index,
 | 
											index,
 | 
				
			||||||
					itemVar,
 | 
											itemVar,
 | 
				
			||||||
					indexVar ? indexVar : undefined,
 | 
											indexVar ? indexVar : undefined,
 | 
				
			||||||
				)
 | 
										)
 | 
				
			||||||
				: index
 | 
									: index
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// Check if we can reuse an existing element
 | 
								// Check if we can reuse an existing element
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user