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.
- package/dist/chunks/hooks-DK2feJxZ.js +1 -0
- package/dist/chunks/rendererCore-Ezb4FOC9.js +1 -0
- package/dist/chunks/rendererCore-qq38UzW-.d.ts +388 -0
- package/dist/chunks/rolldown-runtime-DK3Fl9T5.js +1 -0
- package/dist/chunks/window-BtaK1Znc.d.ts +703 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +1 -1
- package/dist/rendererCore.d.ts +3 -0
- package/dist/rendererCore.js +1 -3
- package/dist/vue-runtime.d.ts +3 -0
- package/dist/vue-runtime.js +1 -2
- package/dist/{vue/createApp.d.mts → vue.d.ts} +6 -4
- package/dist/vue.js +2 -178
- package/package.json +16 -17
- package/dist/callbacks.d.mts +0 -31
- package/dist/chunks/hooks-TbLjfN0c.js +0 -417
- package/dist/chunks/rendererCore-BUNTDvYu.js +0 -110
- package/dist/document.d.mts +0 -11
- package/dist/element/eventHandlers.d.mts +0 -12
- package/dist/element/geometry.d.mts +0 -61
- package/dist/element/handle.d.mts +0 -29
- package/dist/element/lifecycle.d.mts +0 -51
- package/dist/element/scroll.d.mts +0 -42
- package/dist/element/shadowTree.d.mts +0 -64
- package/dist/element/types.d.mts +0 -149
- package/dist/eventTarget.d.mts +0 -11
- package/dist/events.d.mts +0 -105
- package/dist/index.d.mts +0 -6
- package/dist/native.d.mts +0 -46
- package/dist/rendererCore.d.mts +0 -14
- package/dist/targets.d.mts +0 -1
- package/dist/tree.d.mts +0 -157
- package/dist/types.d.mts +0 -454
- package/dist/vue/index.d.mts +0 -2
- package/dist/vue/nodeOps.d.mts +0 -29
- package/dist/vue/patchProp.d.mts +0 -79
- package/dist/vue/runtime.d.mts +0 -2
- package/dist/window.d.mts +0 -13
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { ScrollAlignment } from '../types.mts';
|
|
2
|
-
import { IncaElement } from './types.mts';
|
|
3
|
-
/** The options form of `scrollTo()` and `scrollBy()`. `behavior` is accepted and ignored. */
|
|
4
|
-
export interface ScrollOptions {
|
|
5
|
-
/** The horizontal offset. Omit to keep the current one. */
|
|
6
|
-
left?: number;
|
|
7
|
-
/** The vertical offset. Omit to keep the current one. */
|
|
8
|
-
top?: number;
|
|
9
|
-
/** `behavior` is ignored; every scroll applies at once. */
|
|
10
|
-
behavior?: "auto" | "instant" | "smooth";
|
|
11
|
-
}
|
|
12
|
-
/** Either `(left, top)` or an options object. */
|
|
13
|
-
export type ScrollArgs = [left?: number, top?: number] | [options?: ScrollOptions];
|
|
14
|
-
/**
|
|
15
|
-
* Moves a node's scroll offset. An omitted axis keeps its offset, and a
|
|
16
|
-
* non-finite value counts as `0`. A destroyed node ignores the call.
|
|
17
|
-
* @param el - the node to scroll
|
|
18
|
-
* @param args - `(left, top)` or `{ left, top }`
|
|
19
|
-
* @param relative - `true` adds the values to the current offset
|
|
20
|
-
*/
|
|
21
|
-
export declare function scrollPosition(el: IncaElement, args: ScrollArgs, relative: boolean): void;
|
|
22
|
-
/** The options form of `scrollIntoView()`. `behavior` is accepted and ignored. */
|
|
23
|
-
export interface ScrollIntoViewOptions {
|
|
24
|
-
/** The vertical alignment. Defaults to `"start"`. */
|
|
25
|
-
block?: ScrollAlignment;
|
|
26
|
-
/** The horizontal alignment. Defaults to `"nearest"`. */
|
|
27
|
-
inline?: ScrollAlignment;
|
|
28
|
-
/** `behavior` is ignored; every scroll applies at once. */
|
|
29
|
-
behavior?: "auto" | "instant" | "smooth";
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Turns `scrollIntoView()`'s argument into the alignment pair. `true` or no
|
|
33
|
-
* argument aligns to the start, `false` to the end, and an options object
|
|
34
|
-
* takes each axis from its own key. An unknown string falls back to that
|
|
35
|
-
* axis's default.
|
|
36
|
-
* @param arg - the boolean or options object the caller passed
|
|
37
|
-
* @returns the `block` and `inline` alignments to send to the host
|
|
38
|
-
*/
|
|
39
|
-
export declare function scrollIntoViewArgs(arg?: boolean | ScrollIntoViewOptions): {
|
|
40
|
-
block: ScrollAlignment;
|
|
41
|
-
inline: ScrollAlignment;
|
|
42
|
-
};
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { TagName } from '../types.mts';
|
|
2
|
-
import { IncaElement, IncaNode, IncaText } from './types.mts';
|
|
3
|
-
/**
|
|
4
|
-
* Allocates a new element node for `tag`.
|
|
5
|
-
* @param tag - the node's element kind
|
|
6
|
-
* @returns the new, parentless, childless element
|
|
7
|
-
*/
|
|
8
|
-
export declare function createElementNode(tag: TagName): IncaElement;
|
|
9
|
-
/**
|
|
10
|
-
* Creates a text leaf.
|
|
11
|
-
* @param text - the initial text content
|
|
12
|
-
* @returns the new text leaf
|
|
13
|
-
*/
|
|
14
|
-
export declare function createTextNode(text: string): IncaText;
|
|
15
|
-
/**
|
|
16
|
-
* Creates the hidden container that stands in for a comment node, such as a
|
|
17
|
-
* placeholder for conditional content.
|
|
18
|
-
* @returns the new hidden element
|
|
19
|
-
*/
|
|
20
|
-
export declare function createCommentNode(): IncaElement;
|
|
21
|
-
/**
|
|
22
|
-
* Updates a text leaf's content in place.
|
|
23
|
-
* @param node - the text leaf to update
|
|
24
|
-
* @param text - the new text content
|
|
25
|
-
*/
|
|
26
|
-
export declare function setText(node: IncaText, text: string): void;
|
|
27
|
-
/**
|
|
28
|
-
* Replaces all of `el`'s children with at most a single text child holding
|
|
29
|
-
* `text`. An empty string leaves `el` childless.
|
|
30
|
-
* @param el - the container whose children are replaced
|
|
31
|
-
* @param text - the new text content
|
|
32
|
-
*/
|
|
33
|
-
export declare function setElementText(el: IncaElement, text: string): void;
|
|
34
|
-
/**
|
|
35
|
-
* Attaches `child` to `parent`, before `anchor` or at the end when `anchor` is
|
|
36
|
-
* omitted or `null`. If `anchor` is `child` itself and `child` is already in
|
|
37
|
-
* `parent`, nothing changes. A `child` attached elsewhere is detached first,
|
|
38
|
-
* so a move keeps the node alive.
|
|
39
|
-
* @param child - the node being attached
|
|
40
|
-
* @param parent - the new container
|
|
41
|
-
* @param anchor - the sibling to insert before, or omitted/`null` to append at the end
|
|
42
|
-
*/
|
|
43
|
-
export declare function insert(child: IncaNode, parent: IncaElement, anchor?: IncaNode | null): void;
|
|
44
|
-
/**
|
|
45
|
-
* Removes `child` for good: the native node, its whole subtree, and every
|
|
46
|
-
* event listener registered in it.
|
|
47
|
-
*
|
|
48
|
-
* A caller that removes a subtree calls this on its root alone, and the host
|
|
49
|
-
* frees the descendants with it.
|
|
50
|
-
* @param child - the node being removed
|
|
51
|
-
*/
|
|
52
|
-
export declare function remove(child: IncaNode): void;
|
|
53
|
-
/**
|
|
54
|
-
* Looks up the current parent.
|
|
55
|
-
* @param node - the node to query
|
|
56
|
-
* @returns the current parent, or `null` if it isn't attached
|
|
57
|
-
*/
|
|
58
|
-
export declare function parentNode(node: IncaNode): IncaElement | null;
|
|
59
|
-
/**
|
|
60
|
-
* Looks up the next sibling.
|
|
61
|
-
* @param node - the node to query
|
|
62
|
-
* @returns the sibling immediately after `node` in its parent's children, or `null` if there is none (or `node` isn't attached)
|
|
63
|
-
*/
|
|
64
|
-
export declare function nextSibling(node: IncaNode): IncaNode | null;
|
package/dist/element/types.d.mts
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { IncaEvent, IncaEventMap, IncaEventTarget } from '../types.mts';
|
|
2
|
-
import { HANDLER_EVENTS } from './eventHandlers.mts';
|
|
3
|
-
import { RectLike } from './geometry.mts';
|
|
4
|
-
import { ScrollIntoViewOptions, ScrollOptions } from './scroll.mts';
|
|
5
|
-
/** A function an event handler property holds, called with its target as `this` and the event. */
|
|
6
|
-
export type EventHandler<E = IncaEvent, T = IncaElement> = (this: T, event: E) => unknown;
|
|
7
|
-
/**
|
|
8
|
-
* The event handler properties, such as `onclick`, of the events the host dispatches, `focusin` and
|
|
9
|
-
* `focusout` excepted.
|
|
10
|
-
*/
|
|
11
|
-
export type EventHandlers<T = IncaElement> = {
|
|
12
|
-
[K in (typeof HANDLER_EVENTS)[number] as `on${K}`]: EventHandler<IncaEventMap[K], T> | object | null;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* A container node: either a real element or the hidden stand-in that
|
|
16
|
-
* `createCommentNode` makes. It is the only node type that can act as a
|
|
17
|
-
* parent. `parent` and `children` read the node's current position in the
|
|
18
|
-
* tree.
|
|
19
|
-
*
|
|
20
|
-
* After the node is removed, `addEventListener()` and `removeEventListener()`
|
|
21
|
-
* ignore the call, an assignment to a handler property does nothing, and
|
|
22
|
-
* `dispatchEvent()` returns `true`.
|
|
23
|
-
*/
|
|
24
|
-
export interface IncaElement extends IncaEventTarget, EventHandlers {
|
|
25
|
-
/**
|
|
26
|
-
* The `id` attribute, or an empty string when it is unset. Assigning sets
|
|
27
|
-
* the attribute to the value as a string. After the node is removed,
|
|
28
|
-
* reading gives an empty string and assigning does nothing.
|
|
29
|
-
*/
|
|
30
|
-
id: string;
|
|
31
|
-
/**
|
|
32
|
-
* `"comment"` for the hidden stand-in `createCommentNode` makes;
|
|
33
|
-
* `"element"` for every other container.
|
|
34
|
-
*/
|
|
35
|
-
readonly kind: "element" | "comment";
|
|
36
|
-
/** The current parent, or `null` if this node isn't attached to the tree. */
|
|
37
|
-
parent: IncaElement | null;
|
|
38
|
-
/** This node's children, in render order. */
|
|
39
|
-
children: IncaNode[];
|
|
40
|
-
/**
|
|
41
|
-
* Focuses this node next frame. The node needs a `tabindex` attribute. A
|
|
42
|
-
* `true` `preventScroll` keeps every scroll container where it is. After
|
|
43
|
-
* the node is removed, the call does nothing.
|
|
44
|
-
*/
|
|
45
|
-
focus(options?: {
|
|
46
|
-
preventScroll?: boolean;
|
|
47
|
-
}): void;
|
|
48
|
-
/** Unfocuses this node next frame, if it is the focused one. */
|
|
49
|
-
blur(): void;
|
|
50
|
-
/**
|
|
51
|
-
* Fires an untrusted `click` at this node. A disabled `button` and a node
|
|
52
|
-
* whose own click is still running ignore the call. After the node is
|
|
53
|
-
* removed, the call does nothing.
|
|
54
|
-
*/
|
|
55
|
-
click(): void;
|
|
56
|
-
/**
|
|
57
|
-
* Captures the mouse pointer for this node while a button is held. Only `pointerId` 1 exists.
|
|
58
|
-
* @throws DOMException named `NotFoundError` for another `pointerId`
|
|
59
|
-
* @throws DOMException named `InvalidStateError` when the node is outside the mounted tree,
|
|
60
|
-
* also after it is removed
|
|
61
|
-
*/
|
|
62
|
-
setPointerCapture(pointerId: number): void;
|
|
63
|
-
/**
|
|
64
|
-
* Releases the capture this node requested. Does nothing when the node holds none.
|
|
65
|
-
* @throws DOMException named `NotFoundError` for a `pointerId` other than 1
|
|
66
|
-
*/
|
|
67
|
-
releasePointerCapture(pointerId: number): void;
|
|
68
|
-
/**
|
|
69
|
-
* Whether this node requested the capture and has not released it. `false` after the node is
|
|
70
|
-
* removed.
|
|
71
|
-
*/
|
|
72
|
-
hasPointerCapture(pointerId: number): boolean;
|
|
73
|
-
/**
|
|
74
|
-
* Whether `other` is this node or one of its descendants in the tree as
|
|
75
|
-
* rendered. `null` and `undefined` give `false`, and any other value that is
|
|
76
|
-
* not a node throws a `TypeError`. After the node is removed, it still answers
|
|
77
|
-
* for the subtree it keeps.
|
|
78
|
-
*/
|
|
79
|
-
contains(other: IncaNode | null): boolean;
|
|
80
|
-
/**
|
|
81
|
-
* Assigning sets the `tabindex` attribute to the value's integer part,
|
|
82
|
-
* wrapped to 32 bits. Reading returns the `tabindex` attribute as an
|
|
83
|
-
* integer, or `-1` (`0` for a `button`) when it is unset or invalid.
|
|
84
|
-
* After the node is removed, reading gives that default and assigning does
|
|
85
|
-
* nothing.
|
|
86
|
-
*/
|
|
87
|
-
tabIndex: number;
|
|
88
|
-
/**
|
|
89
|
-
* The box this node was drawn at in the last frame, in window logical
|
|
90
|
-
* pixels. A node created in the same task reads all zeros.
|
|
91
|
-
*/
|
|
92
|
-
getBoundingClientRect(): RectLike;
|
|
93
|
-
/** The box width from the last frame, rounded. `0` until a frame draws the node. */
|
|
94
|
-
readonly offsetWidth: number;
|
|
95
|
-
/** The box height from the last frame, rounded. `0` until a frame draws the node. */
|
|
96
|
-
readonly offsetHeight: number;
|
|
97
|
-
/** The box's left edge from the last frame, relative to {@link offsetParent}. Stays fixed while the parent scrolls. */
|
|
98
|
-
readonly offsetLeft: number;
|
|
99
|
-
/** The box's top edge from the last frame, relative to {@link offsetParent}. Stays fixed while the parent scrolls. */
|
|
100
|
-
readonly offsetTop: number;
|
|
101
|
-
/**
|
|
102
|
-
* The parent, when this node and the parent both have a box from the last frame.
|
|
103
|
-
* `null` when either lacks a box or there is no parent.
|
|
104
|
-
*/
|
|
105
|
-
readonly offsetParent: IncaElement | null;
|
|
106
|
-
/** The box width less both borders, rounded, at least `0`. */
|
|
107
|
-
readonly clientWidth: number;
|
|
108
|
-
/** The box height less both borders, rounded, at least `0`. */
|
|
109
|
-
readonly clientHeight: number;
|
|
110
|
-
/** The border width, rounded. */
|
|
111
|
-
readonly clientLeft: number;
|
|
112
|
-
/** The border width, rounded. */
|
|
113
|
-
readonly clientTop: number;
|
|
114
|
-
/** The horizontal scroll offset. Assigning moves it at once, and reads are clamped to the last frame's maximum. */
|
|
115
|
-
scrollLeft: number;
|
|
116
|
-
/** The vertical scroll offset. Assigning moves it at once, and reads are clamped to the last frame's maximum. */
|
|
117
|
-
scrollTop: number;
|
|
118
|
-
/** The content width: {@link clientWidth} plus the largest horizontal offset. */
|
|
119
|
-
readonly scrollWidth: number;
|
|
120
|
-
/** The content height: {@link clientHeight} plus the largest vertical offset. */
|
|
121
|
-
readonly scrollHeight: number;
|
|
122
|
-
/** Sets the offset to `(left, top)`, or to the options object's `left` and `top`. */
|
|
123
|
-
scrollTo(left?: number, top?: number): void;
|
|
124
|
-
scrollTo(options: ScrollOptions): void;
|
|
125
|
-
/** Adds `(left, top)` to the offset, or the options object's `left` and `top`. */
|
|
126
|
-
scrollBy(left?: number, top?: number): void;
|
|
127
|
-
scrollBy(options: ScrollOptions): void;
|
|
128
|
-
/**
|
|
129
|
-
* Scrolls each scroll container around this node so the node shows. `true`
|
|
130
|
-
* or no argument aligns to the start and `false` to the end. An options
|
|
131
|
-
* object sets `block` (default `"start"`) and `inline` (default `"nearest"`);
|
|
132
|
-
* `behavior` is accepted and ignored. After the node is removed, the call
|
|
133
|
-
* does nothing.
|
|
134
|
-
*/
|
|
135
|
-
scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;
|
|
136
|
-
}
|
|
137
|
-
/** A text leaf node. */
|
|
138
|
-
export interface IncaText {
|
|
139
|
-
/** Discriminates this node within the {@link IncaNode} union. */
|
|
140
|
-
readonly kind: "text";
|
|
141
|
-
/** The current parent, or `null` if this node isn't attached to the tree. */
|
|
142
|
-
parent: IncaElement | null;
|
|
143
|
-
/**
|
|
144
|
-
* The text content, mirroring the value pushed to the native node.
|
|
145
|
-
*/
|
|
146
|
-
text: string;
|
|
147
|
-
}
|
|
148
|
-
/** Any node the shadow tree holds: an element, comment, or text leaf. */
|
|
149
|
-
export type IncaNode = IncaElement | IncaText;
|
package/dist/eventTarget.d.mts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { EventTargetId } from './native.mts';
|
|
2
|
-
import { IncaEventTarget } from './types.mts';
|
|
3
|
-
/**
|
|
4
|
-
* Builds the listener methods of an event target: a node, document or window.
|
|
5
|
-
* @param target - the target id, or a function that resolves it each time a method runs
|
|
6
|
-
* @param passiveByDefault - event names whose listeners are passive unless
|
|
7
|
-
* their options say `passive: false`
|
|
8
|
-
* @returns the target's `addEventListener`, `removeEventListener` and
|
|
9
|
-
* `dispatchEvent`
|
|
10
|
-
*/
|
|
11
|
-
export declare function createEventTarget(target: EventTargetId | (() => EventTargetId), passiveByDefault?: readonly string[]): IncaEventTarget;
|
package/dist/events.d.mts
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { EventTargetId } from './native.mts';
|
|
2
|
-
import { EventLike, EventListenerOrObject, ListenerOptions, NodeId } from './types.mts';
|
|
3
|
-
/**
|
|
4
|
-
* @returns the `eventId` of the newest event any registered listener has
|
|
5
|
-
* received, or 0 before the first. Ids grow with each event, and every
|
|
6
|
-
* listener of one event receives the same id.
|
|
7
|
-
*/
|
|
8
|
-
export declare function latestEventId(): number;
|
|
9
|
-
/**
|
|
10
|
-
* Registers `listener` for `event` on the target (node, document or window).
|
|
11
|
-
* Registering the same listener for the same target, event and `capture`
|
|
12
|
-
* again changes nothing, and the first registration keeps its other options.
|
|
13
|
-
* A `null` listener is ignored.
|
|
14
|
-
*
|
|
15
|
-
* Any event name is accepted, and it fires when the host dispatches that name.
|
|
16
|
-
* `IncaEventMap` gives the event type of each name the host dispatches.
|
|
17
|
-
* @param target - the event target (node id, "$document" or "$window")
|
|
18
|
-
* @param event - the event name (e.g. `"click"`)
|
|
19
|
-
* @param listener - a function, called with the event's `currentTarget` as
|
|
20
|
-
* `this`, or an object whose `handleEvent` method is called with the object
|
|
21
|
-
* as `this` when the event fires
|
|
22
|
-
* @param options - `capture` listens while the event travels down to the
|
|
23
|
-
* target, `passive` ignores `preventDefault()` calls in `listener`, and
|
|
24
|
-
* `once` removes the listener before it first runs
|
|
25
|
-
* @throws TypeError when `target` is malformed or is an unknown target tag
|
|
26
|
-
* @throws TypeError when a node target names no node
|
|
27
|
-
* @throws RangeError when the host has issued its last callback id
|
|
28
|
-
*/
|
|
29
|
-
export declare function addEventListener(target: EventTargetId, event: string, listener: EventListenerOrObject<never, never> | null, options?: ListenerOptions): void;
|
|
30
|
-
/**
|
|
31
|
-
* Drops the registration {@link addEventListener} made for `listener` on
|
|
32
|
-
* the target with the same `event` and `capture`. A no-op if there is none.
|
|
33
|
-
* @param target - the event target (node, document or window)
|
|
34
|
-
* @param event - the event name
|
|
35
|
-
* @param listener - the listener that was registered
|
|
36
|
-
* @param options - `capture` of the registration to drop
|
|
37
|
-
*/
|
|
38
|
-
export declare function removeEventListener(target: EventTargetId, event: string, listener: EventListenerOrObject<never, never> | null, options?: Pick<ListenerOptions, "capture">): void;
|
|
39
|
-
/**
|
|
40
|
-
* Dispatches `event` at a target along its path. Dispatching at an element
|
|
41
|
-
* reaches its ancestors, `document` and `window`. Dispatching at `document`
|
|
42
|
-
* reaches `window`, and dispatching at `window` reaches only `window`.
|
|
43
|
-
* @param target - the target to dispatch at (node id, "$document" or "$window")
|
|
44
|
-
* @param event - the event to dispatch
|
|
45
|
-
* @returns `false` when a listener canceled a cancelable event, else `true`
|
|
46
|
-
* @throws TypeError when `target` is malformed or is an unknown target tag
|
|
47
|
-
* @throws TypeError when `target` is a node id that names no node
|
|
48
|
-
* @throws TypeError when `event` is not an event built with an event constructor
|
|
49
|
-
* @throws DOMException named `InvalidStateError` when `event` is being dispatched
|
|
50
|
-
*/
|
|
51
|
-
export declare function dispatchEvent(target: EventTargetId, event: EventLike): boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Fires an untrusted `click` at `nodeId`. A disabled `button` and a node whose
|
|
54
|
-
* own click is still running ignore the call.
|
|
55
|
-
* @param nodeId - the node to click
|
|
56
|
-
* @throws TypeError when `nodeId` is malformed
|
|
57
|
-
* @throws TypeError when `nodeId` names no node
|
|
58
|
-
*/
|
|
59
|
-
export declare function click(nodeId: NodeId): void;
|
|
60
|
-
/**
|
|
61
|
-
* Requests that `nodeId` become focused. Takes effect on the next frame,
|
|
62
|
-
* dispatching `"blur"`/`"focus"` for whatever actually changed. The node
|
|
63
|
-
* needs a `tabindex` attribute to take focus, and a listener for either event
|
|
64
|
-
* is optional. The scroll containers around the node scroll it into view.
|
|
65
|
-
* @param nodeId - the node to focus
|
|
66
|
-
* @param preventScroll - `true` to leave the scroll containers in place; omitted or `false` scrolls the node into view
|
|
67
|
-
* @throws TypeError when `nodeId` is malformed
|
|
68
|
-
* @throws TypeError when `nodeId` names no node
|
|
69
|
-
*/
|
|
70
|
-
export declare function focus(nodeId: NodeId, preventScroll?: boolean): void;
|
|
71
|
-
/**
|
|
72
|
-
* Requests that `nodeId` become unfocused, the way `element.blur()` does.
|
|
73
|
-
* Takes effect on the next frame; a no-op if `nodeId` isn't the focused node
|
|
74
|
-
* when it runs.
|
|
75
|
-
* @param nodeId - the node to unfocus
|
|
76
|
-
*/
|
|
77
|
-
export declare function blur(nodeId: NodeId): void;
|
|
78
|
-
/**
|
|
79
|
-
* Captures the mouse pointer for `nodeId` while a button is held. The pointer events and the
|
|
80
|
-
* mouse events that follow go to the node until the last button is released, and
|
|
81
|
-
* `gotpointercapture` fires before the next pointer event. With no button held the call does
|
|
82
|
-
* nothing.
|
|
83
|
-
* @param nodeId - the node to capture the pointer for
|
|
84
|
-
* @param pointerId - the pointer to capture; only `1`, the mouse, exists
|
|
85
|
-
* @throws DOMException named `NotFoundError` when `pointerId` is not `1`
|
|
86
|
-
* @throws DOMException named `InvalidStateError` when `nodeId` names no node or a node outside
|
|
87
|
-
* the mounted tree
|
|
88
|
-
*/
|
|
89
|
-
export declare function setPointerCapture(nodeId: NodeId, pointerId: number): void;
|
|
90
|
-
/**
|
|
91
|
-
* Releases the pointer capture `nodeId` requested. `lostpointercapture` fires before the next
|
|
92
|
-
* pointer event. The call does nothing for a node that has no capture.
|
|
93
|
-
* @param nodeId - the node that holds the capture
|
|
94
|
-
* @param pointerId - the pointer to release; only `1`, the mouse, exists
|
|
95
|
-
* @throws DOMException named `NotFoundError` when `pointerId` is not `1`
|
|
96
|
-
*/
|
|
97
|
-
export declare function releasePointerCapture(nodeId: NodeId, pointerId: number): void;
|
|
98
|
-
/**
|
|
99
|
-
* Whether `nodeId` requested the pointer capture and has not released it.
|
|
100
|
-
* @param nodeId - the node to ask about
|
|
101
|
-
* @param pointerId - the pointer to ask about
|
|
102
|
-
* @returns `false` for a pointer other than `1`, for a node outside the mounted tree and for a
|
|
103
|
-
* node that holds no capture
|
|
104
|
-
*/
|
|
105
|
-
export declare function hasPointerCapture(nodeId: NodeId, pointerId: number): boolean;
|
package/dist/index.d.mts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { document } from './document.mts';
|
|
2
|
-
export { window } from './window.mts';
|
|
3
|
-
export type { RectLike, RectValues } from './element/geometry.mts';
|
|
4
|
-
export type { ScrollIntoViewOptions, ScrollOptions } from './element/scroll.mts';
|
|
5
|
-
export type { IncaElement, IncaNode } from './element/types.mts';
|
|
6
|
-
export type { AttributeValue, CallbackId, EventLike, EventListener, EventListenerObject, EventListenerOrObject, IncaDocument, IncaEvent, IncaEventMap, IncaEventTarget, IncaFocusEvent, IncaKeyboardEvent, IncaMouseEvent, IncaPointerEvent, IncaUIEvent, IncaWheelEvent, IncaWindow, ListenerOptions, NodeId, StyleProps, TagName, } from './types.mts';
|
package/dist/native.d.mts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { AttributeValue, CallbackId, EventLike, NodeId, ScrollAlignment } from './types.mts';
|
|
2
|
-
/** What a listener or a dispatch names: a node id, or the tag of `document` or `window`. */
|
|
3
|
-
export type EventTargetId = NodeId | "$document" | "$window";
|
|
4
|
-
/**
|
|
5
|
-
* The host-injected object every wrapper in this package forwards to. Not part of the public
|
|
6
|
-
* surface.
|
|
7
|
-
*/
|
|
8
|
-
interface IncaNative {
|
|
9
|
-
rootNodeId(): NodeId;
|
|
10
|
-
createNode(tag: string): NodeId;
|
|
11
|
-
appendChild(parentId: NodeId, childId: NodeId): void;
|
|
12
|
-
insertBefore(parentId: NodeId, childId: NodeId, anchorId: NodeId | null): void;
|
|
13
|
-
removeChild(parentId: NodeId, childId: NodeId): void;
|
|
14
|
-
setAttribute(nodeId: NodeId, key: string, value: AttributeValue): void;
|
|
15
|
-
getAttribute(nodeId: NodeId, key: string): AttributeValue | null;
|
|
16
|
-
removeAttribute(nodeId: NodeId, key: string): void;
|
|
17
|
-
setStyle(nodeId: NodeId, key: string, value: AttributeValue): void;
|
|
18
|
-
removeStyle(nodeId: NodeId, key: string): void;
|
|
19
|
-
addEventListener(target: EventTargetId, event: string, capture?: boolean, passive?: boolean): CallbackId;
|
|
20
|
-
removeEventListener(target: EventTargetId, event: string, callbackId: CallbackId): boolean;
|
|
21
|
-
destroyNode(nodeId: NodeId): CallbackId[];
|
|
22
|
-
holdNode(nodeId: NodeId): void;
|
|
23
|
-
releaseNode(nodeId: NodeId): void;
|
|
24
|
-
focusNode(nodeId: NodeId, preventScroll?: boolean): void;
|
|
25
|
-
blurNode(nodeId: NodeId): void;
|
|
26
|
-
focusedNode(): NodeId | null;
|
|
27
|
-
layoutOf(nodeId: NodeId): readonly [number, number, number, number, number, number, number] | null;
|
|
28
|
-
scrollOf(nodeId: NodeId): readonly [number, number, number, number] | null;
|
|
29
|
-
scrollNode(nodeId: NodeId, left: number | null, top: number | null): void;
|
|
30
|
-
scrollIntoViewNode(nodeId: NodeId, block: ScrollAlignment, inline: ScrollAlignment): void;
|
|
31
|
-
dispatchEvent(target: EventTargetId, event: EventLike): boolean;
|
|
32
|
-
click(nodeId: NodeId): void;
|
|
33
|
-
setPointerCapture(nodeId: NodeId, pointerId: number): void;
|
|
34
|
-
releasePointerCapture(nodeId: NodeId, pointerId: number): void;
|
|
35
|
-
hasPointerCapture(nodeId: NodeId, pointerId: number): boolean;
|
|
36
|
-
}
|
|
37
|
-
/** What the host calls: it passes the event object as the first argument. */
|
|
38
|
-
export type HostCallback = (...args: unknown[]) => void;
|
|
39
|
-
declare global {
|
|
40
|
-
var __inca_native__: IncaNative;
|
|
41
|
-
var __inca_callbacks__: Record<CallbackId, HostCallback>;
|
|
42
|
-
var __inca_released__: (nodeIds: NodeId[], callbackIds: CallbackId[]) => void;
|
|
43
|
-
var __inca_targets__: (targets: EventTargetId[]) => unknown[];
|
|
44
|
-
}
|
|
45
|
-
export declare function native(): IncaNative;
|
|
46
|
-
export {};
|
package/dist/rendererCore.d.mts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export { createEventTarget } from './eventTarget.mts';
|
|
2
|
-
export { window } from './window.mts';
|
|
3
|
-
export { addEventListener, removeEventListener, latestEventId, focus, blur, dispatchEvent, click, } from './events.mts';
|
|
4
|
-
export { focusedNode, appendChild, createNode, destroyNode, holdNode, releaseNode, insertBefore, removeChild, rootNodeId, setAttribute, getAttribute, layoutOf, scrollOf, scrollNode, scrollIntoViewNode, removeAttribute, setStyle, removeStyle, } from './tree.mts';
|
|
5
|
-
export { createIncaElement, rootElement } from './element/handle.mts';
|
|
6
|
-
export { isDestroyed } from './element/lifecycle.mts';
|
|
7
|
-
export { createCommentNode, createElementNode, createTextNode, insert, nextSibling, parentNode, remove, setElementText, setText, } from './element/shadowTree.mts';
|
|
8
|
-
export type * from './types.mts';
|
|
9
|
-
export type * from './element/types.mts';
|
|
10
|
-
/**
|
|
11
|
-
* What a custom renderer (`incajs/vue`) drives the host through: the tree and
|
|
12
|
-
* event calls, the element handles and the shadow tree.
|
|
13
|
-
*/
|
|
14
|
-
export type IncaCore = typeof import('./rendererCore.mts');
|
package/dist/targets.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/tree.d.mts
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import { AttributeValue, NodeId, ScrollAlignment, StyleProps, TagName } from './types.mts';
|
|
2
|
-
/**
|
|
3
|
-
* Returns the host-allocated root container's id, the node an app attaches
|
|
4
|
-
* itself under. The host allocates it with the tree, so this resolves from
|
|
5
|
-
* the first call and names the same node for the engine's lifetime.
|
|
6
|
-
* @returns the root node's id
|
|
7
|
-
*/
|
|
8
|
-
export declare function rootNodeId(): NodeId;
|
|
9
|
-
/**
|
|
10
|
-
* Allocates a new node of kind `tag` in the native tree. The node starts out
|
|
11
|
-
* detached. Attach it with {@link appendChild}/{@link insertBefore}. The host
|
|
12
|
-
* frees the node at the start of the next frame unless it is inserted or held
|
|
13
|
-
* with {@link holdNode} by then.
|
|
14
|
-
* @param tag - the node's element kind
|
|
15
|
-
* @returns the new node's id
|
|
16
|
-
*/
|
|
17
|
-
export declare function createNode(tag: TagName): NodeId;
|
|
18
|
-
/**
|
|
19
|
-
* Attaches `childId` as the last child of `parentId`. A thin wrapper over
|
|
20
|
-
* {@link insertBefore} with no anchor.
|
|
21
|
-
* @param parentId - the container to attach to
|
|
22
|
-
* @param childId - the node being attached
|
|
23
|
-
*/
|
|
24
|
-
export declare function appendChild(parentId: NodeId, childId: NodeId): void;
|
|
25
|
-
/**
|
|
26
|
-
* Attaches `childId` as a child of `parentId`, positioned before `anchorId`
|
|
27
|
-
* (or at the end, if `anchorId` is `null`). If `anchorId` names a real node
|
|
28
|
-
* that just isn't currently a child of `parentId`, this falls back to
|
|
29
|
-
* appending at the end. Only a wholly unknown `anchorId` raises.
|
|
30
|
-
* @param parentId - the container to attach to
|
|
31
|
-
* @param childId - the node being attached
|
|
32
|
-
* @param anchorId - the sibling to insert before, or `null` to append at the end
|
|
33
|
-
*/
|
|
34
|
-
export declare function insertBefore(parentId: NodeId, childId: NodeId, anchorId: NodeId | null): void;
|
|
35
|
-
/**
|
|
36
|
-
* Detaches `childId` from `parentId`. The detached node keeps its own children
|
|
37
|
-
* and is freed at the start of the next frame unless it is inserted or held
|
|
38
|
-
* with {@link holdNode} by then. Use {@link destroyNode} to free it at once.
|
|
39
|
-
* @param parentId - the current container
|
|
40
|
-
* @param childId - the node being detached
|
|
41
|
-
*/
|
|
42
|
-
export declare function removeChild(parentId: NodeId, childId: NodeId): void;
|
|
43
|
-
/**
|
|
44
|
-
* Frees `nodeId` and its whole subtree, detaching it first, and drops every
|
|
45
|
-
* event listener registered anywhere in it. Destroying an already-destroyed
|
|
46
|
-
* node does nothing. The host's own root cannot be destroyed and raises.
|
|
47
|
-
*
|
|
48
|
-
* Also drops the hold of {@link holdNode}.
|
|
49
|
-
* @param nodeId - the node that isn't coming back
|
|
50
|
-
*/
|
|
51
|
-
export declare function destroyNode(nodeId: NodeId): void;
|
|
52
|
-
/**
|
|
53
|
-
* Keeps `nodeId` and its subtree alive while it has no parent. The host frees
|
|
54
|
-
* a parentless node that is neither held nor inserted by the start of the next
|
|
55
|
-
* frame. Holding a held or attached node changes nothing visible.
|
|
56
|
-
* @param nodeId - the node to keep
|
|
57
|
-
* @throws {TypeError} when `nodeId` names no node
|
|
58
|
-
*/
|
|
59
|
-
export declare function holdNode(nodeId: NodeId): void;
|
|
60
|
-
/**
|
|
61
|
-
* Ends the hold of {@link holdNode}. A node with no parent is freed at the
|
|
62
|
-
* start of the next frame. An unknown id does nothing.
|
|
63
|
-
* @param nodeId - the node to let go
|
|
64
|
-
*/
|
|
65
|
-
export declare function releaseNode(nodeId: NodeId): void;
|
|
66
|
-
/**
|
|
67
|
-
* Sets a non-style attribute/prop on `nodeId`. See {@link setStyle} for
|
|
68
|
-
* layout/paint properties, which live in a separate map.
|
|
69
|
-
* @param nodeId - the node to update
|
|
70
|
-
* @param key - the attribute name
|
|
71
|
-
* @param value - the attribute value
|
|
72
|
-
*/
|
|
73
|
-
export declare function setAttribute(nodeId: NodeId, key: string, value: AttributeValue): void;
|
|
74
|
-
/**
|
|
75
|
-
* Returns the attribute/prop stored on `nodeId` under `key`, or `null` when unset.
|
|
76
|
-
* @param nodeId - the node to read
|
|
77
|
-
* @param key - the attribute name
|
|
78
|
-
* @returns the stored value, or `null`
|
|
79
|
-
* @throws {TypeError} when `nodeId` names no node
|
|
80
|
-
*/
|
|
81
|
-
export declare function getAttribute(nodeId: NodeId, key: string): AttributeValue | null;
|
|
82
|
-
/**
|
|
83
|
-
* Returns the box `nodeId` was drawn at in the last frame, in window logical
|
|
84
|
-
* pixels, or `null` if the node has no recorded box.
|
|
85
|
-
* @param nodeId - the node to read
|
|
86
|
-
* @returns `[x, y, width, height, border, scrollX, scrollY]`, or `null`. `border` is one uniform
|
|
87
|
-
* width on all sides. `scrollX` and `scrollY` are the positive scroll offset the parent applied
|
|
88
|
-
* to the box.
|
|
89
|
-
* @throws {TypeError} when `nodeId` names no node
|
|
90
|
-
*/
|
|
91
|
-
export declare function layoutOf(nodeId: NodeId): readonly [number, number, number, number, number, number, number] | null;
|
|
92
|
-
/**
|
|
93
|
-
* Returns the scroll offset of `nodeId` in window logical pixels. A write made
|
|
94
|
-
* since the last draw is included, clamped to the maximum of the last drawn
|
|
95
|
-
* frame.
|
|
96
|
-
* @param nodeId - the node to read
|
|
97
|
-
* @returns `[left, top, maxLeft, maxTop]`, or `null` for a node whose `overflow` is
|
|
98
|
-
* `visible` or `clip` on both axes. The maxima are the largest offsets the node can take, as
|
|
99
|
-
* of the last drawn frame.
|
|
100
|
-
* @throws {TypeError} when `nodeId` names no node
|
|
101
|
-
*/
|
|
102
|
-
export declare function scrollOf(nodeId: NodeId): readonly [number, number, number, number] | null;
|
|
103
|
-
/**
|
|
104
|
-
* Sets the scroll offset of `nodeId` on one or both axes. A `null` axis keeps
|
|
105
|
-
* its current offset. The host clamps each value to the scrollable range on
|
|
106
|
-
* the next frame. A node whose `overflow` is `visible` or `clip` on both axes ignores the call.
|
|
107
|
-
* @param nodeId - the node to scroll
|
|
108
|
-
* @param left - the horizontal offset, or `null` to keep it
|
|
109
|
-
* @param top - the vertical offset, or `null` to keep it
|
|
110
|
-
* @throws {TypeError} when `nodeId` names no node
|
|
111
|
-
*/
|
|
112
|
-
export declare function scrollNode(nodeId: NodeId, left: number | null, top: number | null): void;
|
|
113
|
-
/**
|
|
114
|
-
* Scrolls each scroll container around `nodeId` so the node shows.
|
|
115
|
-
* @param nodeId - the node to bring into view
|
|
116
|
-
* @param block - the vertical alignment: `"start"`, `"center"`, `"end"` or `"nearest"`
|
|
117
|
-
* @param inline - the horizontal alignment: `"start"`, `"center"`, `"end"` or `"nearest"`
|
|
118
|
-
* @throws {TypeError} when `nodeId` names no node
|
|
119
|
-
* @throws {TypeError} when `block` or `inline` is not an alignment name
|
|
120
|
-
*/
|
|
121
|
-
export declare function scrollIntoViewNode(nodeId: NodeId, block: ScrollAlignment, inline: ScrollAlignment): void;
|
|
122
|
-
/**
|
|
123
|
-
* Removes a non-style attribute/prop from `nodeId`. Removing an attribute
|
|
124
|
-
* that isn't set does nothing.
|
|
125
|
-
* @param nodeId - the node to update
|
|
126
|
-
* @param key - the attribute name
|
|
127
|
-
*/
|
|
128
|
-
export declare function removeAttribute(nodeId: NodeId, key: string): void;
|
|
129
|
-
/**
|
|
130
|
-
* Sets a style property on `nodeId`. A snake_case key from {@link StyleProps}
|
|
131
|
-
* gets compile-time checking on its value's shape. Any other string key, such
|
|
132
|
-
* as a camelCase or kebab-case spelling or a property the types do not list,
|
|
133
|
-
* forwards as a raw {@link AttributeValue}.
|
|
134
|
-
*
|
|
135
|
-
* A key takes any of three spellings: kebab-case (`flex-direction`),
|
|
136
|
-
* camelCase (`flexDirection`) or snake_case (`flex_direction`). All three
|
|
137
|
-
* name the same property, and the value set most recently applies.
|
|
138
|
-
* @param nodeId - the node to update
|
|
139
|
-
* @param key - the style property name in any of the three spellings
|
|
140
|
-
* @param value - the style property value
|
|
141
|
-
*/
|
|
142
|
-
export declare function setStyle<K extends keyof StyleProps>(nodeId: NodeId, key: K, value: NonNullable<StyleProps[K]>): void;
|
|
143
|
-
export declare function setStyle(nodeId: NodeId, key: string, value: AttributeValue): void;
|
|
144
|
-
/**
|
|
145
|
-
* Removes a style property from `nodeId`, so it renders as if never set.
|
|
146
|
-
* Removing a property that isn't set does nothing. The key takes any of the
|
|
147
|
-
* three spellings {@link setStyle} accepts, and removes the property whichever
|
|
148
|
-
* spelling set it.
|
|
149
|
-
* @param nodeId - the node to update
|
|
150
|
-
* @param key - the style property name in any of the three spellings
|
|
151
|
-
*/
|
|
152
|
-
export declare function removeStyle(nodeId: NodeId, key: string): void;
|
|
153
|
-
/**
|
|
154
|
-
* Returns the id of the focused node.
|
|
155
|
-
* @returns the focused node's id, or `null` when no node has focus
|
|
156
|
-
*/
|
|
157
|
-
export declare function focusedNode(): NodeId | null;
|