incajs 0.0.8 → 0.0.9

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,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("./rendererCore.mts");
10
+ export type IncaCore = typeof import('./rendererCore.mts');
package/dist/types.d.mts CHANGED
@@ -110,7 +110,7 @@ export interface StyleProps {
110
110
  * event's name), `target`/`currentTarget` (both the {@link NodeId} it fired
111
111
  * on), `stopPropagation`/`stopImmediatePropagation`/`preventDefault`
112
112
  * methods, plus whatever fields that event kind carries — see
113
- * https://tom96da.github.io/incajs/reference/events for the full list of
113
+ * https://incajs.tom96da.com/reference/events for the full list of
114
114
  * wired event names and their fields.
115
115
  */
116
116
  export type EventListener = (...args: unknown[]) => void;
@@ -10,8 +10,13 @@ import { IncaElement } from './nodeOps.mts';
10
10
  * is new or changed. `core.removeStyle` runs for each sent entry that is now
11
11
  * absent, `null`, or not a string/number. A string or `null` `style`
12
12
  * removes every entry.
13
- * - An `onXxx` key registers `nextValue` as the listener for `xxx`, taking a
14
- * function or an array of them, and unbinds `xxx` for anything else. A
13
+ * - An `onXxx` key registers `nextValue` as a listener for `xxx`, taking a
14
+ * function or an array of them, and unbinds that key's listener for
15
+ * anything else. Each distinct key (`onClick`, `onClickOnce`) is its own
16
+ * listener; they run in the order first registered, a re-patch keeps its
17
+ * place, and the host sees one registration per element and event. A
18
+ * `.once` listener that has fired stays spent until its key is removed.
19
+ * `stopImmediatePropagation()` stops the listeners after it. A
15
20
  * trailing `Once`/`Passive`/`Capture` suffix (from Vue's `.once`/
16
21
  * `.passive`/`.capture` modifiers) is stripped first; `.once` really
17
22
  * removes the listener after it fires once, while `.passive`/`.capture`
package/dist/vue.js CHANGED
@@ -95,54 +95,113 @@ 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
- var m = (() => {
98
+ var m = (e) => e != null && typeof e.then == "function";
99
+ function h(e, t) {
100
+ let n = (Array.isArray(e) ? e : [e]).filter((e) => typeof e == "function");
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
+ };
117
+ }
118
+ function g(e, t) {
119
+ let n = e[0];
120
+ if (typeof n != "object" || !n) return t(() => !1);
121
+ let r = n.stopImmediatePropagation;
122
+ if (typeof r != "function") return t(() => !1);
123
+ let i = Object.hasOwn(n, "stopImmediatePropagation"), a = !1;
99
124
  try {
100
- return process.env.NODE_ENV === "production";
125
+ n.stopImmediatePropagation = (...e) => (a = !0, r.apply(n, e));
101
126
  } catch {
102
- return !1;
127
+ return t(() => !1);
103
128
  }
104
- })(), h = (e) => e != null && typeof e.then == "function";
105
- function g(e, t) {
106
- let n = (Array.isArray(e) ? e : [e]).filter((e) => typeof e == "function");
107
- return n.length === 0 ? null : (...e) => {
108
- let r, o = n.map((e) => (...n) => {
109
- try {
110
- let r = e(...n);
111
- return m && h(r) && r.then(void 0, (e) => {
112
- if (!t?.appContext.config.errorHandler) throw e;
113
- }), r;
114
- } catch (e) {
115
- throw r ??= { error: e }, e;
116
- }
117
- });
118
- if (a(o, t, i.NATIVE_EVENT_HANDLER, e), r && !t?.appContext.config.errorHandler) throw r.error;
129
+ try {
130
+ t(() => a);
131
+ } finally {
132
+ i ? n.stopImmediatePropagation = r : delete n.stopImmediatePropagation;
133
+ }
134
+ }
135
+ var _ = /* @__PURE__ */ new WeakMap();
136
+ function v(e, t, n, r) {
137
+ 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 && _.get(t)?.delete(n);
139
+ }
140
+ function y(e, t, n) {
141
+ let r = {
142
+ slots: /* @__PURE__ */ new Map(),
143
+ registered: !1,
144
+ dispatcher: (...i) => {
145
+ let a;
146
+ if (g(i, (o) => {
147
+ for (let s of Array.from(r.slots.keys())) {
148
+ if (o()) break;
149
+ let c = r.slots.get(s);
150
+ if (c && !c.fired) {
151
+ c.once && (c.fired = !0, v(e, t, n, r));
152
+ try {
153
+ c.listener(...i);
154
+ } catch (e) {
155
+ a ??= { error: e };
156
+ }
157
+ }
158
+ }
159
+ }), a) throw a.error;
160
+ }
119
161
  };
162
+ return r;
163
+ }
164
+ function b(e, t, n, r) {
165
+ let i = _.get(t)?.get(n);
166
+ i?.slots.delete(r) && v(e, t, n, i);
120
167
  }
121
- function _(e, t, n, r, i) {
122
- let { event: a, once: o } = u(n), s = g(r, i);
168
+ function x(e, t, n, r, i) {
169
+ let { event: a, once: o } = u(n), s = h(r, i);
123
170
  if (!s) {
124
- e.removeEventListener(t.id, a);
171
+ b(e, t, a, n);
125
172
  return;
126
173
  }
127
- if (!o) {
128
- e.setEventListener(t.id, a, s);
174
+ let c = _.get(t);
175
+ c || _.set(t, c = /* @__PURE__ */ new Map());
176
+ let l = c.get(a);
177
+ l || c.set(a, l = y(e, t, a));
178
+ let d = l.slots.get(n);
179
+ if (d) {
180
+ d.listener = s;
129
181
  return;
130
182
  }
131
- e.setEventListener(t.id, a, (...n) => {
132
- e.removeEventListener(t.id, a), s(...n);
183
+ l.slots.set(n, {
184
+ listener: s,
185
+ once: o,
186
+ fired: !1
133
187
  });
188
+ try {
189
+ v(e, t, a, l);
190
+ } catch (e) {
191
+ throw l.slots.delete(n), l.slots.size === 0 && c.delete(a), e;
192
+ }
134
193
  }
135
- function v(e) {
194
+ function S(e) {
136
195
  return (t, n, r, i, a, o) => {
137
- n === "style" ? p(e, t, i) : c(n) ? _(e, t, n, i, o ?? null) : (typeof i == "string" || typeof i == "number" || typeof i == "boolean") && e.setAttribute(t.id, n, i);
196
+ n === "style" ? p(e, t, i) : c(n) ? x(e, t, n, i, o ?? null) : (typeof i == "string" || typeof i == "number" || typeof i == "boolean") && e.setAttribute(t.id, n, i);
138
197
  };
139
198
  }
140
199
  //#endregion
141
200
  //#region src/vue/createApp.mts
142
- function y(i, a) {
201
+ function C(i, a) {
143
202
  let c = o({
144
203
  ...s(r),
145
- patchProp: v(r)
204
+ patchProp: S(r)
146
205
  }).createApp(i, a), l = c.mount.bind(c);
147
206
  function u() {
148
207
  let r = e();
@@ -158,4 +217,4 @@ function y(i, a) {
158
217
  return Object.assign(c, { mount: (e) => l(e ?? u()) });
159
218
  }
160
219
  //#endregion
161
- export { y as createIncaApp };
220
+ export { C as createIncaApp };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incajs",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
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.github.io/incajs/",
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.68.0",
52
- "oxlint": "^1.83.0"
51
+ "oxfmt": "^0.71.0",
52
+ "oxlint": "^1.86.0"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "@vue/runtime-core": "^3.5.43"