incajs 0.0.19 → 0.0.21

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.
@@ -7,13 +7,13 @@ 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<never>, callbackId: CallbackId, callable: HostCallback): void;
10
+ export declare function addCallback(group: string, listener: EventListenerOrObject<never, 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<never>): CallbackId | undefined;
16
+ export declare function callbackIdFor(group: string, listener: EventListenerOrObject<never, 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.
@@ -1,4 +1,4 @@
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-COUJ5IPe.js";
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-D1NFQN8Q.js";
2
2
  //#region src/element/eventHandlers.mts
3
3
  var g = [
4
4
  "auxclick",
@@ -124,12 +124,12 @@ function T(r, c, u) {
124
124
  parent: null,
125
125
  children: [],
126
126
  focus: (e) => {
127
- if (f(T)) return;
128
- let t = e?.preventScroll;
129
- t === void 0 ? o(r) : o(r, !!t);
127
+ f(T) || o(r, !!e?.preventScroll);
130
128
  },
131
129
  blur: () => a(r),
132
- click: () => t(r),
130
+ click: () => {
131
+ f(T) || t(r);
132
+ },
133
133
  contains: (t) => {
134
134
  if (t == null) return !1;
135
135
  if (!e(t)) throw TypeError("the value is not a node. pass an element, a text node or null");
@@ -112,7 +112,7 @@ function k(t) {
112
112
  e().click(t);
113
113
  }
114
114
  function A(t, n) {
115
- n === void 0 ? e().focusNode(t) : e().focusNode(t, n);
115
+ e().focusNode(t, n);
116
116
  }
117
117
  function j(t) {
118
118
  e().blurNode(t);
@@ -1,5 +1,5 @@
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-COUJ5IPe.js";
2
- import { n as j } from "./handle-C_4KtGsE.js";
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-D1NFQN8Q.js";
2
+ import { n as j } from "./handle-DdYIkUcm.js";
3
3
  //#region \0rolldown/runtime.js
4
4
  var M = Object.defineProperty, N = (e, t) => {
5
5
  let n = {};
@@ -1,15 +1,15 @@
1
- import { IncaEvent, IncaEventTarget } from '../types.mts';
1
+ import { IncaEvent, IncaEventMap, IncaEventTarget } from '../types.mts';
2
2
  import { HANDLER_EVENTS } from './eventHandlers.mts';
3
3
  import { RectLike } from './geometry.mts';
4
4
  import { ScrollIntoViewOptions, ScrollOptions } from './scroll.mts';
5
5
  /** A function an event handler property holds, called with the element as `this` and the event. */
6
- export type EventHandler = (this: IncaElement, event: IncaEvent) => unknown;
6
+ export type EventHandler<E = IncaEvent> = (this: IncaElement, event: E) => unknown;
7
7
  /**
8
8
  * The event handler properties, such as `onclick`, of the events the host dispatches, `focusin` and
9
9
  * `focusout` excepted.
10
10
  */
11
11
  export type EventHandlers = {
12
- [K in (typeof HANDLER_EVENTS)[number] as `on${K}`]: EventHandler | object | null;
12
+ [K in (typeof HANDLER_EVENTS)[number] as `on${K}`]: EventHandler<IncaEventMap[K]> | object | null;
13
13
  };
14
14
  /**
15
15
  * A container node: either a real element or the hidden stand-in that
@@ -48,8 +48,9 @@ export interface IncaElement extends IncaEventTarget, EventHandlers {
48
48
  /** Unfocuses this node next frame, if it is the focused one. */
49
49
  blur(): void;
50
50
  /**
51
- * Fires an untrusted `click` at this node. A disabled `button`, a node whose
52
- * own click is still running and an unknown node ignore the call.
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.
53
54
  */
54
55
  click(): void;
55
56
  /**
package/dist/events.d.mts CHANGED
@@ -11,7 +11,7 @@ export declare function latestEventId(): number;
11
11
  * registration keeps its other options. A `null` listener is ignored.
12
12
  *
13
13
  * Any event name is accepted, and it fires when the host dispatches that name.
14
- * See the `IncaEvent` type for the fields an event carries.
14
+ * `IncaEventMap` gives the event type of each name the host dispatches.
15
15
  * @param nodeId - the node to listen on
16
16
  * @param event - the event name (e.g. `"click"`)
17
17
  * @param listener - a function, called with the event's `currentTarget` as
@@ -24,7 +24,7 @@ export declare function latestEventId(): number;
24
24
  * @throws TypeError when `nodeId` names no node
25
25
  * @throws RangeError when the host has issued its last callback id
26
26
  */
27
- export declare function addEventListener(nodeId: NodeId, event: string, listener: EventListenerOrObject<never> | null, options?: ListenerOptions): void;
27
+ export declare function addEventListener(nodeId: NodeId, event: string, listener: EventListenerOrObject<never, never> | null, options?: ListenerOptions): void;
28
28
  /**
29
29
  * Drops the registration {@link addEventListener} made for `listener` on
30
30
  * `nodeId` with the same `event` and `capture`. A no-op if there is none.
@@ -33,7 +33,7 @@ export declare function addEventListener(nodeId: NodeId, event: string, listener
33
33
  * @param listener - the listener that was registered
34
34
  * @param options - `capture` of the registration to drop
35
35
  */
36
- export declare function removeEventListener(nodeId: NodeId, event: string, listener: EventListenerOrObject<never> | null, options?: Pick<ListenerOptions, "capture">): void;
36
+ export declare function removeEventListener(nodeId: NodeId, event: string, listener: EventListenerOrObject<never, never> | null, options?: Pick<ListenerOptions, "capture">): void;
37
37
  /**
38
38
  * Dispatches `event` at `nodeId` along the path to the root.
39
39
  * @param nodeId - the node to dispatch at
@@ -41,15 +41,16 @@ export declare function removeEventListener(nodeId: NodeId, event: string, liste
41
41
  * @returns `false` when a listener canceled a cancelable event, else `true`
42
42
  * @throws TypeError when `nodeId` is malformed
43
43
  * @throws TypeError when `nodeId` names no node
44
- * @throws TypeError when `event` is not an `Event` or `CustomEvent`
44
+ * @throws TypeError when `event` is not an event built with an event constructor
45
45
  * @throws DOMException named `InvalidStateError` when `event` is being dispatched
46
46
  */
47
47
  export declare function dispatchEvent(nodeId: NodeId, event: EventLike): boolean;
48
48
  /**
49
- * Fires an untrusted `click` at `nodeId`. A disabled `button`, a node whose
50
- * own click is still running and an unknown node ignore the call.
49
+ * Fires an untrusted `click` at `nodeId`. A disabled `button` and a node whose
50
+ * own click is still running ignore the call.
51
51
  * @param nodeId - the node to click
52
52
  * @throws TypeError when `nodeId` is malformed
53
+ * @throws TypeError when `nodeId` names no node
53
54
  */
54
55
  export declare function click(nodeId: NodeId): void;
55
56
  /**
@@ -59,6 +60,8 @@ export declare function click(nodeId: NodeId): void;
59
60
  * is optional. The scroll containers around the node scroll it into view.
60
61
  * @param nodeId - the node to focus
61
62
  * @param preventScroll - `true` to leave the scroll containers in place; omitted or `false` scrolls the node into view
63
+ * @throws TypeError when `nodeId` is malformed
64
+ * @throws TypeError when `nodeId` names no node
62
65
  */
63
66
  export declare function focus(nodeId: NodeId, preventScroll?: boolean): void;
64
67
  /**
package/dist/index.d.mts CHANGED
@@ -3,4 +3,4 @@ export { window } from './window.mts';
3
3
  export type { RectLike, RectValues } from './element/geometry.mts';
4
4
  export type { ScrollIntoViewOptions, ScrollOptions } from './element/scroll.mts';
5
5
  export type { IncaElement, IncaNode } from './element/types.mts';
6
- export type { AttributeValue, CallbackId, EventLike, EventListener, EventListenerObject, EventListenerOrObject, IncaEvent, IncaEventTarget, ListenerOptions, NodeId, StyleProps, TagName, } from './types.mts';
6
+ export type { AttributeValue, CallbackId, EventLike, EventListener, EventListenerObject, EventListenerOrObject, IncaEvent, IncaEventMap, IncaEventTarget, IncaFocusEvent, IncaKeyboardEvent, IncaMouseEvent, IncaPointerEvent, IncaUIEvent, IncaWheelEvent, ListenerOptions, NodeId, StyleProps, TagName, } from './types.mts';
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { t as e } from "./chunks/hooks-COUJ5IPe.js";
2
- import { t } from "./chunks/handle-C_4KtGsE.js";
1
+ import { t as e } from "./chunks/hooks-D1NFQN8Q.js";
2
+ import { t } from "./chunks/handle-DdYIkUcm.js";
3
3
  export { t as activeElement, e as window };
@@ -1,4 +1,4 @@
1
- import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, u as c } from "./chunks/rendererCore-Bu6a8hAp.js";
2
- import { C as l, D as u, E as d, N as f, S as p, T as m, _ as h, a as g, b as _, c as v, d as y, f as b, g as x, h as S, i as C, k as w, l as T, m as E, n as D, o as O, p as k, r as A, s as j, t as M, u as N, v as P, w as F, x as I, y as L } from "./chunks/hooks-COUJ5IPe.js";
3
- import { n as R } from "./chunks/handle-C_4KtGsE.js";
1
+ import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, u as c } from "./chunks/rendererCore-NnTAUL80.js";
2
+ import { C as l, D as u, E as d, N as f, S as p, T as m, _ as h, a as g, b as _, c as v, d as y, f as b, g as x, h as S, i as C, k as w, l as T, m as E, n as D, o as O, p as k, r as A, s as j, t as M, u as N, v as P, w as F, x as I, y as L } from "./chunks/hooks-D1NFQN8Q.js";
3
+ import { n as R } from "./chunks/handle-DdYIkUcm.js";
4
4
  export { I as addEventListener, D as appendChild, p as blur, l as click, i as createCommentNode, o as createElementNode, _ as createEventTarget, R as createIncaElement, A as createNode, n as createTextNode, C as destroyNode, F as dispatchEvent, m as focus, g as focusedNode, O as getAttribute, j as holdNode, e as insert, v as insertBefore, w as isDestroyed, d as latestEventId, T as layoutOf, a as nextSibling, s as parentNode, N as releaseNode, f as releaseWhenCollected, t as remove, y as removeAttribute, b as removeChild, u as removeEventListener, k as removeStyle, E as rootNodeId, S as scrollIntoViewNode, x as scrollNode, h as scrollOf, P as setAttribute, r as setElementText, L as setStyle, c as setText, M as window };
package/dist/types.d.mts CHANGED
@@ -110,8 +110,8 @@ export interface StyleProps {
110
110
  max_height?: number | "auto";
111
111
  }
112
112
  /**
113
- * An `Event` or `CustomEvent` built in this runtime. The host throws a
114
- * `TypeError` for any other value.
113
+ * An event built in this runtime with `Event`, `CustomEvent` or another
114
+ * event constructor. The host throws a `TypeError` for any other value.
115
115
  */
116
116
  export interface EventLike {
117
117
  readonly type: string;
@@ -144,7 +144,8 @@ export interface IncaEventTarget {
144
144
  * as `this` when the event fires
145
145
  * @param options - a {@link ListenerOptions}, or a boolean for `capture`
146
146
  */
147
- addEventListener<E = IncaEvent>(type: string, listener: EventListenerOrObject<E> | null, options?: boolean | ListenerOptions): void;
147
+ addEventListener<K extends keyof IncaEventMap>(type: K, listener: EventListenerOrObject<IncaEventMap[K], this> | null, options?: boolean | ListenerOptions): void;
148
+ addEventListener<E = IncaEvent>(type: string, listener: EventListenerOrObject<E, this> | null, options?: boolean | ListenerOptions): void;
148
149
  /**
149
150
  * Drops the registration of `listener` for `type` with the same `capture`.
150
151
  * A call that matches no registration changes nothing.
@@ -152,21 +153,21 @@ export interface IncaEventTarget {
152
153
  * @param listener - the listener that was registered
153
154
  * @param options - an object with `capture`, or a boolean for `capture`
154
155
  */
155
- removeEventListener<E = IncaEvent>(type: string, listener: EventListenerOrObject<E> | null, options?: boolean | Pick<ListenerOptions, "capture">): void;
156
+ removeEventListener<K extends keyof IncaEventMap>(type: K, listener: EventListenerOrObject<IncaEventMap[K], this> | null, options?: boolean | Pick<ListenerOptions, "capture">): void;
157
+ removeEventListener<E = IncaEvent>(type: string, listener: EventListenerOrObject<E, this> | null, options?: boolean | Pick<ListenerOptions, "capture">): void;
156
158
  /**
157
- * Dispatches an `Event` or `CustomEvent` at the target.
159
+ * Dispatches an event built with an event constructor at the target.
158
160
  * @param event - the event to dispatch
159
161
  * @returns `false` when a listener canceled a cancelable event, else `true`
160
- * @throws TypeError when `event` is not an `Event` or `CustomEvent`
162
+ * @throws TypeError when `event` is not an event built with an event constructor
161
163
  * @throws DOMException named `InvalidStateError` when `event` is being dispatched
162
164
  */
163
165
  dispatchEvent(event: EventLike): boolean;
164
166
  }
165
167
  /**
166
- * The event object a listener receives. It carries these fields and the
167
- * fields of its event kind, which this type leaves out. A listener that reads
168
- * them declares its parameter with them, such as
169
- * `(event: IncaEvent & { key: string }) => void`.
168
+ * The fields every event carries. {@link IncaEventMap} gives the event type of
169
+ * each name the host dispatches, and a listener for any other name receives
170
+ * this type.
170
171
  *
171
172
  * See https://incajs.tom96da.com/reference/events for the event names the
172
173
  * host dispatches and their fields.
@@ -174,6 +175,14 @@ export interface IncaEventTarget {
174
175
  export interface IncaEvent {
175
176
  /** The event's name. */
176
177
  readonly type: string;
178
+ /** `0`, the {@link IncaEvent.eventPhase} outside a dispatch. */
179
+ readonly NONE: 0;
180
+ /** `1`, the {@link IncaEvent.eventPhase} on an ancestor while the event travels down. */
181
+ readonly CAPTURING_PHASE: 1;
182
+ /** `2`, the {@link IncaEvent.eventPhase} on the target. */
183
+ readonly AT_TARGET: 2;
184
+ /** `3`, the {@link IncaEvent.eventPhase} on an ancestor while the event travels up. */
185
+ readonly BUBBLING_PHASE: 3;
177
186
  /**
178
187
  * The element the event is about, or `window`. It is the deepest element
179
188
  * under the pointer for pointer events, the nearest common ancestor of the
@@ -188,11 +197,17 @@ export interface IncaEvent {
188
197
  * event has been handled. A listener function runs with it as `this`.
189
198
  */
190
199
  readonly currentTarget: IncaEventTarget | null;
191
- /** Whether the event travels up from `target`. Fixed per event name. */
200
+ /**
201
+ * Whether the event travels up from `target`. Fixed per event name for the
202
+ * events the host dispatches.
203
+ */
192
204
  readonly bubbles: boolean;
193
- /** Whether `preventDefault()` can cancel the event. Fixed per event name. */
205
+ /**
206
+ * Whether `preventDefault()` can cancel the event. Fixed per event name for
207
+ * the events the host dispatches.
208
+ */
194
209
  readonly cancelable: boolean;
195
- /** Fixed per event name. */
210
+ /** Fixed per event name for the events the host dispatches. */
196
211
  readonly composed: boolean;
197
212
  /**
198
213
  * 1 on the ancestors of `target` while the event travels down, 2 where
@@ -223,13 +238,169 @@ export interface IncaEvent {
223
238
  * the event has been handled.
224
239
  */
225
240
  composedPath(): IncaEventTarget[];
241
+ /**
242
+ * Sets the type, `bubbles` and `cancelable` of an event that is not being
243
+ * dispatched, clears its stop and cancel flags and makes it untrusted. While
244
+ * the event is dispatched it does nothing.
245
+ */
246
+ initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void;
247
+ }
248
+ /**
249
+ * The event object of a mouse, wheel, keyboard or focus event.
250
+ */
251
+ export interface IncaUIEvent extends IncaEvent {
252
+ /**
253
+ * On the events the host dispatches, the click count of `mousedown`,
254
+ * `mouseup`, `click`, `dblclick` and `auxclick`, and `0` on the others.
255
+ */
256
+ readonly detail: number;
257
+ /** Always `null`. */
258
+ readonly view: null;
259
+ /**
260
+ * On the events the host dispatches: for `mousedown`, `mouseup`, `click`,
261
+ * `dblclick`, `auxclick` and `contextmenu`, `button + 1`. For `wheel`, `0`.
262
+ * For the other mouse events, the lowest held button plus 1, or `0` with no
263
+ * button held. For a keyboard event, `keyCode`. For a focus event, `0`.
264
+ */
265
+ readonly which: number;
266
+ }
267
+ /** The event object of `focus`, `blur`, `focusin` and `focusout`. */
268
+ export interface IncaFocusEvent extends IncaUIEvent {
269
+ /**
270
+ * The element gaining focus for `blur` and `focusout`, the element losing
271
+ * it for `focus` and `focusin`, or `null`.
272
+ */
273
+ readonly relatedTarget: IncaEventTarget | null;
274
+ }
275
+ /** The event object of the mouse events. */
276
+ export interface IncaMouseEvent extends IncaUIEvent {
277
+ readonly screenX: number;
278
+ readonly screenY: number;
279
+ /** The pointer's position in the window. */
280
+ readonly clientX: number;
281
+ /** The pointer's position in the window. */
282
+ readonly clientY: number;
283
+ /** The same as {@link IncaMouseEvent.clientX}. */
284
+ readonly pageX: number;
285
+ /** The same as {@link IncaMouseEvent.clientY}. */
286
+ readonly pageY: number;
287
+ /** The same as {@link IncaMouseEvent.clientX}. */
288
+ readonly x: number;
289
+ /** The same as {@link IncaMouseEvent.clientY}. */
290
+ readonly y: number;
291
+ /** On the events the host dispatches, the pointer's position from the padding edge of `target`. */
292
+ readonly offsetX: number;
293
+ /** On the events the host dispatches, the pointer's position from the padding edge of `target`. */
294
+ readonly offsetY: number;
295
+ /** On the events the host dispatches, the pointer's travel since the previous `mousemove`, and `0` on other events. */
296
+ readonly movementX: number;
297
+ /** On the events the host dispatches, the pointer's travel since the previous `mousemove`, and `0` on other events. */
298
+ readonly movementY: number;
299
+ /** The button the event is about: `0` left, `1` middle, `2` right, `3` back, `4` forward. */
300
+ readonly button: number;
301
+ /** Every button held, as a bitmask: `1` left, `2` right, `4` middle, `8` back, `16` forward. */
302
+ readonly buttons: number;
303
+ readonly ctrlKey: boolean;
304
+ readonly shiftKey: boolean;
305
+ readonly altKey: boolean;
306
+ readonly metaKey: boolean;
307
+ /**
308
+ * The element the pointer came from for `mouseover` and `mouseenter`, the
309
+ * element it went to for `mouseout` and `mouseleave`, or `null`.
310
+ */
311
+ readonly relatedTarget: IncaEventTarget | null;
312
+ /**
313
+ * Whether the modifier `key` is held: `"Control"`, `"Shift"`, `"Alt"`,
314
+ * `"Meta"`, or `"Accel"` (Meta on macOS, Control elsewhere). Any other name
315
+ * gives `false`.
316
+ */
317
+ getModifierState(key: string): boolean;
318
+ }
319
+ /** The event object of `click`, `auxclick` and `contextmenu`. */
320
+ export interface IncaPointerEvent extends IncaMouseEvent {
321
+ /** On the events the host dispatches, `1` for the mouse and `-1` for the click of a key. */
322
+ readonly pointerId: number;
323
+ readonly width: number;
324
+ readonly height: number;
325
+ /** On the events the host dispatches, `0.5` while a button is held, else `0`. */
326
+ readonly pressure: number;
327
+ /** On the events the host dispatches, `"mouse"`, or `""` for the click of a key. */
328
+ readonly pointerType: string;
329
+ /** On the events the host dispatches, `true` for the mouse and `false` for the click of a key. */
330
+ readonly isPrimary: boolean;
331
+ }
332
+ /** The event object of `wheel`. */
333
+ export interface IncaWheelEvent extends IncaMouseEvent {
334
+ readonly deltaX: number;
335
+ readonly deltaY: number;
336
+ /** `0` on the events the host dispatches. */
337
+ readonly deltaZ: number;
338
+ /** `0` for pixels, `1` for lines. */
339
+ readonly deltaMode: number;
340
+ readonly DOM_DELTA_PIXEL: 0;
341
+ readonly DOM_DELTA_LINE: 1;
342
+ readonly DOM_DELTA_PAGE: 2;
343
+ }
344
+ /** The event object of `keydown` and `keyup`. */
345
+ export interface IncaKeyboardEvent extends IncaUIEvent {
346
+ /** The key's name, such as `"Enter"`, `"F5"` or the typed character. */
347
+ readonly key: string;
348
+ /** `""` on the events the host dispatches. */
349
+ readonly code: string;
350
+ /** `0` on the events the host dispatches. */
351
+ readonly location: number;
352
+ /** Whether the key press is an auto-repeat. */
353
+ readonly repeat: boolean;
354
+ /** `false` on the events the host dispatches. */
355
+ readonly isComposing: boolean;
356
+ /** The key's code on a US keyboard layout, and `0` for a key outside it. */
357
+ readonly keyCode: number;
358
+ /** `0` on the events the host dispatches. */
359
+ readonly charCode: number;
360
+ readonly ctrlKey: boolean;
361
+ readonly shiftKey: boolean;
362
+ readonly altKey: boolean;
363
+ readonly metaKey: boolean;
364
+ readonly DOM_KEY_LOCATION_STANDARD: 0;
365
+ readonly DOM_KEY_LOCATION_LEFT: 1;
366
+ readonly DOM_KEY_LOCATION_RIGHT: 2;
367
+ readonly DOM_KEY_LOCATION_NUMPAD: 3;
368
+ /**
369
+ * Whether the modifier `key` is held: `"Control"`, `"Shift"`, `"Alt"`,
370
+ * `"Meta"`, or `"Accel"` (Meta on macOS, Control elsewhere). Any other name
371
+ * gives `false`.
372
+ */
373
+ getModifierState(key: string): boolean;
374
+ }
375
+ /** The event object of each event name the host dispatches. */
376
+ export interface IncaEventMap {
377
+ auxclick: IncaPointerEvent;
378
+ blur: IncaFocusEvent;
379
+ click: IncaPointerEvent;
380
+ contextmenu: IncaPointerEvent;
381
+ dblclick: IncaMouseEvent;
382
+ focus: IncaFocusEvent;
383
+ focusin: IncaFocusEvent;
384
+ focusout: IncaFocusEvent;
385
+ keydown: IncaKeyboardEvent;
386
+ keyup: IncaKeyboardEvent;
387
+ mousedown: IncaMouseEvent;
388
+ mouseenter: IncaMouseEvent;
389
+ mouseleave: IncaMouseEvent;
390
+ mousemove: IncaMouseEvent;
391
+ mouseout: IncaMouseEvent;
392
+ mouseover: IncaMouseEvent;
393
+ mouseup: IncaMouseEvent;
394
+ scroll: IncaEvent;
395
+ wheel: IncaWheelEvent;
226
396
  }
227
397
  /**
228
398
  * Signature of a callback registered via `addEventListener`. It receives the
229
399
  * event, an {@link IncaEvent} unless the parameter declares another type, and
230
- * runs with the event's `currentTarget` as `this`.
400
+ * runs with the event's `currentTarget`, the target it was registered on, as
401
+ * `this`.
231
402
  */
232
- export type EventListener<E = IncaEvent> = (this: IncaEventTarget, event: E) => void;
403
+ export type EventListener<E = IncaEvent, T = IncaEventTarget> = (this: T, event: E) => void;
233
404
  /**
234
405
  * An object whose `handleEvent` method receives the events, called with the
235
406
  * object as `this`. It takes the event an {@link EventListener} takes.
@@ -241,4 +412,4 @@ export interface EventListenerObject<E = IncaEvent> {
241
412
  * What `addEventListener` accepts as a listener: an {@link EventListener} or
242
413
  * an {@link EventListenerObject}.
243
414
  */
244
- export type EventListenerOrObject<E = IncaEvent> = EventListener<E> | EventListenerObject<E>;
415
+ export type EventListenerOrObject<E = IncaEvent, T = IncaEventTarget> = EventListener<E, T> | EventListenerObject<E>;
@@ -46,8 +46,8 @@ import { IncaCore, IncaElement } from '../rendererCore.mts';
46
46
  * - Event names: `onXxx` listens for the hyphenated name (`onMyEvent` listens
47
47
  * for `my-event`), and `on:xxx` listens for the name after the colon as
48
48
  * written (`on:myEvent` listens for `myEvent`). The listener runs when the
49
- * host dispatches that name. See `IncaEvent` for the fields an event
50
- * carries.
49
+ * host dispatches that name. `IncaEventMap` gives the event type of each
50
+ * name the host dispatches.
51
51
  * - Errors: an error a handler throws, or a rejection of an async handler,
52
52
  * goes to the `onErrorCaptured` hooks and the app's `errorHandler`. Every
53
53
  * handler of an event runs even when an earlier one fails, until one calls
@@ -66,12 +66,13 @@ import { IncaCore, IncaElement } from '../rendererCore.mts';
66
66
  * ### Other props
67
67
  *
68
68
  * A string, number or boolean `nextValue` goes to `core.setAttribute` as it
69
- * is. A `disabled`, `hidden` or `inert` set to `false` goes to
70
- * `core.removeAttribute`, as does a `null` or `undefined` `nextValue`, which
71
- * includes a prop that is absent from the new vnode. Any other value (an
72
- * object, array, function or symbol) goes to `core.setAttribute` as
73
- * `String(nextValue)`. An `onUpdate:` key is a component event and sets
74
- * nothing.
69
+ * is. A `null` or `undefined` `nextValue` goes to `core.removeAttribute`,
70
+ * which includes a prop that is absent from the new vnode. So does any falsy
71
+ * value other than `""` for a boolean attribute: `disabled`, `hidden`,
72
+ * `inert`, and the names Vue treats as boolean attributes, such as
73
+ * `readonly`. Any other value (an object, array, function or symbol) goes to
74
+ * `core.setAttribute` as `String(nextValue)`. An `onUpdate:` key is a
75
+ * component event and sets nothing.
75
76
  *
76
77
  * @param core - the incajs bindings to drive the native tree through
77
78
  */
package/dist/vue.js CHANGED
@@ -1,6 +1,6 @@
1
- import { t as e } from "./chunks/rendererCore-Bu6a8hAp.js";
2
- import { m as t } from "./chunks/hooks-COUJ5IPe.js";
3
- import { n } from "./chunks/handle-C_4KtGsE.js";
1
+ import { t as e } from "./chunks/rendererCore-NnTAUL80.js";
2
+ import { m as t } from "./chunks/hooks-D1NFQN8Q.js";
3
+ import { n } from "./chunks/handle-DdYIkUcm.js";
4
4
  import { ErrorCodes as r, callWithAsyncErrorHandling as i, createRenderer as a, warn as o } from "@vue/runtime-core";
5
5
  //#region src/vue/nodeOps.mts
6
6
  function s(e) {
@@ -141,11 +141,18 @@ function E(e, t, n, r, i) {
141
141
  var D = /* @__PURE__ */ new Set([
142
142
  "disabled",
143
143
  "hidden",
144
- "inert"
144
+ "inert",
145
+ "allowfullscreen",
146
+ "formnovalidate",
147
+ "ismap",
148
+ "itemscope",
149
+ "nomodule",
150
+ "novalidate",
151
+ "readonly"
145
152
  ]);
146
153
  function O(e) {
147
154
  return (t, n, r, i, a, o) => {
148
- n.startsWith("onUpdate:") || (n === "style" ? v(e, t, i) : u(n) ? E(e, t, n, i, o ?? null) : d(n) && n in t ? typeof i == "string" ? (Reflect.set(t, n, null), e.setAttribute(t.__node_id, n, i)) : Reflect.set(t, n, i) : D.has(n) && i === !1 ? e.removeAttribute(t.__node_id, n) : typeof i == "string" || typeof i == "number" || typeof i == "boolean" ? e.setAttribute(t.__node_id, n, i) : i == null ? e.removeAttribute(t.__node_id, n) : e.setAttribute(t.__node_id, n, String(i)));
155
+ n.startsWith("onUpdate:") || (n === "style" ? v(e, t, i) : u(n) ? E(e, t, n, i, o ?? null) : d(n) && n in t ? typeof i == "string" ? (Reflect.set(t, n, null), e.setAttribute(t.__node_id, n, i)) : Reflect.set(t, n, i) : D.has(n) && !i && i !== "" ? e.removeAttribute(t.__node_id, n) : typeof i == "string" || typeof i == "number" || typeof i == "boolean" ? e.setAttribute(t.__node_id, n, i) : i == null ? e.removeAttribute(t.__node_id, n) : e.setAttribute(t.__node_id, n, String(i)));
149
156
  };
150
157
  }
151
158
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incajs",
3
- "version": "0.0.19",
3
+ "version": "0.0.21",
4
4
  "description": "A GPU-native, Webview-free desktop app framework built on GPUI and QuickJS.",
5
5
  "keywords": [
6
6
  "cross-platform",