incajs 0.0.8 → 0.0.10
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/dist/chunks/{rendererCore-BmtunkdP.js → rendererCore-CIXQ3Bp7.js} +43 -33
- package/dist/events.d.mts +6 -0
- package/dist/rendererCore.d.mts +2 -2
- package/dist/rendererCore.js +2 -2
- package/dist/types.d.mts +12 -7
- package/dist/vue/patchProp.d.mts +43 -20
- package/dist/vue.js +81 -31
- package/package.json +5 -5
|
@@ -31,74 +31,84 @@ function r() {
|
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
var i = r();
|
|
35
|
-
function
|
|
34
|
+
var i = r(), a = 0;
|
|
35
|
+
function o() {
|
|
36
|
+
return a;
|
|
37
|
+
}
|
|
38
|
+
function s(e) {
|
|
39
|
+
return (...t) => {
|
|
40
|
+
let n = t[0]?.eventId;
|
|
41
|
+
return typeof n == "number" && n > a && (a = n), e(...t);
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function c(e) {
|
|
36
45
|
for (let t of e) i.release(t);
|
|
37
46
|
}
|
|
38
|
-
function
|
|
39
|
-
|
|
40
|
-
let a = i.add(e, t, r);
|
|
47
|
+
function l(e, t, r) {
|
|
48
|
+
u(e, t);
|
|
49
|
+
let a = i.add(e, t, s(r));
|
|
41
50
|
try {
|
|
42
51
|
n().addEventListener(e, t, a);
|
|
43
52
|
} catch (e) {
|
|
44
53
|
throw i.release(a), e;
|
|
45
54
|
}
|
|
46
55
|
}
|
|
47
|
-
function
|
|
56
|
+
function u(e, t) {
|
|
48
57
|
let r = i.idFor(e, t);
|
|
49
58
|
r !== void 0 && (n().removeEventListener(e, t, r), i.release(r));
|
|
50
59
|
}
|
|
51
|
-
function
|
|
60
|
+
function d(e) {
|
|
52
61
|
n().focusNode(e);
|
|
53
62
|
}
|
|
54
|
-
function
|
|
63
|
+
function f(e) {
|
|
55
64
|
n().blurNode(e);
|
|
56
65
|
}
|
|
57
66
|
//#endregion
|
|
58
67
|
//#region src/tree.mts
|
|
59
|
-
function
|
|
68
|
+
function p() {
|
|
60
69
|
return n().rootNodeId();
|
|
61
70
|
}
|
|
62
|
-
function
|
|
71
|
+
function m(e) {
|
|
63
72
|
return n().createNode(e);
|
|
64
73
|
}
|
|
65
|
-
function
|
|
74
|
+
function h(e, t) {
|
|
66
75
|
n().appendChild(e, t);
|
|
67
76
|
}
|
|
68
|
-
function
|
|
77
|
+
function g(e, t, r) {
|
|
69
78
|
n().insertBefore(e, t, r);
|
|
70
79
|
}
|
|
71
|
-
function
|
|
80
|
+
function _(e, t) {
|
|
72
81
|
n().removeChild(e, t);
|
|
73
82
|
}
|
|
74
|
-
function
|
|
75
|
-
|
|
83
|
+
function v(e) {
|
|
84
|
+
c(n().destroyNode(e));
|
|
76
85
|
}
|
|
77
|
-
function
|
|
86
|
+
function y(e, t, r) {
|
|
78
87
|
n().setAttribute(e, t, r);
|
|
79
88
|
}
|
|
80
|
-
function
|
|
89
|
+
function b(e, t, r) {
|
|
81
90
|
n().setStyle(e, t, r);
|
|
82
91
|
}
|
|
83
|
-
function
|
|
92
|
+
function x(e, t) {
|
|
84
93
|
n().removeStyle(e, t);
|
|
85
94
|
}
|
|
86
95
|
//#endregion
|
|
87
96
|
//#region src/rendererCore.mts
|
|
88
|
-
var
|
|
89
|
-
appendChild: () =>
|
|
90
|
-
blur: () =>
|
|
91
|
-
createNode: () =>
|
|
92
|
-
destroyNode: () =>
|
|
93
|
-
focus: () =>
|
|
94
|
-
insertBefore: () =>
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
97
|
+
var S = /* @__PURE__ */ t({
|
|
98
|
+
appendChild: () => h,
|
|
99
|
+
blur: () => f,
|
|
100
|
+
createNode: () => m,
|
|
101
|
+
destroyNode: () => v,
|
|
102
|
+
focus: () => d,
|
|
103
|
+
insertBefore: () => g,
|
|
104
|
+
latestEventId: () => o,
|
|
105
|
+
removeChild: () => _,
|
|
106
|
+
removeEventListener: () => u,
|
|
107
|
+
removeStyle: () => x,
|
|
108
|
+
rootNodeId: () => p,
|
|
109
|
+
setAttribute: () => y,
|
|
110
|
+
setEventListener: () => l,
|
|
111
|
+
setStyle: () => b
|
|
102
112
|
});
|
|
103
113
|
//#endregion
|
|
104
|
-
export {
|
|
114
|
+
export { g as a, p as c, f as d, d as f, l as h, v as i, y as l, u as m, h as n, _ as o, o as p, m as r, x as s, S as t, b as u };
|
package/dist/events.d.mts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { CallbackId, EventListener, NodeId } from './types.mts';
|
|
2
|
+
/**
|
|
3
|
+
* @returns the `eventId` of the newest event any registered listener has
|
|
4
|
+
* received, or 0 before the first. Ids grow with each input event, and every
|
|
5
|
+
* node dispatch of one event carries the same id.
|
|
6
|
+
*/
|
|
7
|
+
export declare function latestEventId(): number;
|
|
2
8
|
/**
|
|
3
9
|
* Drops the JS half of every registration in `callbackIds`. The native half
|
|
4
10
|
* is already gone by the time this runs — `destroyNode` takes both.
|
package/dist/rendererCore.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { setEventListener, removeEventListener, focus, blur } from './events.mts';
|
|
1
|
+
export { setEventListener, removeEventListener, latestEventId, focus, blur } from './events.mts';
|
|
2
2
|
export { appendChild, createNode, destroyNode, insertBefore, removeChild, rootNodeId, setAttribute, setStyle, removeStyle, } from './tree.mts';
|
|
3
3
|
/**
|
|
4
4
|
* The tree/event primitives a custom renderer (`incajs/vue`) drives the
|
|
@@ -7,4 +7,4 @@ export { appendChild, createNode, destroyNode, insertBefore, removeChild, rootNo
|
|
|
7
7
|
* Also the seam a renderer's own tests mock against, in place of a real
|
|
8
8
|
* `globalThis.__inca_native__`.
|
|
9
9
|
*/
|
|
10
|
-
export type IncaCore = typeof import(
|
|
10
|
+
export type IncaCore = typeof import('./rendererCore.mts');
|
package/dist/rendererCore.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, c as t, d as n, f as r, i,
|
|
2
|
-
export {
|
|
1
|
+
import { a as e, c as t, d as n, f as r, h as i, i as a, l as o, m as s, n as c, o as l, p as u, r as d, s as f, u as p } from "./chunks/rendererCore-CIXQ3Bp7.js";
|
|
2
|
+
export { c as appendChild, n as blur, d as createNode, a as destroyNode, r as focus, e as insertBefore, u as latestEventId, l as removeChild, s as removeEventListener, f as removeStyle, t as rootNodeId, o as setAttribute, i as setEventListener, p as setStyle };
|
package/dist/types.d.mts
CHANGED
|
@@ -105,12 +105,17 @@ export interface StyleProps {
|
|
|
105
105
|
max_height?: number | "auto";
|
|
106
106
|
}
|
|
107
107
|
/**
|
|
108
|
-
* Signature of a callback registered via `setEventListener`.
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
108
|
+
* Signature of a callback registered via `setEventListener`.
|
|
109
|
+
*
|
|
110
|
+
* The native host calls it with one argument, an object with:
|
|
111
|
+
* - `type`: the event's name.
|
|
112
|
+
* - `target` and `currentTarget`: both the {@link NodeId} the event fired on.
|
|
113
|
+
* - `eventId`: a number that grows with each event and is the same on every
|
|
114
|
+
* node that event reaches.
|
|
115
|
+
* - `stopPropagation()`, `stopImmediatePropagation()` and `preventDefault()`.
|
|
116
|
+
* - the fields that event kind carries.
|
|
117
|
+
*
|
|
118
|
+
* See https://incajs.tom96da.com/reference/events for the full list of wired
|
|
119
|
+
* event names and their fields.
|
|
115
120
|
*/
|
|
116
121
|
export type EventListener = (...args: unknown[]) => void;
|
package/dist/vue/patchProp.d.mts
CHANGED
|
@@ -3,28 +3,51 @@ import { IncaCore } from '../rendererCore.mts';
|
|
|
3
3
|
import { IncaElement } from './nodeOps.mts';
|
|
4
4
|
/**
|
|
5
5
|
* {@link RendererOptions.patchProp} — applies one changed `v-bind`/
|
|
6
|
-
* attribute/event prop to a host element
|
|
6
|
+
* attribute/event prop to a host element.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* -
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* -
|
|
25
|
-
*
|
|
8
|
+
* ### `style`
|
|
9
|
+
*
|
|
10
|
+
* An object (per `:style="{...}"`) is diffed against the entries already
|
|
11
|
+
* sent for this element.
|
|
12
|
+
* - `core.setStyle` runs for each entry that is new or changed.
|
|
13
|
+
* - `core.removeStyle` runs for each sent entry that is now absent, `null`,
|
|
14
|
+
* or not a string/number.
|
|
15
|
+
* - A string or `null` `style` removes every entry.
|
|
16
|
+
*
|
|
17
|
+
* ### `onXxx`
|
|
18
|
+
*
|
|
19
|
+
* The key registers `nextValue` as a listener for `xxx`, taking a function
|
|
20
|
+
* or an array of them, and unbinds that key's listener for anything else.
|
|
21
|
+
* - Order: each distinct key (`onClick`, `onClickOnce`) is its own listener.
|
|
22
|
+
* They run in the order first registered, a re-patch keeps its place, and
|
|
23
|
+
* the host sees one registration per element and event.
|
|
24
|
+
* - Propagation: `stopImmediatePropagation()` stops the listeners after it.
|
|
25
|
+
* - Timing: a listener attached while an event is being handled first runs
|
|
26
|
+
* for the next event; events are told apart by the `eventId` the host puts
|
|
27
|
+
* on each one.
|
|
28
|
+
* - Modifiers: a trailing `Once`/`Passive`/`Capture` suffix (from Vue's
|
|
29
|
+
* `.once`/`.passive`/`.capture` modifiers) is stripped first. `.once`
|
|
30
|
+
* really removes the listener after it fires once, and a listener that has
|
|
31
|
+
* fired stays spent until its key is removed. `.passive`/`.capture` bind
|
|
32
|
+
* as an ordinary listener with no native passive/capture-phase support
|
|
33
|
+
* yet.
|
|
34
|
+
* - Event names: see {@link EventListener} for which names are wired to real
|
|
35
|
+
* input by the native host today; other names are accepted but never fire.
|
|
36
|
+
* - Errors: an error a handler throws, or a rejection of an async handler,
|
|
37
|
+
* goes to the `onErrorCaptured` hooks and the app's `errorHandler`. Every
|
|
38
|
+
* handler of an event runs even when an earlier one fails, until one calls
|
|
39
|
+
* `stopImmediatePropagation()`. An error that no hook or `errorHandler`
|
|
40
|
+
* takes is logged to the console in a production build, or raised to the
|
|
41
|
+
* host's error report when `throwUnhandledErrorInProduction` is set. A
|
|
42
|
+
* development build warns and raises it to the host's error report, once
|
|
43
|
+
* per failing handler.
|
|
44
|
+
*
|
|
45
|
+
* ### Other props
|
|
46
|
+
*
|
|
47
|
+
* Everything else falls through to `core.setAttribute`, again skipping a
|
|
48
|
+
* non-string/number/boolean value rather than passing it through. Removing
|
|
49
|
+
* any other prop (a `null`/`undefined` `nextValue`) leaves it as-is.
|
|
26
50
|
*
|
|
27
|
-
* Removing any other prop (a `null`/`undefined` `nextValue`) leaves it as-is.
|
|
28
51
|
* @param core - the incajs bindings to drive the native tree through
|
|
29
52
|
*/
|
|
30
53
|
export declare function createPatchProp(core: IncaCore): RendererOptions<unknown, IncaElement>["patchProp"];
|
package/dist/vue.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as e, d as t, f as n, t as r } from "./chunks/rendererCore-
|
|
1
|
+
import { c as e, d as t, f as n, t as r } from "./chunks/rendererCore-CIXQ3Bp7.js";
|
|
2
2
|
import { ErrorCodes as i, callWithAsyncErrorHandling as a, createRenderer as o } from "@vue/runtime-core";
|
|
3
3
|
//#region src/vue/nodeOps.mts
|
|
4
4
|
function s(e) {
|
|
@@ -95,54 +95,104 @@ function p(e, t, n) {
|
|
|
95
95
|
for (let n of i.keys()) d(r[n]) || (e.removeStyle(t.id, n), i.delete(n));
|
|
96
96
|
for (let [n, a] of Object.entries(r)) d(a) && i.get(n) !== a && (e.setStyle(t.id, n, a), i.set(n, a));
|
|
97
97
|
}
|
|
98
|
-
|
|
98
|
+
function m(e) {
|
|
99
|
+
let t = (Array.isArray(e) ? e : [e]).filter((e) => typeof e == "function");
|
|
100
|
+
return t.length === 0 ? null : t;
|
|
101
|
+
}
|
|
102
|
+
function h(e, t) {
|
|
103
|
+
let n = e[0];
|
|
104
|
+
if (typeof n != "object" || !n) return t(() => !1);
|
|
105
|
+
let r = n.stopImmediatePropagation;
|
|
106
|
+
if (typeof r != "function") return t(() => !1);
|
|
107
|
+
let i = Object.hasOwn(n, "stopImmediatePropagation"), a = !1;
|
|
99
108
|
try {
|
|
100
|
-
|
|
109
|
+
n.stopImmediatePropagation = (...e) => (a = !0, r.apply(n, e));
|
|
101
110
|
} catch {
|
|
102
|
-
return !1;
|
|
111
|
+
return t(() => !1);
|
|
112
|
+
}
|
|
113
|
+
try {
|
|
114
|
+
t(() => a);
|
|
115
|
+
} finally {
|
|
116
|
+
i ? n.stopImmediatePropagation = r : delete n.stopImmediatePropagation;
|
|
103
117
|
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
118
|
+
}
|
|
119
|
+
var g = /* @__PURE__ */ new WeakMap();
|
|
120
|
+
function _(e, t, n, r) {
|
|
121
|
+
let i = Array.from(r.slots.values()).some((e) => !e.fired);
|
|
122
|
+
i && !r.registered ? (e.setEventListener(t.id, n, r.dispatcher), r.registered = !0) : !i && r.registered && (r.registered = !1, e.removeEventListener(t.id, n)), r.slots.size === 0 && g.get(t)?.delete(n);
|
|
123
|
+
}
|
|
124
|
+
function v(e, t, n) {
|
|
125
|
+
let r = {
|
|
126
|
+
slots: /* @__PURE__ */ new Map(),
|
|
127
|
+
registered: !1,
|
|
128
|
+
dispatcher: (...o) => {
|
|
129
|
+
let s = [], c = o[0]?.eventId;
|
|
130
|
+
h(o, (l) => {
|
|
131
|
+
for (let u of Array.from(r.slots.keys())) {
|
|
132
|
+
if (l()) break;
|
|
133
|
+
let d = r.slots.get(u);
|
|
134
|
+
if (d && !d.fired && !(typeof c == "number" && d.attachedAt >= c)) {
|
|
135
|
+
d.once && (d.fired = !0, _(e, t, n, r));
|
|
136
|
+
for (let e of d.handlers) {
|
|
137
|
+
if (l()) break;
|
|
138
|
+
try {
|
|
139
|
+
a(e, d.instance, i.NATIVE_EVENT_HANDLER, o);
|
|
140
|
+
} catch (e) {
|
|
141
|
+
s.push(e);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
for (let e of s.slice(1)) Promise.reject(e);
|
|
148
|
+
if (s.length > 0) throw s[0];
|
|
149
|
+
}
|
|
119
150
|
};
|
|
151
|
+
return r;
|
|
152
|
+
}
|
|
153
|
+
function y(e, t, n, r) {
|
|
154
|
+
let i = g.get(t)?.get(n);
|
|
155
|
+
i?.slots.delete(r) && _(e, t, n, i);
|
|
120
156
|
}
|
|
121
|
-
function
|
|
122
|
-
let { event: a, once: o } = u(n), s =
|
|
157
|
+
function b(e, t, n, r, i) {
|
|
158
|
+
let { event: a, once: o } = u(n), s = m(r);
|
|
123
159
|
if (!s) {
|
|
124
|
-
e
|
|
160
|
+
y(e, t, a, n);
|
|
125
161
|
return;
|
|
126
162
|
}
|
|
127
|
-
|
|
128
|
-
|
|
163
|
+
let c = g.get(t);
|
|
164
|
+
c || g.set(t, c = /* @__PURE__ */ new Map());
|
|
165
|
+
let l = c.get(a);
|
|
166
|
+
l || c.set(a, l = v(e, t, a));
|
|
167
|
+
let d = l.slots.get(n);
|
|
168
|
+
if (d) {
|
|
169
|
+
d.handlers = s, d.instance = i;
|
|
129
170
|
return;
|
|
130
171
|
}
|
|
131
|
-
|
|
132
|
-
e.
|
|
172
|
+
l.slots.set(n, {
|
|
173
|
+
attachedAt: e.latestEventId(),
|
|
174
|
+
handlers: s,
|
|
175
|
+
instance: i,
|
|
176
|
+
once: o,
|
|
177
|
+
fired: !1
|
|
133
178
|
});
|
|
179
|
+
try {
|
|
180
|
+
_(e, t, a, l);
|
|
181
|
+
} catch (e) {
|
|
182
|
+
throw l.slots.delete(n), l.slots.size === 0 && c.delete(a), e;
|
|
183
|
+
}
|
|
134
184
|
}
|
|
135
|
-
function
|
|
185
|
+
function x(e) {
|
|
136
186
|
return (t, n, r, i, a, o) => {
|
|
137
|
-
n === "style" ? p(e, t, i) : c(n) ?
|
|
187
|
+
n === "style" ? p(e, t, i) : c(n) ? b(e, t, n, i, o ?? null) : (typeof i == "string" || typeof i == "number" || typeof i == "boolean") && e.setAttribute(t.id, n, i);
|
|
138
188
|
};
|
|
139
189
|
}
|
|
140
190
|
//#endregion
|
|
141
191
|
//#region src/vue/createApp.mts
|
|
142
|
-
function
|
|
192
|
+
function S(i, a) {
|
|
143
193
|
let c = o({
|
|
144
194
|
...s(r),
|
|
145
|
-
patchProp:
|
|
195
|
+
patchProp: x(r)
|
|
146
196
|
}).createApp(i, a), l = c.mount.bind(c);
|
|
147
197
|
function u() {
|
|
148
198
|
let r = e();
|
|
@@ -158,4 +208,4 @@ function y(i, a) {
|
|
|
158
208
|
return Object.assign(c, { mount: (e) => l(e ?? u()) });
|
|
159
209
|
}
|
|
160
210
|
//#endregion
|
|
161
|
-
export {
|
|
211
|
+
export { S as createIncaApp };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "incajs",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "A GPU-native, Webview-free desktop app framework built on GPUI and QuickJS.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cross-platform",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"vue3",
|
|
20
20
|
"webview-free"
|
|
21
21
|
],
|
|
22
|
-
"homepage": "https://tom96da.
|
|
22
|
+
"homepage": "https://incajs.tom96da.com/",
|
|
23
23
|
"license": "(MIT OR Apache-2.0)",
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@vue/runtime-core": "^3.5.43",
|
|
51
|
-
"oxfmt": "^0.
|
|
52
|
-
"oxlint": "^1.
|
|
51
|
+
"oxfmt": "^0.71.0",
|
|
52
|
+
"oxlint": "^1.86.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@vue/runtime-core": "^3.5.43"
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
62
|
"engines": {
|
|
63
|
-
"node": ">=22"
|
|
63
|
+
"node": ">=22.18"
|
|
64
64
|
},
|
|
65
65
|
"scripts": {
|
|
66
66
|
"build": "vite build",
|