Class: ComponentParser

ComponentParser(styleProcessor)

ComponentParser handles the parsing of Avenx component files (.js and .css). It extracts component state, computed properties, methods, and templates, and coordinates with the StyleProcessor to handle styles.

Constructor

new ComponentParser(styleProcessor)

Parameters:
Name Type Description
styleProcessor StyleProcessor

An instance of StyleProcessor to handle styles.

Source:

Members

expressionParser :ExpressionParser

Type:
Source:

styleProcessor :StyleProcessor

Type:
Source:

Methods

parse(filePath, typeopt) → {string}

Parses a .component.js or .page.js file and its corresponding CSS file.

Parameters:
Name Type Attributes Default Description
filePath string

The absolute path to the file.

type 'component' | 'page' <optional>
'component'

The type of file being parsed.

Source:
Returns:

The generated JavaScript class.

Type
string

processBindDirectives(template) → {string}

Processes data-ax-bind attributes on input, textarea, and select elements. Converts data-ax-bind="expr" to value="{{ expr }}" and event listener.

Parameters:
Name Type Description
template string

The template string.

Source:
Returns:

The processed template.

Type
string

processComponentTags(template) → {string}

Processes component tags recursively to handle transclusion slots. Maps <CompName ...>...</CompName> to <div data-avenx-comp="CompName">...</div>.

Parameters:
Name Type Description
template string

The template string.

Source:
Returns:

The processed template.

Type
string