@angular/compiler 14.0.0-next.9 → 14.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/src/compiler.mjs +3 -2
- package/esm2020/src/compiler_facade_interface.mjs +7 -1
- package/esm2020/src/core.mjs +6 -6
- package/esm2020/src/expression_parser/parser.mjs +12 -12
- package/esm2020/src/i18n/i18n_parser.mjs +3 -3
- package/esm2020/src/jit_compiler_facade.mjs +74 -42
- package/esm2020/src/ml_parser/html_whitespaces.mjs +2 -2
- package/esm2020/src/ml_parser/lexer.mjs +36 -36
- package/esm2020/src/ml_parser/parser.mjs +41 -41
- package/esm2020/src/render3/partial/api.mjs +1 -1
- package/esm2020/src/render3/partial/class_metadata.mjs +1 -1
- package/esm2020/src/render3/partial/component.mjs +28 -37
- package/esm2020/src/render3/partial/directive.mjs +6 -3
- package/esm2020/src/render3/partial/factory.mjs +1 -1
- package/esm2020/src/render3/partial/injectable.mjs +1 -1
- package/esm2020/src/render3/partial/injector.mjs +1 -1
- package/esm2020/src/render3/partial/ng_module.mjs +3 -3
- package/esm2020/src/render3/partial/pipe.mjs +6 -3
- package/esm2020/src/render3/r3_ast.mjs +3 -3
- package/esm2020/src/render3/r3_factory.mjs +6 -6
- package/esm2020/src/render3/r3_identifiers.mjs +2 -1
- package/esm2020/src/render3/r3_pipe_compiler.mjs +5 -1
- package/esm2020/src/render3/util.mjs +4 -4
- package/esm2020/src/render3/view/api.mjs +7 -2
- package/esm2020/src/render3/view/compiler.mjs +45 -35
- package/esm2020/src/render3/view/i18n/get_msg_utils.mjs +58 -5
- package/esm2020/src/render3/view/i18n/meta.mjs +4 -4
- package/esm2020/src/render3/view/i18n/util.mjs +2 -2
- package/esm2020/src/render3/view/style_parser.mjs +19 -19
- package/esm2020/src/render3/view/styling_builder.mjs +6 -6
- package/esm2020/src/render3/view/template.mjs +25 -25
- package/esm2020/src/render3/view/util.mjs +14 -5
- package/esm2020/src/selector.mjs +8 -8
- package/esm2020/src/template_parser/binding_parser.mjs +8 -8
- package/esm2020/src/util.mjs +8 -8
- package/esm2020/src/version.mjs +1 -1
- package/fesm2015/compiler.mjs +416 -301
- package/fesm2015/compiler.mjs.map +1 -1
- package/fesm2015/testing.mjs +1 -1
- package/fesm2020/compiler.mjs +424 -314
- package/fesm2020/compiler.mjs.map +1 -1
- package/fesm2020/testing.mjs +1 -1
- package/index.d.ts +4964 -5
- package/package.json +3 -3
- package/testing/index.d.ts +22 -5
- package/compiler.d.ts +0 -8
- package/public_api.d.ts +0 -13
- package/src/assertions.d.ts +0 -8
- package/src/chars.d.ts +0 -75
- package/src/compiler.d.ts +0 -77
- package/src/compiler_facade_interface.d.ts +0 -284
- package/src/compiler_util/expression_converter.d.ts +0 -71
- package/src/config.d.ts +0 -25
- package/src/constant_pool.d.ts +0 -37
- package/src/core.d.ts +0 -216
- package/src/expression_parser/ast.d.ts +0 -440
- package/src/expression_parser/lexer.d.ts +0 -47
- package/src/expression_parser/parser.d.ts +0 -315
- package/src/i18n/big_integer.d.ts +0 -108
- package/src/i18n/digest.d.ts +0 -44
- package/src/i18n/extractor_merger.d.ts +0 -27
- package/src/i18n/i18n_ast.d.ts +0 -148
- package/src/i18n/i18n_html_parser.d.ts +0 -19
- package/src/i18n/i18n_parser.d.ts +0 -18
- package/src/i18n/index.d.ts +0 -15
- package/src/i18n/message_bundle.d.ts +0 -28
- package/src/i18n/parse_util.d.ts +0 -14
- package/src/i18n/serializers/placeholder.d.ts +0 -25
- package/src/i18n/serializers/serializer.d.ts +0 -46
- package/src/i18n/serializers/xliff.d.ts +0 -19
- package/src/i18n/serializers/xliff2.d.ts +0 -19
- package/src/i18n/serializers/xmb.d.ts +0 -22
- package/src/i18n/serializers/xml_helper.d.ts +0 -52
- package/src/i18n/serializers/xtb.d.ts +0 -20
- package/src/i18n/translation_bundle.d.ts +0 -27
- package/src/injectable_compiler_2.d.ts +0 -24
- package/src/jit_compiler_facade.d.ts +0 -46
- package/src/ml_parser/ast.d.ts +0 -89
- package/src/ml_parser/entities.d.ts +0 -9
- package/src/ml_parser/html_parser.d.ts +0 -13
- package/src/ml_parser/html_tags.d.ts +0 -33
- package/src/ml_parser/html_whitespaces.d.ts +0 -45
- package/src/ml_parser/icu_ast_expander.d.ts +0 -42
- package/src/ml_parser/interpolation_config.d.ts +0 -14
- package/src/ml_parser/lexer.d.ts +0 -114
- package/src/ml_parser/parser.d.ts +0 -26
- package/src/ml_parser/tags.d.ts +0 -29
- package/src/ml_parser/tokens.d.ts +0 -141
- package/src/ml_parser/xml_parser.d.ts +0 -13
- package/src/ml_parser/xml_tags.d.ts +0 -24
- package/src/output/abstract_emitter.d.ts +0 -66
- package/src/output/abstract_js_emitter.d.ts +0 -19
- package/src/output/map_util.d.ts +0 -18
- package/src/output/output_ast.d.ts +0 -575
- package/src/output/output_jit.d.ts +0 -73
- package/src/output/output_jit_trusted_types.d.ts +0 -43
- package/src/output/source_map.d.ts +0 -29
- package/src/parse_util.d.ts +0 -75
- package/src/render3/partial/api.d.ts +0 -441
- package/src/render3/partial/class_metadata.d.ts +0 -10
- package/src/render3/partial/component.d.ts +0 -39
- package/src/render3/partial/directive.d.ts +0 -13
- package/src/render3/partial/factory.d.ts +0 -3
- package/src/render3/partial/injectable.d.ts +0 -19
- package/src/render3/partial/injector.d.ts +0 -3
- package/src/render3/partial/ng_module.d.ts +0 -3
- package/src/render3/partial/pipe.d.ts +0 -12
- package/src/render3/partial/util.d.ts +0 -33
- package/src/render3/r3_ast.d.ts +0 -211
- package/src/render3/r3_class_metadata_compiler.d.ts +0 -35
- package/src/render3/r3_factory.d.ts +0 -94
- package/src/render3/r3_identifiers.d.ts +0 -182
- package/src/render3/r3_injector_compiler.d.ts +0 -18
- package/src/render3/r3_jit.d.ts +0 -22
- package/src/render3/r3_module_compiler.d.ts +0 -103
- package/src/render3/r3_pipe_compiler.d.ts +0 -50
- package/src/render3/r3_template_transform.d.ts +0 -24
- package/src/render3/util.d.ts +0 -94
- package/src/render3/view/api.d.ts +0 -328
- package/src/render3/view/compiler.d.ts +0 -86
- package/src/render3/view/i18n/context.d.ts +0 -68
- package/src/render3/view/i18n/get_msg_utils.d.ts +0 -13
- package/src/render3/view/i18n/icu_serializer.d.ts +0 -9
- package/src/render3/view/i18n/localize_utils.d.ts +0 -24
- package/src/render3/view/i18n/meta.d.ts +0 -78
- package/src/render3/view/i18n/util.d.ts +0 -78
- package/src/render3/view/style_parser.d.ts +0 -18
- package/src/render3/view/styling_builder.d.ts +0 -211
- package/src/render3/view/t2_api.d.ts +0 -152
- package/src/render3/view/t2_binder.d.ts +0 -57
- package/src/render3/view/template.d.ts +0 -450
- package/src/render3/view/util.d.ts +0 -94
- package/src/resource_loader.d.ts +0 -17
- package/src/schema/dom_element_schema_registry.d.ts +0 -45
- package/src/schema/dom_security_schema.d.ts +0 -11
- package/src/schema/element_schema_registry.d.ts +0 -29
- package/src/schema/trusted_types_sinks.d.ts +0 -15
- package/src/selector.d.ts +0 -105
- package/src/shadow_css.d.ts +0 -76
- package/src/style_url_resolver.d.ts +0 -8
- package/src/template_parser/binding_parser.d.ts +0 -91
- package/src/template_parser/template_preparser.d.ts +0 -24
- package/src/util.d.ts +0 -42
- package/src/version.d.ts +0 -14
- package/testing/package.json +0 -9
- package/testing/public_api.d.ts +0 -13
- package/testing/src/testing.d.ts +0 -23
- package/testing/testing.d.ts +0 -4
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright Google LLC All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7
|
-
*/
|
|
8
|
-
import { AST } from '../../../expression_parser/ast';
|
|
9
|
-
import * as i18n from '../../../i18n/i18n_ast';
|
|
10
|
-
import * as o from '../../../output/output_ast';
|
|
11
|
-
/**
|
|
12
|
-
* I18nContext is a helper class which keeps track of all i18n-related aspects
|
|
13
|
-
* (accumulates placeholders, bindings, etc) between i18nStart and i18nEnd instructions.
|
|
14
|
-
*
|
|
15
|
-
* When we enter a nested template, the top-level context is being passed down
|
|
16
|
-
* to the nested component, which uses this context to generate a child instance
|
|
17
|
-
* of I18nContext class (to handle nested template) and at the end, reconciles it back
|
|
18
|
-
* with the parent context.
|
|
19
|
-
*
|
|
20
|
-
* @param index Instruction index of i18nStart, which initiates this context
|
|
21
|
-
* @param ref Reference to a translation const that represents the content if thus context
|
|
22
|
-
* @param level Nestng level defined for child contexts
|
|
23
|
-
* @param templateIndex Instruction index of a template which this context belongs to
|
|
24
|
-
* @param meta Meta information (id, meaning, description, etc) associated with this context
|
|
25
|
-
*/
|
|
26
|
-
export declare class I18nContext {
|
|
27
|
-
readonly index: number;
|
|
28
|
-
readonly ref: o.ReadVarExpr;
|
|
29
|
-
readonly level: number;
|
|
30
|
-
readonly templateIndex: number | null;
|
|
31
|
-
readonly meta: i18n.I18nMeta;
|
|
32
|
-
private registry?;
|
|
33
|
-
readonly id: number;
|
|
34
|
-
bindings: Set<AST>;
|
|
35
|
-
placeholders: Map<string, any[]>;
|
|
36
|
-
isEmitted: boolean;
|
|
37
|
-
private _registry;
|
|
38
|
-
private _unresolvedCtxCount;
|
|
39
|
-
constructor(index: number, ref: o.ReadVarExpr, level: number, templateIndex: number | null, meta: i18n.I18nMeta, registry?: any);
|
|
40
|
-
private appendTag;
|
|
41
|
-
get icus(): any;
|
|
42
|
-
get isRoot(): boolean;
|
|
43
|
-
get isResolved(): boolean;
|
|
44
|
-
getSerializedPlaceholders(): Map<string, any[]>;
|
|
45
|
-
appendBinding(binding: AST): void;
|
|
46
|
-
appendIcu(name: string, ref: o.Expression): void;
|
|
47
|
-
appendBoundText(node: i18n.I18nMeta): void;
|
|
48
|
-
appendTemplate(node: i18n.I18nMeta, index: number): void;
|
|
49
|
-
appendElement(node: i18n.I18nMeta, index: number, closed?: boolean): void;
|
|
50
|
-
appendProjection(node: i18n.I18nMeta, index: number): void;
|
|
51
|
-
/**
|
|
52
|
-
* Generates an instance of a child context based on the root one,
|
|
53
|
-
* when we enter a nested template within I18n section.
|
|
54
|
-
*
|
|
55
|
-
* @param index Instruction index of corresponding i18nStart, which initiates this context
|
|
56
|
-
* @param templateIndex Instruction index of a template which this context belongs to
|
|
57
|
-
* @param meta Meta information (id, meaning, description, etc) associated with this context
|
|
58
|
-
*
|
|
59
|
-
* @returns I18nContext instance
|
|
60
|
-
*/
|
|
61
|
-
forkChildContext(index: number, templateIndex: number, meta: i18n.I18nMeta): I18nContext;
|
|
62
|
-
/**
|
|
63
|
-
* Reconciles child context into parent one once the end of the i18n block is reached (i18nEnd).
|
|
64
|
-
*
|
|
65
|
-
* @param context Child I18nContext instance to be reconciled with parent context.
|
|
66
|
-
*/
|
|
67
|
-
reconcileChildContext(context: I18nContext): void;
|
|
68
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright Google LLC All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7
|
-
*/
|
|
8
|
-
import * as i18n from '../../../i18n/i18n_ast';
|
|
9
|
-
import * as o from '../../../output/output_ast';
|
|
10
|
-
export declare function createGoogleGetMsgStatements(variable: o.ReadVarExpr, message: i18n.Message, closureVar: o.ReadVarExpr, params: {
|
|
11
|
-
[name: string]: o.Expression;
|
|
12
|
-
}): o.Statement[];
|
|
13
|
-
export declare function serializeI18nMessageForGetMsg(message: i18n.Message): string;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright Google LLC All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7
|
-
*/
|
|
8
|
-
import * as i18n from '../../../i18n/i18n_ast';
|
|
9
|
-
export declare function serializeIcuNode(icu: i18n.Icu): string;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright Google LLC All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7
|
-
*/
|
|
8
|
-
import * as i18n from '../../../i18n/i18n_ast';
|
|
9
|
-
import * as o from '../../../output/output_ast';
|
|
10
|
-
export declare function createLocalizeStatements(variable: o.ReadVarExpr, message: i18n.Message, params: {
|
|
11
|
-
[name: string]: o.Expression;
|
|
12
|
-
}): o.Statement[];
|
|
13
|
-
/**
|
|
14
|
-
* Serialize an i18n message into two arrays: messageParts and placeholders.
|
|
15
|
-
*
|
|
16
|
-
* These arrays will be used to generate `$localize` tagged template literals.
|
|
17
|
-
*
|
|
18
|
-
* @param message The message to be serialized.
|
|
19
|
-
* @returns an object containing the messageParts and placeholders.
|
|
20
|
-
*/
|
|
21
|
-
export declare function serializeI18nMessageForLocalize(message: i18n.Message): {
|
|
22
|
-
messageParts: o.LiteralPiece[];
|
|
23
|
-
placeHolders: o.PlaceholderPiece[];
|
|
24
|
-
};
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright Google LLC All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7
|
-
*/
|
|
8
|
-
import * as i18n from '../../../i18n/i18n_ast';
|
|
9
|
-
import * as html from '../../../ml_parser/ast';
|
|
10
|
-
import { InterpolationConfig } from '../../../ml_parser/interpolation_config';
|
|
11
|
-
import { ParseTreeResult } from '../../../ml_parser/parser';
|
|
12
|
-
import * as o from '../../../output/output_ast';
|
|
13
|
-
export declare type I18nMeta = {
|
|
14
|
-
id?: string;
|
|
15
|
-
customId?: string;
|
|
16
|
-
legacyIds?: string[];
|
|
17
|
-
description?: string;
|
|
18
|
-
meaning?: string;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* This visitor walks over HTML parse tree and converts information stored in
|
|
22
|
-
* i18n-related attributes ("i18n" and "i18n-*") into i18n meta object that is
|
|
23
|
-
* stored with other element's and attribute's information.
|
|
24
|
-
*/
|
|
25
|
-
export declare class I18nMetaVisitor implements html.Visitor {
|
|
26
|
-
private interpolationConfig;
|
|
27
|
-
private keepI18nAttrs;
|
|
28
|
-
private enableI18nLegacyMessageIdFormat;
|
|
29
|
-
hasI18nMeta: boolean;
|
|
30
|
-
private _errors;
|
|
31
|
-
private _createI18nMessage;
|
|
32
|
-
constructor(interpolationConfig?: InterpolationConfig, keepI18nAttrs?: boolean, enableI18nLegacyMessageIdFormat?: boolean);
|
|
33
|
-
private _generateI18nMessage;
|
|
34
|
-
visitAllWithErrors(nodes: html.Node[]): ParseTreeResult;
|
|
35
|
-
visitElement(element: html.Element): any;
|
|
36
|
-
visitExpansion(expansion: html.Expansion, currentMessage: i18n.Message | null): any;
|
|
37
|
-
visitText(text: html.Text): any;
|
|
38
|
-
visitAttribute(attribute: html.Attribute): any;
|
|
39
|
-
visitComment(comment: html.Comment): any;
|
|
40
|
-
visitExpansionCase(expansionCase: html.ExpansionCase): any;
|
|
41
|
-
/**
|
|
42
|
-
* Parse the general form `meta` passed into extract the explicit metadata needed to create a
|
|
43
|
-
* `Message`.
|
|
44
|
-
*
|
|
45
|
-
* There are three possibilities for the `meta` variable
|
|
46
|
-
* 1) a string from an `i18n` template attribute: parse it to extract the metadata values.
|
|
47
|
-
* 2) a `Message` from a previous processing pass: reuse the metadata values in the message.
|
|
48
|
-
* 4) other: ignore this and just process the message metadata as normal
|
|
49
|
-
*
|
|
50
|
-
* @param meta the bucket that holds information about the message
|
|
51
|
-
* @returns the parsed metadata.
|
|
52
|
-
*/
|
|
53
|
-
private _parseMetadata;
|
|
54
|
-
/**
|
|
55
|
-
* Generate (or restore) message id if not specified already.
|
|
56
|
-
*/
|
|
57
|
-
private _setMessageId;
|
|
58
|
-
/**
|
|
59
|
-
* Update the `message` with a `legacyId` if necessary.
|
|
60
|
-
*
|
|
61
|
-
* @param message the message whose legacy id should be set
|
|
62
|
-
* @param meta information about the message being processed
|
|
63
|
-
*/
|
|
64
|
-
private _setLegacyIds;
|
|
65
|
-
private _reportError;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Parses i18n metas like:
|
|
69
|
-
* - "@@id",
|
|
70
|
-
* - "description[@@id]",
|
|
71
|
-
* - "meaning|description[@@id]"
|
|
72
|
-
* and returns an object with parsed output.
|
|
73
|
-
*
|
|
74
|
-
* @param meta String that represents i18n meta
|
|
75
|
-
* @returns Object with id, meaning and description fields
|
|
76
|
-
*/
|
|
77
|
-
export declare function parseI18nMeta(meta?: string): I18nMeta;
|
|
78
|
-
export declare function i18nMetaToJSDoc(meta: I18nMeta): o.JSDocComment;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright Google LLC All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7
|
-
*/
|
|
8
|
-
import * as i18n from '../../../i18n/i18n_ast';
|
|
9
|
-
import * as html from '../../../ml_parser/ast';
|
|
10
|
-
import * as o from '../../../output/output_ast';
|
|
11
|
-
import * as t from '../../r3_ast';
|
|
12
|
-
/**
|
|
13
|
-
* Prefix for non-`goog.getMsg` i18n-related vars.
|
|
14
|
-
* Note: the prefix uses lowercase characters intentionally due to a Closure behavior that
|
|
15
|
-
* considers variables like `I18N_0` as constants and throws an error when their value changes.
|
|
16
|
-
*/
|
|
17
|
-
export declare const TRANSLATION_VAR_PREFIX = "i18n_";
|
|
18
|
-
/** Name of the i18n attributes **/
|
|
19
|
-
export declare const I18N_ATTR = "i18n";
|
|
20
|
-
export declare const I18N_ATTR_PREFIX = "i18n-";
|
|
21
|
-
/** Prefix of var expressions used in ICUs */
|
|
22
|
-
export declare const I18N_ICU_VAR_PREFIX = "VAR_";
|
|
23
|
-
/** Prefix of ICU expressions for post processing */
|
|
24
|
-
export declare const I18N_ICU_MAPPING_PREFIX = "I18N_EXP_";
|
|
25
|
-
/** Placeholder wrapper for i18n expressions **/
|
|
26
|
-
export declare const I18N_PLACEHOLDER_SYMBOL = "\uFFFD";
|
|
27
|
-
export declare function isI18nAttribute(name: string): boolean;
|
|
28
|
-
export declare function isI18nRootNode(meta?: i18n.I18nMeta): meta is i18n.Message;
|
|
29
|
-
export declare function isSingleI18nIcu(meta?: i18n.I18nMeta): boolean;
|
|
30
|
-
export declare function hasI18nMeta(node: t.Node & {
|
|
31
|
-
i18n?: i18n.I18nMeta;
|
|
32
|
-
}): boolean;
|
|
33
|
-
export declare function hasI18nAttrs(element: html.Element): boolean;
|
|
34
|
-
export declare function icuFromI18nMessage(message: i18n.Message): i18n.IcuPlaceholder;
|
|
35
|
-
export declare function wrapI18nPlaceholder(content: string | number, contextId?: number): string;
|
|
36
|
-
export declare function assembleI18nBoundString(strings: string[], bindingStartIndex?: number, contextId?: number): string;
|
|
37
|
-
export declare function getSeqNumberGenerator(startsAt?: number): () => number;
|
|
38
|
-
export declare function placeholdersToParams(placeholders: Map<string, string[]>): {
|
|
39
|
-
[name: string]: o.LiteralExpr;
|
|
40
|
-
};
|
|
41
|
-
export declare function updatePlaceholderMap(map: Map<string, any[]>, name: string, ...values: any[]): void;
|
|
42
|
-
export declare function assembleBoundTextPlaceholders(meta: i18n.I18nMeta, bindingStartIndex?: number, contextId?: number): Map<string, any[]>;
|
|
43
|
-
/**
|
|
44
|
-
* Format the placeholder names in a map of placeholders to expressions.
|
|
45
|
-
*
|
|
46
|
-
* The placeholder names are converted from "internal" format (e.g. `START_TAG_DIV_1`) to "external"
|
|
47
|
-
* format (e.g. `startTagDiv_1`).
|
|
48
|
-
*
|
|
49
|
-
* @param params A map of placeholder names to expressions.
|
|
50
|
-
* @param useCamelCase whether to camelCase the placeholder name when formatting.
|
|
51
|
-
* @returns A new map of formatted placeholder names to expressions.
|
|
52
|
-
*/
|
|
53
|
-
export declare function i18nFormatPlaceholderNames(params: {
|
|
54
|
-
[name: string]: o.Expression;
|
|
55
|
-
} | undefined, useCamelCase: boolean): {
|
|
56
|
-
[key: string]: o.Expression;
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* Converts internal placeholder names to public-facing format
|
|
60
|
-
* (for example to use in goog.getMsg call).
|
|
61
|
-
* Example: `START_TAG_DIV_1` is converted to `startTagDiv_1`.
|
|
62
|
-
*
|
|
63
|
-
* @param name The placeholder name that should be formatted
|
|
64
|
-
* @returns Formatted placeholder name
|
|
65
|
-
*/
|
|
66
|
-
export declare function formatI18nPlaceholderName(name: string, useCamelCase?: boolean): string;
|
|
67
|
-
/**
|
|
68
|
-
* Generates a prefix for translation const name.
|
|
69
|
-
*
|
|
70
|
-
* @param extra Additional local prefix that should be injected into translation var name
|
|
71
|
-
* @returns Complete translation const prefix
|
|
72
|
-
*/
|
|
73
|
-
export declare function getTranslationConstPrefix(extra: string): string;
|
|
74
|
-
/**
|
|
75
|
-
* Generate AST to declare a variable. E.g. `var I18N_1;`.
|
|
76
|
-
* @param variable the name of the variable to declare.
|
|
77
|
-
*/
|
|
78
|
-
export declare function declareI18nVariable(variable: o.ReadVarExpr): o.Statement;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright Google LLC All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Parses string representation of a style and converts it into object literal.
|
|
10
|
-
*
|
|
11
|
-
* @param value string representation of style as used in the `style` attribute in HTML.
|
|
12
|
-
* Example: `color: red; height: auto`.
|
|
13
|
-
* @returns An array of style property name and value pairs, e.g. `['color', 'red', 'height',
|
|
14
|
-
* 'auto']`
|
|
15
|
-
*/
|
|
16
|
-
export declare function parse(value: string): string[];
|
|
17
|
-
export declare function stripUnnecessaryQuotes(value: string): string;
|
|
18
|
-
export declare function hyphenate(value: string): string;
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import { AST } from '../../expression_parser/ast';
|
|
2
|
-
import * as o from '../../output/output_ast';
|
|
3
|
-
import { ParseSourceSpan } from '../../parse_util';
|
|
4
|
-
import * as t from '../r3_ast';
|
|
5
|
-
import { ValueConverter } from './template';
|
|
6
|
-
import { DefinitionMap } from './util';
|
|
7
|
-
/**
|
|
8
|
-
* Minimum amount of binding slots required in the runtime for style/class bindings.
|
|
9
|
-
*
|
|
10
|
-
* Styling in Angular uses up two slots in the runtime LView/TData data structures to
|
|
11
|
-
* record binding data, property information and metadata.
|
|
12
|
-
*
|
|
13
|
-
* When a binding is registered it will place the following information in the `LView`:
|
|
14
|
-
*
|
|
15
|
-
* slot 1) binding value
|
|
16
|
-
* slot 2) cached value (all other values collected before it in string form)
|
|
17
|
-
*
|
|
18
|
-
* When a binding is registered it will place the following information in the `TData`:
|
|
19
|
-
*
|
|
20
|
-
* slot 1) prop name
|
|
21
|
-
* slot 2) binding index that points to the previous style/class binding (and some extra config
|
|
22
|
-
* values)
|
|
23
|
-
*
|
|
24
|
-
* Let's imagine we have a binding that looks like so:
|
|
25
|
-
*
|
|
26
|
-
* ```
|
|
27
|
-
* <div [style.width]="x" [style.height]="y">
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* Our `LView` and `TData` data-structures look like so:
|
|
31
|
-
*
|
|
32
|
-
* ```typescript
|
|
33
|
-
* LView = [
|
|
34
|
-
* // ...
|
|
35
|
-
* x, // value of x
|
|
36
|
-
* "width: x",
|
|
37
|
-
*
|
|
38
|
-
* y, // value of y
|
|
39
|
-
* "width: x; height: y",
|
|
40
|
-
* // ...
|
|
41
|
-
* ];
|
|
42
|
-
*
|
|
43
|
-
* TData = [
|
|
44
|
-
* // ...
|
|
45
|
-
* "width", // binding slot 20
|
|
46
|
-
* 0,
|
|
47
|
-
*
|
|
48
|
-
* "height",
|
|
49
|
-
* 20,
|
|
50
|
-
* // ...
|
|
51
|
-
* ];
|
|
52
|
-
* ```
|
|
53
|
-
*
|
|
54
|
-
* */
|
|
55
|
-
export declare const MIN_STYLING_BINDING_SLOTS_REQUIRED = 2;
|
|
56
|
-
/**
|
|
57
|
-
* A styling expression summary that is to be processed by the compiler
|
|
58
|
-
*/
|
|
59
|
-
export interface StylingInstruction {
|
|
60
|
-
reference: o.ExternalReference;
|
|
61
|
-
/** Calls to individual styling instructions. Used when chaining calls to the same instruction. */
|
|
62
|
-
calls: StylingInstructionCall[];
|
|
63
|
-
}
|
|
64
|
-
export interface StylingInstructionCall {
|
|
65
|
-
sourceSpan: ParseSourceSpan | null;
|
|
66
|
-
supportsInterpolation: boolean;
|
|
67
|
-
allocateBindingSlots: number;
|
|
68
|
-
params: ((convertFn: (value: any) => o.Expression | o.Expression[]) => o.Expression[]);
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* An internal record of the input data for a styling binding
|
|
72
|
-
*/
|
|
73
|
-
interface BoundStylingEntry {
|
|
74
|
-
hasOverrideFlag: boolean;
|
|
75
|
-
name: string | null;
|
|
76
|
-
suffix: string | null;
|
|
77
|
-
sourceSpan: ParseSourceSpan;
|
|
78
|
-
value: AST;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Produces creation/update instructions for all styling bindings (class and style)
|
|
82
|
-
*
|
|
83
|
-
* It also produces the creation instruction to register all initial styling values
|
|
84
|
-
* (which are all the static class="..." and style="..." attribute values that exist
|
|
85
|
-
* on an element within a template).
|
|
86
|
-
*
|
|
87
|
-
* The builder class below handles producing instructions for the following cases:
|
|
88
|
-
*
|
|
89
|
-
* - Static style/class attributes (style="..." and class="...")
|
|
90
|
-
* - Dynamic style/class map bindings ([style]="map" and [class]="map|string")
|
|
91
|
-
* - Dynamic style/class property bindings ([style.prop]="exp" and [class.name]="exp")
|
|
92
|
-
*
|
|
93
|
-
* Due to the complex relationship of all of these cases, the instructions generated
|
|
94
|
-
* for these attributes/properties/bindings must be done so in the correct order. The
|
|
95
|
-
* order which these must be generated is as follows:
|
|
96
|
-
*
|
|
97
|
-
* if (createMode) {
|
|
98
|
-
* styling(...)
|
|
99
|
-
* }
|
|
100
|
-
* if (updateMode) {
|
|
101
|
-
* styleMap(...)
|
|
102
|
-
* classMap(...)
|
|
103
|
-
* styleProp(...)
|
|
104
|
-
* classProp(...)
|
|
105
|
-
* }
|
|
106
|
-
*
|
|
107
|
-
* The creation/update methods within the builder class produce these instructions.
|
|
108
|
-
*/
|
|
109
|
-
export declare class StylingBuilder {
|
|
110
|
-
private _directiveExpr;
|
|
111
|
-
/** Whether or not there are any static styling values present */
|
|
112
|
-
private _hasInitialValues;
|
|
113
|
-
/**
|
|
114
|
-
* Whether or not there are any styling bindings present
|
|
115
|
-
* (i.e. `[style]`, `[class]`, `[style.prop]` or `[class.name]`)
|
|
116
|
-
*/
|
|
117
|
-
hasBindings: boolean;
|
|
118
|
-
hasBindingsWithPipes: boolean;
|
|
119
|
-
/** the input for [class] (if it exists) */
|
|
120
|
-
private _classMapInput;
|
|
121
|
-
/** the input for [style] (if it exists) */
|
|
122
|
-
private _styleMapInput;
|
|
123
|
-
/** an array of each [style.prop] input */
|
|
124
|
-
private _singleStyleInputs;
|
|
125
|
-
/** an array of each [class.name] input */
|
|
126
|
-
private _singleClassInputs;
|
|
127
|
-
private _lastStylingInput;
|
|
128
|
-
private _firstStylingInput;
|
|
129
|
-
/**
|
|
130
|
-
* Represents the location of each style binding in the template
|
|
131
|
-
* (e.g. `<div [style.width]="w" [style.height]="h">` implies
|
|
132
|
-
* that `width=0` and `height=1`)
|
|
133
|
-
*/
|
|
134
|
-
private _stylesIndex;
|
|
135
|
-
/**
|
|
136
|
-
* Represents the location of each class binding in the template
|
|
137
|
-
* (e.g. `<div [class.big]="b" [class.hidden]="h">` implies
|
|
138
|
-
* that `big=0` and `hidden=1`)
|
|
139
|
-
*/
|
|
140
|
-
private _classesIndex;
|
|
141
|
-
private _initialStyleValues;
|
|
142
|
-
private _initialClassValues;
|
|
143
|
-
constructor(_directiveExpr: o.Expression | null);
|
|
144
|
-
/**
|
|
145
|
-
* Registers a given input to the styling builder to be later used when producing AOT code.
|
|
146
|
-
*
|
|
147
|
-
* The code below will only accept the input if it is somehow tied to styling (whether it be
|
|
148
|
-
* style/class bindings or static style/class attributes).
|
|
149
|
-
*/
|
|
150
|
-
registerBoundInput(input: t.BoundAttribute): boolean;
|
|
151
|
-
registerInputBasedOnName(name: string, expression: AST, sourceSpan: ParseSourceSpan): BoundStylingEntry | null;
|
|
152
|
-
registerStyleInput(name: string, isMapBased: boolean, value: AST, sourceSpan: ParseSourceSpan, suffix?: string | null): BoundStylingEntry | null;
|
|
153
|
-
registerClassInput(name: string, isMapBased: boolean, value: AST, sourceSpan: ParseSourceSpan): BoundStylingEntry | null;
|
|
154
|
-
private _checkForPipes;
|
|
155
|
-
/**
|
|
156
|
-
* Registers the element's static style string value to the builder.
|
|
157
|
-
*
|
|
158
|
-
* @param value the style string (e.g. `width:100px; height:200px;`)
|
|
159
|
-
*/
|
|
160
|
-
registerStyleAttr(value: string): void;
|
|
161
|
-
/**
|
|
162
|
-
* Registers the element's static class string value to the builder.
|
|
163
|
-
*
|
|
164
|
-
* @param value the className string (e.g. `disabled gold zoom`)
|
|
165
|
-
*/
|
|
166
|
-
registerClassAttr(value: string): void;
|
|
167
|
-
/**
|
|
168
|
-
* Appends all styling-related expressions to the provided attrs array.
|
|
169
|
-
*
|
|
170
|
-
* @param attrs an existing array where each of the styling expressions
|
|
171
|
-
* will be inserted into.
|
|
172
|
-
*/
|
|
173
|
-
populateInitialStylingAttrs(attrs: o.Expression[]): void;
|
|
174
|
-
/**
|
|
175
|
-
* Builds an instruction with all the expressions and parameters for `elementHostAttrs`.
|
|
176
|
-
*
|
|
177
|
-
* The instruction generation code below is used for producing the AOT statement code which is
|
|
178
|
-
* responsible for registering initial styles (within a directive hostBindings' creation block),
|
|
179
|
-
* as well as any of the provided attribute values, to the directive host element.
|
|
180
|
-
*/
|
|
181
|
-
assignHostAttrs(attrs: o.Expression[], definitionMap: DefinitionMap): void;
|
|
182
|
-
/**
|
|
183
|
-
* Builds an instruction with all the expressions and parameters for `classMap`.
|
|
184
|
-
*
|
|
185
|
-
* The instruction data will contain all expressions for `classMap` to function
|
|
186
|
-
* which includes the `[class]` expression params.
|
|
187
|
-
*/
|
|
188
|
-
buildClassMapInstruction(valueConverter: ValueConverter): StylingInstruction | null;
|
|
189
|
-
/**
|
|
190
|
-
* Builds an instruction with all the expressions and parameters for `styleMap`.
|
|
191
|
-
*
|
|
192
|
-
* The instruction data will contain all expressions for `styleMap` to function
|
|
193
|
-
* which includes the `[style]` expression params.
|
|
194
|
-
*/
|
|
195
|
-
buildStyleMapInstruction(valueConverter: ValueConverter): StylingInstruction | null;
|
|
196
|
-
private _buildMapBasedInstruction;
|
|
197
|
-
private _buildSingleInputs;
|
|
198
|
-
private _buildClassInputs;
|
|
199
|
-
private _buildStyleInputs;
|
|
200
|
-
/**
|
|
201
|
-
* Constructs all instructions which contain the expressions that will be placed
|
|
202
|
-
* into the update block of a template function or a directive hostBindings function.
|
|
203
|
-
*/
|
|
204
|
-
buildUpdateLevelInstructions(valueConverter: ValueConverter): StylingInstruction[];
|
|
205
|
-
}
|
|
206
|
-
export declare function parseProperty(name: string): {
|
|
207
|
-
property: string;
|
|
208
|
-
suffix: string | null;
|
|
209
|
-
hasOverrideFlag: boolean;
|
|
210
|
-
};
|
|
211
|
-
export {};
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright Google LLC All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7
|
-
*/
|
|
8
|
-
import { AST } from '../../expression_parser/ast';
|
|
9
|
-
import { BoundAttribute, BoundEvent, Element, Node, Reference, Template, TextAttribute, Variable } from '../r3_ast';
|
|
10
|
-
/**
|
|
11
|
-
* A logical target for analysis, which could contain a template or other types of bindings.
|
|
12
|
-
*/
|
|
13
|
-
export interface Target {
|
|
14
|
-
template?: Node[];
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* A data structure which can indicate whether a given property name is present or not.
|
|
18
|
-
*
|
|
19
|
-
* This is used to represent the set of inputs or outputs present on a directive, and allows the
|
|
20
|
-
* binder to query for the presence of a mapping for property names.
|
|
21
|
-
*/
|
|
22
|
-
export interface InputOutputPropertySet {
|
|
23
|
-
hasBindingPropertyName(propertyName: string): boolean;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* A data structure which captures the animation trigger names that are statically resolvable
|
|
27
|
-
* and whether some names could not be statically evaluated.
|
|
28
|
-
*/
|
|
29
|
-
export interface AnimationTriggerNames {
|
|
30
|
-
includesDynamicAnimations: boolean;
|
|
31
|
-
staticTriggerNames: string[];
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Metadata regarding a directive that's needed to match it against template elements. This is
|
|
35
|
-
* provided by a consumer of the t2 APIs.
|
|
36
|
-
*/
|
|
37
|
-
export interface DirectiveMeta {
|
|
38
|
-
/**
|
|
39
|
-
* Name of the directive class (used for debugging).
|
|
40
|
-
*/
|
|
41
|
-
name: string;
|
|
42
|
-
/** The selector for the directive or `null` if there isn't one. */
|
|
43
|
-
selector: string | null;
|
|
44
|
-
/**
|
|
45
|
-
* Whether the directive is a component.
|
|
46
|
-
*/
|
|
47
|
-
isComponent: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Set of inputs which this directive claims.
|
|
50
|
-
*
|
|
51
|
-
* Goes from property names to field names.
|
|
52
|
-
*/
|
|
53
|
-
inputs: InputOutputPropertySet;
|
|
54
|
-
/**
|
|
55
|
-
* Set of outputs which this directive claims.
|
|
56
|
-
*
|
|
57
|
-
* Goes from property names to field names.
|
|
58
|
-
*/
|
|
59
|
-
outputs: InputOutputPropertySet;
|
|
60
|
-
/**
|
|
61
|
-
* Name under which the directive is exported, if any (exportAs in Angular).
|
|
62
|
-
*
|
|
63
|
-
* Null otherwise
|
|
64
|
-
*/
|
|
65
|
-
exportAs: string[] | null;
|
|
66
|
-
isStructural: boolean;
|
|
67
|
-
/**
|
|
68
|
-
* The name of animations that the user defines in the component.
|
|
69
|
-
* Only includes the animation names.
|
|
70
|
-
*/
|
|
71
|
-
animationTriggerNames: AnimationTriggerNames | null;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Interface to the binding API, which processes a template and returns an object similar to the
|
|
75
|
-
* `ts.TypeChecker`.
|
|
76
|
-
*
|
|
77
|
-
* The returned `BoundTarget` has an API for extracting information about the processed target.
|
|
78
|
-
*/
|
|
79
|
-
export interface TargetBinder<D extends DirectiveMeta> {
|
|
80
|
-
bind(target: Target): BoundTarget<D>;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Result of performing the binding operation against a `Target`.
|
|
84
|
-
*
|
|
85
|
-
* The original `Target` is accessible, as well as a suite of methods for extracting binding
|
|
86
|
-
* information regarding the `Target`.
|
|
87
|
-
*
|
|
88
|
-
* @param DirectiveT directive metadata type
|
|
89
|
-
*/
|
|
90
|
-
export interface BoundTarget<DirectiveT extends DirectiveMeta> {
|
|
91
|
-
/**
|
|
92
|
-
* Get the original `Target` that was bound.
|
|
93
|
-
*/
|
|
94
|
-
readonly target: Target;
|
|
95
|
-
/**
|
|
96
|
-
* For a given template node (either an `Element` or a `Template`), get the set of directives
|
|
97
|
-
* which matched the node, if any.
|
|
98
|
-
*/
|
|
99
|
-
getDirectivesOfNode(node: Element | Template): DirectiveT[] | null;
|
|
100
|
-
/**
|
|
101
|
-
* For a given `Reference`, get the reference's target - either an `Element`, a `Template`, or
|
|
102
|
-
* a directive on a particular node.
|
|
103
|
-
*/
|
|
104
|
-
getReferenceTarget(ref: Reference): {
|
|
105
|
-
directive: DirectiveT;
|
|
106
|
-
node: Element | Template;
|
|
107
|
-
} | Element | Template | null;
|
|
108
|
-
/**
|
|
109
|
-
* For a given binding, get the entity to which the binding is being made.
|
|
110
|
-
*
|
|
111
|
-
* This will either be a directive or the node itself.
|
|
112
|
-
*/
|
|
113
|
-
getConsumerOfBinding(binding: BoundAttribute | BoundEvent | TextAttribute): DirectiveT | Element | Template | null;
|
|
114
|
-
/**
|
|
115
|
-
* If the given `AST` expression refers to a `Reference` or `Variable` within the `Target`, then
|
|
116
|
-
* return that.
|
|
117
|
-
*
|
|
118
|
-
* Otherwise, returns `null`.
|
|
119
|
-
*
|
|
120
|
-
* This is only defined for `AST` expressions that read or write to a property of an
|
|
121
|
-
* `ImplicitReceiver`.
|
|
122
|
-
*/
|
|
123
|
-
getExpressionTarget(expr: AST): Reference | Variable | null;
|
|
124
|
-
/**
|
|
125
|
-
* Given a particular `Reference` or `Variable`, get the `Template` which created it.
|
|
126
|
-
*
|
|
127
|
-
* All `Variable`s are defined on templates, so this will always return a value for a `Variable`
|
|
128
|
-
* from the `Target`. For `Reference`s this only returns a value if the `Reference` points to a
|
|
129
|
-
* `Template`. Returns `null` otherwise.
|
|
130
|
-
*/
|
|
131
|
-
getTemplateOfSymbol(symbol: Reference | Variable): Template | null;
|
|
132
|
-
/**
|
|
133
|
-
* Get the nesting level of a particular `Template`.
|
|
134
|
-
*
|
|
135
|
-
* This starts at 1 for top-level `Template`s within the `Target` and increases for `Template`s
|
|
136
|
-
* nested at deeper levels.
|
|
137
|
-
*/
|
|
138
|
-
getNestingLevel(template: Template): number;
|
|
139
|
-
/**
|
|
140
|
-
* Get all `Reference`s and `Variables` visible within the given `Template` (or at the top level,
|
|
141
|
-
* if `null` is passed).
|
|
142
|
-
*/
|
|
143
|
-
getEntitiesInTemplateScope(template: Template | null): ReadonlySet<Reference | Variable>;
|
|
144
|
-
/**
|
|
145
|
-
* Get a list of all the directives used by the target.
|
|
146
|
-
*/
|
|
147
|
-
getUsedDirectives(): DirectiveT[];
|
|
148
|
-
/**
|
|
149
|
-
* Get a list of all the pipes used by the target.
|
|
150
|
-
*/
|
|
151
|
-
getUsedPipes(): string[];
|
|
152
|
-
}
|