import { StateOptions, LimeWebComponent, ContextAwareStateOptions } from '../core'; /** * Config for the {@link SelectLimeObjects} state decorator * @public * @group Lime objects */ export interface SelectLimeObjectsOptions extends StateOptions { /** * LimeType of the object */ limetype?: string; /** * A function to get the limetype */ getLimetype?: (component: LimeWebComponent) => string; /** * Id of the limeobject */ id?: number; } /** * Decorator that subscribes to limeobjects from the {@link LimeObjectRepository}. * * This decorator automatically updates the decorated property whenever limeobjects * change in the platform. You can specify which limetype to fetch objects for, or * get all objects across all limetypes. It's the recommended approach over manual * subscriptions as it handles subscription lifecycle automatically. * * @param options - Configuration including limetype selection and state transformation via {@link SelectLimeObjectsOptions}. * @returns A PropertyDecorator that sets up automatic subscription to limeobjects. * * @remarks * Subscribes to: {@link LimeObjectRepository} * * Updates: The decorated property with limeobjects (typically `Record`) * * Lifecycle: Automatically subscribes in `connectedCallback` and * unsubscribes in `disconnectedCallback` of the component. * * @example Basic usage with decorator * ```ts * import { State } from '@stencil/core'; * import { LimeObject, SelectLimeObjects } from '@limetech/lime-web-components'; * * class MyComponent { * @State() * @SelectLimeObjects() * private allObjects: Record; * } * ``` * * @example Get objects for specific limetype with transformation * ```ts * import { State } from '@stencil/core'; * import { LimeObject, SelectLimeObjects } from '@limetech/lime-web-components'; * * class MyComponent { * @State() * @SelectLimeObjects({ * limetype: 'company', * map: [ * (objects: Record) => objects['company'] ?? [], * ], * }) * private companies: LimeObject[]; * } * ``` * * @public * @group Lime objects */ export declare function SelectLimeObjects(options?: SelectLimeObjectsOptions): PropertyDecorator; /** * Decorator that subscribes to the limeobject for the current context from the {@link LimeObjectRepository}. * * This decorator automatically updates the decorated property whenever the current * limeobject changes. It uses the component's context (limetype and id) to determine * which object to select. When the context changes, the decorator automatically fetches * the new object. It's the recommended approach over manual subscriptions as it handles * subscription lifecycle and context changes automatically. * * @param options - Configuration for state transformation and filtering via {@link ContextAwareStateOptions}. * @returns A PropertyDecorator that sets up automatic subscription to the current limeobject. * * @remarks * Subscribes to: {@link LimeObjectRepository} * * Updates: The decorated property with the current {@link LimeObject} * * Context-aware: Automatically reacts to changes in the component's context.limetype and context.id * * Lifecycle: Automatically subscribes in `connectedCallback` and * unsubscribes in `disconnectedCallback` of the component. * * @example Basic usage - automatically gets the limeobject for current context * ```ts * import { State } from '@stencil/core'; * import { * LimeObject, * SelectCurrentLimeObject, * } from '@limetech/lime-web-components'; * * class MyComponent { * @State() * @SelectCurrentLimeObject() * private currentObject: LimeObject; * } * ``` * * @example Transform object data with map function * ```ts * import { State } from '@stencil/core'; * import { * LimeObject, * SelectCurrentLimeObject, * } from '@limetech/lime-web-components'; * * class MyComponent { * @State() * @SelectCurrentLimeObject({ * map: [(limeObject: LimeObject) => limeObject?.getValue('name')], * }) * private objectName: string; * } * ``` * * @public * @group Lime objects */ export declare function SelectCurrentLimeObject(options?: ContextAwareStateOptions): PropertyDecorator;