Install
useLogoSoup Composable
Reactive Options
Every option accepts a plain value, aref, or a getter function (MaybeRefOrGetter). The composable auto-tracks dependencies via watchEffect and re-processes whenever any option changes.
Options Type
toValue() internally.
Return Value
| Property | Type | Description |
|---|---|---|
state | ShallowRef<LogoSoupState> | Raw reactive state from the engine |
isLoading | ComputedRef<boolean> | true while images are being loaded |
isReady | ComputedRef<boolean> | true when normalization is complete |
normalizedLogos | ComputedRef<NormalizedLogo[]> | The processed logos |
error | ComputedRef<Error | null> | Set if all images fail to load |
watchEffect automatically tracks changes.
Visual Center Alignment
Apply visual center alignment with thegetVisualCenterTransform helper from the core package:
Using in Effect Scopes
The composable usesonScopeDispose (not onUnmounted) for cleanup, so it works correctly inside any Vue effect scope, not just components. This means you can use it in composables that create their own effectScope:
How It Works Under the Hood
The Vue adapter creates a corecreateLogoSoup engine instance and bridges it to Vue’s reactivity system:
shallowRefholds the engine’s state snapshot (notref, since the snapshot is an immutable object that doesn’t need deep reactivity)watchEffectauto-tracks which options are read and re-runsengine.process()when they changeonScopeDisposeunsubscribes and destroys the engine when the scope is torn downcomputedrefs derive convenience properties (isLoading,isReady, etc.) from the shallow ref