incajs 0.0.16 → 0.0.18

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 CHANGED
@@ -12,7 +12,8 @@ framework. No Chromium, no DOM: UI renders directly on the GPU via
12
12
 
13
13
  ## How it works
14
14
 
15
- - The root `incajs` export is the `window` event target and the public types.
15
+ - The root `incajs` export is the `window` event target, `activeElement` and
16
+ the public types.
16
17
  - `incajs/vue` is a custom renderer mapping Vue 3's `createRenderer`
17
18
  lifecycle onto the native host bridge. `createIncaApp(rootComponent,
18
19
  rootProps?)` creates a Vue app whose root mounts against the host's
@@ -7,26 +7,19 @@ import { CallbackId, EventListenerOrObject, NodeId } from './types.mts';
7
7
  * @param callbackId - the id the host returned for the registration
8
8
  * @param callable - the function the host runs
9
9
  */
10
- export declare function addCallback(group: string, listener: EventListenerOrObject, callbackId: CallbackId, callable: HostCallback): void;
10
+ export declare function addCallback(group: string, listener: EventListenerOrObject<never>, callbackId: CallbackId, callable: HostCallback): void;
11
11
  /**
12
12
  * @param group - the node, event and capture flag as one string
13
13
  * @param listener - the listener the caller registered
14
14
  * @returns the id registered for the pair, or `undefined`
15
15
  */
16
- export declare function callbackIdFor(group: string, listener: EventListenerOrObject): CallbackId | undefined;
16
+ export declare function callbackIdFor(group: string, listener: EventListenerOrObject<never>): CallbackId | undefined;
17
17
  /**
18
18
  * Forgets `callbackId` and the listener it names. An id that was never
19
19
  * registered, or was released already, changes nothing.
20
20
  * @param callbackId - the id to drop
21
21
  */
22
22
  export declare function releaseCallback(callbackId: CallbackId): void;
23
- /**
24
- * Drops the JS half of every registration in `callbackIds`. The native half
25
- * is already gone by the time this runs: `destroyNode` takes both.
26
- * @param callbackIds - ids the host reported as released
27
- * @internal
28
- */
29
- export declare function releaseCallbacks(callbackIds: readonly CallbackId[]): void;
30
23
  /**
31
24
  * The capture flag is part of the identity: the same node, event and function
32
25
  * can listen in both phases side by side.
@@ -36,8 +29,3 @@ export declare function releaseCallbacks(callbackIds: readonly CallbackId[]): vo
36
29
  * @returns the node, event and capture flag as one string
37
30
  */
38
31
  export declare const groupOf: (nodeId: NodeId, event: string, capture: boolean | undefined) => string;
39
- /**
40
- * @returns how many `(nodeId, event, capture)` groups hold a registration
41
- * @internal
42
- */
43
- export declare function registeredGroupCount(): number;
@@ -0,0 +1,215 @@
1
+ import { A as e, C as t, M as n, O as r, P as i, S as a, T as o, _ as s, a as c, b as l, g as u, h as d, k as f, l as p, o as m, v as h } from "./hooks-BgB7lzTv.js";
2
+ //#region src/element/eventHandlers.mts
3
+ var g = [
4
+ "auxclick",
5
+ "blur",
6
+ "click",
7
+ "contextmenu",
8
+ "dblclick",
9
+ "focus",
10
+ "keydown",
11
+ "keyup",
12
+ "mousedown",
13
+ "mouseenter",
14
+ "mouseleave",
15
+ "mousemove",
16
+ "mouseout",
17
+ "mouseover",
18
+ "mouseup",
19
+ "scroll",
20
+ "wheel"
21
+ ];
22
+ function _(e, t) {
23
+ for (let n of g) {
24
+ let r = null, i = function(e) {
25
+ typeof r == "function" && Reflect.apply(r, this, [e]) === !1 && e.preventDefault();
26
+ };
27
+ Object.defineProperty(e, `on${n}`, {
28
+ get: () => r,
29
+ set(a) {
30
+ t() || (r = typeof a == "function" || typeof a == "object" && a ? a : null, r === null ? e.removeEventListener(n, i) : e.addEventListener(n, i));
31
+ }
32
+ });
33
+ }
34
+ return e;
35
+ }
36
+ //#endregion
37
+ //#region src/element/geometry.mts
38
+ function v(e) {
39
+ return f(e) ? null : p(e.__node_id);
40
+ }
41
+ function y(e) {
42
+ let t = e.parent;
43
+ return !v(e) || !t || !v(t) ? null : t;
44
+ }
45
+ function b(e) {
46
+ let t = v(e);
47
+ if (!t) return {
48
+ left: 0,
49
+ top: 0
50
+ };
51
+ let n = y(e), r = n ? v(n) : null;
52
+ return {
53
+ left: Math.round(t[0] - (r ? r[0] + r[4] : 0) + t[5]) || 0,
54
+ top: Math.round(t[1] - (r ? r[1] + r[4] : 0) + t[6]) || 0
55
+ };
56
+ }
57
+ function x(e) {
58
+ let [t, n, r, i] = e ?? [
59
+ 0,
60
+ 0,
61
+ 0,
62
+ 0,
63
+ 0
64
+ ], a = {
65
+ x: t,
66
+ y: n,
67
+ width: r,
68
+ height: i,
69
+ top: n,
70
+ left: t,
71
+ right: t + r,
72
+ bottom: n + i
73
+ };
74
+ return {
75
+ ...a,
76
+ toJSON: () => ({ ...a })
77
+ };
78
+ }
79
+ function S(e, t) {
80
+ let n = t === "button" ? 0 : -1;
81
+ if (typeof e != "string" && typeof e != "number") return n;
82
+ let r = /^[\t\n\f\r ]*([+-]?\d+)/.exec(String(e));
83
+ if (!r) return n;
84
+ let i = Number(r[1]) || 0;
85
+ return i >= -2147483648 && i <= 2147483647 ? i : n;
86
+ }
87
+ //#endregion
88
+ //#region src/element/scroll.mts
89
+ function C(e, t, n) {
90
+ if (f(e)) return;
91
+ let [r, i] = t, [a, o] = typeof r == "object" ? [r?.left, r?.top] : [r, i], [c, l] = n ? s(e.__node_id) ?? [0, 0] : [0, 0], d = (e, t) => {
92
+ if (e === void 0) return null;
93
+ let r = Number(e);
94
+ return (n ? t : 0) + (Number.isFinite(r) ? r : 0);
95
+ };
96
+ u(e.__node_id, d(a, c), d(o, l));
97
+ }
98
+ function w(e) {
99
+ let t = [
100
+ "start",
101
+ "center",
102
+ "end",
103
+ "nearest"
104
+ ];
105
+ return typeof e == "object" && e ? {
106
+ block: t.includes(e.block ?? "") ? e.block : "start",
107
+ inline: t.includes(e.inline ?? "") ? e.inline : "nearest"
108
+ } : {
109
+ block: e === !1 ? "end" : "start",
110
+ inline: "nearest"
111
+ };
112
+ }
113
+ //#endregion
114
+ //#region src/element/handle.mts
115
+ function T(r, c, u) {
116
+ let p = l(() => r), g = () => f(T) ? null : s(r), T = _(i({
117
+ get id() {
118
+ return f(T) ? "" : String(m(r, "id") ?? "");
119
+ },
120
+ set id(e) {
121
+ f(T) || h(r, "id", String(e));
122
+ },
123
+ kind: c,
124
+ parent: null,
125
+ children: [],
126
+ focus: (e) => {
127
+ if (f(T)) return;
128
+ let t = e?.preventScroll;
129
+ t === void 0 ? o(r) : o(r, !!t);
130
+ },
131
+ blur: () => a(r),
132
+ click: () => t(r),
133
+ contains: (t) => {
134
+ if (t == null) return !1;
135
+ if (!e(t)) throw TypeError("the value is not a node. pass an element, a text node or null");
136
+ for (let e = t; e !== null; e = e.parent) if (e === T) return !0;
137
+ return !1;
138
+ },
139
+ addEventListener: (...e) => {
140
+ f(T) || p.addEventListener(...e);
141
+ },
142
+ removeEventListener: (...e) => {
143
+ f(T) || p.removeEventListener(...e);
144
+ },
145
+ dispatchEvent: (e) => f(T) || p.dispatchEvent(e),
146
+ get tabIndex() {
147
+ return S(f(T) ? null : m(r, "tabindex"), u ?? "");
148
+ },
149
+ set tabIndex(e) {
150
+ f(T) || h(r, "tabindex", e | 0);
151
+ },
152
+ getBoundingClientRect: () => x(v(T)),
153
+ get offsetWidth() {
154
+ return Math.round(v(T)?.[2] ?? 0);
155
+ },
156
+ get offsetHeight() {
157
+ return Math.round(v(T)?.[3] ?? 0);
158
+ },
159
+ get offsetLeft() {
160
+ return b(T).left;
161
+ },
162
+ get offsetTop() {
163
+ return b(T).top;
164
+ },
165
+ get offsetParent() {
166
+ return y(T);
167
+ },
168
+ get clientWidth() {
169
+ let e = v(T);
170
+ return e ? Math.max(0, Math.round(e[2] - 2 * e[4])) : 0;
171
+ },
172
+ get clientHeight() {
173
+ let e = v(T);
174
+ return e ? Math.max(0, Math.round(e[3] - 2 * e[4])) : 0;
175
+ },
176
+ get clientLeft() {
177
+ return Math.round(v(T)?.[4] ?? 0);
178
+ },
179
+ get clientTop() {
180
+ return Math.round(v(T)?.[4] ?? 0);
181
+ },
182
+ get scrollLeft() {
183
+ return g()?.[0] ?? 0;
184
+ },
185
+ set scrollLeft(e) {
186
+ C(T, [e], !1);
187
+ },
188
+ get scrollTop() {
189
+ return g()?.[1] ?? 0;
190
+ },
191
+ set scrollTop(e) {
192
+ C(T, [void 0, e], !1);
193
+ },
194
+ get scrollWidth() {
195
+ return T.clientWidth + Math.round(g()?.[2] ?? 0);
196
+ },
197
+ get scrollHeight() {
198
+ return T.clientHeight + Math.round(g()?.[3] ?? 0);
199
+ },
200
+ scrollTo: (...e) => C(T, e, !1),
201
+ scrollBy: (...e) => C(T, e, !0),
202
+ scrollIntoView: (e) => {
203
+ if (f(T)) return;
204
+ let { block: t, inline: n } = w(e);
205
+ d(r, t, n);
206
+ }
207
+ }, r), () => f(T));
208
+ return c === "element" && n(T), T;
209
+ }
210
+ function E() {
211
+ let e = c();
212
+ return e === null ? null : r(e) ?? null;
213
+ }
214
+ //#endregion
215
+ export { T as n, E as t };
@@ -0,0 +1,201 @@
1
+ //#region src/native.mts
2
+ function e() {
3
+ return globalThis.__inca_native__;
4
+ }
5
+ //#endregion
6
+ //#region src/element/lifecycle.mts
7
+ var t = /* @__PURE__ */ new WeakSet();
8
+ function n(e, n) {
9
+ return t.add(e), Object.defineProperty(e, "__node_id", { value: n });
10
+ }
11
+ function r(e) {
12
+ return typeof e == "object" && !!e && t.has(e);
13
+ }
14
+ var i = /* @__PURE__ */ new Map(), a = new FinalizationRegistry((e) => {
15
+ i.get(e)?.deref() || i.delete(e);
16
+ });
17
+ function o(e) {
18
+ i.set(e.__node_id, new WeakRef(e)), a.register(e, e.__node_id);
19
+ }
20
+ function s(e) {
21
+ i.delete(e);
22
+ }
23
+ function c(e) {
24
+ return i.get(e)?.deref();
25
+ }
26
+ var l = /* @__PURE__ */ new WeakSet();
27
+ function u(e) {
28
+ return l.has(e);
29
+ }
30
+ function d(e) {
31
+ if (l.add(e), e.kind !== "text") {
32
+ s(e.__node_id);
33
+ for (let t of e.children) d(t);
34
+ }
35
+ }
36
+ function f(e) {
37
+ for (let t of e) {
38
+ let e = c(t);
39
+ e && d(e);
40
+ }
41
+ }
42
+ var p = new FinalizationRegistry((t) => e().releaseNode(t));
43
+ function m(e) {
44
+ p.register(e, e.__node_id);
45
+ }
46
+ //#endregion
47
+ //#region src/callbacks.mts
48
+ var h = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), _ = () => globalThis.__inca_callbacks__ ??= {};
49
+ function v(e, t, n, r) {
50
+ _()[n] = r;
51
+ let i = h.get(e);
52
+ i || h.set(e, i = /* @__PURE__ */ new Map()), i.set(t, n), g.set(n, {
53
+ group: e,
54
+ listener: t
55
+ });
56
+ }
57
+ function y(e, t) {
58
+ return h.get(e)?.get(t);
59
+ }
60
+ function b(e) {
61
+ delete _()[e];
62
+ let t = g.get(e);
63
+ if (t === void 0) return;
64
+ g.delete(e);
65
+ let n = h.get(t.group);
66
+ n?.delete(t.listener), n?.size === 0 && h.delete(t.group);
67
+ }
68
+ function x(e) {
69
+ for (let t of e) b(t);
70
+ }
71
+ var S = (e, t, n) => `${e}:${t}:${n === !0}`;
72
+ globalThis.__inca_released__ ??= (e, t) => {
73
+ let n, r = !1;
74
+ for (let e of t) try {
75
+ x([e]);
76
+ } catch (e) {
77
+ r || (n = e), r = !0;
78
+ }
79
+ if (f(e), r) throw n;
80
+ };
81
+ //#endregion
82
+ //#region src/events.mts
83
+ var C = 0;
84
+ function w() {
85
+ return C;
86
+ }
87
+ function T(e) {
88
+ return (...t) => {
89
+ let n = t[0]?.eventId;
90
+ return typeof n == "number" && n > C && (C = n), e(...t);
91
+ };
92
+ }
93
+ function E(t, n, r, i = {}) {
94
+ if (r == null) return;
95
+ let a = S(t, n, i.capture);
96
+ if (y(a, r) !== void 0) return;
97
+ let o = (...e) => typeof r == "function" ? r.apply(e[0]?.currentTarget, e) : r.handleEvent.apply(r, e), s = i.once ? (...e) => (D(t, n, r, i), o(...e)) : o;
98
+ v(a, r, e().addEventListener(t, n, i.capture === !0, i.passive === !0), T(s));
99
+ }
100
+ function D(t, n, r, i = {}) {
101
+ if (r == null) return;
102
+ let a = y(S(t, n, i.capture), r);
103
+ a !== void 0 && (e().removeEventListener(t, n, a), b(a));
104
+ }
105
+ function O(t, n) {
106
+ return e().dispatchEvent(t, n);
107
+ }
108
+ function k(t) {
109
+ e().click(t);
110
+ }
111
+ function A(t, n) {
112
+ n === void 0 ? e().focusNode(t) : e().focusNode(t, n);
113
+ }
114
+ function j(t) {
115
+ e().blurNode(t);
116
+ }
117
+ //#endregion
118
+ //#region src/eventTarget.mts
119
+ function M(e, t = []) {
120
+ return {
121
+ addEventListener(n, r, i) {
122
+ let a = typeof i == "boolean" ? { capture: i } : i ?? {};
123
+ E(e(), n, r, {
124
+ ...a,
125
+ passive: a.passive ?? t.includes(n)
126
+ });
127
+ },
128
+ removeEventListener(t, n, r) {
129
+ let i = typeof r == "boolean" ? r : r?.capture;
130
+ D(e(), t, n, { capture: i });
131
+ },
132
+ dispatchEvent: (t) => O(e(), t)
133
+ };
134
+ }
135
+ //#endregion
136
+ //#region src/tree.mts
137
+ function N() {
138
+ return e().rootNodeId();
139
+ }
140
+ function P(t) {
141
+ return e().createNode(t);
142
+ }
143
+ function F(t, n) {
144
+ e().appendChild(t, n);
145
+ }
146
+ function I(t, n, r) {
147
+ e().insertBefore(t, n, r);
148
+ }
149
+ function L(t, n) {
150
+ e().removeChild(t, n);
151
+ }
152
+ function R(t) {
153
+ x(e().destroyNode(t));
154
+ }
155
+ function z(t) {
156
+ e().holdNode(t);
157
+ }
158
+ function B(t) {
159
+ e().releaseNode(t);
160
+ }
161
+ function V(t, n, r) {
162
+ e().setAttribute(t, n, r);
163
+ }
164
+ function H(t, n) {
165
+ return e().getAttribute(t, n);
166
+ }
167
+ function U(t) {
168
+ return e().layoutOf(t);
169
+ }
170
+ function W(t) {
171
+ return e().scrollOf(t);
172
+ }
173
+ function G(t, n, r) {
174
+ e().scrollNode(t, n, r);
175
+ }
176
+ function K(t, n, r) {
177
+ e().scrollIntoViewNode(t, n, r);
178
+ }
179
+ function q(t, n) {
180
+ e().removeAttribute(t, n);
181
+ }
182
+ function J(t, n, r) {
183
+ e().setStyle(t, n, r);
184
+ }
185
+ function Y(t, n) {
186
+ e().removeStyle(t, n);
187
+ }
188
+ function X() {
189
+ return e().focusedNode();
190
+ }
191
+ //#endregion
192
+ //#region src/window.mts
193
+ var Z = /* @__PURE__ */ Object.defineProperty(M(N, ["wheel"]), Symbol.toStringTag, { value: "Window" });
194
+ //#endregion
195
+ //#region src/targets.mts
196
+ globalThis.__inca_targets__ ??= (e) => {
197
+ let t = N();
198
+ return e.map((e) => e === t ? Z : c(e) ?? null);
199
+ };
200
+ //#endregion
201
+ export { r as A, k as C, D, w as E, o as M, m as N, c as O, n as P, j as S, A as T, W as _, X as a, M as b, I as c, q as d, L as f, G as g, K as h, R as i, d as j, u as k, U as l, N as m, F as n, H as o, Y as p, P as r, z as s, Z as t, B as u, V as v, O as w, E as x, J as y };
@@ -0,0 +1,110 @@
1
+ import { C as e, D as t, E as n, N as r, P as i, S as a, T as o, _ as s, a as c, b as l, c as u, d, f, g as p, h as m, i as h, j as g, k as _, l as v, m as y, n as b, o as x, p as S, r as C, s as w, t as T, u as E, v as D, w as O, x as k, y as A } from "./hooks-BgB7lzTv.js";
2
+ import { n as j } from "./handle-6SBsiUWz.js";
3
+ //#region \0rolldown/runtime.js
4
+ var M = Object.defineProperty, N = (e, t) => {
5
+ let n = {};
6
+ for (var r in e) M(n, r, {
7
+ get: e[r],
8
+ enumerable: !0
9
+ });
10
+ return t || M(n, Symbol.toStringTag, { value: "Module" }), n;
11
+ };
12
+ //#endregion
13
+ //#region src/element/shadowTree.mts
14
+ function P(e) {
15
+ let t = C(e);
16
+ return j(t, "element", e);
17
+ }
18
+ function F(e) {
19
+ let t = C("text");
20
+ return D(t, "value", e), i({
21
+ kind: "text",
22
+ parent: null,
23
+ text: e
24
+ }, t);
25
+ }
26
+ function I() {
27
+ let e = C("div");
28
+ return A(e, "display", "none"), j(e, "comment");
29
+ }
30
+ function L(e, t) {
31
+ D(e.__node_id, "value", t), e.text = t;
32
+ }
33
+ function R(e, t) {
34
+ for (let t of e.children.splice(0)) h(t.__node_id), g(t), t.parent = null;
35
+ if (!t) return;
36
+ let n = F(t);
37
+ b(e.__node_id, n.__node_id), n.parent = e, e.children.push(n);
38
+ }
39
+ function z(e) {
40
+ let t = e.parent;
41
+ if (!t) return;
42
+ let n = t.children.indexOf(e);
43
+ n !== -1 && t.children.splice(n, 1), e.parent = null;
44
+ }
45
+ function B(e) {
46
+ e.parent && f(e.parent.__node_id, e.__node_id), z(e);
47
+ }
48
+ function V(e, t, n) {
49
+ if (n === e && e.parent === t) return;
50
+ B(e);
51
+ let r = n ? t.children.indexOf(n) : -1;
52
+ u(t.__node_id, e.__node_id, n && r !== -1 ? n.__node_id : null), r === -1 ? t.children.push(e) : t.children.splice(r, 0, e), e.parent = t;
53
+ }
54
+ function H(e) {
55
+ z(e), h(e.__node_id), g(e);
56
+ }
57
+ function U(e) {
58
+ return e.parent;
59
+ }
60
+ function W(e) {
61
+ let t = e.parent;
62
+ if (!t) return null;
63
+ let n = t.children.indexOf(e);
64
+ return t.children[n + 1] ?? null;
65
+ }
66
+ //#endregion
67
+ //#region src/rendererCore.mts
68
+ var G = /* @__PURE__ */ N({
69
+ addEventListener: () => k,
70
+ appendChild: () => b,
71
+ blur: () => a,
72
+ click: () => e,
73
+ createCommentNode: () => I,
74
+ createElementNode: () => P,
75
+ createEventTarget: () => l,
76
+ createIncaElement: () => j,
77
+ createNode: () => C,
78
+ createTextNode: () => F,
79
+ destroyNode: () => h,
80
+ dispatchEvent: () => O,
81
+ focus: () => o,
82
+ focusedNode: () => c,
83
+ getAttribute: () => x,
84
+ holdNode: () => w,
85
+ insert: () => V,
86
+ insertBefore: () => u,
87
+ isDestroyed: () => _,
88
+ latestEventId: () => n,
89
+ layoutOf: () => v,
90
+ nextSibling: () => W,
91
+ parentNode: () => U,
92
+ releaseNode: () => E,
93
+ releaseWhenCollected: () => r,
94
+ remove: () => H,
95
+ removeAttribute: () => d,
96
+ removeChild: () => f,
97
+ removeEventListener: () => t,
98
+ removeStyle: () => S,
99
+ rootNodeId: () => y,
100
+ scrollIntoViewNode: () => m,
101
+ scrollNode: () => p,
102
+ scrollOf: () => s,
103
+ setAttribute: () => D,
104
+ setElementText: () => R,
105
+ setStyle: () => A,
106
+ setText: () => L,
107
+ window: () => T
108
+ });
109
+ //#endregion
110
+ export { V as a, H as c, F as i, R as l, I as n, W as o, P as r, U as s, G as t, L as u };
@@ -0,0 +1,12 @@
1
+ import { IncaEventTarget } from '../types.mts';
2
+ import { EventHandlers } from './types.mts';
3
+ /** The events whose handler property every element has. */
4
+ export declare const HANDLER_EVENTS: readonly ["auxclick", "blur", "click", "contextmenu", "dblclick", "focus", "keydown", "keyup", "mousedown", "mouseenter", "mouseleave", "mousemove", "mouseout", "mouseover", "mouseup", "scroll", "wheel"];
5
+ /**
6
+ * Defines the event handler properties on `handle`. A value assigned while a property holds `null`
7
+ * registers a bubble listener through `handle.addEventListener`, and `null` removes it.
8
+ * @param handle - the element handle
9
+ * @param ignored - whether an assignment is ignored, as it is once the node is removed
10
+ * @returns `handle`, with the properties
11
+ */
12
+ export declare function withEventHandlers<T extends IncaEventTarget>(handle: T, ignored: () => boolean): T & EventHandlers;
@@ -1,32 +1,28 @@
1
- import { IncaCore } from '../rendererCore.mts';
2
1
  import { IncaElement } from './types.mts';
3
2
  /** `[x, y, width, height, border, scrollX, scrollY]` of a node's last drawn frame. */
4
3
  export type LayoutBox = readonly [number, number, number, number, number, number, number];
5
4
  /**
6
5
  * Reads the box a node was last drawn at. A destroyed node, or one with no
7
6
  * recorded box, yields `null`.
8
- * @param core - the incajs bindings to read through
9
7
  * @param el - the node to read
10
8
  * @returns the box, or `null`
11
9
  */
12
- export declare function layoutBox(core: IncaCore, el: IncaElement): LayoutBox | null;
10
+ export declare function layoutBox(el: IncaElement): LayoutBox | null;
13
11
  /**
14
12
  * The parent a node's offsets are measured from. It is the parent when both
15
13
  * the node and the parent have a recorded box.
16
- * @param core - the incajs bindings to read through
17
14
  * @param el - the node to query
18
15
  * @returns the parent, or `null`
19
16
  */
20
- export declare function offsetParentOf(core: IncaCore, el: IncaElement): IncaElement | null;
17
+ export declare function offsetParentOf(el: IncaElement): IncaElement | null;
21
18
  /**
22
19
  * Where a node sits inside the padding edge of its offset parent, rounded to
23
20
  * whole pixels. A node with no offset parent is measured from the window
24
21
  * origin.
25
- * @param core - the incajs bindings to read through
26
22
  * @param el - the node to measure
27
23
  * @returns `left` and `top`; both `0` when the node has no recorded box
28
24
  */
29
- export declare function offsetOf(core: IncaCore, el: IncaElement): {
25
+ export declare function offsetOf(el: IncaElement): {
30
26
  left: number;
31
27
  top: number;
32
28
  };
@@ -1,16 +1,16 @@
1
- import { IncaCore, NodeId, TagName } from '../rendererCore.mts';
1
+ import { NodeId, TagName } from '../types.mts';
2
2
  import { IncaElement } from './types.mts';
3
3
  /**
4
4
  * Builds the {@link IncaElement} handle for a native node: parentless,
5
- * childless, with `focus()`, `blur()`, `click()`, the listener methods of an
6
- * event target, `tabIndex` and the layout members, all driven through `core`.
7
- * @param core - the incajs bindings the handle drives
5
+ * childless, with `id`, `focus()`, `blur()`, `click()`, `contains()`, the
6
+ * listener methods of an event target, `tabIndex`, the layout members and the
7
+ * event handler properties, all driven through the host.
8
8
  * @param id - the native node's id
9
9
  * @param kind - whether the node is an element or a comment stand-in
10
10
  * @param tag - the node's element kind, if it has one; a `button` defaults to tab index `0`
11
11
  * @returns the new handle
12
12
  */
13
- export declare function createIncaElement(core: IncaCore, id: NodeId, kind: IncaElement["kind"], tag?: TagName): IncaElement;
13
+ export declare function createIncaElement(id: NodeId, kind: IncaElement["kind"], tag?: TagName): IncaElement;
14
14
  /**
15
15
  * Returns the element that currently has focus. A `focus()` or `blur()` call
16
16
  * takes effect for this function at once.
@@ -1,5 +1,20 @@
1
- import { NodeId } from '../rendererCore.mts';
1
+ import { NodeId } from '../types.mts';
2
2
  import { IncaElement, IncaNode } from './types.mts';
3
+ /**
4
+ * Gives `handle` a read-only, non-enumerable `__node_id`.
5
+ * @param handle - the new handle
6
+ * @param id - the native node's id
7
+ * @returns `handle`
8
+ */
9
+ export declare function withNodeId<T extends object>(handle: T, id: NodeId): T & {
10
+ readonly __node_id: NodeId;
11
+ };
12
+ /**
13
+ * Whether `value` is a node handle.
14
+ * @param value - the value to check
15
+ * @returns `true` for an element, a comment stand-in or a text handle
16
+ */
17
+ export declare function isNode(value: unknown): value is IncaNode;
3
18
  /**
4
19
  * Records `element` under its id.
5
20
  * @param element - the handle to record
@@ -1,4 +1,3 @@
1
- import { IncaCore } from '../rendererCore.mts';
2
1
  import { ScrollAlignment } from '../types.mts';
3
2
  import { IncaElement } from './types.mts';
4
3
  /** The options form of `scrollTo()` and `scrollBy()`. `behavior` is accepted and ignored. */
@@ -15,12 +14,11 @@ export type ScrollArgs = [left?: number, top?: number] | [options?: ScrollOption
15
14
  /**
16
15
  * Moves a node's scroll offset. An omitted axis keeps its offset, and a
17
16
  * non-finite value counts as `0`. A destroyed node ignores the call.
18
- * @param core - the incajs bindings to write through
19
17
  * @param el - the node to scroll
20
18
  * @param args - `(left, top)` or `{ left, top }`
21
19
  * @param relative - `true` adds the values to the current offset
22
20
  */
23
- export declare function scrollPosition(core: IncaCore, el: IncaElement, args: ScrollArgs, relative: boolean): void;
21
+ export declare function scrollPosition(el: IncaElement, args: ScrollArgs, relative: boolean): void;
24
22
  /** The options form of `scrollIntoView()`. `behavior` is accepted and ignored. */
25
23
  export interface ScrollIntoViewOptions {
26
24
  /** The vertical alignment. Defaults to `"start"`. */