@gluonjs/atoms / packages/atoms/src / UiOwner
Interface: UiOwner
Properties
disposed
readonlydisposed:boolean
selection
readonlyselection:UiStyleSelection
styleOwner
readonlystyleOwner:StyleSheetOwner
Additional target-scoped sheets explicitly retained by this UI handle.
target
readonlytarget:StyleTarget
theme
readonlytheme:UiThemeName
themeSheet
readonlythemeSheet:CSSStyleSheet
Methods
dispose()
dispose():
void
Returns
void
setTheme()
setTheme(
theme):void
Parameters
theme
Returns
void
Example
Retain the shared target foundation, active theme, component style owner, and exact cleanup lifecycle:
import {
UiHydrationError,
createUiStyleSelection,
installUi,
type InstallUiOptions,
type UiHydrationMismatch,
type UiOwner,
type UiStyleSelection,
} from '@gluonjs/atoms';
const options = { theme: 'dark', hydrate: false } satisfies InstallUiOptions;
const selection: UiStyleSelection = createUiStyleSelection(options.theme);
const owner: UiOwner = installUi(document, options);
owner.setTheme('light');
console.log(selection.entries.map((entry) => entry.id), owner.theme, owner.themeSheet);
owner.dispose();
const mismatch: UiHydrationMismatch = 'missing';
const diagnostic = new UiHydrationError(mismatch, 'The server omitted the UI theme carrier.');
console.error(diagnostic.code, diagnostic.mismatch);