UNPKG

3.29 kBTypeScriptView Raw
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 */
8import { ConstantPool } from '../../constant_pool';
9import * as o from '../../output/output_ast';
10import { ParseError, ParseSourceSpan } from '../../parse_util';
11import { BindingParser } from '../../template_parser/binding_parser';
12import { R3CompiledExpression } from '../util';
13import { R3ComponentMetadata, R3DirectiveMetadata } from './api';
14/**
15 * Compile a directive for the render3 runtime as defined by the `R3DirectiveMetadata`.
16 */
17export 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 */
21export declare function compileComponentFromMetadata(meta: R3ComponentMetadata, 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 */
26export declare function createComponentType(meta: R3ComponentMetadata): 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 */
32export 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}
54export declare function createDirectiveTypeParams(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 */
59export declare function createDirectiveType(meta: R3DirectiveMetadata): o.Type;
60export 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}
75export 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 */
86export declare function verifyHostBindings(bindings: ParsedHostBindings, sourceSpan: ParseSourceSpan): ParseError[];