Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aurelia/runtime-html

Package Overview
Dependencies
Maintainers
1
Versions
1024
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aurelia/runtime-html - npm Package Compare versions

Comparing version 2.1.0-dev.202405130849 to 2.1.0-dev.202405280947

2

dist/types/app-task.d.ts

@@ -1,2 +0,2 @@

import type { IContainer, IRegistry, Key, Resolved } from '@aurelia/kernel';
import { type IContainer, type IRegistry, type Key, type Resolved } from '@aurelia/kernel';
export type TaskSlot = 'creating' | 'hydrating' | 'hydrated' | 'activating' | 'activated' | 'deactivating' | 'deactivated';

@@ -3,0 +3,0 @@ export declare const IAppTask: import("@aurelia/kernel").InterfaceSymbol<IAppTask>;

@@ -1,3 +0,2 @@

import { Class } from '@aurelia/kernel';
import type { Constructable } from '@aurelia/kernel';
import { type Class, type Constructable } from '@aurelia/kernel';
import type { InterceptorFunc } from '@aurelia/runtime';

@@ -4,0 +3,0 @@ import { BindingMode, IComponentBindablePropDefinition } from '@aurelia/template-compiler';

@@ -0,1 +1,2 @@

import { type IServiceLocator } from '@aurelia/kernel';
import { type IObserverLocator, IObserverLocatorBasedConnectable, ISubscriber, ICollectionSubscriber } from '@aurelia/runtime';

@@ -5,3 +6,2 @@ import { type Scope } from './scope';

import type { TaskQueue } from '@aurelia/platform';
import type { IServiceLocator } from '@aurelia/kernel';
import type { INode } from '../dom';

@@ -8,0 +8,0 @@ import type { IBinding, BindingMode, IBindingController } from './interfaces-bindings';

import { IAstEvaluator } from '../ast.eval';
import type { IServiceLocator } from '@aurelia/kernel';
import { type IServiceLocator } from '@aurelia/kernel';
import type { TaskQueue } from '@aurelia/platform';

@@ -4,0 +4,0 @@ import type { ICollectionSubscriber, IObserverLocator, IObserverLocatorBasedConnectable, ISubscriber } from '@aurelia/runtime';

@@ -0,3 +1,3 @@

import { type IServiceLocator } from '@aurelia/kernel';
import { IAstEvaluator } from '../ast.eval';
import type { IServiceLocator } from '@aurelia/kernel';
import type { ITask, TaskQueue } from '@aurelia/platform';

@@ -4,0 +4,0 @@ import type { ICollectionSubscriber, IObserverLocator, IObserverLocatorBasedConnectable, ISubscriber } from '@aurelia/runtime';

@@ -1,3 +0,3 @@

import { IExpressionParser, IsBindingBehavior } from '@aurelia/expression-parser';
import { IServiceLocator, Key } from '@aurelia/kernel';
import { IExpressionParser, type IsBindingBehavior } from '@aurelia/expression-parser';
import { type IServiceLocator, type Key } from '@aurelia/kernel';
import { TaskQueue } from '@aurelia/platform';

@@ -4,0 +4,0 @@ import { IObserverLocator, IObserverLocatorBasedConnectable } from '@aurelia/runtime';

@@ -1,2 +0,2 @@

import { IAttrMapper, IsTwoWayPredicate } from '@aurelia/template-compiler';
import { IAttrMapper, type IsTwoWayPredicate } from '@aurelia/template-compiler';
export declare class AttrMapper implements IAttrMapper {

@@ -3,0 +3,0 @@ static register: <C extends import("@aurelia/kernel").Constructable>(this: C, container: import("@aurelia/kernel").IContainer) => void;

import { IContainer } from '@aurelia/kernel';
import { ICoercionConfiguration } from '@aurelia/runtime';
import { DefaultBindingCommand, ForBindingCommand } from '@aurelia/template-compiler';
import { AtPrefixedTriggerAttributePattern, ColonPrefixedBindAttributePattern, DotSeparatedAttributePattern, RefAttributePattern, EventAttributePattern, DefaultBindingCommand, ForBindingCommand } from '@aurelia/template-compiler';
import { DebounceBindingBehavior } from './resources/binding-behaviors/debounce';

@@ -35,12 +35,3 @@ import { SignalBindingBehavior } from './resources/binding-behaviors/signals';

register(c: IContainer): void;
} | (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 () => {
'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;
}))[];
} | typeof RefAttributePattern | typeof DotSeparatedAttributePattern | typeof EventAttributePattern)[];
/**

@@ -51,8 +42,3 @@ * Binding syntax for short-hand attribute name patterns:

*/
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;
}))[];
export declare const ShortHandBindingSyntax: (typeof AtPrefixedTriggerAttributePattern | typeof ColonPrefixedBindAttributePattern)[];
/**

@@ -59,0 +45,0 @@ * Default HTML-specific (but environment-agnostic) binding commands:

@@ -0,1 +1,2 @@

import { IContainer } from '@aurelia/kernel';
import { IPlatform } from './platform';

@@ -198,2 +199,6 @@ import type { IHydratedController } from './templating/controller';

}
/**
* An utility to register a host node with the container with all the commonly used keys.
*/
export declare const registerHostNode: (container: IContainer, host: INode | null, platform?: IPlatform) => IContainer;
//# sourceMappingURL=dom.d.ts.map

@@ -33,3 +33,3 @@ export { type IAstEvaluator, astAssign, astBind, astEvaluate, astUnbind, } from './ast.eval';

export { DataAttributeAccessor, } from './observation/data-attribute-accessor';
export { NodeObserverLocator, type INodeObserverConfig, type INodeObserverConstructor as IHtmlObserverConstructor, } from './observation/observer-locator';
export { NodeObserverLocator, type INodeObserverConfig, type INodeObserverConstructor, } from './observation/observer-locator';
export { type ISelectElement, type IOptionElement, SelectValueObserver } from './observation/select-value-observer';

@@ -65,3 +65,3 @@ export { StyleAttributeAccessor } from './observation/style-attribute-accessor';

export { ViewFactory, IViewFactory, } from './templating/view';
export { INode, IEventTarget, IRenderLocation, type INodeSequence, FragmentNodeSequence, IHistory, IWindow, ILocation, getEffectiveParentNode, setEffectiveParentNode, convertToRenderLocation, isRenderLocation, getRef, setRef, } from './dom';
export { INode, IEventTarget, IRenderLocation, type INodeSequence, FragmentNodeSequence, IHistory, IWindow, ILocation, getEffectiveParentNode, setEffectiveParentNode, convertToRenderLocation, isRenderLocation, getRef, setRef, registerHostNode, } from './dom';
export { IPlatform, } from './platform';

@@ -68,0 +68,0 @@ export { CSSModulesProcessorRegistry, cssModules, ShadowDOMRegistry, shadowCSS, StyleConfiguration, IShadowDOMStyleFactory, type IShadowDOMConfiguration, AdoptedStyleSheetsStyles, StyleElementStyles, IShadowDOMStyles, IShadowDOMGlobalStyles, } from './templating/styles';

@@ -1,3 +0,2 @@

import { IObserver } from '@aurelia/runtime';
import type { AccessorType, IAccessor } from '@aurelia/runtime';
import { IObserver, type AccessorType, type IAccessor } from '@aurelia/runtime';
/**

@@ -4,0 +3,0 @@ * Attribute accessor for HTML elements.

@@ -1,2 +0,2 @@

import { Constructable } from '@aurelia/kernel';
import { type Constructable } from '@aurelia/kernel';
import { IHydratedController } from '../../templating/controller';

@@ -3,0 +3,0 @@ /**

@@ -0,1 +1,2 @@

import { registrableMetadataKey } from '@aurelia/kernel';
import { Scope } from '../../binding/scope';

@@ -59,10 +60,19 @@ import { INode } from '../../dom';

export declare class PromiseAttributePattern {
static [Symbol.metadata]: {
[registrableMetadataKey]: import("@aurelia/kernel").IRegistry;
};
'promise.resolve'(name: string, value: string): AttrSyntax;
}
export declare class FulfilledAttributePattern {
static [Symbol.metadata]: {
[registrableMetadataKey]: import("@aurelia/kernel").IRegistry;
};
'then'(name: string, value: string): AttrSyntax;
}
export declare class RejectedAttributePattern {
static [Symbol.metadata]: {
[registrableMetadataKey]: import("@aurelia/kernel").IRegistry;
};
'catch'(name: string, value: string): AttrSyntax;
}
//# sourceMappingURL=promise.d.ts.map
import { type IServiceLocator } from '@aurelia/kernel';
import { type ISubscriberCollection } from '@aurelia/runtime';
import { type ICustomElementViewModel, type ICustomElementController } from './controller';
import type { INode } from '../dom';
import { type ICustomElementViewModel } from './controller';
import { IBinding } from '../binding/interfaces-bindings';
export type PartialChildrenDefinition = {
/**
* An interface describing options to observe the children elements of a custom element host
*/
export type PartialChildrenDefinition<TQuery extends string = string> = {
query?: TQuery;
callback?: PropertyKey;
name?: PropertyKey;
options?: MutationObserverInit;
query?: (controller: ICustomElementController) => ArrayLike<Node>;
filter?: (node: Node, controller?: ICustomElementController | null, viewModel?: ICustomElementViewModel) => boolean;
map?: (node: Node, controller?: ICustomElementController | null, viewModel?: ICustomElementViewModel) => unknown;
filter?: (node: TQuery extends '$all' ? Node : HTMLElement, viewModel: ICustomElementViewModel | null) => boolean;
map?: (node: TQuery extends '$all' ? Node : HTMLElement, viewModel: ICustomElementViewModel | null) => unknown;
};

@@ -19,7 +20,8 @@ /**

*/
export declare function children<TThis, TValue>(config?: PartialChildrenDefinition): (target: undefined, context: ClassFieldDecoratorContext<TThis, TValue>) => void;
export declare function children<TThis, TValue, TQuery extends string>(config?: PartialChildrenDefinition<TQuery>): (target: undefined, context: ClassFieldDecoratorContext<TThis, TValue>) => void;
/**
* Decorator: Specifies an array property on a class that synchronizes its items with child content nodes of the element.
*
* @param selector - The CSS element selector for filtering children
* @param selector - The CSS element selector for filtering children. Use `$all` to select everything including non element nodes.
* If nothing is provided, it defaults to `*`, which means all elements
*/

@@ -34,2 +36,5 @@ export declare function children<TThis, TValue>(selector: string): (target: undefined, context: ClassFieldDecoratorContext<TThis, TValue>) => void;

export declare function children<TThis, TValue>(target: undefined, context: ClassFieldDecoratorContext<TThis, TValue>): void;
export declare namespace children {
var mixed: boolean;
}
export interface ChildrenBinding extends ISubscriberCollection {

@@ -43,3 +48,3 @@ }

readonly obj: ICustomElementViewModel;
constructor(controller: ICustomElementController, obj: ICustomElementViewModel, callback: undefined | (() => void), query?: (controller: ICustomElementController<ICustomElementViewModel>) => ArrayLike<INode>, filter?: (node: INode, controller?: ICustomElementController<ICustomElementViewModel> | null | undefined, viewModel?: any) => boolean, map?: (node: INode, controller?: ICustomElementController<ICustomElementViewModel> | null | undefined, viewModel?: any) => any, options?: MutationObserverInit);
constructor(host: HTMLElement, obj: ICustomElementViewModel, callback: undefined | (() => void), query: string, filter?: (node: Node, viewModel: ICustomElementViewModel | null) => boolean, map?: (node: Node, viewModel: ICustomElementViewModel | null) => unknown);
getValue(): unknown[];

@@ -46,0 +51,0 @@ setValue(_value: unknown): void;

@@ -1,2 +0,2 @@

import { type Constructable, type IContainer, type AnyFunction, type FunctionPropNames } from '@aurelia/kernel';
import { type Constructable, type IContainer, type AnyFunction, type FunctionPropNames, IRegistry } from '@aurelia/kernel';
export type LifecycleHook<TViewModel, TKey extends keyof TViewModel> = TViewModel[TKey] extends (AnyFunction | undefined) ? (vm: TViewModel, ...args: Parameters<NonNullable<TViewModel[TKey]>>) => ReturnType<NonNullable<TViewModel[TKey]>> : never;

@@ -33,3 +33,3 @@ export type ILifecycleHooks<TViewModel = {}, TKey extends keyof TViewModel = keyof TViewModel> = {

*/
define<T extends Constructable>(def: {}, Type: T): T;
define<T extends Constructable>(def: {}, Type: T): IRegistry;
/**

@@ -36,0 +36,0 @@ * @param ctx - The container where the resolution starts

@@ -0,3 +1,3 @@

import { type IContainer } from '@aurelia/kernel';
import { CustomElementDefinition } from '../resources/custom-element';
import type { IContainer } from '@aurelia/kernel';
import type { ICustomAttributeController, ICustomElementController, ISyntheticView } from './controller';

@@ -4,0 +4,0 @@ export interface IViewFactory {

@@ -0,3 +1,3 @@

import { type IServiceLocator } from '@aurelia/kernel';
import { type Scope } from '../binding/scope';
import type { IServiceLocator } from '@aurelia/kernel';
import type { ICollectionSubscriber, IConnectable, IObservable, IObserverLocator, IObserverLocatorBasedConnectable, ISubscriber } from '@aurelia/runtime';

@@ -4,0 +4,0 @@ import type { IWatcherCallback } from '../watch';

{
"name": "@aurelia/runtime-html",
"version": "2.1.0-dev.202405130849",
"version": "2.1.0-dev.202405280947",
"main": "dist/cjs/index.cjs",

@@ -57,9 +57,9 @@ "module": "dist/esm/index.mjs",

"dependencies": {
"@aurelia/kernel": "2.1.0-dev.202405130849",
"@aurelia/metadata": "2.1.0-dev.202405130849",
"@aurelia/platform": "2.1.0-dev.202405130849",
"@aurelia/platform-browser": "2.1.0-dev.202405130849",
"@aurelia/runtime": "2.1.0-dev.202405130849",
"@aurelia/expression-parser": "2.1.0-dev.202405130849",
"@aurelia/template-compiler": "2.1.0-dev.202405130849"
"@aurelia/kernel": "2.1.0-dev.202405280947",
"@aurelia/metadata": "2.1.0-dev.202405280947",
"@aurelia/platform": "2.1.0-dev.202405280947",
"@aurelia/platform-browser": "2.1.0-dev.202405280947",
"@aurelia/runtime": "2.1.0-dev.202405280947",
"@aurelia/expression-parser": "2.1.0-dev.202405280947",
"@aurelia/template-compiler": "2.1.0-dev.202405280947"
},

@@ -66,0 +66,0 @@ "devDependencies": {

import { BrowserPlatform } from '@aurelia/platform-browser';
import { InstanceProvider, onResolve, onResolveAll } from '@aurelia/kernel';
import { InstanceProvider, onResolve, onResolveAll, isFunction } from '@aurelia/kernel';
import { IAppTask } from './app-task';

@@ -13,3 +13,2 @@ import { CustomElementDefinition, generateElementName } from './resources/custom-element';

import { IEventTarget, registerHostNode } from './dom';
import { isFunction } from './utilities';
import { ErrorNames, createMappedError } from './errors';

@@ -84,3 +83,3 @@

registerResolver(container, IEventTarget, new InstanceProvider<IEventTarget>('IEventTarget', host));
registerHostNode(container, this.platform = this._createPlatform(container, host), host);
registerHostNode(container, host, this.platform = this._createPlatform(container, host));

@@ -87,0 +86,0 @@ this._hydratePromise = onResolve(this._runAppTasks('creating'), () => {

@@ -1,4 +0,4 @@

import { isFunction, objectFreeze } from './utilities';
import { objectFreeze } from './utilities';
import { createInterface, instanceRegistration } from './utilities-di';
import type { IContainer, IRegistry, Key, Resolved } from '@aurelia/kernel';
import { isFunction, type IContainer, type IRegistry, type Key, type Resolved } from '@aurelia/kernel';

@@ -5,0 +5,0 @@ export type TaskSlot =

@@ -10,7 +10,7 @@ /* eslint-disable no-fallthrough */

} from '@aurelia/expression-parser';
import { AnyFunction, IIndexable, isArrayIndex } from '@aurelia/kernel';
import { AnyFunction, IIndexable, isArrayIndex, isArray, isFunction, isObject } from '@aurelia/kernel';
import { IConnectable, IObservable, ISubscriber } from '@aurelia/runtime';
import { Scope, type IBindingContext, IOverrideContext } from './binding/scope';
import { ErrorNames, createMappedError } from './errors';
import { isArray, isFunction, isObject, safeString } from './utilities';
import { safeString } from './utilities';
import { ISignaler } from './signaler';

@@ -17,0 +17,0 @@ import { BindingBehaviorInstance } from './resources/binding-behavior';

@@ -1,4 +0,3 @@

import { DI, InstanceProvider, onResolve } from '@aurelia/kernel';
import { isPromise, DI, InstanceProvider, onResolve } from '@aurelia/kernel';
import { AppRoot, IAppRoot } from './app-root';
import { isPromise } from './utilities';
import { createInterface, registerResolver } from './utilities-di';

@@ -88,4 +87,3 @@

const platform = this.root.platform;
await platform.domWriteQueue.yield();
await platform.domReadQueue.yield();
await platform.domQueue.yield();
await platform.taskQueue.yield();

@@ -92,0 +90,0 @@ }

@@ -1,8 +0,7 @@

import { kebabCase, getPrototypeChain, noop, Class } from '@aurelia/kernel';
import { kebabCase, getPrototypeChain, noop, type Class, createLookup, isString, type Constructable } from '@aurelia/kernel';
import { ICoercionConfiguration } from '@aurelia/runtime';
import { defaultMode, toView, twoWay } from './binding/interfaces-bindings';
import { defineMetadata, getAnnotationKeyFor, getMetadata } from './utilities-metadata';
import { createLookup, isString, objectFreeze, objectKeys } from './utilities';
import { objectFreeze, objectKeys } from './utilities';
import type { Constructable } from '@aurelia/kernel';
import type { InterceptorFunc } from '@aurelia/runtime';

@@ -9,0 +8,0 @@ import { ErrorNames, createMappedError } from './errors';

@@ -0,1 +1,2 @@

import { type IServiceLocator, isString } from '@aurelia/kernel';
import {

@@ -24,6 +25,5 @@ connectable,

} from '@aurelia/platform';
import type { IServiceLocator } from '@aurelia/kernel';
import type { INode } from '../dom';
import type { IBinding, BindingMode, IBindingController } from './interfaces-bindings';
import { isString, safeString } from '../utilities';
import { safeString } from '../utilities';
import { ForOfStatement, IsBindingBehavior } from '@aurelia/expression-parser';

@@ -30,0 +30,0 @@

@@ -12,3 +12,3 @@ import {

import { toView } from './interfaces-bindings';
import type { IServiceLocator } from '@aurelia/kernel';
import { type IServiceLocator, isArray } from '@aurelia/kernel';
import type { ITask, QueueTaskOptions, TaskQueue } from '@aurelia/platform';

@@ -23,3 +23,3 @@ import type {

import type { IPlatform } from '../platform';
import { isArray, safeString } from '../utilities';
import { safeString } from '../utilities';
import type { BindingMode, IBinding, IBindingController } from './interfaces-bindings';

@@ -26,0 +26,0 @@ import { mixinUseScope, mixingBindingLimited, mixinAstEvaluator, createPrototypeMixer } from './binding-utils';

@@ -0,1 +1,2 @@

import { type IServiceLocator, isArray } from '@aurelia/kernel';
import {

@@ -14,3 +15,2 @@ connectable,

import type { IServiceLocator } from '@aurelia/kernel';
import type { ITask, QueueTaskOptions, TaskQueue } from '@aurelia/platform';

@@ -25,3 +25,3 @@ import type {

import { type Scope } from './scope';
import { atLayout, isArray } from '../utilities';
import { atLayout } from '../utilities';
import type { IBinding, BindingMode, IBindingController } from './interfaces-bindings';

@@ -28,0 +28,0 @@ import { type Interpolation, IsExpression } from '@aurelia/expression-parser';

import { type IsBindingBehavior } from '@aurelia/expression-parser';
import { isArray, isFunction, isString, objectFreeze } from '../utilities';
import { isArray, isFunction, isString, resolve, type IServiceLocator, all, IContainer } from '@aurelia/kernel';
import { objectFreeze } from '../utilities';
import { createInterface, singletonRegistration } from '../utilities-di';
import { createPrototypeMixer, mixinAstEvaluator, mixinUseScope, mixingBindingLimited } from './binding-utils';
import { resolve, type IServiceLocator, all, IContainer } from '@aurelia/kernel';
import { ICollectionSubscriber, IObserverLocatorBasedConnectable, ISubscriber, } from '@aurelia/runtime';

@@ -8,0 +8,0 @@ import { type Scope } from './scope';

@@ -1,3 +0,3 @@

import { AccessScopeExpression, IExpressionParser, IsBindingBehavior } from '@aurelia/expression-parser';
import { IServiceLocator, Key, emptyArray } from '@aurelia/kernel';
import { AccessScopeExpression, IExpressionParser, type IsBindingBehavior } from '@aurelia/expression-parser';
import { isObject, type IServiceLocator, type Key, emptyArray } from '@aurelia/kernel';
import { TaskQueue } from '@aurelia/platform';

@@ -17,3 +17,2 @@ import { IObserverLocator, IObserverLocatorBasedConnectable, connectable } from '@aurelia/runtime';

import { Scope } from './scope';
import { isObject } from '../utilities';

@@ -258,2 +257,4 @@ /**

}
/* istanbul ignore next */
this.unbind();
}

@@ -292,21 +293,16 @@ this.isBound = true;

private _createBindings(value: Record<string, unknown> | null, unbind: boolean) {
if (value == null) {
value = {};
let key: string;
if (!isObject(value)) {
/* istanbul ignore if */
if (__DEV__) {
// eslint-disable-next-line no-console
console.warn(`[DEV:aurelia] $bindable spread is given a null/undefined value for properties: "${this.targetKeys.join(', ')}"`);
console.warn(`[DEV:aurelia] $bindable spread is given a non object for properties: "${this.targetKeys.join(', ')}" of ${this.target.constructor.name}`);
}
} else if (!isObject(value)) {
value = {};
/* istanbul ignore if */
if (__DEV__) {
// eslint-disable-next-line no-console
console.warn(`[DEV:aurelia] $bindable spread is given a non-object value for properties: "${this.targetKeys.join(', ')}"`);
for (key in this._bindingCache) {
this._bindingCache[key]?.unbind();
}
return;
}
let key: string;
let binding: PropertyBinding;
// use a cache as we don't wanna cause bindings to "move" (bind/unbind)

@@ -313,0 +309,0 @@ // whenever there's a new evaluation

@@ -1,6 +0,6 @@

import { createLookup, isDataAttribute } from '../utilities';
import { isDataAttribute } from '../utilities';
import { ISVGAnalyzer } from '../observation/svg-analyzer';
import { createImplementationRegister, resolve } from '@aurelia/kernel';
import { createLookup, createImplementationRegister, resolve } from '@aurelia/kernel';
import { ErrorNames, createMappedError } from '../errors';
import { IAttrMapper, IsTwoWayPredicate } from '@aurelia/template-compiler';
import { IAttrMapper, type IsTwoWayPredicate } from '@aurelia/template-compiler';

@@ -7,0 +7,0 @@ export class AttrMapper implements IAttrMapper {

@@ -1,8 +0,3 @@

import { BindableDefinition } from '../bindable';
import { defaultMode } from '../binding/interfaces-bindings';
import { CustomAttribute } from '../resources/custom-attribute';
import { CustomElement, CustomElementDefinition } from '../resources/custom-element';
import { createLookup } from '../utilities';
import {
createLookup,
createImplementationRegister,

@@ -18,2 +13,7 @@ type IContainer,

} from '@aurelia/template-compiler';
import { BindableDefinition } from '../bindable';
import { defaultMode } from '../binding/interfaces-bindings';
import { CustomAttribute } from '../resources/custom-attribute';
import { CustomElement, CustomElementDefinition } from '../resources/custom-element';
import { ErrorNames, createMappedError } from '../errors';

@@ -20,0 +20,0 @@ import type { CustomAttributeDefinition } from '../resources/custom-attribute';

@@ -68,3 +68,2 @@ import { IContainer, noop } from '@aurelia/kernel';

RejectedTemplateController,
// TODO: activate after the attribute parser and/or interpreter such that for `t`, `then` is not picked up.
PromiseAttributePattern,

@@ -113,3 +112,3 @@ FulfilledAttributePattern,

AtPrefixedTriggerAttributePattern,
ColonPrefixedBindAttributePattern
ColonPrefixedBindAttributePattern,
];

@@ -167,3 +166,2 @@

RejectedTemplateController,
// TODO: activate after the attribute parser and/or interpreter such that for `t`, `then` is not picked up.
PromiseAttributePattern,

@@ -170,0 +168,0 @@ FulfilledAttributePattern,

@@ -507,4 +507,6 @@ import { IContainer, InstanceProvider, type Writable } from '@aurelia/kernel';

/** @internal */
export const registerHostNode = (container: IContainer, platform: IPlatform, host: INode | null) => {
/**
* An utility to register a host node with the container with all the commonly used keys.
*/
export const registerHostNode = (container: IContainer, host: INode | null, platform = container.get(IPlatform)) => {
registerResolver(

@@ -511,0 +513,0 @@ container,

@@ -128,2 +128,3 @@ /* eslint-disable @typescript-eslint/no-unsafe-member-access */

slotted_decorator_invalid_usage = 9990,
children_invalid_query = 9989,
}

@@ -252,2 +253,3 @@ _END_CONST_ENUM();

[ErrorNames.slotted_decorator_invalid_usage]: `Invalid @slotted usage. @slotted decorator can only be used on a field`,
[ErrorNames.children_invalid_query]: `Invalid query selector. Only selectors with alpha-numeric characters, or $all are allowed. Got {{0}} instead.`
};

@@ -254,0 +256,0 @@

@@ -169,3 +169,3 @@ export {

type INodeObserverConfig,
type INodeObserverConstructor as IHtmlObserverConstructor,
type INodeObserverConstructor,
} from './observation/observer-locator';

@@ -384,2 +384,3 @@ export {

setRef,
registerHostNode,
} from './dom';

@@ -386,0 +387,0 @@ export {

@@ -1,2 +0,3 @@

import { atLayout, atNode, createLookup } from '../utilities';
import { createLookup } from '@aurelia/kernel';
import { atLayout, atNode } from '../utilities';

@@ -3,0 +4,0 @@ import type { AccessorType, IAccessor } from '@aurelia/runtime';

@@ -11,3 +11,3 @@ import {

import { getCollectionObserver, INodeObserver, INodeObserverConfigBase } from './observer-locator';
import { atLayout, atNode, atObserver, hasOwnProperty, isArray } from '../utilities';
import { atLayout, atNode, atObserver, hasOwnProperty } from '../utilities';

@@ -17,2 +17,3 @@ import type { INode } from '../dom';

import { mixinNodeObserverUseConfig } from './observation-utils';
import { isArray } from '@aurelia/kernel';

@@ -19,0 +20,0 @@ export interface IInputElement extends HTMLInputElement {

@@ -1,3 +0,3 @@

import { emptyArray } from '@aurelia/kernel';
import { atLayout, atNode, isArray, isString } from '../utilities';
import { emptyArray, isArray, isString } from '@aurelia/kernel';
import { atLayout, atNode } from '../utilities';

@@ -4,0 +4,0 @@ import type { AccessorType, IAccessor } from '@aurelia/runtime';

@@ -1,5 +0,3 @@

import { IObserver } from '@aurelia/runtime';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import type { AccessorType, IAccessor, PropertyAccessor } from '@aurelia/runtime';
import { IObserver, type AccessorType, type IAccessor, type PropertyAccessor } from '@aurelia/runtime';
import { mixinNoopSubscribable } from './observation-utils';

@@ -6,0 +4,0 @@ import { atLayout, atNode } from '../utilities';

@@ -1,2 +0,2 @@

import { createImplementationRegister, emptyObject, IServiceLocator, resolve } from '@aurelia/kernel';
import { createImplementationRegister, createLookup, emptyObject, IServiceLocator, isString, resolve } from '@aurelia/kernel';
import {

@@ -19,3 +19,3 @@ getObserverLookup,

import { ValueAttributeObserver } from './value-attribute-observer';
import { atLayout, atNode, createLookup, isDataAttribute, isString, objectAssign } from '../utilities';
import { atLayout, atNode, isDataAttribute, objectAssign } from '../utilities';

@@ -22,0 +22,0 @@ import type { IIndexable } from '@aurelia/kernel';

@@ -10,6 +10,8 @@ import {

import type { INode } from '../dom';
import { atLayout, atNode, atObserver, createError, hasOwnProperty, isArray } from '../utilities';
import { atLayout, atNode, atObserver, hasOwnProperty } from '../utilities';
import { INodeObserver, INodeObserverConfigBase } from './observer-locator';
import { mixinNodeObserverUseConfig } from './observation-utils';
import { createMutationObserver } from '../utilities-dom';
import { ErrorNames, createMappedError } from '../errors';
import { isArray } from '@aurelia/kernel';

@@ -289,6 +291,3 @@ export interface ISelectElement extends HTMLSelectElement {

if (!this._el.multiple) {
if (__DEV__)
throw createError(`AUR0654: array values can only be bound to a multi-select.`);
else
throw createError(`AUR0654`);
throw createMappedError(ErrorNames.select_observer_array_on_non_multi_select);
}

@@ -295,0 +294,0 @@ (this._arrayObserver = this._observerLocator.getArrayObserver(array)).subscribe(this);

@@ -1,3 +0,3 @@

import { emptyArray, kebabCase } from '@aurelia/kernel';
import { atLayout, atNode, hasOwnProperty, isFunction, isString } from '../utilities';
import { emptyArray, kebabCase, isFunction, isString } from '@aurelia/kernel';
import { atLayout, atNode, hasOwnProperty } from '../utilities';
import type { AccessorType, IAccessor } from '@aurelia/runtime';

@@ -4,0 +4,0 @@ import { mixinNoopSubscribable } from './observation-utils';

import { IPlatform } from '../platform';
import { createLookup, isString, objectAssign } from '../utilities';
import { objectAssign } from '../utilities';
import { aliasRegistration, createInterface, singletonRegistration } from '../utilities-di';
import { resolve, type IContainer } from '@aurelia/kernel';
import { createLookup, isString, resolve, type IContainer } from '@aurelia/kernel';
import type { INode } from '../dom';

@@ -7,0 +7,0 @@

@@ -0,6 +1,6 @@

import { type IIndexable, areEqual } from '@aurelia/kernel';
import { subscriberCollection } from '@aurelia/runtime';
import { mixinNodeObserverUseConfig } from './observation-utils';
import { areEqual, atLayout, atNode, atObserver } from '../utilities';
import { atLayout, atNode, atObserver } from '../utilities';
import type { IIndexable } from '@aurelia/kernel';
import type { AccessorType, ISubscriberCollection } from '@aurelia/runtime';

@@ -7,0 +7,0 @@ import type { INode } from '../dom';

@@ -8,3 +8,4 @@ import {

resolve,
Registrable,
isString,
registrableMetadataKey,
} from '@aurelia/kernel';

@@ -35,3 +36,3 @@ import {

import { IRendering } from './templating/rendering';
import { objectKeys, isString, etIsProperty, etInterpolation, etIsIterator, etIsFunction } from './utilities';
import { objectKeys, etIsProperty, etInterpolation, etIsIterator, etIsFunction } from './utilities';
import { createInterface, registerResolver, singletonRegistration } from './utilities-di';

@@ -90,5 +91,9 @@ import { IAuSlotsInfo, AuSlotsInfo } from './templating/controller.projection';

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 {
singletonRegistration(IRenderer, this).register(container);
});
const metadata = context?.metadata ?? (target[Symbol.metadata] ??= Object.create(null));
metadata[registrableMetadataKey] = {
register(container: IContainer): void {
singletonRegistration(IRenderer, target).register(container);
}
};
return target;
}

@@ -452,3 +457,3 @@

observerLocator,
platform.domWriteQueue,
platform.domQueue,
ensureExpression(exprParser, instruction.from, etInterpolation),

@@ -479,3 +484,3 @@ getTarget(target),

observerLocator,
platform.domWriteQueue,
platform.domQueue,
ensureExpression(exprParser, instruction.from, etIsProperty),

@@ -506,3 +511,3 @@ getTarget(target),

observerLocator,
platform.domWriteQueue,
platform.domQueue,
ensureExpression(exprParser, instruction.forOf, etIsIterator),

@@ -533,3 +538,3 @@ getTarget(target),

observerLocator,
platform.domWriteQueue,
platform.domQueue,
platform,

@@ -663,3 +668,3 @@ ensureExpression(exprParser, instruction.from, etIsProperty),

observerLocator,
platform.domWriteQueue,
platform.domQueue,
ensureExpression(exprParser, instruction.from, etIsProperty),

@@ -677,3 +682,3 @@ target.style,

observerLocator,
platform.domWriteQueue,
platform.domQueue,
ensureExpression(exprParser, instruction.from, etIsProperty),

@@ -720,3 +725,3 @@ target.style,

observerLocator,
platform.domWriteQueue,
platform.domQueue,
ensureExpression(exprParser, instruction.from, etIsProperty),

@@ -784,3 +789,3 @@ target,

renderingCtrl.container,
platform.domWriteQueue
platform.domQueue
));

@@ -826,3 +831,3 @@ } else {

registerHostNode(ctn, p, host);
registerHostNode(ctn, host, p);
registerResolver(ctn, IController, new InstanceProvider(controllerProviderName, renderingCtrl));

@@ -887,3 +892,3 @@ registerResolver(ctn, IInstruction, new InstanceProvider(instructionProviderName, instruction));

const ctn = renderingCtrl.container.createChild();
registerHostNode(ctn, p, host);
registerHostNode(ctn, host, p);
registerResolver(ctn, IController, new InstanceProvider(controllerProviderName, renderingCtrl));

@@ -890,0 +895,0 @@ registerResolver(ctn, IInstruction, new InstanceProvider<IInstruction>(instructionProviderName, instruction));

@@ -1,4 +0,4 @@

import { firstDefined, getResourceKeyFor, mergeArrays, resource, resourceBaseName, ResourceType } from '@aurelia/kernel';
import { firstDefined, getResourceKeyFor, mergeArrays, resource, resourceBaseName, ResourceType, isFunction, isString } from '@aurelia/kernel';
import { type Scope } from '../binding/scope';
import { isFunction, isString, objectFreeze } from '../utilities';
import { objectFreeze } from '../utilities';
import { aliasRegistration, singletonRegistration } from '../utilities-di';

@@ -5,0 +5,0 @@ import { defineMetadata, getAnnotationKeyFor, getMetadata, hasMetadata } from '../utilities-metadata';

@@ -1,6 +0,5 @@

import { IDisposable, IPlatform, emptyArray, resolve } from '@aurelia/kernel';
import { isString, type IDisposable, IPlatform, emptyArray, resolve } from '@aurelia/kernel';
import { type BindingBehaviorInstance, BindingBehaviorStaticAuDefinition, behaviorTypeName } from '../binding-behavior';
import { type Scope } from '../../binding/scope';
import { isString } from '../../utilities';
import { type IBinding, type IRateLimitOptions } from '../../binding/interfaces-bindings';

@@ -7,0 +6,0 @@

@@ -1,6 +0,5 @@

import { IPlatform, type IDisposable, emptyArray, resolve } from '@aurelia/kernel';
import { isString, IPlatform, type IDisposable, emptyArray, resolve } from '@aurelia/kernel';
import { TaskQueue } from '@aurelia/platform';
import { type Scope } from '../../binding/scope';
import { type BindingBehaviorInstance, BindingBehaviorStaticAuDefinition, behaviorTypeName } from '../binding-behavior';
import { isString } from '../../utilities';
import { type IBinding, type IRateLimitOptions } from '../../binding/interfaces-bindings';

@@ -7,0 +6,0 @@

@@ -1,2 +0,2 @@

import { mergeArrays, firstDefined, Key, resourceBaseName, getResourceKeyFor } from '@aurelia/kernel';
import { mergeArrays, firstDefined, Key, resourceBaseName, getResourceKeyFor, isFunction, isString } from '@aurelia/kernel';
import { Bindable } from '../bindable';

@@ -6,3 +6,3 @@ import { Watch } from '../watch';

import { defineMetadata, getAnnotationKeyFor, getMetadata, hasMetadata } from '../utilities-metadata';
import { isFunction, isString, objectFreeze } from '../utilities';
import { objectFreeze } from '../utilities';
import { aliasRegistration, singletonRegistration } from '../utilities-di';

@@ -9,0 +9,0 @@ import { defaultMode, toView, BindingMode } from '../binding/interfaces-bindings';

@@ -49,3 +49,3 @@ import { INode } from '../../dom';

if (this._isActive && this._task === null) {
this._task = this.p.domWriteQueue.queueTask(this.update);
this._task = this.p.domQueue.queueTask(this.update);
}

@@ -52,0 +52,0 @@ }

@@ -10,2 +10,5 @@ import {

getResourceKeyFor,
isFunction,
isString,
isSymbol,
} from '@aurelia/kernel';

@@ -16,3 +19,3 @@ import { Bindable } from '../bindable';

import { defineMetadata, getAnnotationKeyFor, getMetadata, hasMetadata } from '../utilities-metadata';
import { def, isFunction, isString, isSymbol, objectAssign, objectFreeze } from '../utilities';
import { def, objectAssign, objectFreeze } from '../utilities';
import { aliasRegistration, singletonRegistration } from '../utilities-di';

@@ -19,0 +22,0 @@

@@ -1,2 +0,2 @@

import { Constructable, IContainer, InstanceProvider, MaybePromise, emptyArray, onResolve, resolve, transient } from '@aurelia/kernel';
import { isFunction, isPromise, type Constructable, IContainer, InstanceProvider, type MaybePromise, emptyArray, onResolve, resolve, transient } from '@aurelia/kernel';
import { IObserverLocator } from '@aurelia/runtime';

@@ -8,3 +8,2 @@ import { Scope } from '../../binding/scope';

import { IRendering } from '../../templating/rendering';
import { isFunction, isPromise } from '../../utilities';
import { registerResolver } from '../../utilities-di';

@@ -373,3 +372,3 @@ import { CustomElement, CustomElementDefinition, CustomElementStaticAuDefinition, elementTypeName } from '../custom-element';

const p = this._platform;
registerHostNode(container, p, host);
registerHostNode(container, host, p);
registerResolver(

@@ -376,0 +375,0 @@ container,

@@ -179,2 +179,11 @@ import { Scope } from '../../binding/scope';

//
// example:
// <template as-custom-element="parent">
// <child>
// <au-slot> #2
// </child>
// ...
// <template as-custom-element="child">
// <au-slot> #1
//
// because of this structure, walk 2 level of controller at once to find the right parent scope for $host value

@@ -181,0 +190,0 @@ while (parent.vmKind === 'synthetic' && parent.parent?.viewModel instanceof AuSlot) {

@@ -1,2 +0,2 @@

import { onResolve, resolve } from '@aurelia/kernel';
import { onResolve, resolve, isPromise, isString } from '@aurelia/kernel';
import { IRenderLocation, setEffectiveParentNode } from '../../dom';

@@ -6,3 +6,3 @@ import { IPlatform } from '../../platform';

import { CustomAttributeStaticAuDefinition, attrTypeName } from '../custom-attribute';
import { isPromise, isString, rethrow } from '../../utilities';
import { rethrow } from '../../utilities';
import { createLocation, insertManyBefore } from '../../utilities-dom';

@@ -9,0 +9,0 @@ import type { ControllerVisitor, ICustomAttributeController, ICustomAttributeViewModel, IHydratedController, ISyntheticView } from '../../templating/controller';

import { Task, TaskAbortError } from '@aurelia/platform';
import { ILogger, onResolve, onResolveAll, resolve } from '@aurelia/kernel';
import { ILogger, onResolve, onResolveAll, resolve, isPromise, registrableMetadataKey } from '@aurelia/kernel';
import { Scope } from '../../binding/scope';

@@ -19,3 +19,3 @@ import { INode, IRenderLocation } from '../../dom';

import { CustomAttributeStaticAuDefinition, attrTypeName } from '../custom-attribute';
import { isPromise, safeString, tsRunning } from '../../utilities';
import { safeString, tsRunning } from '../../utilities';
import { ErrorNames, createMappedError } from '../../errors';

@@ -83,3 +83,3 @@

}
const q = this._platform.domWriteQueue;
const q = this._platform.domQueue;
const fulfilled = this.fulfilled;

@@ -340,2 +340,5 @@ const rejected = this.rejected;

export class PromiseAttributePattern {
public static [Symbol.metadata] = {
[registrableMetadataKey]: AttributePattern.create([{ pattern: 'promise.resolve', symbols: '' }], PromiseAttributePattern)
};
public 'promise.resolve'(name: string, value: string): AttrSyntax {

@@ -345,5 +348,7 @@ return new AttrSyntax(name, value, 'promise', 'bind');

}
AttributePattern.define([{ pattern: 'promise.resolve', symbols: '' }], PromiseAttributePattern);
export class FulfilledAttributePattern {
public static [Symbol.metadata] = {
[registrableMetadataKey]: AttributePattern.create([{ pattern: 'then', symbols: '' }], FulfilledAttributePattern)
};
public 'then'(name: string, value: string): AttrSyntax {

@@ -353,5 +358,7 @@ return new AttrSyntax(name, value, 'then', 'from-view');

}
AttributePattern.define([{ pattern: 'then', symbols: '' }], FulfilledAttributePattern);
export class RejectedAttributePattern {
public static [Symbol.metadata] = {
[registrableMetadataKey]: AttributePattern.create([{ pattern: 'catch', symbols: '' }], RejectedAttributePattern)
};
public 'catch'(name: string, value: string): AttrSyntax {

@@ -361,2 +368,1 @@ return new AttrSyntax(name, value, 'catch', 'from-view');

}
AttributePattern.define([{ pattern: 'catch', symbols: '' }], RejectedAttributePattern);

@@ -1,3 +0,17 @@

import { type IDisposable, onResolve, IIndexable, resolve, all, emptyArray, IContainer } from '@aurelia/kernel';
import {
areEqual,
isArray,
isPromise,
isMap,
isSet,
isNumber,
type IDisposable,
onResolve,
type IIndexable,
resolve,
all,
emptyArray,
IContainer,
} from '@aurelia/kernel';
import {
BindingBehaviorExpression,

@@ -30,3 +44,3 @@ DestructuringAssignmentExpression,

import { IController } from '../../templating/controller';
import { areEqual, isArray, isPromise, isMap, isSet, isNumber, rethrow, etIsProperty } from '../../utilities';
import { rethrow, etIsProperty } from '../../utilities';
import { HydrateTemplateController, IInstruction, IteratorBindingInstruction } from '@aurelia/template-compiler';

@@ -33,0 +47,0 @@

import {
isArray,
ILogger,

@@ -17,3 +18,2 @@ onResolve,

import { oneTime } from '../../binding/interfaces-bindings';
import { isArray } from '../../utilities';

@@ -20,0 +20,0 @@ import type { Controller, ICustomAttributeController, ICustomAttributeViewModel, IHydratedController, IHydratedParentController, IHydratableController, ISyntheticView, ControllerVisitor } from '../../templating/controller';

@@ -7,5 +7,7 @@ import {

resource,
isFunction,
isString,
} from '@aurelia/kernel';
import { aliasRegistration, singletonRegistration } from '../utilities-di';
import { isFunction, isString, objectFreeze } from '../utilities';
import { objectFreeze } from '../utilities';
import { defineMetadata, getAnnotationKeyFor, getMetadata, hasMetadata } from '../utilities-metadata';

@@ -12,0 +14,0 @@

@@ -0,3 +1,3 @@

import { createLookup } from '@aurelia/kernel';
import type { ISubscriber } from '@aurelia/runtime';
import { createLookup } from './utilities';
import { createInterface } from './utilities-di';

@@ -4,0 +4,0 @@

@@ -1,11 +0,10 @@

import { emptyArray, type IContainer, type IServiceLocator, Key , IIndexable } from '@aurelia/kernel';
import { emptyArray, isString, type IContainer, type IServiceLocator, Key, IIndexable } from '@aurelia/kernel';
import { subscriberCollection , type ISubscriberCollection } from '@aurelia/runtime';
import { findElementControllerFor } from '../resources/custom-element';
import { ILifecycleHooks, lifecycleHooks } from './lifecycle-hooks';
import { def, isString, objectAssign, safeString } from '../utilities';
import { def, objectAssign, safeString } from '../utilities';
import { instanceRegistration } from '../utilities-di';
import { type ICustomElementViewModel, type ICustomElementController } from './controller';
import { createMutationObserver, isElement } from '../utilities-dom';
import { createMutationObserver } from '../utilities-dom';
import type { INode } from '../dom';
import { ErrorNames, createMappedError } from '../errors';

@@ -15,9 +14,11 @@ import { getAnnotationKeyFor } from '../utilities-metadata';

export type PartialChildrenDefinition = {
/**
* An interface describing options to observe the children elements of a custom element host
*/
export type PartialChildrenDefinition<TQuery extends string = string> = {
query?: TQuery;
callback?: PropertyKey;
name?: PropertyKey;
options?: MutationObserverInit;
query?: (controller: ICustomElementController) => ArrayLike<Node>;
filter?: (node: Node, controller?: ICustomElementController | null, viewModel?: ICustomElementViewModel) => boolean;
map?: (node: Node, controller?: ICustomElementController | null, viewModel?: ICustomElementViewModel) => unknown;
filter?: (node: TQuery extends '$all' ? Node : HTMLElement, viewModel: ICustomElementViewModel | null) => boolean;
map?: (node: TQuery extends '$all' ? Node : HTMLElement, viewModel: ICustomElementViewModel | null) => unknown;
};

@@ -30,9 +31,10 @@

*/
export function children<TThis,TValue>(config?: PartialChildrenDefinition): (target: undefined, context: ClassFieldDecoratorContext<TThis,TValue>) => void;
export function children<TThis, TValue, TQuery extends string>(config?: PartialChildrenDefinition<TQuery>): (target: undefined, context: ClassFieldDecoratorContext<TThis,TValue>) => void;
/**
* Decorator: Specifies an array property on a class that synchronizes its items with child content nodes of the element.
*
* @param selector - The CSS element selector for filtering children
* @param selector - The CSS element selector for filtering children. Use `$all` to select everything including non element nodes.
* If nothing is provided, it defaults to `*`, which means all elements
*/
export function children<TThis,TValue>(selector: string): (target: undefined, context: ClassFieldDecoratorContext<TThis,TValue>) => void;
export function children<TThis, TValue>(selector: string): (target: undefined, context: ClassFieldDecoratorContext<TThis,TValue>) => void;
/**

@@ -44,6 +46,6 @@ * Decorator: Decorator: Specifies an array property that synchronizes its items with child content nodes of the element.

*/
export function children<TThis,TValue>(target: undefined, context: ClassFieldDecoratorContext<TThis,TValue>): void;
export function children<TThis,TValue>(configOrTarget?: PartialChildrenDefinition | string | undefined, context?: ClassFieldDecoratorContext<TThis,TValue>): void | ((target: undefined, context: ClassFieldDecoratorContext<TThis,TValue>) => void) {
if (!mixed) {
mixed = true;
export function children<TThis, TValue>(target: undefined, context: ClassFieldDecoratorContext<TThis,TValue>): void;
export function children<TThis, TValue, TQuery extends string>(configOrTarget?: PartialChildrenDefinition<TQuery> | string | undefined, context?: ClassFieldDecoratorContext<TThis,TValue>): void | ((target: undefined, context: ClassFieldDecoratorContext<TThis,TValue>) => void) {
if (!children.mixed) {
children.mixed = true;
subscriberCollection(ChildrenBinding, null!);

@@ -63,3 +65,3 @@ lifecycleHooks()(ChildrenLifecycleHooks, null!);

const dependencies = (context.metadata[dependenciesKey] ??= []) as Key[];
dependencies.push(new ChildrenLifecycleHooks(config as PartialChildrenDefinition & { name: PropertyKey }));
dependencies.push(new ChildrenLifecycleHooks(config as PartialChildrenDefinition & { name: PropertyKey } ?? {}));
}

@@ -77,4 +79,5 @@

config = {
filter: (node: Node) => isElement(node) && node.matches(configOrTarget),
map: el => el
query: configOrTarget,
// filter: (node: Node) => isElement(node) && node.matches(configOrTarget),
// map: el => el
};

@@ -90,2 +93,3 @@ return decorator;

}
children.mixed = false;

@@ -107,11 +111,7 @@ export interface ChildrenBinding extends ISubscriberCollection { }

/** @internal */
private readonly _controller: ICustomElementController;
private readonly _query: string;
/** @internal */
private readonly _query = defaultChildQuery;
private readonly _filter?: (node: Node, viewModel: ICustomElementViewModel | null) => boolean;
/** @internal */
private readonly _filter = defaultChildFilter;
/** @internal */
private readonly _map = defaultChildMap;
/** @internal */
private readonly _options?: MutationObserverInit;
private readonly _map?: (node: Node, viewModel: ICustomElementViewModel | null) => unknown;

@@ -122,11 +122,9 @@ public isBound = false;

public constructor(
controller: ICustomElementController,
host: HTMLElement,
obj: ICustomElementViewModel,
callback: undefined | (() => void),
query = defaultChildQuery,
filter = defaultChildFilter,
map = defaultChildMap,
options = childObserverOptions,
query: string,
filter?: (node: Node, viewModel: ICustomElementViewModel | null) => boolean,
map?: (node: Node, viewModel: ICustomElementViewModel | null) => unknown,
) {
this._controller = controller;
this.obj = obj;

@@ -137,4 +135,3 @@ this._callback = callback;

this._map = map;
this._options = options;
this._observer = createMutationObserver(this._host = controller.host, () => {
this._observer = createMutationObserver(this._host = host, () => {
this._onChildrenChanged();

@@ -155,3 +152,3 @@ });

this.isBound = true;
this._observer.observe(this._host, this._options);
this._observer.observe(this._host, { childList: true });
this._children = this._getNodes();

@@ -165,2 +162,4 @@ }

this.isBound = false;
// prevent memory leaks
this._observer.takeRecords();
this._observer.disconnect();

@@ -186,48 +185,26 @@ this._children = emptyArray;

private _getNodes() {
return filterChildren(this._controller, this._query, this._filter, this._map);
const query = this._query;
const filter = this._filter;
const map = this._map;
const nodes = query === '$all' ? this._host.childNodes : this._host.querySelectorAll(`:scope > ${query}`);
const ii = nodes.length;
const results: unknown[] = [];
const findControllerOptions = { optional: true };
let $controller: ICustomElementController | null;
let viewModel: ICustomElementViewModel | null;
let i = 0;
let node: Node;
while (ii > i) {
node = nodes[i];
$controller = findElementControllerFor(node, findControllerOptions);
viewModel = $controller?.viewModel ?? null;
if (filter == null ? true : filter(node, viewModel)) {
results.push(map == null ? viewModel ?? node : map(node, viewModel));
}
++i;
}
return results;
}
}
const childObserverOptions: MutationObserverInit = { childList: true };
const defaultChildQuery = (controller: ICustomElementController): ArrayLike<INode> => controller.host.childNodes;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const defaultChildFilter = (node: INode, controller?: ICustomElementController | null, viewModel?: any): boolean =>
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
!!viewModel;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const defaultChildMap = (node: INode, controller?: ICustomElementController | null, viewModel?: any): any => viewModel;
const forOpts = { optional: true } as const;
const filterChildren = (
controller: ICustomElementController,
query: typeof defaultChildQuery,
filter: typeof defaultChildFilter,
map: typeof defaultChildMap
// eslint-disable-next-line @typescript-eslint/no-explicit-any
): any[] => {
const nodes = query(controller);
const ii = nodes.length;
const children: unknown[] = [];
let node: INode;
let $controller: ICustomElementController | null;
let viewModel: ICustomElementViewModel | null;
let i = 0;
for (; i < ii; ++i) {
node = nodes[i];
$controller = findElementControllerFor(node, forOpts);
viewModel = $controller?.viewModel ?? null;
if (filter(node, $controller, viewModel)) {
children.push(map(node, $controller, viewModel));
}
}
return children;
};
class ChildrenLifecycleHooks {

@@ -244,11 +221,14 @@ public constructor(

const $def = this._def;
const query = $def.query ?? '*';
const childrenObserver = new ChildrenBinding(
controller,
controller.host,
vm,
vm[$def.callback ?? `${safeString($def.name)}Changed`] as () => void,
$def.query ?? defaultChildQuery,
$def.filter ?? defaultChildFilter,
$def.map ?? defaultChildMap,
$def.options ?? childObserverOptions,
query,
$def.filter as PartialChildrenDefinition<'$all'>['filter'],
$def.map as PartialChildrenDefinition<'$all'>['map'],
);
if (/[\s>]/.test(query)) {
throw createMappedError(ErrorNames.children_invalid_query, query);
}
def(vm, $def.name, {

@@ -269,2 +249,19 @@ enumerable: true,

let mixed = false;
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/ban-ts-comment */
function testChildrenDecorator() {
class MyEl {
@children({
filter: (element) => element.getAttribute('hey') == null,
map: el => el.style
})
@children({
map: node => node.style
})
@children({
query: '$all',
// @ts-expect-error
map: node => node.style
})
public nodes: unknown[] = [];
}
}

@@ -144,2 +144,3 @@ import { emptyArray, type IContainer, type IIndexable, type IServiceLocator, type Key } from '@aurelia/kernel';

const $nodes: Node[] = [];
const query = this._query;
let $slot: IAuSlot;

@@ -149,3 +150,3 @@ let node: Node;

for (node of $slot === slot ? nodes : $slot.nodes) {
if (this._query === '*' || (isElement(node) && node.matches(this._query))) {
if (query === '$all' || (isElement(node) && (query === '*' || node.matches(query)))) {
$nodes[$nodes.length] = node;

@@ -152,0 +153,0 @@ }

import { createInterface, singletonRegistration } from '../utilities-di';
import { getOwnPropertyNames, objectFreeze, baseObjectPrototype } from '../utilities';
import { type Constructable, type IContainer, type AnyFunction, type FunctionPropNames, Registrable } from '@aurelia/kernel';
import { type Constructable, type IContainer, type AnyFunction, type FunctionPropNames, IRegistry, registrableMetadataKey } from '@aurelia/kernel';

@@ -66,3 +66,3 @@ export type LifecycleHook<TViewModel, TKey extends keyof TViewModel> =

*/
define<T extends Constructable>(def: {}, Type: T): T {
define<T extends Constructable>(def: {}, Type: T): IRegistry {
const definition = LifecycleHooksDefinition.create(def, Type);

@@ -73,5 +73,7 @@ const $Type = definition.Type;

return Registrable.define($Type, container => {
singletonRegistration(ILifecycleHooks, $Type).register(container);
});
return {
register(container: IContainer): void {
singletonRegistration(ILifecycleHooks, $Type).register(container);
}
};
},

@@ -128,5 +130,7 @@ /**

function decorator<T extends Constructable>(target: T, context: ClassDecoratorContext): T {
return LifecycleHooks.define({}, target);
const metadata = context?.metadata ?? (target[Symbol.metadata] ??= Object.create(null));
metadata[registrableMetadataKey] = LifecycleHooks.define({}, target);
return target;
}
return target == null ? decorator : decorator(target, context!);
}

@@ -1,2 +0,2 @@

import { IContainer, resolve } from '@aurelia/kernel';
import { createLookup, isString, IContainer, resolve } from '@aurelia/kernel';
import { IExpressionParser } from '@aurelia/expression-parser';

@@ -9,3 +9,2 @@ import { IObserverLocator } from '@aurelia/runtime';

import { CustomElementDefinition, PartialCustomElementDefinition } from '../resources/custom-element';
import { createLookup, isString } from '../utilities';
import { IViewFactory, ViewFactory } from './view';

@@ -12,0 +11,0 @@ import type { IHydratableController } from './controller';

@@ -0,7 +1,6 @@

import { isString, type IContainer } from '@aurelia/kernel';
import { CustomElementDefinition } from '../resources/custom-element';
import { isString } from '../utilities';
import { createInterface } from '../utilities-di';
import { Controller } from './controller';
import type { IContainer } from '@aurelia/kernel';
import type { ICustomAttributeController, ICustomElementController, ISyntheticView } from './controller';

@@ -8,0 +7,0 @@

@@ -0,1 +1,2 @@

import { areEqual, type IServiceLocator } from '@aurelia/kernel';
import {

@@ -12,3 +13,2 @@ connectable,

import type { IServiceLocator } from '@aurelia/kernel';
import type {

@@ -23,3 +23,2 @@ ICollectionSubscriber,

import type { IWatcherCallback } from '../watch';
import { areEqual } from '../utilities';
import { IsBindingBehavior } from '@aurelia/expression-parser';

@@ -26,0 +25,0 @@ import { IBinding } from '../binding/interfaces-bindings';

@@ -8,6 +8,6 @@ import {

type IContainer,
type IDisposableResolver,
} from '@aurelia/kernel';
import { defineMetadata, getAnnotationKeyFor, getMetadata } from './utilities-metadata';
import { IResourceKind } from './resources/resources-shared';
import { IDisposableResolver } from '@aurelia/kernel/dist/types/di';

@@ -14,0 +14,0 @@ /** @internal */

import { AccessorType, type ISubscriber } from '@aurelia/runtime';
import { type ISVGAnalyzer } from './observation/svg-analyzer';
import { type ISignaler } from './signaler';
import { createLookup, isString } from '@aurelia/kernel';

@@ -11,6 +12,2 @@ const O = Object;

/** @internal */ export const createLookup = <T = unknown>() => O.create(null) as Record<string, T>;
/** @internal */ export const createError = (message: string) => new Error(message);
/** @internal */ export const hasOwnProperty = baseObjectPrototype.hasOwnProperty;

@@ -44,16 +41,3 @@

/** @internal */ export const isPromise = <T>(v: unknown): v is Promise<T> => v instanceof Promise;
/** @internal */ export const isArray = <T>(v: unknown): v is T[] => v instanceof Array;
/** @internal */ export const isSet = <T>(v: unknown): v is Set<T> => v instanceof Set;
/** @internal */ export const isMap = <T, K>(v: unknown): v is Map<T, K> => v instanceof Map;
// eslint-disable-next-line @typescript-eslint/ban-types
/** @internal */ export const isFunction = <K extends Function>(v: unknown): v is K => typeof v === 'function';
/** @internal */ export const isObject = (v: unknown): v is object => v instanceof O;
/** @internal */ export const isString = (v: unknown): v is string => typeof v === 'string';
/** @internal */ export const isSymbol = (v: unknown): v is string => typeof v === 'symbol';
/** @internal */ export const isNumber = (v: unknown): v is number => typeof v === 'number';
/** @internal */ export const rethrow = (err: unknown) => { throw err; };
/** @internal */ export const areEqual = O.is;

@@ -60,0 +44,0 @@ /** @internal */

@@ -1,5 +0,5 @@

import { emptyArray } from '@aurelia/kernel';
import { emptyArray, isFunction } from '@aurelia/kernel';
import { getAttributeDefinition, isAttributeType } from './resources/custom-attribute';
import { getElementDefinition, isElementType } from './resources/custom-element';
import { isFunction, objectFreeze, safeString } from './utilities';
import { objectFreeze, safeString } from './utilities';

@@ -6,0 +6,0 @@ import type { Constructable } from '@aurelia/kernel';

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 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc