UNPKG

1.07 kBTypeScriptView Raw
1import {
2 Namespace,
3 SimpleComment,
4 SimpleElement,
5 SimpleNode,
6 SimpleText,
7} from '@simple-dom/interface';
8import { Option } from '../core';
9import { Bounds } from './bounds';
10
11export interface GlimmerDOMOperations {
12 createElement(tag: string, context?: SimpleElement): SimpleElement;
13 insertBefore(parent: SimpleElement, node: SimpleNode, reference: Option<SimpleNode>): void;
14 insertHTMLBefore(parent: SimpleElement, nextSibling: Option<SimpleNode>, html: string): Bounds;
15 createTextNode(text: string): SimpleText;
16 createComment(data: string): SimpleComment;
17}
18
19export interface GlimmerTreeChanges extends GlimmerDOMOperations {
20 setAttribute(element: SimpleElement, name: string, value: string): void;
21 removeAttribute(element: SimpleElement, name: string): void;
22 insertAfter(element: SimpleElement, node: SimpleNode, reference: SimpleNode): void;
23}
24
25export interface GlimmerTreeConstruction extends GlimmerDOMOperations {
26 setAttribute(
27 element: SimpleElement,
28 name: string,
29 value: string,
30 namespace?: Option<Namespace>
31 ): void;
32}