Configuration for state transformation and filtering via ContextAwareStateOptions
A PropertyDecorator that sets up automatic subscription to the current limetype
Subscribes to: LimeTypeRepository
Updates: The decorated property with the current LimeType
Context-aware: Automatically reacts to changes in the component's context.limetype
Lifecycle: Automatically subscribes in connectedCallback and unsubscribes in disconnectedCallback
import { State } from '@stencil/core';
import { LimeType, SelectCurrentLimeType } from '@limetech/lime-web-components';
class MyComponent {
@State()
@SelectCurrentLimeType()
private currentType: LimeType;
}
import { State } from '@stencil/core';
import { LimeType, SelectCurrentLimeType } from '@limetech/lime-web-components';
class MyComponent {
@State()
@SelectCurrentLimeType({
map: [(limetype?: LimeType) => limetype?.localname.singular],
})
private typeDisplayName: string;
}
Decorator that subscribes to the limetype for the current context from the LimeTypeRepository.
This decorator automatically updates the decorated property whenever the current limetype changes. It uses the component's context.limetype to determine which type to select. When the context changes, the decorator automatically fetches the new limetype. It's the recommended approach over manual subscriptions as it handles subscription lifecycle and context changes automatically.