Commit Graph

920 Commits

Author SHA1 Message Date
Ilia Mashkov 06b6274e66 refactor: extract magic constants — wave 5 (single-site thresholds)
Long-tail cleanup: threshold and default-value literals in shared
helpers get named module-level constants.

- CharacterComparisonEngine: CHAR_PROXIMITY_RANGE_PCT (5),
  DEFAULT_RENDER_SIZE_PX (16) — kept local instead of importing
  DEFAULT_FONT_SIZE from \$entities/Font because \$shared/lib cannot
  legally upward-import from \$entities per FSD (also avoids an init
  cycle through the mocks barrel).
- typographySettingsStore: BASE_SIZE_EPSILON (0.01) — rounding-jitter
  guard for baseSize reconciliation.
- createDebouncedState: DEFAULT_DEBOUNCE_MS (300) — exported so callers
  can mirror the default.
- createVirtualizer: MEASUREMENT_EPSILON_PX (0.5) — minimum height
  delta before committing a re-measured row.
- createPerspectiveManager: PERSPECTIVE_TOGGLE_THRESHOLD (0.5) — the
  halfway point on the 0-1 spring that flips isBack/isFront.

Skipped #19 (PerspectivePlan defaults) per review — marginal gain.
2026-05-24 22:07:44 +03:00
Ilia Mashkov 0c59262a59 refactor: extract magic constants — wave 4 (UX timings + physics)
Name throttle/debounce intervals, spring presets, and layout paddings
that were inline numeric literals:

- VirtualList: VISIBLE_CHANGE_THROTTLE_MS (150), NEAR_BOTTOM_THROTTLE_MS
  (200), JUMP_THROTTLE_MS (200)
- SampleList: CHECK_POSITION_THROTTLE_MS (100)
- SliderArea: SLIDER_SPRING_CONFIG ({stiffness: 0.2, damping: 0.7}),
  SLIDER_PERSIST_DEBOUNCE_MS (100), SLIDER_PADDING_MOBILE_PX (48),
  SLIDER_PADDING_DESKTOP_PX (96)
- FontVirtualList: TOUCH_DEBOUNCE_MS (150)
- createPerspectiveManager: PERSPECTIVE_SPRING_CONFIG ({stiffness: 0.2,
  damping: 0.8})

No behavior changes — values preserved exactly.
2026-05-24 21:13:46 +03:00
Ilia Mashkov 2bb43797f0 refactor: extract magic constants — wave 3 (font lifecycle)
Promote font-loading scheduling and lifecycle tunables to named
module-level constants:

- comparisonStore: FONT_READY_FALLBACK_MS (1000ms) — UI unblock safety net
- fontLifecycleManager:
  - PURGE_INTERVAL_MS (60000) — periodic eviction sweep
  - IDLE_CALLBACK_TIMEOUT_MS (150) — requestIdleCallback timeout
  - SCHEDULE_FALLBACK_MS (16) — setTimeout fallback (~60fps)
  - YIELD_INTERVAL_MS (8) — parse-loop yield budget for non-Chromium
  - CRITICAL_FONT_WEIGHTS ([400, 700]) — data-saver allowlist
- FontEvictionPolicy: DEFAULT_FONT_TTL_MS (5 minutes)
- FontLoadQueue: FONT_LOAD_MAX_RETRIES (3)

No behavior changes — values preserved exactly. Class-private fields
that mirrored these constants are removed in favor of module scope.
2026-05-24 21:13:38 +03:00
Ilia Mashkov ccef3cf7bb refactor: extract magic constants — wave 2 (TanStack Query defaults)
Promote the duplicated query lifecycle constants in \$shared/api/queryClient.ts:

- staleTime (5 minutes) -> DEFAULT_QUERY_STALE_TIME_MS
- gcTime (10 minutes)   -> DEFAULT_QUERY_GC_TIME_MS
- retry (3)             -> QUERY_RETRY_COUNT
- retryDelay (1s base, 30s cap) -> QUERY_RETRY_BASE_DELAY_MS + QUERY_RETRY_MAX_DELAY_MS

fontCatalogStore and availableFilterStore now import the stale/gc
constants instead of re-deriving '5 * 60 * 1000' / '10 * 60 * 1000'.

fontCatalogStore.svelte.spec.ts's queryClient mock now passes through
the new named exports via importOriginal so the consumer's imports
resolve.
2026-05-24 20:33:46 +03:00
Ilia Mashkov e3b489f173 refactor: extract magic constants — wave 1 (UX, API, storage)
- Use existing MULTIPLIER_S/M/L from \$entities/Font in SliderArea instead
  of inlining the 0.5/0.75/1 literals (constants already existed but were
  duplicated at the call site).
- Centralize API base URL in \$shared/api/endpoints.ts (was duplicated
  between proxyFonts and FilterAndSortFonts filters api).
- Promote every 'glyphdiff:...' localStorage key to a named module-level
  STORAGE_KEY constant. Test files now import the source constant rather
  than redeclaring it (eliminates silent-typo divergence risk).
2026-05-24 20:30:26 +03:00
Ilia Mashkov f92577608a refactor(Font): use pretext layout() directly in row size resolver
createFontRowSizeResolver was reaching into TextLayoutEngine, which
internally called pretext's heavy layoutWithLines and then walked
per-grapheme cursors to build chars arrays. The resolver discarded all
that work and used only totalHeight.

Replace with direct prepare + layout from @chenglou/pretext — pretext
docs explicitly recommend layout() (not layoutWithLines) for the resize
hot path: pure arithmetic on cached segment widths, no canvas calls, no
string allocations.

Test spies on TextLayoutEngine.prototype.layout migrated to vi.mock-ed
pretext layout (pretext's ESM exports are frozen — vi.spyOn fails with
"Cannot redefine property").

TextLayoutEngine marked @deprecated since it has no remaining
consumers; slated for removal after a release cycle.
2026-05-24 20:12:48 +03:00
Ilia Mashkov 728380498b refactor(Font): rename fontStore and appliedFontsManager
Both names were vague or overloaded:

- fontStore / FontStore -> fontCatalogStore / FontCatalogStore
  Three font-related stores live in this slice; the new name names the
  paginated catalog specifically.

- appliedFontsManager / AppliedFontsManager -> fontLifecycleManager /
  FontLifecycleManager
  "Applied" collided with the filter-side appliedFilterStore (different
  meaning). The class actually orchestrates a load-use-evict lifecycle
  with FontBufferCache + FontEvictionPolicy + FontLoadQueue
  collaborators, so "Manager" is justified. Companion types file moved
  alongside (appliedFonts.ts -> fontLifecycle.ts).

Directories, file basenames, factory (createFontStore ->
createFontCatalogStore), and the AppliedFontsManagerDeps interface all
renamed. All consumers (ComparisonView, SampleList, FontList,
FontApplicator, FontVirtualList, FilterAndSortFonts bindings,
createFontRowSizeResolver, mocks) updated.
2026-05-24 20:00:43 +03:00
Ilia Mashkov 07d044f4d6 refactor: extract BatchFontStore into new FetchFontsByIds feature
The byId font fetch was a verb-oriented capability with a single
consumer driven by a feature need (materializing comparison picks).
That shape belongs at the feature layer, not on the entity.

Move:
- entities/Font/model/store/batchFontStore -> features/FetchFontsByIds/model/store/fontsByIdsStore
- Class BatchFontStore -> FontsByIdsStore

entities/Font retains the transport primitives (fetchFontsByIds,
seedFontCache) and the keyspace (fontKeys); the feature wraps them in
the reactive store. comparisonStore now imports FontsByIdsStore from
the new feature. The proxy API is imported via direct path so vi.spyOn
on the source module still observes the call.
2026-05-24 19:41:40 +03:00
Ilia Mashkov df59dfda02 refactor(features): rename SetupFont to AdjustTypography + reorganize
Structural:
- Merge factory + singleton from lib/settingsManager and model/state into
  one model/store/typographySettingsStore/ slice
- Drop now-empty lib/ and model/state/ directories

Semantic:
- Rename feature SetupFont -> AdjustTypography (the feature owns
  continuous typography adjustment, not one-time font setup)
- Drop "Manager" from TypographySettingsManager -> TypographySettingsStore
  (class + factory); singleton typographySettingsStore unchanged

All consumers (Character, Line, SampleList, SliderArea, FontSampler,
comparisonStore) updated. Public barrel signature changed: now exports
createTypographySettingsStore and type TypographySettingsStore.
2026-05-24 18:27:10 +03:00
Ilia Mashkov ca382fd43d refactor(features): rename GetFonts to FilterAndSortFonts
The feature does not fetch fonts — that lives in \$entities/Font's
fontStore. It owns the user's filter selections, sort preference, and
search-by-name query that drive the listing. The new name describes what
it actually does.

Directory + every \$features/GetFonts import path updated; no symbol
renames in this commit.
2026-05-24 18:16:16 +03:00
Ilia Mashkov e0d39d861f refactor(GetFonts): rename filters/filterManager to available/appliedFilterStore
The 'filters' + 'filterManager' pair didn't reveal the schema-vs-selection
split. Rename to reflect the actual roles:

- FiltersStore / filtersStore       → AvailableFilterStore / availableFilterStore
- createFilterManager / FilterManager → createAppliedFilterStore / AppliedFilterStore
- filterManager singleton            → appliedFilterStore
- mapManagerToParams                 → mapAppliedFiltersToParams

Directories and file basenames follow the new singleton names. Public
barrel signature updated; all consumers (Search, FontSearch, Filters,
FilterControls) point at the new identifiers.
2026-05-24 18:08:05 +03:00
Ilia Mashkov b6494a8cb5 test(GetFonts): cover filters and sortStore + nest each in its own dir
Export createSortStore and FiltersStore so per-test instances can be
constructed without sharing singleton state. Add unit tests covering:

- sortStore: default + custom init, display→API value mapping, set()
  idempotency, singleton shape
- filters: empty initial state, fetch population, single-call dedup,
  error path, cached-fetch reuse across observers

Group each store with its tests under its own directory to match the
filterManager layout.
2026-05-24 17:49:26 +03:00
Ilia Mashkov cc218934f4 fix(ComparisonView): update batchFontStore import path in test
Dynamic import inside the vi.mock('$entities/Font') factory was missed
when batchFontStore was relocated into its own subdirectory in 1573950.
Restores the previously-failing comparisonStore test suite (9 tests) and
clears the lingering TS error in svelte-check.
2026-05-24 16:05:59 +03:00
Ilia Mashkov 3a327e2d92 refactor(GetFonts): tighten mapManagerToParams + add coverage
Collapse the three duplicated getGroup/map/length-guard chains into a
single selectedIn helper. Drop the unnecessary `as string[]` casts —
Property<TValue extends string>.value already yields string at the call
site.

Add unit tests covering empty query, populated query, missing group,
empty group, single + multi selection, unknown group ids, and the
combined param shape.
2026-05-24 15:45:07 +03:00
Ilia Mashkov 30621c33df refactor(GetFonts): consolidate model/state into model/store
Align the slice with the project-wide convention (entities/Font,
entities/Breadcrumb, features/ChangeAppTheme all use model/store/;
CLAUDE.md spec calls for store/). Move bindings, filters, and the
filterManager subdir out of the now-removed model/state/ directory.
2026-05-24 15:33:26 +03:00
Ilia Mashkov cb8f6ffc97 refactor(GetFonts): unify filterManager factory + singleton under model/state
Merge the factory previously in lib/filterManager/ with the singleton
previously in model/state/manager.svelte.ts into a single
model/state/filterManager/ slice. The factory builds stateful runes-backed
objects, so it belongs alongside the singleton in model/, not in lib/.

lib/ now contains only the pure mapManagerToParams transform.
Public barrel signature unchanged.
2026-05-24 15:23:25 +03:00
Ilia Mashkov 33d3429060 refactor(GetFonts): consolidate filtersStore wiring into bindings
Move the filtersStore → filterManager.setGroups $effect.root out of
manager.svelte.ts into bindings.svelte.ts so all cross-store reactive
wiring for the feature lives in one place. manager.svelte.ts now only
constructs and exports the singleton.
2026-05-24 15:08:54 +03:00
Ilia Mashkov e60309af78 refactor(GetFonts): centralize filterManager/sortStore → fontStore bridge
Move the duplicated $effect blocks that mapped filterManager and sortStore
into fontStore params out of Search, FontSearch and FilterControls into a
single $effect.root in features/GetFonts/model/state/bindings.svelte.ts.

Consumers now bind to the manager/store directly; the bridge is installed
once via a side-effect import from the feature barrel.
2026-05-24 15:05:28 +03:00
Ilia Mashkov 1573950605 chore(Font): move batchFontStore to separate directory 2026-05-24 13:54:15 +03:00
ilia 773ab55f5c Merge pull request 'Fix/mobile comparison view' (#41) from fix/mobile-comparison-view into main
Workflow / build (push) Successful in 13s
Workflow / publish (push) Successful in 17s
Reviewed-on: #41
2026-05-23 18:21:47 +00:00
Ilia Mashkov 67e02e4e75 feat: tag every build with the immutable commit SHA
Workflow / build (pull_request) Successful in 38s
Workflow / publish (pull_request) Has been skipped
2026-05-23 21:20:37 +03:00
Ilia Mashkov 5ca7a433ff fix: use dvh units to prevent ComparisonView from being covered with address bar on mobile 2026-05-23 21:19:51 +03:00
ilia 3b6ea99d09 Merge pull request 'Fix/text morphing position' (#40) from fix/text-morphing-position into main
Workflow / build (push) Successful in 1m42s
Workflow / publish (push) Successful in 18s
Reviewed-on: #40
2026-05-23 17:43:07 +00:00
Ilia Mashkov f762a09c23 fix(SliderArea): temporarily replace pretext measurements with canvas
Workflow / build (pull_request) Successful in 1m53s
Workflow / publish (pull_request) Has been skipped
2026-05-23 20:07:39 +03:00
Ilia Mashkov 95ae72719e chore: move getPretextFontString into separate directory 2026-05-23 20:03:13 +03:00
ilia f3c4e72b86 Merge pull request 'Fixes/minor tweaks' (#39) from fixes/minor-tweaks into main
Workflow / build (push) Successful in 1m37s
Workflow / publish (push) Successful in 36s
Reviewed-on: #39
2026-05-23 14:11:58 +00:00
Ilia Mashkov f41c4aab9c feat: move class prop to wrapper
Workflow / build (pull_request) Successful in 3m55s
Workflow / publish (pull_request) Has been skipped
2026-05-23 17:00:29 +03:00
Ilia Mashkov d1eb83fa90 fix: wire the search to the store 2026-05-23 16:59:59 +03:00
Ilia Mashkov c01fc79a3e fix: add scrollMargin property since the IntersectionObserver has it 2026-05-05 17:04:23 +03:00
Ilia Mashkov 6bfa7ca777 chore: add .css files declaration 2026-05-05 17:03:43 +03:00
Ilia Mashkov 0d4356b8f1 chore: remove @ts-expect-error since scheduler was added in new TS release 2026-05-05 17:03:18 +03:00
Ilia Mashkov c18574d4c3 fix: remove deprecated tsconfig property 2026-05-05 17:02:25 +03:00
Ilia Mashkov 1c9a7f9fe1 chore: add .vscode to .gitignore 2026-05-05 16:49:56 +03:00
Ilia Mashkov fae6694479 chore(dprint): update markup_fmt plugin version, fix @render indentation and add couple of new rules 2026-05-05 16:49:27 +03:00
Ilia Mashkov a105c94176 chore: upgrade svelte-language-server to 0.18.0 2026-05-05 15:34:38 +03:00
Ilia Mashkov 77c2b27f8b chore: update remaining outdated packages (@chenglou/pretext 0.0.6, svelte-check 4.4.8) 2026-05-05 15:34:38 +03:00
Ilia Mashkov 1ce0d6c66f chore: upgrade tooling and ecosystem (jsdom 29, playwright 1.59.1, storybook 10.3.6) 2026-05-05 15:34:33 +03:00
Ilia Mashkov 6c20a68e19 chore: upgrade core build tooling (vite 8, svelte plugin 7, typescript 6) 2026-05-05 15:34:27 +03:00
Ilia Mashkov 3894912a22 feat(FontList): add a small gap for elements of ComparisonView sidebar font list 2026-05-05 12:05:19 +03:00
Ilia Mashkov e8d3727c6a feat: upgrade lucide icons to 1.14 2026-05-05 10:10:11 +03:00
Ilia Mashkov 5fbf090b24 fix(Footer): minor layout change 2026-05-05 10:06:30 +03:00
ilia a94e1f8b65 Merge pull request 'feat(shared): add cn utility for tailwind-aware class merging' (#38) from feature/minor-improvements into main
Workflow / build (push) Successful in 1m35s
Workflow / publish (push) Successful in 22s
Reviewed-on: #38
2026-04-23 12:11:02 +00:00
Ilia Mashkov f8ba2d7eb0 chore(Footer): move components to separate directories
Workflow / build (pull_request) Successful in 1m42s
Workflow / publish (pull_request) Has been skipped
2026-04-23 14:59:33 +03:00
Ilia Mashkov 3594033bcb feat(FooterLink): move FooterLink to the Footer widget layer, delete the one in shared/ui 2026-04-23 14:59:33 +03:00
Ilia Mashkov 2ae24912f7 feat(Footer): tweak the footer position 2026-04-23 14:59:32 +03:00
Ilia Mashkov 877719f106 feat(Link): create reusable Link ui component 2026-04-23 14:59:32 +03:00
Ilia Mashkov 4eafb96d35 feat(ComparisonView): replace window resize listener with ResiseObserver on the container to catch the container size change on sidebar open/close 2026-04-23 14:59:32 +03:00
Ilia Mashkov 652dfa5c90 feat: brand colored text selection 2026-04-23 14:59:32 +03:00
Ilia Mashkov 54087b7b2a feat: replace clsx with cn util 2026-04-23 14:59:32 +03:00
Ilia Mashkov cffebf05e3 feat(SliderArea): tweak the styles 2026-04-23 14:59:32 +03:00