incajs 0.0.7 → 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
@@ -16,8 +16,8 @@ export type CallbackId = number;
16
16
  export type AttributeValue = string | number | boolean;
17
17
  /**
18
18
  * Element kind passed to `createNode`. `"text"` is the only tag with
19
- * dedicated rendering behavior — a leaf that renders its `"value"`
20
- * attribute's string content. Any other string is a generic styled
19
+ * dedicated rendering behavior — it renders its `"value"` attribute followed
20
+ * by its descendants' text. Any other string is a generic styled
21
21
  * container; the `string & {}` half of this type keeps `"text"`'s
22
22
  * autocomplete while still accepting an arbitrary tag name.
23
23
  */
@@ -55,6 +55,54 @@ export interface StyleProps {
55
55
  corner_radius?: number;
56
56
  /** Font size in px for this container's own text. Cascades to descendant text leaves, same as {@link StyleProps.text_color}. */
57
57
  text_size?: number;
58
+ /** Overflow on both axes; `"scroll"` (alias `"auto"`) makes the container scroll with the wheel. Overridden per axis by {@link StyleProps.overflow_x}/{@link StyleProps.overflow_y}. */
59
+ overflow?: "visible" | "hidden" | "scroll" | "auto";
60
+ /** Horizontal overflow; wins over {@link StyleProps.overflow}. */
61
+ overflow_x?: "visible" | "hidden" | "scroll" | "auto";
62
+ /** Vertical overflow; wins over {@link StyleProps.overflow}. */
63
+ overflow_y?: "visible" | "hidden" | "scroll" | "auto";
64
+ /** Inner spacing in px (`>= 0`) on all four sides. Overridden per axis by {@link StyleProps.padding_x}/{@link StyleProps.padding_y} and per side by the `padding_*` side keys. */
65
+ padding?: number;
66
+ /** Horizontal inner spacing in px (`>= 0`); wins over {@link StyleProps.padding}. */
67
+ padding_x?: number;
68
+ /** Vertical inner spacing in px (`>= 0`); wins over {@link StyleProps.padding}. */
69
+ padding_y?: number;
70
+ /** Top inner spacing in px (`>= 0`); wins over {@link StyleProps.padding_y}. */
71
+ padding_top?: number;
72
+ /** Right inner spacing in px (`>= 0`); wins over {@link StyleProps.padding_x}. */
73
+ padding_right?: number;
74
+ /** Bottom inner spacing in px (`>= 0`); wins over {@link StyleProps.padding_y}. */
75
+ padding_bottom?: number;
76
+ /** Left inner spacing in px (`>= 0`); wins over {@link StyleProps.padding_x}. */
77
+ padding_left?: number;
78
+ /** Outer spacing in px (negative allowed) or `"auto"` on all four sides. Overridden per axis by {@link StyleProps.margin_x}/{@link StyleProps.margin_y} and per side by the `margin_*` side keys. */
79
+ margin?: number | "auto";
80
+ /** Horizontal outer spacing; wins over {@link StyleProps.margin}. */
81
+ margin_x?: number | "auto";
82
+ /** Vertical outer spacing; wins over {@link StyleProps.margin}. */
83
+ margin_y?: number | "auto";
84
+ /** Top outer spacing; wins over {@link StyleProps.margin_y}. */
85
+ margin_top?: number | "auto";
86
+ /** Right outer spacing; wins over {@link StyleProps.margin_x}. */
87
+ margin_right?: number | "auto";
88
+ /** Bottom outer spacing; wins over {@link StyleProps.margin_y}. */
89
+ margin_bottom?: number | "auto";
90
+ /** Left outer spacing; wins over {@link StyleProps.margin_x}. */
91
+ margin_left?: number | "auto";
92
+ /** Share (`>= 0`) of the free space in the parent's main axis this node takes. */
93
+ flex_grow?: number;
94
+ /** Share (`>= 0`) of the overflow in the parent's main axis this node gives up. */
95
+ flex_shrink?: number;
96
+ /** Opacity from `0` to `1`, applied to this node and its descendants; values outside are clamped. */
97
+ opacity?: number;
98
+ /** Minimum width in px, or `"auto"` for the default minimum. */
99
+ min_width?: number | "auto";
100
+ /** Minimum height in px, or `"auto"` for the default minimum. */
101
+ min_height?: number | "auto";
102
+ /** Maximum width in px, or `"auto"` for no limit. */
103
+ max_width?: number | "auto";
104
+ /** Maximum height in px, or `"auto"` for no limit. */
105
+ max_height?: number | "auto";
58
106
  }
59
107
  /**
60
108
  * Signature of a callback registered via `setEventListener`. The
@@ -62,7 +110,7 @@ export interface StyleProps {
62
110
  * event's name), `target`/`currentTarget` (both the {@link NodeId} it fired
63
111
  * on), `stopPropagation`/`stopImmediatePropagation`/`preventDefault`
64
112
  * methods, plus whatever fields that event kind carries — see
65
- * https://tom96da.github.io/incajs/reference/events for the full list of
113
+ * https://incajs.tom96da.com/reference/events for the full list of
66
114
  * wired event names and their fields.
67
115
  */
68
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.7",
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"