refactor(ivy): prefix all generated instructions (#29692)
- Updates all instructions to be prefixed with the Greek delta symbol PR Close #29692
This commit is contained in:
parent
db62ccf9eb
commit
138ca5a246
@ -74,7 +74,7 @@ module.exports = new Package('angular-api', [basePackage, typeScriptPackage])
|
||||
|
||||
// API files are typescript
|
||||
readTypeScriptModules.basePath = API_SOURCE_PATH;
|
||||
readTypeScriptModules.ignoreExportsMatching = [/^[_]|^VERSION$/];
|
||||
readTypeScriptModules.ignoreExportsMatching = [/^[_Δ]|^VERSION$/];
|
||||
readTypeScriptModules.hidePrivateMembers = true;
|
||||
|
||||
// NOTE: This list should be in sync with tools/public_api_guard/BUILD.bazel
|
||||
@ -204,7 +204,8 @@ module.exports = new Package('angular-api', [basePackage, typeScriptPackage])
|
||||
|
||||
function addMinLengthRules(checkContentRules) {
|
||||
const createMinLengthRule = require('./content-rules/minLength');
|
||||
const paramRuleSet = checkContentRules.docTypeRules['parameter'] = checkContentRules.docTypeRules['parameter'] || {};
|
||||
const paramRuleSet = checkContentRules.docTypeRules['parameter'] =
|
||||
checkContentRules.docTypeRules['parameter'] || {};
|
||||
const paramRules = paramRuleSet['name'] = paramRuleSet['name'] || [];
|
||||
paramRules.push(createMinLengthRule());
|
||||
}
|
||||
@ -216,7 +217,8 @@ function addHeadingRules(checkContentRules, API_DOC_TYPES) {
|
||||
|
||||
API_DOC_TYPES.forEach(docType => {
|
||||
let rules;
|
||||
const ruleSet = checkContentRules.docTypeRules[docType] = checkContentRules.docTypeRules[docType] || {};
|
||||
const ruleSet = checkContentRules.docTypeRules[docType] =
|
||||
checkContentRules.docTypeRules[docType] || {};
|
||||
|
||||
rules = ruleSet['description'] = ruleSet['description'] || [];
|
||||
rules.push(noMarkdownHeadings);
|
||||
@ -231,16 +233,17 @@ function addHeadingRules(checkContentRules, API_DOC_TYPES) {
|
||||
|
||||
function addAllowedPropertiesRules(checkContentRules, API_CONTAINED_DOC_TYPES) {
|
||||
API_CONTAINED_DOC_TYPES.forEach(docType => {
|
||||
const ruleSet = checkContentRules.docTypeRules[docType] = checkContentRules.docTypeRules[docType] || {};
|
||||
const ruleSet = checkContentRules.docTypeRules[docType] =
|
||||
checkContentRules.docTypeRules[docType] || {};
|
||||
|
||||
const rules = ruleSet['usageNotes'] = ruleSet['usageNotes'] || [];
|
||||
rules.push((doc, prop, value) =>
|
||||
value &&
|
||||
// methods are allowed to have usage notes
|
||||
!isMethod(doc) &&
|
||||
// options on decorators are allowed to ahve usage notes
|
||||
!(doc.containerDoc && doc.containerDoc.docType === 'decorator') &&
|
||||
`Invalid property: "${prop}" is not allowed on "${doc.docType}" docs.`);
|
||||
rules.push(
|
||||
(doc, prop, value) => value &&
|
||||
// methods are allowed to have usage notes
|
||||
!isMethod(doc) &&
|
||||
// options on decorators are allowed to ahve usage notes
|
||||
!(doc.containerDoc && doc.containerDoc.docType === 'decorator') &&
|
||||
`Invalid property: "${prop}" is not allowed on "${doc.docType}" docs.`);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ We explicitly don't consider the following to be our public API surface:
|
||||
|
||||
- any file/import paths within our package except for the `/`, `/testing` and `/bundles/*` and other documented package entry-points.
|
||||
- constructors of injectable classes (services and directives) - please use DI to obtain instances of these classes
|
||||
- any class members or symbols marked as `private`, or prefixed with underscore (`_`) and [barred latin o](https://en.wikipedia.org/wiki/%C6%9F) (`ɵ`)
|
||||
- any class members or symbols marked as `private`, or prefixed with underscore (`_`), [barred latin o](https://en.wikipedia.org/wiki/%C6%9F) (`ɵ`), and [latin delta](https://en.wikipedia.org/wiki/Delta_(letter)) (`Δ`).
|
||||
- extending any of our classes unless the support for this is specifically documented in the API docs
|
||||
- the contents and API surface of the code generated by Angular's compiler (with one notable exception: the existence and name of `NgModuleFactory` instances exported from generated code is guaranteed)
|
||||
|
||||
|
@ -40,25 +40,25 @@ if [[ $? != 0 ]]; then exit 1; fi
|
||||
if [[ $? != 0 ]]; then exit 1; fi
|
||||
|
||||
# Did it compile @angular/core/ApplicationModule correctly?
|
||||
grep "ApplicationModule.ngModuleDef = defineNgModule" node_modules/@angular/core/fesm2015/core.js
|
||||
grep "ApplicationModule.ngModuleDef = ΔdefineNgModule" node_modules/@angular/core/fesm2015/core.js
|
||||
if [[ $? != 0 ]]; then exit 1; fi
|
||||
grep "ApplicationModule.ngModuleDef = defineNgModule" node_modules/@angular/core/fesm5/core.js
|
||||
grep "ApplicationModule.ngModuleDef = ΔdefineNgModule" node_modules/@angular/core/fesm5/core.js
|
||||
if [[ $? != 0 ]]; then exit 1; fi
|
||||
grep "ApplicationModule.ngModuleDef = ɵngcc0.defineNgModule" node_modules/@angular/core/esm2015/src/application_module.js
|
||||
grep "ApplicationModule.ngModuleDef = ɵngcc0.ΔdefineNgModule" node_modules/@angular/core/esm2015/src/application_module.js
|
||||
if [[ $? != 0 ]]; then exit 1; fi
|
||||
grep "ApplicationModule.ngModuleDef = ɵngcc0.defineNgModule" node_modules/@angular/core/esm5/src/application_module.js
|
||||
grep "ApplicationModule.ngModuleDef = ɵngcc0.ΔdefineNgModule" node_modules/@angular/core/esm5/src/application_module.js
|
||||
if [[ $? != 0 ]]; then exit 1; fi
|
||||
|
||||
# Did it transform @angular/core typing files correctly?
|
||||
grep "import [*] as ɵngcc0 from './src/r3_symbols';" node_modules/@angular/core/core.d.ts
|
||||
if [[ $? != 0 ]]; then exit 1; fi
|
||||
grep "static ngInjectorDef: ɵngcc0.InjectorDef<ApplicationModule>;" node_modules/@angular/core/core.d.ts
|
||||
grep "static ngInjectorDef: ɵngcc0.ΔInjectorDef<ApplicationModule>;" node_modules/@angular/core/core.d.ts
|
||||
if [[ $? != 0 ]]; then exit 1; fi
|
||||
|
||||
# Did it generate a base factory call for synthesized constructors correctly?
|
||||
grep "const ɵMatTable_BaseFactory = ɵngcc0.ɵgetInheritedFactory(MatTable);" node_modules/@angular/material/esm2015/table.js
|
||||
grep "const ɵMatTable_BaseFactory = ɵngcc0.ΔgetInheritedFactory(MatTable);" node_modules/@angular/material/esm2015/table.js
|
||||
if [[ $? != 0 ]]; then exit 1; fi
|
||||
grep "const ɵMatTable_BaseFactory = ɵngcc0.ɵgetInheritedFactory(MatTable);" node_modules/@angular/material/esm5/table.es5.js
|
||||
grep "const ɵMatTable_BaseFactory = ɵngcc0.ΔgetInheritedFactory(MatTable);" node_modules/@angular/material/esm5/table.es5.js
|
||||
if [[ $? != 0 ]]; then exit 1; fi
|
||||
|
||||
# Can it be safely run again (as a noop)?
|
||||
|
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {ɵRenderFlags, ɵcontainer, ɵcontainerRefreshEnd, ɵcontainerRefreshStart, ɵdefineComponent, ɵelementEnd, ɵelementStart, ɵelementStyleProp, ɵelementStyling, ɵembeddedViewEnd, ɵembeddedViewStart, ɵinterpolation1, ɵrenderComponent as renderComponent, ɵtext, ɵtextBinding} from '@angular/core';
|
||||
import {ɵRenderFlags, ɵrenderComponent as renderComponent, Δcontainer, ΔcontainerRefreshEnd, ΔcontainerRefreshStart, ΔdefineComponent, ΔelementEnd, ΔelementStart, ΔelementStyleProp, ΔelementStyling, ΔembeddedViewEnd, ΔembeddedViewStart, Δinterpolation1, Δtext, ΔtextBinding} from '@angular/core';
|
||||
|
||||
import {bindAction, profile} from '../../util';
|
||||
import {createDom, destroyDom, detectChanges} from '../render3/tree';
|
||||
@ -18,7 +18,7 @@ export class TreeFunction {
|
||||
data: TreeNode = emptyTree;
|
||||
|
||||
/** @nocollapse */
|
||||
static ngComponentDef = ɵdefineComponent({
|
||||
static ngComponentDef = ΔdefineComponent({
|
||||
type: TreeFunction,
|
||||
selectors: [['tree']],
|
||||
consts: 5,
|
||||
@ -35,38 +35,38 @@ export class TreeFunction {
|
||||
const c1 = ['background-color'];
|
||||
export function TreeTpl(rf: ɵRenderFlags, ctx: TreeNode) {
|
||||
if (rf & ɵRenderFlags.Create) {
|
||||
ɵelementStart(0, 'tree');
|
||||
ΔelementStart(0, 'tree');
|
||||
{
|
||||
ɵelementStart(1, 'span');
|
||||
ɵelementStyling(null, c1);
|
||||
{ ɵtext(2); }
|
||||
ɵelementEnd();
|
||||
ɵcontainer(3);
|
||||
ɵcontainer(4);
|
||||
ΔelementStart(1, 'span');
|
||||
ΔelementStyling(null, c1);
|
||||
{ Δtext(2); }
|
||||
ΔelementEnd();
|
||||
Δcontainer(3);
|
||||
Δcontainer(4);
|
||||
}
|
||||
ɵelementEnd();
|
||||
ΔelementEnd();
|
||||
}
|
||||
if (rf & ɵRenderFlags.Update) {
|
||||
ɵelementStyleProp(1, 0, ctx.depth % 2 ? '' : 'grey');
|
||||
ɵtextBinding(2, ɵinterpolation1(' ', ctx.value, ' '));
|
||||
ɵcontainerRefreshStart(3);
|
||||
ΔelementStyleProp(1, 0, ctx.depth % 2 ? '' : 'grey');
|
||||
ΔtextBinding(2, Δinterpolation1(' ', ctx.value, ' '));
|
||||
ΔcontainerRefreshStart(3);
|
||||
{
|
||||
if (ctx.left != null) {
|
||||
let rf0 = ɵembeddedViewStart(0, 5, 1);
|
||||
let rf0 = ΔembeddedViewStart(0, 5, 1);
|
||||
{ TreeTpl(rf0, ctx.left); }
|
||||
ɵembeddedViewEnd();
|
||||
ΔembeddedViewEnd();
|
||||
}
|
||||
}
|
||||
ɵcontainerRefreshEnd();
|
||||
ɵcontainerRefreshStart(4);
|
||||
ΔcontainerRefreshEnd();
|
||||
ΔcontainerRefreshStart(4);
|
||||
{
|
||||
if (ctx.right != null) {
|
||||
let rf0 = ɵembeddedViewStart(0, 5, 1);
|
||||
let rf0 = ΔembeddedViewStart(0, 5, 1);
|
||||
{ TreeTpl(rf0, ctx.right); }
|
||||
ɵembeddedViewEnd();
|
||||
ΔembeddedViewEnd();
|
||||
}
|
||||
}
|
||||
ɵcontainerRefreshEnd();
|
||||
ΔcontainerRefreshEnd();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import {Directive, DoCheck, Input, ɵRenderFlags, ɵdefineDirective, ɵelementHostStyling, ɵelementHostStylingApply, ɵelementHostStylingMap} from '@angular/core';
|
||||
import {Directive, DoCheck, Input, ɵRenderFlags, ΔdefineDirective, ΔelementHostStyling, ΔelementHostStylingApply, ΔelementHostStylingMap} from '@angular/core';
|
||||
|
||||
import {NgClassImpl, NgClassImplProvider} from './ng_class_impl';
|
||||
|
||||
@ -29,17 +29,17 @@ export const ngClassDirectiveDef__PRE_R3__ = undefined;
|
||||
// used when the VE is not present (note the directive will
|
||||
// never be instantiated normally because it is apart of a
|
||||
// base class)
|
||||
export const ngClassDirectiveDef__POST_R3__ = ɵdefineDirective({
|
||||
export const ngClassDirectiveDef__POST_R3__ = ΔdefineDirective({
|
||||
type: function() {} as any,
|
||||
selectors: null as any,
|
||||
factory: () => {},
|
||||
hostBindings: function(rf: ɵRenderFlags, ctx: any, elIndex: number) {
|
||||
if (rf & ɵRenderFlags.Create) {
|
||||
ɵelementHostStyling();
|
||||
ΔelementHostStyling();
|
||||
}
|
||||
if (rf & ɵRenderFlags.Update) {
|
||||
ɵelementHostStylingMap(ctx.getValue());
|
||||
ɵelementHostStylingApply();
|
||||
ΔelementHostStylingMap(ctx.getValue());
|
||||
ΔelementHostStylingApply();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import {Directive, DoCheck, Input, ɵRenderFlags, ɵdefineDirective, ɵelementHostStyling, ɵelementHostStylingApply, ɵelementHostStylingMap} from '@angular/core';
|
||||
import {Directive, DoCheck, Input, ɵRenderFlags, ΔdefineDirective, ΔelementHostStyling, ΔelementHostStylingApply, ΔelementHostStylingMap} from '@angular/core';
|
||||
|
||||
import {NgStyleImpl, NgStyleImplProvider} from './ng_style_impl';
|
||||
|
||||
@ -29,17 +29,17 @@ export const ngStyleDirectiveDef__PRE_R3__ = undefined;
|
||||
// used when the VE is not present (note the directive will
|
||||
// never be instantiated normally because it is apart of a
|
||||
// base class)
|
||||
export const ngStyleDirectiveDef__POST_R3__ = ɵdefineDirective({
|
||||
export const ngStyleDirectiveDef__POST_R3__ = ΔdefineDirective({
|
||||
type: function() {} as any,
|
||||
selectors: null as any,
|
||||
factory: () => {},
|
||||
hostBindings: function(rf: ɵRenderFlags, ctx: any, elIndex: number) {
|
||||
if (rf & ɵRenderFlags.Create) {
|
||||
ɵelementHostStyling();
|
||||
ΔelementHostStyling();
|
||||
}
|
||||
if (rf & ɵRenderFlags.Update) {
|
||||
ɵelementHostStylingMap(null, ctx.getValue());
|
||||
ɵelementHostStylingApply();
|
||||
ΔelementHostStylingMap(null, ctx.getValue());
|
||||
ΔelementHostStylingApply();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {ErrorHandler, defineInjectable, inject} from '@angular/core';
|
||||
import {ErrorHandler, ΔdefineInjectable, Δinject} from '@angular/core';
|
||||
|
||||
import {DOCUMENT} from './dom_tokens';
|
||||
|
||||
@ -21,9 +21,9 @@ export abstract class ViewportScroller {
|
||||
// De-sugared tree-shakable injection
|
||||
// See #23917
|
||||
/** @nocollapse */
|
||||
static ngInjectableDef = defineInjectable({
|
||||
static ngInjectableDef = ΔdefineInjectable({
|
||||
providedIn: 'root',
|
||||
factory: () => new BrowserViewportScroller(inject(DOCUMENT), window, inject(ErrorHandler))
|
||||
factory: () => new BrowserViewportScroller(Δinject(DOCUMENT), window, Δinject(ErrorHandler))
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -152,11 +152,11 @@ describe('Renderer', () => {
|
||||
const addDefinitionsSpy = renderer.addDefinitions as jasmine.Spy;
|
||||
expect(addDefinitionsSpy.calls.first().args[2])
|
||||
.toEqual(
|
||||
`A.ngComponentDef = ɵngcc0.ɵdefineComponent({ type: A, selectors: [["a"]], factory: function A_Factory(t) { return new (t || A)(); }, consts: 1, vars: 1, template: function A_Template(rf, ctx) { if (rf & 1) {
|
||||
ɵngcc0.ɵtext(0);
|
||||
`A.ngComponentDef = ɵngcc0.ΔdefineComponent({ type: A, selectors: [["a"]], factory: function A_Factory(t) { return new (t || A)(); }, consts: 1, vars: 1, template: function A_Template(rf, ctx) { if (rf & 1) {
|
||||
ɵngcc0.Δtext(0);
|
||||
} if (rf & 2) {
|
||||
ɵngcc0.ɵselect(0);
|
||||
ɵngcc0.ɵtextBinding(0, ɵngcc0.ɵinterpolation1("", ctx.person.name, ""));
|
||||
ɵngcc0.Δselect(0);
|
||||
ɵngcc0.ΔtextBinding(0, ɵngcc0.Δinterpolation1("", ctx.person.name, ""));
|
||||
} }, encapsulation: 2 });
|
||||
/*@__PURE__*/ ɵngcc0.ɵsetClassMetadata(A, [{
|
||||
type: Component,
|
||||
@ -197,7 +197,7 @@ describe('Renderer', () => {
|
||||
}));
|
||||
expect(addDefinitionsSpy.calls.first().args[2])
|
||||
.toEqual(
|
||||
`A.ngDirectiveDef = ɵngcc0.ɵdefineDirective({ type: A, selectors: [["", "a", ""]], factory: function A_Factory(t) { return new (t || A)(); } });
|
||||
`A.ngDirectiveDef = ɵngcc0.ΔdefineDirective({ type: A, selectors: [["", "a", ""]], factory: function A_Factory(t) { return new (t || A)(); } });
|
||||
/*@__PURE__*/ ɵngcc0.ɵsetClassMetadata(A, [{
|
||||
type: Directive,
|
||||
args: [{ selector: '[a]' }]
|
||||
@ -331,7 +331,7 @@ describe('Renderer', () => {
|
||||
const typingsFile = result.find(f => f.path === '/typings/file.d.ts') !;
|
||||
expect(typingsFile.contents)
|
||||
.toContain(
|
||||
'foo(x: number): number;\n static ngDirectiveDef: ɵngcc0.ɵDirectiveDefWithMeta');
|
||||
'foo(x: number): number;\n static ngDirectiveDef: ɵngcc0.ΔDirectiveDefWithMeta');
|
||||
});
|
||||
|
||||
it('should render imports into typings files', () => {
|
||||
|
@ -423,7 +423,7 @@ export class MetadataBundler {
|
||||
result[key] = this.convertFunction(moduleName, value);
|
||||
} else if (isMetadataSymbolicCallExpression(value)) {
|
||||
// Class members can also contain static members that call a function with module
|
||||
// references. e.g. "static ngInjectableDef = defineInjectable(..)". We also need to
|
||||
// references. e.g. "static ngInjectableDef = ΔdefineInjectable(..)". We also need to
|
||||
// convert these module references because otherwise these resolve to non-existent files.
|
||||
result[key] = this.convertValue(moduleName, value);
|
||||
} else {
|
||||
|
@ -48,15 +48,15 @@ export class NoopImportRewriter implements ImportRewriter {
|
||||
* which they're exported from r3_symbols.
|
||||
*/
|
||||
const CORE_SUPPORTED_SYMBOLS = new Map<string, string>([
|
||||
['defineInjectable', 'defineInjectable'],
|
||||
['defineInjector', 'defineInjector'],
|
||||
['ɵdefineNgModule', 'defineNgModule'],
|
||||
['ɵsetNgModuleScope', 'setNgModuleScope'],
|
||||
['inject', 'inject'],
|
||||
['ΔdefineInjectable', 'ΔdefineInjectable'],
|
||||
['ΔdefineInjector', 'ΔdefineInjector'],
|
||||
['ΔdefineNgModule', 'ΔdefineNgModule'],
|
||||
['ΔsetNgModuleScope', 'ΔsetNgModuleScope'],
|
||||
['Δinject', 'Δinject'],
|
||||
['ɵsetClassMetadata', 'setClassMetadata'],
|
||||
['ɵInjectableDef', 'InjectableDef'],
|
||||
['ɵInjectorDef', 'InjectorDef'],
|
||||
['ɵNgModuleDefWithMeta', 'NgModuleDefWithMeta'],
|
||||
['ΔInjectableDef', 'ΔInjectableDef'],
|
||||
['ΔInjectorDef', 'ΔInjectorDef'],
|
||||
['ΔNgModuleDefWithMeta', 'ΔNgModuleDefWithMeta'],
|
||||
['ɵNgModuleFactory', 'NgModuleFactory'],
|
||||
]);
|
||||
|
||||
|
@ -140,7 +140,7 @@ describe('mock_compiler', () => {
|
||||
expectEmit(
|
||||
result.source, `
|
||||
// TODO: this comment should not be taken into account
|
||||
$r3$.ɵtext(0, "Hello!");
|
||||
$r3$.Δtext(0, "Hello!");
|
||||
// TODO: this comment should not be taken into account
|
||||
`,
|
||||
'todo comments should be ignored');
|
||||
@ -214,4 +214,4 @@ describe('mock_compiler', () => {
|
||||
result.source, '$ctx$.$n$ … $ctx$.$n$.length', 'Match names', {'$n$': /(not)_(\1)/});
|
||||
}).toThrowError(/"\$n\$" is "name" which doesn't match \/\(not\)_\(\\1\)\//);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -39,13 +39,13 @@ describe('compiler compliance: bindings', () => {
|
||||
const template = `
|
||||
template:function MyComponent_Template(rf, $ctx$){
|
||||
if (rf & 1) {
|
||||
$i0$.ɵelementStart(0, "div");
|
||||
$i0$.ɵtext(1);
|
||||
$i0$.ɵelementEnd();
|
||||
$i0$.ΔelementStart(0, "div");
|
||||
$i0$.Δtext(1);
|
||||
$i0$.ΔelementEnd();
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵselect(1);
|
||||
$i0$.ɵtextBinding(1, $i0$.ɵinterpolation1("Hello ", $ctx$.name, ""));
|
||||
$r3$.Δselect(1);
|
||||
$i0$.ΔtextBinding(1, $i0$.Δinterpolation1("Hello ", $ctx$.name, ""));
|
||||
}
|
||||
}`;
|
||||
const result = compile(files, angularFiles);
|
||||
@ -78,11 +78,11 @@ describe('compiler compliance: bindings', () => {
|
||||
…
|
||||
template:function MyComponent_Template(rf, $ctx$){
|
||||
if (rf & 1) {
|
||||
$i0$.ɵelement(0, "a", $e0_attrs$);
|
||||
$i0$.Δelement(0, "a", $e0_attrs$);
|
||||
}
|
||||
if (rf & 2) {
|
||||
$i0$.ɵselect(0);
|
||||
$i0$.ɵelementProperty(0, "title", $i0$.ɵbind($ctx$.title));
|
||||
$i0$.Δselect(0);
|
||||
$i0$.ΔelementProperty(0, "title", $i0$.Δbind($ctx$.title));
|
||||
}
|
||||
}`;
|
||||
const result = compile(files, angularFiles);
|
||||
@ -113,11 +113,11 @@ describe('compiler compliance: bindings', () => {
|
||||
…
|
||||
template:function MyComponent_Template(rf, $ctx$){
|
||||
if (rf & 1) {
|
||||
$i0$.ɵelement(0, "a", $e0_attrs$);
|
||||
$i0$.Δelement(0, "a", $e0_attrs$);
|
||||
}
|
||||
if (rf & 2) {
|
||||
$i0$.ɵselect(0);
|
||||
$i0$.ɵelementProperty(0, "title", $i0$.ɵinterpolation1("Hello ", $ctx$.name, ""));
|
||||
$i0$.Δselect(0);
|
||||
$i0$.ΔelementProperty(0, "title", $i0$.Δinterpolation1("Hello ", $ctx$.name, ""));
|
||||
}
|
||||
}`;
|
||||
const result = compile(files, angularFiles);
|
||||
@ -138,7 +138,7 @@ describe('compiler compliance: bindings', () => {
|
||||
}
|
||||
};
|
||||
const result = compile(files, angularFiles);
|
||||
expect(result.source).not.toContain('i0.ɵelementProperty');
|
||||
expect(result.source).not.toContain('i0.ΔelementProperty');
|
||||
});
|
||||
|
||||
it('should not remap property names whose names do not correspond to their attribute names',
|
||||
@ -170,11 +170,11 @@ describe('compiler compliance: bindings', () => {
|
||||
|
||||
function MyComponent_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$i0$.ɵelement(0, "label", _c0);
|
||||
$i0$.Δelement(0, "label", _c0);
|
||||
}
|
||||
if (rf & 2) {
|
||||
$i0$.ɵselect(0);
|
||||
$i0$.ɵelementProperty(0, "for", $i0$.ɵbind(ctx.forValue));
|
||||
$i0$.Δselect(0);
|
||||
$i0$.ΔelementProperty(0, "for", $i0$.Δbind(ctx.forValue));
|
||||
}
|
||||
}`;
|
||||
|
||||
@ -204,16 +204,16 @@ describe('compiler compliance: bindings', () => {
|
||||
};
|
||||
|
||||
const HostBindingDirDeclaration = `
|
||||
HostBindingDir.ngDirectiveDef = $r3$.ɵdefineDirective({
|
||||
HostBindingDir.ngDirectiveDef = $r3$.ΔdefineDirective({
|
||||
type: HostBindingDir,
|
||||
selectors: [["", "hostBindingDir", ""]],
|
||||
factory: function HostBindingDir_Factory(t) { return new (t || HostBindingDir)(); },
|
||||
hostBindings: function HostBindingDir_HostBindings(rf, ctx, elIndex) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵallocHostVars(1);
|
||||
$r3$.ΔallocHostVars(1);
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵelementProperty(elIndex, "id", $r3$.ɵbind(ctx.dirId), null, true);
|
||||
$r3$.ΔelementProperty(elIndex, "id", $r3$.Δbind(ctx.dirId), null, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -251,16 +251,16 @@ describe('compiler compliance: bindings', () => {
|
||||
const HostBindingCompDeclaration = `
|
||||
const $ff$ = function ($v$) { return ["red", $v$]; };
|
||||
…
|
||||
HostBindingComp.ngComponentDef = $r3$.ɵdefineComponent({
|
||||
HostBindingComp.ngComponentDef = $r3$.ΔdefineComponent({
|
||||
type: HostBindingComp,
|
||||
selectors: [["host-binding-comp"]],
|
||||
factory: function HostBindingComp_Factory(t) { return new (t || HostBindingComp)(); },
|
||||
hostBindings: function HostBindingComp_HostBindings(rf, ctx, elIndex) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵallocHostVars(3);
|
||||
$r3$.ΔallocHostVars(3);
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵelementProperty(elIndex, "id", $r3$.ɵbind($r3$.ɵpureFunction1(1, $ff$, ctx.id)), null, true);
|
||||
$r3$.ΔelementProperty(elIndex, "id", $r3$.Δbind($r3$.ΔpureFunction1(1, $ff$, ctx.id)), null, true);
|
||||
}
|
||||
},
|
||||
consts: 0,
|
||||
@ -299,16 +299,16 @@ describe('compiler compliance: bindings', () => {
|
||||
};
|
||||
|
||||
const HostAttributeDirDeclaration = `
|
||||
HostAttributeDir.ngDirectiveDef = $r3$.ɵdefineDirective({
|
||||
HostAttributeDir.ngDirectiveDef = $r3$.ΔdefineDirective({
|
||||
type: HostAttributeDir,
|
||||
selectors: [["", "hostAttributeDir", ""]],
|
||||
factory: function HostAttributeDir_Factory(t) { return new (t || HostAttributeDir)(); },
|
||||
hostBindings: function HostAttributeDir_HostBindings(rf, ctx, elIndex) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵallocHostVars(1);
|
||||
$r3$.ΔallocHostVars(1);
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵelementAttribute(elIndex, "required", $r3$.ɵbind(ctx.required));
|
||||
$r3$.ΔelementAttribute(elIndex, "required", $r3$.Δbind(ctx.required));
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -344,13 +344,13 @@ describe('compiler compliance: bindings', () => {
|
||||
const HostAttributeDirDeclaration = `
|
||||
const $c0$ = ["aria-label", "label"];
|
||||
…
|
||||
HostAttributeDir.ngDirectiveDef = $r3$.ɵdefineDirective({
|
||||
HostAttributeDir.ngDirectiveDef = $r3$.ΔdefineDirective({
|
||||
type: HostAttributeDir,
|
||||
selectors: [["", "hostAttributeDir", ""]],
|
||||
factory: function HostAttributeDir_Factory(t) { return new (t || HostAttributeDir)(); },
|
||||
hostBindings: function HostAttributeDir_HostBindings(rf, ctx, elIndex) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵelementHostAttrs($c0$);
|
||||
$r3$.ΔelementHostAttrs($c0$);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -402,25 +402,25 @@ describe('compiler compliance: bindings', () => {
|
||||
const $c0$ = ["title", "hello there from component", ${AttributeMarker.Styles}, "opacity", "1"];
|
||||
const $c1$ = ["title", "hello there from directive", ${AttributeMarker.Classes}, "one", "two", ${AttributeMarker.Styles}, "width", "200px", "height", "500px"];
|
||||
…
|
||||
HostAttributeComp.ngComponentDef = $r3$.ɵdefineComponent({
|
||||
HostAttributeComp.ngComponentDef = $r3$.ΔdefineComponent({
|
||||
type: HostAttributeComp,
|
||||
selectors: [["my-host-attribute-component"]],
|
||||
factory: function HostAttributeComp_Factory(t) { return new (t || HostAttributeComp)(); },
|
||||
hostBindings: function HostAttributeComp_HostBindings(rf, ctx, elIndex) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵelementHostAttrs($c0$);
|
||||
$r3$.ΔelementHostAttrs($c0$);
|
||||
…
|
||||
}
|
||||
…
|
||||
}
|
||||
…
|
||||
HostAttributeDir.ngDirectiveDef = $r3$.ɵdefineDirective({
|
||||
HostAttributeDir.ngDirectiveDef = $r3$.ΔdefineDirective({
|
||||
type: HostAttributeDir,
|
||||
selectors: [["", "hostAttributeDir", ""]],
|
||||
factory: function HostAttributeDir_Factory(t) { return new (t || HostAttributeDir)(); },
|
||||
hostBindings: function HostAttributeDir_HostBindings(rf, ctx, elIndex) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵelementHostAttrs($c1$);
|
||||
$r3$.ΔelementHostAttrs($c1$);
|
||||
…
|
||||
}
|
||||
…
|
||||
@ -466,19 +466,19 @@ describe('compiler compliance: bindings', () => {
|
||||
…
|
||||
template:function MyComponent_Template(rf, $ctx$){
|
||||
if (rf & 1) {
|
||||
$i0$.ɵelementStart(0, "b", $_c0$, $_c1$);
|
||||
$i0$.ɵdisableBindings();
|
||||
$i0$.ɵelementStart(2, "i");
|
||||
$i0$.ɵtext(3, "Hello {{ name }}!");
|
||||
$i0$.ɵelementEnd();
|
||||
$i0$.ɵenableBindings();
|
||||
$i0$.ɵelementEnd();
|
||||
$i0$.ɵtext(4);
|
||||
$i0$.ΔelementStart(0, "b", $_c0$, $_c1$);
|
||||
$i0$.ΔdisableBindings();
|
||||
$i0$.ΔelementStart(2, "i");
|
||||
$i0$.Δtext(3, "Hello {{ name }}!");
|
||||
$i0$.ΔelementEnd();
|
||||
$i0$.ΔenableBindings();
|
||||
$i0$.ΔelementEnd();
|
||||
$i0$.Δtext(4);
|
||||
}
|
||||
if (rf & 2) {
|
||||
const $_r0$ = $i0$.ɵreference(1);
|
||||
$r3$.ɵselect(4);
|
||||
$i0$.ɵtextBinding(4, $i0$.ɵinterpolation1(" ", $_r0$.id, " "));
|
||||
const $_r0$ = $i0$.Δreference(1);
|
||||
$r3$.Δselect(4);
|
||||
$i0$.ΔtextBinding(4, $i0$.Δinterpolation1(" ", $_r0$.id, " "));
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -498,12 +498,12 @@ describe('compiler compliance: bindings', () => {
|
||||
…
|
||||
template:function MyComponent_Template(rf, $ctx$){
|
||||
if (rf & 1) {
|
||||
$i0$.ɵelementStart(0, "div");
|
||||
$i0$.ɵdisableBindings();
|
||||
$i0$.ɵelement(1, "input", $_c0$);
|
||||
$i0$.ɵtext(2, " {{ myInput.value }} ");
|
||||
$i0$.ɵenableBindings();
|
||||
$i0$.ɵelementEnd();
|
||||
$i0$.ΔelementStart(0, "div");
|
||||
$i0$.ΔdisableBindings();
|
||||
$i0$.Δelement(1, "input", $_c0$);
|
||||
$i0$.Δtext(2, " {{ myInput.value }} ");
|
||||
$i0$.ΔenableBindings();
|
||||
$i0$.ΔelementEnd();
|
||||
}
|
||||
`;
|
||||
const result = compile(files, angularFiles);
|
||||
@ -522,11 +522,11 @@ describe('compiler compliance: bindings', () => {
|
||||
…
|
||||
template:function MyComponent_Template(rf, $ctx$){
|
||||
if (rf & 1) {
|
||||
$i0$.ɵelementStart(0, "div");
|
||||
$i0$.ɵdisableBindings();
|
||||
$i0$.ɵelement(1, "div", $_c0$);
|
||||
$i0$.ɵenableBindings();
|
||||
$i0$.ɵelementEnd();
|
||||
$i0$.ΔelementStart(0, "div");
|
||||
$i0$.ΔdisableBindings();
|
||||
$i0$.Δelement(1, "div", $_c0$);
|
||||
$i0$.ΔenableBindings();
|
||||
$i0$.ΔelementEnd();
|
||||
}
|
||||
`;
|
||||
const result = compile(files, angularFiles);
|
||||
@ -541,7 +541,7 @@ describe('compiler compliance: bindings', () => {
|
||||
const template = `
|
||||
template:function MyComponent_Template(rf, $ctx$){
|
||||
if (rf & 1) {
|
||||
$i0$.ɵelement(0, "div");
|
||||
$i0$.Δelement(0, "div");
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
@ -32,7 +32,7 @@ describe('compiler compliance: dependency injection', () => {
|
||||
export class MyComponent {
|
||||
constructor(
|
||||
@Attribute('name') name:string,
|
||||
s1: MyService,
|
||||
s1: MyService,
|
||||
@Host() s2: MyService,
|
||||
@Self() s4: MyService,
|
||||
@SkipSelf() s3: MyService,
|
||||
@ -50,13 +50,13 @@ describe('compiler compliance: dependency injection', () => {
|
||||
const factory = `
|
||||
factory: function MyComponent_Factory(t) {
|
||||
return new (t || MyComponent)(
|
||||
$r3$.ɵinjectAttribute('name'),
|
||||
$r3$.ɵdirectiveInject(MyService),
|
||||
$r3$.ɵdirectiveInject(MyService, 1),
|
||||
$r3$.ɵdirectiveInject(MyService, 2),
|
||||
$r3$.ɵdirectiveInject(MyService, 4),
|
||||
$r3$.ɵdirectiveInject(MyService, 8),
|
||||
$r3$.ɵdirectiveInject(MyService, 10)
|
||||
$r3$.ΔinjectAttribute('name'),
|
||||
$r3$.ΔdirectiveInject(MyService),
|
||||
$r3$.ΔdirectiveInject(MyService, 1),
|
||||
$r3$.ΔdirectiveInject(MyService, 2),
|
||||
$r3$.ΔdirectiveInject(MyService, 4),
|
||||
$r3$.ΔdirectiveInject(MyService, 8),
|
||||
$r3$.ΔdirectiveInject(MyService, 10)
|
||||
);
|
||||
}`;
|
||||
|
||||
|
@ -38,7 +38,7 @@ describe('compiler compliance: directives', () => {
|
||||
|
||||
// MyComponent definition should be:
|
||||
const MyComponentDefinition = `
|
||||
MyComponent.ngComponentDef = $r3$.ɵdefineComponent({
|
||||
MyComponent.ngComponentDef = $r3$.ΔdefineComponent({
|
||||
type: MyComponent,
|
||||
selectors: [["my-component"]],
|
||||
factory: function MyComponent_Factory(t) { return new (t || MyComponent)(); },
|
||||
@ -46,7 +46,7 @@ describe('compiler compliance: directives', () => {
|
||||
vars: 0,
|
||||
template: function MyComponent_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵelement(0, "div");
|
||||
$r3$.Δelement(0, "div");
|
||||
}
|
||||
},
|
||||
encapsulation: 2
|
||||
@ -84,7 +84,7 @@ describe('compiler compliance: directives', () => {
|
||||
|
||||
// MyComponent definition should be:
|
||||
const MyComponentDefinition = `
|
||||
MyComponent.ngComponentDef = $r3$.ɵdefineComponent({
|
||||
MyComponent.ngComponentDef = $r3$.ΔdefineComponent({
|
||||
type: MyComponent,
|
||||
selectors: [["my-component"]],
|
||||
factory: function MyComponent_Factory(t) { return new (t || MyComponent)(); },
|
||||
@ -92,7 +92,7 @@ describe('compiler compliance: directives', () => {
|
||||
vars: 0,
|
||||
template: function MyComponent_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵelement(0, "div");
|
||||
$r3$.Δelement(0, "div");
|
||||
}
|
||||
},
|
||||
encapsulation: 2
|
||||
@ -132,15 +132,15 @@ describe('compiler compliance: directives', () => {
|
||||
…
|
||||
const _c0 = [${AttributeMarker.Bindings}, "someDirective"];
|
||||
…
|
||||
MyComponent.ngComponentDef = $r3$.ɵdefineComponent({
|
||||
MyComponent.ngComponentDef = $r3$.ΔdefineComponent({
|
||||
…
|
||||
template: function MyComponent_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵelement(0, "div", _c0);
|
||||
$r3$.Δelement(0, "div", _c0);
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵselect(0);
|
||||
$r3$.ɵelementProperty(0, "someDirective", $r3$.ɵbind(true));
|
||||
$r3$.Δselect(0);
|
||||
$r3$.ΔelementProperty(0, "someDirective", $r3$.Δbind(true));
|
||||
}
|
||||
},
|
||||
…
|
||||
@ -187,15 +187,15 @@ describe('compiler compliance: directives', () => {
|
||||
const $_c0$ = ["directiveA", ""];
|
||||
function MyComponent_ng_template_0_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵtext(0, "Some content");
|
||||
$r3$.Δtext(0, "Some content");
|
||||
}
|
||||
}
|
||||
…
|
||||
MyComponent.ngComponentDef = $r3$.ɵdefineComponent({
|
||||
MyComponent.ngComponentDef = $r3$.ΔdefineComponent({
|
||||
…
|
||||
template: function MyComponent_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵtemplate(0, MyComponent_ng_template_0_Template, 1, 0, "ng-template", $_c0$);
|
||||
$r3$.Δtemplate(0, MyComponent_ng_template_0_Template, 1, 0, "ng-template", $_c0$);
|
||||
}
|
||||
},
|
||||
…
|
||||
@ -241,21 +241,21 @@ describe('compiler compliance: directives', () => {
|
||||
const $_c1$ = ["directiveA", ""];
|
||||
function MyComponent_ng_container_0_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵelementContainerStart(0, $_c1$);
|
||||
$r3$.ɵtext(1, "Some content");
|
||||
$r3$.ɵelementContainerEnd();
|
||||
$r3$.ΔelementContainerStart(0, $_c1$);
|
||||
$r3$.Δtext(1, "Some content");
|
||||
$r3$.ΔelementContainerEnd();
|
||||
}
|
||||
}
|
||||
…
|
||||
MyComponent.ngComponentDef = $r3$.ɵdefineComponent({
|
||||
MyComponent.ngComponentDef = $r3$.ΔdefineComponent({
|
||||
…
|
||||
template: function MyComponent_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵtemplate(0, MyComponent_ng_container_0_Template, 2, 0, "ng-container", $_c0$);
|
||||
$r3$.Δtemplate(0, MyComponent_ng_container_0_Template, 2, 0, "ng-container", $_c0$);
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵselect(0);
|
||||
$r3$.ɵelementProperty(0, "ngIf", $r3$.ɵbind(ctx.showing));
|
||||
$r3$.Δselect(0);
|
||||
$r3$.ΔelementProperty(0, "ngIf", $r3$.Δbind(ctx.showing));
|
||||
}
|
||||
},
|
||||
…
|
||||
@ -295,15 +295,15 @@ describe('compiler compliance: directives', () => {
|
||||
…
|
||||
const $c0_a0$ = [${AttributeMarker.Bindings}, "someDirective"];
|
||||
…
|
||||
MyComponent.ngComponentDef = $r3$.ɵdefineComponent({
|
||||
MyComponent.ngComponentDef = $r3$.ΔdefineComponent({
|
||||
…
|
||||
template: function MyComponent_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵtemplate(0, MyComponent_ng_template_0_Template, 0, 0, "ng-template", $c0_a0$);
|
||||
$r3$.Δtemplate(0, MyComponent_ng_template_0_Template, 0, 0, "ng-template", $c0_a0$);
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵselect(0);
|
||||
$r3$.ɵelementProperty(0, "someDirective", $r3$.ɵbind(true));
|
||||
$r3$.Δselect(0);
|
||||
$r3$.ΔelementProperty(0, "someDirective", $r3$.Δbind(true));
|
||||
}
|
||||
},
|
||||
…
|
||||
@ -344,11 +344,11 @@ describe('compiler compliance: directives', () => {
|
||||
…
|
||||
const $c0_a0$ = [${AttributeMarker.Template}, "someDirective"];
|
||||
…
|
||||
MyComponent.ngComponentDef = $r3$.ɵdefineComponent({
|
||||
MyComponent.ngComponentDef = $r3$.ΔdefineComponent({
|
||||
…
|
||||
template: function MyComponent_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵtemplate(0, MyComponent_div_0_Template, 1, 0, "div", $c0_a0$);
|
||||
$r3$.Δtemplate(0, MyComponent_div_0_Template, 1, 0, "div", $c0_a0$);
|
||||
}
|
||||
},
|
||||
…
|
||||
@ -393,13 +393,13 @@ describe('compiler compliance: directives', () => {
|
||||
…
|
||||
const $c0_a0$ = [${AttributeMarker.Bindings}, "someDirective"];
|
||||
…
|
||||
MyComponent.ngComponentDef = $r3$.ɵdefineComponent({
|
||||
MyComponent.ngComponentDef = $r3$.ΔdefineComponent({
|
||||
…
|
||||
template: function MyComponent_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵelementStart(0, "div", $c0_a0$);
|
||||
$r3$.ɵlistener("someDirective", function MyComponent_Template_div_someDirective_0_listener($event) { return ctx.noop(); });
|
||||
$r3$.ɵelementEnd();
|
||||
$r3$.ΔelementStart(0, "div", $c0_a0$);
|
||||
$r3$.Δlistener("someDirective", function MyComponent_Template_div_someDirective_0_listener($event) { return ctx.noop(); });
|
||||
$r3$.ΔelementEnd();
|
||||
}
|
||||
},
|
||||
…
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -52,7 +52,7 @@ describe('compiler compliance: listen()', () => {
|
||||
};
|
||||
|
||||
const componentDef = `
|
||||
MyComponent.ngComponentDef = IDENT.ɵdefineComponent({
|
||||
MyComponent.ngComponentDef = IDENT.ΔdefineComponent({
|
||||
…
|
||||
inputs:{
|
||||
componentInput: "componentInput",
|
||||
@ -66,7 +66,7 @@ describe('compiler compliance: listen()', () => {
|
||||
});`;
|
||||
|
||||
const directiveDef = `
|
||||
MyDirective.ngDirectiveDef = IDENT.ɵdefineDirective({
|
||||
MyDirective.ngDirectiveDef = IDENT.ΔdefineDirective({
|
||||
…
|
||||
inputs:{
|
||||
directiveInput: "directiveInput",
|
||||
|
@ -45,12 +45,12 @@ describe('compiler compliance: listen()', () => {
|
||||
…
|
||||
template: function MyComponent_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵelementStart(0, "div", $e0_attrs$);
|
||||
$r3$.ɵlistener("click", function MyComponent_Template_div_click_0_listener($event) {
|
||||
$r3$.ΔelementStart(0, "div", $e0_attrs$);
|
||||
$r3$.Δlistener("click", function MyComponent_Template_div_click_0_listener($event) {
|
||||
ctx.onClick($event);
|
||||
return (1 == 2);
|
||||
});
|
||||
$r3$.ɵelementEnd();
|
||||
$r3$.ΔelementEnd();
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -91,11 +91,11 @@ describe('compiler compliance: listen()', () => {
|
||||
…
|
||||
template: function MyComponent_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵelementStart(0, "my-app", $e0_attrs$);
|
||||
$r3$.ɵlistener("click", function MyComponent_Template_my_app_click_0_listener($event) {
|
||||
$r3$.ΔelementStart(0, "my-app", $e0_attrs$);
|
||||
$r3$.Δlistener("click", function MyComponent_Template_my_app_click_0_listener($event) {
|
||||
return ctx.onClick($event);
|
||||
});
|
||||
$r3$.ɵelementEnd();
|
||||
$r3$.ΔelementEnd();
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -138,33 +138,33 @@ describe('compiler compliance: listen()', () => {
|
||||
|
||||
function MyComponent_div_0_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
const $s$ = $r3$.ɵgetCurrentView();
|
||||
$r3$.ɵelementStart(0, "div");
|
||||
$r3$.ɵelementStart(1, "div", $e_attrs$);
|
||||
$r3$.ɵlistener("click", function MyComponent_div_0_Template_div_click_1_listener($event) {
|
||||
$r3$.ɵrestoreView($s$);
|
||||
const $comp$ = $r3$.ɵnextContext();
|
||||
const $s$ = $r3$.ΔgetCurrentView();
|
||||
$r3$.ΔelementStart(0, "div");
|
||||
$r3$.ΔelementStart(1, "div", $e_attrs$);
|
||||
$r3$.Δlistener("click", function MyComponent_div_0_Template_div_click_1_listener($event) {
|
||||
$r3$.ΔrestoreView($s$);
|
||||
const $comp$ = $r3$.ΔnextContext();
|
||||
return $comp$.onClick($comp$.foo);
|
||||
});
|
||||
$r3$.ɵelementEnd();
|
||||
$r3$.ɵelementStart(2, "button", $e_attrs$);
|
||||
$r3$.ɵlistener("click", function MyComponent_div_0_Template_button_click_2_listener($event) {
|
||||
$r3$.ɵrestoreView($s$);
|
||||
const $comp2$ = $r3$.ɵnextContext();
|
||||
$r3$.ΔelementEnd();
|
||||
$r3$.ΔelementStart(2, "button", $e_attrs$);
|
||||
$r3$.Δlistener("click", function MyComponent_div_0_Template_button_click_2_listener($event) {
|
||||
$r3$.ΔrestoreView($s$);
|
||||
const $comp2$ = $r3$.ΔnextContext();
|
||||
return $comp2$.onClick2($comp2$.bar);
|
||||
});
|
||||
$r3$.ɵelementEnd();
|
||||
$r3$.ɵelementEnd();
|
||||
$r3$.ΔelementEnd();
|
||||
$r3$.ΔelementEnd();
|
||||
}
|
||||
}
|
||||
// ...
|
||||
template: function MyComponent_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵtemplate(0, MyComponent_div_0_Template, 3, 0, "div", $c0$);
|
||||
$r3$.Δtemplate(0, MyComponent_div_0_Template, 3, 0, "div", $c0$);
|
||||
}
|
||||
if (rf & 2) {
|
||||
$i0$.ɵselect(0);
|
||||
$i0$.ɵelementProperty(0, "ngIf", $i0$.ɵbind(ctx.showing));
|
||||
$i0$.Δselect(0);
|
||||
$i0$.ΔelementProperty(0, "ngIf", $i0$.Δbind(ctx.showing));
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -199,7 +199,7 @@ describe('compiler compliance: listen()', () => {
|
||||
const $e0_attrs$ = [${AttributeMarker.Bindings}, "click"];
|
||||
const $e2_refs$ = ["user", ""];
|
||||
…
|
||||
MyComponent.ngComponentDef = $r3$.ɵdefineComponent({
|
||||
MyComponent.ngComponentDef = $r3$.ΔdefineComponent({
|
||||
type: MyComponent,
|
||||
selectors: [["my-component"]],
|
||||
factory: function MyComponent_Factory(t) { return new (t || MyComponent)(); },
|
||||
@ -207,16 +207,16 @@ describe('compiler compliance: listen()', () => {
|
||||
vars: 0,
|
||||
template: function MyComponent_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
const $s$ = $r3$.ɵgetCurrentView();
|
||||
$r3$.ɵelementStart(0, "button", $e0_attrs$);
|
||||
$r3$.ɵlistener("click", function MyComponent_Template_button_click_0_listener($event) {
|
||||
$r3$.ɵrestoreView($s$);
|
||||
const $user$ = $r3$.ɵreference(3);
|
||||
const $s$ = $r3$.ΔgetCurrentView();
|
||||
$r3$.ΔelementStart(0, "button", $e0_attrs$);
|
||||
$r3$.Δlistener("click", function MyComponent_Template_button_click_0_listener($event) {
|
||||
$r3$.ΔrestoreView($s$);
|
||||
const $user$ = $r3$.Δreference(3);
|
||||
return ctx.onClick($user$.value);
|
||||
});
|
||||
$r3$.ɵtext(1, "Save");
|
||||
$r3$.ɵelementEnd();
|
||||
$r3$.ɵelement(2, "input", null, $e2_refs$);
|
||||
$r3$.Δtext(1, "Save");
|
||||
$r3$.ΔelementEnd();
|
||||
$r3$.Δelement(2, "input", null, $e2_refs$);
|
||||
}
|
||||
},
|
||||
encapsulation: 2
|
||||
|
@ -46,7 +46,7 @@ describe('compiler compliance: providers', () => {
|
||||
const result = compile(files, angularFiles);
|
||||
expectEmit(
|
||||
result.source,
|
||||
'features: [i0.ɵProvidersFeature([GreeterEN, {provide: Greeter, useClass: GreeterEN}], [GreeterEN])],',
|
||||
'features: [i0.ΔProvidersFeature([GreeterEN, {provide: Greeter, useClass: GreeterEN}], [GreeterEN])],',
|
||||
'Incorrect features');
|
||||
});
|
||||
|
||||
@ -79,7 +79,7 @@ describe('compiler compliance: providers', () => {
|
||||
const result = compile(files, angularFiles);
|
||||
expectEmit(
|
||||
result.source,
|
||||
'features: [i0.ɵProvidersFeature([GreeterEN, {provide: Greeter, useClass: GreeterEN}])],',
|
||||
'features: [i0.ΔProvidersFeature([GreeterEN, {provide: Greeter, useClass: GreeterEN}])],',
|
||||
'Incorrect features');
|
||||
});
|
||||
|
||||
@ -111,7 +111,7 @@ describe('compiler compliance: providers', () => {
|
||||
|
||||
const result = compile(files, angularFiles);
|
||||
expectEmit(
|
||||
result.source, 'features: [i0.ɵProvidersFeature([], [GreeterEN])],', 'Incorrect features');
|
||||
result.source, 'features: [i0.ΔProvidersFeature([], [GreeterEN])],', 'Incorrect features');
|
||||
});
|
||||
|
||||
it('should not emit the ProvidersFeature feature when no providers', () => {
|
||||
|
@ -113,7 +113,7 @@ describe('r3_view_compiler', () => {
|
||||
};
|
||||
|
||||
const bV_call =
|
||||
`$r3$.ɵinterpolationV([" ",ctx.list[0]," ",ctx.list[1]," ",ctx.list[2]," ",ctx.list[3],
|
||||
`$r3$.ΔinterpolationV([" ",ctx.list[0]," ",ctx.list[1]," ",ctx.list[2]," ",ctx.list[3],
|
||||
" ",ctx.list[4]," ",ctx.list[5]," ",ctx.list[6]," ",ctx.list[7]," ",ctx.list[8],
|
||||
" "])`;
|
||||
const result = compile(files, angularFiles);
|
||||
@ -143,12 +143,12 @@ describe('r3_view_compiler', () => {
|
||||
const template = `
|
||||
template: function MyApp_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$i0$.ɵelement(0, "div");
|
||||
$i0$.Δelement(0, "div");
|
||||
}
|
||||
if (rf & 2) {
|
||||
$i0$.ɵselect(0);
|
||||
$i0$.ɵelementProperty(0, "@attr", …);
|
||||
$i0$.ɵelementProperty(0, "@binding", …);
|
||||
$i0$.Δselect(0);
|
||||
$i0$.ΔelementProperty(0, "@attr", …);
|
||||
$i0$.ΔelementProperty(0, "@binding", …);
|
||||
}
|
||||
}`;
|
||||
const result = compile(files, angularFiles);
|
||||
@ -176,10 +176,10 @@ describe('r3_view_compiler', () => {
|
||||
const template = `
|
||||
template: function MyApp_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$i0$.ɵelementStart(0, "div");
|
||||
$i0$.ΔelementStart(0, "div");
|
||||
…
|
||||
$i0$.ɵselect(0);
|
||||
$i0$.ɵelementProperty(0, "@mySelector", …);
|
||||
$i0$.Δselect(0);
|
||||
$i0$.ΔelementProperty(0, "@mySelector", …);
|
||||
}
|
||||
}`;
|
||||
const result = compile(files, angularFiles);
|
||||
|
@ -95,7 +95,7 @@ describe('compiler compliance: styling', () => {
|
||||
};
|
||||
|
||||
const template = `
|
||||
MyComponent.ngComponentDef = $r3$.ɵdefineComponent({
|
||||
MyComponent.ngComponentDef = $r3$.ΔdefineComponent({
|
||||
…
|
||||
styles: ["div.cool { color: blue; }", ":host.nice p { color: gold; }"],
|
||||
encapsulation: 1
|
||||
@ -128,7 +128,7 @@ describe('compiler compliance: styling', () => {
|
||||
};
|
||||
|
||||
const template = `
|
||||
MyComponent.ngComponentDef = $r3$.ɵdefineComponent({
|
||||
MyComponent.ngComponentDef = $r3$.ΔdefineComponent({
|
||||
type: MyComponent,
|
||||
selectors:[["my-component"]],
|
||||
factory:function MyComponent_Factory(t){
|
||||
@ -170,7 +170,7 @@ describe('compiler compliance: styling', () => {
|
||||
};
|
||||
|
||||
const template = `
|
||||
MyComponent.ngComponentDef = $r3$.ɵdefineComponent({
|
||||
MyComponent.ngComponentDef = $r3$.ΔdefineComponent({
|
||||
type: MyComponent,
|
||||
selectors:[["my-component"]],
|
||||
factory:function MyComponent_Factory(t){
|
||||
@ -215,23 +215,23 @@ describe('compiler compliance: styling', () => {
|
||||
|
||||
const template = `
|
||||
…
|
||||
MyComponent.ngComponentDef = $r3$.ɵdefineComponent({
|
||||
MyComponent.ngComponentDef = $r3$.ΔdefineComponent({
|
||||
…
|
||||
consts: 3,
|
||||
vars: 3,
|
||||
template: function MyComponent_Template(rf, $ctx$) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵelement(0, "div");
|
||||
$r3$.ɵelement(1, "div");
|
||||
$r3$.ɵelement(2, "div");
|
||||
$r3$.Δelement(0, "div");
|
||||
$r3$.Δelement(1, "div");
|
||||
$r3$.Δelement(2, "div");
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵselect(0);
|
||||
$r3$.ɵelementProperty(0, "@foo", $r3$.ɵbind(ctx.exp));
|
||||
$r3$.ɵselect(1);
|
||||
$r3$.ɵelementProperty(1, "@bar", $r3$.ɵbind(undefined));
|
||||
$r3$.ɵselect(2);
|
||||
$r3$.ɵelementProperty(2, "@baz", $r3$.ɵbind(undefined));
|
||||
$r3$.Δselect(0);
|
||||
$r3$.ΔelementProperty(0, "@foo", $r3$.Δbind(ctx.exp));
|
||||
$r3$.Δselect(1);
|
||||
$r3$.ΔelementProperty(1, "@bar", $r3$.Δbind(undefined));
|
||||
$r3$.Δselect(2);
|
||||
$r3$.ΔelementProperty(2, "@baz", $r3$.Δbind(undefined));
|
||||
}
|
||||
},
|
||||
encapsulation: 2
|
||||
@ -277,19 +277,19 @@ describe('compiler compliance: styling', () => {
|
||||
|
||||
const template = `
|
||||
…
|
||||
MyComponent.ngComponentDef = $r3$.ɵdefineComponent({
|
||||
MyComponent.ngComponentDef = $r3$.ΔdefineComponent({
|
||||
…
|
||||
consts: 1,
|
||||
vars: 1,
|
||||
template: function MyComponent_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵelementStart(0, "div");
|
||||
$r3$.ɵlistener("@myAnimation.start", function MyComponent_Template_div_animation_myAnimation_start_0_listener($event) { return ctx.onStart($event); });
|
||||
$r3$.ɵlistener("@myAnimation.done", function MyComponent_Template_div_animation_myAnimation_done_0_listener($event) { return ctx.onDone($event); });
|
||||
$r3$.ɵelementEnd();
|
||||
$r3$.ΔelementStart(0, "div");
|
||||
$r3$.Δlistener("@myAnimation.start", function MyComponent_Template_div_animation_myAnimation_start_0_listener($event) { return ctx.onStart($event); });
|
||||
$r3$.Δlistener("@myAnimation.done", function MyComponent_Template_div_animation_myAnimation_done_0_listener($event) { return ctx.onDone($event); });
|
||||
$r3$.ΔelementEnd();
|
||||
} if (rf & 2) {
|
||||
$r3$.ɵselect(0);
|
||||
$r3$.ɵelementProperty(0, "@myAnimation", $r3$.ɵbind(ctx.exp));
|
||||
$r3$.Δselect(0);
|
||||
$r3$.ΔelementProperty(0, "@myAnimation", $r3$.Δbind(ctx.exp));
|
||||
}
|
||||
},
|
||||
encapsulation: 2,
|
||||
@ -340,15 +340,15 @@ describe('compiler compliance: styling', () => {
|
||||
};
|
||||
|
||||
const template = `
|
||||
MyAnimDir.ngDirectiveDef = $r3$.ɵdefineDirective({
|
||||
MyAnimDir.ngDirectiveDef = $r3$.ΔdefineDirective({
|
||||
…
|
||||
hostBindings: function MyAnimDir_HostBindings(rf, ctx, elIndex) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵallocHostVars(1);
|
||||
$r3$.ɵcomponentHostSyntheticListener("@myAnim.start", function MyAnimDir_animation_myAnim_start_HostBindingHandler($event) { return ctx.onStart(); });
|
||||
$r3$.ɵcomponentHostSyntheticListener("@myAnim.done", function MyAnimDir_animation_myAnim_done_HostBindingHandler($event) { return ctx.onDone(); });
|
||||
$r3$.ΔallocHostVars(1);
|
||||
$r3$.ΔcomponentHostSyntheticListener("@myAnim.start", function MyAnimDir_animation_myAnim_start_HostBindingHandler($event) { return ctx.onStart(); });
|
||||
$r3$.ΔcomponentHostSyntheticListener("@myAnim.done", function MyAnimDir_animation_myAnim_done_HostBindingHandler($event) { return ctx.onDone(); });
|
||||
} if (rf & 2) {
|
||||
$r3$.ɵcomponentHostSyntheticProperty(elIndex, "@myAnim", $r3$.ɵbind(ctx.myAnimState), null, true);
|
||||
$r3$.ΔcomponentHostSyntheticProperty(elIndex, "@myAnim", $r3$.Δbind(ctx.myAnimState), null, true);
|
||||
}
|
||||
}
|
||||
…
|
||||
@ -384,13 +384,13 @@ describe('compiler compliance: styling', () => {
|
||||
const template = `
|
||||
template: function MyComponent_Template(rf, $ctx$) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵelementStart(0, "div");
|
||||
$r3$.ɵelementStyling(null, null, $r3$.ɵdefaultStyleSanitizer);
|
||||
$r3$.ɵelementEnd();
|
||||
$r3$.ΔelementStart(0, "div");
|
||||
$r3$.ΔelementStyling(null, null, $r3$.ΔdefaultStyleSanitizer);
|
||||
$r3$.ΔelementEnd();
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵelementStylingMap(0, null, $ctx$.myStyleExp);
|
||||
$r3$.ɵelementStylingApply(0);
|
||||
$r3$.ΔelementStylingMap(0, null, $ctx$.myStyleExp);
|
||||
$r3$.ΔelementStylingApply(0);
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -449,13 +449,13 @@ describe('compiler compliance: styling', () => {
|
||||
vars: 1,
|
||||
template: function MyComponentWithInterpolation_Template(rf, $ctx$) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵelementStart(0, "div");
|
||||
$r3$.ɵelementStyling();
|
||||
$r3$.ɵelementEnd();
|
||||
$r3$.ΔelementStart(0, "div");
|
||||
$r3$.ΔelementStyling();
|
||||
$r3$.ΔelementEnd();
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵelementStylingMap(0, $r3$.ɵinterpolation1("foo foo-", $ctx$.fooId, ""));
|
||||
$r3$.ɵelementStylingApply(0);
|
||||
$r3$.ΔelementStylingMap(0, $r3$.Δinterpolation1("foo foo-", $ctx$.fooId, ""));
|
||||
$r3$.ΔelementStylingApply(0);
|
||||
}
|
||||
}
|
||||
…
|
||||
@ -463,13 +463,13 @@ describe('compiler compliance: styling', () => {
|
||||
vars: 2,
|
||||
template: function MyComponentWithMuchosInterpolation_Template(rf, $ctx$) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵelementStart(0, "div");
|
||||
$r3$.ɵelementStyling();
|
||||
$r3$.ɵelementEnd();
|
||||
$r3$.ΔelementStart(0, "div");
|
||||
$r3$.ΔelementStyling();
|
||||
$r3$.ΔelementEnd();
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵelementStylingMap(0, $r3$.ɵinterpolation2("foo foo-", $ctx$.fooId, "-", $ctx$.fooUsername, ""));
|
||||
$r3$.ɵelementStylingApply(0);
|
||||
$r3$.ΔelementStylingMap(0, $r3$.Δinterpolation2("foo foo-", $ctx$.fooId, "-", $ctx$.fooUsername, ""));
|
||||
$r3$.ΔelementStylingApply(0);
|
||||
}
|
||||
}
|
||||
…
|
||||
@ -477,13 +477,13 @@ describe('compiler compliance: styling', () => {
|
||||
vars: 0,
|
||||
template: function MyComponentWithoutInterpolation_Template(rf, $ctx$) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵelementStart(0, "div");
|
||||
$r3$.ɵelementStyling();
|
||||
$r3$.ɵelementEnd();
|
||||
$r3$.ΔelementStart(0, "div");
|
||||
$r3$.ΔelementStyling();
|
||||
$r3$.ΔelementEnd();
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵelementStylingMap(0, $ctx$.exp);
|
||||
$r3$.ɵelementStylingApply(0);
|
||||
$r3$.ΔelementStylingMap(0, $ctx$.exp);
|
||||
$r3$.ΔelementStylingApply(0);
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -523,7 +523,7 @@ describe('compiler compliance: styling', () => {
|
||||
const $_c0$ = [${AttributeMarker.Styles}, "opacity", "1", ${AttributeMarker.Bindings}, "style"];
|
||||
const $_c1$ = ["width", "height"];
|
||||
…
|
||||
MyComponent.ngComponentDef = $r3$.ɵdefineComponent({
|
||||
MyComponent.ngComponentDef = $r3$.ΔdefineComponent({
|
||||
type: MyComponent,
|
||||
selectors:[["my-component"]],
|
||||
factory:function MyComponent_Factory(t){
|
||||
@ -533,17 +533,17 @@ describe('compiler compliance: styling', () => {
|
||||
vars: 1,
|
||||
template: function MyComponent_Template(rf, $ctx$) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵelementStart(0, "div", $_c0$);
|
||||
$r3$.ɵelementStyling(null, $_c1$, $r3$.ɵdefaultStyleSanitizer);
|
||||
$r3$.ɵelementEnd();
|
||||
$r3$.ΔelementStart(0, "div", $_c0$);
|
||||
$r3$.ΔelementStyling(null, $_c1$, $r3$.ΔdefaultStyleSanitizer);
|
||||
$r3$.ΔelementEnd();
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵelementStylingMap(0, null, $ctx$.myStyleExp);
|
||||
$r3$.ɵelementStyleProp(0, 0, $ctx$.myWidth);
|
||||
$r3$.ɵelementStyleProp(0, 1, $ctx$.myHeight);
|
||||
$r3$.ɵelementStylingApply(0);
|
||||
$r3$.ɵselect(0);
|
||||
$r3$.ɵelementAttribute(0, "style", $r3$.ɵbind("border-width: 10px"), $r3$.ɵsanitizeStyle);
|
||||
$r3$.ΔelementStylingMap(0, null, $ctx$.myStyleExp);
|
||||
$r3$.ΔelementStyleProp(0, 0, $ctx$.myWidth);
|
||||
$r3$.ΔelementStyleProp(0, 1, $ctx$.myHeight);
|
||||
$r3$.ΔelementStylingApply(0);
|
||||
$r3$.Δselect(0);
|
||||
$r3$.ΔelementAttribute(0, "style", $r3$.Δbind("border-width: 10px"), $r3$.ΔsanitizeStyle);
|
||||
}
|
||||
},
|
||||
encapsulation: 2
|
||||
@ -583,7 +583,7 @@ describe('compiler compliance: styling', () => {
|
||||
}
|
||||
}
|
||||
|
||||
MyComponent.ngComponentDef = $r3$.ɵdefineComponent({
|
||||
MyComponent.ngComponentDef = $r3$.ΔdefineComponent({
|
||||
type: MyComponent,
|
||||
selectors: [["my-component"]],
|
||||
factory: function MyComponent_Factory(t) {
|
||||
@ -593,13 +593,13 @@ describe('compiler compliance: styling', () => {
|
||||
vars: 0,
|
||||
template: function MyComponent_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵelementStart(0, "div");
|
||||
$r3$.ɵelementStyling(null, _c0, $r3$.ɵdefaultStyleSanitizer);
|
||||
$r3$.ɵelementEnd();
|
||||
$r3$.ΔelementStart(0, "div");
|
||||
$r3$.ΔelementStyling(null, _c0, $r3$.ΔdefaultStyleSanitizer);
|
||||
$r3$.ΔelementEnd();
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵelementStyleProp(0, 0, ctx.myImage);
|
||||
$r3$.ɵelementStylingApply(0);
|
||||
$r3$.ΔelementStyleProp(0, 0, ctx.myImage);
|
||||
$r3$.ΔelementStylingApply(0);
|
||||
}
|
||||
},
|
||||
encapsulation: 2
|
||||
@ -634,13 +634,13 @@ describe('compiler compliance: styling', () => {
|
||||
…
|
||||
template: function MyComponent_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵelementStart(0, "div");
|
||||
$r3$.ɵelementStyling(null, _c0);
|
||||
$r3$.ɵelementEnd();
|
||||
$r3$.ΔelementStart(0, "div");
|
||||
$r3$.ΔelementStyling(null, _c0);
|
||||
$r3$.ΔelementEnd();
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵelementStyleProp(0, 0, 12, "px");
|
||||
$r3$.ɵelementStylingApply(0);
|
||||
$r3$.ΔelementStyleProp(0, 0, 12, "px");
|
||||
$r3$.ΔelementStylingApply(0);
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -675,13 +675,13 @@ describe('compiler compliance: styling', () => {
|
||||
const template = `
|
||||
template: function MyComponent_Template(rf, $ctx$) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵelementStart(0, "div");
|
||||
$r3$.ɵelementStyling();
|
||||
$r3$.ɵelementEnd();
|
||||
$r3$.ΔelementStart(0, "div");
|
||||
$r3$.ΔelementStyling();
|
||||
$r3$.ΔelementEnd();
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵelementStylingMap(0,$ctx$.myClassExp);
|
||||
$r3$.ɵelementStylingApply(0);
|
||||
$r3$.ΔelementStylingMap(0,$ctx$.myClassExp);
|
||||
$r3$.ΔelementStylingApply(0);
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -721,7 +721,7 @@ describe('compiler compliance: styling', () => {
|
||||
const $e0_attrs$ = [${AttributeMarker.Classes}, "grape", ${AttributeMarker.Bindings}, "class"];
|
||||
const $e0_bindings$ = ["apple", "orange"];
|
||||
…
|
||||
MyComponent.ngComponentDef = $r3$.ɵdefineComponent({
|
||||
MyComponent.ngComponentDef = $r3$.ΔdefineComponent({
|
||||
type: MyComponent,
|
||||
selectors:[["my-component"]],
|
||||
factory:function MyComponent_Factory(t){
|
||||
@ -731,17 +731,17 @@ describe('compiler compliance: styling', () => {
|
||||
vars: 1,
|
||||
template: function MyComponent_Template(rf, $ctx$) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵelementStart(0, "div", $e0_attrs$);
|
||||
$r3$.ɵelementStyling($e0_bindings$);
|
||||
$r3$.ɵelementEnd();
|
||||
$r3$.ΔelementStart(0, "div", $e0_attrs$);
|
||||
$r3$.ΔelementStyling($e0_bindings$);
|
||||
$r3$.ΔelementEnd();
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵelementStylingMap(0, $ctx$.myClassExp);
|
||||
$r3$.ɵelementClassProp(0, 0, $ctx$.yesToApple);
|
||||
$r3$.ɵelementClassProp(0, 1, $ctx$.yesToOrange);
|
||||
$r3$.ɵelementStylingApply(0);
|
||||
$r3$.ɵselect(0);
|
||||
$r3$.ɵelementAttribute(0, "class", $r3$.ɵbind("banana"));
|
||||
$r3$.ΔelementStylingMap(0, $ctx$.myClassExp);
|
||||
$r3$.ΔelementClassProp(0, 0, $ctx$.yesToApple);
|
||||
$r3$.ΔelementClassProp(0, 1, $ctx$.yesToOrange);
|
||||
$r3$.ΔelementStylingApply(0);
|
||||
$r3$.Δselect(0);
|
||||
$r3$.ΔelementAttribute(0, "class", $r3$.Δbind("banana"));
|
||||
}
|
||||
},
|
||||
encapsulation: 2
|
||||
@ -777,7 +777,7 @@ describe('compiler compliance: styling', () => {
|
||||
const template = `
|
||||
const $e0_attrs$ = [${AttributeMarker.Classes}, "foo", ${AttributeMarker.Styles}, "width", "100px", ${AttributeMarker.Bindings}, "class", "style"];
|
||||
…
|
||||
MyComponent.ngComponentDef = $r3$.ɵdefineComponent({
|
||||
MyComponent.ngComponentDef = $r3$.ΔdefineComponent({
|
||||
type: MyComponent,
|
||||
selectors:[["my-component"]],
|
||||
factory:function MyComponent_Factory(t){
|
||||
@ -787,12 +787,12 @@ describe('compiler compliance: styling', () => {
|
||||
vars: 2,
|
||||
template: function MyComponent_Template(rf, $ctx$) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵelement(0, "div", $e0_attrs$);
|
||||
$r3$.Δelement(0, "div", $e0_attrs$);
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵselect(0);
|
||||
$r3$.ɵelementAttribute(0, "class", $r3$.ɵbind("round"));
|
||||
$r3$.ɵelementAttribute(0, "style", $r3$.ɵbind("height:100px"), $r3$.ɵsanitizeStyle);
|
||||
$r3$.Δselect(0);
|
||||
$r3$.ΔelementAttribute(0, "class", $r3$.Δbind("round"));
|
||||
$r3$.ΔelementAttribute(0, "style", $r3$.Δbind("height:100px"), $r3$.ΔsanitizeStyle);
|
||||
}
|
||||
},
|
||||
encapsulation: 2
|
||||
@ -829,13 +829,13 @@ describe('compiler compliance: styling', () => {
|
||||
const template = `
|
||||
template: function MyComponent_Template(rf, $ctx$) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵelementStart(0, "div");
|
||||
$r3$.ɵelementStyling(null, null, $r3$.ɵdefaultStyleSanitizer);
|
||||
$r3$.ɵelementEnd();
|
||||
$r3$.ΔelementStart(0, "div");
|
||||
$r3$.ΔelementStyling(null, null, $r3$.ΔdefaultStyleSanitizer);
|
||||
$r3$.ΔelementEnd();
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵelementStylingMap(0, $ctx$.myClassExp, $ctx$.myStyleExp);
|
||||
$r3$.ɵelementStylingApply(0);
|
||||
$r3$.ΔelementStylingMap(0, $ctx$.myClassExp, $ctx$.myStyleExp);
|
||||
$r3$.ΔelementStylingApply(0);
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -869,15 +869,15 @@ describe('compiler compliance: styling', () => {
|
||||
const template = `
|
||||
template: function MyComponent_Template(rf, $ctx$) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵelementStart(0, "div");
|
||||
$r3$.ɵelementStyling(null, null, $r3$.ɵdefaultStyleSanitizer);
|
||||
$r3$.ɵpipe(1, "classPipe");
|
||||
$r3$.ɵpipe(2, "stylePipe");
|
||||
$r3$.ɵelementEnd();
|
||||
$r3$.ΔelementStart(0, "div");
|
||||
$r3$.ΔelementStyling(null, null, $r3$.ΔdefaultStyleSanitizer);
|
||||
$r3$.Δpipe(1, "classPipe");
|
||||
$r3$.Δpipe(2, "stylePipe");
|
||||
$r3$.ΔelementEnd();
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵelementStylingMap(0, $r3$.ɵpipeBind1(1, 0, $ctx$.myClassExp), $r3$.ɵpipeBind1(2, 2, $ctx$.myStyleExp));
|
||||
$r3$.ɵelementStylingApply(0);
|
||||
$r3$.ΔelementStylingMap(0, $r3$.ΔpipeBind1(1, 0, $ctx$.myClassExp), $r3$.ΔpipeBind1(2, 2, $ctx$.myStyleExp));
|
||||
$r3$.ΔelementStylingApply(0);
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -922,23 +922,23 @@ describe('compiler compliance: styling', () => {
|
||||
…
|
||||
template: function MyComponent_Template(rf, $ctx$) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵelementStart(0, "div");
|
||||
$r3$.ɵelementStyling($e0_classBindings$, $e0_styleBindings$, $r3$.ɵdefaultStyleSanitizer);
|
||||
$r3$.ɵpipe(1, "pipe");
|
||||
$r3$.ɵpipe(2, "pipe");
|
||||
$r3$.ɵpipe(3, "pipe");
|
||||
$r3$.ɵpipe(4, "pipe");
|
||||
$r3$.ɵtext(5);
|
||||
$r3$.ɵelementEnd();
|
||||
$r3$.ΔelementStart(0, "div");
|
||||
$r3$.ΔelementStyling($e0_classBindings$, $e0_styleBindings$, $r3$.ΔdefaultStyleSanitizer);
|
||||
$r3$.Δpipe(1, "pipe");
|
||||
$r3$.Δpipe(2, "pipe");
|
||||
$r3$.Δpipe(3, "pipe");
|
||||
$r3$.Δpipe(4, "pipe");
|
||||
$r3$.Δtext(5);
|
||||
$r3$.ΔelementEnd();
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵelementStylingMap(0, $e2_styling$, $r3$.ɵpipeBind2(1, 1, $ctx$.myStyleExp, 1000));
|
||||
$r3$.ɵelementStyleProp(0, 0, $r3$.ɵpipeBind2(2, 4, $ctx$.barExp, 3000));
|
||||
$r3$.ɵelementStyleProp(0, 1, $r3$.ɵpipeBind2(3, 7, $ctx$.bazExp, 4000));
|
||||
$r3$.ɵelementClassProp(0, 0, $r3$.ɵpipeBind2(4, 10, $ctx$.fooExp, 2000));
|
||||
$r3$.ɵelementStylingApply(0);
|
||||
$r3$.ɵselect(5);
|
||||
$r3$.ɵtextBinding(5, $r3$.ɵinterpolation1(" ", $ctx$.item, ""));
|
||||
$r3$.ΔelementStylingMap(0, $e2_styling$, $r3$.ΔpipeBind2(1, 1, $ctx$.myStyleExp, 1000));
|
||||
$r3$.ΔelementStyleProp(0, 0, $r3$.ΔpipeBind2(2, 4, $ctx$.barExp, 3000));
|
||||
$r3$.ΔelementStyleProp(0, 1, $r3$.ΔpipeBind2(3, 7, $ctx$.bazExp, 4000));
|
||||
$r3$.ΔelementClassProp(0, 0, $r3$.ΔpipeBind2(4, 10, $ctx$.fooExp, 2000));
|
||||
$r3$.ΔelementStylingApply(0);
|
||||
$r3$.Δselect(5);
|
||||
$r3$.ΔtextBinding(5, $r3$.Δinterpolation1(" ", $ctx$.item, ""));
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -990,14 +990,14 @@ describe('compiler compliance: styling', () => {
|
||||
…
|
||||
hostBindings: function MyComponent_HostBindings(rf, ctx, elIndex) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵelementHostAttrs($e0_attrs$);
|
||||
$r3$.ɵelementHostStyling($e0_classBindings$, $e0_styleBindings$, $r3$.ɵdefaultStyleSanitizer);
|
||||
$r3$.ΔelementHostAttrs($e0_attrs$);
|
||||
$r3$.ΔelementHostStyling($e0_classBindings$, $e0_styleBindings$, $r3$.ΔdefaultStyleSanitizer);
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵelementHostStylingMap(ctx.myClass, ctx.myStyle);
|
||||
$r3$.ɵelementHostStyleProp(0, ctx.myColorProp);
|
||||
$r3$.ɵelementHostClassProp(0, ctx.myFooClass);
|
||||
$r3$.ɵelementHostStylingApply();
|
||||
$r3$.ΔelementHostStylingMap(ctx.myClass, ctx.myStyle);
|
||||
$r3$.ΔelementHostStyleProp(0, ctx.myColorProp);
|
||||
$r3$.ΔelementHostClassProp(0, ctx.myFooClass);
|
||||
$r3$.ΔelementHostStylingApply();
|
||||
}
|
||||
},
|
||||
consts: 0,
|
||||
@ -1051,15 +1051,15 @@ describe('compiler compliance: styling', () => {
|
||||
…
|
||||
hostBindings: function MyComponent_HostBindings(rf, ctx, elIndex) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵelementHostStyling(_c0, _c1, $r3$.ɵdefaultStyleSanitizer);
|
||||
$r3$.ΔelementHostStyling(_c0, _c1, $r3$.ΔdefaultStyleSanitizer);
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵelementHostStylingMap(ctx.myClasses, ctx.myStyle);
|
||||
$r3$.ɵelementHostStyleProp(0, ctx.myHeightProp, "pt");
|
||||
$r3$.ɵelementHostStyleProp(1, ctx.myWidthProp);
|
||||
$r3$.ɵelementHostClassProp(0, ctx.myBarClass);
|
||||
$r3$.ɵelementHostClassProp(1, ctx.myFooClass);
|
||||
$r3$.ɵelementHostStylingApply();
|
||||
$r3$.ΔelementHostStylingMap(ctx.myClasses, ctx.myStyle);
|
||||
$r3$.ΔelementHostStyleProp(0, ctx.myHeightProp, "pt");
|
||||
$r3$.ΔelementHostStyleProp(1, ctx.myWidthProp);
|
||||
$r3$.ΔelementHostClassProp(0, ctx.myBarClass);
|
||||
$r3$.ΔelementHostClassProp(1, ctx.myFooClass);
|
||||
$r3$.ΔelementHostStylingApply();
|
||||
}
|
||||
},
|
||||
consts: 0,
|
||||
@ -1113,15 +1113,15 @@ describe('compiler compliance: styling', () => {
|
||||
…
|
||||
function MyComponent_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵelementStart(0, "div");
|
||||
$r3$.ɵelementStyling(_c2, _c3, $r3$.ɵdefaultStyleSanitizer);
|
||||
$r3$.ɵelementEnd();
|
||||
$r3$.ΔelementStart(0, "div");
|
||||
$r3$.ΔelementStyling(_c2, _c3, $r3$.ΔdefaultStyleSanitizer);
|
||||
$r3$.ΔelementEnd();
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵelementStylingMap(0, ctx.myClassExp, ctx.myStyleExp);
|
||||
$r3$.ɵelementStyleProp(0, 0, ctx.myHeightExp, null, true);
|
||||
$r3$.ɵelementClassProp(0, 0, ctx.myBarClassExp, true);
|
||||
$r3$.ɵelementStylingApply(0);
|
||||
$r3$.ΔelementStylingMap(0, ctx.myClassExp, ctx.myStyleExp);
|
||||
$r3$.ΔelementStyleProp(0, 0, ctx.myHeightExp, null, true);
|
||||
$r3$.ΔelementClassProp(0, 0, ctx.myBarClassExp, true);
|
||||
$r3$.ΔelementStylingApply(0);
|
||||
}
|
||||
},
|
||||
`;
|
||||
@ -1132,13 +1132,13 @@ describe('compiler compliance: styling', () => {
|
||||
…
|
||||
hostBindings: function MyComponent_HostBindings(rf, ctx, elIndex) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵelementHostStyling(_c0, _c1, $r3$.ɵdefaultStyleSanitizer);
|
||||
$r3$.ΔelementHostStyling(_c0, _c1, $r3$.ΔdefaultStyleSanitizer);
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵelementHostStylingMap(ctx.myClassExp, ctx.myStyleExp);
|
||||
$r3$.ɵelementHostStyleProp(0, ctx.myWidthExp, null, true);
|
||||
$r3$.ɵelementHostClassProp(0, ctx.myFooClassExp, true);
|
||||
$r3$.ɵelementHostStylingApply();
|
||||
$r3$.ΔelementHostStylingMap(ctx.myClassExp, ctx.myStyleExp);
|
||||
$r3$.ΔelementHostStyleProp(0, ctx.myWidthExp, null, true);
|
||||
$r3$.ΔelementHostClassProp(0, ctx.myFooClassExp, true);
|
||||
$r3$.ΔelementHostStylingApply();
|
||||
}
|
||||
},
|
||||
`;
|
||||
@ -1200,33 +1200,33 @@ describe('compiler compliance: styling', () => {
|
||||
…
|
||||
function ClassDirective_HostBindings(rf, ctx, elIndex) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵelementHostStyling();
|
||||
$r3$.ΔelementHostStyling();
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵelementHostStylingMap(ctx.myClassMap);
|
||||
$r3$.ɵelementHostStylingApply();
|
||||
$r3$.ΔelementHostStylingMap(ctx.myClassMap);
|
||||
$r3$.ΔelementHostStylingApply();
|
||||
}
|
||||
}
|
||||
…
|
||||
function WidthDirective_HostBindings(rf, ctx, elIndex) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵelementHostStyling($widthDir_classes$, $widthDir_styles$);
|
||||
$r3$.ΔelementHostStyling($widthDir_classes$, $widthDir_styles$);
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵelementHostStyleProp(0, ctx.myWidth);
|
||||
$r3$.ɵelementHostClassProp(0, ctx.myFooClass);
|
||||
$r3$.ɵelementHostStylingApply();
|
||||
$r3$.ΔelementHostStyleProp(0, ctx.myWidth);
|
||||
$r3$.ΔelementHostClassProp(0, ctx.myFooClass);
|
||||
$r3$.ΔelementHostStylingApply();
|
||||
}
|
||||
}
|
||||
…
|
||||
function HeightDirective_HostBindings(rf, ctx, elIndex) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵelementHostStyling($heightDir_classes$, $heightDir_styles$);
|
||||
$r3$.ΔelementHostStyling($heightDir_classes$, $heightDir_styles$);
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵelementHostStyleProp(0, ctx.myHeight);
|
||||
$r3$.ɵelementHostClassProp(0, ctx.myBarClass);
|
||||
$r3$.ɵelementHostStylingApply();
|
||||
$r3$.ΔelementHostStyleProp(0, ctx.myHeight);
|
||||
$r3$.ΔelementHostClassProp(0, ctx.myBarClass);
|
||||
$r3$.ΔelementHostStylingApply();
|
||||
}
|
||||
}
|
||||
…
|
||||
@ -1280,15 +1280,15 @@ describe('compiler compliance: styling', () => {
|
||||
…
|
||||
hostBindings: function MyComponent_HostBindings(rf, ctx, elIndex) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵallocHostVars(2);
|
||||
$r3$.ɵelementHostAttrs($_c0$);
|
||||
$r3$.ɵelementHostStyling(null, null, $r3$.ɵdefaultStyleSanitizer);
|
||||
$r3$.ΔallocHostVars(2);
|
||||
$r3$.ΔelementHostAttrs($_c0$);
|
||||
$r3$.ΔelementHostStyling(null, null, $r3$.ΔdefaultStyleSanitizer);
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵelementProperty(elIndex, "id", $r3$.ɵbind(ctx.id), null, true);
|
||||
$r3$.ɵelementProperty(elIndex, "title", $r3$.ɵbind(ctx.title), null, true);
|
||||
$r3$.ɵelementHostStylingMap(ctx.myClass, ctx.myStyle);
|
||||
$r3$.ɵelementHostStylingApply();
|
||||
$r3$.ΔelementProperty(elIndex, "id", $r3$.Δbind(ctx.id), null, true);
|
||||
$r3$.ΔelementProperty(elIndex, "title", $r3$.Δbind(ctx.title), null, true);
|
||||
$r3$.ΔelementHostStylingMap(ctx.myClass, ctx.myStyle);
|
||||
$r3$.ΔelementHostStylingApply();
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -1327,15 +1327,15 @@ describe('compiler compliance: styling', () => {
|
||||
…
|
||||
hostBindings: function WidthDirective_HostBindings(rf, ctx, elIndex) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵallocHostVars(2);
|
||||
$r3$.ɵelementHostStyling($_c0$, $_c1$);
|
||||
$r3$.ΔallocHostVars(2);
|
||||
$r3$.ΔelementHostStyling($_c0$, $_c1$);
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵelementProperty(elIndex, "id", $r3$.ɵbind(ctx.id), null, true);
|
||||
$r3$.ɵelementProperty(elIndex, "title", $r3$.ɵbind(ctx.title), null, true);
|
||||
$r3$.ɵelementHostStyleProp(0, ctx.myWidth);
|
||||
$r3$.ɵelementHostClassProp(0, ctx.myFooClass);
|
||||
$r3$.ɵelementHostStylingApply();
|
||||
$r3$.ΔelementProperty(elIndex, "id", $r3$.Δbind(ctx.id), null, true);
|
||||
$r3$.ΔelementProperty(elIndex, "title", $r3$.Δbind(ctx.title), null, true);
|
||||
$r3$.ΔelementHostStyleProp(0, ctx.myWidth);
|
||||
$r3$.ΔelementHostClassProp(0, ctx.myFooClass);
|
||||
$r3$.ΔelementHostStylingApply();
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
@ -56,65 +56,65 @@ describe('compiler compliance: template', () => {
|
||||
function MyComponent_ul_0_li_1_div_1_Template(rf, ctx) {
|
||||
|
||||
if (rf & 1) {
|
||||
const $s$ = $i0$.ɵgetCurrentView();
|
||||
$i0$.ɵelementStart(0, "div", $c2$);
|
||||
$i0$.ɵlistener("click", function MyComponent_ul_0_li_1_div_1_Template_div_click_0_listener($event){
|
||||
$i0$.ɵrestoreView($s$);
|
||||
const $s$ = $i0$.ΔgetCurrentView();
|
||||
$i0$.ΔelementStart(0, "div", $c2$);
|
||||
$i0$.Δlistener("click", function MyComponent_ul_0_li_1_div_1_Template_div_click_0_listener($event){
|
||||
$i0$.ΔrestoreView($s$);
|
||||
const $inner$ = ctx.$implicit;
|
||||
const $middle$ = $i0$.ɵnextContext().$implicit;
|
||||
const $outer$ = $i0$.ɵnextContext().$implicit;
|
||||
const $myComp$ = $i0$.ɵnextContext();
|
||||
const $middle$ = $i0$.ΔnextContext().$implicit;
|
||||
const $outer$ = $i0$.ΔnextContext().$implicit;
|
||||
const $myComp$ = $i0$.ΔnextContext();
|
||||
return $myComp$.onClick($outer$, $middle$, $inner$);
|
||||
});
|
||||
$i0$.ɵtext(1);
|
||||
$i0$.ɵelementEnd();
|
||||
$i0$.Δtext(1);
|
||||
$i0$.ΔelementEnd();
|
||||
}
|
||||
|
||||
if (rf & 2) {
|
||||
const $inner1$ = ctx.$implicit;
|
||||
const $middle1$ = $i0$.ɵnextContext().$implicit;
|
||||
const $outer1$ = $i0$.ɵnextContext().$implicit;
|
||||
const $myComp1$ = $i0$.ɵnextContext();
|
||||
$i0$.ɵselect(0);
|
||||
$i0$.ɵelementProperty(0, "title", $i0$.ɵbind($myComp1$.format($outer1$, $middle1$, $inner1$, $myComp1$.component)));
|
||||
$r3$.ɵselect(1);
|
||||
$i0$.ɵtextBinding(1, $i0$.ɵinterpolation1(" ", $myComp1$.format($outer1$, $middle1$, $inner1$, $myComp1$.component), " "));
|
||||
const $middle1$ = $i0$.ΔnextContext().$implicit;
|
||||
const $outer1$ = $i0$.ΔnextContext().$implicit;
|
||||
const $myComp1$ = $i0$.ΔnextContext();
|
||||
$i0$.Δselect(0);
|
||||
$i0$.ΔelementProperty(0, "title", $i0$.Δbind($myComp1$.format($outer1$, $middle1$, $inner1$, $myComp1$.component)));
|
||||
$r3$.Δselect(1);
|
||||
$i0$.ΔtextBinding(1, $i0$.Δinterpolation1(" ", $myComp1$.format($outer1$, $middle1$, $inner1$, $myComp1$.component), " "));
|
||||
}
|
||||
}
|
||||
|
||||
function MyComponent_ul_0_li_1_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$i0$.ɵelementStart(0, "li");
|
||||
$i0$.ɵtemplate(1, MyComponent_ul_0_li_1_div_1_Template, 2, 2, "div", $c1$);
|
||||
$i0$.ɵelementEnd();
|
||||
$i0$.ΔelementStart(0, "li");
|
||||
$i0$.Δtemplate(1, MyComponent_ul_0_li_1_div_1_Template, 2, 2, "div", $c1$);
|
||||
$i0$.ΔelementEnd();
|
||||
}
|
||||
if (rf & 2) {
|
||||
const $myComp2$ = $i0$.ɵnextContext(2);
|
||||
$r3$.ɵselect(1);
|
||||
$i0$.ɵelementProperty(1, "ngForOf", $i0$.ɵbind($myComp2$.items));
|
||||
const $myComp2$ = $i0$.ΔnextContext(2);
|
||||
$r3$.Δselect(1);
|
||||
$i0$.ΔelementProperty(1, "ngForOf", $i0$.Δbind($myComp2$.items));
|
||||
}
|
||||
}
|
||||
|
||||
function MyComponent_ul_0_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$i0$.ɵelementStart(0, "ul");
|
||||
$i0$.ɵtemplate(1, MyComponent_ul_0_li_1_Template, 2, 1, "li", $c0$);
|
||||
$i0$.ɵelementEnd();
|
||||
$i0$.ΔelementStart(0, "ul");
|
||||
$i0$.Δtemplate(1, MyComponent_ul_0_li_1_Template, 2, 1, "li", $c0$);
|
||||
$i0$.ΔelementEnd();
|
||||
}
|
||||
if (rf & 2) {
|
||||
const $outer2$ = ctx.$implicit;
|
||||
$r3$.ɵselect(1);
|
||||
$i0$.ɵelementProperty(1, "ngForOf", $i0$.ɵbind($outer2$.items));
|
||||
$r3$.Δselect(1);
|
||||
$i0$.ΔelementProperty(1, "ngForOf", $i0$.Δbind($outer2$.items));
|
||||
}
|
||||
}
|
||||
// ...
|
||||
template:function MyComponent_Template(rf, ctx){
|
||||
if (rf & 1) {
|
||||
$i0$.ɵtemplate(0, MyComponent_ul_0_Template, 2, 1, "ul", $c0$);
|
||||
$i0$.Δtemplate(0, MyComponent_ul_0_Template, 2, 1, "ul", $c0$);
|
||||
}
|
||||
if (rf & 2) {
|
||||
$i0$.ɵselect(0);
|
||||
$i0$.ɵelementProperty(0, "ngForOf", $i0$.ɵbind(ctx.items));
|
||||
$i0$.Δselect(0);
|
||||
$i0$.ΔelementProperty(0, "ngForOf", $i0$.Δbind(ctx.items));
|
||||
}
|
||||
}`;
|
||||
|
||||
@ -152,26 +152,26 @@ describe('compiler compliance: template', () => {
|
||||
|
||||
function MyComponent_div_0_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
const $s$ = $r3$.ɵgetCurrentView();
|
||||
$r3$.ɵelementStart(0, "div", $e_attrs$);
|
||||
$r3$.ɵlistener("click", function MyComponent_div_0_Template_div_click_0_listener($event) {
|
||||
$r3$.ɵrestoreView($s$);
|
||||
const $s$ = $r3$.ΔgetCurrentView();
|
||||
$r3$.ΔelementStart(0, "div", $e_attrs$);
|
||||
$r3$.Δlistener("click", function MyComponent_div_0_Template_div_click_0_listener($event) {
|
||||
$r3$.ΔrestoreView($s$);
|
||||
const $d$ = ctx.$implicit;
|
||||
const $i$ = ctx.index;
|
||||
const $comp$ = $r3$.ɵnextContext();
|
||||
const $comp$ = $r3$.ΔnextContext();
|
||||
return $comp$._handleClick($d$, $i$);
|
||||
});
|
||||
$r3$.ɵelementEnd();
|
||||
$r3$.ΔelementEnd();
|
||||
}
|
||||
}
|
||||
// ...
|
||||
template: function MyComponent_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$r3$.ɵtemplate(0, MyComponent_div_0_Template, 1, 0, "div", $t0_attrs$);
|
||||
$r3$.Δtemplate(0, MyComponent_div_0_Template, 1, 0, "div", $t0_attrs$);
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵselect(0);
|
||||
$r3$.ɵelementProperty(0, "ngForOf", $r3$.ɵbind(ctx._data));
|
||||
$r3$.Δselect(0);
|
||||
$r3$.ΔelementProperty(0, "ngForOf", $r3$.Δbind(ctx._data));
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -207,25 +207,25 @@ describe('compiler compliance: template', () => {
|
||||
|
||||
function MyComponent_span_0_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$i0$.ɵelementStart(0, "span");
|
||||
$i0$.ɵtext(1);
|
||||
$i0$.ɵelementEnd();
|
||||
$i0$.ΔelementStart(0, "span");
|
||||
$i0$.Δtext(1);
|
||||
$i0$.ΔelementEnd();
|
||||
}
|
||||
if (rf & 2) {
|
||||
const $item$ = ctx.$implicit;
|
||||
const $i$ = ctx.index;
|
||||
$r3$.ɵselect(1);
|
||||
$i0$.ɵtextBinding(1, $i0$.ɵinterpolation2(" ", $i$, " - ", $item$, " "));
|
||||
$r3$.Δselect(1);
|
||||
$i0$.ΔtextBinding(1, $i0$.Δinterpolation2(" ", $i$, " - ", $item$, " "));
|
||||
}
|
||||
}
|
||||
// ...
|
||||
template:function MyComponent_Template(rf, ctx){
|
||||
if (rf & 1) {
|
||||
$i0$.ɵtemplate(0, MyComponent_span_0_Template, 2, 2, "span", _c0);
|
||||
$i0$.Δtemplate(0, MyComponent_span_0_Template, 2, 2, "span", _c0);
|
||||
}
|
||||
if (rf & 2) {
|
||||
$i0$.ɵselect(0);
|
||||
$i0$.ɵelementProperty(0, "ngForOf", $i0$.ɵbind(ctx.items));
|
||||
$i0$.Δselect(0);
|
||||
$i0$.ΔelementProperty(0, "ngForOf", $i0$.Δbind(ctx.items));
|
||||
}
|
||||
}`;
|
||||
|
||||
@ -263,40 +263,40 @@ describe('compiler compliance: template', () => {
|
||||
|
||||
function MyComponent_div_0_span_1_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$i0$.ɵelementStart(0, "span");
|
||||
$i0$.ɵtext(1);
|
||||
$i0$.ɵelementEnd();
|
||||
$i0$.ΔelementStart(0, "span");
|
||||
$i0$.Δtext(1);
|
||||
$i0$.ΔelementEnd();
|
||||
}
|
||||
if (rf & 2) {
|
||||
const $div$ = $i0$.ɵnextContext();
|
||||
const $div$ = $i0$.ΔnextContext();
|
||||
const $i$ = $div$.index;
|
||||
const $item$ = $div$.$implicit;
|
||||
$r3$.ɵselect(1);
|
||||
$i0$.ɵtextBinding(1, $i0$.ɵinterpolation2(" ", $i$, " - ", $item$, " "));
|
||||
$r3$.Δselect(1);
|
||||
$i0$.ΔtextBinding(1, $i0$.Δinterpolation2(" ", $i$, " - ", $item$, " "));
|
||||
}
|
||||
}
|
||||
|
||||
function MyComponent_div_0_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$i0$.ɵelementStart(0, "div");
|
||||
$i0$.ɵtemplate(1, MyComponent_div_0_span_1_Template, 2, 2, "span", $c1$);
|
||||
$i0$.ɵelementEnd();
|
||||
$i0$.ΔelementStart(0, "div");
|
||||
$i0$.Δtemplate(1, MyComponent_div_0_span_1_Template, 2, 2, "span", $c1$);
|
||||
$i0$.ΔelementEnd();
|
||||
}
|
||||
if (rf & 2) {
|
||||
const $app$ = $i0$.ɵnextContext();
|
||||
$r3$.ɵselect(1);
|
||||
$i0$.ɵelementProperty(1, "ngIf", $i0$.ɵbind($app$.showing));
|
||||
const $app$ = $i0$.ΔnextContext();
|
||||
$r3$.Δselect(1);
|
||||
$i0$.ΔelementProperty(1, "ngIf", $i0$.Δbind($app$.showing));
|
||||
}
|
||||
}
|
||||
|
||||
// ...
|
||||
template:function MyComponent_Template(rf, ctx){
|
||||
if (rf & 1) {
|
||||
$i0$.ɵtemplate(0, MyComponent_div_0_Template, 2, 1, "div", $c0$);
|
||||
$i0$.Δtemplate(0, MyComponent_div_0_Template, 2, 1, "div", $c0$);
|
||||
}
|
||||
if (rf & 2) {
|
||||
$i0$.ɵselect(0);
|
||||
$i0$.ɵelementProperty(0, "ngForOf", $i0$.ɵbind(ctx.items));
|
||||
$i0$.Δselect(0);
|
||||
$i0$.ΔelementProperty(0, "ngForOf", $i0$.Δbind(ctx.items));
|
||||
}
|
||||
}`;
|
||||
|
||||
@ -335,51 +335,51 @@ describe('compiler compliance: template', () => {
|
||||
const $c0$ = [${AttributeMarker.Template}, "ngFor", "ngForOf"];
|
||||
function MyComponent_div_0_div_1_div_1_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$i0$.ɵelementStart(0, "div");
|
||||
$i0$.ɵtext(1);
|
||||
$i0$.ɵelementEnd();
|
||||
$i0$.ΔelementStart(0, "div");
|
||||
$i0$.Δtext(1);
|
||||
$i0$.ΔelementEnd();
|
||||
}
|
||||
if (rf & 2) {
|
||||
const $middle$ = $i0$.ɵnextContext().$implicit;
|
||||
const $myComp$ = $i0$.ɵnextContext(2);
|
||||
$r3$.ɵselect(1);
|
||||
$i0$.ɵtextBinding(1, $i0$.ɵinterpolation2(" ", $middle$.value, " - ", $myComp$.name, " "));
|
||||
const $middle$ = $i0$.ΔnextContext().$implicit;
|
||||
const $myComp$ = $i0$.ΔnextContext(2);
|
||||
$r3$.Δselect(1);
|
||||
$i0$.ΔtextBinding(1, $i0$.Δinterpolation2(" ", $middle$.value, " - ", $myComp$.name, " "));
|
||||
}
|
||||
}
|
||||
|
||||
function MyComponent_div_0_div_1_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$i0$.ɵelementStart(0, "div");
|
||||
$i0$.ɵtemplate(1, MyComponent_div_0_div_1_div_1_Template, 2, 2, "div", $c0$);
|
||||
$i0$.ɵelementEnd();
|
||||
$i0$.ΔelementStart(0, "div");
|
||||
$i0$.Δtemplate(1, MyComponent_div_0_div_1_div_1_Template, 2, 2, "div", $c0$);
|
||||
$i0$.ΔelementEnd();
|
||||
}
|
||||
if (rf & 2) {
|
||||
const $middle$ = ctx.$implicit;
|
||||
$r3$.ɵselect(1);
|
||||
$i0$.ɵelementProperty(1, "ngForOf", $i0$.ɵbind($middle$.items));
|
||||
$r3$.Δselect(1);
|
||||
$i0$.ΔelementProperty(1, "ngForOf", $i0$.Δbind($middle$.items));
|
||||
}
|
||||
}
|
||||
|
||||
function MyComponent_div_0_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$i0$.ɵelementStart(0, "div");
|
||||
$i0$.ɵtemplate(1, MyComponent_div_0_div_1_Template, 2, 1, "div", $c0$);
|
||||
$i0$.ɵelementEnd();
|
||||
$i0$.ΔelementStart(0, "div");
|
||||
$i0$.Δtemplate(1, MyComponent_div_0_div_1_Template, 2, 1, "div", $c0$);
|
||||
$i0$.ΔelementEnd();
|
||||
}
|
||||
if (rf & 2) {
|
||||
const $outer$ = ctx.$implicit;
|
||||
$r3$.ɵselect(1);
|
||||
$i0$.ɵelementProperty(1, "ngForOf", $i0$.ɵbind($outer$.items));
|
||||
$r3$.Δselect(1);
|
||||
$i0$.ΔelementProperty(1, "ngForOf", $i0$.Δbind($outer$.items));
|
||||
}
|
||||
}
|
||||
// ...
|
||||
template:function MyComponent_Template(rf, ctx){
|
||||
if (rf & 1) {
|
||||
$i0$.ɵtemplate(0, MyComponent_div_0_Template, 2, 1, "div", $c0$);
|
||||
$i0$.Δtemplate(0, MyComponent_div_0_Template, 2, 1, "div", $c0$);
|
||||
}
|
||||
if (rf & 2) {
|
||||
$i0$.ɵselect(0);
|
||||
$i0$.ɵelementProperty(0, "ngForOf", $i0$.ɵbind(ctx.items));
|
||||
$i0$.Δselect(0);
|
||||
$i0$.ΔelementProperty(0, "ngForOf", $i0$.Δbind(ctx.items));
|
||||
}
|
||||
}`;
|
||||
|
||||
@ -414,7 +414,7 @@ describe('compiler compliance: template', () => {
|
||||
|
||||
function MyComponent_ng_template_0_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$i0$.ɵtext(0, " some-content ");
|
||||
$i0$.Δtext(0, " some-content ");
|
||||
}
|
||||
}
|
||||
|
||||
@ -422,11 +422,11 @@ describe('compiler compliance: template', () => {
|
||||
|
||||
template: function MyComponent_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$i0$.ɵtemplate(0, MyComponent_ng_template_0_Template, 1, 0, "ng-template", $c0$);
|
||||
$i0$.Δtemplate(0, MyComponent_ng_template_0_Template, 1, 0, "ng-template", $c0$);
|
||||
}
|
||||
if (rf & 2) {
|
||||
$i0$.ɵselect(0);
|
||||
$i0$.ɵelementProperty(0, "boundAttr", $i0$.ɵbind(ctx.b));
|
||||
$i0$.Δselect(0);
|
||||
$i0$.ΔelementProperty(0, "boundAttr", $i0$.Δbind(ctx.b));
|
||||
}
|
||||
}`;
|
||||
|
||||
@ -459,7 +459,7 @@ describe('compiler compliance: template', () => {
|
||||
|
||||
function MyComponent_ng_template_0_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$i0$.ɵtext(0, "some-content");
|
||||
$i0$.Δtext(0, "some-content");
|
||||
}
|
||||
}
|
||||
|
||||
@ -467,7 +467,7 @@ describe('compiler compliance: template', () => {
|
||||
|
||||
template: function MyComponent_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$i0$.ɵtemplate(0, MyComponent_ng_template_0_Template, 1, 0, "ng-template", null, $t0_refs$, $i0$.ɵtemplateRefExtractor);
|
||||
$i0$.Δtemplate(0, MyComponent_ng_template_0_Template, 1, 0, "ng-template", null, $t0_refs$, $i0$.ΔtemplateRefExtractor);
|
||||
}
|
||||
}`;
|
||||
|
||||
@ -504,8 +504,8 @@ describe('compiler compliance: template', () => {
|
||||
|
||||
template: function MyComponent_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$i0$.ɵtemplate(0, MyComponent_ng_template_0_Template, 0, 0, "ng-template", $t0_attrs$);
|
||||
$i0$.ɵlistener("outDirective", function MyComponent_Template_ng_template_outDirective_0_listener($event) { return $event.doSth(); });
|
||||
$i0$.Δtemplate(0, MyComponent_ng_template_0_Template, 0, 0, "ng-template", $t0_attrs$);
|
||||
$i0$.Δlistener("outDirective", function MyComponent_Template_ng_template_outDirective_0_listener($event) { return $event.doSth(); });
|
||||
}
|
||||
}`;
|
||||
|
||||
@ -657,7 +657,7 @@ describe('compiler compliance: template', () => {
|
||||
|
||||
function MyComponent_div_0_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$i0$.ɵelement(0, "div");
|
||||
$i0$.Δelement(0, "div");
|
||||
}
|
||||
}
|
||||
|
||||
@ -665,11 +665,11 @@ describe('compiler compliance: template', () => {
|
||||
|
||||
template: function MyComponent_Template(rf, ctx) {
|
||||
if (rf & 1) {
|
||||
$i0$.ɵtemplate(0, MyComponent_div_0_Template, 1, 0, "div", $c0$);
|
||||
$i0$.ɵpipe(1, "pipe");
|
||||
$i0$.Δtemplate(0, MyComponent_div_0_Template, 1, 0, "div", $c0$);
|
||||
$i0$.Δpipe(1, "pipe");
|
||||
} if (rf & 2) {
|
||||
$i0$.ɵselect(0);
|
||||
$i0$.ɵelementProperty(0, "ngIf", $i0$.ɵbind($i0$.ɵpipeBind1(1, 1, ctx.val)));
|
||||
$i0$.Δselect(0);
|
||||
$i0$.ΔelementProperty(0, "ngIf", $i0$.Δbind($i0$.ΔpipeBind1(1, 1, ctx.val)));
|
||||
}
|
||||
}`;
|
||||
|
||||
|
@ -1219,7 +1219,7 @@ describe('ngc transformer command-line', () => {
|
||||
|
||||
write('test.ts', `
|
||||
import {Injectable, NgZone} from '@angular/core';
|
||||
|
||||
|
||||
@Injectable({providedIn: 'root'})
|
||||
export class MyService {
|
||||
constructor(public ngZone: NgZone) {}
|
||||
@ -1285,7 +1285,7 @@ describe('ngc transformer command-line', () => {
|
||||
write('lib2/module.ts', `export {Module} from 'lib1_built/module';`);
|
||||
write('lib2/class2.ts', `
|
||||
import {Class1} from 'lib1_built/class1';
|
||||
|
||||
|
||||
export class Class2 {
|
||||
constructor(class1: Class1) {}
|
||||
}
|
||||
@ -2075,7 +2075,7 @@ describe('ngc transformer command-line', () => {
|
||||
})
|
||||
export class Service {}
|
||||
`);
|
||||
expect(source).toMatch(/ngInjectableDef = .+\.defineInjectable\(/);
|
||||
expect(source).toMatch(/ngInjectableDef = .+\.ΔdefineInjectable\(/);
|
||||
expect(source).toMatch(/ngInjectableDef.*token: Service/);
|
||||
expect(source).toMatch(/ngInjectableDef.*providedIn: .+\.Module/);
|
||||
});
|
||||
@ -2131,7 +2131,7 @@ describe('ngc transformer command-line', () => {
|
||||
})
|
||||
export class Service {}
|
||||
`);
|
||||
expect(source).toMatch(/ngInjectableDef.*return ..\.inject\(Existing\)/);
|
||||
expect(source).toMatch(/ngInjectableDef.*return ..\.Δinject\(Existing\)/);
|
||||
});
|
||||
|
||||
it('compiles a useFactory InjectableDef with optional dep', () => {
|
||||
@ -2151,7 +2151,7 @@ describe('ngc transformer command-line', () => {
|
||||
constructor(e: Existing|null) {}
|
||||
}
|
||||
`);
|
||||
expect(source).toMatch(/ngInjectableDef.*return ..\(..\.inject\(Existing, 8\)/);
|
||||
expect(source).toMatch(/ngInjectableDef.*return ..\(..\.Δinject\(Existing, 8\)/);
|
||||
});
|
||||
|
||||
it('compiles a useFactory InjectableDef with skip-self dep', () => {
|
||||
@ -2171,7 +2171,7 @@ describe('ngc transformer command-line', () => {
|
||||
constructor(e: Existing) {}
|
||||
}
|
||||
`);
|
||||
expect(source).toMatch(/ngInjectableDef.*return ..\(..\.inject\(Existing, 4\)/);
|
||||
expect(source).toMatch(/ngInjectableDef.*return ..\(..\.Δinject\(Existing, 4\)/);
|
||||
});
|
||||
|
||||
it('compiles a service that depends on a token', () => {
|
||||
@ -2188,7 +2188,7 @@ describe('ngc transformer command-line', () => {
|
||||
constructor(@Inject(TOKEN) value: boolean) {}
|
||||
}
|
||||
`);
|
||||
expect(source).toMatch(/ngInjectableDef = .+\.defineInjectable\(/);
|
||||
expect(source).toMatch(/ngInjectableDef = .+\.ΔdefineInjectable\(/);
|
||||
expect(source).toMatch(/ngInjectableDef.*token: Service/);
|
||||
expect(source).toMatch(/ngInjectableDef.*providedIn: .+\.Module/);
|
||||
});
|
||||
@ -2215,7 +2215,7 @@ describe('ngc transformer command-line', () => {
|
||||
constructor(@Inject(TOKEN) token: any) {}
|
||||
}
|
||||
`);
|
||||
expect(source).toMatch(/new Service\(i0\.inject\(exports\.TOKEN\)\);/);
|
||||
expect(source).toMatch(/new Service\(i0\.Δinject\(exports\.TOKEN\)\);/);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -62,8 +62,8 @@ export function forwardRef<T>(fn: () => T): T {
|
||||
|
||||
export interface SimpleChanges { [propName: string]: any; }
|
||||
|
||||
export type ɵNgModuleDefWithMeta<ModuleT, DeclarationsT, ImportsT, ExportsT> = any;
|
||||
export type ɵDirectiveDefWithMeta<DirT, SelectorT, ExportAsT, InputsT, OutputsT, QueriesT> = any;
|
||||
export type ΔNgModuleDefWithMeta<ModuleT, DeclarationsT, ImportsT, ExportsT> = any;
|
||||
export type ΔDirectiveDefWithMeta<DirT, SelectorT, ExportAsT, InputsT, OutputsT, QueriesT> = any;
|
||||
|
||||
export enum ViewEncapsulation {
|
||||
Emulated = 0,
|
||||
@ -75,4 +75,4 @@ export enum ViewEncapsulation {
|
||||
export enum ChangeDetectionStrategy {
|
||||
OnPush = 0,
|
||||
Default = 1
|
||||
}
|
||||
}
|
||||
|
@ -18,12 +18,12 @@ const varRegExp = (name: string): RegExp => new RegExp(`var \\w+ = \\[\"${name}\
|
||||
|
||||
const viewQueryRegExp = (descend: boolean, ref?: string): RegExp => {
|
||||
const maybeRef = ref ? `${ref}` : `null`;
|
||||
return new RegExp(`i0\\.ɵviewQuery\\(\\w+, ${descend}, ${maybeRef}\\)`);
|
||||
return new RegExp(`i0\\.ΔviewQuery\\(\\w+, ${descend}, ${maybeRef}\\)`);
|
||||
};
|
||||
|
||||
const contentQueryRegExp = (predicate: string, descend: boolean, ref?: string): RegExp => {
|
||||
const maybeRef = ref ? `${ref}` : `null`;
|
||||
return new RegExp(`i0\\.ɵcontentQuery\\(dirIndex, ${predicate}, ${descend}, ${maybeRef}\\)`);
|
||||
return new RegExp(`i0\\.ΔcontentQuery\\(dirIndex, ${predicate}, ${descend}, ${maybeRef}\\)`);
|
||||
};
|
||||
|
||||
const setClassMetadataRegExp = (expectedType: string): RegExp =>
|
||||
@ -56,8 +56,8 @@ describe('ngtsc behavioral tests', () => {
|
||||
expect(jsContents).toContain('Service.ngInjectableDef =');
|
||||
expect(jsContents).not.toContain('__decorate');
|
||||
const dtsContents = env.getContents('test.d.ts');
|
||||
expect(dtsContents).toContain('static ngInjectableDef: i0.ɵInjectableDef<Dep>;');
|
||||
expect(dtsContents).toContain('static ngInjectableDef: i0.ɵInjectableDef<Service>;');
|
||||
expect(dtsContents).toContain('static ngInjectableDef: i0.ΔInjectableDef<Dep>;');
|
||||
expect(dtsContents).toContain('static ngInjectableDef: i0.ΔInjectableDef<Service>;');
|
||||
});
|
||||
|
||||
it('should compile Injectables with a generic service', () => {
|
||||
@ -75,7 +75,7 @@ describe('ngtsc behavioral tests', () => {
|
||||
const jsContents = env.getContents('test.js');
|
||||
expect(jsContents).toContain('Store.ngInjectableDef =');
|
||||
const dtsContents = env.getContents('test.d.ts');
|
||||
expect(dtsContents).toContain('static ngInjectableDef: i0.ɵInjectableDef<Store<any>>;');
|
||||
expect(dtsContents).toContain('static ngInjectableDef: i0.ΔInjectableDef<Store<any>>;');
|
||||
});
|
||||
|
||||
it('should compile Injectables with providedIn without errors', () => {
|
||||
@ -99,11 +99,11 @@ describe('ngtsc behavioral tests', () => {
|
||||
expect(jsContents).toContain('Dep.ngInjectableDef =');
|
||||
expect(jsContents).toContain('Service.ngInjectableDef =');
|
||||
expect(jsContents)
|
||||
.toContain('return new (t || Service)(i0.inject(Dep)); }, providedIn: \'root\' });');
|
||||
.toContain('return new (t || Service)(i0.Δinject(Dep)); }, providedIn: \'root\' });');
|
||||
expect(jsContents).not.toContain('__decorate');
|
||||
const dtsContents = env.getContents('test.d.ts');
|
||||
expect(dtsContents).toContain('static ngInjectableDef: i0.ɵInjectableDef<Dep>;');
|
||||
expect(dtsContents).toContain('static ngInjectableDef: i0.ɵInjectableDef<Service>;');
|
||||
expect(dtsContents).toContain('static ngInjectableDef: i0.ΔInjectableDef<Dep>;');
|
||||
expect(dtsContents).toContain('static ngInjectableDef: i0.ΔInjectableDef<Service>;');
|
||||
});
|
||||
|
||||
it('should compile Injectables with providedIn and factory without errors', () => {
|
||||
@ -128,7 +128,7 @@ describe('ngtsc behavioral tests', () => {
|
||||
expect(jsContents).toContain('return r; }, providedIn: \'root\' });');
|
||||
expect(jsContents).not.toContain('__decorate');
|
||||
const dtsContents = env.getContents('test.d.ts');
|
||||
expect(dtsContents).toContain('static ngInjectableDef: i0.ɵInjectableDef<Service>;');
|
||||
expect(dtsContents).toContain('static ngInjectableDef: i0.ΔInjectableDef<Service>;');
|
||||
});
|
||||
|
||||
it('should compile Injectables with providedIn and factory with deps without errors', () => {
|
||||
@ -151,13 +151,13 @@ describe('ngtsc behavioral tests', () => {
|
||||
const jsContents = env.getContents('test.js');
|
||||
expect(jsContents).toContain('Service.ngInjectableDef =');
|
||||
expect(jsContents).toContain('factory: function Service_Factory(t) { var r = null; if (t) {');
|
||||
expect(jsContents).toContain('(r = new t(i0.inject(Dep)));');
|
||||
expect(jsContents).toContain('(r = new t(i0.Δinject(Dep)));');
|
||||
expect(jsContents)
|
||||
.toContain('(r = (function (dep) { return new Service(dep); })(i0.inject(Dep)));');
|
||||
.toContain('(r = (function (dep) { return new Service(dep); })(i0.Δinject(Dep)));');
|
||||
expect(jsContents).toContain('return r; }, providedIn: \'root\' });');
|
||||
expect(jsContents).not.toContain('__decorate');
|
||||
const dtsContents = env.getContents('test.d.ts');
|
||||
expect(dtsContents).toContain('static ngInjectableDef: i0.ɵInjectableDef<Service>;');
|
||||
expect(dtsContents).toContain('static ngInjectableDef: i0.ΔInjectableDef<Service>;');
|
||||
});
|
||||
|
||||
it('should compile @Injectable with an @Optional dependency', () => {
|
||||
@ -193,13 +193,13 @@ describe('ngtsc behavioral tests', () => {
|
||||
env.driveMain();
|
||||
|
||||
const jsContents = env.getContents('test.js');
|
||||
expect(jsContents).toContain('TestCmp.ngComponentDef = i0.ɵdefineComponent');
|
||||
expect(jsContents).toContain('TestCmp.ngComponentDef = i0.ΔdefineComponent');
|
||||
expect(jsContents).not.toContain('__decorate');
|
||||
|
||||
const dtsContents = env.getContents('test.d.ts');
|
||||
expect(dtsContents)
|
||||
.toContain(
|
||||
'static ngComponentDef: i0.ɵComponentDefWithMeta<TestCmp, "test-cmp", never, {}, {}, never>');
|
||||
'static ngComponentDef: i0.ΔComponentDefWithMeta<TestCmp, "test-cmp", never, {}, {}, never>');
|
||||
});
|
||||
|
||||
it('should compile Components (dynamic inline template) without errors', () => {
|
||||
@ -217,13 +217,13 @@ describe('ngtsc behavioral tests', () => {
|
||||
env.driveMain();
|
||||
|
||||
const jsContents = env.getContents('test.js');
|
||||
expect(jsContents).toContain('TestCmp.ngComponentDef = i0.ɵdefineComponent');
|
||||
expect(jsContents).toContain('TestCmp.ngComponentDef = i0.ΔdefineComponent');
|
||||
expect(jsContents).not.toContain('__decorate');
|
||||
|
||||
const dtsContents = env.getContents('test.d.ts');
|
||||
expect(dtsContents)
|
||||
.toContain(
|
||||
'static ngComponentDef: i0.ɵComponentDefWithMeta<TestCmp, "test-cmp", never, {}, {}, never>');
|
||||
'static ngComponentDef: i0.ΔComponentDefWithMeta<TestCmp, "test-cmp", never, {}, {}, never>');
|
||||
});
|
||||
|
||||
it('should compile Components (function call inline template) without errors', () => {
|
||||
@ -244,13 +244,13 @@ describe('ngtsc behavioral tests', () => {
|
||||
env.driveMain();
|
||||
|
||||
const jsContents = env.getContents('test.js');
|
||||
expect(jsContents).toContain('TestCmp.ngComponentDef = i0.ɵdefineComponent');
|
||||
expect(jsContents).toContain('TestCmp.ngComponentDef = i0.ΔdefineComponent');
|
||||
expect(jsContents).not.toContain('__decorate');
|
||||
|
||||
const dtsContents = env.getContents('test.d.ts');
|
||||
expect(dtsContents)
|
||||
.toContain(
|
||||
'static ngComponentDef: i0.ɵComponentDefWithMeta<TestCmp, "test-cmp", never, {}, {}, never>');
|
||||
'static ngComponentDef: i0.ΔComponentDefWithMeta<TestCmp, "test-cmp", never, {}, {}, never>');
|
||||
});
|
||||
|
||||
it('should compile Components (external template) without errors', () => {
|
||||
@ -351,13 +351,13 @@ describe('ngtsc behavioral tests', () => {
|
||||
env.driveMain();
|
||||
|
||||
const jsContents = env.getContents('test.js');
|
||||
expect(jsContents).toContain('TestBase.ngBaseDef = i0.ɵdefineBase');
|
||||
expect(jsContents).toContain('TestComponent.ngComponentDef = i0.ɵdefineComponent');
|
||||
expect(jsContents).toContain('TestDirective.ngDirectiveDef = i0.ɵdefineDirective');
|
||||
expect(jsContents).toContain('TestPipe.ngPipeDef = i0.ɵdefinePipe');
|
||||
expect(jsContents).toContain('TestInjectable.ngInjectableDef = i0.defineInjectable');
|
||||
expect(jsContents).toContain('MyModule.ngModuleDef = i0.ɵdefineNgModule');
|
||||
expect(jsContents).toContain('MyModule.ngInjectorDef = i0.defineInjector');
|
||||
expect(jsContents).toContain('TestBase.ngBaseDef = i0.ΔdefineBase');
|
||||
expect(jsContents).toContain('TestComponent.ngComponentDef = i0.ΔdefineComponent');
|
||||
expect(jsContents).toContain('TestDirective.ngDirectiveDef = i0.ΔdefineDirective');
|
||||
expect(jsContents).toContain('TestPipe.ngPipeDef = i0.ΔdefinePipe');
|
||||
expect(jsContents).toContain('TestInjectable.ngInjectableDef = i0.ΔdefineInjectable');
|
||||
expect(jsContents).toContain('MyModule.ngModuleDef = i0.ΔdefineNgModule');
|
||||
expect(jsContents).toContain('MyModule.ngInjectorDef = i0.ΔdefineInjector');
|
||||
expect(jsContents).toContain('inputs: { input: "input" }');
|
||||
expect(jsContents).toContain('outputs: { output: "output" }');
|
||||
});
|
||||
@ -442,25 +442,25 @@ describe('ngtsc behavioral tests', () => {
|
||||
env.driveMain();
|
||||
|
||||
const jsContents = env.getContents('test.js');
|
||||
expect(jsContents).toContain('i0.ɵdefineNgModule({ type: TestModule, bootstrap: [TestCmp] });');
|
||||
expect(jsContents).toContain('i0.ΔdefineNgModule({ type: TestModule, bootstrap: [TestCmp] });');
|
||||
expect(jsContents)
|
||||
.toContain('/*@__PURE__*/ i0.ɵsetNgModuleScope(TestModule, { declarations: [TestCmp] });');
|
||||
.toContain('/*@__PURE__*/ i0.ΔsetNgModuleScope(TestModule, { declarations: [TestCmp] });');
|
||||
expect(jsContents)
|
||||
.toContain(
|
||||
'i0.defineInjector({ factory: ' +
|
||||
'i0.ΔdefineInjector({ factory: ' +
|
||||
'function TestModule_Factory(t) { return new (t || TestModule)(); } });');
|
||||
|
||||
const dtsContents = env.getContents('test.d.ts');
|
||||
expect(dtsContents)
|
||||
.toContain(
|
||||
'static ngComponentDef: i0.ɵComponentDefWithMeta<TestCmp, "test-cmp", never, {}, {}, never>');
|
||||
'static ngComponentDef: i0.ΔComponentDefWithMeta<TestCmp, "test-cmp", never, {}, {}, never>');
|
||||
expect(dtsContents)
|
||||
.toContain(
|
||||
'static ngModuleDef: i0.ɵNgModuleDefWithMeta<TestModule, [typeof TestCmp], never, never>');
|
||||
'static ngModuleDef: i0.ΔNgModuleDefWithMeta<TestModule, [typeof TestCmp], never, never>');
|
||||
expect(dtsContents).not.toContain('__decorate');
|
||||
});
|
||||
|
||||
it('should not emit a setNgModuleScope call when no scope metadata is present', () => {
|
||||
it('should not emit a ΔsetNgModuleScope call when no scope metadata is present', () => {
|
||||
env.tsconfig();
|
||||
env.write('test.ts', `
|
||||
import {NgModule} from '@angular/core';
|
||||
@ -472,8 +472,8 @@ describe('ngtsc behavioral tests', () => {
|
||||
env.driveMain();
|
||||
|
||||
const jsContents = env.getContents('test.js');
|
||||
expect(jsContents).toContain('i0.ɵdefineNgModule({ type: TestModule });');
|
||||
expect(jsContents).not.toContain('ɵsetNgModuleScope(TestModule,');
|
||||
expect(jsContents).toContain('i0.ΔdefineNgModule({ type: TestModule });');
|
||||
expect(jsContents).not.toContain('ΔsetNgModuleScope(TestModule,');
|
||||
});
|
||||
|
||||
it('should filter out directives and pipes from module exports in the injector def', () => {
|
||||
@ -488,7 +488,7 @@ describe('ngtsc behavioral tests', () => {
|
||||
exports: [OtherDir],
|
||||
})
|
||||
export class OtherModule {}
|
||||
|
||||
|
||||
const EXPORTS = [Dir, MyPipe, Comp, OtherModule, OtherDir, RouterModule, RouterComp];
|
||||
|
||||
@NgModule({
|
||||
@ -514,15 +514,15 @@ describe('ngtsc behavioral tests', () => {
|
||||
export class Comp {}
|
||||
`);
|
||||
env.write('node_modules/@angular/router/index.d.ts', `
|
||||
import {ɵComponentDefWithMeta, ModuleWithProviders, ɵNgModuleDefWithMeta} from '@angular/core';
|
||||
import {ΔComponentDefWithMeta, ModuleWithProviders, ΔNgModuleDefWithMeta} from '@angular/core';
|
||||
|
||||
export declare class RouterComp {
|
||||
static ngComponentDef: ɵComponentDefWithMeta<RouterComp, "lib-cmp", never, {}, {}, never>
|
||||
static ngComponentDef: ΔComponentDefWithMeta<RouterComp, "lib-cmp", never, {}, {}, never>
|
||||
}
|
||||
|
||||
declare class RouterModule {
|
||||
static forRoot(): ModuleWithProviders<RouterModule>;
|
||||
static ngModuleDef: ɵNgModuleDefWithMeta<RouterModule, [typeof RouterComp], never, [typeof RouterComp]>;
|
||||
static ngModuleDef: ΔNgModuleDefWithMeta<RouterModule, [typeof RouterComp], never, [typeof RouterComp]>;
|
||||
}
|
||||
`);
|
||||
|
||||
@ -531,7 +531,7 @@ describe('ngtsc behavioral tests', () => {
|
||||
const jsContents = env.getContents('test.js');
|
||||
expect(jsContents)
|
||||
.toContain(
|
||||
'i0.defineInjector({ factory: function TestModule_Factory(t) ' +
|
||||
'i0.ΔdefineInjector({ factory: function TestModule_Factory(t) ' +
|
||||
'{ return new (t || TestModule)(); }, imports: [[OtherModule, RouterModule.forRoot()],' +
|
||||
'\n OtherModule,\n RouterModule] });');
|
||||
});
|
||||
@ -563,18 +563,18 @@ describe('ngtsc behavioral tests', () => {
|
||||
env.driveMain();
|
||||
|
||||
const jsContents = env.getContents('test.js');
|
||||
expect(jsContents).toContain('i0.ɵdefineNgModule({ type: TestModule });');
|
||||
expect(jsContents).toContain('i0.ΔdefineNgModule({ type: TestModule });');
|
||||
expect(jsContents)
|
||||
.toContain(
|
||||
`TestModule.ngInjectorDef = i0.defineInjector({ factory: ` +
|
||||
`TestModule.ngInjectorDef = i0.ΔdefineInjector({ factory: ` +
|
||||
`function TestModule_Factory(t) { return new (t || TestModule)(); }, providers: [{ provide: ` +
|
||||
`Token, useValue: 'test' }], imports: [[OtherModule]] });`);
|
||||
|
||||
const dtsContents = env.getContents('test.d.ts');
|
||||
expect(dtsContents)
|
||||
.toContain(
|
||||
'static ngModuleDef: i0.ɵNgModuleDefWithMeta<TestModule, [typeof TestCmp], [typeof OtherModule], never>');
|
||||
expect(dtsContents).toContain('static ngInjectorDef: i0.ɵInjectorDef');
|
||||
'static ngModuleDef: i0.ΔNgModuleDefWithMeta<TestModule, [typeof TestCmp], [typeof OtherModule], never>');
|
||||
expect(dtsContents).toContain('static ngInjectorDef: i0.ΔInjectorDef');
|
||||
});
|
||||
|
||||
it('should compile NgModules with factory providers without errors', () => {
|
||||
@ -604,18 +604,18 @@ describe('ngtsc behavioral tests', () => {
|
||||
env.driveMain();
|
||||
|
||||
const jsContents = env.getContents('test.js');
|
||||
expect(jsContents).toContain('i0.ɵdefineNgModule({ type: TestModule });');
|
||||
expect(jsContents).toContain('i0.ΔdefineNgModule({ type: TestModule });');
|
||||
expect(jsContents)
|
||||
.toContain(
|
||||
`TestModule.ngInjectorDef = i0.defineInjector({ factory: ` +
|
||||
`TestModule.ngInjectorDef = i0.ΔdefineInjector({ factory: ` +
|
||||
`function TestModule_Factory(t) { return new (t || TestModule)(); }, providers: [{ provide: ` +
|
||||
`Token, useFactory: function () { return new Token(); } }], imports: [[OtherModule]] });`);
|
||||
|
||||
const dtsContents = env.getContents('test.d.ts');
|
||||
expect(dtsContents)
|
||||
.toContain(
|
||||
'static ngModuleDef: i0.ɵNgModuleDefWithMeta<TestModule, [typeof TestCmp], [typeof OtherModule], never>');
|
||||
expect(dtsContents).toContain('static ngInjectorDef: i0.ɵInjectorDef');
|
||||
'static ngModuleDef: i0.ΔNgModuleDefWithMeta<TestModule, [typeof TestCmp], [typeof OtherModule], never>');
|
||||
expect(dtsContents).toContain('static ngInjectorDef: i0.ΔInjectorDef');
|
||||
});
|
||||
|
||||
it('should compile NgModules with factory providers and deps without errors', () => {
|
||||
@ -649,18 +649,18 @@ describe('ngtsc behavioral tests', () => {
|
||||
env.driveMain();
|
||||
|
||||
const jsContents = env.getContents('test.js');
|
||||
expect(jsContents).toContain('i0.ɵdefineNgModule({ type: TestModule });');
|
||||
expect(jsContents).toContain('i0.ΔdefineNgModule({ type: TestModule });');
|
||||
expect(jsContents)
|
||||
.toContain(
|
||||
`TestModule.ngInjectorDef = i0.defineInjector({ factory: ` +
|
||||
`TestModule.ngInjectorDef = i0.ΔdefineInjector({ factory: ` +
|
||||
`function TestModule_Factory(t) { return new (t || TestModule)(); }, providers: [{ provide: ` +
|
||||
`Token, useFactory: function (dep) { return new Token(dep); }, deps: [Dep] }], imports: [[OtherModule]] });`);
|
||||
|
||||
const dtsContents = env.getContents('test.d.ts');
|
||||
expect(dtsContents)
|
||||
.toContain(
|
||||
'static ngModuleDef: i0.ɵNgModuleDefWithMeta<TestModule, [typeof TestCmp], [typeof OtherModule], never>');
|
||||
expect(dtsContents).toContain('static ngInjectorDef: i0.ɵInjectorDef');
|
||||
'static ngModuleDef: i0.ΔNgModuleDefWithMeta<TestModule, [typeof TestCmp], [typeof OtherModule], never>');
|
||||
expect(dtsContents).toContain('static ngInjectorDef: i0.ΔInjectorDef');
|
||||
});
|
||||
|
||||
it('should compile NgModules with references to local components', () => {
|
||||
@ -821,9 +821,9 @@ describe('ngtsc behavioral tests', () => {
|
||||
|
||||
expect(jsContents)
|
||||
.toContain(
|
||||
'TestPipe.ngPipeDef = i0.ɵdefinePipe({ name: "test-pipe", type: TestPipe, ' +
|
||||
'TestPipe.ngPipeDef = i0.ΔdefinePipe({ name: "test-pipe", type: TestPipe, ' +
|
||||
'factory: function TestPipe_Factory(t) { return new (t || TestPipe)(); }, pure: false })');
|
||||
expect(dtsContents).toContain('static ngPipeDef: i0.ɵPipeDefWithMeta<TestPipe, "test-pipe">;');
|
||||
expect(dtsContents).toContain('static ngPipeDef: i0.ΔPipeDefWithMeta<TestPipe, "test-pipe">;');
|
||||
});
|
||||
|
||||
it('should compile pure Pipes without errors', () => {
|
||||
@ -844,9 +844,9 @@ describe('ngtsc behavioral tests', () => {
|
||||
|
||||
expect(jsContents)
|
||||
.toContain(
|
||||
'TestPipe.ngPipeDef = i0.ɵdefinePipe({ name: "test-pipe", type: TestPipe, ' +
|
||||
'TestPipe.ngPipeDef = i0.ΔdefinePipe({ name: "test-pipe", type: TestPipe, ' +
|
||||
'factory: function TestPipe_Factory(t) { return new (t || TestPipe)(); }, pure: true })');
|
||||
expect(dtsContents).toContain('static ngPipeDef: i0.ɵPipeDefWithMeta<TestPipe, "test-pipe">;');
|
||||
expect(dtsContents).toContain('static ngPipeDef: i0.ΔPipeDefWithMeta<TestPipe, "test-pipe">;');
|
||||
});
|
||||
|
||||
it('should compile Pipes with dependencies', () => {
|
||||
@ -868,7 +868,7 @@ describe('ngtsc behavioral tests', () => {
|
||||
env.driveMain();
|
||||
|
||||
const jsContents = env.getContents('test.js');
|
||||
expect(jsContents).toContain('return new (t || TestPipe)(i0.ɵdirectiveInject(Dep));');
|
||||
expect(jsContents).toContain('return new (t || TestPipe)(i0.ΔdirectiveInject(Dep));');
|
||||
});
|
||||
|
||||
it('should compile Pipes with generic types', () => {
|
||||
@ -888,7 +888,7 @@ describe('ngtsc behavioral tests', () => {
|
||||
expect(jsContents).toContain('TestPipe.ngPipeDef =');
|
||||
const dtsContents = env.getContents('test.d.ts');
|
||||
expect(dtsContents)
|
||||
.toContain('static ngPipeDef: i0.ɵPipeDefWithMeta<TestPipe<any>, "test-pipe">;');
|
||||
.toContain('static ngPipeDef: i0.ΔPipeDefWithMeta<TestPipe<any>, "test-pipe">;');
|
||||
});
|
||||
|
||||
it('should include @Pipes in @NgModule scopes', () => {
|
||||
@ -914,7 +914,7 @@ describe('ngtsc behavioral tests', () => {
|
||||
const dtsContents = env.getContents('test.d.ts');
|
||||
expect(dtsContents)
|
||||
.toContain(
|
||||
'i0.ɵNgModuleDefWithMeta<TestModule, [typeof TestPipe, typeof TestCmp], never, never>');
|
||||
'i0.ΔNgModuleDefWithMeta<TestModule, [typeof TestPipe, typeof TestCmp], never, never>');
|
||||
});
|
||||
|
||||
describe('empty and missing selectors', () => {
|
||||
@ -1029,7 +1029,7 @@ describe('ngtsc behavioral tests', () => {
|
||||
expect(dtsContents).toContain('ComponentDefWithMeta<TestCmp');
|
||||
expect(dtsContents).toContain('DirectiveDefWithMeta<TestDir');
|
||||
expect(dtsContents).toContain('PipeDefWithMeta<TestPipe');
|
||||
expect(dtsContents).toContain('NgModuleDefWithMeta<TestNgModule');
|
||||
expect(dtsContents).toContain('ΔNgModuleDefWithMeta<TestNgModule');
|
||||
|
||||
// Validate that each class's .d.ts declaration also has an injectable definition.
|
||||
expect(dtsContents).toContain('InjectableDef<TestCmp');
|
||||
@ -1254,7 +1254,7 @@ describe('ngtsc behavioral tests', () => {
|
||||
`);
|
||||
|
||||
env.driveMain();
|
||||
expect(env.getContents('test.js')).toContain('i0.ɵpureFunction1');
|
||||
expect(env.getContents('test.js')).toContain('i0.ΔpureFunction1');
|
||||
});
|
||||
|
||||
it('should compile array literals inside function arguments', () => {
|
||||
@ -1276,7 +1276,7 @@ describe('ngtsc behavioral tests', () => {
|
||||
`);
|
||||
|
||||
env.driveMain();
|
||||
expect(env.getContents('test.js')).toContain('i0.ɵpureFunction1');
|
||||
expect(env.getContents('test.js')).toContain('i0.ΔpureFunction1');
|
||||
});
|
||||
});
|
||||
|
||||
@ -1292,11 +1292,11 @@ describe('ngtsc behavioral tests', () => {
|
||||
`);
|
||||
|
||||
env.write('node_modules/router/index.d.ts', `
|
||||
import {ModuleWithProviders, ɵNgModuleDefWithMeta} from '@angular/core';
|
||||
import {ModuleWithProviders, ΔNgModuleDefWithMeta} from '@angular/core';
|
||||
|
||||
declare class RouterModule {
|
||||
static forRoot(): ModuleWithProviders<RouterModule>;
|
||||
static ngModuleDef: ɵNgModuleDefWithMeta<RouterModule, never, never, never>;
|
||||
static ngModuleDef: ΔNgModuleDefWithMeta<RouterModule, never, never, never>;
|
||||
}
|
||||
`);
|
||||
|
||||
@ -1308,7 +1308,7 @@ describe('ngtsc behavioral tests', () => {
|
||||
const dtsContents = env.getContents('test.d.ts');
|
||||
expect(dtsContents).toContain(`import * as i1 from "router";`);
|
||||
expect(dtsContents)
|
||||
.toContain('i0.ɵNgModuleDefWithMeta<TestModule, never, [typeof i1.RouterModule], never>');
|
||||
.toContain('i0.ΔNgModuleDefWithMeta<TestModule, never, [typeof i1.RouterModule], never>');
|
||||
});
|
||||
|
||||
it('should extract the generic type if it is provided as qualified type name', () => {
|
||||
@ -1333,9 +1333,9 @@ describe('ngtsc behavioral tests', () => {
|
||||
`);
|
||||
|
||||
env.write('node_modules/router/internal.d.ts', `
|
||||
import {ɵNgModuleDefWithMeta} from '@angular/core';
|
||||
import {ΔNgModuleDefWithMeta} from '@angular/core';
|
||||
export declare class InternalRouterModule {
|
||||
static ngModuleDef: ɵNgModuleDefWithMeta<InternalRouterModule, never, never, never>;
|
||||
static ngModuleDef: ΔNgModuleDefWithMeta<InternalRouterModule, never, never, never>;
|
||||
}
|
||||
`);
|
||||
|
||||
@ -1348,18 +1348,18 @@ describe('ngtsc behavioral tests', () => {
|
||||
expect(dtsContents).toContain(`import * as i1 from "router";`);
|
||||
expect(dtsContents)
|
||||
.toContain(
|
||||
'i0.ɵNgModuleDefWithMeta<TestModule, never, [typeof i1.InternalRouterModule], never>');
|
||||
'i0.ΔNgModuleDefWithMeta<TestModule, never, [typeof i1.InternalRouterModule], never>');
|
||||
});
|
||||
|
||||
it('should not reference a constant with a ModuleWithProviders value in ngModuleDef imports',
|
||||
() => {
|
||||
env.tsconfig();
|
||||
env.write('dep.d.ts', `
|
||||
import {ModuleWithProviders, ɵNgModuleDefWithMeta as NgModuleDefWithMeta} from '@angular/core';
|
||||
import {ModuleWithProviders, ΔNgModuleDefWithMeta as ΔNgModuleDefWithMeta} from '@angular/core';
|
||||
|
||||
export declare class DepModule {
|
||||
static forRoot(arg1: any, arg2: any): ModuleWithProviders<DepModule>;
|
||||
static ngModuleDef: NgModuleDefWithMeta<DepModule, never, never, never>;
|
||||
static ngModuleDef: ΔNgModuleDefWithMeta<DepModule, never, never, never>;
|
||||
}
|
||||
`);
|
||||
env.write('test.ts', `
|
||||
@ -1394,13 +1394,13 @@ describe('ngtsc behavioral tests', () => {
|
||||
`);
|
||||
|
||||
env.write('node_modules/router/index.d.ts', `
|
||||
import {ModuleWithProviders, ɵNgModuleDefWithMeta} from '@angular/core';
|
||||
import {ModuleWithProviders, ΔNgModuleDefWithMeta} from '@angular/core';
|
||||
|
||||
export interface MyType extends ModuleWithProviders {}
|
||||
|
||||
declare class RouterModule {
|
||||
static forRoot(): (MyType)&{ngModule:RouterModule};
|
||||
static ngModuleDef: ɵNgModuleDefWithMeta<RouterModule, never, never, never>;
|
||||
static ngModuleDef: ΔNgModuleDefWithMeta<RouterModule, never, never, never>;
|
||||
}
|
||||
`);
|
||||
|
||||
@ -1413,7 +1413,7 @@ describe('ngtsc behavioral tests', () => {
|
||||
expect(dtsContents).toContain(`import * as i1 from "router";`);
|
||||
expect(dtsContents)
|
||||
.toContain(
|
||||
'i0.ɵNgModuleDefWithMeta<TestModule, never, [typeof i1.RouterModule], never>');
|
||||
'i0.ΔNgModuleDefWithMeta<TestModule, never, [typeof i1.RouterModule], never>');
|
||||
});
|
||||
|
||||
it('should unwrap a namespace imported ModuleWithProviders function if a generic type is provided for it',
|
||||
@ -1433,7 +1433,7 @@ describe('ngtsc behavioral tests', () => {
|
||||
|
||||
declare class RouterModule {
|
||||
static forRoot(): core.ModuleWithProviders<RouterModule>;
|
||||
static ngModuleDef: ɵNgModuleDefWithMeta<RouterModule, never, never, never>;
|
||||
static ngModuleDef: ΔNgModuleDefWithMeta<RouterModule, never, never, never>;
|
||||
}
|
||||
`);
|
||||
|
||||
@ -1446,7 +1446,7 @@ describe('ngtsc behavioral tests', () => {
|
||||
expect(dtsContents).toContain(`import * as i1 from "router";`);
|
||||
expect(dtsContents)
|
||||
.toContain(
|
||||
'i0.ɵNgModuleDefWithMeta<TestModule, never, [typeof i1.RouterModule], never>');
|
||||
'i0.ΔNgModuleDefWithMeta<TestModule, never, [typeof i1.RouterModule], never>');
|
||||
});
|
||||
|
||||
it('should inject special types according to the metadata', () => {
|
||||
@ -1484,7 +1484,7 @@ describe('ngtsc behavioral tests', () => {
|
||||
const jsContents = env.getContents('test.js');
|
||||
expect(jsContents)
|
||||
.toContain(
|
||||
`factory: function FooCmp_Factory(t) { return new (t || FooCmp)(i0.ɵinjectAttribute("test"), i0.ɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵdirectiveInject(i0.ElementRef), i0.ɵdirectiveInject(i0.Injector), i0.ɵdirectiveInject(i0.Renderer2), i0.ɵdirectiveInject(i0.TemplateRef), i0.ɵdirectiveInject(i0.ViewContainerRef)); }`);
|
||||
`factory: function FooCmp_Factory(t) { return new (t || FooCmp)(i0.ΔinjectAttribute("test"), i0.ΔdirectiveInject(i0.ChangeDetectorRef), i0.ΔdirectiveInject(i0.ElementRef), i0.ΔdirectiveInject(i0.Injector), i0.ΔdirectiveInject(i0.Renderer2), i0.ΔdirectiveInject(i0.TemplateRef), i0.ΔdirectiveInject(i0.ViewContainerRef)); }`);
|
||||
});
|
||||
|
||||
it('should generate queries for components', () => {
|
||||
@ -1514,9 +1514,9 @@ describe('ngtsc behavioral tests', () => {
|
||||
expect(jsContents).toMatch(varRegExp('test1'));
|
||||
expect(jsContents).toMatch(varRegExp('test2'));
|
||||
expect(jsContents).toMatch(varRegExp('accessor'));
|
||||
// match `i0.ɵcontentQuery(dirIndex, _c1, true, TemplateRef)`
|
||||
// match `i0.ΔcontentQuery(dirIndex, _c1, true, TemplateRef)`
|
||||
expect(jsContents).toMatch(contentQueryRegExp('\\w+', true, 'TemplateRef'));
|
||||
// match `i0.ɵviewQuery(_c2, true, null)`
|
||||
// match `i0.ΔviewQuery(_c2, true, null)`
|
||||
expect(jsContents).toMatch(viewQueryRegExp(true));
|
||||
});
|
||||
|
||||
@ -1546,10 +1546,10 @@ describe('ngtsc behavioral tests', () => {
|
||||
expect(jsContents).toMatch(varRegExp('test1'));
|
||||
expect(jsContents).toMatch(varRegExp('test2'));
|
||||
expect(jsContents).toMatch(varRegExp('accessor'));
|
||||
// match `i0.ɵcontentQuery(dirIndex, _c1, true, TemplateRef)`
|
||||
// match `i0.ΔcontentQuery(dirIndex, _c1, true, TemplateRef)`
|
||||
expect(jsContents).toMatch(contentQueryRegExp('\\w+', true, 'TemplateRef'));
|
||||
|
||||
// match `i0.ɵviewQuery(_c2, true, null)`
|
||||
// match `i0.ΔviewQuery(_c2, true, null)`
|
||||
// Note that while ViewQuery doesn't necessarily make sense on a directive, because it doesn't
|
||||
// have a view, we still need to handle it because a component could extend the directive.
|
||||
expect(jsContents).toMatch(viewQueryRegExp(true));
|
||||
@ -1573,9 +1573,9 @@ describe('ngtsc behavioral tests', () => {
|
||||
|
||||
env.driveMain();
|
||||
const jsContents = env.getContents('test.js');
|
||||
// match `i0.ɵcontentQuery(dirIndex, TemplateRef, true, null)`
|
||||
// match `i0.ΔcontentQuery(dirIndex, TemplateRef, true, null)`
|
||||
expect(jsContents).toMatch(contentQueryRegExp('TemplateRef', true));
|
||||
// match `i0.ɵcontentQuery(dirIndex, ViewContainerRef, true, null)`
|
||||
// match `i0.ΔcontentQuery(dirIndex, ViewContainerRef, true, null)`
|
||||
expect(jsContents).toMatch(contentQueryRegExp('ViewContainerRef', true));
|
||||
});
|
||||
|
||||
@ -1624,9 +1624,9 @@ describe('ngtsc behavioral tests', () => {
|
||||
const hostBindingsFn = `
|
||||
hostBindings: function FooCmp_HostBindings(rf, ctx, elIndex) {
|
||||
if (rf & 1) {
|
||||
i0.ɵlistener("click", function FooCmp_click_HostBindingHandler($event) { return ctx.onClick(); });
|
||||
i0.ɵlistener("click", function FooCmp_click_HostBindingHandler($event) { return ctx.onDocumentClick($event.target); }, false, i0.ɵresolveDocument);
|
||||
i0.ɵlistener("scroll", function FooCmp_scroll_HostBindingHandler($event) { return ctx.onWindowScroll(); }, false, i0.ɵresolveWindow);
|
||||
i0.Δlistener("click", function FooCmp_click_HostBindingHandler($event) { return ctx.onClick(); });
|
||||
i0.Δlistener("click", function FooCmp_click_HostBindingHandler($event) { return ctx.onDocumentClick($event.target); }, false, i0.ΔresolveDocument);
|
||||
i0.Δlistener("scroll", function FooCmp_scroll_HostBindingHandler($event) { return ctx.onWindowScroll(); }, false, i0.ΔresolveWindow);
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -1722,17 +1722,17 @@ describe('ngtsc behavioral tests', () => {
|
||||
const hostBindingsFn = `
|
||||
hostBindings: function FooCmp_HostBindings(rf, ctx, elIndex) {
|
||||
if (rf & 1) {
|
||||
i0.ɵallocHostVars(2);
|
||||
i0.ɵlistener("click", function FooCmp_click_HostBindingHandler($event) { return ctx.onClick($event); });
|
||||
i0.ɵlistener("click", function FooCmp_click_HostBindingHandler($event) { return ctx.onBodyClick($event); }, false, i0.ɵresolveBody);
|
||||
i0.ɵlistener("change", function FooCmp_change_HostBindingHandler($event) { return ctx.onChange(ctx.arg1, ctx.arg2, ctx.arg3); });
|
||||
i0.ɵelementHostStyling(_c0);
|
||||
i0.ΔallocHostVars(2);
|
||||
i0.Δlistener("click", function FooCmp_click_HostBindingHandler($event) { return ctx.onClick($event); });
|
||||
i0.Δlistener("click", function FooCmp_click_HostBindingHandler($event) { return ctx.onBodyClick($event); }, false, i0.ΔresolveBody);
|
||||
i0.Δlistener("change", function FooCmp_change_HostBindingHandler($event) { return ctx.onChange(ctx.arg1, ctx.arg2, ctx.arg3); });
|
||||
i0.ΔelementHostStyling(_c0);
|
||||
}
|
||||
if (rf & 2) {
|
||||
i0.ɵelementAttribute(elIndex, "hello", i0.ɵbind(ctx.foo));
|
||||
i0.ɵelementProperty(elIndex, "prop", i0.ɵbind(ctx.bar), null, true);
|
||||
i0.ɵelementHostClassProp(0, ctx.someClass);
|
||||
i0.ɵelementHostStylingApply();
|
||||
i0.ΔelementAttribute(elIndex, "hello", i0.Δbind(ctx.foo));
|
||||
i0.ΔelementProperty(elIndex, "prop", i0.Δbind(ctx.bar), null, true);
|
||||
i0.ΔelementHostClassProp(0, ctx.someClass);
|
||||
i0.ΔelementHostStylingApply();
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -1761,7 +1761,7 @@ describe('ngtsc behavioral tests', () => {
|
||||
`);
|
||||
env.driveMain();
|
||||
const jsContents = env.getContents('test.js');
|
||||
expect(jsContents).toContain('i0.ɵelementHostAttrs(["test", test])');
|
||||
expect(jsContents).toContain('i0.ΔelementHostAttrs(["test", test])');
|
||||
});
|
||||
|
||||
it('should accept enum values as host bindings', () => {
|
||||
@ -1786,7 +1786,7 @@ describe('ngtsc behavioral tests', () => {
|
||||
`);
|
||||
|
||||
env.driveMain();
|
||||
expect(env.getContents('test.js')).toContain('"hello", i0.ɵbind(ctx.foo)');
|
||||
expect(env.getContents('test.js')).toContain('"hello", i0.Δbind(ctx.foo)');
|
||||
});
|
||||
|
||||
it('should generate host listeners for directives within hostBindings section', () => {
|
||||
@ -1808,7 +1808,7 @@ describe('ngtsc behavioral tests', () => {
|
||||
const hostBindingsFn = `
|
||||
hostBindings: function Dir_HostBindings(rf, ctx, elIndex) {
|
||||
if (rf & 1) {
|
||||
i0.ɵlistener("change", function Dir_change_HostBindingHandler($event) { return ctx.onChange(ctx.arg); });
|
||||
i0.Δlistener("change", function Dir_change_HostBindingHandler($event) { return ctx.onChange(ctx.arg); });
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -2003,7 +2003,7 @@ describe('ngtsc behavioral tests', () => {
|
||||
`);
|
||||
env.driveMain();
|
||||
const jsContents = env.getContents('test.js');
|
||||
expect(jsContents).not.toContain('i0.ɵelementProperty');
|
||||
expect(jsContents).not.toContain('i0.ΔelementProperty');
|
||||
});
|
||||
|
||||
it('should correctly recognize local symbols', () => {
|
||||
@ -2258,8 +2258,8 @@ describe('ngtsc behavioral tests', () => {
|
||||
const jsContents = env.getContents('test.js');
|
||||
|
||||
expect(jsContents)
|
||||
.toContain('function Base_Factory(t) { return new (t || Base)(i0.inject(Dep)); }');
|
||||
expect(jsContents).toContain('var ɵChild_BaseFactory = i0.ɵgetInheritedFactory(Child)');
|
||||
.toContain('function Base_Factory(t) { return new (t || Base)(i0.Δinject(Dep)); }');
|
||||
expect(jsContents).toContain('var ɵChild_BaseFactory = i0.ΔgetInheritedFactory(Child)');
|
||||
expect(jsContents)
|
||||
.toContain('function Child_Factory(t) { return ɵChild_BaseFactory((t || Child)); }');
|
||||
expect(jsContents)
|
||||
@ -2284,7 +2284,7 @@ describe('ngtsc behavioral tests', () => {
|
||||
env.driveMain();
|
||||
const jsContents = env.getContents('test.js');
|
||||
|
||||
expect(jsContents).toContain('var ɵDir_BaseFactory = i0.ɵgetInheritedFactory(Dir)');
|
||||
expect(jsContents).toContain('var ɵDir_BaseFactory = i0.ΔgetInheritedFactory(Dir)');
|
||||
});
|
||||
|
||||
it('should wrap "directives" in component metadata in a closure when forward references are present',
|
||||
@ -2425,8 +2425,8 @@ describe('ngtsc behavioral tests', () => {
|
||||
const jsContents = trim(env.getContents('test.js'));
|
||||
expect(jsContents).toContain(`import Default from './types';`);
|
||||
expect(jsContents).toContain(`import * as i1 from "./types";`);
|
||||
expect(jsContents).toContain('i0.ɵdirectiveInject(Default)');
|
||||
expect(jsContents).toContain('i0.ɵdirectiveInject(i1.Other)');
|
||||
expect(jsContents).toContain('i0.ΔdirectiveInject(Default)');
|
||||
expect(jsContents).toContain('i0.ΔdirectiveInject(i1.Other)');
|
||||
expect(jsContents).toMatch(setClassMetadataRegExp('type: Default'));
|
||||
expect(jsContents).toMatch(setClassMetadataRegExp('type: i1.Other'));
|
||||
});
|
||||
@ -2537,8 +2537,8 @@ describe('ngtsc behavioral tests', () => {
|
||||
const jsContents = env.getContents('test.js');
|
||||
expect(jsContents)
|
||||
.toMatch(
|
||||
/i\d\.ɵsetComponentScope\(NormalComponent,\s+\[NormalComponent,\s+CyclicComponent\],\s+\[\]\)/);
|
||||
expect(jsContents).not.toContain('/*__PURE__*/ i0.ɵsetComponentScope');
|
||||
/i\d\.ΔsetComponentScope\(NormalComponent,\s+\[NormalComponent,\s+CyclicComponent\],\s+\[\]\)/);
|
||||
expect(jsContents).not.toContain('/*__PURE__*/ i0.ΔsetComponentScope');
|
||||
});
|
||||
|
||||
it('should detect a cycle added entirely during compilation', () => {
|
||||
@ -2729,14 +2729,14 @@ describe('ngtsc behavioral tests', () => {
|
||||
it('should not emit multiple references to the same directive', () => {
|
||||
env.tsconfig();
|
||||
env.write('node_modules/external/index.d.ts', `
|
||||
import {ɵDirectiveDefWithMeta, ɵNgModuleDefWithMeta} from '@angular/core';
|
||||
import {ΔDirectiveDefWithMeta, ΔNgModuleDefWithMeta} from '@angular/core';
|
||||
|
||||
export declare class ExternalDir {
|
||||
static ngDirectiveDef: ɵDirectiveDefWithMeta<ExternalDir, '[test]', never, never, never, never>;
|
||||
static ngDirectiveDef: ΔDirectiveDefWithMeta<ExternalDir, '[test]', never, never, never, never>;
|
||||
}
|
||||
|
||||
export declare class ExternalModule {
|
||||
static ngModuleDef: ɵNgModuleDefWithMeta<ExternalModule, [typeof ExternalDir], never, [typeof ExternalDir]>;
|
||||
static ngModuleDef: ΔNgModuleDefWithMeta<ExternalModule, [typeof ExternalDir], never, [typeof ExternalDir]>;
|
||||
}
|
||||
`);
|
||||
env.write('test.ts', `
|
||||
@ -2765,19 +2765,19 @@ describe('ngtsc behavioral tests', () => {
|
||||
it('should import directives by their external name', () => {
|
||||
env.tsconfig();
|
||||
env.write('node_modules/external/index.d.ts', `
|
||||
import {ɵDirectiveDefWithMeta, ɵNgModuleDefWithMeta} from '@angular/core';
|
||||
import {ΔDirectiveDefWithMeta, ΔNgModuleDefWithMeta} from '@angular/core';
|
||||
import {InternalDir} from './internal';
|
||||
|
||||
export {InternalDir as ExternalDir} from './internal';
|
||||
|
||||
export declare class ExternalModule {
|
||||
static ngModuleDef: ɵNgModuleDefWithMeta<ExternalModule, [typeof InternalDir], never, [typeof InternalDir]>;
|
||||
static ngModuleDef: ΔNgModuleDefWithMeta<ExternalModule, [typeof InternalDir], never, [typeof InternalDir]>;
|
||||
}
|
||||
`);
|
||||
env.write('node_modules/external/internal.d.ts', `
|
||||
|
||||
export declare class InternalDir {
|
||||
static ngDirectiveDef: ɵDirectiveDefWithMeta<InternalDir, '[test]', never, never, never, never>;
|
||||
static ngDirectiveDef: ΔDirectiveDefWithMeta<InternalDir, '[test]', never, never, never, never>;
|
||||
}
|
||||
`);
|
||||
env.write('test.ts', `
|
||||
@ -2986,14 +2986,14 @@ describe('ngtsc behavioral tests', () => {
|
||||
export class Module {}
|
||||
`);
|
||||
env.write('node_modules/external/index.d.ts', `
|
||||
import {ɵDirectiveDefWithMeta, ɵNgModuleDefWithMeta} from '@angular/core';
|
||||
import {ΔDirectiveDefWithMeta, ΔNgModuleDefWithMeta} from '@angular/core';
|
||||
|
||||
export declare class ExternalDir {
|
||||
static ngDirectiveDef: ɵDirectiveDefWithMeta<ExternalDir, '[test]', never, never, never, never>;
|
||||
static ngDirectiveDef: ΔDirectiveDefWithMeta<ExternalDir, '[test]', never, never, never, never>;
|
||||
}
|
||||
|
||||
export declare class ExternalModule {
|
||||
static ngModuleDef: ɵNgModuleDefWithMeta<ExternalModule, [typeof ExternalDir], never, [typeof ExternalDir]>;
|
||||
static ngModuleDef: ΔNgModuleDefWithMeta<ExternalModule, [typeof ExternalDir], never, [typeof ExternalDir]>;
|
||||
}
|
||||
`);
|
||||
|
||||
@ -3173,15 +3173,15 @@ describe('ngtsc behavioral tests', () => {
|
||||
const hostBindingsFn = `
|
||||
hostBindings: function UnsafeAttrsDirective_HostBindings(rf, ctx, elIndex) {
|
||||
if (rf & 1) {
|
||||
i0.ɵallocHostVars(6);
|
||||
i0.ΔallocHostVars(6);
|
||||
}
|
||||
if (rf & 2) {
|
||||
i0.ɵelementAttribute(elIndex, "href", i0.ɵbind(ctx.attrHref), i0.ɵsanitizeUrlOrResourceUrl);
|
||||
i0.ɵelementAttribute(elIndex, "src", i0.ɵbind(ctx.attrSrc), i0.ɵsanitizeUrlOrResourceUrl);
|
||||
i0.ɵelementAttribute(elIndex, "action", i0.ɵbind(ctx.attrAction), i0.ɵsanitizeUrl);
|
||||
i0.ɵelementAttribute(elIndex, "profile", i0.ɵbind(ctx.attrProfile), i0.ɵsanitizeResourceUrl);
|
||||
i0.ɵelementAttribute(elIndex, "innerHTML", i0.ɵbind(ctx.attrInnerHTML), i0.ɵsanitizeHtml);
|
||||
i0.ɵelementAttribute(elIndex, "title", i0.ɵbind(ctx.attrSafeTitle));
|
||||
i0.ΔelementAttribute(elIndex, "href", i0.Δbind(ctx.attrHref), i0.ΔsanitizeUrlOrResourceUrl);
|
||||
i0.ΔelementAttribute(elIndex, "src", i0.Δbind(ctx.attrSrc), i0.ΔsanitizeUrlOrResourceUrl);
|
||||
i0.ΔelementAttribute(elIndex, "action", i0.Δbind(ctx.attrAction), i0.ΔsanitizeUrl);
|
||||
i0.ΔelementAttribute(elIndex, "profile", i0.Δbind(ctx.attrProfile), i0.ΔsanitizeResourceUrl);
|
||||
i0.ΔelementAttribute(elIndex, "innerHTML", i0.Δbind(ctx.attrInnerHTML), i0.ΔsanitizeHtml);
|
||||
i0.ΔelementAttribute(elIndex, "title", i0.Δbind(ctx.attrSafeTitle));
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -3228,15 +3228,15 @@ describe('ngtsc behavioral tests', () => {
|
||||
const hostBindingsFn = `
|
||||
hostBindings: function UnsafePropsDirective_HostBindings(rf, ctx, elIndex) {
|
||||
if (rf & 1) {
|
||||
i0.ɵallocHostVars(6);
|
||||
i0.ΔallocHostVars(6);
|
||||
}
|
||||
if (rf & 2) {
|
||||
i0.ɵelementProperty(elIndex, "href", i0.ɵbind(ctx.propHref), i0.ɵsanitizeUrlOrResourceUrl, true);
|
||||
i0.ɵelementProperty(elIndex, "src", i0.ɵbind(ctx.propSrc), i0.ɵsanitizeUrlOrResourceUrl, true);
|
||||
i0.ɵelementProperty(elIndex, "action", i0.ɵbind(ctx.propAction), i0.ɵsanitizeUrl, true);
|
||||
i0.ɵelementProperty(elIndex, "profile", i0.ɵbind(ctx.propProfile), i0.ɵsanitizeResourceUrl, true);
|
||||
i0.ɵelementProperty(elIndex, "innerHTML", i0.ɵbind(ctx.propInnerHTML), i0.ɵsanitizeHtml, true);
|
||||
i0.ɵelementProperty(elIndex, "title", i0.ɵbind(ctx.propSafeTitle), null, true);
|
||||
i0.ΔelementProperty(elIndex, "href", i0.Δbind(ctx.propHref), i0.ΔsanitizeUrlOrResourceUrl, true);
|
||||
i0.ΔelementProperty(elIndex, "src", i0.Δbind(ctx.propSrc), i0.ΔsanitizeUrlOrResourceUrl, true);
|
||||
i0.ΔelementProperty(elIndex, "action", i0.Δbind(ctx.propAction), i0.ΔsanitizeUrl, true);
|
||||
i0.ΔelementProperty(elIndex, "profile", i0.Δbind(ctx.propProfile), i0.ΔsanitizeResourceUrl, true);
|
||||
i0.ΔelementProperty(elIndex, "innerHTML", i0.Δbind(ctx.propInnerHTML), i0.ΔsanitizeHtml, true);
|
||||
i0.ΔelementProperty(elIndex, "title", i0.Δbind(ctx.propSafeTitle), null, true);
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -3268,15 +3268,15 @@ describe('ngtsc behavioral tests', () => {
|
||||
const hostBindingsFn = `
|
||||
hostBindings: function FooCmp_HostBindings(rf, ctx, elIndex) {
|
||||
if (rf & 1) {
|
||||
i0.ɵallocHostVars(6);
|
||||
i0.ΔallocHostVars(6);
|
||||
}
|
||||
if (rf & 2) {
|
||||
i0.ɵelementProperty(elIndex, "src", i0.ɵbind(ctx.srcProp), null, true);
|
||||
i0.ɵelementProperty(elIndex, "href", i0.ɵbind(ctx.hrefProp), null, true);
|
||||
i0.ɵelementProperty(elIndex, "title", i0.ɵbind(ctx.titleProp), null, true);
|
||||
i0.ɵelementAttribute(elIndex, "src", i0.ɵbind(ctx.srcAttr));
|
||||
i0.ɵelementAttribute(elIndex, "href", i0.ɵbind(ctx.hrefAttr));
|
||||
i0.ɵelementAttribute(elIndex, "title", i0.ɵbind(ctx.titleAttr));
|
||||
i0.ΔelementProperty(elIndex, "src", i0.Δbind(ctx.srcProp), null, true);
|
||||
i0.ΔelementProperty(elIndex, "href", i0.Δbind(ctx.hrefProp), null, true);
|
||||
i0.ΔelementProperty(elIndex, "title", i0.Δbind(ctx.titleProp), null, true);
|
||||
i0.ΔelementAttribute(elIndex, "src", i0.Δbind(ctx.srcAttr));
|
||||
i0.ΔelementAttribute(elIndex, "href", i0.Δbind(ctx.hrefAttr));
|
||||
i0.ΔelementAttribute(elIndex, "title", i0.Δbind(ctx.titleAttr));
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -3306,13 +3306,13 @@ describe('ngtsc behavioral tests', () => {
|
||||
beforeEach(() => {
|
||||
env.tsconfig();
|
||||
env.write('node_modules/@angular/router/index.d.ts', `
|
||||
import {ModuleWithProviders, ɵNgModuleDefWithMeta as NgModuleDefWithMeta} from '@angular/core';
|
||||
import {ModuleWithProviders, ΔNgModuleDefWithMeta as ΔNgModuleDefWithMeta} from '@angular/core';
|
||||
|
||||
export declare var ROUTES;
|
||||
export declare class RouterModule {
|
||||
static forRoot(arg1: any, arg2: any): ModuleWithProviders<RouterModule>;
|
||||
static forChild(arg1: any): ModuleWithProviders<RouterModule>;
|
||||
static ngModuleDef: NgModuleDefWithMeta<RouterModule, never, never, never>;
|
||||
static ngModuleDef: ΔNgModuleDefWithMeta<RouterModule, never, never, never>;
|
||||
}
|
||||
`);
|
||||
});
|
||||
@ -3942,24 +3942,24 @@ export const Foo = Foo__PRE_R3__;
|
||||
|
||||
// 'alpha' declares the directive which will ultimately be imported.
|
||||
env.write('alpha.d.ts', `
|
||||
import {ɵDirectiveDefWithMeta, ɵNgModuleDefWithMeta} from '@angular/core';
|
||||
import {ΔDirectiveDefWithMeta, ΔNgModuleDefWithMeta} from '@angular/core';
|
||||
|
||||
export declare class ExternalDir {
|
||||
static ngDirectiveDef: ɵDirectiveDefWithMeta<ExternalDir, '[test]', never, never, never, never>;
|
||||
static ngDirectiveDef: ΔDirectiveDefWithMeta<ExternalDir, '[test]', never, never, never, never>;
|
||||
}
|
||||
|
||||
export declare class AlphaModule {
|
||||
static ngModuleDef: ɵNgModuleDefWithMeta<AlphaModule, [typeof ExternalDir], never, [typeof ExternalDir]>;
|
||||
static ngModuleDef: ΔNgModuleDefWithMeta<AlphaModule, [typeof ExternalDir], never, [typeof ExternalDir]>;
|
||||
}
|
||||
`);
|
||||
|
||||
// 'beta' re-exports AlphaModule from alpha.
|
||||
env.write('beta.d.ts', `
|
||||
import {ɵNgModuleDefWithMeta} from '@angular/core';
|
||||
import {ΔNgModuleDefWithMeta} from '@angular/core';
|
||||
import {AlphaModule} from './alpha';
|
||||
|
||||
export declare class BetaModule {
|
||||
static ngModuleDef: ɵNgModuleDefWithMeta<AlphaModule, never, never, [typeof AlphaModule]>;
|
||||
static ngModuleDef: ΔNgModuleDefWithMeta<AlphaModule, never, never, [typeof AlphaModule]>;
|
||||
}
|
||||
`);
|
||||
|
||||
@ -3991,26 +3991,26 @@ export const Foo = Foo__PRE_R3__;
|
||||
it('should write alias ES2015 exports for NgModule exported directives', () => {
|
||||
env.tsconfig({'_useHostForImportGeneration': true});
|
||||
env.write('external.d.ts', `
|
||||
import {ɵDirectiveDefWithMeta, ɵNgModuleDefWithMeta} from '@angular/core';
|
||||
import {ΔDirectiveDefWithMeta, ΔNgModuleDefWithMeta} from '@angular/core';
|
||||
import {LibModule} from './lib';
|
||||
|
||||
export declare class ExternalDir {
|
||||
static ngDirectiveDef: ɵDirectiveDefWithMeta<ExternalDir, '[test]', never, never, never, never>;
|
||||
static ngDirectiveDef: ΔDirectiveDefWithMeta<ExternalDir, '[test]', never, never, never, never>;
|
||||
}
|
||||
|
||||
export declare class ExternalModule {
|
||||
static ngModuleDef: ɵNgModuleDefWithMeta<ExternalModule, [typeof ExternalDir], never, [typeof ExternalDir, typeof LibModule]>;
|
||||
static ngModuleDef: ΔNgModuleDefWithMeta<ExternalModule, [typeof ExternalDir], never, [typeof ExternalDir, typeof LibModule]>;
|
||||
}
|
||||
`);
|
||||
env.write('lib.d.ts', `
|
||||
import {ɵDirectiveDefWithMeta, ɵNgModuleDefWithMeta} from '@angular/core';
|
||||
import {ΔDirectiveDefWithMeta, ΔNgModuleDefWithMeta} from '@angular/core';
|
||||
|
||||
export declare class LibDir {
|
||||
static ngDirectiveDef: ɵDirectiveDefWithMeta<LibDir, '[lib]', never, never, never, never>;
|
||||
static ngDirectiveDef: ΔDirectiveDefWithMeta<LibDir, '[lib]', never, never, never, never>;
|
||||
}
|
||||
|
||||
export declare class LibModule {
|
||||
static ngModuleDef: ɵNgModuleDefWithMeta<LibModule, [typeof LibDir], never, [typeof LibDir]>;
|
||||
static ngModuleDef: ΔNgModuleDefWithMeta<LibModule, [typeof LibDir], never, [typeof LibDir]>;
|
||||
}
|
||||
`);
|
||||
env.write('foo.ts', `
|
||||
|
@ -25,10 +25,10 @@ describe('ngtsc module scopes', () => {
|
||||
env.tsconfig();
|
||||
env.write('test.ts', `
|
||||
import {NgModule} from '@angular/core';
|
||||
|
||||
|
||||
@NgModule({})
|
||||
export class OtherModule {}
|
||||
|
||||
|
||||
@NgModule({imports: [OtherModule]})
|
||||
export class TestModule {}
|
||||
`);
|
||||
@ -36,23 +36,23 @@ describe('ngtsc module scopes', () => {
|
||||
env.driveMain();
|
||||
|
||||
const jsContents = env.getContents('test.js');
|
||||
expect(jsContents).toContain('i0.ɵdefineNgModule({ type: TestModule });');
|
||||
expect(jsContents).toContain('i0.ΔdefineNgModule({ type: TestModule });');
|
||||
expect(jsContents)
|
||||
.toContain(
|
||||
'/*@__PURE__*/ i0.ɵsetNgModuleScope(TestModule, { imports: [OtherModule] });');
|
||||
'/*@__PURE__*/ i0.ΔsetNgModuleScope(TestModule, { imports: [OtherModule] });');
|
||||
|
||||
const dtsContents = env.getContents('test.d.ts');
|
||||
expect(dtsContents)
|
||||
.toContain(
|
||||
'static ngModuleDef: i0.ɵNgModuleDefWithMeta<TestModule, never, [typeof OtherModule], never>');
|
||||
'static ngModuleDef: i0.ΔNgModuleDefWithMeta<TestModule, never, [typeof OtherModule], never>');
|
||||
});
|
||||
|
||||
it('should produce an error when an invalid class is imported', () => {
|
||||
env.write('test.ts', `
|
||||
import {NgModule} from '@angular/core';
|
||||
|
||||
|
||||
class NotAModule {}
|
||||
|
||||
|
||||
@NgModule({imports: [NotAModule]})
|
||||
class IsAModule {}
|
||||
`);
|
||||
@ -69,7 +69,7 @@ describe('ngtsc module scopes', () => {
|
||||
env.write('test.ts', `
|
||||
import {NgModule} from '@angular/core';
|
||||
import {NotAClass} from './dep';
|
||||
|
||||
|
||||
@NgModule({imports: [NotAClass]})
|
||||
class IsAModule {}
|
||||
`);
|
||||
@ -87,10 +87,10 @@ describe('ngtsc module scopes', () => {
|
||||
env.tsconfig();
|
||||
env.write('test.ts', `
|
||||
import {NgModule} from '@angular/core';
|
||||
|
||||
|
||||
@NgModule({})
|
||||
export class OtherModule {}
|
||||
|
||||
|
||||
@NgModule({exports: [OtherModule]})
|
||||
export class TestModule {}
|
||||
`);
|
||||
@ -98,23 +98,23 @@ describe('ngtsc module scopes', () => {
|
||||
env.driveMain();
|
||||
|
||||
const jsContents = env.getContents('test.js');
|
||||
expect(jsContents).toContain('i0.ɵdefineNgModule({ type: TestModule });');
|
||||
expect(jsContents).toContain('i0.ΔdefineNgModule({ type: TestModule });');
|
||||
expect(jsContents)
|
||||
.toContain(
|
||||
'/*@__PURE__*/ i0.ɵsetNgModuleScope(TestModule, { exports: [OtherModule] });');
|
||||
'/*@__PURE__*/ i0.ΔsetNgModuleScope(TestModule, { exports: [OtherModule] });');
|
||||
|
||||
const dtsContents = env.getContents('test.d.ts');
|
||||
expect(dtsContents)
|
||||
.toContain(
|
||||
'static ngModuleDef: i0.ɵNgModuleDefWithMeta<TestModule, never, never, [typeof OtherModule]>');
|
||||
'static ngModuleDef: i0.ΔNgModuleDefWithMeta<TestModule, never, never, [typeof OtherModule]>');
|
||||
});
|
||||
|
||||
it('should produce an error when a non-NgModule class is exported', () => {
|
||||
env.write('test.ts', `
|
||||
import {NgModule} from '@angular/core';
|
||||
|
||||
|
||||
class NotAModule {}
|
||||
|
||||
|
||||
@NgModule({exports: [NotAModule]})
|
||||
class IsAModule {}
|
||||
`);
|
||||
@ -131,12 +131,12 @@ describe('ngtsc module scopes', () => {
|
||||
import {NgModule} from '@angular/core';
|
||||
|
||||
export class NotAModule {}
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [NotAModule],
|
||||
})
|
||||
class InvalidModule {}
|
||||
|
||||
|
||||
@NgModule({exports: [InvalidModule]})
|
||||
class IsAModule {}
|
||||
`);
|
||||
@ -157,10 +157,10 @@ describe('ngtsc module scopes', () => {
|
||||
it('should produce an error when a non-declared/imported class is re-exported', () => {
|
||||
env.write('test.ts', `
|
||||
import {Directive, NgModule} from '@angular/core';
|
||||
|
||||
|
||||
@Directive({selector: 'test'})
|
||||
class Dir {}
|
||||
|
||||
|
||||
@NgModule({exports: [Dir]})
|
||||
class IsAModule {}
|
||||
`);
|
||||
|
@ -23,17 +23,17 @@ describe('template source-mapping', () => {
|
||||
it('should map simple element with content', () => {
|
||||
const mappings = compileAndMap('<h1>Heading 1</h1>');
|
||||
expect(mappings).toContain(
|
||||
{source: '<h1>', generated: 'i0.ɵelementStart(0, "h1")', sourceUrl: '../test.ts'});
|
||||
{source: '<h1>', generated: 'i0.ΔelementStart(0, "h1")', sourceUrl: '../test.ts'});
|
||||
expect(mappings).toContain(
|
||||
{source: 'Heading 1', generated: 'i0.ɵtext(1, "Heading 1")', sourceUrl: '../test.ts'});
|
||||
{source: 'Heading 1', generated: 'i0.Δtext(1, "Heading 1")', sourceUrl: '../test.ts'});
|
||||
expect(mappings).toContain(
|
||||
{source: '</h1>', generated: 'i0.ɵelementEnd()', sourceUrl: '../test.ts'});
|
||||
{source: '</h1>', generated: 'i0.ΔelementEnd()', sourceUrl: '../test.ts'});
|
||||
});
|
||||
|
||||
it('should map void element', () => {
|
||||
const mappings = compileAndMap('<hr>');
|
||||
expect(mappings).toContain(
|
||||
{source: '<hr>', generated: 'i0.ɵelement(0, "hr")', sourceUrl: '../test.ts'});
|
||||
{source: '<hr>', generated: 'i0.Δelement(0, "hr")', sourceUrl: '../test.ts'});
|
||||
});
|
||||
});
|
||||
|
||||
@ -41,40 +41,40 @@ describe('template source-mapping', () => {
|
||||
it('should map a mix of interpolated and static content', () => {
|
||||
const mappings = compileAndMap('<h3>Hello {{ name }}</h3>');
|
||||
expect(mappings).toContain(
|
||||
{source: '<h3>', generated: 'i0.ɵelementStart(0, "h3")', sourceUrl: '../test.ts'});
|
||||
{source: '<h3>', generated: 'i0.ΔelementStart(0, "h3")', sourceUrl: '../test.ts'});
|
||||
expect(mappings).toContain({
|
||||
source: 'Hello {{ name }}',
|
||||
generated: 'i0.ɵtextBinding(1, i0.ɵinterpolation1("Hello ", ctx.name, ""))',
|
||||
generated: 'i0.ΔtextBinding(1, i0.Δinterpolation1("Hello ", ctx.name, ""))',
|
||||
sourceUrl: '../test.ts'
|
||||
});
|
||||
expect(mappings).toContain(
|
||||
{source: '</h3>', generated: 'i0.ɵelementEnd()', sourceUrl: '../test.ts'});
|
||||
{source: '</h3>', generated: 'i0.ΔelementEnd()', sourceUrl: '../test.ts'});
|
||||
});
|
||||
|
||||
it('should map a complex interpolated expression', () => {
|
||||
const mappings = compileAndMap('<h2>{{ greeting + " " + name }}</h2>');
|
||||
expect(mappings).toContain(
|
||||
{source: '<h2>', generated: 'i0.ɵelementStart(0, "h2")', sourceUrl: '../test.ts'});
|
||||
{source: '<h2>', generated: 'i0.ΔelementStart(0, "h2")', sourceUrl: '../test.ts'});
|
||||
expect(mappings).toContain({
|
||||
source: '{{ greeting + " " + name }}',
|
||||
generated:
|
||||
'i0.ɵtextBinding(1, i0.ɵinterpolation1("", ((ctx.greeting + " ") + ctx.name), ""))',
|
||||
'i0.ΔtextBinding(1, i0.Δinterpolation1("", ((ctx.greeting + " ") + ctx.name), ""))',
|
||||
sourceUrl: '../test.ts'
|
||||
});
|
||||
expect(mappings).toContain(
|
||||
{source: '</h2>', generated: 'i0.ɵelementEnd()', sourceUrl: '../test.ts'});
|
||||
{source: '</h2>', generated: 'i0.ΔelementEnd()', sourceUrl: '../test.ts'});
|
||||
});
|
||||
|
||||
it('should map interpolated properties', () => {
|
||||
const mappings = compileAndMap('<div id="{{name}}"></div>');
|
||||
expect(mappings).toContain({
|
||||
source: '<div id="{{name}}"></div>',
|
||||
generated: 'i0.ɵelement(0, "div", _c0)',
|
||||
generated: 'i0.Δelement(0, "div", _c0)',
|
||||
sourceUrl: '../test.ts'
|
||||
});
|
||||
expect(mappings).toContain({
|
||||
source: 'id="{{name}}"',
|
||||
generated: 'i0.ɵelementProperty(0, "id", i0.ɵinterpolation1("", ctx.name, ""))',
|
||||
generated: 'i0.ΔelementProperty(0, "id", i0.Δinterpolation1("", ctx.name, ""))',
|
||||
sourceUrl: '../test.ts'
|
||||
});
|
||||
});
|
||||
@ -82,15 +82,15 @@ describe('template source-mapping', () => {
|
||||
it('should map interpolation with pipe', () => {
|
||||
const mappings = compileAndMap('<div>{{200.3 | percent : 2 }}</div>');
|
||||
expect(mappings).toContain(
|
||||
{source: '<div>', generated: 'i0.ɵelementStart(0, "div")', sourceUrl: '../test.ts'});
|
||||
{source: '<div>', generated: 'i0.ΔelementStart(0, "div")', sourceUrl: '../test.ts'});
|
||||
expect(mappings).toContain({
|
||||
source: '{{200.3 | percent : 2 }}',
|
||||
generated:
|
||||
'i0.ɵtextBinding(1, i0.ɵinterpolation1("", i0.ɵpipeBind2(2, 1, 200.3, 2), ""))',
|
||||
'i0.ΔtextBinding(1, i0.Δinterpolation1("", i0.ΔpipeBind2(2, 1, 200.3, 2), ""))',
|
||||
sourceUrl: '../test.ts'
|
||||
});
|
||||
expect(mappings).toContain(
|
||||
{source: '</div>', generated: 'i0.ɵelementEnd()', sourceUrl: '../test.ts'});
|
||||
{source: '</div>', generated: 'i0.ΔelementEnd()', sourceUrl: '../test.ts'});
|
||||
});
|
||||
});
|
||||
|
||||
@ -99,12 +99,12 @@ describe('template source-mapping', () => {
|
||||
const mappings = compileAndMap('<div [attr]="name"></div>');
|
||||
expect(mappings).toContain({
|
||||
source: '<div [attr]="name"></div>',
|
||||
generated: 'i0.ɵelement(0, "div", _c0)',
|
||||
generated: 'i0.Δelement(0, "div", _c0)',
|
||||
sourceUrl: '../test.ts'
|
||||
});
|
||||
expect(mappings).toContain({
|
||||
source: '[attr]="name"',
|
||||
generated: 'i0.ɵelementProperty(0, "attr", i0.ɵbind(ctx.name))',
|
||||
generated: 'i0.ΔelementProperty(0, "attr", i0.Δbind(ctx.name))',
|
||||
sourceUrl: '../test.ts'
|
||||
});
|
||||
});
|
||||
@ -113,12 +113,12 @@ describe('template source-mapping', () => {
|
||||
const mappings = compileAndMap('<div [attr]="greeting + name"></div>');
|
||||
expect(mappings).toContain({
|
||||
source: '<div [attr]="greeting + name"></div>',
|
||||
generated: 'i0.ɵelement(0, "div", _c0)',
|
||||
generated: 'i0.Δelement(0, "div", _c0)',
|
||||
sourceUrl: '../test.ts'
|
||||
});
|
||||
expect(mappings).toContain({
|
||||
source: '[attr]="greeting + name"',
|
||||
generated: 'i0.ɵelementProperty(0, "attr", i0.ɵbind((ctx.greeting + ctx.name)))',
|
||||
generated: 'i0.ΔelementProperty(0, "attr", i0.Δbind((ctx.greeting + ctx.name)))',
|
||||
sourceUrl: '../test.ts'
|
||||
});
|
||||
});
|
||||
@ -127,12 +127,12 @@ describe('template source-mapping', () => {
|
||||
const mappings = compileAndMap('<div bind-attr="name"></div>');
|
||||
expect(mappings).toContain({
|
||||
source: '<div bind-attr="name"></div>',
|
||||
generated: 'i0.ɵelement(0, "div", _c0)',
|
||||
generated: 'i0.Δelement(0, "div", _c0)',
|
||||
sourceUrl: '../test.ts'
|
||||
});
|
||||
expect(mappings).toContain({
|
||||
source: 'bind-attr="name"',
|
||||
generated: 'i0.ɵelementProperty(0, "attr", i0.ɵbind(ctx.name))',
|
||||
generated: 'i0.ΔelementProperty(0, "attr", i0.Δbind(ctx.name))',
|
||||
sourceUrl: '../test.ts'
|
||||
});
|
||||
});
|
||||
@ -141,15 +141,15 @@ describe('template source-mapping', () => {
|
||||
const mappings = compileAndMap('<button (click)="doSomething()">Do it</button>');
|
||||
expect(mappings).toContain({
|
||||
source: '<button (click)="doSomething()">',
|
||||
generated: 'i0.ɵelementStart(0, "button", _c0)',
|
||||
generated: 'i0.ΔelementStart(0, "button", _c0)',
|
||||
sourceUrl: '../test.ts'
|
||||
});
|
||||
expect(mappings).toContain(
|
||||
{source: 'Do it', generated: 'i0.ɵtext(1, "Do it")', sourceUrl: '../test.ts'});
|
||||
{source: 'Do it', generated: 'i0.Δtext(1, "Do it")', sourceUrl: '../test.ts'});
|
||||
expect(mappings).toContain(
|
||||
{source: 'doSomething()', generated: 'ctx.doSomething()', sourceUrl: '../test.ts'});
|
||||
expect(mappings).toContain(
|
||||
{source: '</button>', generated: 'i0.ɵelementEnd()', sourceUrl: '../test.ts'});
|
||||
{source: '</button>', generated: 'i0.ΔelementEnd()', sourceUrl: '../test.ts'});
|
||||
});
|
||||
|
||||
it('should map a complex output binding expression', () => {
|
||||
@ -157,11 +157,11 @@ describe('template source-mapping', () => {
|
||||
compileAndMap(`<button (click)="items.push('item' + items.length)">Add Item</button>`);
|
||||
expect(mappings).toContain({
|
||||
source: `<button (click)="items.push('item' + items.length)">`,
|
||||
generated: 'i0.ɵelementStart(0, "button", _c0)',
|
||||
generated: 'i0.ΔelementStart(0, "button", _c0)',
|
||||
sourceUrl: '../test.ts'
|
||||
});
|
||||
expect(mappings).toContain(
|
||||
{source: 'Add Item', generated: 'i0.ɵtext(1, "Add Item")', sourceUrl: '../test.ts'});
|
||||
{source: 'Add Item', generated: 'i0.Δtext(1, "Add Item")', sourceUrl: '../test.ts'});
|
||||
expect(mappings).toContain(
|
||||
{source: 'items.push(', generated: 'ctx.items.push((', sourceUrl: '../test.ts'});
|
||||
expect(mappings).toContain(
|
||||
@ -172,41 +172,41 @@ describe('template source-mapping', () => {
|
||||
sourceUrl: '../test.ts'
|
||||
});
|
||||
expect(mappings).toContain(
|
||||
{source: '</button>', generated: 'i0.ɵelementEnd()', sourceUrl: '../test.ts'});
|
||||
{source: '</button>', generated: 'i0.ΔelementEnd()', sourceUrl: '../test.ts'});
|
||||
});
|
||||
|
||||
it('should map a longhand output binding expression', () => {
|
||||
const mappings = compileAndMap('<button on-click="doSomething()">Do it</button>');
|
||||
expect(mappings).toContain({
|
||||
source: '<button on-click="doSomething()">',
|
||||
generated: 'i0.ɵelementStart(0, "button", _c0)',
|
||||
generated: 'i0.ΔelementStart(0, "button", _c0)',
|
||||
sourceUrl: '../test.ts'
|
||||
});
|
||||
expect(mappings).toContain(
|
||||
{source: 'Do it', generated: 'i0.ɵtext(1, "Do it")', sourceUrl: '../test.ts'});
|
||||
{source: 'Do it', generated: 'i0.Δtext(1, "Do it")', sourceUrl: '../test.ts'});
|
||||
expect(mappings).toContain(
|
||||
{source: 'doSomething()', generated: 'ctx.doSomething()', sourceUrl: '../test.ts'});
|
||||
expect(mappings).toContain(
|
||||
{source: '</button>', generated: 'i0.ɵelementEnd()', sourceUrl: '../test.ts'});
|
||||
{source: '</button>', generated: 'i0.ΔelementEnd()', sourceUrl: '../test.ts'});
|
||||
});
|
||||
|
||||
it('should map a two-way binding expression', () => {
|
||||
const mappings = compileAndMap('Name: <input [(ngModel)]="name">');
|
||||
expect(mappings).toContain({
|
||||
source: '<input [(ngModel)]="name">',
|
||||
generated: 'i0.ɵelementStart(1, "input", _c0)',
|
||||
generated: 'i0.ΔelementStart(1, "input", _c0)',
|
||||
sourceUrl: '../test.ts'
|
||||
});
|
||||
// TODO: improve mappings here
|
||||
expect(mappings).toContain({
|
||||
source: '[(ngModel)]="name"',
|
||||
generated:
|
||||
'i0.ɵlistener("ngModelChange", function TestCmp_Template_input_ngModelChange_1_listener($event) { return ctx.name = $event; })',
|
||||
'i0.Δlistener("ngModelChange", function TestCmp_Template_input_ngModelChange_1_listener($event) { return ctx.name = $event; })',
|
||||
sourceUrl: '../test.ts'
|
||||
});
|
||||
expect(mappings).toContain({
|
||||
source: '<input [(ngModel)]="name">',
|
||||
generated: 'i0.ɵelementEnd()',
|
||||
generated: 'i0.ΔelementEnd()',
|
||||
sourceUrl: '../test.ts'
|
||||
});
|
||||
});
|
||||
@ -215,19 +215,19 @@ describe('template source-mapping', () => {
|
||||
const mappings = compileAndMap('Name: <input bindon-ngModel="name">');
|
||||
expect(mappings).toContain({
|
||||
source: '<input bindon-ngModel="name">',
|
||||
generated: 'i0.ɵelementStart(1, "input", _c0)',
|
||||
generated: 'i0.ΔelementStart(1, "input", _c0)',
|
||||
sourceUrl: '../test.ts'
|
||||
});
|
||||
// TODO: improve mappings here
|
||||
expect(mappings).toContain({
|
||||
source: 'bindon-ngModel="name"',
|
||||
generated:
|
||||
'i0.ɵlistener("ngModelChange", function TestCmp_Template_input_ngModelChange_1_listener($event) { return ctx.name = $event; })',
|
||||
'i0.Δlistener("ngModelChange", function TestCmp_Template_input_ngModelChange_1_listener($event) { return ctx.name = $event; })',
|
||||
sourceUrl: '../test.ts'
|
||||
});
|
||||
expect(mappings).toContain({
|
||||
source: '<input bindon-ngModel="name">',
|
||||
generated: 'i0.ɵelementEnd()',
|
||||
generated: 'i0.ΔelementEnd()',
|
||||
sourceUrl: '../test.ts'
|
||||
});
|
||||
});
|
||||
@ -236,17 +236,17 @@ describe('template source-mapping', () => {
|
||||
const mappings = compileAndMap('<div [class.initial]="isInitial">Message</div>');
|
||||
expect(mappings).toContain({
|
||||
source: '<div [class.initial]="isInitial">',
|
||||
generated: 'i0.ɵelementStart(0, "div")',
|
||||
generated: 'i0.ΔelementStart(0, "div")',
|
||||
sourceUrl: '../test.ts'
|
||||
});
|
||||
|
||||
// TODO: Add better mappings for binding
|
||||
|
||||
expect(mappings).toContain(
|
||||
{source: 'Message', generated: 'i0.ɵtext(1, "Message")', sourceUrl: '../test.ts'});
|
||||
{source: 'Message', generated: 'i0.Δtext(1, "Message")', sourceUrl: '../test.ts'});
|
||||
|
||||
expect(mappings).toContain(
|
||||
{source: '</div>', generated: 'i0.ɵelementEnd()', sourceUrl: '../test.ts'});
|
||||
{source: '</div>', generated: 'i0.ΔelementEnd()', sourceUrl: '../test.ts'});
|
||||
});
|
||||
});
|
||||
|
||||
@ -256,20 +256,20 @@ describe('template source-mapping', () => {
|
||||
|
||||
expect(mappings).toContain({
|
||||
source: '<div *ngIf="showMessage()">',
|
||||
generated: 'i0.ɵelementStart(0, "div")',
|
||||
generated: 'i0.ΔelementStart(0, "div")',
|
||||
sourceUrl: '../test.ts'
|
||||
});
|
||||
|
||||
// TODO - map the bindings better
|
||||
|
||||
expect(mappings).toContain(
|
||||
{source: '</div>', generated: 'i0.ɵelementEnd()', sourceUrl: '../test.ts'});
|
||||
{source: '</div>', generated: 'i0.ΔelementEnd()', sourceUrl: '../test.ts'});
|
||||
|
||||
// TODO: the `ctx_r...` appears to be dependent upon previous tests!!!
|
||||
|
||||
// expect(mappings).toContain({
|
||||
// source: '{{ name }}',
|
||||
// generated: 'i0.ɵtextBinding(1, i0.ɵinterpolation1("", ctx_r0.name, ""))',
|
||||
// generated: 'i0.ΔtextBinding(1, i0.Δinterpolation1("", ctx_r0.name, ""))',
|
||||
// sourceUrl: '../test.ts'
|
||||
// });
|
||||
});
|
||||
@ -282,18 +282,18 @@ describe('template source-mapping', () => {
|
||||
`</ng-template>`);
|
||||
|
||||
expect(mappings).toContain(
|
||||
{source: '<div>', generated: 'i0.ɵelementStart(0, "div")', sourceUrl: '../test.ts'});
|
||||
{source: '<div>', generated: 'i0.ΔelementStart(0, "div")', sourceUrl: '../test.ts'});
|
||||
|
||||
// TODO - map the bindings better
|
||||
|
||||
expect(mappings).toContain(
|
||||
{source: '</div>', generated: 'i0.ɵelementEnd()', sourceUrl: '../test.ts'});
|
||||
{source: '</div>', generated: 'i0.ΔelementEnd()', sourceUrl: '../test.ts'});
|
||||
|
||||
// TODO: the `ctx_r...` appears to be dependent upon previous tests!!!
|
||||
|
||||
// expect(mappings).toContain({
|
||||
// source: '{{ name }}',
|
||||
// generated: 'i0.ɵtextBinding(1, i0.ɵinterpolation1("", ctx_r0.name, ""))',
|
||||
// generated: 'i0.ΔtextBinding(1, i0.Δinterpolation1("", ctx_r0.name, ""))',
|
||||
// sourceUrl: '../test.ts'
|
||||
// });
|
||||
});
|
||||
@ -304,14 +304,14 @@ describe('template source-mapping', () => {
|
||||
|
||||
expect(mappings).toContain({
|
||||
source: '<div *ngFor="let item of items; index as i; trackBy: trackByFn">',
|
||||
generated: 'i0.ɵelementStart(0, "div")',
|
||||
generated: 'i0.ΔelementStart(0, "div")',
|
||||
sourceUrl: '../test.ts'
|
||||
});
|
||||
|
||||
// TODO - map the bindings better
|
||||
|
||||
expect(mappings).toContain(
|
||||
{source: '</div>', generated: 'i0.ɵelementEnd()', sourceUrl: '../test.ts'});
|
||||
{source: '</div>', generated: 'i0.ΔelementEnd()', sourceUrl: '../test.ts'});
|
||||
|
||||
});
|
||||
|
||||
@ -330,20 +330,20 @@ describe('template source-mapping', () => {
|
||||
`<div><ng-content></ng-content></div>`);
|
||||
|
||||
expect(mappings).toContain(
|
||||
{source: '<h3>', generated: 'i0.ɵelementStart(0, "h3")', sourceUrl: '../test.ts'});
|
||||
{source: '<h3>', generated: 'i0.ΔelementStart(0, "h3")', sourceUrl: '../test.ts'});
|
||||
expect(mappings).toContain({
|
||||
source: '<ng-content select="title">',
|
||||
generated: 'i0.ɵprojection(1, 1)',
|
||||
generated: 'i0.Δprojection(1, 1)',
|
||||
sourceUrl: '../test.ts'
|
||||
});
|
||||
expect(mappings).toContain(
|
||||
{source: '</h3>', generated: 'i0.ɵelementEnd()', sourceUrl: '../test.ts'});
|
||||
{source: '</h3>', generated: 'i0.ΔelementEnd()', sourceUrl: '../test.ts'});
|
||||
expect(mappings).toContain(
|
||||
{source: '<div>', generated: 'i0.ɵelementStart(2, "div")', sourceUrl: '../test.ts'});
|
||||
{source: '<div>', generated: 'i0.ΔelementStart(2, "div")', sourceUrl: '../test.ts'});
|
||||
expect(mappings).toContain(
|
||||
{source: '<ng-content>', generated: 'i0.ɵprojection(3)', sourceUrl: '../test.ts'});
|
||||
{source: '<ng-content>', generated: 'i0.Δprojection(3)', sourceUrl: '../test.ts'});
|
||||
expect(mappings).toContain(
|
||||
{source: '</div>', generated: 'i0.ɵelementEnd()', sourceUrl: '../test.ts'});
|
||||
{source: '</div>', generated: 'i0.ΔelementEnd()', sourceUrl: '../test.ts'});
|
||||
});
|
||||
});
|
||||
|
||||
@ -352,24 +352,24 @@ describe('template source-mapping', () => {
|
||||
|
||||
// Creation mode
|
||||
expect(mappings).toContain(
|
||||
{generated: 'i0.ɵelementStart(0, "div")', source: '<div>', sourceUrl: '../test.ts'});
|
||||
{generated: 'i0.ΔelementStart(0, "div")', source: '<div>', sourceUrl: '../test.ts'});
|
||||
expect(mappings).toContain({
|
||||
generated: 'i0.ɵtext(1, "this is a test")',
|
||||
generated: 'i0.Δtext(1, "this is a test")',
|
||||
source: 'this is a test',
|
||||
sourceUrl: '../test.ts'
|
||||
});
|
||||
expect(mappings).toContain(
|
||||
{generated: 'i0.ɵelementEnd()', source: '</div>', sourceUrl: '../test.ts'});
|
||||
{generated: 'i0.ΔelementEnd()', source: '</div>', sourceUrl: '../test.ts'});
|
||||
expect(mappings).toContain(
|
||||
{generated: 'i0.ɵelementStart(2, "div")', source: '<div>', sourceUrl: '../test.ts'});
|
||||
{generated: 'i0.ΔelementStart(2, "div")', source: '<div>', sourceUrl: '../test.ts'});
|
||||
expect(mappings).toContain(
|
||||
{generated: 'i0.ɵtext(3)', source: '{{ 1 + 2 }}', sourceUrl: '../test.ts'});
|
||||
{generated: 'i0.Δtext(3)', source: '{{ 1 + 2 }}', sourceUrl: '../test.ts'});
|
||||
expect(mappings).toContain(
|
||||
{generated: 'i0.ɵelementEnd()', source: '</div>', sourceUrl: '../test.ts'});
|
||||
{generated: 'i0.ΔelementEnd()', source: '</div>', sourceUrl: '../test.ts'});
|
||||
|
||||
// Update mode
|
||||
expect(mappings).toContain({
|
||||
generated: 'i0.ɵtextBinding(3, i0.ɵinterpolation1("", (1 + 2), ""))',
|
||||
generated: 'i0.ΔtextBinding(3, i0.Δinterpolation1("", (1 + 2), ""))',
|
||||
source: '{{ 1 + 2 }}',
|
||||
sourceUrl: '../test.ts'
|
||||
});
|
||||
@ -380,24 +380,24 @@ describe('template source-mapping', () => {
|
||||
|
||||
// Creation mode
|
||||
expect(mappings).toContain(
|
||||
{generated: 'i0.ɵelementStart(0, "div")', source: '<div>', sourceUrl: '../test.ts'});
|
||||
{generated: 'i0.ΔelementStart(0, "div")', source: '<div>', sourceUrl: '../test.ts'});
|
||||
expect(mappings).toContain({
|
||||
generated: 'i0.ɵtext(1, "this is a test")',
|
||||
generated: 'i0.Δtext(1, "this is a test")',
|
||||
source: 'this is a test',
|
||||
sourceUrl: '../test.ts'
|
||||
});
|
||||
expect(mappings).toContain(
|
||||
{generated: 'i0.ɵelementEnd()', source: '</div>', sourceUrl: '../test.ts'});
|
||||
{generated: 'i0.ΔelementEnd()', source: '</div>', sourceUrl: '../test.ts'});
|
||||
expect(mappings).toContain(
|
||||
{generated: 'i0.ɵelementStart(2, "div")', source: '<div>', sourceUrl: '../test.ts'});
|
||||
{generated: 'i0.ΔelementStart(2, "div")', source: '<div>', sourceUrl: '../test.ts'});
|
||||
expect(mappings).toContain(
|
||||
{generated: 'i0.ɵtext(3)', source: '{{ 1 + 2 }}', sourceUrl: '../test.ts'});
|
||||
{generated: 'i0.Δtext(3)', source: '{{ 1 + 2 }}', sourceUrl: '../test.ts'});
|
||||
expect(mappings).toContain(
|
||||
{generated: 'i0.ɵelementEnd()', source: '</div>', sourceUrl: '../test.ts'});
|
||||
{generated: 'i0.ΔelementEnd()', source: '</div>', sourceUrl: '../test.ts'});
|
||||
|
||||
// Update mode
|
||||
expect(mappings).toContain({
|
||||
generated: 'i0.ɵtextBinding(3, i0.ɵinterpolation1("", (1 + 2), ""))',
|
||||
generated: 'i0.ΔtextBinding(3, i0.Δinterpolation1("", (1 + 2), ""))',
|
||||
source: '{{ 1 + 2 }}',
|
||||
sourceUrl: '../test.ts'
|
||||
});
|
||||
@ -409,7 +409,7 @@ describe('template source-mapping', () => {
|
||||
const mappings = compileAndMap('<div class=\\"some-class\\">this is a test</div>');
|
||||
|
||||
expect(mappings).toContain({
|
||||
generated: 'i0.ɵelementStart(0, "div", _c0)',
|
||||
generated: 'i0.ΔelementStart(0, "div", _c0)',
|
||||
source: '<div class=\\"some-class\\">',
|
||||
sourceUrl: '../test.ts'
|
||||
});
|
||||
@ -428,30 +428,30 @@ describe('template source-mapping', () => {
|
||||
|
||||
// Creation mode
|
||||
expect(mappings).toContain({
|
||||
generated: 'i0.ɵelementStart(0, "div")',
|
||||
generated: 'i0.ΔelementStart(0, "div")',
|
||||
source: '<div>',
|
||||
sourceUrl: '../dir/test.html'
|
||||
});
|
||||
expect(mappings).toContain({
|
||||
generated: 'i0.ɵtext(1, "this is a test")',
|
||||
generated: 'i0.Δtext(1, "this is a test")',
|
||||
source: 'this is a test',
|
||||
sourceUrl: '../dir/test.html'
|
||||
});
|
||||
expect(mappings).toContain(
|
||||
{generated: 'i0.ɵelementEnd()', source: '</div>', sourceUrl: '../dir/test.html'});
|
||||
{generated: 'i0.ΔelementEnd()', source: '</div>', sourceUrl: '../dir/test.html'});
|
||||
expect(mappings).toContain({
|
||||
generated: 'i0.ɵelementStart(2, "div")',
|
||||
generated: 'i0.ΔelementStart(2, "div")',
|
||||
source: '<div>',
|
||||
sourceUrl: '../dir/test.html'
|
||||
});
|
||||
expect(mappings).toContain(
|
||||
{generated: 'i0.ɵtext(3)', source: '{{ 1 + 2 }}', sourceUrl: '../dir/test.html'});
|
||||
{generated: 'i0.Δtext(3)', source: '{{ 1 + 2 }}', sourceUrl: '../dir/test.html'});
|
||||
expect(mappings).toContain(
|
||||
{generated: 'i0.ɵelementEnd()', source: '</div>', sourceUrl: '../dir/test.html'});
|
||||
{generated: 'i0.ΔelementEnd()', source: '</div>', sourceUrl: '../dir/test.html'});
|
||||
|
||||
// Update mode
|
||||
expect(mappings).toContain({
|
||||
generated: 'i0.ɵtextBinding(3, i0.ɵinterpolation1("", (1 + 2), ""))',
|
||||
generated: 'i0.ΔtextBinding(3, i0.Δinterpolation1("", (1 + 2), ""))',
|
||||
source: '{{ 1 + 2 }}',
|
||||
sourceUrl: '../dir/test.html'
|
||||
});
|
||||
@ -463,39 +463,39 @@ describe('template source-mapping', () => {
|
||||
|
||||
// Creation mode
|
||||
expect(mappings).toContain({
|
||||
generated: 'i0.ɵelementStart(0, "div")',
|
||||
generated: 'i0.ΔelementStart(0, "div")',
|
||||
source: '<div>',
|
||||
sourceUrl: '../extraRootDir/test.html'
|
||||
});
|
||||
expect(mappings).toContain({
|
||||
generated: 'i0.ɵtext(1, "this is a test")',
|
||||
generated: 'i0.Δtext(1, "this is a test")',
|
||||
source: 'this is a test',
|
||||
sourceUrl: '../extraRootDir/test.html'
|
||||
});
|
||||
expect(mappings).toContain({
|
||||
generated: 'i0.ɵelementEnd()',
|
||||
generated: 'i0.ΔelementEnd()',
|
||||
source: '</div>',
|
||||
sourceUrl: '../extraRootDir/test.html'
|
||||
});
|
||||
expect(mappings).toContain({
|
||||
generated: 'i0.ɵelementStart(2, "div")',
|
||||
generated: 'i0.ΔelementStart(2, "div")',
|
||||
source: '<div>',
|
||||
sourceUrl: '../extraRootDir/test.html'
|
||||
});
|
||||
expect(mappings).toContain({
|
||||
generated: 'i0.ɵtext(3)',
|
||||
generated: 'i0.Δtext(3)',
|
||||
source: '{{ 1 + 2 }}',
|
||||
sourceUrl: '../extraRootDir/test.html'
|
||||
});
|
||||
expect(mappings).toContain({
|
||||
generated: 'i0.ɵelementEnd()',
|
||||
generated: 'i0.ΔelementEnd()',
|
||||
source: '</div>',
|
||||
sourceUrl: '../extraRootDir/test.html'
|
||||
});
|
||||
|
||||
// Update mode
|
||||
expect(mappings).toContain({
|
||||
generated: 'i0.ɵtextBinding(3, i0.ɵinterpolation1("", (1 + 2), ""))',
|
||||
generated: 'i0.ΔtextBinding(3, i0.Δinterpolation1("", (1 + 2), ""))',
|
||||
source: '{{ 1 + 2 }}',
|
||||
sourceUrl: '../extraRootDir/test.html'
|
||||
});
|
||||
|
@ -26,17 +26,17 @@ export declare class NgForOfContext<T> {
|
||||
export declare class NgForOf<T> {
|
||||
ngForOf: T[];
|
||||
static ngTemplateContextGuard<T>(dir: NgForOf<T>, ctx: any): ctx is NgForOfContext<T>;
|
||||
static ngDirectiveDef: i0.ɵDirectiveDefWithMeta<NgForOf<any>, '[ngFor][ngForOf]', never, {'ngForOf': 'ngForOf'}, {}, never>;
|
||||
static ngDirectiveDef: i0.ΔDirectiveDefWithMeta<NgForOf<any>, '[ngFor][ngForOf]', never, {'ngForOf': 'ngForOf'}, {}, never>;
|
||||
}
|
||||
|
||||
export declare class NgIf {
|
||||
ngIf: any;
|
||||
static ngTemplateGuard_ngIf<E>(dir: NgIf, expr: E): expr is NonNullable<E>
|
||||
static ngDirectiveDef: i0.ɵDirectiveDefWithMeta<NgForOf<any>, '[ngIf]', never, {'ngIf': 'ngIf'}, {}, never>;
|
||||
static ngDirectiveDef: i0.ΔDirectiveDefWithMeta<NgForOf<any>, '[ngIf]', never, {'ngIf': 'ngIf'}, {}, never>;
|
||||
}
|
||||
|
||||
export declare class CommonModule {
|
||||
static ngModuleDef: i0.ɵNgModuleDefWithMeta<CommonModule, [typeof NgIf, typeof NgForOf], never, [typeof NgIf, typeof NgForOf]>;
|
||||
static ngModuleDef: i0.ΔNgModuleDefWithMeta<CommonModule, [typeof NgIf, typeof NgForOf], never, [typeof NgIf, typeof NgForOf]>;
|
||||
}
|
||||
`);
|
||||
}
|
||||
|
@ -81,18 +81,18 @@ In `ngtsc` this is instead emitted as,
|
||||
```js
|
||||
const i0 = require("@angular/core");
|
||||
class GreetComponent {}
|
||||
GreetComponent.ngComponentDef = i0.ɵdefineComponent({
|
||||
GreetComponent.ngComponentDef = i0.ΔdefineComponent({
|
||||
type: GreetComponent,
|
||||
tag: 'greet',
|
||||
factory: () => new GreetComponent(),
|
||||
template: function (rf, ctx) {
|
||||
if (rf & RenderFlags.Create) {
|
||||
i0.ɵelementStart(0, 'div');
|
||||
i0.ɵtext(1);
|
||||
i0.ɵelementEnd();
|
||||
i0.ΔelementStart(0, 'div');
|
||||
i0.Δtext(1);
|
||||
i0.ΔelementEnd();
|
||||
}
|
||||
if (rf & RenderFlags.Update) {
|
||||
i0.ɵtextBinding(1, i0.ɵinterpolation1('Hello ', ctx.name, '!'));
|
||||
i0.ΔtextBinding(1, i0.Δinterpolation1('Hello ', ctx.name, '!'));
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -104,14 +104,14 @@ and the `.d.ts` contains:
|
||||
import * as i0 from '@angular/core';
|
||||
export class GreetComponent {
|
||||
static ngComponentDef: i0.NgComponentDef<
|
||||
GreetComponent,
|
||||
'greet',
|
||||
GreetComponent,
|
||||
'greet',
|
||||
{input: 'input'}
|
||||
>;
|
||||
}
|
||||
```
|
||||
|
||||
The information needed by reference inversion and type-checking is included in
|
||||
The information needed by reference inversion and type-checking is included in
|
||||
the type declaration of the `ngComponentDef` in the `.d.ts`.
|
||||
|
||||
#### TypeScript architecture
|
||||
@ -127,18 +127,18 @@ The overall architecure of TypeScript is:
|
||||
| TypeScript | -parse-> | AST | ->transform-> | AST | ->print-> | JavaScript |
|
||||
| source | | |-----| | |-----| | source |
|
||||
|------------| | | | |------------|
|
||||
| type-check |
|
||||
| | |
|
||||
| v |
|
||||
| |--------| |
|
||||
|--> | errors | <---|
|
||||
| type-check |
|
||||
| | |
|
||||
| v |
|
||||
| |--------| |
|
||||
|--> | errors | <---|
|
||||
|--------|
|
||||
|
||||
The parse step is a traditional recursive descent parser, augmented to support incremental parsing, that emits an abstract syntax tree (AST).
|
||||
The parse step is a traditional recursive descent parser, augmented to support incremental parsing, that emits an abstract syntax tree (AST).
|
||||
|
||||
The type-checker construct a symbol table and then performs type analysis of every expression in the file, reporting errors it finds. This process not extended or modified by `ngtsc`.
|
||||
|
||||
The transform step is a set of AST to AST transformations that perform various tasks such as, removing type declarations, lowering module and class declarations to ES5, converting `async` methods to state-machines, etc.
|
||||
The transform step is a set of AST to AST transformations that perform various tasks such as, removing type declarations, lowering module and class declarations to ES5, converting `async` methods to state-machines, etc.
|
||||
|
||||
#### Extension points
|
||||
|
||||
@ -229,7 +229,7 @@ The `ngtsc` metadata evaluator will be built as a partial Typescript interpreter
|
||||
|
||||
A template is compiled in `TemplateCompiler` by performing the following:
|
||||
|
||||
1. Tokenizes the template
|
||||
1. Tokenizes the template
|
||||
2. Parses the tokens into an HTML AST
|
||||
3. Converts the HTML AST into an Angular Template AST.
|
||||
4. Translates the Angular Template AST to a template function
|
||||
@ -244,7 +244,7 @@ As part of this conversion an exhaustive list of selector targets is also produc
|
||||
|
||||
The `TemplateCompiler` can produce a template function from a string without additional information. However, correct interpretation of that string requires a selector scope discussed below. The selector scope is built at runtime allowing the runtime to use a function built from just a string as long as it is given a selector scope (e.g. an NgModule) to use during instantiation.
|
||||
|
||||
#### The selector problem
|
||||
#### The selector problem
|
||||
|
||||
To interpret the content of a template, the runtime needs to know what component and directives to apply to the element and what pipes are referenced by binding expressions. The list of candidate components, directives and pipes are determined by the `NgModule` in which the component is declared. Since the module and component are in separate source files, mapping which components, directives and pipes referenced is left to the runtime. Unfortunately, this leads to a tree-shaking problem. Since there no direct link between the component and types the component references then all components, directives and pipes declared in the module, and any module imported from the module, must be available at runtime or risk the template failing to be interpreted correctly. Including everything can lead to a very large program which contains many components the application doesn't actually use.
|
||||
|
||||
|
@ -161,7 +161,7 @@ export class MyComponent {
|
||||
```js
|
||||
export class MyComponent {
|
||||
name: string;
|
||||
static ngComponentDef = defineComponent({...});
|
||||
static ngComponentDef = ΔdefineComponent({...});
|
||||
}
|
||||
```
|
||||
|
||||
@ -213,7 +213,7 @@ export class MyDirective {
|
||||
constructor() {
|
||||
this.dirId = 'some id';
|
||||
}
|
||||
static ngDirectiveDef = defineDirective({...});
|
||||
static ngDirectiveDef = ΔdefineDirective({...});
|
||||
}
|
||||
```
|
||||
|
||||
@ -256,7 +256,7 @@ export class MyPipe implements PipeTransform {
|
||||
```js
|
||||
export class MyPipe {
|
||||
transform(...) ...
|
||||
static ngPipeDef = definePipe({...});
|
||||
static ngPipeDef = ΔdefinePipe({...});
|
||||
}
|
||||
```
|
||||
|
||||
@ -329,7 +329,7 @@ export class MyModule {}
|
||||
*my.module.js*
|
||||
```js
|
||||
export class MyModule {
|
||||
static ngInjectorDef = defineInjector(...);
|
||||
static ngInjectorDef = ΔdefineInjector(...);
|
||||
}
|
||||
```
|
||||
|
||||
@ -389,7 +389,7 @@ manually written as:
|
||||
|
||||
```ts
|
||||
export class MyModule {
|
||||
static ngInjectorDef = defineInjector({
|
||||
static ngInjectorDef = ΔdefineInjector({
|
||||
providers: [{
|
||||
provide: Service, useClass: ServiceImpl
|
||||
}],
|
||||
@ -411,7 +411,7 @@ export class MyModule {
|
||||
}
|
||||
```
|
||||
|
||||
except for the call to `defineInjector` would generate a `{ __symbolic: 'error' }`
|
||||
except for the call to `ΔdefineInjector` would generate a `{ __symbolic: 'error' }`
|
||||
value which is ignored by the ivy compiler. This allows the system to ignore
|
||||
the difference between manually and mechanically created module definitions.
|
||||
|
||||
@ -440,7 +440,7 @@ properties by including a `// @__BUILD_OPTIMIZER_REMOVE_` comment:
|
||||
|
||||
```ts
|
||||
export class MyModule {
|
||||
static ngInjectorDef = defineInjector({
|
||||
static ngInjectorDef = ΔdefineInjector({
|
||||
providers: [{
|
||||
provide: Service, useClass: ServiceImpl
|
||||
}],
|
||||
|
@ -62,11 +62,11 @@ export class Identifiers {
|
||||
moduleName: CORE,
|
||||
|
||||
};
|
||||
static inject: o.ExternalReference = {name: 'inject', moduleName: CORE};
|
||||
static inject: o.ExternalReference = {name: 'Δinject', moduleName: CORE};
|
||||
static INJECTOR: o.ExternalReference = {name: 'INJECTOR', moduleName: CORE};
|
||||
static Injector: o.ExternalReference = {name: 'Injector', moduleName: CORE};
|
||||
static defineInjectable: o.ExternalReference = {name: 'defineInjectable', moduleName: CORE};
|
||||
static InjectableDef: o.ExternalReference = {name: 'ɵInjectableDef', moduleName: CORE};
|
||||
static ΔdefineInjectable: o.ExternalReference = {name: 'ΔdefineInjectable', moduleName: CORE};
|
||||
static InjectableDef: o.ExternalReference = {name: 'ΔInjectableDef', moduleName: CORE};
|
||||
static ViewEncapsulation: o.ExternalReference = {
|
||||
name: 'ViewEncapsulation',
|
||||
moduleName: CORE,
|
||||
@ -92,7 +92,7 @@ export class Identifiers {
|
||||
name: 'ɵinlineInterpolate',
|
||||
moduleName: CORE,
|
||||
};
|
||||
static interpolate: o.ExternalReference = {name: 'ɵinterpolate', moduleName: CORE};
|
||||
static interpolate: o.ExternalReference = {name: 'Δinterpolate', moduleName: CORE};
|
||||
static EMPTY_ARRAY: o.ExternalReference = {name: 'ɵEMPTY_ARRAY', moduleName: CORE};
|
||||
static EMPTY_MAP: o.ExternalReference = {name: 'ɵEMPTY_MAP', moduleName: CORE};
|
||||
static Renderer: o.ExternalReference = {name: 'Renderer', moduleName: CORE};
|
||||
|
@ -116,7 +116,7 @@ export class InjectableCompiler {
|
||||
mapEntry('token', ctx.importExpr(injectable.type.reference)),
|
||||
mapEntry('providedIn', providedIn),
|
||||
];
|
||||
return o.importExpr(Identifiers.defineInjectable).callFn([o.literalMap(def)]);
|
||||
return o.importExpr(Identifiers.ΔdefineInjectable).callFn([o.literalMap(def)]);
|
||||
}
|
||||
|
||||
compile(injectable: CompileInjectableMetadata, ctx: OutputContext): void {
|
||||
|
@ -100,7 +100,7 @@ export function compileInjectable(meta: R3InjectableMetadata): InjectableDef {
|
||||
const token = meta.type;
|
||||
const providedIn = meta.providedIn;
|
||||
|
||||
const expression = o.importExpr(Identifiers.defineInjectable).callFn([mapToMapExpression(
|
||||
const expression = o.importExpr(Identifiers.ΔdefineInjectable).callFn([mapToMapExpression(
|
||||
{token, factory: result.factory, providedIn})]);
|
||||
const type = new o.ExpressionType(o.importExpr(
|
||||
Identifiers.InjectableDef, [typeWithParameters(meta.type, meta.typeArgumentCount)]));
|
||||
|
@ -17,226 +17,226 @@ export class Identifiers {
|
||||
static PATCH_DEPS = 'patchedDeps';
|
||||
|
||||
/* Instructions */
|
||||
static namespaceHTML: o.ExternalReference = {name: 'ɵnamespaceHTML', moduleName: CORE};
|
||||
static namespaceHTML: o.ExternalReference = {name: 'ΔnamespaceHTML', moduleName: CORE};
|
||||
|
||||
static namespaceMathML: o.ExternalReference = {name: 'ɵnamespaceMathML', moduleName: CORE};
|
||||
static namespaceMathML: o.ExternalReference = {name: 'ΔnamespaceMathML', moduleName: CORE};
|
||||
|
||||
static namespaceSVG: o.ExternalReference = {name: 'ɵnamespaceSVG', moduleName: CORE};
|
||||
static namespaceSVG: o.ExternalReference = {name: 'ΔnamespaceSVG', moduleName: CORE};
|
||||
|
||||
static element: o.ExternalReference = {name: 'ɵelement', moduleName: CORE};
|
||||
static element: o.ExternalReference = {name: 'Δelement', moduleName: CORE};
|
||||
|
||||
static elementStart: o.ExternalReference = {name: 'ɵelementStart', moduleName: CORE};
|
||||
static elementStart: o.ExternalReference = {name: 'ΔelementStart', moduleName: CORE};
|
||||
|
||||
static elementEnd: o.ExternalReference = {name: 'ɵelementEnd', moduleName: CORE};
|
||||
static elementEnd: o.ExternalReference = {name: 'ΔelementEnd', moduleName: CORE};
|
||||
|
||||
static elementProperty: o.ExternalReference = {name: 'ɵelementProperty', moduleName: CORE};
|
||||
static elementProperty: o.ExternalReference = {name: 'ΔelementProperty', moduleName: CORE};
|
||||
|
||||
static select: o.ExternalReference = {name: 'ɵselect', moduleName: CORE};
|
||||
static select: o.ExternalReference = {name: 'Δselect', moduleName: CORE};
|
||||
|
||||
static componentHostSyntheticProperty:
|
||||
o.ExternalReference = {name: 'ɵcomponentHostSyntheticProperty', moduleName: CORE};
|
||||
o.ExternalReference = {name: 'ΔcomponentHostSyntheticProperty', moduleName: CORE};
|
||||
|
||||
static componentHostSyntheticListener:
|
||||
o.ExternalReference = {name: 'ɵcomponentHostSyntheticListener', moduleName: CORE};
|
||||
o.ExternalReference = {name: 'ΔcomponentHostSyntheticListener', moduleName: CORE};
|
||||
|
||||
static elementAttribute: o.ExternalReference = {name: 'ɵelementAttribute', moduleName: CORE};
|
||||
static elementAttribute: o.ExternalReference = {name: 'ΔelementAttribute', moduleName: CORE};
|
||||
|
||||
static elementClassProp: o.ExternalReference = {name: 'ɵelementClassProp', moduleName: CORE};
|
||||
static elementClassProp: o.ExternalReference = {name: 'ΔelementClassProp', moduleName: CORE};
|
||||
|
||||
static elementContainerStart:
|
||||
o.ExternalReference = {name: 'ɵelementContainerStart', moduleName: CORE};
|
||||
o.ExternalReference = {name: 'ΔelementContainerStart', moduleName: CORE};
|
||||
|
||||
static elementContainerEnd:
|
||||
o.ExternalReference = {name: 'ɵelementContainerEnd', moduleName: CORE};
|
||||
o.ExternalReference = {name: 'ΔelementContainerEnd', moduleName: CORE};
|
||||
|
||||
static elementStyling: o.ExternalReference = {name: 'ɵelementStyling', moduleName: CORE};
|
||||
static elementStyling: o.ExternalReference = {name: 'ΔelementStyling', moduleName: CORE};
|
||||
|
||||
static elementStylingMap: o.ExternalReference = {name: 'ɵelementStylingMap', moduleName: CORE};
|
||||
static elementStylingMap: o.ExternalReference = {name: 'ΔelementStylingMap', moduleName: CORE};
|
||||
|
||||
static elementStyleProp: o.ExternalReference = {name: 'ɵelementStyleProp', moduleName: CORE};
|
||||
static elementStyleProp: o.ExternalReference = {name: 'ΔelementStyleProp', moduleName: CORE};
|
||||
|
||||
static elementStylingApply:
|
||||
o.ExternalReference = {name: 'ɵelementStylingApply', moduleName: CORE};
|
||||
o.ExternalReference = {name: 'ΔelementStylingApply', moduleName: CORE};
|
||||
|
||||
static elementHostAttrs: o.ExternalReference = {name: 'ɵelementHostAttrs', moduleName: CORE};
|
||||
static elementHostAttrs: o.ExternalReference = {name: 'ΔelementHostAttrs', moduleName: CORE};
|
||||
|
||||
static elementHostStyling: o.ExternalReference = {name: 'ɵelementHostStyling', moduleName: CORE};
|
||||
static elementHostStyling: o.ExternalReference = {name: 'ΔelementHostStyling', moduleName: CORE};
|
||||
|
||||
static elementHostStylingMap:
|
||||
o.ExternalReference = {name: 'ɵelementHostStylingMap', moduleName: CORE};
|
||||
o.ExternalReference = {name: 'ΔelementHostStylingMap', moduleName: CORE};
|
||||
|
||||
static elementHostStyleProp:
|
||||
o.ExternalReference = {name: 'ɵelementHostStyleProp', moduleName: CORE};
|
||||
o.ExternalReference = {name: 'ΔelementHostStyleProp', moduleName: CORE};
|
||||
|
||||
static elementHostClassProp:
|
||||
o.ExternalReference = {name: 'ɵelementHostClassProp', moduleName: CORE};
|
||||
o.ExternalReference = {name: 'ΔelementHostClassProp', moduleName: CORE};
|
||||
|
||||
static elementHostStylingApply:
|
||||
o.ExternalReference = {name: 'ɵelementHostStylingApply', moduleName: CORE};
|
||||
o.ExternalReference = {name: 'ΔelementHostStylingApply', moduleName: CORE};
|
||||
|
||||
static containerCreate: o.ExternalReference = {name: 'ɵcontainer', moduleName: CORE};
|
||||
static containerCreate: o.ExternalReference = {name: 'Δcontainer', moduleName: CORE};
|
||||
|
||||
static nextContext: o.ExternalReference = {name: 'ɵnextContext', moduleName: CORE};
|
||||
static nextContext: o.ExternalReference = {name: 'ΔnextContext', moduleName: CORE};
|
||||
|
||||
static templateCreate: o.ExternalReference = {name: 'ɵtemplate', moduleName: CORE};
|
||||
static templateCreate: o.ExternalReference = {name: 'Δtemplate', moduleName: CORE};
|
||||
|
||||
static text: o.ExternalReference = {name: 'ɵtext', moduleName: CORE};
|
||||
static text: o.ExternalReference = {name: 'Δtext', moduleName: CORE};
|
||||
|
||||
static textBinding: o.ExternalReference = {name: 'ɵtextBinding', moduleName: CORE};
|
||||
static textBinding: o.ExternalReference = {name: 'ΔtextBinding', moduleName: CORE};
|
||||
|
||||
static bind: o.ExternalReference = {name: 'ɵbind', moduleName: CORE};
|
||||
static bind: o.ExternalReference = {name: 'Δbind', moduleName: CORE};
|
||||
|
||||
static enableBindings: o.ExternalReference = {name: 'ɵenableBindings', moduleName: CORE};
|
||||
static enableBindings: o.ExternalReference = {name: 'ΔenableBindings', moduleName: CORE};
|
||||
|
||||
static disableBindings: o.ExternalReference = {name: 'ɵdisableBindings', moduleName: CORE};
|
||||
static disableBindings: o.ExternalReference = {name: 'ΔdisableBindings', moduleName: CORE};
|
||||
|
||||
static allocHostVars: o.ExternalReference = {name: 'ɵallocHostVars', moduleName: CORE};
|
||||
static allocHostVars: o.ExternalReference = {name: 'ΔallocHostVars', moduleName: CORE};
|
||||
|
||||
static getCurrentView: o.ExternalReference = {name: 'ɵgetCurrentView', moduleName: CORE};
|
||||
static getCurrentView: o.ExternalReference = {name: 'ΔgetCurrentView', moduleName: CORE};
|
||||
|
||||
static restoreView: o.ExternalReference = {name: 'ɵrestoreView', moduleName: CORE};
|
||||
static restoreView: o.ExternalReference = {name: 'ΔrestoreView', moduleName: CORE};
|
||||
|
||||
static interpolation1: o.ExternalReference = {name: 'ɵinterpolation1', moduleName: CORE};
|
||||
static interpolation2: o.ExternalReference = {name: 'ɵinterpolation2', moduleName: CORE};
|
||||
static interpolation3: o.ExternalReference = {name: 'ɵinterpolation3', moduleName: CORE};
|
||||
static interpolation4: o.ExternalReference = {name: 'ɵinterpolation4', moduleName: CORE};
|
||||
static interpolation5: o.ExternalReference = {name: 'ɵinterpolation5', moduleName: CORE};
|
||||
static interpolation6: o.ExternalReference = {name: 'ɵinterpolation6', moduleName: CORE};
|
||||
static interpolation7: o.ExternalReference = {name: 'ɵinterpolation7', moduleName: CORE};
|
||||
static interpolation8: o.ExternalReference = {name: 'ɵinterpolation8', moduleName: CORE};
|
||||
static interpolationV: o.ExternalReference = {name: 'ɵinterpolationV', moduleName: CORE};
|
||||
static interpolation1: o.ExternalReference = {name: 'Δinterpolation1', moduleName: CORE};
|
||||
static interpolation2: o.ExternalReference = {name: 'Δinterpolation2', moduleName: CORE};
|
||||
static interpolation3: o.ExternalReference = {name: 'Δinterpolation3', moduleName: CORE};
|
||||
static interpolation4: o.ExternalReference = {name: 'Δinterpolation4', moduleName: CORE};
|
||||
static interpolation5: o.ExternalReference = {name: 'Δinterpolation5', moduleName: CORE};
|
||||
static interpolation6: o.ExternalReference = {name: 'Δinterpolation6', moduleName: CORE};
|
||||
static interpolation7: o.ExternalReference = {name: 'Δinterpolation7', moduleName: CORE};
|
||||
static interpolation8: o.ExternalReference = {name: 'Δinterpolation8', moduleName: CORE};
|
||||
static interpolationV: o.ExternalReference = {name: 'ΔinterpolationV', moduleName: CORE};
|
||||
|
||||
static pureFunction0: o.ExternalReference = {name: 'ɵpureFunction0', moduleName: CORE};
|
||||
static pureFunction1: o.ExternalReference = {name: 'ɵpureFunction1', moduleName: CORE};
|
||||
static pureFunction2: o.ExternalReference = {name: 'ɵpureFunction2', moduleName: CORE};
|
||||
static pureFunction3: o.ExternalReference = {name: 'ɵpureFunction3', moduleName: CORE};
|
||||
static pureFunction4: o.ExternalReference = {name: 'ɵpureFunction4', moduleName: CORE};
|
||||
static pureFunction5: o.ExternalReference = {name: 'ɵpureFunction5', moduleName: CORE};
|
||||
static pureFunction6: o.ExternalReference = {name: 'ɵpureFunction6', moduleName: CORE};
|
||||
static pureFunction7: o.ExternalReference = {name: 'ɵpureFunction7', moduleName: CORE};
|
||||
static pureFunction8: o.ExternalReference = {name: 'ɵpureFunction8', moduleName: CORE};
|
||||
static pureFunctionV: o.ExternalReference = {name: 'ɵpureFunctionV', moduleName: CORE};
|
||||
static pureFunction0: o.ExternalReference = {name: 'ΔpureFunction0', moduleName: CORE};
|
||||
static pureFunction1: o.ExternalReference = {name: 'ΔpureFunction1', moduleName: CORE};
|
||||
static pureFunction2: o.ExternalReference = {name: 'ΔpureFunction2', moduleName: CORE};
|
||||
static pureFunction3: o.ExternalReference = {name: 'ΔpureFunction3', moduleName: CORE};
|
||||
static pureFunction4: o.ExternalReference = {name: 'ΔpureFunction4', moduleName: CORE};
|
||||
static pureFunction5: o.ExternalReference = {name: 'ΔpureFunction5', moduleName: CORE};
|
||||
static pureFunction6: o.ExternalReference = {name: 'ΔpureFunction6', moduleName: CORE};
|
||||
static pureFunction7: o.ExternalReference = {name: 'ΔpureFunction7', moduleName: CORE};
|
||||
static pureFunction8: o.ExternalReference = {name: 'ΔpureFunction8', moduleName: CORE};
|
||||
static pureFunctionV: o.ExternalReference = {name: 'ΔpureFunctionV', moduleName: CORE};
|
||||
|
||||
static pipeBind1: o.ExternalReference = {name: 'ɵpipeBind1', moduleName: CORE};
|
||||
static pipeBind2: o.ExternalReference = {name: 'ɵpipeBind2', moduleName: CORE};
|
||||
static pipeBind3: o.ExternalReference = {name: 'ɵpipeBind3', moduleName: CORE};
|
||||
static pipeBind4: o.ExternalReference = {name: 'ɵpipeBind4', moduleName: CORE};
|
||||
static pipeBindV: o.ExternalReference = {name: 'ɵpipeBindV', moduleName: CORE};
|
||||
static pipeBind1: o.ExternalReference = {name: 'ΔpipeBind1', moduleName: CORE};
|
||||
static pipeBind2: o.ExternalReference = {name: 'ΔpipeBind2', moduleName: CORE};
|
||||
static pipeBind3: o.ExternalReference = {name: 'ΔpipeBind3', moduleName: CORE};
|
||||
static pipeBind4: o.ExternalReference = {name: 'ΔpipeBind4', moduleName: CORE};
|
||||
static pipeBindV: o.ExternalReference = {name: 'ΔpipeBindV', moduleName: CORE};
|
||||
|
||||
static i18n: o.ExternalReference = {name: 'ɵi18n', moduleName: CORE};
|
||||
static i18nAttributes: o.ExternalReference = {name: 'ɵi18nAttributes', moduleName: CORE};
|
||||
static i18nExp: o.ExternalReference = {name: 'ɵi18nExp', moduleName: CORE};
|
||||
static i18nStart: o.ExternalReference = {name: 'ɵi18nStart', moduleName: CORE};
|
||||
static i18nEnd: o.ExternalReference = {name: 'ɵi18nEnd', moduleName: CORE};
|
||||
static i18nApply: o.ExternalReference = {name: 'ɵi18nApply', moduleName: CORE};
|
||||
static i18nPostprocess: o.ExternalReference = {name: 'ɵi18nPostprocess', moduleName: CORE};
|
||||
static i18n: o.ExternalReference = {name: 'Δi18n', moduleName: CORE};
|
||||
static i18nAttributes: o.ExternalReference = {name: 'Δi18nAttributes', moduleName: CORE};
|
||||
static i18nExp: o.ExternalReference = {name: 'Δi18nExp', moduleName: CORE};
|
||||
static i18nStart: o.ExternalReference = {name: 'Δi18nStart', moduleName: CORE};
|
||||
static i18nEnd: o.ExternalReference = {name: 'Δi18nEnd', moduleName: CORE};
|
||||
static i18nApply: o.ExternalReference = {name: 'Δi18nApply', moduleName: CORE};
|
||||
static i18nPostprocess: o.ExternalReference = {name: 'Δi18nPostprocess', moduleName: CORE};
|
||||
|
||||
static load: o.ExternalReference = {name: 'ɵload', moduleName: CORE};
|
||||
static load: o.ExternalReference = {name: 'Δload', moduleName: CORE};
|
||||
|
||||
static pipe: o.ExternalReference = {name: 'ɵpipe', moduleName: CORE};
|
||||
static pipe: o.ExternalReference = {name: 'Δpipe', moduleName: CORE};
|
||||
|
||||
static projection: o.ExternalReference = {name: 'ɵprojection', moduleName: CORE};
|
||||
static projectionDef: o.ExternalReference = {name: 'ɵprojectionDef', moduleName: CORE};
|
||||
static projection: o.ExternalReference = {name: 'Δprojection', moduleName: CORE};
|
||||
static projectionDef: o.ExternalReference = {name: 'ΔprojectionDef', moduleName: CORE};
|
||||
|
||||
static reference: o.ExternalReference = {name: 'ɵreference', moduleName: CORE};
|
||||
static reference: o.ExternalReference = {name: 'Δreference', moduleName: CORE};
|
||||
|
||||
static inject: o.ExternalReference = {name: 'inject', moduleName: CORE};
|
||||
static inject: o.ExternalReference = {name: 'Δinject', moduleName: CORE};
|
||||
|
||||
static injectAttribute: o.ExternalReference = {name: 'ɵinjectAttribute', moduleName: CORE};
|
||||
static injectAttribute: o.ExternalReference = {name: 'ΔinjectAttribute', moduleName: CORE};
|
||||
|
||||
static directiveInject: o.ExternalReference = {name: 'ɵdirectiveInject', moduleName: CORE};
|
||||
static directiveInject: o.ExternalReference = {name: 'ΔdirectiveInject', moduleName: CORE};
|
||||
|
||||
static templateRefExtractor:
|
||||
o.ExternalReference = {name: 'ɵtemplateRefExtractor', moduleName: CORE};
|
||||
o.ExternalReference = {name: 'ΔtemplateRefExtractor', moduleName: CORE};
|
||||
|
||||
static resolveWindow: o.ExternalReference = {name: 'ɵresolveWindow', moduleName: CORE};
|
||||
static resolveDocument: o.ExternalReference = {name: 'ɵresolveDocument', moduleName: CORE};
|
||||
static resolveBody: o.ExternalReference = {name: 'ɵresolveBody', moduleName: CORE};
|
||||
static resolveWindow: o.ExternalReference = {name: 'ΔresolveWindow', moduleName: CORE};
|
||||
static resolveDocument: o.ExternalReference = {name: 'ΔresolveDocument', moduleName: CORE};
|
||||
static resolveBody: o.ExternalReference = {name: 'ΔresolveBody', moduleName: CORE};
|
||||
|
||||
static defineBase: o.ExternalReference = {name: 'ɵdefineBase', moduleName: CORE};
|
||||
static defineBase: o.ExternalReference = {name: 'ΔdefineBase', moduleName: CORE};
|
||||
|
||||
static BaseDef: o.ExternalReference = {
|
||||
name: 'ɵBaseDef',
|
||||
name: 'ΔBaseDef',
|
||||
moduleName: CORE,
|
||||
};
|
||||
|
||||
static defineComponent: o.ExternalReference = {name: 'ɵdefineComponent', moduleName: CORE};
|
||||
static defineComponent: o.ExternalReference = {name: 'ΔdefineComponent', moduleName: CORE};
|
||||
|
||||
static setComponentScope: o.ExternalReference = {name: 'ɵsetComponentScope', moduleName: CORE};
|
||||
static setComponentScope: o.ExternalReference = {name: 'ΔsetComponentScope', moduleName: CORE};
|
||||
|
||||
static ComponentDefWithMeta: o.ExternalReference = {
|
||||
name: 'ɵComponentDefWithMeta',
|
||||
name: 'ΔComponentDefWithMeta',
|
||||
moduleName: CORE,
|
||||
};
|
||||
|
||||
static defineDirective: o.ExternalReference = {
|
||||
name: 'ɵdefineDirective',
|
||||
name: 'ΔdefineDirective',
|
||||
moduleName: CORE,
|
||||
};
|
||||
|
||||
static DirectiveDefWithMeta: o.ExternalReference = {
|
||||
name: 'ɵDirectiveDefWithMeta',
|
||||
name: 'ΔDirectiveDefWithMeta',
|
||||
moduleName: CORE,
|
||||
};
|
||||
|
||||
static InjectorDef: o.ExternalReference = {
|
||||
name: 'ɵInjectorDef',
|
||||
name: 'ΔInjectorDef',
|
||||
moduleName: CORE,
|
||||
};
|
||||
|
||||
static defineInjector: o.ExternalReference = {
|
||||
name: 'defineInjector',
|
||||
name: 'ΔdefineInjector',
|
||||
moduleName: CORE,
|
||||
};
|
||||
|
||||
static NgModuleDefWithMeta: o.ExternalReference = {
|
||||
name: 'ɵNgModuleDefWithMeta',
|
||||
name: 'ΔNgModuleDefWithMeta',
|
||||
moduleName: CORE,
|
||||
};
|
||||
|
||||
static defineNgModule: o.ExternalReference = {name: 'ɵdefineNgModule', moduleName: CORE};
|
||||
static setNgModuleScope: o.ExternalReference = {name: 'ɵsetNgModuleScope', moduleName: CORE};
|
||||
static defineNgModule: o.ExternalReference = {name: 'ΔdefineNgModule', moduleName: CORE};
|
||||
static setNgModuleScope: o.ExternalReference = {name: 'ΔsetNgModuleScope', moduleName: CORE};
|
||||
|
||||
static PipeDefWithMeta: o.ExternalReference = {name: 'ɵPipeDefWithMeta', moduleName: CORE};
|
||||
static PipeDefWithMeta: o.ExternalReference = {name: 'ΔPipeDefWithMeta', moduleName: CORE};
|
||||
|
||||
static definePipe: o.ExternalReference = {name: 'ɵdefinePipe', moduleName: CORE};
|
||||
static definePipe: o.ExternalReference = {name: 'ΔdefinePipe', moduleName: CORE};
|
||||
|
||||
static queryRefresh: o.ExternalReference = {name: 'ɵqueryRefresh', moduleName: CORE};
|
||||
static viewQuery: o.ExternalReference = {name: 'ɵviewQuery', moduleName: CORE};
|
||||
static staticViewQuery: o.ExternalReference = {name: 'ɵstaticViewQuery', moduleName: CORE};
|
||||
static staticContentQuery: o.ExternalReference = {name: 'ɵstaticContentQuery', moduleName: CORE};
|
||||
static loadViewQuery: o.ExternalReference = {name: 'ɵloadViewQuery', moduleName: CORE};
|
||||
static contentQuery: o.ExternalReference = {name: 'ɵcontentQuery', moduleName: CORE};
|
||||
static loadContentQuery: o.ExternalReference = {name: 'ɵloadContentQuery', moduleName: CORE};
|
||||
static queryRefresh: o.ExternalReference = {name: 'ΔqueryRefresh', moduleName: CORE};
|
||||
static viewQuery: o.ExternalReference = {name: 'ΔviewQuery', moduleName: CORE};
|
||||
static staticViewQuery: o.ExternalReference = {name: 'ΔstaticViewQuery', moduleName: CORE};
|
||||
static staticContentQuery: o.ExternalReference = {name: 'ΔstaticContentQuery', moduleName: CORE};
|
||||
static loadViewQuery: o.ExternalReference = {name: 'ΔloadViewQuery', moduleName: CORE};
|
||||
static contentQuery: o.ExternalReference = {name: 'ΔcontentQuery', moduleName: CORE};
|
||||
static loadContentQuery: o.ExternalReference = {name: 'ΔloadContentQuery', moduleName: CORE};
|
||||
|
||||
static NgOnChangesFeature: o.ExternalReference = {name: 'ɵNgOnChangesFeature', moduleName: CORE};
|
||||
static NgOnChangesFeature: o.ExternalReference = {name: 'ΔNgOnChangesFeature', moduleName: CORE};
|
||||
|
||||
static InheritDefinitionFeature:
|
||||
o.ExternalReference = {name: 'ɵInheritDefinitionFeature', moduleName: CORE};
|
||||
o.ExternalReference = {name: 'ΔInheritDefinitionFeature', moduleName: CORE};
|
||||
|
||||
static ProvidersFeature: o.ExternalReference = {name: 'ɵProvidersFeature', moduleName: CORE};
|
||||
static ProvidersFeature: o.ExternalReference = {name: 'ΔProvidersFeature', moduleName: CORE};
|
||||
|
||||
static listener: o.ExternalReference = {name: 'ɵlistener', moduleName: CORE};
|
||||
static listener: o.ExternalReference = {name: 'Δlistener', moduleName: CORE};
|
||||
|
||||
static getFactoryOf: o.ExternalReference = {
|
||||
name: 'ɵgetFactoryOf',
|
||||
name: 'ΔgetFactoryOf',
|
||||
moduleName: CORE,
|
||||
};
|
||||
|
||||
static getInheritedFactory: o.ExternalReference = {
|
||||
name: 'ɵgetInheritedFactory',
|
||||
name: 'ΔgetInheritedFactory',
|
||||
moduleName: CORE,
|
||||
};
|
||||
|
||||
// sanitization-related functions
|
||||
static sanitizeHtml: o.ExternalReference = {name: 'ɵsanitizeHtml', moduleName: CORE};
|
||||
static sanitizeStyle: o.ExternalReference = {name: 'ɵsanitizeStyle', moduleName: CORE};
|
||||
static sanitizeHtml: o.ExternalReference = {name: 'ΔsanitizeHtml', moduleName: CORE};
|
||||
static sanitizeStyle: o.ExternalReference = {name: 'ΔsanitizeStyle', moduleName: CORE};
|
||||
static defaultStyleSanitizer:
|
||||
o.ExternalReference = {name: 'ɵdefaultStyleSanitizer', moduleName: CORE};
|
||||
o.ExternalReference = {name: 'ΔdefaultStyleSanitizer', moduleName: CORE};
|
||||
static sanitizeResourceUrl:
|
||||
o.ExternalReference = {name: 'ɵsanitizeResourceUrl', moduleName: CORE};
|
||||
static sanitizeScript: o.ExternalReference = {name: 'ɵsanitizeScript', moduleName: CORE};
|
||||
static sanitizeUrl: o.ExternalReference = {name: 'ɵsanitizeUrl', moduleName: CORE};
|
||||
o.ExternalReference = {name: 'ΔsanitizeResourceUrl', moduleName: CORE};
|
||||
static sanitizeScript: o.ExternalReference = {name: 'ΔsanitizeScript', moduleName: CORE};
|
||||
static sanitizeUrl: o.ExternalReference = {name: 'ΔsanitizeUrl', moduleName: CORE};
|
||||
static sanitizeUrlOrResourceUrl:
|
||||
o.ExternalReference = {name: 'ɵsanitizeUrlOrResourceUrl', moduleName: CORE};
|
||||
o.ExternalReference = {name: 'ΔsanitizeUrlOrResourceUrl', moduleName: CORE};
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ export function compileNgModule(meta: R3NgModuleMetadata): R3NgModuleDef {
|
||||
}
|
||||
|
||||
// If requested to emit scope information inline, pass the declarations, imports and exports to
|
||||
// the `defineNgModule` call. The JIT compilation uses this.
|
||||
// the `ΔdefineNgModule` call. The JIT compilation uses this.
|
||||
if (emitInline) {
|
||||
if (declarations.length) {
|
||||
definitionMap.declarations = refsToArray(declarations, containsForwardDecls);
|
||||
@ -117,7 +117,7 @@ export function compileNgModule(meta: R3NgModuleMetadata): R3NgModuleDef {
|
||||
}
|
||||
}
|
||||
|
||||
// If not emitting inline, the scope information is not passed into `defineNgModule` as it would
|
||||
// If not emitting inline, the scope information is not passed into `ΔdefineNgModule` as it would
|
||||
// prevent tree-shaking of the declarations, imports and exports references.
|
||||
else {
|
||||
const setNgModuleScopeCall = generateSetNgModuleScopeCall(meta);
|
||||
@ -141,7 +141,7 @@ export function compileNgModule(meta: R3NgModuleMetadata): R3NgModuleDef {
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a function call to `setNgModuleScope` with all necessary information so that the
|
||||
* Generates a function call to `ΔsetNgModuleScope` with all necessary information so that the
|
||||
* transitive module scope can be computed during runtime in JIT mode. This call is marked pure
|
||||
* such that the references to declarations, imports and exports may be elided causing these
|
||||
* symbols to become tree-shakeable.
|
||||
|
@ -840,7 +840,7 @@ export class TemplateDefinitionBuilder implements t.Visitor<void>, LocalResolver
|
||||
return trimTrailingNulls(parameters);
|
||||
});
|
||||
|
||||
// handle property bindings e.g. ɵelementProperty(1, 'ngForOf', ɵbind(ctx.items));
|
||||
// handle property bindings e.g. ΔelementProperty(1, 'ngForOf', Δbind(ctx.items));
|
||||
const context = o.variable(CONTEXT_NAME);
|
||||
this.templatePropertyBindings(template, templateIndex, context, template.templateAttrs);
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {defineInjectable} from '../../di/interface/defs';
|
||||
import {ΔdefineInjectable} from '../../di/interface/defs';
|
||||
import {StaticProvider} from '../../di/interface/provider';
|
||||
import {Optional, SkipSelf} from '../../di/metadata';
|
||||
import {DefaultIterableDifferFactory} from '../differs/default_iterable_differ';
|
||||
@ -143,7 +143,7 @@ export interface IterableDifferFactory {
|
||||
*/
|
||||
export class IterableDiffers {
|
||||
/** @nocollapse */
|
||||
static ngInjectableDef = defineInjectable({
|
||||
static ngInjectableDef = ΔdefineInjectable({
|
||||
providedIn: 'root',
|
||||
factory: () => new IterableDiffers([new DefaultIterableDifferFactory()])
|
||||
});
|
||||
|
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Optional, SkipSelf, StaticProvider, defineInjectable} from '../../di';
|
||||
import {Optional, SkipSelf, StaticProvider, ΔdefineInjectable} from '../../di';
|
||||
import {DefaultKeyValueDifferFactory} from './default_keyvalue_differ';
|
||||
|
||||
|
||||
@ -118,7 +118,7 @@ export interface KeyValueDifferFactory {
|
||||
*/
|
||||
export class KeyValueDiffers {
|
||||
/** @nocollapse */
|
||||
static ngInjectableDef = defineInjectable({
|
||||
static ngInjectableDef = ΔdefineInjectable({
|
||||
providedIn: 'root',
|
||||
factory: () => new KeyValueDiffers([new DefaultKeyValueDifferFactory()])
|
||||
});
|
||||
|
@ -8,4 +8,4 @@
|
||||
|
||||
export {CodegenComponentFactoryResolver as ɵCodegenComponentFactoryResolver} from './linker/component_factory_resolver';
|
||||
export {registerModuleFactory as ɵregisterModuleFactory} from './linker/ng_module_factory_loader';
|
||||
export {ArgumentType as ɵArgumentType, BindingFlags as ɵBindingFlags, DepFlags as ɵDepFlags, EMPTY_ARRAY as ɵEMPTY_ARRAY, EMPTY_MAP as ɵEMPTY_MAP, NodeFlags as ɵNodeFlags, QueryBindingType as ɵQueryBindingType, QueryValueType as ɵQueryValueType, ViewDefinition as ɵViewDefinition, ViewFlags as ɵViewFlags, anchorDef as ɵand, createComponentFactory as ɵccf, createNgModuleFactory as ɵcmf, createRendererType2 as ɵcrt, directiveDef as ɵdid, elementDef as ɵeld, elementEventFullName as ɵelementEventFullName, getComponentViewDefinitionFactory as ɵgetComponentViewDefinitionFactory, inlineInterpolate as ɵinlineInterpolate, interpolate as ɵinterpolate, moduleDef as ɵmod, moduleProvideDef as ɵmpd, ngContentDef as ɵncd, nodeValue as ɵnov, pipeDef as ɵpid, providerDef as ɵprd, pureArrayDef as ɵpad, pureObjectDef as ɵpod, purePipeDef as ɵppd, queryDef as ɵqud, textDef as ɵted, unwrapValue as ɵunv, viewDef as ɵvid} from './view/index';
|
||||
export {ArgumentType as ɵArgumentType, BindingFlags as ɵBindingFlags, DepFlags as ɵDepFlags, EMPTY_ARRAY as ɵEMPTY_ARRAY, EMPTY_MAP as ɵEMPTY_MAP, NodeFlags as ɵNodeFlags, QueryBindingType as ɵQueryBindingType, QueryValueType as ɵQueryValueType, ViewDefinition as ɵViewDefinition, ViewFlags as ɵViewFlags, anchorDef as ɵand, createComponentFactory as ɵccf, createNgModuleFactory as ɵcmf, createRendererType2 as ɵcrt, directiveDef as ɵdid, elementDef as ɵeld, getComponentViewDefinitionFactory as ɵgetComponentViewDefinitionFactory, inlineInterpolate as ɵinlineInterpolate, interpolate as ɵinterpolate, moduleDef as ɵmod, moduleProvideDef as ɵmpd, ngContentDef as ɵncd, nodeValue as ɵnov, pipeDef as ɵpid, providerDef as ɵprd, pureArrayDef as ɵpad, pureObjectDef as ɵpod, purePipeDef as ɵppd, queryDef as ɵqud, textDef as ɵted, unwrapValue as ɵunv, viewDef as ɵvid} from './view/index';
|
||||
|
@ -13,8 +13,8 @@ export {devModeEqual as ɵdevModeEqual} from './change_detection/change_detectio
|
||||
export {isListLikeIterable as ɵisListLikeIterable} from './change_detection/change_detection_util';
|
||||
export {ChangeDetectorStatus as ɵChangeDetectorStatus, isDefaultChangeDetectionStrategy as ɵisDefaultChangeDetectionStrategy} from './change_detection/constants';
|
||||
export {Console as ɵConsole} from './console';
|
||||
export {inject as ɵinject, setCurrentInjector as ɵsetCurrentInjector} from './di/injector_compatibility';
|
||||
export {InjectableDef as ɵInjectableDef, InjectorDef as ɵInjectorDef, getInjectableDef as ɵgetInjectableDef} from './di/interface/defs';
|
||||
export {inject, setCurrentInjector as ɵsetCurrentInjector, Δinject} from './di/injector_compatibility';
|
||||
export {getInjectableDef as ɵgetInjectableDef, ΔInjectableDef as ΔInjectableDef, ΔInjectorDef} from './di/interface/defs';
|
||||
export {APP_ROOT as ɵAPP_ROOT} from './di/scope';
|
||||
export {ivyEnabled as ɵivyEnabled} from './ivy_switch';
|
||||
export {ComponentFactory as ɵComponentFactory} from './linker/component_factory';
|
||||
@ -27,6 +27,7 @@ export {_sanitizeHtml as ɵ_sanitizeHtml} from './sanitization/html_sanitizer';
|
||||
export {_sanitizeStyle as ɵ_sanitizeStyle} from './sanitization/style_sanitizer';
|
||||
export {_sanitizeUrl as ɵ_sanitizeUrl} from './sanitization/url_sanitizer';
|
||||
export {global as ɵglobal} from './util/global';
|
||||
|
||||
export {looseIdentical as ɵlooseIdentical,} from './util/comparison';
|
||||
export {stringify as ɵstringify} from './util/stringify';
|
||||
export {makeDecorator as ɵmakeDecorator} from './util/decorators';
|
||||
|
@ -8,11 +8,11 @@
|
||||
|
||||
// clang-format off
|
||||
export {
|
||||
defineBase as ɵdefineBase,
|
||||
defineComponent as ɵdefineComponent,
|
||||
defineDirective as ɵdefineDirective,
|
||||
definePipe as ɵdefinePipe,
|
||||
defineNgModule as ɵdefineNgModule,
|
||||
ΔdefineBase,
|
||||
ΔdefineComponent,
|
||||
ΔdefineDirective,
|
||||
ΔdefinePipe,
|
||||
ΔdefineNgModule,
|
||||
detectChanges as ɵdetectChanges,
|
||||
renderComponent as ɵrenderComponent,
|
||||
AttributeMarker as ɵAttributeMarker,
|
||||
@ -21,16 +21,16 @@ export {
|
||||
ComponentRef as ɵRender3ComponentRef,
|
||||
DirectiveType as ɵDirectiveType,
|
||||
RenderFlags as ɵRenderFlags,
|
||||
directiveInject as ɵdirectiveInject,
|
||||
injectAttribute as ɵinjectAttribute,
|
||||
getFactoryOf as ɵgetFactoryOf,
|
||||
getInheritedFactory as ɵgetInheritedFactory,
|
||||
setComponentScope as ɵsetComponentScope,
|
||||
setNgModuleScope as ɵsetNgModuleScope,
|
||||
templateRefExtractor as ɵtemplateRefExtractor,
|
||||
ProvidersFeature as ɵProvidersFeature,
|
||||
InheritDefinitionFeature as ɵInheritDefinitionFeature,
|
||||
NgOnChangesFeature as ɵNgOnChangesFeature,
|
||||
ΔdirectiveInject,
|
||||
ΔinjectAttribute,
|
||||
ΔgetFactoryOf,
|
||||
ΔgetInheritedFactory,
|
||||
ΔsetComponentScope,
|
||||
ΔsetNgModuleScope,
|
||||
ΔtemplateRefExtractor,
|
||||
ΔProvidersFeature,
|
||||
ΔInheritDefinitionFeature,
|
||||
ΔNgOnChangesFeature,
|
||||
LifecycleHooksFeature as ɵLifecycleHooksFeature,
|
||||
NgModuleType as ɵNgModuleType,
|
||||
NgModuleRef as ɵRender3NgModuleRef,
|
||||
@ -38,106 +38,106 @@ export {
|
||||
markDirty as ɵmarkDirty,
|
||||
NgModuleFactory as ɵNgModuleFactory,
|
||||
NO_CHANGE as ɵNO_CHANGE,
|
||||
container as ɵcontainer,
|
||||
nextContext as ɵnextContext,
|
||||
elementStart as ɵelementStart,
|
||||
namespaceHTML as ɵnamespaceHTML,
|
||||
namespaceMathML as ɵnamespaceMathML,
|
||||
namespaceSVG as ɵnamespaceSVG,
|
||||
element as ɵelement,
|
||||
listener as ɵlistener,
|
||||
text as ɵtext,
|
||||
embeddedViewStart as ɵembeddedViewStart,
|
||||
projection as ɵprojection,
|
||||
bind as ɵbind,
|
||||
interpolation1 as ɵinterpolation1,
|
||||
interpolation2 as ɵinterpolation2,
|
||||
interpolation3 as ɵinterpolation3,
|
||||
interpolation4 as ɵinterpolation4,
|
||||
interpolation5 as ɵinterpolation5,
|
||||
interpolation6 as ɵinterpolation6,
|
||||
interpolation7 as ɵinterpolation7,
|
||||
interpolation8 as ɵinterpolation8,
|
||||
interpolationV as ɵinterpolationV,
|
||||
pipeBind1 as ɵpipeBind1,
|
||||
pipeBind2 as ɵpipeBind2,
|
||||
pipeBind3 as ɵpipeBind3,
|
||||
pipeBind4 as ɵpipeBind4,
|
||||
pipeBindV as ɵpipeBindV,
|
||||
pureFunction0 as ɵpureFunction0,
|
||||
pureFunction1 as ɵpureFunction1,
|
||||
pureFunction2 as ɵpureFunction2,
|
||||
pureFunction3 as ɵpureFunction3,
|
||||
pureFunction4 as ɵpureFunction4,
|
||||
pureFunction5 as ɵpureFunction5,
|
||||
pureFunction6 as ɵpureFunction6,
|
||||
pureFunction7 as ɵpureFunction7,
|
||||
pureFunction8 as ɵpureFunction8,
|
||||
pureFunctionV as ɵpureFunctionV,
|
||||
getCurrentView as ɵgetCurrentView,
|
||||
Δcontainer,
|
||||
ΔnextContext,
|
||||
ΔelementStart,
|
||||
ΔnamespaceHTML,
|
||||
ΔnamespaceMathML,
|
||||
ΔnamespaceSVG,
|
||||
Δelement,
|
||||
Δlistener,
|
||||
Δtext,
|
||||
ΔembeddedViewStart,
|
||||
Δprojection,
|
||||
Δbind,
|
||||
Δinterpolation1,
|
||||
Δinterpolation2,
|
||||
Δinterpolation3,
|
||||
Δinterpolation4,
|
||||
Δinterpolation5,
|
||||
Δinterpolation6,
|
||||
Δinterpolation7,
|
||||
Δinterpolation8,
|
||||
ΔinterpolationV,
|
||||
ΔpipeBind1,
|
||||
ΔpipeBind2,
|
||||
ΔpipeBind3,
|
||||
ΔpipeBind4,
|
||||
ΔpipeBindV,
|
||||
ΔpureFunction0,
|
||||
ΔpureFunction1,
|
||||
ΔpureFunction2,
|
||||
ΔpureFunction3,
|
||||
ΔpureFunction4,
|
||||
ΔpureFunction5,
|
||||
ΔpureFunction6,
|
||||
ΔpureFunction7,
|
||||
ΔpureFunction8,
|
||||
ΔpureFunctionV,
|
||||
ΔgetCurrentView,
|
||||
getDirectives as ɵgetDirectives,
|
||||
getHostElement as ɵgetHostElement,
|
||||
restoreView as ɵrestoreView,
|
||||
containerRefreshStart as ɵcontainerRefreshStart,
|
||||
containerRefreshEnd as ɵcontainerRefreshEnd,
|
||||
queryRefresh as ɵqueryRefresh,
|
||||
viewQuery as ɵviewQuery,
|
||||
staticViewQuery as ɵstaticViewQuery,
|
||||
staticContentQuery as ɵstaticContentQuery,
|
||||
loadViewQuery as ɵloadViewQuery,
|
||||
contentQuery as ɵcontentQuery,
|
||||
loadContentQuery as ɵloadContentQuery,
|
||||
elementEnd as ɵelementEnd,
|
||||
elementProperty as ɵelementProperty,
|
||||
componentHostSyntheticProperty as ɵcomponentHostSyntheticProperty,
|
||||
componentHostSyntheticListener as ɵcomponentHostSyntheticListener,
|
||||
projectionDef as ɵprojectionDef,
|
||||
reference as ɵreference,
|
||||
enableBindings as ɵenableBindings,
|
||||
disableBindings as ɵdisableBindings,
|
||||
allocHostVars as ɵallocHostVars,
|
||||
elementAttribute as ɵelementAttribute,
|
||||
elementContainerStart as ɵelementContainerStart,
|
||||
elementContainerEnd as ɵelementContainerEnd,
|
||||
elementStyling as ɵelementStyling,
|
||||
elementStylingMap as ɵelementStylingMap,
|
||||
elementStyleProp as ɵelementStyleProp,
|
||||
elementStylingApply as ɵelementStylingApply,
|
||||
elementClassProp as ɵelementClassProp,
|
||||
ΔrestoreView,
|
||||
ΔcontainerRefreshStart,
|
||||
ΔcontainerRefreshEnd,
|
||||
ΔqueryRefresh,
|
||||
ΔviewQuery,
|
||||
ΔstaticViewQuery,
|
||||
ΔstaticContentQuery,
|
||||
ΔloadViewQuery,
|
||||
ΔcontentQuery,
|
||||
ΔloadContentQuery,
|
||||
ΔelementEnd,
|
||||
ΔelementProperty,
|
||||
ΔcomponentHostSyntheticProperty,
|
||||
ΔcomponentHostSyntheticListener,
|
||||
ΔprojectionDef,
|
||||
Δreference,
|
||||
ΔenableBindings,
|
||||
ΔdisableBindings,
|
||||
ΔallocHostVars,
|
||||
ΔelementAttribute,
|
||||
ΔelementContainerStart,
|
||||
ΔelementContainerEnd,
|
||||
ΔelementStyling,
|
||||
ΔelementStylingMap,
|
||||
ΔelementStyleProp,
|
||||
ΔelementStylingApply,
|
||||
ΔelementClassProp,
|
||||
|
||||
elementHostAttrs as ɵelementHostAttrs,
|
||||
elementHostStyling as ɵelementHostStyling,
|
||||
elementHostStylingMap as ɵelementHostStylingMap,
|
||||
elementHostStyleProp as ɵelementHostStyleProp,
|
||||
elementHostClassProp as ɵelementHostClassProp,
|
||||
elementHostStylingApply as ɵelementHostStylingApply,
|
||||
ΔelementHostAttrs,
|
||||
ΔelementHostStyling,
|
||||
ΔelementHostStylingMap,
|
||||
ΔelementHostStyleProp,
|
||||
ΔelementHostClassProp,
|
||||
ΔelementHostStylingApply,
|
||||
|
||||
select as ɵselect,
|
||||
textBinding as ɵtextBinding,
|
||||
template as ɵtemplate,
|
||||
embeddedViewEnd as ɵembeddedViewEnd,
|
||||
Δselect,
|
||||
ΔtextBinding,
|
||||
Δtemplate,
|
||||
ΔembeddedViewEnd,
|
||||
store as ɵstore,
|
||||
load as ɵload,
|
||||
pipe as ɵpipe,
|
||||
BaseDef as ɵBaseDef,
|
||||
Δload,
|
||||
Δpipe,
|
||||
ΔBaseDef,
|
||||
ComponentDef as ɵComponentDef,
|
||||
ComponentDefWithMeta as ɵComponentDefWithMeta,
|
||||
ΔComponentDefWithMeta,
|
||||
DirectiveDef as ɵDirectiveDef,
|
||||
DirectiveDefWithMeta as ɵDirectiveDefWithMeta,
|
||||
ΔDirectiveDefWithMeta,
|
||||
PipeDef as ɵPipeDef,
|
||||
PipeDefWithMeta as ɵPipeDefWithMeta,
|
||||
ΔPipeDefWithMeta,
|
||||
whenRendered as ɵwhenRendered,
|
||||
i18n as ɵi18n,
|
||||
i18nAttributes as ɵi18nAttributes,
|
||||
i18nExp as ɵi18nExp,
|
||||
i18nStart as ɵi18nStart,
|
||||
i18nEnd as ɵi18nEnd,
|
||||
i18nApply as ɵi18nApply,
|
||||
i18nPostprocess as ɵi18nPostprocess,
|
||||
Δi18n,
|
||||
Δi18nAttributes,
|
||||
Δi18nExp,
|
||||
Δi18nStart,
|
||||
Δi18nEnd,
|
||||
Δi18nApply,
|
||||
Δi18nPostprocess,
|
||||
setClassMetadata as ɵsetClassMetadata,
|
||||
resolveWindow as ɵresolveWindow,
|
||||
resolveDocument as ɵresolveDocument,
|
||||
resolveBody as ɵresolveBody,
|
||||
ΔresolveWindow,
|
||||
ΔresolveDocument,
|
||||
ΔresolveBody,
|
||||
} from './render3/index';
|
||||
|
||||
|
||||
@ -159,18 +159,18 @@ export {
|
||||
|
||||
export {
|
||||
NgModuleDef as ɵNgModuleDef,
|
||||
NgModuleDefWithMeta as ɵNgModuleDefWithMeta,
|
||||
ΔNgModuleDefWithMeta,
|
||||
NgModuleTransitiveScopes as ɵNgModuleTransitiveScopes,
|
||||
} from './metadata/ng_module';
|
||||
|
||||
export {
|
||||
sanitizeHtml as ɵsanitizeHtml,
|
||||
sanitizeStyle as ɵsanitizeStyle,
|
||||
defaultStyleSanitizer as ɵdefaultStyleSanitizer,
|
||||
sanitizeScript as ɵsanitizeScript,
|
||||
sanitizeUrl as ɵsanitizeUrl,
|
||||
sanitizeResourceUrl as ɵsanitizeResourceUrl,
|
||||
sanitizeUrlOrResourceUrl as ɵsanitizeUrlOrResourceUrl,
|
||||
ΔsanitizeHtml,
|
||||
ΔsanitizeStyle,
|
||||
ΔdefaultStyleSanitizer,
|
||||
ΔsanitizeScript,
|
||||
ΔsanitizeUrl,
|
||||
ΔsanitizeResourceUrl,
|
||||
ΔsanitizeUrlOrResourceUrl,
|
||||
} from './sanitization/sanitization';
|
||||
|
||||
export {
|
||||
|
@ -14,11 +14,11 @@
|
||||
|
||||
export * from './metadata';
|
||||
export {InjectFlags} from './interface/injector';
|
||||
export {defineInjectable, defineInjector, InjectableType, InjectorType} from './interface/defs';
|
||||
export {ΔdefineInjectable, defineInjectable, ΔdefineInjector, InjectableType, InjectorType} from './interface/defs';
|
||||
export {forwardRef, resolveForwardRef, ForwardRefFn} from './forward_ref';
|
||||
export {Injectable, InjectableDecorator, InjectableProvider} from './injectable';
|
||||
export {INJECTOR, Injector} from './injector';
|
||||
export {inject} from './injector_compatibility';
|
||||
export {Δinject, inject} from './injector_compatibility';
|
||||
export {ReflectiveInjector} from './reflective_injector';
|
||||
export {StaticProvider, ValueProvider, ConstructorSansProvider, ExistingProvider, FactoryProvider, Provider, TypeProvider, ClassProvider} from './interface/provider';
|
||||
export {ResolvedReflectiveFactory, ResolvedReflectiveProvider} from './reflective_provider';
|
||||
|
@ -8,7 +8,8 @@
|
||||
|
||||
import {Type} from '../interface/type';
|
||||
import {TypeDecorator, makeDecorator} from '../util/decorators';
|
||||
import {InjectableDef, InjectableType, defineInjectable, getInjectableDef} from './interface/defs';
|
||||
|
||||
import {InjectableType, getInjectableDef, ΔInjectableDef, ΔdefineInjectable} from './interface/defs';
|
||||
import {ClassSansProvider, ConstructorSansProvider, ExistingSansProvider, FactorySansProvider, StaticClassSansProvider, ValueSansProvider} from './interface/provider';
|
||||
import {compileInjectable as render3CompileInjectable} from './jit/injectable';
|
||||
import {convertInjectableProviderToFactory} from './util';
|
||||
@ -79,7 +80,7 @@ export const Injectable: InjectableDecorator = makeDecorator(
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface InjectableType<T> extends Type<T> { ngInjectableDef: InjectableDef<T>; }
|
||||
export interface InjectableType<T> extends Type<T> { ngInjectableDef: ΔInjectableDef<T>; }
|
||||
|
||||
/**
|
||||
* Supports @Injectable() in JIT mode for Render2.
|
||||
@ -88,7 +89,7 @@ function render2CompileInjectable(
|
||||
injectableType: InjectableType<any>,
|
||||
options: {providedIn?: Type<any>| 'root' | null} & InjectableProvider): void {
|
||||
if (options && options.providedIn !== undefined && !getInjectableDef(injectableType)) {
|
||||
injectableType.ngInjectableDef = defineInjectable({
|
||||
injectableType.ngInjectableDef = ΔdefineInjectable({
|
||||
providedIn: options.providedIn,
|
||||
factory: convertInjectableProviderToFactory(injectableType, options),
|
||||
});
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
import {Type} from '../interface/type';
|
||||
|
||||
import {defineInjectable} from './interface/defs';
|
||||
import {ΔdefineInjectable} from './interface/defs';
|
||||
|
||||
/**
|
||||
* Creates a token that can be used in a DI Provider.
|
||||
@ -67,7 +67,7 @@ export class InjectionToken<T> {
|
||||
// We are using it to assign `-1` which is used to identify `Injector`.
|
||||
(this as any).__NG_ELEMENT_ID__ = options;
|
||||
} else if (options !== undefined) {
|
||||
this.ngInjectableDef = defineInjectable({
|
||||
this.ngInjectableDef = ΔdefineInjectable({
|
||||
providedIn: options.providedIn || 'root',
|
||||
factory: options.factory,
|
||||
});
|
||||
|
@ -11,8 +11,8 @@ import {getClosureSafeProperty} from '../util/property';
|
||||
import {stringify} from '../util/stringify';
|
||||
import {resolveForwardRef} from './forward_ref';
|
||||
import {InjectionToken} from './injection_token';
|
||||
import {inject} from './injector_compatibility';
|
||||
import {defineInjectable} from './interface/defs';
|
||||
import {Δinject} from './injector_compatibility';
|
||||
import {ΔdefineInjectable} from './interface/defs';
|
||||
import {InjectFlags} from './interface/injector';
|
||||
import {ConstructorProvider, ExistingProvider, FactoryProvider, StaticClassProvider, StaticProvider, ValueProvider} from './interface/provider';
|
||||
import {Inject, Optional, Self, SkipSelf} from './metadata';
|
||||
@ -107,9 +107,9 @@ export abstract class Injector {
|
||||
}
|
||||
|
||||
/** @nocollapse */
|
||||
static ngInjectableDef = defineInjectable({
|
||||
static ngInjectableDef = ΔdefineInjectable({
|
||||
providedIn: 'any' as any,
|
||||
factory: () => inject(INJECTOR),
|
||||
factory: () => Δinject(INJECTOR),
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -11,7 +11,7 @@ import {stringify} from '../util/stringify';
|
||||
|
||||
import {InjectionToken} from './injection_token';
|
||||
import {Injector} from './injector';
|
||||
import {InjectableDef, getInjectableDef} from './interface/defs';
|
||||
import {getInjectableDef, ΔInjectableDef} from './interface/defs';
|
||||
import {InjectFlags} from './interface/injector';
|
||||
import {Inject, Optional, Self, SkipSelf} from './metadata';
|
||||
|
||||
@ -69,7 +69,13 @@ export function injectInjectorOnly<T>(
|
||||
}
|
||||
|
||||
/**
|
||||
* Injects a token from the currently active injector.
|
||||
* Generated instruction: Injects a token from the currently active injector.
|
||||
*
|
||||
* WARNING: This function is meant to be generated by the Ivy compiler, and is not meant for
|
||||
* developer consumption!
|
||||
*
|
||||
* https://github.com/angular/angular/blob/master/packages/core/src/render3/DELTA_INSTRUCTIONS.md
|
||||
*
|
||||
* Must be used in the context of a factory function such as one defined for an
|
||||
* `InjectionToken`. Throws an error if not called from such a context.
|
||||
*
|
||||
@ -91,11 +97,17 @@ export function injectInjectorOnly<T>(
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function inject<T>(token: Type<T>| InjectionToken<T>): T;
|
||||
export function inject<T>(token: Type<T>| InjectionToken<T>, flags?: InjectFlags): T|null;
|
||||
export function inject<T>(token: Type<T>| InjectionToken<T>, flags = InjectFlags.Default): T|null {
|
||||
export function Δinject<T>(token: Type<T>| InjectionToken<T>): T;
|
||||
export function Δinject<T>(token: Type<T>| InjectionToken<T>, flags?: InjectFlags): T|null;
|
||||
export function Δinject<T>(token: Type<T>| InjectionToken<T>, flags = InjectFlags.Default): T|null {
|
||||
return (_injectImplementation || injectInjectorOnly)(token, flags);
|
||||
}
|
||||
/**
|
||||
* @deprecated in v8, delete after v10. This API should be used only be generated code, and that
|
||||
* code should now use Δinject instead.
|
||||
* @publicApi
|
||||
*/
|
||||
export const inject = Δinject;
|
||||
|
||||
/**
|
||||
* Injects `root` tokens in limp mode.
|
||||
@ -106,7 +118,7 @@ export function inject<T>(token: Type<T>| InjectionToken<T>, flags = InjectFlags
|
||||
*/
|
||||
export function injectRootLimpMode<T>(
|
||||
token: Type<T>| InjectionToken<T>, notFoundValue: T | undefined, flags: InjectFlags): T|null {
|
||||
const injectableDef: InjectableDef<T>|null = getInjectableDef(token);
|
||||
const injectableDef: ΔInjectableDef<T>|null = getInjectableDef(token);
|
||||
if (injectableDef && injectableDef.providedIn == 'root') {
|
||||
return injectableDef.value === undefined ? injectableDef.value = injectableDef.factory() :
|
||||
injectableDef.value;
|
||||
@ -142,9 +154,9 @@ export function injectArgs(types: (Type<any>| InjectionToken<any>| any[])[]): an
|
||||
}
|
||||
}
|
||||
|
||||
args.push(inject(type !, flags));
|
||||
args.push(Δinject(type !, flags));
|
||||
} else {
|
||||
args.push(inject(arg));
|
||||
args.push(Δinject(arg));
|
||||
}
|
||||
}
|
||||
return args;
|
||||
|
@ -23,8 +23,10 @@ import {ClassProvider, ConstructorProvider, ExistingProvider, FactoryProvider, S
|
||||
* that the injectable does not belong to any scope.
|
||||
*
|
||||
* NOTE: This is a private type and should not be exported
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface InjectableDef<T> {
|
||||
export interface ΔInjectableDef<T> {
|
||||
/**
|
||||
* Specifies that the given type belongs to a particular injector:
|
||||
* - `InjectorType` such as `NgModule`,
|
||||
@ -55,8 +57,10 @@ export interface InjectableDef<T> {
|
||||
* an import/dependency structure).
|
||||
*
|
||||
* NOTE: This is a private type and should not be exported
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface InjectorDef<T> {
|
||||
export interface ΔInjectorDef<T> {
|
||||
factory: () => T;
|
||||
|
||||
// TODO(alxhub): Narrow down the type here once decorators properly change the return type of the
|
||||
@ -127,15 +131,22 @@ export interface InjectorTypeWithProviders<T> {
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function defineInjectable<T>(opts: {
|
||||
export function ΔdefineInjectable<T>(opts: {
|
||||
providedIn?: Type<any>| 'root' | 'any' | null,
|
||||
factory: () => T,
|
||||
}): never {
|
||||
return ({
|
||||
providedIn: opts.providedIn as any || null, factory: opts.factory, value: undefined,
|
||||
} as InjectableDef<T>) as never;
|
||||
} as ΔInjectableDef<T>) as never;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated in v8, delete after v10. This API should be used only be generated code, and that
|
||||
* code should now use ΔdefineInjectable instead.
|
||||
* @publicApi
|
||||
*/
|
||||
export const defineInjectable = ΔdefineInjectable;
|
||||
|
||||
/**
|
||||
* Construct an `InjectorDef` which configures an injector.
|
||||
*
|
||||
@ -156,11 +167,11 @@ export function defineInjectable<T>(opts: {
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function defineInjector(options: {factory: () => any, providers?: any[], imports?: any[]}):
|
||||
export function ΔdefineInjector(options: {factory: () => any, providers?: any[], imports?: any[]}):
|
||||
never {
|
||||
return ({
|
||||
factory: options.factory, providers: options.providers || [], imports: options.imports || [],
|
||||
} as InjectorDef<any>) as never;
|
||||
} as ΔInjectorDef<any>) as never;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -168,7 +179,7 @@ export function defineInjector(options: {factory: () => any, providers?: any[],
|
||||
*
|
||||
* @param type type which may have `ngInjectableDef`
|
||||
*/
|
||||
export function getInjectableDef<T>(type: any): InjectableDef<T>|null {
|
||||
export function getInjectableDef<T>(type: any): ΔInjectableDef<T>|null {
|
||||
return type && type.hasOwnProperty(NG_INJECTABLE_DEF) ? (type as any)[NG_INJECTABLE_DEF] : null;
|
||||
}
|
||||
|
||||
@ -177,7 +188,7 @@ export function getInjectableDef<T>(type: any): InjectableDef<T>|null {
|
||||
*
|
||||
* @param type type which may have `ngInjectorDef`
|
||||
*/
|
||||
export function getInjectorDef<T>(type: any): InjectorDef<T>|null {
|
||||
export function getInjectorDef<T>(type: any): ΔInjectorDef<T>|null {
|
||||
return type && type.hasOwnProperty(NG_INJECTOR_DEF) ? (type as any)[NG_INJECTOR_DEF] : null;
|
||||
}
|
||||
|
||||
|
@ -7,8 +7,9 @@
|
||||
*/
|
||||
|
||||
import {Type} from '../../interface/type';
|
||||
import {inject} from '../injector_compatibility';
|
||||
import {defineInjectable, defineInjector, getInjectableDef, getInjectorDef} from '../interface/defs';
|
||||
import {Δinject} from '../injector_compatibility';
|
||||
import {getInjectableDef, getInjectorDef, ΔdefineInjectable, ΔdefineInjector} from '../interface/defs';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@ -17,10 +18,10 @@ import {defineInjectable, defineInjector, getInjectableDef, getInjectorDef} from
|
||||
* This should be kept up to date with the public exports of @angular/core.
|
||||
*/
|
||||
export const angularCoreDiEnv: {[name: string]: Function} = {
|
||||
'defineInjectable': defineInjectable,
|
||||
'defineInjector': defineInjector,
|
||||
'inject': inject,
|
||||
'ɵgetFactoryOf': getFactoryOf,
|
||||
'ΔdefineInjectable': ΔdefineInjectable,
|
||||
'ΔdefineInjector': ΔdefineInjector,
|
||||
'Δinject': Δinject,
|
||||
'ΔgetFactoryOf': getFactoryOf,
|
||||
};
|
||||
|
||||
function getFactoryOf<T>(type: Type<any>): ((type: Type<T>| null) => T)|null {
|
||||
|
@ -9,16 +9,18 @@
|
||||
import {OnDestroy} from '../interface/lifecycle_hooks';
|
||||
import {Type} from '../interface/type';
|
||||
import {stringify} from '../util/stringify';
|
||||
|
||||
import {resolveForwardRef} from './forward_ref';
|
||||
import {InjectionToken} from './injection_token';
|
||||
import {INJECTOR, Injector, NG_TEMP_TOKEN_PATH, NullInjector, USE_VALUE, catchInjectorError} from './injector';
|
||||
import {inject, injectArgs, setCurrentInjector} from './injector_compatibility';
|
||||
import {InjectableDef, InjectableType, InjectorType, InjectorTypeWithProviders, getInjectableDef, getInjectorDef} from './interface/defs';
|
||||
import {injectArgs, setCurrentInjector, Δinject} from './injector_compatibility';
|
||||
import {InjectableType, InjectorType, InjectorTypeWithProviders, getInjectableDef, getInjectorDef, ΔInjectableDef} from './interface/defs';
|
||||
import {InjectFlags} from './interface/injector';
|
||||
import {ClassProvider, ConstructorProvider, ExistingProvider, FactoryProvider, StaticClassProvider, StaticProvider, TypeProvider, ValueProvider} from './interface/provider';
|
||||
import {APP_ROOT} from './scope';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Internal type for a single provider in a deep provider array.
|
||||
*/
|
||||
@ -354,7 +356,7 @@ export class R3Injector {
|
||||
return record.value as T;
|
||||
}
|
||||
|
||||
private injectableDefInScope(def: InjectableDef<any>): boolean {
|
||||
private injectableDefInScope(def: ΔInjectableDef<any>): boolean {
|
||||
if (!def.providedIn) {
|
||||
return false;
|
||||
} else if (typeof def.providedIn === 'string') {
|
||||
@ -411,7 +413,7 @@ export function providerToFactory(
|
||||
if (isValueProvider(provider)) {
|
||||
factory = () => resolveForwardRef(provider.useValue);
|
||||
} else if (isExistingProvider(provider)) {
|
||||
factory = () => inject(resolveForwardRef(provider.useExisting));
|
||||
factory = () => Δinject(resolveForwardRef(provider.useExisting));
|
||||
} else if (isFactoryProvider(provider)) {
|
||||
factory = () => provider.useFactory(...injectArgs(provider.deps || []));
|
||||
} else {
|
||||
|
@ -10,7 +10,7 @@ import {Type} from '../interface/type';
|
||||
import {ReflectionCapabilities} from '../reflection/reflection_capabilities';
|
||||
import {getClosureSafeProperty} from '../util/property';
|
||||
|
||||
import {inject, injectArgs} from './injector_compatibility';
|
||||
import {injectArgs, Δinject} from './injector_compatibility';
|
||||
import {ClassSansProvider, ConstructorSansProvider, ExistingSansProvider, FactorySansProvider, StaticClassSansProvider, ValueProvider, ValueSansProvider} from './interface/provider';
|
||||
|
||||
const USE_VALUE =
|
||||
@ -32,7 +32,7 @@ export function convertInjectableProviderToFactory(
|
||||
return () => valueProvider.useValue;
|
||||
} else if ((provider as ExistingSansProvider).useExisting) {
|
||||
const existingProvider = (provider as ExistingSansProvider);
|
||||
return () => inject(existingProvider.useExisting);
|
||||
return () => Δinject(existingProvider.useExisting);
|
||||
} else if ((provider as FactorySansProvider).useFactory) {
|
||||
const factoryProvider = (provider as FactorySansProvider);
|
||||
return () => factoryProvider.useFactory(...injectArgs(factoryProvider.deps || EMPTY_ARRAY));
|
||||
|
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
import {ApplicationRef} from '../application_ref';
|
||||
import {InjectorType, defineInjector} from '../di/interface/defs';
|
||||
import {InjectorType, ΔdefineInjector} from '../di/interface/defs';
|
||||
import {Provider} from '../di/interface/provider';
|
||||
import {convertInjectableProviderToFactory} from '../di/util';
|
||||
import {Type} from '../interface/type';
|
||||
@ -32,7 +32,10 @@ export interface NgModuleTransitiveScopes {
|
||||
schemas: SchemaMetadata[]|null;
|
||||
}
|
||||
|
||||
export type NgModuleDefWithMeta<T, Declarations, Imports, Exports> = NgModuleDef<T>;
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export type ΔNgModuleDefWithMeta<T, Declarations, Imports, Exports> = NgModuleDef<T>;
|
||||
|
||||
/**
|
||||
* Runtime link information for NgModules.
|
||||
@ -40,7 +43,7 @@ export type NgModuleDefWithMeta<T, Declarations, Imports, Exports> = NgModuleDef
|
||||
* This is the internal data structure used by the runtime to assemble components, directives,
|
||||
* pipes, and injectors.
|
||||
*
|
||||
* NOTE: Always use `defineNgModule` function to create this object,
|
||||
* NOTE: Always use `ΔdefineNgModule` function to create this object,
|
||||
* never create the object directly since the shape of this object
|
||||
* can change between versions.
|
||||
*/
|
||||
@ -344,7 +347,7 @@ function preR3NgModuleCompile(moduleType: InjectorType<any>, metadata: NgModule)
|
||||
imports = [...imports, metadata.exports];
|
||||
}
|
||||
|
||||
moduleType.ngInjectorDef = defineInjector({
|
||||
moduleType.ngInjectorDef = ΔdefineInjector({
|
||||
factory: convertInjectableProviderToFactory(moduleType, {useClass: moduleType}),
|
||||
providers: metadata && metadata.providers,
|
||||
imports: imports,
|
||||
|
@ -21,10 +21,10 @@
|
||||
* The below symbols are used for @Injectable and @NgModule compilation.
|
||||
*/
|
||||
|
||||
export {inject} from './di/injector_compatibility';
|
||||
export {InjectableDef, InjectorDef, defineInjectable, defineInjector} from './di/interface/defs';
|
||||
export {NgModuleDef, NgModuleDefWithMeta} from './metadata/ng_module';
|
||||
export {defineNgModule} from './render3/definition';
|
||||
export {Δinject} from './di/injector_compatibility';
|
||||
export {ΔInjectableDef, ΔInjectorDef, ΔdefineInjectable, ΔdefineInjector} from './di/interface/defs';
|
||||
export {NgModuleDef, ΔNgModuleDefWithMeta} from './metadata/ng_module';
|
||||
export {ΔdefineNgModule} from './render3/definition';
|
||||
export {setClassMetadata} from './render3/metadata';
|
||||
export {NgModuleFactory} from './render3/ng_module_ref';
|
||||
|
||||
|
9
packages/core/src/render3/DELTA_INSTRUCTIONS.md
Normal file
9
packages/core/src/render3/DELTA_INSTRUCTIONS.md
Normal file
@ -0,0 +1,9 @@
|
||||
# Delta Instructions
|
||||
|
||||
Ivy exports a number of functions prefixed with `Δ`, for example `ΔelementStart`, or `Δinject`, et al. These functions are referred to an "instructions" or "delta" instructions. They are functions that are called by code generated by the Ivy compiler that must be publicly exposed in order to be consumed by this generated code. **They are not meant for developer consumption**. The reason they are prefixed with `Δ` is not only to identify them as different from other functions, but also to make them not show up at the top of IDE code completion in environments such as Visual Studio code.
|
||||
|
||||
|
||||
### Guidance
|
||||
|
||||
- Do not use `Δ` functions directly. They are meant to be used in generated code.
|
||||
- Do not create new `Δ` functions, it's not a convention that Angular consumes, and it is liable to confuse other developers into thinking consuming Angular's `Δ` functions is a good pattern to follow.
|
@ -10,8 +10,8 @@ We currently expect Ivy to remain behind the flag until it's feature complete an
|
||||
|
||||
The work can be divided into three categories:
|
||||
- `@angular/compiler-cli`: TypeScript transformer pipeline which includes two command line tools:
|
||||
- `ngtsc`: (Angular TypeScript Compiler) Angular compiler which strips out `@Component` (and friends) and replaces it with `defineComponent` (and friends).
|
||||
- `ngcc`: (Angular Compatibility Compiler) NPM upgrade compiler which reads the `STORING_METADATA_IN_D.TS.json` files and `.js` files and adds `defineComponent` (and friends) into the `node_module`. This in effect converts a pre-ivy module into ivy module.
|
||||
- `ngtsc`: (Angular TypeScript Compiler) Angular compiler which strips out `@Component` (and friends) and replaces it with `ΔdefineComponent` (and friends).
|
||||
- `ngcc`: (Angular Compatibility Compiler) NPM upgrade compiler which reads the `STORING_METADATA_IN_D.TS.json` files and `.js` files and adds `ΔdefineComponent` (and friends) into the `node_module`. This in effect converts a pre-ivy module into ivy module.
|
||||
- `@angular/compiler`: Ivy Compiler which converts decorator into ivy
|
||||
- `@angular/core`: Decorators which can be patched with `@angular/compiler`.
|
||||
|
||||
@ -20,7 +20,7 @@ The work can be divided into three categories:
|
||||
### `ngtsc` TSC compiler transformer
|
||||
|
||||
TSC transformer which removes and converts `@Pipe`, `@Component`, `@Directive` and `@NgModule`
|
||||
to the corresponding `definePipe`, `defineComponent`, `defineDirective` and `defineInjector`.
|
||||
to the corresponding `ΔdefinePipe`, `ΔdefineComponent`, `ΔdefineDirective` and `ΔdefineInjector`.
|
||||
|
||||
- ✅ Basic setup of the transformer into `tsc`
|
||||
- ✅ Can read STORING_METADATA_IN_D.TS from `.d.ts` (see: [STORING_METADATA_IN_D.TS.md](./STORING_METADATA_IN_D.TS.md))
|
||||
@ -40,19 +40,19 @@ A tool which "upgrades" `node_module` compiled with non-ivy `ngc` into ivy compl
|
||||
|
||||
## `@angular/compiler` changes
|
||||
|
||||
- ✅ Component compilation: Translates `@Component` => `defineComponent`
|
||||
- ✅ Component compilation: Translates `@Component` => `ΔdefineComponent`
|
||||
- ✅ `TemplateCompiler` (current known as `ViewCompiler`)
|
||||
- ✅ `StyleCompiler`
|
||||
- ✅ `PipeCompiler`: Translates `@Pipe` => `definePipe`
|
||||
- ✅ `DirectiveCompiler`: Translates `@Directive` => `defineDirective`
|
||||
- ✅ `InjectableCompiler`: Translates `@Injectable` => `defineInjectable`
|
||||
- ✅ `NgModuleCompiler`: Translates `@NgModule` => `defineInjector` (and `defineNgModule` only in jit)
|
||||
- ✅ `PipeCompiler`: Translates `@Pipe` => `ΔdefinePipe`
|
||||
- ✅ `DirectiveCompiler`: Translates `@Directive` => `ΔdefineDirective`
|
||||
- ✅ `InjectableCompiler`: Translates `@Injectable` => `ΔdefineInjectable`
|
||||
- ✅ `NgModuleCompiler`: Translates `@NgModule` => `ΔdefineInjector` (and `ΔdefineNgModule` only in jit)
|
||||
- ❌ Documentation
|
||||
|
||||
|
||||
## `@angular/core` changes
|
||||
|
||||
The goal is for the `@Component` (and friends) to be the compiler of template. Since decorators are functions which execute during parsing of the `.js` file, the decorator can compile the template into Ivy. The AoT compiler's job is to remove the `@Component` and replace it with call to `defineComponent`.
|
||||
The goal is for the `@Component` (and friends) to be the compiler of template. Since decorators are functions which execute during parsing of the `.js` file, the decorator can compile the template into Ivy. The AoT compiler's job is to remove the `@Component` and replace it with call to `ΔdefineComponent`.
|
||||
|
||||
- ✅ `@angular/compiler` can patch itself onto:
|
||||
- ✅ `@Injectable`
|
||||
@ -68,15 +68,15 @@ The goal is for the `@Component` (and friends) to be the compiler of template. S
|
||||
# Crosscutting
|
||||
|
||||
## Decorators
|
||||
| Annotation | `defineXXX()` | Run time | Spec | Compiler |
|
||||
| -------------------- | ------------------------------ | ------- | -------- | -------- |
|
||||
| `@Component` | ✅ `defineComponent()` | ✅ | ✅ | ✅ |
|
||||
| `@Directive` | ✅ `defineDirective()` | ✅ | ✅ | ✅ |
|
||||
| `@Directive` | ✅ `defineBase()` | ✅ | ✅ | ✅ |
|
||||
| `@Pipe` | ✅ `definePipe()` | ✅ | ✅ | ✅ |
|
||||
| `@Injectable` | ✅ `defineInjectable()` | ✅ | ✅ | ✅ |
|
||||
| `@NgModule` | ✅ `defineInjector()` | ✅ | ✅ | ✅ |
|
||||
| `@ConfigureInjector` | ✅ `defineInjector()` | ❌ | ❌ | ❌ |
|
||||
| Annotation | `defineXXX()` | Run time | Spec | Compiler |
|
||||
| -------------------- | ------------------------------ | ------- | -------- | -------- |
|
||||
| `@Component` | ✅ `ΔdefineComponent()` | ✅ | ✅ | ✅ |
|
||||
| `@Directive` | ✅ `ΔdefineDirective()` | ✅ | ✅ | ✅ |
|
||||
| `@Directive` | ✅ `ΔdefineBase()` | ✅ | ✅ | ✅ |
|
||||
| `@Pipe` | ✅ `ΔdefinePipe()` | ✅ | ✅ | ✅ |
|
||||
| `@Injectable` | ✅ `ΔdefineInjectable()` | ✅ | ✅ | ✅ |
|
||||
| `@NgModule` | ✅ `ΔdefineInjector()` | ✅ | ✅ | ✅ |
|
||||
| `@ConfigureInjector` | ✅ `ΔdefineInjector()` | ❌ | ❌ | ❌ |
|
||||
|
||||
|
||||
|
||||
|
@ -4,7 +4,7 @@ Previous version of Angular used `metadata.json` files to store information abou
|
||||
`ngc` compiler would than do a global analysis to generate the `.ngfactory.ts` files from the `metadata.json`.
|
||||
Ivy strives for locality, which means that `ngtsc` should not need any global information in order to compile the system.
|
||||
The above is mostly true.
|
||||
Unfortunately, in order for `ngtsc` to generate code which is tree shakable `ngtsc` does need to have global knowledge.
|
||||
Unfortunately, in order for `ngtsc` to generate code which is tree shakable `ngtsc` does need to have global knowledge.
|
||||
|
||||
Here is an abbreviated example of breakage of tree-shake-ability.
|
||||
```typescript
|
||||
@ -13,7 +13,7 @@ Here is an abbreviated example of breakage of tree-shake-ability.
|
||||
})
|
||||
export class TooltipDirective {
|
||||
// ngtsc generates this:
|
||||
static ngDirectiveDef = defineDirective(...);
|
||||
static ngDirectiveDef = ΔdefineDirective(...);
|
||||
}
|
||||
|
||||
@Component({
|
||||
@ -22,12 +22,12 @@ export class TooltipDirective {
|
||||
})
|
||||
class MyAppComponent {
|
||||
// ngtsc generates this:
|
||||
static ngDirectiveDef = defineComponent({
|
||||
static ngDirectiveDef = ΔdefineComponent({
|
||||
...
|
||||
directives: [
|
||||
// BREAKS TREE-SHAKING!!!
|
||||
// TooltipDirective included here because it was declared in the NgModule
|
||||
// ngtsc does not know it can be omitted.
|
||||
// ngtsc does not know it can be omitted.
|
||||
// Only way for ngtsc to know that it can omit TooltipDirective is if it knows
|
||||
// its selector and see if the selector matches the current component's template.
|
||||
TooltipDirective
|
||||
@ -41,12 +41,12 @@ class MyAppComponent {
|
||||
})
|
||||
class MyAppModule {
|
||||
// ngtsc generates this:
|
||||
static ngDirectiveDef = defineNgModule(...);
|
||||
static ngDirectiveDef = ΔdefineNgModule(...);
|
||||
}
|
||||
```
|
||||
|
||||
Notice that `ngtsc` can't remove `TooltipDirective` because it would need to know its selector and see if the directive matches in the component's template.
|
||||
Knowing the selector breaks locality and so we make an exception for some locality information such as selector, inputs and outputs.
|
||||
Knowing the selector breaks locality and so we make an exception for some locality information such as selector, inputs and outputs.
|
||||
Since we are breaking the locality rule, we need to store the information someplace since `ngtsc` can't have access to the `TooltipDirective` source.
|
||||
We store the information in the `.d.ts` file like so.
|
||||
|
||||
|
@ -36,18 +36,18 @@ The size of the `CONSTS` section is declared in the property `consts` of the com
|
||||
})
|
||||
class MyApp {
|
||||
|
||||
static ngComponentDef = defineComponent({
|
||||
static ngComponentDef = ΔdefineComponent({
|
||||
...,
|
||||
consts: 5,
|
||||
template: function(rf: RenderFlags, ctx: MyApp) {
|
||||
if (rf & RenderFlags.Create) {
|
||||
elementStart(0, 'div');
|
||||
text(1, 'Hello ');
|
||||
elementStart(2, 'b');
|
||||
text(3, 'World');
|
||||
elementEnd();
|
||||
text(4, '!');
|
||||
elementEnd();
|
||||
ΔelementStart(0, 'div');
|
||||
Δtext(1, 'Hello ');
|
||||
ΔelementStart(2, 'b');
|
||||
Δtext(3, 'World');
|
||||
ΔelementEnd();
|
||||
Δtext(4, '!');
|
||||
ΔelementEnd();
|
||||
}
|
||||
...
|
||||
}
|
||||
@ -87,19 +87,19 @@ The size of the `VARS `section is declared in the property `vars` of the compone
|
||||
class MyApp {
|
||||
name = 'World';
|
||||
|
||||
static ngComponentDef = defineComponent({
|
||||
static ngComponentDef = ΔdefineComponent({
|
||||
...,
|
||||
consts: 2, // Two DOM Elements.
|
||||
vars: 2, // Two bindings.
|
||||
template: function(rf: RenderFlags, ctx: MyApp) {
|
||||
if (rf & RenderFlags.Create) {
|
||||
elementStart(0, 'div');
|
||||
text(1);
|
||||
elementEnd();
|
||||
ΔelementStart(0, 'div');
|
||||
Δtext(1);
|
||||
ΔelementEnd();
|
||||
}
|
||||
if (rf & RenderFlags.Update) {
|
||||
elementProperty(0, 'title', bind(ctx.name));
|
||||
textBinding(1, interpolation1('Hello ', ctx.name, '!'));
|
||||
ΔelementProperty(0, 'title', Δbind(ctx.name));
|
||||
ΔtextBinding(1, Δinterpolation1('Hello ', ctx.name, '!'));
|
||||
}
|
||||
...
|
||||
}
|
||||
@ -139,12 +139,12 @@ Examples include:
|
||||
})
|
||||
class MyApp {
|
||||
|
||||
static ngComponentDef = defineComponent({
|
||||
static ngComponentDef = ΔdefineComponent({
|
||||
...,
|
||||
consts: 1,
|
||||
template: function(rf: RenderFlags, ctx: MyApp) {
|
||||
if (rf & RenderFlags.Create) {
|
||||
element(0, 'child', ['tooltip', null]);
|
||||
Δelement(0, 'child', ['tooltip', null]);
|
||||
}
|
||||
...
|
||||
},
|
||||
@ -159,7 +159,7 @@ class MyApp {
|
||||
})
|
||||
class Child {
|
||||
@HostBinding('tooltip') hostTitle = 'Hello World!';
|
||||
static ngComponentDef = defineComponent({
|
||||
static ngComponentDef = ΔdefineComponent({
|
||||
...
|
||||
hostVars: 1
|
||||
});
|
||||
@ -171,7 +171,7 @@ class Child {
|
||||
})
|
||||
class Tooltip {
|
||||
@HostBinding('title') hostTitle = 'greeting';
|
||||
static ngDirectiveDef = defineDirective({
|
||||
static ngDirectiveDef = ΔdefineDirective({
|
||||
...
|
||||
hostVars: 1
|
||||
});
|
||||
@ -273,12 +273,12 @@ Injection tokens are sorted into three sections:
|
||||
})
|
||||
class MyApp {
|
||||
|
||||
static ngComponentDef = defineComponent({
|
||||
static ngComponentDef = ΔdefineComponent({
|
||||
...,
|
||||
consts: 1,
|
||||
template: function(rf: RenderFlags, ctx: MyApp) {
|
||||
if (rf & RenderFlags.Create) {
|
||||
element(0, 'child');
|
||||
Δelement(0, 'child');
|
||||
}
|
||||
...
|
||||
},
|
||||
@ -301,7 +301,7 @@ class MyApp {
|
||||
})
|
||||
class Child {
|
||||
construction(injector: Injector) {}
|
||||
static ngComponentDef = defineComponent({
|
||||
static ngComponentDef = ΔdefineComponent({
|
||||
...
|
||||
features: [
|
||||
ProvidesFeature(
|
||||
@ -348,7 +348,7 @@ NOTICE:
|
||||
Where `factory` is a function which wraps the factory into object which can be monomorphically detected at runtime in an efficient way.
|
||||
```TypeScript
|
||||
class Factory {
|
||||
/// Marker set to true during factory invocation to see if we get into recursive loop.
|
||||
/// Marker set to true during factory invocation to see if we get into recursive loop.
|
||||
/// Recursive loop causes an error to be displayed.
|
||||
resolving = false;
|
||||
constructor(public factory: Function) { }
|
||||
@ -376,13 +376,13 @@ There are several special objects such as `ElementRef`, `ViewContainerRef`, etc.
|
||||
These objects behave as if they are always included in the `providers` array of every component and directive.
|
||||
Adding them always there would prevent tree shaking so they need to be lazily included.
|
||||
|
||||
NOTE:
|
||||
NOTE:
|
||||
An interesting thing about these objects is that they are not memoized `injector.get(ElementRef) !== injector.get(ElementRef)`.
|
||||
This could be considered a bug, it means that we don't have to allocate storage space for them.
|
||||
|
||||
We should treat these special objects like any other token. `directiveInject()` already reads a special `NG_ELEMENT_ID`
|
||||
property set on directives to locate their bit in the bloom filter. We can set this same property on special objects,
|
||||
but point to a factory function rather than an element ID number. When we check that property in `directiveInject()`
|
||||
property set on directives to locate their bit in the bloom filter. We can set this same property on special objects,
|
||||
but point to a factory function rather than an element ID number. When we check that property in `directiveInject()`
|
||||
and see that it's a function, we know to invoke the factory function directly instead of searching the node tree.
|
||||
|
||||
```typescript
|
||||
@ -422,7 +422,7 @@ function inject(token: any): any {
|
||||
if (typeof token === 'function' && injectableDef = token.ngInjectableDef) {
|
||||
const provideIn = injectableDef.provideIn;
|
||||
if (provideIn === '__node_injector__') {
|
||||
// if we are injecting `Injector` than create a wrapper object around the inject but which
|
||||
// if we are injecting `Injector` than create a wrapper object around the inject but which
|
||||
// is bound to the current node.
|
||||
return createInjector();
|
||||
}
|
||||
@ -439,4 +439,4 @@ TODO
|
||||
|
||||
## Combining `LContainer` with `LView`
|
||||
|
||||
TODO
|
||||
TODO
|
||||
|
@ -9,7 +9,7 @@
|
||||
import {ChangeDetectorRef as ViewEngine_ChangeDetectorRef} from '../change_detection/change_detector_ref';
|
||||
import {InjectionToken} from '../di/injection_token';
|
||||
import {Injector} from '../di/injector';
|
||||
import {inject} from '../di/injector_compatibility';
|
||||
import {Δinject} from '../di/injector_compatibility';
|
||||
import {InjectFlags} from '../di/interface/injector';
|
||||
import {Type} from '../interface/type';
|
||||
import {ComponentFactory as viewEngine_ComponentFactory, ComponentRef as viewEngine_ComponentRef} from '../linker/component_factory';
|
||||
@ -66,7 +66,7 @@ function toRefArray(map: {[key: string]: string}): {propName: string; templateNa
|
||||
*/
|
||||
export const ROOT_CONTEXT = new InjectionToken<RootContext>(
|
||||
'ROOT_CONTEXT_TOKEN',
|
||||
{providedIn: 'root', factory: () => createRootContext(inject(SCHEDULER))});
|
||||
{providedIn: 'root', factory: () => createRootContext(Δinject(SCHEDULER))});
|
||||
|
||||
/**
|
||||
* A change detection scheduler token for {@link RootContext}. This token is the default value used
|
||||
|
@ -18,7 +18,7 @@ import {stringify} from '../util/stringify';
|
||||
|
||||
import {EMPTY_ARRAY, EMPTY_OBJ} from './empty';
|
||||
import {NG_COMPONENT_DEF, NG_DIRECTIVE_DEF, NG_MODULE_DEF, NG_PIPE_DEF} from './fields';
|
||||
import {BaseDef, ComponentDef, ComponentDefFeature, ComponentTemplate, ComponentType, ContentQueriesFunction, DirectiveDef, DirectiveDefFeature, DirectiveType, DirectiveTypesOrFactory, FactoryFn, HostBindingsFunction, PipeDef, PipeType, PipeTypesOrFactory, ViewQueriesFunction} from './interfaces/definition';
|
||||
import {ComponentDef, ComponentDefFeature, ComponentTemplate, ComponentType, ContentQueriesFunction, DirectiveDef, DirectiveDefFeature, DirectiveType, DirectiveTypesOrFactory, FactoryFn, HostBindingsFunction, PipeDef, PipeType, PipeTypesOrFactory, ViewQueriesFunction, ΔBaseDef} from './interfaces/definition';
|
||||
// while SelectorFlags is unused here, it's required so that types don't get resolved lazily
|
||||
// see: https://github.com/Microsoft/web-build-tools/issues/1050
|
||||
import {CssSelectorList, SelectorFlags} from './interfaces/projection';
|
||||
@ -39,8 +39,9 @@ let _renderCompCount = 0;
|
||||
* });
|
||||
* }
|
||||
* ```
|
||||
* @publicApi
|
||||
*/
|
||||
export function defineComponent<T>(componentDefinition: {
|
||||
export function ΔdefineComponent<T>(componentDefinition: {
|
||||
/**
|
||||
* Directive type, needed to configure the injector.
|
||||
*/
|
||||
@ -303,7 +304,10 @@ export function defineComponent<T>(componentDefinition: {
|
||||
return def as never;
|
||||
}
|
||||
|
||||
export function setComponentScope(
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export function ΔsetComponentScope(
|
||||
type: ComponentType<any>, directives: Type<any>[], pipes: Type<any>[]): void {
|
||||
const def = (type.ngComponentDef as ComponentDef<any>);
|
||||
def.directiveDefs = () => directives.map(extractDirectiveDef);
|
||||
@ -327,7 +331,10 @@ export function extractPipeDef(type: PipeType<any>): PipeDef<any> {
|
||||
return def !;
|
||||
}
|
||||
|
||||
export function defineNgModule<T>(def: {
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export function ΔdefineNgModule<T>(def: {
|
||||
/** Token representing the module. Used by DI. */
|
||||
type: T;
|
||||
|
||||
@ -368,8 +375,10 @@ export function defineNgModule<T>(def: {
|
||||
* Scope metadata of modules is not used in production builds, so calls to this function can be
|
||||
* marked pure to tree-shake it from the bundle, allowing for all referenced declarations
|
||||
* to become eligible for tree-shaking as well.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function setNgModuleScope(type: any, scope: {
|
||||
export function ΔsetNgModuleScope(type: any, scope: {
|
||||
/** List of components, directives, and pipes declared by this module. */
|
||||
declarations?: Type<any>[] | (() => Type<any>[]);
|
||||
|
||||
@ -469,15 +478,19 @@ function invertObject<T>(
|
||||
* Create a base definition
|
||||
*
|
||||
* # Example
|
||||
* ```
|
||||
* ```ts
|
||||
* class ShouldBeInherited {
|
||||
* static ngBaseDef = defineBase({
|
||||
* static ngBaseDef = ΔdefineBase({
|
||||
* ...
|
||||
* })
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @param baseDefinition The base definition parameters
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function defineBase<T>(baseDefinition: {
|
||||
export function ΔdefineBase<T>(baseDefinition: {
|
||||
/**
|
||||
* A map of input names.
|
||||
*
|
||||
@ -534,7 +547,7 @@ export function defineBase<T>(baseDefinition: {
|
||||
* of properties.
|
||||
*/
|
||||
outputs?: {[P in keyof T]?: string};
|
||||
}): BaseDef<T> {
|
||||
}): ΔBaseDef<T> {
|
||||
const declaredInputs: {[P in keyof T]: string} = {} as any;
|
||||
return {
|
||||
inputs: invertObject<T>(baseDefinition.inputs as any, declaredInputs),
|
||||
@ -547,17 +560,19 @@ export function defineBase<T>(baseDefinition: {
|
||||
* Create a directive definition object.
|
||||
*
|
||||
* # Example
|
||||
* ```
|
||||
* ```ts
|
||||
* class MyDirective {
|
||||
* // Generated by Angular Template Compiler
|
||||
* // [Symbol] syntax will not be supported by TypeScript until v2.7
|
||||
* static ngDirectiveDef = defineDirective({
|
||||
* static ngDirectiveDef = ΔdefineDirective({
|
||||
* ...
|
||||
* });
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export const defineDirective = defineComponent as any as<T>(directiveDefinition: {
|
||||
export const ΔdefineDirective = ΔdefineComponent as any as<T>(directiveDefinition: {
|
||||
/**
|
||||
* Directive type, needed to configure the injector.
|
||||
*/
|
||||
@ -672,8 +687,10 @@ export const defineDirective = defineComponent as any as<T>(directiveDefinition:
|
||||
* }
|
||||
* ```
|
||||
* @param pipeDef Pipe definition generated by the compiler
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function definePipe<T>(pipeDef: {
|
||||
export function ΔdefinePipe<T>(pipeDef: {
|
||||
/** Name of the pipe. Used for matching pipes in template to pipe defs. */
|
||||
name: string,
|
||||
|
||||
|
@ -634,7 +634,10 @@ export class NodeInjector implements Injector {
|
||||
}
|
||||
}
|
||||
|
||||
export function getFactoryOf<T>(type: Type<any>): ((type: Type<T>| null) => T)|null {
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export function ΔgetFactoryOf<T>(type: Type<any>): ((type: Type<T>| null) => T)|null {
|
||||
const typeAny = type as any;
|
||||
const def = getComponentDef<T>(typeAny) || getDirectiveDef<T>(typeAny) ||
|
||||
getPipeDef<T>(typeAny) || getInjectableDef<T>(typeAny) || getInjectorDef<T>(typeAny);
|
||||
@ -644,9 +647,12 @@ export function getFactoryOf<T>(type: Type<any>): ((type: Type<T>| null) => T)|n
|
||||
return def.factory;
|
||||
}
|
||||
|
||||
export function getInheritedFactory<T>(type: Type<any>): (type: Type<T>) => T {
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export function ΔgetInheritedFactory<T>(type: Type<any>): (type: Type<T>) => T {
|
||||
const proto = Object.getPrototypeOf(type.prototype).constructor as Type<any>;
|
||||
const factory = getFactoryOf<T>(proto);
|
||||
const factory = ΔgetFactoryOf<T>(proto);
|
||||
if (factory !== null) {
|
||||
return factory;
|
||||
} else {
|
||||
|
@ -12,7 +12,7 @@ import {ClassProvider, Provider} from '../di/interface/provider';
|
||||
import {isClassProvider, isTypeProvider, providerToFactory} from '../di/r3_injector';
|
||||
|
||||
import {diPublicInInjector, getNodeInjectable, getOrCreateNodeInjectorForNode} from './di';
|
||||
import {directiveInject} from './instructions/all';
|
||||
import {ΔdirectiveInject} from './instructions/all';
|
||||
import {DirectiveDef} from './interfaces/definition';
|
||||
import {NodeInjectorFactory} from './interfaces/injector';
|
||||
import {TContainerNode, TElementContainerNode, TElementNode, TNodeProviderIndexes} from './interfaces/node';
|
||||
@ -93,7 +93,7 @@ function resolveProvider(
|
||||
|
||||
if (isTypeProvider(provider) || !provider.multi) {
|
||||
// Single provider case: the factory is created and pushed immediately
|
||||
const factory = new NodeInjectorFactory(providerFactory, isViewProvider, directiveInject);
|
||||
const factory = new NodeInjectorFactory(providerFactory, isViewProvider, ΔdirectiveInject);
|
||||
const existingFactoryIndex = indexOf(
|
||||
token, tInjectables, isViewProvider ? beginIndex : beginIndex + cptViewProvidersCount,
|
||||
endIndex);
|
||||
@ -255,7 +255,7 @@ function multiFactory(
|
||||
this: NodeInjectorFactory, _: null, tData: TData, lData: LView, tNode: TElementNode) => any,
|
||||
index: number, isViewProvider: boolean, isComponent: boolean,
|
||||
f: () => any): NodeInjectorFactory {
|
||||
const factory = new NodeInjectorFactory(factoryFn, isViewProvider, directiveInject);
|
||||
const factory = new NodeInjectorFactory(factoryFn, isViewProvider, ΔdirectiveInject);
|
||||
factory.multi = [];
|
||||
factory.index = index;
|
||||
factory.componentProviders = 0;
|
||||
|
@ -13,7 +13,7 @@ import {ComponentDef, DirectiveDef, DirectiveDefFeature, RenderFlags} from '../i
|
||||
import {adjustActiveDirectiveSuperClassDepthPosition} from '../state';
|
||||
import {isComponentDef} from '../util/view_utils';
|
||||
|
||||
import {NgOnChangesFeature} from './ng_onchanges_feature';
|
||||
import {ΔNgOnChangesFeature} from './ng_onchanges_feature';
|
||||
|
||||
function getSuperType(type: Type<any>): Type<any>&
|
||||
{ngComponentDef?: ComponentDef<any>, ngDirectiveDef?: DirectiveDef<any>} {
|
||||
@ -23,8 +23,10 @@ function getSuperType(type: Type<any>): Type<any>&
|
||||
/**
|
||||
* Merges the definition from a super class to a sub class.
|
||||
* @param definition The definition that is a SubClass of another directive of component
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function InheritDefinitionFeature(definition: DirectiveDef<any>| ComponentDef<any>): void {
|
||||
export function ΔInheritDefinitionFeature(definition: DirectiveDef<any>| ComponentDef<any>): void {
|
||||
let superType = getSuperType(definition.type);
|
||||
|
||||
while (superType) {
|
||||
@ -159,7 +161,7 @@ export function InheritDefinitionFeature(definition: DirectiveDef<any>| Componen
|
||||
definition.onInit = definition.onInit || superPrototype.ngOnInit;
|
||||
|
||||
if (superPrototype.ngOnChanges) {
|
||||
NgOnChangesFeature()(definition);
|
||||
ΔNgOnChangesFeature()(definition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -38,8 +38,10 @@ type OnChangesExpando = OnChanges & {
|
||||
* features: [NgOnChangesFeature()]
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function NgOnChangesFeature<T>(): DirectiveDefFeature {
|
||||
export function ΔNgOnChangesFeature<T>(): DirectiveDefFeature {
|
||||
// This option ensures that the ngOnChanges lifecycle hook will be inherited
|
||||
// from superclasses (in InheritDefinitionFeature).
|
||||
(NgOnChangesFeatureImpl as DirectiveDefFeature).ngInherit = true;
|
||||
|
@ -36,8 +36,10 @@ import {DirectiveDef} from '../interfaces/definition';
|
||||
* }
|
||||
*
|
||||
* @param definition
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function ProvidersFeature<T>(providers: Provider[], viewProviders: Provider[] = []) {
|
||||
export function ΔProvidersFeature<T>(providers: Provider[], viewProviders: Provider[] = []) {
|
||||
return (definition: DirectiveDef<T>) => {
|
||||
definition.providersResolver =
|
||||
(def: DirectiveDef<T>, processProvidersFn?: ProcessProvidersFunction) => {
|
||||
|
@ -14,7 +14,7 @@ import {assertDefined, assertEqual, assertGreaterThan} from '../util/assert';
|
||||
|
||||
import {attachPatchData} from './context_discovery';
|
||||
import {attachI18nOpCodesDebug} from './debug';
|
||||
import {elementAttribute, load, textBinding} from './instructions/all';
|
||||
import {ΔelementAttribute, Δload, ΔtextBinding} from './instructions/all';
|
||||
import {allocExpando, createNodeAtIndex} from './instructions/shared';
|
||||
import {LContainer, NATIVE} from './interfaces/container';
|
||||
import {COMMENT_MARKER, ELEMENT_MARKER, I18nMutateOpCode, I18nMutateOpCodes, I18nUpdateOpCode, I18nUpdateOpCodes, IcuType, TI18n, TIcu} from './interfaces/i18n';
|
||||
@ -346,8 +346,10 @@ const parentIndexStack: number[] = [];
|
||||
* @param index A unique index of the translation in the static block.
|
||||
* @param message The translation message.
|
||||
* @param subTemplateIndex Optional sub-template index in the `message`.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function i18nStart(index: number, message: string, subTemplateIndex?: number): void {
|
||||
export function Δi18nStart(index: number, message: string, subTemplateIndex?: number): void {
|
||||
const tView = getLView()[TVIEW];
|
||||
ngDevMode && assertDefined(tView, `tView should be defined`);
|
||||
i18nIndexStack[++i18nIndexStackPointer] = index;
|
||||
@ -532,9 +534,9 @@ function appendI18nNode(tNode: TNode, parentTNode: TNode, previousTNode: TNode |
|
||||
*
|
||||
* @returns Transformed string that can be consumed by i18nStart instruction
|
||||
*
|
||||
* @publicAPI
|
||||
* @publicApi
|
||||
*/
|
||||
export function i18nPostprocess(
|
||||
export function Δi18nPostprocess(
|
||||
message: string, replacements: {[key: string]: (string | string[])} = {}): string {
|
||||
/**
|
||||
* Step 1: resolve all multi-value placeholders like [<EFBFBD>#5<EFBFBD>|<EFBFBD>*1:1<EFBFBD><EFBFBD>#2:1<EFBFBD>|<EFBFBD>#4:1<EFBFBD>]
|
||||
@ -627,8 +629,10 @@ export function i18nPostprocess(
|
||||
/**
|
||||
* Translates a translation block marked by `i18nStart` and `i18nEnd`. It inserts the text/ICU nodes
|
||||
* into the render tree, moves the placeholder nodes and removes the deleted nodes.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function i18nEnd(): void {
|
||||
export function Δi18nEnd(): void {
|
||||
const tView = getLView()[TVIEW];
|
||||
ngDevMode && assertDefined(tView, `tView should be defined`);
|
||||
i18nEndFirstPass(tView);
|
||||
@ -736,7 +740,7 @@ function readCreateOpCodes(
|
||||
const elementNodeIndex = opCode >>> I18nMutateOpCode.SHIFT_REF;
|
||||
const attrName = createOpCodes[++i] as string;
|
||||
const attrValue = createOpCodes[++i] as string;
|
||||
elementAttribute(elementNodeIndex, attrName, attrValue);
|
||||
ΔelementAttribute(elementNodeIndex, attrName, attrValue);
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unable to determine the type of mutate operation for "${opCode}"`);
|
||||
@ -813,10 +817,10 @@ function readUpdateOpCodes(
|
||||
case I18nUpdateOpCode.Attr:
|
||||
const attrName = updateOpCodes[++j] as string;
|
||||
const sanitizeFn = updateOpCodes[++j] as SanitizerFn | null;
|
||||
elementAttribute(nodeIndex, attrName, value, sanitizeFn);
|
||||
ΔelementAttribute(nodeIndex, attrName, value, sanitizeFn);
|
||||
break;
|
||||
case I18nUpdateOpCode.Text:
|
||||
textBinding(nodeIndex, value);
|
||||
ΔtextBinding(nodeIndex, value);
|
||||
break;
|
||||
case I18nUpdateOpCode.IcuSwitch:
|
||||
tIcuIndex = updateOpCodes[++j] as number;
|
||||
@ -880,7 +884,7 @@ function removeNode(index: number, viewData: LView) {
|
||||
nativeRemoveNode(viewData[RENDERER], removedPhRNode);
|
||||
}
|
||||
|
||||
const slotValue = load(index) as RElement | RComment | LContainer | StylingContext;
|
||||
const slotValue = Δload(index) as RElement | RComment | LContainer | StylingContext;
|
||||
if (isLContainer(slotValue)) {
|
||||
const lContainer = slotValue as LContainer;
|
||||
if (removedPhTNode.type !== TNodeType.Container) {
|
||||
@ -914,10 +918,12 @@ function removeNode(index: number, viewData: LView) {
|
||||
* @param index A unique index of the translation in the static block.
|
||||
* @param message The translation message.
|
||||
* @param subTemplateIndex Optional sub-template index in the `message`.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function i18n(index: number, message: string, subTemplateIndex?: number): void {
|
||||
i18nStart(index, message, subTemplateIndex);
|
||||
i18nEnd();
|
||||
export function Δi18n(index: number, message: string, subTemplateIndex?: number): void {
|
||||
Δi18nStart(index, message, subTemplateIndex);
|
||||
Δi18nEnd();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -925,8 +931,10 @@ export function i18n(index: number, message: string, subTemplateIndex?: number):
|
||||
*
|
||||
* @param index A unique index in the static block
|
||||
* @param values
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function i18nAttributes(index: number, values: string[]): void {
|
||||
export function Δi18nAttributes(index: number, values: string[]): void {
|
||||
const tView = getLView()[TVIEW];
|
||||
ngDevMode && assertDefined(tView, `tView should be defined`);
|
||||
if (tView.firstTemplatePass && tView.data[index + HEADER_OFFSET] === null) {
|
||||
@ -958,7 +966,7 @@ function i18nAttributesFirstPass(tView: TView, index: number, values: string[])
|
||||
addAllToArray(
|
||||
generateBindingUpdateOpCodes(value, previousElementIndex, attrName), updateOpCodes);
|
||||
} else {
|
||||
elementAttribute(previousElementIndex, attrName, value);
|
||||
ΔelementAttribute(previousElementIndex, attrName, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -975,8 +983,10 @@ let shiftsCounter = 0;
|
||||
* update the translated nodes.
|
||||
*
|
||||
* @param expression The binding's new value or NO_CHANGE
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function i18nExp<T>(expression: T | NO_CHANGE): void {
|
||||
export function Δi18nExp<T>(expression: T | NO_CHANGE): void {
|
||||
if (expression !== NO_CHANGE) {
|
||||
changeMask = changeMask | (1 << shiftsCounter);
|
||||
}
|
||||
@ -988,8 +998,10 @@ export function i18nExp<T>(expression: T | NO_CHANGE): void {
|
||||
*
|
||||
* @param index Index of either {@link i18nStart} (translation block) or {@link i18nAttributes}
|
||||
* (i18n attribute) on which it should update the content.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function i18nApply(index: number) {
|
||||
export function Δi18nApply(index: number) {
|
||||
if (shiftsCounter) {
|
||||
const lView = getLView();
|
||||
const tView = lView[TVIEW];
|
||||
|
@ -6,109 +6,107 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import {LifecycleHooksFeature, renderComponent, whenRendered} from './component';
|
||||
import {defineBase, defineComponent, defineDirective, defineNgModule, definePipe, setComponentScope, setNgModuleScope} from './definition';
|
||||
import {InheritDefinitionFeature} from './features/inherit_definition_feature';
|
||||
import {NgOnChangesFeature} from './features/ng_onchanges_feature';
|
||||
import {ProvidersFeature} from './features/providers_feature';
|
||||
import {BaseDef, ComponentDef, ComponentDefWithMeta, ComponentTemplate, ComponentType, DirectiveDef, DirectiveDefFlags, DirectiveDefWithMeta, DirectiveType, PipeDef, PipeDefWithMeta} from './interfaces/definition';
|
||||
import {ΔdefineBase, ΔdefineComponent, ΔdefineDirective, ΔdefineNgModule, ΔdefinePipe, ΔsetComponentScope, ΔsetNgModuleScope} from './definition';
|
||||
import {ΔInheritDefinitionFeature} from './features/inherit_definition_feature';
|
||||
import {ΔNgOnChangesFeature} from './features/ng_onchanges_feature';
|
||||
import {ΔProvidersFeature} from './features/providers_feature';
|
||||
import {ComponentDef, ComponentTemplate, ComponentType, DirectiveDef, DirectiveDefFlags, DirectiveType, PipeDef, ΔBaseDef, ΔComponentDefWithMeta, ΔDirectiveDefWithMeta, ΔPipeDefWithMeta} from './interfaces/definition';
|
||||
import {getComponent, getDirectives, getHostElement, getRenderedText} from './util/discovery_utils';
|
||||
|
||||
export {ComponentFactory, ComponentFactoryResolver, ComponentRef, injectComponentFactoryResolver} from './component_ref';
|
||||
export {getFactoryOf, getInheritedFactory} from './di';
|
||||
export {ΔgetFactoryOf, ΔgetInheritedFactory} from './di';
|
||||
// clang-format off
|
||||
export {
|
||||
detectChanges,
|
||||
markDirty,
|
||||
store,
|
||||
tick,
|
||||
ΔallocHostVars,
|
||||
Δbind,
|
||||
ΔcomponentHostSyntheticListener,
|
||||
ΔcomponentHostSyntheticProperty,
|
||||
|
||||
Δcontainer,
|
||||
ΔcontainerRefreshEnd,
|
||||
ΔcontainerRefreshStart,
|
||||
|
||||
ΔdirectiveInject,
|
||||
|
||||
Δelement,
|
||||
ΔelementAttribute,
|
||||
ΔelementClassProp,
|
||||
ΔelementContainerEnd,
|
||||
|
||||
ΔelementContainerStart,
|
||||
ΔelementEnd,
|
||||
|
||||
ΔelementHostAttrs,
|
||||
ΔelementHostClassProp,
|
||||
ΔelementHostStyleProp,
|
||||
ΔelementHostStyling,
|
||||
ΔelementHostStylingApply,
|
||||
ΔelementHostStylingMap,
|
||||
ΔelementProperty,
|
||||
ΔelementStart,
|
||||
ΔelementStyleProp,
|
||||
ΔelementStyling,
|
||||
ΔelementStylingApply,
|
||||
ΔelementStylingMap,
|
||||
ΔembeddedViewEnd,
|
||||
|
||||
ΔembeddedViewStart,
|
||||
|
||||
ΔgetCurrentView,
|
||||
ΔinjectAttribute,
|
||||
|
||||
Δinterpolation1,
|
||||
Δinterpolation2,
|
||||
Δinterpolation3,
|
||||
Δinterpolation4,
|
||||
Δinterpolation5,
|
||||
Δinterpolation6,
|
||||
Δinterpolation7,
|
||||
Δinterpolation8,
|
||||
ΔinterpolationV,
|
||||
|
||||
Δlistener,
|
||||
Δload,
|
||||
|
||||
ΔnamespaceHTML,
|
||||
ΔnamespaceMathML,
|
||||
ΔnamespaceSVG,
|
||||
|
||||
ΔnextContext,
|
||||
|
||||
Δprojection,
|
||||
ΔprojectionDef,
|
||||
Δproperty,
|
||||
|
||||
Δreference,
|
||||
|
||||
Δselect,
|
||||
Δtemplate,
|
||||
|
||||
Δtext,
|
||||
ΔtextBinding} from './instructions/all';
|
||||
export {RenderFlags} from './interfaces/definition';
|
||||
export {CssSelectorList} from './interfaces/projection';
|
||||
|
||||
|
||||
// clang-format off
|
||||
export {
|
||||
allocHostVars,
|
||||
bind,
|
||||
interpolation1,
|
||||
interpolation2,
|
||||
interpolation3,
|
||||
interpolation4,
|
||||
interpolation5,
|
||||
interpolation6,
|
||||
interpolation7,
|
||||
interpolation8,
|
||||
interpolationV,
|
||||
ΔrestoreView,
|
||||
|
||||
container,
|
||||
containerRefreshStart,
|
||||
containerRefreshEnd,
|
||||
|
||||
nextContext,
|
||||
|
||||
element,
|
||||
elementAttribute,
|
||||
elementClassProp,
|
||||
elementEnd,
|
||||
elementProperty,
|
||||
componentHostSyntheticProperty,
|
||||
componentHostSyntheticListener,
|
||||
elementStart,
|
||||
|
||||
elementContainerStart,
|
||||
elementContainerEnd,
|
||||
elementStyling,
|
||||
elementStylingMap,
|
||||
elementStyleProp,
|
||||
elementStylingApply,
|
||||
|
||||
elementHostAttrs,
|
||||
elementHostStyling,
|
||||
elementHostStylingMap,
|
||||
elementHostStyleProp,
|
||||
elementHostClassProp,
|
||||
elementHostStylingApply,
|
||||
|
||||
select,
|
||||
property,
|
||||
|
||||
listener,
|
||||
store,
|
||||
load,
|
||||
|
||||
namespaceHTML,
|
||||
namespaceMathML,
|
||||
namespaceSVG,
|
||||
|
||||
projection,
|
||||
projectionDef,
|
||||
|
||||
text,
|
||||
textBinding,
|
||||
template,
|
||||
|
||||
reference,
|
||||
|
||||
embeddedViewStart,
|
||||
embeddedViewEnd,
|
||||
detectChanges,
|
||||
markDirty,
|
||||
tick,
|
||||
|
||||
directiveInject,
|
||||
injectAttribute,
|
||||
|
||||
getCurrentView
|
||||
} from './instructions/all';
|
||||
|
||||
export {
|
||||
restoreView,
|
||||
|
||||
enableBindings,
|
||||
disableBindings,
|
||||
ΔenableBindings,
|
||||
ΔdisableBindings,
|
||||
} from './state';
|
||||
|
||||
export {
|
||||
i18n,
|
||||
i18nAttributes,
|
||||
i18nExp,
|
||||
i18nStart,
|
||||
i18nEnd,
|
||||
i18nApply,
|
||||
i18nPostprocess
|
||||
Δi18n,
|
||||
Δi18nAttributes,
|
||||
Δi18nExp,
|
||||
Δi18nStart,
|
||||
Δi18nEnd,
|
||||
Δi18nApply,
|
||||
Δi18nPostprocess,
|
||||
} from './i18n';
|
||||
|
||||
export {NgModuleFactory, NgModuleRef, NgModuleType} from './ng_module_ref';
|
||||
@ -122,71 +120,71 @@ export {
|
||||
} from './metadata';
|
||||
|
||||
export {
|
||||
pipe,
|
||||
pipeBind1,
|
||||
pipeBind2,
|
||||
pipeBind3,
|
||||
pipeBind4,
|
||||
pipeBindV,
|
||||
Δpipe,
|
||||
ΔpipeBind1,
|
||||
ΔpipeBind2,
|
||||
ΔpipeBind3,
|
||||
ΔpipeBind4,
|
||||
ΔpipeBindV,
|
||||
} from './pipe';
|
||||
|
||||
export {
|
||||
queryRefresh,
|
||||
viewQuery,
|
||||
staticViewQuery,
|
||||
loadViewQuery,
|
||||
contentQuery,
|
||||
loadContentQuery,
|
||||
staticContentQuery
|
||||
ΔqueryRefresh,
|
||||
ΔviewQuery,
|
||||
ΔstaticViewQuery,
|
||||
ΔloadViewQuery,
|
||||
ΔcontentQuery,
|
||||
ΔloadContentQuery,
|
||||
ΔstaticContentQuery
|
||||
} from './query';
|
||||
|
||||
export {
|
||||
pureFunction0,
|
||||
pureFunction1,
|
||||
pureFunction2,
|
||||
pureFunction3,
|
||||
pureFunction4,
|
||||
pureFunction5,
|
||||
pureFunction6,
|
||||
pureFunction7,
|
||||
pureFunction8,
|
||||
pureFunctionV,
|
||||
ΔpureFunction0,
|
||||
ΔpureFunction1,
|
||||
ΔpureFunction2,
|
||||
ΔpureFunction3,
|
||||
ΔpureFunction4,
|
||||
ΔpureFunction5,
|
||||
ΔpureFunction6,
|
||||
ΔpureFunction7,
|
||||
ΔpureFunction8,
|
||||
ΔpureFunctionV,
|
||||
} from './pure_function';
|
||||
|
||||
export {templateRefExtractor} from './view_engine_compatibility_prebound';
|
||||
export {ΔtemplateRefExtractor} from './view_engine_compatibility_prebound';
|
||||
|
||||
export {resolveWindow, resolveDocument, resolveBody} from './util/misc_utils';
|
||||
export {ΔresolveWindow, ΔresolveDocument, ΔresolveBody} from './util/misc_utils';
|
||||
|
||||
// clang-format on
|
||||
|
||||
export {
|
||||
BaseDef,
|
||||
ΔBaseDef,
|
||||
ComponentDef,
|
||||
ComponentDefWithMeta,
|
||||
ΔComponentDefWithMeta,
|
||||
ComponentTemplate,
|
||||
ComponentType,
|
||||
DirectiveDef,
|
||||
DirectiveDefFlags,
|
||||
DirectiveDefWithMeta,
|
||||
ΔDirectiveDefWithMeta,
|
||||
DirectiveType,
|
||||
NgOnChangesFeature,
|
||||
InheritDefinitionFeature,
|
||||
ProvidersFeature,
|
||||
ΔNgOnChangesFeature,
|
||||
ΔInheritDefinitionFeature,
|
||||
ΔProvidersFeature,
|
||||
PipeDef,
|
||||
PipeDefWithMeta,
|
||||
ΔPipeDefWithMeta,
|
||||
LifecycleHooksFeature,
|
||||
defineComponent,
|
||||
defineDirective,
|
||||
defineNgModule,
|
||||
defineBase,
|
||||
definePipe,
|
||||
ΔdefineComponent,
|
||||
ΔdefineDirective,
|
||||
ΔdefineNgModule,
|
||||
ΔdefineBase,
|
||||
ΔdefinePipe,
|
||||
getHostElement,
|
||||
getComponent,
|
||||
getDirectives,
|
||||
getRenderedText,
|
||||
renderComponent,
|
||||
setComponentScope,
|
||||
setNgModuleScope,
|
||||
ΔsetComponentScope,
|
||||
ΔsetNgModuleScope,
|
||||
whenRendered,
|
||||
};
|
||||
|
||||
|
@ -16,8 +16,10 @@ import {NO_CHANGE} from '../tokens';
|
||||
* Allocates the necessary amount of slots for host vars.
|
||||
*
|
||||
* @param count Amount of vars to be allocated
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function allocHostVars(count: number): void {
|
||||
export function ΔallocHostVars(count: number): void {
|
||||
const lView = getLView();
|
||||
const tView = lView[TVIEW];
|
||||
if (!tView.firstTemplatePass) return;
|
||||
|
@ -27,8 +27,10 @@ import {addToViewTree, createDirectivesAndLocals, createLContainer, createNodeAt
|
||||
* % }
|
||||
*
|
||||
* @param index The index of the container in the data array
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function container(index: number): void {
|
||||
export function Δcontainer(index: number): void {
|
||||
const tNode = containerInternal(index, null, null);
|
||||
const lView = getLView();
|
||||
if (lView[TVIEW].firstTemplatePass) {
|
||||
@ -54,8 +56,10 @@ export function container(index: number): void {
|
||||
* @param localRefs A set of local reference bindings on the element.
|
||||
* @param localRefExtractor A function which extracts local-refs values from the template.
|
||||
* Defaults to the current element associated with the local-ref.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function template(
|
||||
export function Δtemplate(
|
||||
index: number, templateFn: ComponentTemplate<any>| null, consts: number, vars: number,
|
||||
tagName?: string | null, attrs?: TAttributes | null, localRefs?: string[] | null,
|
||||
localRefExtractor?: LocalRefExtractor) {
|
||||
@ -80,8 +84,10 @@ export function template(
|
||||
* Sets a container up to receive views.
|
||||
*
|
||||
* @param index The index of the container in the data array
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function containerRefreshStart(index: number): void {
|
||||
export function ΔcontainerRefreshStart(index: number): void {
|
||||
const lView = getLView();
|
||||
const tView = lView[TVIEW];
|
||||
let previousOrParentTNode = loadInternal(tView.data, index) as TNode;
|
||||
@ -101,8 +107,10 @@ export function containerRefreshStart(index: number): void {
|
||||
* Marks the end of the LContainer.
|
||||
*
|
||||
* Marking the end of LContainer is the time when to child views get inserted or removed.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function containerRefreshEnd(): void {
|
||||
export function ΔcontainerRefreshEnd(): void {
|
||||
let previousOrParentTNode = getPreviousOrParentTNode();
|
||||
if (getIsParent()) {
|
||||
setIsParent(false);
|
||||
|
@ -19,22 +19,25 @@ import {getLView, getPreviousOrParentTNode} from '../state';
|
||||
*
|
||||
* Usage example (in factory function):
|
||||
*
|
||||
* ```ts
|
||||
* class SomeDirective {
|
||||
* constructor(directive: DirectiveA) {}
|
||||
*
|
||||
* static ngDirectiveDef = defineDirective({
|
||||
* static ngDirectiveDef = ΔdefineDirective({
|
||||
* type: SomeDirective,
|
||||
* factory: () => new SomeDirective(directiveInject(DirectiveA))
|
||||
* factory: () => new SomeDirective(ΔdirectiveInject(DirectiveA))
|
||||
* });
|
||||
* }
|
||||
*
|
||||
* ```
|
||||
* @param token the type or token to inject
|
||||
* @param flags Injection flags
|
||||
* @returns the value from the injector or `null` when not found
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function directiveInject<T>(token: Type<T>| InjectionToken<T>): T;
|
||||
export function directiveInject<T>(token: Type<T>| InjectionToken<T>, flags: InjectFlags): T;
|
||||
export function directiveInject<T>(
|
||||
export function ΔdirectiveInject<T>(token: Type<T>| InjectionToken<T>): T;
|
||||
export function ΔdirectiveInject<T>(token: Type<T>| InjectionToken<T>, flags: InjectFlags): T;
|
||||
export function ΔdirectiveInject<T>(
|
||||
token: Type<T>| InjectionToken<T>, flags = InjectFlags.Default): T|null {
|
||||
token = resolveForwardRef(token);
|
||||
return getOrCreateInjectable<T>(
|
||||
@ -44,7 +47,9 @@ export function directiveInject<T>(
|
||||
|
||||
/**
|
||||
* Facade for the attribute injection from DI.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function injectAttribute(attrNameToInject: string): string|null {
|
||||
export function ΔinjectAttribute(attrNameToInject: string): string|null {
|
||||
return injectAttributeImpl(getPreviousOrParentTNode(), attrNameToInject);
|
||||
}
|
||||
|
@ -41,8 +41,10 @@ import {getActiveDirectiveStylingIndex} from './styling';
|
||||
* Attributes and localRefs are passed as an array of strings where elements with an even index
|
||||
* hold an attribute name and elements with an odd index hold an attribute value, ex.:
|
||||
* ['id', 'warning5', 'class', 'alert']
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function elementStart(
|
||||
export function ΔelementStart(
|
||||
index: number, name: string, attrs?: TAttributes | null, localRefs?: string[] | null): void {
|
||||
const lView = getLView();
|
||||
const tView = lView[TVIEW];
|
||||
@ -122,8 +124,12 @@ export function elementStart(
|
||||
executeContentQueries(tView, tNode, lView);
|
||||
}
|
||||
|
||||
/** Mark the end of the element. */
|
||||
export function elementEnd(): void {
|
||||
/**
|
||||
* Mark the end of the element.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function ΔelementEnd(): void {
|
||||
let previousOrParentTNode = getPreviousOrParentTNode();
|
||||
if (getIsParent()) {
|
||||
setIsParent(false);
|
||||
@ -172,11 +178,13 @@ export function elementEnd(): void {
|
||||
* @param attrs Statically bound set of attributes, classes, and styles to be written into the DOM
|
||||
* element on creation. Use [AttributeMarker] to denote the meaning of this array.
|
||||
* @param localRefs A set of local reference bindings on the element.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function element(
|
||||
export function Δelement(
|
||||
index: number, name: string, attrs?: TAttributes | null, localRefs?: string[] | null): void {
|
||||
elementStart(index, name, attrs, localRefs);
|
||||
elementEnd();
|
||||
ΔelementStart(index, name, attrs, localRefs);
|
||||
ΔelementEnd();
|
||||
}
|
||||
|
||||
|
||||
@ -189,8 +197,10 @@ export function element(
|
||||
* Otherwise the attribute value is set to the stringified value.
|
||||
* @param sanitizer An optional function used to sanitize the value.
|
||||
* @param namespace Optional namespace to use when setting the attribute.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function elementAttribute(
|
||||
export function ΔelementAttribute(
|
||||
index: number, name: string, value: any, sanitizer?: SanitizerFn | null,
|
||||
namespace?: string): void {
|
||||
if (value !== NO_CHANGE) {
|
||||
@ -258,7 +268,7 @@ export function elementAttribute(
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function elementHostAttrs(attrs: TAttributes) {
|
||||
export function ΔelementHostAttrs(attrs: TAttributes) {
|
||||
const hostElementIndex = getSelectedIndex();
|
||||
const lView = getLView();
|
||||
const tNode = getTNode(hostElementIndex, lView);
|
||||
|
@ -28,8 +28,10 @@ import {createDirectivesAndLocals, createNodeAtIndex, executeContentQueries, set
|
||||
* Even if this instruction accepts a set of attributes no actual attribute values are propagated to
|
||||
* the DOM (as a comment node can't have attributes). Attributes are here only for directive
|
||||
* matching purposes and setting initial inputs of directives.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function elementContainerStart(
|
||||
export function ΔelementContainerStart(
|
||||
index: number, attrs?: TAttributes | null, localRefs?: string[] | null): void {
|
||||
const lView = getLView();
|
||||
const tView = lView[TVIEW];
|
||||
@ -65,8 +67,12 @@ export function elementContainerStart(
|
||||
executeContentQueries(tView, tNode, lView);
|
||||
}
|
||||
|
||||
/** Mark the end of the <ng-container>. */
|
||||
export function elementContainerEnd(): void {
|
||||
/**
|
||||
* Mark the end of the <ng-container>.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function ΔelementContainerEnd(): void {
|
||||
let previousOrParentTNode = getPreviousOrParentTNode();
|
||||
const lView = getLView();
|
||||
const tView = lView[TVIEW];
|
||||
|
@ -23,8 +23,10 @@ import {assignTViewNodeToLView, createLView, createTView, refreshDescendantViews
|
||||
*
|
||||
* @param viewBlockId The ID of this view
|
||||
* @return boolean Whether or not this view is in creation mode
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function embeddedViewStart(viewBlockId: number, consts: number, vars: number): RenderFlags {
|
||||
export function ΔembeddedViewStart(viewBlockId: number, consts: number, vars: number): RenderFlags {
|
||||
const lView = getLView();
|
||||
const previousOrParentTNode = getPreviousOrParentTNode();
|
||||
// The previous node can be a view node if we are processing an inline for loop
|
||||
@ -122,8 +124,12 @@ function scanForView(lContainer: LContainer, startIdx: number, viewBlockId: numb
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Marks the end of an embedded view. */
|
||||
export function embeddedViewEnd(): void {
|
||||
/**
|
||||
* Marks the end of an embedded view.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function ΔembeddedViewEnd(): void {
|
||||
const lView = getLView();
|
||||
const viewHost = lView[T_HOST];
|
||||
|
||||
|
@ -14,7 +14,9 @@ import {getLView} from '../state';
|
||||
* Used in conjunction with the restoreView() instruction to save a snapshot
|
||||
* of the current view and restore it when listeners are invoked. This allows
|
||||
* walking the declaration view tree in listeners to get vars from parent views.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function getCurrentView(): OpaqueViewState {
|
||||
export function ΔgetCurrentView(): OpaqueViewState {
|
||||
return getLView() as any as OpaqueViewState;
|
||||
}
|
||||
|
@ -28,8 +28,10 @@ import {BindingDirection, generatePropertyAliases, getCleanup, handleError, load
|
||||
* @param useCapture Whether or not to use capture in event listener
|
||||
* @param eventTargetResolver Function that returns global target information in case this listener
|
||||
* should be attached to a global object like window, document or body
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function listener(
|
||||
export function Δlistener(
|
||||
eventName: string, listenerFn: (e?: any) => any, useCapture = false,
|
||||
eventTargetResolver?: GlobalTargetResolver): void {
|
||||
listenerInternal(eventName, listenerFn, useCapture, eventTargetResolver);
|
||||
@ -53,8 +55,10 @@ export function listener(
|
||||
* @param useCapture Whether or not to use capture in event listener
|
||||
* @param eventTargetResolver Function that returns global target information in case this listener
|
||||
* should be attached to a global object like window, document or body
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function componentHostSyntheticListener<T>(
|
||||
export function ΔcomponentHostSyntheticListener<T>(
|
||||
eventName: string, listenerFn: (e?: any) => any, useCapture = false,
|
||||
eventTargetResolver?: GlobalTargetResolver): void {
|
||||
listenerInternal(eventName, listenerFn, useCapture, eventTargetResolver, loadComponentRenderer);
|
||||
|
@ -6,4 +6,4 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
export {namespaceHTML, namespaceMathML, namespaceSVG} from '../state';
|
||||
export {ΔnamespaceHTML, ΔnamespaceMathML, ΔnamespaceSVG} from '../state';
|
||||
|
@ -16,7 +16,9 @@ import {nextContextImpl} from '../state';
|
||||
*
|
||||
* @param level The relative level of the view from which to grab context compared to contextVewData
|
||||
* @returns context
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function nextContext<T = any>(level: number = 1): T {
|
||||
export function ΔnextContext<T = any>(level: number = 1): T {
|
||||
return nextContextImpl(level);
|
||||
}
|
||||
|
@ -34,8 +34,10 @@ import {createNodeAtIndex} from './shared';
|
||||
*
|
||||
* @param selectors A collection of parsed CSS selectors
|
||||
* @param rawSelectors A collection of CSS selectors in the raw, un-parsed form
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function projectionDef(selectors?: CssSelectorList[], textSelectors?: string[]): void {
|
||||
export function ΔprojectionDef(selectors?: CssSelectorList[], textSelectors?: string[]): void {
|
||||
const componentNode = findComponentView(getLView())[T_HOST] as TElementNode;
|
||||
|
||||
if (!componentNode.projection) {
|
||||
@ -72,8 +74,10 @@ export function projectionDef(selectors?: CssSelectorList[], textSelectors?: str
|
||||
* @param selectorIndex:
|
||||
* - 0 when the selector is `*` (or unspecified as this is the default value),
|
||||
* - 1 based index of the selector from the {@link projectionDef}
|
||||
*/
|
||||
export function projection(nodeIndex: number, selectorIndex: number = 0, attrs?: string[]): void {
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Δprojection(nodeIndex: number, selectorIndex: number = 0, attrs?: string[]): void {
|
||||
const lView = getLView();
|
||||
const tProjectionNode =
|
||||
createNodeAtIndex(nodeIndex, TNodeType.Projection, null, null, attrs || null);
|
||||
|
@ -38,22 +38,26 @@ import {TsickleIssue1009, initializeTNodeInputs, loadComponentRenderer, setInput
|
||||
* (this is necessary for host property bindings)
|
||||
* @returns This function returns itself so that it may be chained
|
||||
* (e.g. `property('name', ctx.name)('title', ctx.title)`)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function property<T>(
|
||||
export function Δproperty<T>(
|
||||
propName: string, value: T, sanitizer?: SanitizerFn | null,
|
||||
nativeOnly?: boolean): TsickleIssue1009 {
|
||||
const index = getSelectedIndex();
|
||||
const bindReconciledValue = bind(value);
|
||||
const bindReconciledValue = Δbind(value);
|
||||
elementPropertyInternal(index, propName, bindReconciledValue, sanitizer, nativeOnly);
|
||||
return property;
|
||||
return Δproperty;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a single value binding.
|
||||
*
|
||||
* @param value Value to diff
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function bind<T>(value: T): T|NO_CHANGE {
|
||||
export function Δbind<T>(value: T): T|NO_CHANGE {
|
||||
const lView = getLView();
|
||||
const bindingIndex = lView[BINDING_INDEX]++;
|
||||
storeBindingMetadata(lView);
|
||||
@ -75,8 +79,10 @@ export function bind<T>(value: T): T|NO_CHANGE {
|
||||
* @param sanitizer An optional function used to sanitize the value.
|
||||
* @param nativeOnly Whether or not we should only set native properties and skip input check
|
||||
* (this is necessary for host property bindings)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function elementProperty<T>(
|
||||
export function ΔelementProperty<T>(
|
||||
index: number, propName: string, value: T | NO_CHANGE, sanitizer?: SanitizerFn | null,
|
||||
nativeOnly?: boolean): void {
|
||||
elementPropertyInternal(index, propName, value, sanitizer, nativeOnly);
|
||||
@ -102,8 +108,10 @@ export function elementProperty<T>(
|
||||
* @param sanitizer An optional function used to sanitize the value.
|
||||
* @param nativeOnly Whether or not we should only set native properties and skip input check
|
||||
* (this is necessary for host property bindings)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function componentHostSyntheticProperty<T>(
|
||||
export function ΔcomponentHostSyntheticProperty<T>(
|
||||
index: number, propName: string, value: T | NO_CHANGE, sanitizer?: SanitizerFn | null,
|
||||
nativeOnly?: boolean) {
|
||||
elementPropertyInternal(index, propName, value, sanitizer, nativeOnly, loadComponentRenderer);
|
||||
|
@ -24,8 +24,10 @@ import {storeBindingMetadata} from './shared';
|
||||
* - has evaluated expressions at odd indexes.
|
||||
*
|
||||
* Returns the concatenated string when any of the arguments changes, `NO_CHANGE` otherwise.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function interpolationV(values: any[]): string|NO_CHANGE {
|
||||
export function ΔinterpolationV(values: any[]): string|NO_CHANGE {
|
||||
ngDevMode && assertLessThan(2, values.length, 'should have at least 3 values');
|
||||
ngDevMode && assertEqual(values.length % 2, 1, 'should have an odd number of values');
|
||||
let different = false;
|
||||
@ -67,16 +69,22 @@ export function interpolationV(values: any[]): string|NO_CHANGE {
|
||||
* @param prefix static value used for concatenation only.
|
||||
* @param v0 value checked for change.
|
||||
* @param suffix static value used for concatenation only.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function interpolation1(prefix: string, v0: any, suffix: string): string|NO_CHANGE {
|
||||
export function Δinterpolation1(prefix: string, v0: any, suffix: string): string|NO_CHANGE {
|
||||
const lView = getLView();
|
||||
const different = bindingUpdated(lView, lView[BINDING_INDEX]++, v0);
|
||||
storeBindingMetadata(lView, prefix, suffix);
|
||||
return different ? prefix + renderStringify(v0) + suffix : NO_CHANGE;
|
||||
}
|
||||
|
||||
/** Creates an interpolation binding with 2 expressions. */
|
||||
export function interpolation2(
|
||||
/**
|
||||
* Creates an interpolation binding with 2 expressions.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Δinterpolation2(
|
||||
prefix: string, v0: any, i0: string, v1: any, suffix: string): string|NO_CHANGE {
|
||||
const lView = getLView();
|
||||
const bindingIndex = lView[BINDING_INDEX];
|
||||
@ -92,8 +100,12 @@ export function interpolation2(
|
||||
return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + suffix : NO_CHANGE;
|
||||
}
|
||||
|
||||
/** Creates an interpolation binding with 3 expressions. */
|
||||
export function interpolation3(
|
||||
/**
|
||||
* Creates an interpolation binding with 3 expressions.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Δinterpolation3(
|
||||
prefix: string, v0: any, i0: string, v1: any, i1: string, v2: any, suffix: string): string|
|
||||
NO_CHANGE {
|
||||
const lView = getLView();
|
||||
@ -114,8 +126,12 @@ export function interpolation3(
|
||||
NO_CHANGE;
|
||||
}
|
||||
|
||||
/** Create an interpolation binding with 4 expressions. */
|
||||
export function interpolation4(
|
||||
/**
|
||||
* Create an interpolation binding with 4 expressions.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Δinterpolation4(
|
||||
prefix: string, v0: any, i0: string, v1: any, i1: string, v2: any, i2: string, v3: any,
|
||||
suffix: string): string|NO_CHANGE {
|
||||
const lView = getLView();
|
||||
@ -138,8 +154,12 @@ export function interpolation4(
|
||||
NO_CHANGE;
|
||||
}
|
||||
|
||||
/** Creates an interpolation binding with 5 expressions. */
|
||||
export function interpolation5(
|
||||
/**
|
||||
* Creates an interpolation binding with 5 expressions.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Δinterpolation5(
|
||||
prefix: string, v0: any, i0: string, v1: any, i1: string, v2: any, i2: string, v3: any,
|
||||
i3: string, v4: any, suffix: string): string|NO_CHANGE {
|
||||
const lView = getLView();
|
||||
@ -164,8 +184,12 @@ export function interpolation5(
|
||||
NO_CHANGE;
|
||||
}
|
||||
|
||||
/** Creates an interpolation binding with 6 expressions. */
|
||||
export function interpolation6(
|
||||
/**
|
||||
* Creates an interpolation binding with 6 expressions.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Δinterpolation6(
|
||||
prefix: string, v0: any, i0: string, v1: any, i1: string, v2: any, i2: string, v3: any,
|
||||
i3: string, v4: any, i4: string, v5: any, suffix: string): string|NO_CHANGE {
|
||||
const lView = getLView();
|
||||
@ -191,8 +215,12 @@ export function interpolation6(
|
||||
NO_CHANGE;
|
||||
}
|
||||
|
||||
/** Creates an interpolation binding with 7 expressions. */
|
||||
export function interpolation7(
|
||||
/**
|
||||
* Creates an interpolation binding with 7 expressions.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Δinterpolation7(
|
||||
prefix: string, v0: any, i0: string, v1: any, i1: string, v2: any, i2: string, v3: any,
|
||||
i3: string, v4: any, i4: string, v5: any, i5: string, v6: any, suffix: string): string|
|
||||
NO_CHANGE {
|
||||
@ -221,8 +249,12 @@ export function interpolation7(
|
||||
NO_CHANGE;
|
||||
}
|
||||
|
||||
/** Creates an interpolation binding with 8 expressions. */
|
||||
export function interpolation8(
|
||||
/**
|
||||
* Creates an interpolation binding with 8 expressions.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Δinterpolation8(
|
||||
prefix: string, v0: any, i0: string, v1: any, i1: string, v2: any, i2: string, v3: any,
|
||||
i3: string, v4: any, i4: string, v5: any, i5: string, v6: any, i6: string, v7: any,
|
||||
suffix: string): string|NO_CHANGE {
|
||||
|
@ -18,18 +18,20 @@ import {getCheckNoChangesMode, getLView, setSelectedIndex} from '../state';
|
||||
*
|
||||
* ```ts
|
||||
* (rf: RenderFlags, ctx: any) => {
|
||||
* if (rf & 1) {
|
||||
* element(0, 'div');
|
||||
* }
|
||||
* if (rf & 2) {
|
||||
* select(0); // Select the <div/> created above.
|
||||
* property('title', 'test');
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
* @param index the index of the item to act on with the following instructions
|
||||
*/
|
||||
export function select(index: number): void {
|
||||
* if (rf & 1) {
|
||||
* element(0, 'div');
|
||||
* }
|
||||
* if (rf & 2) {
|
||||
* select(0); // Select the <div/> created above.
|
||||
* property('title', 'test');
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
* @param index the index of the item to act on with the following instructions
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Δselect(index: number): void {
|
||||
ngDevMode && assertGreaterThan(index, -1, 'Invalid index');
|
||||
ngDevMode &&
|
||||
assertLessThan(
|
||||
|
@ -27,7 +27,7 @@ import {StylingContext} from '../interfaces/styling';
|
||||
import {BINDING_INDEX, CHILD_HEAD, CHILD_TAIL, CLEANUP, CONTEXT, DECLARATION_VIEW, ExpandoInstructions, FLAGS, HEADER_OFFSET, HOST, INJECTOR, InitPhaseState, LView, LViewFlags, NEXT, PARENT, QUERIES, RENDERER, RENDERER_FACTORY, RootContext, RootContextFlags, SANITIZER, TVIEW, TView, T_HOST} from '../interfaces/view';
|
||||
import {assertNodeOfPossibleTypes, assertNodeType} from '../node_assert';
|
||||
import {isNodeMatchingSelectorList} from '../node_selector_matcher';
|
||||
import {enterView, getBindingsEnabled, getCheckNoChangesMode, getIsParent, getLView, getNamespace, getPreviousOrParentTNode, incrementActiveDirectiveId, isCreationMode, leaveView, namespaceHTML, resetComponentState, setActiveHostElement, setBindingRoot, setCheckNoChangesMode, setCurrentDirectiveDef, setCurrentQueryIndex, setIsParent, setPreviousOrParentTNode, setSelectedIndex} from '../state';
|
||||
import {enterView, getBindingsEnabled, getCheckNoChangesMode, getIsParent, getLView, getNamespace, getPreviousOrParentTNode, incrementActiveDirectiveId, isCreationMode, leaveView, resetComponentState, setActiveHostElement, setBindingRoot, setCheckNoChangesMode, setCurrentDirectiveDef, setCurrentQueryIndex, setIsParent, setPreviousOrParentTNode, setSelectedIndex, ΔnamespaceHTML} from '../state';
|
||||
import {initializeStaticContext as initializeStaticStylingContext} from '../styling/class_and_style_bindings';
|
||||
import {NO_CHANGE} from '../tokens';
|
||||
import {attrsStylingIndexOf} from '../util/attrs_utils';
|
||||
@ -36,6 +36,7 @@ import {getLViewParent, getRootContext} from '../util/view_traversal_utils';
|
||||
import {getComponentViewByIndex, getNativeByTNode, isComponentDef, isContentQueryHost, isRootView, readPatchedLView, resetPreOrderHookFlags, unwrapRNode, viewAttachedToChangeDetector} from '../util/view_utils';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* A permanent marker promise which signifies that the current CD tree is
|
||||
* clean.
|
||||
@ -426,7 +427,7 @@ export function renderEmbeddedTemplate<T>(viewToRender: LView, tView: TView, con
|
||||
|
||||
oldView = enterView(viewToRender, viewToRender[T_HOST]);
|
||||
resetPreOrderHookFlags(viewToRender);
|
||||
namespaceHTML();
|
||||
ΔnamespaceHTML();
|
||||
|
||||
// Reset the selected index so we can assert that `select` was called later
|
||||
ngDevMode && setSelectedIndex(-1);
|
||||
@ -461,7 +462,7 @@ function renderComponentOrTemplate<T>(
|
||||
if (creationModeIsActive) {
|
||||
// creation mode pass
|
||||
if (templateFn) {
|
||||
namespaceHTML();
|
||||
ΔnamespaceHTML();
|
||||
|
||||
// Reset the selected index so we can assert that `select` was called later
|
||||
ngDevMode && setSelectedIndex(-1);
|
||||
@ -1510,7 +1511,7 @@ export function checkView<T>(hostView: LView, component: T) {
|
||||
|
||||
try {
|
||||
resetPreOrderHookFlags(hostView);
|
||||
namespaceHTML();
|
||||
ΔnamespaceHTML();
|
||||
creationMode && executeViewQueryFn(RenderFlags.Create, hostTView, component);
|
||||
|
||||
// Reset the selected index so we can assert that `select` was called later
|
||||
|
@ -30,13 +30,19 @@ export function store<T>(index: number, value: T): void {
|
||||
* with a nextContext() call, which walks up the tree and updates the contextViewData instance.
|
||||
*
|
||||
* @param index The index of the local ref in contextViewData.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function reference<T>(index: number) {
|
||||
export function Δreference<T>(index: number) {
|
||||
const contextLView = getContextLView();
|
||||
return loadInternal<T>(contextLView, index);
|
||||
}
|
||||
|
||||
/** Retrieves a value from current `viewData`. */
|
||||
export function load<T>(index: number): T {
|
||||
/**
|
||||
* Retrieves a value from current `viewData`.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Δload<T>(index: number): T {
|
||||
return loadInternal<T>(getLView(), index);
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ import {scheduleTick, setInputsForProperty} from './shared';
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function elementStyling(
|
||||
export function ΔelementStyling(
|
||||
classBindingNames?: string[] | null, styleBindingNames?: string[] | null,
|
||||
styleSanitizer?: StyleSanitizeFn | null): void {
|
||||
const tNode = getPreviousOrParentTNode();
|
||||
@ -106,7 +106,7 @@ export function elementStyling(
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function elementHostStyling(
|
||||
export function ΔelementHostStyling(
|
||||
classBindingNames?: string[] | null, styleBindingNames?: string[] | null,
|
||||
styleSanitizer?: StyleSanitizeFn | null): void {
|
||||
const tNode = getPreviousOrParentTNode();
|
||||
@ -166,7 +166,7 @@ function initElementStyling(
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function elementStyleProp(
|
||||
export function ΔelementStyleProp(
|
||||
index: number, styleIndex: number, value: string | number | String | PlayerFactory | null,
|
||||
suffix?: string | null, forceOverride?: boolean): void {
|
||||
const valueToAdd = resolveStylePropValue(value, suffix);
|
||||
@ -200,7 +200,7 @@ export function elementStyleProp(
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function elementHostStyleProp(
|
||||
export function ΔelementHostStyleProp(
|
||||
styleIndex: number, value: string | number | String | PlayerFactory | null,
|
||||
suffix?: string | null, forceOverride?: boolean): void {
|
||||
const directiveStylingIndex = getActiveDirectiveStylingIndex();
|
||||
@ -253,7 +253,7 @@ function resolveStylePropValue(
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function elementClassProp(
|
||||
export function ΔelementClassProp(
|
||||
index: number, classIndex: number, value: boolean | PlayerFactory,
|
||||
forceOverride?: boolean): void {
|
||||
const input = (value instanceof BoundPlayerFactory) ?
|
||||
@ -283,7 +283,7 @@ export function elementClassProp(
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function elementHostClassProp(
|
||||
export function ΔelementHostClassProp(
|
||||
classIndex: number, value: boolean | PlayerFactory, forceOverride?: boolean): void {
|
||||
const directiveStylingIndex = getActiveDirectiveStylingIndex();
|
||||
const hostElementIndex = getSelectedIndex();
|
||||
@ -326,7 +326,7 @@ function booleanOrNull(value: any): boolean|null {
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function elementStylingMap(
|
||||
export function ΔelementStylingMap(
|
||||
index: number, classes: {[key: string]: any} | string | NO_CHANGE | null,
|
||||
styles?: {[styleName: string]: any} | NO_CHANGE | null): void {
|
||||
const lView = getLView();
|
||||
@ -379,7 +379,7 @@ export function elementStylingMap(
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function elementHostStylingMap(
|
||||
export function ΔelementHostStylingMap(
|
||||
classes: {[key: string]: any} | string | NO_CHANGE | null,
|
||||
styles?: {[styleName: string]: any} | NO_CHANGE | null): void {
|
||||
const directiveStylingIndex = getActiveDirectiveStylingIndex();
|
||||
@ -405,7 +405,7 @@ export function elementHostStylingMap(
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function elementStylingApply(index: number): void {
|
||||
export function ΔelementStylingApply(index: number): void {
|
||||
elementStylingApplyInternal(DEFAULT_TEMPLATE_DIRECTIVE_INDEX, index);
|
||||
}
|
||||
|
||||
@ -419,7 +419,7 @@ export function elementStylingApply(index: number): void {
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function elementHostStylingApply(): void {
|
||||
export function ΔelementHostStylingApply(): void {
|
||||
elementStylingApplyInternal(getActiveDirectiveStylingIndex(), getSelectedIndex());
|
||||
}
|
||||
|
||||
@ -449,4 +449,4 @@ export function getActiveDirectiveStylingIndex() {
|
||||
// parent directive. To help the styling code distinguish between a parent
|
||||
// sub-classed directive the inheritance depth is taken into account as well.
|
||||
return getActiveDirectiveId() + getActiveDirectiveSuperClassDepth();
|
||||
}
|
||||
}
|
||||
|
@ -21,8 +21,10 @@ import {createNodeAtIndex} from './shared';
|
||||
*
|
||||
* @param index Index of the node in the data array
|
||||
* @param value Value to write. This value will be stringified.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function text(index: number, value?: any): void {
|
||||
export function Δtext(index: number, value?: any): void {
|
||||
const lView = getLView();
|
||||
ngDevMode && assertEqual(
|
||||
lView[BINDING_INDEX], lView[TVIEW].bindingStartIndex,
|
||||
@ -42,8 +44,10 @@ export function text(index: number, value?: any): void {
|
||||
*
|
||||
* @param index Index of the node in the data array.
|
||||
* @param value Stringified value to write.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function textBinding<T>(index: number, value: T | NO_CHANGE): void {
|
||||
export function ΔtextBinding<T>(index: number, value: T | NO_CHANGE): void {
|
||||
if (value !== NO_CHANGE) {
|
||||
const lView = getLView();
|
||||
ngDevMode && assertDataInRange(lView, index + HEADER_OFFSET);
|
||||
|
@ -85,7 +85,10 @@ export const enum DirectiveDefFlags {ContentQuery = 0b10}
|
||||
*/
|
||||
export interface PipeType<T> extends Type<T> { ngPipeDef: never; }
|
||||
|
||||
export type DirectiveDefWithMeta<
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export type ΔDirectiveDefWithMeta<
|
||||
T, Selector extends string, ExportAs extends string[], InputMap extends{[key: string]: string},
|
||||
OutputMap extends{[key: string]: string}, QueryFields extends string[]> = DirectiveDef<T>;
|
||||
|
||||
@ -97,8 +100,10 @@ export type DirectiveDefWithMeta<
|
||||
* and outputs should be inherited.
|
||||
*
|
||||
* See: {@link defineBase}
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface BaseDef<T> {
|
||||
export interface ΔBaseDef<T> {
|
||||
/**
|
||||
* A dictionary mapping the inputs' minified property names to their public API names, which
|
||||
* are their aliases if any, or their original unminified property names
|
||||
@ -134,7 +139,7 @@ export interface BaseDef<T> {
|
||||
*
|
||||
* See: {@link defineDirective}
|
||||
*/
|
||||
export interface DirectiveDef<T> extends BaseDef<T> {
|
||||
export interface DirectiveDef<T> extends ΔBaseDef<T> {
|
||||
/** Token representing the directive. Used by DI. */
|
||||
type: Type<T>;
|
||||
|
||||
@ -194,7 +199,10 @@ export interface DirectiveDef<T> extends BaseDef<T> {
|
||||
privateName: string) => void)|null;
|
||||
}
|
||||
|
||||
export type ComponentDefWithMeta<
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export type ΔComponentDefWithMeta<
|
||||
T, Selector extends String, ExportAs extends string[], InputMap extends{[key: string]: string},
|
||||
OutputMap extends{[key: string]: string}, QueryFields extends string[]> = ComponentDef<T>;
|
||||
|
||||
@ -338,7 +346,10 @@ export interface PipeDef<T> {
|
||||
onDestroy: (() => void)|null;
|
||||
}
|
||||
|
||||
export type PipeDefWithMeta<T, Name extends string> = PipeDef<T>;
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export type ΔPipeDefWithMeta<T, Name extends string> = PipeDef<T>;
|
||||
|
||||
export interface DirectiveDefFeature {
|
||||
<T>(directiveDef: DirectiveDef<T>): void;
|
||||
|
@ -6,8 +6,8 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {defineInjectable, defineInjector,} from '../../di/interface/defs';
|
||||
import {inject} from '../../di/injector_compatibility';
|
||||
import {ΔdefineInjectable, ΔdefineInjector,} from '../../di/interface/defs';
|
||||
import {Δinject} from '../../di/injector_compatibility';
|
||||
import * as r3 from '../index';
|
||||
import * as sanitization from '../../sanitization/sanitization';
|
||||
|
||||
@ -18,116 +18,116 @@ import * as sanitization from '../../sanitization/sanitization';
|
||||
* This should be kept up to date with the public exports of @angular/core.
|
||||
*/
|
||||
export const angularCoreEnv: {[name: string]: Function} = {
|
||||
'ɵdefineBase': r3.defineBase,
|
||||
'ɵdefineComponent': r3.defineComponent,
|
||||
'ɵdefineDirective': r3.defineDirective,
|
||||
'defineInjectable': defineInjectable,
|
||||
'defineInjector': defineInjector,
|
||||
'ɵdefineNgModule': r3.defineNgModule,
|
||||
'ɵdefinePipe': r3.definePipe,
|
||||
'ɵdirectiveInject': r3.directiveInject,
|
||||
'ɵgetFactoryOf': r3.getFactoryOf,
|
||||
'ɵgetInheritedFactory': r3.getInheritedFactory,
|
||||
'inject': inject,
|
||||
'ɵinjectAttribute': r3.injectAttribute,
|
||||
'ɵtemplateRefExtractor': r3.templateRefExtractor,
|
||||
'ɵNgOnChangesFeature': r3.NgOnChangesFeature,
|
||||
'ɵProvidersFeature': r3.ProvidersFeature,
|
||||
'ɵInheritDefinitionFeature': r3.InheritDefinitionFeature,
|
||||
'ɵelementAttribute': r3.elementAttribute,
|
||||
'ɵbind': r3.bind,
|
||||
'ɵcontainer': r3.container,
|
||||
'ɵnextContext': r3.nextContext,
|
||||
'ɵcontainerRefreshStart': r3.containerRefreshStart,
|
||||
'ɵcontainerRefreshEnd': r3.containerRefreshEnd,
|
||||
'ɵnamespaceHTML': r3.namespaceHTML,
|
||||
'ɵnamespaceMathML': r3.namespaceMathML,
|
||||
'ɵnamespaceSVG': r3.namespaceSVG,
|
||||
'ɵenableBindings': r3.enableBindings,
|
||||
'ɵdisableBindings': r3.disableBindings,
|
||||
'ɵallocHostVars': r3.allocHostVars,
|
||||
'ɵelementStart': r3.elementStart,
|
||||
'ɵelementEnd': r3.elementEnd,
|
||||
'ɵelement': r3.element,
|
||||
'ɵelementContainerStart': r3.elementContainerStart,
|
||||
'ɵelementContainerEnd': r3.elementContainerEnd,
|
||||
'ɵpureFunction0': r3.pureFunction0,
|
||||
'ɵpureFunction1': r3.pureFunction1,
|
||||
'ɵpureFunction2': r3.pureFunction2,
|
||||
'ɵpureFunction3': r3.pureFunction3,
|
||||
'ɵpureFunction4': r3.pureFunction4,
|
||||
'ɵpureFunction5': r3.pureFunction5,
|
||||
'ɵpureFunction6': r3.pureFunction6,
|
||||
'ɵpureFunction7': r3.pureFunction7,
|
||||
'ɵpureFunction8': r3.pureFunction8,
|
||||
'ɵpureFunctionV': r3.pureFunctionV,
|
||||
'ɵgetCurrentView': r3.getCurrentView,
|
||||
'ɵrestoreView': r3.restoreView,
|
||||
'ɵinterpolation1': r3.interpolation1,
|
||||
'ɵinterpolation2': r3.interpolation2,
|
||||
'ɵinterpolation3': r3.interpolation3,
|
||||
'ɵinterpolation4': r3.interpolation4,
|
||||
'ɵinterpolation5': r3.interpolation5,
|
||||
'ɵinterpolation6': r3.interpolation6,
|
||||
'ɵinterpolation7': r3.interpolation7,
|
||||
'ɵinterpolation8': r3.interpolation8,
|
||||
'ɵinterpolationV': r3.interpolationV,
|
||||
'ɵlistener': r3.listener,
|
||||
'ɵload': r3.load,
|
||||
'ɵprojection': r3.projection,
|
||||
'ɵelementProperty': r3.elementProperty,
|
||||
'ɵcomponentHostSyntheticProperty': r3.componentHostSyntheticProperty,
|
||||
'ɵcomponentHostSyntheticListener': r3.componentHostSyntheticListener,
|
||||
'ɵpipeBind1': r3.pipeBind1,
|
||||
'ɵpipeBind2': r3.pipeBind2,
|
||||
'ɵpipeBind3': r3.pipeBind3,
|
||||
'ɵpipeBind4': r3.pipeBind4,
|
||||
'ɵpipeBindV': r3.pipeBindV,
|
||||
'ɵprojectionDef': r3.projectionDef,
|
||||
'ɵpipe': r3.pipe,
|
||||
'ɵqueryRefresh': r3.queryRefresh,
|
||||
'ɵviewQuery': r3.viewQuery,
|
||||
'ɵstaticViewQuery': r3.staticViewQuery,
|
||||
'ɵstaticContentQuery': r3.staticContentQuery,
|
||||
'ɵloadViewQuery': r3.loadViewQuery,
|
||||
'ɵcontentQuery': r3.contentQuery,
|
||||
'ɵloadContentQuery': r3.loadContentQuery,
|
||||
'ɵreference': r3.reference,
|
||||
'ɵelementHostAttrs': r3.elementHostAttrs,
|
||||
'ɵelementStyling': r3.elementStyling,
|
||||
'ɵelementStylingMap': r3.elementStylingMap,
|
||||
'ɵelementStyleProp': r3.elementStyleProp,
|
||||
'ɵelementStylingApply': r3.elementStylingApply,
|
||||
'ɵelementClassProp': r3.elementClassProp,
|
||||
'ɵelementHostStyling': r3.elementHostStyling,
|
||||
'ɵelementHostStylingMap': r3.elementHostStylingMap,
|
||||
'ɵelementHostStyleProp': r3.elementHostStyleProp,
|
||||
'ɵelementHostStylingApply': r3.elementHostStylingApply,
|
||||
'ɵelementHostClassProp': r3.elementHostClassProp,
|
||||
'ɵselect': r3.select,
|
||||
'ɵtemplate': r3.template,
|
||||
'ɵtext': r3.text,
|
||||
'ɵtextBinding': r3.textBinding,
|
||||
'ɵembeddedViewStart': r3.embeddedViewStart,
|
||||
'ɵembeddedViewEnd': r3.embeddedViewEnd,
|
||||
'ɵi18n': r3.i18n,
|
||||
'ɵi18nAttributes': r3.i18nAttributes,
|
||||
'ɵi18nExp': r3.i18nExp,
|
||||
'ɵi18nStart': r3.i18nStart,
|
||||
'ɵi18nEnd': r3.i18nEnd,
|
||||
'ɵi18nApply': r3.i18nApply,
|
||||
'ɵi18nPostprocess': r3.i18nPostprocess,
|
||||
'ɵresolveWindow': r3.resolveWindow,
|
||||
'ɵresolveDocument': r3.resolveDocument,
|
||||
'ɵresolveBody': r3.resolveBody,
|
||||
'ɵsetComponentScope': r3.setComponentScope,
|
||||
'ɵsetNgModuleScope': r3.setNgModuleScope,
|
||||
'ΔdefineBase': r3.ΔdefineBase,
|
||||
'ΔdefineComponent': r3.ΔdefineComponent,
|
||||
'ΔdefineDirective': r3.ΔdefineDirective,
|
||||
'ΔdefineInjectable': ΔdefineInjectable,
|
||||
'ΔdefineInjector': ΔdefineInjector,
|
||||
'ΔdefineNgModule': r3.ΔdefineNgModule,
|
||||
'ΔdefinePipe': r3.ΔdefinePipe,
|
||||
'ΔdirectiveInject': r3.ΔdirectiveInject,
|
||||
'ΔgetFactoryOf': r3.ΔgetFactoryOf,
|
||||
'ΔgetInheritedFactory': r3.ΔgetInheritedFactory,
|
||||
'Δinject': Δinject,
|
||||
'ΔinjectAttribute': r3.ΔinjectAttribute,
|
||||
'ΔtemplateRefExtractor': r3.ΔtemplateRefExtractor,
|
||||
'ΔNgOnChangesFeature': r3.ΔNgOnChangesFeature,
|
||||
'ΔProvidersFeature': r3.ΔProvidersFeature,
|
||||
'ΔInheritDefinitionFeature': r3.ΔInheritDefinitionFeature,
|
||||
'ΔelementAttribute': r3.ΔelementAttribute,
|
||||
'Δbind': r3.Δbind,
|
||||
'Δcontainer': r3.Δcontainer,
|
||||
'ΔnextContext': r3.ΔnextContext,
|
||||
'ΔcontainerRefreshStart': r3.ΔcontainerRefreshStart,
|
||||
'ΔcontainerRefreshEnd': r3.ΔcontainerRefreshEnd,
|
||||
'ΔnamespaceHTML': r3.ΔnamespaceHTML,
|
||||
'ΔnamespaceMathML': r3.ΔnamespaceMathML,
|
||||
'ΔnamespaceSVG': r3.ΔnamespaceSVG,
|
||||
'ΔenableBindings': r3.ΔenableBindings,
|
||||
'ΔdisableBindings': r3.ΔdisableBindings,
|
||||
'ΔallocHostVars': r3.ΔallocHostVars,
|
||||
'ΔelementStart': r3.ΔelementStart,
|
||||
'ΔelementEnd': r3.ΔelementEnd,
|
||||
'Δelement': r3.Δelement,
|
||||
'ΔelementContainerStart': r3.ΔelementContainerStart,
|
||||
'ΔelementContainerEnd': r3.ΔelementContainerEnd,
|
||||
'ΔpureFunction0': r3.ΔpureFunction0,
|
||||
'ΔpureFunction1': r3.ΔpureFunction1,
|
||||
'ΔpureFunction2': r3.ΔpureFunction2,
|
||||
'ΔpureFunction3': r3.ΔpureFunction3,
|
||||
'ΔpureFunction4': r3.ΔpureFunction4,
|
||||
'ΔpureFunction5': r3.ΔpureFunction5,
|
||||
'ΔpureFunction6': r3.ΔpureFunction6,
|
||||
'ΔpureFunction7': r3.ΔpureFunction7,
|
||||
'ΔpureFunction8': r3.ΔpureFunction8,
|
||||
'ΔpureFunctionV': r3.ΔpureFunctionV,
|
||||
'ΔgetCurrentView': r3.ΔgetCurrentView,
|
||||
'ΔrestoreView': r3.ΔrestoreView,
|
||||
'Δinterpolation1': r3.Δinterpolation1,
|
||||
'Δinterpolation2': r3.Δinterpolation2,
|
||||
'Δinterpolation3': r3.Δinterpolation3,
|
||||
'Δinterpolation4': r3.Δinterpolation4,
|
||||
'Δinterpolation5': r3.Δinterpolation5,
|
||||
'Δinterpolation6': r3.Δinterpolation6,
|
||||
'Δinterpolation7': r3.Δinterpolation7,
|
||||
'Δinterpolation8': r3.Δinterpolation8,
|
||||
'ΔinterpolationV': r3.ΔinterpolationV,
|
||||
'Δlistener': r3.Δlistener,
|
||||
'Δload': r3.Δload,
|
||||
'Δprojection': r3.Δprojection,
|
||||
'ΔelementProperty': r3.ΔelementProperty,
|
||||
'ΔcomponentHostSyntheticProperty': r3.ΔcomponentHostSyntheticProperty,
|
||||
'ΔcomponentHostSyntheticListener': r3.ΔcomponentHostSyntheticListener,
|
||||
'ΔpipeBind1': r3.ΔpipeBind1,
|
||||
'ΔpipeBind2': r3.ΔpipeBind2,
|
||||
'ΔpipeBind3': r3.ΔpipeBind3,
|
||||
'ΔpipeBind4': r3.ΔpipeBind4,
|
||||
'ΔpipeBindV': r3.ΔpipeBindV,
|
||||
'ΔprojectionDef': r3.ΔprojectionDef,
|
||||
'Δpipe': r3.Δpipe,
|
||||
'ΔqueryRefresh': r3.ΔqueryRefresh,
|
||||
'ΔviewQuery': r3.ΔviewQuery,
|
||||
'ΔstaticViewQuery': r3.ΔstaticViewQuery,
|
||||
'ΔstaticContentQuery': r3.ΔstaticContentQuery,
|
||||
'ΔloadViewQuery': r3.ΔloadViewQuery,
|
||||
'ΔcontentQuery': r3.ΔcontentQuery,
|
||||
'ΔloadContentQuery': r3.ΔloadContentQuery,
|
||||
'Δreference': r3.Δreference,
|
||||
'ΔelementHostAttrs': r3.ΔelementHostAttrs,
|
||||
'ΔelementStyling': r3.ΔelementStyling,
|
||||
'ΔelementStylingMap': r3.ΔelementStylingMap,
|
||||
'ΔelementStyleProp': r3.ΔelementStyleProp,
|
||||
'ΔelementStylingApply': r3.ΔelementStylingApply,
|
||||
'ΔelementClassProp': r3.ΔelementClassProp,
|
||||
'ΔelementHostStyling': r3.ΔelementHostStyling,
|
||||
'ΔelementHostStylingMap': r3.ΔelementHostStylingMap,
|
||||
'ΔelementHostStyleProp': r3.ΔelementHostStyleProp,
|
||||
'ΔelementHostStylingApply': r3.ΔelementHostStylingApply,
|
||||
'ΔelementHostClassProp': r3.ΔelementHostClassProp,
|
||||
'Δselect': r3.Δselect,
|
||||
'Δtemplate': r3.Δtemplate,
|
||||
'Δtext': r3.Δtext,
|
||||
'ΔtextBinding': r3.ΔtextBinding,
|
||||
'ΔembeddedViewStart': r3.ΔembeddedViewStart,
|
||||
'ΔembeddedViewEnd': r3.ΔembeddedViewEnd,
|
||||
'Δi18n': r3.Δi18n,
|
||||
'Δi18nAttributes': r3.Δi18nAttributes,
|
||||
'Δi18nExp': r3.Δi18nExp,
|
||||
'Δi18nStart': r3.Δi18nStart,
|
||||
'Δi18nEnd': r3.Δi18nEnd,
|
||||
'Δi18nApply': r3.Δi18nApply,
|
||||
'Δi18nPostprocess': r3.Δi18nPostprocess,
|
||||
'ΔresolveWindow': r3.ΔresolveWindow,
|
||||
'ΔresolveDocument': r3.ΔresolveDocument,
|
||||
'ΔresolveBody': r3.ΔresolveBody,
|
||||
'ΔsetComponentScope': r3.ΔsetComponentScope,
|
||||
'ΔsetNgModuleScope': r3.ΔsetNgModuleScope,
|
||||
|
||||
'ɵsanitizeHtml': sanitization.sanitizeHtml,
|
||||
'ɵsanitizeStyle': sanitization.sanitizeStyle,
|
||||
'ɵdefaultStyleSanitizer': sanitization.defaultStyleSanitizer,
|
||||
'ɵsanitizeResourceUrl': sanitization.sanitizeResourceUrl,
|
||||
'ɵsanitizeScript': sanitization.sanitizeScript,
|
||||
'ɵsanitizeUrl': sanitization.sanitizeUrl,
|
||||
'ɵsanitizeUrlOrResourceUrl': sanitization.sanitizeUrlOrResourceUrl
|
||||
'ΔsanitizeHtml': sanitization.ΔsanitizeHtml,
|
||||
'ΔsanitizeStyle': sanitization.ΔsanitizeStyle,
|
||||
'ΔdefaultStyleSanitizer': sanitization.ΔdefaultStyleSanitizer,
|
||||
'ΔsanitizeResourceUrl': sanitization.ΔsanitizeResourceUrl,
|
||||
'ΔsanitizeScript': sanitization.ΔsanitizeScript,
|
||||
'ΔsanitizeUrl': sanitization.ΔsanitizeUrl,
|
||||
'ΔsanitizeUrlOrResourceUrl': sanitization.ΔsanitizeUrlOrResourceUrl
|
||||
};
|
||||
|
@ -9,22 +9,25 @@
|
||||
import {WrappedValue} from '../change_detection/change_detection_util';
|
||||
import {PipeTransform} from '../change_detection/pipe_transform';
|
||||
|
||||
import {load, store} from './instructions/all';
|
||||
import {store, Δload} from './instructions/all';
|
||||
import {PipeDef, PipeDefList} from './interfaces/definition';
|
||||
import {BINDING_INDEX, HEADER_OFFSET, TVIEW} from './interfaces/view';
|
||||
import {pureFunction1, pureFunction2, pureFunction3, pureFunction4, pureFunctionV} from './pure_function';
|
||||
import {ΔpureFunction1, ΔpureFunction2, ΔpureFunction3, ΔpureFunction4, ΔpureFunctionV} from './pure_function';
|
||||
import {getLView} from './state';
|
||||
import {NO_CHANGE} from './tokens';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create a pipe.
|
||||
*
|
||||
* @param index Pipe index where the pipe will be stored.
|
||||
* @param pipeName The name of the pipe
|
||||
* @returns T the instance of the pipe.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function pipe(index: number, pipeName: string): any {
|
||||
export function Δpipe(index: number, pipeName: string): any {
|
||||
const tView = getLView()[TVIEW];
|
||||
let pipeDef: PipeDef<any>;
|
||||
const adjustedIndex = index + HEADER_OFFSET;
|
||||
@ -51,6 +54,8 @@ export function pipe(index: number, pipeName: string): any {
|
||||
* @param name Name of pipe to resolve
|
||||
* @param registry Full list of available pipes
|
||||
* @returns Matching PipeDef
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
function getPipeDef(name: string, registry: PipeDefList | null): PipeDef<any> {
|
||||
if (registry) {
|
||||
@ -73,11 +78,13 @@ function getPipeDef(name: string, registry: PipeDefList | null): PipeDef<any> {
|
||||
* @param index Pipe index where the pipe was stored on creation.
|
||||
* @param slotOffset the offset in the reserved slot space
|
||||
* @param v1 1st argument to {@link PipeTransform#transform}.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function pipeBind1(index: number, slotOffset: number, v1: any): any {
|
||||
const pipeInstance = load<PipeTransform>(index);
|
||||
export function ΔpipeBind1(index: number, slotOffset: number, v1: any): any {
|
||||
const pipeInstance = Δload<PipeTransform>(index);
|
||||
return unwrapValue(
|
||||
isPure(index) ? pureFunction1(slotOffset, pipeInstance.transform, v1, pipeInstance) :
|
||||
isPure(index) ? ΔpureFunction1(slotOffset, pipeInstance.transform, v1, pipeInstance) :
|
||||
pipeInstance.transform(v1));
|
||||
}
|
||||
|
||||
@ -91,11 +98,13 @@ export function pipeBind1(index: number, slotOffset: number, v1: any): any {
|
||||
* @param slotOffset the offset in the reserved slot space
|
||||
* @param v1 1st argument to {@link PipeTransform#transform}.
|
||||
* @param v2 2nd argument to {@link PipeTransform#transform}.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function pipeBind2(index: number, slotOffset: number, v1: any, v2: any): any {
|
||||
const pipeInstance = load<PipeTransform>(index);
|
||||
export function ΔpipeBind2(index: number, slotOffset: number, v1: any, v2: any): any {
|
||||
const pipeInstance = Δload<PipeTransform>(index);
|
||||
return unwrapValue(
|
||||
isPure(index) ? pureFunction2(slotOffset, pipeInstance.transform, v1, v2, pipeInstance) :
|
||||
isPure(index) ? ΔpureFunction2(slotOffset, pipeInstance.transform, v1, v2, pipeInstance) :
|
||||
pipeInstance.transform(v1, v2));
|
||||
}
|
||||
|
||||
@ -110,11 +119,13 @@ export function pipeBind2(index: number, slotOffset: number, v1: any, v2: any):
|
||||
* @param v1 1st argument to {@link PipeTransform#transform}.
|
||||
* @param v2 2nd argument to {@link PipeTransform#transform}.
|
||||
* @param v3 4rd argument to {@link PipeTransform#transform}.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function pipeBind3(index: number, slotOffset: number, v1: any, v2: any, v3: any): any {
|
||||
const pipeInstance = load<PipeTransform>(index);
|
||||
export function ΔpipeBind3(index: number, slotOffset: number, v1: any, v2: any, v3: any): any {
|
||||
const pipeInstance = Δload<PipeTransform>(index);
|
||||
return unwrapValue(
|
||||
isPure(index) ? pureFunction3(slotOffset, pipeInstance.transform, v1, v2, v3, pipeInstance) :
|
||||
isPure(index) ? ΔpureFunction3(slotOffset, pipeInstance.transform, v1, v2, v3, pipeInstance) :
|
||||
pipeInstance.transform(v1, v2, v3));
|
||||
}
|
||||
|
||||
@ -130,13 +141,15 @@ export function pipeBind3(index: number, slotOffset: number, v1: any, v2: any, v
|
||||
* @param v2 2nd argument to {@link PipeTransform#transform}.
|
||||
* @param v3 3rd argument to {@link PipeTransform#transform}.
|
||||
* @param v4 4th argument to {@link PipeTransform#transform}.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function pipeBind4(
|
||||
export function ΔpipeBind4(
|
||||
index: number, slotOffset: number, v1: any, v2: any, v3: any, v4: any): any {
|
||||
const pipeInstance = load<PipeTransform>(index);
|
||||
const pipeInstance = Δload<PipeTransform>(index);
|
||||
return unwrapValue(
|
||||
isPure(index) ?
|
||||
pureFunction4(slotOffset, pipeInstance.transform, v1, v2, v3, v4, pipeInstance) :
|
||||
ΔpureFunction4(slotOffset, pipeInstance.transform, v1, v2, v3, v4, pipeInstance) :
|
||||
pipeInstance.transform(v1, v2, v3, v4));
|
||||
}
|
||||
|
||||
@ -149,11 +162,13 @@ export function pipeBind4(
|
||||
* @param index Pipe index where the pipe was stored on creation.
|
||||
* @param slotOffset the offset in the reserved slot space
|
||||
* @param values Array of arguments to pass to {@link PipeTransform#transform} method.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function pipeBindV(index: number, slotOffset: number, values: any[]): any {
|
||||
const pipeInstance = load<PipeTransform>(index);
|
||||
export function ΔpipeBindV(index: number, slotOffset: number, values: any[]): any {
|
||||
const pipeInstance = Δload<PipeTransform>(index);
|
||||
return unwrapValue(
|
||||
isPure(index) ? pureFunctionV(slotOffset, pipeInstance.transform, values, pipeInstance) :
|
||||
isPure(index) ? ΔpureFunctionV(slotOffset, pipeInstance.transform, values, pipeInstance) :
|
||||
pipeInstance.transform.apply(pipeInstance, values));
|
||||
}
|
||||
|
||||
|
@ -37,8 +37,10 @@ import {getBindingRoot, getLView, isCreationMode} from './state';
|
||||
* @param pureFn Function that returns a value
|
||||
* @param thisArg Optional calling context of pureFn
|
||||
* @returns value
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function pureFunction0<T>(slotOffset: number, pureFn: () => T, thisArg?: any): T {
|
||||
export function ΔpureFunction0<T>(slotOffset: number, pureFn: () => T, thisArg?: any): T {
|
||||
// TODO(kara): use bindingRoot instead of bindingStartIndex when implementing host bindings
|
||||
const bindingIndex = getBindingRoot() + slotOffset;
|
||||
const lView = getLView();
|
||||
@ -56,8 +58,10 @@ export function pureFunction0<T>(slotOffset: number, pureFn: () => T, thisArg?:
|
||||
* @param exp Updated expression value
|
||||
* @param thisArg Optional calling context of pureFn
|
||||
* @returns Updated or cached value
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function pureFunction1(
|
||||
export function ΔpureFunction1(
|
||||
slotOffset: number, pureFn: (v: any) => any, exp: any, thisArg?: any): any {
|
||||
// TODO(kara): use bindingRoot instead of bindingStartIndex when implementing host bindings
|
||||
const lView = getLView();
|
||||
@ -77,8 +81,10 @@ export function pureFunction1(
|
||||
* @param exp2
|
||||
* @param thisArg Optional calling context of pureFn
|
||||
* @returns Updated or cached value
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function pureFunction2(
|
||||
export function ΔpureFunction2(
|
||||
slotOffset: number, pureFn: (v1: any, v2: any) => any, exp1: any, exp2: any,
|
||||
thisArg?: any): any {
|
||||
// TODO(kara): use bindingRoot instead of bindingStartIndex when implementing host bindings
|
||||
@ -102,8 +108,10 @@ export function pureFunction2(
|
||||
* @param exp3
|
||||
* @param thisArg Optional calling context of pureFn
|
||||
* @returns Updated or cached value
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function pureFunction3(
|
||||
export function ΔpureFunction3(
|
||||
slotOffset: number, pureFn: (v1: any, v2: any, v3: any) => any, exp1: any, exp2: any, exp3: any,
|
||||
thisArg?: any): any {
|
||||
// TODO(kara): use bindingRoot instead of bindingStartIndex when implementing host bindings
|
||||
@ -128,8 +136,10 @@ export function pureFunction3(
|
||||
* @param exp4
|
||||
* @param thisArg Optional calling context of pureFn
|
||||
* @returns Updated or cached value
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function pureFunction4(
|
||||
export function ΔpureFunction4(
|
||||
slotOffset: number, pureFn: (v1: any, v2: any, v3: any, v4: any) => any, exp1: any, exp2: any,
|
||||
exp3: any, exp4: any, thisArg?: any): any {
|
||||
// TODO(kara): use bindingRoot instead of bindingStartIndex when implementing host bindings
|
||||
@ -155,8 +165,10 @@ export function pureFunction4(
|
||||
* @param exp5
|
||||
* @param thisArg Optional calling context of pureFn
|
||||
* @returns Updated or cached value
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function pureFunction5(
|
||||
export function ΔpureFunction5(
|
||||
slotOffset: number, pureFn: (v1: any, v2: any, v3: any, v4: any, v5: any) => any, exp1: any,
|
||||
exp2: any, exp3: any, exp4: any, exp5: any, thisArg?: any): any {
|
||||
// TODO(kara): use bindingRoot instead of bindingStartIndex when implementing host bindings
|
||||
@ -184,8 +196,10 @@ export function pureFunction5(
|
||||
* @param exp6
|
||||
* @param thisArg Optional calling context of pureFn
|
||||
* @returns Updated or cached value
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function pureFunction6(
|
||||
export function ΔpureFunction6(
|
||||
slotOffset: number, pureFn: (v1: any, v2: any, v3: any, v4: any, v5: any, v6: any) => any,
|
||||
exp1: any, exp2: any, exp3: any, exp4: any, exp5: any, exp6: any, thisArg?: any): any {
|
||||
// TODO(kara): use bindingRoot instead of bindingStartIndex when implementing host bindings
|
||||
@ -215,8 +229,10 @@ export function pureFunction6(
|
||||
* @param exp7
|
||||
* @param thisArg Optional calling context of pureFn
|
||||
* @returns Updated or cached value
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function pureFunction7(
|
||||
export function ΔpureFunction7(
|
||||
slotOffset: number,
|
||||
pureFn: (v1: any, v2: any, v3: any, v4: any, v5: any, v6: any, v7: any) => any, exp1: any,
|
||||
exp2: any, exp3: any, exp4: any, exp5: any, exp6: any, exp7: any, thisArg?: any): any {
|
||||
@ -248,8 +264,10 @@ export function pureFunction7(
|
||||
* @param exp8
|
||||
* @param thisArg Optional calling context of pureFn
|
||||
* @returns Updated or cached value
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function pureFunction8(
|
||||
export function ΔpureFunction8(
|
||||
slotOffset: number,
|
||||
pureFn: (v1: any, v2: any, v3: any, v4: any, v5: any, v6: any, v7: any, v8: any) => any,
|
||||
exp1: any, exp2: any, exp3: any, exp4: any, exp5: any, exp6: any, exp7: any, exp8: any,
|
||||
@ -278,8 +296,10 @@ export function pureFunction8(
|
||||
* @param exps An array of binding values
|
||||
* @param thisArg Optional calling context of pureFn
|
||||
* @returns Updated or cached value
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function pureFunctionV(
|
||||
export function ΔpureFunctionV(
|
||||
slotOffset: number, pureFn: (...v: any[]) => any, exps: any[], thisArg?: any): any {
|
||||
// TODO(kara): use bindingRoot instead of bindingStartIndex when implementing host bindings
|
||||
let bindingIndex = getBindingRoot() + slotOffset;
|
||||
|
@ -18,7 +18,7 @@ import {assertDataInRange, assertDefined, assertEqual} from '../util/assert';
|
||||
import {assertPreviousIsParent} from './assert';
|
||||
import {getNodeInjectable, locateDirectiveOrProvider} from './di';
|
||||
import {NG_ELEMENT_ID} from './fields';
|
||||
import {load, store} from './instructions/all';
|
||||
import {store, Δload} from './instructions/all';
|
||||
import {storeCleanupWithContext} from './instructions/shared';
|
||||
import {unusedValueExportToPlacateAjd as unused1} from './interfaces/definition';
|
||||
import {unusedValueExportToPlacateAjd as unused2} from './interfaces/injector';
|
||||
@ -369,8 +369,10 @@ export function query<T>(
|
||||
*
|
||||
* @returns `true` if a query got dirty during change detection or if this is a static query
|
||||
* resolving in creation mode, `false` otherwise.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function queryRefresh(queryList: QueryList<any>): boolean {
|
||||
export function ΔqueryRefresh(queryList: QueryList<any>): boolean {
|
||||
const queryListImpl = (queryList as any as QueryList_<any>);
|
||||
const creationMode = isCreationMode();
|
||||
|
||||
@ -389,11 +391,13 @@ export function queryRefresh(queryList: QueryList<any>): boolean {
|
||||
* @param predicate The type for which the query will search
|
||||
* @param descend Whether or not to descend into children
|
||||
* @param read What to save in the query
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function staticViewQuery<T>(
|
||||
export function ΔstaticViewQuery<T>(
|
||||
// TODO(FW-486): "read" should be an AbstractType
|
||||
predicate: Type<any>| string[], descend: boolean, read: any): void {
|
||||
const queryList = viewQuery(predicate, descend, read) as QueryList_<T>;
|
||||
const queryList = ΔviewQuery(predicate, descend, read) as QueryList_<T>;
|
||||
const tView = getLView()[TVIEW];
|
||||
queryList._static = true;
|
||||
if (!tView.staticViewQueries) {
|
||||
@ -408,8 +412,10 @@ export function staticViewQuery<T>(
|
||||
* @param descend Whether or not to descend into children
|
||||
* @param read What to save in the query
|
||||
* @returns QueryList<T>
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function viewQuery<T>(
|
||||
export function ΔviewQuery<T>(
|
||||
// TODO(FW-486): "read" should be an AbstractType
|
||||
predicate: Type<any>| string[], descend: boolean, read: any): QueryList<T> {
|
||||
const lView = getLView();
|
||||
@ -425,12 +431,14 @@ export function viewQuery<T>(
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads current View Query and moves the pointer/index to the next View Query in LView.
|
||||
*/
|
||||
export function loadViewQuery<T>(): T {
|
||||
* Loads current View Query and moves the pointer/index to the next View Query in LView.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function ΔloadViewQuery<T>(): T {
|
||||
const index = getCurrentQueryIndex();
|
||||
setCurrentQueryIndex(index + 1);
|
||||
return load<T>(index - HEADER_OFFSET);
|
||||
return Δload<T>(index - HEADER_OFFSET);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -442,8 +450,10 @@ export function loadViewQuery<T>(): T {
|
||||
* @param descend Whether or not to descend into children
|
||||
* @param read What to save in the query
|
||||
* @returns QueryList<T>
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function contentQuery<T>(
|
||||
export function ΔcontentQuery<T>(
|
||||
directiveIndex: number, predicate: Type<any>| string[], descend: boolean,
|
||||
// TODO(FW-486): "read" should be an AbstractType
|
||||
read: any): QueryList<T> {
|
||||
@ -471,12 +481,14 @@ export function contentQuery<T>(
|
||||
* @param descend Whether or not to descend into children
|
||||
* @param read What to save in the query
|
||||
* @returns QueryList<T>
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function staticContentQuery<T>(
|
||||
export function ΔstaticContentQuery<T>(
|
||||
directiveIndex: number, predicate: Type<any>| string[], descend: boolean,
|
||||
// TODO(FW-486): "read" should be an AbstractType
|
||||
read: any): void {
|
||||
const queryList = contentQuery(directiveIndex, predicate, descend, read) as QueryList_<T>;
|
||||
const queryList = ΔcontentQuery(directiveIndex, predicate, descend, read) as QueryList_<T>;
|
||||
const tView = getLView()[TVIEW];
|
||||
queryList._static = true;
|
||||
if (!tView.staticContentQueries) {
|
||||
@ -484,7 +496,11 @@ export function staticContentQuery<T>(
|
||||
}
|
||||
}
|
||||
|
||||
export function loadContentQuery<T>(): QueryList<T> {
|
||||
/**
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function ΔloadContentQuery<T>(): QueryList<T> {
|
||||
const lView = getLView();
|
||||
ngDevMode &&
|
||||
assertDefined(
|
||||
|
@ -82,15 +82,17 @@ export function getBindingsEnabled(): boolean {
|
||||
* Should match component / directive.
|
||||
* </my-comp>
|
||||
* <div ngNonBindable>
|
||||
* <!-- disabledBindings() -->
|
||||
* <!-- ΔdisableBindings() -->
|
||||
* <my-comp my-directive>
|
||||
* Should not match component / directive because we are in ngNonBindable.
|
||||
* </my-comp>
|
||||
* <!-- enableBindings() -->
|
||||
* <!-- ΔenableBindings() -->
|
||||
* </div>
|
||||
* ```
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function enableBindings(): void {
|
||||
export function ΔenableBindings(): void {
|
||||
bindingsEnabled = true;
|
||||
}
|
||||
|
||||
@ -103,15 +105,17 @@ export function enableBindings(): void {
|
||||
* Should match component / directive.
|
||||
* </my-comp>
|
||||
* <div ngNonBindable>
|
||||
* <!-- disabledBindings() -->
|
||||
* <!-- ΔdisableBindings() -->
|
||||
* <my-comp my-directive>
|
||||
* Should not match component / directive because we are in ngNonBindable.
|
||||
* </my-comp>
|
||||
* <!-- enableBindings() -->
|
||||
* <!-- ΔenableBindings() -->
|
||||
* </div>
|
||||
* ```
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function disableBindings(): void {
|
||||
export function ΔdisableBindings(): void {
|
||||
bindingsEnabled = false;
|
||||
}
|
||||
|
||||
@ -262,8 +266,10 @@ export function getActiveDirectiveSuperClassDepth() {
|
||||
* walking the declaration view tree in listeners to get vars from parent views.
|
||||
*
|
||||
* @param viewToRestore The OpaqueViewState instance to restore.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function restoreView(viewToRestore: OpaqueViewState) {
|
||||
export function ΔrestoreView(viewToRestore: OpaqueViewState) {
|
||||
contextLView = viewToRestore as any as LView;
|
||||
}
|
||||
|
||||
@ -483,23 +489,29 @@ let _currentNamespace: string|null = null;
|
||||
|
||||
/**
|
||||
* Sets the namespace used to create elements to `'http://www.w3.org/2000/svg'` in global state.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function namespaceSVG() {
|
||||
export function ΔnamespaceSVG() {
|
||||
_currentNamespace = 'http://www.w3.org/2000/svg';
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the namespace used to create elements to `'http://www.w3.org/1998/MathML/'` in global state.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function namespaceMathML() {
|
||||
export function ΔnamespaceMathML() {
|
||||
_currentNamespace = 'http://www.w3.org/1998/MathML/';
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the namespace used to create elements no `null`, which forces element creation to use
|
||||
* `createElement` rather than `createElementNS`.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function namespaceHTML() {
|
||||
export function ΔnamespaceHTML() {
|
||||
_currentNamespace = null;
|
||||
}
|
||||
|
||||
|
@ -41,15 +41,27 @@ export const defaultScheduler =
|
||||
setTimeout // everything else
|
||||
).bind(global);
|
||||
|
||||
export function resolveWindow(element: RElement & {ownerDocument: Document}) {
|
||||
/**
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function ΔresolveWindow(element: RElement & {ownerDocument: Document}) {
|
||||
return {name: 'window', target: element.ownerDocument.defaultView};
|
||||
}
|
||||
|
||||
export function resolveDocument(element: RElement & {ownerDocument: Document}) {
|
||||
/**
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function ΔresolveDocument(element: RElement & {ownerDocument: Document}) {
|
||||
return {name: 'document', target: element.ownerDocument};
|
||||
}
|
||||
|
||||
export function resolveBody(element: RElement & {ownerDocument: Document}) {
|
||||
/**
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function ΔresolveBody(element: RElement & {ownerDocument: Document}) {
|
||||
return {name: 'body', target: element.ownerDocument.body};
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,9 @@ import {createTemplateRef} from './view_engine_compatibility';
|
||||
/**
|
||||
* Retrieves `TemplateRef` instance from `Injector` when a local reference is placed on the
|
||||
* `<ng-template>` element.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function templateRefExtractor(tNode: TNode, currentView: LView) {
|
||||
export function ΔtemplateRefExtractor(tNode: TNode, currentView: LView) {
|
||||
return createTemplateRef(ViewEngine_TemplateRef, ViewEngine_ElementRef, tNode, currentView);
|
||||
}
|
||||
|
@ -30,8 +30,10 @@ import {_sanitizeUrl as _sanitizeUrl} from './url_sanitizer';
|
||||
* @param unsafeHtml untrusted `html`, typically from the user.
|
||||
* @returns `html` string which is safe to display to user, because all of the dangerous javascript
|
||||
* and urls have been removed.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function sanitizeHtml(unsafeHtml: any): string {
|
||||
export function ΔsanitizeHtml(unsafeHtml: any): string {
|
||||
const sanitizer = getSanitizer();
|
||||
if (sanitizer) {
|
||||
return sanitizer.sanitize(SecurityContext.HTML, unsafeHtml) || '';
|
||||
@ -54,8 +56,10 @@ export function sanitizeHtml(unsafeHtml: any): string {
|
||||
* @param unsafeStyle untrusted `style`, typically from the user.
|
||||
* @returns `style` string which is safe to bind to the `style` properties, because all of the
|
||||
* dangerous javascript and urls have been removed.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function sanitizeStyle(unsafeStyle: any): string {
|
||||
export function ΔsanitizeStyle(unsafeStyle: any): string {
|
||||
const sanitizer = getSanitizer();
|
||||
if (sanitizer) {
|
||||
return sanitizer.sanitize(SecurityContext.STYLE, unsafeStyle) || '';
|
||||
@ -79,8 +83,10 @@ export function sanitizeStyle(unsafeStyle: any): string {
|
||||
* @param unsafeUrl untrusted `url`, typically from the user.
|
||||
* @returns `url` string which is safe to bind to the `src` properties such as `<img src>`, because
|
||||
* all of the dangerous javascript has been removed.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function sanitizeUrl(unsafeUrl: any): string {
|
||||
export function ΔsanitizeUrl(unsafeUrl: any): string {
|
||||
const sanitizer = getSanitizer();
|
||||
if (sanitizer) {
|
||||
return sanitizer.sanitize(SecurityContext.URL, unsafeUrl) || '';
|
||||
@ -99,8 +105,10 @@ export function sanitizeUrl(unsafeUrl: any): string {
|
||||
* @param unsafeResourceUrl untrusted `url`, typically from the user.
|
||||
* @returns `url` string which is safe to bind to the `src` properties such as `<img src>`, because
|
||||
* only trusted `url`s have been allowed to pass.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function sanitizeResourceUrl(unsafeResourceUrl: any): string {
|
||||
export function ΔsanitizeResourceUrl(unsafeResourceUrl: any): string {
|
||||
const sanitizer = getSanitizer();
|
||||
if (sanitizer) {
|
||||
return sanitizer.sanitize(SecurityContext.RESOURCE_URL, unsafeResourceUrl) || '';
|
||||
@ -120,8 +128,10 @@ export function sanitizeResourceUrl(unsafeResourceUrl: any): string {
|
||||
* @param unsafeScript untrusted `script`, typically from the user.
|
||||
* @returns `url` string which is safe to bind to the `<script>` element such as `<img src>`,
|
||||
* because only trusted `scripts` have been allowed to pass.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function sanitizeScript(unsafeScript: any): string {
|
||||
export function ΔsanitizeScript(unsafeScript: any): string {
|
||||
const sanitizer = getSanitizer();
|
||||
if (sanitizer) {
|
||||
return sanitizer.sanitize(SecurityContext.SCRIPT, unsafeScript) || '';
|
||||
@ -143,9 +153,9 @@ export function getUrlSanitizer(tag: string, prop: string) {
|
||||
if ((prop === 'src' && (tag === 'embed' || tag === 'frame' || tag === 'iframe' ||
|
||||
tag === 'media' || tag === 'script')) ||
|
||||
(prop === 'href' && (tag === 'base' || tag === 'link'))) {
|
||||
return sanitizeResourceUrl;
|
||||
return ΔsanitizeResourceUrl;
|
||||
}
|
||||
return sanitizeUrl;
|
||||
return ΔsanitizeUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -160,22 +170,26 @@ export function getUrlSanitizer(tag: string, prop: string) {
|
||||
* @param tag target element tag name.
|
||||
* @param prop name of the property that contains the value.
|
||||
* @returns `url` string which is safe to bind.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function sanitizeUrlOrResourceUrl(unsafeUrl: any, tag: string, prop: string): any {
|
||||
export function ΔsanitizeUrlOrResourceUrl(unsafeUrl: any, tag: string, prop: string): any {
|
||||
return getUrlSanitizer(tag, prop)(unsafeUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* The default style sanitizer will handle sanitization for style properties by
|
||||
* sanitizing any CSS property that can include a `url` value (usually image-based properties)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export const defaultStyleSanitizer = (function(prop: string, value?: string): string | boolean {
|
||||
export const ΔdefaultStyleSanitizer = (function(prop: string, value?: string): string | boolean {
|
||||
if (value === undefined) {
|
||||
return prop === 'background-image' || prop === 'background' || prop === 'border-image' ||
|
||||
prop === 'filter' || prop === 'list-style' || prop === 'list-style-image';
|
||||
}
|
||||
|
||||
return sanitizeStyle(value);
|
||||
return ΔsanitizeStyle(value);
|
||||
} as StyleSanitizeFn);
|
||||
|
||||
export function validateAgainstEventProperties(name: string) {
|
||||
|
@ -9,7 +9,7 @@
|
||||
import {resolveForwardRef} from '../di/forward_ref';
|
||||
import {INJECTOR, Injector} from '../di/injector';
|
||||
import {setCurrentInjector} from '../di/injector_compatibility';
|
||||
import {InjectableDef, getInjectableDef} from '../di/interface/defs';
|
||||
import {getInjectableDef, ΔInjectableDef} from '../di/interface/defs';
|
||||
import {APP_ROOT} from '../di/scope';
|
||||
import {NgModuleRef} from '../linker/ng_module_factory';
|
||||
import {stringify} from '../util/stringify';
|
||||
@ -98,7 +98,7 @@ export function resolveNgModuleDep(
|
||||
return data;
|
||||
}
|
||||
const providerDef = data._def.providersByKey[tokenKey];
|
||||
let injectableDef: InjectableDef<any>|null;
|
||||
let injectableDef: ΔInjectableDef<any>|null;
|
||||
if (providerDef) {
|
||||
let providerInstance = data._providers[providerDef.index];
|
||||
if (providerInstance === undefined) {
|
||||
@ -132,7 +132,7 @@ function moduleTransitivelyPresent(ngModule: NgModuleData, scope: any): boolean
|
||||
return ngModule._def.modules.indexOf(scope) > -1;
|
||||
}
|
||||
|
||||
function targetsModule(ngModule: NgModuleData, def: InjectableDef<any>): boolean {
|
||||
function targetsModule(ngModule: NgModuleData, def: ΔInjectableDef<any>): boolean {
|
||||
return def.providedIn != null && (moduleTransitivelyPresent(ngModule, def.providedIn) ||
|
||||
def.providedIn === 'root' && ngModule._def.isRoot);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
import {DebugElement__PRE_R3__, DebugNode__PRE_R3__, EventListener, getDebugNode, indexDebugNode, removeDebugNodeFromIndex} from '../debug/debug_node';
|
||||
import {Injector} from '../di';
|
||||
import {InjectableType} from '../di/injectable';
|
||||
import {InjectableDef, getInjectableDef} from '../di/interface/defs';
|
||||
import {getInjectableDef, ΔInjectableDef} from '../di/interface/defs';
|
||||
import {ErrorHandler} from '../error_handler';
|
||||
import {Type} from '../interface/type';
|
||||
import {ComponentFactory} from '../linker/component_factory';
|
||||
@ -170,7 +170,7 @@ const viewDefOverrides = new Map<any, ViewDefinition>();
|
||||
|
||||
function debugOverrideProvider(override: ProviderOverride) {
|
||||
providerOverrides.set(override.token, override);
|
||||
let injectableDef: InjectableDef<any>|null;
|
||||
let injectableDef: ΔInjectableDef<any>|null;
|
||||
if (typeof override.token === 'function' && (injectableDef = getInjectableDef(override.token)) &&
|
||||
typeof injectableDef.providedIn === 'function') {
|
||||
providerOverridesWithScope.set(override.token as InjectableType<any>, override);
|
||||
|
@ -257,33 +257,15 @@
|
||||
{
|
||||
"name": "defaultScheduler"
|
||||
},
|
||||
{
|
||||
"name": "defineComponent"
|
||||
},
|
||||
{
|
||||
"name": "defineInjector"
|
||||
},
|
||||
{
|
||||
"name": "defineNgModule"
|
||||
},
|
||||
{
|
||||
"name": "diPublicInInjector"
|
||||
},
|
||||
{
|
||||
"name": "domRendererFactory3"
|
||||
},
|
||||
{
|
||||
"name": "element"
|
||||
},
|
||||
{
|
||||
"name": "elementCreate"
|
||||
},
|
||||
{
|
||||
"name": "elementEnd"
|
||||
},
|
||||
{
|
||||
"name": "elementStart"
|
||||
},
|
||||
{
|
||||
"name": "enterView"
|
||||
},
|
||||
@ -536,9 +518,6 @@
|
||||
{
|
||||
"name": "matchTemplateAttribute"
|
||||
},
|
||||
{
|
||||
"name": "namespaceHTML"
|
||||
},
|
||||
{
|
||||
"name": "nativeAppendChild"
|
||||
},
|
||||
@ -641,9 +620,6 @@
|
||||
{
|
||||
"name": "setClass"
|
||||
},
|
||||
{
|
||||
"name": "setComponentScope"
|
||||
},
|
||||
{
|
||||
"name": "setCurrentDirectiveDef"
|
||||
},
|
||||
@ -689,9 +665,6 @@
|
||||
{
|
||||
"name": "syncViewWithBlueprint"
|
||||
},
|
||||
{
|
||||
"name": "text"
|
||||
},
|
||||
{
|
||||
"name": "throwMultipleComponentError"
|
||||
},
|
||||
@ -703,5 +676,32 @@
|
||||
},
|
||||
{
|
||||
"name": "viewAttachedToChangeDetector"
|
||||
},
|
||||
{
|
||||
"name": "ΔdefineComponent"
|
||||
},
|
||||
{
|
||||
"name": "ΔdefineInjector"
|
||||
},
|
||||
{
|
||||
"name": "ΔdefineNgModule"
|
||||
},
|
||||
{
|
||||
"name": "Δelement"
|
||||
},
|
||||
{
|
||||
"name": "ΔelementEnd"
|
||||
},
|
||||
{
|
||||
"name": "ΔelementStart"
|
||||
},
|
||||
{
|
||||
"name": "ΔnamespaceHTML"
|
||||
},
|
||||
{
|
||||
"name": "ΔsetComponentScope"
|
||||
},
|
||||
{
|
||||
"name": "Δtext"
|
||||
}
|
||||
]
|
@ -200,9 +200,6 @@
|
||||
{
|
||||
"name": "defaultScheduler"
|
||||
},
|
||||
{
|
||||
"name": "defineComponent"
|
||||
},
|
||||
{
|
||||
"name": "diPublicInInjector"
|
||||
},
|
||||
@ -371,9 +368,6 @@
|
||||
{
|
||||
"name": "locateHostElement"
|
||||
},
|
||||
{
|
||||
"name": "namespaceHTML"
|
||||
},
|
||||
{
|
||||
"name": "nativeAppendChild"
|
||||
},
|
||||
@ -482,9 +476,6 @@
|
||||
{
|
||||
"name": "syncViewWithBlueprint"
|
||||
},
|
||||
{
|
||||
"name": "text"
|
||||
},
|
||||
{
|
||||
"name": "tickRootContext"
|
||||
},
|
||||
@ -493,5 +484,14 @@
|
||||
},
|
||||
{
|
||||
"name": "viewAttachedToChangeDetector"
|
||||
},
|
||||
{
|
||||
"name": "ΔdefineComponent"
|
||||
},
|
||||
{
|
||||
"name": "ΔnamespaceHTML"
|
||||
},
|
||||
{
|
||||
"name": "Δtext"
|
||||
}
|
||||
]
|
@ -131,12 +131,6 @@
|
||||
{
|
||||
"name": "deepForEach"
|
||||
},
|
||||
{
|
||||
"name": "defineInjectable"
|
||||
},
|
||||
{
|
||||
"name": "defineInjector"
|
||||
},
|
||||
{
|
||||
"name": "formatError"
|
||||
},
|
||||
@ -161,9 +155,6 @@
|
||||
{
|
||||
"name": "hasOnDestroy"
|
||||
},
|
||||
{
|
||||
"name": "inject"
|
||||
},
|
||||
{
|
||||
"name": "injectArgs"
|
||||
},
|
||||
@ -229,5 +220,14 @@
|
||||
},
|
||||
{
|
||||
"name": "tryResolveToken"
|
||||
},
|
||||
{
|
||||
"name": "ΔdefineInjectable"
|
||||
},
|
||||
{
|
||||
"name": "ΔdefineInjector"
|
||||
},
|
||||
{
|
||||
"name": "Δinject"
|
||||
}
|
||||
]
|
@ -6,17 +6,17 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Injector, defineInjectable, defineInjector, ɵcreateInjector as createInjector} from '@angular/core';
|
||||
import {Injector, ɵcreateInjector as createInjector, ΔdefineInjectable, ΔdefineInjector} from '@angular/core';
|
||||
|
||||
export class RootService {
|
||||
static ngInjectableDef = defineInjectable({
|
||||
static ngInjectableDef = ΔdefineInjectable({
|
||||
providedIn: 'root',
|
||||
factory: () => new RootService(),
|
||||
});
|
||||
}
|
||||
|
||||
export class ScopedService {
|
||||
static ngInjectableDef = defineInjectable({
|
||||
static ngInjectableDef = ΔdefineInjectable({
|
||||
providedIn: null,
|
||||
factory: () => new ScopedService(),
|
||||
});
|
||||
@ -28,7 +28,7 @@ export class ScopedService {
|
||||
}
|
||||
|
||||
export class DefinedInjector {
|
||||
static ngInjectorDef = defineInjector({
|
||||
static ngInjectorDef = ΔdefineInjector({
|
||||
factory: () => new DefinedInjector(),
|
||||
providers: [ScopedService],
|
||||
});
|
||||
|
@ -434,9 +434,6 @@
|
||||
{
|
||||
"name": "baseResolveDirective"
|
||||
},
|
||||
{
|
||||
"name": "bind"
|
||||
},
|
||||
{
|
||||
"name": "bindingUpdated"
|
||||
},
|
||||
@ -545,15 +542,6 @@
|
||||
{
|
||||
"name": "defaultScheduler"
|
||||
},
|
||||
{
|
||||
"name": "defineComponent"
|
||||
},
|
||||
{
|
||||
"name": "defineDirective"
|
||||
},
|
||||
{
|
||||
"name": "defineInjectable"
|
||||
},
|
||||
{
|
||||
"name": "destroyLView"
|
||||
},
|
||||
@ -569,39 +557,18 @@
|
||||
{
|
||||
"name": "diPublicInInjector"
|
||||
},
|
||||
{
|
||||
"name": "directiveInject"
|
||||
},
|
||||
{
|
||||
"name": "directiveOwnerPointers"
|
||||
},
|
||||
{
|
||||
"name": "domRendererFactory3"
|
||||
},
|
||||
{
|
||||
"name": "elementClassProp"
|
||||
},
|
||||
{
|
||||
"name": "elementCreate"
|
||||
},
|
||||
{
|
||||
"name": "elementEnd"
|
||||
},
|
||||
{
|
||||
"name": "elementProperty"
|
||||
},
|
||||
{
|
||||
"name": "elementPropertyInternal"
|
||||
},
|
||||
{
|
||||
"name": "elementStart"
|
||||
},
|
||||
{
|
||||
"name": "elementStyling"
|
||||
},
|
||||
{
|
||||
"name": "elementStylingApply"
|
||||
},
|
||||
{
|
||||
"name": "elementStylingApplyInternal"
|
||||
},
|
||||
@ -695,9 +662,6 @@
|
||||
{
|
||||
"name": "getContextLView"
|
||||
},
|
||||
{
|
||||
"name": "getCurrentView"
|
||||
},
|
||||
{
|
||||
"name": "getDebugContext"
|
||||
},
|
||||
@ -947,9 +911,6 @@
|
||||
{
|
||||
"name": "instantiateRootComponent"
|
||||
},
|
||||
{
|
||||
"name": "interpolation1"
|
||||
},
|
||||
{
|
||||
"name": "invertObject"
|
||||
},
|
||||
@ -1031,9 +992,6 @@
|
||||
{
|
||||
"name": "leaveView"
|
||||
},
|
||||
{
|
||||
"name": "listener"
|
||||
},
|
||||
{
|
||||
"name": "listenerInternal"
|
||||
},
|
||||
@ -1067,9 +1025,6 @@
|
||||
{
|
||||
"name": "matchTemplateAttribute"
|
||||
},
|
||||
{
|
||||
"name": "namespaceHTML"
|
||||
},
|
||||
{
|
||||
"name": "nativeAppendChild"
|
||||
},
|
||||
@ -1091,9 +1046,6 @@
|
||||
{
|
||||
"name": "nativeRemoveNode"
|
||||
},
|
||||
{
|
||||
"name": "nextContext"
|
||||
},
|
||||
{
|
||||
"name": "nextContextImpl"
|
||||
},
|
||||
@ -1136,9 +1088,6 @@
|
||||
{
|
||||
"name": "readPatchedLView"
|
||||
},
|
||||
{
|
||||
"name": "reference"
|
||||
},
|
||||
{
|
||||
"name": "refreshChildComponents"
|
||||
},
|
||||
@ -1202,9 +1151,6 @@
|
||||
{
|
||||
"name": "resolveForwardRef"
|
||||
},
|
||||
{
|
||||
"name": "restoreView"
|
||||
},
|
||||
{
|
||||
"name": "saveNameToExportMap"
|
||||
},
|
||||
@ -1220,9 +1166,6 @@
|
||||
{
|
||||
"name": "searchTokensOnInjector"
|
||||
},
|
||||
{
|
||||
"name": "select"
|
||||
},
|
||||
{
|
||||
"name": "setActiveHostElement"
|
||||
},
|
||||
@ -1319,15 +1262,6 @@
|
||||
{
|
||||
"name": "syncViewWithBlueprint"
|
||||
},
|
||||
{
|
||||
"name": "template"
|
||||
},
|
||||
{
|
||||
"name": "text"
|
||||
},
|
||||
{
|
||||
"name": "textBinding"
|
||||
},
|
||||
{
|
||||
"name": "throwMultipleComponentError"
|
||||
},
|
||||
@ -1366,5 +1300,71 @@
|
||||
},
|
||||
{
|
||||
"name": "wrapListener"
|
||||
},
|
||||
{
|
||||
"name": "Δbind"
|
||||
},
|
||||
{
|
||||
"name": "ΔdefineComponent"
|
||||
},
|
||||
{
|
||||
"name": "ΔdefineDirective"
|
||||
},
|
||||
{
|
||||
"name": "ΔdefineInjectable"
|
||||
},
|
||||
{
|
||||
"name": "ΔdirectiveInject"
|
||||
},
|
||||
{
|
||||
"name": "ΔelementClassProp"
|
||||
},
|
||||
{
|
||||
"name": "ΔelementEnd"
|
||||
},
|
||||
{
|
||||
"name": "ΔelementProperty"
|
||||
},
|
||||
{
|
||||
"name": "ΔelementStart"
|
||||
},
|
||||
{
|
||||
"name": "ΔelementStyling"
|
||||
},
|
||||
{
|
||||
"name": "ΔelementStylingApply"
|
||||
},
|
||||
{
|
||||
"name": "ΔgetCurrentView"
|
||||
},
|
||||
{
|
||||
"name": "Δinterpolation1"
|
||||
},
|
||||
{
|
||||
"name": "Δlistener"
|
||||
},
|
||||
{
|
||||
"name": "ΔnamespaceHTML"
|
||||
},
|
||||
{
|
||||
"name": "ΔnextContext"
|
||||
},
|
||||
{
|
||||
"name": "Δreference"
|
||||
},
|
||||
{
|
||||
"name": "ΔrestoreView"
|
||||
},
|
||||
{
|
||||
"name": "Δselect"
|
||||
},
|
||||
{
|
||||
"name": "Δtemplate"
|
||||
},
|
||||
{
|
||||
"name": "Δtext"
|
||||
},
|
||||
{
|
||||
"name": "ΔtextBinding"
|
||||
}
|
||||
]
|
@ -6,34 +6,34 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {INJECTOR, InjectFlags, InjectionToken, Injector, Optional, defineInjectable, defineInjector, inject} from '@angular/core';
|
||||
import {INJECTOR, InjectFlags, InjectionToken, Injector, Optional, ΔdefineInjectable, ΔdefineInjector, Δinject} from '@angular/core';
|
||||
import {R3Injector, createInjector} from '@angular/core/src/di/r3_injector';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
|
||||
describe('InjectorDef-based createInjector()', () => {
|
||||
class CircularA {
|
||||
static ngInjectableDef = defineInjectable({
|
||||
static ngInjectableDef = ΔdefineInjectable({
|
||||
providedIn: null,
|
||||
factory: () => inject(CircularB),
|
||||
factory: () => Δinject(CircularB),
|
||||
});
|
||||
}
|
||||
|
||||
class CircularB {
|
||||
static ngInjectableDef = defineInjectable({
|
||||
static ngInjectableDef = ΔdefineInjectable({
|
||||
providedIn: null,
|
||||
factory: () => inject(CircularA),
|
||||
factory: () => Δinject(CircularA),
|
||||
});
|
||||
}
|
||||
|
||||
class Service {
|
||||
static ngInjectableDef = defineInjectable({
|
||||
static ngInjectableDef = ΔdefineInjectable({
|
||||
providedIn: null,
|
||||
factory: () => new Service(),
|
||||
});
|
||||
}
|
||||
|
||||
class OptionalService {
|
||||
static ngInjectableDef = defineInjectable({
|
||||
static ngInjectableDef = ΔdefineInjectable({
|
||||
providedIn: null,
|
||||
factory: () => new OptionalService(),
|
||||
});
|
||||
@ -55,41 +55,41 @@ describe('InjectorDef-based createInjector()', () => {
|
||||
class ServiceWithDep {
|
||||
constructor(readonly service: Service) {}
|
||||
|
||||
static ngInjectableDef = defineInjectable({
|
||||
static ngInjectableDef = ΔdefineInjectable({
|
||||
providedIn: null,
|
||||
factory: () => new ServiceWithDep(inject(Service)),
|
||||
factory: () => new ServiceWithDep(Δinject(Service)),
|
||||
});
|
||||
}
|
||||
|
||||
class ServiceWithOptionalDep {
|
||||
constructor(@Optional() readonly service: OptionalService|null) {}
|
||||
|
||||
static ngInjectableDef = defineInjectable({
|
||||
static ngInjectableDef = ΔdefineInjectable({
|
||||
providedIn: null,
|
||||
factory: () => new ServiceWithOptionalDep(inject(OptionalService, InjectFlags.Optional)),
|
||||
factory: () => new ServiceWithOptionalDep(Δinject(OptionalService, InjectFlags.Optional)),
|
||||
});
|
||||
}
|
||||
|
||||
class ServiceWithMissingDep {
|
||||
constructor(readonly service: Service) {}
|
||||
|
||||
static ngInjectableDef = defineInjectable({
|
||||
static ngInjectableDef = ΔdefineInjectable({
|
||||
providedIn: null,
|
||||
factory: () => new ServiceWithMissingDep(inject(Service)),
|
||||
factory: () => new ServiceWithMissingDep(Δinject(Service)),
|
||||
});
|
||||
}
|
||||
|
||||
class ServiceWithMultiDep {
|
||||
constructor(readonly locale: string[]) {}
|
||||
|
||||
static ngInjectableDef = defineInjectable({
|
||||
static ngInjectableDef = ΔdefineInjectable({
|
||||
providedIn: null,
|
||||
factory: () => new ServiceWithMultiDep(inject(LOCALE)),
|
||||
factory: () => new ServiceWithMultiDep(Δinject(LOCALE)),
|
||||
});
|
||||
}
|
||||
|
||||
class ServiceTwo {
|
||||
static ngInjectableDef = defineInjectable({
|
||||
static ngInjectableDef = ΔdefineInjectable({
|
||||
providedIn: null,
|
||||
factory: () => new ServiceTwo(),
|
||||
});
|
||||
@ -97,7 +97,7 @@ describe('InjectorDef-based createInjector()', () => {
|
||||
|
||||
let deepServiceDestroyed = false;
|
||||
class DeepService {
|
||||
static ngInjectableDef = defineInjectable({
|
||||
static ngInjectableDef = ΔdefineInjectable({
|
||||
providedIn: null,
|
||||
factory: () => new DeepService(),
|
||||
});
|
||||
@ -107,7 +107,7 @@ describe('InjectorDef-based createInjector()', () => {
|
||||
|
||||
let eagerServiceCreated: boolean = false;
|
||||
class EagerService {
|
||||
static ngInjectableDef = defineInjectable({
|
||||
static ngInjectableDef = ΔdefineInjectable({
|
||||
providedIn: undefined,
|
||||
factory: () => new EagerService(),
|
||||
});
|
||||
@ -119,8 +119,8 @@ describe('InjectorDef-based createInjector()', () => {
|
||||
class DeepModule {
|
||||
constructor(eagerService: EagerService) { deepModuleCreated = true; }
|
||||
|
||||
static ngInjectorDef = defineInjector({
|
||||
factory: () => new DeepModule(inject(EagerService)),
|
||||
static ngInjectorDef = ΔdefineInjector({
|
||||
factory: () => new DeepModule(Δinject(EagerService)),
|
||||
imports: undefined,
|
||||
providers: [
|
||||
EagerService,
|
||||
@ -137,7 +137,7 @@ describe('InjectorDef-based createInjector()', () => {
|
||||
}
|
||||
|
||||
class IntermediateModule {
|
||||
static ngInjectorDef = defineInjector({
|
||||
static ngInjectorDef = ΔdefineInjector({
|
||||
factory: () => new IntermediateModule(),
|
||||
imports: [DeepModule.safe()],
|
||||
providers: [],
|
||||
@ -147,13 +147,13 @@ describe('InjectorDef-based createInjector()', () => {
|
||||
class InjectorWithDep {
|
||||
constructor(readonly service: Service) {}
|
||||
|
||||
static ngInjectorDef = defineInjector({
|
||||
factory: () => new InjectorWithDep(inject(Service)),
|
||||
static ngInjectorDef = ΔdefineInjector({
|
||||
factory: () => new InjectorWithDep(Δinject(Service)),
|
||||
});
|
||||
}
|
||||
|
||||
class Module {
|
||||
static ngInjectorDef = defineInjector({
|
||||
static ngInjectorDef = ΔdefineInjector({
|
||||
factory: () => new Module(),
|
||||
imports: [IntermediateModule],
|
||||
providers: [
|
||||
@ -175,7 +175,7 @@ describe('InjectorDef-based createInjector()', () => {
|
||||
}
|
||||
|
||||
class OtherModule {
|
||||
static ngInjectorDef = defineInjector({
|
||||
static ngInjectorDef = ΔdefineInjector({
|
||||
factory: () => new OtherModule(),
|
||||
imports: undefined,
|
||||
providers: [],
|
||||
@ -183,7 +183,7 @@ describe('InjectorDef-based createInjector()', () => {
|
||||
}
|
||||
|
||||
class ModuleWithMissingDep {
|
||||
static ngInjectorDef = defineInjector({
|
||||
static ngInjectorDef = ΔdefineInjector({
|
||||
factory: () => new ModuleWithMissingDep(),
|
||||
imports: undefined,
|
||||
providers: [ServiceWithMissingDep],
|
||||
@ -193,7 +193,7 @@ describe('InjectorDef-based createInjector()', () => {
|
||||
class NotAModule {}
|
||||
|
||||
class ImportsNotAModule {
|
||||
static ngInjectorDef = defineInjector({
|
||||
static ngInjectorDef = ΔdefineInjector({
|
||||
factory: () => new ImportsNotAModule(),
|
||||
imports: [NotAModule],
|
||||
providers: [],
|
||||
@ -202,7 +202,7 @@ describe('InjectorDef-based createInjector()', () => {
|
||||
|
||||
let scopedServiceDestroyed = false;
|
||||
class ScopedService {
|
||||
static ngInjectableDef = defineInjectable({
|
||||
static ngInjectableDef = ΔdefineInjectable({
|
||||
providedIn: Module,
|
||||
factory: () => new ScopedService(),
|
||||
});
|
||||
@ -211,7 +211,7 @@ describe('InjectorDef-based createInjector()', () => {
|
||||
}
|
||||
|
||||
class WrongScopeService {
|
||||
static ngInjectableDef = defineInjectable({
|
||||
static ngInjectableDef = ΔdefineInjectable({
|
||||
providedIn: OtherModule,
|
||||
factory: () => new WrongScopeService(),
|
||||
});
|
||||
@ -367,7 +367,7 @@ describe('InjectorDef-based createInjector()', () => {
|
||||
}
|
||||
class ErrorModule {
|
||||
static ngInjectorDef =
|
||||
defineInjector({factory: () => new ErrorModule(), providers: [MissingArgumentType]});
|
||||
ΔdefineInjector({factory: () => new ErrorModule(), providers: [MissingArgumentType]});
|
||||
}
|
||||
expect(() => createInjector(ErrorModule).get(MissingArgumentType))
|
||||
.toThrowError('Can\'t resolve all parameters for MissingArgumentType: (?).');
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user