incajs 0.0.31 → 0.0.33

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.
@@ -1,5 +1,296 @@
1
1
  /** The events whose handler property every element has. */
2
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
+ /**
4
+ * Stable handle to a node in the native retained tree, returned by `createNode`
5
+ * and used in every later call that touches that node.
6
+ */
7
+ type NodeId = number;
8
+ /**
9
+ * Id assigned to one registered event listener. Managed internally by
10
+ * `addEventListener`/`removeEventListener`/`removeNode`.
11
+ */
12
+ type CallbackId = number;
13
+ /**
14
+ * A value `setAttribute`/`setStyle` can take. Any other value raises a catchable
15
+ * exception.
16
+ */
17
+ type AttributeValue = string | number | boolean;
18
+ /** Where `scrollIntoView` aligns a node on one axis. */
19
+ type ScrollAlignment = "start" | "center" | "end" | "nearest";
20
+ /** How {@link IncaNative.linkedNode} names the node to reach from a node. */
21
+ type NodeLink = "parent" | "first" | "last" | "previous" | "next";
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
+ * What a native returns for a copy of a node without a name: id, the marker or tag, and the text
30
+ * of a `#text` copy (`null` for any other node).
31
+ */
32
+ type NodeEntry = [id: NodeId, tag: string, data: string | null];
33
+ /** What a native returns for an element it makes: id and the four name parts. */
34
+ type ElementEntry = [id: NodeId, localName: string, namespaceURI: string | null, prefix: string | null, tagName: string];
35
+ /**
36
+ * One node of a parsed fragment: id, tag, namespace (`null` for a text node, a comment and a
37
+ * fragment), parent id and the text of a text node or a comment.
38
+ */
39
+ type ParsedEntry = [id: NodeId, tag: string, namespaceURI: string | null, parentId: NodeId, data: string | null];
40
+ /**
41
+ * What a parse writes into the tree: the position of the first inserted node among the children of
42
+ * its container, and the nodes in pre-order. An entry whose parent is no entry is a root.
43
+ */
44
+ type Parsed = [position: number, entries: ParsedEntry[]];
45
+ /** What a listener or a dispatch names: a node id, or the tag of `window`. */
46
+ type EventTargetId = NodeId | "$window";
47
+ /**
48
+ * The host-injected object every wrapper in this package forwards to. Not part of the public
49
+ * surface.
50
+ */
51
+ interface IncaNative {
52
+ rootNodeId(): NodeId;
53
+ documentNodeId(): NodeId;
54
+ createNode(tag: string): NodeId;
55
+ createElement(localName: string): [NodeId, TagName];
56
+ createElementNS(namespace: string | null, qualifiedName: string): ElementEntry;
57
+ attributeKey(nodeId: NodeId, name: string): string;
58
+ appendChild(parentId: NodeId, nodeId: NodeId): number;
59
+ insertBefore(parentId: NodeId, nodeId: NodeId, refId: NodeId | null): number;
60
+ removeChild(parentId: NodeId, childId: NodeId): void;
61
+ replaceChild(parentId: NodeId, nodeId: NodeId, childId: NodeId): number;
62
+ cloneNode(nodeId: NodeId, deep: boolean): (NodeEntry | ElementEntry)[];
63
+ templateContent(nodeId: NodeId): NodeId | null;
64
+ innerHtml(nodeId: NodeId): string;
65
+ outerHtml(nodeId: NodeId): string;
66
+ setInnerHtml(nodeId: NodeId, html: string): Parsed;
67
+ setOuterHtml(nodeId: NodeId, html: string): Parsed | null;
68
+ insertAdjacentHtml(nodeId: NodeId, position: string, html: string): Parsed;
69
+ rootOf(nodeId: NodeId): NodeId;
70
+ compareNodePosition(nodeId: NodeId, otherId: NodeId): number;
71
+ isEqualNode(nodeId: NodeId, otherId: NodeId): boolean;
72
+ setAttribute(nodeId: NodeId, key: string, value: AttributeValue): void;
73
+ getAttribute(nodeId: NodeId, key: string): AttributeValue | null;
74
+ removeAttribute(nodeId: NodeId, key: string): void;
75
+ attributeNames(nodeId: NodeId): string[];
76
+ classList(nodeId: NodeId): DOMTokenList;
77
+ datasetGet(nodeId: NodeId, key: string): string | undefined;
78
+ datasetSet(nodeId: NodeId, key: string, value: string): void;
79
+ datasetDelete(nodeId: NodeId, key: string): boolean;
80
+ datasetKeys(nodeId: NodeId): string[];
81
+ datasetTarget(): object;
82
+ linkedNode(nodeId: NodeId, link: NodeLink, elementOnly?: boolean): NodeId | null;
83
+ childNodeIds(nodeId: NodeId, elementOnly?: boolean): NodeId[];
84
+ isConnected(nodeId: NodeId): boolean;
85
+ textContent(nodeId: NodeId): string;
86
+ wholeText(nodeId: NodeId): string;
87
+ substringData(nodeId: NodeId, offset: number, count: number): string;
88
+ replaceData(nodeId: NodeId, offset: number, count: number, data: string): void;
89
+ splitText(nodeId: NodeId, offset: number): NodeId;
90
+ matches(nodeId: NodeId, selector: string): boolean;
91
+ closest(nodeId: NodeId, selector: string): NodeId | null;
92
+ checkSelector(selector: string): void;
93
+ querySelector(nodeId: NodeId, selector: string): NodeId | null;
94
+ querySelectorAll(nodeId: NodeId, selector: string): NodeId[];
95
+ setStyle(nodeId: NodeId, key: string, value: AttributeValue): void;
96
+ removeStyle(nodeId: NodeId, key: string): void;
97
+ styleOf(nodeId: NodeId): CSSStyleDeclaration;
98
+ inputValue(nodeId: NodeId): string;
99
+ setInputValue(nodeId: NodeId, value: string): void;
100
+ addEventListener(target: EventTargetId, event: string, callback: HostCallback, capture?: boolean, passive?: boolean): CallbackId;
101
+ removeEventListener(target: EventTargetId, event: string, callbackId: CallbackId): boolean;
102
+ removeNode(nodeId: NodeId): [callbackIds: CallbackId[], nodeIds: NodeId[]];
103
+ holdNode(nodeId: NodeId): void;
104
+ releaseNode(nodeId: NodeId): void;
105
+ focusNode(nodeId: NodeId, preventScroll?: boolean): void;
106
+ blurNode(nodeId: NodeId): void;
107
+ focusedNode(): NodeId | null;
108
+ layoutOf(nodeId: NodeId): readonly [number, number, number, number, number, number, number] | null;
109
+ scrollOf(nodeId: NodeId): readonly [number, number, number, number] | null;
110
+ scrollNode(nodeId: NodeId, left: number | null, top: number | null): void;
111
+ scrollIntoViewNode(nodeId: NodeId, block: ScrollAlignment, inline: ScrollAlignment): void;
112
+ dispatchEvent(target: EventTargetId, event: EventLike): boolean;
113
+ click(nodeId: NodeId): void;
114
+ setPointerCapture(nodeId: NodeId, pointerId: number): void;
115
+ releasePointerCapture(nodeId: NodeId, pointerId: number): void;
116
+ hasPointerCapture(nodeId: NodeId, pointerId: number): boolean;
117
+ }
118
+ /** What the host calls: it passes the event object as the first argument. */
119
+ type HostCallback = (...args: unknown[]) => void;
120
+ declare global {
121
+ var __inca_native__: IncaNative;
122
+ var __inca_released__: (nodeIds: NodeId[], callbackIds: CallbackId[]) => void;
123
+ var __inca_targets__: (targets: EventTargetId[]) => unknown[];
124
+ }
125
+ /**
126
+ * Returns the host-allocated root container's id, the node an app attaches
127
+ * itself under. The host allocates it with the tree, so this resolves from
128
+ * the first call and names the same node for the engine's lifetime.
129
+ * @returns the root node's id
130
+ */
131
+ declare function rootNodeId(): NodeId;
132
+ /**
133
+ * Allocates a new node of kind `tag` in the native tree. The node starts out
134
+ * detached. Attach it with {@link appendChild}/{@link insertBefore}. The host
135
+ * frees the node at the start of the next frame unless it is inserted or held
136
+ * with {@link holdNode} by then.
137
+ * @param tag - the node's element kind
138
+ * @returns the new node's id
139
+ */
140
+ declare function createNode(tag: TagName): NodeId;
141
+ /**
142
+ * Keeps `nodeId` and its subtree alive while it has no parent. The host frees
143
+ * a parentless node that is neither held nor inserted by the start of the next
144
+ * frame. Holding a held or attached node changes nothing visible.
145
+ * @param nodeId - the node to keep
146
+ * @throws {TypeError} when `nodeId` names no node
147
+ */
148
+ declare function holdNode(nodeId: NodeId): void;
149
+ /**
150
+ * Ends the hold of {@link holdNode}. A node with no parent is freed at the
151
+ * start of the next frame. An unknown id does nothing.
152
+ * @param nodeId - the node to let go
153
+ */
154
+ declare function releaseNode(nodeId: NodeId): void;
155
+ /**
156
+ * Sets an attribute/prop on `nodeId`. The key `style` applies the text as the inline style
157
+ * declarations. See {@link setStyle} for layout/paint properties.
158
+ * @param nodeId - the node to update
159
+ * @param key - the attribute name
160
+ * @param value - the attribute value
161
+ * @throws {DOMException} named `InvalidCharacterError` when `key` is not a valid attribute name
162
+ */
163
+ declare function setAttribute(nodeId: NodeId, key: string, value: AttributeValue): void;
164
+ /**
165
+ * Returns the attribute/prop stored on `nodeId` under `key`, or `null` when unset.
166
+ * @param nodeId - the node to read
167
+ * @param key - the attribute name
168
+ * @returns the stored value, or `null`
169
+ * @throws {TypeError} when `nodeId` names no node
170
+ */
171
+ declare function getAttribute(nodeId: NodeId, key: string): AttributeValue | null;
172
+ /**
173
+ * Removes an attribute/prop from `nodeId`. Removing an attribute
174
+ * that isn't set does nothing.
175
+ * @param nodeId - the node to update
176
+ * @param key - the attribute name
177
+ */
178
+ declare function removeAttribute(nodeId: NodeId, key: string): void;
179
+ /**
180
+ * Sets a style property on `nodeId`. A key from {@link StyleProps} gets
181
+ * compile-time checking on its value's shape. Any other string key, such as a
182
+ * camelCase or kebab-case spelling or a property the types do not list,
183
+ * forwards as a raw {@link AttributeValue}.
184
+ *
185
+ * A key takes kebab-case (`flex-direction`) or camelCase (`flexDirection`).
186
+ * Both spellings share one slot per property, and the value set most recently
187
+ * applies.
188
+ * @param nodeId - the node to update
189
+ * @param key - the style property name
190
+ * @param value - the style property value
191
+ */
192
+ declare function setStyle<K extends keyof StyleProps>(nodeId: NodeId, key: K, value: NonNullable<StyleProps[K]>): void;
193
+ declare function setStyle(nodeId: NodeId, key: string, value: AttributeValue): void;
194
+ /**
195
+ * Removes a style property from `nodeId`, so it renders as if never set.
196
+ * Removing a property that isn't set does nothing. The key takes any spelling
197
+ * or CSS name {@link setStyle} accepts, and removes the property whichever
198
+ * one set it.
199
+ * @param nodeId - the node to update
200
+ * @param key - the style property name
201
+ */
202
+ declare function removeStyle(nodeId: NodeId, key: string): void;
203
+ /**
204
+ * Returns the box `nodeId` was drawn at in the last frame, in window logical
205
+ * pixels, or `null` if the node has no recorded box.
206
+ * @param nodeId - the node to read
207
+ * @returns `[x, y, width, height, border, scrollX, scrollY]`, or `null`. `border` is one uniform
208
+ * width on all sides. `scrollX` and `scrollY` are the positive scroll offset the parent applied
209
+ * to the box.
210
+ * @throws {TypeError} when `nodeId` names no node
211
+ */
212
+ declare function layoutOf(nodeId: NodeId): readonly [number, number, number, number, number, number, number] | null;
213
+ /**
214
+ * Returns the scroll offset of `nodeId` in window logical pixels. A write made
215
+ * since the last draw is included, clamped to the maximum of the last drawn
216
+ * frame.
217
+ * @param nodeId - the node to read
218
+ * @returns `[left, top, maxLeft, maxTop]`, or `null` for a node whose `overflow` is
219
+ * `visible` or `clip` on both axes. The maxima are the largest offsets the node can take, as
220
+ * of the last drawn frame.
221
+ * @throws {TypeError} when `nodeId` names no node
222
+ */
223
+ declare function scrollOf(nodeId: NodeId): readonly [number, number, number, number] | null;
224
+ /**
225
+ * Sets the scroll offset of `nodeId` on one or both axes. A `null` axis keeps
226
+ * its current offset. The host clamps each value to the scrollable range on
227
+ * the next frame. A node whose `overflow` is `visible` or `clip` on both axes ignores the call.
228
+ * @param nodeId - the node to scroll
229
+ * @param left - the horizontal offset, or `null` to keep it
230
+ * @param top - the vertical offset, or `null` to keep it
231
+ * @throws {TypeError} when `nodeId` names no node
232
+ */
233
+ declare function scrollNode(nodeId: NodeId, left: number | null, top: number | null): void;
234
+ /**
235
+ * Scrolls each scroll container around `nodeId` so the node shows.
236
+ * @param nodeId - the node to bring into view
237
+ * @param block - the vertical alignment: `"start"`, `"center"`, `"end"` or `"nearest"`
238
+ * @param inline - the horizontal alignment: `"start"`, `"center"`, `"end"` or `"nearest"`
239
+ * @throws {TypeError} when `nodeId` names no node
240
+ * @throws {TypeError} when `block` or `inline` is not an alignment name
241
+ */
242
+ declare function scrollIntoViewNode(nodeId: NodeId, block: ScrollAlignment, inline: ScrollAlignment): void;
243
+ /**
244
+ * Dispatches `event` at a target along its path. Dispatching at an element
245
+ * reaches its ancestors, `document` and `window`. Dispatching at `document`
246
+ * reaches `window`, and dispatching at `window` reaches only `window`.
247
+ * @param target - the target to dispatch at (node id or "$window")
248
+ * @param event - the event to dispatch
249
+ * @returns `false` when a listener canceled a cancelable event, else `true`
250
+ * @throws TypeError when `target` is malformed or is an unknown target tag
251
+ * @throws TypeError when `target` is a node id that names no node
252
+ * @throws TypeError when `event` is not an event built with an event constructor
253
+ * @throws DOMException named `InvalidStateError` when `event` is being dispatched
254
+ */
255
+ declare function dispatchEvent(target: EventTargetId, event: EventLike): boolean;
256
+ /**
257
+ * Fires an untrusted `click` at `nodeId`. A disabled `button` or `input` and a node whose
258
+ * own click is still running ignore the call.
259
+ * @param nodeId - the node to click
260
+ * @throws TypeError when `nodeId` is malformed
261
+ * @throws TypeError when `nodeId` names no node
262
+ */
263
+ declare function click(nodeId: NodeId): void;
264
+ /**
265
+ * Requests that `nodeId` become focused. Takes effect on the next frame,
266
+ * dispatching `"blur"`/`"focus"` for whatever actually changed. The node
267
+ * needs a `tabindex` attribute to take focus, and a listener for either event
268
+ * is optional. The scroll containers around the node scroll it into view.
269
+ * @param nodeId - the node to focus
270
+ * @param preventScroll - `true` to leave the scroll containers in place; omitted or `false` scrolls the node into view
271
+ * @throws TypeError when `nodeId` is malformed
272
+ * @throws TypeError when `nodeId` names no node
273
+ */
274
+ declare function focus(nodeId: NodeId, preventScroll?: boolean): void;
275
+ /**
276
+ * Requests that `nodeId` become unfocused, the way `element.blur()` does.
277
+ * Takes effect on the next frame; a no-op if `nodeId` isn't the focused node
278
+ * when it runs.
279
+ * @param nodeId - the node to unfocus
280
+ */
281
+ declare function blur(nodeId: NodeId): void;
282
+ /**
283
+ * Returns the id of the focused node.
284
+ * @returns the focused node's id, or `null` when no node has focus
285
+ */
286
+ declare function focusedNode(): NodeId | null;
287
+ /**
288
+ * Whether `node` left the tree for good, removed or freed. A removed node stays in the host and
289
+ * its members read real values. Its listeners are gone.
290
+ * @param node - the handle to check
291
+ * @returns `true` after {@link markRemoved} reached `node`, or when the host freed it
292
+ */
293
+ declare function isRemoved(node: IncaNode): boolean;
3
294
  /** The plain values of a {@link RectLike}, as `toJSON` returns them. */
4
295
  interface RectValues {
5
296
  readonly x: number;
@@ -96,7 +387,7 @@ interface NodeListOf<T extends IncaNode> {
96
387
  }
97
388
  /** An attribute of an element. It has no `Node` members. */
98
389
  interface Attr {
99
- /** The attribute name in lower case. */
390
+ /** The attribute name as the element keys it: lower case on an HTML element. */
100
391
  readonly name: string;
101
392
  /** The same as `name`. */
102
393
  readonly localName: string;
@@ -115,6 +406,35 @@ interface Attr {
115
406
  /** The element that holds the attribute, or `null` once the attribute is removed. */
116
407
  readonly ownerElement: IncaElement | null;
117
408
  }
409
+ /**
410
+ * The `data-*` attributes of an element as properties. The key `fooBar` names the attribute
411
+ * `data-foo-bar`. Reads give text and writes convert the value to text.
412
+ */
413
+ interface DOMStringMap {
414
+ [name: string]: string | undefined;
415
+ }
416
+ /** The live set of the tokens of the `class` attribute. It is read from `classList`. */
417
+ interface DOMTokenList {
418
+ /** The number of tokens. */
419
+ readonly length: number;
420
+ /** The attribute text. Assigning sets the attribute. */
421
+ value: string;
422
+ toString(): string;
423
+ /** Returns the token at `index`, or `null`. */
424
+ item(index: number): string | null;
425
+ contains(token: string): boolean;
426
+ add(...tokens: string[]): void;
427
+ remove(...tokens: string[]): void;
428
+ toggle(token: string, force?: boolean): boolean;
429
+ replace(token: string, newToken: string): boolean;
430
+ /** Throws a `TypeError`, because `class` defines no supported tokens. */
431
+ supports(token: string): boolean;
432
+ forEach(callback: (token: string, index: number, list: DOMTokenList) => void, thisArg?: unknown): void;
433
+ keys(): IteratorObject<number, undefined, unknown>;
434
+ values(): IteratorObject<string, undefined, unknown>;
435
+ entries(): IteratorObject<[number, string], undefined, unknown>;
436
+ [Symbol.iterator](): IteratorObject<string, undefined, unknown>;
437
+ }
118
438
  /** A live, read-only list of the attributes of an element in the order they were set. */
119
439
  interface NamedNodeMap {
120
440
  readonly [index: number]: Attr;
@@ -309,6 +629,127 @@ interface TextMembers {
309
629
  */
310
630
  splitText(offset: number): IncaText;
311
631
  }
632
+ /**
633
+ * The inline style of an element. Every style key and every CSS alias is a property in camelCase
634
+ * and in kebab-case, and the host-only style keys are properties too. Reading a property gives the
635
+ * declaration in its serialized form, or an empty string when the block has none.
636
+ * Assigning a property sets the declaration, and an empty string removes it. A value the host
637
+ * cannot read prints a warning and leaves the block as it was. The block of a freed element reads
638
+ * empty and ignores writes. It is not constructible, has no indexed access and is not iterable.
639
+ */
640
+ interface CSSStyleDeclaration {
641
+ /** The number of declarations. */
642
+ readonly length: number;
643
+ /**
644
+ * The declarations as `name: value;` text in the order they were set. Assigning replaces all
645
+ * declarations with the ones the text holds, and `null` assigns `""`.
646
+ */
647
+ cssText: string;
648
+ /**
649
+ * The serialized value of the declaration `property`, or an empty string when it is unset.
650
+ * @param property - The CSS name, such as `background-color`.
651
+ * @returns The value.
652
+ */
653
+ getPropertyValue(property: string): string;
654
+ /**
655
+ * Sets the declaration `property` to `value`, and removes it when `value` is `null` or `""`.
656
+ * A `priority` other than `""` and `"important"` leaves the block as it was.
657
+ * @param property - The CSS name.
658
+ * @param value - The value, converted to text.
659
+ * @param priority - The priority, which the host does not keep.
660
+ */
661
+ setProperty(property: string, value: string | null, priority?: string | null): void;
662
+ /**
663
+ * Removes the declaration `property`.
664
+ * @param property - The CSS name.
665
+ * @returns The value the declaration had, or an empty string when it was unset.
666
+ */
667
+ removeProperty(property: string): string;
668
+ /**
669
+ * The priority of the declaration `property`.
670
+ * @param property - The CSS name.
671
+ * @returns Always an empty string.
672
+ */
673
+ getPropertyPriority(property: string): string;
674
+ /**
675
+ * The CSS name of the declaration at `index`, in the order they were set.
676
+ * @param index - The position, converted to an unsigned 32-bit integer.
677
+ * @returns The name, or an empty string beyond the list.
678
+ */
679
+ item(index: number): string;
680
+ display: string;
681
+ "flex-direction": string;
682
+ flexDirection: string;
683
+ "justify-content": string;
684
+ justifyContent: string;
685
+ "align-items": string;
686
+ alignItems: string;
687
+ gap: string;
688
+ width: string;
689
+ height: string;
690
+ "border-width": string;
691
+ borderWidth: string;
692
+ background: string;
693
+ "background-color": string;
694
+ backgroundColor: string;
695
+ "border-color": string;
696
+ borderColor: string;
697
+ "corner-radius": string;
698
+ cornerRadius: string;
699
+ "border-radius": string;
700
+ borderRadius: string;
701
+ "text-color": string;
702
+ textColor: string;
703
+ color: string;
704
+ "text-size": string;
705
+ textSize: string;
706
+ "font-size": string;
707
+ fontSize: string;
708
+ overflow: string;
709
+ "overflow-x": string;
710
+ overflowX: string;
711
+ "overflow-y": string;
712
+ overflowY: string;
713
+ "flex-grow": string;
714
+ flexGrow: string;
715
+ "flex-shrink": string;
716
+ flexShrink: string;
717
+ opacity: string;
718
+ "min-width": string;
719
+ minWidth: string;
720
+ "min-height": string;
721
+ minHeight: string;
722
+ "max-width": string;
723
+ maxWidth: string;
724
+ "max-height": string;
725
+ maxHeight: string;
726
+ padding: string;
727
+ "padding-x": string;
728
+ paddingX: string;
729
+ "padding-y": string;
730
+ paddingY: string;
731
+ "padding-top": string;
732
+ paddingTop: string;
733
+ "padding-right": string;
734
+ paddingRight: string;
735
+ "padding-bottom": string;
736
+ paddingBottom: string;
737
+ "padding-left": string;
738
+ paddingLeft: string;
739
+ margin: string;
740
+ "margin-x": string;
741
+ marginX: string;
742
+ "margin-y": string;
743
+ marginY: string;
744
+ "margin-top": string;
745
+ marginTop: string;
746
+ "margin-right": string;
747
+ marginRight: string;
748
+ "margin-bottom": string;
749
+ marginBottom: string;
750
+ "margin-left": string;
751
+ marginLeft: string;
752
+ }
312
753
  /** The members that read and write the markup of an element. */
313
754
  interface HtmlMembers {
314
755
  /**
@@ -335,7 +776,7 @@ interface HtmlMembers {
335
776
  /**
336
777
  * A container node: either a real element or the hidden stand-in that
337
778
  * `createCommentNode` makes. It is the only node type that can act as a
338
- * parent. `parent` reads the node's current position in the tree.
779
+ * parent.
339
780
  *
340
781
  * A removed node keeps its attributes and its position in its own subtree, and its members read
341
782
  * them. Its listeners are dropped. `addEventListener()` and `removeEventListener()` ignore the
@@ -348,18 +789,33 @@ interface IncaElement extends IncaEventTarget, EventHandlers, NodeMembers, TextC
348
789
  * the attribute to the value as a string.
349
790
  */
350
791
  id: string;
792
+ /**
793
+ * The `class` attribute, or an empty string when it is unset. Assigning sets the attribute to the
794
+ * value as a string.
795
+ */
796
+ className: string;
797
+ /**
798
+ * The live token list of the `class` attribute. Every read returns the same list. Assigning a
799
+ * string sets the `value` of the list.
800
+ */
801
+ get classList(): DOMTokenList;
802
+ set classList(value: string);
351
803
  /**
352
804
  * `"comment"` for the hidden stand-in `createCommentNode` makes;
353
805
  * `"element"` for every other container.
354
806
  */
355
807
  readonly kind: "element" | "comment";
356
808
  /**
357
- * The tag of the element in ASCII upper case, such as `"BUTTON"`. The mount container reads
358
- * `"DIV"`.
809
+ * The qualified name of the element. An element of the HTML namespace reads in ASCII upper case,
810
+ * such as `"BUTTON"`, and the mount container reads `"DIV"`.
359
811
  */
360
812
  readonly tagName: string;
361
- /** The current parent element or fragment, or `null` if this node isn't attached to the tree. */
362
- parent: IncaParent | null;
813
+ /** The name of the element without its prefix. */
814
+ readonly localName: string;
815
+ /** The namespace of the element, or `null` for none. */
816
+ readonly namespaceURI: string | null;
817
+ /** The prefix of the element name, or `null` for none. */
818
+ readonly prefix: string | null;
363
819
  /**
364
820
  * The child elements in order, as a live collection. Every read returns the same object, which
365
821
  * follows later changes. A removed element lists the element children it kept.
@@ -453,6 +909,20 @@ interface IncaElement extends IncaEventTarget, EventHandlers, NodeMembers, TextC
453
909
  * changes. A key that equals the name of a set attribute reads its `Attr`.
454
910
  */
455
911
  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;
456
926
  /**
457
927
  * Whether this element matches the selector list. `:focus-visible` and the other interactive and
458
928
  * form-state pseudo-classes never match.
@@ -556,8 +1026,6 @@ interface IncaTemplateElement extends IncaElement {
556
1026
  interface IncaText extends NodeMembers, CharacterDataMembers, TextMembers {
557
1027
  /** Discriminates this node within the {@link IncaNode} union. */
558
1028
  readonly kind: "text";
559
- /** The current parent element or fragment, or `null` if this node isn't attached to the tree. */
560
- parent: IncaParent | null;
561
1029
  /**
562
1030
  * The text content, mirroring the value pushed to the native node.
563
1031
  */
@@ -570,38 +1038,20 @@ interface IncaText extends NodeMembers, CharacterDataMembers, TextMembers {
570
1038
  interface IncaFragment extends NodeMembers, TextContentMember {
571
1039
  /** Discriminates this node within the {@link IncaNode} union. */
572
1040
  readonly kind: "fragment";
573
- /** A fragment has no parent. */
574
- parent: null;
575
1041
  }
576
1042
  /** A node that can have children. */
577
1043
  type IncaParent = IncaElement | IncaFragment | IncaDocument;
578
- /** Any node the shadow tree holds: an element, comment, text leaf, fragment or the document. */
1044
+ /** Any node handle: an element, comment, text leaf, fragment or the document. */
579
1045
  type IncaNode = IncaElement | IncaText | IncaFragment | IncaDocument;
580
- /**
581
- * Stable handle to a node in the native retained tree, returned by `createNode`
582
- * and used in every later call that touches that node.
583
- */
584
- type NodeId = number;
585
- /**
586
- * Id assigned to one registered event listener. Managed internally by
587
- * `addEventListener`/`removeEventListener`/`releaseListeners`.
588
- */
589
- type CallbackId = number;
590
- /**
591
- * A value `setAttribute`/`setStyle` can take. Any other value raises a catchable
592
- * exception.
593
- */
594
- type AttributeValue = string | number | boolean;
595
1046
  /** Element kind passed to `createNode`. */
596
1047
  type TagName = string;
597
- /** Where `scrollIntoView` aligns a node on one axis. */
598
- type ScrollAlignment = "start" | "center" | "end" | "nearest";
599
1048
  /** One overflow value; `"auto"` is an alias of `"scroll"`. */
600
1049
  type Overflow = "visible" | "hidden" | "clip" | "scroll" | "auto";
601
1050
  /**
602
1051
  * A size in px: a number, `"0"` or a string such as `"10px"`. A string that reads as zero
603
1052
  * (`"0.0"`, `"-0"`) is also valid, and the unit is case-insensitive. The host warns on a space
604
- * before `px`, a trailing `.` and hexadecimal, binary and octal, which the type admits.
1053
+ * before `px`, a trailing `.`, a `.` before the exponent, hexadecimal, binary and octal, which the
1054
+ * type admits.
605
1055
  */
606
1056
  type Px = number | "0" | `${number}px`;
607
1057
  /**
@@ -673,19 +1123,22 @@ interface StyleProps {
673
1123
  marginLeft?: Px | "auto";
674
1124
  /**
675
1125
  * Share (`>= 0`) of the free space in the parent's main axis this node takes.
676
- * The host warns on a trailing `.`, hexadecimal, binary and octal, which the type admits.
1126
+ * The host warns on a trailing `.`, a `.` before the exponent, hexadecimal, binary and octal,
1127
+ * which the type admits.
677
1128
  */
678
1129
  flexGrow?: number | `${number}`;
679
1130
  /**
680
1131
  * Share (`>= 0`) of the overflow in the parent's main axis this node gives up.
681
- * The host warns on a trailing `.`, hexadecimal, binary and octal, which the type admits.
1132
+ * The host warns on a trailing `.`, a `.` before the exponent, hexadecimal, binary and octal,
1133
+ * which the type admits.
682
1134
  */
683
1135
  flexShrink?: number | `${number}`;
684
1136
  /**
685
- * Opacity from `0` to `1`, applied to this node and its descendants; values outside are clamped.
686
- * The host warns on a trailing `.`, hexadecimal, binary and octal, which the type admits.
1137
+ * Opacity from `0` to `1`, or a percentage from `0%` to `100%`, applied to this node and its
1138
+ * descendants; values outside are clamped. The host warns on a trailing `.`, a `.` before the
1139
+ * exponent, hexadecimal, binary and octal, which the type admits.
687
1140
  */
688
- opacity?: number | `${number}`;
1141
+ opacity?: number | `${number}` | `${number}%`;
689
1142
  /** Minimum width in px (`>= 0`), or `"auto"` for the default minimum. */
690
1143
  minWidth?: Px | "auto";
691
1144
  /** Minimum height in px (`>= 0`), or `"auto"` for the default minimum. */
@@ -757,16 +1210,14 @@ interface IncaEventTarget {
757
1210
  * The top node of the tree, the parent of the mount container. It holds at most one element and
758
1211
  * any number of comments, and no text.
759
1212
  */
760
- interface IncaDocument extends IncaEventTarget, EventHandlers<IncaDocument>, Omit<NodeMembers, "cloneNode"> {
761
- /** Discriminates this node within the {@link IncaNode} union. */
1213
+ interface IncaDocument extends IncaEventTarget, EventHandlers<IncaDocument>, NodeMembers {
1214
+ /** Discriminates this node within the `IncaNode` union. */
762
1215
  readonly kind: "document";
763
- /** The document has no parent. */
764
- parent: null;
765
1216
  /** Always `null`. An assignment does nothing. */
766
1217
  textContent: string | null;
767
1218
  /**
768
- * The element that has focus, or `null` when no element has focus. A `focus()` or `blur()` call
769
- * takes effect for this property at once.
1219
+ * The element that has focus, or else the element of the document, or `null` when it has none.
1220
+ * A `focus()` or `blur()` call takes effect for this property at once.
770
1221
  */
771
1222
  readonly activeElement: IncaElement | null;
772
1223
  /**
@@ -783,6 +1234,19 @@ interface IncaDocument extends IncaEventTarget, EventHandlers<IncaDocument>, Omi
783
1234
  * @throws DOMException named `InvalidCharacterError` when `localName` is not a valid element name
784
1235
  */
785
1236
  createElement(localName: string): IncaElement;
1237
+ /**
1238
+ * Creates an element with a namespace. The namespace converts to a string, and `null`,
1239
+ * `undefined` and `""` mean no namespace. The name converts to a string and splits at its first
1240
+ * colon into a prefix and a local name. The element keeps the case of the name.
1241
+ * @param namespace - The namespace, such as `"http://www.w3.org/2000/svg"`.
1242
+ * @param qualifiedName - The element name, such as `"svg"` or `"x:item"`.
1243
+ * @returns The new element, which has no parent.
1244
+ * @throws TypeError when called with fewer than two arguments
1245
+ * @throws DOMException named `InvalidCharacterError` when the prefix or the local name is not a
1246
+ * valid element name
1247
+ * @throws DOMException named `NamespaceError` when the prefix and the namespace do not fit
1248
+ */
1249
+ createElementNS(namespace: string | null, qualifiedName: string): IncaElement;
786
1250
  /**
787
1251
  * Creates a text node.
788
1252
  * @param data - The text. It converts to a string.
@@ -1126,15 +1590,11 @@ interface EventListenerObject<E = IncaEvent> {
1126
1590
  */
1127
1591
  type EventListenerOrObject<E = IncaEvent, T = IncaEventTarget> = EventListener<E, T> | EventListenerObject<E>;
1128
1592
  /**
1129
- * The event target at the top of the app, after `document`. Every event path
1130
- * ends at it. Bubble listeners on it run for every bubbling event, and capture
1131
- * listeners run for every event dispatched in the app, including events that
1132
- * do not bubble. A key event reaches it through the mount container and
1133
- * `document`. A `wheel` listener is passive unless its options say
1593
+ * The event target at the top of the app, after `document`. Every event path ends at it. Bubble
1594
+ * listeners on it run for every bubbling event, and capture listeners run for every event
1595
+ * dispatched in the app, including events that do not bubble. A key event reaches it through the
1596
+ * mount container and `document`. A `wheel` listener is passive unless its options say
1134
1597
  * `passive: false`.
1135
- *
1136
- * It has the listener methods `addEventListener`, `removeEventListener` and
1137
- * `dispatchEvent`, and the event handler properties such as `onkeydown`.
1138
1598
  */
1139
1599
  declare const window: IncaWindow;
1140
- export { EventHandler as A, IncaText as B, Overflow as C, TagName as D, StyleProps as E, IncaFragment as F, TextMembers as G, NodeListOf as H, IncaInputElement as I, RectLike as J, ScrollIntoViewOptions as K, IncaNode as L, HTMLCollectionOf as M, HtmlMembers as N, Attr as O, IncaElement as P, IncaParent as R, NodeId as S, ScrollAlignment as T, NodeMembers as U, NamedNodeMap as V, TextContentMember as W, RectValues as Y, IncaPointerEvent as _, EventListener as a, IncaWindow as b, IncaCompositionEvent as c, IncaEventMap as d, IncaEventTarget as f, IncaMouseEvent as g, IncaKeyboardEvent as h, EventLike as i, EventHandlers as j, CharacterDataMembers as k, IncaDocument as l, IncaInputEvent as m, AttributeValue as n, EventListenerObject as o, IncaFocusEvent as p, ScrollOptions as q, CallbackId as r, EventListenerOrObject as s, window as t, IncaEvent as u, IncaUIEvent as v, Px as w, ListenerOptions as x, IncaWheelEvent as y, IncaTemplateElement as z };
1600
+ export { focus as $, EventHandlers as A, NamedNodeMap as B, TagName as C, DOMStringMap as D, CharacterDataMembers as E, IncaInputElement as F, ScrollIntoViewOptions as G, NodeMembers as H, IncaNode as I, RectValues as J, ScrollOptions as K, IncaParent as L, HtmlMembers as M, IncaElement as N, DOMTokenList as O, IncaFragment as P, dispatchEvent as Q, IncaTemplateElement as R, StyleProps as S, CSSStyleDeclaration as T, TextContentMember as U, NodeListOf as V, TextMembers as W, blur as X, isRemoved as Y, click as Z, IncaWheelEvent as _, EventTargetId as _t, EventListenerOrObject as a, getAttribute as at, Overflow as b, IncaEvent as c, setAttribute as ct, IncaFocusEvent as d, holdNode as dt, focusedNode as et, IncaInputEvent as f, releaseNode as ft, IncaUIEvent as g, ElementName as gt, IncaPointerEvent as h, CallbackId as ht, EventListenerObject as i, scrollOf as it, HTMLCollectionOf as j, EventHandler as k, IncaEventMap as l, setStyle as lt, IncaMouseEvent as m, AttributeValue as mt, EventLike as n, scrollIntoViewNode as nt, IncaCompositionEvent as o, removeAttribute as ot, IncaKeyboardEvent as p, rootNodeId as pt, RectLike as q, EventListener as r, scrollNode as rt, IncaDocument as s, removeStyle as st, window as t, layoutOf as tt, IncaEventTarget as u, createNode as ut, IncaWindow as v, NodeId as vt, Attr as w, Px as x, ListenerOptions as y, ScrollAlignment as yt, IncaText as z };