clove/pkviewer
web/src/lib/components/TokenStyle.svelte
back to web/src/lib/components
<!-- web/src/lib/components/TokenStyle.svelte -->
<script lang="ts">
import { tokenCss, type TokenScope } from "$lib/tokenStyle.ts";
let {
vars,
darkVars,
scope,
colorScheme,
}: {
vars: Record<string, string>;
darkVars?: Record<string, string>;
scope: TokenScope;
colorScheme?: "auto" | "light" | "dark";
} = $props();
// Every value has been through sanitizeCssVars, so nothing can leave the declaration
const css = $derived(tokenCss({ vars, darkVars, scope, colorScheme }));
</script>
{#if css}
{@html `<style>${css}</style>`}
{/if}