feature/fetch-fonts #14

Merged
ilia merged 76 commits from feature/fetch-fonts into main 2026-01-14 11:01:44 +00:00

76 Commits

Author SHA1 Message Date
Ilia Mashkov
f730dbc782 fix(workflow): change scripts
Some checks failed
Lint / Lint Code (push) Failing after 30s
Test / Svelte Checks (push) Failing after 35s
Build / build (pull_request) Failing after 1m28s
Lint / Lint Code (pull_request) Failing after 39s
Test / Svelte Checks (pull_request) Failing after 44s
2026-01-14 12:58:52 +03:00
Ilia Mashkov
8b704f1f82 fix(workflow): change the yarn install flags
Some checks failed
Test / Svelte Checks (push) Failing after 33s
Lint / Lint Code (push) Failing after 29s
2026-01-14 12:40:56 +03:00
Ilia Mashkov
36ed19e195 fix(workflow): yarn cache path 2026-01-14 12:39:30 +03:00
Ilia Mashkov
b209e051e5 fix(workflow): yarn cache path
Some checks failed
Lint / Lint Code (push) Failing after 11s
Test / Svelte Checks (push) Failing after 11s
2026-01-14 12:34:10 +03:00
Ilia Mashkov
f49e116408 fix(workflow): change node version
Some checks failed
Lint / Lint Code (push) Failing after 18s
Test / Svelte Checks (push) Failing after 11s
2026-01-14 12:25:14 +03:00
Ilia Mashkov
8d1d1cd60f chore: import/export changes due to code move
Some checks failed
Test / Svelte Checks (push) Failing after 5s
Lint / Lint Code (push) Failing after 1m48s
2026-01-13 20:11:58 +03:00
Ilia Mashkov
fb5c15ec32 fix: minor changes 2026-01-13 20:11:18 +03:00
Ilia Mashkov
955cc66916 feat: new version of unifiedFontStore 2026-01-13 20:10:44 +03:00
Ilia Mashkov
a9cdd15787 feat(GetFonts): separated types for filters 2026-01-13 20:10:20 +03:00
Ilia Mashkov
76172aaa6b fix: minor changes 2026-01-13 20:09:30 +03:00
Ilia Mashkov
7146328982 feat(mapManagerToParams): create mapper to transform filter values to query param values 2026-01-13 20:08:46 +03:00
Ilia Mashkov
52ecb9e304 fix: remove searchQuery from FilterModel 2026-01-13 20:07:42 +03:00
Ilia Mashkov
30cb9ada1a fix(Font): refresh types 2026-01-13 20:06:58 +03:00
Ilia Mashkov
4eeb43fa34 chore: delete unused code 2026-01-13 20:05:33 +03:00
Ilia Mashkov
ad6ba4f0a0 feat: add query provider to App.svelte 2026-01-13 20:04:39 +03:00
Ilia Mashkov
170c8546d3 chore: import/export changes due to code move 2026-01-13 20:04:02 +03:00
Ilia Mashkov
2f15148cdb feat(VirtualList): add overscan support 2026-01-13 20:02:50 +03:00
Ilia Mashkov
a29b80efbb feature: Create BaseFontStore class with Tanstack query logic and FontshareStore, GoogleFontsStore based on it 2026-01-13 20:02:20 +03:00
Ilia Mashkov
91451f7886 chore: import/export fixes due to code move 2026-01-13 20:00:36 +03:00
Ilia Mashkov
99d4b4e29a chore: rename FetchFonts to GetFonts 2026-01-13 19:59:07 +03:00
Ilia Mashkov
d9d45bf9fb chore: move Filters and Controls to GetFont feature 2026-01-13 19:57:22 +03:00
Ilia Mashkov
4810c2b228 chore: delete unused code 2026-01-13 19:56:20 +03:00
Ilia Mashkov
4c9b9f631f fix: minor type changes for fonts 2026-01-13 19:54:56 +03:00
Ilia Mashkov
5fcb381b11 chore(normalize): move font api responce normalization functions to lib 2026-01-13 19:53:26 +03:00
Ilia Mashkov
e098da2dbb feat(filterManager): add debouced state support and move manager 2026-01-13 19:52:36 +03:00
Ilia Mashkov
1a76e9387a feat(createDebouncedState): create helper for managing state with debounce 2026-01-13 19:51:41 +03:00
Ilia Mashkov
0f1eb489ed feat: add query provider for Tanstack 2026-01-13 19:49:51 +03:00
Ilia Mashkov
6e8376b8fc fix(arch): move unifiedFontStore context creation to Layout.svelte
- Moved unifiedFontStore creation from Page.svelte to Layout.svelte
- Layout now creates store instance and provides it via setContext()
- Page.svelte now receives store via getContext() instead of creating it
- Fixes context accessibility issue where FiltersSidebar and FontSearch
  (siblings of Page) could not access the store
- All child components now share the same store instance at Layout level

This resolves the architectural issue where context only flows downward,
not sideways. All components (FiltersSidebar, FontSearch, Page) are now
children of Layout and can access the unifiedFontStore context.
2026-01-12 08:51:36 +03:00
Ilia Mashkov
d81af0a77b feat: implement P0/P1 performance and code quality optimizations
P0 Performance Optimizations:
- Add debounced search (300ms) to reduce re-renders during typing
- Implement single-pass filter function for O(n) complexity
- Add TanStack Query cancellation before new requests

P1 Code Quality Optimizations:
- Add runtime type guards for filter validation
- Implement two derived values (filteredFonts + sortedFilteredFonts)
- Remove all 'as any[]' casts from filter bridge
- Add fast-path for default sorting (skip unnecessary operations)

New Utilities:
- debounce utility with 4 tests (all pass)
- filterUtils with 15 tests (all pass)
- typeGuards with 20 tests (all pass)
- Total: 39 new tests

Modified Files:
- unifiedFontStore.svelte.ts: Add debouncing, use filter/sort utilities
- filterBridge.svelte.ts: Type-safe validation with type guards
- unifiedFontStore.test.ts: Fix pre-existing bugs (missing async, duplicate imports)

Code Quality:
- 0 linting warnings/errors (oxlint)
- FSD compliant architecture (entity lib layer)
- Backward compatible store API
2026-01-11 14:49:21 +03:00
Ilia Mashkov
77de829b04 fix: types 2026-01-09 16:48:26 +03:00
Ilia Mashkov
7630802363 fix: minor changes in types 2026-01-09 16:20:25 +03:00
Ilia Mashkov
43175fd52a feat(FontSearch): create FontSearch component with SearchBar and FontList with list virtualization 2026-01-09 16:20:00 +03:00
Ilia Mashkov
9598d8c3e4 feat(SearchBar): create SearchBar component with input and popover that contains search results 2026-01-09 16:19:22 +03:00
Ilia Mashkov
c863bea2dc feat: create FontList component with use of VirtualList 2026-01-09 16:18:16 +03:00
Ilia Mashkov
ea1f46f780 feat(fontCollection): create font collection state manager 2026-01-09 16:17:49 +03:00
Ilia Mashkov
bdb67157fd fix: rename file 2026-01-09 16:17:09 +03:00
Ilia Mashkov
e198e967ab fix: minor changes in shadcn components import 2026-01-09 16:16:32 +03:00
Ilia Mashkov
e1af950442 chore: create index files for better import/export api 2026-01-09 16:14:38 +03:00
Ilia Mashkov
13509a4145 chore: add comments for types and constants 2026-01-09 16:13:47 +03:00
Ilia Mashkov
09111a7c61 fix: import/export 2026-01-09 16:13:02 +03:00
Ilia Mashkov
b13c0d268b fix: import/export 2026-01-09 16:12:51 +03:00
Ilia Mashkov
1990860717 feat: add generic type for property value 2026-01-09 16:11:35 +03:00
Ilia Mashkov
6f7e863b13 fix: use proper types for fetching fonts 2026-01-09 16:09:56 +03:00
Ilia Mashkov
8ad29fd3a8 feat(FontCategory): separate types for font categories from different providers 2026-01-09 16:09:18 +03:00
Ilia Mashkov
de2688de5a delete: delete stores 2026-01-09 16:08:19 +03:00
Ilia Mashkov
1ebab2d77b feat: add data-testid attribute
Some checks failed
Lint / Lint Code (push) Failing after 7m16s
Test / Svelte Checks (push) Failing after 7m8s
2026-01-08 13:15:02 +03:00
Ilia Mashkov
fc00717359 feat: test coverage of ComboControl and CheckboxFilter 2026-01-08 13:14:04 +03:00
Ilia Mashkov
36a326817d feat: test coverage for utils
Some checks failed
Lint / Lint Code (push) Failing after 7m20s
Test / Svelte Checks (push) Failing after 7m20s
2026-01-07 17:26:59 +03:00
Ilia Mashkov
f4c2a38873 fix: imports path 2026-01-07 16:54:19 +03:00
Ilia Mashkov
614d6b0673 fix: imports path 2026-01-07 16:54:12 +03:00
Ilia Mashkov
f26f56ddef chore: move createVirtualizer 2026-01-07 16:53:44 +03:00
Ilia Mashkov
76f27a64b2 refactor(createTypographyControl): createControlStore rewrote to runes 2026-01-07 16:53:17 +03:00
Ilia Mashkov
baff3b9e27 refactor(createFilter): createFilterStore rewrote to runes 2026-01-07 16:52:17 +03:00
Ilia Mashkov
d15b90cfcb feat: move buildQueryString to separate directory 2026-01-07 16:49:37 +03:00
Ilia Mashkov
893bb02459 feat: move buildQueryString to separate directory 2026-01-07 16:49:18 +03:00
Ilia Mashkov
f7b19bd97f feat: move functions to separate files 2026-01-07 16:48:49 +03:00
Ilia Mashkov
2c4bfaba41 fix: rename file from .ts to .svelte.ts to support svelte runes 2026-01-07 14:27:25 +03:00
Ilia Mashkov
9fd98aca5d refactor(createFilterStore): move from store pattern to svelte 5 runes usage 2026-01-07 14:26:37 +03:00
Ilia Mashkov
0692711726 fix: import/export paths
Some checks failed
Lint / Lint Code (push) Failing after 7m18s
Test / Svelte Checks (push) Failing after 7m16s
2026-01-06 21:40:28 +03:00
Ilia Mashkov
86898bf83c chore: move utils directory into shared/lib 2026-01-06 21:39:17 +03:00
Ilia Mashkov
1950cd4095 refactor(VirtualList): refactor VirtualList with modern svelte 5 patterns 2026-01-06 21:38:53 +03:00
Ilia Mashkov
7a9f7e238c refactor(createVirtualizer): refactor createVirtualizerStore with modern svelte 5 patterns 2026-01-06 21:38:18 +03:00
Ilia Mashkov
1f19e964ca fix: import/export paths 2026-01-06 21:36:29 +03:00
Ilia Mashkov
eb10d58128 chore: move store creators to separate directories 2026-01-06 21:35:49 +03:00
Ilia Mashkov
c78ab826a2 chore: move fetch directory into shared/lib 2026-01-06 21:35:16 +03:00
Ilia Mashkov
931a2df1ee feat: test coverage for store creators 2026-01-06 21:34:05 +03:00
Ilia Mashkov
bea3f7ae7f chore: move store creators to separate directories 2026-01-06 21:33:30 +03:00
Ilia Mashkov
d1f035a6ad feat(api): create api calls for google fonts and fontshare 2026-01-06 21:31:25 +03:00
Ilia Mashkov
c0ccf4baff refactor(virtual): use store pattern instead of hook, fix styling
Store Pattern Migration:
- Created createVirtualizerStore using Svelte stores (writable/derived)
- Replaced useVirtualList hook with createVirtualizerStore
- Matches existing store patterns (createFilterStore, createControlStore)
- More Svelte-idiomatic than React-inspired hook pattern

Component Refactoring:
- Renamed FontVirtualList.svelte → VirtualList.svelte
- Moved component from shared/virtual/ → shared/ui/
- Updated to use store pattern instead of hook
- Removed pixel values from style tags (uses Tailwind CSS)
- Height now configurable via Tailwind classes (e.g., 'h-96', 'h-[500px]')
- Props changed from shorthand {fonts} to explicit items prop

File Changes:
- Deleted: useVirtualList.ts (replaced by store pattern)
- Deleted: FontVirtualList.svelte (renamed and moved)
- Deleted: useVirtualList.test.ts (updated to test store pattern)
- Updated: README.md with store pattern usage examples
- Updated: index.ts with migration guide
- Created: createVirtualizerStore.ts in shared/store/
- Created: VirtualList.svelte in shared/ui/
- Created: createVirtualizerStore.test.ts
- Created: barrel exports (shared/store/index.ts, shared/ui/index.ts)

Styling Improvements:
- All pixel values removed from <style> tags
- Uses Tailwind CSS for all styling
- Responsive height via Tailwind classes or props
- Only inline styles for dynamic positioning (required for virtualization)

TypeScript & Testing:
- Full TypeScript support with generics
- All 33 tests passing
- Type checking passes
- Linting passes (minor warnings only)

Breaking Changes:
- Component name: FontVirtualList → VirtualList
- Component location: $shared/virtual → $shared/ui
- Hook removed: useVirtualList → createVirtualizerStore
- Props change: {fonts} shorthand → items prop
- Import changes: $shared/virtual → $shared/ui and $shared/store

Documentation:
- Updated README.md with store pattern examples
- Added migration guide in virtual/index.ts
- Documented breaking changes and migration steps
2026-01-06 18:56:30 +03:00
Ilia Mashkov
10b7457f21 refactor(virtual): use store pattern instead of hook, fix styling
Store Pattern Migration:
- Created createVirtualizerStore using Svelte stores (writable/derived)
- Replaced useVirtualList hook with createVirtualizerStore
- Matches existing store patterns (createFilterStore, createControlStore)
- More Svelte-idiomatic than React-inspired hook pattern

Component Refactoring:
- Renamed FontVirtualList.svelte → VirtualList.svelte
- Moved component from shared/virtual/ → shared/ui/
- Updated to use store pattern instead of hook
- Removed pixel values from style tags (uses Tailwind CSS)
- Height now configurable via Tailwind classes (e.g., 'h-96', 'h-[500px]')
- Props changed from shorthand {fonts} to explicit items prop

File Changes:
- Deleted: useVirtualList.ts (replaced by store pattern)
- Deleted: FontVirtualList.svelte (renamed and moved)
- Deleted: useVirtualList.test.ts (updated to test store pattern)
- Updated: README.md with store pattern usage examples
- Updated: index.ts with migration guide
- Created: createVirtualizerStore.ts in shared/store/
- Created: VirtualList.svelte in shared/ui/
- Created: createVirtualizerStore.test.ts
- Created: barrel exports (shared/store/index.ts, shared/ui/index.ts)

Styling Improvements:
- All pixel values removed from <style> tags
- Uses Tailwind CSS for all styling
- Responsive height via Tailwind classes or props
- Only inline styles for dynamic positioning (required for virtualization)

TypeScript & Testing:
- Full TypeScript support with generics
- All 33 tests passing
- Type checking passes
- Linting passes (minor warnings only)

Breaking Changes:
- Component name: FontVirtualList → VirtualList
- Component location: $shared/virtual → $shared/ui
- Hook removed: useVirtualList → createVirtualizerStore
- Props change: {fonts} shorthand → items prop
- Import changes: $shared/virtual → $shared/ui and $shared/store

Documentation:
- Updated README.md with store pattern examples
- Added migration guide in virtual/index.ts
- Documented breaking changes and migration steps
2026-01-06 18:55:07 +03:00
Ilia Mashkov
2c666646cb style(font): fix lint warnings - remove unused imports and variables
- Removed unused FontFeatures, FontMetadata, FontProvider from normalize.ts imports
- Removed unused UnifiedFont from normalize.test.ts imports
- Removed unused FontSubset from store.ts imports
- Changed unused queryClient variables to void calls to suppress warnings
2026-01-06 15:24:34 +03:00
Ilia Mashkov
be14a62e83 refactor(font): split types into separate files for better maintainability 2026-01-06 15:23:08 +03:00
Ilia Mashkov
db814f0b93 fix(types): resolve import path and type issues after consolidation
- Added GoogleFontItem type alias for backward compatibility
- Updated normalize.ts to properly type Record<string, string> values
- Fixed import paths in Font index.ts (added subdirectory paths)
- Removed unused Readable import from store
- Removed type exports from normalize and API index files
- Updated stores index.ts to import types from parent types.ts
- All tests passing (129 tests)

All imports now use centralized types from model/types.ts:
- API clients re-export types for backward compatibility
- Normalize module imports types and exports functions
- Store module imports types and exports factory
- Main index.ts exports all types from model/types.ts
2026-01-06 15:11:16 +03:00
Ilia Mashkov
9f8b840e7a refactor(font): consolidate all types into single types.ts file
- Created unified model/types.ts with all type definitions
- Consolidated domain types (FontCategory, FontProvider, FontSubset)
- Consolidated Google Fonts API types (FontItem, GoogleFontsApiModel, etc.)
- Consolidated Fontshare API types (FontshareFont, FontshareStyle, etc.)
- Consolidated normalization types (UnifiedFont, FontStyleUrls, etc.)
- Consolidated store types (FontCollectionStore, FontCollectionFilters, etc.)
- Removed duplicate type files (font.ts, google_fonts.ts, fontshare_fonts.ts)
- Updated all imports to use consolidated types
- Updated normalize module to import from /Font
- Updated API clients to re-export types for backward compatibility
- Updated store to use centralized types
- Updated Font index.ts to export all types

Benefits:
- Centralized type definitions in single location
- Cleaner imports (single import from /Font)
- Better code organization with clear sections
- Follows FSD principles (types in model layer)
- No duplicate type definitions
2026-01-06 15:06:38 +03:00
Ilia Mashkov
9abec4210c feat(utils): add generic buildQueryString utility
- Add type-safe buildQueryString function to /utils
- Support primitives, arrays, and optional values
- Proper URL encoding for special characters
- Add comprehensive tests (25 test cases, all passing)
- Update Google Fonts API client to use shared utility
- Update Fontshare API client to use shared utility
- Export utility from /utils/index.ts

Benefits:
- DRY - Single source of truth for query string logic
- Type-safe - Proper TypeScript support with QueryParams type
- Tested - Comprehensive test coverage
- Maintainable - One place to fix bugs
2026-01-06 15:00:31 +03:00
Ilia Mashkov
29d1cc0cdc refactor(shared): rename fontCache to collectionCache
- Rename fontCache.ts to collectionCache.ts
- Rename FontCacheManager interface to CollectionCacheManager
- Make implementation fully generic (already was, just renamed interface)
- Update exports in shared/fetch/index.ts
- Fix getStats() to return derived store value for accurate statistics
- Add comprehensive test coverage for collection cache manager
  - 41 test cases covering all functionality
  - Tests for caching, deduplication, state tracking
  - Tests for statistics, reactivity, and edge cases

Closes task-1 of Phase 1 refactoring
2026-01-06 14:38:55 +03:00