1 | /// <amd-module name="@angular/language-service/ivy/utils" />
|
2 | /**
|
3 | * @license
|
4 | * Copyright Google LLC All Rights Reserved.
|
5 | *
|
6 | * Use of this source code is governed by an MIT-style license that can be
|
7 | * found in the LICENSE file at https://angular.io/license
|
8 | */
|
9 | import { AbsoluteSourceSpan, ParseSourceSpan } from '@angular/compiler';
|
10 | import { NgCompiler } from '@angular/compiler-cli/src/ngtsc/core';
|
11 | import { DirectiveSymbol } from '@angular/compiler-cli/src/ngtsc/typecheck/api';
|
12 | import * as e from '@angular/compiler/src/expression_parser/ast';
|
13 | import * as t from '@angular/compiler/src/render3/r3_ast';
|
14 | import * as ts from 'typescript';
|
15 | export declare function getTextSpanOfNode(node: t.Node | e.AST): ts.TextSpan;
|
16 | export declare function toTextSpan(span: AbsoluteSourceSpan | ParseSourceSpan): ts.TextSpan;
|
17 | interface NodeWithKeyAndValue extends t.Node {
|
18 | keySpan: ParseSourceSpan;
|
19 | valueSpan?: ParseSourceSpan;
|
20 | }
|
21 | export declare function isTemplateNodeWithKeyAndValue(node: t.Node | e.AST): node is NodeWithKeyAndValue;
|
22 | export declare function isTemplateNode(node: t.Node | e.AST): node is t.Node;
|
23 | export declare function isExpressionNode(node: t.Node | e.AST): node is e.AST;
|
24 | export interface TemplateInfo {
|
25 | template: t.Node[];
|
26 | component: ts.ClassDeclaration;
|
27 | }
|
28 | /**
|
29 | * Retrieves the `ts.ClassDeclaration` at a location along with its template nodes.
|
30 | */
|
31 | export declare function getTemplateInfoAtPosition(fileName: string, position: number, compiler: NgCompiler): TemplateInfo | undefined;
|
32 | /**
|
33 | * Given an element or template, determines which directives match because the tag is present. For
|
34 | * example, if a directive selector is `div[myAttr]`, this would match div elements but would not if
|
35 | * the selector were just `[myAttr]`. We find which directives are applied because of this tag by
|
36 | * elimination: compare the directive matches with the tag present against the directive matches
|
37 | * without it. The difference would be the directives which match because the tag is present.
|
38 | *
|
39 | * @param element The element or template node that the attribute/tag is part of.
|
40 | * @param directives The list of directives to match against.
|
41 | * @returns The list of directives matching the tag name via the strategy described above.
|
42 | */
|
43 | export declare function getDirectiveMatchesForElementTag(element: t.Template | t.Element, directives: DirectiveSymbol[]): Set<DirectiveSymbol>;
|
44 | /**
|
45 | * Given an attribute name, determines which directives match because the attribute is present. We
|
46 | * find which directives are applied because of this attribute by elimination: compare the directive
|
47 | * matches with the attribute present against the directive matches without it. The difference would
|
48 | * be the directives which match because the attribute is present.
|
49 | *
|
50 | * @param name The name of the attribute
|
51 | * @param hostNode The node which the attribute appears on
|
52 | * @param directives The list of directives to match against.
|
53 | * @returns The list of directives matching the tag name via the strategy described above.
|
54 | */
|
55 | export declare function getDirectiveMatchesForAttribute(name: string, hostNode: t.Template | t.Element, directives: DirectiveSymbol[]): Set<DirectiveSymbol>;
|
56 | /**
|
57 | * Returns a new `ts.SymbolDisplayPart` array which has the alias imports from the tcb filtered
|
58 | * out, i.e. `i0.NgForOf`.
|
59 | */
|
60 | export declare function filterAliasImports(displayParts: ts.SymbolDisplayPart[]): ts.SymbolDisplayPart[];
|
61 | export declare function isDollarEvent(n: t.Node | e.AST): n is e.PropertyRead;
|
62 | /**
|
63 | * Returns a new array formed by applying a given callback function to each element of the array,
|
64 | * and then flattening the result by one level.
|
65 | */
|
66 | export declare function flatMap<T, R>(items: T[] | readonly T[], f: (item: T) => R[] | readonly R[]): R[];
|
67 | export {};
|