Chore/architecture refactoring #42
@@ -1,19 +1,25 @@
|
|||||||
|
export { mapManagerToParams } from './lib';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
/**
|
||||||
|
* Filter Manager
|
||||||
|
*/
|
||||||
createFilterManager,
|
createFilterManager,
|
||||||
type FilterManager,
|
type FilterManager,
|
||||||
mapManagerToParams,
|
filterManager,
|
||||||
} from './lib';
|
/**
|
||||||
|
* Filter Store
|
||||||
export { filtersStore } from './model/state/filters.svelte';
|
*/
|
||||||
export { filterManager } from './model/state/manager.svelte';
|
filtersStore,
|
||||||
|
/**
|
||||||
export {
|
* Sort Store
|
||||||
|
*/
|
||||||
SORT_MAP,
|
SORT_MAP,
|
||||||
SORT_OPTIONS,
|
SORT_OPTIONS,
|
||||||
type SortApiValue,
|
type SortApiValue,
|
||||||
type SortOption,
|
type SortOption,
|
||||||
sortStore,
|
sortStore,
|
||||||
} from './model/store/sortStore.svelte';
|
} from './model';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
FilterControls,
|
FilterControls,
|
||||||
|
|||||||
@@ -1,6 +1 @@
|
|||||||
export {
|
|
||||||
createFilterManager,
|
|
||||||
type FilterManager,
|
|
||||||
} from './filterManager/filterManager.svelte';
|
|
||||||
|
|
||||||
export { mapManagerToParams } from './mapper/mapManagerToParams';
|
export { mapManagerToParams } from './mapper/mapManagerToParams';
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { ProxyFontsParams } from '$entities/Font/api';
|
import type { ProxyFontsParams } from '$entities/Font/api';
|
||||||
import type { FilterManager } from '../filterManager/filterManager.svelte';
|
import type { FilterManager } from '../../model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maps filter manager to proxy API parameters.
|
* Maps filter manager to proxy API parameters.
|
||||||
|
|||||||
@@ -23,11 +23,19 @@ export {
|
|||||||
* Main filter controller
|
* Main filter controller
|
||||||
*/
|
*/
|
||||||
export {
|
export {
|
||||||
|
/**
|
||||||
|
* Factory for constructing a filter manager instance
|
||||||
|
*/
|
||||||
|
createFilterManager,
|
||||||
|
/**
|
||||||
|
* Reactive interface returned by `createFilterManager`
|
||||||
|
*/
|
||||||
|
type FilterManager,
|
||||||
/**
|
/**
|
||||||
* High-level manager for syncing search and filters
|
* High-level manager for syncing search and filters
|
||||||
*/
|
*/
|
||||||
filterManager,
|
filterManager,
|
||||||
} from './state/manager.svelte';
|
} from './state/filterManager/filterManager.svelte';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Side-effect import: installs the global filterManager+sortStore → fontStore
|
* Side-effect import: installs the global filterManager+sortStore → fontStore
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ import { fontStore } from '$entities/Font';
|
|||||||
import { untrack } from 'svelte';
|
import { untrack } from 'svelte';
|
||||||
import { mapManagerToParams } from '../../lib/mapper/mapManagerToParams';
|
import { mapManagerToParams } from '../../lib/mapper/mapManagerToParams';
|
||||||
import { sortStore } from '../store/sortStore.svelte';
|
import { sortStore } from '../store/sortStore.svelte';
|
||||||
|
import { filterManager } from './filterManager/filterManager.svelte';
|
||||||
import { filtersStore } from './filters.svelte';
|
import { filtersStore } from './filters.svelte';
|
||||||
import { filterManager } from './manager.svelte';
|
|
||||||
|
|
||||||
$effect.root(() => {
|
$effect.root(() => {
|
||||||
/**
|
/**
|
||||||
|
|||||||
+20
-5
@@ -1,9 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* Filter manager for font filtering
|
* Filter manager factory and singleton.
|
||||||
*
|
*
|
||||||
* Manages multiple filter groups (providers, categories, subsets)
|
* Owns multiple filter groups (providers, categories, subsets) plus a
|
||||||
* with debounced search input. Provides reactive state for filter
|
* debounced search input. Provides reactive state for filter selections
|
||||||
* selections and convenience methods for bulk operations.
|
* and convenience methods for bulk operations.
|
||||||
|
*
|
||||||
|
* The factory (`createFilterManager`) is exported for tests; the app
|
||||||
|
* consumes the `filterManager` singleton at the bottom of this file.
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* ```ts
|
* ```ts
|
||||||
@@ -25,7 +28,7 @@ import { createDebouncedState } from '$shared/lib/helpers';
|
|||||||
import type {
|
import type {
|
||||||
FilterConfig,
|
FilterConfig,
|
||||||
FilterGroupConfig,
|
FilterGroupConfig,
|
||||||
} from '../../model';
|
} from '../../types/filter';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a filter manager instance
|
* Creates a filter manager instance
|
||||||
@@ -123,3 +126,15 @@ export function createFilterManager<TValue extends string>(config: FilterConfig<
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type FilterManager = ReturnType<typeof createFilterManager>;
|
export type FilterManager = ReturnType<typeof createFilterManager>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App-wide filter manager singleton.
|
||||||
|
*
|
||||||
|
* Constructed with empty groups; the filtersStore → filterManager wiring
|
||||||
|
* lives in `./bindings.svelte` and populates groups once backend filter
|
||||||
|
* metadata arrives.
|
||||||
|
*/
|
||||||
|
export const filterManager = createFilterManager({
|
||||||
|
queryValue: '',
|
||||||
|
groups: [],
|
||||||
|
});
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
/**
|
|
||||||
* Filter manager singleton.
|
|
||||||
*
|
|
||||||
* Constructed with empty groups; the filtersStore → filterManager wiring
|
|
||||||
* lives in `./bindings.svelte` and populates groups once the backend
|
|
||||||
* filter metadata arrives.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { createFilterManager } from '../../lib/filterManager/filterManager.svelte';
|
|
||||||
|
|
||||||
export const filterManager = createFilterManager({
|
|
||||||
queryValue: '',
|
|
||||||
groups: [],
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user