diff --git a/goldens/public-api/core/core.d.ts b/goldens/public-api/core/core.d.ts index dfb7c9cdf3..5bdc411fbb 100644 --- a/goldens/public-api/core/core.d.ts +++ b/goldens/public-api/core/core.d.ts @@ -723,8 +723,6 @@ export declare type ɵɵComponentDefWithMeta = ɵComponentDef; -export declare function ɵɵcomponentHostSyntheticListener(eventName: string, listenerFn: (e?: any) => any, useCapture?: boolean, eventTargetResolver?: GlobalTargetResolver): typeof ɵɵcomponentHostSyntheticListener; - export declare function ɵɵcontentQuery(directiveIndex: number, predicate: Type | InjectionToken | string[], descend: boolean, read?: any): void; export declare function ɵɵCopyDefinitionFeature(definition: ɵDirectiveDef | ɵComponentDef): void; @@ -1054,6 +1052,10 @@ export declare function ɵɵstylePropInterpolate8(prop: string, prefix: string, export declare function ɵɵstylePropInterpolateV(prop: string, values: any[], valueSuffix?: string | null): typeof ɵɵstylePropInterpolateV; +export declare function ɵɵsyntheticHostListener(eventName: string, listenerFn: (e?: any) => any, useCapture?: boolean, eventTargetResolver?: GlobalTargetResolver): typeof ɵɵsyntheticHostListener; + +export declare function ɵɵsyntheticHostProperty(propName: string, value: T | ɵNO_CHANGE, sanitizer?: SanitizerFn | null): typeof ɵɵsyntheticHostProperty; + export declare function ɵɵtemplate(index: number, templateFn: ComponentTemplate | null, decls: number, vars: number, tagName?: string | null, attrsIndex?: number | null, localRefsIndex?: number | null, localRefExtractor?: LocalRefExtractor): void; export declare function ɵɵtemplateRefExtractor(tNode: TNode, currentView: ɵangular_packages_core_core_bp): TemplateRef | null; @@ -1080,8 +1082,6 @@ export declare function ɵɵtextInterpolate8(prefix: string, v0: any, i0: string export declare function ɵɵtextInterpolateV(values: any[]): typeof ɵɵtextInterpolateV; -export declare function ɵɵupdateSyntheticHostBinding(propName: string, value: T | ɵNO_CHANGE, sanitizer?: SanitizerFn | null): typeof ɵɵupdateSyntheticHostBinding; - export declare function ɵɵviewQuery(predicate: Type | InjectionToken | string[], descend: boolean, read?: any): void; export declare const PACKAGE_ROOT_URL: InjectionToken; diff --git a/packages/compiler-cli/test/compliance/r3_compiler_compliance_spec.ts b/packages/compiler-cli/test/compliance/r3_compiler_compliance_spec.ts index aeb7cca37f..b2c777d0e0 100644 --- a/packages/compiler-cli/test/compliance/r3_compiler_compliance_spec.ts +++ b/packages/compiler-cli/test/compliance/r3_compiler_compliance_spec.ts @@ -434,7 +434,7 @@ describe('compiler compliance', () => { hostVars: 14, hostBindings: function MyComponent_HostBindings(rf, ctx) { if (rf & 2) { - $r3$.ɵɵupdateSyntheticHostBinding("@expansionHeight", + $r3$.ɵɵsyntheticHostProperty("@expansionHeight", $r3$.ɵɵpureFunction2(5, $_c1$, ctx.getExpandedState(), $r3$.ɵɵpureFunction2(2, $_c0$, ctx.collapsedHeight, ctx.expandedHeight) ) diff --git a/packages/compiler-cli/test/compliance/r3_view_compiler_binding_spec.ts b/packages/compiler-cli/test/compliance/r3_view_compiler_binding_spec.ts index bbd5801c9a..59b857e7ba 100644 --- a/packages/compiler-cli/test/compliance/r3_view_compiler_binding_spec.ts +++ b/packages/compiler-cli/test/compliance/r3_view_compiler_binding_spec.ts @@ -1000,7 +1000,7 @@ describe('compiler compliance: bindings', () => { hostBindings: function MyDirective_HostBindings(rf, ctx) { … if (rf & 2) { - $r3$.ɵɵupdateSyntheticHostBinding("@expand", ctx.expandedState)("@fadeOut", true)("@shrink", ctx.isSmall); + $r3$.ɵɵsyntheticHostProperty("@expand", ctx.expandedState)("@fadeOut", true)("@shrink", ctx.isSmall); } } `; @@ -1173,7 +1173,7 @@ describe('compiler compliance: bindings', () => { … hostBindings: function MyComponent_HostBindings(rf, ctx) { if (rf & 1) { - $r3$.ɵɵcomponentHostSyntheticListener("@animation.done", function MyComponent_animation_animation_done_HostBindingHandler() { return ctx.done(); })("@animation.start", function MyComponent_animation_animation_start_HostBindingHandler() { return ctx.start(); }); + $r3$.ɵɵsyntheticHostListener("@animation.done", function MyComponent_animation_animation_done_HostBindingHandler() { return ctx.done(); })("@animation.start", function MyComponent_animation_animation_start_HostBindingHandler() { return ctx.start(); }); } } `; @@ -1211,7 +1211,7 @@ describe('compiler compliance: bindings', () => { … hostBindings: function MyComponent_HostBindings(rf, ctx) { if (rf & 1) { - $r3$.ɵɵcomponentHostSyntheticListener("@animation.done", function MyComponent_animation_animation_done_HostBindingHandler() { return ctx.done(); })("@animation.start", function MyComponent_animation_animation_start_HostBindingHandler() { return ctx.start(); }); + $r3$.ɵɵsyntheticHostListener("@animation.done", function MyComponent_animation_animation_done_HostBindingHandler() { return ctx.done(); })("@animation.start", function MyComponent_animation_animation_start_HostBindingHandler() { return ctx.start(); }); $r3$.ɵɵlistener("mousedown", function MyComponent_mousedown_HostBindingHandler() { return ctx.mousedown(); })("mouseup", function MyComponent_mouseup_HostBindingHandler() { return ctx.mouseup(); })("click", function MyComponent_click_HostBindingHandler() { return ctx.click(); }); } } diff --git a/packages/compiler-cli/test/compliance/r3_view_compiler_styling_spec.ts b/packages/compiler-cli/test/compliance/r3_view_compiler_styling_spec.ts index 0ae6c64669..80b97f9df9 100644 --- a/packages/compiler-cli/test/compliance/r3_view_compiler_styling_spec.ts +++ b/packages/compiler-cli/test/compliance/r3_view_compiler_styling_spec.ts @@ -336,9 +336,10 @@ describe('compiler compliance: styling', () => { hostVars: 1, hostBindings: function MyAnimDir_HostBindings(rf, ctx) { if (rf & 1) { - $r3$.ɵɵcomponentHostSyntheticListener("@myAnim.start", function MyAnimDir_animation_myAnim_start_HostBindingHandler() { return ctx.onStart(); })("@myAnim.done", function MyAnimDir_animation_myAnim_done_HostBindingHandler() { return ctx.onDone(); }); - } if (rf & 2) { - $r3$.ɵɵupdateSyntheticHostBinding("@myAnim", ctx.myAnimState); + $r3$.ɵɵsyntheticHostListener("@myAnim.start", function MyAnimDir_animation_myAnim_start_HostBindingHandler() { return ctx.onStart(); })("@myAnim.done", function MyAnimDir_animation_myAnim_done_HostBindingHandler() { return ctx.onDone(); }); + } + if (rf & 2) { + $r3$.ɵɵsyntheticHostProperty("@myAnim", ctx.myAnimState); } } … @@ -2083,7 +2084,7 @@ describe('compiler compliance: styling', () => { hostBindings: function MyDir_HostBindings(rf, ctx) { if (rf & 2) { $r3$.ɵɵhostProperty("title", ctx.title); - $r3$.ɵɵupdateSyntheticHostBinding("@anim", + $r3$.ɵɵsyntheticHostProperty("@anim", $r3$.ɵɵpureFunction2(7, _c1, ctx._animValue, $r3$.ɵɵpureFunction2(4, _c0, ctx._animParam1, ctx._animParam2))); $r3$.ɵɵclassProp("foo", ctx.foo); diff --git a/packages/compiler/src/render3/r3_identifiers.ts b/packages/compiler/src/render3/r3_identifiers.ts index cffefcc612..7d59830c6d 100644 --- a/packages/compiler/src/render3/r3_identifiers.ts +++ b/packages/compiler/src/render3/r3_identifiers.ts @@ -32,11 +32,11 @@ export class Identifiers { static select: o.ExternalReference = {name: 'ɵɵselect', moduleName: CORE}; static advance: o.ExternalReference = {name: 'ɵɵadvance', moduleName: CORE}; - static updateSyntheticHostBinding: - o.ExternalReference = {name: 'ɵɵupdateSyntheticHostBinding', moduleName: CORE}; + static syntheticHostProperty: + o.ExternalReference = {name: 'ɵɵsyntheticHostProperty', moduleName: CORE}; - static componentHostSyntheticListener: - o.ExternalReference = {name: 'ɵɵcomponentHostSyntheticListener', moduleName: CORE}; + static syntheticHostListener: + o.ExternalReference = {name: 'ɵɵsyntheticHostListener', moduleName: CORE}; static attribute: o.ExternalReference = {name: 'ɵɵattribute', moduleName: CORE}; diff --git a/packages/compiler/src/render3/view/compiler.ts b/packages/compiler/src/render3/view/compiler.ts index 1198d999f9..f0c305fe19 100644 --- a/packages/compiler/src/render3/view/compiler.ts +++ b/packages/compiler/src/render3/view/compiler.ts @@ -640,7 +640,7 @@ function createHostBindingsFunction( propertyBindings.push(instructionParams); } else if (instruction === R3.attribute) { attributeBindings.push(instructionParams); - } else if (instruction === R3.updateSyntheticHostBinding) { + } else if (instruction === R3.syntheticHostProperty) { syntheticHostBindings.push(instructionParams); } else { updateStatements.push(o.importExpr(instruction).callFn(instructionParams).toStmt()); @@ -657,7 +657,7 @@ function createHostBindingsFunction( if (syntheticHostBindings.length > 0) { updateStatements.push( - chainedInstruction(R3.updateSyntheticHostBinding, syntheticHostBindings).toStmt()); + chainedInstruction(R3.syntheticHostProperty, syntheticHostBindings).toStmt()); } // since we're dealing with directives/components and both have hostBinding @@ -738,7 +738,7 @@ function getBindingNameAndInstruction(binding: ParsedProperty): // host bindings that have a synthetic property (e.g. @foo) should always be rendered // in the context of the component and not the parent. Therefore there is a special // compatibility instruction available for this purpose. - instruction = R3.updateSyntheticHostBinding; + instruction = R3.syntheticHostProperty; } else { instruction = R3.hostProperty; } @@ -768,8 +768,7 @@ function createHostListeners(eventBindings: ParsedEvent[], name?: string): o.Sta }); if (syntheticListeners.length > 0) { - instructions.push( - chainedInstruction(R3.componentHostSyntheticListener, syntheticListeners).toStmt()); + instructions.push(chainedInstruction(R3.syntheticHostListener, syntheticListeners).toStmt()); } if (listeners.length > 0) { diff --git a/packages/core/src/core_render3_private_export.ts b/packages/core/src/core_render3_private_export.ts index 35fa2b13b8..d20a6449ac 100644 --- a/packages/core/src/core_render3_private_export.ts +++ b/packages/core/src/core_render3_private_export.ts @@ -124,7 +124,6 @@ export { ɵɵclassMapInterpolateV, ɵɵclassProp, ɵɵComponentDefWithMeta, - ɵɵcomponentHostSyntheticListener, ɵɵcontentQuery, ɵɵCopyDefinitionFeature, ɵɵdefineComponent, @@ -227,6 +226,8 @@ export { ɵɵstylePropInterpolate7, ɵɵstylePropInterpolate8, ɵɵstylePropInterpolateV, + ɵɵsyntheticHostListener, + ɵɵsyntheticHostProperty, ɵɵtemplate, ɵɵtemplateRefExtractor, ɵɵtext, @@ -240,7 +241,6 @@ export { ɵɵtextInterpolate7, ɵɵtextInterpolate8, ɵɵtextInterpolateV, - ɵɵupdateSyntheticHostBinding, ɵɵviewQuery, } from './render3/index'; export { diff --git a/packages/core/src/render3/index.ts b/packages/core/src/render3/index.ts index dcd4b75d0c..85764cece7 100644 --- a/packages/core/src/render3/index.ts +++ b/packages/core/src/render3/index.ts @@ -48,7 +48,6 @@ export { ɵɵclassMapInterpolateV, ɵɵclassProp, - ɵɵcomponentHostSyntheticListener, ɵɵdirectiveInject, @@ -113,6 +112,9 @@ export { ɵɵstylePropInterpolate8, ɵɵstylePropInterpolateV, + ɵɵsyntheticHostListener, + ɵɵsyntheticHostProperty, + ɵɵtemplate, ɵɵtext, @@ -126,8 +128,6 @@ export { ɵɵtextInterpolate7, ɵɵtextInterpolate8, ɵɵtextInterpolateV, - - ɵɵupdateSyntheticHostBinding, } from './instructions/all'; export {RenderFlags} from './interfaces/definition'; export { diff --git a/packages/core/src/render3/instructions/host_property.ts b/packages/core/src/render3/instructions/host_property.ts index efff77d42b..a6d2549e68 100644 --- a/packages/core/src/render3/instructions/host_property.ts +++ b/packages/core/src/render3/instructions/host_property.ts @@ -62,9 +62,9 @@ export function ɵɵhostProperty( * * @codeGenApi */ -export function ɵɵupdateSyntheticHostBinding( +export function ɵɵsyntheticHostProperty( propName: string, value: T|NO_CHANGE, - sanitizer?: SanitizerFn|null): typeof ɵɵupdateSyntheticHostBinding { + sanitizer?: SanitizerFn|null): typeof ɵɵsyntheticHostProperty { const lView = getLView(); const bindingIndex = nextBindingIndex(); if (bindingUpdated(lView, bindingIndex, value)) { @@ -75,5 +75,5 @@ export function ɵɵupdateSyntheticHostBinding( elementPropertyInternal(tView, tNode, lView, propName, value, renderer, sanitizer, true); ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, bindingIndex); } - return ɵɵupdateSyntheticHostBinding; + return ɵɵsyntheticHostProperty; } diff --git a/packages/core/src/render3/instructions/listener.ts b/packages/core/src/render3/instructions/listener.ts index 3a8daffc70..4caf2af8e1 100644 --- a/packages/core/src/render3/instructions/listener.ts +++ b/packages/core/src/render3/instructions/listener.ts @@ -68,9 +68,9 @@ export function ɵɵlistener( * * @codeGenApi */ -export function ɵɵcomponentHostSyntheticListener( +export function ɵɵsyntheticHostListener( eventName: string, listenerFn: (e?: any) => any, useCapture = false, - eventTargetResolver?: GlobalTargetResolver): typeof ɵɵcomponentHostSyntheticListener { + eventTargetResolver?: GlobalTargetResolver): typeof ɵɵsyntheticHostListener { const tNode = getPreviousOrParentTNode(); const lView = getLView(); const tView = getTView(); @@ -78,7 +78,7 @@ export function ɵɵcomponentHostSyntheticListener( const renderer = loadComponentRenderer(currentDef, tNode, lView); listenerInternal( tView, lView, renderer, tNode, eventName, listenerFn, useCapture, eventTargetResolver); - return ɵɵcomponentHostSyntheticListener; + return ɵɵsyntheticHostListener; } /** diff --git a/packages/core/src/render3/jit/environment.ts b/packages/core/src/render3/jit/environment.ts index 1377ff40c7..00f3286f18 100644 --- a/packages/core/src/render3/jit/environment.ts +++ b/packages/core/src/render3/jit/environment.ts @@ -75,8 +75,8 @@ export const angularCoreEnv: {[name: string]: Function} = 'ɵɵrestoreView': r3.ɵɵrestoreView, 'ɵɵlistener': r3.ɵɵlistener, 'ɵɵprojection': r3.ɵɵprojection, - 'ɵɵupdateSyntheticHostBinding': r3.ɵɵupdateSyntheticHostBinding, - 'ɵɵcomponentHostSyntheticListener': r3.ɵɵcomponentHostSyntheticListener, + 'ɵɵsyntheticHostProperty': r3.ɵɵsyntheticHostProperty, + 'ɵɵsyntheticHostListener': r3.ɵɵsyntheticHostListener, 'ɵɵpipeBind1': r3.ɵɵpipeBind1, 'ɵɵpipeBind2': r3.ɵɵpipeBind2, 'ɵɵpipeBind3': r3.ɵɵpipeBind3,