import { LimeType } from './limetype'; /** * Creates a function to find a limetype by its label in a collection of limetypes. * * The returned function searches through a collection of limetypes and returns * the first one that matches the given label. This function is typically used * to generate a callback for decorators or other higher-order logic. * * @param label - The label of the limetype to find. * @returns A function that takes a collection of limetypes and returns the first * limetype that matches the label, or `undefined` if no match is found. * * @example Finding the person limetype * ```ts * import { * LimeType, * PlatformServiceName, * findLimetypeByLabel, * } from '@limetech/lime-web-components'; * * const repository = platform.get(PlatformServiceName.LimeTypeRepository); * * // The returned function takes limetypes keyed by name, the same shape * // `SelectLimeTypes` gives a component * const limetypes: Record = {}; * for (const limetype of repository.getLimeTypes()) { * limetypes[limetype.name] = limetype; * } * * const findPersonLimetype = findLimetypeByLabel('person'); * const personLimetype = findPersonLimetype(limetypes); * ``` * * @example Using findLimetypeByLabel as a callback for a decorator * ```ts * import { State } from '@stencil/core'; * import { * LimeType, * SelectLimeTypes, * findLimetypeByLabel, * } from '@limetech/lime-web-components'; * * class MyComponent { * @State() * @SelectLimeTypes({ * map: [findLimetypeByLabel('person')], * }) * private personLimetype: LimeType; * } * ``` * * @public * @group Lime types */ export declare const findLimetypeByLabel: (label: string) => (limetypes: Record) => LimeType | undefined;