Socket
Socket
Sign inDemoInstall

@aurelia/runtime

Package Overview
Dependencies
Maintainers
1
Versions
1110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aurelia/runtime - npm Package Compare versions

Comparing version 2.1.0-dev.202401061915 to 2.1.0-dev.202401281151

96

dist/types/binding/ast.d.ts

@@ -7,35 +7,3 @@ import type { IBinding, IConnectable } from '../observation';

export { astVisit, IVisitor, Unparser } from './ast.visitor';
export declare const enum ExpressionKind {
AccessThis = 0,
AccessGlobal = 1,
AccessScope = 2,
ArrayLiteral = 3,
ObjectLiteral = 4,
PrimitiveLiteral = 5,
Template = 6,
Unary = 7,
CallScope = 8,
CallMember = 9,
CallFunction = 10,
CallGlobal = 11,
AccessMember = 12,
AccessKeyed = 13,
TaggedTemplate = 14,
Binary = 15,
Conditional = 16,
Assign = 17,
ArrowFunction = 18,
ValueConverter = 19,
BindingBehavior = 20,
ArrayBindingPattern = 21,
ObjectBindingPattern = 22,
BindingIdentifier = 23,
ForOfStatement = 24,
Interpolation = 25,
ArrayDestructuring = 26,
ObjectDestructuring = 27,
DestructuringAssignmentLeaf = 28,
DestructuringAssignmentRestLeaf = 29,
Custom = 30
}
export type ExpressionKind = 'AccessThis' | 'AccessGlobal' | 'AccessScope' | 'ArrayLiteral' | 'ObjectLiteral' | 'PrimitiveLiteral' | 'Template' | 'Unary' | 'CallScope' | 'CallMember' | 'CallFunction' | 'CallGlobal' | 'AccessMember' | 'AccessKeyed' | 'TaggedTemplate' | 'Binary' | 'Conditional' | 'Assign' | 'ArrowFunction' | 'ValueConverter' | 'BindingBehavior' | 'ArrayBindingPattern' | 'ObjectBindingPattern' | 'BindingIdentifier' | 'ForOfStatement' | 'Interpolation' | 'ArrayDestructuring' | 'ObjectDestructuring' | 'DestructuringAssignmentLeaf' | 'Custom';
export type UnaryOperator = 'void' | 'typeof' | '!' | '-' | '+';

@@ -59,3 +27,3 @@ export type BinaryOperator = '??' | '&&' | '||' | '==' | '===' | '!=' | '!==' | 'instanceof' | 'in' | '+' | '-' | '*' | '/' | '%' | '<' | '>' | '<=' | '>=';

readonly value: unknown;
readonly $kind = ExpressionKind.Custom;
readonly $kind = "Custom";
constructor(value: unknown);

@@ -77,3 +45,3 @@ evaluate(_s: Scope, _e: IAstEvaluator | null, _c: IConnectable | null): unknown;

readonly args: readonly IsAssign[];
readonly $kind = ExpressionKind.BindingBehavior;
readonly $kind = "BindingBehavior";
/**

@@ -94,3 +62,3 @@ * The name of the property to store a binding behavior on the binding when binding

readonly args: readonly IsAssign[];
readonly $kind = ExpressionKind.ValueConverter;
readonly $kind = "ValueConverter";
constructor(expression: IsValueConverter, name: string, args: readonly IsAssign[]);

@@ -101,3 +69,3 @@ }

readonly value: IsAssign;
readonly $kind = ExpressionKind.Assign;
readonly $kind = "Assign";
constructor(target: IsAssignable, value: IsAssign);

@@ -109,3 +77,3 @@ }

readonly no: IsAssign;
readonly $kind = ExpressionKind.Conditional;
readonly $kind = "Conditional";
constructor(condition: IsBinary, yes: IsAssign, no: IsAssign);

@@ -115,3 +83,3 @@ }

readonly name: string;
readonly $kind: ExpressionKind.AccessGlobal;
readonly $kind: 'AccessGlobal';
constructor(name: string);

@@ -121,3 +89,3 @@ }

readonly ancestor: number;
readonly $kind: ExpressionKind.AccessThis;
readonly $kind: 'AccessThis';
constructor(ancestor?: number);

@@ -128,3 +96,3 @@ }

readonly ancestor: number;
readonly $kind = ExpressionKind.AccessScope;
readonly $kind = "AccessScope";
constructor(name: string, ancestor?: number);

@@ -136,3 +104,3 @@ }

readonly optional: boolean;
readonly $kind: ExpressionKind.AccessMember;
readonly $kind: 'AccessMember';
readonly accessGlobal: boolean;

@@ -145,3 +113,3 @@ constructor(object: IsLeftHandSide, name: string, optional?: boolean);

readonly optional: boolean;
readonly $kind = ExpressionKind.AccessKeyed;
readonly $kind = "AccessKeyed";
readonly accessGlobal: boolean;

@@ -155,3 +123,3 @@ constructor(object: IsLeftHandSide, key: IsAssign, optional?: boolean);

readonly optional: boolean;
readonly $kind = ExpressionKind.CallScope;
readonly $kind = "CallScope";
constructor(name: string, args: readonly IsAssign[], ancestor?: number, optional?: boolean);

@@ -165,3 +133,3 @@ }

readonly optionalCall: boolean;
readonly $kind = ExpressionKind.CallMember;
readonly $kind = "CallMember";
constructor(object: IsLeftHandSide, name: string, args: readonly IsAssign[], optionalMember?: boolean, optionalCall?: boolean);

@@ -173,3 +141,3 @@ }

readonly optional: boolean;
readonly $kind = ExpressionKind.CallFunction;
readonly $kind = "CallFunction";
constructor(func: IsLeftHandSide, args: readonly IsAssign[], optional?: boolean);

@@ -180,3 +148,3 @@ }

readonly args: readonly IsAssign[];
readonly $kind = ExpressionKind.CallGlobal;
readonly $kind = "CallGlobal";
constructor(name: string, args: readonly IsAssign[]);

@@ -188,3 +156,3 @@ }

readonly right: IsBinary;
readonly $kind: ExpressionKind.Binary;
readonly $kind: 'Binary';
constructor(operation: BinaryOperator, left: IsBinary, right: IsBinary);

@@ -195,3 +163,3 @@ }

readonly expression: IsLeftHandSide;
readonly $kind = ExpressionKind.Unary;
readonly $kind = "Unary";
constructor(operation: UnaryOperator, expression: IsLeftHandSide);

@@ -206,3 +174,3 @@ }

static readonly $empty: PrimitiveLiteralExpression<string>;
readonly $kind = ExpressionKind.PrimitiveLiteral;
readonly $kind = "PrimitiveLiteral";
constructor(value: TValue);

@@ -213,3 +181,3 @@ }

static readonly $empty: ArrayLiteralExpression;
readonly $kind = ExpressionKind.ArrayLiteral;
readonly $kind = "ArrayLiteral";
constructor(elements: readonly IsAssign[]);

@@ -221,3 +189,3 @@ }

static readonly $empty: ObjectLiteralExpression;
readonly $kind = ExpressionKind.ObjectLiteral;
readonly $kind = "ObjectLiteral";
constructor(keys: readonly (number | string)[], values: readonly IsAssign[]);

@@ -229,3 +197,3 @@ }

static readonly $empty: TemplateExpression;
readonly $kind = ExpressionKind.Template;
readonly $kind = "Template";
constructor(cooked: readonly string[], expressions?: readonly IsAssign[]);

@@ -239,3 +207,3 @@ }

readonly expressions: readonly IsAssign[];
readonly $kind = ExpressionKind.TaggedTemplate;
readonly $kind = "TaggedTemplate";
constructor(cooked: readonly string[] & {

@@ -247,3 +215,3 @@ raw?: readonly string[];

readonly elements: readonly IsAssign[];
readonly $kind = ExpressionKind.ArrayBindingPattern;
readonly $kind = "ArrayBindingPattern";
constructor(elements: readonly IsAssign[]);

@@ -254,3 +222,3 @@ }

readonly values: readonly IsAssign[];
readonly $kind = ExpressionKind.ObjectBindingPattern;
readonly $kind = "ObjectBindingPattern";
constructor(keys: readonly (string | number)[], values: readonly IsAssign[]);

@@ -260,3 +228,3 @@ }

readonly name: string;
readonly $kind = ExpressionKind.BindingIdentifier;
readonly $kind = "BindingIdentifier";
constructor(name: string);

@@ -268,3 +236,3 @@ }

readonly semiIdx: number;
readonly $kind = ExpressionKind.ForOfStatement;
readonly $kind = "ForOfStatement";
constructor(declaration: BindingIdentifierOrPattern | DestructuringAssignmentExpression, iterable: IsBindingBehavior, semiIdx: number);

@@ -275,3 +243,3 @@ }

readonly expressions: readonly IsBindingBehavior[];
readonly $kind = ExpressionKind.Interpolation;
readonly $kind = "Interpolation";
readonly isMulti: boolean;

@@ -283,7 +251,7 @@ readonly firstExpression: IsBindingBehavior;

export declare class DestructuringAssignmentExpression {
readonly $kind: ExpressionKind.ArrayDestructuring | ExpressionKind.ObjectDestructuring;
readonly $kind: 'ArrayDestructuring' | 'ObjectDestructuring';
readonly list: readonly (DestructuringAssignmentExpression | DestructuringAssignmentSingleExpression | DestructuringAssignmentRestExpression)[];
readonly source: AccessMemberExpression | AccessKeyedExpression | undefined;
readonly initializer: IsBindingBehavior | undefined;
constructor($kind: ExpressionKind.ArrayDestructuring | ExpressionKind.ObjectDestructuring, list: readonly (DestructuringAssignmentExpression | DestructuringAssignmentSingleExpression | DestructuringAssignmentRestExpression)[], source: AccessMemberExpression | AccessKeyedExpression | undefined, initializer: IsBindingBehavior | undefined);
constructor($kind: 'ArrayDestructuring' | 'ObjectDestructuring', list: readonly (DestructuringAssignmentExpression | DestructuringAssignmentSingleExpression | DestructuringAssignmentRestExpression)[], source: AccessMemberExpression | AccessKeyedExpression | undefined, initializer: IsBindingBehavior | undefined);
}

@@ -295,3 +263,3 @@ /** This is an internal API */

readonly initializer: IsBindingBehavior | undefined;
readonly $kind = ExpressionKind.DestructuringAssignmentLeaf;
readonly $kind = "DestructuringAssignmentLeaf";
constructor(target: AccessMemberExpression, source: AccessMemberExpression | AccessKeyedExpression, initializer: IsBindingBehavior | undefined);

@@ -303,3 +271,3 @@ }

readonly indexOrProperties: string[] | number;
readonly $kind = ExpressionKind.DestructuringAssignmentLeaf;
readonly $kind = "DestructuringAssignmentLeaf";
constructor(target: AccessMemberExpression, indexOrProperties: string[] | number);

@@ -311,3 +279,3 @@ }

rest: boolean;
readonly $kind = ExpressionKind.ArrowFunction;
readonly $kind = "ArrowFunction";
constructor(args: BindingIdentifier[], body: IsAssign, rest?: boolean);

@@ -314,0 +282,0 @@ }

@@ -6,5 +6,5 @@ import { ForOfStatement, Interpolation, AnyBindingExpression, IsBindingBehavior } from './ast';

export declare class ExpressionParser {
parse(expression: string, expressionType: ExpressionType.IsIterator): ForOfStatement;
parse(expression: string, expressionType: ExpressionType.Interpolation): Interpolation;
parse(expression: string, expressionType: Exclude<ExpressionType, ExpressionType.IsIterator | ExpressionType.Interpolation>): IsBindingBehavior;
parse(expression: string, expressionType: 'IsIterator'): ForOfStatement;
parse(expression: string, expressionType: 'Interpolation'): Interpolation;
parse(expression: string, expressionType: Exclude<ExpressionType, 'IsIterator' | 'Interpolation'>): IsBindingBehavior;
parse(expression: string, expressionType: ExpressionType): AnyBindingExpression;

@@ -28,11 +28,10 @@ }

}
export declare const enum ExpressionType {
None = 0,
Interpolation = 1,
IsIterator = 2,
IsChainable = 4,
IsFunction = 8,
IsProperty = 16,
IsCustom = 32
}
declare const etNone: "None";
declare const etInterpolation: "Interpolation";
declare const etIsIterator: "IsIterator";
declare const etIsChainable: "IsChainable";
declare const etIsFunction: "IsFunction";
declare const etIsProperty: "IsProperty";
declare const etIsCustom: "IsCustom";
export type ExpressionType = typeof etNone | typeof etInterpolation | typeof etIsIterator | typeof etIsChainable | typeof etIsFunction | typeof etIsProperty | typeof etIsCustom;
export declare function parseExpression(input: string, expressionType?: ExpressionType): AnyBindingExpression;

@@ -39,0 +38,0 @@ export declare function parse(minPrecedence: Precedence, expressionType: ExpressionType): AnyBindingExpression;

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

export { ExpressionKind, CallFunctionExpression, CustomExpression, BindingBehaviorExpression, ValueConverterExpression, AssignExpression, ConditionalExpression, AccessThisExpression, AccessGlobalExpression, AccessScopeExpression, AccessMemberExpression, AccessKeyedExpression, CallScopeExpression, CallMemberExpression, BinaryExpression, UnaryExpression, PrimitiveLiteralExpression, ArrayLiteralExpression, ObjectLiteralExpression, TemplateExpression, TaggedTemplateExpression, ArrayBindingPattern, ObjectBindingPattern, BindingIdentifier, ForOfStatement, Interpolation, DestructuringAssignmentExpression, DestructuringAssignmentSingleExpression, DestructuringAssignmentRestExpression, ArrowFunction, astVisit, Unparser, type AnyBindingExpression, type BindingBehaviorInstance, type IsPrimary, type IsLiteral, type IsLeftHandSide, type IsUnary, type IsBinary, type IsConditional, type IsAssign, type IsValueConverter, type IsBindingBehavior, type IsAssignable, type IsExpression, type IsExpressionOrStatement, type IVisitor, type BinaryOperator, type BindingIdentifierOrPattern, type UnaryOperator, type IAstEvaluator, type ValueConverterInstance, } from './binding/ast';
export { type ExpressionKind, CallFunctionExpression, CustomExpression, BindingBehaviorExpression, ValueConverterExpression, AssignExpression, ConditionalExpression, AccessThisExpression, AccessGlobalExpression, AccessScopeExpression, AccessMemberExpression, AccessKeyedExpression, CallScopeExpression, CallMemberExpression, BinaryExpression, UnaryExpression, PrimitiveLiteralExpression, ArrayLiteralExpression, ObjectLiteralExpression, TemplateExpression, TaggedTemplateExpression, ArrayBindingPattern, ObjectBindingPattern, BindingIdentifier, ForOfStatement, Interpolation, DestructuringAssignmentExpression, DestructuringAssignmentSingleExpression, DestructuringAssignmentRestExpression, ArrowFunction, astVisit, Unparser, type AnyBindingExpression, type BindingBehaviorInstance, type IsPrimary, type IsLiteral, type IsLeftHandSide, type IsUnary, type IsBinary, type IsConditional, type IsAssign, type IsValueConverter, type IsBindingBehavior, type IsAssignable, type IsExpression, type IsExpressionOrStatement, type IVisitor, type BinaryOperator, type BindingIdentifierOrPattern, type UnaryOperator, type IAstEvaluator, type ValueConverterInstance, } from './binding/ast';
export { astAssign, astBind, astEvaluate, astUnbind, } from './binding/ast.eval';
export { type IConnectableBinding, connectable, BindingObserverRecord, } from './binding/connectable';
export { IExpressionParser, ExpressionType, parseExpression, } from './binding/expression-parser';
export { IExpressionParser, type ExpressionType, parseExpression, } from './binding/expression-parser';
export { ArrayObserver, ArrayIndexObserver, enableArrayObservation, disableArrayObservation, type IArrayIndexObserver, } from './observation/array-observer';

@@ -24,3 +24,3 @@ export { MapObserver, enableMapObservation, disableMapObservation, } from './observation/map-observer';

export { ConnectableSwitcher, } from './observation/connectable-switcher';
export { type AccessorOrObserver, type IRateLimitOptions, type IBinding, AccessorType, type Collection, CollectionKind, type IAccessor, type IBindingContext, type ICollectionChangeTracker, type ICollectionObserver, type IConnectable, type ICollectionSubscriber, type IndexMap, type IObserver, type IObservable, type IOverrideContext, type InterceptorFunc, type ISubscribable, type ISubscriberCollection, type CollectionObserver, type ICollectionSubscriberCollection, type ICollectionSubscribable, type ISubscriber, type ISubscriberRecord, isIndexMap, copyIndexMap, cloneIndexMap, createIndexMap, ICoercionConfiguration, } from './observation';
export { type AccessorOrObserver, type IRateLimitOptions, type IBinding, AccessorType, type Collection, type CollectionKind, type IAccessor, type IBindingContext, type ICollectionChangeTracker, type ICollectionObserver, type IConnectable, type ICollectionSubscriber, type IndexMap, type IObserver, type IObservable, type IOverrideContext, type InterceptorFunc, type ISubscribable, type ISubscriberCollection, type CollectionObserver, type ICollectionSubscriberCollection, type ICollectionSubscribable, type ISubscriber, type ISubscriberRecord, isIndexMap, copyIndexMap, cloneIndexMap, createIndexMap, ICoercionConfiguration, } from './observation';
//# sourceMappingURL=index.d.ts.map

@@ -92,19 +92,13 @@ import { IDisposable, IIndexable, IServiceLocator } from '@aurelia/kernel';

export type Collection = unknown[] | Set<unknown> | Map<unknown, unknown>;
export declare const enum CollectionKind {
indexed = 8,
keyed = 4,
array = 9,
map = 6,
set = 7
}
export type CollectionKind = 'indexed' | 'keyed' | 'array' | 'map' | 'set';
export type LengthPropertyName<T> = T extends unknown[] ? 'length' : T extends Set<unknown> ? 'size' : T extends Map<unknown, unknown> ? 'size' : never;
export type CollectionTypeToKind<T> = T extends unknown[] ? CollectionKind.array | CollectionKind.indexed : T extends Set<unknown> ? CollectionKind.set | CollectionKind.keyed : T extends Map<unknown, unknown> ? CollectionKind.map | CollectionKind.keyed : never;
export type CollectionKindToType<T> = T extends CollectionKind.array ? unknown[] : T extends CollectionKind.indexed ? unknown[] : T extends CollectionKind.map ? Map<unknown, unknown> : T extends CollectionKind.set ? Set<unknown> : T extends CollectionKind.keyed ? Set<unknown> | Map<unknown, unknown> : never;
export type ObservedCollectionKindToType<T> = T extends CollectionKind.array ? unknown[] : T extends CollectionKind.indexed ? unknown[] : T extends CollectionKind.map ? Map<unknown, unknown> : T extends CollectionKind.set ? Set<unknown> : T extends CollectionKind.keyed ? Map<unknown, unknown> | Set<unknown> : never;
export declare const enum AccessorType {
None = 0,
Observer = 1,
Node = 2,
Layout = 4
}
export type CollectionKindToType<T> = T extends 'array' ? unknown[] : T extends 'indexed' ? unknown[] : T extends 'map' ? Map<unknown, unknown> : T extends 'set' ? Set<unknown> : T extends 'keyed' ? Set<unknown> | Map<unknown, unknown> : never;
export type ObservedCollectionKindToType<T> = T extends 'array' ? unknown[] : T extends 'indexed' ? unknown[] : T extends 'map' ? Map<unknown, unknown> : T extends 'set' ? Set<unknown> : T extends 'keyed' ? Map<unknown, unknown> | Set<unknown> : never;
export declare const AccessorType: Readonly<{
readonly None: 0;
readonly Observer: 1;
readonly Node: 2;
readonly Layout: 4;
}>;
export type AccessorType = typeof AccessorType[keyof typeof AccessorType];
/**

@@ -159,3 +153,3 @@ * Basic interface to normalize getting/setting a value of any property on any object

collection: ObservedCollectionKindToType<T>;
getLengthObserver(): T extends CollectionKind.array ? CollectionLengthObserver : CollectionSizeObserver;
getLengthObserver(): T extends 'array' ? CollectionLengthObserver : CollectionSizeObserver;
notify(): void;

@@ -162,0 +156,0 @@ }

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

import { AccessorType, type ISubscriberCollection, type ICollectionSubscriberCollection, type IObserver, type CollectionKind, type ICollectionObserver, type IndexMap, type ISubscriber } from '../observation';
import { type AccessorType, type ISubscriberCollection, type ICollectionSubscriberCollection, type IObserver, type ICollectionObserver, type IndexMap, type ISubscriber } from '../observation';
import { CollectionLengthObserver } from './collection-length-observer';
export declare function enableArrayObservation(): void;
export declare function disableArrayObservation(): void;
export interface ArrayObserver extends ICollectionObserver<CollectionKind.array>, ICollectionSubscriberCollection {
export interface ArrayObserver extends ICollectionObserver<'array'>, ICollectionSubscriberCollection {
}

@@ -17,3 +17,3 @@ export declare class ArrayObserver {

export interface IArrayIndexObserver extends IObserver {
owner: ICollectionObserver<CollectionKind.array>;
owner: ICollectionObserver<'array'>;
}

@@ -20,0 +20,0 @@ export interface ArrayIndexObserver extends IArrayIndexObserver, ISubscriberCollection {

@@ -1,9 +0,9 @@

import { AccessorType, Collection, CollectionKind, IObserver } from '../observation';
import type { ICollectionObserver, IndexMap, ISubscriberCollection, ICollectionSubscriber } from '../observation';
import { Collection, IObserver } from '../observation';
import type { AccessorType, ICollectionObserver, IndexMap, ISubscriberCollection, ICollectionSubscriber } from '../observation';
export interface CollectionLengthObserver extends ISubscriberCollection {
}
export declare class CollectionLengthObserver implements IObserver, ICollectionSubscriber {
readonly owner: ICollectionObserver<CollectionKind.array>;
readonly owner: ICollectionObserver<'array'>;
readonly type: AccessorType;
constructor(owner: ICollectionObserver<CollectionKind.array>);
constructor(owner: ICollectionObserver<'array'>);
getValue(): number;

@@ -16,5 +16,5 @@ setValue(newValue: number): void;

export declare class CollectionSizeObserver implements ICollectionSubscriber {
readonly owner: ICollectionObserver<CollectionKind.map | CollectionKind.set>;
readonly owner: ICollectionObserver<'map' | 'set'>;
readonly type: AccessorType;
constructor(owner: ICollectionObserver<CollectionKind.map | CollectionKind.set>);
constructor(owner: ICollectionObserver<'map' | 'set'>);
getValue(): number;

@@ -21,0 +21,0 @@ setValue(): void;

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

import { AccessorType, ICoercionConfiguration, IObserver, InterceptorFunc } from '../observation';
import type { ISubscriber, ICollectionSubscriber, ISubscriberCollection, IConnectable } from '../observation';
import { ICoercionConfiguration, IObserver, InterceptorFunc } from '../observation';
import type { AccessorType, ISubscriber, ICollectionSubscriber, ISubscriberCollection, IConnectable } from '../observation';
import type { IConnectableBinding } from '../binding/connectable';

@@ -4,0 +4,0 @@ import type { IObserverLocator } from './observer-locator';

import { IContainer, IPlatform } from '@aurelia/kernel';
import { AccessorType, type IObserver, type ISubscriberCollection, type IObservable, type ISubscriber } from '../observation';
import { type AccessorType, type IObserver, type ISubscriberCollection, type IObservable, type ISubscriber } from '../observation';
import type { IIndexable } from '@aurelia/kernel';

@@ -4,0 +4,0 @@ export interface IDirtyChecker extends DirtyChecker {

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

import { AccessorType } from '../observation';
import { CollectionSizeObserver } from './collection-length-observer';
import type { CollectionKind, ICollectionObserver, ICollectionSubscriberCollection } from '../observation';
import type { AccessorType, ICollectionObserver, ICollectionSubscriberCollection } from '../observation';
export declare function enableMapObservation(): void;
export declare function disableMapObservation(): void;
export interface MapObserver extends ICollectionObserver<CollectionKind.map>, ICollectionSubscriberCollection {
export interface MapObserver extends ICollectionObserver<'map'>, ICollectionSubscriberCollection {
}

@@ -8,0 +7,0 @@ export declare class MapObserver {

import { ComputedGetterFn } from './computed-observer';
import { IDirtyChecker } from './dirty-checker';
import { PropertyAccessor } from './property-accessor';
import type { Collection, IAccessor, ICollectionObserver, IObserver, AccessorOrObserver, CollectionKind, CollectionObserver } from '../observation';
import type { Collection, IAccessor, ICollectionObserver, IObserver, AccessorOrObserver, CollectionObserver } from '../observation';
export declare const propertyAccessor: PropertyAccessor;

@@ -34,5 +34,5 @@ export interface IObjectObservationAdapter {

getAccessor(obj: object, key: PropertyKey): AccessorOrObserver;
getArrayObserver(observedArray: unknown[]): ICollectionObserver<CollectionKind.array>;
getMapObserver(observedMap: Map<unknown, unknown>): ICollectionObserver<CollectionKind.map>;
getSetObserver(observedSet: Set<unknown>): ICollectionObserver<CollectionKind.set>;
getArrayObserver(observedArray: unknown[]): ICollectionObserver<'array'>;
getMapObserver(observedMap: Map<unknown, unknown>): ICollectionObserver<'map'>;
getSetObserver(observedSet: Set<unknown>): ICollectionObserver<'set'>;
private createObserver;

@@ -39,0 +39,0 @@ }

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

import { AccessorType } from '../observation';
import type { Primitive } from '@aurelia/kernel';
import type { IAccessor, ISubscribable } from '../observation';
import type { AccessorType, IAccessor, ISubscribable } from '../observation';
export declare class PrimitiveObserver implements IAccessor, ISubscribable {

@@ -5,0 +4,0 @@ get doNotCache(): true;

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

import { AccessorType } from '../observation';
import type { IAccessor } from '../observation';
import type { AccessorType, IAccessor } from '../observation';
export declare class PropertyAccessor implements IAccessor {

@@ -4,0 +3,0 @@ type: AccessorType;

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

import { AccessorType, type ICollectionSubscriberCollection, type ICollectionObserver, type CollectionKind } from '../observation';
import { type AccessorType, type ICollectionSubscriberCollection, type ICollectionObserver } from '../observation';
import { CollectionSizeObserver } from './collection-length-observer';
export declare function enableSetObservation(): void;
export declare function disableSetObservation(): void;
export interface SetObserver extends ICollectionObserver<CollectionKind.set>, ICollectionSubscriberCollection {
export interface SetObserver extends ICollectionObserver<'set'>, ICollectionSubscriberCollection {
}

@@ -7,0 +7,0 @@ export declare class SetObserver {

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

import { AccessorType, ICoercionConfiguration, IObserver, InterceptorFunc } from '../observation';
import { ICoercionConfiguration, IObserver, InterceptorFunc } from '../observation';
import type { IIndexable } from '@aurelia/kernel';
import type { ISubscriber, ISubscriberCollection } from '../observation';
import type { AccessorType, ISubscriber, ISubscriberCollection } from '../observation';
export interface SetterObserver extends ISubscriberCollection {

@@ -5,0 +5,0 @@ }

{
"name": "@aurelia/runtime",
"version": "2.1.0-dev.202401061915",
"version": "2.1.0-dev.202401281151",
"main": "dist/cjs/index.cjs",

@@ -56,5 +56,5 @@ "module": "dist/esm/index.mjs",

"dependencies": {
"@aurelia/kernel": "2.1.0-dev.202401061915",
"@aurelia/metadata": "2.1.0-dev.202401061915",
"@aurelia/platform": "2.1.0-dev.202401061915"
"@aurelia/kernel": "2.1.0-dev.202401281151",
"@aurelia/metadata": "2.1.0-dev.202401281151",
"@aurelia/platform": "2.1.0-dev.202401281151"
},

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

@@ -7,3 +7,2 @@ /* eslint-disable no-fallthrough */

import {
ExpressionKind,
type IsExpressionOrStatement,

@@ -14,3 +13,33 @@ type IAstEvaluator,

DestructuringAssignmentSingleExpression,
BindingBehaviorInstance
BindingBehaviorInstance,
ekAccessThis,
ekAccessScope,
ekAccessGlobal,
ekCallGlobal,
ekArrayLiteral,
ekObjectLiteral,
ekPrimitiveLiteral,
ekTemplate,
ekUnary,
ekCallScope,
ekArrowFunction,
ekCallFunction,
ekCallMember,
ekAccessMember,
ekAccessKeyed,
ekTaggedTemplate,
ekBinary,
ekConditional,
ekAssign,
ekValueConverter,
ekBindingBehavior,
ekBindingIdentifier,
ekForOfStatement,
ekInterpolation,
ekArrayDestructuring,
ekDestructuringAssignmentLeaf,
ekArrayBindingPattern,
ekObjectBindingPattern,
ekObjectDestructuring,
ekCustom
} from './ast';

@@ -24,3 +53,3 @@ import { IConnectableBinding } from './connectable';

switch (ast.$kind) {
case ExpressionKind.AccessThis: {
case ekAccessThis: {
let oc: IOverrideContext | null = s.overrideContext;

@@ -35,3 +64,3 @@ let currentScope: Scope | null = s;

}
case ExpressionKind.AccessScope: {
case ekAccessScope: {
const obj = getContext(s, ast.name, ast.ancestor) as IBindingContext;

@@ -57,5 +86,5 @@ if (c !== null) {

}
case ExpressionKind.AccessGlobal:
case ekAccessGlobal:
return globalThis[ast.name as keyof typeof globalThis];
case ExpressionKind.CallGlobal: {
case ekCallGlobal: {
const func = globalThis[ast.name as keyof typeof globalThis] as AnyFunction;

@@ -71,5 +100,5 @@ if (isFunction(func)) {

}
case ExpressionKind.ArrayLiteral:
case ekArrayLiteral:
return ast.elements.map(expr => astEvaluate(expr, s, e, c));
case ExpressionKind.ObjectLiteral: {
case ekObjectLiteral: {
const instance: Record<string, unknown> = {};

@@ -81,5 +110,5 @@ for (let i = 0; i < ast.keys.length; ++i) {

}
case ExpressionKind.PrimitiveLiteral:
case ekPrimitiveLiteral:
return ast.value;
case ExpressionKind.Template: {
case ekTemplate: {
let result = ast.cooked[0];

@@ -92,3 +121,3 @@ for (let i = 0; i < ast.expressions.length; ++i) {

}
case ExpressionKind.Unary:
case ekUnary:
switch (ast.operation as string) {

@@ -108,3 +137,3 @@ case 'void':

}
case ExpressionKind.CallScope: {
case ekCallScope: {
const args = ast.args.map(a => astEvaluate(a, s, e, c));

@@ -121,3 +150,3 @@ const context = getContext(s, ast.name, ast.ancestor)!;

}
case ExpressionKind.CallMember: {
case ekCallMember: {
const instance = astEvaluate(ast.object, s, e, c) as IIndexable;

@@ -138,3 +167,3 @@

}
case ExpressionKind.CallFunction: {
case ekCallFunction: {
const func = astEvaluate(ast.func, s, e, c);

@@ -149,3 +178,3 @@ if (isFunction(func)) {

}
case ExpressionKind.ArrowFunction: {
case ekArrowFunction: {
const func = (...args: unknown[]) => {

@@ -168,3 +197,3 @@ const params = ast.args;

}
case ExpressionKind.AccessMember: {
case ekAccessMember: {
const instance = astEvaluate(ast.object, s, e, c) as IIndexable;

@@ -198,3 +227,3 @@ let ret: unknown;

}
case ExpressionKind.AccessKeyed: {
case ekAccessKeyed: {
const instance = astEvaluate(ast.object, s, e, c) as IIndexable;

@@ -212,3 +241,3 @@ const key = astEvaluate(ast.key, s, e, c) as string;

}
case ExpressionKind.TaggedTemplate: {
case ekTaggedTemplate: {
const results = ast.expressions.map(expr => astEvaluate(expr, s, e, c));

@@ -221,3 +250,3 @@ const func = astEvaluate(ast.func, s, e, c);

}
case ExpressionKind.Binary: {
case ekBinary: {
const left = ast.left;

@@ -301,8 +330,8 @@ const right = ast.right;

}
case ExpressionKind.Conditional:
case ekConditional:
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
return astEvaluate(ast.condition, s, e, c) ? astEvaluate(ast.yes, s, e, c) : astEvaluate(ast.no, s, e, c);
case ExpressionKind.Assign:
case ekAssign:
return astAssign(ast.target, s, e, astEvaluate(ast.value, s, e, c));
case ExpressionKind.ValueConverter: {
case ekValueConverter: {
const vc = e?.getConverter?.(ast.name);

@@ -317,9 +346,9 @@ if (vc == null) {

}
case ExpressionKind.BindingBehavior:
case ekBindingBehavior:
return astEvaluate(ast.expression, s, e, c);
case ExpressionKind.BindingIdentifier:
case ekBindingIdentifier:
return ast.name;
case ExpressionKind.ForOfStatement:
case ekForOfStatement:
return astEvaluate(ast.iterable, s, e, c);
case ExpressionKind.Interpolation:
case ekInterpolation:
if (ast.isMulti) {

@@ -336,5 +365,5 @@ let result = ast.parts[0];

}
case ExpressionKind.DestructuringAssignmentLeaf:
case ekDestructuringAssignmentLeaf:
return astEvaluate(ast.target, s, e, c);
case ExpressionKind.ArrayDestructuring: {
case ekArrayDestructuring: {
return ast.list.map(x => astEvaluate(x, s, e, c));

@@ -354,3 +383,3 @@ }

// object.y = value[1]
case ExpressionKind.ArrayBindingPattern:
case ekArrayBindingPattern:
// TODO

@@ -360,7 +389,7 @@ // similar to array binding ast, this should only come after batch

// regardless number of property assignments on the scope binding context
case ExpressionKind.ObjectBindingPattern:
case ExpressionKind.ObjectDestructuring:
case ekObjectBindingPattern:
case ekObjectDestructuring:
default:
return void 0;
case ExpressionKind.Custom:
case ekCustom:
return ast.evaluate(s, e, c);

@@ -372,3 +401,3 @@ }

switch (ast.$kind) {
case ExpressionKind.AccessScope: {
case ekAccessScope: {
if (ast.name === '$host') {

@@ -380,3 +409,3 @@ throw createMappedError(ErrorNames.ast_no_assign_$host);

}
case ExpressionKind.AccessMember: {
case ekAccessMember: {
const obj = astEvaluate(ast.object, s, e, null) as IObservable;

@@ -394,3 +423,3 @@ if (isObject(obj)) {

}
case ExpressionKind.AccessKeyed: {
case ekAccessKeyed: {
const instance = astEvaluate(ast.object, s, e, null) as IIndexable;

@@ -410,6 +439,6 @@ const key = astEvaluate(ast.key, s, e, null) as string;

}
case ExpressionKind.Assign:
case ekAssign:
astAssign(ast.value, s, e, val);
return astAssign(ast.target, s, e, val);
case ExpressionKind.ValueConverter: {
case ekValueConverter: {
const vc = e?.getConverter?.(ast.name);

@@ -424,6 +453,6 @@ if (vc == null) {

}
case ExpressionKind.BindingBehavior:
case ekBindingBehavior:
return astAssign(ast.expression, s, e, val);
case ExpressionKind.ArrayDestructuring:
case ExpressionKind.ObjectDestructuring: {
case ekArrayDestructuring:
case ekObjectDestructuring: {
const list = ast.list;

@@ -436,7 +465,7 @@ const len = list.length;

switch (item.$kind) {
case ExpressionKind.DestructuringAssignmentLeaf:
case ekDestructuringAssignmentLeaf:
astAssign(item, s, e, val);
break;
case ExpressionKind.ArrayDestructuring:
case ExpressionKind.ObjectDestructuring: {
case ekArrayDestructuring:
case ekObjectDestructuring: {
if (typeof val !== 'object' || val === null) {

@@ -456,3 +485,3 @@ throw createMappedError(ErrorNames.ast_destruct_null);

}
case ExpressionKind.DestructuringAssignmentLeaf: {
case ekDestructuringAssignmentLeaf: {
if (ast instanceof DestructuringAssignmentSingleExpression) {

@@ -495,3 +524,3 @@ if (val == null) { return; }

}
case ExpressionKind.Custom:
case ekCustom:
return ast.assign(s, e, val);

@@ -507,3 +536,3 @@ default:

switch (ast.$kind) {
case ExpressionKind.BindingBehavior: {
case ekBindingBehavior: {
const name = ast.name;

@@ -524,3 +553,3 @@ const key = ast.key;

}
case ExpressionKind.ValueConverter: {
case ekValueConverter: {
const name = ast.name;

@@ -548,7 +577,7 @@ const vc = b.getConverter?.(name);

}
case ExpressionKind.ForOfStatement: {
case ekForOfStatement: {
astBind(ast.iterable, s, b);
break;
}
case ExpressionKind.Custom: {
case ekCustom: {
ast.bind?.(s, b);

@@ -561,3 +590,3 @@ }

switch (ast.$kind) {
case ExpressionKind.BindingBehavior: {
case ekBindingBehavior: {
const key = ast.key;

@@ -572,3 +601,3 @@ const $b = b as BindingWithBehavior;

}
case ExpressionKind.ValueConverter: {
case ekValueConverter: {
const vc = b.getConverter?.(ast.name);

@@ -588,7 +617,7 @@ if (vc?.signals === void 0) {

}
case ExpressionKind.ForOfStatement: {
case ekForOfStatement: {
astUnbind(ast.iterable, s, b);
break;
}
case ExpressionKind.Custom: {
case ekCustom: {
ast.unbind?.(s, b);

@@ -595,0 +624,0 @@ }

@@ -15,36 +15,65 @@ import { emptyArray } from '@aurelia/kernel';

export const enum ExpressionKind {
AccessThis,
AccessGlobal,
AccessScope,
ArrayLiteral,
ObjectLiteral,
PrimitiveLiteral,
Template,
Unary,
CallScope,
CallMember,
CallFunction,
CallGlobal,
AccessMember,
AccessKeyed,
TaggedTemplate,
Binary,
Conditional,
Assign,
ArrowFunction,
ValueConverter,
BindingBehavior,
ArrayBindingPattern,
ObjectBindingPattern,
BindingIdentifier,
ForOfStatement,
Interpolation,
ArrayDestructuring,
ObjectDestructuring,
DestructuringAssignmentLeaf,
DestructuringAssignmentRestLeaf,
Custom,
}
/** @internal */ export const ekAccessThis = 'AccessThis';
/** @internal */ export const ekAccessGlobal = 'AccessGlobal';
/** @internal */ export const ekAccessScope = 'AccessScope';
/** @internal */ export const ekArrayLiteral = 'ArrayLiteral';
/** @internal */ export const ekObjectLiteral = 'ObjectLiteral';
/** @internal */ export const ekPrimitiveLiteral = 'PrimitiveLiteral';
/** @internal */ export const ekTemplate = 'Template';
/** @internal */ export const ekUnary = 'Unary';
/** @internal */ export const ekCallScope = 'CallScope';
/** @internal */ export const ekCallMember = 'CallMember';
/** @internal */ export const ekCallFunction = 'CallFunction';
/** @internal */ export const ekCallGlobal = 'CallGlobal';
/** @internal */ export const ekAccessMember = 'AccessMember';
/** @internal */ export const ekAccessKeyed = 'AccessKeyed';
/** @internal */ export const ekTaggedTemplate = 'TaggedTemplate';
/** @internal */ export const ekBinary = 'Binary';
/** @internal */ export const ekConditional = 'Conditional';
/** @internal */ export const ekAssign = 'Assign';
/** @internal */ export const ekArrowFunction = 'ArrowFunction';
/** @internal */ export const ekValueConverter = 'ValueConverter';
/** @internal */ export const ekBindingBehavior = 'BindingBehavior';
/** @internal */ export const ekArrayBindingPattern = 'ArrayBindingPattern';
/** @internal */ export const ekObjectBindingPattern = 'ObjectBindingPattern';
/** @internal */ export const ekBindingIdentifier = 'BindingIdentifier';
/** @internal */ export const ekForOfStatement = 'ForOfStatement';
/** @internal */ export const ekInterpolation = 'Interpolation';
/** @internal */ export const ekArrayDestructuring = 'ArrayDestructuring';
/** @internal */ export const ekObjectDestructuring = 'ObjectDestructuring';
/** @internal */ export const ekDestructuringAssignmentLeaf = 'DestructuringAssignmentLeaf';
/** @internal */ export const ekCustom = 'Custom';
export type ExpressionKind =
| 'AccessThis'
| 'AccessGlobal'
| 'AccessScope'
| 'ArrayLiteral'
| 'ObjectLiteral'
| 'PrimitiveLiteral'
| 'Template'
| 'Unary'
| 'CallScope'
| 'CallMember'
| 'CallFunction'
| 'CallGlobal'
| 'AccessMember'
| 'AccessKeyed'
| 'TaggedTemplate'
| 'Binary'
| 'Conditional'
| 'Assign'
| 'ArrowFunction'
| 'ValueConverter'
| 'BindingBehavior'
| 'ArrayBindingPattern'
| 'ObjectBindingPattern'
| 'BindingIdentifier'
| 'ForOfStatement'
| 'Interpolation'
| 'ArrayDestructuring'
| 'ObjectDestructuring'
| 'DestructuringAssignmentLeaf'
| 'Custom';
export type UnaryOperator = 'void' | 'typeof' | '!' | '-' | '+';

@@ -70,3 +99,3 @@

export class CustomExpression {
public readonly $kind = ExpressionKind.Custom;
public readonly $kind = ekCustom;
public constructor(

@@ -106,3 +135,3 @@ public readonly value: unknown,

export class BindingBehaviorExpression {
public readonly $kind = ExpressionKind.BindingBehavior;
public readonly $kind = ekBindingBehavior;
/**

@@ -129,3 +158,3 @@ * The name of the property to store a binding behavior on the binding when binding

export class ValueConverterExpression {
public readonly $kind = ExpressionKind.ValueConverter;
public readonly $kind = ekValueConverter;
public constructor(

@@ -140,3 +169,3 @@ public readonly expression: IsValueConverter,

export class AssignExpression {
public readonly $kind = ExpressionKind.Assign;
public readonly $kind = ekAssign;

@@ -150,3 +179,3 @@ public constructor(

export class ConditionalExpression {
public readonly $kind = ExpressionKind.Conditional;
public readonly $kind = ekConditional;
public constructor(

@@ -160,3 +189,3 @@ public readonly condition: IsBinary,

export class AccessGlobalExpression {
public readonly $kind: ExpressionKind.AccessGlobal = ExpressionKind.AccessGlobal;
public readonly $kind: 'AccessGlobal' = ekAccessGlobal;

@@ -169,3 +198,3 @@ public constructor(

export class AccessThisExpression {
public readonly $kind: ExpressionKind.AccessThis = ExpressionKind.AccessThis;
public readonly $kind: 'AccessThis' = ekAccessThis;

@@ -178,3 +207,3 @@ public constructor(

export class AccessScopeExpression {
public readonly $kind = ExpressionKind.AccessScope;
public readonly $kind = ekAccessScope;
public constructor(

@@ -187,6 +216,6 @@ public readonly name: string,

const isAccessGlobal = (ast: IsLeftHandSide) => (
ast.$kind === ExpressionKind.AccessGlobal ||
ast.$kind === ekAccessGlobal ||
(
ast.$kind === ExpressionKind.AccessMember ||
ast.$kind === ExpressionKind.AccessKeyed
ast.$kind === ekAccessMember ||
ast.$kind === ekAccessKeyed
) && ast.accessGlobal

@@ -196,3 +225,3 @@ );

export class AccessMemberExpression {
public readonly $kind: ExpressionKind.AccessMember = ExpressionKind.AccessMember;
public readonly $kind: 'AccessMember' = ekAccessMember;
public readonly accessGlobal: boolean;

@@ -209,3 +238,3 @@ public constructor(

export class AccessKeyedExpression {
public readonly $kind = ExpressionKind.AccessKeyed;
public readonly $kind = ekAccessKeyed;
public readonly accessGlobal: boolean;

@@ -222,3 +251,3 @@ public constructor(

export class CallScopeExpression {
public readonly $kind = ExpressionKind.CallScope;
public readonly $kind = ekCallScope;
public constructor(

@@ -233,3 +262,3 @@ public readonly name: string,

export class CallMemberExpression {
public readonly $kind = ExpressionKind.CallMember;
public readonly $kind = ekCallMember;
public constructor(

@@ -245,3 +274,3 @@ public readonly object: IsLeftHandSide,

export class CallFunctionExpression {
public readonly $kind = ExpressionKind.CallFunction;
public readonly $kind = ekCallFunction;
public constructor(

@@ -255,3 +284,3 @@ public readonly func: IsLeftHandSide,

export class CallGlobalExpression {
public readonly $kind = ExpressionKind.CallGlobal;
public readonly $kind = ekCallGlobal;
public constructor(

@@ -264,3 +293,3 @@ public readonly name: string,

export class BinaryExpression {
public readonly $kind: ExpressionKind.Binary = ExpressionKind.Binary;
public readonly $kind: 'Binary' = ekBinary;
public constructor(

@@ -274,3 +303,3 @@ public readonly operation: BinaryOperator,

export class UnaryExpression {
public readonly $kind = ExpressionKind.Unary;
public readonly $kind = ekUnary;
public constructor(

@@ -287,3 +316,3 @@ public readonly operation: UnaryOperator,

public static readonly $empty: PrimitiveLiteralExpression<string> = new PrimitiveLiteralExpression<''>('');
public readonly $kind = ExpressionKind.PrimitiveLiteral;
public readonly $kind = ekPrimitiveLiteral;

@@ -297,3 +326,3 @@ public constructor(

public static readonly $empty: ArrayLiteralExpression = new ArrayLiteralExpression(emptyArray);
public readonly $kind = ExpressionKind.ArrayLiteral;
public readonly $kind = ekArrayLiteral;
public constructor(

@@ -306,3 +335,3 @@ public readonly elements: readonly IsAssign[],

public static readonly $empty: ObjectLiteralExpression = new ObjectLiteralExpression(emptyArray, emptyArray);
public readonly $kind = ExpressionKind.ObjectLiteral;
public readonly $kind = ekObjectLiteral;
public constructor(

@@ -316,3 +345,3 @@ public readonly keys: readonly (number | string)[],

public static readonly $empty: TemplateExpression = new TemplateExpression(['']);
public readonly $kind = ExpressionKind.Template;
public readonly $kind = ekTemplate;
public constructor(

@@ -325,3 +354,3 @@ public readonly cooked: readonly string[],

export class TaggedTemplateExpression {
public readonly $kind = ExpressionKind.TaggedTemplate;
public readonly $kind = ekTaggedTemplate;
public constructor(

@@ -338,3 +367,3 @@ public readonly cooked: readonly string[] & { raw?: readonly string[] },

export class ArrayBindingPattern {
public readonly $kind = ExpressionKind.ArrayBindingPattern;
public readonly $kind = ekArrayBindingPattern;
// We'll either have elements, or keys+values, but never all 3

@@ -347,3 +376,3 @@ public constructor(

export class ObjectBindingPattern {
public readonly $kind = ExpressionKind.ObjectBindingPattern;
public readonly $kind = ekObjectBindingPattern;
// We'll either have elements, or keys+values, but never all 3

@@ -357,3 +386,3 @@ public constructor(

export class BindingIdentifier {
public readonly $kind = ExpressionKind.BindingIdentifier;
public readonly $kind = ekBindingIdentifier;
public constructor(

@@ -367,3 +396,3 @@ public readonly name: string,

export class ForOfStatement {
public readonly $kind = ExpressionKind.ForOfStatement;
public readonly $kind = ekForOfStatement;
public constructor(

@@ -382,3 +411,3 @@ public readonly declaration: BindingIdentifierOrPattern | DestructuringAssignmentExpression,

export class Interpolation {
public readonly $kind = ExpressionKind.Interpolation;
public readonly $kind = ekInterpolation;
public readonly isMulti: boolean;

@@ -399,3 +428,3 @@ public readonly firstExpression: IsBindingBehavior;

public constructor(
public readonly $kind: ExpressionKind.ArrayDestructuring | ExpressionKind.ObjectDestructuring,
public readonly $kind: 'ArrayDestructuring' | 'ObjectDestructuring',
public readonly list: readonly (DestructuringAssignmentExpression | DestructuringAssignmentSingleExpression | DestructuringAssignmentRestExpression)[],

@@ -409,3 +438,3 @@ public readonly source: AccessMemberExpression | AccessKeyedExpression | undefined,

export class DestructuringAssignmentSingleExpression {
public readonly $kind = ExpressionKind.DestructuringAssignmentLeaf;
public readonly $kind = ekDestructuringAssignmentLeaf;
public constructor(

@@ -420,3 +449,3 @@ public readonly target: AccessMemberExpression,

export class DestructuringAssignmentRestExpression {
public readonly $kind = ExpressionKind.DestructuringAssignmentLeaf;
public readonly $kind = ekDestructuringAssignmentLeaf;
public constructor(

@@ -429,3 +458,3 @@ public readonly target: AccessMemberExpression,

export class ArrowFunction {
public readonly $kind = ExpressionKind.ArrowFunction;
public readonly $kind = ekArrowFunction;
public constructor(

@@ -432,0 +461,0 @@ public args: BindingIdentifier[],

import { createError, isString, safeString } from '../utilities';
import { CustomExpression, ExpressionKind } from './ast';
import { CustomExpression, ekAccessKeyed, ekAccessMember, ekAccessScope, ekAccessThis, ekArrayBindingPattern, ekArrayDestructuring, ekArrayLiteral, ekArrowFunction, ekAssign, ekBinary, ekBindingBehavior, ekBindingIdentifier, ekCallFunction, ekCallMember, ekCallScope, ekConditional, ekCustom, ekDestructuringAssignmentLeaf, ekForOfStatement, ekInterpolation, ekObjectBindingPattern, ekObjectDestructuring, ekObjectLiteral, ekPrimitiveLiteral, ekTaggedTemplate, ekTemplate, ekUnary, ekValueConverter } from './ast';

@@ -39,30 +39,30 @@ import type { AccessKeyedExpression, AccessMemberExpression, AccessScopeExpression, AccessThisExpression, ArrayBindingPattern, ArrayLiteralExpression, ArrowFunction, AssignExpression, BinaryExpression, BindingBehaviorExpression, BindingIdentifier, CallFunctionExpression, CallMemberExpression, CallScopeExpression, ConditionalExpression, ForOfStatement, Interpolation, ObjectBindingPattern, ObjectLiteralExpression, PrimitiveLiteralExpression, TaggedTemplateExpression, TemplateExpression, UnaryExpression, ValueConverterExpression, DestructuringAssignmentExpression, DestructuringAssignmentSingleExpression, DestructuringAssignmentRestExpression, IsExpressionOrStatement, IsBindingBehavior } from './ast';

switch (ast.$kind) {
case ExpressionKind.AccessKeyed: return visitor.visitAccessKeyed(ast);
case ExpressionKind.AccessMember: return visitor.visitAccessMember(ast);
case ExpressionKind.AccessScope: return visitor.visitAccessScope(ast);
case ExpressionKind.AccessThis: return visitor.visitAccessThis(ast);
case ExpressionKind.ArrayBindingPattern: return visitor.visitArrayBindingPattern(ast);
case ExpressionKind.ArrayDestructuring: return visitor.visitDestructuringAssignmentExpression(ast);
case ExpressionKind.ArrayLiteral: return visitor.visitArrayLiteral(ast);
case ExpressionKind.ArrowFunction: return visitor.visitArrowFunction(ast);
case ExpressionKind.Assign: return visitor.visitAssign(ast);
case ExpressionKind.Binary: return visitor.visitBinary(ast);
case ExpressionKind.BindingBehavior: return visitor.visitBindingBehavior(ast);
case ExpressionKind.BindingIdentifier: return visitor.visitBindingIdentifier(ast);
case ExpressionKind.CallFunction: return visitor.visitCallFunction(ast);
case ExpressionKind.CallMember: return visitor.visitCallMember(ast);
case ExpressionKind.CallScope: return visitor.visitCallScope(ast);
case ExpressionKind.Conditional: return visitor.visitConditional(ast);
case ExpressionKind.DestructuringAssignmentLeaf: return visitor.visitDestructuringAssignmentSingleExpression(ast as DestructuringAssignmentSingleExpression);
case ExpressionKind.ForOfStatement: return visitor.visitForOfStatement(ast);
case ExpressionKind.Interpolation: return visitor.visitInterpolation(ast);
case ExpressionKind.ObjectBindingPattern: return visitor.visitObjectBindingPattern(ast);
case ExpressionKind.ObjectDestructuring: return visitor.visitDestructuringAssignmentExpression(ast);
case ExpressionKind.ObjectLiteral: return visitor.visitObjectLiteral(ast);
case ExpressionKind.PrimitiveLiteral: return visitor.visitPrimitiveLiteral(ast);
case ExpressionKind.TaggedTemplate: return visitor.visitTaggedTemplate(ast);
case ExpressionKind.Template: return visitor.visitTemplate(ast);
case ExpressionKind.Unary: return visitor.visitUnary(ast);
case ExpressionKind.ValueConverter: return visitor.visitValueConverter(ast);
case ExpressionKind.Custom: return visitor.visitCustom(ast);
case ekAccessKeyed: return visitor.visitAccessKeyed(ast);
case ekAccessMember: return visitor.visitAccessMember(ast);
case ekAccessScope: return visitor.visitAccessScope(ast);
case ekAccessThis: return visitor.visitAccessThis(ast);
case ekArrayBindingPattern: return visitor.visitArrayBindingPattern(ast);
case ekArrayDestructuring: return visitor.visitDestructuringAssignmentExpression(ast);
case ekArrayLiteral: return visitor.visitArrayLiteral(ast);
case ekArrowFunction: return visitor.visitArrowFunction(ast);
case ekAssign: return visitor.visitAssign(ast);
case ekBinary: return visitor.visitBinary(ast);
case ekBindingBehavior: return visitor.visitBindingBehavior(ast);
case ekBindingIdentifier: return visitor.visitBindingIdentifier(ast);
case ekCallFunction: return visitor.visitCallFunction(ast);
case ekCallMember: return visitor.visitCallMember(ast);
case ekCallScope: return visitor.visitCallScope(ast);
case ekConditional: return visitor.visitConditional(ast);
case ekDestructuringAssignmentLeaf: return visitor.visitDestructuringAssignmentSingleExpression(ast as DestructuringAssignmentSingleExpression);
case ekForOfStatement: return visitor.visitForOfStatement(ast);
case ekInterpolation: return visitor.visitInterpolation(ast);
case ekObjectBindingPattern: return visitor.visitObjectBindingPattern(ast);
case ekObjectDestructuring: return visitor.visitDestructuringAssignmentExpression(ast);
case ekObjectLiteral: return visitor.visitObjectLiteral(ast);
case ekPrimitiveLiteral: return visitor.visitPrimitiveLiteral(ast);
case ekTaggedTemplate: return visitor.visitTaggedTemplate(ast);
case ekTemplate: return visitor.visitTemplate(ast);
case ekUnary: return visitor.visitUnary(ast);
case ekValueConverter: return visitor.visitValueConverter(ast);
case ekCustom: return visitor.visitCustom(ast);
default: {

@@ -334,3 +334,3 @@ throw createError(`Unknown ast node ${JSON.stringify(ast)}`);

const $kind = expr.$kind;
const isObjDes = $kind === ExpressionKind.ObjectDestructuring;
const isObjDes = $kind === ekObjectDestructuring;
this.text += isObjDes ? '{' : '[';

@@ -344,7 +344,7 @@ const list = expr.list;

switch(item.$kind) {
case ExpressionKind.DestructuringAssignmentLeaf:
case ekDestructuringAssignmentLeaf:
astVisit(item, this);
break;
case ExpressionKind.ArrayDestructuring:
case ExpressionKind.ObjectDestructuring: {
case ekArrayDestructuring:
case ekObjectDestructuring: {
const source = item.source;

@@ -351,0 +351,0 @@ if(source) {

@@ -38,3 +38,2 @@ /* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */

UnaryOperator,
ExpressionKind,
DestructuringAssignmentSingleExpression as DASE,

@@ -45,2 +44,12 @@ DestructuringAssignmentExpression as DAE,

CallGlobalExpression,
type ExpressionKind,
ekAccessThis,
ekAccessGlobal,
ekAccessMember,
ekAccessScope,
ekArrayDestructuring,
ekArrayBindingPattern,
ekObjectBindingPattern,
ekBindingIdentifier,
ekObjectDestructuring,
} from './ast';

@@ -58,5 +67,5 @@ import { createInterface, createLookup, objectAssign } from '../utilities';

public parse(expression: string, expressionType: ExpressionType.IsIterator): ForOfStatement;
public parse(expression: string, expressionType: ExpressionType.Interpolation): Interpolation;
public parse(expression: string, expressionType: Exclude<ExpressionType, ExpressionType.IsIterator | ExpressionType.Interpolation>): IsBindingBehavior;
public parse(expression: string, expressionType: 'IsIterator'): ForOfStatement;
public parse(expression: string, expressionType: 'Interpolation'): Interpolation;
public parse(expression: string, expressionType: Exclude<ExpressionType, 'IsIterator' | 'Interpolation'>): IsBindingBehavior;
public parse(expression: string, expressionType: ExpressionType): AnyBindingExpression;

@@ -66,5 +75,5 @@ public parse(expression: string, expressionType: ExpressionType): AnyBindingExpression {

switch (expressionType) {
case ExpressionType.IsCustom:
case etIsCustom:
return new CustomExpression(expression) as AnyBindingExpression;
case ExpressionType.Interpolation:
case etInterpolation:
found = this._interpolationLookup[expression];

@@ -75,3 +84,3 @@ if (found === void 0) {

return found;
case ExpressionType.IsIterator:
case etIsIterator:
found = this._forOfLookup[expression];

@@ -84,4 +93,3 @@ if (found === void 0) {

if (expression.length === 0) {
// this is an intermediate code before converting the ExpressionType enum to a string literal type as part of the issue #1736
if (expressionType === ExpressionType.IsFunction || expressionType === ExpressionType.IsProperty) {
if (expressionType === etIsFunction || expressionType === etIsProperty) {
return PrimitiveLiteralExpression.$empty;

@@ -101,7 +109,7 @@ }

/** @internal */
private $parse(expression: string, expressionType: ExpressionType.IsIterator): ForOfStatement;
private $parse(expression: string, expressionType: 'IsIterator'): ForOfStatement;
/** @internal */
private $parse(expression: string, expressionType: ExpressionType.Interpolation): Interpolation;
private $parse(expression: string, expressionType: 'Interpolation'): Interpolation;
/** @internal */
private $parse(expression: string, expressionType: Exclude<ExpressionType, ExpressionType.IsIterator | ExpressionType.Interpolation>): IsBindingBehavior;
private $parse(expression: string, expressionType: Exclude<ExpressionType, 'IsIterator' | 'Interpolation'>): IsBindingBehavior;
/** @internal */

@@ -121,3 +129,3 @@ private $parse(expression: string, expressionType: ExpressionType): AnyBindingExpression {

$semicolonIndex = -1;
return parse(Precedence.Variadic, expressionType === void 0 ? ExpressionType.IsProperty : expressionType);
return parse(Precedence.Variadic, expressionType === void 0 ? etIsProperty : expressionType);
}

@@ -346,11 +354,10 @@ }

export const enum ExpressionType {
None = 0,
Interpolation = 0b0_000001,
IsIterator = 0b0_000010,
IsChainable = 0b0_000100,
IsFunction = 0b0_001000,
IsProperty = 0b0_010000,
IsCustom = 0b0_100000,
}
const etNone = 'None' as const;
const etInterpolation = 'Interpolation' as const;
const etIsIterator = 'IsIterator' as const;
const etIsChainable = 'IsChainable' as const;
const etIsFunction = 'IsFunction' as const;
const etIsProperty = 'IsProperty' as const;
const etIsCustom = 'IsCustom' as const;
export type ExpressionType = typeof etNone | typeof etInterpolation | typeof etIsIterator | typeof etIsChainable | typeof etIsFunction | typeof etIsProperty | typeof etIsCustom;

@@ -392,3 +399,3 @@ let $input: string = '';

$semicolonIndex = -1;
return parse(Precedence.Variadic, expressionType === void 0 ? ExpressionType.IsProperty : expressionType);
return parse(Precedence.Variadic, expressionType === void 0 ? etIsProperty : expressionType);
}

@@ -405,3 +412,3 @@

export function parse(minPrecedence: Precedence, expressionType: ExpressionType): AnyBindingExpression {
if (expressionType === ExpressionType.IsCustom) {
if (expressionType === etIsCustom) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any

@@ -412,3 +419,3 @@ return new CustomExpression($input) as any;

if ($index === 0) {
if (expressionType & ExpressionType.Interpolation) {
if (expressionType === etInterpolation) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any

@@ -520,3 +527,3 @@ return parseInterpolation() as any;

const id = $tokenValue as string;
if (expressionType & ExpressionType.IsIterator) {
if (expressionType === etIsIterator) {
result = new BindingIdentifier(id);

@@ -539,3 +546,3 @@ } else if ($accessGlobal && globalNames.includes(id as (typeof globalNames)[number])) {

++$scopeDepth;
const body = parse(Precedence.Assign, ExpressionType.None) as IsAssign;
const body = parse(Precedence.Assign, etNone) as IsAssign;
$optional = _optional;

@@ -606,3 +613,3 @@ $scopeDepth = _scopeDepth;

if (expressionType & ExpressionType.IsIterator) {
if (expressionType === etIsIterator) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any

@@ -620,3 +627,3 @@ return parseForOfStatement(result as BindingIdentifierOrPattern) as any;

if (result.$kind === ExpressionKind.AccessThis) {
if (result.$kind === ekAccessThis) {
switch ($currentToken as Token) {

@@ -711,7 +718,7 @@ case Token.QuestionDot:

case Token.OpenParen:
if (result.$kind === ExpressionKind.AccessScope) {
if (result.$kind === ekAccessScope) {
result = new CallScopeExpression(result.name, parseArguments(), result.ancestor, false);
} else if (result.$kind === ExpressionKind.AccessMember) {
} else if (result.$kind === ekAccessMember) {
result = new CallMemberExpression(result.object, result.name, parseArguments(), result.optional, false);
} else if (result.$kind === ExpressionKind.AccessGlobal) {
} else if (result.$kind === ekAccessGlobal) {
result = new CallGlobalExpression(result.name, parseArguments());

@@ -884,7 +891,7 @@ } else {

if ($currentToken !== Token.EOF) {
if ((expressionType & ExpressionType.Interpolation) > 0 && $currentToken === Token.CloseBrace) {
if (expressionType === etInterpolation && $currentToken === Token.CloseBrace) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return result as any;
}
if ((expressionType & ExpressionType.IsChainable) > 0 && $currentToken === Token.Semicolon) {
if (expressionType === etIsChainable && $currentToken === Token.Semicolon) {
if ($index === $length) {

@@ -914,3 +921,3 @@ throw unconsumedToken();

const items: DASE[] = [];
const dae = new DAE(ExpressionKind.ArrayDestructuring, items, void 0, void 0);
const dae = new DAE(ekArrayDestructuring, items, void 0, void 0);
let target: string = '';

@@ -955,3 +962,3 @@ let $continue = true;

while (($currentToken as Token) !== Token.CloseParen) {
args.push(parse(Precedence.Assign, ExpressionType.None) as IsAssign);
args.push(parse(Precedence.Assign, etNone) as IsAssign);
if (!consumeOpt(Token.Comma)) {

@@ -973,3 +980,3 @@ break;

nextToken();
result = new AccessKeyedExpression(result, parse(Precedence.Assign, ExpressionType.None) as IsAssign, optional);
result = new AccessKeyedExpression(result, parse(Precedence.Assign, etNone) as IsAssign, optional);
consume(Token.CloseBracket);

@@ -996,5 +1003,5 @@

if (($currentToken as Token) === Token.OpenParen) {
if (lhs.$kind === ExpressionKind.AccessScope) {
if (lhs.$kind === ekAccessScope) {
return new CallScopeExpression(lhs.name, parseArguments(), lhs.ancestor, true);
} else if (lhs.$kind === ExpressionKind.AccessMember) {
} else if (lhs.$kind === ekAccessMember) {
return new CallMemberExpression(lhs.object, lhs.name, parseArguments(), lhs.optional, true);

@@ -1118,3 +1125,3 @@ } else {

++$scopeDepth;
const body = parse(Precedence.Assign, ExpressionType.None) as IsAssign;
const body = parse(Precedence.Assign, etNone) as IsAssign;
$optional = _optional;

@@ -1205,3 +1212,3 @@ $scopeDepth = _scopeDepth;

++$scopeDepth;
const body = parse(Precedence.Assign, ExpressionType.None) as IsAssign;
const body = parse(Precedence.Assign, etNone) as IsAssign;
$optional = _optional;

@@ -1287,3 +1294,3 @@ $scopeDepth = _scopeDepth;

} else {
elements.push(parse(Precedence.Assign, expressionType & ~ExpressionType.IsIterator) as IsAssign);
elements.push(parse(Precedence.Assign, expressionType === etIsIterator ? etNone : expressionType) as IsAssign);
if (consumeOpt(Token.Comma)) {

@@ -1302,3 +1309,3 @@ if (($currentToken as Token) === Token.CloseBracket) {

consume(Token.CloseBracket);
if (expressionType & ExpressionType.IsIterator) {
if (expressionType === etIsIterator) {
return new ArrayBindingPattern(elements);

@@ -1311,16 +1318,13 @@ } else {

const allowedForExprKinds: ExpressionKind[] = [ekArrayBindingPattern, ekObjectBindingPattern, ekBindingIdentifier, ekArrayDestructuring, ekObjectDestructuring];
function parseForOfStatement(result: BindingIdentifierOrPattern): ForOfStatement {
if ((result.$kind & (
ExpressionKind.ArrayBindingPattern
| ExpressionKind.ObjectBindingPattern
| ExpressionKind.BindingIdentifier
)) === 0) {
throw invalidLHSBindingIdentifierInForOf();
if (!allowedForExprKinds.includes(result.$kind)) {
throw invalidLHSBindingIdentifierInForOf(result.$kind);
}
if ($currentToken !== Token.OfKeyword) {
throw invalidLHSBindingIdentifierInForOf();
throw invalidLHSBindingIdentifierInForOf(result.$kind);
}
nextToken();
const declaration = result;
const statement = parse(Precedence.Variadic, ExpressionType.IsChainable);
const statement = parse(Precedence.Variadic, etIsChainable);
return new ForOfStatement(declaration, statement as IsBindingBehavior, $semicolonIndex);

@@ -1362,3 +1366,3 @@ }

consume(Token.Colon);
values.push(parse(Precedence.Assign, expressionType & ~ExpressionType.IsIterator) as IsAssign);
values.push(parse(Precedence.Assign, expressionType === etIsIterator ? etNone : expressionType) as IsAssign);
} else if ($currentToken & Token.IdentifierName) {

@@ -1371,3 +1375,3 @@ // IdentifierName = optional colon

if (consumeOpt(Token.Colon)) {
values.push(parse(Precedence.Assign, expressionType & ~ExpressionType.IsIterator) as IsAssign);
values.push(parse(Precedence.Assign, expressionType === etIsIterator ? etNone : expressionType) as IsAssign);
} else {

@@ -1378,3 +1382,3 @@ // Shorthand

$index = index;
values.push(parse(Precedence.Primary, expressionType & ~ExpressionType.IsIterator) as IsAssign);
values.push(parse(Precedence.Primary, expressionType === etIsIterator ? etNone : expressionType) as IsAssign);
}

@@ -1392,3 +1396,3 @@ } else {

consume(Token.CloseBrace);
if (expressionType & ExpressionType.IsIterator) {
if (expressionType === etIsIterator) {
return new ObjectBindingPattern(keys, values);

@@ -1416,3 +1420,3 @@ } else {

nextToken();
const expression = parse(Precedence.Variadic, ExpressionType.Interpolation) as IsBindingBehavior | Interpolation;
const expression = parse(Precedence.Variadic, etInterpolation) as IsBindingBehavior | Interpolation;
expressions.push(expression);

@@ -1675,3 +1679,3 @@ continue;

const invalidLHSBindingIdentifierInForOf = () => createMappedError(ErrorNames.parse_invalid_identifier_in_forof, $input);
const invalidLHSBindingIdentifierInForOf = (kind: any) => createMappedError(ErrorNames.parse_invalid_identifier_in_forof, $input, kind);

@@ -1678,0 +1682,0 @@ const invalidPropDefInObjLiteral = () => createMappedError(ErrorNames.parse_invalid_identifier_object_literal_key, $input);

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

[ErrorNames.parse_unexpected_keyword_import]: `Expression error: unexpected keyword "import": "{{0}}"`,
[ErrorNames.parse_invalid_identifier_in_forof]: `Expression error: invalid BindingIdentifier at left hand side of "of": "{{0}}"`,
[ErrorNames.parse_invalid_identifier_in_forof]: `Expression error: invalid BindingIdentifier at left hand side of "of": "{{0}}" | kind: {{1}}`,
[ErrorNames.parse_invalid_identifier_object_literal_key]: `Expression error: invalid or unsupported property definition in object literal: "{{0}}"`,

@@ -102,0 +102,0 @@ [ErrorNames.parse_unterminated_string]: `Expression error: unterminated quote in string literal: "{{0}}"`,

export {
ExpressionKind,
type ExpressionKind,
// Ast nodes

@@ -72,3 +72,3 @@ CallFunctionExpression,

IExpressionParser,
ExpressionType,
type ExpressionType,
parseExpression,

@@ -167,3 +167,3 @@ } from './binding/expression-parser';

type Collection,
CollectionKind,
type CollectionKind,
type IAccessor,

@@ -170,0 +170,0 @@ type IBindingContext,

import { DI, IDisposable, IIndexable, IServiceLocator } from '@aurelia/kernel';
import { isArray } from './utilities';
import { isArray, objectFreeze } from './utilities';

@@ -108,9 +108,3 @@ import type { Scope } from './observation/scope';

export const enum CollectionKind {
indexed = 0b1000,
keyed = 0b0100,
array = 0b1001,
map = 0b0110,
set = 0b0111,
}
export type CollectionKind = 'indexed' | 'keyed' | 'array' | 'map' | 'set';

@@ -123,30 +117,26 @@ export type LengthPropertyName<T> =

export type CollectionTypeToKind<T> =
T extends unknown[] ? CollectionKind.array | CollectionKind.indexed :
T extends Set<unknown> ? CollectionKind.set | CollectionKind.keyed :
T extends Map<unknown, unknown> ? CollectionKind.map | CollectionKind.keyed :
never;
export type CollectionKindToType<T> =
T extends CollectionKind.array ? unknown[] :
T extends CollectionKind.indexed ? unknown[] :
T extends CollectionKind.map ? Map<unknown, unknown> :
T extends CollectionKind.set ? Set<unknown> :
T extends CollectionKind.keyed ? Set<unknown> | Map<unknown, unknown> :
T extends 'array' ? unknown[] :
T extends 'indexed' ? unknown[] :
T extends 'map' ? Map<unknown, unknown> :
T extends 'set' ? Set<unknown> :
T extends 'keyed' ? Set<unknown> | Map<unknown, unknown> :
never;
export type ObservedCollectionKindToType<T> =
T extends CollectionKind.array ? unknown[] :
T extends CollectionKind.indexed ? unknown[] :
T extends CollectionKind.map ? Map<unknown, unknown> :
T extends CollectionKind.set ? Set<unknown> :
T extends CollectionKind.keyed ? Map<unknown, unknown> | Set<unknown> :
T extends 'array' ? unknown[] :
T extends 'indexed' ? unknown[] :
T extends 'map' ? Map<unknown, unknown> :
T extends 'set' ? Set<unknown> :
T extends 'keyed' ? Map<unknown, unknown> | Set<unknown> :
never;
export const enum AccessorType {
None = 0b0_000_000,
Observer = 0b0_000_001,
Node = 0b0_000_010,
/** @internal */ export const atNone = 0b0_000_000;
/** @internal */ export const atObserver = 0b0_000_001;
/** @internal */ export const atNode = 0b0_000_010;
/** @internal */ export const atLayout = 0b0_000_100;
export const AccessorType = /*@__PURE__*/objectFreeze({
None : atNone,
Observer : atObserver,
Node : atNode,
// misc characteristic of accessors/observers when update

@@ -160,5 +150,5 @@ //

// todo: https://csstriggers.com/
Layout = 0b0_000_100,
}
Layout : atLayout,
} as const);
export type AccessorType = typeof AccessorType[keyof typeof AccessorType];
/**

@@ -266,3 +256,3 @@ * Basic interface to normalize getting/setting a value of any property on any object

collection: ObservedCollectionKindToType<T>;
getLengthObserver(): T extends CollectionKind.array ? CollectionLengthObserver : CollectionSizeObserver;
getLengthObserver(): T extends 'array' ? CollectionLengthObserver : CollectionSizeObserver;
notify(): void;

@@ -269,0 +259,0 @@ }

import {
createIndexMap,
AccessorType,
type AccessorType,
type ISubscriberCollection,
type ICollectionSubscriberCollection,
type IObserver,
type CollectionKind,
type ICollectionObserver,
type IndexMap,
type ISubscriber,
atObserver,
} from '../observation';

@@ -380,6 +380,6 @@ import {

export interface ArrayObserver extends ICollectionObserver<CollectionKind.array>, ICollectionSubscriberCollection {}
export interface ArrayObserver extends ICollectionObserver<'array'>, ICollectionSubscriberCollection {}
export class ArrayObserver {
public type: AccessorType = AccessorType.Observer;
public type: AccessorType = atObserver;

@@ -432,3 +432,3 @@ private readonly indexObservers: Record<string | number, ArrayIndexObserver | undefined>;

export interface IArrayIndexObserver extends IObserver {
owner: ICollectionObserver<CollectionKind.array>;
owner: ICollectionObserver<'array'>;
}

@@ -435,0 +435,0 @@

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

import { AccessorType, Collection, CollectionKind, IObserver } from '../observation';
import { Collection, IObserver, atObserver } from '../observation';
import { subscriberCollection } from './subscriber-collection';

@@ -7,2 +7,3 @@ import { ensureProto } from '../utilities';

import type {
AccessorType,
ICollectionObserver,

@@ -13,2 +14,3 @@ IndexMap,

ICollectionSubscriber,
CollectionKind,
} from '../observation';

@@ -20,3 +22,3 @@ import { ErrorNames, createMappedError } from '../errors';

export class CollectionLengthObserver implements IObserver, ICollectionSubscriber {
public readonly type: AccessorType = AccessorType.Observer;
public readonly type: AccessorType = atObserver;

@@ -30,3 +32,3 @@ /** @internal */

public constructor(
public readonly owner: ICollectionObserver<CollectionKind.array>,
public readonly owner: ICollectionObserver<'array'>,
) {

@@ -70,3 +72,3 @@ this._value = (this._obj = owner.collection).length;

export class CollectionSizeObserver implements ICollectionSubscriber {
public readonly type: AccessorType = AccessorType.Observer;
public readonly type: AccessorType = atObserver;

@@ -80,3 +82,3 @@ /** @internal */

public constructor(
public readonly owner: ICollectionObserver<CollectionKind.map | CollectionKind.set>,
public readonly owner: ICollectionObserver<'map' | 'set'>,
) {

@@ -83,0 +85,0 @@ this._value = (this._obj = owner.collection).size;

import {
AccessorType,
ICoercionConfiguration,
IObserver,
InterceptorFunc,
atObserver,
} from '../observation';

@@ -14,2 +14,3 @@ import { subscriberCollection } from './subscriber-collection';

import type {
AccessorType,
ISubscriber,

@@ -37,3 +38,3 @@ ICollectionSubscriber,

public type: AccessorType = AccessorType.Observer;
public type: AccessorType = atObserver;

@@ -40,0 +41,0 @@ /** @internal */

import { ErrorNames, createMappedError } from '../errors';
import type { IConnectable } from '../observation';
import { objectFreeze } from '../utilities';

@@ -57,3 +58,3 @@ /**

export const ConnectableSwitcher = Object.freeze({
export const ConnectableSwitcher = /*@__PURE__*/ objectFreeze({
get current() {

@@ -60,0 +61,0 @@ return _connectable;

import { IContainer, IPlatform, Registration } from '@aurelia/kernel';
import { AccessorType, type IObserver, type ISubscriberCollection, type IObservable, type ISubscriber } from '../observation';
import { type AccessorType, type IObserver, type ISubscriberCollection, type IObservable, type ISubscriber, atNone } from '../observation';
import { subscriberCollection } from './subscriber-collection';

@@ -124,3 +124,3 @@ import { createError, createInterface, safeString } from '../utilities';

export class DirtyCheckProperty implements DirtyCheckProperty {
public type: AccessorType = AccessorType.None;
public type: AccessorType = atNone;

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

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

import { createIndexMap, AccessorType } from '../observation';
import { createIndexMap, atObserver } from '../observation';
import { CollectionSizeObserver } from './collection-length-observer';

@@ -7,3 +7,3 @@ import { subscriberCollection } from './subscriber-collection';

import type {
CollectionKind,
AccessorType,
ICollectionObserver,

@@ -154,6 +154,6 @@ ICollectionSubscriberCollection,

export interface MapObserver extends ICollectionObserver<CollectionKind.map>, ICollectionSubscriberCollection {}
export interface MapObserver extends ICollectionObserver<'map'>, ICollectionSubscriberCollection {}
export class MapObserver {
public type: AccessorType = AccessorType.Observer;
public type: AccessorType = atObserver;
private lenObs?: CollectionSizeObserver;

@@ -160,0 +160,0 @@

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

import { AccessorType, IAccessor, IObserver, ISubscriberCollection } from '../observation';
import { AccessorType, IAccessor, IObserver, ISubscriberCollection, atObserver } from '../observation';
import { safeString, def, isFunction, areEqual } from '../utilities';

@@ -170,3 +170,3 @@ import { currentConnectable } from './connectable-switcher';

public static mixed = false;
public readonly type: AccessorType = AccessorType.Observer;
public readonly type: AccessorType = atObserver;

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

@@ -19,3 +19,2 @@ import { Primitive, isArrayIndex, ILogger } from '@aurelia/kernel';

AccessorOrObserver,
CollectionKind,
CollectionObserver,

@@ -124,11 +123,11 @@ } from '../observation';

public getArrayObserver(observedArray: unknown[]): ICollectionObserver<CollectionKind.array> {
public getArrayObserver(observedArray: unknown[]): ICollectionObserver<'array'> {
return getArrayObserver(observedArray);
}
public getMapObserver(observedMap: Map<unknown, unknown>): ICollectionObserver<CollectionKind.map> {
public getMapObserver(observedMap: Map<unknown, unknown>): ICollectionObserver<'map'> {
return getMapObserver(observedMap);
}
public getSetObserver(observedSet: Set<unknown>): ICollectionObserver<CollectionKind.set> {
public getSetObserver(observedSet: Set<unknown>): ICollectionObserver<'set'> {
return getSetObserver(observedSet);

@@ -135,0 +134,0 @@ }

@@ -1,9 +0,9 @@

import { AccessorType } from '../observation';
import { atNone } from '../observation';
import type { Primitive } from '@aurelia/kernel';
import type { IAccessor, ISubscribable } from '../observation';
import type { AccessorType, IAccessor, ISubscribable } from '../observation';
export class PrimitiveObserver implements IAccessor, ISubscribable {
public get doNotCache(): true { return true; }
public type: AccessorType = AccessorType.None;
public type: AccessorType = atNone;
/** @internal */

@@ -10,0 +10,0 @@ private readonly _obj: Primitive;

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

import { AccessorType } from '../observation';
import type { IAccessor, IObservable } from '../observation';
import { atNone } from '../observation';
import type { AccessorType, IAccessor, IObservable } from '../observation';

@@ -7,3 +7,3 @@ export class PropertyAccessor implements IAccessor {

// even if this property accessor is used to access an element
public type: AccessorType = AccessorType.None;
public type: AccessorType = atNone;

@@ -10,0 +10,0 @@ public getValue(obj: object, key: string): unknown {

import { IIndexable } from '@aurelia/kernel';
import { Collection, IConnectable } from '../observation';
import { isArray, isMap, isSet, safeString } from '../utilities';
import { isArray, isMap, isSet, objectFreeze, safeString } from '../utilities';
import { connecting, currentConnectable, _connectable } from './connectable-switcher';

@@ -473,3 +473,3 @@

const observeCollection = (connectable: IConnectable | null, collection: Collection) => connectable?.observeCollection(collection);
export const ProxyObservable = Object.freeze({
export const ProxyObservable = /*@__PURE__*/ objectFreeze({
getProxy,

@@ -476,0 +476,0 @@ getRaw,

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

import { createIndexMap, AccessorType, type ICollectionSubscriberCollection, type ICollectionObserver, type CollectionKind } from '../observation';
import { createIndexMap, type AccessorType, type ICollectionSubscriberCollection, type ICollectionObserver, atObserver } from '../observation';
import { CollectionSizeObserver } from './collection-length-observer';

@@ -133,6 +133,6 @@ import { subscriberCollection } from './subscriber-collection';

export interface SetObserver extends ICollectionObserver<CollectionKind.set>, ICollectionSubscriberCollection {}
export interface SetObserver extends ICollectionObserver<'set'>, ICollectionSubscriberCollection {}
export class SetObserver {
public type: AccessorType = AccessorType.Observer;
public type: AccessorType = atObserver;
private lenObs?: CollectionSizeObserver;

@@ -139,0 +139,0 @@

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

import { AccessorType, ICoercionConfiguration, IObserver, InterceptorFunc } from '../observation';
import { ICoercionConfiguration, IObserver, InterceptorFunc, atObserver } from '../observation';
import { subscriberCollection } from './subscriber-collection';

@@ -7,2 +7,3 @@ import { areEqual, def, objectAssign } from '../utilities';

import type {
AccessorType,
ISubscriber,

@@ -20,3 +21,3 @@ ISubscriberCollection,

// todo(bigopon): tweak the flag based on typeof obj (array/set/map/iterator/proxy etc...)
public type: AccessorType = AccessorType.Observer;
public type: AccessorType = atObserver;

@@ -23,0 +24,0 @@ /** @internal */

@@ -69,2 +69,3 @@ import { Metadata } from '@aurelia/metadata';

/** @internal */ export const objectAssign = Object.assign;
/** @internal */ export const objectFreeze = Object.freeze;
// this is used inside template literal, since TS errs without String(...value)

@@ -71,0 +72,0 @@ /** @internal */ export const safeString = String;

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

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