TriFrost

TriFrost 0.43.1

|peterver

News

Improved

  • qol: <Script> components that do not reference any arguments (like el, data, or $) are now rendered inline instead of being registered in the (atomic) script engine. This enables immediate execution, useful for boot-time logic like theme/locale detection:
/* Theme detection */
<Script>
  {() => {
    const saved = localStorage.getItem('theme');
    const preferred = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
    document.documentElement.setAttribute('data-theme', saved || preferred);
  }}
</Script>
/* Locale detection */
<Script>
  {() => {
    const locale = navigator.language?.startsWith('fr') ? 'fr' : 'en';
    document.documentElement.setAttribute('data-lang', locale);
  }}
</Script>

Loved the read? Share it with others