@jimka/typescript-ui / core / StyleTarget
Class: abstract StyleTarget<T>
Defined in: src/typescript/lib/core/StyleTarget.ts:19
Shared base for a deferred-write style buffer. Either flushes into a CSSStyleRule (see StyleRule) or an HTMLElement (see InlineStyle).
Remarks
Before the target exists, writes accumulate in dirty. Once materialize runs, queued entries flush onto the target's style declaration and subsequent StyleTarget.set calls write through directly. StyleTarget.queue is a write-to-dirty-only path used by callers that need to batch their own commits (see Component's autoCommitStyle switch).
Extended by
Type Parameters
• T extends { style: CSSStyleDeclaration; }
Constructors
new StyleTarget()
new StyleTarget<T>(): StyleTarget<T>Returns
StyleTarget<T>
Methods
flush()
flush(): voidDefined in: src/typescript/lib/core/StyleTarget.ts:74
Drains the dirty bag onto the live target. No-op when the target is not yet attached — the dirty entries stay queued for the next flush after materialize.
Returns
void
isMaterialized()
isMaterialized(): booleanDefined in: src/typescript/lib/core/StyleTarget.ts:85
Returns whether the underlying target has been materialised.
Returns
boolean
queue()
queue(key: string, value: null | string): voidDefined in: src/typescript/lib/core/StyleTarget.ts:56
Writes a single style property into the dirty bag without flushing, even when the target is already attached. Callers that own their own batching gate (e.g. autoCommitStyle = false) use this to accumulate writes that StyleTarget.flush will drain later.
Parameters
key
string
The CSS property name (camelCase).
value
The value to set, or null to remove the property.
null | string
Returns
void
queueMany()
queueMany(values: Record<string, null | string>): voidDefined in: src/typescript/lib/core/StyleTarget.ts:65
Bulk variant of StyleTarget.queue.
Parameters
values
Record<string, null | string>
Camel-cased property keys mapped to string values (or null to clear).
Returns
void
set()
set(key: string, value: null | string): voidDefined in: src/typescript/lib/core/StyleTarget.ts:30
Writes a single style property. Flushes immediately when the target is attached; otherwise queues the entry into the dirty bag.
Parameters
key
string
The CSS property name (camelCase).
value
The value to set, or null to remove the property.
null | string
Returns
void
setMany()
setMany(values: Record<string, null | string>): voidDefined in: src/typescript/lib/core/StyleTarget.ts:43
Bulk variant of StyleTarget.set.
Parameters
values
Record<string, null | string>
Camel-cased property keys mapped to string values (or null to clear).
Returns
void