incajs 0.0.14 → 0.0.16
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/README.md +1 -1
- package/dist/callbacks.d.mts +43 -0
- package/dist/chunks/handle-B1h0qxex.js +193 -0
- package/dist/chunks/rendererCore-U_s1R1v7.js +171 -0
- package/dist/element/geometry.d.mts +65 -0
- package/dist/{vue/createElement.d.mts → element/handle.d.mts} +9 -3
- package/dist/element/lifecycle.d.mts +36 -0
- package/dist/element/scroll.d.mts +44 -0
- package/dist/element/shadowTree.d.mts +71 -0
- package/dist/element/types.d.mts +119 -0
- package/dist/events.d.mts +5 -15
- package/dist/index.d.mts +4 -0
- package/dist/index.js +4 -3
- package/dist/native.d.mts +13 -4
- package/dist/rendererCore.d.mts +2 -2
- package/dist/rendererCore.js +1 -31
- package/dist/tree.d.mts +60 -7
- package/dist/types.d.mts +5 -6
- package/dist/vue/createApp.d.mts +1 -1
- package/dist/vue/index.d.mts +0 -2
- package/dist/vue/nodeOps.d.mts +10 -60
- package/dist/vue/patchProp.d.mts +2 -2
- package/dist/vue.js +109 -116
- package/package.json +1 -1
- package/dist/chunks/tree-BQ6ux0tE.js +0 -125
- /package/dist/{createEventTarget.d.mts → eventTarget.d.mts} +0 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { IncaEventTarget, NodeId } from '../rendererCore.mts';
|
|
2
|
+
import { RectLike } from './geometry.mts';
|
|
3
|
+
import { ScrollIntoViewOptions, ScrollOptions } from './scroll.mts';
|
|
4
|
+
/**
|
|
5
|
+
* A container node: either a real element or the hidden stand-in that
|
|
6
|
+
* `createCommentNode` makes. It is the only node type that can act as a
|
|
7
|
+
* parent.
|
|
8
|
+
*
|
|
9
|
+
* `inca`'s native tree has no parent pointers and no way to list a
|
|
10
|
+
* node's children, so `parent`/`children` are maintained here as a
|
|
11
|
+
* JS-side shadow of the tree, kept in sync by `insert` and
|
|
12
|
+
* `remove`.
|
|
13
|
+
*
|
|
14
|
+
* After the node is removed, `addEventListener()` and `removeEventListener()`
|
|
15
|
+
* ignore the call, and `dispatchEvent()` returns `true`.
|
|
16
|
+
*/
|
|
17
|
+
export interface IncaElement extends IncaEventTarget {
|
|
18
|
+
/**
|
|
19
|
+
* The underlying native node's id, the only part of this object the native
|
|
20
|
+
* tree itself knows about.
|
|
21
|
+
*/
|
|
22
|
+
readonly id: NodeId;
|
|
23
|
+
/**
|
|
24
|
+
* `"comment"` for the hidden stand-in `createCommentNode`
|
|
25
|
+
* makes; `"element"` for every other container. Purely
|
|
26
|
+
* informational: both render identically once created.
|
|
27
|
+
*/
|
|
28
|
+
readonly kind: "element" | "comment";
|
|
29
|
+
/** The current parent, or `null` if this node isn't attached to the tree. */
|
|
30
|
+
parent: IncaElement | null;
|
|
31
|
+
/** This node's children, in render order. */
|
|
32
|
+
children: IncaNode[];
|
|
33
|
+
/**
|
|
34
|
+
* Focuses this node next frame. The node needs a `tabindex` attribute. A
|
|
35
|
+
* `true` `preventScroll` keeps every scroll container where it is. After
|
|
36
|
+
* the node is removed, the call does nothing.
|
|
37
|
+
*/
|
|
38
|
+
focus(options?: {
|
|
39
|
+
preventScroll?: boolean;
|
|
40
|
+
}): void;
|
|
41
|
+
/** Unfocuses this node next frame, if it is the focused one. */
|
|
42
|
+
blur(): void;
|
|
43
|
+
/**
|
|
44
|
+
* Fires an untrusted `click` at this node. A disabled `button`, a node whose
|
|
45
|
+
* own click is still running and an unknown node ignore the call.
|
|
46
|
+
*/
|
|
47
|
+
click(): void;
|
|
48
|
+
/**
|
|
49
|
+
* Assigning sets the `tabindex` attribute to the value's integer part,
|
|
50
|
+
* wrapped to 32 bits. Reading returns the `tabindex` attribute as an
|
|
51
|
+
* integer, or `-1` (`0` for a `button`) when it is unset or invalid.
|
|
52
|
+
* After the node is removed, reading gives that default and assigning does
|
|
53
|
+
* nothing.
|
|
54
|
+
*/
|
|
55
|
+
tabIndex: number;
|
|
56
|
+
/**
|
|
57
|
+
* The box this node was drawn at in the last frame, in window logical
|
|
58
|
+
* pixels. A node created in the same task reads all zeros.
|
|
59
|
+
*/
|
|
60
|
+
getBoundingClientRect(): RectLike;
|
|
61
|
+
/** The box width from the last frame, rounded. `0` until a frame draws the node. */
|
|
62
|
+
readonly offsetWidth: number;
|
|
63
|
+
/** The box height from the last frame, rounded. `0` until a frame draws the node. */
|
|
64
|
+
readonly offsetHeight: number;
|
|
65
|
+
/** The box's left edge from the last frame, relative to {@link offsetParent}. Stays fixed while the parent scrolls. */
|
|
66
|
+
readonly offsetLeft: number;
|
|
67
|
+
/** The box's top edge from the last frame, relative to {@link offsetParent}. Stays fixed while the parent scrolls. */
|
|
68
|
+
readonly offsetTop: number;
|
|
69
|
+
/**
|
|
70
|
+
* The parent, when this node and the parent both have a box from the last frame.
|
|
71
|
+
* `null` when either lacks a box or there is no parent.
|
|
72
|
+
*/
|
|
73
|
+
readonly offsetParent: IncaElement | null;
|
|
74
|
+
/** The box width less both borders, rounded, at least `0`. */
|
|
75
|
+
readonly clientWidth: number;
|
|
76
|
+
/** The box height less both borders, rounded, at least `0`. */
|
|
77
|
+
readonly clientHeight: number;
|
|
78
|
+
/** The border width, rounded. */
|
|
79
|
+
readonly clientLeft: number;
|
|
80
|
+
/** The border width, rounded. */
|
|
81
|
+
readonly clientTop: number;
|
|
82
|
+
/** The horizontal scroll offset. Assigning moves it at once, and reads are clamped to the last frame's maximum. */
|
|
83
|
+
scrollLeft: number;
|
|
84
|
+
/** The vertical scroll offset. Assigning moves it at once, and reads are clamped to the last frame's maximum. */
|
|
85
|
+
scrollTop: number;
|
|
86
|
+
/** The content width: {@link clientWidth} plus the largest horizontal offset. */
|
|
87
|
+
readonly scrollWidth: number;
|
|
88
|
+
/** The content height: {@link clientHeight} plus the largest vertical offset. */
|
|
89
|
+
readonly scrollHeight: number;
|
|
90
|
+
/** Sets the offset to `(left, top)`, or to the options object's `left` and `top`. */
|
|
91
|
+
scrollTo(left?: number, top?: number): void;
|
|
92
|
+
scrollTo(options: ScrollOptions): void;
|
|
93
|
+
/** Adds `(left, top)` to the offset, or the options object's `left` and `top`. */
|
|
94
|
+
scrollBy(left?: number, top?: number): void;
|
|
95
|
+
scrollBy(options: ScrollOptions): void;
|
|
96
|
+
/**
|
|
97
|
+
* Scrolls each scroll container around this node so the node shows. `true`
|
|
98
|
+
* or no argument aligns to the start and `false` to the end. An options
|
|
99
|
+
* object sets `block` (default `"start"`) and `inline` (default `"nearest"`);
|
|
100
|
+
* `behavior` is accepted and ignored. After the node is removed, the call
|
|
101
|
+
* does nothing.
|
|
102
|
+
*/
|
|
103
|
+
scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;
|
|
104
|
+
}
|
|
105
|
+
/** A text leaf node. */
|
|
106
|
+
export interface IncaText {
|
|
107
|
+
/** The underlying native node's id. */
|
|
108
|
+
readonly id: NodeId;
|
|
109
|
+
/** Discriminates this node within the {@link IncaNode} union. */
|
|
110
|
+
readonly kind: "text";
|
|
111
|
+
/** The current parent, or `null` if this node isn't attached to the tree. */
|
|
112
|
+
parent: IncaElement | null;
|
|
113
|
+
/**
|
|
114
|
+
* The text content, mirroring the value pushed to the native node.
|
|
115
|
+
*/
|
|
116
|
+
text: string;
|
|
117
|
+
}
|
|
118
|
+
/** Any node the shadow tree holds: an element, comment, or text leaf. */
|
|
119
|
+
export type IncaNode = IncaElement | IncaText;
|
package/dist/events.d.mts
CHANGED
|
@@ -1,22 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
/**
|
|
3
|
-
* @returns how many `(nodeId, event, capture)` groups hold a registration
|
|
4
|
-
* @internal
|
|
5
|
-
*/
|
|
6
|
-
export declare function registeredGroupCount(): number;
|
|
1
|
+
import { EventLike, EventListenerOrObject, ListenerOptions, NodeId } from './types.mts';
|
|
7
2
|
/**
|
|
8
3
|
* @returns the `eventId` of the newest event any registered listener has
|
|
9
4
|
* received, or 0 before the first. Ids grow with each event, and every
|
|
10
5
|
* listener of one event receives the same id.
|
|
11
6
|
*/
|
|
12
7
|
export declare function latestEventId(): number;
|
|
13
|
-
/**
|
|
14
|
-
* Drops the JS half of every registration in `callbackIds`. The native half
|
|
15
|
-
* is already gone by the time this runs — `destroyNode` takes both.
|
|
16
|
-
* @param callbackIds - ids the host reported as released
|
|
17
|
-
* @internal
|
|
18
|
-
*/
|
|
19
|
-
export declare function releaseCallbacks(callbackIds: readonly CallbackId[]): void;
|
|
20
8
|
/**
|
|
21
9
|
* Registers `listener` for `event` on `nodeId`. Registering the same listener
|
|
22
10
|
* for the same node, event and `capture` again changes nothing, and the first
|
|
@@ -33,6 +21,7 @@ export declare function releaseCallbacks(callbackIds: readonly CallbackId[]): vo
|
|
|
33
21
|
* `once` removes the listener before it first runs
|
|
34
22
|
* @throws TypeError when `nodeId` is malformed
|
|
35
23
|
* @throws TypeError when `nodeId` names no node
|
|
24
|
+
* @throws RangeError when the host has issued its last callback id
|
|
36
25
|
*/
|
|
37
26
|
export declare function addEventListener(nodeId: NodeId, event: string, listener: EventListenerOrObject | null, options?: ListenerOptions): void;
|
|
38
27
|
/**
|
|
@@ -66,10 +55,11 @@ export declare function click(nodeId: NodeId): void;
|
|
|
66
55
|
* Requests that `nodeId` become focused. Takes effect on the next frame,
|
|
67
56
|
* dispatching `"blur"`/`"focus"` for whatever actually changed. The node
|
|
68
57
|
* needs a `tabindex` attribute to take focus, and a listener for either event
|
|
69
|
-
* is optional.
|
|
58
|
+
* is optional. The scroll containers around the node scroll it into view.
|
|
70
59
|
* @param nodeId - the node to focus
|
|
60
|
+
* @param preventScroll - `true` to leave the scroll containers in place; omitted or `false` scrolls the node into view
|
|
71
61
|
*/
|
|
72
|
-
export declare function focus(nodeId: NodeId): void;
|
|
62
|
+
export declare function focus(nodeId: NodeId, preventScroll?: boolean): void;
|
|
73
63
|
/**
|
|
74
64
|
* Requests that `nodeId` become unfocused, the way `element.blur()` does.
|
|
75
65
|
* Takes effect on the next frame; a no-op if `nodeId` isn't the focused node
|
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
+
export { activeElement } from './element/handle.mts';
|
|
1
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';
|
|
2
6
|
export type { AttributeValue, CallbackId, EventLike, EventListener, EventListenerObject, EventListenerOrObject, IncaEventTarget, ListenerOptions, NodeId, StyleProps, TagName, } from './types.mts';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { f as e, v as t } from "./chunks/rendererCore-U_s1R1v7.js";
|
|
2
|
+
import { t as n } from "./chunks/handle-B1h0qxex.js";
|
|
2
3
|
//#region src/window.mts
|
|
3
|
-
var
|
|
4
|
+
var r = /* @__PURE__ */ t(e, ["wheel"]);
|
|
4
5
|
//#endregion
|
|
5
|
-
export { n as window };
|
|
6
|
+
export { n as activeElement, r as window };
|
package/dist/native.d.mts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { AttributeValue, CallbackId, EventLike, NodeId } from './types.mts';
|
|
2
|
-
/**
|
|
1
|
+
import { AttributeValue, CallbackId, EventLike, NodeId, ScrollAlignment } from './types.mts';
|
|
2
|
+
/**
|
|
3
|
+
* The host-injected object every wrapper in this package forwards to. Not part of the public
|
|
4
|
+
* surface.
|
|
5
|
+
*/
|
|
3
6
|
interface IncaNative {
|
|
4
7
|
rootNodeId(): NodeId;
|
|
5
8
|
createNode(tag: string): NodeId;
|
|
@@ -7,14 +10,20 @@ interface IncaNative {
|
|
|
7
10
|
insertBefore(parentId: NodeId, childId: NodeId, anchorId: NodeId | null): void;
|
|
8
11
|
removeChild(parentId: NodeId, childId: NodeId): void;
|
|
9
12
|
setAttribute(nodeId: NodeId, key: string, value: AttributeValue): void;
|
|
13
|
+
getAttribute(nodeId: NodeId, key: string): AttributeValue | null;
|
|
10
14
|
removeAttribute(nodeId: NodeId, key: string): void;
|
|
11
15
|
setStyle(nodeId: NodeId, key: string, value: AttributeValue): void;
|
|
12
16
|
removeStyle(nodeId: NodeId, key: string): void;
|
|
13
|
-
addEventListener(nodeId: NodeId, event: string,
|
|
17
|
+
addEventListener(nodeId: NodeId, event: string, capture?: boolean, passive?: boolean): CallbackId;
|
|
14
18
|
removeEventListener(nodeId: NodeId, event: string, callbackId: CallbackId): boolean;
|
|
15
19
|
destroyNode(nodeId: NodeId): CallbackId[];
|
|
16
|
-
focusNode(nodeId: NodeId): void;
|
|
20
|
+
focusNode(nodeId: NodeId, preventScroll?: boolean): void;
|
|
17
21
|
blurNode(nodeId: NodeId): void;
|
|
22
|
+
focusedNode(): NodeId | null;
|
|
23
|
+
layoutOf(nodeId: NodeId): readonly [number, number, number, number, number, number, number] | null;
|
|
24
|
+
scrollOf(nodeId: NodeId): readonly [number, number, number, number] | null;
|
|
25
|
+
scrollNode(nodeId: NodeId, left: number | null, top: number | null): void;
|
|
26
|
+
scrollIntoViewNode(nodeId: NodeId, block: ScrollAlignment, inline: ScrollAlignment): void;
|
|
18
27
|
dispatchEvent(nodeId: NodeId, event: EventLike): boolean;
|
|
19
28
|
click(nodeId: NodeId): void;
|
|
20
29
|
}
|
package/dist/rendererCore.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { createEventTarget } from './
|
|
1
|
+
export { createEventTarget } from './eventTarget.mts';
|
|
2
2
|
export { addEventListener, removeEventListener, latestEventId, focus, blur, dispatchEvent, click, } from './events.mts';
|
|
3
|
-
export { appendChild, createNode, destroyNode, insertBefore, removeChild, rootNodeId, setAttribute, removeAttribute, setStyle, removeStyle, } from './tree.mts';
|
|
3
|
+
export { focusedNode, appendChild, createNode, destroyNode, insertBefore, removeChild, rootNodeId, setAttribute, getAttribute, layoutOf, scrollOf, scrollNode, scrollIntoViewNode, removeAttribute, setStyle, removeStyle, } from './tree.mts';
|
|
4
4
|
export type * from './types.mts';
|
|
5
5
|
/**
|
|
6
6
|
* The tree/event primitives a custom renderer (`incajs/vue`) drives the
|
package/dist/rendererCore.js
CHANGED
|
@@ -1,31 +1 @@
|
|
|
1
|
-
|
|
2
|
-
//#region \0rolldown/runtime.js
|
|
3
|
-
var v = Object.defineProperty, y = /* @__PURE__ */ ((e, t) => {
|
|
4
|
-
let n = {};
|
|
5
|
-
for (var r in e) v(n, r, {
|
|
6
|
-
get: e[r],
|
|
7
|
-
enumerable: !0
|
|
8
|
-
});
|
|
9
|
-
return t || v(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
10
|
-
})({
|
|
11
|
-
addEventListener: () => i,
|
|
12
|
-
appendChild: () => h,
|
|
13
|
-
blur: () => f,
|
|
14
|
-
click: () => l,
|
|
15
|
-
createEventTarget: () => r,
|
|
16
|
-
createNode: () => u,
|
|
17
|
-
destroyNode: () => p,
|
|
18
|
-
dispatchEvent: () => o,
|
|
19
|
-
focus: () => a,
|
|
20
|
-
insertBefore: () => s,
|
|
21
|
-
latestEventId: () => e,
|
|
22
|
-
removeAttribute: () => t,
|
|
23
|
-
removeChild: () => d,
|
|
24
|
-
removeEventListener: () => _,
|
|
25
|
-
removeStyle: () => m,
|
|
26
|
-
rootNodeId: () => n,
|
|
27
|
-
setAttribute: () => c,
|
|
28
|
-
setStyle: () => g
|
|
29
|
-
});
|
|
30
|
-
//#endregion
|
|
31
|
-
export { i as addEventListener, h as appendChild, f as blur, l as click, r as createEventTarget, u as createNode, p as destroyNode, o as dispatchEvent, a as focus, s as insertBefore, e as latestEventId, t as removeAttribute, d as removeChild, _ as removeEventListener, m as removeStyle, n as rootNodeId, c as setAttribute, g as setStyle, y as t };
|
|
1
|
+
export { y as addEventListener, n as appendChild, b as blur, x as click, v as createEventTarget, r as createNode, i as destroyNode, S as dispatchEvent, C as focus, a as focusedNode, o as getAttribute, s as insertBefore, w as latestEventId, c as layoutOf, l as removeAttribute, u as removeChild, T as removeEventListener, d as removeStyle, f as rootNodeId, p as scrollIntoViewNode, m as scrollNode, h as scrollOf, g as setAttribute, _ as setStyle } from "./chunks/rendererCore-U_s1R1v7.js";
|
package/dist/tree.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AttributeValue, NodeId, StyleProps, TagName } from './types.mts';
|
|
1
|
+
import { AttributeValue, NodeId, ScrollAlignment, StyleProps, TagName } from './types.mts';
|
|
2
2
|
/**
|
|
3
|
-
* Returns the host-allocated root container's id
|
|
3
|
+
* Returns the host-allocated root container's id, the node an app attaches
|
|
4
4
|
* itself under. The host allocates it with the tree, so this resolves from
|
|
5
5
|
* the first call and names the same node for the engine's lifetime.
|
|
6
6
|
* @returns the root node's id
|
|
@@ -8,7 +8,7 @@ import { AttributeValue, NodeId, StyleProps, TagName } from './types.mts';
|
|
|
8
8
|
export declare function rootNodeId(): NodeId;
|
|
9
9
|
/**
|
|
10
10
|
* Allocates a new node of kind `tag` in the native tree. The node starts out
|
|
11
|
-
* detached
|
|
11
|
+
* detached. Attach it with {@link appendChild}/{@link insertBefore}.
|
|
12
12
|
* @param tag - the node's element kind
|
|
13
13
|
* @returns the new node's id
|
|
14
14
|
*/
|
|
@@ -24,7 +24,7 @@ export declare function appendChild(parentId: NodeId, childId: NodeId): void;
|
|
|
24
24
|
* Attaches `childId` as a child of `parentId`, positioned before `anchorId`
|
|
25
25
|
* (or at the end, if `anchorId` is `null`). If `anchorId` names a real node
|
|
26
26
|
* that just isn't currently a child of `parentId`, this falls back to
|
|
27
|
-
* appending at the end instead of throwing
|
|
27
|
+
* appending at the end instead of throwing. Only a wholly unknown
|
|
28
28
|
* `anchorId` raises.
|
|
29
29
|
* @param parentId - the container to attach to
|
|
30
30
|
* @param childId - the node being attached
|
|
@@ -32,9 +32,9 @@ export declare function appendChild(parentId: NodeId, childId: NodeId): void;
|
|
|
32
32
|
*/
|
|
33
33
|
export declare function insertBefore(parentId: NodeId, childId: NodeId, anchorId: NodeId | null): void;
|
|
34
34
|
/**
|
|
35
|
-
* Detaches `childId` from `parentId`. The detached node stays alive
|
|
36
|
-
*
|
|
37
|
-
*
|
|
35
|
+
* Detaches `childId` from `parentId`. The detached node stays alive and keeps
|
|
36
|
+
* its own children, so it can be re-attached elsewhere. Use
|
|
37
|
+
* {@link destroyNode} for a node that isn't coming back.
|
|
38
38
|
* @param parentId - the current container
|
|
39
39
|
* @param childId - the node being detached
|
|
40
40
|
*/
|
|
@@ -57,6 +57,54 @@ export declare function destroyNode(nodeId: NodeId): void;
|
|
|
57
57
|
* @param value - the attribute value
|
|
58
58
|
*/
|
|
59
59
|
export declare function setAttribute(nodeId: NodeId, key: string, value: AttributeValue): void;
|
|
60
|
+
/**
|
|
61
|
+
* Returns the attribute/prop stored on `nodeId` under `key`, or `null` when unset.
|
|
62
|
+
* @param nodeId - the node to read
|
|
63
|
+
* @param key - the attribute name
|
|
64
|
+
* @returns the stored value, or `null`
|
|
65
|
+
* @throws {TypeError} when `nodeId` names no node
|
|
66
|
+
*/
|
|
67
|
+
export declare function getAttribute(nodeId: NodeId, key: string): AttributeValue | null;
|
|
68
|
+
/**
|
|
69
|
+
* Returns the box `nodeId` was drawn at in the last frame, in window logical
|
|
70
|
+
* pixels, or `null` if the node has no recorded box.
|
|
71
|
+
* @param nodeId - the node to read
|
|
72
|
+
* @returns `[x, y, width, height, border, scrollX, scrollY]`, or `null`. `border` is one uniform
|
|
73
|
+
* width on all sides. `scrollX` and `scrollY` are the positive scroll offset the parent applied
|
|
74
|
+
* to the box.
|
|
75
|
+
* @throws {TypeError} when `nodeId` names no node
|
|
76
|
+
*/
|
|
77
|
+
export declare function layoutOf(nodeId: NodeId): readonly [number, number, number, number, number, number, number] | null;
|
|
78
|
+
/**
|
|
79
|
+
* Returns the scroll offset of `nodeId` in window logical pixels. A write made
|
|
80
|
+
* since the last draw is included, clamped to the maximum of the last drawn
|
|
81
|
+
* frame.
|
|
82
|
+
* @param nodeId - the node to read
|
|
83
|
+
* @returns `[left, top, maxLeft, maxTop]`, or `null` for a node whose `overflow` is
|
|
84
|
+
* `visible` on both axes. The maxima are the largest offsets the node can take, as
|
|
85
|
+
* of the last drawn frame.
|
|
86
|
+
* @throws {TypeError} when `nodeId` names no node
|
|
87
|
+
*/
|
|
88
|
+
export declare function scrollOf(nodeId: NodeId): readonly [number, number, number, number] | null;
|
|
89
|
+
/**
|
|
90
|
+
* Sets the scroll offset of `nodeId` on one or both axes. A `null` axis keeps
|
|
91
|
+
* its current offset. The host clamps each value to the scrollable range on
|
|
92
|
+
* the next frame. A node with `overflow: visible` on both axes ignores the call.
|
|
93
|
+
* @param nodeId - the node to scroll
|
|
94
|
+
* @param left - the horizontal offset, or `null` to keep it
|
|
95
|
+
* @param top - the vertical offset, or `null` to keep it
|
|
96
|
+
* @throws {TypeError} when `nodeId` names no node
|
|
97
|
+
*/
|
|
98
|
+
export declare function scrollNode(nodeId: NodeId, left: number | null, top: number | null): void;
|
|
99
|
+
/**
|
|
100
|
+
* Scrolls each scroll container around `nodeId` so the node shows.
|
|
101
|
+
* @param nodeId - the node to bring into view
|
|
102
|
+
* @param block - the vertical alignment: `"start"`, `"center"`, `"end"` or `"nearest"`
|
|
103
|
+
* @param inline - the horizontal alignment: `"start"`, `"center"`, `"end"` or `"nearest"`
|
|
104
|
+
* @throws {TypeError} when `nodeId` names no node
|
|
105
|
+
* @throws {TypeError} when `block` or `inline` is not an alignment name
|
|
106
|
+
*/
|
|
107
|
+
export declare function scrollIntoViewNode(nodeId: NodeId, block: ScrollAlignment, inline: ScrollAlignment): void;
|
|
60
108
|
/**
|
|
61
109
|
* Removes a non-style attribute/prop from `nodeId`. Removing an attribute
|
|
62
110
|
* that isn't set does nothing.
|
|
@@ -88,3 +136,8 @@ export declare function setStyle(nodeId: NodeId, key: string, value: AttributeVa
|
|
|
88
136
|
* @param key - the style property name in any of the three spellings
|
|
89
137
|
*/
|
|
90
138
|
export declare function removeStyle(nodeId: NodeId, key: string): void;
|
|
139
|
+
/**
|
|
140
|
+
* Returns the id of the focused node.
|
|
141
|
+
* @returns the focused node's id, or `null` when no node has focus
|
|
142
|
+
*/
|
|
143
|
+
export declare function focusedNode(): NodeId | null;
|
package/dist/types.d.mts
CHANGED
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
export type NodeId = number;
|
|
6
6
|
/**
|
|
7
7
|
* Id assigned to one registered event listener. Managed internally by
|
|
8
|
-
* `addEventListener`/`removeEventListener`/`destroyNode
|
|
9
|
-
* pass one directly.
|
|
8
|
+
* `addEventListener`/`removeEventListener`/`destroyNode`.
|
|
10
9
|
*/
|
|
11
10
|
export type CallbackId = number;
|
|
12
11
|
/**
|
|
@@ -16,12 +15,14 @@ export type CallbackId = number;
|
|
|
16
15
|
export type AttributeValue = string | number | boolean;
|
|
17
16
|
/**
|
|
18
17
|
* Element kind passed to `createNode`. `"text"` is the only tag with
|
|
19
|
-
* dedicated rendering behavior
|
|
18
|
+
* dedicated rendering behavior: it renders its `"value"` attribute followed
|
|
20
19
|
* by its descendants' text. Any other string is a generic styled
|
|
21
20
|
* container; the `string & {}` half of this type keeps `"text"`'s
|
|
22
21
|
* autocomplete while still accepting an arbitrary tag name.
|
|
23
22
|
*/
|
|
24
23
|
export type TagName = "text" | (string & {});
|
|
24
|
+
/** Where `scrollIntoView` aligns a node on one axis. */
|
|
25
|
+
export type ScrollAlignment = "start" | "center" | "end" | "nearest";
|
|
25
26
|
/**
|
|
26
27
|
* Style properties, in their snake_case spelling, that `setStyle`'s typed
|
|
27
28
|
* overload checks. A deliberately incomplete, v1 layout/paint vocabulary. The
|
|
@@ -38,7 +39,7 @@ export interface StyleProps {
|
|
|
38
39
|
justify_content?: "start" | "end" | "center" | "stretch";
|
|
39
40
|
/** Cross-axis alignment of children within this container. */
|
|
40
41
|
align_items?: "start" | "end" | "center" | "stretch";
|
|
41
|
-
/** Uniform spacing, in px, between children
|
|
42
|
+
/** Uniform spacing, in px, between children, applied on both axes. */
|
|
42
43
|
gap?: number;
|
|
43
44
|
/** Fixed width in px, or `"auto"` to size to content. */
|
|
44
45
|
width?: number | "auto";
|
|
@@ -138,7 +139,6 @@ export interface IncaEventTarget {
|
|
|
138
139
|
* @param listener - a function, or an object whose `handleEvent` method is
|
|
139
140
|
* called when the event fires
|
|
140
141
|
* @param options - a {@link ListenerOptions}, or a boolean for `capture`
|
|
141
|
-
* @throws TypeError when the target's node was destroyed
|
|
142
142
|
*/
|
|
143
143
|
addEventListener(type: string, listener: EventListenerOrObject | null, options?: boolean | ListenerOptions): void;
|
|
144
144
|
/**
|
|
@@ -153,7 +153,6 @@ export interface IncaEventTarget {
|
|
|
153
153
|
* Dispatches an `Event` or `CustomEvent` at the target.
|
|
154
154
|
* @param event - the event to dispatch
|
|
155
155
|
* @returns `false` when a listener canceled a cancelable event, else `true`
|
|
156
|
-
* @throws TypeError when the target's node was destroyed
|
|
157
156
|
* @throws TypeError when `event` is not an `Event` or `CustomEvent`
|
|
158
157
|
* @throws DOMException named `InvalidStateError` when `event` is being dispatched
|
|
159
158
|
*/
|
package/dist/vue/createApp.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { App, Component, ComponentPublicInstance } from '@vue/runtime-core';
|
|
2
|
-
import { IncaElement } from '
|
|
2
|
+
import { IncaElement } from '../element/types.mts';
|
|
3
3
|
/**
|
|
4
4
|
* `@vue/runtime-core`'s `App`, with `mount` additionally callable with no
|
|
5
5
|
* argument to target the host's own root container. An intersection rather
|
package/dist/vue/index.d.mts
CHANGED
package/dist/vue/nodeOps.d.mts
CHANGED
|
@@ -1,70 +1,20 @@
|
|
|
1
1
|
import { RendererOptions } from '@vue/runtime-core';
|
|
2
|
-
import {
|
|
2
|
+
import { IncaElement, IncaNode } from '../element/types.mts';
|
|
3
|
+
import { IncaCore } from '../rendererCore.mts';
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* `
|
|
7
|
-
*
|
|
8
|
-
* `
|
|
9
|
-
* node's children, so `parent`/`children` are maintained here as a
|
|
10
|
-
* JS-side shadow of the tree, kept in sync by {@link NodeOps.insert}/
|
|
11
|
-
* {@link NodeOps.remove}.
|
|
5
|
+
* Marks `handle` so that Vue's `reactive()` and `ref()` keep the object itself.
|
|
6
|
+
* A template ref then holds the same object the application receives from
|
|
7
|
+
* `activeElement()`.
|
|
8
|
+
* @param handle - the node handle to mark
|
|
9
|
+
* @returns `handle`
|
|
12
10
|
*/
|
|
13
|
-
export
|
|
14
|
-
/**
|
|
15
|
-
* The underlying native node's id — the only part of this object the native
|
|
16
|
-
* tree itself knows about.
|
|
17
|
-
*/
|
|
18
|
-
readonly id: NodeId;
|
|
19
|
-
/**
|
|
20
|
-
* `"comment"` for the hidden stand-in {@link NodeOps.createComment}
|
|
21
|
-
* produces; `"element"` for every other container. Purely
|
|
22
|
-
* informational — both render identically once created.
|
|
23
|
-
*/
|
|
24
|
-
readonly kind: "element" | "comment";
|
|
25
|
-
/** The current parent, or `null` if this node isn't attached to the tree. */
|
|
26
|
-
parent: IncaElement | null;
|
|
27
|
-
/** This node's children, in render order. */
|
|
28
|
-
children: IncaNode[];
|
|
29
|
-
/** Focuses this node next frame. The node needs a `tabindex` attribute. */
|
|
30
|
-
focus(): void;
|
|
31
|
-
/** Unfocuses this node next frame, if it is the focused one. */
|
|
32
|
-
blur(): void;
|
|
33
|
-
/**
|
|
34
|
-
* Fires an untrusted `click` at this node. A disabled `button`, a node whose
|
|
35
|
-
* own click is still running and an unknown node ignore the call.
|
|
36
|
-
*/
|
|
37
|
-
click(): void;
|
|
38
|
-
/**
|
|
39
|
-
* Assigning sets the `tabindex` attribute to the integer part of the
|
|
40
|
-
* value. Reading returns the last value assigned, or `-1` (`0` for a
|
|
41
|
-
* `button`).
|
|
42
|
-
*/
|
|
43
|
-
tabIndex: number;
|
|
44
|
-
}
|
|
45
|
-
/** A text leaf host node — `@vue/runtime-core`'s `HostNode` for text. */
|
|
46
|
-
export interface IncaText {
|
|
47
|
-
/** The underlying native node's id. */
|
|
48
|
-
readonly id: NodeId;
|
|
49
|
-
/** Discriminates this node within the {@link IncaNode} union. */
|
|
50
|
-
readonly kind: "text";
|
|
51
|
-
/** The current parent, or `null` if this node isn't attached to the tree. */
|
|
52
|
-
parent: IncaElement | null;
|
|
53
|
-
/**
|
|
54
|
-
* The text content, mirroring what's been pushed to the native node via
|
|
55
|
-
* {@link IncaCore.setAttribute}.
|
|
56
|
-
*/
|
|
57
|
-
text: string;
|
|
58
|
-
}
|
|
59
|
-
/** Any host node {@link NodeOps} can produce: an element, comment, or text leaf. */
|
|
60
|
-
export type IncaNode = IncaElement | IncaText;
|
|
11
|
+
export declare function skipReactive<T extends object>(handle: T): T;
|
|
61
12
|
/** {@link createNodeOps}'s return shape. */
|
|
62
13
|
export type NodeOps = Omit<RendererOptions<IncaNode, IncaElement>, "patchProp">;
|
|
63
14
|
/**
|
|
64
15
|
* `@vue/runtime-core`'s {@link RendererOptions}`<IncaNode, IncaElement>`,
|
|
65
|
-
* minus `patchProp
|
|
66
|
-
* renderer
|
|
67
|
-
* native bridge directly.
|
|
16
|
+
* minus `patchProp`. This is the host-node lifecycle half of `incajs/vue`'s custom
|
|
17
|
+
* renderer.
|
|
68
18
|
* @param core - the incajs bindings to drive the native tree through
|
|
69
19
|
*/
|
|
70
20
|
export declare function createNodeOps(core: IncaCore): NodeOps;
|
package/dist/vue/patchProp.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { RendererOptions } from '@vue/runtime-core';
|
|
2
|
+
import { IncaElement } from '../element/types.mts';
|
|
2
3
|
import { IncaCore } from '../rendererCore.mts';
|
|
3
|
-
import { IncaElement } from './nodeOps.mts';
|
|
4
4
|
/**
|
|
5
|
-
* {@link RendererOptions.patchProp}
|
|
5
|
+
* {@link RendererOptions.patchProp} applies one changed `v-bind`/
|
|
6
6
|
* attribute/event prop to a host element.
|
|
7
7
|
*
|
|
8
8
|
* ### `style`
|