@aurelia/runtime-html
Advanced tools
Comparing version
import type { IServiceLocator } from '@aurelia/kernel'; | ||
import { type ICollectionSubscriber, type IObserverLocatorBasedConnectable, type ISubscriber, type Scope, type IAstEvaluator } from '@aurelia/runtime'; | ||
import { type ICollectionSubscriber, type IObserverLocatorBasedConnectable, type ISubscriber, type Scope, type IAstEvaluator, IObserverLocator } from '@aurelia/runtime'; | ||
import { type IsBindingBehavior } from '@aurelia/expression-parser'; | ||
@@ -8,2 +8,3 @@ import { IBinding } from './interfaces-bindings'; | ||
export declare class RefBinding implements IBinding, ISubscriber, ICollectionSubscriber { | ||
oL: IObserverLocator; | ||
ast: IsBindingBehavior; | ||
@@ -14,3 +15,6 @@ target: object; | ||
isBound: boolean; | ||
constructor(locator: IServiceLocator, ast: IsBindingBehavior, target: object, strict: boolean); | ||
constructor(locator: IServiceLocator, oL: IObserverLocator, ast: IsBindingBehavior, target: object, strict: boolean); | ||
updateSource(): void; | ||
handleChange(): void; | ||
handleCollectionChange(): void; | ||
bind(_scope: Scope): void; | ||
@@ -17,0 +21,0 @@ unbind(): void; |
@@ -106,3 +106,3 @@ import { IContainer } from '@aurelia/kernel'; | ||
readonly target: "rj"; | ||
render(renderingCtrl: import(".").IHydratableController, target: import("./dom").INode, instruction: import("@aurelia/template-compiler").RefBindingInstruction, platform: import("./platform").IPlatform, exprParser: import("@aurelia/expression-parser").IExpressionParser): void; | ||
render(renderingCtrl: import(".").IHydratableController, target: import("./dom").INode, instruction: import("@aurelia/template-compiler").RefBindingInstruction, platform: import("./platform").IPlatform, exprParser: import("@aurelia/expression-parser").IExpressionParser, observerLocator: import("@aurelia/runtime").IObserverLocator): void; | ||
}; | ||
@@ -109,0 +109,0 @@ } | { |
@@ -63,3 +63,3 @@ import { type Constructable } from '@aurelia/kernel'; | ||
readonly target: "rj"; | ||
render(renderingCtrl: IHydratableController, target: INode, instruction: RefBindingInstruction, platform: IPlatform, exprParser: IExpressionParser): void; | ||
render(renderingCtrl: IHydratableController, target: INode, instruction: RefBindingInstruction, platform: IPlatform, exprParser: IExpressionParser, observerLocator: IObserverLocator): void; | ||
}; | ||
@@ -66,0 +66,0 @@ }; |
{ | ||
"name": "@aurelia/runtime-html", | ||
"version": "2.0.1-dev.202501261023", | ||
"version": "2.0.1-dev.202502111125", | ||
"main": "dist/cjs/index.cjs", | ||
@@ -57,9 +57,9 @@ "module": "dist/esm/index.mjs", | ||
"dependencies": { | ||
"@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" | ||
"@aurelia/kernel": "2.0.1-dev.202502111125", | ||
"@aurelia/metadata": "2.0.1-dev.202502111125", | ||
"@aurelia/platform": "2.0.1-dev.202502111125", | ||
"@aurelia/platform-browser": "2.0.1-dev.202502111125", | ||
"@aurelia/runtime": "2.0.1-dev.202502111125", | ||
"@aurelia/expression-parser": "2.0.1-dev.202502111125", | ||
"@aurelia/template-compiler": "2.0.1-dev.202502111125" | ||
}, | ||
@@ -66,0 +66,0 @@ "devDependencies": { |
@@ -94,3 +94,3 @@ import { | ||
public updateSource(value: unknown): void { | ||
astAssign(this.ast, this._scope!, this, value); | ||
astAssign(this.ast, this._scope!, this, null, value); | ||
} | ||
@@ -97,0 +97,0 @@ |
@@ -12,4 +12,6 @@ import type { IServiceLocator } from '@aurelia/kernel'; | ||
type IAstEvaluator, | ||
connectable, | ||
IObserverLocator, | ||
} from '@aurelia/runtime'; | ||
import { createPrototypeMixer, mixinAstEvaluator } from './binding-utils'; | ||
import { createPrototypeMixer, mixinAstEvaluator, mixingBindingLimited, mixinUseScope } from './binding-utils'; | ||
import { type IsBindingBehavior } from '@aurelia/expression-parser'; | ||
@@ -21,2 +23,5 @@ import { IBinding } from './interfaces-bindings'; | ||
public static mix = /*@__PURE__*/ createPrototypeMixer(() => { | ||
connectable(RefBinding, null!); | ||
mixingBindingLimited(RefBinding, () => 'updateSource'); | ||
mixinUseScope(RefBinding); | ||
mixinAstEvaluator(RefBinding); | ||
@@ -35,2 +40,3 @@ }); | ||
locator: IServiceLocator, | ||
public oL: IObserverLocator, | ||
public ast: IsBindingBehavior, | ||
@@ -43,2 +49,24 @@ public target: object, | ||
public updateSource() { | ||
if (this.isBound) { | ||
this.obs.version++; | ||
astAssign(this.ast, this._scope!, this, this, this.target); | ||
this.obs.clear(); | ||
} else { | ||
astAssign(this.ast, this._scope!, this, null, null); | ||
} | ||
} | ||
public handleChange(): void { | ||
if (this.isBound) { | ||
this.updateSource(); | ||
} | ||
} | ||
public handleCollectionChange(): void { | ||
if (this.isBound) { | ||
this.updateSource(); | ||
} | ||
} | ||
public bind(_scope: Scope): void { | ||
@@ -56,7 +84,5 @@ if (this.isBound) { | ||
astBind(this.ast, _scope, this); | ||
this.isBound = true; | ||
astAssign(this.ast, this._scope, this, this.target); | ||
// add isBound flag and remove isBinding flag | ||
this.isBound = true; | ||
this.updateSource(); | ||
} | ||
@@ -70,5 +96,6 @@ | ||
this.isBound = false; | ||
this.obs.clearAll(); | ||
if (astEvaluate(this.ast, this._scope!, this, null) === this.target) { | ||
astAssign(this.ast, this._scope!, this, null); | ||
this.updateSource(); | ||
} | ||
@@ -75,0 +102,0 @@ |
@@ -425,2 +425,5 @@ import { | ||
public readonly target = InstructionType.refBinding; | ||
public constructor() { | ||
RefBinding.mix(); | ||
} | ||
public render( | ||
@@ -432,5 +435,7 @@ renderingCtrl: IHydratableController, | ||
exprParser: IExpressionParser, | ||
observerLocator: IObserverLocator | ||
): void { | ||
renderingCtrl.addBinding(new RefBinding( | ||
renderingCtrl.container, | ||
observerLocator, | ||
ensureExpression(exprParser, instruction.from, etIsProperty), | ||
@@ -437,0 +442,0 @@ getRefTarget(target, instruction.to), |
@@ -852,3 +852,3 @@ import { | ||
if (hasDestructuredLocal) { | ||
astAssign(dec, scope, binding, item); | ||
astAssign(dec, scope, binding, null, item); | ||
} else { | ||
@@ -932,3 +932,3 @@ scope.bindingContext[local] = item; | ||
const scope = Scope.fromParent(parentScope, new BindingContext(), new RepeatOverrideContext()); | ||
astAssign(forOf.declaration, scope, binding, item); | ||
astAssign(forOf.declaration, scope, binding, null, item); | ||
} | ||
@@ -935,0 +935,0 @@ return Scope.fromParent(parentScope, new BindingContext(local, item), new RepeatOverrideContext()); |
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
4086215
0.17%74354
0.25%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed