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
package/README.md CHANGED
@@ -12,7 +12,7 @@ framework. No Chromium, no DOM: UI renders directly on the GPU via
12
12
 
13
13
  ## How it works
14
14
 
15
- - The root `incajs` export is the `window` event target, `activeElement` and
15
+ - The root `incajs` export is the `window` and `document` event targets and
16
16
  the public types.
17
17
  - `incajs/vue` is a custom renderer mapping Vue 3's `createRenderer`
18
18
  lifecycle onto the native host bridge. `createIncaApp(rootComponent,
@@ -0,0 +1 @@
1
+ const e=/* @__PURE__ */ `auxclick.beforeinput.blur.change.click.contextmenu.dblclick.focus.gotpointercapture.input.keydown.keyup.lostpointercapture.mousedown.mouseenter.mouseleave.mousemove.mouseout.mouseover.mouseup.pointerdown.pointerenter.pointerleave.pointermove.pointerout.pointerover.pointerup.scroll.wheel`.split(`.`);function t(t,n){for(let r of e){let e=null,i=function(t){typeof e==`function`&&Reflect.apply(e,this,[t])===!1&&t.preventDefault()};Object.defineProperty(t,`on${r}`,{get:()=>e,set(a){n()||(e=typeof a==`function`||typeof a==`object`&&a?a:null,e===null?t.removeEventListener(r,i):t.addEventListener(r,i))}})}return t}function n(){return globalThis.__inca_native__}const r=/* @__PURE__ */ new Map,i=/* @__PURE__ */ new Map,a=()=>globalThis.__inca_callbacks__??={};function o(e,t,n,o){a()[n]=o;let s=r.get(e);s||r.set(e,s=/* @__PURE__ */ new Map),s.set(t,n),i.set(n,{group:e,listener:t})}function s(e,t){return r.get(e)?.get(t)}function c(e){delete a()[e];let t=i.get(e);if(t===void 0)return;i.delete(e);let n=r.get(t.group);n?.delete(t.listener),n?.size===0&&r.delete(t.group)}function l(e){for(let t of e)c(t)}const u=(e,t,n)=>`${e}:${t}:${n===!0}`;Object.defineProperty(globalThis,"__inca_released__",{value:(e,t)=>{let n,r=!1;for(let e of t)try{l([e])}catch(e){r||(n=e),r=!0}if(ce(e),r)throw n},configurable:!0});function d(){return n().rootNodeId()}function ee(e){return n().createNode(e)}function te(e,t){n().appendChild(e,t)}function f(e,t,r){n().insertBefore(e,t,r)}function ne(e,t){n().removeChild(e,t)}function re(e){l(n().destroyNode(e))}function ie(e){n().holdNode(e)}function p(e){n().releaseNode(e)}function m(e,t,r){n().setAttribute(e,t,r)}function h(e,t){return n().getAttribute(e,t)}function g(e){return n().layoutOf(e)}function _(e){return n().scrollOf(e)}function v(e,t,r){n().scrollNode(e,t,r)}function y(e,t,r){n().scrollIntoViewNode(e,t,r)}function b(e,t){n().removeAttribute(e,t)}function x(e,t,r){n().setStyle(e,t,r)}function ae(e,t){n().removeStyle(e,t)}function S(e){return n().inputValue(e)}function C(e,t){n().setInputValue(e,t)}function w(){return n().focusedNode()}const T=/* @__PURE__ */ new WeakSet;function E(e,t){return T.add(e),Object.defineProperty(e,"__node_id",{value:t})}function D(e){return typeof e==`object`&&!!e&&T.has(e)}const O=/* @__PURE__ */ new Map,k=new FinalizationRegistry(e=>{O.get(e)?.deref()||O.delete(e)});function oe(e){O.set(e.__node_id,new WeakRef(e)),k.register(e,e.__node_id)}function se(e){O.delete(e)}function A(e){return O.get(e)?.deref()}const j=/* @__PURE__ */ new WeakSet;function M(e){return j.has(e)}function N(e){if(j.add(e),e.kind!==`text`){se(e.__node_id);for(let t of e.children)N(t)}}function ce(e){for(let t of e){let e=A(t);e&&N(e)}}const le=new FinalizationRegistry(e=>n().releaseNode(e));function ue(e){le.register(e,e.__node_id)}function P(){let e=w();return e===null?null:A(e)??null}let F=0;function I(){return F}function L(e){return(...t)=>{let n=t[0]?.eventId;return typeof n==`number`&&n>F&&(F=n),e(...t)}}function R(e,t,r,i={}){if(r==null)return;let a=u(e,t,i.capture);if(s(a,r)!==void 0)return;let c=(...e)=>typeof r==`function`?r.apply(e[0]?.currentTarget,e):r.handleEvent.apply(r,e),l=i.once?(...n)=>(z(e,t,r,i),c(...n)):c;o(a,r,n().addEventListener(e,t,i.capture===!0,i.passive===!0),L(l))}function z(e,t,r,i={}){if(r==null)return;let a=s(u(e,t,i.capture),r);a!==void 0&&(n().removeEventListener(e,t,a),c(a))}function B(e,t){return n().dispatchEvent(e,t)}function V(e){n().click(e)}function H(e,t){n().focusNode(e,t)}function U(e){n().blurNode(e)}function de(e,t){n().setPointerCapture(e,t)}function fe(e,t){n().releasePointerCapture(e,t)}function pe(e,t){return n().hasPointerCapture(e,t)}function W(e,t=[]){let n=typeof e==`function`?e:()=>e;return{addEventListener(e,r,i){let a=typeof i==`boolean`?{capture:i}:i??{};R(n(),e,r,{...a,passive:a.passive??t.includes(e)})},removeEventListener(e,t,r){let i=typeof r==`boolean`?r:r?.capture;z(n(),e,t,{capture:i})},dispatchEvent:e=>B(n(),e)}}function G(){throw TypeError(`document cannot be constructed. use the document export of incajs`)}function me(){throw TypeError(`a shadow root cannot be constructed. the host has no shadow roots`)}Object.defineProperty(globalThis,"Document",{value:G,writable:!0,configurable:!0,enumerable:!1}),Object.defineProperty(globalThis,"ShadowRoot",{value:me,writable:!0,configurable:!0,enumerable:!1});const K=/* @__PURE__ */ Object.defineProperties(Object.setPrototypeOf(t(W(`$document`,[`wheel`]),()=>!1),G.prototype),{[Symbol.toStringTag]:{value:`Document`},activeElement:{get:P}}),q=/* @__PURE__ */ Object.defineProperty(t(W(`$window`,[`wheel`]),()=>!1),Symbol.toStringTag,{value:`Window`});function J(e){return M(e)?null:g(e.__node_id)}function Y(e){let t=e.parent;return!J(e)||!t||!J(t)?null:t}function X(e){let t=J(e);if(!t)return{left:0,top:0};let n=Y(e),r=n?J(n):null;return{left:Math.round(t[0]-(r?r[0]+r[4]:0)+t[5])||0,top:Math.round(t[1]-(r?r[1]+r[4]:0)+t[6])||0}}function he(e){let[t,n,r,i]=e??[0,0,0,0,0],a={x:t,y:n,width:r,height:i,top:n,left:t,right:t+r,bottom:n+i};return{...a,toJSON:()=>({...a})}}function ge(e,t){let n=t===`button`||t===`input`?0:-1;if(typeof e!=`string`&&typeof e!=`number`)return n;let r=/^[\t\n\f\r ]*([+-]?\d+)/.exec(String(e));if(!r)return n;let i=Number(r[1])||0;return i>=-2147483648&&i<=2147483647?i:n}function Z(e,t,n){if(M(e))return;let[r,i]=t,[a,o]=typeof r==`object`?[r?.left,r?.top]:[r,i],[s,c]=n?_(e.__node_id)??[0,0]:[0,0],l=(e,t)=>{if(e===void 0)return null;let r=Number(e);return(n?t:0)+(Number.isFinite(r)?r:0)};v(e.__node_id,l(a,s),l(o,c))}function _e(e){let t=[`start`,`center`,`end`,`nearest`];return typeof e==`object`&&e?{block:t.includes(e.block??``)?e.block:`start`,inline:t.includes(e.inline??``)?e.inline:`nearest`}:{block:e===!1?`end`:`start`,inline:`nearest`}}function Q(e,n,r,i=[]){let a=W(()=>e,i),o=()=>M(c)?null:_(e),s={get id(){return M(c)?``:String(h(e,`id`)??``)},set id(t){M(c)||m(e,`id`,String(t))},kind:n,parent:null,children:[],focus:t=>{M(c)||H(e,!!t?.preventScroll)},blur:()=>U(e),click:()=>{M(c)||V(e)},setPointerCapture:t=>de(e,t),releasePointerCapture:t=>fe(e,t),hasPointerCapture:t=>pe(e,t),contains:e=>{if(e==null)return!1;if(!D(e))throw TypeError(`the value is not a node. pass an element, a text node or null`);for(let t=e;t!==null;t=t.parent)if(t===c)return!0;return!1},addEventListener:(...e)=>{M(c)||a.addEventListener(...e)},removeEventListener:(...e)=>{M(c)||a.removeEventListener(...e)},dispatchEvent:e=>M(c)||a.dispatchEvent(e),get tabIndex(){return ge(M(c)?null:h(e,`tabindex`),r??``)},set tabIndex(t){M(c)||m(e,`tabindex`,t|0)},getBoundingClientRect:()=>he(J(c)),get offsetWidth(){return Math.round(J(c)?.[2]??0)},get offsetHeight(){return Math.round(J(c)?.[3]??0)},get offsetLeft(){return X(c).left},get offsetTop(){return X(c).top},get offsetParent(){return Y(c)},get clientWidth(){let e=J(c);return e?Math.max(0,Math.round(e[2]-2*e[4])):0},get clientHeight(){let e=J(c);return e?Math.max(0,Math.round(e[3]-2*e[4])):0},get clientLeft(){return Math.round(J(c)?.[4]??0)},get clientTop(){return Math.round(J(c)?.[4]??0)},get scrollLeft(){return o()?.[0]??0},set scrollLeft(e){Z(c,[e],!1)},get scrollTop(){return o()?.[1]??0},set scrollTop(e){Z(c,[void 0,e],!1)},get scrollWidth(){return c.clientWidth+Math.round(o()?.[2]??0)},get scrollHeight(){return c.clientHeight+Math.round(o()?.[3]??0)},scrollTo:(...e)=>Z(c,e,!1),scrollBy:(...e)=>Z(c,e,!0),scrollIntoView:t=>{if(M(c))return;let{block:n,inline:r}=_e(t);y(e,n,r)},getRootNode:()=>{let e=c;for(;e.parent!==null;)e=e.parent;return e.__node_id===d()?K:e}};r===`input`&&Object.defineProperty(s,"value",{get:()=>M(c)?``:S(e),set:t=>{M(c)||C(e,t===null?``:String(t))},enumerable:!0,configurable:!0});let c=t(E(s,e),()=>M(c));return n===`element`&&oe(c),c}function $(){let e=d();return A(e)??Q(e,`element`,void 0,[`wheel`])}Object.defineProperty(globalThis,"__inca_targets__",{value:e=>e.map(e=>e===`$document`?K:e===`$window`?q:A(e)??(e===d()?$():null)),configurable:!0});export{y as A,f as C,ne as D,b as E,_ as M,m as N,ae as O,x as P,ie as S,p as T,te as _,W as a,w as b,V as c,I as d,z as f,E as g,ue as h,K as i,v as j,d as k,B as l,N as m,$ as n,R as o,M as p,q as r,U as s,Q as t,H as u,ee as v,g as w,h as x,re as y};
@@ -0,0 +1,385 @@
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 "./window-DD6KfOr9.js";
2
+ /** What a listener or a dispatch names: a node id, or the tag of `document` or `window`. */
3
+ type EventTargetId = NodeId | "$document" | "$window";
4
+ /**
5
+ * The host-injected object every wrapper in this package forwards to. Not part of the public
6
+ * surface.
7
+ */
8
+ interface IncaNative {
9
+ rootNodeId(): NodeId;
10
+ createNode(tag: string): NodeId;
11
+ appendChild(parentId: NodeId, childId: NodeId): void;
12
+ insertBefore(parentId: NodeId, childId: NodeId, anchorId: NodeId | null): void;
13
+ removeChild(parentId: NodeId, childId: NodeId): void;
14
+ setAttribute(nodeId: NodeId, key: string, value: AttributeValue): void;
15
+ getAttribute(nodeId: NodeId, key: string): AttributeValue | null;
16
+ removeAttribute(nodeId: NodeId, key: string): void;
17
+ setStyle(nodeId: NodeId, key: string, value: AttributeValue): void;
18
+ removeStyle(nodeId: NodeId, key: string): void;
19
+ inputValue(nodeId: NodeId): string;
20
+ setInputValue(nodeId: NodeId, value: string): void;
21
+ addEventListener(target: EventTargetId, event: string, capture?: boolean, passive?: boolean): CallbackId;
22
+ removeEventListener(target: EventTargetId, event: string, callbackId: CallbackId): boolean;
23
+ destroyNode(nodeId: NodeId): CallbackId[];
24
+ holdNode(nodeId: NodeId): void;
25
+ releaseNode(nodeId: NodeId): void;
26
+ focusNode(nodeId: NodeId, preventScroll?: boolean): void;
27
+ blurNode(nodeId: NodeId): void;
28
+ focusedNode(): NodeId | null;
29
+ layoutOf(nodeId: NodeId): readonly [number, number, number, number, number, number, number] | null;
30
+ scrollOf(nodeId: NodeId): readonly [number, number, number, number] | null;
31
+ scrollNode(nodeId: NodeId, left: number | null, top: number | null): void;
32
+ scrollIntoViewNode(nodeId: NodeId, block: ScrollAlignment, inline: ScrollAlignment): void;
33
+ dispatchEvent(target: EventTargetId, event: EventLike): boolean;
34
+ click(nodeId: NodeId): void;
35
+ setPointerCapture(nodeId: NodeId, pointerId: number): void;
36
+ releasePointerCapture(nodeId: NodeId, pointerId: number): void;
37
+ hasPointerCapture(nodeId: NodeId, pointerId: number): boolean;
38
+ }
39
+ /** What the host calls: it passes the event object as the first argument. */
40
+ type HostCallback = (...args: unknown[]) => void;
41
+ declare global {
42
+ var __inca_native__: IncaNative;
43
+ var __inca_callbacks__: Record<CallbackId, HostCallback>;
44
+ var __inca_released__: (nodeIds: NodeId[], callbackIds: CallbackId[]) => void;
45
+ var __inca_targets__: (targets: EventTargetId[]) => unknown[];
46
+ }
47
+ /**
48
+ * Builds the listener methods of an event target: a node, document or window.
49
+ * @param target - the target id, or a function that resolves it each time a method runs
50
+ * @param passiveByDefault - event names whose listeners are passive unless
51
+ * their options say `passive: false`
52
+ * @returns the target's `addEventListener`, `removeEventListener` and
53
+ * `dispatchEvent`
54
+ */
55
+ declare function createEventTarget(target: EventTargetId | (() => EventTargetId), passiveByDefault?: readonly string[]): IncaEventTarget;
56
+ /**
57
+ * @returns the `eventId` of the newest event any registered listener has
58
+ * received, or 0 before the first. Ids grow with each event, and every
59
+ * listener of one event receives the same id.
60
+ */
61
+ declare function latestEventId(): number;
62
+ /**
63
+ * Registers `listener` for `event` on the target (node, document or window).
64
+ * Registering the same listener for the same target, event and `capture`
65
+ * again changes nothing, and the first registration keeps its other options.
66
+ * A `null` listener is ignored.
67
+ *
68
+ * Any event name is accepted, and it fires when the host dispatches that name.
69
+ * `IncaEventMap` gives the event type of each name the host dispatches.
70
+ * @param target - the event target (node id, "$document" or "$window")
71
+ * @param event - the event name (e.g. `"click"`)
72
+ * @param listener - a function, called with the event's `currentTarget` as
73
+ * `this`, or an object whose `handleEvent` method is called with the object
74
+ * as `this` when the event fires
75
+ * @param options - `capture` listens while the event travels down to the
76
+ * target, `passive` ignores `preventDefault()` calls in `listener`, and
77
+ * `once` removes the listener before it first runs
78
+ * @throws TypeError when `target` is malformed or is an unknown target tag
79
+ * @throws TypeError when a node target names no node
80
+ * @throws RangeError when the host has issued its last callback id
81
+ */
82
+ declare function addEventListener(target: EventTargetId, event: string, listener: EventListenerOrObject<never, never> | null, options?: ListenerOptions): void;
83
+ /**
84
+ * Drops the registration {@link addEventListener} made for `listener` on
85
+ * the target with the same `event` and `capture`. A no-op if there is none.
86
+ * @param target - the event target (node, document or window)
87
+ * @param event - the event name
88
+ * @param listener - the listener that was registered
89
+ * @param options - `capture` of the registration to drop
90
+ */
91
+ declare function removeEventListener(target: EventTargetId, event: string, listener: EventListenerOrObject<never, never> | null, options?: Pick<ListenerOptions, "capture">): void;
92
+ /**
93
+ * Dispatches `event` at a target along its path. Dispatching at an element
94
+ * reaches its ancestors, `document` and `window`. Dispatching at `document`
95
+ * reaches `window`, and dispatching at `window` reaches only `window`.
96
+ * @param target - the target to dispatch at (node id, "$document" or "$window")
97
+ * @param event - the event to dispatch
98
+ * @returns `false` when a listener canceled a cancelable event, else `true`
99
+ * @throws TypeError when `target` is malformed or is an unknown target tag
100
+ * @throws TypeError when `target` is a node id that names no node
101
+ * @throws TypeError when `event` is not an event built with an event constructor
102
+ * @throws DOMException named `InvalidStateError` when `event` is being dispatched
103
+ */
104
+ declare function dispatchEvent(target: EventTargetId, event: EventLike): boolean;
105
+ /**
106
+ * Fires an untrusted `click` at `nodeId`. A disabled `button` or `input` and a node whose
107
+ * own click is still running ignore the call.
108
+ * @param nodeId - the node to click
109
+ * @throws TypeError when `nodeId` is malformed
110
+ * @throws TypeError when `nodeId` names no node
111
+ */
112
+ declare function click(nodeId: NodeId): void;
113
+ /**
114
+ * Requests that `nodeId` become focused. Takes effect on the next frame,
115
+ * dispatching `"blur"`/`"focus"` for whatever actually changed. The node
116
+ * needs a `tabindex` attribute to take focus, and a listener for either event
117
+ * is optional. The scroll containers around the node scroll it into view.
118
+ * @param nodeId - the node to focus
119
+ * @param preventScroll - `true` to leave the scroll containers in place; omitted or `false` scrolls the node into view
120
+ * @throws TypeError when `nodeId` is malformed
121
+ * @throws TypeError when `nodeId` names no node
122
+ */
123
+ declare function focus(nodeId: NodeId, preventScroll?: boolean): void;
124
+ /**
125
+ * Requests that `nodeId` become unfocused, the way `element.blur()` does.
126
+ * Takes effect on the next frame; a no-op if `nodeId` isn't the focused node
127
+ * when it runs.
128
+ * @param nodeId - the node to unfocus
129
+ */
130
+ declare function blur(nodeId: NodeId): void;
131
+ /**
132
+ * Returns the host-allocated root container's id, the node an app attaches
133
+ * itself under. The host allocates it with the tree, so this resolves from
134
+ * the first call and names the same node for the engine's lifetime.
135
+ * @returns the root node's id
136
+ */
137
+ declare function rootNodeId(): NodeId;
138
+ /**
139
+ * Allocates a new node of kind `tag` in the native tree. The node starts out
140
+ * detached. Attach it with {@link appendChild}/{@link insertBefore}. The host
141
+ * frees the node at the start of the next frame unless it is inserted or held
142
+ * with {@link holdNode} by then.
143
+ * @param tag - the node's element kind
144
+ * @returns the new node's id
145
+ */
146
+ declare function createNode(tag: TagName): NodeId;
147
+ /**
148
+ * Attaches `childId` as the last child of `parentId`. A thin wrapper over
149
+ * {@link insertBefore} with no anchor.
150
+ * @param parentId - the container to attach to
151
+ * @param childId - the node being attached
152
+ */
153
+ declare function appendChild(parentId: NodeId, childId: NodeId): void;
154
+ /**
155
+ * Attaches `childId` as a child of `parentId`, positioned before `anchorId`
156
+ * (or at the end, if `anchorId` is `null`). If `anchorId` names a real node
157
+ * that just isn't currently a child of `parentId`, this falls back to
158
+ * appending at the end. Only a wholly unknown `anchorId` raises.
159
+ * @param parentId - the container to attach to
160
+ * @param childId - the node being attached
161
+ * @param anchorId - the sibling to insert before, or `null` to append at the end
162
+ */
163
+ declare function insertBefore(parentId: NodeId, childId: NodeId, anchorId: NodeId | null): void;
164
+ /**
165
+ * Detaches `childId` from `parentId`. The detached node keeps its own children
166
+ * and is freed at the start of the next frame unless it is inserted or held
167
+ * with {@link holdNode} by then. Use {@link destroyNode} to free it at once.
168
+ * @param parentId - the current container
169
+ * @param childId - the node being detached
170
+ */
171
+ declare function removeChild(parentId: NodeId, childId: NodeId): void;
172
+ /**
173
+ * Frees `nodeId` and its whole subtree, detaching it first, and drops every
174
+ * event listener registered anywhere in it. Destroying an already-destroyed
175
+ * node does nothing. The host's own root cannot be destroyed and raises.
176
+ *
177
+ * Also drops the hold of {@link holdNode}.
178
+ * @param nodeId - the node that isn't coming back
179
+ */
180
+ declare function destroyNode(nodeId: NodeId): void;
181
+ /**
182
+ * Keeps `nodeId` and its subtree alive while it has no parent. The host frees
183
+ * a parentless node that is neither held nor inserted by the start of the next
184
+ * frame. Holding a held or attached node changes nothing visible.
185
+ * @param nodeId - the node to keep
186
+ * @throws {TypeError} when `nodeId` names no node
187
+ */
188
+ declare function holdNode(nodeId: NodeId): void;
189
+ /**
190
+ * Ends the hold of {@link holdNode}. A node with no parent is freed at the
191
+ * start of the next frame. An unknown id does nothing.
192
+ * @param nodeId - the node to let go
193
+ */
194
+ declare function releaseNode(nodeId: NodeId): void;
195
+ /**
196
+ * Sets a non-style attribute/prop on `nodeId`. See {@link setStyle} for
197
+ * layout/paint properties, which live in a separate map.
198
+ * @param nodeId - the node to update
199
+ * @param key - the attribute name
200
+ * @param value - the attribute value
201
+ */
202
+ declare function setAttribute(nodeId: NodeId, key: string, value: AttributeValue): void;
203
+ /**
204
+ * Returns the attribute/prop stored on `nodeId` under `key`, or `null` when unset.
205
+ * @param nodeId - the node to read
206
+ * @param key - the attribute name
207
+ * @returns the stored value, or `null`
208
+ * @throws {TypeError} when `nodeId` names no node
209
+ */
210
+ declare function getAttribute(nodeId: NodeId, key: string): AttributeValue | null;
211
+ /**
212
+ * Returns the box `nodeId` was drawn at in the last frame, in window logical
213
+ * pixels, or `null` if the node has no recorded box.
214
+ * @param nodeId - the node to read
215
+ * @returns `[x, y, width, height, border, scrollX, scrollY]`, or `null`. `border` is one uniform
216
+ * width on all sides. `scrollX` and `scrollY` are the positive scroll offset the parent applied
217
+ * to the box.
218
+ * @throws {TypeError} when `nodeId` names no node
219
+ */
220
+ declare function layoutOf(nodeId: NodeId): readonly [number, number, number, number, number, number, number] | null;
221
+ /**
222
+ * Returns the scroll offset of `nodeId` in window logical pixels. A write made
223
+ * since the last draw is included, clamped to the maximum of the last drawn
224
+ * frame.
225
+ * @param nodeId - the node to read
226
+ * @returns `[left, top, maxLeft, maxTop]`, or `null` for a node whose `overflow` is
227
+ * `visible` or `clip` on both axes. The maxima are the largest offsets the node can take, as
228
+ * of the last drawn frame.
229
+ * @throws {TypeError} when `nodeId` names no node
230
+ */
231
+ declare function scrollOf(nodeId: NodeId): readonly [number, number, number, number] | null;
232
+ /**
233
+ * Sets the scroll offset of `nodeId` on one or both axes. A `null` axis keeps
234
+ * its current offset. The host clamps each value to the scrollable range on
235
+ * the next frame. A node whose `overflow` is `visible` or `clip` on both axes ignores the call.
236
+ * @param nodeId - the node to scroll
237
+ * @param left - the horizontal offset, or `null` to keep it
238
+ * @param top - the vertical offset, or `null` to keep it
239
+ * @throws {TypeError} when `nodeId` names no node
240
+ */
241
+ declare function scrollNode(nodeId: NodeId, left: number | null, top: number | null): void;
242
+ /**
243
+ * Scrolls each scroll container around `nodeId` so the node shows.
244
+ * @param nodeId - the node to bring into view
245
+ * @param block - the vertical alignment: `"start"`, `"center"`, `"end"` or `"nearest"`
246
+ * @param inline - the horizontal alignment: `"start"`, `"center"`, `"end"` or `"nearest"`
247
+ * @throws {TypeError} when `nodeId` names no node
248
+ * @throws {TypeError} when `block` or `inline` is not an alignment name
249
+ */
250
+ declare function scrollIntoViewNode(nodeId: NodeId, block: ScrollAlignment, inline: ScrollAlignment): void;
251
+ /**
252
+ * Removes a non-style attribute/prop from `nodeId`. Removing an attribute
253
+ * that isn't set does nothing.
254
+ * @param nodeId - the node to update
255
+ * @param key - the attribute name
256
+ */
257
+ declare function removeAttribute(nodeId: NodeId, key: string): void;
258
+ /**
259
+ * Sets a style property on `nodeId`. A snake_case key from {@link StyleProps}
260
+ * gets compile-time checking on its value's shape. Any other string key, such
261
+ * as a camelCase or kebab-case spelling or a property the types do not list,
262
+ * forwards as a raw {@link AttributeValue}.
263
+ *
264
+ * A key takes any of three spellings: kebab-case (`flex-direction`),
265
+ * camelCase (`flexDirection`) or snake_case (`flex_direction`). All three
266
+ * name the same property, and the value set most recently applies.
267
+ * @param nodeId - the node to update
268
+ * @param key - the style property name in any of the three spellings
269
+ * @param value - the style property value
270
+ */
271
+ declare function setStyle<K extends keyof StyleProps>(nodeId: NodeId, key: K, value: NonNullable<StyleProps[K]>): void;
272
+ declare function setStyle(nodeId: NodeId, key: string, value: AttributeValue): void;
273
+ /**
274
+ * Removes a style property from `nodeId`, so it renders as if never set.
275
+ * Removing a property that isn't set does nothing. The key takes any of the
276
+ * three spellings {@link setStyle} accepts, and removes the property whichever
277
+ * spelling set it.
278
+ * @param nodeId - the node to update
279
+ * @param key - the style property name in any of the three spellings
280
+ */
281
+ declare function removeStyle(nodeId: NodeId, key: string): void;
282
+ /**
283
+ * Returns the id of the focused node.
284
+ * @returns the focused node's id, or `null` when no node has focus
285
+ */
286
+ declare function focusedNode(): NodeId | null;
287
+ /**
288
+ * Builds the {@link IncaElement} handle for a native node: parentless,
289
+ * childless, with `id`, `focus()`, `blur()`, `click()`, the pointer capture
290
+ * methods, `contains()`, the listener methods of an event target, `tabIndex`,
291
+ * the `value` of an `input`, `getRootNode()`, the layout members and the event handler properties,
292
+ * all driven through the host.
293
+ * @param id - the native node's id
294
+ * @param kind - whether the node is an element or a comment stand-in
295
+ * @param tag - the node's element kind, if it has one; a `button` or `input` defaults to tab
296
+ * index `0`, and an `input` has `value`
297
+ * @param passiveByDefault - event names whose listeners are passive unless their options say
298
+ * `passive: false`
299
+ * @returns the new handle
300
+ */
301
+ declare function createIncaElement(id: NodeId, kind: IncaElement["kind"], tag?: TagName, passiveByDefault?: readonly string[]): IncaElement;
302
+ /**
303
+ * Returns the handle of the host's mount container, which stands between the app's elements and
304
+ * `document` in an event path. A live handle is reused, so a mount and an event see one object.
305
+ * A `wheel` listener on it is passive unless its options say `passive: false`.
306
+ * @returns the mount container's handle
307
+ */
308
+ declare function rootElement(): IncaElement;
309
+ /**
310
+ * Whether the host freed `node` with its subtree.
311
+ * @param node - the handle to check
312
+ * @returns `true` after {@link markDestroyed} reached `node`
313
+ */
314
+ declare function isDestroyed(node: IncaNode): boolean;
315
+ /**
316
+ * Allocates a new element node for `tag`.
317
+ * @param tag - the node's element kind
318
+ * @returns the new, parentless, childless element
319
+ */
320
+ declare function createElementNode(tag: TagName): IncaElement;
321
+ /**
322
+ * Creates a text leaf.
323
+ * @param text - the initial text content
324
+ * @returns the new text leaf
325
+ */
326
+ declare function createTextNode(text: string): IncaText;
327
+ /**
328
+ * Creates the hidden container that stands in for a comment node, such as a
329
+ * placeholder for conditional content.
330
+ * @returns the new hidden element
331
+ */
332
+ declare function createCommentNode(): IncaElement;
333
+ /**
334
+ * Updates a text leaf's content in place.
335
+ * @param node - the text leaf to update
336
+ * @param text - the new text content
337
+ */
338
+ declare function setText(node: IncaText, text: string): void;
339
+ /**
340
+ * Replaces all of `el`'s children with at most a single text child holding
341
+ * `text`. An empty string leaves `el` childless.
342
+ * @param el - the container whose children are replaced
343
+ * @param text - the new text content
344
+ */
345
+ declare function setElementText(el: IncaElement, text: string): void;
346
+ /**
347
+ * Attaches `child` to `parent`, before `anchor` or at the end when `anchor` is
348
+ * omitted or `null`. If `anchor` is `child` itself and `child` is already in
349
+ * `parent`, nothing changes. A `child` attached elsewhere is detached first,
350
+ * so a move keeps the node alive.
351
+ * @param child - the node being attached
352
+ * @param parent - the new container
353
+ * @param anchor - the sibling to insert before, or omitted/`null` to append at the end
354
+ */
355
+ declare function insert(child: IncaNode, parent: IncaElement, anchor?: IncaNode | null): void;
356
+ /**
357
+ * Removes `child` for good: the native node, its whole subtree, and every
358
+ * event listener registered in it.
359
+ *
360
+ * A caller that removes a subtree calls this on its root alone, and the host
361
+ * frees the descendants with it.
362
+ * @param child - the node being removed
363
+ */
364
+ declare function remove(child: IncaNode): void;
365
+ /**
366
+ * Looks up the current parent.
367
+ * @param node - the node to query
368
+ * @returns the current parent, or `null` if it isn't attached
369
+ */
370
+ declare function parentNode(node: IncaNode): IncaElement | null;
371
+ /**
372
+ * Looks up the next sibling.
373
+ * @param node - the node to query
374
+ * @returns the sibling immediately after `node` in its parent's children, or `null` if there is none (or `node` isn't attached)
375
+ */
376
+ declare function nextSibling(node: IncaNode): IncaNode | null;
377
+ declare namespace rendererCore_d_exports {
378
+ export { AttributeValue, CallbackId, EventHandler, EventHandlers, EventLike, EventListener, EventListenerObject, EventListenerOrObject, IncaCompositionEvent, IncaCore, IncaDocument, IncaElement, IncaEvent, IncaEventMap, IncaEventTarget, IncaFocusEvent, IncaInputElement, IncaInputEvent, IncaKeyboardEvent, IncaMouseEvent, IncaNode, IncaPointerEvent, IncaText, IncaUIEvent, IncaWheelEvent, IncaWindow, ListenerOptions, NodeId, Overflow, ScrollAlignment, StyleProps, 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 };
379
+ }
380
+ /**
381
+ * What a custom renderer (`incajs/vue`) drives the host through: the tree and
382
+ * event calls, the element handles and the shadow tree.
383
+ */
384
+ type IncaCore = typeof rendererCore_d_exports;
385
+ export { setAttribute as A, removeAttribute as C, scrollIntoViewNode as D, rootNodeId as E, dispatchEvent as F, focus as I, latestEventId as L, addEventListener as M, blur as N, scrollNode as O, click as P, removeEventListener as R, releaseNode as S, removeStyle as T, focusedNode as _, insert as a, insertBefore as b, remove as c, isDestroyed as d, createIncaElement as f, destroyNode as g, createNode as h, createTextNode as i, setStyle as j, scrollOf as k, setElementText as l, appendChild as m, createCommentNode as n, nextSibling as o, rootElement as p, createElementNode as r, parentNode as s, IncaCore as t, setText as u, getAttribute as v, removeChild as w, layoutOf as x, holdNode as y, createEventTarget as z };
@@ -0,0 +1 @@
1
+ import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{A as t,C as n,D as r,E as i,M as a,N as o,O as s,P as c,S as l,T as u,_ as d,a as f,b as p,c as m,d as h,f as g,g as _,h as v,j as y,k as b,l as x,m as S,n as C,o as w,p as T,r as E,s as D,t as O,u as k,v as A,w as j,x as M,y as N}from"./hooks-N7NnMPKd.js";function P(e){let t=A(e);return O(t,`element`,e)}function F(e){let t=A(`text`);return o(t,`value`,e),_({kind:`text`,parent:null,text:e},t)}function I(){let e=A(`div`);return c(e,`display`,`none`),O(e,`comment`)}function L(e,t){o(e.__node_id,`value`,t),e.text=t}function R(e,t){for(let t of e.children.splice(0))N(t.__node_id),S(t),t.parent=null;if(!t)return;let n=F(t);d(e.__node_id,n.__node_id),n.parent=e,e.children.push(n)}function z(e){let t=e.parent;if(!t)return;let n=t.children.indexOf(e);n!==-1&&t.children.splice(n,1),e.parent=null}function B(e){e.parent&&r(e.parent.__node_id,e.__node_id),z(e)}function V(e,t,r){if(r===e&&e.parent===t)return;B(e);let i=r?t.children.indexOf(r):-1;n(t.__node_id,e.__node_id,r&&i!==-1?r.__node_id:null),i===-1?t.children.push(e):t.children.splice(i,0,e),e.parent=t}function H(e){z(e),N(e.__node_id),S(e)}function U(e){return e.parent}function W(e){let t=e.parent;if(!t)return null;let n=t.children.indexOf(e);return t.children[n+1]??null}var G=/* @__PURE__ */ e({addEventListener:()=>w,appendChild:()=>d,blur:()=>D,click:()=>m,createCommentNode:()=>I,createElementNode:()=>P,createEventTarget:()=>f,createIncaElement:()=>O,createNode:()=>A,createTextNode:()=>F,destroyNode:()=>N,dispatchEvent:()=>x,focus:()=>k,focusedNode:()=>p,getAttribute:()=>M,holdNode:()=>l,insert:()=>V,insertBefore:()=>n,isDestroyed:()=>T,latestEventId:()=>h,layoutOf:()=>j,nextSibling:()=>W,parentNode:()=>U,releaseNode:()=>u,releaseWhenCollected:()=>v,remove:()=>H,removeAttribute:()=>i,removeChild:()=>r,removeEventListener:()=>g,removeStyle:()=>s,rootElement:()=>C,rootNodeId:()=>b,scrollIntoViewNode:()=>t,scrollNode:()=>y,scrollOf:()=>a,setAttribute:()=>o,setElementText:()=>R,setStyle:()=>c,setText:()=>L,window:()=>E});export{V as a,H as c,F as i,R as l,I as n,W as o,P as r,U as s,G as t,L as u};
@@ -0,0 +1 @@
1
+ var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};export{t};