incajs 0.0.0 → 0.0.1

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/LICENSE ADDED
@@ -0,0 +1,5 @@
1
+ Dual-licensed under MIT OR Apache-2.0.
2
+
3
+ See:
4
+ - https://github.com/tom96da/incajs/blob/main/LICENSE-MIT
5
+ - https://github.com/tom96da/incajs/blob/main/LICENSE-APACHE
package/README.md CHANGED
@@ -5,8 +5,19 @@ SPDX-License-Identifier: MIT OR Apache-2.0
5
5
 
6
6
  # incajs
7
7
 
8
- **Incarnative.js** — a GPU-native, Webview-free desktop application framework
9
- powered by [GPUI](https://www.gpui.rs/) and QuickJS.
8
+ **Incarnative.js** — a GPU-native, Webview-free desktop application
9
+ framework powered by [GPUI](https://www.gpui.rs/) and QuickJS.
10
10
 
11
- This is a name reservation on npm. The real implementation is still in
12
- development at [tom96da/gpjs-ui](https://github.com/tom96da/gpjs-ui).
11
+ `incajs` provides the framework-agnostic JS API that talks directly to the
12
+ native host bridge (`globalThis.__inca_native__`), plus first-class Vue 3
13
+ support via the `incajs/vue` subpath — a custom renderer mapping Vue's
14
+ `createRenderer` lifecycle methods onto this package's own typed wrapper
15
+ functions. `incajs/vue`'s `@vue/runtime-core` peer dependency is optional:
16
+ only import `incajs/vue` if you're building with Vue.
17
+
18
+ The typed wrapper functions over the native bridge, the
19
+ `__inca_callbacks__` event-listener registry, and the Vue 3 renderer
20
+ (node lifecycle, text/comment nodes, style/attribute/event prop patching)
21
+ are implemented and tested.
22
+
23
+ Part of [tom96da/incajs](https://github.com/tom96da/incajs).
@@ -0,0 +1,28 @@
1
+ import { CallbackId, EventListener, NodeId } from './types.mts';
2
+ /**
3
+ * Drops the JS half of every registration in `callbackIds`. The native half
4
+ * is already gone by the time this runs — {@link destroyNode} takes both.
5
+ * @param callbackIds - ids the host reported as released
6
+ * @internal
7
+ */
8
+ export declare function releaseCallbacks(callbackIds: readonly CallbackId[]): void;
9
+ /**
10
+ * Makes `listener` the one thing that runs when `event` fires on `nodeId`,
11
+ * replacing whatever was registered for that pair before.
12
+ *
13
+ * The host holds a list per `(nodeId, event)` and dispatches to all of it;
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.
17
+ * @param nodeId - the node to listen on
18
+ * @param event - the event name (e.g. `"click"`)
19
+ * @param listener - called when the event fires
20
+ */
21
+ export declare function setEventListener(nodeId: NodeId, event: string, listener: EventListener): void;
22
+ /**
23
+ * Drops whatever {@link setEventListener} registered for `(nodeId, event)`,
24
+ * on both the native and the JS side. A no-op if nothing is registered.
25
+ * @param nodeId - the node to stop listening on
26
+ * @param event - the event name
27
+ */
28
+ export declare function removeEventListener(nodeId: NodeId, event: string): void;
@@ -0,0 +1,3 @@
1
+ export { removeEventListener, setEventListener } from './events.mts';
2
+ export { appendChild, createNode, destroyNode, insertBefore, removeChild, rootNodeId, setAttribute, setStyle, } from './tree.mts';
3
+ export type { AttributeValue, CallbackId, EventListener, NodeId, StyleProps, TagName, } from './types.mts';
package/dist/index.js ADDED
@@ -0,0 +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 "./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 };
@@ -0,0 +1,20 @@
1
+ import { AttributeValue, CallbackId, EventListener, NodeId } from './types.mts';
2
+ /** The host-injected object every wrapper in this package forwards to. Not part of the public surface — reach it through the wrappers instead. */
3
+ interface IncaNative {
4
+ rootNodeId(): NodeId;
5
+ createNode(tag: string): NodeId;
6
+ appendChild(parentId: NodeId, childId: NodeId): void;
7
+ insertBefore(parentId: NodeId, childId: NodeId, anchorId: NodeId | null): void;
8
+ removeChild(parentId: NodeId, childId: NodeId): void;
9
+ setAttribute(nodeId: NodeId, key: string, value: AttributeValue): void;
10
+ setStyle(nodeId: NodeId, key: string, value: AttributeValue): void;
11
+ addEventListener(nodeId: NodeId, event: string, callbackId: CallbackId): void;
12
+ removeEventListener(nodeId: NodeId, event: string, callbackId: CallbackId): boolean;
13
+ destroyNode(nodeId: NodeId): CallbackId[];
14
+ }
15
+ declare global {
16
+ var __inca_native__: IncaNative;
17
+ var __inca_callbacks__: Record<CallbackId, EventListener>;
18
+ }
19
+ export declare function native(): IncaNative;
20
+ export {};
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The subset of `incajs`'s own API a custom renderer (`incajs/vue`, and any
3
+ * future framework adapter alongside it) drives the native tree through —
4
+ * derived from `index.mts`'s real exports, so this contract can't drift out
5
+ * of sync with them.
6
+ *
7
+ * Also the seam a renderer's own tests mock against, in place of a real
8
+ * `globalThis.__inca_native__`.
9
+ */
10
+ export type IncaCore = Pick<typeof import("./index.mts"), "rootNodeId" | "createNode" | "appendChild" | "insertBefore" | "removeChild" | "destroyNode" | "setAttribute" | "setStyle" | "setEventListener" | "removeEventListener">;
@@ -0,0 +1,86 @@
1
+ //#region \0rolldown/runtime.js
2
+ var e = Object.defineProperty, t = (t, n) => {
3
+ let r = {};
4
+ for (var i in t) e(r, i, {
5
+ get: t[i],
6
+ enumerable: !0
7
+ });
8
+ return n || e(r, Symbol.toStringTag, { value: "Module" }), r;
9
+ };
10
+ //#endregion
11
+ //#region src/native.mts
12
+ function n() {
13
+ return globalThis.__inca_native__;
14
+ }
15
+ //#endregion
16
+ //#region src/events.mts
17
+ function r() {
18
+ let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = 0, r = (e, t) => `${e}:${t}`, i = () => globalThis.__inca_callbacks__ ??= {};
19
+ return {
20
+ add(a, o, s) {
21
+ let c = n++;
22
+ return i()[c] = s, e.set(r(a, o), c), t.set(c, r(a, o)), c;
23
+ },
24
+ idFor(t, n) {
25
+ return e.get(r(t, n));
26
+ },
27
+ release(n) {
28
+ delete i()[n];
29
+ let r = t.get(n);
30
+ r !== void 0 && (t.delete(n), e.delete(r));
31
+ }
32
+ };
33
+ }
34
+ var i = r();
35
+ function a(e) {
36
+ for (let t of e) i.release(t);
37
+ }
38
+ function o(e, t, r) {
39
+ s(e, t), n().addEventListener(e, t, i.add(e, t, r));
40
+ }
41
+ function s(e, t) {
42
+ let r = i.idFor(e, t);
43
+ r !== void 0 && (n().removeEventListener(e, t, r), i.release(r));
44
+ }
45
+ //#endregion
46
+ //#region src/tree.mts
47
+ function c() {
48
+ return n().rootNodeId();
49
+ }
50
+ function l(e) {
51
+ return n().createNode(e);
52
+ }
53
+ function u(e, t) {
54
+ n().appendChild(e, t);
55
+ }
56
+ function d(e, t, r) {
57
+ n().insertBefore(e, t, r);
58
+ }
59
+ function f(e, t) {
60
+ n().removeChild(e, t);
61
+ }
62
+ function p(e) {
63
+ a(n().destroyNode(e));
64
+ }
65
+ function m(e, t, r) {
66
+ n().setAttribute(e, t, r);
67
+ }
68
+ function h(e, t, r) {
69
+ n().setStyle(e, t, r);
70
+ }
71
+ //#endregion
72
+ //#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
+ removeEventListener: () => s,
80
+ rootNodeId: () => c,
81
+ setAttribute: () => m,
82
+ setEventListener: () => o,
83
+ setStyle: () => h
84
+ });
85
+ //#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 };
@@ -0,0 +1,71 @@
1
+ import { AttributeValue, NodeId, StyleProps, TagName } from './types.mts';
2
+ /**
3
+ * Returns the host-allocated root container's id — the node an app attaches
4
+ * itself under. The host allocates it with the tree, so this resolves from
5
+ * the first call and names the same node for the engine's lifetime.
6
+ * @returns the root node's id
7
+ */
8
+ export declare function rootNodeId(): NodeId;
9
+ /**
10
+ * Allocates a new node of kind `tag` in the native tree. The node starts out
11
+ * detached — attach it with {@link appendChild}/{@link insertBefore}.
12
+ * @param tag - the node's element kind
13
+ * @returns the new node's id
14
+ */
15
+ export declare function createNode(tag: TagName): NodeId;
16
+ /**
17
+ * Attaches `childId` as the last child of `parentId`. A thin wrapper over
18
+ * {@link insertBefore} with no anchor.
19
+ * @param parentId - the container to attach to
20
+ * @param childId - the node being attached
21
+ */
22
+ export declare function appendChild(parentId: NodeId, childId: NodeId): void;
23
+ /**
24
+ * Attaches `childId` as a child of `parentId`, positioned before `anchorId`
25
+ * (or at the end, if `anchorId` is `null`). If `anchorId` names a real node
26
+ * that just isn't currently a child of `parentId`, this falls back to
27
+ * appending at the end instead of throwing — only a wholly unknown
28
+ * `anchorId` raises.
29
+ * @param parentId - the container to attach to
30
+ * @param childId - the node being attached
31
+ * @param anchorId - the sibling to insert before, or `null` to append at the end
32
+ */
33
+ export declare function insertBefore(parentId: NodeId, childId: NodeId, anchorId: NodeId | null): void;
34
+ /**
35
+ * Detaches `childId` from `parentId`. The detached node stays alive (and
36
+ * keeps its own children) — it isn't freed, so it can be re-attached
37
+ * elsewhere. Use {@link destroyNode} for a node that isn't coming back.
38
+ * @param parentId - the current container
39
+ * @param childId - the node being detached
40
+ */
41
+ export declare function removeChild(parentId: NodeId, childId: NodeId): void;
42
+ /**
43
+ * Frees `nodeId` and its whole subtree, detaching it first, and drops every
44
+ * event listener registered anywhere in it. Destroying an already-destroyed
45
+ * node does nothing. The host's own root cannot be destroyed and raises.
46
+ *
47
+ * Nothing else frees a node: a subtree dropped with {@link removeChild}
48
+ * alone stays allocated for the life of the engine.
49
+ * @param nodeId - the node that isn't coming back
50
+ */
51
+ export declare function destroyNode(nodeId: NodeId): void;
52
+ /**
53
+ * Sets a non-style attribute/prop on `nodeId`. See {@link setStyle} for
54
+ * layout/paint properties, which live in a separate map.
55
+ * @param nodeId - the node to update
56
+ * @param key - the attribute name
57
+ * @param value - the attribute value
58
+ */
59
+ export declare function setAttribute(nodeId: NodeId, key: string, value: AttributeValue): void;
60
+ /**
61
+ * Sets a style property on `nodeId` — the only way to reach {@link setAttribute}'s
62
+ * counterpart style map. A key from {@link StyleProps} gets compile-time
63
+ * checking on its value's shape; any other string key still forwards as a
64
+ * raw {@link AttributeValue}, for style properties this package's types
65
+ * haven't caught up with yet.
66
+ * @param nodeId - the node to update
67
+ * @param key - the style property name
68
+ * @param value - the style property value
69
+ */
70
+ export declare function setStyle<K extends keyof StyleProps>(nodeId: NodeId, key: K, value: NonNullable<StyleProps[K]>): void;
71
+ export declare function setStyle(nodeId: NodeId, key: string, value: AttributeValue): void;
@@ -0,0 +1,55 @@
1
+ /** Stable handle to a node in the native retained tree, returned by {@link createNode} and used in every later call that touches that node. */
2
+ export type NodeId = number;
3
+ /** Id assigned to one registered event listener. Managed internally by {@link setEventListener}/{@link removeEventListener}/{@link destroyNode} — callers never see or pass one directly. */
4
+ export type CallbackId = number;
5
+ /** A value {@link setAttribute}/{@link setStyle} can take. Anything else raises a catchable exception rather than being silently coerced. */
6
+ export type AttributeValue = string | number | boolean;
7
+ /**
8
+ * Element kind passed to {@link createNode}. `"text"` is the only tag with
9
+ * dedicated rendering behavior — a leaf that renders its `"value"`
10
+ * attribute's string content. Any other string is a generic styled
11
+ * container; the `string & {}` half of this type keeps `"text"`'s
12
+ * autocomplete while still accepting an arbitrary tag name.
13
+ */
14
+ export type TagName = "text" | (string & {});
15
+ /**
16
+ * Style properties recognized by {@link setStyle}'s typed overload. A
17
+ * deliberately incomplete, v1 layout/paint vocabulary — an unrecognized key
18
+ * or a value shape that doesn't parse (e.g. a malformed enum string) is
19
+ * ignored by the renderer rather than applied or thrown.
20
+ */
21
+ export interface StyleProps {
22
+ /** Layout mode for this node's children. `"none"` skips both layout and rendering for the whole subtree. */
23
+ display?: "flex" | "block" | "grid" | "none";
24
+ /** Main-axis direction for a `"flex"` container. */
25
+ flex_direction?: "row" | "column" | "row_reverse" | "column_reverse";
26
+ /** Main-axis alignment of children within this container. */
27
+ justify_content?: "start" | "end" | "center" | "stretch";
28
+ /** Cross-axis alignment of children within this container. */
29
+ align_items?: "start" | "end" | "center" | "stretch";
30
+ /** Uniform spacing, in px, between children — applied on both axes. */
31
+ gap?: number;
32
+ /** Fixed width in px, or `"auto"` to size to content. */
33
+ width?: number | "auto";
34
+ /** Fixed height in px, or `"auto"` to size to content. */
35
+ height?: number | "auto";
36
+ /** Uniform border width in px, applied to all four sides. */
37
+ border_width?: number;
38
+ /** Fill color, as a hex number (`0xRRGGBB`) or a CSS-style string (`"#rrggbb"`/`"#rgb"`). */
39
+ background?: number | string;
40
+ /** Border color. Accepts the same formats as {@link StyleProps.background}. */
41
+ border_color?: number | string;
42
+ /** Color for this container's own text. Cascades to descendant text leaves, same as {@link StyleProps.text_size}; there's no separate per-leaf text styling. */
43
+ text_color?: number | string;
44
+ /** Uniform corner radius in px, applied to all four corners. */
45
+ corner_radius?: number;
46
+ /** Font size in px for this container's own text. Cascades to descendant text leaves, same as {@link StyleProps.text_color}. */
47
+ text_size?: number;
48
+ }
49
+ /**
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.
54
+ */
55
+ export type EventListener = (...args: unknown[]) => void;
@@ -0,0 +1,21 @@
1
+ import { App, Component, ComponentPublicInstance } from '@vue/runtime-core';
2
+ import { IncaElement } from './nodeOps.mts';
3
+ /**
4
+ * `@vue/runtime-core`'s `App`, with `mount` additionally callable with no
5
+ * argument to target the host's own root container. An intersection rather
6
+ * than an `Omit`: `App`'s `this`-returning methods (`use`, `mixin`,
7
+ * `component`, `directive`) have to keep this wider `mount` when chained.
8
+ */
9
+ export type IncaApp = App<IncaElement> & {
10
+ mount: (rootContainer?: IncaElement) => ComponentPublicInstance;
11
+ };
12
+ /**
13
+ * Creates a Vue app whose root mounts against a {@link IncaElement} host
14
+ * handle instead of a DOM element. `app.mount()` with no argument targets
15
+ * the host's root container; `app.unmount`, `app.use`, etc. all behave
16
+ * exactly as `@vue/runtime-core` itself documents them.
17
+ * @param rootComponent - the component to mount as the app's root
18
+ * @param rootProps - props to pass to that root component
19
+ * @returns the created app
20
+ */
21
+ export declare function createIncaApp(rootComponent: Component, rootProps?: Record<string, unknown> | null): IncaApp;
@@ -0,0 +1,4 @@
1
+ export { createIncaApp } from './createApp.mts';
2
+ export type { IncaApp } from './createApp.mts';
3
+ export type { IncaCore } from '../rendererCore.mts';
4
+ export type { IncaElement, IncaNode } from './nodeOps.mts';
@@ -0,0 +1,44 @@
1
+ import { RendererOptions } from '@vue/runtime-core';
2
+ import { IncaCore } from '../rendererCore.mts';
3
+ import { NodeId } from '../types.mts';
4
+ /**
5
+ * A container host node: either a real element or the hidden stand-in
6
+ * {@link nodeOps.createComment} uses. Also `@vue/runtime-core`'s
7
+ * `HostElement` — the only host node type that can act as a 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 {@link nodeOps.insert}/
12
+ * {@link nodeOps.remove}.
13
+ */
14
+ export interface IncaElement {
15
+ /** The underlying native node's id — the only part of this object the native tree itself knows about. */
16
+ readonly id: NodeId;
17
+ /** `"comment"` for the hidden stand-in {@link nodeOps.createComment} produces; `"element"` for every other container. Purely informational — both render identically once created. */
18
+ readonly kind: "element" | "comment";
19
+ /** The current parent, or `null` if this node isn't attached to the tree. */
20
+ parent: IncaElement | null;
21
+ /** This node's children, in render order. */
22
+ children: IncaNode[];
23
+ }
24
+ /** A text leaf host node — `@vue/runtime-core`'s `HostNode` for text. */
25
+ export interface IncaText {
26
+ /** The underlying native node's id. */
27
+ readonly id: NodeId;
28
+ /** Discriminates this node within the {@link IncaNode} union. */
29
+ readonly kind: "text";
30
+ /** The current parent, or `null` if this node isn't attached to the tree. */
31
+ parent: IncaElement | null;
32
+ /** The text content, mirroring what's been pushed to the native node via {@link setAttribute}. */
33
+ text: string;
34
+ }
35
+ /** Any host node {@link nodeOps} can produce: an element, comment, or text leaf. */
36
+ export type IncaNode = IncaElement | IncaText;
37
+ /**
38
+ * `@vue/runtime-core`'s {@link RendererOptions}`<IncaNode, IncaElement>`,
39
+ * minus `patchProp` (see `./patchProp.mts`) — the host-node lifecycle half
40
+ * of `incajs/vue`'s custom renderer, built entirely on the injected
41
+ * {@link IncaCore}, never on the native bridge directly.
42
+ * @param core - the incajs bindings to drive the native tree through
43
+ */
44
+ export declare function createNodeOps(core: IncaCore): Omit<RendererOptions<IncaNode, IncaElement>, "patchProp">;
@@ -0,0 +1,22 @@
1
+ import { RendererOptions } from '@vue/runtime-core';
2
+ import { IncaCore } from '../rendererCore.mts';
3
+ import { IncaElement } from './nodeOps.mts';
4
+ /**
5
+ * {@link RendererOptions.patchProp} — applies one changed `v-bind`/
6
+ * attribute/event prop to a host element:
7
+ *
8
+ * - `style` (an object, per `:style="{...}"`) fans out to one
9
+ * `core.setStyle` call per entry; an entry whose value isn't a
10
+ * string/number is skipped.
11
+ * - An `onXxx` key registers `nextValue` as the listener for `xxx`, taking a
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.
15
+ * - Everything else falls through to `core.setAttribute`, again skipping
16
+ * a non-string/number/boolean value rather than passing it through.
17
+ *
18
+ * There is no native "unset" call, so a prop that's removed entirely (a
19
+ * `null`/`undefined` `nextValue`) is left as-is rather than cleared.
20
+ * @param core - the incajs bindings to drive the native tree through
21
+ */
22
+ export declare function createPatchProp(core: IncaCore): RendererOptions<unknown, IncaElement>["patchProp"];
package/dist/vue.js ADDED
@@ -0,0 +1,108 @@
1
+ import { s as e, t } from "./src-EeQFPfUI.js";
2
+ import { createRenderer as n } from "@vue/runtime-core";
3
+ //#region src/vue/nodeOps.mts
4
+ function r(e) {
5
+ function t(t) {
6
+ let n = e.createNode("text");
7
+ return e.setAttribute(n, "value", t), {
8
+ id: n,
9
+ kind: "text",
10
+ parent: null,
11
+ text: t
12
+ };
13
+ }
14
+ function n(e) {
15
+ let t = e.parent;
16
+ if (!t) return;
17
+ let n = t.children.indexOf(e);
18
+ n !== -1 && t.children.splice(n, 1), e.parent = null;
19
+ }
20
+ function r(t) {
21
+ t.parent && e.removeChild(t.parent.id, t.id), n(t);
22
+ }
23
+ return {
24
+ createElement(t) {
25
+ return {
26
+ id: e.createNode(t),
27
+ kind: "element",
28
+ parent: null,
29
+ children: []
30
+ };
31
+ },
32
+ createText: t,
33
+ createComment(t) {
34
+ let n = e.createNode("div");
35
+ return e.setStyle(n, "display", "none"), {
36
+ id: n,
37
+ kind: "comment",
38
+ parent: null,
39
+ children: []
40
+ };
41
+ },
42
+ setText(t, n) {
43
+ e.setAttribute(t.id, "value", n), t.text = n;
44
+ },
45
+ setElementText(n, r) {
46
+ for (let t of n.children.splice(0)) e.destroyNode(t.id), t.parent = null;
47
+ if (!r) return;
48
+ let i = t(r);
49
+ e.appendChild(n.id, i.id), i.parent = n, n.children.push(i);
50
+ },
51
+ insert(t, n, i) {
52
+ r(t);
53
+ let a = i ? n.children.indexOf(i) : -1;
54
+ e.insertBefore(n.id, t.id, i && a !== -1 ? i.id : null), a === -1 ? n.children.push(t) : n.children.splice(a, 0, t), t.parent = n;
55
+ },
56
+ remove(t) {
57
+ n(t), e.destroyNode(t.id);
58
+ },
59
+ parentNode(e) {
60
+ return e.parent;
61
+ },
62
+ nextSibling(e) {
63
+ let t = e.parent;
64
+ if (!t) return null;
65
+ let n = t.children.indexOf(e);
66
+ return t.children[n + 1] ?? null;
67
+ }
68
+ };
69
+ }
70
+ //#endregion
71
+ //#region src/vue/patchProp.mts
72
+ var i = (e) => /^on[A-Z]/.test(e);
73
+ function a(e, t, n) {
74
+ if (typeof n == "object" && n) for (let [r, i] of Object.entries(n)) (typeof i == "string" || typeof i == "number") && e.setStyle(t.id, r, i);
75
+ }
76
+ function o(e) {
77
+ if (typeof e == "function") return e;
78
+ if (!Array.isArray(e)) return null;
79
+ let t = e.filter((e) => typeof e == "function");
80
+ return t.length === 0 ? null : (...e) => {
81
+ for (let n of t) n(...e);
82
+ };
83
+ }
84
+ function s(e, t, n, r) {
85
+ let i = n.slice(2).toLowerCase(), a = o(r);
86
+ a ? e.setEventListener(t.id, i, a) : e.removeEventListener(t.id, i);
87
+ }
88
+ function c(e) {
89
+ return (t, n, r, o) => {
90
+ n === "style" ? a(e, t, o) : i(n) ? s(e, t, n, o) : (typeof o == "string" || typeof o == "number" || typeof o == "boolean") && e.setAttribute(t.id, n, o);
91
+ };
92
+ }
93
+ //#endregion
94
+ //#region src/vue/createApp.mts
95
+ function l(i, a) {
96
+ let o = n({
97
+ ...r(t),
98
+ patchProp: c(t)
99
+ }).createApp(i, a), s = o.mount.bind(o);
100
+ return Object.assign(o, { mount: (t) => s(t ?? {
101
+ id: e(),
102
+ kind: "element",
103
+ parent: null,
104
+ children: []
105
+ }) });
106
+ }
107
+ //#endregion
108
+ export { l as createIncaApp };
package/package.json CHANGED
@@ -1,23 +1,71 @@
1
1
  {
2
2
  "name": "incajs",
3
- "version": "0.0.0",
4
- "description": "Incarnative.js — a GPU-native, Webview-free desktop application framework powered by GPUI and QuickJS. Name reservation; the real implementation is still in development.",
3
+ "version": "0.0.1",
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.",
5
5
  "keywords": [
6
6
  "cross-platform",
7
+ "custom-renderer",
7
8
  "desktop-app",
8
9
  "electron-alternative",
10
+ "framework-agnostic",
9
11
  "gpui",
10
12
  "gui",
13
+ "incajs",
14
+ "incarnative.js",
11
15
  "quickjs",
12
16
  "rust",
13
17
  "tauri-alternative",
14
18
  "vue",
19
+ "vue3",
15
20
  "webview-free"
16
21
  ],
17
22
  "license": "(MIT OR Apache-2.0)",
18
23
  "repository": {
19
24
  "type": "git",
20
- "url": "git+https://github.com/tom96da/gpjs-ui.git",
25
+ "url": "git+https://github.com/tom96da/incajs.git",
21
26
  "directory": "packages/core"
27
+ },
28
+ "files": [
29
+ "dist"
30
+ ],
31
+ "type": "module",
32
+ "sideEffects": false,
33
+ "main": "./dist/index.js",
34
+ "types": "./dist/index.d.mts",
35
+ "exports": {
36
+ ".": {
37
+ "types": "./dist/index.d.mts",
38
+ "import": "./dist/index.js"
39
+ },
40
+ "./vue": {
41
+ "types": "./dist/vue/index.d.mts",
42
+ "import": "./dist/vue.js"
43
+ }
44
+ },
45
+ "publishConfig": {
46
+ "access": "public"
47
+ },
48
+ "devDependencies": {
49
+ "@vue/runtime-core": "^3.5.42",
50
+ "oxfmt": "^0.66.0",
51
+ "oxlint": "^1.81.0"
52
+ },
53
+ "peerDependencies": {
54
+ "@vue/runtime-core": "^3.5.42"
55
+ },
56
+ "peerDependenciesMeta": {
57
+ "@vue/runtime-core": {
58
+ "optional": true
59
+ }
60
+ },
61
+ "engines": {
62
+ "node": ">=22"
63
+ },
64
+ "scripts": {
65
+ "build": "vite build",
66
+ "test": "vitest run",
67
+ "lint": "oxlint --type-aware",
68
+ "format": "oxfmt --check .",
69
+ "typecheck": "oxlint -A all --type-aware --type-check"
22
70
  }
23
71
  }