fix(ivy): introduce host-specific styling instructions (#29292)

This patch is the first of a few patches which separates the
styling logic between template bindings (e.g. <div [style])
from host bindings (e.g. @HostBinding('style')). This patch
in particular introduces a series of host-specific styling
instructions and changes the existing set of template styling
instructions not to accept directives. The underyling code (which
communicates with the styling algorithm) still works as it did
before.

This PR also separates the styling instruction code into a separate
file and moves over all other instructions into an dedicated
instructions directory.

PR Close #29292
This commit is contained in:
Matias Niemelä
2019-03-15 13:45:08 -07:00
parent d5e3f2c64b
commit 8714daf276
23 changed files with 736 additions and 432 deletions

View File

@ -119,6 +119,29 @@ export function getLView(): LView {
return lView;
}
let activeHostContext: {}|null = null;
let activeHostElementIndex: number|null = null;
/**
* Sets the active host context (the directive/component instance) and its host element index.
*
* @param host the directive/component instance
* @param index the element index value for the host element where the directive/component instance
* lives
*/
export function setActiveHost(host: {} | null, index: number | null = null) {
activeHostContext = host;
activeHostElementIndex = index;
}
export function getActiveHostContext() {
return activeHostContext;
}
export function getActiveHostElementIndex() {
return activeHostElementIndex;
}
/**
* Restores `contextViewData` to the given OpaqueViewState instance.
*