Guides
Config
Global Svelte TV configuration.
Import Config from svelte-tv and set it before mounting your app.
import { Config } from 'svelte-tv';Common Setup
Config.animationsEnabled = true;
Config.fontSettings.fontFamily = 'Roboto-Regular';
Config.focusStateKey = '$focus';
Config.rendererOptions = {
deviceLogicalPixelRatio: window.innerHeight / 1080,
devicePhysicalPixelRatio: 1,
boundsMargin: 100,
targetFPS: 0,
};Renderer
rendererOptions is passed to @lightningjs/renderer.
Config.rendererOptions = {
renderEngine: WebGlCoreRenderer,
fontEngines: [SdfTextRenderer],
fpsUpdateInterval: 1000,
textureMemory: {
criticalThreshold: 200e6,
targetThresholdLevel: 0.8,
},
numImageWorkers: 4,
deviceLogicalPixelRatio: window.innerHeight / 1080,
devicePhysicalPixelRatio: 1,
createImageBitmapSupport: 'auto',
boundsMargin: 100,
targetFPS: 0,
enableClear: false,
};Default: {}.
Fonts
fontSettings provides default text props.
Config.fontSettings.fontFamily = 'Roboto-Regular';
Config.fontSettings.fontSize = 32;Defaults:
Config.fontSettings = {
fontFamily: 'sans-serif',
fontSize: 100,
};fontWeightAlias maps common weight names to renderer font suffixes.
Config.fontWeightAlias = {
thin: 100,
light: 300,
regular: '',
400: '',
medium: 500,
bold: 700,
black: 900,
};Focus
Config.focusStateKey = '$focus';
Config.throttleInput = 120;focusStateKeyis the state added to the focused node.throttleInputthrottles global key presses in milliseconds.setActiveElementlets advanced integrations control how active focus is stored.
Default focusStateKey: '$focus'.
Animations
Config.animationsEnabled = true;
Config.animationSettings = {
duration: 250,
easing: 'ease-in-out',
};Set animationsEnabled = false to disable transitions globally.
Debug Flags
Config.debug = false;
Config.keyDebug = false;
Config.focusDebug = false;
Config.focusHistoryDebug = 0;debugenables general debug logging.keyDebuglogs keyboard handling.focusDebuglogs focus changes.focusHistoryDebugprints recent focus history when greater than0.
Styling
Config.lockStyles = true;
Config.stateOrder = [];lockStyleskeeps authored props from being overwritten by lower-priority styles.stateOrdercontrols priority when multiple state styles are active.
Advanced
Config.convertToShader = (node, effects) => {
return customShader;
};
Config.taskDelay = 0;
Config.domRendererEnabled = false;convertToShadercustomizes how effects become renderer shaders.taskDelayis available for delayed internal work.domRendererEnabledexists for renderer experiments and defaults tofalse.