incajs 0.0.22 → 0.0.24

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.
Files changed (38) hide show
  1. package/dist/chunks/hooks-DK2feJxZ.js +1 -0
  2. package/dist/chunks/rendererCore-Ezb4FOC9.js +1 -0
  3. package/dist/chunks/rendererCore-qq38UzW-.d.ts +388 -0
  4. package/dist/chunks/rolldown-runtime-DK3Fl9T5.js +1 -0
  5. package/dist/chunks/window-BtaK1Znc.d.ts +703 -0
  6. package/dist/index.d.ts +12 -0
  7. package/dist/index.js +1 -1
  8. package/dist/rendererCore.d.ts +3 -0
  9. package/dist/rendererCore.js +1 -3
  10. package/dist/vue-runtime.d.ts +3 -0
  11. package/dist/vue-runtime.js +1 -2
  12. package/dist/{vue/createApp.d.mts → vue.d.ts} +6 -4
  13. package/dist/vue.js +2 -178
  14. package/package.json +16 -17
  15. package/dist/callbacks.d.mts +0 -31
  16. package/dist/chunks/hooks-TbLjfN0c.js +0 -417
  17. package/dist/chunks/rendererCore-BUNTDvYu.js +0 -110
  18. package/dist/document.d.mts +0 -11
  19. package/dist/element/eventHandlers.d.mts +0 -12
  20. package/dist/element/geometry.d.mts +0 -61
  21. package/dist/element/handle.d.mts +0 -29
  22. package/dist/element/lifecycle.d.mts +0 -51
  23. package/dist/element/scroll.d.mts +0 -42
  24. package/dist/element/shadowTree.d.mts +0 -64
  25. package/dist/element/types.d.mts +0 -149
  26. package/dist/eventTarget.d.mts +0 -11
  27. package/dist/events.d.mts +0 -105
  28. package/dist/index.d.mts +0 -6
  29. package/dist/native.d.mts +0 -46
  30. package/dist/rendererCore.d.mts +0 -14
  31. package/dist/targets.d.mts +0 -1
  32. package/dist/tree.d.mts +0 -157
  33. package/dist/types.d.mts +0 -454
  34. package/dist/vue/index.d.mts +0 -2
  35. package/dist/vue/nodeOps.d.mts +0 -29
  36. package/dist/vue/patchProp.d.mts +0 -79
  37. package/dist/vue/runtime.d.mts +0 -2
  38. package/dist/window.d.mts +0 -13
@@ -0,0 +1,703 @@
1
+ declare global {
2
+ function setTimeout<A extends unknown[]>(handler: (...args: A) => void, delay?: number, ...args: A): number;
3
+ function setInterval<A extends unknown[]>(handler: (...args: A) => void, delay?: number, ...args: A): number;
4
+ function clearTimeout(id?: number): void;
5
+ function clearInterval(id?: number): void;
6
+ }
7
+ /** The events whose handler property every element has. */
8
+ declare const HANDLER_EVENTS: readonly ["auxclick", "beforeinput", "blur", "change", "click", "contextmenu", "dblclick", "focus", "gotpointercapture", "input", "keydown", "keyup", "lostpointercapture", "mousedown", "mouseenter", "mouseleave", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointerenter", "pointerleave", "pointermove", "pointerout", "pointerover", "pointerup", "scroll", "wheel"];
9
+ /** The plain values of a {@link RectLike}, as `toJSON` returns them. */
10
+ interface RectValues {
11
+ readonly x: number;
12
+ readonly y: number;
13
+ readonly width: number;
14
+ readonly height: number;
15
+ readonly top: number;
16
+ readonly left: number;
17
+ readonly right: number;
18
+ readonly bottom: number;
19
+ }
20
+ /**
21
+ * A rectangle with its position, its size and its four edges. `toJSON()` returns
22
+ * the plain values.
23
+ */
24
+ interface RectLike extends RectValues {
25
+ toJSON(): RectValues;
26
+ }
27
+ /** The options form of `scrollTo()` and `scrollBy()`. `behavior` is accepted and ignored. */
28
+ interface ScrollOptions {
29
+ /** The horizontal offset. Omit to keep the current one. */
30
+ left?: number;
31
+ /** The vertical offset. Omit to keep the current one. */
32
+ top?: number;
33
+ /** `behavior` is ignored; every scroll applies at once. */
34
+ behavior?: "auto" | "instant" | "smooth";
35
+ }
36
+ /** The options form of `scrollIntoView()`. `behavior` is accepted and ignored. */
37
+ interface ScrollIntoViewOptions {
38
+ /** The vertical alignment. Defaults to `"start"`. */
39
+ block?: ScrollAlignment;
40
+ /** The horizontal alignment. Defaults to `"nearest"`. */
41
+ inline?: ScrollAlignment;
42
+ /** `behavior` is ignored; every scroll applies at once. */
43
+ behavior?: "auto" | "instant" | "smooth";
44
+ }
45
+ /** A function an event handler property holds, called with its target as `this` and the event. */
46
+ type EventHandler<E = IncaEvent, T = IncaElement> = (this: T, event: E) => unknown;
47
+ /**
48
+ * The event handler properties, such as `onclick`, of the events the host dispatches, `focusin` and
49
+ * `focusout` excepted.
50
+ */
51
+ type EventHandlers<T = IncaElement> = { [K in (typeof HANDLER_EVENTS)[number] as `on${K}`]: EventHandler<IncaEventMap[K], T> | object | null; };
52
+ /**
53
+ * A container node: either a real element or the hidden stand-in that
54
+ * `createCommentNode` makes. It is the only node type that can act as a
55
+ * parent. `parent` and `children` read the node's current position in the
56
+ * tree.
57
+ *
58
+ * After the node is removed, `addEventListener()` and `removeEventListener()`
59
+ * ignore the call, an assignment to a handler property does nothing, and
60
+ * `dispatchEvent()` returns `true`.
61
+ */
62
+ interface IncaElement extends IncaEventTarget, EventHandlers {
63
+ /**
64
+ * The `id` attribute, or an empty string when it is unset. Assigning sets
65
+ * the attribute to the value as a string. After the node is removed,
66
+ * reading gives an empty string and assigning does nothing.
67
+ */
68
+ id: string;
69
+ /**
70
+ * `"comment"` for the hidden stand-in `createCommentNode` makes;
71
+ * `"element"` for every other container.
72
+ */
73
+ readonly kind: "element" | "comment";
74
+ /** The current parent, or `null` if this node isn't attached to the tree. */
75
+ parent: IncaElement | null;
76
+ /** This node's children, in render order. */
77
+ children: IncaNode[];
78
+ /**
79
+ * Focuses this node next frame. The node needs a `tabindex` attribute. A
80
+ * `true` `preventScroll` keeps every scroll container where it is. After
81
+ * the node is removed, the call does nothing.
82
+ */
83
+ focus(options?: {
84
+ preventScroll?: boolean;
85
+ }): void;
86
+ /** Unfocuses this node next frame, if it is the focused one. */
87
+ blur(): void;
88
+ /**
89
+ * Fires an untrusted `click` at this node. A disabled `button` or `input` and a node
90
+ * whose own click is still running ignore the call. After the node is removed, the call
91
+ * does nothing.
92
+ */
93
+ click(): void;
94
+ /**
95
+ * Captures the mouse pointer for this node while a button is held. Only `pointerId` 1 exists.
96
+ * @throws DOMException named `NotFoundError` for another `pointerId`
97
+ * @throws DOMException named `InvalidStateError` when the node is outside the mounted tree,
98
+ * also after it is removed
99
+ */
100
+ setPointerCapture(pointerId: number): void;
101
+ /**
102
+ * Releases the capture this node requested. Does nothing when the node holds none.
103
+ * @throws DOMException named `NotFoundError` for a `pointerId` other than 1
104
+ */
105
+ releasePointerCapture(pointerId: number): void;
106
+ /**
107
+ * Whether this node requested the capture and has not released it. `false` after the node is
108
+ * removed.
109
+ */
110
+ hasPointerCapture(pointerId: number): boolean;
111
+ /**
112
+ * Whether `other` is this node or one of its descendants in the tree as
113
+ * rendered. `null` and `undefined` give `false`, and any other value that is
114
+ * not a node throws a `TypeError`. After the node is removed, it still answers
115
+ * for the subtree it keeps.
116
+ */
117
+ contains(other: IncaNode | null): boolean;
118
+ /**
119
+ * Assigning sets the `tabindex` attribute to the value's integer part,
120
+ * wrapped to 32 bits. Reading returns the `tabindex` attribute as an
121
+ * integer, or `-1` (`0` for a `button` or an `input`) when it is unset or invalid.
122
+ * After the node is removed, reading gives that default and assigning does
123
+ * nothing.
124
+ */
125
+ tabIndex: number;
126
+ /**
127
+ * The box this node was drawn at in the last frame, in window logical
128
+ * pixels. A node created in the same task reads all zeros.
129
+ */
130
+ getBoundingClientRect(): RectLike;
131
+ /** The box width from the last frame, rounded. `0` until a frame draws the node. */
132
+ readonly offsetWidth: number;
133
+ /** The box height from the last frame, rounded. `0` until a frame draws the node. */
134
+ readonly offsetHeight: number;
135
+ /** The box's left edge from the last frame, relative to {@link offsetParent}. Stays fixed while the parent scrolls. */
136
+ readonly offsetLeft: number;
137
+ /** The box's top edge from the last frame, relative to {@link offsetParent}. Stays fixed while the parent scrolls. */
138
+ readonly offsetTop: number;
139
+ /**
140
+ * The parent, when this node and the parent both have a box from the last frame.
141
+ * `null` when either lacks a box or there is no parent.
142
+ */
143
+ readonly offsetParent: IncaElement | null;
144
+ /** The box width less both borders, rounded, at least `0`. */
145
+ readonly clientWidth: number;
146
+ /** The box height less both borders, rounded, at least `0`. */
147
+ readonly clientHeight: number;
148
+ /** The border width, rounded. */
149
+ readonly clientLeft: number;
150
+ /** The border width, rounded. */
151
+ readonly clientTop: number;
152
+ /** The horizontal scroll offset. Assigning moves it at once, and reads are clamped to the last frame's maximum. */
153
+ scrollLeft: number;
154
+ /** The vertical scroll offset. Assigning moves it at once, and reads are clamped to the last frame's maximum. */
155
+ scrollTop: number;
156
+ /** The content width: {@link clientWidth} plus the largest horizontal offset. */
157
+ readonly scrollWidth: number;
158
+ /** The content height: {@link clientHeight} plus the largest vertical offset. */
159
+ readonly scrollHeight: number;
160
+ /** Sets the offset to `(left, top)`, or to the options object's `left` and `top`. */
161
+ scrollTo(left?: number, top?: number): void;
162
+ scrollTo(options: ScrollOptions): void;
163
+ /** Adds `(left, top)` to the offset, or the options object's `left` and `top`. */
164
+ scrollBy(left?: number, top?: number): void;
165
+ scrollBy(options: ScrollOptions): void;
166
+ /**
167
+ * Scrolls each scroll container around this node so the node shows. `true`
168
+ * or no argument aligns to the start and `false` to the end. An options
169
+ * object sets `block` (default `"start"`) and `inline` (default `"nearest"`);
170
+ * `behavior` is accepted and ignored. After the node is removed, the call
171
+ * does nothing.
172
+ */
173
+ scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;
174
+ /**
175
+ * The `document` export while the node hangs under the mount container,
176
+ * else the topmost node of its subtree, the node itself without a parent.
177
+ */
178
+ getRootNode(): IncaElement | IncaDocument;
179
+ }
180
+ /** The handle of an `<input>`. */
181
+ interface IncaInputElement extends IncaElement {
182
+ /**
183
+ * The text of the input. Assigning sets the value as a string, and `null` as `""`; line breaks
184
+ * are dropped and a changed text puts the caret at its end. After the node is removed, reading
185
+ * gives `""` and assigning does nothing.
186
+ */
187
+ value: string;
188
+ }
189
+ /** A text leaf node. */
190
+ interface IncaText {
191
+ /** Discriminates this node within the {@link IncaNode} union. */
192
+ readonly kind: "text";
193
+ /** The current parent, or `null` if this node isn't attached to the tree. */
194
+ parent: IncaElement | null;
195
+ /**
196
+ * The text content, mirroring the value pushed to the native node.
197
+ */
198
+ text: string;
199
+ }
200
+ /** Any node the shadow tree holds: an element, comment, or text leaf. */
201
+ type IncaNode = IncaElement | IncaText;
202
+ /**
203
+ * Stable handle to a node in the native retained tree, returned by `createNode`
204
+ * and used in every later call that touches that node.
205
+ */
206
+ type NodeId = number;
207
+ /**
208
+ * Id assigned to one registered event listener. Managed internally by
209
+ * `addEventListener`/`removeEventListener`/`destroyNode`.
210
+ */
211
+ type CallbackId = number;
212
+ /**
213
+ * A value `setAttribute`/`setStyle` can take. Any other value raises a catchable
214
+ * exception.
215
+ */
216
+ type AttributeValue = string | number | boolean;
217
+ /**
218
+ * Element kind passed to `createNode`. `"text"` is the only tag with
219
+ * dedicated rendering behavior: it renders its `"value"` attribute followed
220
+ * by its descendants' text. Any other string is a generic styled
221
+ * container; the `string & {}` half of this type keeps `"text"`'s
222
+ * autocomplete while still accepting an arbitrary tag name.
223
+ */
224
+ type TagName = "text" | (string & {});
225
+ /** Where `scrollIntoView` aligns a node on one axis. */
226
+ type ScrollAlignment = "start" | "center" | "end" | "nearest";
227
+ /** One overflow value; `"auto"` is an alias of `"scroll"`. */
228
+ type Overflow = "visible" | "hidden" | "clip" | "scroll" | "auto";
229
+ /**
230
+ * A size in px: a number, `"0"` or a string such as `"10px"`. A string that reads as zero
231
+ * (`"0.0"`, `"-0"`) is also valid, and the unit is case-insensitive. The host warns on a space
232
+ * before `px`, a trailing `.` and hexadecimal, binary and octal, which the type admits.
233
+ */
234
+ type Px = number | "0" | `${number}px`;
235
+ /**
236
+ * Style properties that `setStyle`'s typed overload checks. A deliberately
237
+ * incomplete, v1 layout/paint vocabulary, written with the CSS property names.
238
+ * An unrecognized key or a value shape that doesn't parse (e.g. a malformed
239
+ * enum string) is ignored by the renderer, and the host prints a warning line
240
+ * on stderr for it (an empty string `''` prints none).
241
+ */
242
+ interface StyleProps {
243
+ /** Layout mode for this node's children. `"none"` skips both layout and rendering for the whole subtree. */
244
+ display?: "flex" | "block" | "grid" | "none";
245
+ /** Main-axis direction for a `"flex"` container. */
246
+ flexDirection?: "row" | "column" | "row-reverse" | "column-reverse";
247
+ /** Main-axis alignment of children within this container. */
248
+ justifyContent?: "start" | "end" | "flex-start" | "flex-end" | "center" | "stretch";
249
+ /** Cross-axis alignment of children within this container. */
250
+ alignItems?: "start" | "end" | "flex-start" | "flex-end" | "center" | "stretch";
251
+ /** Uniform spacing, in px (`>= 0`), between children, applied on both axes. */
252
+ gap?: Px;
253
+ /** Fixed width in px (`>= 0`), or `"auto"` to size to content. */
254
+ width?: Px | "auto";
255
+ /** Fixed height in px (`>= 0`), or `"auto"` to size to content. */
256
+ height?: Px | "auto";
257
+ /** Uniform border width in px (`>= 0`), applied to all four sides. */
258
+ borderWidth?: Px;
259
+ /** Fill color, as a hex number (`0xRRGGBB`) or a CSS-style string (`"#rrggbb"`/`"#rgb"`). */
260
+ backgroundColor?: number | string;
261
+ /** Border color. Accepts the same formats as {@link StyleProps.backgroundColor}. */
262
+ borderColor?: number | string;
263
+ /** Color for this container's own text. Cascades to descendant text leaves, same as {@link StyleProps.fontSize}; there's no separate per-leaf text styling. */
264
+ color?: number | string;
265
+ /** Uniform corner radius in px (`>= 0`), applied to all four corners. */
266
+ borderRadius?: Px;
267
+ /** Font size in px (`>= 0`) for this container's own text. Cascades to descendant text leaves, same as {@link StyleProps.color}. */
268
+ fontSize?: Px;
269
+ /** Overflow on both axes, or `"<x> <y>"` per axis; `"scroll"` (alias `"auto"`) makes the container scroll with the wheel. Overridden per axis by {@link StyleProps.overflowX}/{@link StyleProps.overflowY}. */
270
+ overflow?: Overflow | `${Overflow} ${Overflow}`;
271
+ /** Horizontal overflow; wins over {@link StyleProps.overflow}. */
272
+ overflowX?: Overflow;
273
+ /** Vertical overflow; wins over {@link StyleProps.overflow}. */
274
+ overflowY?: Overflow;
275
+ /** Inner spacing in px (`>= 0`) on all four sides. Overridden per side by the `padding*` side keys. */
276
+ padding?: Px;
277
+ /** Top inner spacing in px (`>= 0`); wins over {@link StyleProps.padding}. */
278
+ paddingTop?: Px;
279
+ /** Right inner spacing in px (`>= 0`); wins over {@link StyleProps.padding}. */
280
+ paddingRight?: Px;
281
+ /** Bottom inner spacing in px (`>= 0`); wins over {@link StyleProps.padding}. */
282
+ paddingBottom?: Px;
283
+ /** Left inner spacing in px (`>= 0`); wins over {@link StyleProps.padding}. */
284
+ paddingLeft?: Px;
285
+ /** Outer spacing in px (negative allowed) or `"auto"` on all four sides. Overridden per side by the `margin*` side keys. */
286
+ margin?: Px | "auto";
287
+ /** Top outer spacing; wins over {@link StyleProps.margin}. */
288
+ marginTop?: Px | "auto";
289
+ /** Right outer spacing; wins over {@link StyleProps.margin}. */
290
+ marginRight?: Px | "auto";
291
+ /** Bottom outer spacing; wins over {@link StyleProps.margin}. */
292
+ marginBottom?: Px | "auto";
293
+ /** Left outer spacing; wins over {@link StyleProps.margin}. */
294
+ marginLeft?: Px | "auto";
295
+ /**
296
+ * Share (`>= 0`) of the free space in the parent's main axis this node takes.
297
+ * The host warns on a trailing `.`, hexadecimal, binary and octal, which the type admits.
298
+ */
299
+ flexGrow?: number | `${number}`;
300
+ /**
301
+ * Share (`>= 0`) of the overflow in the parent's main axis this node gives up.
302
+ * The host warns on a trailing `.`, hexadecimal, binary and octal, which the type admits.
303
+ */
304
+ flexShrink?: number | `${number}`;
305
+ /**
306
+ * Opacity from `0` to `1`, applied to this node and its descendants; values outside are clamped.
307
+ * The host warns on a trailing `.`, hexadecimal, binary and octal, which the type admits.
308
+ */
309
+ opacity?: number | `${number}`;
310
+ /** Minimum width in px (`>= 0`), or `"auto"` for the default minimum. */
311
+ minWidth?: Px | "auto";
312
+ /** Minimum height in px (`>= 0`), or `"auto"` for the default minimum. */
313
+ minHeight?: Px | "auto";
314
+ /** Maximum width in px (`>= 0`), or `"auto"` for no limit. */
315
+ maxWidth?: Px | "auto";
316
+ /** Maximum height in px (`>= 0`), or `"auto"` for no limit. */
317
+ maxHeight?: Px | "auto";
318
+ }
319
+ /**
320
+ * An event built in this runtime with `Event`, `CustomEvent` or another
321
+ * event constructor. The host throws a `TypeError` for any other value.
322
+ */
323
+ interface EventLike {
324
+ readonly type: string;
325
+ }
326
+ /**
327
+ * How a listener registered via `addEventListener` takes part in an event.
328
+ */
329
+ interface ListenerOptions {
330
+ /**
331
+ * Listen while the event travels from `window` down to the target. The default listens while it
332
+ * travels back up.
333
+ */
334
+ capture?: boolean;
335
+ /** `preventDefault()` calls inside the listener are ignored. */
336
+ passive?: boolean;
337
+ /** The listener is removed before it first runs. */
338
+ once?: boolean;
339
+ }
340
+ /**
341
+ * The listener methods of an object that receives events, such as the
342
+ * `window` and `document` exports and a template `ref`. A registration is identified by the
343
+ * event name, the listener and `capture`. `removeEventListener` takes the
344
+ * same listener that `addEventListener` received.
345
+ */
346
+ interface IncaEventTarget {
347
+ /**
348
+ * Registers `listener` for `type`. Registering the same listener for the
349
+ * same `type` and `capture` again changes nothing. A `null` listener is
350
+ * ignored.
351
+ * @param type - the event name (e.g. `"keydown"`)
352
+ * @param listener - a function, called with the event's `currentTarget` as
353
+ * `this`, or an object whose `handleEvent` method is called with the object
354
+ * as `this` when the event fires
355
+ * @param options - a {@link ListenerOptions}, or a boolean for `capture`
356
+ */
357
+ addEventListener<K extends keyof IncaEventMap>(type: K, listener: EventListenerOrObject<IncaEventMap[K], this> | null, options?: boolean | ListenerOptions): void;
358
+ addEventListener<E = IncaEvent>(type: string, listener: EventListenerOrObject<E, this> | null, options?: boolean | ListenerOptions): void;
359
+ /**
360
+ * Drops the registration of `listener` for `type` with the same `capture`.
361
+ * A call that matches no registration changes nothing.
362
+ * @param type - the event name
363
+ * @param listener - the listener that was registered
364
+ * @param options - an object with `capture`, or a boolean for `capture`
365
+ */
366
+ removeEventListener<K extends keyof IncaEventMap>(type: K, listener: EventListenerOrObject<IncaEventMap[K], this> | null, options?: boolean | Pick<ListenerOptions, "capture">): void;
367
+ removeEventListener<E = IncaEvent>(type: string, listener: EventListenerOrObject<E, this> | null, options?: boolean | Pick<ListenerOptions, "capture">): void;
368
+ /**
369
+ * Dispatches an event built with an event constructor at the target.
370
+ * @param event - the event to dispatch
371
+ * @returns `false` when a listener canceled a cancelable event, else `true`
372
+ * @throws TypeError when `event` is not an event built with an event constructor
373
+ * @throws DOMException named `InvalidStateError` when `event` is being dispatched
374
+ */
375
+ dispatchEvent(event: EventLike): boolean;
376
+ }
377
+ /**
378
+ * The event target between the elements and `window`.
379
+ */
380
+ interface IncaDocument extends IncaEventTarget, EventHandlers<IncaDocument> {
381
+ /** The element that has focus, or `null` when no element has focus. */
382
+ readonly activeElement: IncaElement | null;
383
+ }
384
+ /**
385
+ * The event target at the top of every event path.
386
+ */
387
+ interface IncaWindow extends IncaEventTarget, EventHandlers<IncaWindow> {}
388
+ /**
389
+ * The fields every event carries. {@link IncaEventMap} gives the event type of
390
+ * each name the host dispatches, and a listener for any other name receives
391
+ * this type.
392
+ *
393
+ * See https://incajs.tom96da.com/reference/events for the event names the
394
+ * host dispatches and their fields.
395
+ */
396
+ interface IncaEvent {
397
+ /** The event's name. */
398
+ readonly type: string;
399
+ /** `0`, the {@link IncaEvent.eventPhase} outside a dispatch. */
400
+ readonly NONE: 0;
401
+ /** `1`, the {@link IncaEvent.eventPhase} on an ancestor while the event travels down. */
402
+ readonly CAPTURING_PHASE: 1;
403
+ /** `2`, the {@link IncaEvent.eventPhase} on the target. */
404
+ readonly AT_TARGET: 2;
405
+ /** `3`, the {@link IncaEvent.eventPhase} on an ancestor while the event travels up. */
406
+ readonly BUBBLING_PHASE: 3;
407
+ /**
408
+ * The element the event is about. It is the deepest element under the pointer for pointer
409
+ * events (the capturing element while the pointer is captured), the nearest common ancestor of
410
+ * the press and the release for `click`, `dblclick` and `auxclick`, and the focused element for
411
+ * key events. With no such element it is the mount container's element. A script dispatch at
412
+ * `document` or `window` gives that object.
413
+ */
414
+ readonly target: IncaEventTarget;
415
+ /** The same object as {@link IncaEvent.target}. */
416
+ readonly srcElement: IncaEventTarget;
417
+ /**
418
+ * The element, `document` or `window` whose listener is running, and `null` once the
419
+ * event has been handled. A listener function runs with it as `this`.
420
+ */
421
+ readonly currentTarget: IncaEventTarget | null;
422
+ /**
423
+ * Whether the event travels up from `target`. Fixed per event name for the
424
+ * events the host dispatches.
425
+ */
426
+ readonly bubbles: boolean;
427
+ /**
428
+ * Whether `preventDefault()` can cancel the event. Fixed per event name for
429
+ * the events the host dispatches.
430
+ */
431
+ readonly cancelable: boolean;
432
+ /** Fixed per event name for the events the host dispatches. */
433
+ readonly composed: boolean;
434
+ /**
435
+ * 1 on the ancestors of `target` while the event travels down, 2 where
436
+ * `currentTarget` is `target`, 3 on the ancestors while it travels up, and 0
437
+ * once the event has been handled.
438
+ */
439
+ readonly eventPhase: 0 | 1 | 2 | 3;
440
+ /** `true` once a listener called `preventDefault()` on a cancelable event. */
441
+ readonly defaultPrevented: boolean;
442
+ /** `true` for events the host dispatches and `false` for events a script dispatches. */
443
+ readonly isTrusted: boolean;
444
+ /** Milliseconds since the host started. */
445
+ readonly timeStamp: number;
446
+ /** A number that grows with each event and is the same on every node that event reaches. */
447
+ readonly eventId: number;
448
+ /** Assigning `true` while the event is dispatched stops it like `stopPropagation()`. */
449
+ cancelBubble: boolean;
450
+ /** The opposite of `defaultPrevented`. Assigning `false` cancels a cancelable event like `preventDefault()`. */
451
+ returnValue: boolean;
452
+ /** Stops the event from reaching the listeners of later nodes on its path. */
453
+ stopPropagation(): void;
454
+ /** Stops the event from reaching any later listener. */
455
+ stopImmediatePropagation(): void;
456
+ /** Cancels the event when it is cancelable and the listener is not passive. */
457
+ preventDefault(): void;
458
+ /**
459
+ * `target` and its ancestors, then `document` and `window`, and an empty
460
+ * array once the event has been handled.
461
+ */
462
+ composedPath(): IncaEventTarget[];
463
+ /**
464
+ * Sets the type, `bubbles` and `cancelable` of an event that is not being
465
+ * dispatched, clears its stop and cancel flags and makes it untrusted. While
466
+ * the event is dispatched it does nothing.
467
+ */
468
+ initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void;
469
+ }
470
+ /**
471
+ * The event object of a mouse, wheel, keyboard, focus, input or composition event.
472
+ */
473
+ interface IncaUIEvent extends IncaEvent {
474
+ /**
475
+ * On the events the host dispatches, the click count of `mousedown`,
476
+ * `mouseup`, `click`, `dblclick` and `auxclick`, and `0` on the others.
477
+ */
478
+ readonly detail: number;
479
+ /** Always `null`. */
480
+ readonly view: null;
481
+ /**
482
+ * On the events the host dispatches: for `mousedown`, `mouseup`, `click`,
483
+ * `dblclick`, `auxclick` and `contextmenu`, `button + 1`. For `wheel`, `0`.
484
+ * For the other mouse events, the lowest held button plus 1, or `0` with no
485
+ * button held. For the pointer events, `button + 1`, so `0` when `button` is `-1`. For a
486
+ * keyboard event, `keyCode`. For a focus event, `0`.
487
+ */
488
+ readonly which: number;
489
+ }
490
+ /** The event object of `focus`, `blur`, `focusin` and `focusout`. */
491
+ interface IncaFocusEvent extends IncaUIEvent {
492
+ /**
493
+ * The element gaining focus for `blur` and `focusout`, the element losing
494
+ * it for `focus` and `focusin`, or `null`.
495
+ */
496
+ readonly relatedTarget: IncaEventTarget | null;
497
+ }
498
+ /** The event object of the mouse events. */
499
+ interface IncaMouseEvent extends IncaUIEvent {
500
+ readonly screenX: number;
501
+ readonly screenY: number;
502
+ /** The pointer's position in the window. */
503
+ readonly clientX: number;
504
+ /** The pointer's position in the window. */
505
+ readonly clientY: number;
506
+ /** The same as {@link IncaMouseEvent.clientX}. */
507
+ readonly pageX: number;
508
+ /** The same as {@link IncaMouseEvent.clientY}. */
509
+ readonly pageY: number;
510
+ /** The same as {@link IncaMouseEvent.clientX}. */
511
+ readonly x: number;
512
+ /** The same as {@link IncaMouseEvent.clientY}. */
513
+ readonly y: number;
514
+ /** On the events the host dispatches, the pointer's position from the padding edge of `target`. */
515
+ readonly offsetX: number;
516
+ /** On the events the host dispatches, the pointer's position from the padding edge of `target`. */
517
+ readonly offsetY: number;
518
+ /** On the events the host dispatches, the pointer's travel since the previous `mousemove`, and `0` on other events. */
519
+ readonly movementX: number;
520
+ /** On the events the host dispatches, the pointer's travel since the previous `mousemove`, and `0` on other events. */
521
+ readonly movementY: number;
522
+ /**
523
+ * The button the event is about: `0` left, `1` middle, `2` right, `3` back, `4` forward. `-1` on
524
+ * a pointer event that is about no button.
525
+ */
526
+ readonly button: number;
527
+ /** Every button held, as a bitmask: `1` left, `2` right, `4` middle, `8` back, `16` forward. */
528
+ readonly buttons: number;
529
+ readonly ctrlKey: boolean;
530
+ readonly shiftKey: boolean;
531
+ readonly altKey: boolean;
532
+ readonly metaKey: boolean;
533
+ /**
534
+ * The element the pointer came from for `mouseover` and `mouseenter`, the
535
+ * element it went to for `mouseout` and `mouseleave`, or `null`.
536
+ */
537
+ readonly relatedTarget: IncaEventTarget | null;
538
+ /**
539
+ * Whether the modifier `key` is held: `"Control"`, `"Shift"`, `"Alt"`,
540
+ * `"Meta"`, or `"Accel"` (Meta on macOS, Control elsewhere). Any other name
541
+ * gives `false`.
542
+ */
543
+ getModifierState(key: string): boolean;
544
+ }
545
+ /**
546
+ * The event object of the `pointer*` events, `gotpointercapture`, `lostpointercapture`, `click`,
547
+ * `auxclick` and `contextmenu`.
548
+ */
549
+ interface IncaPointerEvent extends IncaMouseEvent {
550
+ /**
551
+ * On the events the host dispatches, `1` for the mouse and for the `contextmenu` of a key, and
552
+ * `-1` for the click of a key.
553
+ */
554
+ readonly pointerId: number;
555
+ readonly width: number;
556
+ readonly height: number;
557
+ /** On the pointer events the host dispatches, `0.5` while a button is held, else `0`. */
558
+ readonly pressure: number;
559
+ /** On the events the host dispatches, `"mouse"`, or `""` for the click of a key. */
560
+ readonly pointerType: string;
561
+ /**
562
+ * On the events the host dispatches, `true` on the pointer events and `false` on `click`,
563
+ * `auxclick` and `contextmenu`.
564
+ */
565
+ readonly isPrimary: boolean;
566
+ }
567
+ /** The event object of `wheel`. */
568
+ interface IncaWheelEvent extends IncaMouseEvent {
569
+ readonly deltaX: number;
570
+ readonly deltaY: number;
571
+ /** `0` on the events the host dispatches. */
572
+ readonly deltaZ: number;
573
+ /** `0` for pixels, `1` for lines. */
574
+ readonly deltaMode: number;
575
+ readonly DOM_DELTA_PIXEL: 0;
576
+ readonly DOM_DELTA_LINE: 1;
577
+ readonly DOM_DELTA_PAGE: 2;
578
+ }
579
+ /** The event object of `keydown` and `keyup`. */
580
+ interface IncaKeyboardEvent extends IncaUIEvent {
581
+ /** The key's name, such as `"Enter"`, `"F5"` or the typed character. */
582
+ readonly key: string;
583
+ /** `""` on the events the host dispatches. */
584
+ readonly code: string;
585
+ /** `0` on the events the host dispatches. */
586
+ readonly location: number;
587
+ /** Whether the key press is an auto-repeat. */
588
+ readonly repeat: boolean;
589
+ /** Whether an input method composes in the focused `<input>`. */
590
+ readonly isComposing: boolean;
591
+ /** The key's code on a US keyboard layout, and `0` for a key outside it. */
592
+ readonly keyCode: number;
593
+ /** `0` on the events the host dispatches. */
594
+ readonly charCode: number;
595
+ readonly ctrlKey: boolean;
596
+ readonly shiftKey: boolean;
597
+ readonly altKey: boolean;
598
+ readonly metaKey: boolean;
599
+ readonly DOM_KEY_LOCATION_STANDARD: 0;
600
+ readonly DOM_KEY_LOCATION_LEFT: 1;
601
+ readonly DOM_KEY_LOCATION_RIGHT: 2;
602
+ readonly DOM_KEY_LOCATION_NUMPAD: 3;
603
+ /**
604
+ * Whether the modifier `key` is held: `"Control"`, `"Shift"`, `"Alt"`,
605
+ * `"Meta"`, or `"Accel"` (Meta on macOS, Control elsewhere). Any other name
606
+ * gives `false`.
607
+ */
608
+ getModifierState(key: string): boolean;
609
+ }
610
+ /** The event object of `beforeinput` and `input`. */
611
+ interface IncaInputEvent extends IncaUIEvent {
612
+ /**
613
+ * The inserted text, or `null` for a deletion and a line break. On `input`, `null` for an empty
614
+ * composition text too.
615
+ */
616
+ readonly data: string | null;
617
+ /**
618
+ * On the events the host dispatches, one of `insertText`, `insertFromPaste`,
619
+ * `insertCompositionText`, `insertLineBreak`, `deleteContentBackward`, `deleteContentForward`
620
+ * and `deleteByCut`.
621
+ */
622
+ readonly inputType: string;
623
+ /** Whether the edit belongs to a composition. */
624
+ readonly isComposing: boolean;
625
+ /** Always `null`. */
626
+ readonly dataTransfer: null;
627
+ /** Returns a new empty array. */
628
+ getTargetRanges(): [];
629
+ }
630
+ /** The event object of `compositionstart`, `compositionupdate` and `compositionend`. */
631
+ interface IncaCompositionEvent extends IncaUIEvent {
632
+ /** The composed text. For `compositionstart`, the text the composition replaces. */
633
+ readonly data: string;
634
+ }
635
+ /** The event object of each event name the host dispatches. */
636
+ interface IncaEventMap {
637
+ auxclick: IncaPointerEvent;
638
+ beforeinput: IncaInputEvent;
639
+ blur: IncaFocusEvent;
640
+ change: IncaEvent;
641
+ click: IncaPointerEvent;
642
+ compositionend: IncaCompositionEvent;
643
+ compositionstart: IncaCompositionEvent;
644
+ compositionupdate: IncaCompositionEvent;
645
+ contextmenu: IncaPointerEvent;
646
+ dblclick: IncaMouseEvent;
647
+ focus: IncaFocusEvent;
648
+ focusin: IncaFocusEvent;
649
+ focusout: IncaFocusEvent;
650
+ gotpointercapture: IncaPointerEvent;
651
+ input: IncaInputEvent;
652
+ keydown: IncaKeyboardEvent;
653
+ keyup: IncaKeyboardEvent;
654
+ lostpointercapture: IncaPointerEvent;
655
+ mousedown: IncaMouseEvent;
656
+ mouseenter: IncaMouseEvent;
657
+ mouseleave: IncaMouseEvent;
658
+ mousemove: IncaMouseEvent;
659
+ mouseout: IncaMouseEvent;
660
+ mouseover: IncaMouseEvent;
661
+ mouseup: IncaMouseEvent;
662
+ pointerdown: IncaPointerEvent;
663
+ pointerenter: IncaPointerEvent;
664
+ pointerleave: IncaPointerEvent;
665
+ pointermove: IncaPointerEvent;
666
+ pointerout: IncaPointerEvent;
667
+ pointerover: IncaPointerEvent;
668
+ pointerup: IncaPointerEvent;
669
+ scroll: IncaEvent;
670
+ wheel: IncaWheelEvent;
671
+ }
672
+ /**
673
+ * Signature of a callback registered via `addEventListener`. It receives the
674
+ * event, an {@link IncaEvent} unless the parameter declares another type, and
675
+ * runs with the event's `currentTarget`, the target it was registered on, as
676
+ * `this`.
677
+ */
678
+ type EventListener<E = IncaEvent, T = IncaEventTarget> = (this: T, event: E) => void;
679
+ /**
680
+ * An object whose `handleEvent` method receives the events, called with the
681
+ * object as `this`. It takes the event an {@link EventListener} takes.
682
+ */
683
+ interface EventListenerObject<E = IncaEvent> {
684
+ handleEvent(event: E): void;
685
+ }
686
+ /**
687
+ * What `addEventListener` accepts as a listener: an {@link EventListener} or
688
+ * an {@link EventListenerObject}.
689
+ */
690
+ type EventListenerOrObject<E = IncaEvent, T = IncaEventTarget> = EventListener<E, T> | EventListenerObject<E>;
691
+ /**
692
+ * The event target at the top of the app, after `document`. Every event path
693
+ * ends at it. Bubble listeners on it run for every bubbling event, and capture
694
+ * listeners run for every event dispatched in the app, including events that
695
+ * do not bubble. A key event reaches it through the mount container and
696
+ * `document`. A `wheel` listener is passive unless its options say
697
+ * `passive: false`.
698
+ *
699
+ * It has the listener methods `addEventListener`, `removeEventListener` and
700
+ * `dispatchEvent`, and the event handler properties such as `onkeydown`.
701
+ */
702
+ declare const window: IncaWindow;
703
+ export { IncaElement as A, Overflow as C, TagName as D, StyleProps as E, ScrollOptions as F, RectLike as I, RectValues as L, IncaNode as M, IncaText as N, EventHandler as O, ScrollIntoViewOptions as P, NodeId as S, ScrollAlignment as T, 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, IncaInputElement as j, EventHandlers as k, IncaDocument as l, IncaInputEvent as m, AttributeValue as n, EventListenerObject as o, IncaFocusEvent as p, CallbackId as r, EventListenerOrObject as s, window as t, IncaEvent as u, IncaUIEvent as v, Px as w, ListenerOptions as x, IncaWheelEvent as y };