UNPKG

2.35 kBTypeScriptView Raw
1import { SourceSlice } from '../../source/slice';
2import { NamedArgument } from './args';
3import type { CallFields } from './base';
4import type { ExpressionNode } from './expr';
5/**
6 * Attr nodes look like HTML attributes, but are classified as:
7 *
8 * 1. `HtmlAttr`, which means a regular HTML attribute in Glimmer
9 * 2. `SplatAttr`, which means `...attributes`
10 * 3. `ComponentArg`, which means an attribute whose name begins with `@`, and it is therefore a
11 * component argument.
12 */
13export declare type AttrNode = HtmlAttr | SplatAttr | ComponentArg;
14/**
15 * `HtmlAttr` and `SplatAttr` are grouped together because the order of the `SplatAttr` node,
16 * relative to other attributes, matters.
17 */
18export declare type HtmlOrSplatAttr = HtmlAttr | SplatAttr;
19/**
20 * "Attr Block" nodes are allowed inside an open element tag in templates. They interact with the
21 * element (or component).
22 */
23export declare type AttrBlockNode = AttrNode | ElementModifier;
24declare const HtmlAttr_base: import("./node").TypedNodeConstructor<"HtmlAttr", AttrNodeOptions & import("./node").BaseNodeFields>;
25/**
26 * `HtmlAttr` nodes are valid HTML attributes, with or without a value.
27 *
28 * Exceptions:
29 *
30 * - `...attributes` is `SplatAttr`
31 * - `@x=<value>` is `ComponentArg`
32 */
33export declare class HtmlAttr extends HtmlAttr_base {
34}
35declare const SplatAttr_base: import("./node").TypedNodeConstructor<"SplatAttr", {
36 symbol: number;
37} & import("./node").BaseNodeFields>;
38export declare class SplatAttr extends SplatAttr_base {
39}
40declare const ComponentArg_base: import("./node").NodeConstructor<AttrNodeOptions & import("./node").BaseNodeFields>;
41/**
42 * Corresponds to an argument passed by a component (`@x=<value>`)
43 */
44export declare class ComponentArg extends ComponentArg_base {
45 /**
46 * Convert the component argument into a named argument node
47 */
48 toNamedArgument(): NamedArgument;
49}
50declare const ElementModifier_base: import("./node").TypedNodeConstructor<"ElementModifier", CallFields & import("./node").BaseNodeFields>;
51/**
52 * An `ElementModifier` is just a normal call node in modifier position.
53 */
54export declare class ElementModifier extends ElementModifier_base {
55}
56export interface AttrNodeOptions {
57 name: SourceSlice;
58 value: ExpressionNode;
59 trusting: boolean;
60}
61export {};
62//# sourceMappingURL=attr-block.d.ts.map
\No newline at end of file