@aurelia/runtime-html
Advanced tools
Comparing version 2.0.1-dev.202411141142 to 2.0.1-dev.202501261023
@@ -42,5 +42,5 @@ import { type IServiceLocator } from '@aurelia/kernel'; | ||
handleCollectionChange(): void; | ||
bind(_scope: Scope): void; | ||
bind(scope: Scope): void; | ||
unbind(): void; | ||
} | ||
//# sourceMappingURL=interpolation-binding.d.ts.map |
@@ -9,3 +9,3 @@ import { type IsBindingBehavior } from '@aurelia/expression-parser'; | ||
readonly onError: (event: Event, error: unknown) => void; | ||
constructor(prevent: boolean, capture: boolean, onError: (event: Event, error: unknown) => void); | ||
constructor(prevent: boolean, capture: boolean | undefined, onError: (event: Event, error: unknown) => void); | ||
} | ||
@@ -12,0 +12,0 @@ export interface ListenerBinding extends IAstEvaluator, IObserverLocatorBasedConnectable, IServiceLocator { |
@@ -179,3 +179,3 @@ import { IContainer } from '@aurelia/kernel'; | ||
register(container: IContainer): IContainer; | ||
customize(cb?: ConfigurationOptionsProvider): any; | ||
customize(cb?: ConfigurationOptionsProvider): /*elided*/ any; | ||
}; | ||
@@ -182,0 +182,0 @@ export type ConfigurationOptionsProvider = (options: IRuntimeHtmlConfigurationOptions) => void; |
{ | ||
"name": "@aurelia/runtime-html", | ||
"version": "2.0.1-dev.202411141142", | ||
"version": "2.0.1-dev.202501261023", | ||
"main": "dist/cjs/index.cjs", | ||
@@ -57,9 +57,9 @@ "module": "dist/esm/index.mjs", | ||
"dependencies": { | ||
"@aurelia/kernel": "2.0.1-dev.202411141142", | ||
"@aurelia/metadata": "2.0.1-dev.202411141142", | ||
"@aurelia/platform": "2.0.1-dev.202411141142", | ||
"@aurelia/platform-browser": "2.0.1-dev.202411141142", | ||
"@aurelia/runtime": "2.0.1-dev.202411141142", | ||
"@aurelia/expression-parser": "2.0.1-dev.202411141142", | ||
"@aurelia/template-compiler": "2.0.1-dev.202411141142" | ||
"@aurelia/kernel": "2.0.1-dev.202501261023", | ||
"@aurelia/metadata": "2.0.1-dev.202501261023", | ||
"@aurelia/platform": "2.0.1-dev.202501261023", | ||
"@aurelia/platform-browser": "2.0.1-dev.202501261023", | ||
"@aurelia/runtime": "2.0.1-dev.202501261023", | ||
"@aurelia/expression-parser": "2.0.1-dev.202501261023", | ||
"@aurelia/template-compiler": "2.0.1-dev.202501261023" | ||
}, | ||
@@ -70,4 +70,4 @@ "devDependencies": { | ||
"engines": { | ||
"node": ">=14.17.0" | ||
"node": ">=20.16.0" | ||
} | ||
} |
@@ -258,5 +258,5 @@ import { type IServiceLocator, isArray } from '@aurelia/kernel'; | ||
public bind(_scope: Scope): void { | ||
public bind(scope: Scope): void { | ||
if (this.isBound) { | ||
if (this._scope === _scope) { | ||
if (this._scope === scope) { | ||
/* istanbul-ignore-next */ | ||
@@ -267,5 +267,5 @@ return; | ||
} | ||
this._scope = _scope; | ||
this._scope = scope; | ||
astBind(this.ast, _scope, this); | ||
astBind(this.ast, scope, this); | ||
@@ -272,0 +272,0 @@ this._value = astEvaluate( |
@@ -275,3 +275,3 @@ import { | ||
fromAnnotationOrDefinitionOrTypeOrDefault('capture', def, Type, returnFalse), | ||
fromDefinitionOrDefault('template', def, returnNull), | ||
fromAnnotationOrDefinitionOrTypeOrDefault('template', def, Type, returnNull), | ||
mergeArrays(def.instructions), | ||
@@ -278,0 +278,0 @@ mergeArrays(getElementAnnotation(Type, 'dependencies'), def.dependencies), |
@@ -1,2 +0,2 @@ | ||
import { IContainer, InstanceProvider, Writable, emptyArray, onResolve, resolve } from '@aurelia/kernel'; | ||
import { IContainer, InstanceProvider, Writable, emptyArray, isFunction, onResolve, resolve } from '@aurelia/kernel'; | ||
import { Scope } from '@aurelia/runtime'; | ||
@@ -216,3 +216,3 @@ import { IInstruction, type HydrateElementInstruction } from '@aurelia/template-compiler'; | ||
), () => { | ||
if (this._hasSlotWatcher) { | ||
if (this._hasSlotWatcher || isFunction(this.slotchange)) { | ||
this._slotwatchers.forEach(w => w.watch(this)); | ||
@@ -219,0 +219,0 @@ this._observe(); |
@@ -150,3 +150,3 @@ import { | ||
this._normalizeToArray(); | ||
this._createScopes(); | ||
this._createScopes(void 0); | ||
@@ -179,3 +179,3 @@ return this._activateAllViews(initiator, this._normalizedItems ?? emptyArray); | ||
this._normalizeToArray(); | ||
this._createScopes(); | ||
this._createScopes(void 0); | ||
this._applyIndexMap(void 0); | ||
@@ -200,3 +200,3 @@ } | ||
this._normalizeToArray(); | ||
this._createScopes(); | ||
this._createScopes(this.key === null ? indexMap : void 0); | ||
this._applyIndexMap(indexMap); | ||
@@ -330,3 +330,3 @@ } | ||
/** @internal */ | ||
private _createScopes(): void { | ||
private _createScopes(indexMap: IndexMap | undefined): void { | ||
const oldScopes = this._scopes; | ||
@@ -347,4 +347,43 @@ this._oldScopes = oldScopes.slice(); | ||
for (let i = 0; i < len; ++i) { | ||
scopes[i] = getScope(oldScopeMap, newScopeMap, items[i], forOf, parentScope, binding, local, hasDestructuredLocal); | ||
if (indexMap === void 0) { | ||
const key = this.key; | ||
const hasKey = key !== null; | ||
if (hasKey) { | ||
const keys = Array<unknown>(len); | ||
if (typeof key === 'string') { | ||
for (let i = 0; i < len; ++i) { | ||
keys[i] = (items[i] as IIndexable)[key]; | ||
} | ||
} else { | ||
for (let i = 0; i < len; ++i) { | ||
// This method of creating a throwaway scope just for key evaluation is inefficient but requires a lot less code this way. | ||
// It seems acceptable for what should be a niche use case and this way it's guaranteed to work correctly in all cases. | ||
// When performance matters, it is advised to use normal string-based keys instead of expressions: | ||
// `repeat.for="i of items; key.bind: i.key" - inefficient | ||
// `repeat.for="i of items; key: key" - efficient | ||
const scope = createScope(items[i], forOf, parentScope, binding, local, hasDestructuredLocal); | ||
setItem(hasDestructuredLocal, forOf.declaration, scope, binding, local, items[i]); | ||
keys[i] = astEvaluate(key, scope, binding, null); | ||
} | ||
} | ||
for (let i = 0; i < len; ++i) { | ||
scopes[i] = getScope(oldScopeMap, newScopeMap, keys[i], items[i], forOf, parentScope, binding, local, hasDestructuredLocal); | ||
} | ||
} else { | ||
for (let i = 0; i < len; ++i) { | ||
scopes[i] = getScope(oldScopeMap, newScopeMap, items[i], items[i], forOf, parentScope, binding, local, hasDestructuredLocal); | ||
} | ||
} | ||
} else { | ||
const oldLen = oldScopes.length; | ||
for (let i = 0; i < len; ++i) { | ||
const src = indexMap[i]; | ||
if (src >= 0 && src < oldLen) { | ||
scopes[i] = oldScopes[src]; | ||
} else { | ||
scopes[i] = createScope(items[i], forOf, parentScope, binding, local, hasDestructuredLocal); | ||
} | ||
setItem(hasDestructuredLocal, forOf.declaration, scopes[i], binding, local, items[i]); | ||
} | ||
} | ||
@@ -853,2 +892,3 @@ | ||
newScopeMap: Map<unknown, Scope | Scope[]>, | ||
key: unknown, | ||
item: unknown, | ||
@@ -861,11 +901,10 @@ forOf: ForOfStatement, | ||
) => { | ||
// let scope = void 0 as Scope | Scope[] | undefined; | ||
let scope = oldScopeMap.get(item); | ||
let scope = oldScopeMap.get(key); | ||
if (scope === void 0) { | ||
scope = createScope(item, forOf, parentScope, binding, local, hasDestructuredLocal); | ||
} else if (scope instanceof Scope) { | ||
oldScopeMap.delete(item); | ||
oldScopeMap.delete(key); | ||
} else if (scope.length === 1) { | ||
scope = scope[0]; | ||
oldScopeMap.delete(item); | ||
oldScopeMap.delete(key); | ||
} else { | ||
@@ -875,6 +914,6 @@ scope = scope.shift()!; | ||
if (newScopeMap.has(item)) { | ||
const entry = newScopeMap.get(item)!; | ||
if (newScopeMap.has(key)) { | ||
const entry = newScopeMap.get(key)!; | ||
if (entry instanceof Scope) { | ||
newScopeMap.set(item, [entry, scope]); | ||
newScopeMap.set(key, [entry, scope]); | ||
} else { | ||
@@ -884,3 +923,3 @@ entry.push(scope); | ||
} else { | ||
newScopeMap.set(item, scope); | ||
newScopeMap.set(key, scope); | ||
} | ||
@@ -887,0 +926,0 @@ setItem(hasDestructuredLocal, forOf.declaration, scope, binding, local, item); |
@@ -168,26 +168,28 @@ import { createLookup, isString, IContainer, resolve } from '@aurelia/kernel'; | ||
if (ii > 0) { | ||
while (ii > i) { | ||
row = rows[i]; | ||
target = targets[i]; | ||
// host is only null when rendering a synthetic view | ||
// but we have a check here so that we dont need to read surrogates unnecessarily | ||
if (host != null) { | ||
row = definition.surrogates; | ||
if ((jj = row.length) > 0) { | ||
j = 0; | ||
jj = row.length; | ||
while (jj > j) { | ||
instruction = row[j]; | ||
renderers[instruction.type].render(controller, target, instruction, this._platform, this._exprParser, this._observerLocator); | ||
renderers[instruction.type].render(controller, host, instruction, this._platform, this._exprParser, this._observerLocator); | ||
++j; | ||
} | ||
++i; | ||
} | ||
} | ||
if (host != null) { | ||
row = definition.surrogates; | ||
if ((jj = row.length) > 0) { | ||
if (ii > 0) { | ||
while (ii > i) { | ||
row = rows[i]; | ||
target = targets[i]; | ||
j = 0; | ||
jj = row.length; | ||
while (jj > j) { | ||
instruction = row[j]; | ||
renderers[instruction.type].render(controller, host, instruction, this._platform, this._exprParser, this._observerLocator); | ||
renderers[instruction.type].render(controller, target, instruction, this._platform, this._exprParser, this._observerLocator); | ||
++j; | ||
} | ||
++i; | ||
} | ||
@@ -194,0 +196,0 @@ } |
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
74170
4079256
+ Added@aurelia/expression-parser@2.0.1-dev.202501261023(transitive)
+ Added@aurelia/kernel@2.0.1-dev.202501261023(transitive)
+ Added@aurelia/metadata@2.0.1-dev.202501261023(transitive)
+ Added@aurelia/platform@2.0.1-dev.202501261023(transitive)
+ Added@aurelia/platform-browser@2.0.1-dev.202501261023(transitive)
+ Added@aurelia/runtime@2.0.1-dev.202501261023(transitive)
+ Added@aurelia/template-compiler@2.0.1-dev.202501261023(transitive)
- Removed@aurelia/expression-parser@2.0.1-dev.202411141142(transitive)
- Removed@aurelia/kernel@2.0.1-dev.202411141142(transitive)
- Removed@aurelia/metadata@2.0.1-dev.202411141142(transitive)
- Removed@aurelia/platform@2.0.1-dev.202411141142(transitive)
- Removed@aurelia/platform-browser@2.0.1-dev.202411141142(transitive)
- Removed@aurelia/runtime@2.0.1-dev.202411141142(transitive)
- Removed@aurelia/template-compiler@2.0.1-dev.202411141142(transitive)