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