incajs 0.0.22 → 0.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/chunks/hooks-N7NnMPKd.js +1 -0
  2. package/dist/chunks/rendererCore-B3-0H_IR.d.ts +385 -0
  3. package/dist/chunks/rendererCore-b4ytjgR8.js +1 -0
  4. package/dist/chunks/rolldown-runtime-DK3Fl9T5.js +1 -0
  5. package/dist/chunks/window-DD6KfOr9.d.ts +691 -0
  6. package/dist/index.d.ts +12 -0
  7. package/dist/index.js +1 -1
  8. package/dist/rendererCore.d.ts +3 -0
  9. package/dist/rendererCore.js +1 -3
  10. package/dist/vue-runtime.d.ts +3 -0
  11. package/dist/vue-runtime.js +1 -2
  12. package/dist/{vue/createApp.d.mts → vue.d.ts} +6 -4
  13. package/dist/vue.js +2 -178
  14. package/package.json +6 -18
  15. package/dist/callbacks.d.mts +0 -31
  16. package/dist/chunks/hooks-TbLjfN0c.js +0 -417
  17. package/dist/chunks/rendererCore-BUNTDvYu.js +0 -110
  18. package/dist/document.d.mts +0 -11
  19. package/dist/element/eventHandlers.d.mts +0 -12
  20. package/dist/element/geometry.d.mts +0 -61
  21. package/dist/element/handle.d.mts +0 -29
  22. package/dist/element/lifecycle.d.mts +0 -51
  23. package/dist/element/scroll.d.mts +0 -42
  24. package/dist/element/shadowTree.d.mts +0 -64
  25. package/dist/element/types.d.mts +0 -149
  26. package/dist/eventTarget.d.mts +0 -11
  27. package/dist/events.d.mts +0 -105
  28. package/dist/index.d.mts +0 -6
  29. package/dist/native.d.mts +0 -46
  30. package/dist/rendererCore.d.mts +0 -14
  31. package/dist/targets.d.mts +0 -1
  32. package/dist/tree.d.mts +0 -157
  33. package/dist/types.d.mts +0 -454
  34. package/dist/vue/index.d.mts +0 -2
  35. package/dist/vue/nodeOps.d.mts +0 -29
  36. package/dist/vue/patchProp.d.mts +0 -79
  37. package/dist/vue/runtime.d.mts +0 -2
  38. package/dist/window.d.mts +0 -13
@@ -1,417 +0,0 @@
1
- //#region src/element/eventHandlers.mts
2
- var e = /* @__PURE__ */ "auxclick.blur.click.contextmenu.dblclick.focus.gotpointercapture.keydown.keyup.lostpointercapture.mousedown.mouseenter.mouseleave.mousemove.mouseout.mouseover.mouseup.pointerdown.pointerenter.pointerleave.pointermove.pointerout.pointerover.pointerup.scroll.wheel".split(".");
3
- function t(t, n) {
4
- for (let r of e) {
5
- let e = null, i = function(t) {
6
- typeof e == "function" && Reflect.apply(e, this, [t]) === !1 && t.preventDefault();
7
- };
8
- Object.defineProperty(t, `on${r}`, {
9
- get: () => e,
10
- set(a) {
11
- n() || (e = typeof a == "function" || typeof a == "object" && a ? a : null, e === null ? t.removeEventListener(r, i) : t.addEventListener(r, i));
12
- }
13
- });
14
- }
15
- return t;
16
- }
17
- //#endregion
18
- //#region src/native.mts
19
- function n() {
20
- return globalThis.__inca_native__;
21
- }
22
- //#endregion
23
- //#region src/element/lifecycle.mts
24
- var r = /* @__PURE__ */ new WeakSet();
25
- function i(e, t) {
26
- return r.add(e), Object.defineProperty(e, "__node_id", { value: t });
27
- }
28
- function a(e) {
29
- return typeof e == "object" && !!e && r.has(e);
30
- }
31
- var o = /* @__PURE__ */ new Map(), s = new FinalizationRegistry((e) => {
32
- o.get(e)?.deref() || o.delete(e);
33
- });
34
- function c(e) {
35
- o.set(e.__node_id, new WeakRef(e)), s.register(e, e.__node_id);
36
- }
37
- function l(e) {
38
- o.delete(e);
39
- }
40
- function u(e) {
41
- return o.get(e)?.deref();
42
- }
43
- var d = /* @__PURE__ */ new WeakSet();
44
- function f(e) {
45
- return d.has(e);
46
- }
47
- function p(e) {
48
- if (d.add(e), e.kind !== "text") {
49
- l(e.__node_id);
50
- for (let t of e.children) p(t);
51
- }
52
- }
53
- function m(e) {
54
- for (let t of e) {
55
- let e = u(t);
56
- e && p(e);
57
- }
58
- }
59
- var ee = new FinalizationRegistry((e) => n().releaseNode(e));
60
- function te(e) {
61
- ee.register(e, e.__node_id);
62
- }
63
- //#endregion
64
- //#region src/callbacks.mts
65
- var h = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), _ = () => globalThis.__inca_callbacks__ ??= {};
66
- function v(e, t, n, r) {
67
- _()[n] = r;
68
- let i = h.get(e);
69
- i || h.set(e, i = /* @__PURE__ */ new Map()), i.set(t, n), g.set(n, {
70
- group: e,
71
- listener: t
72
- });
73
- }
74
- function y(e, t) {
75
- return h.get(e)?.get(t);
76
- }
77
- function b(e) {
78
- delete _()[e];
79
- let t = g.get(e);
80
- if (t === void 0) return;
81
- g.delete(e);
82
- let n = h.get(t.group);
83
- n?.delete(t.listener), n?.size === 0 && h.delete(t.group);
84
- }
85
- function x(e) {
86
- for (let t of e) b(t);
87
- }
88
- var S = (e, t, n) => `${e}:${t}:${n === !0}`;
89
- Object.defineProperty(globalThis, "__inca_released__", {
90
- value: (e, t) => {
91
- let n, r = !1;
92
- for (let e of t) try {
93
- x([e]);
94
- } catch (e) {
95
- r || (n = e), r = !0;
96
- }
97
- if (m(e), r) throw n;
98
- },
99
- configurable: !0
100
- });
101
- //#endregion
102
- //#region src/events.mts
103
- var C = 0;
104
- function ne() {
105
- return C;
106
- }
107
- function w(e) {
108
- return (...t) => {
109
- let n = t[0]?.eventId;
110
- return typeof n == "number" && n > C && (C = n), e(...t);
111
- };
112
- }
113
- function T(e, t, r, i = {}) {
114
- if (r == null) return;
115
- let a = S(e, t, i.capture);
116
- if (y(a, r) !== void 0) return;
117
- let o = (...e) => typeof r == "function" ? r.apply(e[0]?.currentTarget, e) : r.handleEvent.apply(r, e), s = i.once ? (...n) => (E(e, t, r, i), o(...n)) : o;
118
- v(a, r, n().addEventListener(e, t, i.capture === !0, i.passive === !0), w(s));
119
- }
120
- function E(e, t, r, i = {}) {
121
- if (r == null) return;
122
- let a = y(S(e, t, i.capture), r);
123
- a !== void 0 && (n().removeEventListener(e, t, a), b(a));
124
- }
125
- function D(e, t) {
126
- return n().dispatchEvent(e, t);
127
- }
128
- function O(e) {
129
- n().click(e);
130
- }
131
- function k(e, t) {
132
- n().focusNode(e, t);
133
- }
134
- function A(e) {
135
- n().blurNode(e);
136
- }
137
- function j(e, t) {
138
- n().setPointerCapture(e, t);
139
- }
140
- function M(e, t) {
141
- n().releasePointerCapture(e, t);
142
- }
143
- function N(e, t) {
144
- return n().hasPointerCapture(e, t);
145
- }
146
- //#endregion
147
- //#region src/eventTarget.mts
148
- function P(e, t = []) {
149
- let n = typeof e == "function" ? e : () => e;
150
- return {
151
- addEventListener(e, r, i) {
152
- let a = typeof i == "boolean" ? { capture: i } : i ?? {};
153
- T(n(), e, r, {
154
- ...a,
155
- passive: a.passive ?? t.includes(e)
156
- });
157
- },
158
- removeEventListener(e, t, r) {
159
- let i = typeof r == "boolean" ? r : r?.capture;
160
- E(n(), e, t, { capture: i });
161
- },
162
- dispatchEvent: (e) => D(n(), e)
163
- };
164
- }
165
- //#endregion
166
- //#region src/tree.mts
167
- function F() {
168
- return n().rootNodeId();
169
- }
170
- function re(e) {
171
- return n().createNode(e);
172
- }
173
- function ie(e, t) {
174
- n().appendChild(e, t);
175
- }
176
- function ae(e, t, r) {
177
- n().insertBefore(e, t, r);
178
- }
179
- function oe(e, t) {
180
- n().removeChild(e, t);
181
- }
182
- function se(e) {
183
- x(n().destroyNode(e));
184
- }
185
- function ce(e) {
186
- n().holdNode(e);
187
- }
188
- function le(e) {
189
- n().releaseNode(e);
190
- }
191
- function I(e, t, r) {
192
- n().setAttribute(e, t, r);
193
- }
194
- function L(e, t) {
195
- return n().getAttribute(e, t);
196
- }
197
- function R(e) {
198
- return n().layoutOf(e);
199
- }
200
- function z(e) {
201
- return n().scrollOf(e);
202
- }
203
- function B(e, t, r) {
204
- n().scrollNode(e, t, r);
205
- }
206
- function V(e, t, r) {
207
- n().scrollIntoViewNode(e, t, r);
208
- }
209
- function H(e, t) {
210
- n().removeAttribute(e, t);
211
- }
212
- function U(e, t, r) {
213
- n().setStyle(e, t, r);
214
- }
215
- function ue(e, t) {
216
- n().removeStyle(e, t);
217
- }
218
- function W() {
219
- return n().focusedNode();
220
- }
221
- //#endregion
222
- //#region src/element/geometry.mts
223
- function G(e) {
224
- return f(e) ? null : R(e.__node_id);
225
- }
226
- function K(e) {
227
- let t = e.parent;
228
- return !G(e) || !t || !G(t) ? null : t;
229
- }
230
- function q(e) {
231
- let t = G(e);
232
- if (!t) return {
233
- left: 0,
234
- top: 0
235
- };
236
- let n = K(e), r = n ? G(n) : null;
237
- return {
238
- left: Math.round(t[0] - (r ? r[0] + r[4] : 0) + t[5]) || 0,
239
- top: Math.round(t[1] - (r ? r[1] + r[4] : 0) + t[6]) || 0
240
- };
241
- }
242
- function J(e) {
243
- let [t, n, r, i] = e ?? [
244
- 0,
245
- 0,
246
- 0,
247
- 0,
248
- 0
249
- ], a = {
250
- x: t,
251
- y: n,
252
- width: r,
253
- height: i,
254
- top: n,
255
- left: t,
256
- right: t + r,
257
- bottom: n + i
258
- };
259
- return {
260
- ...a,
261
- toJSON: () => ({ ...a })
262
- };
263
- }
264
- function de(e, t) {
265
- let n = t === "button" ? 0 : -1;
266
- if (typeof e != "string" && typeof e != "number") return n;
267
- let r = /^[\t\n\f\r ]*([+-]?\d+)/.exec(String(e));
268
- if (!r) return n;
269
- let i = Number(r[1]) || 0;
270
- return i >= -2147483648 && i <= 2147483647 ? i : n;
271
- }
272
- //#endregion
273
- //#region src/element/scroll.mts
274
- function Y(e, t, n) {
275
- if (f(e)) return;
276
- let [r, i] = t, [a, o] = typeof r == "object" ? [r?.left, r?.top] : [r, i], [s, c] = n ? z(e.__node_id) ?? [0, 0] : [0, 0], l = (e, t) => {
277
- if (e === void 0) return null;
278
- let r = Number(e);
279
- return (n ? t : 0) + (Number.isFinite(r) ? r : 0);
280
- };
281
- B(e.__node_id, l(a, s), l(o, c));
282
- }
283
- function fe(e) {
284
- let t = [
285
- "start",
286
- "center",
287
- "end",
288
- "nearest"
289
- ];
290
- return typeof e == "object" && e ? {
291
- block: t.includes(e.block ?? "") ? e.block : "start",
292
- inline: t.includes(e.inline ?? "") ? e.inline : "nearest"
293
- } : {
294
- block: e === !1 ? "end" : "start",
295
- inline: "nearest"
296
- };
297
- }
298
- //#endregion
299
- //#region src/element/handle.mts
300
- function X(e, n, r, o = []) {
301
- let s = P(() => e, o), l = () => f(u) ? null : z(e), u = t(i({
302
- get id() {
303
- return f(u) ? "" : String(L(e, "id") ?? "");
304
- },
305
- set id(t) {
306
- f(u) || I(e, "id", String(t));
307
- },
308
- kind: n,
309
- parent: null,
310
- children: [],
311
- focus: (t) => {
312
- f(u) || k(e, !!t?.preventScroll);
313
- },
314
- blur: () => A(e),
315
- click: () => {
316
- f(u) || O(e);
317
- },
318
- setPointerCapture: (t) => j(e, t),
319
- releasePointerCapture: (t) => M(e, t),
320
- hasPointerCapture: (t) => N(e, t),
321
- contains: (e) => {
322
- if (e == null) return !1;
323
- if (!a(e)) throw TypeError("the value is not a node. pass an element, a text node or null");
324
- for (let t = e; t !== null; t = t.parent) if (t === u) return !0;
325
- return !1;
326
- },
327
- addEventListener: (...e) => {
328
- f(u) || s.addEventListener(...e);
329
- },
330
- removeEventListener: (...e) => {
331
- f(u) || s.removeEventListener(...e);
332
- },
333
- dispatchEvent: (e) => f(u) || s.dispatchEvent(e),
334
- get tabIndex() {
335
- return de(f(u) ? null : L(e, "tabindex"), r ?? "");
336
- },
337
- set tabIndex(t) {
338
- f(u) || I(e, "tabindex", t | 0);
339
- },
340
- getBoundingClientRect: () => J(G(u)),
341
- get offsetWidth() {
342
- return Math.round(G(u)?.[2] ?? 0);
343
- },
344
- get offsetHeight() {
345
- return Math.round(G(u)?.[3] ?? 0);
346
- },
347
- get offsetLeft() {
348
- return q(u).left;
349
- },
350
- get offsetTop() {
351
- return q(u).top;
352
- },
353
- get offsetParent() {
354
- return K(u);
355
- },
356
- get clientWidth() {
357
- let e = G(u);
358
- return e ? Math.max(0, Math.round(e[2] - 2 * e[4])) : 0;
359
- },
360
- get clientHeight() {
361
- let e = G(u);
362
- return e ? Math.max(0, Math.round(e[3] - 2 * e[4])) : 0;
363
- },
364
- get clientLeft() {
365
- return Math.round(G(u)?.[4] ?? 0);
366
- },
367
- get clientTop() {
368
- return Math.round(G(u)?.[4] ?? 0);
369
- },
370
- get scrollLeft() {
371
- return l()?.[0] ?? 0;
372
- },
373
- set scrollLeft(e) {
374
- Y(u, [e], !1);
375
- },
376
- get scrollTop() {
377
- return l()?.[1] ?? 0;
378
- },
379
- set scrollTop(e) {
380
- Y(u, [void 0, e], !1);
381
- },
382
- get scrollWidth() {
383
- return u.clientWidth + Math.round(l()?.[2] ?? 0);
384
- },
385
- get scrollHeight() {
386
- return u.clientHeight + Math.round(l()?.[3] ?? 0);
387
- },
388
- scrollTo: (...e) => Y(u, e, !1),
389
- scrollBy: (...e) => Y(u, e, !0),
390
- scrollIntoView: (t) => {
391
- if (f(u)) return;
392
- let { block: n, inline: r } = fe(t);
393
- V(e, n, r);
394
- }
395
- }, e), () => f(u));
396
- return n === "element" && c(u), u;
397
- }
398
- function pe() {
399
- let e = W();
400
- return e === null ? null : u(e) ?? null;
401
- }
402
- function Z() {
403
- let e = F();
404
- return u(e) ?? X(e, "element", void 0, ["wheel"]);
405
- }
406
- //#endregion
407
- //#region src/document.mts
408
- var Q = /* @__PURE__ */ Object.defineProperties(t(P("$document", ["wheel"]), () => !1), {
409
- [Symbol.toStringTag]: { value: "Document" },
410
- activeElement: { get: pe }
411
- }), $ = /* @__PURE__ */ Object.defineProperty(t(P("$window", ["wheel"]), () => !1), Symbol.toStringTag, { value: "Window" });
412
- Object.defineProperty(globalThis, "__inca_targets__", {
413
- value: (e) => e.map((e) => e === "$document" ? Q : e === "$window" ? $ : u(e) ?? (e === F() ? Z() : null)),
414
- configurable: !0
415
- });
416
- //#endregion
417
- export { E as A, P as C, D, O as E, p as M, te as N, k as O, i as P, U as S, A as T, F as _, ie as a, z as b, W as c, ae as d, R as f, ue as g, oe as h, Z as i, f as j, ne as k, L as l, H as m, Q as n, re as o, le as p, X as r, se as s, $ as t, ce as u, V as v, T as w, I as x, B as y };
@@ -1,110 +0,0 @@
1
- import { A as e, C as t, D as n, E as r, M as i, N as a, O as o, P as s, S as c, T as l, _ as u, a as d, b as f, c as p, d as m, f as h, g, h as _, i as v, j as y, k as b, l as x, m as S, o as C, p as w, r as T, s as E, t as D, u as O, v as k, w as A, x as j, y as M } from "./hooks-TbLjfN0c.js";
2
- //#region \0rolldown/runtime.js
3
- var N = Object.defineProperty, P = (e, t) => {
4
- let n = {};
5
- for (var r in e) N(n, r, {
6
- get: e[r],
7
- enumerable: !0
8
- });
9
- return t || N(n, Symbol.toStringTag, { value: "Module" }), n;
10
- };
11
- //#endregion
12
- //#region src/element/shadowTree.mts
13
- function F(e) {
14
- let t = C(e);
15
- return T(t, "element", e);
16
- }
17
- function I(e) {
18
- let t = C("text");
19
- return j(t, "value", e), s({
20
- kind: "text",
21
- parent: null,
22
- text: e
23
- }, t);
24
- }
25
- function L() {
26
- let e = C("div");
27
- return c(e, "display", "none"), T(e, "comment");
28
- }
29
- function R(e, t) {
30
- j(e.__node_id, "value", t), e.text = t;
31
- }
32
- function z(e, t) {
33
- for (let t of e.children.splice(0)) E(t.__node_id), i(t), t.parent = null;
34
- if (!t) return;
35
- let n = I(t);
36
- d(e.__node_id, n.__node_id), n.parent = e, e.children.push(n);
37
- }
38
- function B(e) {
39
- let t = e.parent;
40
- if (!t) return;
41
- let n = t.children.indexOf(e);
42
- n !== -1 && t.children.splice(n, 1), e.parent = null;
43
- }
44
- function V(e) {
45
- e.parent && _(e.parent.__node_id, e.__node_id), B(e);
46
- }
47
- function H(e, t, n) {
48
- if (n === e && e.parent === t) return;
49
- V(e);
50
- let r = n ? t.children.indexOf(n) : -1;
51
- m(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;
52
- }
53
- function U(e) {
54
- B(e), E(e.__node_id), i(e);
55
- }
56
- function W(e) {
57
- return e.parent;
58
- }
59
- function G(e) {
60
- let t = e.parent;
61
- if (!t) return null;
62
- let n = t.children.indexOf(e);
63
- return t.children[n + 1] ?? null;
64
- }
65
- //#endregion
66
- //#region src/rendererCore.mts
67
- var K = /* @__PURE__ */ P({
68
- addEventListener: () => A,
69
- appendChild: () => d,
70
- blur: () => l,
71
- click: () => r,
72
- createCommentNode: () => L,
73
- createElementNode: () => F,
74
- createEventTarget: () => t,
75
- createIncaElement: () => T,
76
- createNode: () => C,
77
- createTextNode: () => I,
78
- destroyNode: () => E,
79
- dispatchEvent: () => n,
80
- focus: () => o,
81
- focusedNode: () => p,
82
- getAttribute: () => x,
83
- holdNode: () => O,
84
- insert: () => H,
85
- insertBefore: () => m,
86
- isDestroyed: () => y,
87
- latestEventId: () => b,
88
- layoutOf: () => h,
89
- nextSibling: () => G,
90
- parentNode: () => W,
91
- releaseNode: () => w,
92
- releaseWhenCollected: () => a,
93
- remove: () => U,
94
- removeAttribute: () => S,
95
- removeChild: () => _,
96
- removeEventListener: () => e,
97
- removeStyle: () => g,
98
- rootElement: () => v,
99
- rootNodeId: () => u,
100
- scrollIntoViewNode: () => k,
101
- scrollNode: () => M,
102
- scrollOf: () => f,
103
- setAttribute: () => j,
104
- setElementText: () => z,
105
- setStyle: () => c,
106
- setText: () => R,
107
- window: () => D
108
- });
109
- //#endregion
110
- export { H as a, U as c, I as i, z as l, L as n, G as o, F as r, W as s, K as t, R as u };
@@ -1,11 +0,0 @@
1
- import { IncaDocument } from './types.mts';
2
- /**
3
- * The event target between the elements and `window`. An event at an element
4
- * passes through it, and it is the next target after the mount container.
5
- *
6
- * It has the listener methods `addEventListener`, `removeEventListener` and
7
- * `dispatchEvent`, the event handler properties such as `onkeydown`, and
8
- * `activeElement`. A `wheel` listener is passive unless its options say
9
- * `passive: false`.
10
- */
11
- export declare const document: IncaDocument;
@@ -1,12 +0,0 @@
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", "gotpointercapture", "keydown", "keyup", "lostpointercapture", "mousedown", "mouseenter", "mouseleave", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointerenter", "pointerleave", "pointermove", "pointerout", "pointerover", "pointerup", "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,61 +0,0 @@
1
- import { IncaElement } from './types.mts';
2
- /** `[x, y, width, height, border, scrollX, scrollY]` of a node's last drawn frame. */
3
- export type LayoutBox = readonly [number, number, number, number, number, number, number];
4
- /**
5
- * Reads the box a node was last drawn at. A destroyed node, or one with no
6
- * recorded box, yields `null`.
7
- * @param el - the node to read
8
- * @returns the box, or `null`
9
- */
10
- export declare function layoutBox(el: IncaElement): LayoutBox | null;
11
- /**
12
- * The parent a node's offsets are measured from. It is the parent when both
13
- * the node and the parent have a recorded box.
14
- * @param el - the node to query
15
- * @returns the parent, or `null`
16
- */
17
- export declare function offsetParentOf(el: IncaElement): IncaElement | null;
18
- /**
19
- * Where a node sits inside the padding edge of its offset parent, rounded to
20
- * whole pixels. A node with no offset parent is measured from the window
21
- * origin.
22
- * @param el - the node to measure
23
- * @returns `left` and `top`; both `0` when the node has no recorded box
24
- */
25
- export declare function offsetOf(el: IncaElement): {
26
- left: number;
27
- top: number;
28
- };
29
- /** The plain values of a {@link RectLike}, as `toJSON` returns them. */
30
- export interface RectValues {
31
- readonly x: number;
32
- readonly y: number;
33
- readonly width: number;
34
- readonly height: number;
35
- readonly top: number;
36
- readonly left: number;
37
- readonly right: number;
38
- readonly bottom: number;
39
- }
40
- /**
41
- * A rectangle with its position, its size and its four edges. `toJSON()` returns
42
- * the plain values.
43
- */
44
- export interface RectLike extends RectValues {
45
- toJSON(): RectValues;
46
- }
47
- /**
48
- * Builds a rect from a node's box. Values stay unrounded.
49
- * @param layout - the box from {@link LayoutBox}, or `null` for no record
50
- * @returns the rect; all zeros for `null`
51
- */
52
- export declare function rectOf(layout: LayoutBox | null): RectLike;
53
- /**
54
- * Reads a `tabindex` attribute value as the element's tab index. A value that
55
- * is missing, not a string or number, has no leading integer, or falls outside
56
- * the 32-bit signed range yields the default.
57
- * @param value - the stored `tabindex` attribute, or `null` if unset
58
- * @param kind - the element kind; `"button"` defaults to `0`, any other kind to `-1`
59
- * @returns the parsed tab index, or the default
60
- */
61
- export declare function tabIndexOf(value: string | number | boolean | null, kind: string): number;
@@ -1,29 +0,0 @@
1
- import { NodeId, TagName } from '../types.mts';
2
- import { IncaElement } from './types.mts';
3
- /**
4
- * Builds the {@link IncaElement} handle for a native node: parentless,
5
- * childless, with `id`, `focus()`, `blur()`, `click()`, the pointer capture
6
- * methods, `contains()`, the listener methods of an event target, `tabIndex`,
7
- * the layout members and the event handler properties, all driven through the
8
- * host.
9
- * @param id - the native node's id
10
- * @param kind - whether the node is an element or a comment stand-in
11
- * @param tag - the node's element kind, if it has one; a `button` defaults to tab index `0`
12
- * @param passiveByDefault - event names whose listeners are passive unless their options say
13
- * `passive: false`
14
- * @returns the new handle
15
- */
16
- export declare function createIncaElement(id: NodeId, kind: IncaElement["kind"], tag?: TagName, passiveByDefault?: readonly string[]): IncaElement;
17
- /**
18
- * Returns the element that currently has focus. A `focus()` or `blur()` call
19
- * takes effect for this function at once.
20
- * @returns the focused element, or `null` when no element has focus
21
- */
22
- export declare function activeElement(): IncaElement | null;
23
- /**
24
- * Returns the handle of the host's mount container, which stands between the app's elements and
25
- * `document` in an event path. A live handle is reused, so a mount and an event see one object.
26
- * A `wheel` listener on it is passive unless its options say `passive: false`.
27
- * @returns the mount container's handle
28
- */
29
- export declare function rootElement(): IncaElement;
@@ -1,51 +0,0 @@
1
- import { NodeId } from '../types.mts';
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;
18
- /**
19
- * Records `element` under its id.
20
- * @param element - the handle to record
21
- */
22
- export declare function registerElement(element: IncaElement): void;
23
- /**
24
- * Drops the record of a native node.
25
- * @param id - the native node's id
26
- */
27
- export declare function unregisterElement(id: NodeId): void;
28
- /**
29
- * Counts the recorded nodes, including those whose handle is already collected
30
- * and waits for the registry to drop it.
31
- * @returns the number of records
32
- */
33
- export declare function recordedCount(): number;
34
- /**
35
- * Looks up the live handle of a native node.
36
- * @param id - the native node's id
37
- * @returns the handle, or `undefined` when none is live
38
- */
39
- export declare function elementOf(id: NodeId): IncaElement | undefined;
40
- /**
41
- * Whether the host freed `node` with its subtree.
42
- * @param node - the handle to check
43
- * @returns `true` after {@link markDestroyed} reached `node`
44
- */
45
- export declare function isDestroyed(node: IncaNode): boolean;
46
- /**
47
- * Records that the host freed `node` and every descendant of it, and drops
48
- * their element handles from the registry.
49
- * @param node - the root of the freed subtree
50
- */
51
- export declare function markDestroyed(node: IncaNode): void;