@aurelia/runtime-html
Advanced tools
Comparing version 2.0.0-beta.10 to 2.0.0-beta.11
import { State } from '../templating/controller'; | ||
/** | ||
* 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 | ||
*/ | ||
@@ -5,0 +10,0 @@ export declare const BindingMode: Readonly<{ |
@@ -1,2 +0,2 @@ | ||
import type { IServiceLocator } from '@aurelia/kernel'; | ||
import { type IServiceLocator, IContainer } from '@aurelia/kernel'; | ||
import { IAstEvaluator, IBinding, IConnectableBinding, Scope, type IsBindingBehavior } from '@aurelia/runtime'; | ||
@@ -22,3 +22,3 @@ export declare class ListenerBindingOptions { | ||
self: boolean; | ||
constructor(locator: IServiceLocator, ast: IsBindingBehavior, target: Node, targetEvent: string, options: ListenerBindingOptions); | ||
constructor(locator: IServiceLocator, ast: IsBindingBehavior, target: Node, targetEvent: string, options: ListenerBindingOptions, modifiedEventHandler: IModifiedEventHandler | null); | ||
callSource(event: Event): unknown; | ||
@@ -29,2 +29,24 @@ handleEvent(event: Event): void; | ||
} | ||
export type IModifiedEventHandler = (event: Event) => boolean; | ||
export interface IModifiedEventHandlerCreator { | ||
readonly type: string | string[]; | ||
getHandler(modifier: string): IModifiedEventHandler; | ||
} | ||
export declare const IModifiedEventHandlerCreator: import("@aurelia/kernel").InterfaceSymbol<IModifiedEventHandlerCreator>; | ||
export interface IKeyMapping { | ||
readonly meta: string[]; | ||
readonly keys: Record</* modifier */ string, /* key */ string>; | ||
} | ||
export declare const IKeyMapping: import("@aurelia/kernel").InterfaceSymbol<IKeyMapping>; | ||
export interface IEventModifier { | ||
getHandler(type: string, modifier: string | null): IModifiedEventHandler | null; | ||
} | ||
export declare const IEventModifier: import("@aurelia/kernel").InterfaceSymbol<IEventModifier>; | ||
export declare class EventModifier implements IEventModifier { | ||
static register(c: IContainer): void; | ||
getHandler(type: string, modifier: string | null): IModifiedEventHandler | null; | ||
} | ||
export declare const EventModifierRegistration: { | ||
register(c: IContainer): void; | ||
}; | ||
//# sourceMappingURL=listener-binding.d.ts.map |
import { IContainer } from '@aurelia/kernel'; | ||
import { DirtyChecker, ICoercionConfiguration } from '@aurelia/runtime'; | ||
import { AtPrefixedTriggerAttributePattern, ColonPrefixedBindAttributePattern, SpreadAttributePattern, DotSeparatedAttributePattern, RefAttributePattern } from './resources/attribute-pattern'; | ||
import { AtPrefixedTriggerAttributePattern, ColonPrefixedBindAttributePattern, SpreadAttributePattern, DotSeparatedAttributePattern, RefAttributePattern, EventAttributePattern } from './resources/attribute-pattern'; | ||
import { ForBindingCommand, OneTimeBindingCommand, TriggerBindingCommand } from './resources/binding-command'; | ||
@@ -36,3 +36,5 @@ import { TemplateCompiler } from './compiler/template-compiler'; | ||
*/ | ||
export declare const DefaultBindingSyntax: (typeof DotSeparatedAttributePattern | typeof RefAttributePattern | typeof SpreadAttributePattern)[]; | ||
export declare const DefaultBindingSyntax: ({ | ||
register(c: IContainer): void; | ||
} | typeof DotSeparatedAttributePattern | typeof RefAttributePattern | typeof EventAttributePattern | typeof SpreadAttributePattern)[]; | ||
/** | ||
@@ -39,0 +41,0 @@ * Binding syntax for short-hand attribute name patterns: |
@@ -15,3 +15,3 @@ export { bindable, Bindable, BindableDefinition, type PartialBindableDefinition, coercer, } from './bindable'; | ||
export { IFlushQueue, FlushQueue, type IFlushable, BindingTargetSubscriber, mixinAstEvaluator, mixingBindingLimited, mixinUseScope, } from './binding/binding-utils'; | ||
export { ListenerBinding, ListenerBindingOptions, } from './binding/listener-binding'; | ||
export { ListenerBinding, ListenerBindingOptions, type IModifiedEventHandler, IEventModifier, EventModifier, EventModifierRegistration, IModifiedEventHandlerCreator, IKeyMapping, } from './binding/listener-binding'; | ||
export { AttributeBinding, } from './binding/attribute'; | ||
@@ -50,3 +50,3 @@ export { InterpolationBinding, InterpolationPartBinding, } from './binding/interpolation-binding'; | ||
export { ISanitizer, SanitizeValueConverter, } from './resources/value-converters/sanitize'; | ||
export { DefaultComponents, DefaultBindingSyntax, ShortHandBindingSyntax, DefaultBindingLanguage, DefaultResources, DefaultRenderers, StandardConfiguration, } from './configuration'; | ||
export { type ConfigurationOptionsProvider, DefaultComponents, DefaultBindingSyntax, ShortHandBindingSyntax, DefaultBindingLanguage, DefaultResources, DefaultRenderers, StandardConfiguration, } from './configuration'; | ||
export { ITemplateElementFactory } from './compiler/template-element-factory'; | ||
@@ -53,0 +53,0 @@ export { BindablesInfo, TemplateCompiler, ITemplateCompilerHooks, TemplateCompilerHooks, templateCompilerHooks, } from './compiler/template-compiler'; |
@@ -48,2 +48,3 @@ import { IServiceLocator } from '@aurelia/kernel'; | ||
export declare class NodeObserverLocator implements INodeObserverLocator { | ||
static register(container: IContainer): void; | ||
/** | ||
@@ -54,3 +55,2 @@ * Indicates whether the node observer will be allowed to use dirty checking for a property it doesn't know how to observe | ||
constructor(); | ||
static register(container: IContainer): void; | ||
handles(obj: unknown, _key: PropertyKey): boolean; | ||
@@ -57,0 +57,0 @@ useConfig(config: Record<string, Record<string, INodeObserverConfig>>): void; |
@@ -1,3 +0,2 @@ | ||
import { IPlatform } from '../platform'; | ||
import type { IContainer, IResolver } from '@aurelia/kernel'; | ||
import { type IContainer } from '@aurelia/kernel'; | ||
import type { INode } from '../dom'; | ||
@@ -11,6 +10,6 @@ export interface ISVGAnalyzer extends NoopSVGAnalyzer { | ||
export declare class SVGAnalyzer { | ||
static register(container: IContainer): IResolver<ISVGAnalyzer>; | ||
constructor(platform: IPlatform); | ||
static register(container: IContainer): void; | ||
constructor(); | ||
isStandardSvgAttribute(node: INode, attributeName: string): boolean; | ||
} | ||
//# sourceMappingURL=svg-analyzer.d.ts.map |
@@ -184,4 +184,5 @@ import { type IContainer, type Class, type IRegistry } from '@aurelia/kernel'; | ||
capture: boolean; | ||
modifier: string | null; | ||
readonly type = "hb"; | ||
constructor(from: string | IsBindingBehavior, to: string, preventDefault: boolean, capture: boolean); | ||
constructor(from: string | IsBindingBehavior, to: string, preventDefault: boolean, capture: boolean, modifier: string | null); | ||
} | ||
@@ -188,0 +189,0 @@ export declare class StylePropertyBindingInstruction { |
@@ -53,3 +53,4 @@ import type { Class, Constructable, IContainer, ResourceDefinition, ResourceType } from '@aurelia/kernel'; | ||
command: string | null; | ||
constructor(rawName: string, rawValue: string, target: string, command: string | null); | ||
parts: string[] | null; | ||
constructor(rawName: string, rawValue: string, target: string, command: string | null, parts?: string[] | null); | ||
} | ||
@@ -65,3 +66,3 @@ export interface IAttributePattern { | ||
export declare class AttributeParser implements IAttributeParser { | ||
constructor(interpreter: ISyntaxInterpreter, attrPatterns: IAttributePattern[]); | ||
constructor(); | ||
parse(name: string, value: string): AttrSyntax; | ||
@@ -94,2 +95,6 @@ } | ||
} | ||
export declare class EventAttributePattern { | ||
'PART.trigger:PART'(rawName: string, rawValue: string, parts: string[]): AttrSyntax; | ||
'PART.capture:PART'(rawName: string, rawValue: string, parts: string[]): AttrSyntax; | ||
} | ||
export declare class ColonPrefixedBindAttributePattern { | ||
@@ -100,2 +105,3 @@ ':PART'(rawName: string, rawValue: string, parts: string[]): AttrSyntax; | ||
'@PART'(rawName: string, rawValue: string, parts: string[]): AttrSyntax; | ||
'@PART:PART'(rawName: string, rawValue: string, parts: string[]): AttrSyntax; | ||
} | ||
@@ -102,0 +108,0 @@ export declare class SpreadAttributePattern { |
@@ -13,3 +13,2 @@ import { Scope, ICoercionConfiguration } from '@aurelia/runtime'; | ||
import type { PartialCustomElementDefinition } from '../resources/custom-element'; | ||
type BindingContext<C extends IViewModel> = Required<ICompileHooks> & Required<IActivationHooks<IHydratedController | null>> & C; | ||
export declare class Controller<C extends IViewModel = IViewModel> implements IController<C> { | ||
@@ -133,2 +132,17 @@ container: IContainer; | ||
} | ||
export type BindingContext<C extends IViewModel> = Required<ICompileHooks> & Required<IActivationHooks<IHydratedController | null>> & C; | ||
/** | ||
* Describes the type of the host node/location of a controller | ||
* - `none` / 1: no host | ||
* - `host` / 2: an HTML element is the host of a controller | ||
* - `shadowRoot` / 3: a shadow root is the host of a controller | ||
* - `location` / 4: a render location is the location of a controller, this is often used for template controllers | ||
*/ | ||
export declare const MountTarget: Readonly<{ | ||
none: 0; | ||
host: 1; | ||
shadowRoot: 2; | ||
location: 3; | ||
}>; | ||
export type MountTarget = typeof MountTarget[keyof typeof MountTarget]; | ||
export declare function isCustomElementController<C extends ICustomElementViewModel = ICustomElementViewModel>(value: unknown): value is ICustomElementController<C>; | ||
@@ -135,0 +149,0 @@ export declare function isCustomElementViewModel(value: unknown): value is ICustomElementViewModel; |
{ | ||
"name": "@aurelia/runtime-html", | ||
"version": "2.0.0-beta.10", | ||
"version": "2.0.0-beta.11", | ||
"main": "dist/cjs/index.cjs", | ||
@@ -56,7 +56,7 @@ "module": "dist/esm/index.mjs", | ||
"dependencies": { | ||
"@aurelia/kernel": "2.0.0-beta.10", | ||
"@aurelia/metadata": "2.0.0-beta.10", | ||
"@aurelia/platform": "2.0.0-beta.10", | ||
"@aurelia/platform-browser": "2.0.0-beta.10", | ||
"@aurelia/runtime": "2.0.0-beta.10" | ||
"@aurelia/kernel": "2.0.0-beta.11", | ||
"@aurelia/metadata": "2.0.0-beta.11", | ||
"@aurelia/platform": "2.0.0-beta.11", | ||
"@aurelia/platform-browser": "2.0.0-beta.11", | ||
"@aurelia/runtime": "2.0.0-beta.11" | ||
}, | ||
@@ -63,0 +63,0 @@ "devDependencies": { |
@@ -56,5 +56,3 @@ import { type IServiceLocator, Key, type Constructable, IDisposable } from '@aurelia/kernel'; | ||
export const mixinUseScope = <T extends { _scope?: Scope }>(target: Constructable<T>) => { | ||
defineHiddenProp(target.prototype, 'useScope', function (this: T, scope: Scope) { | ||
this._scope = scope; | ||
}); | ||
defineHiddenProp(target.prototype, 'useScope', useScope); | ||
}; | ||
@@ -76,24 +74,6 @@ | ||
def(proto, 'strictFnCall', { enumerable: true, get: function () { return strictFnCall; } }); | ||
defineHiddenProp(proto, 'get', function (this: T, key: Key) { | ||
return this.l.get(key); | ||
}); | ||
defineHiddenProp(proto, 'getSignaler', function (this: T) { | ||
return this.l.root.get(ISignaler); | ||
}); | ||
defineHiddenProp(proto, 'getConverter', function (this: T, name: string) { | ||
const key = ValueConverter.keyFrom(name); | ||
let resourceLookup = resourceLookupCache.get(this); | ||
if (resourceLookup == null) { | ||
resourceLookupCache.set(this, resourceLookup = new ResourceLookup()); | ||
} | ||
return resourceLookup[key] ??= this.l.get<ValueConverterInstance>(resource(key)); | ||
}); | ||
defineHiddenProp(proto, 'getBehavior', function (this: T, name: string) { | ||
const key = BindingBehavior.keyFrom(name); | ||
let resourceLookup = resourceLookupCache.get(this); | ||
if (resourceLookup == null) { | ||
resourceLookupCache.set(this, resourceLookup = new ResourceLookup()); | ||
} | ||
return resourceLookup[key] ??= this.l.get<BindingBehaviorInstance>(resource(key)); | ||
}); | ||
defineHiddenProp(proto, 'get', evaluatorGet<T>); | ||
defineHiddenProp(proto, 'getSignaler', evaluatorGetSignaler<T>); | ||
defineHiddenProp(proto, 'getConverter', evaluatorGetConverter<T>); | ||
defineHiddenProp(proto, 'getBehavior', evaluatorGetBehavior<T>); | ||
}; | ||
@@ -146,2 +126,29 @@ }; | ||
type IHasServiceLocator = { l: IServiceLocator }; | ||
function useScope<T extends { _scope?: Scope }>(this: T, scope: Scope) { | ||
this._scope = scope; | ||
} | ||
function evaluatorGet<T extends IHasServiceLocator>(this: T, key: Key) { | ||
return this.l.get(key); | ||
} | ||
function evaluatorGetSignaler<T extends IHasServiceLocator>(this: T) { | ||
return this.l.root.get(ISignaler); | ||
} | ||
function evaluatorGetConverter<T extends IHasServiceLocator>(this: T, name: string) { | ||
const key = ValueConverter.keyFrom(name); | ||
let resourceLookup = resourceLookupCache.get(this); | ||
if (resourceLookup == null) { | ||
resourceLookupCache.set(this, resourceLookup = new ResourceLookup()); | ||
} | ||
return resourceLookup[key] ??= this.l.get<ValueConverterInstance>(resource(key)); | ||
} | ||
function evaluatorGetBehavior<T extends IHasServiceLocator>(this: T, name: string) { | ||
const key = BindingBehavior.keyFrom(name); | ||
let resourceLookup = resourceLookupCache.get(this); | ||
if (resourceLookup == null) { | ||
resourceLookupCache.set(this, resourceLookup = new ResourceLookup()); | ||
} | ||
return resourceLookup[key] ??= this.l.get<BindingBehaviorInstance>(resource(key)); | ||
} | ||
function flushItem(item: IFlushable, _: IFlushable, items: Set<IFlushable>) { | ||
@@ -148,0 +155,0 @@ items.delete(item); |
@@ -17,2 +17,7 @@ import { State } from '../templating/controller'; | ||
* 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 | ||
*/ | ||
@@ -19,0 +24,0 @@ export const BindingMode = /*@__PURE__*/ objectFreeze({ |
@@ -1,5 +0,6 @@ | ||
import { isFunction } from '../utilities'; | ||
import { isArray, isFunction, isString, objectFreeze } from '../utilities'; | ||
import { createInterface, singletonRegistration } from '../utilities-di'; | ||
import { mixinAstEvaluator, mixinUseScope, mixingBindingLimited } from './binding-utils'; | ||
import type { IServiceLocator } from '@aurelia/kernel'; | ||
import { resolve, type IServiceLocator, all, IContainer } from '@aurelia/kernel'; | ||
import { astBind, astEvaluate, astUnbind, IAstEvaluator, IBinding, IConnectableBinding, Scope, type IsBindingBehavior } from '@aurelia/runtime'; | ||
@@ -43,2 +44,5 @@ | ||
/** @internal */ | ||
private readonly _modifiedEventHandler: IModifiedEventHandler | null = null; | ||
public constructor( | ||
@@ -50,5 +54,7 @@ locator: IServiceLocator, | ||
options: ListenerBindingOptions, | ||
modifiedEventHandler: IModifiedEventHandler | null, | ||
) { | ||
this.l = locator; | ||
this._options = options; | ||
this._modifiedEventHandler = modifiedEventHandler; | ||
} | ||
@@ -82,3 +88,5 @@ | ||
} | ||
this.callSource(event); | ||
if (this._modifiedEventHandler?.(event) !== false) { | ||
this.callSource(event); | ||
} | ||
} | ||
@@ -120,1 +128,170 @@ | ||
mixinAstEvaluator(true, true)(ListenerBinding); | ||
export type IModifiedEventHandler = (event: Event) => boolean; | ||
export interface IModifiedEventHandlerCreator { | ||
readonly type: string | string[]; | ||
getHandler(modifier: string): IModifiedEventHandler; | ||
} | ||
export const IModifiedEventHandlerCreator = /*@__PURE__*/createInterface<IModifiedEventHandlerCreator>('IEventModifier'); | ||
export interface IKeyMapping { | ||
readonly meta: string[]; | ||
readonly keys: Record</* modifier */string, /* key */ string>; | ||
} | ||
export const IKeyMapping = /*@__PURE__*/createInterface<IKeyMapping>('IKeyMapping', x => x.instance({ | ||
meta: objectFreeze(['ctrl', 'alt', 'shift', 'meta']) as string[], | ||
keys: { | ||
escape: 'Escape', | ||
enter: 'Enter', | ||
space: 'Space', | ||
tab: 'tab', | ||
// by default, maps the key a-z and A-Z to their respective keycodes | ||
...Array.from({ length: 25 }).reduce((acc: Record<string, string>, _, idx) => { | ||
// map keycode of upper case character from A-Z | ||
let char = String.fromCharCode(idx + 65); | ||
acc[idx + 65] = char; | ||
// map keycode and character code of lower case character from a-z | ||
char = String.fromCharCode(idx + 97); | ||
acc[idx + 97] = acc[char] = char; | ||
return acc; | ||
}, {}) | ||
}, | ||
})); | ||
class ModifiedMouseEventHandler implements IModifiedEventHandlerCreator { | ||
public static register(c: IContainer) { | ||
c.register(singletonRegistration(IModifiedEventHandlerCreator, ModifiedMouseEventHandler)); | ||
} | ||
public readonly type = ['click', 'mousedown', 'mousemove', 'mouseup', 'dblclick', 'contextmenu']; | ||
/** @internal */ | ||
private readonly _mapping = resolve(IKeyMapping); | ||
/** @internal */ | ||
private readonly _mouseButtons = ['left', 'middle', 'right']; | ||
public getHandler(modifier: string): IModifiedEventHandler { | ||
const modifiers = modifier.split(/[:+.]/); | ||
if (__DEV__) { | ||
// verify modifiers and add warnings if necessary | ||
} | ||
return ((event: MouseEvent) => { | ||
let prevent = false; | ||
let stop = false; | ||
let m: string; | ||
for (m of modifiers) { | ||
switch (m) { | ||
case 'prevent': prevent = true; continue; | ||
case 'stop': stop = true; continue; | ||
case 'left': | ||
case 'middle': | ||
case 'right': | ||
if (event.button !== this._mouseButtons.indexOf(m)) return false; | ||
continue; | ||
} | ||
if (this._mapping.meta.includes(m) && event[`${m}Key` as keyof MouseEvent] !== true) { | ||
return false; | ||
} | ||
if (__DEV__) { | ||
// eslint-disable-next-line no-console | ||
console.warn(`Modifier '${m}' is not supported for mouse events.`); | ||
} | ||
} | ||
if (prevent) event.preventDefault(); | ||
if (stop) event.stopPropagation(); | ||
return true; | ||
}) as IModifiedEventHandler; | ||
} | ||
} | ||
class ModifiedKeyboardEventHandler implements IModifiedEventHandlerCreator { | ||
public static register(c: IContainer) { | ||
c.register(singletonRegistration(IModifiedEventHandlerCreator, ModifiedKeyboardEventHandler)); | ||
} | ||
/** @internal */ | ||
private readonly _mapping = resolve(IKeyMapping); | ||
public readonly type = ['keydown', 'keyup']; | ||
public getHandler(modifier: string): IModifiedEventHandler { | ||
const modifiers = modifier.split(/[:+.]/); | ||
return ((event: KeyboardEvent) => { | ||
let prevent = false; | ||
let stop = false; | ||
let mod: string; | ||
for (mod of modifiers) { | ||
switch (mod) { | ||
case 'prevent': prevent = true; continue; | ||
case 'stop': stop = true; continue; | ||
} | ||
if (this._mapping.meta.includes(mod)) { | ||
if (event[`${mod}Key` as keyof KeyboardEvent] !== true) { | ||
return false; | ||
} | ||
continue; | ||
} | ||
const mappedKey = this._mapping.keys[mod]; | ||
if (mappedKey !== event.key) { | ||
return false; | ||
} | ||
if (__DEV__) { | ||
// eslint-disable-next-line no-console | ||
console.warn(`Modifier '${mod}' is not supported for keyboard event with key "${event.key}".`); | ||
} | ||
} | ||
if (prevent) event.preventDefault(); | ||
if (stop) event.stopPropagation(); | ||
return true; | ||
}) as IModifiedEventHandler; | ||
} | ||
} | ||
export interface IEventModifier { | ||
getHandler(type: string, modifier: string | null): IModifiedEventHandler | null; | ||
} | ||
export const IEventModifier = /*@__PURE__*/createInterface<IEventModifier>('IEventModifierHandler', x => x.instance({ | ||
getHandler: () => { | ||
if (__DEV__) { | ||
// eslint-disable-next-line no-console | ||
console.warn('No event modifier handler registered'); | ||
} | ||
/* istanbul ignore next */ | ||
return null; | ||
} | ||
})); | ||
export class EventModifier implements IEventModifier { | ||
public static register(c: IContainer) { | ||
c.register(singletonRegistration(IEventModifier, EventModifier)); | ||
} | ||
/** @internal */ | ||
private readonly _reg = resolve(all(IModifiedEventHandlerCreator)) | ||
.reduce((acc: Record<string, IModifiedEventHandlerCreator>, cur) => { | ||
const types = isArray(cur.type) ? cur.type : [cur.type]; | ||
types.forEach(t => acc[t] = cur); | ||
return acc; | ||
}, {}); | ||
public getHandler(type: string, modifier: string | null): IModifiedEventHandler | null { | ||
return isString(modifier) ? this._reg[type]?.getHandler(modifier) ?? null : null; | ||
} | ||
} | ||
export const EventModifierRegistration = { | ||
register(c: IContainer) { | ||
c.register( | ||
EventModifier, | ||
ModifiedMouseEventHandler, | ||
ModifiedKeyboardEventHandler, | ||
); | ||
} | ||
}; |
@@ -9,2 +9,3 @@ import { IContainer, noop } from '@aurelia/kernel'; | ||
RefAttributePattern, | ||
EventAttributePattern, | ||
} from './resources/attribute-pattern'; | ||
@@ -80,2 +81,3 @@ import { | ||
import { instanceRegistration } from './utilities-di'; | ||
import { EventModifierRegistration } from './binding/listener-binding'; | ||
@@ -103,2 +105,4 @@ /** | ||
SpreadAttributePattern, | ||
EventAttributePattern, | ||
EventModifierRegistration, | ||
]; | ||
@@ -105,0 +109,0 @@ |
@@ -108,2 +108,8 @@ export { | ||
ListenerBindingOptions, | ||
type IModifiedEventHandler, | ||
IEventModifier, | ||
EventModifier, | ||
EventModifierRegistration, | ||
IModifiedEventHandlerCreator, | ||
IKeyMapping, | ||
} from './binding/listener-binding'; | ||
@@ -310,2 +316,4 @@ export { | ||
export { | ||
type ConfigurationOptionsProvider, | ||
DefaultComponents, | ||
@@ -312,0 +320,0 @@ |
@@ -109,4 +109,8 @@ import { emptyObject, IServiceLocator, resolve } from '@aurelia/kernel'; | ||
export class NodeObserverLocator implements INodeObserverLocator { | ||
/** @internal */ | ||
protected static readonly inject = [IServiceLocator, IPlatform, IDirtyChecker, ISVGAnalyzer]; | ||
public static register(container: IContainer) { | ||
container.register( | ||
singletonRegistration(this, this), | ||
aliasRegistration(this, INodeObserverLocator), | ||
); | ||
} | ||
@@ -177,7 +181,2 @@ /** | ||
public static register(container: IContainer) { | ||
aliasRegistration(INodeObserverLocator, NodeObserverLocator).register(container); | ||
singletonRegistration(INodeObserverLocator, NodeObserverLocator).register(container); | ||
} | ||
// deepscan-disable-next-line | ||
@@ -184,0 +183,0 @@ public handles(obj: unknown, _key: PropertyKey): boolean { |
import { IPlatform } from '../platform'; | ||
import { createLookup, isString, objectAssign } from '../utilities'; | ||
import { createInterface, singletonRegistration } from '../utilities-di'; | ||
import { aliasRegistration, createInterface, singletonRegistration } from '../utilities-di'; | ||
import type { IContainer, IResolver } from '@aurelia/kernel'; | ||
import { resolve, type IContainer } from '@aurelia/kernel'; | ||
import type { INode } from '../dom'; | ||
@@ -27,8 +27,7 @@ | ||
export class SVGAnalyzer { | ||
/** | ||
* @internal | ||
*/ | ||
public static inject = [IPlatform]; | ||
public static register(container: IContainer): IResolver<ISVGAnalyzer> { | ||
return singletonRegistration(ISVGAnalyzer, this).register(container); | ||
public static register(container: IContainer): void { | ||
container.register( | ||
singletonRegistration(this, this), | ||
aliasRegistration(this, ISVGAnalyzer) | ||
); | ||
} | ||
@@ -132,3 +131,4 @@ | ||
private readonly SVGElement: typeof SVGElement; | ||
public constructor(platform: IPlatform) { | ||
public constructor() { | ||
const platform = resolve(IPlatform); | ||
this.SVGElement = platform.globalThis.SVGElement; | ||
@@ -135,0 +135,0 @@ |
@@ -28,3 +28,3 @@ import { | ||
import { RefBinding } from './binding/ref-binding'; | ||
import { ListenerBinding, ListenerBindingOptions } from './binding/listener-binding'; | ||
import { IEventModifier, ListenerBinding, ListenerBindingOptions } from './binding/listener-binding'; | ||
import { CustomElement, CustomElementDefinition, findElementControllerFor } from './resources/custom-element'; | ||
@@ -262,2 +262,3 @@ import { CustomAttribute, CustomAttributeDefinition, findAttributeControllerFor } from './resources/custom-attribute'; | ||
public capture: boolean, | ||
public modifier: string | null, | ||
) {} | ||
@@ -862,2 +863,6 @@ } | ||
public target!: typeof InstructionType.listenerBinding; | ||
/** @internal */ | ||
private readonly _modifierHandler = resolve(IEventModifier); | ||
public render( | ||
@@ -876,2 +881,3 @@ renderingCtrl: IHydratableController, | ||
new ListenerBindingOptions(instruction.preventDefault, instruction.capture), | ||
this._modifierHandler.getHandler(instruction.to, instruction.modifier), | ||
)); | ||
@@ -878,0 +884,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { emptyArray, Protocol, all } from '@aurelia/kernel'; | ||
import { emptyArray, Protocol, all, resolve } from '@aurelia/kernel'; | ||
import { appendAnnotationKey, appendResourceKey, defineMetadata, getResourceKeyFor } from '../utilities-metadata'; | ||
@@ -439,2 +439,3 @@ import { createInterface, singletonRegistration } from '../utilities-di'; | ||
public command: string | null, | ||
public parts: string[] | null = null | ||
) {} | ||
@@ -456,5 +457,2 @@ } | ||
/** @internal */ | ||
protected static inject = [ISyntaxInterpreter, all(IAttributePattern)]; | ||
/** @internal */ | ||
private readonly _cache: Record<string, Interpretation> = {}; | ||
@@ -472,7 +470,5 @@ /** | ||
public constructor( | ||
interpreter: ISyntaxInterpreter, | ||
attrPatterns: IAttributePattern[], | ||
) { | ||
this._interpreter = interpreter; | ||
public constructor() { | ||
const interpreter = this._interpreter = resolve(ISyntaxInterpreter); | ||
const attrPatterns = resolve(all(IAttributePattern)); | ||
const patterns: AttributeParser['_patterns'] = this._patterns = {}; | ||
@@ -497,3 +493,3 @@ const allDefs = attrPatterns.reduce<AttributePatternDefinition[]>( | ||
if (pattern == null) { | ||
return new AttrSyntax(name, value, name, null); | ||
return new AttrSyntax(name, value, name, null, null); | ||
} else { | ||
@@ -596,2 +592,15 @@ return this._patterns[pattern][pattern](name, value, interpretation.parts); | ||
@attributePattern( | ||
{ pattern: 'PART.trigger:PART', symbols: '.:' }, | ||
{ pattern: 'PART.capture:PART', symbols: '.:' }, | ||
) | ||
export class EventAttributePattern { | ||
public 'PART.trigger:PART'(rawName: string, rawValue: string, parts: string[]): AttrSyntax { | ||
return new AttrSyntax(rawName, rawValue, parts[0], 'trigger', parts); | ||
} | ||
public 'PART.capture:PART'(rawName: string, rawValue: string, parts: string[]): AttrSyntax { | ||
return new AttrSyntax(rawName, rawValue, parts[0], 'capture', parts); | ||
} | ||
} | ||
@attributePattern({ pattern: ':PART', symbols: ':' }) | ||
@@ -604,3 +613,6 @@ export class ColonPrefixedBindAttributePattern { | ||
@attributePattern({ pattern: '@PART', symbols: '@' }) | ||
@attributePattern( | ||
{ pattern: '@PART', symbols: '@' }, | ||
{ pattern: '@PART:PART', symbols: '@:' }, | ||
) | ||
export class AtPrefixedTriggerAttributePattern { | ||
@@ -610,2 +622,7 @@ public '@PART'(rawName: string, rawValue: string, parts: string[]): AttrSyntax { | ||
} | ||
public '@PART:PART'(rawName: string, rawValue: string, parts: string[]): AttrSyntax { | ||
parts.splice(1, 0, 'trigger'); | ||
return new AttrSyntax(rawName, rawValue, parts[0], 'trigger', parts); | ||
} | ||
} | ||
@@ -612,0 +629,0 @@ |
@@ -329,3 +329,9 @@ import { camelCase, mergeArrays, firstDefined, emptyArray } from '@aurelia/kernel'; | ||
public build(info: ICommandBuildInfo, exprParser: IExpressionParser): IInstruction { | ||
return new ListenerBindingInstruction(exprParser.parse(info.attr.rawValue, etIsFunction), info.attr.target, true, false); | ||
return new ListenerBindingInstruction( | ||
exprParser.parse(info.attr.rawValue, etIsFunction), | ||
info.attr.target, | ||
true, | ||
false, | ||
info.attr.parts?.[2] ?? null | ||
); | ||
} | ||
@@ -339,3 +345,9 @@ } | ||
public build(info: ICommandBuildInfo, exprParser: IExpressionParser): IInstruction { | ||
return new ListenerBindingInstruction(exprParser.parse(info.attr.rawValue, etIsFunction), info.attr.target, false, true); | ||
return new ListenerBindingInstruction( | ||
exprParser.parse(info.attr.rawValue, etIsFunction), | ||
info.attr.target, | ||
false, | ||
true, | ||
info.attr.parts?.[2] ?? null | ||
); | ||
} | ||
@@ -342,0 +354,0 @@ } |
@@ -13,4 +13,2 @@ import { twoWay } from '../../binding/interfaces-bindings'; | ||
export class Focus implements ICustomAttributeViewModel { | ||
/** @internal */ protected static inject = [INode, IPlatform]; | ||
public readonly $controller!: ICustomAttributeController<this>; | ||
@@ -17,0 +15,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { IContainer, noop } from '@aurelia/kernel'; | ||
import { IContainer, noop, resolve } from '@aurelia/kernel'; | ||
import { AppTask } from '../app-task'; | ||
@@ -88,7 +88,5 @@ import { ICssModulesMapping, INode } from '../dom'; | ||
class AdoptedStyleSheetsStylesFactory { | ||
public static inject = [IPlatform]; | ||
private readonly p = resolve(IPlatform); | ||
private readonly cache = new Map<string, CSSStyleSheet>(); | ||
public constructor(private readonly p: IPlatform) {} | ||
public createStyles(localStyles: (string | CSSStyleSheet)[], sharedStyles: IShadowDOMStyles | null): IShadowDOMStyles { | ||
@@ -100,4 +98,3 @@ return new AdoptedStyleSheetsStyles(this.p, localStyles, this.cache, sharedStyles); | ||
class StyleElementStylesFactory { | ||
public static inject = [IPlatform]; | ||
public constructor(private readonly p: IPlatform) {} | ||
private readonly p = resolve(IPlatform); | ||
@@ -104,0 +101,0 @@ public createStyles(localStyles: string[], sharedStyles: IShadowDOMStyles | null): IShadowDOMStyles { |
Sorry, the diff of this file is too big to display
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
4824276
86938
+ Added@aurelia/kernel@2.0.0-beta.11(transitive)
+ Added@aurelia/metadata@2.0.0-beta.11(transitive)
+ Added@aurelia/platform@2.0.0-beta.11(transitive)
+ Added@aurelia/platform-browser@2.0.0-beta.11(transitive)
+ Added@aurelia/runtime@2.0.0-beta.11(transitive)
- Removed@aurelia/kernel@2.0.0-beta.10(transitive)
- Removed@aurelia/metadata@2.0.0-beta.10(transitive)
- Removed@aurelia/platform@2.0.0-beta.10(transitive)
- Removed@aurelia/platform-browser@2.0.0-beta.10(transitive)
- Removed@aurelia/runtime@2.0.0-beta.10(transitive)