200 lines
4.0 KiB
TypeScript
200 lines
4.0 KiB
TypeScript
/**
|
|
* Reactive helper factories using Svelte 5 runes
|
|
*
|
|
* Provides composable state management patterns for common UI needs:
|
|
* - Filter management with multi-selection
|
|
* - Typography controls with bounds and stepping
|
|
* - Virtual scrolling for large lists
|
|
* - Debounced state for search inputs
|
|
* - Entity stores with O(1) lookups
|
|
* - Character-by-character font comparison
|
|
* - Persistent localStorage-backed state
|
|
* - Responsive breakpoint tracking
|
|
* - 3D perspective animations
|
|
*
|
|
* @example
|
|
* ```ts
|
|
* import { createFilter, createVirtualizer, createTypographyControl } from '$shared/lib/helpers';
|
|
*
|
|
* const filter = createFilter({ properties: [...] });
|
|
* const virtualizer = createVirtualizer(() => ({ count: 1000, estimateSize: () => 50 }));
|
|
* const control = createTypographyControl({ value: 16, min: 12, max: 72, step: 1 });
|
|
* ```
|
|
*/
|
|
|
|
/**
|
|
* Filter management
|
|
*/
|
|
export {
|
|
/**
|
|
* Reactive filter factory
|
|
*/
|
|
createFilter,
|
|
/**
|
|
* Filter instance type
|
|
*/
|
|
type Filter,
|
|
/**
|
|
* Initial state model
|
|
*/
|
|
type FilterModel,
|
|
/**
|
|
* Filterable property definition
|
|
*/
|
|
type Property,
|
|
} from './createFilter/createFilter.svelte';
|
|
|
|
/**
|
|
* Bounded numeric controls
|
|
*/
|
|
export {
|
|
/**
|
|
* Base numeric configuration
|
|
*/
|
|
type ControlDataModel,
|
|
/**
|
|
* Extended model with labels
|
|
*/
|
|
type ControlModel,
|
|
/**
|
|
* Reactive control factory
|
|
*/
|
|
createTypographyControl,
|
|
/**
|
|
* Control instance type
|
|
*/
|
|
type TypographyControl,
|
|
} from './createTypographyControl/createTypographyControl.svelte';
|
|
|
|
/**
|
|
* List virtualization
|
|
*/
|
|
export {
|
|
/**
|
|
* Reactive virtualizer factory
|
|
*/
|
|
createVirtualizer,
|
|
/**
|
|
* Rendered item layout data
|
|
*/
|
|
type VirtualItem,
|
|
/**
|
|
* Virtualizer instance type
|
|
*/
|
|
type Virtualizer,
|
|
/**
|
|
* Configuration options
|
|
*/
|
|
type VirtualizerOptions,
|
|
} from './createVirtualizer/createVirtualizer.svelte';
|
|
|
|
/**
|
|
* UI State
|
|
*/
|
|
export {
|
|
/**
|
|
* Immediate/debounced state factory
|
|
*/
|
|
createDebouncedState,
|
|
} from './createDebouncedState/createDebouncedState.svelte';
|
|
|
|
/**
|
|
* Entity collections
|
|
*/
|
|
export {
|
|
/**
|
|
* Reactive entity store factory
|
|
*/
|
|
createEntityStore,
|
|
/**
|
|
* Base entity requirement
|
|
*/
|
|
type Entity,
|
|
/**
|
|
* Entity store instance type
|
|
*/
|
|
type EntityStore,
|
|
} from './createEntityStore/createEntityStore.svelte';
|
|
|
|
/**
|
|
* Comparison logic
|
|
*/
|
|
export {
|
|
/**
|
|
* Character-by-character comparison utility
|
|
*/
|
|
CharacterComparisonEngine,
|
|
/**
|
|
* Single line of comparison results
|
|
*/
|
|
type ComparisonLine,
|
|
/**
|
|
* Full comparison output
|
|
*/
|
|
type ComparisonResult,
|
|
} from './CharacterComparisonEngine/CharacterComparisonEngine.svelte';
|
|
|
|
/**
|
|
* Text layout
|
|
*/
|
|
export {
|
|
/**
|
|
* Single line layout information
|
|
*/
|
|
type LayoutLine as TextLayoutLine,
|
|
/**
|
|
* Full multi-line layout information
|
|
*/
|
|
type LayoutResult as TextLayoutResult,
|
|
/**
|
|
* High-level text measurement engine
|
|
*/
|
|
TextLayoutEngine,
|
|
} from './TextLayoutEngine/TextLayoutEngine.svelte';
|
|
|
|
/**
|
|
* Persistence
|
|
*/
|
|
export {
|
|
/**
|
|
* LocalStorage-backed reactive store factory
|
|
*/
|
|
createPersistentStore,
|
|
/**
|
|
* Persistent store instance type
|
|
*/
|
|
type PersistentStore,
|
|
} from './createPersistentStore/createPersistentStore.svelte';
|
|
|
|
/**
|
|
* Responsive design
|
|
*/
|
|
export {
|
|
/**
|
|
* Breakpoint tracking factory
|
|
*/
|
|
createResponsiveManager,
|
|
/**
|
|
* Responsive manager instance type
|
|
*/
|
|
type ResponsiveManager,
|
|
/**
|
|
* Singleton manager for global usage
|
|
*/
|
|
responsiveManager,
|
|
} from './createResponsiveManager/createResponsiveManager.svelte';
|
|
|
|
/**
|
|
* 3D Perspectives
|
|
*/
|
|
export {
|
|
/**
|
|
* Motion-aware perspective factory
|
|
*/
|
|
createPerspectiveManager,
|
|
/**
|
|
* Perspective manager instance type
|
|
*/
|
|
type PerspectiveManager,
|
|
} from './createPerspectiveManager/createPerspectiveManager.svelte';
|