import { Key } from '@aurelia/kernel'; import type { Constructable, IContainer, ResourceDefinition, PartialResourceDefinition, ResourceType } from '@aurelia/kernel'; import type { BindableDefinition, PartialBindableDefinition } from '../bindable'; import type { ICustomAttributeViewModel, ICustomAttributeController } from '../templating/controller'; import type { IWatchDefinition } from '../watch'; import { type IResourceKind } from './resources-shared'; import { IAttributeComponentDefinition } from '@aurelia/template-compiler'; export type PartialCustomAttributeDefinition = PartialResourceDefinition & { readonly isTemplateController?: boolean; readonly bindables?: (Record>) | (TBindables | PartialBindableDefinition & { name: TBindables; })[]; /** * A config that can be used by template compliler to change attr value parsing mode * `true` to always parse as a single value, mostly will be string in URL scenario * Example: * ```html *
* ``` * With `noMultiBinding: true`, user does not need to escape the `:` with `\` * or use binding command to escape it. * * With `noMultiBinding: false (default)`, the above will be parsed as it's binding * to a property name `http`, with value equal to literal string `//bla.bla.com` */ readonly noMultiBindings?: boolean; readonly watches?: IWatchDefinition[]; readonly dependencies?: readonly Key[]; /** * **Only used by template controller custom attributes.** * * Container strategy for the view factory of this template controller. * * By default, the view factory will be reusing the container of the parent view (controller), * as this container has information about the resources registered. * * Specify `'new'` to create a new container for the view factory. */ readonly containerStrategy?: 'reuse' | 'new'; }>; export type CustomAttributeStaticAuDefinition = PartialCustomAttributeDefinition & { type: 'custom-attribute'; }; export type CustomAttributeType = ResourceType; export type CustomAttributeKind = IResourceKind & { for(node: Node, name: string): ICustomAttributeController | undefined; closest ? Constructable : Constructable = A extends Constructable ? Constructable : Constructable>(node: Node, Type: CustomAttributeType): ICustomAttributeController> | null; closest ? Constructable : Constructable = A extends Constructable ? Constructable : Constructable>(node: Node, name: string): ICustomAttributeController> | null; isType(value: T): value is (T extends Constructable ? CustomAttributeType : never); define(name: string, Type: T): CustomAttributeType; define(def: PartialCustomAttributeDefinition, Type: T): CustomAttributeType; define(nameOrDef: string | PartialCustomAttributeDefinition, Type: T): CustomAttributeType; getDefinition(Type: T, context?: DecoratorContext | null): CustomAttributeDefinition; getDefinition(Type: Function, context?: DecoratorContext | null): CustomAttributeDefinition; annotate(Type: Constructable, prop: K, value: PartialCustomAttributeDefinition[K]): void; getAnnotation(Type: Constructable, prop: K, context: DecoratorContext | undefined | null): PartialCustomAttributeDefinition[K] | undefined; find(c: IContainer, name: string): CustomAttributeDefinition | null; }; export type CustomAttributeDecorator = (Type: T, context: ClassDecoratorContext) => CustomAttributeType; /** * Decorator: Indicates that the decorated class is a custom attribute. */ export declare function customAttribute(definition: PartialCustomAttributeDefinition): CustomAttributeDecorator; export declare function customAttribute(name: string): CustomAttributeDecorator; export declare function customAttribute(nameOrDef: string | PartialCustomAttributeDefinition): CustomAttributeDecorator; /** * Decorator: Applied to custom attributes. Indicates that whatever element the * attribute is placed on should be converted into a template and that this * attribute controls the instantiation of the template. */ export declare function templateController(definition: Omit): CustomAttributeDecorator; export declare function templateController(name: string): CustomAttributeDecorator; export declare function templateController(nameOrDef: string | Omit): CustomAttributeDecorator; export declare class CustomAttributeDefinition implements ResourceDefinition { readonly Type: CustomAttributeType; readonly name: string; readonly aliases: readonly string[]; readonly key: string; readonly isTemplateController: boolean; readonly bindables: Record; readonly noMultiBindings: boolean; readonly watches: IWatchDefinition[]; readonly dependencies: Key[]; readonly containerStrategy: 'reuse' | 'new'; readonly defaultProperty: string; get type(): 'custom-attribute'; private constructor(); static create(nameOrDef: string | PartialCustomAttributeDefinition, Type: CustomAttributeType): CustomAttributeDefinition; register(container: IContainer, aliasName?: string | undefined): void; toString(): string; } export declare const CustomAttribute: Readonly; //# sourceMappingURL=custom-attribute.d.ts.map