incajs 0.0.9 → 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 +1 -1
- package/dist/rendererCore.js +2 -2
- package/dist/types.d.mts +12 -7
- package/dist/vue/patchProp.d.mts +43 -25
- package/dist/vue.js +46 -55
- package/package.json +2 -2
|
@@ -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
|
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,33 +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
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
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.
|
|
31
50
|
*
|
|
32
|
-
* Removing any other prop (a `null`/`undefined` `nextValue`) leaves it as-is.
|
|
33
51
|
* @param core - the incajs bindings to drive the native tree through
|
|
34
52
|
*/
|
|
35
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,27 +95,11 @@ 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
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
return n.length === 0 ? null : (...e) => {
|
|
102
|
-
let r;
|
|
103
|
-
if (g(e, (o) => {
|
|
104
|
-
let s = n.map((e) => (...n) => {
|
|
105
|
-
if (!o()) try {
|
|
106
|
-
let r = e(...n);
|
|
107
|
-
return process.env.NODE_ENV === "production" && m(r) && r.then(void 0, (e) => {
|
|
108
|
-
if (!t?.appContext.config.errorHandler) throw e;
|
|
109
|
-
}), r;
|
|
110
|
-
} catch (e) {
|
|
111
|
-
throw r ??= { error: e }, e;
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
a(s, t, i.NATIVE_EVENT_HANDLER, e);
|
|
115
|
-
}), r && !t?.appContext.config.errorHandler) throw r.error;
|
|
116
|
-
};
|
|
98
|
+
function m(e) {
|
|
99
|
+
let t = (Array.isArray(e) ? e : [e]).filter((e) => typeof e == "function");
|
|
100
|
+
return t.length === 0 ? null : t;
|
|
117
101
|
}
|
|
118
|
-
function
|
|
102
|
+
function h(e, t) {
|
|
119
103
|
let n = e[0];
|
|
120
104
|
if (typeof n != "object" || !n) return t(() => !1);
|
|
121
105
|
let r = n.stopImmediatePropagation;
|
|
@@ -132,76 +116,83 @@ function g(e, t) {
|
|
|
132
116
|
i ? n.stopImmediatePropagation = r : delete n.stopImmediatePropagation;
|
|
133
117
|
}
|
|
134
118
|
}
|
|
135
|
-
var
|
|
136
|
-
function
|
|
119
|
+
var g = /* @__PURE__ */ new WeakMap();
|
|
120
|
+
function _(e, t, n, r) {
|
|
137
121
|
let i = Array.from(r.slots.values()).some((e) => !e.fired);
|
|
138
|
-
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 &&
|
|
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);
|
|
139
123
|
}
|
|
140
|
-
function
|
|
124
|
+
function v(e, t, n) {
|
|
141
125
|
let r = {
|
|
142
126
|
slots: /* @__PURE__ */ new Map(),
|
|
143
127
|
registered: !1,
|
|
144
|
-
dispatcher: (...
|
|
145
|
-
let
|
|
146
|
-
|
|
147
|
-
for (let
|
|
148
|
-
if (
|
|
149
|
-
let
|
|
150
|
-
if (
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
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
|
+
}
|
|
156
143
|
}
|
|
157
144
|
}
|
|
158
145
|
}
|
|
159
|
-
})
|
|
146
|
+
});
|
|
147
|
+
for (let e of s.slice(1)) Promise.reject(e);
|
|
148
|
+
if (s.length > 0) throw s[0];
|
|
160
149
|
}
|
|
161
150
|
};
|
|
162
151
|
return r;
|
|
163
152
|
}
|
|
164
|
-
function
|
|
165
|
-
let i =
|
|
166
|
-
i?.slots.delete(r) &&
|
|
153
|
+
function y(e, t, n, r) {
|
|
154
|
+
let i = g.get(t)?.get(n);
|
|
155
|
+
i?.slots.delete(r) && _(e, t, n, i);
|
|
167
156
|
}
|
|
168
|
-
function
|
|
169
|
-
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);
|
|
170
159
|
if (!s) {
|
|
171
|
-
|
|
160
|
+
y(e, t, a, n);
|
|
172
161
|
return;
|
|
173
162
|
}
|
|
174
|
-
let c =
|
|
175
|
-
c ||
|
|
163
|
+
let c = g.get(t);
|
|
164
|
+
c || g.set(t, c = /* @__PURE__ */ new Map());
|
|
176
165
|
let l = c.get(a);
|
|
177
|
-
l || c.set(a, l =
|
|
166
|
+
l || c.set(a, l = v(e, t, a));
|
|
178
167
|
let d = l.slots.get(n);
|
|
179
168
|
if (d) {
|
|
180
|
-
d.
|
|
169
|
+
d.handlers = s, d.instance = i;
|
|
181
170
|
return;
|
|
182
171
|
}
|
|
183
172
|
l.slots.set(n, {
|
|
184
|
-
|
|
173
|
+
attachedAt: e.latestEventId(),
|
|
174
|
+
handlers: s,
|
|
175
|
+
instance: i,
|
|
185
176
|
once: o,
|
|
186
177
|
fired: !1
|
|
187
178
|
});
|
|
188
179
|
try {
|
|
189
|
-
|
|
180
|
+
_(e, t, a, l);
|
|
190
181
|
} catch (e) {
|
|
191
182
|
throw l.slots.delete(n), l.slots.size === 0 && c.delete(a), e;
|
|
192
183
|
}
|
|
193
184
|
}
|
|
194
|
-
function
|
|
185
|
+
function x(e) {
|
|
195
186
|
return (t, n, r, i, a, o) => {
|
|
196
|
-
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);
|
|
197
188
|
};
|
|
198
189
|
}
|
|
199
190
|
//#endregion
|
|
200
191
|
//#region src/vue/createApp.mts
|
|
201
|
-
function
|
|
192
|
+
function S(i, a) {
|
|
202
193
|
let c = o({
|
|
203
194
|
...s(r),
|
|
204
|
-
patchProp:
|
|
195
|
+
patchProp: x(r)
|
|
205
196
|
}).createApp(i, a), l = c.mount.bind(c);
|
|
206
197
|
function u() {
|
|
207
198
|
let r = e();
|
|
@@ -217,4 +208,4 @@ function C(i, a) {
|
|
|
217
208
|
return Object.assign(c, { mount: (e) => l(e ?? u()) });
|
|
218
209
|
}
|
|
219
210
|
//#endregion
|
|
220
|
-
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",
|
|
@@ -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",
|