@angular/compiler 14.0.0-next.14 → 14.0.0-next.15

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.
Files changed (124) hide show
  1. package/esm2020/src/compiler.mjs +3 -2
  2. package/esm2020/src/jit_compiler_facade.mjs +9 -13
  3. package/esm2020/src/render3/partial/class_metadata.mjs +1 -1
  4. package/esm2020/src/render3/partial/directive.mjs +1 -1
  5. package/esm2020/src/render3/partial/factory.mjs +1 -1
  6. package/esm2020/src/render3/partial/injectable.mjs +1 -1
  7. package/esm2020/src/render3/partial/injector.mjs +1 -1
  8. package/esm2020/src/render3/partial/ng_module.mjs +1 -1
  9. package/esm2020/src/render3/partial/pipe.mjs +1 -1
  10. package/esm2020/src/shadow_css.mjs +291 -12
  11. package/esm2020/src/util.mjs +8 -8
  12. package/esm2020/src/version.mjs +1 -1
  13. package/fesm2015/compiler.mjs +311 -39
  14. package/fesm2015/compiler.mjs.map +1 -1
  15. package/fesm2015/testing.mjs +1 -1
  16. package/fesm2020/compiler.mjs +314 -39
  17. package/fesm2020/compiler.mjs.map +1 -1
  18. package/fesm2020/testing.mjs +1 -1
  19. package/index.d.ts +4964 -5
  20. package/package.json +3 -3
  21. package/testing/index.d.ts +22 -5
  22. package/compiler.d.ts +0 -8
  23. package/public_api.d.ts +0 -13
  24. package/src/assertions.d.ts +0 -8
  25. package/src/chars.d.ts +0 -75
  26. package/src/compiler.d.ts +0 -77
  27. package/src/compiler_facade_interface.d.ts +0 -299
  28. package/src/compiler_util/expression_converter.d.ts +0 -71
  29. package/src/config.d.ts +0 -25
  30. package/src/constant_pool.d.ts +0 -37
  31. package/src/core.d.ts +0 -216
  32. package/src/expression_parser/ast.d.ts +0 -440
  33. package/src/expression_parser/lexer.d.ts +0 -47
  34. package/src/expression_parser/parser.d.ts +0 -315
  35. package/src/i18n/big_integer.d.ts +0 -108
  36. package/src/i18n/digest.d.ts +0 -44
  37. package/src/i18n/extractor_merger.d.ts +0 -27
  38. package/src/i18n/i18n_ast.d.ts +0 -148
  39. package/src/i18n/i18n_html_parser.d.ts +0 -19
  40. package/src/i18n/i18n_parser.d.ts +0 -18
  41. package/src/i18n/index.d.ts +0 -15
  42. package/src/i18n/message_bundle.d.ts +0 -28
  43. package/src/i18n/parse_util.d.ts +0 -14
  44. package/src/i18n/serializers/placeholder.d.ts +0 -25
  45. package/src/i18n/serializers/serializer.d.ts +0 -46
  46. package/src/i18n/serializers/xliff.d.ts +0 -19
  47. package/src/i18n/serializers/xliff2.d.ts +0 -19
  48. package/src/i18n/serializers/xmb.d.ts +0 -22
  49. package/src/i18n/serializers/xml_helper.d.ts +0 -52
  50. package/src/i18n/serializers/xtb.d.ts +0 -20
  51. package/src/i18n/translation_bundle.d.ts +0 -27
  52. package/src/injectable_compiler_2.d.ts +0 -24
  53. package/src/jit_compiler_facade.d.ts +0 -46
  54. package/src/ml_parser/ast.d.ts +0 -89
  55. package/src/ml_parser/entities.d.ts +0 -9
  56. package/src/ml_parser/html_parser.d.ts +0 -13
  57. package/src/ml_parser/html_tags.d.ts +0 -33
  58. package/src/ml_parser/html_whitespaces.d.ts +0 -45
  59. package/src/ml_parser/icu_ast_expander.d.ts +0 -42
  60. package/src/ml_parser/interpolation_config.d.ts +0 -14
  61. package/src/ml_parser/lexer.d.ts +0 -114
  62. package/src/ml_parser/parser.d.ts +0 -26
  63. package/src/ml_parser/tags.d.ts +0 -29
  64. package/src/ml_parser/tokens.d.ts +0 -141
  65. package/src/ml_parser/xml_parser.d.ts +0 -13
  66. package/src/ml_parser/xml_tags.d.ts +0 -24
  67. package/src/output/abstract_emitter.d.ts +0 -66
  68. package/src/output/abstract_js_emitter.d.ts +0 -19
  69. package/src/output/map_util.d.ts +0 -18
  70. package/src/output/output_ast.d.ts +0 -575
  71. package/src/output/output_jit.d.ts +0 -73
  72. package/src/output/output_jit_trusted_types.d.ts +0 -43
  73. package/src/output/source_map.d.ts +0 -29
  74. package/src/parse_util.d.ts +0 -75
  75. package/src/render3/partial/api.d.ts +0 -463
  76. package/src/render3/partial/class_metadata.d.ts +0 -10
  77. package/src/render3/partial/component.d.ts +0 -39
  78. package/src/render3/partial/directive.d.ts +0 -13
  79. package/src/render3/partial/factory.d.ts +0 -3
  80. package/src/render3/partial/injectable.d.ts +0 -19
  81. package/src/render3/partial/injector.d.ts +0 -3
  82. package/src/render3/partial/ng_module.d.ts +0 -3
  83. package/src/render3/partial/pipe.d.ts +0 -12
  84. package/src/render3/partial/util.d.ts +0 -33
  85. package/src/render3/r3_ast.d.ts +0 -211
  86. package/src/render3/r3_class_metadata_compiler.d.ts +0 -35
  87. package/src/render3/r3_factory.d.ts +0 -94
  88. package/src/render3/r3_identifiers.d.ts +0 -183
  89. package/src/render3/r3_injector_compiler.d.ts +0 -18
  90. package/src/render3/r3_jit.d.ts +0 -22
  91. package/src/render3/r3_module_compiler.d.ts +0 -103
  92. package/src/render3/r3_pipe_compiler.d.ts +0 -50
  93. package/src/render3/r3_template_transform.d.ts +0 -24
  94. package/src/render3/util.d.ts +0 -94
  95. package/src/render3/view/api.d.ts +0 -342
  96. package/src/render3/view/compiler.d.ts +0 -86
  97. package/src/render3/view/i18n/context.d.ts +0 -68
  98. package/src/render3/view/i18n/get_msg_utils.d.ts +0 -47
  99. package/src/render3/view/i18n/icu_serializer.d.ts +0 -9
  100. package/src/render3/view/i18n/localize_utils.d.ts +0 -24
  101. package/src/render3/view/i18n/meta.d.ts +0 -78
  102. package/src/render3/view/i18n/util.d.ts +0 -78
  103. package/src/render3/view/style_parser.d.ts +0 -18
  104. package/src/render3/view/styling_builder.d.ts +0 -211
  105. package/src/render3/view/t2_api.d.ts +0 -152
  106. package/src/render3/view/t2_binder.d.ts +0 -57
  107. package/src/render3/view/template.d.ts +0 -450
  108. package/src/render3/view/util.d.ts +0 -94
  109. package/src/resource_loader.d.ts +0 -17
  110. package/src/schema/dom_element_schema_registry.d.ts +0 -45
  111. package/src/schema/dom_security_schema.d.ts +0 -11
  112. package/src/schema/element_schema_registry.d.ts +0 -29
  113. package/src/schema/trusted_types_sinks.d.ts +0 -15
  114. package/src/selector.d.ts +0 -105
  115. package/src/shadow_css.d.ts +0 -76
  116. package/src/style_url_resolver.d.ts +0 -8
  117. package/src/template_parser/binding_parser.d.ts +0 -91
  118. package/src/template_parser/template_preparser.d.ts +0 -24
  119. package/src/util.d.ts +0 -42
  120. package/src/version.d.ts +0 -14
  121. package/testing/package.json +0 -9
  122. package/testing/public_api.d.ts +0 -13
  123. package/testing/src/testing.d.ts +0 -23
  124. package/testing/testing.d.ts +0 -4
@@ -1,86 +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 { ConstantPool } from '../../constant_pool';
9
- import * as o from '../../output/output_ast';
10
- import { ParseError, ParseSourceSpan } from '../../parse_util';
11
- import { BindingParser } from '../../template_parser/binding_parser';
12
- import { R3CompiledExpression } from '../util';
13
- import { R3ComponentMetadata, R3DirectiveMetadata, R3TemplateDependency } from './api';
14
- /**
15
- * Compile a directive for the render3 runtime as defined by the `R3DirectiveMetadata`.
16
- */
17
- export declare function compileDirectiveFromMetadata(meta: R3DirectiveMetadata, constantPool: ConstantPool, bindingParser: BindingParser): R3CompiledExpression;
18
- /**
19
- * Compile a component for the render3 runtime as defined by the `R3ComponentMetadata`.
20
- */
21
- export declare function compileComponentFromMetadata(meta: R3ComponentMetadata<R3TemplateDependency>, constantPool: ConstantPool, bindingParser: BindingParser): R3CompiledExpression;
22
- /**
23
- * Creates the type specification from the component meta. This type is inserted into .d.ts files
24
- * to be consumed by upstream compilations.
25
- */
26
- export declare function createComponentType(meta: R3ComponentMetadata<R3TemplateDependency>): o.Type;
27
- /**
28
- * A set of flags to be used with Queries.
29
- *
30
- * NOTE: Ensure changes here are in sync with `packages/core/src/render3/interfaces/query.ts`
31
- */
32
- export declare const enum QueryFlags {
33
- /**
34
- * No flags
35
- */
36
- none = 0,
37
- /**
38
- * Whether or not the query should descend into children.
39
- */
40
- descendants = 1,
41
- /**
42
- * The query can be computed statically and hence can be assigned eagerly.
43
- *
44
- * NOTE: Backwards compatibility with ViewEngine.
45
- */
46
- isStatic = 2,
47
- /**
48
- * If the `QueryList` should fire change event only if actual change to query was computed (vs old
49
- * behavior where the change was fired whenever the query was recomputed, even if the recomputed
50
- * query resulted in the same list.)
51
- */
52
- emitDistinctChangesOnly = 4
53
- }
54
- export declare function createBaseDirectiveTypeParams(meta: R3DirectiveMetadata): o.Type[];
55
- /**
56
- * Creates the type specification from the directive meta. This type is inserted into .d.ts files
57
- * to be consumed by upstream compilations.
58
- */
59
- export declare function createDirectiveType(meta: R3DirectiveMetadata): o.Type;
60
- export interface ParsedHostBindings {
61
- attributes: {
62
- [key: string]: o.Expression;
63
- };
64
- listeners: {
65
- [key: string]: string;
66
- };
67
- properties: {
68
- [key: string]: string;
69
- };
70
- specialAttributes: {
71
- styleAttr?: string;
72
- classAttr?: string;
73
- };
74
- }
75
- export declare function parseHostBindings(host: {
76
- [key: string]: string | o.Expression;
77
- }): ParsedHostBindings;
78
- /**
79
- * Verifies host bindings and returns the list of errors (if any). Empty array indicates that a
80
- * given set of host bindings has no errors.
81
- *
82
- * @param bindings set of host bindings to verify.
83
- * @param sourceSpan source span where host bindings were defined.
84
- * @returns array of errors associated with a given set of host bindings.
85
- */
86
- export declare function verifyHostBindings(bindings: ParsedHostBindings, sourceSpan: ParseSourceSpan): ParseError[];
@@ -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,47 +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
- /**
11
- * Generates a `goog.getMsg()` statement and reassignment. The template:
12
- *
13
- * ```html
14
- * <div i18n>Sent from {{ sender }} to <span class="receiver">{{ receiver }}</span></div>
15
- * ```
16
- *
17
- * Generates:
18
- *
19
- * ```typescript
20
- * const MSG_FOO = goog.getMsg(
21
- * // Message template.
22
- * 'Sent from {$interpolation} to {$startTagSpan}{$interpolation_1}{$closeTagSpan}.',
23
- * // Placeholder values, set to magic strings which get replaced by the Angular runtime.
24
- * {
25
- * 'interpolation': '\uFFFD0\uFFFD',
26
- * 'startTagSpan': '\uFFFD1\uFFFD',
27
- * 'interpolation_1': '\uFFFD2\uFFFD',
28
- * 'closeTagSpan': '\uFFFD3\uFFFD',
29
- * },
30
- * // Options bag.
31
- * {
32
- * // Maps each placeholder to the original Angular source code which generates it's value.
33
- * original_code: {
34
- * 'interpolation': '{{ sender }}',
35
- * 'startTagSpan': '<span class="receiver">',
36
- * 'interploation_1': '{{ receiver }}',
37
- * 'closeTagSpan': '</span>',
38
- * },
39
- * },
40
- * );
41
- * const I18N_0 = MSG_FOO;
42
- * ```
43
- */
44
- export declare function createGoogleGetMsgStatements(variable: o.ReadVarExpr, message: i18n.Message, closureVar: o.ReadVarExpr, placeholderValues: {
45
- [name: string]: o.Expression;
46
- }): o.Statement[];
47
- 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 formatI18nPlaceholderNamesInMap(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 {};