UNPKG

5.21 kBTypeScriptView Raw
1import { Bounds, Cursor, CursorStackSymbol, ElementBuilder, ElementOperations, Environment, GlimmerTreeChanges, GlimmerTreeConstruction, LiveBlock, Maybe, Option, UpdatableBlock, ModifierInstance } from '@glimmer/interfaces';
2import { Stack } from '@glimmer/util';
3import { AttrNamespace, SimpleComment, SimpleDocumentFragment, SimpleElement, SimpleNode, SimpleText } from '@simple-dom/interface';
4import { CursorImpl } from '../bounds';
5import { DynamicAttribute } from './attributes/dynamic';
6export interface FirstNode {
7 firstNode(): SimpleNode;
8}
9export interface LastNode {
10 lastNode(): SimpleNode;
11}
12export declare class Fragment implements Bounds {
13 private bounds;
14 constructor(bounds: Bounds);
15 parentElement(): SimpleElement;
16 firstNode(): SimpleNode;
17 lastNode(): SimpleNode;
18}
19export declare const CURSOR_STACK: CursorStackSymbol;
20export declare class NewElementBuilder implements ElementBuilder {
21 dom: GlimmerTreeConstruction;
22 updateOperations: GlimmerTreeChanges;
23 constructing: Option<SimpleElement>;
24 operations: Option<ElementOperations>;
25 private env;
26 [CURSOR_STACK]: Stack<Cursor>;
27 private modifierStack;
28 private blockStack;
29 static forInitialRender(env: Environment, cursor: CursorImpl): NewElementBuilder;
30 static resume(env: Environment, block: UpdatableBlock): NewElementBuilder;
31 constructor(env: Environment, parentNode: SimpleElement, nextSibling: Option<SimpleNode>);
32 protected initialize(): this;
33 debugBlocks(): LiveBlock[];
34 get element(): SimpleElement;
35 get nextSibling(): Option<SimpleNode>;
36 get hasBlocks(): boolean;
37 protected block(): LiveBlock;
38 popElement(): void;
39 pushSimpleBlock(): LiveBlock;
40 pushUpdatableBlock(): UpdatableBlockImpl;
41 pushBlockList(list: LiveBlock[]): LiveBlockList;
42 protected pushLiveBlock<T extends LiveBlock>(block: T, isRemote?: boolean): T;
43 popBlock(): LiveBlock;
44 __openBlock(): void;
45 __closeBlock(): void;
46 openElement(tag: string): SimpleElement;
47 __openElement(tag: string): SimpleElement;
48 flushElement(modifiers: Option<ModifierInstance[]>): void;
49 __flushElement(parent: SimpleElement, constructing: SimpleElement): void;
50 closeElement(): Option<ModifierInstance[]>;
51 pushRemoteElement(element: SimpleElement, guid: string, insertBefore: Maybe<SimpleNode>): Option<RemoteLiveBlock>;
52 __pushRemoteElement(element: SimpleElement, _guid: string, insertBefore: Maybe<SimpleNode>): Option<RemoteLiveBlock>;
53 popRemoteElement(): void;
54 protected pushElement(element: SimpleElement, nextSibling?: Maybe<SimpleNode>): void;
55 private pushModifiers;
56 private popModifiers;
57 didAppendBounds(bounds: Bounds): Bounds;
58 didAppendNode<T extends SimpleNode>(node: T): T;
59 didOpenElement(element: SimpleElement): SimpleElement;
60 willCloseElement(): void;
61 appendText(string: string): SimpleText;
62 __appendText(text: string): SimpleText;
63 __appendNode(node: SimpleNode): SimpleNode;
64 __appendFragment(fragment: SimpleDocumentFragment): Bounds;
65 __appendHTML(html: string): Bounds;
66 appendDynamicHTML(value: string): void;
67 appendDynamicText(value: string): SimpleText;
68 appendDynamicFragment(value: SimpleDocumentFragment): void;
69 appendDynamicNode(value: SimpleNode): void;
70 private trustedContent;
71 private untrustedContent;
72 appendComment(string: string): SimpleComment;
73 __appendComment(string: string): SimpleComment;
74 __setAttribute(name: string, value: string, namespace: Option<AttrNamespace>): void;
75 __setProperty(name: string, value: unknown): void;
76 setStaticAttribute(name: string, value: string, namespace: Option<AttrNamespace>): void;
77 setDynamicAttribute(name: string, value: unknown, trusting: boolean, namespace: Option<AttrNamespace>): DynamicAttribute;
78}
79export declare class SimpleLiveBlock implements LiveBlock {
80 private parent;
81 protected first: Option<FirstNode>;
82 protected last: Option<LastNode>;
83 protected nesting: number;
84 constructor(parent: SimpleElement);
85 parentElement(): SimpleElement;
86 firstNode(): SimpleNode;
87 lastNode(): SimpleNode;
88 openElement(element: SimpleElement): void;
89 closeElement(): void;
90 didAppendNode(node: SimpleNode): void;
91 didAppendBounds(bounds: Bounds): void;
92 finalize(stack: ElementBuilder): void;
93}
94export declare class RemoteLiveBlock extends SimpleLiveBlock {
95 constructor(parent: SimpleElement);
96}
97export declare class UpdatableBlockImpl extends SimpleLiveBlock implements UpdatableBlock {
98 reset(): Option<SimpleNode>;
99}
100export declare class LiveBlockList implements LiveBlock {
101 private readonly parent;
102 boundList: LiveBlock[];
103 constructor(parent: SimpleElement, boundList: LiveBlock[]);
104 parentElement(): SimpleElement;
105 firstNode(): SimpleNode;
106 lastNode(): SimpleNode;
107 openElement(_element: SimpleElement): void;
108 closeElement(): void;
109 didAppendNode(_node: SimpleNode): void;
110 didAppendBounds(_bounds: Bounds): void;
111 finalize(_stack: ElementBuilder): void;
112}
113export declare function clientBuilder(env: Environment, cursor: CursorImpl): ElementBuilder;
114//# sourceMappingURL=element-builder.d.ts.map
\No newline at end of file