Class: BaseComponent

BaseComponent(options)

new BaseComponent(options)

Creates a new base component.
Parameters:
Name Type Description
options Object Configuration options
Properties
Name Type Description
template string HTML template string
display string CSS display value for :host
observedAttributes Array.<string> Attributes to observe
attributeHandlers Object Attribute change handlers
events Array.<string> Events to re-dispatch
targetSelector string CSS selector for the target element
Source:

Members

(static) observedAttributes

Defines which attributes the component observes for changes.
Source:

Methods

attributeChangedCallback(name, oldValue, newValue)

Called when one of the component's observed attributes is added, removed, or changed.
Parameters:
Name Type Description
name string The name of the attribute that changed.
oldValue string | null The attribute's old value.
newValue string | null The attribute's new value.
Source:

connectedCallback()

Called when the element is connected to the DOM. Applies initial attributes and ensures styles are applied.
Source:

createPropertyAccessor(propertyName) → {Object}

Creates a standard getter/setter pair for a property.
Parameters:
Name Type Description
propertyName string The property name
Source:
Returns:
Object with get and set functions
Type
Object

setupEventListeners()

Sets up event listeners to re-dispatch events from the host element.
Source:

setupShadowDOM()

Sets up the shadow DOM with the provided template.
Source:

validateAndWarnARIA(attributeName, value)

Validates and warns about ARIA issues for a specific attribute
Parameters:
Name Type Description
attributeName string The name of the attribute being validated
value string | null The value of the attribute
Source:

(static) createBooleanHandler(propertyName, attributeName) → {function}

Creates a standard attribute handler for boolean attributes.
Parameters:
Name Type Description
propertyName string The property name to set
attributeName string The attribute name to check
Source:
Returns:
The attribute handler function
Type
function

(static) createSetAttributeHandler(attributeName) → {function}

Creates a standard attribute handler for setAttribute.
Parameters:
Name Type Description
attributeName string The attribute name to set
Source:
Returns:
The attribute handler function
Type
function

(static) createStringHandler(propertyName, defaultValue) → {function}

Creates a standard attribute handler for string attributes.
Parameters:
Name Type Description
propertyName string The property name to set
defaultValue string Default value if attribute is null
Source:
Returns:
The attribute handler function
Type
function