diff --git a/src/app/ui/Layout.svelte b/src/app/ui/Layout.svelte index 920662e..1f59a65 100644 --- a/src/app/ui/Layout.svelte +++ b/src/app/ui/Layout.svelte @@ -12,14 +12,34 @@ * * Uses Sidebar.Provider to enable mobile-responsive collapsible sidebar behavior * throughout the application. + * + * Creates and provides unifiedFontStore context to all child components (FiltersSidebar, + * TypographyMenu/FontSearch, and Page.svelte), ensuring all components can access + * the same font data and filtering state. */ +import { + UNIFIED_FONT_STORE_KEY, + type UnifiedFontStore, + createUnifiedFontStore, +} from '$entities/Font/model/store/unifiedFontStore.svelte'; import favicon from '$shared/assets/favicon.svg'; import * as Sidebar from '$shared/shadcn/ui/sidebar/index'; import { FiltersSidebar } from '$widgets/FiltersSidebar'; import TypographyMenu from '$widgets/TypographySettings/ui/TypographyMenu.svelte'; +import { setContext } from 'svelte'; /** Slot content for route pages to render */ let { children } = $props(); + +// Create unified font store instance at Layout level (highest common ancestor) +const unifiedFontStore: UnifiedFontStore = createUnifiedFontStore(); + +// Provide store to all children components via context +// This makes the store accessible to FiltersSidebar, FontSearch, and Page.svelte +setContext(UNIFIED_FONT_STORE_KEY, unifiedFontStore); + +// Export store for direct access in Page.svelte +export { unifiedFontStore }; diff --git a/src/routes/Page.svelte b/src/routes/Page.svelte index 1c3ee63..36559bd 100644 --- a/src/routes/Page.svelte +++ b/src/routes/Page.svelte @@ -1,16 +1,171 @@ - -

Welcome to Svelte + Vite

-

- Visit svelte.dev/docs to read the documentation -

+
+
+

Font Browser

+

+ Browse and compare fonts from multiple providers +

+
+ + + {#if testResults.length > 0} +
+

Feature Validation Tests

+
    + {#each testResults as result} +
  • + {result} +
  • + {/each} +
+
+ {/if} + + +
+
+

+ Font List + + ({unifiedFontStore.count} total, {unifiedFontStore.filteredFonts.length} + displayed) + +

+
+
+ +
+
+ + +
+

Debug Information

+
+
+

Loading: {unifiedFontStore.isLoading}

+

Error: {unifiedFontStore.error || 'None'}

+
+
+

+ Providers filter: { + unifiedFontStore.filters.providers.join(', ') || 'All' + } +

+

+ Categories filter: { + unifiedFontStore.filters.categories.join(', ') || 'All' + } +

+
+
+

+ Subsets filter: { + unifiedFontStore.filters.subsets.join(', ') || 'All' + } +

+

Search query: {unifiedFontStore.searchQuery || 'None'}

+
+
+

Sort field: {unifiedFontStore.sort.field}

+

Sort direction: {unifiedFontStore.sort.direction}

+
+
+
+