New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(ivy): ensure directive host bindings use the styling algorithm #27134
Conversation
You can preview b5bb890 at https://pr27134-b5bb890.ngbuilds.io/. |
You can preview b1b227e at https://pr27134-b1b227e.ngbuilds.io/. |
You can preview d98994c at https://pr27134-d98994c.ngbuilds.io/. |
@@ -1111,7 +1111,7 @@ export function elementClassProp( | |||
export function elementStyling( | |||
classDeclarations?: (string | boolean | InitialStylingFlags)[] | null, | |||
styleDeclarations?: (string | boolean | InitialStylingFlags)[] | null, | |||
styleSanitizer?: StyleSanitizeFn | null): void { | |||
styleSanitizer?: StyleSanitizeFn | null, directiveIndex?: number): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need docs for the extra argument.
@@ -1153,7 +1153,7 @@ export function elementStyling( | |||
* specifically for element styling--the index must be the next index after the element | |||
* index.) | |||
*/ | |||
export function elementStylingApply(index: number): void { | |||
export function elementStylingApply(index: number, directiveIndex?: number): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need docs for the extra argument.
@@ -50,15 +51,21 @@ export interface StylingInstruction { | |||
* | |||
* The creation/update methods within the builder class produce these instructions. | |||
*/ | |||
interface BindingEntry { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You inserted the interface
in between the comment and class which means that the interface
now has the comment of StyleBuilder
.
Can we come up with a better name for BindingEntry
Perhaps StyleBoundAttribute
or something like that?
const _c0 = ["foo", "baz", ${InitialStylingFlags.VALUES_MODE}, "foo", true, "baz", true]; | ||
const _c1 = ["width", "height", "color", ${InitialStylingFlags.VALUES_MODE}, "width", "200px", "height", "500px"]; | ||
… | ||
hostBindings: function MyComponent_HostBindings(dirIndex, elIndex) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kara I think we may need to do the refactoring for host bindings sooner than later. The correct output here should be
hostBindings: function MyComponent_HostBindings(rf:RenderFlags, dirIndex, elIndex) {
if (rf & RenderFlags.Create) {
$r3$.ɵelementStyling(_c0, _c1, $r3$.ɵdefaultStyleSanitizer, dirIndex);
}
if (rf & RenderFlags.Update) {
$r3$.ɵelementStylingMap(elIndex, $r3$.ɵload(dirIndex).myClass, $r3$.ɵload(dirIndex).myStyle, dirIndex);
$r3$.ɵelementStyleProp(elIndex, 2, $r3$.ɵload(dirIndex).myColorProp, null, dirIndex);
$r3$.ɵelementClassProp(elIndex, 0, $r3$.ɵload(dirIndex).myFooClass, dirIndex);
$r3$.ɵelementStylingApply(elIndex, dirIndex);
}
}
The key here is that the call to elementStyling
should happen only once at initialization, where as the rest of the call need to happen one each binding.
@matsko How are you planning to deal with the above until @kara fixes the runtime?
@matsko Is it in issue that we will have multiple calls to elementStylingApply
From view as well as from host bindings?
You can preview 2a34661 at https://pr27134-2a34661.ngbuilds.io/. |
Merged as #27145 |
… algorithm (angular#27134)" This reverts commit b5dbf51.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
No description provided.