import type { ElementConstructor, RenderElement, ShaderProps } from 'claude-code' import type { ShaderScene } from './themes' /** * Lays a theme's shader over its still Svg. A theme with no shader gets the Svg back unchanged. * * A new scene needs its name in `ShaderScene` and a case of its own here: the type checker refuses a name with no case, * and where no checker ran such a theme shows its Svg alone. * Claude Code finds shader files by reading this source, and takes only a `module` written as a string in an element * named `Shader`: a path from a list, or a renamed parameter, leaves the Svg showing alone. */ export function overShader( Shader: ElementConstructor | undefined, shader: ShaderScene | undefined, still: RenderElement, ): RenderElement { // A Claude Code from before shaders gives no Shader: the Svg is the whole scene. if (Shader === undefined || shader === undefined) { return still } switch (shader) { case 'duck-pond': return {still} case 'falling-sand': return {still} case 'field-lines': return {still} case 'garden-beetles': return {still} case 'koi-pond': return {still} case 'ripple-tank': return {still} case 'sea-sparkle': return {still} case 'semicolony': return {still} case 'star-chart': return {still} } // Reached only by a name with no case above, which the type checker refuses on this line. shader satisfies never return still }