import { IExpressionParser } from '@aurelia/expression-parser'; import { IAttrMapper } from './attribute-mapper'; import { type PropertyBindingInstruction, type IInstruction, IteratorBindingInstruction, ListenerBindingInstruction, AttributeBindingInstruction, RefBindingInstruction, SpreadValueBindingInstruction } from './instructions'; import type { Constructable, IContainer, IServiceLocator, PartialResourceDefinition, ResourceDefinition, ResourceType } from '@aurelia/kernel'; import { AttrSyntax } from './attribute-pattern'; import { IAttributeComponentDefinition, IElementComponentDefinition, IComponentBindablePropDefinition } from './interfaces-template-compiler'; export type PartialBindingCommandDefinition = PartialResourceDefinition; export type BindingCommandStaticAuDefinition = PartialBindingCommandDefinition & { type: 'binding-command'; }; export interface IPlainAttrCommandInfo { readonly node: Element; readonly attr: AttrSyntax; readonly bindable: null; readonly def: null; } export interface IBindableCommandInfo { readonly node: Element; readonly attr: AttrSyntax; readonly bindable: IComponentBindablePropDefinition; readonly def: IAttributeComponentDefinition | IElementComponentDefinition; } export type ICommandBuildInfo = IPlainAttrCommandInfo | IBindableCommandInfo; export type BindingCommandInstance = { /** * Characteristics of a binding command. * - `false`: The normal process (check custom attribute -> check bindable -> command.build()) should take place. * - `true`: The binding command wants to take over the processing of an attribute. The template compiler keeps the attribute as is in compilation, instead of executing the normal process. */ ignoreAttr: boolean; build(info: ICommandBuildInfo, parser: IExpressionParser, mapper: IAttrMapper): IInstruction; } & T; export type BindingCommandType = ResourceType; export type BindingCommandKind = { readonly name: string; keyFrom(name: string): string; define(name: string, Type: T): BindingCommandType; define(def: PartialBindingCommandDefinition, Type: T): BindingCommandType; define(nameOrDef: string | PartialBindingCommandDefinition, Type: T): BindingCommandType; getAnnotation(Type: Constructable, prop: K): PartialBindingCommandDefinition[K] | undefined; find(container: IContainer, name: string): BindingCommandDefinition | null; get(container: IServiceLocator, name: string): BindingCommandInstance; }; export type BindingCommandDecorator = (Type: T, context: ClassDecoratorContext) => BindingCommandType; /** * Decorator to describe a class as a binding command resource */ export declare function bindingCommand(name: string): BindingCommandDecorator; export declare function bindingCommand(definition: PartialBindingCommandDefinition): BindingCommandDecorator; export declare class BindingCommandDefinition implements ResourceDefinition { readonly Type: BindingCommandType; readonly name: string; readonly aliases: readonly string[]; readonly key: string; private constructor(); static create(nameOrDef: string | PartialBindingCommandDefinition, Type: BindingCommandType): BindingCommandDefinition; register(container: IContainer, aliasName?: string | undefined): void; } export declare const BindingCommand: Readonly; export declare class OneTimeBindingCommand implements BindingCommandInstance { static readonly $au: BindingCommandStaticAuDefinition; get ignoreAttr(): boolean; build(info: ICommandBuildInfo, exprParser: IExpressionParser, attrMapper: IAttrMapper): PropertyBindingInstruction; } export declare class ToViewBindingCommand implements BindingCommandInstance { static readonly $au: BindingCommandStaticAuDefinition; get ignoreAttr(): boolean; build(info: ICommandBuildInfo, exprParser: IExpressionParser, attrMapper: IAttrMapper): PropertyBindingInstruction; } export declare class FromViewBindingCommand implements BindingCommandInstance { static readonly $au: BindingCommandStaticAuDefinition; get ignoreAttr(): boolean; build(info: ICommandBuildInfo, exprParser: IExpressionParser, attrMapper: IAttrMapper): PropertyBindingInstruction; } export declare class TwoWayBindingCommand implements BindingCommandInstance { static readonly $au: BindingCommandStaticAuDefinition; get ignoreAttr(): boolean; build(info: ICommandBuildInfo, exprParser: IExpressionParser, attrMapper: IAttrMapper): PropertyBindingInstruction; } export declare class DefaultBindingCommand implements BindingCommandInstance { static readonly $au: BindingCommandStaticAuDefinition; get ignoreAttr(): boolean; build(info: ICommandBuildInfo, exprParser: IExpressionParser, attrMapper: IAttrMapper): PropertyBindingInstruction; } export declare class ForBindingCommand implements BindingCommandInstance { static readonly $au: BindingCommandStaticAuDefinition; get ignoreAttr(): boolean; build(info: ICommandBuildInfo, exprParser: IExpressionParser): IteratorBindingInstruction; } export declare class TriggerBindingCommand implements BindingCommandInstance { static readonly $au: BindingCommandStaticAuDefinition; get ignoreAttr(): boolean; build(info: ICommandBuildInfo, exprParser: IExpressionParser): ListenerBindingInstruction; } export declare class CaptureBindingCommand implements BindingCommandInstance { static readonly $au: BindingCommandStaticAuDefinition; get ignoreAttr(): boolean; build(info: ICommandBuildInfo, exprParser: IExpressionParser): ListenerBindingInstruction; } /** * Attr binding command. Compile attr with binding symbol with command `attr` to `AttributeBindingInstruction` */ export declare class AttrBindingCommand implements BindingCommandInstance { static readonly $au: BindingCommandStaticAuDefinition; get ignoreAttr(): boolean; build(info: ICommandBuildInfo, exprParser: IExpressionParser): AttributeBindingInstruction; } /** * Style binding command. Compile attr with binding symbol with command `style` to `AttributeBindingInstruction` */ export declare class StyleBindingCommand implements BindingCommandInstance { static readonly $au: BindingCommandStaticAuDefinition; get ignoreAttr(): boolean; build(info: ICommandBuildInfo, exprParser: IExpressionParser): AttributeBindingInstruction; } /** * Class binding command. Compile attr with binding symbol with command `class` to `AttributeBindingInstruction` */ export declare class ClassBindingCommand implements BindingCommandInstance { static readonly $au: BindingCommandStaticAuDefinition; get ignoreAttr(): boolean; build(info: ICommandBuildInfo, exprParser: IExpressionParser): AttributeBindingInstruction; } /** * Binding command to refer different targets (element, custom element/attribute view models, controller) attached to an element */ export declare class RefBindingCommand implements BindingCommandInstance { static readonly $au: BindingCommandStaticAuDefinition; get ignoreAttr(): boolean; build(info: ICommandBuildInfo, exprParser: IExpressionParser): RefBindingInstruction; } export declare class SpreadValueBindingCommand implements BindingCommandInstance { static readonly $au: BindingCommandStaticAuDefinition; get ignoreAttr(): boolean; build(info: ICommandBuildInfo): SpreadValueBindingInstruction; } //# sourceMappingURL=binding-command.d.ts.map