From a392b575ccc307327a576017d5ad1a918de1a724 Mon Sep 17 00:00:00 2001 From: Ilia Mashkov Date: Mon, 2 Feb 2026 12:10:38 +0300 Subject: [PATCH] chore: migrate from direct with css towards font-face approach --- src/entities/Font/ui/FontApplicator/FontApplicator.svelte | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/entities/Font/ui/FontApplicator/FontApplicator.svelte b/src/entities/Font/ui/FontApplicator/FontApplicator.svelte index b5c8e5b..fbde458 100644 --- a/src/entities/Font/ui/FontApplicator/FontApplicator.svelte +++ b/src/entities/Font/ui/FontApplicator/FontApplicator.svelte @@ -20,6 +20,8 @@ interface Props { * Font id to load */ id: string; + + url: string; /** * Font weight */ @@ -34,7 +36,7 @@ interface Props { children?: Snippet; } -let { name, id, weight = 400, className, children }: Props = $props(); +let { name, id, url, weight = 400, className, children }: Props = $props(); let element: Element; // Track if the user has actually scrolled this into view @@ -44,7 +46,7 @@ $effect(() => { const observer = new IntersectionObserver(entries => { if (entries[0].isIntersecting) { hasEnteredViewport = true; - appliedFontsManager.touch([{ slug: id, weight }]); + appliedFontsManager.touch([{ id, weight, name, url }]); // Once it has entered, we can stop observing to save CPU observer.unobserve(element); @@ -54,7 +56,7 @@ $effect(() => { return () => observer.disconnect(); }); -const status = $derived(appliedFontsManager.getFontStatus(id, weight, false)); +const status = $derived(appliedFontsManager.getFontStatus(id, weight)); // The "Show" condition: Element is in view AND (Font is ready OR it errored out) const shouldReveal = $derived(hasEnteredViewport && (status === 'loaded' || status === 'error'));