Skip to content

ui/panels/BasePanel

Classes

abstract BasePanel

Defined in: ui/panels/BasePanel.ts:13

BasePanel - Abstract base class for all UI panels Provides common functionality for panel management including: - DOM element management - Event listener cleanup - Lifecycle methods - Common panel operations (collapse/expand)

Extended by

Constructors

Constructor
new BasePanel(panelSelector, contentId?): BasePanel;

Defined in: ui/panels/BasePanel.ts:24

Parameters
panelSelector

string

CSS selector for the panel container

contentId?

string

ID of the panel content element (optional)

Returns

BasePanel

Properties

panelElement
protected panelElement: HTMLElement | null = null;

Defined in: ui/panels/BasePanel.ts:14

panelContent
protected panelContent: HTMLElement | null = null;

Defined in: ui/panels/BasePanel.ts:15

collapseButton
protected collapseButton: HTMLElement | null = null;

Defined in: ui/panels/BasePanel.ts:16

listeners
protected listeners: ListenerRegistry;

Defined in: ui/panels/BasePanel.ts:17

panelSelector
protected panelSelector: string;

Defined in: ui/panels/BasePanel.ts:25

CSS selector for the panel container

contentId?
protected optional contentId?: string;

Defined in: ui/panels/BasePanel.ts:26

ID of the panel content element (optional)

Methods

init()
init(): void;

Defined in: ui/panels/BasePanel.ts:33

Initialize the panel Must be called after DOM is ready

Returns

void

onInit()
abstract protected onInit(): void;

Defined in: ui/panels/BasePanel.ts:58

Subclasses override this to perform custom initialization

Returns

void

toggleCollapse()
protected toggleCollapse(): void;

Defined in: ui/panels/BasePanel.ts:73

Toggle panel collapse state

Returns

void

addEventListener()
protected addEventListener(
   element, 
   event, 
   handler): void;

Defined in: ui/panels/BasePanel.ts:87

Add an event listener and track it for cleanup

Parameters
element

HTMLElement

event

string

handler

EventListener

Returns

void

bindEvent()
protected bindEvent(
   id, 
   event, 
   handler): HTMLElement | null;

Defined in: ui/panels/BasePanel.ts:100

Attach a tracked event listener to an element by ID, with the standard warn-if-missing handling that panels used to copy-paste. Returns the element so callers can chain further setup.

Parameters
id

string

event

string

handler

EventListener

Returns

HTMLElement | null

bindClick()
protected bindClick(id, handler): HTMLElement | null;

Defined in: ui/panels/BasePanel.ts:117

Attach a tracked click handler to an element by ID.

Parameters
id

string

handler

() => void

Returns

HTMLElement | null

bindInput()
protected bindInput(id, handler): HTMLElement | null;

Defined in: ui/panels/BasePanel.ts:124

Attach a tracked 'input' handler that receives the input's value.

Parameters
id

string

handler

(value) => void

Returns

HTMLElement | null

bindChange()
protected bindChange(id, handler): HTMLElement | null;

Defined in: ui/panels/BasePanel.ts:133

Attach a tracked 'change' handler that receives the select/input value.

Parameters
id

string

handler

(value) => void

Returns

HTMLElement | null

bindCheckbox()
protected bindCheckbox(id, handler): HTMLElement | null;

Defined in: ui/panels/BasePanel.ts:143

Attach a tracked 'change' handler to a checkbox that receives its checked state.

Parameters
id

string

handler

(checked) => void

Returns

HTMLElement | null

setInputValue()
protected setInputValue(id, value): void;

Defined in: ui/panels/BasePanel.ts:152

Set an input/select value by element ID, ignoring missing elements.

Parameters
id

string

value

string | number

Returns

void

setChecked()
protected setChecked(id, checked): void;

Defined in: ui/panels/BasePanel.ts:160

Set a checkbox's checked state by element ID, ignoring missing elements.

Parameters
id

string

checked

boolean

Returns

void

setText()
protected setText(id, text): void;

Defined in: ui/panels/BasePanel.ts:168

Set an element's text content by element ID, ignoring missing elements.

Parameters
id

string

text

string

Returns

void

getElement()
protected getElement(selector): HTMLElement | null;

Defined in: ui/panels/BasePanel.ts:176

Get an element within the panel

Parameters
selector

string

Returns

HTMLElement | null

getElementById()
protected getElementById(id): HTMLElement | null;

Defined in: ui/panels/BasePanel.ts:184

Get an element by ID within the panel

Parameters
id

string

Returns

HTMLElement | null

trackSubscription()
protected trackSubscription(unsubscribe): void;

Defined in: ui/panels/BasePanel.ts:193

Track an unsubscribe function (e.g. from StateManager.subscribe) so the subscription is released in destroy(). Without this, destroyed panels keep reacting to state changes on detached DOM.

Parameters
unsubscribe

() => void

Returns

void

update()
abstract update(data?): void;

Defined in: ui/panels/BasePanel.ts:200

Update panel content (override in subclasses)

Parameters
data?

unknown

Returns

void

destroy()
destroy(): void;

Defined in: ui/panels/BasePanel.ts:205

Clean up panel resources

Returns

void

onDestroy()
protected onDestroy(): void;

Defined in: ui/panels/BasePanel.ts:215

Subclasses override this to perform custom cleanup

Returns

void

show()
show(): void;

Defined in: ui/panels/BasePanel.ts:222

Show the panel

Returns

void

hide()
hide(): void;

Defined in: ui/panels/BasePanel.ts:231

Hide the panel

Returns

void

isVisible()
isVisible(): boolean;

Defined in: ui/panels/BasePanel.ts:240

Check if panel is visible

Returns

boolean