@aurelia/runtime-html
Advanced tools
Comparing version 2.0.1-dev.202404171154 to 2.0.1-dev.202404281254
import { Class } from '@aurelia/kernel'; | ||
import { type BindingMode } from './binding/interfaces-bindings'; | ||
import type { Constructable } from '@aurelia/kernel'; | ||
import type { InterceptorFunc } from '@aurelia/runtime'; | ||
import { BindingMode, IComponentBindablePropDefinition } from '@aurelia/template-compiler'; | ||
type PropertyType = typeof Number | typeof String | typeof Boolean | typeof BigInt | { | ||
coercer: InterceptorFunc; | ||
} | Class<unknown>; | ||
export type PartialBindableDefinition = { | ||
mode?: BindingMode; | ||
export type PartialBindableDefinition = Omit<IComponentBindablePropDefinition, 'name'> & { | ||
callback?: string; | ||
attribute?: string; | ||
name?: string; | ||
primary?: boolean; | ||
set?: InterceptorFunc; | ||
@@ -23,3 +20,2 @@ type?: PropertyType; | ||
}; | ||
type PartialBindableDefinitionPropertyOmitted = Omit<PartialBindableDefinition, 'name'>; | ||
/** | ||
@@ -31,3 +27,3 @@ * Decorator: Specifies custom behavior for a bindable property. | ||
*/ | ||
export declare function bindable(config?: PartialBindableDefinitionPropertyOmitted): (target: unknown, context: ClassDecoratorContext | ClassFieldDecoratorContext | ClassGetterDecoratorContext) => void; | ||
export declare function bindable(config?: Omit<PartialBindableDefinition, 'name'>): (target: unknown, context: ClassDecoratorContext | ClassFieldDecoratorContext | ClassGetterDecoratorContext) => void; | ||
/** | ||
@@ -34,0 +30,0 @@ * Decorator: Specifies a bindable property on a class. |
@@ -47,2 +47,3 @@ import { type IServiceLocator, type Constructable } from '@aurelia/kernel'; | ||
export declare const mixingBindingLimited: <T extends IBinding>(target: Constructable<T>, getMethodName: (binding: T, opts: IRateLimitOptions) => keyof T) => void; | ||
export declare const createPrototypeMixer: (mixer: () => void) => <T extends Constructable<IBinding>>(this: T) => void; | ||
//# sourceMappingURL=binding-utils.d.ts.map |
@@ -5,21 +5,3 @@ import { IDisposable, IServiceLocator } from '@aurelia/kernel'; | ||
import { TaskQueue } from '@aurelia/platform'; | ||
/** | ||
* Mode of a binding to operate | ||
* - 1 / one time - bindings should only update the target once | ||
* - 2 / to view - bindings should update the target and observe the source for changes to update again | ||
* - 3 / from view - bindings should update the source and observe the target for changes to update again | ||
* - 6 / two way - bindings should observe both target and source for changes to update the other side | ||
* - 8 / default - undecided mode, bindings, depends on the circumstance, may decide what to do accordingly | ||
*/ | ||
export declare const BindingMode: Readonly<{ | ||
readonly oneTime: 1; | ||
readonly toView: 2; | ||
readonly fromView: 4; | ||
readonly twoWay: 6; | ||
/** | ||
* Unspecified mode, bindings may act differently with this mode | ||
*/ | ||
readonly default: 8; | ||
}>; | ||
export type BindingMode = typeof BindingMode[keyof typeof BindingMode]; | ||
export { BindingMode } from '@aurelia/template-compiler'; | ||
export interface IBindingController { | ||
@@ -26,0 +8,0 @@ readonly state: State; |
@@ -12,2 +12,3 @@ import type { IServiceLocator } from '@aurelia/kernel'; | ||
target: object; | ||
static mix: <T extends import("@aurelia/kernel").Constructable<IBinding>>(this: T) => void; | ||
isBound: boolean; | ||
@@ -14,0 +15,0 @@ constructor(locator: IServiceLocator, ast: IsBindingBehavior, target: object); |
@@ -7,3 +7,4 @@ import { IServiceLocator, Key } from '@aurelia/kernel'; | ||
import { ICustomElementController, IHydrationContext, IController } from '../templating/controller'; | ||
import { IHasController, ITemplateCompiler } from '../renderer'; | ||
import { IHasController } from '../renderer'; | ||
import { ITemplateCompiler } from '@aurelia/template-compiler'; | ||
import { IRendering } from '../templating/rendering'; | ||
@@ -10,0 +11,0 @@ import { IPlatform } from '../platform'; |
@@ -1,6 +0,4 @@ | ||
export interface IAttrMapper extends AttrMapper { | ||
} | ||
export declare const IAttrMapper: import("@aurelia/kernel").InterfaceSymbol<IAttrMapper>; | ||
export type IsTwoWayPredicate = (element: Element, attribute: string) => boolean; | ||
export declare class AttrMapper { | ||
import { IAttrMapper, IsTwoWayPredicate } from '@aurelia/template-compiler'; | ||
export declare class AttrMapper implements IAttrMapper { | ||
static register: <C extends import("@aurelia/kernel").Constructable>(this: C, container: import("@aurelia/kernel").IContainer) => void; | ||
private readonly svg; | ||
@@ -7,0 +5,0 @@ constructor(); |
@@ -1,61 +0,6 @@ | ||
import { ITemplateCompiler } from '../renderer'; | ||
import { BindableDefinition } from '../bindable'; | ||
import { AttrSyntax } from '../resources/attribute-pattern'; | ||
import { CustomElementDefinition } from '../resources/custom-element'; | ||
import { BindingCommandInstance } from '../resources/binding-command'; | ||
import type { IContainer, Constructable } from '@aurelia/kernel'; | ||
import type { CustomAttributeDefinition } from '../resources/custom-attribute'; | ||
import type { ICompliationInstruction, IInstruction } from '../renderer'; | ||
export declare class TemplateCompiler implements ITemplateCompiler { | ||
static register(container: IContainer): void; | ||
debug: boolean; | ||
resolveResources: boolean; | ||
compile(definition: CustomElementDefinition, container: IContainer, compilationInstruction: ICompliationInstruction | null): CustomElementDefinition; | ||
compileSpread(requestor: CustomElementDefinition, attrSyntaxs: AttrSyntax[], container: IContainer, target: Element, targetDef?: CustomElementDefinition): IInstruction[]; | ||
} | ||
export interface IAttributeBindablesInfo { | ||
readonly attrs: Record<string, BindableDefinition>; | ||
readonly bindables: Record<string, BindableDefinition>; | ||
readonly primary: BindableDefinition; | ||
} | ||
export interface IElementBindablesInfo { | ||
readonly attrs: Record<string, BindableDefinition>; | ||
readonly bindables: Record<string, BindableDefinition>; | ||
readonly primary: null; | ||
} | ||
export interface IBindablesInfoResolver { | ||
get(def: CustomAttributeDefinition): IAttributeBindablesInfo; | ||
get(def: CustomElementDefinition): IElementBindablesInfo; | ||
} | ||
export declare const IBindablesInfoResolver: import("@aurelia/kernel").InterfaceSymbol<IBindablesInfoResolver>; | ||
export interface IResourceResolver { | ||
el(c: IContainer, name: string): CustomElementDefinition | null; | ||
attr(c: IContainer, name: string): CustomAttributeDefinition | null; | ||
command(c: IContainer, name: string): BindingCommandInstance | null; | ||
} | ||
export declare const IResourceResolver: import("@aurelia/kernel").InterfaceSymbol<IResourceResolver>; | ||
import { type IRegistry } from '@aurelia/kernel'; | ||
/** | ||
* An interface describing the hooks a compilation process should invoke. | ||
* | ||
* A feature available to the default template compiler. | ||
* A group of registrations to connect the template compiler with the aurelia runtime implementation | ||
*/ | ||
export declare const ITemplateCompilerHooks: import("@aurelia/kernel").InterfaceSymbol<ITemplateCompilerHooks>; | ||
export interface ITemplateCompilerHooks { | ||
/** | ||
* Should be invoked immediately before a template gets compiled | ||
*/ | ||
compiling?(template: HTMLElement): void; | ||
} | ||
export declare const TemplateCompilerHooks: Readonly<{ | ||
name: string; | ||
define<K extends ITemplateCompilerHooks, T extends Constructable<K>>(Type: T): T; | ||
findAll(container: IContainer): readonly ITemplateCompilerHooks[]; | ||
}>; | ||
/** | ||
* Decorator: Indicates that the decorated class is a template compiler hooks. | ||
* | ||
* An instance of this class will be created and appropriate compilation hooks will be invoked | ||
* at different phases of the default compiler. | ||
*/ | ||
export declare const templateCompilerHooks: <T extends Constructable>(target?: T, _context?: ClassDecoratorContext) => any; | ||
export declare const RuntimeTemplateCompilerImplementation: IRegistry; | ||
//# sourceMappingURL=template-compiler.d.ts.map |
import { IContainer } from '@aurelia/kernel'; | ||
import { DirtyChecker, ICoercionConfiguration } from '@aurelia/runtime'; | ||
import { OneTimeBindingCommand, TriggerBindingCommand } from './resources/binding-command'; | ||
import { TemplateCompiler } from './compiler/template-compiler'; | ||
import { ICoercionConfiguration } from '@aurelia/runtime'; | ||
import { DefaultBindingCommand, ForBindingCommand } from '@aurelia/template-compiler'; | ||
import { DebounceBindingBehavior } from './resources/binding-behaviors/debounce'; | ||
@@ -22,3 +21,2 @@ import { SignalBindingBehavior } from './resources/binding-behaviors/signals'; | ||
import { SanitizeValueConverter } from './resources/value-converters/sanitize'; | ||
import { NodeObserverLocator } from './observation/observer-locator'; | ||
/** | ||
@@ -30,3 +28,3 @@ * Default HTML-specific (but environment-agnostic) implementations for the following interfaces: | ||
*/ | ||
export declare const DefaultComponents: (typeof NodeObserverLocator | typeof TemplateCompiler | typeof DirtyChecker)[]; | ||
export declare const DefaultComponents: import("@aurelia/kernel").IRegistry[]; | ||
/** | ||
@@ -39,22 +37,14 @@ * Default binding syntax for the following attribute name patterns: | ||
register(c: IContainer): void; | ||
} | { | ||
new (): { | ||
'PART.PART'(rawName: string, rawValue: string, parts: readonly string[]): import("./resources/attribute-pattern").AttrSyntax; | ||
'PART.PART.PART'(rawName: string, rawValue: string, parts: readonly string[]): import("./resources/attribute-pattern").AttrSyntax; | ||
}; | ||
} | { | ||
new (): { | ||
ref(rawName: string, rawValue: string, _parts: readonly string[]): import("./resources/attribute-pattern").AttrSyntax; | ||
'PART.ref'(rawName: string, rawValue: string, parts: readonly string[]): import("./resources/attribute-pattern").AttrSyntax; | ||
}; | ||
} | { | ||
new (): { | ||
'PART.trigger:PART'(rawName: string, rawValue: string, parts: readonly string[]): import("./resources/attribute-pattern").AttrSyntax; | ||
'PART.capture:PART'(rawName: string, rawValue: string, parts: readonly string[]): import("./resources/attribute-pattern").AttrSyntax; | ||
}; | ||
} | { | ||
new (): { | ||
'...$attrs'(rawName: string, rawValue: string, _parts: readonly string[]): import("./resources/attribute-pattern").AttrSyntax; | ||
}; | ||
})[]; | ||
} | (new () => { | ||
ref(rawName: string, rawValue: string, _parts: readonly string[]): import("@aurelia/template-compiler").AttrSyntax; | ||
'PART.ref'(rawName: string, rawValue: string, parts: readonly string[]): import("@aurelia/template-compiler").AttrSyntax; | ||
}) | (new () => { | ||
'PART.PART'(rawName: string, rawValue: string, parts: readonly string[]): import("@aurelia/template-compiler").AttrSyntax; | ||
'PART.PART.PART'(rawName: string, rawValue: string, parts: readonly string[]): import("@aurelia/template-compiler").AttrSyntax; | ||
}) | (new () => { | ||
'...$attrs'(rawName: string, rawValue: string, _parts: readonly string[]): import("@aurelia/template-compiler").AttrSyntax; | ||
}) | (new () => { | ||
'PART.trigger:PART'(rawName: string, rawValue: string, parts: readonly string[]): import("@aurelia/template-compiler").AttrSyntax; | ||
'PART.capture:PART'(rawName: string, rawValue: string, parts: readonly string[]): import("@aurelia/template-compiler").AttrSyntax; | ||
}))[]; | ||
/** | ||
@@ -65,12 +55,8 @@ * Binding syntax for short-hand attribute name patterns: | ||
*/ | ||
export declare const ShortHandBindingSyntax: ({ | ||
new (): { | ||
':PART'(rawName: string, rawValue: string, parts: readonly string[]): import("./resources/attribute-pattern").AttrSyntax; | ||
}; | ||
} | { | ||
new (): { | ||
'@PART'(rawName: string, rawValue: string, parts: readonly string[]): import("./resources/attribute-pattern").AttrSyntax; | ||
'@PART:PART'(rawName: string, rawValue: string, parts: readonly string[]): import("./resources/attribute-pattern").AttrSyntax; | ||
}; | ||
})[]; | ||
export declare const ShortHandBindingSyntax: ((new () => { | ||
'@PART'(rawName: string, rawValue: string, parts: readonly string[]): import("@aurelia/template-compiler").AttrSyntax; | ||
'@PART:PART'(rawName: string, rawValue: string, parts: readonly string[]): import("@aurelia/template-compiler").AttrSyntax; | ||
}) | (new () => { | ||
':PART'(rawName: string, rawValue: string, parts: readonly string[]): import("@aurelia/template-compiler").AttrSyntax; | ||
}))[]; | ||
/** | ||
@@ -82,3 +68,3 @@ * Default HTML-specific (but environment-agnostic) binding commands: | ||
*/ | ||
export declare const DefaultBindingLanguage: (typeof OneTimeBindingCommand | typeof TriggerBindingCommand)[]; | ||
export declare const DefaultBindingLanguage: (typeof DefaultBindingCommand | typeof ForBindingCommand)[]; | ||
/** | ||
@@ -113,3 +99,3 @@ * Default HTML-specific (but environment-agnostic) resources: | ||
readonly target: "re"; | ||
render(renderingCtrl: import(".").IHydratableController<import(".").IViewModel>, target: import(".").IController<import(".").IViewModel>, instruction: import("./renderer").SetPropertyInstruction): void; | ||
render(renderingCtrl: import(".").IHydratableController<import(".").IViewModel>, target: import(".").IController<import(".").IViewModel>, instruction: import("@aurelia/template-compiler").SetPropertyInstruction): void; | ||
}; | ||
@@ -120,3 +106,3 @@ } | { | ||
readonly target: "ra"; | ||
render(renderingCtrl: import(".").IHydratableController<import(".").IViewModel>, target: HTMLElement, instruction: import("./renderer").HydrateElementInstruction<Record<PropertyKey, unknown>>, platform: import("./platform").IPlatform, exprParser: import("@aurelia/expression-parser").IExpressionParser<import("@aurelia/expression-parser").CustomExpression>, observerLocator: import("@aurelia/runtime").IObserverLocator): void; | ||
render(renderingCtrl: import(".").IHydratableController<import(".").IViewModel>, target: HTMLElement, instruction: import("@aurelia/template-compiler").HydrateElementInstruction<Record<PropertyKey, unknown>, import(".").CustomElementDefinition<import("@aurelia/kernel").Constructable>>, platform: import("./platform").IPlatform, exprParser: import("@aurelia/expression-parser").IExpressionParser<import("@aurelia/expression-parser").CustomExpression>, observerLocator: import("@aurelia/runtime").IObserverLocator): void; | ||
}; | ||
@@ -127,3 +113,3 @@ } | { | ||
readonly target: "rb"; | ||
render(renderingCtrl: import(".").IHydratableController<import(".").IViewModel>, target: HTMLElement, instruction: import("./renderer").HydrateAttributeInstruction, platform: import("./platform").IPlatform, exprParser: import("@aurelia/expression-parser").IExpressionParser<import("@aurelia/expression-parser").CustomExpression>, observerLocator: import("@aurelia/runtime").IObserverLocator): void; | ||
render(renderingCtrl: import(".").IHydratableController<import(".").IViewModel>, target: HTMLElement, instruction: import("@aurelia/template-compiler").HydrateAttributeInstruction<import(".").CustomAttributeDefinition<import("@aurelia/kernel").Constructable>>, platform: import("./platform").IPlatform, exprParser: import("@aurelia/expression-parser").IExpressionParser<import("@aurelia/expression-parser").CustomExpression>, observerLocator: import("@aurelia/runtime").IObserverLocator): void; | ||
}; | ||
@@ -134,3 +120,3 @@ } | { | ||
readonly target: "rc"; | ||
render(renderingCtrl: import(".").IHydratableController<import(".").IViewModel>, target: HTMLElement, instruction: import("./renderer").HydrateTemplateController, platform: import("./platform").IPlatform, exprParser: import("@aurelia/expression-parser").IExpressionParser<import("@aurelia/expression-parser").CustomExpression>, observerLocator: import("@aurelia/runtime").IObserverLocator): void; | ||
render(renderingCtrl: import(".").IHydratableController<import(".").IViewModel>, target: HTMLElement, instruction: import("@aurelia/template-compiler").HydrateTemplateController<import(".").CustomAttributeDefinition<import("@aurelia/kernel").Constructable>>, platform: import("./platform").IPlatform, exprParser: import("@aurelia/expression-parser").IExpressionParser<import("@aurelia/expression-parser").CustomExpression>, observerLocator: import("@aurelia/runtime").IObserverLocator): void; | ||
}; | ||
@@ -140,3 +126,3 @@ } | { | ||
readonly target: "rd"; | ||
render(renderingCtrl: import(".").IHydratableController<import(".").IViewModel>, target: Node & ChildNode, instruction: import("./renderer").HydrateLetElementInstruction, platform: import("./platform").IPlatform, exprParser: import("@aurelia/expression-parser").IExpressionParser<import("@aurelia/expression-parser").CustomExpression>, observerLocator: import("@aurelia/runtime").IObserverLocator): void; | ||
render(renderingCtrl: import(".").IHydratableController<import(".").IViewModel>, target: Node & ChildNode, instruction: import("@aurelia/template-compiler").HydrateLetElementInstruction, platform: import("./platform").IPlatform, exprParser: import("@aurelia/expression-parser").IExpressionParser<import("@aurelia/expression-parser").CustomExpression>, observerLocator: import("@aurelia/runtime").IObserverLocator): void; | ||
}; | ||
@@ -146,3 +132,3 @@ } | { | ||
readonly target: "rj"; | ||
render(renderingCtrl: import(".").IHydratableController<import(".").IViewModel>, target: import("./dom").INode, instruction: import("./renderer").RefBindingInstruction, platform: import("./platform").IPlatform, exprParser: import("@aurelia/expression-parser").IExpressionParser<import("@aurelia/expression-parser").CustomExpression>): void; | ||
render(renderingCtrl: import(".").IHydratableController<import(".").IViewModel>, target: import("./dom").INode, instruction: import("@aurelia/template-compiler").RefBindingInstruction, platform: import("./platform").IPlatform, exprParser: import("@aurelia/expression-parser").IExpressionParser<import("@aurelia/expression-parser").CustomExpression>): void; | ||
}; | ||
@@ -152,3 +138,3 @@ } | { | ||
readonly target: "rf"; | ||
render(renderingCtrl: import(".").IHydratableController<import(".").IViewModel>, target: import(".").IController<import(".").IViewModel>, instruction: import("./renderer").InterpolationInstruction, platform: import("./platform").IPlatform, exprParser: import("@aurelia/expression-parser").IExpressionParser<import("@aurelia/expression-parser").CustomExpression>, observerLocator: import("@aurelia/runtime").IObserverLocator): void; | ||
render(renderingCtrl: import(".").IHydratableController<import(".").IViewModel>, target: import(".").IController<import(".").IViewModel>, instruction: import("@aurelia/template-compiler").InterpolationInstruction, platform: import("./platform").IPlatform, exprParser: import("@aurelia/expression-parser").IExpressionParser<import("@aurelia/expression-parser").CustomExpression>, observerLocator: import("@aurelia/runtime").IObserverLocator): void; | ||
}; | ||
@@ -158,3 +144,3 @@ } | { | ||
readonly target: "rg"; | ||
render(renderingCtrl: import(".").IHydratableController<import(".").IViewModel>, target: import(".").IController<import(".").IViewModel>, instruction: import("./renderer").PropertyBindingInstruction, platform: import("./platform").IPlatform, exprParser: import("@aurelia/expression-parser").IExpressionParser<import("@aurelia/expression-parser").CustomExpression>, observerLocator: import("@aurelia/runtime").IObserverLocator): void; | ||
render(renderingCtrl: import(".").IHydratableController<import(".").IViewModel>, target: import(".").IController<import(".").IViewModel>, instruction: import("@aurelia/template-compiler").PropertyBindingInstruction, platform: import("./platform").IPlatform, exprParser: import("@aurelia/expression-parser").IExpressionParser<import("@aurelia/expression-parser").CustomExpression>, observerLocator: import("@aurelia/runtime").IObserverLocator): void; | ||
}; | ||
@@ -164,3 +150,3 @@ } | { | ||
readonly target: "rk"; | ||
render(renderingCtrl: import(".").IHydratableController<import(".").IViewModel>, target: import(".").IController<import(".").IViewModel>, instruction: import("./renderer").IteratorBindingInstruction, platform: import("./platform").IPlatform, exprParser: import("@aurelia/expression-parser").IExpressionParser<import("@aurelia/expression-parser").CustomExpression>, observerLocator: import("@aurelia/runtime").IObserverLocator): void; | ||
render(renderingCtrl: import(".").IHydratableController<import(".").IViewModel>, target: import(".").IController<import(".").IViewModel>, instruction: import("@aurelia/template-compiler").IteratorBindingInstruction, platform: import("./platform").IPlatform, exprParser: import("@aurelia/expression-parser").IExpressionParser<import("@aurelia/expression-parser").CustomExpression>, observerLocator: import("@aurelia/runtime").IObserverLocator): void; | ||
}; | ||
@@ -170,3 +156,3 @@ } | { | ||
readonly target: "ha"; | ||
render(renderingCtrl: import(".").IHydratableController<import(".").IViewModel>, target: ChildNode, instruction: import("./renderer").TextBindingInstruction, platform: import("./platform").IPlatform, exprParser: import("@aurelia/expression-parser").IExpressionParser<import("@aurelia/expression-parser").CustomExpression>, observerLocator: import("@aurelia/runtime").IObserverLocator): void; | ||
render(renderingCtrl: import(".").IHydratableController<import(".").IViewModel>, target: ChildNode, instruction: import("@aurelia/template-compiler").TextBindingInstruction, platform: import("./platform").IPlatform, exprParser: import("@aurelia/expression-parser").IExpressionParser<import("@aurelia/expression-parser").CustomExpression>, observerLocator: import("@aurelia/runtime").IObserverLocator): void; | ||
}; | ||
@@ -178,3 +164,3 @@ } | { | ||
readonly _defaultOptions: import("./renderer").IListenerBindingOptions; | ||
render(renderingCtrl: import(".").IHydratableController<import(".").IViewModel>, target: HTMLElement, instruction: import("./renderer").ListenerBindingInstruction, platform: import("./platform").IPlatform, exprParser: import("@aurelia/expression-parser").IExpressionParser<import("@aurelia/expression-parser").CustomExpression>): void; | ||
render(renderingCtrl: import(".").IHydratableController<import(".").IViewModel>, target: HTMLElement, instruction: import("@aurelia/template-compiler").ListenerBindingInstruction, platform: import("./platform").IPlatform, exprParser: import("@aurelia/expression-parser").IExpressionParser<import("@aurelia/expression-parser").CustomExpression>): void; | ||
}; | ||
@@ -184,3 +170,3 @@ } | { | ||
readonly target: "he"; | ||
render(_: import(".").IHydratableController<import(".").IViewModel>, target: HTMLElement, instruction: import("./renderer").SetAttributeInstruction): void; | ||
render(_: import(".").IHydratableController<import(".").IViewModel>, target: HTMLElement, instruction: import("@aurelia/template-compiler").SetAttributeInstruction): void; | ||
}; | ||
@@ -190,3 +176,3 @@ } | { | ||
readonly target: "hf"; | ||
render(_: import(".").IHydratableController<import(".").IViewModel>, target: HTMLElement, instruction: import("./renderer").SetClassAttributeInstruction): void; | ||
render(_: import(".").IHydratableController<import(".").IViewModel>, target: HTMLElement, instruction: import("@aurelia/template-compiler").SetClassAttributeInstruction): void; | ||
}; | ||
@@ -196,3 +182,3 @@ } | { | ||
readonly target: "hg"; | ||
render(_: import(".").IHydratableController<import(".").IViewModel>, target: HTMLElement, instruction: import("./renderer").SetStyleAttributeInstruction): void; | ||
render(_: import(".").IHydratableController<import(".").IViewModel>, target: HTMLElement, instruction: import("@aurelia/template-compiler").SetStyleAttributeInstruction): void; | ||
}; | ||
@@ -202,3 +188,3 @@ } | { | ||
readonly target: "hd"; | ||
render(renderingCtrl: import(".").IHydratableController<import(".").IViewModel>, target: HTMLElement, instruction: import("./renderer").StylePropertyBindingInstruction, platform: import("./platform").IPlatform, exprParser: import("@aurelia/expression-parser").IExpressionParser<import("@aurelia/expression-parser").CustomExpression>, observerLocator: import("@aurelia/runtime").IObserverLocator): void; | ||
render(renderingCtrl: import(".").IHydratableController<import(".").IViewModel>, target: HTMLElement, instruction: import("@aurelia/template-compiler").StylePropertyBindingInstruction, platform: import("./platform").IPlatform, exprParser: import("@aurelia/expression-parser").IExpressionParser<import("@aurelia/expression-parser").CustomExpression>, observerLocator: import("@aurelia/runtime").IObserverLocator): void; | ||
}; | ||
@@ -208,10 +194,10 @@ } | { | ||
readonly target: "hc"; | ||
render(renderingCtrl: import(".").IHydratableController<import(".").IViewModel>, target: HTMLElement, instruction: import("./renderer").AttributeBindingInstruction, platform: import("./platform").IPlatform, exprParser: import("@aurelia/expression-parser").IExpressionParser<import("@aurelia/expression-parser").CustomExpression>, observerLocator: import("@aurelia/runtime").IObserverLocator): void; | ||
render(renderingCtrl: import(".").IHydratableController<import(".").IViewModel>, target: HTMLElement, instruction: import("@aurelia/template-compiler").AttributeBindingInstruction, platform: import("./platform").IPlatform, exprParser: import("@aurelia/expression-parser").IExpressionParser<import("@aurelia/expression-parser").CustomExpression>, observerLocator: import("@aurelia/runtime").IObserverLocator): void; | ||
}; | ||
} | { | ||
new (): { | ||
readonly _compiler: import("./renderer").ITemplateCompiler; | ||
readonly _compiler: import("@aurelia/template-compiler").ITemplateCompiler; | ||
readonly _rendering: import(".").IRendering; | ||
readonly target: "hs"; | ||
render(renderingCtrl: import(".").IHydratableController<import(".").IViewModel>, target: HTMLElement, _instruction: import("./renderer").SpreadBindingInstruction, platform: import("./platform").IPlatform, exprParser: import("@aurelia/expression-parser").IExpressionParser<import("@aurelia/expression-parser").CustomExpression>, observerLocator: import("@aurelia/runtime").IObserverLocator): void; | ||
render(renderingCtrl: import(".").IHydratableController<import(".").IViewModel>, target: HTMLElement, _instruction: import("@aurelia/template-compiler").SpreadBindingInstruction, platform: import("./platform").IPlatform, exprParser: import("@aurelia/expression-parser").IExpressionParser<import("@aurelia/expression-parser").CustomExpression>, observerLocator: import("@aurelia/runtime").IObserverLocator): void; | ||
}; | ||
@@ -218,0 +204,0 @@ })[]; |
@@ -16,9 +16,6 @@ export { type IAstEvaluator, astAssign, astBind, astEvaluate, astUnbind, } from './ast.eval'; | ||
export { type TaskSlot, AppTask, IAppTask, type AppTaskCallback, type AppTaskCallbackNoArg, } from './app-task'; | ||
export { AttrSyntax, IAttributeParser, attributePattern, type AttributePatternDefinition, IAttributePattern, type AttributePatternKind, AttributePattern, Interpretation, ISyntaxInterpreter, AtPrefixedTriggerAttributePattern, ColonPrefixedBindAttributePattern, DotSeparatedAttributePattern, RefAttributePattern, } from './resources/attribute-pattern'; | ||
export { bindingCommand, type ICommandBuildInfo, BindingCommand, type BindingCommandInstance, type PartialBindingCommandDefinition, type BindingCommandStaticAuDefinition, BindingCommandDefinition, type BindingCommandKind, type BindingCommandType, DefaultBindingCommand, ForBindingCommand, FromViewBindingCommand, OneTimeBindingCommand, ToViewBindingCommand, TwoWayBindingCommand, TriggerBindingCommand, CaptureBindingCommand, AttrBindingCommand, ClassBindingCommand, StyleBindingCommand, } from './resources/binding-command'; | ||
export { IAttrMapper, type IsTwoWayPredicate, } from './compiler/attribute-mapper'; | ||
export { BindingMode, type IBindingController, type IBinding, type IRateLimitOptions, } from './binding/interfaces-bindings'; | ||
export { IFlushQueue, FlushQueue, type IFlushable, BindingTargetSubscriber, mixinAstEvaluator, mixingBindingLimited, mixinUseScope, } from './binding/binding-utils'; | ||
export { ListenerBinding, ListenerBindingOptions, type IModifiedEventHandler, IEventModifier, EventModifier, EventModifierRegistration, IModifiedEventHandlerCreator, IKeyMapping, } from './binding/listener-binding'; | ||
export { AttributeBinding, } from './binding/attribute'; | ||
export { AttributeBinding, } from './binding/attribute-binding'; | ||
export { InterpolationBinding, InterpolationPartBinding, } from './binding/interpolation-binding'; | ||
@@ -30,3 +27,5 @@ export { ContentBinding, } from './binding/content-binding'; | ||
export { Scope, BindingContext, type IBindingContext, type IOverrideContext } from './binding/scope'; | ||
export { IRenderer, ITemplateCompiler, type ICompliationInstruction, renderer, HydrateAttributeInstruction, HydrateElementInstruction, HydrateTemplateController, InterpolationInstruction, IteratorBindingInstruction, LetBindingInstruction, HydrateLetElementInstruction, RefBindingInstruction, SetPropertyInstruction, AttributeBindingInstruction, ListenerBindingInstruction, PropertyBindingInstruction, SetAttributeInstruction, SetClassAttributeInstruction, SetStyleAttributeInstruction, StylePropertyBindingInstruction, TextBindingInstruction, SpreadBindingInstruction, SpreadElementPropBindingInstruction, isInstruction, IInstruction, InstructionType, PropertyBindingRenderer, TextBindingRenderer, ListenerBindingRenderer, IListenerBindingOptions, LetElementRenderer, TemplateControllerRenderer, AttributeBindingRenderer, CustomAttributeRenderer, CustomElementRenderer, InterpolationBindingRenderer, IteratorBindingRenderer, MultiAttrInstruction, RefBindingRenderer, SetAttributeRenderer, SetClassAttributeRenderer, SetPropertyRenderer, SetStyleAttributeRenderer, SpreadRenderer, StylePropertyBindingRenderer, } from './renderer'; | ||
export { IRenderer, renderer, PropertyBindingRenderer, TextBindingRenderer, ListenerBindingRenderer, IListenerBindingOptions, LetElementRenderer, TemplateControllerRenderer, AttributeBindingRenderer, CustomAttributeRenderer, CustomElementRenderer, InterpolationBindingRenderer, IteratorBindingRenderer, RefBindingRenderer, SetAttributeRenderer, SetClassAttributeRenderer, SetPropertyRenderer, SetStyleAttributeRenderer, SpreadRenderer, StylePropertyBindingRenderer, } from './renderer'; | ||
export { AttrMapper, } from './compiler/attribute-mapper'; | ||
export { RuntimeTemplateCompilerImplementation, } from './compiler/template-compiler'; | ||
export { AttributeNSAccessor, } from './observation/attribute-ns-accessor'; | ||
@@ -53,3 +52,3 @@ export { type IInputElement, CheckedObserver, } from './observation/checked-observer'; | ||
export { AuSlot, } from './resources/custom-elements/au-slot'; | ||
export { capture, containerless, customElement, CustomElement, type CustomElementDecorator, type CustomElementKind, type CustomElementType, CustomElementDefinition, type PartialCustomElementDefinition, type ProcessContentHook, type CustomElementStaticAuDefinition, useShadowDOM, processContent, } from './resources/custom-element'; | ||
export { capture, containerless, customElement, CustomElement, type CustomElementDecorator, type CustomElementKind, type CustomElementType, CustomElementDefinition, type PartialCustomElementDefinition, type CustomElementStaticAuDefinition, useShadowDOM, processContent, } from './resources/custom-element'; | ||
export { AuCompose, type IDynamicComponentActivate, } from './resources/custom-elements/au-compose'; | ||
@@ -59,4 +58,5 @@ export { ValueConverter, ValueConverterDefinition, type PartialValueConverterDefinition, type ValueConverterStaticAuDefinition, type ValueConverterKind, type ValueConverterDecorator, type ValueConverterType, type ValueConverterInstance, valueConverter, } from './resources/value-converter'; | ||
export { type ConfigurationOptionsProvider, DefaultComponents, DefaultBindingSyntax, ShortHandBindingSyntax, DefaultBindingLanguage, DefaultResources, DefaultRenderers, StandardConfiguration, } from './configuration'; | ||
export { ITemplateElementFactory } from './compiler/template-element-factory'; | ||
export { TemplateCompiler, ITemplateCompilerHooks, TemplateCompilerHooks, templateCompilerHooks, type IAttributeBindablesInfo, type IElementBindablesInfo, IBindablesInfoResolver, } from './compiler/template-compiler'; | ||
export { | ||
/** @deprecated - Should be imported directly from `aurelia` or `@aurelia/template-compiler` package */ | ||
BindingCommand, } from '@aurelia/template-compiler'; | ||
export { type PartialChildrenDefinition, children, ChildrenBinding, } from './templating/children'; | ||
@@ -63,0 +63,0 @@ export { Controller, isCustomElementController, isCustomElementViewModel, type ViewModelKind, State, type ControllerVisitor, type IViewModel, IController, type IComponentController, type IContextualCustomElementController, type IControllerElementHydrationInstruction, type IHydratableController, IHydrationContext, type IDryCustomElementController, type ICustomAttributeController, type IHydratedController, type IHydratedComponentController, type IHydratedParentController, type ICompiledCustomElementController, type ICustomElementController, type ICustomElementViewModel, type ICustomAttributeViewModel, type IHydratedCustomElementViewModel, type IHydratedCustomAttributeViewModel, type ISyntheticView, } from './templating/controller'; |
import { IServiceLocator } from '@aurelia/kernel'; | ||
import { INodeObserverLocator, IObserverLocator } from '@aurelia/runtime'; | ||
import type { IContainer } from '@aurelia/kernel'; | ||
import type { IAccessor, IObserver, ICollectionObserver, CollectionKind } from '@aurelia/runtime'; | ||
@@ -48,3 +47,3 @@ import type { INode } from '../dom'; | ||
export declare class NodeObserverLocator implements INodeObserverLocator { | ||
static register(container: IContainer): void; | ||
static register: <C extends import("@aurelia/kernel").Constructable>(this: C, container: import("@aurelia/kernel").IContainer) => void; | ||
/** | ||
@@ -51,0 +50,0 @@ * Indicates whether the node observer will be allowed to use dirty checking for a property it doesn't know how to observe |
@@ -1,5 +0,4 @@ | ||
import { type IContainer, type Constructable } from '@aurelia/kernel'; | ||
import { IExpressionParser, type Interpolation, type IsBindingBehavior, type ForOfStatement } from '@aurelia/expression-parser'; | ||
import { type Constructable } from '@aurelia/kernel'; | ||
import { IExpressionParser } from '@aurelia/expression-parser'; | ||
import { IObserverLocator } from '@aurelia/runtime'; | ||
import { type BindingMode } from './binding/interfaces-bindings'; | ||
import { IEventModifier } from './binding/listener-binding'; | ||
@@ -12,273 +11,10 @@ import { CustomElementDefinition } from './resources/custom-element'; | ||
import { IRendering } from './templating/rendering'; | ||
import type { AttrSyntax } from './resources/attribute-pattern'; | ||
import { IAuSlotProjections } from './templating/controller.projection'; | ||
import type { IHydratableController } from './templating/controller'; | ||
import type { PartialCustomElementDefinition } from './resources/custom-element'; | ||
export declare const InstructionType: Readonly<{ | ||
hydrateElement: "ra"; | ||
hydrateAttribute: "rb"; | ||
hydrateTemplateController: "rc"; | ||
hydrateLetElement: "rd"; | ||
setProperty: "re"; | ||
interpolation: "rf"; | ||
propertyBinding: "rg"; | ||
letBinding: "ri"; | ||
refBinding: "rj"; | ||
iteratorBinding: "rk"; | ||
multiAttr: "rl"; | ||
textBinding: "ha"; | ||
listenerBinding: "hb"; | ||
attributeBinding: "hc"; | ||
stylePropertyBinding: "hd"; | ||
setAttribute: "he"; | ||
setClassAttribute: "hf"; | ||
setStyleAttribute: "hg"; | ||
spreadBinding: "hs"; | ||
spreadElementProp: "hp"; | ||
}>; | ||
export type InstructionType = typeof InstructionType[keyof typeof InstructionType]; | ||
export interface IInstruction { | ||
readonly type: string; | ||
} | ||
export declare const IInstruction: import("@aurelia/kernel").InterfaceSymbol<IInstruction>; | ||
export declare function isInstruction(value: unknown): value is IInstruction; | ||
export declare class InterpolationInstruction { | ||
from: string | Interpolation; | ||
to: string; | ||
readonly type = "rf"; | ||
constructor(from: string | Interpolation, to: string); | ||
} | ||
export declare class PropertyBindingInstruction { | ||
from: string | IsBindingBehavior; | ||
to: string; | ||
mode: BindingMode; | ||
readonly type = "rg"; | ||
constructor(from: string | IsBindingBehavior, to: string, mode: BindingMode); | ||
} | ||
export declare class IteratorBindingInstruction { | ||
forOf: string | ForOfStatement; | ||
to: string; | ||
props: MultiAttrInstruction[]; | ||
readonly type = "rk"; | ||
constructor(forOf: string | ForOfStatement, to: string, props: MultiAttrInstruction[]); | ||
} | ||
export declare class RefBindingInstruction { | ||
readonly from: string | IsBindingBehavior; | ||
readonly to: string; | ||
readonly type = "rj"; | ||
constructor(from: string | IsBindingBehavior, to: string); | ||
} | ||
export declare class SetPropertyInstruction { | ||
value: unknown; | ||
to: string; | ||
readonly type = "re"; | ||
constructor(value: unknown, to: string); | ||
} | ||
export declare class MultiAttrInstruction { | ||
value: string; | ||
to: string; | ||
command: string | null; | ||
readonly type = "rl"; | ||
constructor(value: string, to: string, command: string | null); | ||
} | ||
export declare class HydrateElementInstruction<T extends Record<PropertyKey, unknown> = Record<PropertyKey, unknown>> { | ||
/** | ||
* The name of the custom element this instruction is associated with | ||
*/ | ||
res: string | /* Constructable | */ CustomElementDefinition; | ||
/** | ||
* Bindable instructions for the custom element instance | ||
*/ | ||
props: IInstruction[]; | ||
/** | ||
* Indicates what projections are associated with the element usage | ||
*/ | ||
projections: Record<string, PartialCustomElementDefinition> | null; | ||
/** | ||
* Indicates whether the usage of the custom element was with a containerless attribute or not | ||
*/ | ||
containerless: boolean; | ||
/** | ||
* A list of captured attr syntaxes | ||
*/ | ||
captures: AttrSyntax[] | undefined; | ||
/** | ||
* Any data associated with this instruction | ||
*/ | ||
readonly data: T; | ||
readonly type = "ra"; | ||
constructor( | ||
/** | ||
* The name of the custom element this instruction is associated with | ||
*/ | ||
res: string | /* Constructable | */ CustomElementDefinition, | ||
/** | ||
* Bindable instructions for the custom element instance | ||
*/ | ||
props: IInstruction[], | ||
/** | ||
* Indicates what projections are associated with the element usage | ||
*/ | ||
projections: Record<string, PartialCustomElementDefinition> | null, | ||
/** | ||
* Indicates whether the usage of the custom element was with a containerless attribute or not | ||
*/ | ||
containerless: boolean, | ||
/** | ||
* A list of captured attr syntaxes | ||
*/ | ||
captures: AttrSyntax[] | undefined, | ||
/** | ||
* Any data associated with this instruction | ||
*/ | ||
data: T); | ||
} | ||
export declare class HydrateAttributeInstruction { | ||
res: string | /* Constructable | */ CustomAttributeDefinition; | ||
alias: string | undefined; | ||
/** | ||
* Bindable instructions for the custom attribute instance | ||
*/ | ||
props: IInstruction[]; | ||
readonly type = "rb"; | ||
constructor(res: string | /* Constructable | */ CustomAttributeDefinition, alias: string | undefined, | ||
/** | ||
* Bindable instructions for the custom attribute instance | ||
*/ | ||
props: IInstruction[]); | ||
} | ||
export declare class HydrateTemplateController { | ||
def: PartialCustomElementDefinition; | ||
res: string | /* Constructable | */ CustomAttributeDefinition; | ||
alias: string | undefined; | ||
/** | ||
* Bindable instructions for the template controller instance | ||
*/ | ||
props: IInstruction[]; | ||
readonly type = "rc"; | ||
constructor(def: PartialCustomElementDefinition, res: string | /* Constructable | */ CustomAttributeDefinition, alias: string | undefined, | ||
/** | ||
* Bindable instructions for the template controller instance | ||
*/ | ||
props: IInstruction[]); | ||
} | ||
export declare class HydrateLetElementInstruction { | ||
instructions: LetBindingInstruction[]; | ||
toBindingContext: boolean; | ||
readonly type = "rd"; | ||
constructor(instructions: LetBindingInstruction[], toBindingContext: boolean); | ||
} | ||
export declare class LetBindingInstruction { | ||
from: string | IsBindingBehavior | Interpolation; | ||
to: string; | ||
readonly type = "ri"; | ||
constructor(from: string | IsBindingBehavior | Interpolation, to: string); | ||
} | ||
export declare class TextBindingInstruction { | ||
from: string | IsBindingBehavior; | ||
readonly type = "ha"; | ||
constructor(from: string | IsBindingBehavior); | ||
} | ||
export declare class ListenerBindingInstruction { | ||
from: string | IsBindingBehavior; | ||
to: string; | ||
capture: boolean; | ||
modifier: string | null; | ||
readonly type = "hb"; | ||
constructor(from: string | IsBindingBehavior, to: string, capture: boolean, modifier: string | null); | ||
} | ||
export declare class StylePropertyBindingInstruction { | ||
from: string | IsBindingBehavior; | ||
to: string; | ||
readonly type = "hd"; | ||
constructor(from: string | IsBindingBehavior, to: string); | ||
} | ||
export declare class SetAttributeInstruction { | ||
value: string; | ||
to: string; | ||
readonly type = "he"; | ||
constructor(value: string, to: string); | ||
} | ||
export declare class SetClassAttributeInstruction { | ||
readonly value: string; | ||
readonly type: typeof InstructionType.setClassAttribute; | ||
constructor(value: string); | ||
} | ||
export declare class SetStyleAttributeInstruction { | ||
readonly value: string; | ||
readonly type: typeof InstructionType.setStyleAttribute; | ||
constructor(value: string); | ||
} | ||
export declare class AttributeBindingInstruction { | ||
/** | ||
* `attr` and `to` have the same value on a normal attribute | ||
* Will be different on `class` and `style` | ||
* on `class`: attr = `class` (from binding command), to = attribute name | ||
* on `style`: attr = `style` (from binding command), to = attribute name | ||
*/ | ||
attr: string; | ||
from: string | IsBindingBehavior; | ||
to: string; | ||
readonly type = "hc"; | ||
constructor( | ||
/** | ||
* `attr` and `to` have the same value on a normal attribute | ||
* Will be different on `class` and `style` | ||
* on `class`: attr = `class` (from binding command), to = attribute name | ||
* on `style`: attr = `style` (from binding command), to = attribute name | ||
*/ | ||
attr: string, from: string | IsBindingBehavior, to: string); | ||
} | ||
export declare class SpreadBindingInstruction { | ||
readonly type = "hs"; | ||
} | ||
export declare class SpreadElementPropBindingInstruction { | ||
readonly instructions: IInstruction; | ||
readonly type = "hp"; | ||
constructor(instructions: IInstruction); | ||
} | ||
export declare const ITemplateCompiler: import("@aurelia/kernel").InterfaceSymbol<ITemplateCompiler>; | ||
export interface ITemplateCompiler { | ||
/** | ||
* Indicates whether this compiler should compile template in debug mode | ||
* | ||
* For the default compiler, this means all expressions are kept as is on the template | ||
*/ | ||
debug: boolean; | ||
/** | ||
* Experimental API, for optimization. | ||
* | ||
* `true` to create CustomElement/CustomAttribute instructions | ||
* with resolved resources constructor during compilation, instead of name | ||
*/ | ||
resolveResources: boolean; | ||
compile(partialDefinition: CustomElementDefinition, context: IContainer, compilationInstruction: ICompliationInstruction | null): CustomElementDefinition; | ||
/** | ||
* Compile a list of captured attributes as if they are declared in a template | ||
* | ||
* @param requestor - the context definition where the attributes is compiled | ||
* @param attrSyntaxes - the attributes captured | ||
* @param container - the container containing information for the compilation | ||
* @param host - the host element where the attributes are spreaded on | ||
*/ | ||
compileSpread(requestor: CustomElementDefinition, attrSyntaxes: AttrSyntax[], container: IContainer, target: Element, | ||
/** | ||
* An associated custom element definition for the target host element | ||
* Sometimes spread compilation may occur without the container having all necessary information | ||
* about the targeted element that is receiving the spread | ||
* | ||
* Caller of this method may want to provide this information dynamically instead | ||
*/ | ||
targetDef?: CustomElementDefinition): IInstruction[]; | ||
} | ||
export interface ICompliationInstruction { | ||
/** | ||
* A record of projections available for compiling a template. | ||
* Where each key is the matching slot name for <au-slot/> inside, | ||
* and each value is the definition to render and project | ||
*/ | ||
projections: IAuSlotProjections | null; | ||
} | ||
export interface IRenderer<TType extends string = string> { | ||
target: TType; | ||
import { AttributeBindingInstruction, HydrateAttributeInstruction, HydrateElementInstruction, HydrateLetElementInstruction, HydrateTemplateController, IInstruction, ITemplateCompiler, InterpolationInstruction, IteratorBindingInstruction, ListenerBindingInstruction, PropertyBindingInstruction, RefBindingInstruction, SetAttributeInstruction, SetClassAttributeInstruction, SetPropertyInstruction, SetStyleAttributeInstruction, SpreadBindingInstruction, StylePropertyBindingInstruction, TextBindingInstruction } from '@aurelia/template-compiler'; | ||
/** | ||
* An interface describing an instruction renderer | ||
* its target property will be used to match instruction types dynamically at render time | ||
*/ | ||
export interface IRenderer { | ||
target: string; | ||
render( | ||
@@ -290,4 +26,4 @@ /** | ||
} | ||
export declare const IRenderer: import("@aurelia/kernel").InterfaceSymbol<IRenderer<string>>; | ||
export declare function renderer<TType extends string, T extends IRenderer<TType>, C extends Constructable<T>>(target: C, context: ClassDecoratorContext): C; | ||
export declare const IRenderer: import("@aurelia/kernel").InterfaceSymbol<IRenderer>; | ||
export declare function renderer<T extends IRenderer, C extends Constructable<T>>(target: C, context: ClassDecoratorContext): C; | ||
export declare const SetPropertyRenderer: { | ||
@@ -303,3 +39,3 @@ new (): { | ||
readonly target: "ra"; | ||
render(renderingCtrl: IHydratableController, target: HTMLElement, instruction: HydrateElementInstruction, platform: IPlatform, exprParser: IExpressionParser, observerLocator: IObserverLocator): void; | ||
render(renderingCtrl: IHydratableController, target: HTMLElement, instruction: HydrateElementInstruction<Record<PropertyKey, unknown>, CustomElementDefinition>, platform: IPlatform, exprParser: IExpressionParser, observerLocator: IObserverLocator): void; | ||
}; | ||
@@ -311,3 +47,3 @@ }; | ||
readonly target: "rb"; | ||
render(renderingCtrl: IHydratableController, target: HTMLElement, instruction: HydrateAttributeInstruction, platform: IPlatform, exprParser: IExpressionParser, observerLocator: IObserverLocator): void; | ||
render(renderingCtrl: IHydratableController, target: HTMLElement, instruction: HydrateAttributeInstruction<CustomAttributeDefinition>, platform: IPlatform, exprParser: IExpressionParser, observerLocator: IObserverLocator): void; | ||
}; | ||
@@ -319,3 +55,3 @@ }; | ||
readonly target: "rc"; | ||
render(renderingCtrl: IHydratableController, target: HTMLElement, instruction: HydrateTemplateController, platform: IPlatform, exprParser: IExpressionParser, observerLocator: IObserverLocator): void; | ||
render(renderingCtrl: IHydratableController, target: HTMLElement, instruction: HydrateTemplateController<CustomAttributeDefinition>, platform: IPlatform, exprParser: IExpressionParser, observerLocator: IObserverLocator): void; | ||
}; | ||
@@ -322,0 +58,0 @@ }; |
import { Key } from '@aurelia/kernel'; | ||
import { type BindingMode } from '../binding/interfaces-bindings'; | ||
import { BindingMode } from '../binding/interfaces-bindings'; | ||
import type { Constructable, IContainer, ResourceDefinition, PartialResourceDefinition, ResourceType } from '@aurelia/kernel'; | ||
@@ -8,4 +8,5 @@ import type { BindableDefinition, PartialBindableDefinition } from '../bindable'; | ||
import { type IResourceKind } from './resources-shared'; | ||
export type PartialCustomAttributeDefinition<TBindables extends string = string> = PartialResourceDefinition<{ | ||
readonly defaultBindingMode?: BindingMode; | ||
import { IAttributeComponentDefinition } from '@aurelia/template-compiler'; | ||
export type PartialCustomAttributeDefinition<TBindables extends string = string> = PartialResourceDefinition<Omit<IAttributeComponentDefinition, 'type'> & { | ||
readonly defaultBindingMode?: string | number; | ||
readonly isTemplateController?: boolean; | ||
@@ -73,5 +74,5 @@ readonly bindables?: (Record<TBindables, true | Omit<PartialBindableDefinition, 'name'>>) | (TBindables | PartialBindableDefinition & { | ||
*/ | ||
export declare function templateController(definition: Omit<PartialCustomAttributeDefinition, 'isTemplateController'>): CustomAttributeDecorator; | ||
export declare function templateController(definition: Omit<PartialCustomAttributeDefinition, 'isTemplateController' | 'type'>): CustomAttributeDecorator; | ||
export declare function templateController(name: string): CustomAttributeDecorator; | ||
export declare function templateController(nameOrDef: string | Omit<PartialCustomAttributeDefinition, 'isTemplateController'>): CustomAttributeDecorator; | ||
export declare function templateController(nameOrDef: string | Omit<PartialCustomAttributeDefinition, 'isTemplateController' | 'type'>): CustomAttributeDecorator; | ||
export declare class CustomAttributeDefinition<T extends Constructable = Constructable> implements ResourceDefinition<T, ICustomAttributeViewModel, PartialCustomAttributeDefinition> { | ||
@@ -89,3 +90,3 @@ readonly Type: CustomAttributeType<T>; | ||
readonly containerStrategy: 'reuse' | 'new'; | ||
get kind(): 'attribute'; | ||
get type(): 'custom-attribute'; | ||
private constructor(); | ||
@@ -92,0 +93,0 @@ static create<T extends Constructable = Constructable>(nameOrDef: string | PartialCustomAttributeDefinition, Type: CustomAttributeType<T>): CustomAttributeDefinition<T>; |
import type { Constructable, IContainer, ResourceType, PartialResourceDefinition, Key, ResourceDefinition, InterfaceSymbol } from '@aurelia/kernel'; | ||
import type { BindableDefinition, PartialBindableDefinition } from '../bindable'; | ||
import type { BindableDefinition } from '../bindable'; | ||
import type { ICustomElementViewModel, ICustomElementController } from '../templating/controller'; | ||
import type { IPlatform } from '../platform'; | ||
import type { IInstruction } from '../renderer'; | ||
import { ProcessContentHook, type IElementComponentDefinition, IInstruction } from '@aurelia/template-compiler'; | ||
import type { IWatchDefinition } from '../watch'; | ||
import { type IResourceKind } from './resources-shared'; | ||
export type PartialCustomElementDefinition<TBindables extends string = string> = PartialResourceDefinition<{ | ||
readonly cache?: '*' | number; | ||
readonly capture?: boolean | ((attr: string) => boolean); | ||
readonly template?: null | string | Node; | ||
readonly instructions?: readonly (readonly IInstruction[])[]; | ||
readonly dependencies?: readonly Key[]; | ||
export type PartialCustomElementDefinition<TBindables extends string = string> = PartialResourceDefinition<Omit<IElementComponentDefinition<TBindables>, 'type'> & { | ||
readonly cache?: number | '*'; | ||
/** | ||
@@ -18,15 +13,4 @@ * An semi internal property used to signal the rendering process not to try to compile the template again | ||
readonly injectable?: InterfaceSymbol | null; | ||
readonly needsCompile?: boolean; | ||
readonly surrogates?: readonly IInstruction[]; | ||
readonly bindables?: Record<TBindables, true | Omit<PartialBindableDefinition, 'name'>> | (TBindables | PartialBindableDefinition & { | ||
name: TBindables; | ||
})[]; | ||
readonly containerless?: boolean; | ||
readonly shadowOptions?: { | ||
mode: 'open' | 'closed'; | ||
} | null; | ||
readonly hasSlots?: boolean; | ||
readonly enhance?: boolean; | ||
readonly watches?: IWatchDefinition[]; | ||
readonly processContent?: ProcessContentHook | null; | ||
}>; | ||
@@ -115,7 +99,7 @@ export type CustomElementStaticAuDefinition<TBindables extends string = string> = PartialCustomElementDefinition<TBindables> & { | ||
export declare function customElement(nameOrDef: string | PartialCustomElementDefinition): CustomElementDecorator; | ||
type ShadowOptions = Pick<PartialCustomElementDefinition, 'shadowOptions'>['shadowOptions']; | ||
type ShadowOptions = PartialCustomElementDefinition['shadowOptions']; | ||
/** | ||
* Decorator: Indicates that the custom element should render its view in ShadowDOM. | ||
*/ | ||
export declare function useShadowDOM(options?: ShadowOptions): (target: Constructable) => void; | ||
export declare function useShadowDOM(options?: ShadowOptions): (target: Constructable, context: ClassDecoratorContext) => void; | ||
/** | ||
@@ -141,4 +125,4 @@ * Decorator: Indicates that the custom element should render its view in ShadowDOM. | ||
readonly template: null | string | Node; | ||
readonly instructions: readonly (readonly IInstruction[])[]; | ||
readonly dependencies: readonly Key[]; | ||
readonly instructions: readonly IInstruction[][]; | ||
readonly dependencies: Key[]; | ||
readonly injectable: InterfaceSymbol<C> | null; | ||
@@ -159,3 +143,3 @@ readonly needsCompile: boolean; | ||
readonly processContent: ProcessContentHook | null; | ||
get kind(): 'element'; | ||
get type(): 'custom-element'; | ||
private constructor(); | ||
@@ -171,3 +155,2 @@ static create(def: PartialCustomElementDefinition, Type?: null): CustomElementDefinition; | ||
type DecoratorFactoryMethod = (target: Function, context: ClassMethodDecoratorContext) => void; | ||
export type ProcessContentHook = (node: HTMLElement, platform: IPlatform, data: Record<PropertyKey, unknown>) => boolean | void; | ||
export declare function processContent(hook: ProcessContentHook | string | symbol): CustomElementDecorator; | ||
@@ -174,0 +157,0 @@ export declare function processContent(): DecoratorFactoryMethod; |
import { IViewFactory } from '../../templating/view'; | ||
import type { ISyntheticView, ICustomAttributeController, ICustomAttributeViewModel, IHydratedController, IHydratedParentController, ControllerVisitor, IHydratableController } from '../../templating/controller'; | ||
import type { IInstruction } from '../../renderer'; | ||
import type { IInstruction } from '@aurelia/template-compiler'; | ||
import type { INode } from '../../dom'; | ||
@@ -5,0 +5,0 @@ import { CustomAttributeStaticAuDefinition } from '../custom-attribute'; |
import { Scope } from '../../binding/scope'; | ||
import { INode } from '../../dom'; | ||
import { IInstruction } from '../../renderer'; | ||
import { ICustomAttributeController, ICustomAttributeViewModel, IHydratableController, IHydratedController, IHydratedParentController, ISyntheticView } from '../../templating/controller'; | ||
import { AttrSyntax } from '../attribute-pattern'; | ||
import { IInstruction, AttrSyntax } from '@aurelia/template-compiler'; | ||
import { CustomAttributeStaticAuDefinition } from '../custom-attribute'; | ||
@@ -7,0 +6,0 @@ export declare class PromiseTemplateController implements ICustomAttributeViewModel { |
@@ -7,3 +7,3 @@ import { ForOfStatement, type IsBindingBehavior } from '@aurelia/expression-parser'; | ||
import { CustomAttributeStaticAuDefinition } from '../custom-attribute'; | ||
import { HydrateTemplateController } from '../../renderer'; | ||
import { HydrateTemplateController } from '@aurelia/template-compiler'; | ||
import type { ISyntheticView, ICustomAttributeController, IHydratableController, ICustomAttributeViewModel, IHydratedController, IHydratedParentController, ControllerVisitor } from '../../templating/controller'; | ||
@@ -10,0 +10,0 @@ type Items<C extends Collection = unknown[]> = C | undefined; |
@@ -5,3 +5,3 @@ import { type Scope } from '../../binding/scope'; | ||
import type { INode } from '../../dom'; | ||
import type { IInstruction } from '../../renderer'; | ||
import type { IInstruction } from '@aurelia/template-compiler'; | ||
export declare class Switch implements ICustomAttributeViewModel { | ||
@@ -8,0 +8,0 @@ static readonly $au: CustomAttributeStaticAuDefinition; |
@@ -7,6 +7,4 @@ import { ICoercionConfiguration } from '@aurelia/runtime'; | ||
import type { INode, INodeSequence, IRenderLocation } from '../dom'; | ||
import type { IInstruction } from '../renderer'; | ||
import type { AttrSyntax } from '../resources/attribute-pattern'; | ||
import type { IInstruction, AttrSyntax } from '@aurelia/template-compiler'; | ||
import type { PartialCustomElementDefinition } from '../resources/custom-element'; | ||
import type { IAuSlotProjections } from './controller.projection'; | ||
import type { LifecycleHooksLookup } from './lifecycle-hooks'; | ||
@@ -460,3 +458,3 @@ import type { IViewFactory } from './view'; | ||
export interface IControllerElementHydrationInstruction { | ||
readonly projections: IAuSlotProjections | null; | ||
readonly projections: Record<string, PartialCustomElementDefinition> | null; | ||
/** | ||
@@ -463,0 +461,0 @@ * A list of captured attributes/binding in raw format |
import { IContainer } from '@aurelia/kernel'; | ||
import { INode, INodeSequence } from '../dom'; | ||
import { ICompliationInstruction, IRenderer } from '../renderer'; | ||
import { IRenderer } from '../renderer'; | ||
import { CustomElementDefinition, PartialCustomElementDefinition } from '../resources/custom-element'; | ||
@@ -8,8 +8,13 @@ import { IViewFactory } from './view'; | ||
export declare const IRendering: import("@aurelia/kernel").InterfaceSymbol<IRendering>; | ||
export interface IRendering extends Rendering { | ||
export interface IRendering { | ||
get renderers(): Record<string, IRenderer>; | ||
compile(definition: CustomElementDefinition, container: IContainer): CustomElementDefinition; | ||
getViewFactory(definition: PartialCustomElementDefinition, container: IContainer): IViewFactory; | ||
createNodes(definition: CustomElementDefinition): INodeSequence; | ||
render(controller: IHydratableController, targets: ArrayLike<INode>, definition: CustomElementDefinition, host: INode | null | undefined): void; | ||
} | ||
export declare class Rendering { | ||
export declare class Rendering implements IRendering { | ||
get renderers(): Record<string, IRenderer>; | ||
constructor(); | ||
compile(definition: PartialCustomElementDefinition, container: IContainer, compilationInstruction: ICompliationInstruction | null): CustomElementDefinition; | ||
compile(definition: CustomElementDefinition, container: IContainer): CustomElementDefinition; | ||
getViewFactory(definition: PartialCustomElementDefinition, container: IContainer): IViewFactory; | ||
@@ -16,0 +21,0 @@ createNodes(definition: CustomElementDefinition): INodeSequence; |
import { CustomElementDefinition } from '../resources/custom-element'; | ||
import type { IContainer } from '@aurelia/kernel'; | ||
import type { PartialCustomElementDefinition } from '../resources/custom-element'; | ||
import type { ICustomAttributeController, ICustomElementController, ISyntheticView } from './controller'; | ||
export interface IViewFactory extends ViewFactory { | ||
export interface IViewFactory { | ||
name: string; | ||
readonly container: IContainer; | ||
def: CustomElementDefinition; | ||
isCaching: boolean; | ||
setCacheSize(size: number | '*', doNotOverrideIfAlreadySet: boolean): void; | ||
canReturnToCache(_controller: ISyntheticView): boolean; | ||
tryReturnToCache(controller: ISyntheticView): boolean; | ||
create(parentController?: ISyntheticView | ICustomElementController | ICustomAttributeController | undefined): ISyntheticView; | ||
} | ||
@@ -12,3 +19,3 @@ export declare const IViewFactory: import("@aurelia/kernel").InterfaceSymbol<IViewFactory>; | ||
readonly container: IContainer; | ||
def: PartialCustomElementDefinition; | ||
def: CustomElementDefinition; | ||
isCaching: boolean; | ||
@@ -15,0 +22,0 @@ constructor(container: IContainer, def: CustomElementDefinition); |
{ | ||
"name": "@aurelia/runtime-html", | ||
"version": "2.0.1-dev.202404171154", | ||
"version": "2.0.1-dev.202404281254", | ||
"main": "dist/cjs/index.cjs", | ||
@@ -57,8 +57,9 @@ "module": "dist/esm/index.mjs", | ||
"dependencies": { | ||
"@aurelia/kernel": "2.0.1-dev.202404171154", | ||
"@aurelia/metadata": "2.0.1-dev.202404171154", | ||
"@aurelia/platform": "2.0.1-dev.202404171154", | ||
"@aurelia/platform-browser": "2.0.1-dev.202404171154", | ||
"@aurelia/runtime": "2.0.1-dev.202404171154", | ||
"@aurelia/expression-parser": "2.0.1-dev.202404171154" | ||
"@aurelia/kernel": "2.0.1-dev.202404281254", | ||
"@aurelia/metadata": "2.0.1-dev.202404281254", | ||
"@aurelia/platform": "2.0.1-dev.202404281254", | ||
"@aurelia/platform-browser": "2.0.1-dev.202404281254", | ||
"@aurelia/runtime": "2.0.1-dev.202404281254", | ||
"@aurelia/expression-parser": "2.0.1-dev.202404281254", | ||
"@aurelia/template-compiler": "2.0.1-dev.202404281254" | ||
}, | ||
@@ -65,0 +66,0 @@ "devDependencies": { |
@@ -6,3 +6,3 @@ import { BrowserPlatform } from '@aurelia/platform-browser'; | ||
import { Controller, IControllerElementHydrationInstruction } from './templating/controller'; | ||
import { createInterface, instanceRegistration } from './utilities-di'; | ||
import { createInterface, instanceRegistration, registerResolver } from './utilities-di'; | ||
@@ -13,3 +13,3 @@ import type { Constructable, IContainer, IDisposable } from '@aurelia/kernel'; | ||
import { IPlatform } from './platform'; | ||
import { registerHostNode } from './dom'; | ||
import { IEventTarget, registerHostNode } from './dom'; | ||
import { isFunction } from './utilities'; | ||
@@ -84,2 +84,3 @@ import { ErrorNames, createMappedError } from './errors'; | ||
registerResolver(container, IEventTarget, new InstanceProvider<IEventTarget>('IEventTarget', host)); | ||
registerHostNode(container, this.platform = this._createPlatform(container, host), host); | ||
@@ -125,3 +126,3 @@ | ||
return onResolve(this._runAppTasks('hydrating'), () => { | ||
controller._hydrate(null); | ||
controller._hydrate(); | ||
return onResolve(this._runAppTasks('hydrated'), () => { | ||
@@ -128,0 +129,0 @@ controller._hydrateChildren(); |
@@ -75,8 +75,10 @@ import { DI, InstanceProvider, onResolve } from '@aurelia/kernel'; | ||
public enhance<T extends object>(config: IEnhancementConfig<T>): IAppRoot<T> | Promise<IAppRoot<T>> { | ||
const appRoot = new AppRoot( | ||
const container = (config.container ?? this.container.createChild()); | ||
const rootProvider = registerResolver(container, IAppRoot, new InstanceProvider<IAppRoot<T>>('IAppRoot')); | ||
const appRoot: IAppRoot<T> = new AppRoot( | ||
{ host: config.host as HTMLElement, component: config.component }, | ||
config.container ?? this.container.createChild(), | ||
new InstanceProvider('IAppRoot'), | ||
container, | ||
rootProvider, | ||
true | ||
) as IAppRoot<T>; | ||
); | ||
return onResolve(appRoot.activate(), () => appRoot); | ||
@@ -83,0 +85,0 @@ } |
import { kebabCase, getPrototypeChain, noop, Class } from '@aurelia/kernel'; | ||
import { ICoercionConfiguration } from '@aurelia/runtime'; | ||
import { toView, type BindingMode, twoWay } from './binding/interfaces-bindings'; | ||
import { defaultMode, toView, twoWay } from './binding/interfaces-bindings'; | ||
import { defineMetadata, getAnnotationKeyFor, getMetadata } from './utilities-metadata'; | ||
@@ -10,11 +10,12 @@ import { createLookup, isString, objectFreeze, objectKeys } from './utilities'; | ||
import { ErrorNames, createMappedError } from './errors'; | ||
import { BindingMode, IComponentBindablePropDefinition } from '@aurelia/template-compiler'; | ||
type PropertyType = typeof Number | typeof String | typeof Boolean | typeof BigInt | { coercer: InterceptorFunc } | Class<unknown>; | ||
export type PartialBindableDefinition = { | ||
mode?: BindingMode; | ||
export type PartialBindableDefinition = Omit<IComponentBindablePropDefinition, 'name'> & { | ||
// mode?: BindingMode; | ||
callback?: string; | ||
attribute?: string; | ||
// attribute?: string; | ||
name?: string; | ||
primary?: boolean; | ||
// primary?: boolean; | ||
set?: InterceptorFunc; | ||
@@ -31,4 +32,2 @@ type?: PropertyType; | ||
type PartialBindableDefinitionPropertyOmitted = Omit<PartialBindableDefinition, 'name'>; | ||
/** | ||
@@ -40,3 +39,3 @@ * Decorator: Specifies custom behavior for a bindable property. | ||
*/ | ||
export function bindable(config?: PartialBindableDefinitionPropertyOmitted): (target: unknown, context: ClassDecoratorContext | ClassFieldDecoratorContext | ClassGetterDecoratorContext) => void; | ||
export function bindable(config?: Omit<PartialBindableDefinition, 'name'>): (target: unknown, context: ClassDecoratorContext | ClassFieldDecoratorContext | ClassGetterDecoratorContext) => void; | ||
/** | ||
@@ -129,3 +128,3 @@ * Decorator: Specifies a bindable property on a class. | ||
// - @bindable({...opts}) | ||
configOrProp = configOrPropOrTarget === void 0 ? {} : configOrPropOrTarget as string | PartialBindableDefinition; | ||
configOrProp = configOrPropOrTarget === void 0 ? {} satisfies PartialBindableDefinition : configOrPropOrTarget as string | PartialBindableDefinition; | ||
return decorator; | ||
@@ -193,6 +192,7 @@ } | ||
public static create(prop: string, def: PartialBindableDefinition = {}): BindableDefinition { | ||
const mode = (def.mode ?? toView) as BindingMode; | ||
return new BindableDefinition( | ||
def.attribute ?? kebabCase(prop), | ||
def.callback ?? `${prop}Changed`, | ||
def.mode ?? toView, | ||
isString(mode) ? BindingMode[mode as keyof typeof BindingMode] ?? defaultMode : mode, | ||
def.primary ?? false, | ||
@@ -199,0 +199,0 @@ def.name ?? prop, |
@@ -296,1 +296,13 @@ import { type IServiceLocator, Key, type Constructable, IDisposable, IContainer } from '@aurelia/kernel'; | ||
})(); | ||
export const createPrototypeMixer = (() => { | ||
const mixed = new WeakSet<Constructable<IBinding>>(); | ||
return (mixer: () => void) => { | ||
return function<T extends Constructable<IBinding>>(this: T) { | ||
if (!mixed.has(this)) { | ||
mixed.add(this); | ||
mixer.call(this); | ||
} | ||
}; | ||
}; | ||
})(); |
@@ -24,3 +24,3 @@ import { | ||
import type { BindingMode, IBinding, IBindingController } from './interfaces-bindings'; | ||
import { mixinUseScope, mixingBindingLimited, mixinAstEvaluator } from './binding-utils'; | ||
import { mixinUseScope, mixingBindingLimited, mixinAstEvaluator, createPrototypeMixer } from './binding-utils'; | ||
import { IsExpression } from '@aurelia/expression-parser'; | ||
@@ -40,3 +40,4 @@ | ||
export class ContentBinding implements IBinding, ISubscriber, ICollectionSubscriber { | ||
static { | ||
/** @internal */ | ||
public static mix = /*@__PURE__*/ createPrototypeMixer(() => { | ||
mixinUseScope(ContentBinding); | ||
@@ -46,3 +47,3 @@ mixingBindingLimited(ContentBinding, () => 'updateTarget'); | ||
mixinAstEvaluator(void 0, false)(ContentBinding); | ||
} | ||
}); | ||
@@ -49,0 +50,0 @@ public isBound: boolean = false; |
import { IDisposable, IServiceLocator } from '@aurelia/kernel'; | ||
import { State } from '../templating/controller'; | ||
import { objectFreeze } from '../utilities'; | ||
import { type Scope } from './scope'; | ||
import { TaskQueue } from '@aurelia/platform'; | ||
import { BindingMode } from '@aurelia/template-compiler'; | ||
// Note: the oneTime binding now has a non-zero value for 2 reasons: | ||
// - plays nicer with bitwise operations (more consistent code, more explicit settings) | ||
// - allows for potentially having something like BindingMode.oneTime | BindingMode.fromView, where an initial value is set once to the view but updates from the view also propagate back to the view model | ||
// | ||
// Furthermore, the "default" mode would be for simple ".bind" expressions to make it explicit for our logic that the default is being used. | ||
// This essentially adds extra information which binding could use to do smarter things and allows bindingBehaviors that add a mode instead of simply overwriting it | ||
/** @internal */ export const oneTime = 0b0001; | ||
/** @internal */ export const toView = 0b0010; | ||
/** @internal */ export const fromView = 0b0100; | ||
/** @internal */ export const twoWay = 0b0110; | ||
/** @internal */ export const defaultMode = 0b1000; | ||
/** | ||
* Mode of a binding to operate | ||
* - 1 / one time - bindings should only update the target once | ||
* - 2 / to view - bindings should update the target and observe the source for changes to update again | ||
* - 3 / from view - bindings should update the source and observe the target for changes to update again | ||
* - 6 / two way - bindings should observe both target and source for changes to update the other side | ||
* - 8 / default - undecided mode, bindings, depends on the circumstance, may decide what to do accordingly | ||
*/ | ||
export const BindingMode = /*@__PURE__*/ objectFreeze({ | ||
oneTime, | ||
toView, | ||
fromView, | ||
twoWay, | ||
/** | ||
* Unspecified mode, bindings may act differently with this mode | ||
*/ | ||
default: defaultMode, | ||
} as const); | ||
export type BindingMode = typeof BindingMode[keyof typeof BindingMode]; | ||
/** @internal */ export const { default: defaultMode, oneTime, toView, fromView, twoWay } = BindingMode; | ||
export { BindingMode } from '@aurelia/template-compiler'; | ||
@@ -38,0 +10,0 @@ export interface IBindingController { |
@@ -11,3 +11,3 @@ import { | ||
import { activating } from '../templating/controller'; | ||
import { mixinAstEvaluator, mixinUseScope, mixingBindingLimited } from './binding-utils'; | ||
import { createPrototypeMixer, mixinAstEvaluator, mixinUseScope, mixingBindingLimited } from './binding-utils'; | ||
import { toView } from './interfaces-bindings'; | ||
@@ -42,3 +42,2 @@ | ||
export class InterpolationBinding implements IBinding, ISubscriber, ICollectionSubscriber { | ||
public isBound: boolean = false; | ||
@@ -78,3 +77,3 @@ | ||
public targetProperty: string, | ||
public mode: BindingMode, | ||
public mode: BindingMode | ||
) { | ||
@@ -180,3 +179,4 @@ this._controller = controller; | ||
export class InterpolationPartBinding implements IBinding, ICollectionSubscriber { | ||
static { | ||
/** @internal */ | ||
public static mix = /*@__PURE__*/ createPrototypeMixer(() => { | ||
mixinUseScope(InterpolationPartBinding); | ||
@@ -186,3 +186,3 @@ mixingBindingLimited(InterpolationPartBinding, () => 'updateTarget'); | ||
mixinAstEvaluator(true)(InterpolationPartBinding); | ||
} | ||
}); | ||
@@ -189,0 +189,0 @@ // at runtime, mode may be overriden by binding behavior |
@@ -16,3 +16,3 @@ import { | ||
} from '../ast.eval'; | ||
import { mixinAstEvaluator, mixinUseScope, mixingBindingLimited } from './binding-utils'; | ||
import { createPrototypeMixer, mixinAstEvaluator, mixinUseScope, mixingBindingLimited } from './binding-utils'; | ||
@@ -25,3 +25,8 @@ import type { IIndexable, IServiceLocator } from '@aurelia/kernel'; | ||
export class LetBinding implements IBinding, ISubscriber, ICollectionSubscriber { | ||
static { | ||
/** | ||
* The renderer can call this method to prepare the prototype, | ||
* so that it can be effectively tree shaken before decorator can be officially applied with tree shaking. | ||
* @internal | ||
*/ | ||
public static mix = /*@__PURE__*/ createPrototypeMixer(() => { | ||
mixinUseScope(LetBinding); | ||
@@ -31,3 +36,3 @@ mixingBindingLimited(LetBinding, () => 'updateTarget'); | ||
mixinAstEvaluator(true)(LetBinding); | ||
} | ||
}); | ||
@@ -34,0 +39,0 @@ public isBound: boolean = false; |
import { type IsBindingBehavior } from '@aurelia/expression-parser'; | ||
import { isArray, isFunction, isString, objectFreeze } from '../utilities'; | ||
import { createInterface, singletonRegistration } from '../utilities-di'; | ||
import { mixinAstEvaluator, mixinUseScope, mixingBindingLimited } from './binding-utils'; | ||
import { createPrototypeMixer, mixinAstEvaluator, mixinUseScope, mixingBindingLimited } from './binding-utils'; | ||
@@ -24,7 +24,8 @@ import { resolve, type IServiceLocator, all, IContainer } from '@aurelia/kernel'; | ||
export class ListenerBinding implements IBinding, ISubscriber, ICollectionSubscriber { | ||
static { | ||
/** @internal */ | ||
public static mix = createPrototypeMixer(function () { | ||
mixinUseScope(ListenerBinding); | ||
mixingBindingLimited(ListenerBinding, () => 'callSource'); | ||
mixinAstEvaluator(true, true)(ListenerBinding); | ||
} | ||
}); | ||
@@ -93,3 +94,3 @@ public isBound: boolean = false; | ||
if (this.target !== event.composedPath()[0]) { | ||
/* istanbul-ignore-next */ | ||
/* istanbul ignore next */ | ||
return; | ||
@@ -106,3 +107,3 @@ } | ||
if (this._scope === scope) { | ||
/* istanbul-ignore-next */ | ||
/* istanbul ignore next */ | ||
return; | ||
@@ -123,3 +124,3 @@ } | ||
if (!this.isBound) { | ||
/* istanbul-ignore-next */ | ||
/* istanbul ignore next */ | ||
return; | ||
@@ -126,0 +127,0 @@ } |
import { connectable, ISubscriber } from '@aurelia/runtime'; | ||
import { astAssign, astBind, astEvaluate, astUnbind, IAstEvaluator } from '../ast.eval'; | ||
import { activating } from '../templating/controller'; | ||
import { BindingTargetSubscriber, IFlushQueue, mixinAstEvaluator, mixinUseScope, mixingBindingLimited } from './binding-utils'; | ||
import { BindingTargetSubscriber, IFlushQueue, createPrototypeMixer, mixinAstEvaluator, mixinUseScope, mixingBindingLimited } from './binding-utils'; | ||
import { IBinding, fromView, oneTime, toView } from './interfaces-bindings'; | ||
@@ -25,3 +25,4 @@ | ||
export class PropertyBinding implements IBinding, ISubscriber, ICollectionSubscriber { | ||
static { | ||
/** @internal */ | ||
public static mix = /*@__PURE__*/ createPrototypeMixer(() => { | ||
mixinUseScope(PropertyBinding); | ||
@@ -31,3 +32,3 @@ mixingBindingLimited(PropertyBinding, (propBinding: PropertyBinding) => (propBinding.mode & fromView) ? 'updateSource' : 'updateTarget'); | ||
mixinAstEvaluator(true, false)(PropertyBinding); | ||
} | ||
}); | ||
@@ -34,0 +35,0 @@ public isBound: boolean = false; |
@@ -5,3 +5,3 @@ import type { IServiceLocator } from '@aurelia/kernel'; | ||
import { astAssign, astBind, astEvaluate, astUnbind, IAstEvaluator } from '../ast.eval'; | ||
import { mixinAstEvaluator } from './binding-utils'; | ||
import { createPrototypeMixer, mixinAstEvaluator } from './binding-utils'; | ||
import { type IsBindingBehavior } from '@aurelia/expression-parser'; | ||
@@ -12,5 +12,5 @@ import { IBinding } from './interfaces-bindings'; | ||
export class RefBinding implements IBinding, ISubscriber, ICollectionSubscriber { | ||
static { | ||
public static mix = /*@__PURE__*/ createPrototypeMixer(() => { | ||
mixinAstEvaluator(false)(RefBinding); | ||
} | ||
}); | ||
@@ -17,0 +17,0 @@ public isBound: boolean = false; |
@@ -8,3 +8,4 @@ import { IServiceLocator, Key, emptyArray } from '@aurelia/kernel'; | ||
import { ICustomElementController, IHydrationContext, IController, IHydratableController, vmkCa } from '../templating/controller'; | ||
import { IHasController, IInstruction, ITemplateCompiler, spreadBinding as $spreadBinding, SpreadElementPropBindingInstruction, spreadElementProp } from '../renderer'; | ||
import { IHasController,} from '../renderer'; | ||
import { IInstruction, ITemplateCompiler, SpreadElementPropBindingInstruction, InstructionType } from '@aurelia/template-compiler'; | ||
import { IRendering } from '../templating/rendering'; | ||
@@ -67,6 +68,6 @@ import { IPlatform } from '../platform'; | ||
switch (inst.type) { | ||
case $spreadBinding: | ||
case InstructionType.spreadBinding: | ||
renderSpreadInstruction(ancestor + 1); | ||
break; | ||
case spreadElementProp: | ||
case InstructionType.spreadElementProp: | ||
renderers[(inst as SpreadElementPropBindingInstruction).instructions.type].render( | ||
@@ -73,0 +74,0 @@ spreadBinding, |
import { createLookup, isDataAttribute } from '../utilities'; | ||
import { ISVGAnalyzer } from '../observation/svg-analyzer'; | ||
import { createInterface } from '../utilities-di'; | ||
import { resolve } from '@aurelia/kernel'; | ||
import { createImplementationRegister, resolve } from '@aurelia/kernel'; | ||
import { ErrorNames, createMappedError } from '../errors'; | ||
import { IAttrMapper, IsTwoWayPredicate } from '@aurelia/template-compiler'; | ||
export interface IAttrMapper extends AttrMapper {} | ||
export const IAttrMapper = /*@__PURE__*/createInterface<IAttrMapper>('IAttrMapper', x => x.singleton(AttrMapper)); | ||
export class AttrMapper implements IAttrMapper { | ||
public static register = /*@__PURE__*/ createImplementationRegister(IAttrMapper); | ||
export type IsTwoWayPredicate = (element: Element, attribute: string) => boolean; | ||
export class AttrMapper { | ||
/** @internal */ private readonly fns: IsTwoWayPredicate[] = []; | ||
@@ -14,0 +11,0 @@ /** @internal */ private readonly _tagAttrMap: Record<string, Record<string, PropertyKey>> = createLookup(); |
@@ -10,4 +10,3 @@ import { IContainer, noop } from '@aurelia/kernel'; | ||
EventAttributePattern, | ||
} from './resources/attribute-pattern'; | ||
import { | ||
DefaultBindingCommand, | ||
@@ -26,4 +25,3 @@ ForBindingCommand, | ||
SpreadBindingCommand, | ||
} from './resources/binding-command'; | ||
import { TemplateCompiler } from './compiler/template-compiler'; | ||
} from '@aurelia/template-compiler'; | ||
import { | ||
@@ -83,2 +81,3 @@ CustomAttributeRenderer, | ||
import { EventModifierRegistration } from './binding/listener-binding'; | ||
import { RuntimeTemplateCompilerImplementation } from './compiler/template-compiler'; | ||
@@ -92,3 +91,3 @@ /** | ||
export const DefaultComponents = [ | ||
TemplateCompiler, | ||
RuntimeTemplateCompilerImplementation, | ||
DirtyChecker, | ||
@@ -95,0 +94,0 @@ NodeObserverLocator, |
@@ -69,44 +69,4 @@ export { | ||
} from './app-task'; | ||
export { | ||
AttrSyntax, | ||
IAttributeParser, | ||
attributePattern, | ||
type AttributePatternDefinition, | ||
IAttributePattern, | ||
type AttributePatternKind, | ||
AttributePattern, | ||
Interpretation, | ||
ISyntaxInterpreter, | ||
AtPrefixedTriggerAttributePattern, | ||
ColonPrefixedBindAttributePattern, | ||
DotSeparatedAttributePattern, | ||
RefAttributePattern, | ||
} from './resources/attribute-pattern'; | ||
export { | ||
bindingCommand, | ||
type ICommandBuildInfo, | ||
BindingCommand , | ||
type BindingCommandInstance, | ||
type PartialBindingCommandDefinition, | ||
type BindingCommandStaticAuDefinition, | ||
BindingCommandDefinition, | ||
type BindingCommandKind, | ||
type BindingCommandType, | ||
DefaultBindingCommand, | ||
ForBindingCommand, | ||
FromViewBindingCommand, | ||
OneTimeBindingCommand, | ||
ToViewBindingCommand, | ||
TwoWayBindingCommand, | ||
TriggerBindingCommand, | ||
CaptureBindingCommand, | ||
AttrBindingCommand, | ||
ClassBindingCommand, | ||
StyleBindingCommand, | ||
} from './resources/binding-command'; | ||
export { | ||
IAttrMapper, | ||
type IsTwoWayPredicate, | ||
} from './compiler/attribute-mapper'; | ||
export { | ||
BindingMode, | ||
@@ -138,3 +98,3 @@ type IBindingController, | ||
AttributeBinding, | ||
} from './binding/attribute'; | ||
} from './binding/attribute-binding'; | ||
export { | ||
@@ -165,29 +125,4 @@ InterpolationBinding, | ||
IRenderer, | ||
ITemplateCompiler, | ||
type ICompliationInstruction, | ||
renderer, | ||
HydrateAttributeInstruction, | ||
HydrateElementInstruction, | ||
HydrateTemplateController, | ||
InterpolationInstruction, | ||
IteratorBindingInstruction, | ||
LetBindingInstruction, | ||
HydrateLetElementInstruction, | ||
RefBindingInstruction, | ||
SetPropertyInstruction, | ||
AttributeBindingInstruction, | ||
ListenerBindingInstruction, | ||
PropertyBindingInstruction, | ||
SetAttributeInstruction, | ||
SetClassAttributeInstruction, | ||
SetStyleAttributeInstruction, | ||
StylePropertyBindingInstruction, | ||
TextBindingInstruction, | ||
SpreadBindingInstruction, | ||
SpreadElementPropBindingInstruction, | ||
isInstruction, | ||
IInstruction, | ||
InstructionType, | ||
PropertyBindingRenderer, | ||
@@ -204,3 +139,2 @@ TextBindingRenderer, | ||
IteratorBindingRenderer, | ||
MultiAttrInstruction, | ||
RefBindingRenderer, | ||
@@ -216,2 +150,10 @@ SetAttributeRenderer, | ||
export { | ||
AttrMapper, | ||
} from './compiler/attribute-mapper'; | ||
export { | ||
RuntimeTemplateCompilerImplementation, | ||
} from './compiler/template-compiler'; | ||
export { | ||
AttributeNSAccessor, | ||
@@ -318,3 +260,2 @@ } from './observation/attribute-ns-accessor'; | ||
type PartialCustomElementDefinition, | ||
type ProcessContentHook, | ||
type CustomElementStaticAuDefinition, | ||
@@ -365,13 +306,5 @@ useShadowDOM, | ||
export { | ||
ITemplateElementFactory | ||
} from './compiler/template-element-factory'; | ||
export { | ||
TemplateCompiler, | ||
ITemplateCompilerHooks, | ||
TemplateCompilerHooks, | ||
templateCompilerHooks, | ||
type IAttributeBindablesInfo, | ||
type IElementBindablesInfo, | ||
IBindablesInfoResolver, | ||
} from './compiler/template-compiler'; | ||
/** @deprecated - Should be imported directly from `aurelia` or `@aurelia/template-compiler` package */ | ||
BindingCommand, | ||
} from '@aurelia/template-compiler'; | ||
@@ -378,0 +311,0 @@ export { |
@@ -1,2 +0,2 @@ | ||
import { emptyObject, IServiceLocator, resolve } from '@aurelia/kernel'; | ||
import { createImplementationRegister, emptyObject, IServiceLocator, resolve } from '@aurelia/kernel'; | ||
import { | ||
@@ -20,5 +20,4 @@ getObserverLookup, | ||
import { atLayout, atNode, createLookup, isDataAttribute, isString, objectAssign } from '../utilities'; | ||
import { aliasRegistration, singletonRegistration } from '../utilities-di'; | ||
import type { IIndexable, IContainer } from '@aurelia/kernel'; | ||
import type { IIndexable } from '@aurelia/kernel'; | ||
import type { AccessorType, IAccessor, IObserver, ICollectionObserver, CollectionKind } from '@aurelia/runtime'; | ||
@@ -28,27 +27,29 @@ import type { INode } from '../dom'; | ||
// https://infra.spec.whatwg.org/#namespaces | ||
// const htmlNS = 'http://www.w3.org/1999/xhtml'; | ||
// const mathmlNS = 'http://www.w3.org/1998/Math/MathML'; | ||
// const svgNS = 'http://www.w3.org/2000/svg'; | ||
const xlinkNS = 'http://www.w3.org/1999/xlink'; | ||
const xmlNS = 'http://www.w3.org/XML/1998/namespace'; | ||
const xmlnsNS = 'http://www.w3.org/2000/xmlns/'; | ||
const nsAttributes = (() => { | ||
// https://infra.spec.whatwg.org/#namespaces | ||
// const htmlNS = 'http://www.w3.org/1999/xhtml'; | ||
// const mathmlNS = 'http://www.w3.org/1998/Math/MathML'; | ||
// const svgNS = 'http://www.w3.org/2000/svg'; | ||
const xlinkNS = 'http://www.w3.org/1999/xlink'; | ||
const xmlNS = 'http://www.w3.org/XML/1998/namespace'; | ||
const xmlnsNS = 'http://www.w3.org/2000/xmlns/'; | ||
// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 | ||
const nsAttributes = objectAssign( | ||
createLookup<[string, string]>(), | ||
{ | ||
'xlink:actuate': ['actuate', xlinkNS], | ||
'xlink:arcrole': ['arcrole', xlinkNS], | ||
'xlink:href': ['href', xlinkNS], | ||
'xlink:role': ['role', xlinkNS], | ||
'xlink:show': ['show', xlinkNS], | ||
'xlink:title': ['title', xlinkNS], | ||
'xlink:type': ['type', xlinkNS], | ||
'xml:lang': ['lang', xmlNS], | ||
'xml:space': ['space', xmlNS], | ||
'xmlns': ['xmlns', xmlnsNS], | ||
'xmlns:xlink': ['xlink', xmlnsNS], | ||
}, | ||
); | ||
// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 | ||
return objectAssign( | ||
createLookup<[string, string]>(), | ||
{ | ||
'xlink:actuate': ['actuate', xlinkNS], | ||
'xlink:arcrole': ['arcrole', xlinkNS], | ||
'xlink:href': ['href', xlinkNS], | ||
'xlink:role': ['role', xlinkNS], | ||
'xlink:show': ['show', xlinkNS], | ||
'xlink:title': ['title', xlinkNS], | ||
'xlink:type': ['type', xlinkNS], | ||
'xml:lang': ['lang', xmlNS], | ||
'xml:space': ['space', xmlNS], | ||
'xmlns': ['xmlns', xmlnsNS], | ||
'xmlns:xlink': ['xlink', xmlnsNS], | ||
}, | ||
); | ||
})(); | ||
@@ -111,8 +112,3 @@ const elementPropertyAccessor = new PropertyAccessor(); | ||
export class NodeObserverLocator implements INodeObserverLocator { | ||
public static register(container: IContainer) { | ||
container.register( | ||
singletonRegistration(this, this), | ||
aliasRegistration(this, INodeObserverLocator), | ||
); | ||
} | ||
public static register = /*@__PURE__*/ createImplementationRegister(INodeObserverLocator); | ||
@@ -119,0 +115,0 @@ /** |
@@ -13,6 +13,3 @@ import { | ||
type ExpressionType, | ||
type Interpolation, | ||
type IsBindingBehavior, | ||
type AnyBindingExpression, | ||
type ForOfStatement, | ||
} from '@aurelia/expression-parser'; | ||
@@ -23,5 +20,5 @@ import { | ||
} from '@aurelia/runtime'; | ||
import { toView, type BindingMode } from './binding/interfaces-bindings'; | ||
import { AttributeBinding } from './binding/attribute'; | ||
import { InterpolationBinding } from './binding/interpolation-binding'; | ||
import { toView } from './binding/interfaces-bindings'; | ||
import { AttributeBinding } from './binding/attribute-binding'; | ||
import { InterpolationBinding, InterpolationPartBinding } from './binding/interpolation-binding'; | ||
import { ContentBinding } from "./binding/content-binding"; | ||
@@ -39,342 +36,17 @@ import { LetBinding } from './binding/let-binding'; | ||
import { IRendering } from './templating/rendering'; | ||
import type { AttrSyntax } from './resources/attribute-pattern'; | ||
import { objectKeys, isString, etIsProperty, etInterpolation, etIsIterator, etIsFunction, objectFreeze } from './utilities'; | ||
import { objectKeys, isString, etIsProperty, etInterpolation, etIsIterator, etIsFunction } from './utilities'; | ||
import { createInterface, registerResolver, singletonRegistration } from './utilities-di'; | ||
import { IAuSlotProjections, IAuSlotsInfo, AuSlotsInfo } from './templating/controller.projection'; | ||
import { IAuSlotsInfo, AuSlotsInfo } from './templating/controller.projection'; | ||
import type { IHydratableController } from './templating/controller'; | ||
import type { PartialCustomElementDefinition } from './resources/custom-element'; | ||
import { ErrorNames, createMappedError } from './errors'; | ||
import { SpreadBinding } from './binding/spread-binding'; | ||
import { AttributeBindingInstruction, HydrateAttributeInstruction, HydrateElementInstruction, HydrateLetElementInstruction, HydrateTemplateController, IInstruction, ITemplateCompiler, InstructionType, InterpolationInstruction, IteratorBindingInstruction, LetBindingInstruction, ListenerBindingInstruction, PropertyBindingInstruction, RefBindingInstruction, SetAttributeInstruction, SetClassAttributeInstruction, SetPropertyInstruction, SetStyleAttributeInstruction, SpreadBindingInstruction, StylePropertyBindingInstruction, TextBindingInstruction } from '@aurelia/template-compiler'; | ||
/** @internal */ export const hydrateElement = 'ra'; | ||
/** @internal */ export const hydrateAttribute = 'rb'; | ||
/** @internal */ export const hydrateTemplateController = 'rc'; | ||
/** @internal */ export const hydrateLetElement = 'rd'; | ||
/** @internal */ export const setProperty = 're'; | ||
/** @internal */ export const interpolation = 'rf'; | ||
/** @internal */ export const propertyBinding = 'rg'; | ||
/** @internal */ export const letBinding = 'ri'; | ||
/** @internal */ export const refBinding = 'rj'; | ||
/** @internal */ export const iteratorBinding = 'rk'; | ||
/** @internal */ export const multiAttr = 'rl'; | ||
/** @internal */ export const textBinding = 'ha'; | ||
/** @internal */ export const listenerBinding = 'hb'; | ||
/** @internal */ export const attributeBinding = 'hc'; | ||
/** @internal */ export const stylePropertyBinding = 'hd'; | ||
/** @internal */ export const setAttribute = 'he'; | ||
/** @internal */ export const setClassAttribute = 'hf'; | ||
/** @internal */ export const setStyleAttribute = 'hg'; | ||
/** @internal */ export const spreadBinding = 'hs'; | ||
/** @internal */ export const spreadElementProp = 'hp'; | ||
export const InstructionType = /*@__PURE__*/ objectFreeze({ | ||
hydrateElement, | ||
hydrateAttribute, | ||
hydrateTemplateController, | ||
hydrateLetElement, | ||
setProperty, | ||
interpolation, | ||
propertyBinding, | ||
letBinding, | ||
refBinding, | ||
iteratorBinding, | ||
multiAttr, | ||
textBinding, | ||
listenerBinding, | ||
attributeBinding, | ||
stylePropertyBinding, | ||
setAttribute, | ||
setClassAttribute, | ||
setStyleAttribute, | ||
spreadBinding, | ||
spreadElementProp, | ||
}); | ||
export type InstructionType = typeof InstructionType[keyof typeof InstructionType]; | ||
export interface IInstruction { | ||
readonly type: string; | ||
} | ||
export const IInstruction = /*@__PURE__*/createInterface<IInstruction>('Instruction'); | ||
export function isInstruction(value: unknown): value is IInstruction { | ||
const type = (value as { type?: string }).type; | ||
return isString(type) && type.length === 2; | ||
} | ||
export class InterpolationInstruction { | ||
public readonly type = interpolation; | ||
public constructor( | ||
public from: string | Interpolation, | ||
public to: string, | ||
) {} | ||
} | ||
export class PropertyBindingInstruction { | ||
public readonly type = propertyBinding; | ||
public constructor( | ||
public from: string | IsBindingBehavior, | ||
public to: string, | ||
public mode: BindingMode, | ||
) {} | ||
} | ||
export class IteratorBindingInstruction { | ||
public readonly type = iteratorBinding; | ||
public constructor( | ||
public forOf: string | ForOfStatement, | ||
public to: string, | ||
public props: MultiAttrInstruction[], | ||
) {} | ||
} | ||
export class RefBindingInstruction { | ||
public readonly type = refBinding; | ||
public constructor( | ||
public readonly from: string | IsBindingBehavior, | ||
public readonly to: string | ||
) {} | ||
} | ||
export class SetPropertyInstruction { | ||
public readonly type = setProperty; | ||
public constructor( | ||
public value: unknown, | ||
public to: string, | ||
) {} | ||
} | ||
export class MultiAttrInstruction { | ||
public readonly type = multiAttr; | ||
public constructor( | ||
public value: string, | ||
public to: string, | ||
public command: string | null, | ||
) {} | ||
} | ||
export class HydrateElementInstruction<T extends Record<PropertyKey, unknown> = Record<PropertyKey, unknown>> { | ||
public readonly type = hydrateElement; | ||
public constructor( | ||
/** | ||
* The name of the custom element this instruction is associated with | ||
*/ | ||
// in theory, Constructor of resources should be accepted too | ||
// though it would be unnecessary right now | ||
public res: string | /* Constructable | */CustomElementDefinition, | ||
/** | ||
* Bindable instructions for the custom element instance | ||
*/ | ||
public props: IInstruction[], | ||
/** | ||
* Indicates what projections are associated with the element usage | ||
*/ | ||
public projections: Record<string, PartialCustomElementDefinition> | null, | ||
/** | ||
* Indicates whether the usage of the custom element was with a containerless attribute or not | ||
*/ | ||
public containerless: boolean, | ||
/** | ||
* A list of captured attr syntaxes | ||
*/ | ||
public captures: AttrSyntax[] | undefined, | ||
/** | ||
* Any data associated with this instruction | ||
*/ | ||
public readonly data: T, | ||
) { | ||
} | ||
} | ||
export class HydrateAttributeInstruction { | ||
public readonly type = hydrateAttribute; | ||
public constructor( | ||
// in theory, Constructor of resources should be accepted too | ||
// though it would be unnecessary right now | ||
public res: string | /* Constructable | */CustomAttributeDefinition, | ||
public alias: string | undefined, | ||
/** | ||
* Bindable instructions for the custom attribute instance | ||
*/ | ||
public props: IInstruction[], | ||
) {} | ||
} | ||
export class HydrateTemplateController { | ||
public readonly type = hydrateTemplateController; | ||
public constructor( | ||
public def: PartialCustomElementDefinition, | ||
// in theory, Constructor of resources should be accepted too | ||
// though it would be unnecessary right now | ||
public res: string | /* Constructable | */CustomAttributeDefinition, | ||
public alias: string | undefined, | ||
/** | ||
* Bindable instructions for the template controller instance | ||
*/ | ||
public props: IInstruction[], | ||
) {} | ||
} | ||
export class HydrateLetElementInstruction { | ||
public readonly type = hydrateLetElement; | ||
public constructor( | ||
public instructions: LetBindingInstruction[], | ||
public toBindingContext: boolean, | ||
) {} | ||
} | ||
export class LetBindingInstruction { | ||
public readonly type = letBinding; | ||
public constructor( | ||
public from: string | IsBindingBehavior | Interpolation, | ||
public to: string, | ||
) {} | ||
} | ||
export class TextBindingInstruction { | ||
public readonly type = textBinding; | ||
public constructor( | ||
public from: string | IsBindingBehavior, | ||
) {} | ||
} | ||
export class ListenerBindingInstruction { | ||
public readonly type = listenerBinding; | ||
public constructor( | ||
public from: string | IsBindingBehavior, | ||
public to: string, | ||
public capture: boolean, | ||
public modifier: string | null, | ||
) {} | ||
} | ||
export class StylePropertyBindingInstruction { | ||
public readonly type = stylePropertyBinding; | ||
public constructor( | ||
public from: string | IsBindingBehavior, | ||
public to: string, | ||
) {} | ||
} | ||
export class SetAttributeInstruction { | ||
public readonly type = setAttribute; | ||
public constructor( | ||
public value: string, | ||
public to: string, | ||
) {} | ||
} | ||
export class SetClassAttributeInstruction { | ||
public readonly type: typeof InstructionType.setClassAttribute = setClassAttribute; | ||
public constructor( | ||
public readonly value: string, | ||
) {} | ||
} | ||
export class SetStyleAttributeInstruction { | ||
public readonly type: typeof InstructionType.setStyleAttribute = setStyleAttribute; | ||
public constructor( | ||
public readonly value: string, | ||
) {} | ||
} | ||
export class AttributeBindingInstruction { | ||
public readonly type = attributeBinding; | ||
public constructor( | ||
/** | ||
* `attr` and `to` have the same value on a normal attribute | ||
* Will be different on `class` and `style` | ||
* on `class`: attr = `class` (from binding command), to = attribute name | ||
* on `style`: attr = `style` (from binding command), to = attribute name | ||
*/ | ||
public attr: string, | ||
public from: string | IsBindingBehavior, | ||
public to: string, | ||
) {} | ||
} | ||
export class SpreadBindingInstruction { | ||
public readonly type = spreadBinding; | ||
} | ||
export class SpreadElementPropBindingInstruction { | ||
public readonly type = spreadElementProp; | ||
public constructor( | ||
public readonly instructions: IInstruction, | ||
) {} | ||
} | ||
export const ITemplateCompiler = /*@__PURE__*/createInterface<ITemplateCompiler>('ITemplateCompiler'); | ||
export interface ITemplateCompiler { | ||
/** | ||
* Indicates whether this compiler should compile template in debug mode | ||
* | ||
* For the default compiler, this means all expressions are kept as is on the template | ||
*/ | ||
debug: boolean; | ||
/** | ||
* Experimental API, for optimization. | ||
* | ||
* `true` to create CustomElement/CustomAttribute instructions | ||
* with resolved resources constructor during compilation, instead of name | ||
*/ | ||
resolveResources: boolean; | ||
compile( | ||
partialDefinition: CustomElementDefinition, | ||
context: IContainer, | ||
compilationInstruction: ICompliationInstruction | null, | ||
): CustomElementDefinition; | ||
/** | ||
* Compile a list of captured attributes as if they are declared in a template | ||
* | ||
* @param requestor - the context definition where the attributes is compiled | ||
* @param attrSyntaxes - the attributes captured | ||
* @param container - the container containing information for the compilation | ||
* @param host - the host element where the attributes are spreaded on | ||
*/ | ||
compileSpread( | ||
requestor: CustomElementDefinition, | ||
attrSyntaxes: AttrSyntax[], | ||
container: IContainer, | ||
target: Element, | ||
/** | ||
* An associated custom element definition for the target host element | ||
* Sometimes spread compilation may occur without the container having all necessary information | ||
* about the targeted element that is receiving the spread | ||
* | ||
* Caller of this method may want to provide this information dynamically instead | ||
*/ | ||
targetDef?: CustomElementDefinition, | ||
): IInstruction[]; | ||
} | ||
export interface ICompliationInstruction { | ||
/** | ||
* A record of projections available for compiling a template. | ||
* Where each key is the matching slot name for <au-slot/> inside, | ||
* and each value is the definition to render and project | ||
*/ | ||
projections: IAuSlotProjections | null; | ||
} | ||
export interface IRenderer<TType extends string = string> { | ||
target: TType; | ||
/** | ||
* An interface describing an instruction renderer | ||
* its target property will be used to match instruction types dynamically at render time | ||
*/ | ||
export interface IRenderer { | ||
target: string; | ||
render( | ||
@@ -395,3 +67,3 @@ /** | ||
export function renderer<TType extends string, T extends IRenderer<TType>, C extends Constructable<T>>(target: C, context: ClassDecoratorContext): C { | ||
export function renderer<T extends IRenderer, C extends Constructable<T>>(target: C, context: ClassDecoratorContext): C { | ||
return Registrable.define(target, function (this: typeof target, container: IContainer): void { | ||
@@ -443,4 +115,4 @@ singletonRegistration(IRenderer, this).register(container); | ||
export const SetPropertyRenderer = /*@__PURE__*/ renderer(class SetPropertyRenderer implements IRenderer<'re'> { | ||
public readonly target = setProperty; | ||
export const SetPropertyRenderer = /*@__PURE__*/ renderer(class SetPropertyRenderer implements IRenderer { | ||
public readonly target = InstructionType.setProperty; | ||
@@ -464,3 +136,3 @@ public render( | ||
public readonly target = hydrateElement; | ||
public readonly target = InstructionType.hydrateElement; | ||
@@ -470,3 +142,3 @@ public render( | ||
target: HTMLElement, | ||
instruction: HydrateElementInstruction, | ||
instruction: HydrateElementInstruction<Record<PropertyKey, unknown>, CustomElementDefinition>, | ||
platform: IPlatform, | ||
@@ -541,3 +213,3 @@ exprParser: IExpressionParser, | ||
public readonly target = hydrateAttribute; | ||
public readonly target = InstructionType.hydrateAttribute; | ||
@@ -550,3 +222,4 @@ public render( | ||
target: HTMLElement, | ||
instruction: HydrateAttributeInstruction, | ||
// <CustomAttributeDefinition> as we assume it's always used with the default resources resolver | ||
instruction: HydrateAttributeInstruction<CustomAttributeDefinition>, | ||
platform: IPlatform, | ||
@@ -613,3 +286,3 @@ exprParser: IExpressionParser, | ||
public readonly target = hydrateTemplateController; | ||
public readonly target = InstructionType.hydrateTemplateController; | ||
@@ -619,3 +292,4 @@ public render( | ||
target: HTMLElement, | ||
instruction: HydrateTemplateController, | ||
// <CustomAttributeDefinition> as we assume it's always used with the default resources resolver | ||
instruction: HydrateTemplateController<CustomAttributeDefinition>, | ||
platform: IPlatform, | ||
@@ -693,3 +367,6 @@ exprParser: IExpressionParser, | ||
export const LetElementRenderer = /*@__PURE__*/ renderer(class LetElementRenderer implements IRenderer { | ||
public readonly target = hydrateLetElement; | ||
public readonly target = InstructionType.hydrateLetElement; | ||
public constructor() { | ||
LetBinding.mix(); | ||
} | ||
public render( | ||
@@ -728,3 +405,3 @@ renderingCtrl: IHydratableController, | ||
export const RefBindingRenderer = /*@__PURE__*/ renderer(class RefBindingRenderer implements IRenderer { | ||
public readonly target = refBinding; | ||
public readonly target = InstructionType.refBinding; | ||
public render( | ||
@@ -746,3 +423,6 @@ renderingCtrl: IHydratableController, | ||
export const InterpolationBindingRenderer = /*@__PURE__*/ renderer(class InterpolationBindingRenderer implements IRenderer { | ||
public readonly target = interpolation; | ||
public readonly target = InstructionType.interpolation; | ||
public constructor() { | ||
InterpolationPartBinding.mix(); | ||
} | ||
public render( | ||
@@ -770,3 +450,6 @@ renderingCtrl: IHydratableController, | ||
export const PropertyBindingRenderer = /*@__PURE__*/ renderer(class PropertyBindingRenderer implements IRenderer { | ||
public readonly target = propertyBinding; | ||
public readonly target = InstructionType.propertyBinding; | ||
public constructor() { | ||
PropertyBinding.mix(); | ||
} | ||
public render( | ||
@@ -794,3 +477,6 @@ renderingCtrl: IHydratableController, | ||
export const IteratorBindingRenderer = /*@__PURE__*/ renderer(class IteratorBindingRenderer implements IRenderer { | ||
public readonly target = iteratorBinding; | ||
public readonly target = InstructionType.iteratorBinding; | ||
public constructor() { | ||
PropertyBinding.mix(); | ||
} | ||
public render( | ||
@@ -818,3 +504,6 @@ renderingCtrl: IHydratableController, | ||
export const TextBindingRenderer = /*@__PURE__*/ renderer(class TextBindingRenderer implements IRenderer { | ||
public readonly target = textBinding; | ||
public readonly target = InstructionType.textBinding; | ||
public constructor() { | ||
ContentBinding.mix(); | ||
} | ||
public render( | ||
@@ -854,3 +543,3 @@ renderingCtrl: IHydratableController, | ||
export const ListenerBindingRenderer = /*@__PURE__*/ renderer(class ListenerBindingRenderer implements IRenderer { | ||
public readonly target = listenerBinding; | ||
public readonly target = InstructionType.listenerBinding; | ||
@@ -862,2 +551,6 @@ /** @internal */ | ||
public constructor() { | ||
ListenerBinding.mix(); | ||
} | ||
public render( | ||
@@ -882,3 +575,3 @@ renderingCtrl: IHydratableController, | ||
export const SetAttributeRenderer = /*@__PURE__*/ renderer(class SetAttributeRenderer implements IRenderer { | ||
public readonly target = setAttribute; | ||
public readonly target = InstructionType.setAttribute; | ||
public render( | ||
@@ -894,3 +587,3 @@ _: IHydratableController, | ||
export const SetClassAttributeRenderer = /*@__PURE__*/ renderer(class SetClassAttributeRenderer implements IRenderer { | ||
public readonly target = setClassAttribute; | ||
public readonly target = InstructionType.setClassAttribute; | ||
public render( | ||
@@ -906,3 +599,3 @@ _: IHydratableController, | ||
export const SetStyleAttributeRenderer = /*@__PURE__*/ renderer(class SetStyleAttributeRenderer implements IRenderer { | ||
public readonly target = setStyleAttribute; | ||
public readonly target = InstructionType.setStyleAttribute; | ||
public render( | ||
@@ -943,3 +636,6 @@ _: IHydratableController, | ||
export const StylePropertyBindingRenderer = /*@__PURE__*/ renderer(class StylePropertyBindingRenderer implements IRenderer { | ||
public readonly target = stylePropertyBinding; | ||
public readonly target = InstructionType.stylePropertyBinding; | ||
public constructor() { | ||
PropertyBinding.mix(); | ||
} | ||
public render( | ||
@@ -994,3 +690,6 @@ renderingCtrl: IHydratableController, | ||
export const AttributeBindingRenderer = /*@__PURE__*/ renderer(class AttributeBindingRenderer implements IRenderer { | ||
public readonly target = attributeBinding; | ||
public readonly target = InstructionType.attributeBinding; | ||
public constructor() { | ||
AttributeBinding.mix(); | ||
} | ||
public render( | ||
@@ -1029,3 +728,3 @@ renderingCtrl: IHydratableController, | ||
public readonly target = spreadBinding; | ||
public readonly target = InstructionType.spreadBinding; | ||
@@ -1032,0 +731,0 @@ public render( |
@@ -107,3 +107,3 @@ import { firstDefined, getResourceKeyFor, mergeArrays, resource, resourceBaseName, ResourceType } from '@aurelia/kernel'; | ||
export const BindingBehavior = objectFreeze<BindingBehaviorKind>({ | ||
export const BindingBehavior = /*@__PURE__*/ objectFreeze<BindingBehaviorKind>({ | ||
name: bbBaseName, | ||
@@ -110,0 +110,0 @@ keyFrom: getBindingBehaviorKeyFrom, |
@@ -14,3 +14,3 @@ import { type Scope } from '../../binding/scope'; | ||
public bind(_scope: Scope, binding: ListenerBinding): void { | ||
if (!(binding instanceof ListenerBinding)) { | ||
if (!('handleEvent' in binding)) { | ||
throw createMappedError(ErrorNames.self_behavior_invalid_usage); | ||
@@ -17,0 +17,0 @@ } |
@@ -8,3 +8,3 @@ import { mergeArrays, firstDefined, Key, resourceBaseName, getResourceKeyFor } from '@aurelia/kernel'; | ||
import { aliasRegistration, singletonRegistration } from '../utilities-di'; | ||
import { type BindingMode, toView } from '../binding/interfaces-bindings'; | ||
import { defaultMode, toView, BindingMode } from '../binding/interfaces-bindings'; | ||
@@ -24,5 +24,6 @@ import type { | ||
import { dtAttribute, getDefinitionFromStaticAu, type IResourceKind } from './resources-shared'; | ||
import { IAttributeComponentDefinition } from '@aurelia/template-compiler'; | ||
export type PartialCustomAttributeDefinition<TBindables extends string = string> = PartialResourceDefinition<{ | ||
readonly defaultBindingMode?: BindingMode; | ||
export type PartialCustomAttributeDefinition<TBindables extends string = string> = PartialResourceDefinition<Omit<IAttributeComponentDefinition, 'type'> & { | ||
readonly defaultBindingMode?: string | number; | ||
readonly isTemplateController?: boolean; | ||
@@ -102,6 +103,6 @@ readonly bindables?: (Record<TBindables, true | Omit<PartialBindableDefinition, 'name'>>) | (TBindables | PartialBindableDefinition & { name: TBindables })[]; | ||
*/ | ||
export function templateController(definition: Omit<PartialCustomAttributeDefinition, 'isTemplateController'>): CustomAttributeDecorator; | ||
export function templateController(definition: Omit<PartialCustomAttributeDefinition, 'isTemplateController' | 'type'>): CustomAttributeDecorator; | ||
export function templateController(name: string): CustomAttributeDecorator; | ||
export function templateController(nameOrDef: string | Omit<PartialCustomAttributeDefinition, 'isTemplateController'>): CustomAttributeDecorator; | ||
export function templateController(nameOrDef: string | Omit<PartialCustomAttributeDefinition, 'isTemplateController'>): CustomAttributeDecorator { | ||
export function templateController(nameOrDef: string | Omit<PartialCustomAttributeDefinition, 'isTemplateController' | 'type'>): CustomAttributeDecorator; | ||
export function templateController(nameOrDef: string | Omit<PartialCustomAttributeDefinition, 'isTemplateController' | 'type'>): CustomAttributeDecorator { | ||
return function (target, context) { | ||
@@ -122,3 +123,3 @@ context.addInitializer(function (this) { | ||
// a simple marker to distinguish between Custom Element definition & Custom attribute definition | ||
public get kind(): 'attribute' { return dtAttribute; } | ||
public get type(): 'custom-attribute' { return dtAttribute; } | ||
@@ -153,2 +154,4 @@ private constructor( | ||
const mode = firstDefined(getAttributeAnnotation(Type, 'defaultBindingMode'), def.defaultBindingMode, Type.defaultBindingMode, toView) as string | BindingMode; | ||
return new CustomAttributeDefinition( | ||
@@ -159,3 +162,3 @@ Type, | ||
getAttributeKeyFrom(name), | ||
firstDefined(getAttributeAnnotation(Type, 'defaultBindingMode'), def.defaultBindingMode, Type.defaultBindingMode, toView), | ||
isString(mode) ? BindingMode[mode as keyof typeof BindingMode] ?? defaultMode : mode, | ||
firstDefined(getAttributeAnnotation(Type, 'isTemplateController'), def.isTemplateController, Type.isTemplateController, false), | ||
@@ -260,3 +263,3 @@ Bindable.from(...Bindable.getAll(Type), getAttributeAnnotation(Type, 'bindables'), Type.bindables, def.bindables), | ||
export const CustomAttribute = objectFreeze<CustomAttributeKind>({ | ||
export const CustomAttribute = /*@__PURE__*/ objectFreeze<CustomAttributeKind>({ | ||
name: attributeBaseName, | ||
@@ -263,0 +266,0 @@ keyFrom: getAttributeKeyFrom, |
import { INode } from '../../dom'; | ||
import { IPlatform } from '../../platform'; | ||
import { attrTypeName, type CustomAttributeStaticAuDefinition } from '../custom-attribute'; | ||
import { IInstruction } from '../../renderer'; | ||
@@ -9,3 +8,3 @@ import type { ITask } from '@aurelia/platform'; | ||
import type { ICustomAttributeViewModel } from '../../templating/controller'; | ||
import type { HydrateAttributeInstruction } from '../../renderer'; | ||
import { IInstruction, HydrateAttributeInstruction } from '@aurelia/template-compiler'; | ||
import { resolve } from '@aurelia/kernel'; | ||
@@ -12,0 +11,0 @@ |
@@ -30,7 +30,6 @@ import { | ||
} from '@aurelia/kernel'; | ||
import type { BindableDefinition, PartialBindableDefinition } from '../bindable'; | ||
import type { BindableDefinition } from '../bindable'; | ||
import type { INode } from '../dom'; | ||
import type { Controller, ICustomElementViewModel, ICustomElementController } from '../templating/controller'; | ||
import type { IPlatform } from '../platform'; | ||
import type { IInstruction } from '../renderer'; | ||
import { ProcessContentHook, type IElementComponentDefinition, IInstruction } from '@aurelia/template-compiler'; | ||
import type { IWatchDefinition } from '../watch'; | ||
@@ -40,8 +39,4 @@ import { ErrorNames, createMappedError } from '../errors'; | ||
export type PartialCustomElementDefinition<TBindables extends string = string> = PartialResourceDefinition<{ | ||
readonly cache?: '*' | number; | ||
readonly capture?: boolean | ((attr: string) => boolean); | ||
readonly template?: null | string | Node; | ||
readonly instructions?: readonly (readonly IInstruction[])[]; | ||
readonly dependencies?: readonly Key[]; | ||
export type PartialCustomElementDefinition<TBindables extends string = string> = PartialResourceDefinition<Omit<IElementComponentDefinition<TBindables>, 'type'> & { | ||
readonly cache?: number | '*'; | ||
/** | ||
@@ -51,11 +46,4 @@ * An semi internal property used to signal the rendering process not to try to compile the template again | ||
readonly injectable?: InterfaceSymbol | null; | ||
readonly needsCompile?: boolean; | ||
readonly surrogates?: readonly IInstruction[]; | ||
readonly bindables?: Record<TBindables, true | Omit<PartialBindableDefinition, 'name'>> | (TBindables | PartialBindableDefinition & { name: TBindables })[]; | ||
readonly containerless?: boolean; | ||
readonly shadowOptions?: { mode: 'open' | 'closed' } | null; | ||
readonly hasSlots?: boolean; | ||
readonly enhance?: boolean; | ||
readonly watches?: IWatchDefinition[]; | ||
readonly processContent?: ProcessContentHook | null; | ||
}>; | ||
@@ -152,3 +140,3 @@ | ||
type ShadowOptions = Pick<PartialCustomElementDefinition, 'shadowOptions'>['shadowOptions']; | ||
type ShadowOptions = PartialCustomElementDefinition['shadowOptions']; | ||
@@ -158,3 +146,3 @@ /** | ||
*/ | ||
export function useShadowDOM(options?: ShadowOptions): (target: Constructable) => void; | ||
export function useShadowDOM(options?: ShadowOptions): (target: Constructable, context: ClassDecoratorContext) => void; | ||
/** | ||
@@ -221,3 +209,3 @@ * Decorator: Indicates that the custom element should render its view in ShadowDOM. | ||
export class CustomElementDefinition<C extends Constructable = Constructable> implements ResourceDefinition<C, ICustomElementViewModel, PartialCustomElementDefinition> { | ||
public get kind(): 'element' { return dtElement; } | ||
public get type(): 'custom-element' { return dtElement; } | ||
private constructor( | ||
@@ -231,4 +219,4 @@ public readonly Type: CustomElementType<C>, | ||
public readonly template: null | string | Node, | ||
public readonly instructions: readonly (readonly IInstruction[])[], | ||
public readonly dependencies: readonly Key[], | ||
public readonly instructions: readonly IInstruction[][], | ||
public readonly dependencies: Key[], | ||
public readonly injectable: InterfaceSymbol<C> | null, | ||
@@ -441,4 +429,4 @@ public readonly needsCompile: boolean, | ||
export const defineElement = <C extends Constructable>(nameOrDef: string | PartialCustomElementDefinition, Type: C | null): CustomElementType<C> => { | ||
const definition = CustomElementDefinition.create(nameOrDef, Type as Constructable); | ||
const $Type = definition.Type as CustomElementType<C>; | ||
const definition = CustomElementDefinition.create(nameOrDef, Type as CustomElementType<C>); | ||
const $Type = definition.Type; | ||
@@ -597,3 +585,3 @@ // this is the case, where the APi is invoked directly without a decorator | ||
export const CustomElement = objectFreeze<CustomElementKind>({ | ||
export const CustomElement = /*@__PURE__*/ objectFreeze<CustomElementKind>({ | ||
name: elementBaseName, | ||
@@ -620,3 +608,2 @@ keyFrom: getElementKeyFrom, | ||
type DecoratorFactoryMethod = (target: Function, context: ClassMethodDecoratorContext) => void; | ||
export type ProcessContentHook = (node: HTMLElement, platform: IPlatform, data: Record<PropertyKey, unknown>) => boolean | void; | ||
@@ -623,0 +610,0 @@ const pcHookMetadataProperty = /*@__PURE__*/getAnnotationKeyFor('processContent'); |
@@ -6,3 +6,2 @@ import { Constructable, IContainer, InstanceProvider, MaybePromise, emptyArray, onResolve, resolve, transient } from '@aurelia/kernel'; | ||
import { IPlatform } from '../../platform'; | ||
import { HydrateElementInstruction, IInstruction, ITemplateCompiler } from '../../renderer'; | ||
import { Controller, HydrationContext, IController, ICustomElementController, IHydratedController, IHydrationContext, ISyntheticView, vmkCe } from '../../templating/controller'; | ||
@@ -16,3 +15,3 @@ import { IRendering } from '../../templating/rendering'; | ||
import { SpreadBinding } from '../../binding/spread-binding'; | ||
import { AttrSyntax } from '../attribute-pattern'; | ||
import { HydrateElementInstruction, IInstruction, ITemplateCompiler, AttrSyntax } from '@aurelia/template-compiler'; | ||
import { IExpressionParser } from '@aurelia/expression-parser'; | ||
@@ -19,0 +18,0 @@ |
import { Scope } from '../../binding/scope'; | ||
import { IRenderLocation } from '../../dom'; | ||
import { CustomElementDefinition, CustomElementStaticAuDefinition, elementTypeName } from '../custom-element'; | ||
import { IInstruction } from '../../renderer'; | ||
import { IHydrationContext } from '../../templating/controller'; | ||
@@ -10,6 +9,6 @@ import { IRendering } from '../../templating/rendering'; | ||
import { IInstruction, type HydrateElementInstruction } from '@aurelia/template-compiler'; | ||
import { IContainer, InstanceProvider, Writable, emptyArray, onResolve, resolve } from '@aurelia/kernel'; | ||
import type { ControllerVisitor, ICustomElementController, ICustomElementViewModel, IHydratedController, IHydratedParentController, ISyntheticView } from '../../templating/controller'; | ||
import type { IViewFactory } from '../../templating/view'; | ||
import type { HydrateElementInstruction } from '../../renderer'; | ||
import { type IAuSlot, type IAuSlotSubscriber, IAuSlotWatcher, defaultSlotName, auslotAttr } from '../../templating/controller.projection'; | ||
@@ -16,0 +15,0 @@ |
import { Constructable, PartialResourceDefinition, ResourceDefinition, StaticResourceType } from '@aurelia/kernel'; | ||
import { defineMetadata, getMetadata } from '../utilities-metadata'; | ||
/** @internal */ export const dtElement = 'element'; | ||
/** @internal */ export const dtAttribute = 'attribute'; | ||
/** @internal */ export const dtElement = 'custom-element'; | ||
/** @internal */ export const dtAttribute = 'custom-attribute'; | ||
/** @internal */export const staticResourceDefinitionMetadataKey = '__au_static_resource__'; | ||
export interface IResourceKind { | ||
@@ -19,8 +17,9 @@ readonly name: string; | ||
createDef: (au: PartialResourceDefinition<Def>, Type: C) => Def, | ||
metadataKey = '__au_static_resource__' | ||
): Def => { | ||
let def = getMetadata(staticResourceDefinitionMetadataKey, Type) as Def; | ||
let def = getMetadata(metadataKey, Type) as Def; | ||
if (def == null) { | ||
if ((Type as StaticResourceType<Def>).$au?.type === typeName) { | ||
def = createDef((Type as StaticResourceType<Def>).$au!, Type as C); | ||
defineMetadata(def, Type, staticResourceDefinitionMetadataKey); | ||
defineMetadata(def, Type, metadataKey); | ||
} | ||
@@ -27,0 +26,0 @@ } |
@@ -7,3 +7,3 @@ /* eslint-disable @typescript-eslint/strict-boolean-expressions */ | ||
import type { ISyntheticView, ICustomAttributeController, ICustomAttributeViewModel, IHydratedController, IHydratedParentController, ControllerVisitor, IHydratableController } from '../../templating/controller'; | ||
import type { IInstruction } from '../../renderer'; | ||
import type { IInstruction } from '@aurelia/template-compiler'; | ||
import type { INode } from '../../dom'; | ||
@@ -21,3 +21,3 @@ import { ErrorNames, createMappedError } from '../../errors'; | ||
cache: { | ||
set: v => v === '' || !!v && v !== 'false', | ||
set: (v: unknown) => v === '' || !!v && v !== 'false', | ||
} | ||
@@ -24,0 +24,0 @@ } |
@@ -6,3 +6,2 @@ import { Task, TaskAbortError } from '@aurelia/platform'; | ||
import { IPlatform } from '../../platform'; | ||
import { IInstruction } from '../../renderer'; | ||
import { fromView, toView } from '../../binding/interfaces-bindings'; | ||
@@ -19,3 +18,3 @@ import { | ||
import { IViewFactory } from '../../templating/view'; | ||
import { AttrSyntax, AttributePattern } from '../attribute-pattern'; | ||
import { IInstruction, AttrSyntax, AttributePattern } from '@aurelia/template-compiler'; | ||
import { CustomAttributeStaticAuDefinition, attrTypeName } from '../custom-attribute'; | ||
@@ -22,0 +21,0 @@ import { isPromise, safeString, tsRunning } from '../../utilities'; |
@@ -31,3 +31,3 @@ import { type IDisposable, onResolve, IIndexable } from '@aurelia/kernel'; | ||
import { areEqual, isArray, isPromise, baseObjectPrototype, rethrow, etIsProperty } from '../../utilities'; | ||
import { HydrateTemplateController, IInstruction, IteratorBindingInstruction } from '../../renderer'; | ||
import { HydrateTemplateController, IInstruction, IteratorBindingInstruction } from '@aurelia/template-compiler'; | ||
@@ -34,0 +34,0 @@ import type { PropertyBinding } from '../../binding/property-binding'; |
@@ -21,3 +21,3 @@ import { | ||
import type { INode } from '../../dom'; | ||
import type { IInstruction } from '../../renderer'; | ||
import type { IInstruction } from '@aurelia/template-compiler'; | ||
import { createMappedError, ErrorNames } from '../../errors'; | ||
@@ -24,0 +24,0 @@ import { PartialBindableDefinition } from '../../bindable'; |
@@ -7,3 +7,3 @@ import { IContainer, resolve } from '@aurelia/kernel'; | ||
import { IPlatform } from '../platform'; | ||
import { ICompliationInstruction, IInstruction, IRenderer, ITemplateCompiler } from '../renderer'; | ||
import { IRenderer } from '../renderer'; | ||
import { CustomElementDefinition, PartialCustomElementDefinition } from '../resources/custom-element'; | ||
@@ -15,7 +15,26 @@ import { createLookup, isString } from '../utilities'; | ||
import { ErrorNames, createMappedError } from '../errors'; | ||
import { IInstruction, ITemplateCompiler } from '@aurelia/template-compiler'; | ||
export const IRendering = /*@__PURE__*/createInterface<IRendering>('IRendering', x => x.singleton(Rendering)); | ||
export interface IRendering extends Rendering { } | ||
export interface IRendering { | ||
get renderers(): Record<string, IRenderer>; | ||
export class Rendering { | ||
compile( | ||
definition: CustomElementDefinition, | ||
container: IContainer, | ||
): CustomElementDefinition; | ||
getViewFactory(definition: PartialCustomElementDefinition, container: IContainer): IViewFactory; | ||
createNodes(definition: CustomElementDefinition): INodeSequence; | ||
render( | ||
controller: IHydratableController, | ||
targets: ArrayLike<INode>, | ||
definition: CustomElementDefinition, | ||
host: INode | null | undefined, | ||
): void; | ||
} | ||
export class Rendering implements IRendering { | ||
/** @internal */ | ||
@@ -40,3 +59,9 @@ private readonly _ctn: IContainer; | ||
return this._renderers ??= this._ctn.getAll(IRenderer, false).reduce((all, r) => { | ||
all[r.target] = r; | ||
if (__DEV__) { | ||
if (all[r.target] !== void 0) { | ||
// eslint-disable-next-line no-console | ||
console.warn(`[DEV:aurelia] Renderer for target ${r.target} already exists.`); | ||
} | ||
} | ||
all[r.target] ??= r; | ||
return all; | ||
@@ -55,17 +80,14 @@ }, createLookup<IRenderer>()); | ||
public compile( | ||
definition: PartialCustomElementDefinition, | ||
definition: CustomElementDefinition, | ||
container: IContainer, | ||
compilationInstruction: ICompliationInstruction | null, | ||
): CustomElementDefinition { | ||
const compiler = container.get(ITemplateCompiler); | ||
const compiledMap = this._compilationCache; | ||
let compiled = compiledMap.get(definition); | ||
if (definition.needsCompile !== false) { | ||
const compiledMap = this._compilationCache; | ||
const compiler = container.get(ITemplateCompiler); | ||
let compiled = compiledMap.get(definition); | ||
if (compiled == null) { | ||
// const fullDefinition = CustomElementDefinition.getOrCreate(definition); | ||
compiledMap.set(definition, compiled = compiler.compile( | ||
CustomElementDefinition.getOrCreate(definition), | ||
compiledMap.set(definition, compiled = CustomElementDefinition.create(compiler.compile( | ||
definition, | ||
container, | ||
compilationInstruction | ||
)); | ||
))); | ||
} else { | ||
@@ -80,3 +102,3 @@ // todo: | ||
return definition as CustomElementDefinition; | ||
return definition; | ||
} | ||
@@ -102,3 +124,3 @@ | ||
let tpl: HTMLTemplateElement; | ||
if (template === null) { | ||
if (template == null) { | ||
fragment = null; | ||
@@ -105,0 +127,0 @@ } else if (template instanceof p.Node) { |
@@ -7,7 +7,20 @@ import { CustomElementDefinition } from '../resources/custom-element'; | ||
import type { IContainer } from '@aurelia/kernel'; | ||
import type { PartialCustomElementDefinition } from '../resources/custom-element'; | ||
import type { ICustomAttributeController, ICustomElementController, ISyntheticView } from './controller'; | ||
export interface IViewFactory extends ViewFactory {} | ||
export interface IViewFactory { | ||
name: string; | ||
readonly container: IContainer; | ||
def: CustomElementDefinition; | ||
isCaching: boolean; | ||
setCacheSize(size: number | '*', doNotOverrideIfAlreadySet: boolean): void; | ||
canReturnToCache(_controller: ISyntheticView): boolean; | ||
tryReturnToCache(controller: ISyntheticView): boolean; | ||
create(parentController?: ISyntheticView | ICustomElementController | ICustomAttributeController | undefined): ISyntheticView; | ||
} | ||
export const IViewFactory = /*@__PURE__*/createInterface<IViewFactory>('IViewFactory'); | ||
export class ViewFactory implements IViewFactory { | ||
@@ -18,3 +31,3 @@ public static maxCacheSize: number = 0xFFFF; | ||
public readonly container: IContainer; | ||
public def: PartialCustomElementDefinition; | ||
public def: CustomElementDefinition; | ||
public isCaching: boolean = false; | ||
@@ -21,0 +34,0 @@ |
@@ -11,2 +11,3 @@ import { | ||
import { IResourceKind } from './resources/resources-shared'; | ||
import { IDisposableResolver } from '@aurelia/kernel/dist/types/di'; | ||
@@ -32,3 +33,3 @@ /** @internal */ | ||
/** @internal */ | ||
export const registerResolver = (ctn: IContainer, key: Key, resolver: IResolver): IResolver => | ||
export const registerResolver = <T extends IResolver | IDisposableResolver>(ctn: IContainer, key: Key, resolver: T): T => | ||
ctn.registerResolver(key, resolver); | ||
@@ -35,0 +36,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4227790
7
230
76534
+ Added@aurelia/expression-parser@2.0.1-dev.202404281254(transitive)
+ Added@aurelia/kernel@2.0.1-dev.202404281254(transitive)
+ Added@aurelia/metadata@2.0.1-dev.202404281254(transitive)
+ Added@aurelia/platform@2.0.1-dev.202404281254(transitive)
+ Added@aurelia/platform-browser@2.0.1-dev.202404281254(transitive)
+ Added@aurelia/runtime@2.0.1-dev.202404281254(transitive)
+ Added@aurelia/template-compiler@2.0.1-dev.202404281254(transitive)
- Removed@aurelia/expression-parser@2.0.1-dev.202404171154(transitive)
- Removed@aurelia/kernel@2.0.1-dev.202404171154(transitive)
- Removed@aurelia/metadata@2.0.1-dev.202404171154(transitive)
- Removed@aurelia/platform@2.0.1-dev.202404171154(transitive)
- Removed@aurelia/platform-browser@2.0.1-dev.202404171154(transitive)
- Removed@aurelia/runtime@2.0.1-dev.202404171154(transitive)