incajs 0.0.21 → 0.0.23

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.
Files changed (39) hide show
  1. package/README.md +1 -1
  2. package/dist/chunks/hooks-N7NnMPKd.js +1 -0
  3. package/dist/chunks/rendererCore-B3-0H_IR.d.ts +385 -0
  4. package/dist/chunks/rendererCore-b4ytjgR8.js +1 -0
  5. package/dist/chunks/rolldown-runtime-DK3Fl9T5.js +1 -0
  6. package/dist/chunks/window-DD6KfOr9.d.ts +691 -0
  7. package/dist/index.d.ts +12 -0
  8. package/dist/index.js +1 -3
  9. package/dist/rendererCore.d.ts +3 -0
  10. package/dist/rendererCore.js +1 -4
  11. package/dist/vue-runtime.d.ts +3 -0
  12. package/dist/vue-runtime.js +1 -2
  13. package/dist/{vue/createApp.d.mts → vue.d.ts} +6 -4
  14. package/dist/vue.js +2 -179
  15. package/package.json +6 -18
  16. package/dist/callbacks.d.mts +0 -31
  17. package/dist/chunks/handle-DdYIkUcm.js +0 -215
  18. package/dist/chunks/hooks-D1NFQN8Q.js +0 -205
  19. package/dist/chunks/rendererCore-NnTAUL80.js +0 -110
  20. package/dist/element/eventHandlers.d.mts +0 -12
  21. package/dist/element/geometry.d.mts +0 -61
  22. package/dist/element/handle.d.mts +0 -19
  23. package/dist/element/lifecycle.d.mts +0 -51
  24. package/dist/element/scroll.d.mts +0 -42
  25. package/dist/element/shadowTree.d.mts +0 -64
  26. package/dist/element/types.d.mts +0 -132
  27. package/dist/eventTarget.d.mts +0 -10
  28. package/dist/events.d.mts +0 -73
  29. package/dist/index.d.mts +0 -6
  30. package/dist/native.d.mts +0 -41
  31. package/dist/rendererCore.d.mts +0 -14
  32. package/dist/targets.d.mts +0 -1
  33. package/dist/tree.d.mts +0 -157
  34. package/dist/types.d.mts +0 -415
  35. package/dist/vue/index.d.mts +0 -2
  36. package/dist/vue/nodeOps.d.mts +0 -29
  37. package/dist/vue/patchProp.d.mts +0 -79
  38. package/dist/vue/runtime.d.mts +0 -2
  39. package/dist/window.d.mts +0 -13
@@ -0,0 +1,12 @@
1
+ import { A as IncaInputElement, E as TagName, F as RectLike, I as RectValues, N as ScrollIntoViewOptions, P as ScrollOptions, S as NodeId, T as StyleProps, _ as IncaPointerEvent, a as EventListener, b as IncaWindow, c as IncaCompositionEvent, d as IncaEventMap, f as IncaEventTarget, g as IncaMouseEvent, h as IncaKeyboardEvent, i as EventLike, j as IncaNode, k as IncaElement, l as IncaDocument, m as IncaInputEvent, n as AttributeValue, o as EventListenerObject, p as IncaFocusEvent, r as CallbackId, s as EventListenerOrObject, t as window, u as IncaEvent, v as IncaUIEvent, x as ListenerOptions, y as IncaWheelEvent } from "./chunks/window-DD6KfOr9.js";
2
+ /**
3
+ * The event target between the elements and `window`. An event at an element
4
+ * passes through it, and it is the next target after the mount container.
5
+ *
6
+ * It has the listener methods `addEventListener`, `removeEventListener` and
7
+ * `dispatchEvent`, the event handler properties such as `onkeydown`, and
8
+ * `activeElement`. A `wheel` listener is passive unless its options say
9
+ * `passive: false`. It is an instance of the global `Document`.
10
+ */
11
+ export declare const document: IncaDocument;
12
+ export { type AttributeValue, type CallbackId, type EventLike, type EventListener, type EventListenerObject, type EventListenerOrObject, type IncaCompositionEvent, type IncaDocument, type IncaElement, type IncaEvent, type IncaEventMap, type IncaEventTarget, type IncaFocusEvent, type IncaInputElement, type IncaInputEvent, type IncaKeyboardEvent, type IncaMouseEvent, type IncaNode, type IncaPointerEvent, type IncaUIEvent, type IncaWheelEvent, type IncaWindow, type ListenerOptions, type NodeId, type RectLike, type RectValues, type ScrollIntoViewOptions, type ScrollOptions, type StyleProps, type TagName, window };
package/dist/index.js CHANGED
@@ -1,3 +1 @@
1
- import { t as e } from "./chunks/hooks-D1NFQN8Q.js";
2
- import { t } from "./chunks/handle-DdYIkUcm.js";
3
- export { t as activeElement, e as window };
1
+ export{i as document,r as window}from"./chunks/hooks-N7NnMPKd.js";
@@ -0,0 +1,3 @@
1
+ import { A as IncaInputElement, C as Overflow, D as EventHandler, E as TagName, M as IncaText, O as EventHandlers, S as NodeId, T as StyleProps, _ as IncaPointerEvent, a as EventListener, b as IncaWindow, c as IncaCompositionEvent, d as IncaEventMap, f as IncaEventTarget, g as IncaMouseEvent, h as IncaKeyboardEvent, i as EventLike, j as IncaNode, k as IncaElement, l as IncaDocument, m as IncaInputEvent, n as AttributeValue, o as EventListenerObject, p as IncaFocusEvent, r as CallbackId, s as EventListenerOrObject, t as window, u as IncaEvent, v as IncaUIEvent, w as ScrollAlignment, x as ListenerOptions, y as IncaWheelEvent } from "./chunks/window-DD6KfOr9.js";
2
+ import { A as setAttribute, C as removeAttribute, D as scrollIntoViewNode, E as rootNodeId, F as dispatchEvent, I as focus, L as latestEventId, M as addEventListener, N as blur, O as scrollNode, P as click, R as removeEventListener, S as releaseNode, T as removeStyle, _ as focusedNode, a as insert, b as insertBefore, c as remove, d as isDestroyed, f as createIncaElement, g as destroyNode, h as createNode, i as createTextNode, j as setStyle, k as scrollOf, l as setElementText, m as appendChild, n as createCommentNode, o as nextSibling, p as rootElement, r as createElementNode, s as parentNode, t as IncaCore, u as setText, v as getAttribute, w as removeChild, x as layoutOf, y as holdNode, z as createEventTarget } from "./chunks/rendererCore-B3-0H_IR.js";
3
+ export { type AttributeValue, type CallbackId, type EventHandler, type EventHandlers, type EventLike, type EventListener, type EventListenerObject, type EventListenerOrObject, type IncaCompositionEvent, IncaCore, type IncaDocument, type IncaElement, type IncaEvent, type IncaEventMap, type IncaEventTarget, type IncaFocusEvent, type IncaInputElement, type IncaInputEvent, type IncaKeyboardEvent, type IncaMouseEvent, type IncaNode, type IncaPointerEvent, type IncaText, type IncaUIEvent, type IncaWheelEvent, type IncaWindow, type ListenerOptions, type NodeId, type Overflow, type ScrollAlignment, type StyleProps, type TagName, addEventListener, appendChild, blur, click, createCommentNode, createElementNode, createEventTarget, createIncaElement, createNode, createTextNode, destroyNode, dispatchEvent, focus, focusedNode, getAttribute, holdNode, insert, insertBefore, isDestroyed, latestEventId, layoutOf, nextSibling, parentNode, releaseNode, remove, removeAttribute, removeChild, removeEventListener, removeStyle, rootElement, rootNodeId, scrollIntoViewNode, scrollNode, scrollOf, setAttribute, setElementText, setStyle, setText, window };
@@ -1,4 +1 @@
1
- import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, u as c } from "./chunks/rendererCore-NnTAUL80.js";
2
- import { C as l, D as u, E as d, N as f, S as p, T as m, _ as h, a as g, b as _, c as v, d as y, f as b, g as x, h as S, i as C, k as w, l as T, m as E, n as D, o as O, p as k, r as A, s as j, t as M, u as N, v as P, w as F, x as I, y as L } from "./chunks/hooks-D1NFQN8Q.js";
3
- import { n as R } from "./chunks/handle-DdYIkUcm.js";
4
- export { I as addEventListener, D as appendChild, p as blur, l as click, i as createCommentNode, o as createElementNode, _ as createEventTarget, R as createIncaElement, A as createNode, n as createTextNode, C as destroyNode, F as dispatchEvent, m as focus, g as focusedNode, O as getAttribute, j as holdNode, e as insert, v as insertBefore, w as isDestroyed, d as latestEventId, T as layoutOf, a as nextSibling, s as parentNode, N as releaseNode, f as releaseWhenCollected, t as remove, y as removeAttribute, b as removeChild, u as removeEventListener, k as removeStyle, E as rootNodeId, S as scrollIntoViewNode, x as scrollNode, h as scrollOf, P as setAttribute, r as setElementText, L as setStyle, c as setText, M as window };
1
+ import{A as e,C as t,D as n,E as r,M as i,N as a,O as o,P as s,S as c,T as l,_ as u,a as d,b as f,c as p,d as m,f as h,h as g,j as _,k as v,l as y,n as b,o as x,p as S,r as C,s as w,t as T,u as E,v as D,w as O,x as k,y as A}from"./chunks/hooks-N7NnMPKd.js";import{a as j,c as M,i as N,l as P,n as F,o as I,r as L,s as R,u as z}from"./chunks/rendererCore-b4ytjgR8.js";export{x as addEventListener,u as appendChild,w as blur,p as click,F as createCommentNode,L as createElementNode,d as createEventTarget,T as createIncaElement,D as createNode,N as createTextNode,A as destroyNode,y as dispatchEvent,E as focus,f as focusedNode,k as getAttribute,c as holdNode,j as insert,t as insertBefore,S as isDestroyed,m as latestEventId,O as layoutOf,I as nextSibling,R as parentNode,l as releaseNode,g as releaseWhenCollected,M as remove,r as removeAttribute,n as removeChild,h as removeEventListener,o as removeStyle,b as rootElement,v as rootNodeId,e as scrollIntoViewNode,_ as scrollNode,i as scrollOf,a as setAttribute,P as setElementText,s as setStyle,z as setText,C as window};
@@ -0,0 +1,3 @@
1
+ import { vModelText, withKeys, withModifiers } from "@vue/runtime-dom";
2
+ export * from "@vue/runtime-core";
3
+ export { vModelText, withKeys, withModifiers };
@@ -1,2 +1 @@
1
- export { withKeys, withModifiers } from "@vue/runtime-dom";
2
- export * from "@vue/runtime-core";
1
+ export{vModelText,withKeys,withModifiers}from"@vue/runtime-dom";export*from"@vue/runtime-core";
@@ -1,12 +1,13 @@
1
- import { App, Component, ComponentPublicInstance } from '@vue/runtime-core';
2
- import { IncaElement } from '../rendererCore.mts';
1
+ import { k as IncaElement } from "./chunks/window-DD6KfOr9.js";
2
+ import "./chunks/rendererCore-B3-0H_IR.js";
3
+ import { App, Component, ComponentPublicInstance } from "@vue/runtime-core";
3
4
  /**
4
5
  * `@vue/runtime-core`'s `App`, with `mount` also callable with no argument
5
6
  * to target the host's own root container. `use`, `mixin`, `component` and
6
7
  * `directive` return an `IncaApp`.
7
8
  */
8
- export type IncaApp = App<IncaElement> & {
9
- mount: (rootContainer?: IncaElement) => ComponentPublicInstance;
9
+ type IncaApp = App<IncaElement> & {
10
+ mount: (rootContainer?: IncaElement) => ComponentPublicInstance;
10
11
  };
11
12
  /**
12
13
  * Creates a Vue app whose root mounts on an {@link IncaElement} host
@@ -18,3 +19,4 @@ export type IncaApp = App<IncaElement> & {
18
19
  * @returns the created app
19
20
  */
20
21
  export declare function createIncaApp(rootComponent: Component, rootProps?: Record<string, unknown> | null): IncaApp;
22
+ export type { IncaApp };
package/dist/vue.js CHANGED
@@ -1,179 +1,2 @@
1
- import { t as e } from "./chunks/rendererCore-NnTAUL80.js";
2
- import { m as t } from "./chunks/hooks-D1NFQN8Q.js";
3
- import { n } from "./chunks/handle-DdYIkUcm.js";
4
- import { ErrorCodes as r, callWithAsyncErrorHandling as i, createRenderer as a, warn as o } from "@vue/runtime-core";
5
- //#region src/vue/nodeOps.mts
6
- function s(e) {
7
- return Object.defineProperty(e, "__v_skip", { value: !0 }), e;
8
- }
9
- function c(e) {
10
- return {
11
- createElement: (t) => s(e.createElementNode(t)),
12
- createText: (t) => s(e.createTextNode(t)),
13
- createComment: (t) => s(e.createCommentNode()),
14
- setText: (t, n) => e.setText(t, n),
15
- setElementText: (t, n) => e.setElementText(t, n),
16
- insert: (t, n, r) => e.insert(t, n, r),
17
- remove: (t) => e.remove(t),
18
- parentNode: e.parentNode,
19
- nextSibling: e.nextSibling
20
- };
21
- }
22
- function l(e, t) {
23
- let n = (t) => (e.holdNode(t.__node_id), e.releaseWhenCollected(t), t), { createElement: r, createText: i } = t;
24
- return {
25
- createElement: (e) => n(r(e)),
26
- createText: (e) => n(i(e))
27
- };
28
- }
29
- //#endregion
30
- //#region src/vue/patchProp.mts
31
- var u = (e) => /^on[^a-z]/.test(e), d = (e) => /^on[a-z]/.test(e), f = /(?:Once|Passive|Capture)$/, p = /^on:?(?:Once|Passive|Capture)$/, m = (e) => e.replace(/\B([A-Z])/g, "-$1").toLowerCase();
32
- function h(e) {
33
- let t = e, n = {
34
- event: "",
35
- once: !1,
36
- capture: !1,
37
- passive: !1
38
- }, r;
39
- for (; (r = t.match(f)) && !p.test(t);) t = t.slice(0, -r[0].length), r[0] === "Once" ? n.once = !0 : r[0] === "Capture" ? n.capture = !0 : n.passive = !0;
40
- return n.event = t[2] === ":" ? t.slice(3) : m(t.slice(2)), n;
41
- }
42
- var g = (e) => typeof e == "string" || typeof e == "number", _ = /* @__PURE__ */ new WeakMap();
43
- function v(e, t, n) {
44
- let r = typeof n == "object" && n ? n : {}, i = _.get(t);
45
- i || _.set(t, i = /* @__PURE__ */ new Map());
46
- let a = !1;
47
- for (let n of i.keys()) g(r[n]) || (e.removeStyle(t.__node_id, n), i.delete(n), a = !0);
48
- for (let [n, o] of Object.entries(r)) g(o) && (a || i.get(n) !== o) && (e.setStyle(t.__node_id, n, o), i.set(n, o));
49
- }
50
- function y(e, t) {
51
- return e ? typeof e == "function" ? [e] : Array.isArray(e) ? e.slice() : (o(`Wrong type passed as event handler to ${t} - did you forget @ or : in front of your prop?
52
- Expected function or array of functions, received type ${typeof e}.`), []) : null;
53
- }
54
- function b(e, t) {
55
- let n = e[0];
56
- if (typeof n != "object" || !n) return t(() => !1);
57
- let r = n.stopImmediatePropagation;
58
- if (typeof r != "function") return t(() => !1);
59
- let i = Object.hasOwn(n, "stopImmediatePropagation"), a = !1;
60
- try {
61
- n.stopImmediatePropagation = (...e) => (a = !0, r.apply(n, e));
62
- } catch {
63
- return t(() => !1);
64
- }
65
- try {
66
- t(() => a);
67
- } finally {
68
- i ? n.stopImmediatePropagation = r : delete n.stopImmediatePropagation;
69
- }
70
- }
71
- var x = /* @__PURE__ */ new WeakMap(), S = ({ event: e, capture: t, passive: n }) => `${e}:${t === !0}:${n === !0}`;
72
- function C(e, t, n, r) {
73
- let i = Array.from(r.slots.values()).some((e) => !e.fired);
74
- i && !r.registered && !e.isDestroyed(t) ? (e.addEventListener(t.__node_id, r.event, r.dispatcher, r.options), r.registered = !0) : !i && r.registered && (r.registered = !1, e.removeEventListener(t.__node_id, r.event, r.dispatcher, r.options)), r.slots.size === 0 && x.get(t)?.delete(n);
75
- }
76
- function w(e, t, n, { event: a, capture: o, passive: s }) {
77
- let c = {
78
- event: a,
79
- options: {
80
- capture: o,
81
- passive: s
82
- },
83
- slots: /* @__PURE__ */ new Map(),
84
- registered: !1,
85
- dispatcher: (...a) => {
86
- let o = [], s = a[0]?.eventId;
87
- b(a, (l) => {
88
- for (let u of Array.from(c.slots.keys())) {
89
- if (l()) break;
90
- let d = c.slots.get(u);
91
- if (d && !d.fired && !(typeof s == "number" && d.attachedAt >= s)) {
92
- d.once && (d.fired = !0, C(e, t, n, c));
93
- for (let e of d.handlers) {
94
- if (l()) break;
95
- if (e) try {
96
- i(e, d.instance, r.NATIVE_EVENT_HANDLER, a);
97
- } catch (e) {
98
- o.push(e);
99
- }
100
- }
101
- }
102
- }
103
- });
104
- for (let e of o.slice(1)) Promise.reject(e);
105
- if (o.length > 0) throw o[0];
106
- }
107
- };
108
- return c;
109
- }
110
- function T(e, t, n, r) {
111
- let i = S(n), a = x.get(t)?.get(i);
112
- a?.slots.delete(r) && C(e, t, i, a);
113
- }
114
- function E(e, t, n, r, i) {
115
- let a = h(n), o = y(r, n);
116
- if (!o) {
117
- T(e, t, a, n);
118
- return;
119
- }
120
- let s = S(a), c = x.get(t);
121
- c || x.set(t, c = /* @__PURE__ */ new Map());
122
- let l = c.get(s);
123
- l || c.set(s, l = w(e, t, s, a));
124
- let u = l.slots.get(n);
125
- if (u) u.handlers = o, u.instance = i;
126
- else {
127
- l.slots.set(n, {
128
- attachedAt: e.latestEventId(),
129
- handlers: o,
130
- instance: i,
131
- once: a.once,
132
- fired: !1
133
- });
134
- try {
135
- C(e, t, s, l);
136
- } catch (e) {
137
- throw l.slots.delete(n), l.slots.size === 0 && c.delete(s), e;
138
- }
139
- }
140
- }
141
- var D = /* @__PURE__ */ new Set([
142
- "disabled",
143
- "hidden",
144
- "inert",
145
- "allowfullscreen",
146
- "formnovalidate",
147
- "ismap",
148
- "itemscope",
149
- "nomodule",
150
- "novalidate",
151
- "readonly"
152
- ]);
153
- function O(e) {
154
- return (t, n, r, i, a, o) => {
155
- n.startsWith("onUpdate:") || (n === "style" ? v(e, t, i) : u(n) ? E(e, t, n, i, o ?? null) : d(n) && n in t ? typeof i == "string" ? (Reflect.set(t, n, null), e.setAttribute(t.__node_id, n, i)) : Reflect.set(t, n, i) : D.has(n) && !i && i !== "" ? e.removeAttribute(t.__node_id, n) : typeof i == "string" || typeof i == "number" || typeof i == "boolean" ? e.setAttribute(t.__node_id, n, i) : i == null ? e.removeAttribute(t.__node_id, n) : e.setAttribute(t.__node_id, n, String(i)));
156
- };
157
- }
158
- //#endregion
159
- //#region src/vue/createApp.mts
160
- var k = /* @__PURE__ */ new Set();
161
- function A(r, i) {
162
- let o = {
163
- ...c(e),
164
- patchProp: O(e)
165
- }, u = a(o);
166
- Object.assign(o, l(e, o));
167
- let d = u.createApp(r, i), f = d.mount.bind(d), p = d.unmount.bind(d);
168
- return Object.assign(d, {
169
- mount: (e) => {
170
- let r = f(e ?? s(n(t(), "element")));
171
- return k.add(d), r;
172
- },
173
- unmount: () => {
174
- p(), k.delete(d);
175
- }
176
- });
177
- }
178
- //#endregion
179
- export { A as createIncaApp };
1
+ import{n as e}from"./chunks/hooks-N7NnMPKd.js";import{t}from"./chunks/rendererCore-b4ytjgR8.js";import{ErrorCodes as n,callWithAsyncErrorHandling as r,createRenderer as i,warn as a}from"@vue/runtime-core";function o(e){return Object.defineProperty(e,"__v_skip",{value:!0}),e}function s(e){return{createElement:t=>o(e.createElementNode(t)),createText:t=>o(e.createTextNode(t)),createComment:t=>o(e.createCommentNode()),setText:(t,n)=>e.setText(t,n),setElementText:(t,n)=>e.setElementText(t,n),insert:(t,n,r)=>e.insert(t,n,r),remove:t=>e.remove(t),parentNode:e.parentNode,nextSibling:e.nextSibling}}function c(e,t){let n=t=>(e.holdNode(t.__node_id),e.releaseWhenCollected(t),t),{createElement:r,createText:i}=t;return{createElement:e=>n(r(e)),createText:e=>n(i(e))}}const l=e=>/^on[^a-z]/.test(e),u=e=>/^on[a-z]/.test(e),d=/(?:Once|Passive|Capture)$/,f=/^on:?(?:Once|Passive|Capture)$/,p=e=>e.replace(/\B([A-Z])/g,`-$1`).toLowerCase();function m(e){let t=e,n={event:``,once:!1,capture:!1,passive:!1},r;for(;(r=t.match(d))&&!f.test(t);)t=t.slice(0,-r[0].length),r[0]===`Once`?n.once=!0:r[0]===`Capture`?n.capture=!0:n.passive=!0;return n.event=t[2]===`:`?t.slice(3):p(t.slice(2)),n}const h=e=>typeof e==`string`||typeof e==`number`,g=/* @__PURE__ */ new WeakMap;function _(e,t,n){let r=typeof n==`object`&&n?n:{},i=g.get(t);i||g.set(t,i=/* @__PURE__ */ new Map);let a=!1;for(let n of i.keys())h(r[n])||(e.removeStyle(t.__node_id,n),i.delete(n),a=!0);for(let[n,o]of Object.entries(r))h(o)&&(a||i.get(n)!==o)&&(e.setStyle(t.__node_id,n,o),i.set(n,o))}function v(e,t){return e?typeof e==`function`?[e]:Array.isArray(e)?e.slice():(a(`Wrong type passed as event handler to ${t} - did you forget @ or : in front of your prop?
2
+ Expected function or array of functions, received type ${typeof e}.`),[]):null}function y(e,t){let n=e[0];if(typeof n!=`object`||!n)return t(()=>!1);let r=n.stopImmediatePropagation;if(typeof r!=`function`)return t(()=>!1);let i=Object.hasOwn(n,`stopImmediatePropagation`),a=!1;try{n.stopImmediatePropagation=(...e)=>(a=!0,r.apply(n,e))}catch{return t(()=>!1)}try{t(()=>a)}finally{i?n.stopImmediatePropagation=r:delete n.stopImmediatePropagation}}const b=/* @__PURE__ */ new WeakMap,x=({event:e,capture:t,passive:n})=>`${e}:${t===!0}:${n===!0}`;function S(e,t,n,r){let i=Array.from(r.slots.values()).some(e=>!e.fired);i&&!r.registered&&!e.isDestroyed(t)?(e.addEventListener(t.__node_id,r.event,r.dispatcher,r.options),r.registered=!0):!i&&r.registered&&(r.registered=!1,e.removeEventListener(t.__node_id,r.event,r.dispatcher,r.options)),r.slots.size===0&&b.get(t)?.delete(n)}function C(e,t,i,{event:a,capture:o,passive:s}){let c={event:a,options:{capture:o,passive:s},slots:/* @__PURE__ */ new Map,registered:!1,dispatcher:(...a)=>{let o=[],s=a[0]?.eventId;y(a,l=>{for(let u of Array.from(c.slots.keys())){if(l())break;let d=c.slots.get(u);if(d&&!d.fired&&!(typeof s==`number`&&d.attachedAt>=s)){d.once&&(d.fired=!0,S(e,t,i,c));for(let e of d.handlers){if(l())break;if(e)try{r(e,d.instance,n.NATIVE_EVENT_HANDLER,a)}catch(e){o.push(e)}}}}});for(let e of o.slice(1))Promise.reject(e);if(o.length>0)throw o[0]}};return c}function w(e,t,n,r){let i=x(n),a=b.get(t)?.get(i);a?.slots.delete(r)&&S(e,t,i,a)}function T(e,t,n,r,i){let a=m(n),o=v(r,n);if(!o){w(e,t,a,n);return}let s=x(a),c=b.get(t);c||b.set(t,c=/* @__PURE__ */ new Map);let l=c.get(s);l||c.set(s,l=C(e,t,s,a));let u=l.slots.get(n);if(u)u.handlers=o,u.instance=i;else{l.slots.set(n,{attachedAt:e.latestEventId(),handlers:o,instance:i,once:a.once,fired:!1});try{S(e,t,s,l)}catch(e){throw l.slots.delete(n),l.slots.size===0&&c.delete(s),e}}}const E=/* @__PURE__ */ new Set([`disabled`,`hidden`,`inert`,`allowfullscreen`,`formnovalidate`,`ismap`,`itemscope`,`nomodule`,`novalidate`,`readonly`]);function D(e){return(t,n,r,i,a,o)=>{n.startsWith(`onUpdate:`)||(n===`style`?_(e,t,i):l(n)?T(e,t,n,i,o??null):u(n)&&n in t?typeof i==`string`?(Reflect.set(t,n,null),e.setAttribute(t.__node_id,n,i)):Reflect.set(t,n,i):n===`value`&&`value`in t?Reflect.set(t,n,i??``):E.has(n)&&!i&&i!==``?e.removeAttribute(t.__node_id,n):typeof i==`string`||typeof i==`number`||typeof i==`boolean`?e.setAttribute(t.__node_id,n,i):i==null?e.removeAttribute(t.__node_id,n):e.setAttribute(t.__node_id,n,String(i)))}}const O=/* @__PURE__ */ new Set;function k(n,r){let a={...s(t),patchProp:D(t)},l=i(a);Object.assign(a,c(t,a));let u=l.createApp(n,r),d=u.mount.bind(u),f=u.unmount.bind(u);return Object.assign(u,{mount:t=>{let n=d(t??o(e()));return O.add(u),n},unmount:()=>{f(),O.delete(u)}})}export{k as createIncaApp};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incajs",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "description": "A GPU-native, Webview-free desktop app framework built on GPUI and QuickJS.",
5
5
  "keywords": [
6
6
  "cross-platform",
@@ -33,33 +33,28 @@
33
33
  "sideEffects": [
34
34
  "src/callbacks.mts",
35
35
  "src/targets.mts",
36
+ "src/interfaces.mts",
36
37
  "dist/chunks/hooks-*.js"
37
38
  ],
38
39
  "main": "./dist/index.js",
39
- "types": "./dist/index.d.mts",
40
+ "types": "./dist/index.d.ts",
40
41
  "exports": {
41
42
  ".": {
42
- "types": "./dist/index.d.mts",
43
+ "types": "./dist/index.d.ts",
43
44
  "import": "./dist/index.js"
44
45
  },
45
46
  "./vue": {
46
- "types": "./dist/vue/index.d.mts",
47
+ "types": "./dist/vue.d.ts",
47
48
  "import": "./dist/vue.js"
48
49
  },
49
50
  "./vue/runtime": {
50
- "types": "./dist/vue/runtime.d.mts",
51
+ "types": "./dist/vue-runtime.d.ts",
51
52
  "import": "./dist/vue-runtime.js"
52
53
  }
53
54
  },
54
55
  "publishConfig": {
55
56
  "access": "public"
56
57
  },
57
- "devDependencies": {
58
- "@vue/runtime-core": "^3.5.43",
59
- "@vue/runtime-dom": "^3.5.43",
60
- "oxfmt": "^0.72.0",
61
- "oxlint": "^1.87.0"
62
- },
63
58
  "peerDependencies": {
64
59
  "@vue/runtime-core": "^3.5.43",
65
60
  "@vue/runtime-dom": "^3.5.43"
@@ -74,12 +69,5 @@
74
69
  },
75
70
  "engines": {
76
71
  "node": ">=22.18"
77
- },
78
- "scripts": {
79
- "build": "vite build",
80
- "test": "vitest run",
81
- "lint": "oxlint --type-aware",
82
- "format": "oxfmt --check .",
83
- "typecheck": "oxlint -A all --type-aware --type-check"
84
72
  }
85
73
  }
@@ -1,31 +0,0 @@
1
- import { HostCallback } from './native.mts';
2
- import { CallbackId, EventListenerOrObject, NodeId } from './types.mts';
3
- /**
4
- * Records `callable` under `callbackId` at `globalThis.__inca_callbacks__`.
5
- * @param group - the node, event and capture flag as one string, from {@link groupOf}
6
- * @param listener - the listener the caller registered, which identifies the registration
7
- * @param callbackId - the id the host returned for the registration
8
- * @param callable - the function the host runs
9
- */
10
- export declare function addCallback(group: string, listener: EventListenerOrObject<never, never>, callbackId: CallbackId, callable: HostCallback): void;
11
- /**
12
- * @param group - the node, event and capture flag as one string
13
- * @param listener - the listener the caller registered
14
- * @returns the id registered for the pair, or `undefined`
15
- */
16
- export declare function callbackIdFor(group: string, listener: EventListenerOrObject<never, never>): CallbackId | undefined;
17
- /**
18
- * Forgets `callbackId` and the listener it names. An id that was never
19
- * registered, or was released already, changes nothing.
20
- * @param callbackId - the id to drop
21
- */
22
- export declare function releaseCallback(callbackId: CallbackId): void;
23
- /**
24
- * The capture flag is part of the identity: the same node, event and function
25
- * can listen in both phases side by side.
26
- * @param nodeId - the node listened on
27
- * @param event - the event name
28
- * @param capture - the capture flag of the registration
29
- * @returns the node, event and capture flag as one string
30
- */
31
- export declare const groupOf: (nodeId: NodeId, event: string, capture: boolean | undefined) => string;
@@ -1,215 +0,0 @@
1
- import { A as e, C as t, M as n, O as r, P as i, S as a, T as o, _ as s, a as c, b as l, g as u, h as d, k as f, l as p, o as m, v as h } from "./hooks-D1NFQN8Q.js";
2
- //#region src/element/eventHandlers.mts
3
- var g = [
4
- "auxclick",
5
- "blur",
6
- "click",
7
- "contextmenu",
8
- "dblclick",
9
- "focus",
10
- "keydown",
11
- "keyup",
12
- "mousedown",
13
- "mouseenter",
14
- "mouseleave",
15
- "mousemove",
16
- "mouseout",
17
- "mouseover",
18
- "mouseup",
19
- "scroll",
20
- "wheel"
21
- ];
22
- function _(e, t) {
23
- for (let n of g) {
24
- let r = null, i = function(e) {
25
- typeof r == "function" && Reflect.apply(r, this, [e]) === !1 && e.preventDefault();
26
- };
27
- Object.defineProperty(e, `on${n}`, {
28
- get: () => r,
29
- set(a) {
30
- t() || (r = typeof a == "function" || typeof a == "object" && a ? a : null, r === null ? e.removeEventListener(n, i) : e.addEventListener(n, i));
31
- }
32
- });
33
- }
34
- return e;
35
- }
36
- //#endregion
37
- //#region src/element/geometry.mts
38
- function v(e) {
39
- return f(e) ? null : p(e.__node_id);
40
- }
41
- function y(e) {
42
- let t = e.parent;
43
- return !v(e) || !t || !v(t) ? null : t;
44
- }
45
- function b(e) {
46
- let t = v(e);
47
- if (!t) return {
48
- left: 0,
49
- top: 0
50
- };
51
- let n = y(e), r = n ? v(n) : null;
52
- return {
53
- left: Math.round(t[0] - (r ? r[0] + r[4] : 0) + t[5]) || 0,
54
- top: Math.round(t[1] - (r ? r[1] + r[4] : 0) + t[6]) || 0
55
- };
56
- }
57
- function x(e) {
58
- let [t, n, r, i] = e ?? [
59
- 0,
60
- 0,
61
- 0,
62
- 0,
63
- 0
64
- ], a = {
65
- x: t,
66
- y: n,
67
- width: r,
68
- height: i,
69
- top: n,
70
- left: t,
71
- right: t + r,
72
- bottom: n + i
73
- };
74
- return {
75
- ...a,
76
- toJSON: () => ({ ...a })
77
- };
78
- }
79
- function S(e, t) {
80
- let n = t === "button" ? 0 : -1;
81
- if (typeof e != "string" && typeof e != "number") return n;
82
- let r = /^[\t\n\f\r ]*([+-]?\d+)/.exec(String(e));
83
- if (!r) return n;
84
- let i = Number(r[1]) || 0;
85
- return i >= -2147483648 && i <= 2147483647 ? i : n;
86
- }
87
- //#endregion
88
- //#region src/element/scroll.mts
89
- function C(e, t, n) {
90
- if (f(e)) return;
91
- let [r, i] = t, [a, o] = typeof r == "object" ? [r?.left, r?.top] : [r, i], [c, l] = n ? s(e.__node_id) ?? [0, 0] : [0, 0], d = (e, t) => {
92
- if (e === void 0) return null;
93
- let r = Number(e);
94
- return (n ? t : 0) + (Number.isFinite(r) ? r : 0);
95
- };
96
- u(e.__node_id, d(a, c), d(o, l));
97
- }
98
- function w(e) {
99
- let t = [
100
- "start",
101
- "center",
102
- "end",
103
- "nearest"
104
- ];
105
- return typeof e == "object" && e ? {
106
- block: t.includes(e.block ?? "") ? e.block : "start",
107
- inline: t.includes(e.inline ?? "") ? e.inline : "nearest"
108
- } : {
109
- block: e === !1 ? "end" : "start",
110
- inline: "nearest"
111
- };
112
- }
113
- //#endregion
114
- //#region src/element/handle.mts
115
- function T(r, c, u) {
116
- let p = l(() => r), g = () => f(T) ? null : s(r), T = _(i({
117
- get id() {
118
- return f(T) ? "" : String(m(r, "id") ?? "");
119
- },
120
- set id(e) {
121
- f(T) || h(r, "id", String(e));
122
- },
123
- kind: c,
124
- parent: null,
125
- children: [],
126
- focus: (e) => {
127
- f(T) || o(r, !!e?.preventScroll);
128
- },
129
- blur: () => a(r),
130
- click: () => {
131
- f(T) || t(r);
132
- },
133
- contains: (t) => {
134
- if (t == null) return !1;
135
- if (!e(t)) throw TypeError("the value is not a node. pass an element, a text node or null");
136
- for (let e = t; e !== null; e = e.parent) if (e === T) return !0;
137
- return !1;
138
- },
139
- addEventListener: (...e) => {
140
- f(T) || p.addEventListener(...e);
141
- },
142
- removeEventListener: (...e) => {
143
- f(T) || p.removeEventListener(...e);
144
- },
145
- dispatchEvent: (e) => f(T) || p.dispatchEvent(e),
146
- get tabIndex() {
147
- return S(f(T) ? null : m(r, "tabindex"), u ?? "");
148
- },
149
- set tabIndex(e) {
150
- f(T) || h(r, "tabindex", e | 0);
151
- },
152
- getBoundingClientRect: () => x(v(T)),
153
- get offsetWidth() {
154
- return Math.round(v(T)?.[2] ?? 0);
155
- },
156
- get offsetHeight() {
157
- return Math.round(v(T)?.[3] ?? 0);
158
- },
159
- get offsetLeft() {
160
- return b(T).left;
161
- },
162
- get offsetTop() {
163
- return b(T).top;
164
- },
165
- get offsetParent() {
166
- return y(T);
167
- },
168
- get clientWidth() {
169
- let e = v(T);
170
- return e ? Math.max(0, Math.round(e[2] - 2 * e[4])) : 0;
171
- },
172
- get clientHeight() {
173
- let e = v(T);
174
- return e ? Math.max(0, Math.round(e[3] - 2 * e[4])) : 0;
175
- },
176
- get clientLeft() {
177
- return Math.round(v(T)?.[4] ?? 0);
178
- },
179
- get clientTop() {
180
- return Math.round(v(T)?.[4] ?? 0);
181
- },
182
- get scrollLeft() {
183
- return g()?.[0] ?? 0;
184
- },
185
- set scrollLeft(e) {
186
- C(T, [e], !1);
187
- },
188
- get scrollTop() {
189
- return g()?.[1] ?? 0;
190
- },
191
- set scrollTop(e) {
192
- C(T, [void 0, e], !1);
193
- },
194
- get scrollWidth() {
195
- return T.clientWidth + Math.round(g()?.[2] ?? 0);
196
- },
197
- get scrollHeight() {
198
- return T.clientHeight + Math.round(g()?.[3] ?? 0);
199
- },
200
- scrollTo: (...e) => C(T, e, !1),
201
- scrollBy: (...e) => C(T, e, !0),
202
- scrollIntoView: (e) => {
203
- if (f(T)) return;
204
- let { block: t, inline: n } = w(e);
205
- d(r, t, n);
206
- }
207
- }, r), () => f(T));
208
- return c === "element" && n(T), T;
209
- }
210
- function E() {
211
- let e = c();
212
- return e === null ? null : r(e) ?? null;
213
- }
214
- //#endregion
215
- export { T as n, E as t };