@moxijs/ui - v0.3.5
    Preparing search index...

    Class UIComponentAbstract

    Base abstract class for all UI components Provides box model, layout, and rendering functionality.

    Implements IFlexLayoutParticipant for integration with the new flex layout system. Components can be added to a LayoutTree for automatic layout management.

    IMPORTANT: UI components use a two-phase lifecycle:

    1. Construction - creates the component structure
    2. layout() - measures and positions internal elements

    When using FlexContainer, layout() is called automatically on children. When adding directly to a PIXI.Container, you MUST call layout() manually:

    const btn = new UIButton({ label: 'Click', width: 100, height: 32 });
    btn.layout(100, 32); // Required for label to render!
    pixiContainer.addChild(btn.container);

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    boxModel: BoxModel

    The box model defining this component's sizing and spacing

    computedLayout: ComputedLayout

    The computed layout after measurement and positioning

    container: Container

    The PIXI container that holds this component's visual representation

    enabled: boolean = true

    Whether this component is enabled for interaction

    focused: boolean = false

    Internal focus state

    focusRing?: Graphics

    Focus ring for visual focus indication

    fontConfig?: UIFontConfig

    Font configuration for this component. Children inherit these settings (like CSS font inheritance). Set via setFontConfig() and resolved via getInheritedFont* methods.

    hovered: boolean = false

    Hover state (for components that track hover)

    id: string

    Unique identifier for this component in the layout tree

    layoutConfig?: UILayoutConfig

    Layout configuration for this component. Children inherit these defaults unless overridden.

    layoutDirty: boolean = true

    Flag indicating if layout needs to be recalculated

    layoutEngine: LayoutEngine

    Layout engine service for calculating layouts Initialized in base class so all components have access to layout calculations

    parent?: UIComponent

    Reference to parent component (if any)

    pressed: boolean = false

    Pressed state (for components that track press)

    tabIndex: number = -1

    Tab index for focus order (-1 means not focusable by tab)

    themeResolver?: ThemeResolver

    Optional theme resolver for color resolution Components can set this to enable automatic theming

    visible: boolean = true

    Whether this component is currently visible

    Accessors

    Methods

    • Gets the global bounds of this component (position relative to stage)

      Returns { height: number; width: number; x: number; y: number }

    • Gets the inherited font family (convenience method).

      Parameters

      • OptionallocalOverride: string

        Optional local override

      Returns string

    • Gets the inherited font size (convenience method).

      Parameters

      • OptionallocalOverride: number

        Optional local override

      Returns number

    • Gets the inherited text color (convenience method).

      Parameters

      • OptionallocalOverride: number

        Optional local override

      Returns number

    • Gets the layout configuration for this component.

      Returns UILayoutConfig

    • Performs layout for this component within the given available space Default implementation uses LayoutEngine. Override if custom layout logic is needed.

      Parameters

      • availableWidth: number

        Available width in pixels

      • availableHeight: number

        Available height in pixels

      Returns void

    • Helper to make container interactive with common settings Components can call this in setupInteractivity() or override for custom behavior

      Parameters

      • cursor: string = 'pointer'

        Cursor type ('pointer', 'text', 'default', etc.)

      Returns void

    • Marks this component's layout as dirty, requiring recalculation

      Returns void

    • Measure the intrinsic content size of this component. Called by the flex layout engine during Pass 2 (measure).

      Override in subclasses that have intrinsic content size. For containers that size based on children, return { width: 0, height: 0 }.

      Returns { height: number; width: number }

      The content size in pixels

    • Called when component loses focus Override in subclasses to customize blur behavior

      Returns void

    • Called when component receives focus Override in subclasses to customize focus behavior

      Returns void

    • Renders the component's visuals Called after layout is complete

      Returns void

    • Resolve checkmark color with optional override

      Parameters

      • Optionaloverride: number

      Returns number

    • Resolve a color from theme with optional override Simplifies color resolution across all components

      Parameters

      • type: "background" | "border" | "text" | "focus" | "disabled" | "selected" | "hover"
      • Optionaloverride: number

      Returns number

    • Resolve a control-specific color with optional override

      Parameters

      • controlType: "button" | "select" | "checkbox" | "textInput" | "textArea" | "radio"
      • type: "background" | "border" | "text"
      • Optionaloverride: number

      Returns number

    • Resolves a layout setting by walking up the parent chain. Allows components to adapt to their context (e.g. using parent's default padding).

      Type Parameters

      • K extends keyof UILayoutConfig

      Parameters

      • key: K

        The layout config key to resolve

      • OptionallocalOverride: UILayoutConfig[K]

        Optional local override value

      Returns UILayoutConfig[K]

      The resolved value or undefined

    • Resolve placeholder color with optional override

      Parameters

      • Optionaloverride: number

      Returns number

    • Resolve text color with optional override

      Parameters

      • Optionaloverride: number

      Returns number

    • Sets align-self property

      Parameters

      • align: "auto" | "center" | "end" | "start" | "stretch"

      Returns void

    • Sets flex properties for this component

      Parameters

      • props: FlexProps

      Returns void

    • Sets flex basis

      Parameters

      • basis: number | "auto"

      Returns void

    • Sets flex grow factor

      Parameters

      • grow: number

      Returns void

    • Sets flex shrink factor

      Parameters

      • shrink: number

      Returns void

    • Sets layout configuration for this component. Children will inherit these settings.

      Parameters

      • config: UILayoutConfig

      Returns void

    • Sets the position of this component

      Parameters

      • x: number
      • y: number

      Returns void

    • Updates the focus ring appearance based on component size. Uses theme colors for consistent styling.

      Returns void