incajs 0.0.3 → 0.0.4

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.
@@ -42,45 +42,53 @@ function s(e, t) {
42
42
  let r = i.idFor(e, t);
43
43
  r !== void 0 && (n().removeEventListener(e, t, r), i.release(r));
44
44
  }
45
+ function c(e) {
46
+ n().focusNode(e);
47
+ }
48
+ function l() {
49
+ n().blurNode();
50
+ }
45
51
  //#endregion
46
52
  //#region src/tree.mts
47
- function c() {
53
+ function u() {
48
54
  return n().rootNodeId();
49
55
  }
50
- function l(e) {
56
+ function d(e) {
51
57
  return n().createNode(e);
52
58
  }
53
- function u(e, t) {
59
+ function f(e, t) {
54
60
  n().appendChild(e, t);
55
61
  }
56
- function d(e, t, r) {
62
+ function p(e, t, r) {
57
63
  n().insertBefore(e, t, r);
58
64
  }
59
- function f(e, t) {
65
+ function m(e, t) {
60
66
  n().removeChild(e, t);
61
67
  }
62
- function p(e) {
68
+ function h(e) {
63
69
  a(n().destroyNode(e));
64
70
  }
65
- function m(e, t, r) {
71
+ function g(e, t, r) {
66
72
  n().setAttribute(e, t, r);
67
73
  }
68
- function h(e, t, r) {
74
+ function _(e, t, r) {
69
75
  n().setStyle(e, t, r);
70
76
  }
71
77
  //#endregion
72
78
  //#region src/index.mts
73
- var g = /* @__PURE__ */ t({
74
- appendChild: () => u,
75
- createNode: () => l,
76
- destroyNode: () => p,
77
- insertBefore: () => d,
78
- removeChild: () => f,
79
+ var v = /* @__PURE__ */ t({
80
+ appendChild: () => f,
81
+ blur: () => l,
82
+ createNode: () => d,
83
+ destroyNode: () => h,
84
+ focus: () => c,
85
+ insertBefore: () => p,
86
+ removeChild: () => m,
79
87
  removeEventListener: () => s,
80
- rootNodeId: () => c,
81
- setAttribute: () => m,
88
+ rootNodeId: () => u,
89
+ setAttribute: () => g,
82
90
  setEventListener: () => o,
83
- setStyle: () => h
91
+ setStyle: () => _
84
92
  });
85
93
  //#endregion
86
- export { d as a, m as c, o as d, p as i, h as l, u as n, f as o, l as r, c as s, g as t, s as u };
94
+ export { p as a, g as c, c as d, s as f, h as i, _ as l, f as n, m as o, o as p, d as r, u as s, v as t, l as u };
package/dist/events.d.mts CHANGED
@@ -12,8 +12,10 @@ export declare function releaseCallbacks(callbackIds: readonly CallbackId[]): vo
12
12
  *
13
13
  * The host holds a list per `(nodeId, event)` and dispatches to all of it;
14
14
  * this wrapper keeps one, the way a framework adapter composes its own
15
- * handlers into a single callback. Only `"click"` is wired to a real native
16
- * input event today; other event names are accepted but never fire.
15
+ * handlers into a single callback. `"click"`/`"mousedown"`/`"mouseup"`/
16
+ * `"mousemove"`/`"wheel"`/`"mouseenter"`/`"mouseleave"`/`"focus"`/`"blur"`
17
+ * are wired to real native input today; other event names are accepted but
18
+ * never fire.
17
19
  * @param nodeId - the node to listen on
18
20
  * @param event - the event name (e.g. `"click"`)
19
21
  * @param listener - called when the event fires
@@ -26,3 +28,17 @@ export declare function setEventListener(nodeId: NodeId, event: string, listener
26
28
  * @param event - the event name
27
29
  */
28
30
  export declare function removeEventListener(nodeId: NodeId, event: string): void;
31
+ /**
32
+ * Requests that `nodeId` become focused. Takes effect on the next frame,
33
+ * dispatching `"blur"`/`"focus"` for whatever actually changed — `nodeId`
34
+ * doesn't need a `"focus"`/`"blur"` listener registered for this to work,
35
+ * the same way `element.focus()` works on any focusable DOM element
36
+ * regardless of whether it's being listened to.
37
+ * @param nodeId - the node to focus
38
+ */
39
+ export declare function focus(nodeId: NodeId): void;
40
+ /**
41
+ * Requests that whatever is focused become unfocused. Takes effect on the
42
+ * next frame; a no-op if nothing is focused when it runs.
43
+ */
44
+ export declare function blur(): void;
package/dist/index.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- export { removeEventListener, setEventListener } from './events.mts';
1
+ export { blur, focus, removeEventListener, setEventListener } from './events.mts';
2
2
  export { appendChild, createNode, destroyNode, insertBefore, removeChild, rootNodeId, setAttribute, setStyle, } from './tree.mts';
3
3
  export type { AttributeValue, CallbackId, EventListener, NodeId, StyleProps, TagName, } from './types.mts';
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as e, c as t, d as n, i as r, l as i, n as a, o, r as s, s as c, u as l } from "./chunks/src-EeQFPfUI.js";
2
- export { a as appendChild, s as createNode, r as destroyNode, e as insertBefore, o as removeChild, l as removeEventListener, c as rootNodeId, t as setAttribute, n as setEventListener, i as setStyle };
1
+ import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, p as c, r as l, s as u, u as d } from "./chunks/src-SeArA65c.js";
2
+ export { o as appendChild, d as blur, l as createNode, i as destroyNode, n as focus, e as insertBefore, s as removeChild, r as removeEventListener, u as rootNodeId, t as setAttribute, c as setEventListener, a as setStyle };
package/dist/native.d.mts CHANGED
@@ -11,6 +11,8 @@ interface IncaNative {
11
11
  addEventListener(nodeId: NodeId, event: string, callbackId: CallbackId): void;
12
12
  removeEventListener(nodeId: NodeId, event: string, callbackId: CallbackId): boolean;
13
13
  destroyNode(nodeId: NodeId): CallbackId[];
14
+ focusNode(nodeId: NodeId): void;
15
+ blurNode(): void;
14
16
  }
15
17
  declare global {
16
18
  var __inca_native__: IncaNative;
package/dist/types.d.mts CHANGED
@@ -48,8 +48,24 @@ export interface StyleProps {
48
48
  }
49
49
  /**
50
50
  * Signature of a callback registered via {@link setEventListener}. The
51
- * native host currently always calls it with exactly one argument, the
52
- * {@link NodeId} the event fired on — the type stays variadic so a future
53
- * event kind can add a richer payload without a breaking signature change.
51
+ * native host calls it with one argument, an object with `type` (the
52
+ * event's name), `target`/`currentTarget` (both the {@link NodeId} it fired
53
+ * on), `stopPropagation`/`stopImmediatePropagation`/`preventDefault`
54
+ * methods, plus whatever fields that event kind carries.
55
+ *
56
+ * `"mousedown"`/`"mouseup"`/`"mousemove"`/`"mouseenter"`/`"mouseleave"`
57
+ * carry `clientX`, `clientY`, `button`, `buttons`, `detail`, and
58
+ * `ctrlKey`/`shiftKey`/`altKey`/`metaKey`, DOM-`MouseEvent`-named.
59
+ * `"wheel"` carries those same fields plus `deltaX`/`deltaY`/`deltaZ`/
60
+ * `deltaMode`, DOM-`WheelEvent`-named (`deltaMode` is `0` or `1`; `deltaZ`
61
+ * is always `0`). `"keydown"`/`"keyup"` carry `key`, `repeat`, and
62
+ * `ctrlKey`/`shiftKey`/`altKey`/`metaKey`, DOM-`KeyboardEvent`-named, and
63
+ * fire on whichever node is currently focused, bubbling to its ancestors;
64
+ * with nothing focused, neither reaches any node. `"click"`/`"focus"`/
65
+ * `"blur"` carry none of their own.
66
+ *
67
+ * An element already under the pointer when it mounts gets a
68
+ * `"mouseenter"` the first time its hover state is checked, with no
69
+ * pointer movement involved.
54
70
  */
55
71
  export type EventListener = (...args: unknown[]) => void;
@@ -10,8 +10,10 @@ import { IncaElement } from './nodeOps.mts';
10
10
  * string/number is skipped.
11
11
  * - An `onXxx` key registers `nextValue` as the listener for `xxx`, taking a
12
12
  * function or an array of them, and unbinds `xxx` for anything else — only
13
- * `"click"` is wired to real input by the native host today, other event
14
- * names are accepted but never fire.
13
+ * `"click"`/`"mousedown"`/`"mouseup"`/`"mousemove"`/`"wheel"`/
14
+ * `"mouseenter"`/`"mouseleave"`/`"focus"`/`"blur"`/`"keydown"`/`"keyup"`
15
+ * are wired to real input by the native host today, other event names
16
+ * are accepted but never fire.
15
17
  * - Everything else falls through to `core.setAttribute`, again skipping
16
18
  * a non-string/number/boolean value rather than passing it through.
17
19
  *
package/dist/vue.js CHANGED
@@ -1,4 +1,4 @@
1
- import { s as e, t } from "./chunks/src-EeQFPfUI.js";
1
+ import { s as e, t } from "./chunks/src-SeArA65c.js";
2
2
  import { createRenderer as n } from "@vue/runtime-core";
3
3
  //#region src/vue/nodeOps.mts
4
4
  function r(e) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "incajs",
3
- "version": "0.0.3",
4
- "description": "Incarnative.js — a GPU-native, Webview-free desktop application framework powered by GPUI and QuickJS. Framework-agnostic core, with first-class Vue 3 support via the incajs/vue subpath.",
3
+ "version": "0.0.4",
4
+ "description": "A GPU-native, Webview-free desktop app framework built on GPUI and QuickJS.",
5
5
  "keywords": [
6
6
  "cross-platform",
7
7
  "custom-renderer",