1 | import { Dict, Option, PresentArray } from '@glimmer/interfaces';
|
2 | export declare type BuilderParams = BuilderExpression[];
|
3 | export declare type BuilderHash = Option<Dict<BuilderExpression>>;
|
4 | export declare type BuilderBlockHash = BuilderHash | {
|
5 | as: string | string[];
|
6 | };
|
7 | export declare type BuilderBlocks = Dict<BuilderBlock>;
|
8 | export declare type BuilderAttrs = Dict<BuilderAttr>;
|
9 | export declare type NormalizedParams = NormalizedExpression[];
|
10 | export declare type NormalizedHash = Dict<NormalizedExpression>;
|
11 | export declare type NormalizedBlock = NormalizedStatement[];
|
12 | export declare type NormalizedBlocks = Dict<NormalizedBlock>;
|
13 | export declare type NormalizedAttrs = Dict<NormalizedAttr>;
|
14 | export declare type NormalizedAttr = HeadKind.Splat | NormalizedExpression;
|
15 | export interface NormalizedElement {
|
16 | name: string;
|
17 | attrs: Option<NormalizedAttrs>;
|
18 | block: Option<NormalizedBlock>;
|
19 | }
|
20 | export interface NormalizedAngleInvocation {
|
21 | head: NormalizedExpression;
|
22 | attrs: Option<NormalizedAttrs>;
|
23 | block: Option<NormalizedBlock>;
|
24 | }
|
25 | export declare const enum HeadKind {
|
26 | Block = "Block",
|
27 | Call = "Call",
|
28 | Element = "Element",
|
29 | AppendPath = "AppendPath",
|
30 | AppendExpr = "AppendExpr",
|
31 | Literal = "Literal",
|
32 | Modifier = "Modifier",
|
33 | DynamicComponent = "DynamicComponent",
|
34 | Comment = "Comment",
|
35 | Splat = "Splat",
|
36 | Keyword = "Keyword"
|
37 | }
|
38 | export declare enum VariableKind {
|
39 | Local = "Local",
|
40 | Free = "Free",
|
41 | Arg = "Arg",
|
42 | Block = "Block",
|
43 | This = "This"
|
44 | }
|
45 | export interface Variable {
|
46 | kind: VariableKind;
|
47 | name: string;
|
48 | |
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 | mode: 'loose' | 'strict';
|
57 | }
|
58 | export interface Path {
|
59 | head: Variable;
|
60 | tail: PresentArray<string>;
|
61 | }
|
62 | export interface AppendExpr {
|
63 | kind: HeadKind.AppendExpr;
|
64 | expr: NormalizedExpression;
|
65 | trusted: boolean;
|
66 | }
|
67 | export interface AppendPath {
|
68 | kind: HeadKind.AppendPath;
|
69 | path: NormalizedPath;
|
70 | trusted: boolean;
|
71 | }
|
72 | export interface NormalizedKeywordStatement {
|
73 | kind: HeadKind.Keyword;
|
74 | name: string;
|
75 | params: Option<NormalizedParams>;
|
76 | hash: Option<NormalizedHash>;
|
77 | blockParams: Option<string[]>;
|
78 | blocks: NormalizedBlocks;
|
79 | }
|
80 | export declare type NormalizedStatement = {
|
81 | kind: HeadKind.Call;
|
82 | head: NormalizedHead;
|
83 | params: Option<NormalizedParams>;
|
84 | hash: Option<NormalizedHash>;
|
85 | trusted: boolean;
|
86 | } | {
|
87 | kind: HeadKind.Block;
|
88 | head: NormalizedHead;
|
89 | params: Option<NormalizedParams>;
|
90 | hash: Option<NormalizedHash>;
|
91 | blockParams: Option<string[]>;
|
92 | blocks: NormalizedBlocks;
|
93 | } | NormalizedKeywordStatement | {
|
94 | kind: HeadKind.Element;
|
95 | name: string;
|
96 | attrs: NormalizedAttrs;
|
97 | block: NormalizedBlock;
|
98 | } | {
|
99 | kind: HeadKind.Comment;
|
100 | value: string;
|
101 | } | {
|
102 | kind: HeadKind.Literal;
|
103 | value: string;
|
104 | } | AppendPath | AppendExpr | {
|
105 | kind: HeadKind.Modifier;
|
106 | params: NormalizedParams;
|
107 | hash: Option<NormalizedHash>;
|
108 | } | {
|
109 | kind: HeadKind.DynamicComponent;
|
110 | expr: NormalizedExpression;
|
111 | hash: Option<NormalizedHash>;
|
112 | block: NormalizedBlock;
|
113 | };
|
114 | export declare function normalizeStatement(statement: BuilderStatement): NormalizedStatement;
|
115 | export declare function normalizeAppendHead(head: NormalizedHead, trusted: boolean): AppendExpr | AppendPath;
|
116 | export declare type SugaryArrayStatement = BuilderCallExpression | BuilderElement | BuilderBlockStatement;
|
117 | export declare function normalizeSugaryArrayStatement(statement: SugaryArrayStatement): NormalizedStatement;
|
118 | export declare function normalizePathHead(whole: string): Variable;
|
119 | export declare type BuilderBlockStatement = [string, BuilderBlock | BuilderBlocks] | [string, BuilderParams | BuilderBlockHash, BuilderBlock | BuilderBlocks] | [string, BuilderParams, BuilderBlockHash, BuilderBlock | BuilderBlocks];
|
120 | export interface NormalizedBuilderBlockStatement {
|
121 | head: NormalizedHead;
|
122 | params: Option<NormalizedParams>;
|
123 | hash: Option<NormalizedHash>;
|
124 | blockParams: Option<string[]>;
|
125 | blocks: NormalizedBlocks;
|
126 | }
|
127 | export declare function normalizeBuilderBlockStatement(statement: BuilderBlockStatement): NormalizedBuilderBlockStatement;
|
128 | export declare function entries<D extends Dict>(dict: D, callback: <K extends keyof D>(key: K, value: D[K]) => void): void;
|
129 | export declare type BuilderElement = [string] | [string, BuilderAttrs, BuilderBlock] | [string, BuilderBlock] | [string, BuilderAttrs];
|
130 | export declare type BuilderComment = [Builder.Comment, string];
|
131 | export declare type InvocationElement = [string] | [string, BuilderAttrs, BuilderBlock] | [string, BuilderBlock] | [string, BuilderAttrs];
|
132 | export declare function isElement(input: [string, ...unknown[]]): input is BuilderElement;
|
133 | export declare function extractElement(input: string): Option<string>;
|
134 | export declare function extractAngleInvocation(input: string): Option<string>;
|
135 | export declare function isAngleInvocation(input: [string, ...unknown[]]): input is InvocationElement;
|
136 | export declare function isBlock(input: [string, ...unknown[]]): input is BuilderBlockStatement;
|
137 | export declare const enum Builder {
|
138 | Literal = 0,
|
139 | Comment = 1,
|
140 | Append = 2,
|
141 | Modifier = 3,
|
142 | DynamicComponent = 4,
|
143 | Get = 5,
|
144 | Concat = 6,
|
145 | HasBlock = 7,
|
146 | HasBlockParams = 8
|
147 | }
|
148 | export declare type VerboseStatement = [Builder.Literal, string] | [Builder.Comment, string] | [Builder.Append, BuilderExpression, true] | [Builder.Append, BuilderExpression] | [Builder.Modifier, Params, Hash] | [Builder.DynamicComponent, BuilderExpression, Hash, BuilderBlock];
|
149 | export declare type BuilderStatement = VerboseStatement | SugaryArrayStatement | TupleBuilderExpression | string;
|
150 | export declare type BuilderAttr = 'splat' | BuilderExpression;
|
151 | export declare type TupleBuilderExpression = [Builder.Literal, string | boolean | null | undefined] | [Builder.Get, string] | [Builder.Get, string, string[]] | [Builder.Concat, ...BuilderExpression[]] | [Builder.HasBlock, string] | [Builder.HasBlockParams, string] | BuilderCallExpression;
|
152 | declare type Params = BuilderParams;
|
153 | declare type Hash = Dict<BuilderExpression>;
|
154 | export declare const enum ExpressionKind {
|
155 | Literal = "Literal",
|
156 | Call = "Call",
|
157 | GetPath = "GetPath",
|
158 | GetVar = "GetVar",
|
159 | Concat = "Concat",
|
160 | HasBlock = "HasBlock",
|
161 | HasBlockParams = "HasBlockParams"
|
162 | }
|
163 | export interface NormalizedCallExpression {
|
164 | type: ExpressionKind.Call;
|
165 | head: NormalizedHead;
|
166 | params: Option<NormalizedParams>;
|
167 | hash: Option<NormalizedHash>;
|
168 | }
|
169 | export interface NormalizedPath {
|
170 | type: ExpressionKind.GetPath;
|
171 | path: Path;
|
172 | }
|
173 | export interface NormalizedVar {
|
174 | type: ExpressionKind.GetVar;
|
175 | variable: Variable;
|
176 | }
|
177 | export declare type NormalizedHead = NormalizedPath | NormalizedVar;
|
178 | export interface NormalizedConcat {
|
179 | type: ExpressionKind.Concat;
|
180 | params: [NormalizedExpression, ...NormalizedExpression[]];
|
181 | }
|
182 | export declare type NormalizedExpression = {
|
183 | type: ExpressionKind.Literal;
|
184 | value: null | undefined | boolean | string | number;
|
185 | } | NormalizedCallExpression | NormalizedPath | NormalizedVar | NormalizedConcat | {
|
186 | type: ExpressionKind.HasBlock;
|
187 | name: string;
|
188 | } | {
|
189 | type: ExpressionKind.HasBlockParams;
|
190 | name: string;
|
191 | };
|
192 | export declare function normalizeAppendExpression(expression: BuilderExpression, forceTrusted?: boolean): AppendExpr | AppendPath;
|
193 | export declare function normalizeExpression(expression: BuilderExpression): NormalizedExpression;
|
194 | export declare type BuilderExpression = TupleBuilderExpression | BuilderCallExpression | null | undefined | boolean | string | number;
|
195 | export declare function isBuilderExpression(expr: BuilderExpression | BuilderCallExpression): expr is TupleBuilderExpression | BuilderCallExpression;
|
196 | export declare function isLiteral(expr: BuilderExpression | BuilderCallExpression): expr is [Builder.Literal, string | boolean | undefined];
|
197 | export declare function statementIsExpression(statement: BuilderStatement): statement is TupleBuilderExpression;
|
198 | export declare function isBuilderCallExpression(value: TupleBuilderExpression | BuilderCallExpression): value is BuilderCallExpression;
|
199 | export declare type MiniBuilderBlock = BuilderStatement[];
|
200 | export declare type BuilderBlock = MiniBuilderBlock;
|
201 | export declare type BuilderCallExpression = [string] | [string, Params | Hash] | [string, Params, Hash];
|
202 | export declare function normalizeParams(input: Params): NormalizedParams;
|
203 | export declare function normalizeHash(input: Option<Hash>): Option<NormalizedHash>;
|
204 | export declare function normalizeCallExpression(expr: BuilderCallExpression): NormalizedCallExpression;
|
205 | export {};
|
206 |
|
\ | No newline at end of file |