incajs 0.0.33 → 0.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/hooks-DrVhbaR0.js +1 -0
- package/dist/chunks/{rendererCore-B5s1VDRj.d.ts → rendererCore-MkDukDmX.d.ts} +21 -24
- package/dist/chunks/{rendererCore-Cnyh79II.js → rendererCore-hjb_YEzl.js} +1 -1
- package/dist/chunks/{treeOps-HfdCml0F.js → treeOps-BFrsoJSW.js} +1 -1
- package/dist/chunks/{window-CE2esnja.d.ts → window-DUfFz2C1.d.ts} +410 -312
- package/dist/globals.d.mts +135 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/rendererCore.d.ts +3 -3
- package/dist/rendererCore.js +1 -1
- package/dist/style.js +1 -1
- package/dist/vue.d.ts +2 -2
- package/dist/vue.js +2 -2
- package/package.json +2 -1
- package/dist/chunks/hooks-CxYWemIJ.js +0 -1
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/** The events whose handler property every element has. */
|
|
2
|
-
declare const HANDLER_EVENTS: readonly ["auxclick", "beforeinput", "blur", "change", "click", "contextmenu", "dblclick", "focus", "gotpointercapture", "input", "keydown", "keypress", "keyup", "lostpointercapture", "mousedown", "mouseenter", "mouseleave", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointerenter", "pointerleave", "pointermove", "pointerout", "pointerover", "pointerup", "scroll", "wheel"];
|
|
3
1
|
/**
|
|
4
2
|
* Stable handle to a node in the native retained tree, returned by `createNode`
|
|
5
3
|
* and used in every later call that touches that node.
|
|
@@ -19,12 +17,22 @@ type AttributeValue = string | number | boolean;
|
|
|
19
17
|
type ScrollAlignment = "start" | "center" | "end" | "nearest";
|
|
20
18
|
/** How {@link IncaNative.linkedNode} names the node to reach from a node. */
|
|
21
19
|
type NodeLink = "parent" | "first" | "last" | "previous" | "next";
|
|
20
|
+
/** Where `insertNodes` puts its nodes: into the node or next to it. */
|
|
21
|
+
type InsertionPlace = "append" | "prepend" | "before" | "after" | "replaceWith" | "replaceChildren";
|
|
22
22
|
/**
|
|
23
23
|
* The name of an element. A string is the tag of an HTML element: it is the local name, and its
|
|
24
24
|
* ASCII upper case is the `tagName`. A tuple holds the four name parts of
|
|
25
25
|
* `createElementNS`.
|
|
26
26
|
*/
|
|
27
27
|
type ElementName = string | [localName: string, namespaceURI: string | null, prefix: string | null, tagName: string];
|
|
28
|
+
/**
|
|
29
|
+
* The last drawn box of a node in window logical pixels. `border` is one uniform width. `scrollX`
|
|
30
|
+
* and `scrollY` are the positive scroll offset the parent applied to the box, and `gutterWidth`
|
|
31
|
+
* and `gutterHeight` are the strips the scrollbars reserve inside the border.
|
|
32
|
+
*/
|
|
33
|
+
type NodeBox = readonly [x: number, y: number, width: number, height: number, border: number, scrollX: number, scrollY: number, gutterWidth: number, gutterHeight: number];
|
|
34
|
+
/** The scroll offset of a node and its maximum, as of the last drawn frame. */
|
|
35
|
+
type NodeScroll = readonly [left: number, top: number, maxLeft: number, maxTop: number];
|
|
28
36
|
/**
|
|
29
37
|
* What a native returns for a copy of a node without a name: id, the marker or tag, and the text
|
|
30
38
|
* of a `#text` copy (`null` for any other node).
|
|
@@ -42,8 +50,35 @@ type ParsedEntry = [id: NodeId, tag: string, namespaceURI: string | null, parent
|
|
|
42
50
|
* its container, and the nodes in pre-order. An entry whose parent is no entry is a root.
|
|
43
51
|
*/
|
|
44
52
|
type Parsed = [position: number, entries: ParsedEntry[]];
|
|
45
|
-
/**
|
|
46
|
-
type
|
|
53
|
+
/** The target that names `window`, as the host gives it. */
|
|
54
|
+
type WindowTargetId = string & {
|
|
55
|
+
readonly __windowTarget: unique symbol;
|
|
56
|
+
};
|
|
57
|
+
/** An `AbortSignal` object that names itself as a target. */
|
|
58
|
+
type SignalTarget = object & {
|
|
59
|
+
readonly __signalTarget: unique symbol;
|
|
60
|
+
};
|
|
61
|
+
/** What a listener or a dispatch names: a node id, the target of `window`, or a signal. */
|
|
62
|
+
type EventTargetId = NodeId | WindowTargetId | SignalTarget;
|
|
63
|
+
/** What `__inca_targets__` takes: the targets that have no signal. */
|
|
64
|
+
type HookTarget = NodeId | WindowTargetId;
|
|
65
|
+
/**
|
|
66
|
+
* The prototypes of the node interfaces that the host holds, by name. `ForeignElement` is the
|
|
67
|
+
* prototype of an SVG or MathML element and no global names it.
|
|
68
|
+
*/
|
|
69
|
+
interface InterfacePrototypes {
|
|
70
|
+
EventTarget: object;
|
|
71
|
+
Node: object;
|
|
72
|
+
CharacterData: object;
|
|
73
|
+
Text: object;
|
|
74
|
+
Comment: object;
|
|
75
|
+
Element: object;
|
|
76
|
+
HTMLElement: object;
|
|
77
|
+
ForeignElement: object;
|
|
78
|
+
DocumentFragment: object;
|
|
79
|
+
Document: object;
|
|
80
|
+
HTMLDocument: object;
|
|
81
|
+
}
|
|
47
82
|
/**
|
|
48
83
|
* The host-injected object every wrapper in this package forwards to. Not part of the public
|
|
49
84
|
* surface.
|
|
@@ -51,6 +86,8 @@ type EventTargetId = NodeId | "$window";
|
|
|
51
86
|
interface IncaNative {
|
|
52
87
|
rootNodeId(): NodeId;
|
|
53
88
|
documentNodeId(): NodeId;
|
|
89
|
+
interfacePrototypes(): InterfacePrototypes;
|
|
90
|
+
registerUncloneable(map: WeakMap<object, unknown>): void;
|
|
54
91
|
createNode(tag: string): NodeId;
|
|
55
92
|
createElement(localName: string): [NodeId, TagName];
|
|
56
93
|
createElementNS(namespace: string | null, qualifiedName: string): ElementEntry;
|
|
@@ -59,6 +96,7 @@ interface IncaNative {
|
|
|
59
96
|
insertBefore(parentId: NodeId, nodeId: NodeId, refId: NodeId | null): number;
|
|
60
97
|
removeChild(parentId: NodeId, childId: NodeId): void;
|
|
61
98
|
replaceChild(parentId: NodeId, nodeId: NodeId, childId: NodeId): number;
|
|
99
|
+
insertNodes(nodeId: NodeId, place: InsertionPlace, nodes: (NodeId | string)[]): [textIds: NodeId[], removedIds: NodeId[]] | null;
|
|
62
100
|
cloneNode(nodeId: NodeId, deep: boolean): (NodeEntry | ElementEntry)[];
|
|
63
101
|
templateContent(nodeId: NodeId): NodeId | null;
|
|
64
102
|
innerHtml(nodeId: NodeId): string;
|
|
@@ -97,7 +135,7 @@ interface IncaNative {
|
|
|
97
135
|
styleOf(nodeId: NodeId): CSSStyleDeclaration;
|
|
98
136
|
inputValue(nodeId: NodeId): string;
|
|
99
137
|
setInputValue(nodeId: NodeId, value: string): void;
|
|
100
|
-
addEventListener(target: EventTargetId, event: string, callback: HostCallback, capture?: boolean, passive?: boolean): CallbackId;
|
|
138
|
+
addEventListener(target: EventTargetId, event: string, callback: HostCallback, capture?: boolean, passive?: boolean, signal?: SignalTarget): CallbackId | null;
|
|
101
139
|
removeEventListener(target: EventTargetId, event: string, callbackId: CallbackId): boolean;
|
|
102
140
|
removeNode(nodeId: NodeId): [callbackIds: CallbackId[], nodeIds: NodeId[]];
|
|
103
141
|
holdNode(nodeId: NodeId): void;
|
|
@@ -105,11 +143,13 @@ interface IncaNative {
|
|
|
105
143
|
focusNode(nodeId: NodeId, preventScroll?: boolean): void;
|
|
106
144
|
blurNode(nodeId: NodeId): void;
|
|
107
145
|
focusedNode(): NodeId | null;
|
|
108
|
-
layoutOf(nodeId: NodeId):
|
|
109
|
-
scrollOf(nodeId: NodeId):
|
|
146
|
+
layoutOf(nodeId: NodeId): NodeBox | null;
|
|
147
|
+
scrollOf(nodeId: NodeId): NodeScroll | null;
|
|
110
148
|
scrollNode(nodeId: NodeId, left: number | null, top: number | null): void;
|
|
111
149
|
scrollIntoViewNode(nodeId: NodeId, block: ScrollAlignment, inline: ScrollAlignment): void;
|
|
112
150
|
dispatchEvent(target: EventTargetId, event: EventLike): boolean;
|
|
151
|
+
windowTargetId(): WindowTargetId;
|
|
152
|
+
signalId(value: unknown): number | null;
|
|
113
153
|
click(nodeId: NodeId): void;
|
|
114
154
|
setPointerCapture(nodeId: NodeId, pointerId: number): void;
|
|
115
155
|
releasePointerCapture(nodeId: NodeId, pointerId: number): void;
|
|
@@ -120,7 +160,7 @@ type HostCallback = (...args: unknown[]) => void;
|
|
|
120
160
|
declare global {
|
|
121
161
|
var __inca_native__: IncaNative;
|
|
122
162
|
var __inca_released__: (nodeIds: NodeId[], callbackIds: CallbackId[]) => void;
|
|
123
|
-
var __inca_targets__: (targets:
|
|
163
|
+
var __inca_targets__: (targets: HookTarget[]) => unknown[];
|
|
124
164
|
}
|
|
125
165
|
/**
|
|
126
166
|
* Returns the host-allocated root container's id, the node an app attaches
|
|
@@ -204,12 +244,10 @@ declare function removeStyle(nodeId: NodeId, key: string): void;
|
|
|
204
244
|
* Returns the box `nodeId` was drawn at in the last frame, in window logical
|
|
205
245
|
* pixels, or `null` if the node has no recorded box.
|
|
206
246
|
* @param nodeId - the node to read
|
|
207
|
-
* @returns
|
|
208
|
-
* width on all sides. `scrollX` and `scrollY` are the positive scroll offset the parent applied
|
|
209
|
-
* to the box.
|
|
247
|
+
* @returns the box, or `null`
|
|
210
248
|
* @throws {TypeError} when `nodeId` names no node
|
|
211
249
|
*/
|
|
212
|
-
declare function layoutOf(nodeId: NodeId):
|
|
250
|
+
declare function layoutOf(nodeId: NodeId): NodeBox | null;
|
|
213
251
|
/**
|
|
214
252
|
* Returns the scroll offset of `nodeId` in window logical pixels. A write made
|
|
215
253
|
* since the last draw is included, clamped to the maximum of the last drawn
|
|
@@ -220,7 +258,7 @@ declare function layoutOf(nodeId: NodeId): readonly [number, number, number, num
|
|
|
220
258
|
* of the last drawn frame.
|
|
221
259
|
* @throws {TypeError} when `nodeId` names no node
|
|
222
260
|
*/
|
|
223
|
-
declare function scrollOf(nodeId: NodeId):
|
|
261
|
+
declare function scrollOf(nodeId: NodeId): NodeScroll | null;
|
|
224
262
|
/**
|
|
225
263
|
* Sets the scroll offset of `nodeId` on one or both axes. A `null` axis keeps
|
|
226
264
|
* its current offset. The host clamps each value to the scrollable range on
|
|
@@ -243,8 +281,9 @@ declare function scrollIntoViewNode(nodeId: NodeId, block: ScrollAlignment, inli
|
|
|
243
281
|
/**
|
|
244
282
|
* Dispatches `event` at a target along its path. Dispatching at an element
|
|
245
283
|
* reaches its ancestors, `document` and `window`. Dispatching at `document`
|
|
246
|
-
* reaches `window`, and dispatching at `window` reaches only `window`.
|
|
247
|
-
*
|
|
284
|
+
* reaches `window`, and dispatching at `window` reaches only `window`. Dispatching at a signal
|
|
285
|
+
* reaches only that signal.
|
|
286
|
+
* @param target - the target to dispatch at (a node id, the window target or a signal object)
|
|
248
287
|
* @param event - the event to dispatch
|
|
249
288
|
* @returns `false` when a listener canceled a cancelable event, else `true`
|
|
250
289
|
* @throws TypeError when `target` is malformed or is an unknown target tag
|
|
@@ -291,6 +330,8 @@ declare function focusedNode(): NodeId | null;
|
|
|
291
330
|
* @returns `true` after {@link markRemoved} reached `node`, or when the host freed it
|
|
292
331
|
*/
|
|
293
332
|
declare function isRemoved(node: IncaNode): boolean;
|
|
333
|
+
/** The events whose handler property every element has. */
|
|
334
|
+
declare const HANDLER_EVENTS: readonly ["auxclick", "beforeinput", "blur", "change", "click", "contextmenu", "dblclick", "focus", "gotpointercapture", "input", "keydown", "keypress", "keyup", "lostpointercapture", "mousedown", "mouseenter", "mouseleave", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointerenter", "pointerleave", "pointermove", "pointerout", "pointerover", "pointerup", "scroll", "wheel"];
|
|
294
335
|
/** The plain values of a {@link RectLike}, as `toJSON` returns them. */
|
|
295
336
|
interface RectValues {
|
|
296
337
|
readonly x: number;
|
|
@@ -456,179 +497,6 @@ interface NamedNodeMap {
|
|
|
456
497
|
getNamedItem(qualifiedName: string): Attr | null;
|
|
457
498
|
[Symbol.iterator](): IterableIterator<Attr>;
|
|
458
499
|
}
|
|
459
|
-
/** The members every node has: what it is, its data and its place in the tree. */
|
|
460
|
-
interface NodeMembers {
|
|
461
|
-
/**
|
|
462
|
-
* `1` for an element, `3` for a text node, `8` for a comment stand-in, `9` for the document and
|
|
463
|
-
* `11` for a fragment.
|
|
464
|
-
*/
|
|
465
|
-
readonly nodeType: 1 | 3 | 8 | 9 | 11;
|
|
466
|
-
/**
|
|
467
|
-
* The {@link IncaElement.tagName} of an element, `"#text"` for a text node, `"#comment"` for a
|
|
468
|
-
* comment stand-in, `"#document"` for the document and `"#document-fragment"` for a fragment.
|
|
469
|
-
*/
|
|
470
|
-
readonly nodeName: string;
|
|
471
|
-
/**
|
|
472
|
-
* The data of a text node or a comment stand-in, and `null` for an element, the document or a
|
|
473
|
-
* fragment. Assigning `null` or `undefined` stores `""` and any other value stores its string.
|
|
474
|
-
* Assigning to an element, the document, a fragment or a freed node does nothing.
|
|
475
|
-
*/
|
|
476
|
-
nodeValue: string | null;
|
|
477
|
-
/** Whether the node hangs under `document`. */
|
|
478
|
-
readonly isConnected: boolean;
|
|
479
|
-
/** `document`, and `null` for `document` itself. */
|
|
480
|
-
readonly ownerDocument: IncaDocument | null;
|
|
481
|
-
/**
|
|
482
|
-
* The parent, or `null` for a detached node. A node inside a fragment reads the fragment. A
|
|
483
|
-
* freed node reads `null`.
|
|
484
|
-
*/
|
|
485
|
-
readonly parentNode: IncaElement | IncaFragment | IncaDocument | null;
|
|
486
|
-
/** The first child, or `null`. */
|
|
487
|
-
readonly firstChild: IncaNode | null;
|
|
488
|
-
/** The last child, or `null`. */
|
|
489
|
-
readonly lastChild: IncaNode | null;
|
|
490
|
-
/** The sibling right before this node, or `null`. */
|
|
491
|
-
readonly previousSibling: IncaNode | null;
|
|
492
|
-
/** The sibling right after this node, or `null`. */
|
|
493
|
-
readonly nextSibling: IncaNode | null;
|
|
494
|
-
/**
|
|
495
|
-
* The children in order, as a live list. Every read returns the same object, which follows later
|
|
496
|
-
* changes. A freed node has an empty list.
|
|
497
|
-
*/
|
|
498
|
-
readonly childNodes: NodeListOf<IncaNode>;
|
|
499
|
-
/** Whether the node has a child. */
|
|
500
|
-
hasChildNodes(): boolean;
|
|
501
|
-
/**
|
|
502
|
-
* Appends `node` as the last child. A fragment gives up its children in order and stays empty.
|
|
503
|
-
* A node that has a parent moves. Throws `HierarchyRequestError` when this node is a text node or
|
|
504
|
-
* a comment, or when `node` is this node or one of its ancestors.
|
|
505
|
-
* @returns `node`
|
|
506
|
-
*/
|
|
507
|
-
appendChild<T extends IncaNode>(node: T): T;
|
|
508
|
-
/**
|
|
509
|
-
* Inserts `node` before `child`, or last when `child` is `null` or `undefined`. A fragment gives
|
|
510
|
-
* up its children in order and stays empty. Throws `HierarchyRequestError` as
|
|
511
|
-
* {@link NodeMembers.appendChild} does, and `NotFoundError` when `child` is not a child of this
|
|
512
|
-
* node.
|
|
513
|
-
* @returns `node`
|
|
514
|
-
*/
|
|
515
|
-
insertBefore<T extends IncaNode>(node: T, child: IncaNode | null | undefined): T;
|
|
516
|
-
/**
|
|
517
|
-
* Removes `child`, which keeps its listeners and can be inserted again. Throws `NotFoundError`
|
|
518
|
-
* when `child` is not a child of this node.
|
|
519
|
-
* @returns `child`
|
|
520
|
-
*/
|
|
521
|
-
removeChild<T extends IncaNode>(child: T): T;
|
|
522
|
-
/**
|
|
523
|
-
* Puts `node` in the place of `child`, which keeps its listeners and can be inserted again.
|
|
524
|
-
* Throws as {@link NodeMembers.insertBefore} does, with `child` as the node that has to be a
|
|
525
|
-
* child of this node.
|
|
526
|
-
* @returns `child`
|
|
527
|
-
*/
|
|
528
|
-
replaceChild<T extends IncaNode>(node: IncaNode, child: T): T;
|
|
529
|
-
/**
|
|
530
|
-
* Copies the node: its tag, attributes and style, and with `deep` its descendants. The copy has
|
|
531
|
-
* no parent, no listeners and no scroll offset, and the text of an `input` carries over.
|
|
532
|
-
* @param deep - whether the descendants are copied too
|
|
533
|
-
* @returns the copy
|
|
534
|
-
*/
|
|
535
|
-
cloneNode(deep?: boolean): this;
|
|
536
|
-
/**
|
|
537
|
-
* Whether `other` is this node or one of its descendants in the tree as rendered. `null` and
|
|
538
|
-
* `undefined` give `false`, and any other value that is not a node throws a `TypeError`. After
|
|
539
|
-
* the node is removed, it still answers for the subtree it keeps. A freed node contains only
|
|
540
|
-
* itself.
|
|
541
|
-
*/
|
|
542
|
-
contains(other: IncaNode | null): boolean;
|
|
543
|
-
/**
|
|
544
|
-
* The topmost node above this one: `document` for a connected node, else the top of its
|
|
545
|
-
* subtree, the node itself without a parent.
|
|
546
|
-
*/
|
|
547
|
-
getRootNode(): IncaNode;
|
|
548
|
-
/**
|
|
549
|
-
* The position of `other` relative to this node as a bit mask: `1` disconnected, `2` preceding,
|
|
550
|
-
* `4` following, `8` contains, `16` contained by and `32` implementation specific. Nodes of
|
|
551
|
-
* different trees give `1 | 32` plus `2` or `4`, with opposite directions for the two orders of
|
|
552
|
-
* the pair. A freed node is a tree of its own: it gives `1 | 32` plus `2` or `4` by the order of
|
|
553
|
-
* the two ids, and `0` for itself.
|
|
554
|
-
* @throws {TypeError} when `other` is not a node
|
|
555
|
-
*/
|
|
556
|
-
compareDocumentPosition(other: IncaNode): number;
|
|
557
|
-
/** Whether `other` is this node. `null` and `undefined` give `false`. */
|
|
558
|
-
isSameNode(other: IncaNode | null): boolean;
|
|
559
|
-
/**
|
|
560
|
-
* Whether `other` has the same tag, attributes, style and children, compared in depth. The typed
|
|
561
|
-
* text of an `input` is not compared. `null` and `undefined` give `false`. A freed node equals
|
|
562
|
-
* only itself.
|
|
563
|
-
*/
|
|
564
|
-
isEqualNode(other: IncaNode | null): boolean;
|
|
565
|
-
}
|
|
566
|
-
/** The `textContent` of a node. */
|
|
567
|
-
interface TextContentMember {
|
|
568
|
-
/**
|
|
569
|
-
* The data of a text node or a comment stand-in, and the data of the text nodes below an
|
|
570
|
-
* element in tree order, comment stand-ins left out. Assigning `null` or `undefined` stores `""`
|
|
571
|
-
* and any other value stores its string. Assigning to an element replaces its children with one
|
|
572
|
-
* text node, or with none for `""`. A freed node reads `""` or its last data and ignores the
|
|
573
|
-
* assignment.
|
|
574
|
-
*/
|
|
575
|
-
textContent: string;
|
|
576
|
-
}
|
|
577
|
-
/** The members of a text node and a comment stand-in that read and edit their data. */
|
|
578
|
-
interface CharacterDataMembers extends TextContentMember {
|
|
579
|
-
/** The data. Assigning `null` stores `""` and any other value stores its string. */
|
|
580
|
-
data: string;
|
|
581
|
-
/** The number of UTF-16 code units of the data. */
|
|
582
|
-
readonly length: number;
|
|
583
|
-
/**
|
|
584
|
-
* The part of the data from `offset`. Both arguments convert to unsigned 32-bit integers and
|
|
585
|
-
* count UTF-16 code units. `count` stops at the end of the data.
|
|
586
|
-
* @param offset - Where the part starts.
|
|
587
|
-
* @param count - The length of the part.
|
|
588
|
-
* @throws {DOMException} named `IndexSizeError` when `offset` is beyond the data.
|
|
589
|
-
*/
|
|
590
|
-
substringData(offset: number, count: number): string;
|
|
591
|
-
/**
|
|
592
|
-
* Adds `data` at the end of the data.
|
|
593
|
-
* @param data - The text to add.
|
|
594
|
-
*/
|
|
595
|
-
appendData(data: string): void;
|
|
596
|
-
/**
|
|
597
|
-
* Adds `data` at `offset`.
|
|
598
|
-
* @param offset - Where to add.
|
|
599
|
-
* @param data - The text to add.
|
|
600
|
-
* @throws {DOMException} named `IndexSizeError` when `offset` is beyond the data.
|
|
601
|
-
*/
|
|
602
|
-
insertData(offset: number, data: string): void;
|
|
603
|
-
/**
|
|
604
|
-
* Removes `count` units from `offset`.
|
|
605
|
-
* @param offset - Where the removal starts.
|
|
606
|
-
* @param count - The number of units, stopping at the end of the data.
|
|
607
|
-
* @throws {DOMException} named `IndexSizeError` when `offset` is beyond the data.
|
|
608
|
-
*/
|
|
609
|
-
deleteData(offset: number, count: number): void;
|
|
610
|
-
/**
|
|
611
|
-
* Replaces `count` units from `offset` with `data`.
|
|
612
|
-
* @param offset - Where the replaced part starts.
|
|
613
|
-
* @param count - The number of units, stopping at the end of the data.
|
|
614
|
-
* @param data - The new text.
|
|
615
|
-
* @throws {DOMException} named `IndexSizeError` when `offset` is beyond the data.
|
|
616
|
-
*/
|
|
617
|
-
replaceData(offset: number, count: number, data: string): void;
|
|
618
|
-
}
|
|
619
|
-
/** The members only a text node has. */
|
|
620
|
-
interface TextMembers {
|
|
621
|
-
/** The data of this node and of the text nodes that touch it, in order. */
|
|
622
|
-
readonly wholeText: string;
|
|
623
|
-
/**
|
|
624
|
-
* Cuts the data at `offset`. This node keeps the head and the new node holds the tail. The new
|
|
625
|
-
* node follows this one when this one has a parent, and has no parent otherwise.
|
|
626
|
-
* @param offset - Where to cut, converted like the offset of `substringData()`.
|
|
627
|
-
* @returns The new node.
|
|
628
|
-
* @throws {DOMException} named `IndexSizeError` when `offset` is beyond the data.
|
|
629
|
-
*/
|
|
630
|
-
splitText(offset: number): IncaText;
|
|
631
|
-
}
|
|
632
500
|
/**
|
|
633
501
|
* The inline style of an element. Every style key and every CSS alias is a property in camelCase
|
|
634
502
|
* and in kebab-case, and the host-only style keys are properties too. Reading a property gives the
|
|
@@ -774,16 +642,14 @@ interface HtmlMembers {
|
|
|
774
642
|
insertAdjacentHTML(position: string, text: string): void;
|
|
775
643
|
}
|
|
776
644
|
/**
|
|
777
|
-
*
|
|
778
|
-
* `createCommentNode` makes. It is the only node type that can act as a
|
|
779
|
-
* parent.
|
|
645
|
+
* An element, a node with a tag, attributes and children.
|
|
780
646
|
*
|
|
781
647
|
* A removed node keeps its attributes and its position in its own subtree, and its members read
|
|
782
648
|
* them. Its listeners are dropped. `addEventListener()` and `removeEventListener()` ignore the
|
|
783
649
|
* call, an assignment to a handler property does nothing, and `dispatchEvent()` runs no listener
|
|
784
650
|
* on it.
|
|
785
651
|
*/
|
|
786
|
-
interface IncaElement extends IncaEventTarget,
|
|
652
|
+
interface IncaElement extends IncaEventTarget, NodeMembers, ParentNodeMembers, ChildNodeMembers, NonDocumentTypeChildNodeMembers, TextContentMember, HtmlMembers {
|
|
787
653
|
/**
|
|
788
654
|
* The `id` attribute, or an empty string when it is unset. Assigning sets
|
|
789
655
|
* the attribute to the value as a string.
|
|
@@ -800,11 +666,8 @@ interface IncaElement extends IncaEventTarget, EventHandlers, NodeMembers, TextC
|
|
|
800
666
|
*/
|
|
801
667
|
get classList(): DOMTokenList;
|
|
802
668
|
set classList(value: string);
|
|
803
|
-
/**
|
|
804
|
-
|
|
805
|
-
* `"element"` for every other container.
|
|
806
|
-
*/
|
|
807
|
-
readonly kind: "element" | "comment";
|
|
669
|
+
/** Discriminates this node within the {@link IncaNode} union. */
|
|
670
|
+
readonly kind: "element";
|
|
808
671
|
/**
|
|
809
672
|
* The qualified name of the element. An element of the HTML namespace reads in ASCII upper case,
|
|
810
673
|
* such as `"BUTTON"`, and the mount container reads `"DIV"`.
|
|
@@ -816,42 +679,6 @@ interface IncaElement extends IncaEventTarget, EventHandlers, NodeMembers, TextC
|
|
|
816
679
|
readonly namespaceURI: string | null;
|
|
817
680
|
/** The prefix of the element name, or `null` for none. */
|
|
818
681
|
readonly prefix: string | null;
|
|
819
|
-
/**
|
|
820
|
-
* The child elements in order, as a live collection. Every read returns the same object, which
|
|
821
|
-
* follows later changes. A removed element lists the element children it kept.
|
|
822
|
-
*/
|
|
823
|
-
readonly children: HTMLCollectionOf<IncaElement>;
|
|
824
|
-
/**
|
|
825
|
-
* The parent element, or `null` for a detached node, a node inside a fragment and the mount
|
|
826
|
-
* container.
|
|
827
|
-
*/
|
|
828
|
-
readonly parentElement: IncaElement | null;
|
|
829
|
-
/** The first child that is an element, or `null`. */
|
|
830
|
-
readonly firstElementChild: IncaElement | null;
|
|
831
|
-
/** The last child that is an element, or `null`. */
|
|
832
|
-
readonly lastElementChild: IncaElement | null;
|
|
833
|
-
/** The number of children that are elements. */
|
|
834
|
-
readonly childElementCount: number;
|
|
835
|
-
/** The closest earlier sibling that is an element, or `null`. */
|
|
836
|
-
readonly previousElementSibling: IncaElement | null;
|
|
837
|
-
/** The closest later sibling that is an element, or `null`. */
|
|
838
|
-
readonly nextElementSibling: IncaElement | null;
|
|
839
|
-
/**
|
|
840
|
-
* Focuses this node next frame. The node needs a `tabindex` attribute. A
|
|
841
|
-
* `true` `preventScroll` keeps every scroll container where it is. After
|
|
842
|
-
* the node is removed, the call does nothing.
|
|
843
|
-
*/
|
|
844
|
-
focus(options?: {
|
|
845
|
-
preventScroll?: boolean;
|
|
846
|
-
}): void;
|
|
847
|
-
/** Unfocuses this node next frame, if it is the focused one. */
|
|
848
|
-
blur(): void;
|
|
849
|
-
/**
|
|
850
|
-
* Fires an untrusted `click` at this node. A disabled `button` or `input` and a node
|
|
851
|
-
* whose own click is still running ignore the call. After the node is removed, the call
|
|
852
|
-
* does nothing.
|
|
853
|
-
*/
|
|
854
|
-
click(): void;
|
|
855
682
|
/**
|
|
856
683
|
* Captures the mouse pointer for this node while a button is held. Only `pointerId` 1 exists.
|
|
857
684
|
* @throws DOMException named `NotFoundError` for another `pointerId`
|
|
@@ -869,12 +696,6 @@ interface IncaElement extends IncaEventTarget, EventHandlers, NodeMembers, TextC
|
|
|
869
696
|
* removed.
|
|
870
697
|
*/
|
|
871
698
|
hasPointerCapture(pointerId: number): boolean;
|
|
872
|
-
/**
|
|
873
|
-
* Assigning sets the `tabindex` attribute to the value's integer part,
|
|
874
|
-
* wrapped to 32 bits. Reading returns the `tabindex` attribute as an
|
|
875
|
-
* integer, or `-1` (`0` for a `button` or an `input`) when it is unset or invalid.
|
|
876
|
-
*/
|
|
877
|
-
tabIndex: number;
|
|
878
699
|
/**
|
|
879
700
|
* The value of the attribute `name` as a string, or `null` when it is unset. Names are
|
|
880
701
|
* ASCII-case-insensitive.
|
|
@@ -909,20 +730,6 @@ interface IncaElement extends IncaEventTarget, EventHandlers, NodeMembers, TextC
|
|
|
909
730
|
* changes. A key that equals the name of a set attribute reads its `Attr`.
|
|
910
731
|
*/
|
|
911
732
|
readonly attributes: NamedNodeMap;
|
|
912
|
-
/**
|
|
913
|
-
* The inline style as a live block. Every read returns the same object. Assigning a string
|
|
914
|
-
* writes its `cssText`, and `null` assigns `""`.
|
|
915
|
-
*/
|
|
916
|
-
get style(): CSSStyleDeclaration;
|
|
917
|
-
set style(cssText: string | null);
|
|
918
|
-
/**
|
|
919
|
-
* The `data-*` attributes as a live object. Every read returns the same object. A write converts
|
|
920
|
-
* the value to text.
|
|
921
|
-
* @throws DOMException named `SyntaxError` for a write to a key with a dash before a lower case
|
|
922
|
-
* letter, and named `InvalidCharacterError` for a key that makes an invalid attribute name
|
|
923
|
-
* @throws TypeError for a write of a `Symbol` value
|
|
924
|
-
*/
|
|
925
|
-
readonly dataset: DOMStringMap;
|
|
926
733
|
/**
|
|
927
734
|
* Whether this element matches the selector list. `:focus-visible` and the other interactive and
|
|
928
735
|
* form-state pseudo-classes never match.
|
|
@@ -940,44 +747,11 @@ interface IncaElement extends IncaEventTarget, EventHandlers, NodeMembers, TextC
|
|
|
940
747
|
* @returns The matching element, or `null` when none matches.
|
|
941
748
|
*/
|
|
942
749
|
closest(selectors: string): IncaElement | null;
|
|
943
|
-
/**
|
|
944
|
-
* The first descendant element that matches the selector list, or `null`. This element is never
|
|
945
|
-
* in the result. `:scope` and a leading `&` select this element. A removed element searches the
|
|
946
|
-
* subtree it kept.
|
|
947
|
-
* @throws DOMException named `SyntaxError` for an invalid selector, also after this element is
|
|
948
|
-
* removed
|
|
949
|
-
* @param selectors - A selector list.
|
|
950
|
-
* @returns The first matching descendant in document order, or `null`.
|
|
951
|
-
*/
|
|
952
|
-
querySelector(selectors: string): IncaElement | null;
|
|
953
|
-
/**
|
|
954
|
-
* The descendant elements that match the selector list, in document order, as a list that later
|
|
955
|
-
* changes do not reach. Every call returns a new list. A removed element searches the subtree it
|
|
956
|
-
* kept.
|
|
957
|
-
* @throws DOMException named `SyntaxError` for an invalid selector, also after this element is
|
|
958
|
-
* removed
|
|
959
|
-
* @param selectors - A selector list.
|
|
960
|
-
* @returns The matching descendants.
|
|
961
|
-
*/
|
|
962
|
-
querySelectorAll(selectors: string): NodeListOf<IncaElement>;
|
|
963
750
|
/**
|
|
964
751
|
* The box this node was drawn at in the last frame, in window logical
|
|
965
752
|
* pixels. A node created in the same task reads all zeros.
|
|
966
753
|
*/
|
|
967
754
|
getBoundingClientRect(): RectLike;
|
|
968
|
-
/** The box width from the last frame, rounded. `0` until a frame draws the node. */
|
|
969
|
-
readonly offsetWidth: number;
|
|
970
|
-
/** The box height from the last frame, rounded. `0` until a frame draws the node. */
|
|
971
|
-
readonly offsetHeight: number;
|
|
972
|
-
/** The box's left edge from the last frame, relative to {@link offsetParent}. Stays fixed while the parent scrolls. */
|
|
973
|
-
readonly offsetLeft: number;
|
|
974
|
-
/** The box's top edge from the last frame, relative to {@link offsetParent}. Stays fixed while the parent scrolls. */
|
|
975
|
-
readonly offsetTop: number;
|
|
976
|
-
/**
|
|
977
|
-
* The parent, when this node and the parent both have a box from the last frame.
|
|
978
|
-
* `null` when either lacks a box or there is no parent.
|
|
979
|
-
*/
|
|
980
|
-
readonly offsetParent: IncaElement | null;
|
|
981
755
|
/** The box width less both borders, rounded, at least `0`. */
|
|
982
756
|
readonly clientWidth: number;
|
|
983
757
|
/** The box height less both borders, rounded, at least `0`. */
|
|
@@ -1009,8 +783,63 @@ interface IncaElement extends IncaEventTarget, EventHandlers, NodeMembers, TextC
|
|
|
1009
783
|
*/
|
|
1010
784
|
scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;
|
|
1011
785
|
}
|
|
786
|
+
/**
|
|
787
|
+
* An element of the HTML namespace: an element with the members of HTML elements, the shared
|
|
788
|
+
* element members, `click()` and the offset members.
|
|
789
|
+
*/
|
|
790
|
+
interface IncaHTMLElement extends IncaElement, EventHandlers<IncaHTMLElement> {
|
|
791
|
+
/**
|
|
792
|
+
* Focuses this node next frame. The node needs a `tabindex` attribute. A
|
|
793
|
+
* `true` `preventScroll` keeps every scroll container where it is. After
|
|
794
|
+
* the node is removed, the call does nothing.
|
|
795
|
+
*/
|
|
796
|
+
focus(options?: {
|
|
797
|
+
preventScroll?: boolean;
|
|
798
|
+
}): void;
|
|
799
|
+
/** Unfocuses this node next frame, if it is the focused one. */
|
|
800
|
+
blur(): void;
|
|
801
|
+
/**
|
|
802
|
+
* Assigning sets the `tabindex` attribute to the value's integer part,
|
|
803
|
+
* wrapped to 32 bits. Reading returns the `tabindex` attribute as an
|
|
804
|
+
* integer, or `-1` (`0` for a `button` or an `input`) when it is unset or invalid.
|
|
805
|
+
*/
|
|
806
|
+
tabIndex: number;
|
|
807
|
+
/**
|
|
808
|
+
* The inline style as a live block. Every read returns the same object. Assigning a string
|
|
809
|
+
* writes its `cssText`, and `null` assigns `""`.
|
|
810
|
+
*/
|
|
811
|
+
get style(): CSSStyleDeclaration;
|
|
812
|
+
set style(cssText: string | null);
|
|
813
|
+
/**
|
|
814
|
+
* The `data-*` attributes as a live object. Every read returns the same object. A write converts
|
|
815
|
+
* the value to text.
|
|
816
|
+
* @throws DOMException named `SyntaxError` for a write to a key with a dash before a lower case
|
|
817
|
+
* letter, and named `InvalidCharacterError` for a key that makes an invalid attribute name
|
|
818
|
+
* @throws TypeError for a write of a `Symbol` value
|
|
819
|
+
*/
|
|
820
|
+
readonly dataset: DOMStringMap;
|
|
821
|
+
/**
|
|
822
|
+
* Fires an untrusted `click` at this node. A disabled `button` or `input` and a node
|
|
823
|
+
* whose own click is still running ignore the call. After the node is removed, the call
|
|
824
|
+
* does nothing.
|
|
825
|
+
*/
|
|
826
|
+
click(): void;
|
|
827
|
+
/** The box width from the last frame, rounded. `0` until a frame draws the node. */
|
|
828
|
+
readonly offsetWidth: number;
|
|
829
|
+
/** The box height from the last frame, rounded. `0` until a frame draws the node. */
|
|
830
|
+
readonly offsetHeight: number;
|
|
831
|
+
/** The box's left edge from the last frame, relative to {@link offsetParent}. Stays fixed while the parent scrolls. */
|
|
832
|
+
readonly offsetLeft: number;
|
|
833
|
+
/** The box's top edge from the last frame, relative to {@link offsetParent}. Stays fixed while the parent scrolls. */
|
|
834
|
+
readonly offsetTop: number;
|
|
835
|
+
/**
|
|
836
|
+
* The parent, when this node and the parent both have a box from the last frame.
|
|
837
|
+
* `null` when either lacks a box or there is no parent.
|
|
838
|
+
*/
|
|
839
|
+
readonly offsetParent: IncaElement | null;
|
|
840
|
+
}
|
|
1012
841
|
/** The handle of an `<input>`. */
|
|
1013
|
-
interface IncaInputElement extends
|
|
842
|
+
interface IncaInputElement extends IncaHTMLElement {
|
|
1014
843
|
/**
|
|
1015
844
|
* The text of the input. Assigning sets the value as a string, and `null` as `""`; line breaks
|
|
1016
845
|
* are dropped and a changed text puts the caret at its end.
|
|
@@ -1018,12 +847,17 @@ interface IncaInputElement extends IncaElement {
|
|
|
1018
847
|
value: string;
|
|
1019
848
|
}
|
|
1020
849
|
/** The handle of a `<template>`. */
|
|
1021
|
-
interface IncaTemplateElement extends
|
|
850
|
+
interface IncaTemplateElement extends IncaHTMLElement {
|
|
1022
851
|
/** The fragment that holds the markup of the template. It is never drawn or connected. */
|
|
1023
852
|
readonly content: IncaFragment;
|
|
1024
853
|
}
|
|
854
|
+
/** A comment node. */
|
|
855
|
+
interface IncaComment extends IncaEventTarget, NodeMembers, TextContentMember, CharacterDataMembers, ChildNodeMembers, NonDocumentTypeChildNodeMembers {
|
|
856
|
+
/** Discriminates this node within the {@link IncaNode} union. */
|
|
857
|
+
readonly kind: "comment";
|
|
858
|
+
}
|
|
1025
859
|
/** A text leaf node. */
|
|
1026
|
-
interface IncaText extends NodeMembers, CharacterDataMembers, TextMembers {
|
|
860
|
+
interface IncaText extends IncaEventTarget, NodeMembers, TextContentMember, CharacterDataMembers, ChildNodeMembers, NonDocumentTypeChildNodeMembers, TextMembers {
|
|
1027
861
|
/** Discriminates this node within the {@link IncaNode} union. */
|
|
1028
862
|
readonly kind: "text";
|
|
1029
863
|
/**
|
|
@@ -1035,17 +869,290 @@ interface IncaText extends NodeMembers, CharacterDataMembers, TextMembers {
|
|
|
1035
869
|
* The node `document.createDocumentFragment()` returns: a parentless container whose children move
|
|
1036
870
|
* into the node it is inserted into.
|
|
1037
871
|
*/
|
|
1038
|
-
interface IncaFragment extends NodeMembers, TextContentMember {
|
|
872
|
+
interface IncaFragment extends IncaEventTarget, NodeMembers, ParentNodeMembers, TextContentMember {
|
|
1039
873
|
/** Discriminates this node within the {@link IncaNode} union. */
|
|
1040
874
|
readonly kind: "fragment";
|
|
1041
875
|
}
|
|
1042
876
|
/** A node that can have children. */
|
|
1043
877
|
type IncaParent = IncaElement | IncaFragment | IncaDocument;
|
|
1044
878
|
/** Any node handle: an element, comment, text leaf, fragment or the document. */
|
|
1045
|
-
type IncaNode = IncaElement | IncaText | IncaFragment | IncaDocument;
|
|
879
|
+
type IncaNode = IncaElement | IncaComment | IncaText | IncaFragment | IncaDocument;
|
|
880
|
+
/** The sibling members of the nodes that have a parent and are no document type. */
|
|
881
|
+
interface NonDocumentTypeChildNodeMembers {
|
|
882
|
+
/** The closest earlier sibling that is an element, or `null`. */
|
|
883
|
+
readonly previousElementSibling: IncaElement | null;
|
|
884
|
+
/** The closest later sibling that is an element, or `null`. */
|
|
885
|
+
readonly nextElementSibling: IncaElement | null;
|
|
886
|
+
}
|
|
887
|
+
/** The members every node has: what it is, its data and its place in the tree. */
|
|
888
|
+
interface NodeMembers {
|
|
889
|
+
/**
|
|
890
|
+
* `1` for an element, `3` for a text node, `8` for a comment, `9` for the document and
|
|
891
|
+
* `11` for a fragment.
|
|
892
|
+
*/
|
|
893
|
+
readonly nodeType: 1 | 3 | 8 | 9 | 11;
|
|
894
|
+
/**
|
|
895
|
+
* The {@link IncaElement.tagName} of an element, `"#text"` for a text node, `"#comment"` for a
|
|
896
|
+
* comment, `"#document"` for the document and `"#document-fragment"` for a fragment.
|
|
897
|
+
*/
|
|
898
|
+
readonly nodeName: string;
|
|
899
|
+
/**
|
|
900
|
+
* The data of a text node or a comment, and `null` for an element, the document or a
|
|
901
|
+
* fragment. Assigning `null` or `undefined` stores `""` and any other value stores its string.
|
|
902
|
+
* Assigning to an element, the document, a fragment or a freed node does nothing.
|
|
903
|
+
*/
|
|
904
|
+
nodeValue: string | null;
|
|
905
|
+
/** Whether the node hangs under `document`. */
|
|
906
|
+
readonly isConnected: boolean;
|
|
907
|
+
/** `document`, and `null` for `document` itself. */
|
|
908
|
+
readonly ownerDocument: IncaDocument | null;
|
|
909
|
+
/**
|
|
910
|
+
* The parent, or `null` for a detached node. A node inside a fragment reads the fragment. A
|
|
911
|
+
* freed node reads `null`.
|
|
912
|
+
*/
|
|
913
|
+
readonly parentNode: IncaElement | IncaFragment | IncaDocument | null;
|
|
914
|
+
/**
|
|
915
|
+
* The parent element, or `null` for a detached node, a node inside a fragment and the mount
|
|
916
|
+
* container.
|
|
917
|
+
*/
|
|
918
|
+
readonly parentElement: IncaElement | null;
|
|
919
|
+
/** The first child, or `null`. */
|
|
920
|
+
readonly firstChild: IncaNode | null;
|
|
921
|
+
/** The last child, or `null`. */
|
|
922
|
+
readonly lastChild: IncaNode | null;
|
|
923
|
+
/** The sibling right before this node, or `null`. */
|
|
924
|
+
readonly previousSibling: IncaNode | null;
|
|
925
|
+
/** The sibling right after this node, or `null`. */
|
|
926
|
+
readonly nextSibling: IncaNode | null;
|
|
927
|
+
/**
|
|
928
|
+
* The children in order, as a live list. Every read returns the same object, which follows later
|
|
929
|
+
* changes. A freed node has an empty list.
|
|
930
|
+
*/
|
|
931
|
+
readonly childNodes: NodeListOf<IncaNode>;
|
|
932
|
+
/** Whether the node has a child. */
|
|
933
|
+
hasChildNodes(): boolean;
|
|
934
|
+
/**
|
|
935
|
+
* Appends `node` as the last child. A fragment gives up its children in order and stays empty.
|
|
936
|
+
* A node that has a parent moves. Throws `HierarchyRequestError` when this node is a text node or
|
|
937
|
+
* a comment, or when `node` is this node or one of its ancestors.
|
|
938
|
+
* @returns `node`
|
|
939
|
+
*/
|
|
940
|
+
appendChild<T extends IncaNode>(node: T): T;
|
|
941
|
+
/**
|
|
942
|
+
* Inserts `node` before `child`, or last when `child` is `null` or `undefined`. A fragment gives
|
|
943
|
+
* up its children in order and stays empty. Throws `HierarchyRequestError` as
|
|
944
|
+
* {@link NodeMembers.appendChild} does, and `NotFoundError` when `child` is not a child of this
|
|
945
|
+
* node.
|
|
946
|
+
* @returns `node`
|
|
947
|
+
*/
|
|
948
|
+
insertBefore<T extends IncaNode>(node: T, child: IncaNode | null | undefined): T;
|
|
949
|
+
/**
|
|
950
|
+
* Removes `child`, which keeps its listeners and can be inserted again. Throws `NotFoundError`
|
|
951
|
+
* when `child` is not a child of this node.
|
|
952
|
+
* @returns `child`
|
|
953
|
+
*/
|
|
954
|
+
removeChild<T extends IncaNode>(child: T): T;
|
|
955
|
+
/**
|
|
956
|
+
* Puts `node` in the place of `child`, which keeps its listeners and can be inserted again.
|
|
957
|
+
* Throws as {@link NodeMembers.insertBefore} does, with `child` as the node that has to be a
|
|
958
|
+
* child of this node.
|
|
959
|
+
* @returns `child`
|
|
960
|
+
*/
|
|
961
|
+
replaceChild<T extends IncaNode>(node: IncaNode, child: T): T;
|
|
962
|
+
/**
|
|
963
|
+
* Copies the node: its tag, attributes and style, and with `deep` its descendants. The copy has
|
|
964
|
+
* no parent, no listeners and no scroll offset, and the text of an `input` carries over.
|
|
965
|
+
* @param deep - whether the descendants are copied too
|
|
966
|
+
* @returns the copy
|
|
967
|
+
*/
|
|
968
|
+
cloneNode(deep?: boolean): this;
|
|
969
|
+
/**
|
|
970
|
+
* Whether `other` is this node or one of its descendants in the tree as rendered. `null` and
|
|
971
|
+
* `undefined` give `false`, and any other value that is not a node throws a `TypeError`. After
|
|
972
|
+
* the node is removed, it still answers for the subtree it keeps. A freed node contains only
|
|
973
|
+
* itself.
|
|
974
|
+
*/
|
|
975
|
+
contains(other: IncaNode | null): boolean;
|
|
976
|
+
/**
|
|
977
|
+
* The topmost node above this one: `document` for a connected node, else the top of its
|
|
978
|
+
* subtree, the node itself without a parent.
|
|
979
|
+
*/
|
|
980
|
+
getRootNode(): IncaNode;
|
|
981
|
+
/**
|
|
982
|
+
* The position of `other` relative to this node as a bit mask: `1` disconnected, `2` preceding,
|
|
983
|
+
* `4` following, `8` contains, `16` contained by and `32` implementation specific. Nodes of
|
|
984
|
+
* different trees give `1 | 32` plus `2` or `4`, with opposite directions for the two orders of
|
|
985
|
+
* the pair. A freed node is a tree of its own: it gives `1 | 32` plus `2` or `4` by the order of
|
|
986
|
+
* the two ids, and `0` for itself.
|
|
987
|
+
* @throws {TypeError} when `other` is not a node
|
|
988
|
+
*/
|
|
989
|
+
compareDocumentPosition(other: IncaNode): number;
|
|
990
|
+
/** Whether `other` is this node. `null` and `undefined` give `false`. */
|
|
991
|
+
isSameNode(other: IncaNode | null): boolean;
|
|
992
|
+
/**
|
|
993
|
+
* Whether `other` has the same tag, attributes, style and children, compared in depth. The typed
|
|
994
|
+
* text of an `input` is not compared. `null` and `undefined` give `false`. A freed node equals
|
|
995
|
+
* only itself.
|
|
996
|
+
*/
|
|
997
|
+
isEqualNode(other: IncaNode | null): boolean;
|
|
998
|
+
}
|
|
999
|
+
/** The `textContent` of a node. */
|
|
1000
|
+
interface TextContentMember {
|
|
1001
|
+
/**
|
|
1002
|
+
* The data of a text node or a comment, and the data of the text nodes below an
|
|
1003
|
+
* element in tree order, comments left out. Assigning `null` or `undefined` stores `""`
|
|
1004
|
+
* and any other value stores its string. Assigning to an element replaces its children with one
|
|
1005
|
+
* text node, or with none for `""`. A freed node reads `""` or its last data and ignores the
|
|
1006
|
+
* assignment.
|
|
1007
|
+
*/
|
|
1008
|
+
textContent: string;
|
|
1009
|
+
}
|
|
1010
|
+
/** The members of a text node and a comment that read and edit their data. */
|
|
1011
|
+
interface CharacterDataMembers {
|
|
1012
|
+
/** The data. Assigning `null` stores `""` and any other value stores its string. */
|
|
1013
|
+
data: string;
|
|
1014
|
+
/** The number of UTF-16 code units of the data. */
|
|
1015
|
+
readonly length: number;
|
|
1016
|
+
/**
|
|
1017
|
+
* The part of the data from `offset`. Both arguments convert to unsigned 32-bit integers and
|
|
1018
|
+
* count UTF-16 code units. `count` stops at the end of the data.
|
|
1019
|
+
* @param offset - Where the part starts.
|
|
1020
|
+
* @param count - The length of the part.
|
|
1021
|
+
* @throws {DOMException} named `IndexSizeError` when `offset` is beyond the data.
|
|
1022
|
+
*/
|
|
1023
|
+
substringData(offset: number, count: number): string;
|
|
1024
|
+
/**
|
|
1025
|
+
* Adds `data` at the end of the data.
|
|
1026
|
+
* @param data - The text to add.
|
|
1027
|
+
*/
|
|
1028
|
+
appendData(data: string): void;
|
|
1029
|
+
/**
|
|
1030
|
+
* Adds `data` at `offset`.
|
|
1031
|
+
* @param offset - Where to add.
|
|
1032
|
+
* @param data - The text to add.
|
|
1033
|
+
* @throws {DOMException} named `IndexSizeError` when `offset` is beyond the data.
|
|
1034
|
+
*/
|
|
1035
|
+
insertData(offset: number, data: string): void;
|
|
1036
|
+
/**
|
|
1037
|
+
* Removes `count` units from `offset`.
|
|
1038
|
+
* @param offset - Where the removal starts.
|
|
1039
|
+
* @param count - The number of units, stopping at the end of the data.
|
|
1040
|
+
* @throws {DOMException} named `IndexSizeError` when `offset` is beyond the data.
|
|
1041
|
+
*/
|
|
1042
|
+
deleteData(offset: number, count: number): void;
|
|
1043
|
+
/**
|
|
1044
|
+
* Replaces `count` units from `offset` with `data`.
|
|
1045
|
+
* @param offset - Where the replaced part starts.
|
|
1046
|
+
* @param count - The number of units, stopping at the end of the data.
|
|
1047
|
+
* @param data - The new text.
|
|
1048
|
+
* @throws {DOMException} named `IndexSizeError` when `offset` is beyond the data.
|
|
1049
|
+
*/
|
|
1050
|
+
replaceData(offset: number, count: number, data: string): void;
|
|
1051
|
+
}
|
|
1052
|
+
/** The members only a text node has. */
|
|
1053
|
+
interface TextMembers {
|
|
1054
|
+
/** The data of this node and of the text nodes that touch it, in order. */
|
|
1055
|
+
readonly wholeText: string;
|
|
1056
|
+
/**
|
|
1057
|
+
* Cuts the data at `offset`. This node keeps the head and the new node holds the tail. The new
|
|
1058
|
+
* node follows this one when this one has a parent, and has no parent otherwise.
|
|
1059
|
+
* @param offset - Where to cut, converted like the offset of `substringData()`.
|
|
1060
|
+
* @returns The new node.
|
|
1061
|
+
* @throws {DOMException} named `IndexSizeError` when `offset` is beyond the data.
|
|
1062
|
+
*/
|
|
1063
|
+
splitText(offset: number): IncaText;
|
|
1064
|
+
}
|
|
1065
|
+
/** The members of the nodes that hold children that insert and replace nodes. */
|
|
1066
|
+
interface ParentNodeMutationMembers {
|
|
1067
|
+
/**
|
|
1068
|
+
* Inserts `nodes` after the last child. A string becomes a new text node. A fragment gives up
|
|
1069
|
+
* its children in order, and a node that has a parent moves. With several nodes, a node given
|
|
1070
|
+
* twice takes the place of its last occurrence. When the call throws, no node has moved.
|
|
1071
|
+
* @param nodes - the nodes and strings to insert
|
|
1072
|
+
* @throws {DOMException} named `HierarchyRequestError` when a node is this node or one of its
|
|
1073
|
+
* ancestors, or the insertion gives the document text or a second element
|
|
1074
|
+
* @throws {TypeError} for a `Symbol`, a string with a lone surrogate or a freed node
|
|
1075
|
+
*/
|
|
1076
|
+
append(...nodes: (IncaNode | string)[]): void;
|
|
1077
|
+
/**
|
|
1078
|
+
* Inserts `nodes` before the first child that the call does not move. Takes and throws as
|
|
1079
|
+
* {@link ParentNodeMutationMembers.append} does.
|
|
1080
|
+
* @param nodes - the nodes and strings to insert
|
|
1081
|
+
*/
|
|
1082
|
+
prepend(...nodes: (IncaNode | string)[]): void;
|
|
1083
|
+
/**
|
|
1084
|
+
* Makes `nodes` the only children. Every other child leaves, keeps its listeners and can be
|
|
1085
|
+
* inserted again. Takes and throws as {@link ParentNodeMutationMembers.append} does. A document
|
|
1086
|
+
* that holds an element throws when it gets an element.
|
|
1087
|
+
* @param nodes - the nodes and strings to insert
|
|
1088
|
+
*/
|
|
1089
|
+
replaceChildren(...nodes: (IncaNode | string)[]): void;
|
|
1090
|
+
}
|
|
1091
|
+
/** The members of the nodes that have a parent and leave it or change places in it. */
|
|
1092
|
+
interface ChildNodeMembers {
|
|
1093
|
+
/**
|
|
1094
|
+
* Inserts `nodes` before this node. A node that has no parent does nothing. Takes and throws as
|
|
1095
|
+
* {@link ParentNodeMutationMembers.append} does.
|
|
1096
|
+
* @param nodes - the nodes and strings to insert
|
|
1097
|
+
*/
|
|
1098
|
+
before(...nodes: (IncaNode | string)[]): void;
|
|
1099
|
+
/**
|
|
1100
|
+
* Inserts `nodes` after this node. A node that has no parent does nothing. Takes and throws as
|
|
1101
|
+
* {@link ParentNodeMutationMembers.append} does.
|
|
1102
|
+
* @param nodes - the nodes and strings to insert
|
|
1103
|
+
*/
|
|
1104
|
+
after(...nodes: (IncaNode | string)[]): void;
|
|
1105
|
+
/**
|
|
1106
|
+
* Puts `nodes` in the place of this node, which leaves its parent unless it is one of them. A
|
|
1107
|
+
* node that has no parent does nothing. Takes and throws as
|
|
1108
|
+
* {@link ParentNodeMutationMembers.append} does.
|
|
1109
|
+
* @param nodes - the nodes and strings to insert
|
|
1110
|
+
*/
|
|
1111
|
+
replaceWith(...nodes: (IncaNode | string)[]): void;
|
|
1112
|
+
/** Takes this node out of its parent. It keeps its listeners and can be inserted again. */
|
|
1113
|
+
remove(): void;
|
|
1114
|
+
}
|
|
1115
|
+
/** The members of the nodes that hold children: the child elements and the queries. */
|
|
1116
|
+
interface ParentNodeMembers extends ParentNodeMutationMembers {
|
|
1117
|
+
/**
|
|
1118
|
+
* The child elements in order, as a live collection. Every read returns the same object, which
|
|
1119
|
+
* follows later changes. A removed element lists the element children it kept.
|
|
1120
|
+
*/
|
|
1121
|
+
readonly children: HTMLCollectionOf<IncaElement>;
|
|
1122
|
+
/** The first child that is an element, or `null`. */
|
|
1123
|
+
readonly firstElementChild: IncaElement | null;
|
|
1124
|
+
/** The last child that is an element, or `null`. */
|
|
1125
|
+
readonly lastElementChild: IncaElement | null;
|
|
1126
|
+
/** The number of children that are elements. */
|
|
1127
|
+
readonly childElementCount: number;
|
|
1128
|
+
/**
|
|
1129
|
+
* The first descendant element that matches the selector list, or `null`. The node itself is
|
|
1130
|
+
* never in the result. `:scope` and a leading `&` select an element receiver. A removed element
|
|
1131
|
+
* searches the subtree it kept.
|
|
1132
|
+
* @throws DOMException named `SyntaxError` for an invalid selector, also after the node is
|
|
1133
|
+
* removed
|
|
1134
|
+
* @param selectors - A selector list.
|
|
1135
|
+
* @returns The first matching descendant in document order, or `null`.
|
|
1136
|
+
*/
|
|
1137
|
+
querySelector(selectors: string): IncaElement | null;
|
|
1138
|
+
/**
|
|
1139
|
+
* The descendant elements that match the selector list, in document order, as a list that later
|
|
1140
|
+
* changes do not reach. Every call returns a new list. A removed element searches the subtree it
|
|
1141
|
+
* kept.
|
|
1142
|
+
* @throws DOMException named `SyntaxError` for an invalid selector, also after the node is
|
|
1143
|
+
* removed
|
|
1144
|
+
* @param selectors - A selector list.
|
|
1145
|
+
* @returns The matching descendants.
|
|
1146
|
+
*/
|
|
1147
|
+
querySelectorAll(selectors: string): NodeListOf<IncaElement>;
|
|
1148
|
+
}
|
|
1046
1149
|
/** Element kind passed to `createNode`. */
|
|
1047
1150
|
type TagName = string;
|
|
1048
|
-
/**
|
|
1151
|
+
/**
|
|
1152
|
+
* One overflow value. `"scroll"` and `"auto"` scroll with the wheel. The scrollbar of `"auto"`
|
|
1153
|
+
* draws over the content, and the one of `"scroll"` reserves its width where the platform does
|
|
1154
|
+
* not hide scrollbars.
|
|
1155
|
+
*/
|
|
1049
1156
|
type Overflow = "visible" | "hidden" | "clip" | "scroll" | "auto";
|
|
1050
1157
|
/**
|
|
1051
1158
|
* A size in px: a number, `"0"` or a string such as `"10px"`. A string that reads as zero
|
|
@@ -1095,7 +1202,11 @@ interface StyleProps {
|
|
|
1095
1202
|
borderRadius?: Px;
|
|
1096
1203
|
/** Font size in px (`>= 0`) for this container's own text. Cascades to descendant text leaves, same as {@link StyleProps.color}. */
|
|
1097
1204
|
fontSize?: Px;
|
|
1098
|
-
/**
|
|
1205
|
+
/**
|
|
1206
|
+
* Overflow on both axes, or `"<x> <y>"` per axis; `"scroll"` and `"auto"` make the container
|
|
1207
|
+
* scroll with the wheel. Overridden per axis by {@link StyleProps.overflowX}/
|
|
1208
|
+
* {@link StyleProps.overflowY}.
|
|
1209
|
+
*/
|
|
1099
1210
|
overflow?: Overflow | `${Overflow} ${Overflow}`;
|
|
1100
1211
|
/** Horizontal overflow; wins over {@link StyleProps.overflow}. */
|
|
1101
1212
|
overflowX?: Overflow;
|
|
@@ -1168,6 +1279,8 @@ interface ListenerOptions {
|
|
|
1168
1279
|
passive?: boolean;
|
|
1169
1280
|
/** The listener is removed before it first runs. */
|
|
1170
1281
|
once?: boolean;
|
|
1282
|
+
/** The listener is removed when the signal aborts. A signal that is aborted already registers nothing. */
|
|
1283
|
+
signal?: AbortSignal;
|
|
1171
1284
|
}
|
|
1172
1285
|
/**
|
|
1173
1286
|
* The listener methods of an object that receives events, such as the
|
|
@@ -1210,7 +1323,7 @@ interface IncaEventTarget {
|
|
|
1210
1323
|
* The top node of the tree, the parent of the mount container. It holds at most one element and
|
|
1211
1324
|
* any number of comments, and no text.
|
|
1212
1325
|
*/
|
|
1213
|
-
interface IncaDocument extends IncaEventTarget, EventHandlers<IncaDocument>, NodeMembers {
|
|
1326
|
+
interface IncaDocument extends IncaEventTarget, EventHandlers<IncaDocument>, NodeMembers, ParentNodeMembers {
|
|
1214
1327
|
/** Discriminates this node within the `IncaNode` union. */
|
|
1215
1328
|
readonly kind: "document";
|
|
1216
1329
|
/** Always `null`. An assignment does nothing. */
|
|
@@ -1233,7 +1346,7 @@ interface IncaDocument extends IncaEventTarget, EventHandlers<IncaDocument>, Nod
|
|
|
1233
1346
|
* @throws TypeError when called without an argument
|
|
1234
1347
|
* @throws DOMException named `InvalidCharacterError` when `localName` is not a valid element name
|
|
1235
1348
|
*/
|
|
1236
|
-
createElement(localName: string):
|
|
1349
|
+
createElement(localName: string): IncaHTMLElement;
|
|
1237
1350
|
/**
|
|
1238
1351
|
* Creates an element with a namespace. The namespace converts to a string, and `null`,
|
|
1239
1352
|
* `undefined` and `""` mean no namespace. The name converts to a string and splits at its first
|
|
@@ -1260,22 +1373,7 @@ interface IncaDocument extends IncaEventTarget, EventHandlers<IncaDocument>, Nod
|
|
|
1260
1373
|
* @returns The new comment, which has no parent.
|
|
1261
1374
|
* @throws TypeError when called without an argument
|
|
1262
1375
|
*/
|
|
1263
|
-
createComment(data: string):
|
|
1264
|
-
/**
|
|
1265
|
-
* The first element below the document that matches the selector list, or `null`.
|
|
1266
|
-
* @throws DOMException named `SyntaxError` for an invalid selector
|
|
1267
|
-
* @param selectors - A selector list.
|
|
1268
|
-
* @returns The first matching element in document order, or `null`.
|
|
1269
|
-
*/
|
|
1270
|
-
querySelector(selectors: string): IncaElement | null;
|
|
1271
|
-
/**
|
|
1272
|
-
* The elements below the document that match the selector list, in document order, as a list
|
|
1273
|
-
* that later changes do not reach. Every call returns a new list.
|
|
1274
|
-
* @throws DOMException named `SyntaxError` for an invalid selector
|
|
1275
|
-
* @param selectors - A selector list.
|
|
1276
|
-
* @returns The matching elements.
|
|
1277
|
-
*/
|
|
1278
|
-
querySelectorAll(selectors: string): NodeListOf<IncaElement>;
|
|
1376
|
+
createComment(data: string): IncaComment;
|
|
1279
1377
|
}
|
|
1280
1378
|
/**
|
|
1281
1379
|
* The event target at the top of every event path.
|
|
@@ -1597,4 +1695,4 @@ type EventListenerOrObject<E = IncaEvent, T = IncaEventTarget> = EventListener<E
|
|
|
1597
1695
|
* `passive: false`.
|
|
1598
1696
|
*/
|
|
1599
1697
|
declare const window: IncaWindow;
|
|
1600
|
-
export {
|
|
1698
|
+
export { RectLike as $, TextContentMember as A, IncaComment as B, TagName as C, EventTargetId as Ct, NonDocumentTypeChildNodeMembers as D, NodeMembers as E, DOMTokenList as F, IncaNode as G, IncaFragment as H, EventHandler as I, IncaText as J, IncaParent as K, EventHandlers as L, Attr as M, CSSStyleDeclaration as N, ParentNodeMembers as O, DOMStringMap as P, ScrollOptions as Q, HTMLCollectionOf as R, StyleProps as S, ElementName as St, ChildNodeMembers as T, ScrollAlignment as Tt, IncaHTMLElement as U, IncaElement as V, IncaInputElement as W, NodeListOf as X, NamedNodeMap as Y, ScrollIntoViewOptions as Z, IncaWheelEvent as _, holdNode as _t, EventListenerOrObject as a, focus as at, Overflow as b, AttributeValue as bt, IncaEvent as c, scrollIntoViewNode as ct, IncaFocusEvent as d, getAttribute as dt, RectValues as et, IncaInputEvent as f, removeAttribute as ft, IncaUIEvent as g, createNode as gt, IncaPointerEvent as h, setStyle as ht, EventListenerObject as i, dispatchEvent as it, TextMembers as j, ParentNodeMutationMembers as k, IncaEventMap as l, scrollNode as lt, IncaMouseEvent as m, setAttribute as mt, EventLike as n, blur as nt, IncaCompositionEvent as o, focusedNode as ot, IncaKeyboardEvent as p, removeStyle as pt, IncaTemplateElement as q, EventListener as r, click as rt, IncaDocument as s, layoutOf as st, window as t, isRemoved as tt, IncaEventTarget as u, scrollOf as ut, IncaWindow as v, releaseNode as vt, CharacterDataMembers as w, NodeId as wt, Px as x, CallbackId as xt, ListenerOptions as y, rootNodeId as yt, HtmlMembers as z };
|