On this page
Overview
Restores app-scoped presentation before CSS and owns complete skin-class application without starting profile storage.
- Artifact
ThemePresentation.js· classic-script - Classification
public first party - Availability
Browser / native WebView classic script - Normalization
Synchronous presentation only; complete strings and numeric class text remain usable, cache failures preserve rendering, and authoritative profile and appearance loads reconcile the cache.
Import and lifecycle
<script src="/node_modules/arcane-os/runtime/arcane/modules/ThemePresentation.js"></script>
First classic evaluation installs or reuses globalThis.arcaneThemePresentation and synchronously restores the app-scoped presentation before following CSS. Place after the existing app-id declaration with no type=module, async, or defer. No imports, User/OPFS/model startup, page hiding, polling, profile snapshot, or migration. Root colors apply before body exists; one DOMContentLoaded callback supplies the latest complete skin classes. Cache misses leave ordinary first-visit presentation; module-only use can evaluate after first paint.
Application-facing behavior: No ESM exports; globalThis.arcaneThemePresentation with applyUserSkin(skin,{root?,body?,cache?}) returning palette|null, remember(fields,root?) returning boolean, restore(root?) returning cached record ({} on miss) or null when unavailable/failed, and reportError(message,error). Classic script runs after the existing app-id declaration and before CSS without type=module, async, or defer; first evaluation restores automatically. Cache fields: skin, palette, appearance:{colorScheme,density,reduceMotion,fontSize}, customProperties (Theme-owned applied CSS map or null). Complete Error goes to console.warn initially and shared logging after ThemeManager import. No User import, OPFS, model wait, profile snapshot, unrelated inline style capture, or migration; missing cache cannot supply an unloaded profile skin.
Protocol and host implementation
DOM and optional application-scoped localStorage This detail does not widen the application-facing API or grant authority.
Exports, signatures, parameters, and results
This artifact has no ESM bindings. Its public load, global, asset, or worker contract is listed below.
| Callable | Kind | Exact public signature | Parameter syntax |
|---|---|---|---|
arcaneThemePresentation.applyUserSkin | global-member | function applyUserSkin(skin,{
root=globalThis.document?.documentElement,
body=(root?.ownerDocument||globalThis.document)?.body,
cache=true
}={}) | skin,{
root=globalThis.document?.documentElement,
body=(root?.ownerDocument||globalThis.document)?.body,
cache=true
}={} |
arcaneThemePresentation.remember | global-member | function remember(fields,root=globalThis.document?.documentElement) | fields,root=globalThis.document?.documentElement |
arcaneThemePresentation.restore | global-member | function restore(root=globalThis.document?.documentElement) | root=globalThis.document?.documentElement |
arcaneThemePresentation.reportError | global-member | function reportError(message,error) | message,error |
| Member | Kind | Exact public declaration | Parameter syntax |
|---|---|---|---|
arcaneThemePresentation.applyUserSkin | static global-method | function applyUserSkin(skin,{
root=globalThis.document?.documentElement,
body=(root?.ownerDocument||globalThis.document)?.body,
cache=true
}={}) | skin,{
root=globalThis.document?.documentElement,
body=(root?.ownerDocument||globalThis.document)?.body,
cache=true
}={} |
arcaneThemePresentation.remember | static global-method | function remember(fields,root=globalThis.document?.documentElement) | fields,root=globalThis.document?.documentElement |
arcaneThemePresentation.restore | static global-method | function restore(root=globalThis.document?.documentElement) | root=globalThis.document?.documentElement |
arcaneThemePresentation.reportError | static global-method | function reportError(message,error) | message,error |
Parameter meanings and results
No ESM exports. Global applyUserSkin(skin,{root?,body?,cache=true}={}) returns selected palette or null for falsy skin/missing root, preserving independent body classes and complete supplied strings; numbers cache their complete class text. remember(fields,root=document.documentElement) returns whether its write succeeded. restore(root=document.documentElement) returns cached record, {} on cache miss, or null when unavailable/failed. reportError(message,error) initially calls console.warn and is connected to arcaneLogging.warn by ThemeManager. Cache fields are skin, palette, appearance:{colorScheme,density,reduceMotion,fontSize}, and customProperties (applied Theme-owned CSS property map or null), under arcane.apps.<application-id>:arcane.theme.presentation. Existing profile readiness and authoritative appearance preferences reconcile this presentation-only record.
Events, side effects, and errors
Source-literal CustomEvent dispatches
No source-literal CustomEvent dispatch is part of this artifact.
Lifecycle and event flow
- Consumes one native DOMContentLoaded only when complete skin classes were applied before body exists; no semantic event or User lifecycle is started.
Direct coded failures
This artifact directly assigns no stable coded failure.
Exported Error subclasses
This artifact exports no Error subclass.
Documented failure behavior
- Missing application identity or storage skips the cache.
- Conflicting document identities, storage failures, and malformed JSON log the complete Error without blocking rendering. A later authoritative write can replace malformed cached JSON.
Availability and capabilities
Browser / native WebView classic script. Synchronous presentation only; complete strings and numeric class text remain usable, cache failures preserve rendering, and authoritative profile and appearance loads reconcile the cache.
None; DOM and optional application-scoped localStorage only.
Load example
<meta name="arcane-app-id" content="dragon-observatory">
<script src="/node_modules/arcane-os/runtime/arcane/modules/ThemePresentation.js"></script>
<link rel="stylesheet" href="/arcane/css/theme.css">
<script type="module" src="/node_modules/arcane-os/runtime/arcane/modules/ThemeBootstrap.js"></script>
Related reference
No direct Core call is claimed for this artifact. Any injected provider or consuming module retains its own documented authority.