incajs 0.0.32 → 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-MkDukDmX.d.ts +142 -0
- package/dist/chunks/rendererCore-hjb_YEzl.js +1 -0
- package/dist/chunks/treeOps-BFrsoJSW.js +1 -0
- package/dist/chunks/{window-gMkkjr_q.d.ts → window-DUfFz2C1.d.ts} +782 -418
- package/dist/globals.d.mts +139 -3
- package/dist/index.d.ts +4 -9
- 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-DGPTjDZ2.js +0 -1
- package/dist/chunks/rendererCore-Cf8-27u1.d.ts +0 -445
- package/dist/chunks/rendererCore-p80C6A9w.js +0 -1
|
@@ -1,3 +1,335 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable handle to a node in the native retained tree, returned by `createNode`
|
|
3
|
+
* and used in every later call that touches that node.
|
|
4
|
+
*/
|
|
5
|
+
type NodeId = number;
|
|
6
|
+
/**
|
|
7
|
+
* Id assigned to one registered event listener. Managed internally by
|
|
8
|
+
* `addEventListener`/`removeEventListener`/`removeNode`.
|
|
9
|
+
*/
|
|
10
|
+
type CallbackId = number;
|
|
11
|
+
/**
|
|
12
|
+
* A value `setAttribute`/`setStyle` can take. Any other value raises a catchable
|
|
13
|
+
* exception.
|
|
14
|
+
*/
|
|
15
|
+
type AttributeValue = string | number | boolean;
|
|
16
|
+
/** Where `scrollIntoView` aligns a node on one axis. */
|
|
17
|
+
type ScrollAlignment = "start" | "center" | "end" | "nearest";
|
|
18
|
+
/** How {@link IncaNative.linkedNode} names the node to reach from a node. */
|
|
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
|
+
/**
|
|
23
|
+
* The name of an element. A string is the tag of an HTML element: it is the local name, and its
|
|
24
|
+
* ASCII upper case is the `tagName`. A tuple holds the four name parts of
|
|
25
|
+
* `createElementNS`.
|
|
26
|
+
*/
|
|
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];
|
|
36
|
+
/**
|
|
37
|
+
* What a native returns for a copy of a node without a name: id, the marker or tag, and the text
|
|
38
|
+
* of a `#text` copy (`null` for any other node).
|
|
39
|
+
*/
|
|
40
|
+
type NodeEntry = [id: NodeId, tag: string, data: string | null];
|
|
41
|
+
/** What a native returns for an element it makes: id and the four name parts. */
|
|
42
|
+
type ElementEntry = [id: NodeId, localName: string, namespaceURI: string | null, prefix: string | null, tagName: string];
|
|
43
|
+
/**
|
|
44
|
+
* One node of a parsed fragment: id, tag, namespace (`null` for a text node, a comment and a
|
|
45
|
+
* fragment), parent id and the text of a text node or a comment.
|
|
46
|
+
*/
|
|
47
|
+
type ParsedEntry = [id: NodeId, tag: string, namespaceURI: string | null, parentId: NodeId, data: string | null];
|
|
48
|
+
/**
|
|
49
|
+
* What a parse writes into the tree: the position of the first inserted node among the children of
|
|
50
|
+
* its container, and the nodes in pre-order. An entry whose parent is no entry is a root.
|
|
51
|
+
*/
|
|
52
|
+
type Parsed = [position: number, entries: ParsedEntry[]];
|
|
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
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The host-injected object every wrapper in this package forwards to. Not part of the public
|
|
84
|
+
* surface.
|
|
85
|
+
*/
|
|
86
|
+
interface IncaNative {
|
|
87
|
+
rootNodeId(): NodeId;
|
|
88
|
+
documentNodeId(): NodeId;
|
|
89
|
+
interfacePrototypes(): InterfacePrototypes;
|
|
90
|
+
registerUncloneable(map: WeakMap<object, unknown>): void;
|
|
91
|
+
createNode(tag: string): NodeId;
|
|
92
|
+
createElement(localName: string): [NodeId, TagName];
|
|
93
|
+
createElementNS(namespace: string | null, qualifiedName: string): ElementEntry;
|
|
94
|
+
attributeKey(nodeId: NodeId, name: string): string;
|
|
95
|
+
appendChild(parentId: NodeId, nodeId: NodeId): number;
|
|
96
|
+
insertBefore(parentId: NodeId, nodeId: NodeId, refId: NodeId | null): number;
|
|
97
|
+
removeChild(parentId: NodeId, childId: NodeId): void;
|
|
98
|
+
replaceChild(parentId: NodeId, nodeId: NodeId, childId: NodeId): number;
|
|
99
|
+
insertNodes(nodeId: NodeId, place: InsertionPlace, nodes: (NodeId | string)[]): [textIds: NodeId[], removedIds: NodeId[]] | null;
|
|
100
|
+
cloneNode(nodeId: NodeId, deep: boolean): (NodeEntry | ElementEntry)[];
|
|
101
|
+
templateContent(nodeId: NodeId): NodeId | null;
|
|
102
|
+
innerHtml(nodeId: NodeId): string;
|
|
103
|
+
outerHtml(nodeId: NodeId): string;
|
|
104
|
+
setInnerHtml(nodeId: NodeId, html: string): Parsed;
|
|
105
|
+
setOuterHtml(nodeId: NodeId, html: string): Parsed | null;
|
|
106
|
+
insertAdjacentHtml(nodeId: NodeId, position: string, html: string): Parsed;
|
|
107
|
+
rootOf(nodeId: NodeId): NodeId;
|
|
108
|
+
compareNodePosition(nodeId: NodeId, otherId: NodeId): number;
|
|
109
|
+
isEqualNode(nodeId: NodeId, otherId: NodeId): boolean;
|
|
110
|
+
setAttribute(nodeId: NodeId, key: string, value: AttributeValue): void;
|
|
111
|
+
getAttribute(nodeId: NodeId, key: string): AttributeValue | null;
|
|
112
|
+
removeAttribute(nodeId: NodeId, key: string): void;
|
|
113
|
+
attributeNames(nodeId: NodeId): string[];
|
|
114
|
+
classList(nodeId: NodeId): DOMTokenList;
|
|
115
|
+
datasetGet(nodeId: NodeId, key: string): string | undefined;
|
|
116
|
+
datasetSet(nodeId: NodeId, key: string, value: string): void;
|
|
117
|
+
datasetDelete(nodeId: NodeId, key: string): boolean;
|
|
118
|
+
datasetKeys(nodeId: NodeId): string[];
|
|
119
|
+
datasetTarget(): object;
|
|
120
|
+
linkedNode(nodeId: NodeId, link: NodeLink, elementOnly?: boolean): NodeId | null;
|
|
121
|
+
childNodeIds(nodeId: NodeId, elementOnly?: boolean): NodeId[];
|
|
122
|
+
isConnected(nodeId: NodeId): boolean;
|
|
123
|
+
textContent(nodeId: NodeId): string;
|
|
124
|
+
wholeText(nodeId: NodeId): string;
|
|
125
|
+
substringData(nodeId: NodeId, offset: number, count: number): string;
|
|
126
|
+
replaceData(nodeId: NodeId, offset: number, count: number, data: string): void;
|
|
127
|
+
splitText(nodeId: NodeId, offset: number): NodeId;
|
|
128
|
+
matches(nodeId: NodeId, selector: string): boolean;
|
|
129
|
+
closest(nodeId: NodeId, selector: string): NodeId | null;
|
|
130
|
+
checkSelector(selector: string): void;
|
|
131
|
+
querySelector(nodeId: NodeId, selector: string): NodeId | null;
|
|
132
|
+
querySelectorAll(nodeId: NodeId, selector: string): NodeId[];
|
|
133
|
+
setStyle(nodeId: NodeId, key: string, value: AttributeValue): void;
|
|
134
|
+
removeStyle(nodeId: NodeId, key: string): void;
|
|
135
|
+
styleOf(nodeId: NodeId): CSSStyleDeclaration;
|
|
136
|
+
inputValue(nodeId: NodeId): string;
|
|
137
|
+
setInputValue(nodeId: NodeId, value: string): void;
|
|
138
|
+
addEventListener(target: EventTargetId, event: string, callback: HostCallback, capture?: boolean, passive?: boolean, signal?: SignalTarget): CallbackId | null;
|
|
139
|
+
removeEventListener(target: EventTargetId, event: string, callbackId: CallbackId): boolean;
|
|
140
|
+
removeNode(nodeId: NodeId): [callbackIds: CallbackId[], nodeIds: NodeId[]];
|
|
141
|
+
holdNode(nodeId: NodeId): void;
|
|
142
|
+
releaseNode(nodeId: NodeId): void;
|
|
143
|
+
focusNode(nodeId: NodeId, preventScroll?: boolean): void;
|
|
144
|
+
blurNode(nodeId: NodeId): void;
|
|
145
|
+
focusedNode(): NodeId | null;
|
|
146
|
+
layoutOf(nodeId: NodeId): NodeBox | null;
|
|
147
|
+
scrollOf(nodeId: NodeId): NodeScroll | null;
|
|
148
|
+
scrollNode(nodeId: NodeId, left: number | null, top: number | null): void;
|
|
149
|
+
scrollIntoViewNode(nodeId: NodeId, block: ScrollAlignment, inline: ScrollAlignment): void;
|
|
150
|
+
dispatchEvent(target: EventTargetId, event: EventLike): boolean;
|
|
151
|
+
windowTargetId(): WindowTargetId;
|
|
152
|
+
signalId(value: unknown): number | null;
|
|
153
|
+
click(nodeId: NodeId): void;
|
|
154
|
+
setPointerCapture(nodeId: NodeId, pointerId: number): void;
|
|
155
|
+
releasePointerCapture(nodeId: NodeId, pointerId: number): void;
|
|
156
|
+
hasPointerCapture(nodeId: NodeId, pointerId: number): boolean;
|
|
157
|
+
}
|
|
158
|
+
/** What the host calls: it passes the event object as the first argument. */
|
|
159
|
+
type HostCallback = (...args: unknown[]) => void;
|
|
160
|
+
declare global {
|
|
161
|
+
var __inca_native__: IncaNative;
|
|
162
|
+
var __inca_released__: (nodeIds: NodeId[], callbackIds: CallbackId[]) => void;
|
|
163
|
+
var __inca_targets__: (targets: HookTarget[]) => unknown[];
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Returns the host-allocated root container's id, the node an app attaches
|
|
167
|
+
* itself under. The host allocates it with the tree, so this resolves from
|
|
168
|
+
* the first call and names the same node for the engine's lifetime.
|
|
169
|
+
* @returns the root node's id
|
|
170
|
+
*/
|
|
171
|
+
declare function rootNodeId(): NodeId;
|
|
172
|
+
/**
|
|
173
|
+
* Allocates a new node of kind `tag` in the native tree. The node starts out
|
|
174
|
+
* detached. Attach it with {@link appendChild}/{@link insertBefore}. The host
|
|
175
|
+
* frees the node at the start of the next frame unless it is inserted or held
|
|
176
|
+
* with {@link holdNode} by then.
|
|
177
|
+
* @param tag - the node's element kind
|
|
178
|
+
* @returns the new node's id
|
|
179
|
+
*/
|
|
180
|
+
declare function createNode(tag: TagName): NodeId;
|
|
181
|
+
/**
|
|
182
|
+
* Keeps `nodeId` and its subtree alive while it has no parent. The host frees
|
|
183
|
+
* a parentless node that is neither held nor inserted by the start of the next
|
|
184
|
+
* frame. Holding a held or attached node changes nothing visible.
|
|
185
|
+
* @param nodeId - the node to keep
|
|
186
|
+
* @throws {TypeError} when `nodeId` names no node
|
|
187
|
+
*/
|
|
188
|
+
declare function holdNode(nodeId: NodeId): void;
|
|
189
|
+
/**
|
|
190
|
+
* Ends the hold of {@link holdNode}. A node with no parent is freed at the
|
|
191
|
+
* start of the next frame. An unknown id does nothing.
|
|
192
|
+
* @param nodeId - the node to let go
|
|
193
|
+
*/
|
|
194
|
+
declare function releaseNode(nodeId: NodeId): void;
|
|
195
|
+
/**
|
|
196
|
+
* Sets an attribute/prop on `nodeId`. The key `style` applies the text as the inline style
|
|
197
|
+
* declarations. See {@link setStyle} for layout/paint properties.
|
|
198
|
+
* @param nodeId - the node to update
|
|
199
|
+
* @param key - the attribute name
|
|
200
|
+
* @param value - the attribute value
|
|
201
|
+
* @throws {DOMException} named `InvalidCharacterError` when `key` is not a valid attribute name
|
|
202
|
+
*/
|
|
203
|
+
declare function setAttribute(nodeId: NodeId, key: string, value: AttributeValue): void;
|
|
204
|
+
/**
|
|
205
|
+
* Returns the attribute/prop stored on `nodeId` under `key`, or `null` when unset.
|
|
206
|
+
* @param nodeId - the node to read
|
|
207
|
+
* @param key - the attribute name
|
|
208
|
+
* @returns the stored value, or `null`
|
|
209
|
+
* @throws {TypeError} when `nodeId` names no node
|
|
210
|
+
*/
|
|
211
|
+
declare function getAttribute(nodeId: NodeId, key: string): AttributeValue | null;
|
|
212
|
+
/**
|
|
213
|
+
* Removes an attribute/prop from `nodeId`. Removing an attribute
|
|
214
|
+
* that isn't set does nothing.
|
|
215
|
+
* @param nodeId - the node to update
|
|
216
|
+
* @param key - the attribute name
|
|
217
|
+
*/
|
|
218
|
+
declare function removeAttribute(nodeId: NodeId, key: string): void;
|
|
219
|
+
/**
|
|
220
|
+
* Sets a style property on `nodeId`. A key from {@link StyleProps} gets
|
|
221
|
+
* compile-time checking on its value's shape. Any other string key, such as a
|
|
222
|
+
* camelCase or kebab-case spelling or a property the types do not list,
|
|
223
|
+
* forwards as a raw {@link AttributeValue}.
|
|
224
|
+
*
|
|
225
|
+
* A key takes kebab-case (`flex-direction`) or camelCase (`flexDirection`).
|
|
226
|
+
* Both spellings share one slot per property, and the value set most recently
|
|
227
|
+
* applies.
|
|
228
|
+
* @param nodeId - the node to update
|
|
229
|
+
* @param key - the style property name
|
|
230
|
+
* @param value - the style property value
|
|
231
|
+
*/
|
|
232
|
+
declare function setStyle<K extends keyof StyleProps>(nodeId: NodeId, key: K, value: NonNullable<StyleProps[K]>): void;
|
|
233
|
+
declare function setStyle(nodeId: NodeId, key: string, value: AttributeValue): void;
|
|
234
|
+
/**
|
|
235
|
+
* Removes a style property from `nodeId`, so it renders as if never set.
|
|
236
|
+
* Removing a property that isn't set does nothing. The key takes any spelling
|
|
237
|
+
* or CSS name {@link setStyle} accepts, and removes the property whichever
|
|
238
|
+
* one set it.
|
|
239
|
+
* @param nodeId - the node to update
|
|
240
|
+
* @param key - the style property name
|
|
241
|
+
*/
|
|
242
|
+
declare function removeStyle(nodeId: NodeId, key: string): void;
|
|
243
|
+
/**
|
|
244
|
+
* Returns the box `nodeId` was drawn at in the last frame, in window logical
|
|
245
|
+
* pixels, or `null` if the node has no recorded box.
|
|
246
|
+
* @param nodeId - the node to read
|
|
247
|
+
* @returns the box, or `null`
|
|
248
|
+
* @throws {TypeError} when `nodeId` names no node
|
|
249
|
+
*/
|
|
250
|
+
declare function layoutOf(nodeId: NodeId): NodeBox | null;
|
|
251
|
+
/**
|
|
252
|
+
* Returns the scroll offset of `nodeId` in window logical pixels. A write made
|
|
253
|
+
* since the last draw is included, clamped to the maximum of the last drawn
|
|
254
|
+
* frame.
|
|
255
|
+
* @param nodeId - the node to read
|
|
256
|
+
* @returns `[left, top, maxLeft, maxTop]`, or `null` for a node whose `overflow` is
|
|
257
|
+
* `visible` or `clip` on both axes. The maxima are the largest offsets the node can take, as
|
|
258
|
+
* of the last drawn frame.
|
|
259
|
+
* @throws {TypeError} when `nodeId` names no node
|
|
260
|
+
*/
|
|
261
|
+
declare function scrollOf(nodeId: NodeId): NodeScroll | null;
|
|
262
|
+
/**
|
|
263
|
+
* Sets the scroll offset of `nodeId` on one or both axes. A `null` axis keeps
|
|
264
|
+
* its current offset. The host clamps each value to the scrollable range on
|
|
265
|
+
* the next frame. A node whose `overflow` is `visible` or `clip` on both axes ignores the call.
|
|
266
|
+
* @param nodeId - the node to scroll
|
|
267
|
+
* @param left - the horizontal offset, or `null` to keep it
|
|
268
|
+
* @param top - the vertical offset, or `null` to keep it
|
|
269
|
+
* @throws {TypeError} when `nodeId` names no node
|
|
270
|
+
*/
|
|
271
|
+
declare function scrollNode(nodeId: NodeId, left: number | null, top: number | null): void;
|
|
272
|
+
/**
|
|
273
|
+
* Scrolls each scroll container around `nodeId` so the node shows.
|
|
274
|
+
* @param nodeId - the node to bring into view
|
|
275
|
+
* @param block - the vertical alignment: `"start"`, `"center"`, `"end"` or `"nearest"`
|
|
276
|
+
* @param inline - the horizontal alignment: `"start"`, `"center"`, `"end"` or `"nearest"`
|
|
277
|
+
* @throws {TypeError} when `nodeId` names no node
|
|
278
|
+
* @throws {TypeError} when `block` or `inline` is not an alignment name
|
|
279
|
+
*/
|
|
280
|
+
declare function scrollIntoViewNode(nodeId: NodeId, block: ScrollAlignment, inline: ScrollAlignment): void;
|
|
281
|
+
/**
|
|
282
|
+
* Dispatches `event` at a target along its path. Dispatching at an element
|
|
283
|
+
* reaches its ancestors, `document` and `window`. Dispatching at `document`
|
|
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)
|
|
287
|
+
* @param event - the event to dispatch
|
|
288
|
+
* @returns `false` when a listener canceled a cancelable event, else `true`
|
|
289
|
+
* @throws TypeError when `target` is malformed or is an unknown target tag
|
|
290
|
+
* @throws TypeError when `target` is a node id that names no node
|
|
291
|
+
* @throws TypeError when `event` is not an event built with an event constructor
|
|
292
|
+
* @throws DOMException named `InvalidStateError` when `event` is being dispatched
|
|
293
|
+
*/
|
|
294
|
+
declare function dispatchEvent(target: EventTargetId, event: EventLike): boolean;
|
|
295
|
+
/**
|
|
296
|
+
* Fires an untrusted `click` at `nodeId`. A disabled `button` or `input` and a node whose
|
|
297
|
+
* own click is still running ignore the call.
|
|
298
|
+
* @param nodeId - the node to click
|
|
299
|
+
* @throws TypeError when `nodeId` is malformed
|
|
300
|
+
* @throws TypeError when `nodeId` names no node
|
|
301
|
+
*/
|
|
302
|
+
declare function click(nodeId: NodeId): void;
|
|
303
|
+
/**
|
|
304
|
+
* Requests that `nodeId` become focused. Takes effect on the next frame,
|
|
305
|
+
* dispatching `"blur"`/`"focus"` for whatever actually changed. The node
|
|
306
|
+
* needs a `tabindex` attribute to take focus, and a listener for either event
|
|
307
|
+
* is optional. The scroll containers around the node scroll it into view.
|
|
308
|
+
* @param nodeId - the node to focus
|
|
309
|
+
* @param preventScroll - `true` to leave the scroll containers in place; omitted or `false` scrolls the node into view
|
|
310
|
+
* @throws TypeError when `nodeId` is malformed
|
|
311
|
+
* @throws TypeError when `nodeId` names no node
|
|
312
|
+
*/
|
|
313
|
+
declare function focus(nodeId: NodeId, preventScroll?: boolean): void;
|
|
314
|
+
/**
|
|
315
|
+
* Requests that `nodeId` become unfocused, the way `element.blur()` does.
|
|
316
|
+
* Takes effect on the next frame; a no-op if `nodeId` isn't the focused node
|
|
317
|
+
* when it runs.
|
|
318
|
+
* @param nodeId - the node to unfocus
|
|
319
|
+
*/
|
|
320
|
+
declare function blur(nodeId: NodeId): void;
|
|
321
|
+
/**
|
|
322
|
+
* Returns the id of the focused node.
|
|
323
|
+
* @returns the focused node's id, or `null` when no node has focus
|
|
324
|
+
*/
|
|
325
|
+
declare function focusedNode(): NodeId | null;
|
|
326
|
+
/**
|
|
327
|
+
* Whether `node` left the tree for good, removed or freed. A removed node stays in the host and
|
|
328
|
+
* its members read real values. Its listeners are gone.
|
|
329
|
+
* @param node - the handle to check
|
|
330
|
+
* @returns `true` after {@link markRemoved} reached `node`, or when the host freed it
|
|
331
|
+
*/
|
|
332
|
+
declare function isRemoved(node: IncaNode): boolean;
|
|
1
333
|
/** The events whose handler property every element has. */
|
|
2
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"];
|
|
3
335
|
/** The plain values of a {@link RectLike}, as `toJSON` returns them. */
|
|
@@ -165,179 +497,6 @@ interface NamedNodeMap {
|
|
|
165
497
|
getNamedItem(qualifiedName: string): Attr | null;
|
|
166
498
|
[Symbol.iterator](): IterableIterator<Attr>;
|
|
167
499
|
}
|
|
168
|
-
/** The members every node has: what it is, its data and its place in the tree. */
|
|
169
|
-
interface NodeMembers {
|
|
170
|
-
/**
|
|
171
|
-
* `1` for an element, `3` for a text node, `8` for a comment stand-in, `9` for the document and
|
|
172
|
-
* `11` for a fragment.
|
|
173
|
-
*/
|
|
174
|
-
readonly nodeType: 1 | 3 | 8 | 9 | 11;
|
|
175
|
-
/**
|
|
176
|
-
* The {@link IncaElement.tagName} of an element, `"#text"` for a text node, `"#comment"` for a
|
|
177
|
-
* comment stand-in, `"#document"` for the document and `"#document-fragment"` for a fragment.
|
|
178
|
-
*/
|
|
179
|
-
readonly nodeName: string;
|
|
180
|
-
/**
|
|
181
|
-
* The data of a text node or a comment stand-in, and `null` for an element, the document or a
|
|
182
|
-
* fragment. Assigning `null` or `undefined` stores `""` and any other value stores its string.
|
|
183
|
-
* Assigning to an element, the document, a fragment or a freed node does nothing.
|
|
184
|
-
*/
|
|
185
|
-
nodeValue: string | null;
|
|
186
|
-
/** Whether the node hangs under `document`. */
|
|
187
|
-
readonly isConnected: boolean;
|
|
188
|
-
/** `document`, and `null` for `document` itself. */
|
|
189
|
-
readonly ownerDocument: IncaDocument | null;
|
|
190
|
-
/**
|
|
191
|
-
* The parent, or `null` for a detached node. A node inside a fragment reads the fragment. A
|
|
192
|
-
* freed node reads `null`.
|
|
193
|
-
*/
|
|
194
|
-
readonly parentNode: IncaElement | IncaFragment | IncaDocument | null;
|
|
195
|
-
/** The first child, or `null`. */
|
|
196
|
-
readonly firstChild: IncaNode | null;
|
|
197
|
-
/** The last child, or `null`. */
|
|
198
|
-
readonly lastChild: IncaNode | null;
|
|
199
|
-
/** The sibling right before this node, or `null`. */
|
|
200
|
-
readonly previousSibling: IncaNode | null;
|
|
201
|
-
/** The sibling right after this node, or `null`. */
|
|
202
|
-
readonly nextSibling: IncaNode | null;
|
|
203
|
-
/**
|
|
204
|
-
* The children in order, as a live list. Every read returns the same object, which follows later
|
|
205
|
-
* changes. A freed node has an empty list.
|
|
206
|
-
*/
|
|
207
|
-
readonly childNodes: NodeListOf<IncaNode>;
|
|
208
|
-
/** Whether the node has a child. */
|
|
209
|
-
hasChildNodes(): boolean;
|
|
210
|
-
/**
|
|
211
|
-
* Appends `node` as the last child. A fragment gives up its children in order and stays empty.
|
|
212
|
-
* A node that has a parent moves. Throws `HierarchyRequestError` when this node is a text node or
|
|
213
|
-
* a comment, or when `node` is this node or one of its ancestors.
|
|
214
|
-
* @returns `node`
|
|
215
|
-
*/
|
|
216
|
-
appendChild<T extends IncaNode>(node: T): T;
|
|
217
|
-
/**
|
|
218
|
-
* Inserts `node` before `child`, or last when `child` is `null` or `undefined`. A fragment gives
|
|
219
|
-
* up its children in order and stays empty. Throws `HierarchyRequestError` as
|
|
220
|
-
* {@link NodeMembers.appendChild} does, and `NotFoundError` when `child` is not a child of this
|
|
221
|
-
* node.
|
|
222
|
-
* @returns `node`
|
|
223
|
-
*/
|
|
224
|
-
insertBefore<T extends IncaNode>(node: T, child: IncaNode | null | undefined): T;
|
|
225
|
-
/**
|
|
226
|
-
* Removes `child`, which keeps its listeners and can be inserted again. Throws `NotFoundError`
|
|
227
|
-
* when `child` is not a child of this node.
|
|
228
|
-
* @returns `child`
|
|
229
|
-
*/
|
|
230
|
-
removeChild<T extends IncaNode>(child: T): T;
|
|
231
|
-
/**
|
|
232
|
-
* Puts `node` in the place of `child`, which keeps its listeners and can be inserted again.
|
|
233
|
-
* Throws as {@link NodeMembers.insertBefore} does, with `child` as the node that has to be a
|
|
234
|
-
* child of this node.
|
|
235
|
-
* @returns `child`
|
|
236
|
-
*/
|
|
237
|
-
replaceChild<T extends IncaNode>(node: IncaNode, child: T): T;
|
|
238
|
-
/**
|
|
239
|
-
* Copies the node: its tag, attributes and style, and with `deep` its descendants. The copy has
|
|
240
|
-
* no parent, no listeners and no scroll offset, and the text of an `input` carries over.
|
|
241
|
-
* @param deep - whether the descendants are copied too
|
|
242
|
-
* @returns the copy
|
|
243
|
-
*/
|
|
244
|
-
cloneNode(deep?: boolean): this;
|
|
245
|
-
/**
|
|
246
|
-
* Whether `other` is this node or one of its descendants in the tree as rendered. `null` and
|
|
247
|
-
* `undefined` give `false`, and any other value that is not a node throws a `TypeError`. After
|
|
248
|
-
* the node is removed, it still answers for the subtree it keeps. A freed node contains only
|
|
249
|
-
* itself.
|
|
250
|
-
*/
|
|
251
|
-
contains(other: IncaNode | null): boolean;
|
|
252
|
-
/**
|
|
253
|
-
* The topmost node above this one: `document` for a connected node, else the top of its
|
|
254
|
-
* subtree, the node itself without a parent.
|
|
255
|
-
*/
|
|
256
|
-
getRootNode(): IncaNode;
|
|
257
|
-
/**
|
|
258
|
-
* The position of `other` relative to this node as a bit mask: `1` disconnected, `2` preceding,
|
|
259
|
-
* `4` following, `8` contains, `16` contained by and `32` implementation specific. Nodes of
|
|
260
|
-
* different trees give `1 | 32` plus `2` or `4`, with opposite directions for the two orders of
|
|
261
|
-
* the pair. A freed node is a tree of its own: it gives `1 | 32` plus `2` or `4` by the order of
|
|
262
|
-
* the two ids, and `0` for itself.
|
|
263
|
-
* @throws {TypeError} when `other` is not a node
|
|
264
|
-
*/
|
|
265
|
-
compareDocumentPosition(other: IncaNode): number;
|
|
266
|
-
/** Whether `other` is this node. `null` and `undefined` give `false`. */
|
|
267
|
-
isSameNode(other: IncaNode | null): boolean;
|
|
268
|
-
/**
|
|
269
|
-
* Whether `other` has the same tag, attributes, style and children, compared in depth. The typed
|
|
270
|
-
* text of an `input` is not compared. `null` and `undefined` give `false`. A freed node equals
|
|
271
|
-
* only itself.
|
|
272
|
-
*/
|
|
273
|
-
isEqualNode(other: IncaNode | null): boolean;
|
|
274
|
-
}
|
|
275
|
-
/** The `textContent` of a node. */
|
|
276
|
-
interface TextContentMember {
|
|
277
|
-
/**
|
|
278
|
-
* The data of a text node or a comment stand-in, and the data of the text nodes below an
|
|
279
|
-
* element in tree order, comment stand-ins left out. Assigning `null` or `undefined` stores `""`
|
|
280
|
-
* and any other value stores its string. Assigning to an element replaces its children with one
|
|
281
|
-
* text node, or with none for `""`. A freed node reads `""` or its last data and ignores the
|
|
282
|
-
* assignment.
|
|
283
|
-
*/
|
|
284
|
-
textContent: string;
|
|
285
|
-
}
|
|
286
|
-
/** The members of a text node and a comment stand-in that read and edit their data. */
|
|
287
|
-
interface CharacterDataMembers extends TextContentMember {
|
|
288
|
-
/** The data. Assigning `null` stores `""` and any other value stores its string. */
|
|
289
|
-
data: string;
|
|
290
|
-
/** The number of UTF-16 code units of the data. */
|
|
291
|
-
readonly length: number;
|
|
292
|
-
/**
|
|
293
|
-
* The part of the data from `offset`. Both arguments convert to unsigned 32-bit integers and
|
|
294
|
-
* count UTF-16 code units. `count` stops at the end of the data.
|
|
295
|
-
* @param offset - Where the part starts.
|
|
296
|
-
* @param count - The length of the part.
|
|
297
|
-
* @throws {DOMException} named `IndexSizeError` when `offset` is beyond the data.
|
|
298
|
-
*/
|
|
299
|
-
substringData(offset: number, count: number): string;
|
|
300
|
-
/**
|
|
301
|
-
* Adds `data` at the end of the data.
|
|
302
|
-
* @param data - The text to add.
|
|
303
|
-
*/
|
|
304
|
-
appendData(data: string): void;
|
|
305
|
-
/**
|
|
306
|
-
* Adds `data` at `offset`.
|
|
307
|
-
* @param offset - Where to add.
|
|
308
|
-
* @param data - The text to add.
|
|
309
|
-
* @throws {DOMException} named `IndexSizeError` when `offset` is beyond the data.
|
|
310
|
-
*/
|
|
311
|
-
insertData(offset: number, data: string): void;
|
|
312
|
-
/**
|
|
313
|
-
* Removes `count` units from `offset`.
|
|
314
|
-
* @param offset - Where the removal starts.
|
|
315
|
-
* @param count - The number of units, stopping at the end of the data.
|
|
316
|
-
* @throws {DOMException} named `IndexSizeError` when `offset` is beyond the data.
|
|
317
|
-
*/
|
|
318
|
-
deleteData(offset: number, count: number): void;
|
|
319
|
-
/**
|
|
320
|
-
* Replaces `count` units from `offset` with `data`.
|
|
321
|
-
* @param offset - Where the replaced part starts.
|
|
322
|
-
* @param count - The number of units, stopping at the end of the data.
|
|
323
|
-
* @param data - The new text.
|
|
324
|
-
* @throws {DOMException} named `IndexSizeError` when `offset` is beyond the data.
|
|
325
|
-
*/
|
|
326
|
-
replaceData(offset: number, count: number, data: string): void;
|
|
327
|
-
}
|
|
328
|
-
/** The members only a text node has. */
|
|
329
|
-
interface TextMembers {
|
|
330
|
-
/** The data of this node and of the text nodes that touch it, in order. */
|
|
331
|
-
readonly wholeText: string;
|
|
332
|
-
/**
|
|
333
|
-
* Cuts the data at `offset`. This node keeps the head and the new node holds the tail. The new
|
|
334
|
-
* node follows this one when this one has a parent, and has no parent otherwise.
|
|
335
|
-
* @param offset - Where to cut, converted like the offset of `substringData()`.
|
|
336
|
-
* @returns The new node.
|
|
337
|
-
* @throws {DOMException} named `IndexSizeError` when `offset` is beyond the data.
|
|
338
|
-
*/
|
|
339
|
-
splitText(offset: number): IncaText;
|
|
340
|
-
}
|
|
341
500
|
/**
|
|
342
501
|
* The inline style of an element. Every style key and every CSS alias is a property in camelCase
|
|
343
502
|
* and in kebab-case, and the host-only style keys are properties too. Reading a property gives the
|
|
@@ -483,16 +642,14 @@ interface HtmlMembers {
|
|
|
483
642
|
insertAdjacentHTML(position: string, text: string): void;
|
|
484
643
|
}
|
|
485
644
|
/**
|
|
486
|
-
*
|
|
487
|
-
* `createCommentNode` makes. It is the only node type that can act as a
|
|
488
|
-
* parent. `parent` reads the node's current position in the tree.
|
|
645
|
+
* An element, a node with a tag, attributes and children.
|
|
489
646
|
*
|
|
490
647
|
* A removed node keeps its attributes and its position in its own subtree, and its members read
|
|
491
648
|
* them. Its listeners are dropped. `addEventListener()` and `removeEventListener()` ignore the
|
|
492
649
|
* call, an assignment to a handler property does nothing, and `dispatchEvent()` runs no listener
|
|
493
650
|
* on it.
|
|
494
651
|
*/
|
|
495
|
-
interface IncaElement extends IncaEventTarget,
|
|
652
|
+
interface IncaElement extends IncaEventTarget, NodeMembers, ParentNodeMembers, ChildNodeMembers, NonDocumentTypeChildNodeMembers, TextContentMember, HtmlMembers {
|
|
496
653
|
/**
|
|
497
654
|
* The `id` attribute, or an empty string when it is unset. Assigning sets
|
|
498
655
|
* the attribute to the value as a string.
|
|
@@ -509,11 +666,8 @@ interface IncaElement extends IncaEventTarget, EventHandlers, NodeMembers, TextC
|
|
|
509
666
|
*/
|
|
510
667
|
get classList(): DOMTokenList;
|
|
511
668
|
set classList(value: string);
|
|
512
|
-
/**
|
|
513
|
-
|
|
514
|
-
* `"element"` for every other container.
|
|
515
|
-
*/
|
|
516
|
-
readonly kind: "element" | "comment";
|
|
669
|
+
/** Discriminates this node within the {@link IncaNode} union. */
|
|
670
|
+
readonly kind: "element";
|
|
517
671
|
/**
|
|
518
672
|
* The qualified name of the element. An element of the HTML namespace reads in ASCII upper case,
|
|
519
673
|
* such as `"BUTTON"`, and the mount container reads `"DIV"`.
|
|
@@ -525,137 +679,457 @@ interface IncaElement extends IncaEventTarget, EventHandlers, NodeMembers, TextC
|
|
|
525
679
|
readonly namespaceURI: string | null;
|
|
526
680
|
/** The prefix of the element name, or `null` for none. */
|
|
527
681
|
readonly prefix: string | null;
|
|
528
|
-
/** The current parent element or fragment, or `null` if this node isn't attached to the tree. */
|
|
529
|
-
parent: IncaParent | null;
|
|
530
682
|
/**
|
|
531
|
-
*
|
|
532
|
-
*
|
|
683
|
+
* Captures the mouse pointer for this node while a button is held. Only `pointerId` 1 exists.
|
|
684
|
+
* @throws DOMException named `NotFoundError` for another `pointerId`
|
|
685
|
+
* @throws DOMException named `InvalidStateError` when the node is outside the mounted tree,
|
|
686
|
+
* also after it is removed
|
|
533
687
|
*/
|
|
534
|
-
|
|
688
|
+
setPointerCapture(pointerId: number): void;
|
|
535
689
|
/**
|
|
536
|
-
*
|
|
537
|
-
*
|
|
690
|
+
* Releases the capture this node requested. Does nothing when the node holds none.
|
|
691
|
+
* @throws DOMException named `NotFoundError` for a `pointerId` other than 1
|
|
538
692
|
*/
|
|
539
|
-
|
|
540
|
-
/**
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
693
|
+
releasePointerCapture(pointerId: number): void;
|
|
694
|
+
/**
|
|
695
|
+
* Whether this node requested the capture and has not released it. `false` after the node is
|
|
696
|
+
* removed.
|
|
697
|
+
*/
|
|
698
|
+
hasPointerCapture(pointerId: number): boolean;
|
|
699
|
+
/**
|
|
700
|
+
* The value of the attribute `name` as a string, or `null` when it is unset. Names are
|
|
701
|
+
* ASCII-case-insensitive.
|
|
702
|
+
* @param name - The attribute name.
|
|
703
|
+
* @returns The attribute value, or `null` when the attribute is unset.
|
|
704
|
+
*/
|
|
705
|
+
getAttribute(name: string): string | null;
|
|
706
|
+
/**
|
|
707
|
+
* Sets the attribute `name` to `String(value)`. Names are ASCII-case-insensitive.
|
|
708
|
+
* `disabled`, `hidden`, `inert` and `readonly` take effect by presence.
|
|
709
|
+
* @throws DOMException named `InvalidCharacterError` for an empty name, or one that holds ASCII
|
|
710
|
+
* whitespace, NUL, `/`, `=` or `>`
|
|
711
|
+
* @param name - The attribute name.
|
|
712
|
+
* @param value - The new value, converted with `String`.
|
|
713
|
+
*/
|
|
714
|
+
setAttribute(name: string, value: string): void;
|
|
715
|
+
/**
|
|
716
|
+
* Whether the attribute `name` is set, an empty value included.
|
|
717
|
+
* @param name - The attribute name.
|
|
718
|
+
* @returns `true` when the attribute is set.
|
|
719
|
+
*/
|
|
720
|
+
hasAttribute(name: string): boolean;
|
|
721
|
+
/**
|
|
722
|
+
* Removes the attribute `name`. An unset name changes nothing.
|
|
723
|
+
* @param name - The attribute name.
|
|
724
|
+
*/
|
|
725
|
+
removeAttribute(name: string): void;
|
|
726
|
+
/** The names of the set attributes in the order they were set. */
|
|
727
|
+
getAttributeNames(): string[];
|
|
728
|
+
/**
|
|
729
|
+
* The set attributes as a live map. Every read returns the same object, which follows later
|
|
730
|
+
* changes. A key that equals the name of a set attribute reads its `Attr`.
|
|
731
|
+
*/
|
|
732
|
+
readonly attributes: NamedNodeMap;
|
|
733
|
+
/**
|
|
734
|
+
* Whether this element matches the selector list. `:focus-visible` and the other interactive and
|
|
735
|
+
* form-state pseudo-classes never match.
|
|
736
|
+
* @throws DOMException named `SyntaxError` for an invalid selector, also after this element is
|
|
737
|
+
* removed
|
|
738
|
+
* @param selectors - A selector list.
|
|
739
|
+
* @returns `true` when this element matches the selector list.
|
|
740
|
+
*/
|
|
741
|
+
matches(selectors: string): boolean;
|
|
742
|
+
/**
|
|
743
|
+
* The nearest element at or above this one that matches the selector list, or `null`.
|
|
744
|
+
* @throws DOMException named `SyntaxError` for an invalid selector, also after this element is
|
|
745
|
+
* removed
|
|
746
|
+
* @param selectors - A selector list.
|
|
747
|
+
* @returns The matching element, or `null` when none matches.
|
|
748
|
+
*/
|
|
749
|
+
closest(selectors: string): IncaElement | null;
|
|
750
|
+
/**
|
|
751
|
+
* The box this node was drawn at in the last frame, in window logical
|
|
752
|
+
* pixels. A node created in the same task reads all zeros.
|
|
753
|
+
*/
|
|
754
|
+
getBoundingClientRect(): RectLike;
|
|
755
|
+
/** The box width less both borders, rounded, at least `0`. */
|
|
756
|
+
readonly clientWidth: number;
|
|
757
|
+
/** The box height less both borders, rounded, at least `0`. */
|
|
758
|
+
readonly clientHeight: number;
|
|
759
|
+
/** The border width, rounded. */
|
|
760
|
+
readonly clientLeft: number;
|
|
761
|
+
/** The border width, rounded. */
|
|
762
|
+
readonly clientTop: number;
|
|
763
|
+
/** The horizontal scroll offset. Assigning moves it at once, and reads are clamped to the last frame's maximum. */
|
|
764
|
+
scrollLeft: number;
|
|
765
|
+
/** The vertical scroll offset. Assigning moves it at once, and reads are clamped to the last frame's maximum. */
|
|
766
|
+
scrollTop: number;
|
|
767
|
+
/** The content width: {@link clientWidth} plus the largest horizontal offset. */
|
|
768
|
+
readonly scrollWidth: number;
|
|
769
|
+
/** The content height: {@link clientHeight} plus the largest vertical offset. */
|
|
770
|
+
readonly scrollHeight: number;
|
|
771
|
+
/** Sets the offset to `(left, top)`, or to the options object's `left` and `top`. */
|
|
772
|
+
scrollTo(left?: number, top?: number): void;
|
|
773
|
+
scrollTo(options: ScrollOptions): void;
|
|
774
|
+
/** Adds `(left, top)` to the offset, or the options object's `left` and `top`. */
|
|
775
|
+
scrollBy(left?: number, top?: number): void;
|
|
776
|
+
scrollBy(options: ScrollOptions): void;
|
|
777
|
+
/**
|
|
778
|
+
* Scrolls each scroll container around this node so the node shows. `true`
|
|
779
|
+
* or no argument aligns to the start and `false` to the end. An options
|
|
780
|
+
* object sets `block` (default `"start"`) and `inline` (default `"nearest"`);
|
|
781
|
+
* `behavior` is accepted and ignored. After the node is removed, the call
|
|
782
|
+
* does nothing.
|
|
783
|
+
*/
|
|
784
|
+
scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;
|
|
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
|
+
}
|
|
841
|
+
/** The handle of an `<input>`. */
|
|
842
|
+
interface IncaInputElement extends IncaHTMLElement {
|
|
843
|
+
/**
|
|
844
|
+
* The text of the input. Assigning sets the value as a string, and `null` as `""`; line breaks
|
|
845
|
+
* are dropped and a changed text puts the caret at its end.
|
|
846
|
+
*/
|
|
847
|
+
value: string;
|
|
848
|
+
}
|
|
849
|
+
/** The handle of a `<template>`. */
|
|
850
|
+
interface IncaTemplateElement extends IncaHTMLElement {
|
|
851
|
+
/** The fragment that holds the markup of the template. It is never drawn or connected. */
|
|
852
|
+
readonly content: IncaFragment;
|
|
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
|
+
}
|
|
859
|
+
/** A text leaf node. */
|
|
860
|
+
interface IncaText extends IncaEventTarget, NodeMembers, TextContentMember, CharacterDataMembers, ChildNodeMembers, NonDocumentTypeChildNodeMembers, TextMembers {
|
|
861
|
+
/** Discriminates this node within the {@link IncaNode} union. */
|
|
862
|
+
readonly kind: "text";
|
|
863
|
+
/**
|
|
864
|
+
* The text content, mirroring the value pushed to the native node.
|
|
865
|
+
*/
|
|
866
|
+
text: string;
|
|
867
|
+
}
|
|
868
|
+
/**
|
|
869
|
+
* The node `document.createDocumentFragment()` returns: a parentless container whose children move
|
|
870
|
+
* into the node it is inserted into.
|
|
871
|
+
*/
|
|
872
|
+
interface IncaFragment extends IncaEventTarget, NodeMembers, ParentNodeMembers, TextContentMember {
|
|
873
|
+
/** Discriminates this node within the {@link IncaNode} union. */
|
|
874
|
+
readonly kind: "fragment";
|
|
875
|
+
}
|
|
876
|
+
/** A node that can have children. */
|
|
877
|
+
type IncaParent = IncaElement | IncaFragment | IncaDocument;
|
|
878
|
+
/** Any node handle: an element, comment, text leaf, fragment or the document. */
|
|
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 {
|
|
546
882
|
/** The closest earlier sibling that is an element, or `null`. */
|
|
547
883
|
readonly previousElementSibling: IncaElement | null;
|
|
548
884
|
/** The closest later sibling that is an element, or `null`. */
|
|
549
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;
|
|
550
992
|
/**
|
|
551
|
-
*
|
|
552
|
-
* `
|
|
553
|
-
*
|
|
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.
|
|
554
996
|
*/
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
blur(): void;
|
|
997
|
+
isEqualNode(other: IncaNode | null): boolean;
|
|
998
|
+
}
|
|
999
|
+
/** The `textContent` of a node. */
|
|
1000
|
+
interface TextContentMember {
|
|
560
1001
|
/**
|
|
561
|
-
*
|
|
562
|
-
*
|
|
563
|
-
*
|
|
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.
|
|
564
1007
|
*/
|
|
565
|
-
|
|
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;
|
|
566
1016
|
/**
|
|
567
|
-
*
|
|
568
|
-
*
|
|
569
|
-
* @
|
|
570
|
-
*
|
|
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.
|
|
571
1022
|
*/
|
|
572
|
-
|
|
1023
|
+
substringData(offset: number, count: number): string;
|
|
573
1024
|
/**
|
|
574
|
-
*
|
|
575
|
-
* @
|
|
1025
|
+
* Adds `data` at the end of the data.
|
|
1026
|
+
* @param data - The text to add.
|
|
576
1027
|
*/
|
|
577
|
-
|
|
1028
|
+
appendData(data: string): void;
|
|
578
1029
|
/**
|
|
579
|
-
*
|
|
580
|
-
*
|
|
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.
|
|
581
1034
|
*/
|
|
582
|
-
|
|
1035
|
+
insertData(offset: number, data: string): void;
|
|
583
1036
|
/**
|
|
584
|
-
*
|
|
585
|
-
*
|
|
586
|
-
*
|
|
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.
|
|
587
1041
|
*/
|
|
588
|
-
|
|
1042
|
+
deleteData(offset: number, count: number): void;
|
|
589
1043
|
/**
|
|
590
|
-
*
|
|
591
|
-
*
|
|
592
|
-
* @param
|
|
593
|
-
* @
|
|
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.
|
|
594
1049
|
*/
|
|
595
|
-
|
|
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;
|
|
596
1056
|
/**
|
|
597
|
-
*
|
|
598
|
-
*
|
|
599
|
-
* @
|
|
600
|
-
*
|
|
601
|
-
* @
|
|
602
|
-
* @param value - The new value, converted with `String`.
|
|
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.
|
|
603
1062
|
*/
|
|
604
|
-
|
|
1063
|
+
splitText(offset: number): IncaText;
|
|
1064
|
+
}
|
|
1065
|
+
/** The members of the nodes that hold children that insert and replace nodes. */
|
|
1066
|
+
interface ParentNodeMutationMembers {
|
|
605
1067
|
/**
|
|
606
|
-
*
|
|
607
|
-
*
|
|
608
|
-
*
|
|
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
|
|
609
1075
|
*/
|
|
610
|
-
|
|
1076
|
+
append(...nodes: (IncaNode | string)[]): void;
|
|
611
1077
|
/**
|
|
612
|
-
*
|
|
613
|
-
* @
|
|
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
|
|
614
1081
|
*/
|
|
615
|
-
|
|
616
|
-
/** The names of the set attributes in the order they were set. */
|
|
617
|
-
getAttributeNames(): string[];
|
|
1082
|
+
prepend(...nodes: (IncaNode | string)[]): void;
|
|
618
1083
|
/**
|
|
619
|
-
*
|
|
620
|
-
*
|
|
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
|
|
621
1088
|
*/
|
|
622
|
-
|
|
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 {
|
|
623
1093
|
/**
|
|
624
|
-
*
|
|
625
|
-
*
|
|
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
|
|
626
1097
|
*/
|
|
627
|
-
|
|
628
|
-
set style(cssText: string | null);
|
|
1098
|
+
before(...nodes: (IncaNode | string)[]): void;
|
|
629
1099
|
/**
|
|
630
|
-
*
|
|
631
|
-
*
|
|
632
|
-
* @
|
|
633
|
-
* letter, and named `InvalidCharacterError` for a key that makes an invalid attribute name
|
|
634
|
-
* @throws TypeError for a write of a `Symbol` value
|
|
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
|
|
635
1103
|
*/
|
|
636
|
-
|
|
1104
|
+
after(...nodes: (IncaNode | string)[]): void;
|
|
637
1105
|
/**
|
|
638
|
-
*
|
|
639
|
-
*
|
|
640
|
-
* @
|
|
641
|
-
*
|
|
642
|
-
* @param selectors - A selector list.
|
|
643
|
-
* @returns `true` when this element matches the selector list.
|
|
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
|
|
644
1110
|
*/
|
|
645
|
-
|
|
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 {
|
|
646
1117
|
/**
|
|
647
|
-
* The
|
|
648
|
-
*
|
|
649
|
-
* removed
|
|
650
|
-
* @param selectors - A selector list.
|
|
651
|
-
* @returns The matching element, or `null` when none matches.
|
|
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.
|
|
652
1120
|
*/
|
|
653
|
-
|
|
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;
|
|
654
1128
|
/**
|
|
655
|
-
* The first descendant element that matches the selector list, or `null`.
|
|
656
|
-
* in the result. `:scope` and a leading `&` select
|
|
657
|
-
* subtree it kept.
|
|
658
|
-
* @throws DOMException named `SyntaxError` for an invalid selector, also after
|
|
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
|
|
659
1133
|
* removed
|
|
660
1134
|
* @param selectors - A selector list.
|
|
661
1135
|
* @returns The first matching descendant in document order, or `null`.
|
|
@@ -665,124 +1139,26 @@ interface IncaElement extends IncaEventTarget, EventHandlers, NodeMembers, TextC
|
|
|
665
1139
|
* The descendant elements that match the selector list, in document order, as a list that later
|
|
666
1140
|
* changes do not reach. Every call returns a new list. A removed element searches the subtree it
|
|
667
1141
|
* kept.
|
|
668
|
-
* @throws DOMException named `SyntaxError` for an invalid selector, also after
|
|
1142
|
+
* @throws DOMException named `SyntaxError` for an invalid selector, also after the node is
|
|
669
1143
|
* removed
|
|
670
1144
|
* @param selectors - A selector list.
|
|
671
1145
|
* @returns The matching descendants.
|
|
672
1146
|
*/
|
|
673
1147
|
querySelectorAll(selectors: string): NodeListOf<IncaElement>;
|
|
674
|
-
/**
|
|
675
|
-
* The box this node was drawn at in the last frame, in window logical
|
|
676
|
-
* pixels. A node created in the same task reads all zeros.
|
|
677
|
-
*/
|
|
678
|
-
getBoundingClientRect(): RectLike;
|
|
679
|
-
/** The box width from the last frame, rounded. `0` until a frame draws the node. */
|
|
680
|
-
readonly offsetWidth: number;
|
|
681
|
-
/** The box height from the last frame, rounded. `0` until a frame draws the node. */
|
|
682
|
-
readonly offsetHeight: number;
|
|
683
|
-
/** The box's left edge from the last frame, relative to {@link offsetParent}. Stays fixed while the parent scrolls. */
|
|
684
|
-
readonly offsetLeft: number;
|
|
685
|
-
/** The box's top edge from the last frame, relative to {@link offsetParent}. Stays fixed while the parent scrolls. */
|
|
686
|
-
readonly offsetTop: number;
|
|
687
|
-
/**
|
|
688
|
-
* The parent, when this node and the parent both have a box from the last frame.
|
|
689
|
-
* `null` when either lacks a box or there is no parent.
|
|
690
|
-
*/
|
|
691
|
-
readonly offsetParent: IncaElement | null;
|
|
692
|
-
/** The box width less both borders, rounded, at least `0`. */
|
|
693
|
-
readonly clientWidth: number;
|
|
694
|
-
/** The box height less both borders, rounded, at least `0`. */
|
|
695
|
-
readonly clientHeight: number;
|
|
696
|
-
/** The border width, rounded. */
|
|
697
|
-
readonly clientLeft: number;
|
|
698
|
-
/** The border width, rounded. */
|
|
699
|
-
readonly clientTop: number;
|
|
700
|
-
/** The horizontal scroll offset. Assigning moves it at once, and reads are clamped to the last frame's maximum. */
|
|
701
|
-
scrollLeft: number;
|
|
702
|
-
/** The vertical scroll offset. Assigning moves it at once, and reads are clamped to the last frame's maximum. */
|
|
703
|
-
scrollTop: number;
|
|
704
|
-
/** The content width: {@link clientWidth} plus the largest horizontal offset. */
|
|
705
|
-
readonly scrollWidth: number;
|
|
706
|
-
/** The content height: {@link clientHeight} plus the largest vertical offset. */
|
|
707
|
-
readonly scrollHeight: number;
|
|
708
|
-
/** Sets the offset to `(left, top)`, or to the options object's `left` and `top`. */
|
|
709
|
-
scrollTo(left?: number, top?: number): void;
|
|
710
|
-
scrollTo(options: ScrollOptions): void;
|
|
711
|
-
/** Adds `(left, top)` to the offset, or the options object's `left` and `top`. */
|
|
712
|
-
scrollBy(left?: number, top?: number): void;
|
|
713
|
-
scrollBy(options: ScrollOptions): void;
|
|
714
|
-
/**
|
|
715
|
-
* Scrolls each scroll container around this node so the node shows. `true`
|
|
716
|
-
* or no argument aligns to the start and `false` to the end. An options
|
|
717
|
-
* object sets `block` (default `"start"`) and `inline` (default `"nearest"`);
|
|
718
|
-
* `behavior` is accepted and ignored. After the node is removed, the call
|
|
719
|
-
* does nothing.
|
|
720
|
-
*/
|
|
721
|
-
scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;
|
|
722
|
-
}
|
|
723
|
-
/** The handle of an `<input>`. */
|
|
724
|
-
interface IncaInputElement extends IncaElement {
|
|
725
|
-
/**
|
|
726
|
-
* The text of the input. Assigning sets the value as a string, and `null` as `""`; line breaks
|
|
727
|
-
* are dropped and a changed text puts the caret at its end.
|
|
728
|
-
*/
|
|
729
|
-
value: string;
|
|
730
|
-
}
|
|
731
|
-
/** The handle of a `<template>`. */
|
|
732
|
-
interface IncaTemplateElement extends IncaElement {
|
|
733
|
-
/** The fragment that holds the markup of the template. It is never drawn or connected. */
|
|
734
|
-
readonly content: IncaFragment;
|
|
735
|
-
}
|
|
736
|
-
/** A text leaf node. */
|
|
737
|
-
interface IncaText extends NodeMembers, CharacterDataMembers, TextMembers {
|
|
738
|
-
/** Discriminates this node within the {@link IncaNode} union. */
|
|
739
|
-
readonly kind: "text";
|
|
740
|
-
/** The current parent element or fragment, or `null` if this node isn't attached to the tree. */
|
|
741
|
-
parent: IncaParent | null;
|
|
742
|
-
/**
|
|
743
|
-
* The text content, mirroring the value pushed to the native node.
|
|
744
|
-
*/
|
|
745
|
-
text: string;
|
|
746
|
-
}
|
|
747
|
-
/**
|
|
748
|
-
* The node `document.createDocumentFragment()` returns: a parentless container whose children move
|
|
749
|
-
* into the node it is inserted into.
|
|
750
|
-
*/
|
|
751
|
-
interface IncaFragment extends NodeMembers, TextContentMember {
|
|
752
|
-
/** Discriminates this node within the {@link IncaNode} union. */
|
|
753
|
-
readonly kind: "fragment";
|
|
754
|
-
/** A fragment has no parent. */
|
|
755
|
-
parent: null;
|
|
756
1148
|
}
|
|
757
|
-
/** A node that can have children. */
|
|
758
|
-
type IncaParent = IncaElement | IncaFragment | IncaDocument;
|
|
759
|
-
/** Any node the shadow tree holds: an element, comment, text leaf, fragment or the document. */
|
|
760
|
-
type IncaNode = IncaElement | IncaText | IncaFragment | IncaDocument;
|
|
761
|
-
/**
|
|
762
|
-
* Stable handle to a node in the native retained tree, returned by `createNode`
|
|
763
|
-
* and used in every later call that touches that node.
|
|
764
|
-
*/
|
|
765
|
-
type NodeId = number;
|
|
766
|
-
/**
|
|
767
|
-
* Id assigned to one registered event listener. Managed internally by
|
|
768
|
-
* `addEventListener`/`removeEventListener`/`releaseListeners`.
|
|
769
|
-
*/
|
|
770
|
-
type CallbackId = number;
|
|
771
|
-
/**
|
|
772
|
-
* A value `setAttribute`/`setStyle` can take. Any other value raises a catchable
|
|
773
|
-
* exception.
|
|
774
|
-
*/
|
|
775
|
-
type AttributeValue = string | number | boolean;
|
|
776
1149
|
/** Element kind passed to `createNode`. */
|
|
777
1150
|
type TagName = string;
|
|
778
|
-
/**
|
|
779
|
-
|
|
780
|
-
|
|
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
|
+
*/
|
|
781
1156
|
type Overflow = "visible" | "hidden" | "clip" | "scroll" | "auto";
|
|
782
1157
|
/**
|
|
783
1158
|
* A size in px: a number, `"0"` or a string such as `"10px"`. A string that reads as zero
|
|
784
1159
|
* (`"0.0"`, `"-0"`) is also valid, and the unit is case-insensitive. The host warns on a space
|
|
785
|
-
* before `px`, a trailing `.`
|
|
1160
|
+
* before `px`, a trailing `.`, a `.` before the exponent, hexadecimal, binary and octal, which the
|
|
1161
|
+
* type admits.
|
|
786
1162
|
*/
|
|
787
1163
|
type Px = number | "0" | `${number}px`;
|
|
788
1164
|
/**
|
|
@@ -826,7 +1202,11 @@ interface StyleProps {
|
|
|
826
1202
|
borderRadius?: Px;
|
|
827
1203
|
/** Font size in px (`>= 0`) for this container's own text. Cascades to descendant text leaves, same as {@link StyleProps.color}. */
|
|
828
1204
|
fontSize?: Px;
|
|
829
|
-
/**
|
|
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
|
+
*/
|
|
830
1210
|
overflow?: Overflow | `${Overflow} ${Overflow}`;
|
|
831
1211
|
/** Horizontal overflow; wins over {@link StyleProps.overflow}. */
|
|
832
1212
|
overflowX?: Overflow;
|
|
@@ -854,19 +1234,22 @@ interface StyleProps {
|
|
|
854
1234
|
marginLeft?: Px | "auto";
|
|
855
1235
|
/**
|
|
856
1236
|
* Share (`>= 0`) of the free space in the parent's main axis this node takes.
|
|
857
|
-
* The host warns on a trailing `.`, hexadecimal, binary and octal,
|
|
1237
|
+
* The host warns on a trailing `.`, a `.` before the exponent, hexadecimal, binary and octal,
|
|
1238
|
+
* which the type admits.
|
|
858
1239
|
*/
|
|
859
1240
|
flexGrow?: number | `${number}`;
|
|
860
1241
|
/**
|
|
861
1242
|
* Share (`>= 0`) of the overflow in the parent's main axis this node gives up.
|
|
862
|
-
* The host warns on a trailing `.`, hexadecimal, binary and octal,
|
|
1243
|
+
* The host warns on a trailing `.`, a `.` before the exponent, hexadecimal, binary and octal,
|
|
1244
|
+
* which the type admits.
|
|
863
1245
|
*/
|
|
864
1246
|
flexShrink?: number | `${number}`;
|
|
865
1247
|
/**
|
|
866
|
-
* Opacity from `0` to `1`, applied to this node and its
|
|
867
|
-
* The host warns on a trailing `.`,
|
|
1248
|
+
* Opacity from `0` to `1`, or a percentage from `0%` to `100%`, applied to this node and its
|
|
1249
|
+
* descendants; values outside are clamped. The host warns on a trailing `.`, a `.` before the
|
|
1250
|
+
* exponent, hexadecimal, binary and octal, which the type admits.
|
|
868
1251
|
*/
|
|
869
|
-
opacity?: number | `${number}
|
|
1252
|
+
opacity?: number | `${number}` | `${number}%`;
|
|
870
1253
|
/** Minimum width in px (`>= 0`), or `"auto"` for the default minimum. */
|
|
871
1254
|
minWidth?: Px | "auto";
|
|
872
1255
|
/** Minimum height in px (`>= 0`), or `"auto"` for the default minimum. */
|
|
@@ -896,6 +1279,8 @@ interface ListenerOptions {
|
|
|
896
1279
|
passive?: boolean;
|
|
897
1280
|
/** The listener is removed before it first runs. */
|
|
898
1281
|
once?: boolean;
|
|
1282
|
+
/** The listener is removed when the signal aborts. A signal that is aborted already registers nothing. */
|
|
1283
|
+
signal?: AbortSignal;
|
|
899
1284
|
}
|
|
900
1285
|
/**
|
|
901
1286
|
* The listener methods of an object that receives events, such as the
|
|
@@ -938,16 +1323,14 @@ interface IncaEventTarget {
|
|
|
938
1323
|
* The top node of the tree, the parent of the mount container. It holds at most one element and
|
|
939
1324
|
* any number of comments, and no text.
|
|
940
1325
|
*/
|
|
941
|
-
interface IncaDocument extends IncaEventTarget, EventHandlers<IncaDocument>,
|
|
942
|
-
/** Discriminates this node within the
|
|
1326
|
+
interface IncaDocument extends IncaEventTarget, EventHandlers<IncaDocument>, NodeMembers, ParentNodeMembers {
|
|
1327
|
+
/** Discriminates this node within the `IncaNode` union. */
|
|
943
1328
|
readonly kind: "document";
|
|
944
|
-
/** The document has no parent. */
|
|
945
|
-
parent: null;
|
|
946
1329
|
/** Always `null`. An assignment does nothing. */
|
|
947
1330
|
textContent: string | null;
|
|
948
1331
|
/**
|
|
949
|
-
* The element that has focus, or
|
|
950
|
-
* takes effect for this property at once.
|
|
1332
|
+
* The element that has focus, or else the element of the document, or `null` when it has none.
|
|
1333
|
+
* A `focus()` or `blur()` call takes effect for this property at once.
|
|
951
1334
|
*/
|
|
952
1335
|
readonly activeElement: IncaElement | null;
|
|
953
1336
|
/**
|
|
@@ -963,7 +1346,7 @@ interface IncaDocument extends IncaEventTarget, EventHandlers<IncaDocument>, Omi
|
|
|
963
1346
|
* @throws TypeError when called without an argument
|
|
964
1347
|
* @throws DOMException named `InvalidCharacterError` when `localName` is not a valid element name
|
|
965
1348
|
*/
|
|
966
|
-
createElement(localName: string):
|
|
1349
|
+
createElement(localName: string): IncaHTMLElement;
|
|
967
1350
|
/**
|
|
968
1351
|
* Creates an element with a namespace. The namespace converts to a string, and `null`,
|
|
969
1352
|
* `undefined` and `""` mean no namespace. The name converts to a string and splits at its first
|
|
@@ -990,22 +1373,7 @@ interface IncaDocument extends IncaEventTarget, EventHandlers<IncaDocument>, Omi
|
|
|
990
1373
|
* @returns The new comment, which has no parent.
|
|
991
1374
|
* @throws TypeError when called without an argument
|
|
992
1375
|
*/
|
|
993
|
-
createComment(data: string):
|
|
994
|
-
/**
|
|
995
|
-
* The first element below the document that matches the selector list, or `null`.
|
|
996
|
-
* @throws DOMException named `SyntaxError` for an invalid selector
|
|
997
|
-
* @param selectors - A selector list.
|
|
998
|
-
* @returns The first matching element in document order, or `null`.
|
|
999
|
-
*/
|
|
1000
|
-
querySelector(selectors: string): IncaElement | null;
|
|
1001
|
-
/**
|
|
1002
|
-
* The elements below the document that match the selector list, in document order, as a list
|
|
1003
|
-
* that later changes do not reach. Every call returns a new list.
|
|
1004
|
-
* @throws DOMException named `SyntaxError` for an invalid selector
|
|
1005
|
-
* @param selectors - A selector list.
|
|
1006
|
-
* @returns The matching elements.
|
|
1007
|
-
*/
|
|
1008
|
-
querySelectorAll(selectors: string): NodeListOf<IncaElement>;
|
|
1376
|
+
createComment(data: string): IncaComment;
|
|
1009
1377
|
}
|
|
1010
1378
|
/**
|
|
1011
1379
|
* The event target at the top of every event path.
|
|
@@ -1320,15 +1688,11 @@ interface EventListenerObject<E = IncaEvent> {
|
|
|
1320
1688
|
*/
|
|
1321
1689
|
type EventListenerOrObject<E = IncaEvent, T = IncaEventTarget> = EventListener<E, T> | EventListenerObject<E>;
|
|
1322
1690
|
/**
|
|
1323
|
-
* The event target at the top of the app, after `document`. Every event path
|
|
1324
|
-
*
|
|
1325
|
-
*
|
|
1326
|
-
*
|
|
1327
|
-
* `document`. A `wheel` listener is passive unless its options say
|
|
1691
|
+
* The event target at the top of the app, after `document`. Every event path ends at it. Bubble
|
|
1692
|
+
* listeners on it run for every bubbling event, and capture listeners run for every event
|
|
1693
|
+
* dispatched in the app, including events that do not bubble. A key event reaches it through the
|
|
1694
|
+
* mount container and `document`. A `wheel` listener is passive unless its options say
|
|
1328
1695
|
* `passive: false`.
|
|
1329
|
-
*
|
|
1330
|
-
* It has the listener methods `addEventListener`, `removeEventListener` and
|
|
1331
|
-
* `dispatchEvent`, and the event handler properties such as `onkeydown`.
|
|
1332
1696
|
*/
|
|
1333
1697
|
declare const window: IncaWindow;
|
|
1334
|
-
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 };
|