incajs 0.0.27 → 0.0.29

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.
@@ -0,0 +1,2 @@
1
+ const e=/* @__PURE__ */ `auxclick.beforeinput.blur.change.click.contextmenu.dblclick.focus.gotpointercapture.input.keydown.keypress.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 WeakSet;function i(e,t){return r.add(e),Object.defineProperty(e,"__node_id",{value:t})}function a(e){return typeof e==`object`&&!!e&&r.has(e)}const o=/* @__PURE__ */ new Map,s=new FinalizationRegistry(e=>{o.get(e)?.deref()||o.delete(e)});function c(e){o.set(e.__node_id,new WeakRef(e)),s.register(e,e.__node_id)}function l(e){o.delete(e)}function u(e){return o.get(e)?.deref()}function d(e){let t=u(e);return t?.kind===`element`?t:void 0}const ee=/* @__PURE__ */ new WeakSet;function f(e){return ee.has(e)||p.has(e)}function te(e){if(ee.add(e),e.kind!==`text`)for(let t of e.__children)te(t)}const p=/* @__PURE__ */ new WeakSet;function m(e){return p.has(e)}function ne(e){if(p.add(e),l(e.__node_id),e.kind!==`text`)for(let t of e.__children)ne(t)}function re(e){for(let t of e){let e=u(t);e&&ne(e)}}const ie=new FinalizationRegistry(e=>n().releaseNode(e)),ae=/* @__PURE__ */ new WeakSet;function oe(e){return ae.has(e)}function h(e){ae.add(e),ie.register(e,e.__node_id)}const g=/* @__PURE__ */ new Map,se=/* @__PURE__ */ new Map;function ce(e,t,n){let r=g.get(e);r||g.set(e,r=/* @__PURE__ */ new Map),r.set(t,n),se.set(n,{group:e,listener:t})}function le(e,t){return g.get(e)?.get(t)}function ue(e){let t=se.get(e);if(t===void 0)return;se.delete(e);let n=g.get(t.group);n?.delete(t.listener),n?.size===0&&g.delete(t.group)}function de(e){for(let t of e)ue(t)}const fe=(e,t,n)=>`${e}:${t}:${n===!0}`;Object.defineProperty(globalThis,"__inca_released__",{value:(e,t)=>{de(t),re(e)},configurable:!0});let pe=0;function me(){return pe}function he(e){return(...t)=>{let n=t[0]?.eventId;return typeof n==`number`&&n>pe&&(pe=n),e(...t)}}function ge(e,t,r,i={}){if(r==null)return;let a=fe(e,t,i.capture);if(le(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?(...n)=>(_(e,t,r,i),o(...n)):o;ce(a,r,n().addEventListener(e,t,he(s),i.capture===!0,i.passive===!0))}function _(e,t,r,i={}){if(r==null)return;let a=le(fe(e,t,i.capture),r);a!==void 0&&(n().removeEventListener(e,t,a),ue(a))}function _e(e,t){return n().dispatchEvent(e,t)}function ve(e){n().click(e)}function ye(e,t){n().focusNode(e,t)}function be(e){n().blurNode(e)}function xe(e,t){n().setPointerCapture(e,t)}function Se(e,t){n().releasePointerCapture(e,t)}function Ce(e,t){return n().hasPointerCapture(e,t)}function v(e,t=[]){let n=typeof e==`function`?e:()=>e;return{addEventListener(e,r,i){let a=typeof i==`boolean`?{capture:i}:i??{};ge(n(),e,r,{...a,passive:a.passive??t.includes(e)})},removeEventListener(e,t,r){let i=typeof r==`boolean`?r:r?.capture;_(n(),e,t,{capture:i})},dispatchEvent:e=>_e(n(),e)}}function we(){throw TypeError(`document cannot be constructed. use the document export of incajs`)}function Te(){throw TypeError(`a shadow root cannot be constructed. the host has no shadow roots`)}Object.defineProperty(globalThis,"Document",{value:we,writable:!0,configurable:!0,enumerable:!1}),Object.defineProperty(globalThis,"ShadowRoot",{value:Te,writable:!0,configurable:!0,enumerable:!1});function y(){return n().rootNodeId()}function b(e){return n().createNode(e)}function x(e,t){return n().appendChild(e,t)}function S(e,t,r){return n().insertBefore(e,t,r)}function C(e,t){n().removeChild(e,t)}function Ee(e,t,r){return n().replaceChild(e,t,r)}function De(e,t){return n().cloneNode(e,t)}function Oe(e){return n().rootOf(e)}function ke(e,t){return n().compareNodePosition(e,t)}function Ae(e,t){return n().isEqualNode(e,t)}function je(e){de(n().releaseListeners(e))}function w(e){n().holdNode(e)}function Me(e){n().releaseNode(e)}function T(e,t,r){n().setAttribute(e,t,r)}function E(e,t){return n().getAttribute(e,t)}function Ne(e){return n().attributeNames(e)}function Pe(e,t){return n().linkedNode(e,t)}function Fe(e){return n().childNodeIds(e)}function Ie(e){return n().isConnected(e)}function Le(e){return n().textContent(e)}function Re(e){return n().wholeText(e)}function ze(e,t,r){return n().substringData(e,t,r)}function Be(e,t,r,i){n().replaceData(e,t,r,i)}function Ve(e,t){return n().splitText(e,t)}function He(e,t){return n().matches(e,t)}function Ue(e,t){return n().closest(e,t)}function We(e,t){return n().querySelector(e,t)}function Ge(e,t){return n().querySelectorAll(e,t)}function D(e){n().checkSelector(e)}function Ke(e){return n().layoutOf(e)}function O(e){return n().scrollOf(e)}function qe(e,t,r){n().scrollNode(e,t,r)}function Je(e,t,r){n().scrollIntoViewNode(e,t,r)}function Ye(e,t){n().removeAttribute(e,t)}function Xe(e,t,r){n().setStyle(e,t,r)}function Ze(e,t){n().removeStyle(e,t)}function Qe(e){return n().inputValue(e)}function $e(e,t){n().setInputValue(e,t)}function et(){return n().focusedNode()}function tt(){let e=et();return e===null?null:d(e)??null}const k=/* @__PURE__ */ Object.defineProperties(Object.setPrototypeOf(t(v(`$document`,[`wheel`]),()=>!1),we.prototype),{[Symbol.toStringTag]:{value:`Document`},activeElement:{get:tt}}),nt=/^(?:0|[1-9]\d*)$/,rt=2**32-1;function A(e){return nt.test(e)&&Number(e)<rt}function it(e,t){return t===``?null:e.find(e=>e.id===t)??e.find(e=>e.getAttribute(`name`)===t)??null}function at(e){let t=/* @__PURE__ */ new Set;for(let n of e)t.add(n.id),t.add(n.getAttribute(`name`)??``);return t.delete(``),[...t]}function j(e){let{source:t,named:n}=e,r=e=>{if(e!==l)throw TypeError(`the receiver is not a collection. call it on one`)},i={writable:!0,enumerable:!0,configurable:!0},a=Object.create(Object.prototype,{length:{get(){return r(this),t().length},enumerable:!0,configurable:!0},item:{...i,value:Object.defineProperty(function(...e){if(r(this),e.length<1)throw TypeError(`item() needs 1 argument`);return t()[e[0]>>>0]??null},"length",{value:1})},...e.method&&{[e.method]:{...i,value(...t){if(r(this),t.length<1)throw TypeError(`${e.method}() needs 1 argument`);return e.find(`${t[0]}`)}}},...e.arrayMembers&&{forEach:{...i,value:Array.prototype.forEach},entries:{...i,value:Array.prototype.entries},keys:{...i,value:Array.prototype.keys},values:{...i,value:Array.prototype.values}},[Symbol.iterator]:{...i,enumerable:!1,value:Array.prototype.values},[Symbol.toStringTag]:{value:e.tag,configurable:!0}}),o=Object.create(a),s=e=>Object.hasOwn(o,e),c=e=>A(e)||!s(e)&&!(e in a)&&n(e)!==null,l=new Proxy(o,{get(e,r,i){return typeof r==`symbol`?Reflect.get(o,r,i):A(r)?t()[Number(r)]:r in o?Reflect.get(o,r,i):n(r)??void 0},has(e,r){return typeof r==`symbol`||r in o?r in o:A(r)?Number(r)<t().length:n(r)!==null},set(e,t,n,r){return r===l&&typeof t==`string`&&c(t)?!1:Reflect.set(o,t,n,r)},deleteProperty(e,n){if(typeof n==`string`){if(A(n))return Number(n)>=t().length;if(c(n))return!1}return Reflect.deleteProperty(o,n)},preventExtensions:()=>!1,defineProperty(e,t,n){return typeof t==`string`&&c(t)?!1:Reflect.defineProperty(o,t,n)},ownKeys(){let n=t(),r=Array.from(n,(e,t)=>String(t)),i=e.names(n).filter(e=>!A(e)&&!(e in a)&&!s(e)),c=Reflect.ownKeys(o);return[...r,...c,...i]},getOwnPropertyDescriptor(e,r){if(typeof r==`symbol`||s(r))return Reflect.getOwnPropertyDescriptor(o,r);if(A(r)){let e=t()[Number(r)];return e?{value:e,writable:!1,enumerable:!0,configurable:!0}:void 0}let i=r in a?void 0:n(r);return i?{value:i,writable:!1,enumerable:!1,configurable:!0}:void 0}});return l}function ot(e){let t=t=>it(e(),t);return j({tag:`HTMLCollection`,method:`namedItem`,source:e,find:t,named:t,names:at})}function st(e,t,n){return j({tag:`NamedNodeMap`,method:`getNamedItem`,source:e,find:t,named:n,names:e=>e.map(e=>e.name)})}function M(e){return j({tag:`NodeList`,arrayMembers:!0,source:e,find:()=>null,named:()=>null,names:()=>[]})}const ct=/* @__PURE__ */ new Set([`\0`,` `,`
2
+ `,`\f`,`\r`,` `,`/`,`=`,`>`]);function lt(e){if(e.length===0)return!1;for(let t of e)if(ct.has(t))return!1;return!0}function N(e){if(typeof e==`symbol`)throw TypeError(`a symbol cannot become text`);return String(e)}function P(e,t,n){if(e.length<t)throw TypeError(`${n}() needs ${t} argument${t===1?``:`s`}`)}function ut(e){return e.replace(/[A-Z]/g,e=>e.toLowerCase())}var F=class e{#e;#t;#n;#r;#i;constructor(e,t,n,r,i){this.#e=e,this.#i=t,this.#t=n,this.#r=r,this.#n=i}static detach(e){e.#r=null,e.#n(e)}#a(){if(this.#r===null)return!1;let t=m(this.#r)?null:E(this.#t,this.#e);return t===null?(e.detach(this),!1):(this.#i=N(t),!0)}get name(){return this.#e}get localName(){return this.#e}get value(){return this.#a(),this.#i}set value(e){let t=N(e);this.#a()&&T(this.#t,this.#e,t),this.#i=t}get namespaceURI(){return null}get prefix(){return null}get specified(){return!0}get ownerElement(){return this.#a(),this.#r}get[Symbol.toStringTag](){return`Attr`}};function dt(e,t){let n=t=>{let n=E(e,t);return n===null?null:N(n)},r=()=>m(t)?[]:Ne(e),i=/* @__PURE__ */ new Map,a=e=>{i.get(e.name)===e&&i.delete(e.name)},o=(n,r)=>{let o=i.get(n);return o||(o=new F(n,r,e,t,a),i.set(n,o)),o},s=e=>{let r=m(t)?null:n(e);if(r!==null)return o(e,r);let a=i.get(e);return a&&F.detach(a),null},c=()=>{let e=r(),t=new Set(e);for(let[e,n]of i)t.has(e)||F.detach(n);return e.map(e=>i.get(e)??o(e,n(e)))},l;return{getAttribute:(...e)=>(P(e,1,`getAttribute`),m(t)?null:n(N(e[0]))),setAttribute:(...n)=>{P(n,2,`setAttribute`);let r=N(n[0]),i=N(n[1]);if(!lt(r))throw new DOMException(`the attribute name is not valid. it is empty or holds whitespace, '/', '=' or '>'`,`InvalidCharacterError`);m(t)||T(e,r,i)},hasAttribute:(...e)=>(P(e,1,`hasAttribute`),!m(t)&&n(N(e[0]))!==null),removeAttribute:(...n)=>{P(n,1,`removeAttribute`);let r=N(n[0]);m(t)||Ye(e,r)},getAttributeNames:()=>r(),get attributes(){return l??=st(c,e=>s(ut(e)),e=>e===ut(e)?s(e):null),l}}}function ft(e){return e.kind===`element`}function I(e){return e.__children.filter(ft)}function pt(e,t){let n=e.parent?.__children??[];for(let r=n.indexOf(e)+t;r>=0&&r<n.length;r+=t){let e=n[r];if(ft(e))return e}return null}function mt(e){let t;return{get children(){return t??=ot(()=>I(e))},get parentElement(){return e.parent?.kind===`element`?e.parent:null},get firstElementChild(){return I(e)[0]??null},get lastElementChild(){return I(e).at(-1)??null},get childElementCount(){return I(e).length},get previousElementSibling(){return pt(e,-1)},get nextElementSibling(){return pt(e,1)}}}function L(e){return f(e)?null:Ke(e.__node_id)}function ht(e){let t=e.parent;return!L(e)||t?.kind!==`element`||!L(t)?null:t}function gt(e){let t=L(e);if(!t)return{left:0,top:0};let n=ht(e),r=n?L(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 _t(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 vt(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 R(e){m(e)||oe(e)||(w(e.__node_id),h(e))}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,t,n){e.__children.splice(n,0,...t);for(let n of t)n.parent=e}function yt(e){e.parent&&C(e.parent.__node_id,e.__node_id),z(e)}function bt(e,t,n){if(n===e&&e.parent===t)return;yt(e);let r=n?t.__children.indexOf(n):-1;S(t.__node_id,e.__node_id,n&&r!==-1?n.__node_id:null),r===-1?t.__children.push(e):t.__children.splice(r,0,e),e.parent=t}function xt(e){e.parent&&m(e.parent)?z(e):yt(e),je(e.__node_id),te(e),R(e)}function St(e){return e.parent?.kind===`element`?e.parent:null}function Ct(e){let t=e.parent;if(!t)return null;let n=t.__children.indexOf(e);return t.__children[n+1]??null}function V(){return new DOMException(`the node was freed. pass a child of the node you call it on`,`NotFoundError`)}function H(e,t){if(!a(e))throw TypeError(`parameter ${t} is not a node. pass an element, a text node, a comment or a fragment`);return e}function wt(e){return e.kind===`fragment`?e.__children.slice():[e]}function Tt(e,t,n){let r=De(e.__node_id,t),i=0,a=e=>{let[o,s]=r[i++];if(e.kind===`text`)return n.text(o,e.text);let c=e.kind===`fragment`?n.fragment(o):n.element(o,e.kind,e.kind===`element`?s:void 0);if(!t)return c;for(let t of e.__children)B(c,[a(t)],c.__children.length);return c},o=a(e);return R(o),o}function U(e,t){let n=e.__node_id,r=e,i=(e,t)=>{let n=wt(e),i=t();for(let e of n)z(e);B(r,n,i)};return{appendChild:(...e)=>{P(e,1,`appendChild`);let t=H(e[0],1);return i(t,()=>x(n,t.__node_id)),t},insertBefore:(...e)=>{P(e,2,`insertBefore`);let t=H(e[0],1),r=e[1]===null||e[1]===void 0?null:H(e[1],2);if(r&&m(r))throw V();return i(t,()=>S(n,t.__node_id,r?.__node_id??null)),t},removeChild:(...e)=>{P(e,1,`removeChild`);let t=H(e[0],1);if(m(t))throw V();return C(n,t.__node_id),z(t),R(t),t},replaceChild:(...e)=>{P(e,2,`replaceChild`);let t=H(e[0],1),i=H(e[1],2);if(m(i))throw V();let a=wt(t),o=Ee(n,t.__node_id,i.__node_id);for(let e of a)z(e);return z(i),i!==t&&R(i),B(r,a,o),i},cloneNode:n=>Tt(e,!!n,t)}}function W(e){let t=e.__node_id,n=e=>e==null?null:H(e,1);return{contains:r=>{let i=n(r);return i===null?!1:i===e?!0:m(e)||m(i)?!1:!!(ke(t,i.__node_id)&16)},getRootNode:()=>{if(m(e))return e;let n=Oe(t);return n===y()?k:u(n)},compareDocumentPosition:(...n)=>{P(n,1,`compareDocumentPosition`);let r=H(n[0],1);return r===e?0:m(e)||m(r)?33|(r.__node_id<t?2:4):ke(t,r.__node_id)},isSameNode:t=>n(t)===e,isEqualNode:r=>{let i=n(r);return i===null?!1:m(e)||m(i)?i===e:Ae(t,i.__node_id)}}}const Et={element:1,text:3,comment:8,fragment:11};function G(e){return m(e)?e.kind===`text`?e.text:``:String(E(e.__node_id,`value`)??``)}function K(e,t){e.kind===`element`||e.kind===`fragment`||m(e)||(T(e.__node_id,`value`,t),e.kind===`text`&&(e.text=t))}function q(e){let t=e.__node_id,n=n=>{if(m(e))return null;let r=Pe(t,n);return r===null?null:u(r)??null},r,i=()=>m(e)?[]:Fe(t).flatMap(e=>u(e)??[]);return{get nodeType(){return Et[e.kind]},get nodeName(){return e.kind===`element`?e.tagName:e.kind===`fragment`?`#document-fragment`:`#${e.kind}`},get nodeValue(){return e.kind===`element`||e.kind===`fragment`?null:G(e)},set nodeValue(t){K(e,String(t??``))},get isConnected(){return!m(e)&&Ie(t)},get ownerDocument(){return k},get parentNode(){let e=n(`parent`);return e===null?t===y()?k:null:e},get firstChild(){return n(`first`)},get lastChild(){return n(`last`)},get previousSibling(){return n(`previous`)},get nextSibling(){return n(`next`)},get childNodes(){return r??=M(i)},hasChildNodes:()=>i().length>0}}function J(e,t,n){if(f(e))return;let[r,i]=t,[a,o]=typeof r==`object`?[r?.left,r?.top]:[r,i],[s,c]=n?O(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)};qe(e.__node_id,l(a,s),l(o,c))}function Dt(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 Y(e){return e==null?``:N(e)}function Ot(e){let t=e.__node_id,n=(n,r,i)=>{m(e)||(Be(t,n,r,i),e.kind===`text`&&(e.text=G(e)))};return{get data(){return G(e)},set data(t){K(e,t===null?``:N(t))},get length(){return G(e).length},get textContent(){return G(e)},set textContent(t){K(e,Y(t))},substringData:(...n)=>{if(P(n,2,`substringData`),!m(e))return ze(t,n[0],n[1]);let r=n[0]>>>0;return G(e).slice(r,r+(n[1]>>>0))},appendData:(...t)=>{P(t,1,`appendData`),n(G(e).length,0,N(t[0]))},insertData:(...e)=>{P(e,2,`insertData`),n(e[0],0,N(e[1]))},deleteData:(...e)=>{P(e,2,`deleteData`),n(e[0],e[1],``)},replaceData:(...e)=>{P(e,3,`replaceData`),n(e[0],e[1],N(e[2]))}}}function kt(e){let t=e.__node_id;return{get wholeText(){return m(e)?e.text:Re(t)},splitText:(...n)=>{if(P(n,1,`splitText`),m(e))throw TypeError(`the text node was freed. create a new one`);let r=Ve(t,n[0]),i=Z(r,String(E(r,`value`)??``));e.text=G(e);let a=e.parent;return a===null?(w(i.__node_id),h(i)):(a.__children.splice(a.__children.indexOf(e)+1,0,i),i.parent=a),i}}}function At(e){let t=b(`#text`);return T(t,`value`,e),Z(t,e)}function jt(e,t){T(e.__node_id,`value`,t),e.text=t}function X(e,t){for(let t of e.__children.slice())xt(t);if(!t)return;let n=At(t);x(e.__node_id,n.__node_id),n.parent=e,e.__children.push(n)}function Z(e,t){let n=i({kind:`text`,parent:null,text:t},e);for(let e of[q(n),U(n,{text:Z}),W(n),Ot(n),kt(n)])Object.defineProperties(n,Object.getOwnPropertyDescriptors(e));return c(n),n}function Q(e,t){return P(e,1,t),N(e[0])}const Mt={element:$,text:Z,fragment:Lt};function $(e,n,r=`div`,a=[]){let o=v(()=>e,a),s=()=>f(u)?null:O(e),l={get id(){return m(u)?``:String(E(e,`id`)??``)},set id(t){m(u)||T(e,`id`,String(t))},kind:n,tagName:r.replace(/[a-z]/g,e=>e.toUpperCase()),parent:null,__children:[],focus:t=>{f(u)||ye(e,!!t?.preventScroll)},blur:()=>be(e),click:()=>{f(u)||ve(e)},setPointerCapture:t=>xe(e,t),releasePointerCapture:t=>Se(e,t),hasPointerCapture:t=>Ce(e,t),addEventListener:(...e)=>{f(u)||o.addEventListener(...e)},removeEventListener:(...e)=>{f(u)||o.removeEventListener(...e)},dispatchEvent:e=>m(u)||o.dispatchEvent(e),get tabIndex(){return vt(m(u)?null:E(e,`tabindex`),r)},set tabIndex(t){m(u)||T(e,`tabindex`,t|0)},getBoundingClientRect:()=>_t(L(u)),get offsetWidth(){return Math.round(L(u)?.[2]??0)},get offsetHeight(){return Math.round(L(u)?.[3]??0)},get offsetLeft(){return gt(u).left},get offsetTop(){return gt(u).top},get offsetParent(){return ht(u)},get clientWidth(){let e=L(u);return e?Math.max(0,Math.round(e[2]-2*e[4])):0},get clientHeight(){let e=L(u);return e?Math.max(0,Math.round(e[3]-2*e[4])):0},get clientLeft(){return Math.round(L(u)?.[4]??0)},get clientTop(){return Math.round(L(u)?.[4]??0)},get scrollLeft(){return s()?.[0]??0},set scrollLeft(e){J(u,[e],!1)},get scrollTop(){return s()?.[1]??0},set scrollTop(e){J(u,[void 0,e],!1)},get scrollWidth(){return u.clientWidth+Math.round(s()?.[2]??0)},get scrollHeight(){return u.clientHeight+Math.round(s()?.[3]??0)},scrollTo:(...e)=>J(u,e,!1),scrollBy:(...e)=>J(u,e,!0),scrollIntoView:t=>{if(f(u))return;let{block:n,inline:r}=Dt(t);Je(e,n,r)},matches:(...t)=>{let n=Q(t,`matches`);return m(u)?(D(n),!1):He(e,n)},closest:(...t)=>{let n=Q(t,`closest`);if(m(u))return D(n),null;let r=Ue(e,n);return r===null?null:d(r)},querySelector:(...t)=>{let n=Q(t,`querySelector`);if(m(u))return D(n),null;let r=We(e,n);return r===null?null:d(r)},querySelectorAll:(...t)=>{let n=Q(t,`querySelectorAll`);if(m(u))return D(n),M(()=>[]);let r=Ge(e,n).map(e=>d(e));return M(()=>r)}};r===`input`&&Object.defineProperty(l,"value",{get:()=>m(u)?``:Qe(e),set:t=>{m(u)||$e(e,t===null?``:String(t))},enumerable:!0,configurable:!0});let u=t(i(l,e),()=>f(u));return Object.defineProperties(u,Object.getOwnPropertyDescriptors(dt(e,u))),Object.defineProperties(u,Object.getOwnPropertyDescriptors(mt(u))),Object.defineProperties(u,Object.getOwnPropertyDescriptors(q(u))),Object.defineProperties(u,Object.getOwnPropertyDescriptors(U(u,Mt))),Object.defineProperties(u,Object.getOwnPropertyDescriptors(W(u))),Object.defineProperties(u,Object.getOwnPropertyDescriptors(n===`comment`?Ot(u):Nt(u))),c(u),u}function Nt(e){return{get textContent(){return m(e)?``:Le(e.__node_id)},set textContent(t){m(e)||X(e,Y(t))}}}function Pt(e){return $(b(e),`element`,e)}function Ft(e=``){let t=b(`#comment`);return Xe(t,`display`,`none`),T(t,`value`,e),$(t,`comment`)}function It(){let e=y();return d(e)??$(e,`element`,void 0,[`wheel`])}function Lt(e){let t=i({kind:`fragment`,parent:null,__children:[]},e),n={get textContent(){return m(t)?``:Le(e)},set textContent(e){m(t)||X(t,Y(e))}};for(let e of[q(t),U(t,Mt),W(t),n])Object.defineProperties(t,Object.getOwnPropertyDescriptors(e));return c(t),t}function Rt(){let e=Lt(b(`#fragment`));return w(e.__node_id),h(e),e}Object.defineProperty(k,"createDocumentFragment",{value:Rt,configurable:!0,writable:!0});const zt=/* @__PURE__ */ Object.defineProperty(t(v(`$window`,[`wheel`]),()=>!1),Symbol.toStringTag,{value:`Window`});Object.defineProperty(globalThis,"__inca_targets__",{value:e=>e.map(e=>e===`$document`?k:e===`$window`?zt:d(e)??(e===y()?It():null)),configurable:!0});export{Ze as A,ve as B,S as C,Me as D,Ge as E,T as F,f as G,ye as H,Xe as I,h as K,v as L,Je as M,qe as N,Ye as O,O as P,ge as R,w as S,Pe as T,me as U,_e as V,_ as W,x as _,It as a,et as b,X as c,B as d,Ct as f,k as g,z as h,$ as i,y as j,C as k,jt as l,xt as m,Ft as n,Z as o,St as p,Pt as r,At as s,zt as t,bt as u,Fe as v,Ke as w,E as x,b as y,be as z};
@@ -0,0 +1 @@
1
+ import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{A as t,B as n,C as r,D as i,F as a,G as o,H as s,I as c,K as l,L as u,M as d,N as f,O as p,P as m,R as h,S as g,U as _,V as v,W as y,_ as b,a as x,b as S,c as C,f as w,i as T,j as E,k as D,l as O,m as k,n as A,p as j,r as M,s as N,t as P,u as F,w as I,x as L,y as R,z}from"./hooks-BSL3d56y.js";var B=/* @__PURE__ */ e({addEventListener:()=>h,appendChild:()=>b,blur:()=>z,click:()=>n,createCommentNode:()=>A,createElementNode:()=>M,createEventTarget:()=>u,createIncaElement:()=>T,createNode:()=>R,createTextNode:()=>N,dispatchEvent:()=>v,focus:()=>s,focusedNode:()=>S,getAttribute:()=>L,holdNode:()=>g,insert:()=>F,insertBefore:()=>r,isRemoved:()=>o,latestEventId:()=>_,layoutOf:()=>I,nextSibling:()=>w,parentNode:()=>j,releaseNode:()=>i,releaseWhenCollected:()=>l,remove:()=>k,removeAttribute:()=>p,removeChild:()=>D,removeEventListener:()=>y,removeStyle:()=>t,rootElement:()=>x,rootNodeId:()=>E,scrollIntoViewNode:()=>d,scrollNode:()=>f,scrollOf:()=>m,setAttribute:()=>a,setElementText:()=>C,setStyle:()=>c,setText:()=>O,window:()=>P});export{B as t};
@@ -1,4 +1,6 @@
1
- import { A as EventHandlers, C as Overflow, D as TagName, E as StyleProps, F as IncaText, I as NamedNodeMap, L as NodeListOf, M as IncaElement, N as IncaInputElement, O as Attr, P as IncaNode, 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 HTMLCollectionOf, k as EventHandler, 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-Bdris5XB.js";
1
+ import { A as EventHandler, B as NodeListOf, C as Overflow, D as TagName, E as StyleProps, F as IncaInputElement, H as TextContentMember, I as IncaNode, L as IncaParent, M as HTMLCollectionOf, N as IncaElement, O as Attr, P as IncaFragment, R as IncaText, S as NodeId, T as ScrollAlignment, U as TextMembers, V as NodeMembers, _ 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 EventHandlers, k as CharacterDataMembers, 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, z as NamedNodeMap } from "./window-DIrasL0K.js";
2
+ /** How {@link IncaNative.linkedNode} names the node to reach from a node. */
3
+ type NodeLink = "parent" | "first" | "last" | "previous" | "next";
2
4
  /** What a listener or a dispatch names: a node id, or the tag of `document` or `window`. */
3
5
  type EventTargetId = NodeId | "$document" | "$window";
4
6
  /**
@@ -8,13 +10,26 @@ type EventTargetId = NodeId | "$document" | "$window";
8
10
  interface IncaNative {
9
11
  rootNodeId(): NodeId;
10
12
  createNode(tag: string): NodeId;
11
- appendChild(parentId: NodeId, childId: NodeId): void;
12
- insertBefore(parentId: NodeId, childId: NodeId, anchorId: NodeId | null): void;
13
+ appendChild(parentId: NodeId, nodeId: NodeId): number;
14
+ insertBefore(parentId: NodeId, nodeId: NodeId, refId: NodeId | null): number;
13
15
  removeChild(parentId: NodeId, childId: NodeId): void;
16
+ replaceChild(parentId: NodeId, nodeId: NodeId, childId: NodeId): number;
17
+ cloneNode(nodeId: NodeId, deep: boolean): [NodeId, string][];
18
+ rootOf(nodeId: NodeId): NodeId;
19
+ compareNodePosition(nodeId: NodeId, otherId: NodeId): number;
20
+ isEqualNode(nodeId: NodeId, otherId: NodeId): boolean;
14
21
  setAttribute(nodeId: NodeId, key: string, value: AttributeValue): void;
15
22
  getAttribute(nodeId: NodeId, key: string): AttributeValue | null;
16
23
  removeAttribute(nodeId: NodeId, key: string): void;
17
24
  attributeNames(nodeId: NodeId): string[];
25
+ linkedNode(nodeId: NodeId, link: NodeLink): NodeId | null;
26
+ childNodeIds(nodeId: NodeId): NodeId[];
27
+ isConnected(nodeId: NodeId): boolean;
28
+ textContent(nodeId: NodeId): string;
29
+ wholeText(nodeId: NodeId): string;
30
+ substringData(nodeId: NodeId, offset: number, count: number): string;
31
+ replaceData(nodeId: NodeId, offset: number, count: number, data: string): void;
32
+ splitText(nodeId: NodeId, offset: number): NodeId;
18
33
  matches(nodeId: NodeId, selector: string): boolean;
19
34
  closest(nodeId: NodeId, selector: string): NodeId | null;
20
35
  checkSelector(selector: string): void;
@@ -24,7 +39,7 @@ interface IncaNative {
24
39
  removeStyle(nodeId: NodeId, key: string): void;
25
40
  inputValue(nodeId: NodeId): string;
26
41
  setInputValue(nodeId: NodeId, value: string): void;
27
- addEventListener(target: EventTargetId, event: string, capture?: boolean, passive?: boolean): CallbackId;
42
+ addEventListener(target: EventTargetId, event: string, callback: HostCallback, capture?: boolean, passive?: boolean): CallbackId;
28
43
  removeEventListener(target: EventTargetId, event: string, callbackId: CallbackId): boolean;
29
44
  releaseListeners(nodeId: NodeId): CallbackId[];
30
45
  holdNode(nodeId: NodeId): void;
@@ -41,17 +56,13 @@ interface IncaNative {
41
56
  setPointerCapture(nodeId: NodeId, pointerId: number): void;
42
57
  releasePointerCapture(nodeId: NodeId, pointerId: number): void;
43
58
  hasPointerCapture(nodeId: NodeId, pointerId: number): boolean;
44
- startTimer(delay: number, repeat: boolean): number | undefined;
45
- stopTimer(id: number): void;
46
59
  }
47
60
  /** What the host calls: it passes the event object as the first argument. */
48
61
  type HostCallback = (...args: unknown[]) => void;
49
62
  declare global {
50
63
  var __inca_native__: IncaNative;
51
- var __inca_callbacks__: Record<CallbackId, HostCallback>;
52
64
  var __inca_released__: (nodeIds: NodeId[], callbackIds: CallbackId[]) => void;
53
65
  var __inca_targets__: (targets: EventTargetId[]) => unknown[];
54
- var __inca_timer__: (id: number) => void;
55
66
  }
56
67
  /**
57
68
  * Builds the listener methods of an event target: a node, document or window.
@@ -154,28 +165,35 @@ declare function rootNodeId(): NodeId;
154
165
  */
155
166
  declare function createNode(tag: TagName): NodeId;
156
167
  /**
157
- * Attaches `childId` as the last child of `parentId`. A thin wrapper over
168
+ * Attaches `nodeId` as the last child of `parentId`. A thin wrapper over
158
169
  * {@link insertBefore} with no anchor.
159
170
  * @param parentId - the container to attach to
160
- * @param childId - the node being attached
171
+ * @param nodeId - the node being attached, or a fragment whose children are attached
172
+ * @returns the position of the first attached node among the children of `parentId`
173
+ * @throws {DOMException} `HierarchyRequestError` as {@link insertBefore} does
161
174
  */
162
- declare function appendChild(parentId: NodeId, childId: NodeId): void;
175
+ declare function appendChild(parentId: NodeId, nodeId: NodeId): number;
163
176
  /**
164
- * Attaches `childId` as a child of `parentId`, positioned before `anchorId`
165
- * (or at the end, if `anchorId` is `null`). If `anchorId` names a real node
166
- * that just isn't currently a child of `parentId`, this falls back to
167
- * appending at the end. Only a wholly unknown `anchorId` raises.
177
+ * Attaches `nodeId` as a child of `parentId`, positioned before `refId`
178
+ * (or at the end, if `refId` is `null`). A fragment attaches its children in order.
168
179
  * @param parentId - the container to attach to
169
- * @param childId - the node being attached
170
- * @param anchorId - the sibling to insert before, or `null` to append at the end
180
+ * @param nodeId - the node being attached, or a fragment whose children are attached
181
+ * @param refId - the sibling to insert before, or `null` to append at the end
182
+ * @returns the position of the first attached node among the children of `parentId`
183
+ * @throws {DOMException} `HierarchyRequestError` when `parentId` is a text node or a comment,
184
+ * `nodeId` is `parentId` or an ancestor of it, or `nodeId` is the root container;
185
+ * `NotFoundError` when `refId` is not a child of `parentId`
186
+ * @throws {TypeError} when an id names no node
171
187
  */
172
- declare function insertBefore(parentId: NodeId, childId: NodeId, anchorId: NodeId | null): void;
188
+ declare function insertBefore(parentId: NodeId, nodeId: NodeId, refId: NodeId | null): number;
173
189
  /**
174
- * Detaches `childId` from `parentId`. The detached node keeps its own children
190
+ * Detaches `childId` from `parentId`. The detached node keeps its own children and its listeners,
175
191
  * and is freed at the start of the next frame unless it is inserted or held
176
- * with {@link holdNode} by then.
192
+ * with {@link holdNode} by then. An unknown `childId` does nothing.
177
193
  * @param parentId - the current container
178
194
  * @param childId - the node being detached
195
+ * @throws {DOMException} `NotFoundError` when `childId` is a node that is not a child of `parentId`
196
+ * @throws {TypeError} when `parentId` names no node
179
197
  */
180
198
  declare function removeChild(parentId: NodeId, childId: NodeId): void;
181
199
  /**
@@ -287,9 +305,9 @@ declare function focusedNode(): NodeId | null;
287
305
  /**
288
306
  * Builds the {@link IncaElement} handle for a native node: parentless,
289
307
  * 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.
308
+ * methods, the listener methods of an event target, `tabIndex`,
309
+ * the `value` of an `input`, the layout members, the node members and the event
310
+ * handler properties, all driven through the host.
293
311
  * @param id - the native node's id
294
312
  * @param kind - whether the node is an element or a comment stand-in
295
313
  * @param tag - the node's element kind, `div` when omitted; a `button` or `input` defaults to tab
@@ -299,51 +317,33 @@ declare function focusedNode(): NodeId | null;
299
317
  * @returns the new handle
300
318
  */
301
319
  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 `node` left the tree for good, removed or freed. A removed node stays in the host and
311
- * its members read real values. Its listeners are gone.
312
- * @param node - the handle to check
313
- * @returns `true` after {@link markRemoved} or {@link markDestroyed} reached `node`
314
- */
315
- declare function isRemoved(node: IncaNode): boolean;
316
320
  /**
317
321
  * Allocates a new element node for `tag`.
318
322
  * @param tag - the node's element kind
319
323
  * @returns the new, parentless, childless element
320
324
  */
321
325
  declare function createElementNode(tag: TagName): IncaElement;
322
- /**
323
- * Creates a text leaf.
324
- * @param text - the initial text content
325
- * @returns the new text leaf
326
- */
327
- declare function createTextNode(text: string): IncaText;
328
326
  /**
329
327
  * Creates the hidden container that stands in for a comment node, such as a
330
328
  * placeholder for conditional content.
329
+ * @param text - the data of the comment
331
330
  * @returns the new hidden element
332
331
  */
333
- declare function createCommentNode(): IncaElement;
332
+ declare function createCommentNode(text?: string): IncaElement;
334
333
  /**
335
- * Updates a text leaf's content in place.
336
- * @param node - the text leaf to update
337
- * @param text - the new text content
334
+ * Returns the handle of the host's mount container, which stands between the app's elements and
335
+ * `document` in an event path. A live handle is reused, so a mount and an event see one object.
336
+ * A `wheel` listener on it is passive unless its options say `passive: false`.
337
+ * @returns the mount container's handle
338
338
  */
339
- declare function setText(node: IncaText, text: string): void;
339
+ declare function rootElement(): IncaElement;
340
340
  /**
341
- * Replaces all of `el`'s children with at most a single text child holding
342
- * `text`. An empty string leaves `el` childless.
343
- * @param el - the container whose children are replaced
344
- * @param text - the new text content
341
+ * Whether `node` left the tree for good, removed or freed. A removed node stays in the host and
342
+ * its members read real values. Its listeners are gone.
343
+ * @param node - the handle to check
344
+ * @returns `true` after {@link markRemoved} or {@link markDestroyed} reached `node`
345
345
  */
346
- declare function setElementText(el: IncaElement, text: string): void;
346
+ declare function isRemoved(node: IncaNode): boolean;
347
347
  /**
348
348
  * Attaches `child` to `parent`, before `anchor` or at the end when `anchor` is
349
349
  * omitted or `null`. If `anchor` is `child` itself and `child` is already in
@@ -366,7 +366,7 @@ declare function remove(child: IncaNode): void;
366
366
  /**
367
367
  * Looks up the current parent.
368
368
  * @param node - the node to query
369
- * @returns the current parent, or `null` if it isn't attached
369
+ * @returns the current parent, or `null` if it isn't attached or sits in a fragment
370
370
  */
371
371
  declare function parentNode(node: IncaNode): IncaElement | null;
372
372
  /**
@@ -375,12 +375,31 @@ declare function parentNode(node: IncaNode): IncaElement | null;
375
375
  * @returns the sibling immediately after `node` in its parent's children, or `null` if there is none (or `node` isn't attached)
376
376
  */
377
377
  declare function nextSibling(node: IncaNode): IncaNode | null;
378
+ /**
379
+ * Creates a text leaf.
380
+ * @param text - the initial text content
381
+ * @returns the new text leaf
382
+ */
383
+ declare function createTextNode(text: string): IncaText;
384
+ /**
385
+ * Updates a text leaf's content in place.
386
+ * @param node - the text leaf to update
387
+ * @param text - the new text content
388
+ */
389
+ declare function setText(node: IncaText, text: string): void;
390
+ /**
391
+ * Replaces all of `el`'s children with at most a single text child holding
392
+ * `text`. An empty string leaves `el` childless.
393
+ * @param el - the element or fragment whose children are replaced
394
+ * @param text - the new text content
395
+ */
396
+ declare function setElementText(el: IncaParent, text: string): void;
378
397
  declare namespace rendererCore_d_exports {
379
- export { Attr, AttributeValue, CallbackId, EventHandler, EventHandlers, EventLike, EventListener, EventListenerObject, EventListenerOrObject, HTMLCollectionOf, IncaCompositionEvent, IncaCore, IncaDocument, IncaElement, IncaEvent, IncaEventMap, IncaEventTarget, IncaFocusEvent, IncaInputElement, IncaInputEvent, IncaKeyboardEvent, IncaMouseEvent, IncaNode, IncaPointerEvent, IncaText, IncaUIEvent, IncaWheelEvent, IncaWindow, ListenerOptions, NamedNodeMap, NodeId, NodeListOf, Overflow, Px, ScrollAlignment, StyleProps, TagName, addEventListener, appendChild, blur, click, createCommentNode, createElementNode, createEventTarget, createIncaElement, createNode, createTextNode, dispatchEvent, focus, focusedNode, getAttribute, holdNode, insert, insertBefore, isRemoved, latestEventId, layoutOf, nextSibling, parentNode, releaseNode, remove, removeAttribute, removeChild, removeEventListener, removeStyle, rootElement, rootNodeId, scrollIntoViewNode, scrollNode, scrollOf, setAttribute, setElementText, setStyle, setText, window };
398
+ export { Attr, AttributeValue, CallbackId, CharacterDataMembers, EventHandler, EventHandlers, EventLike, EventListener, EventListenerObject, EventListenerOrObject, HTMLCollectionOf, IncaCompositionEvent, IncaCore, IncaDocument, IncaElement, IncaEvent, IncaEventMap, IncaEventTarget, IncaFocusEvent, IncaFragment, IncaInputElement, IncaInputEvent, IncaKeyboardEvent, IncaMouseEvent, IncaNode, IncaParent, IncaPointerEvent, IncaText, IncaUIEvent, IncaWheelEvent, IncaWindow, ListenerOptions, NamedNodeMap, NodeId, NodeListOf, NodeMembers, Overflow, Px, ScrollAlignment, StyleProps, TagName, TextContentMember, TextMembers, addEventListener, appendChild, blur, click, createCommentNode, createElementNode, createEventTarget, createIncaElement, createNode, createTextNode, dispatchEvent, focus, focusedNode, getAttribute, holdNode, insert, insertBefore, isRemoved, latestEventId, layoutOf, nextSibling, parentNode, releaseNode, remove, removeAttribute, removeChild, removeEventListener, removeStyle, rootElement, rootNodeId, scrollIntoViewNode, scrollNode, scrollOf, setAttribute, setElementText, setStyle, setText, window };
380
399
  }
381
400
  /**
382
401
  * What a custom renderer (`incajs/vue`) drives the host through: the tree and
383
402
  * event calls, the element handles and the shadow tree.
384
403
  */
385
404
  type IncaCore = typeof rendererCore_d_exports;
386
- export { setStyle as A, removeChild as C, scrollNode as D, scrollIntoViewNode as E, focus as F, latestEventId as I, removeEventListener as L, blur as M, click as N, scrollOf as O, dispatchEvent as P, createEventTarget as R, removeAttribute as S, rootNodeId as T, getAttribute as _, insert as a, layoutOf as b, remove as c, isRemoved as d, createIncaElement as f, focusedNode as g, createNode as h, createTextNode as i, addEventListener as j, setAttribute 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, holdNode as v, removeStyle as w, releaseNode as x, insertBefore as y };
405
+ export { setStyle as A, removeChild as C, scrollNode as D, scrollIntoViewNode as E, focus as F, latestEventId as I, removeEventListener as L, blur as M, click as N, scrollOf as O, dispatchEvent as P, createEventTarget as R, removeAttribute as S, rootNodeId as T, getAttribute as _, insert as a, layoutOf as b, remove as c, createElementNode as d, createIncaElement as f, focusedNode as g, createNode as h, setText as i, addEventListener as j, setAttribute as k, isRemoved as l, appendChild as m, createTextNode as n, nextSibling as o, rootElement as p, setElementText as r, parentNode as s, IncaCore as t, createCommentNode as u, holdNode as v, removeStyle as w, releaseNode as x, insertBefore as y };
@@ -3,6 +3,12 @@ declare global {
3
3
  function setInterval<A extends unknown[]>(handler: (...args: A) => void, delay?: number, ...args: A): number;
4
4
  function clearTimeout(id?: number): void;
5
5
  function clearInterval(id?: number): void;
6
+ function requestAnimationFrame(callback: (time: number) => void): number;
7
+ function cancelAnimationFrame(id: number): void;
8
+ interface Performance {
9
+ now(): number;
10
+ }
11
+ var performance: Performance;
6
12
  }
7
13
  /** The events whose handler property every element has. */
8
14
  declare const HANDLER_EVENTS: readonly ["auxclick", "beforeinput", "blur", "change", "click", "contextmenu", "dblclick", "focus", "gotpointercapture", "input", "keydown", "keypress", "keyup", "lostpointercapture", "mousedown", "mouseenter", "mouseleave", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointerenter", "pointerleave", "pointermove", "pointerout", "pointerover", "pointerup", "scroll", "wheel"];
@@ -70,30 +76,33 @@ interface HTMLCollectionOf<T extends IncaElement> {
70
76
  namedItem(name: string): T | null;
71
77
  [Symbol.iterator](): IterableIterator<T>;
72
78
  }
73
- /** A read-only list of elements that a query returned. It keeps the elements it found. */
74
- interface NodeListOf<T extends IncaElement> {
79
+ /**
80
+ * A read-only list of nodes. The list of `childNodes` follows later changes. The list of
81
+ * `querySelectorAll()` holds the elements found when it was made.
82
+ */
83
+ interface NodeListOf<T extends IncaNode> {
75
84
  readonly [index: number]: T;
76
- /** The number of elements in the list. */
85
+ /** The number of nodes in the list. */
77
86
  readonly length: number;
78
87
  /**
79
- * The element at `index`, or `null` beyond the list. The index converts to an unsigned 32-bit
88
+ * The node at `index`, or `null` beyond the list. The index converts to an unsigned 32-bit
80
89
  * integer.
81
90
  * @param index - The position in the list.
82
- * @returns The element at `index`, or `null`.
91
+ * @returns The node at `index`, or `null`.
83
92
  */
84
93
  item(index: number): T | null;
85
94
  /**
86
- * Calls `callback` with the element, its index and the list for each element in order.
95
+ * Calls `callback` with the node, its index and the list for each node in order.
87
96
  * @throws TypeError when `callback` is not a function
88
- * @param callback - The function to call for each element.
97
+ * @param callback - The function to call for each node.
89
98
  * @param thisArg - The value of `this` inside `callback`.
90
99
  */
91
100
  forEach(callback: (value: T, index: number, list: NodeListOf<T>) => void, thisArg?: unknown): void;
92
- /** The pairs of index and element in order. */
101
+ /** The pairs of index and node in order. */
93
102
  entries(): IterableIterator<[number, T]>;
94
103
  /** The indices in order. */
95
104
  keys(): IterableIterator<number>;
96
- /** The elements in order. */
105
+ /** The nodes in order. */
97
106
  values(): IterableIterator<T>;
98
107
  [Symbol.iterator](): IterableIterator<T>;
99
108
  }
@@ -139,6 +148,179 @@ interface NamedNodeMap {
139
148
  getNamedItem(qualifiedName: string): Attr | null;
140
149
  [Symbol.iterator](): IterableIterator<Attr>;
141
150
  }
151
+ /** The members every node has: what it is, its data and its place in the tree. */
152
+ interface NodeMembers {
153
+ /**
154
+ * `1` for an element, `3` for a text node, `8` for a comment stand-in and `11` for a
155
+ * fragment.
156
+ */
157
+ readonly nodeType: 1 | 3 | 8 | 11;
158
+ /**
159
+ * The {@link IncaElement.tagName} of an element, `"#text"` for a text node, `"#comment"` for a
160
+ * comment stand-in and `"#document-fragment"` for a fragment.
161
+ */
162
+ readonly nodeName: string;
163
+ /**
164
+ * The data of a text node or a comment stand-in, and `null` for an element or a
165
+ * fragment. Assigning `null` or `undefined` stores `""` and any other value stores its string.
166
+ * Assigning to an element, a fragment or a freed node does nothing.
167
+ */
168
+ nodeValue: string | null;
169
+ /** Whether the node hangs under the mount container, which counts as connected. */
170
+ readonly isConnected: boolean;
171
+ /** The `document` export. */
172
+ readonly ownerDocument: IncaDocument;
173
+ /**
174
+ * The parent, `document` for the mount container and `null` for a detached node. A node inside
175
+ * a fragment reads the fragment. A freed node reads `null`.
176
+ */
177
+ readonly parentNode: IncaElement | IncaFragment | IncaDocument | null;
178
+ /** The first child, or `null`. */
179
+ readonly firstChild: IncaNode | null;
180
+ /** The last child, or `null`. */
181
+ readonly lastChild: IncaNode | null;
182
+ /** The sibling right before this node, or `null`. */
183
+ readonly previousSibling: IncaNode | null;
184
+ /** The sibling right after this node, or `null`. */
185
+ readonly nextSibling: IncaNode | null;
186
+ /**
187
+ * The children in order, as a live list. Every read returns the same object, which follows later
188
+ * changes. A freed node has an empty list.
189
+ */
190
+ readonly childNodes: NodeListOf<IncaNode>;
191
+ /** Whether the node has a child. */
192
+ hasChildNodes(): boolean;
193
+ /**
194
+ * Appends `node` as the last child. A fragment gives up its children in order and stays empty.
195
+ * A node that has a parent moves. Throws `HierarchyRequestError` when this node is a text node or
196
+ * a comment, or when `node` is this node or one of its ancestors.
197
+ * @returns `node`
198
+ */
199
+ appendChild<T extends IncaNode>(node: T): T;
200
+ /**
201
+ * Inserts `node` before `child`, or last when `child` is `null` or `undefined`. A fragment gives
202
+ * up its children in order and stays empty. Throws `HierarchyRequestError` as
203
+ * {@link NodeMembers.appendChild} does, and `NotFoundError` when `child` is not a child of this
204
+ * node.
205
+ * @returns `node`
206
+ */
207
+ insertBefore<T extends IncaNode>(node: T, child: IncaNode | null | undefined): T;
208
+ /**
209
+ * Removes `child`, which keeps its listeners and can be inserted again. Throws `NotFoundError`
210
+ * when `child` is not a child of this node.
211
+ * @returns `child`
212
+ */
213
+ removeChild<T extends IncaNode>(child: T): T;
214
+ /**
215
+ * Puts `node` in the place of `child`, which keeps its listeners and can be inserted again.
216
+ * Throws as {@link NodeMembers.insertBefore} does, with `child` as the node that has to be a
217
+ * child of this node.
218
+ * @returns `child`
219
+ */
220
+ replaceChild<T extends IncaNode>(node: IncaNode, child: T): T;
221
+ /**
222
+ * Copies the node: its tag, attributes and style, and with `deep` its descendants. The copy has
223
+ * no parent, no listeners and no scroll offset, and the text of an `input` carries over.
224
+ * @param deep - whether the descendants are copied too
225
+ * @returns the copy
226
+ */
227
+ cloneNode(deep?: boolean): this;
228
+ /**
229
+ * Whether `other` is this node or one of its descendants in the tree as rendered. `null` and
230
+ * `undefined` give `false`, and any other value that is not a node throws a `TypeError`. After
231
+ * the node is removed, it still answers for the subtree it keeps. A freed node contains only
232
+ * itself.
233
+ */
234
+ contains(other: IncaNode | null): boolean;
235
+ /**
236
+ * The `document` export while the node hangs under the mount container, else the topmost node
237
+ * of its subtree, the node itself without a parent.
238
+ */
239
+ getRootNode(): IncaNode | IncaDocument;
240
+ /**
241
+ * The position of `other` relative to this node as a bit mask: `1` disconnected, `2` preceding,
242
+ * `4` following, `8` contains, `16` contained by and `32` implementation specific. Nodes of
243
+ * different trees give `1 | 32` plus `2` or `4`, with opposite directions for the two orders of
244
+ * the pair. A freed node is a tree of its own: it gives `1 | 32` plus `2` or `4` by the order of
245
+ * the two ids, and `0` for itself.
246
+ * @throws {TypeError} when `other` is not a node
247
+ */
248
+ compareDocumentPosition(other: IncaNode): number;
249
+ /** Whether `other` is this node. `null` and `undefined` give `false`. */
250
+ isSameNode(other: IncaNode | null): boolean;
251
+ /**
252
+ * Whether `other` has the same tag, attributes, style and children, compared in depth. The typed
253
+ * text of an `input` is not compared. `null` and `undefined` give `false`. A freed node equals
254
+ * only itself.
255
+ */
256
+ isEqualNode(other: IncaNode | null): boolean;
257
+ }
258
+ /** The `textContent` of a node. */
259
+ interface TextContentMember {
260
+ /**
261
+ * The data of a text node or a comment stand-in, and the data of the text nodes below an
262
+ * element in tree order, comment stand-ins left out. Assigning `null` or `undefined` stores `""`
263
+ * and any other value stores its string. Assigning to an element replaces its children with one
264
+ * text node, or with none for `""`. A freed node reads `""` or its last data and ignores the
265
+ * assignment.
266
+ */
267
+ textContent: string;
268
+ }
269
+ /** The members of a text node and a comment stand-in that read and edit their data. */
270
+ interface CharacterDataMembers extends TextContentMember {
271
+ /** The data. Assigning `null` stores `""` and any other value stores its string. */
272
+ data: string;
273
+ /** The number of UTF-16 code units of the data. */
274
+ readonly length: number;
275
+ /**
276
+ * The part of the data from `offset`. Both arguments convert to unsigned 32-bit integers and
277
+ * count UTF-16 code units. `count` stops at the end of the data.
278
+ * @param offset - Where the part starts.
279
+ * @param count - The length of the part.
280
+ * @throws {DOMException} named `IndexSizeError` when `offset` is beyond the data.
281
+ */
282
+ substringData(offset: number, count: number): string;
283
+ /**
284
+ * Adds `data` at the end of the data.
285
+ * @param data - The text to add.
286
+ */
287
+ appendData(data: string): void;
288
+ /**
289
+ * Adds `data` at `offset`.
290
+ * @param offset - Where to add.
291
+ * @param data - The text to add.
292
+ * @throws {DOMException} named `IndexSizeError` when `offset` is beyond the data.
293
+ */
294
+ insertData(offset: number, data: string): void;
295
+ /**
296
+ * Removes `count` units from `offset`.
297
+ * @param offset - Where the removal starts.
298
+ * @param count - The number of units, stopping at the end of the data.
299
+ * @throws {DOMException} named `IndexSizeError` when `offset` is beyond the data.
300
+ */
301
+ deleteData(offset: number, count: number): void;
302
+ /**
303
+ * Replaces `count` units from `offset` with `data`.
304
+ * @param offset - Where the replaced part starts.
305
+ * @param count - The number of units, stopping at the end of the data.
306
+ * @param data - The new text.
307
+ * @throws {DOMException} named `IndexSizeError` when `offset` is beyond the data.
308
+ */
309
+ replaceData(offset: number, count: number, data: string): void;
310
+ }
311
+ /** The members only a text node has. */
312
+ interface TextMembers {
313
+ /** The data of this node and of the text nodes that touch it, in order. */
314
+ readonly wholeText: string;
315
+ /**
316
+ * Cuts the data at `offset`. This node keeps the head and the new node holds the tail. The new
317
+ * node follows this one when this one has a parent, and has no parent otherwise.
318
+ * @param offset - Where to cut, converted like the offset of `substringData()`.
319
+ * @returns The new node.
320
+ * @throws {DOMException} named `IndexSizeError` when `offset` is beyond the data.
321
+ */
322
+ splitText(offset: number): IncaText;
323
+ }
142
324
  /**
143
325
  * A container node: either a real element or the hidden stand-in that
144
326
  * `createCommentNode` makes. It is the only node type that can act as a
@@ -149,7 +331,7 @@ interface NamedNodeMap {
149
331
  * call, an assignment to a handler property does nothing, and `dispatchEvent()` runs no listener
150
332
  * on it.
151
333
  */
152
- interface IncaElement extends IncaEventTarget, EventHandlers {
334
+ interface IncaElement extends IncaEventTarget, EventHandlers, NodeMembers, TextContentMember {
153
335
  /**
154
336
  * The `id` attribute, or an empty string when it is unset. Assigning sets
155
337
  * the attribute to the value as a string.
@@ -165,14 +347,17 @@ interface IncaElement extends IncaEventTarget, EventHandlers {
165
347
  * `"DIV"`.
166
348
  */
167
349
  readonly tagName: string;
168
- /** The current parent, or `null` if this node isn't attached to the tree. */
169
- parent: IncaElement | null;
350
+ /** The current parent element or fragment, or `null` if this node isn't attached to the tree. */
351
+ parent: IncaParent | null;
170
352
  /**
171
353
  * The child elements in order, as a live collection. Every read returns the same object, which
172
354
  * follows later changes. A removed element lists the element children it kept.
173
355
  */
174
356
  readonly children: HTMLCollectionOf<IncaElement>;
175
- /** The parent element, or `null` for a detached node and for the mount container. */
357
+ /**
358
+ * The parent element, or `null` for a detached node, a node inside a fragment and the mount
359
+ * container.
360
+ */
176
361
  readonly parentElement: IncaElement | null;
177
362
  /** The first child that is an element, or `null`. */
178
363
  readonly firstElementChild: IncaElement | null;
@@ -217,13 +402,6 @@ interface IncaElement extends IncaEventTarget, EventHandlers {
217
402
  * removed.
218
403
  */
219
404
  hasPointerCapture(pointerId: number): boolean;
220
- /**
221
- * Whether `other` is this node or one of its descendants in the tree as
222
- * rendered. `null` and `undefined` give `false`, and any other value that is
223
- * not a node throws a `TypeError`. After the node is removed, it still answers
224
- * for the subtree it keeps.
225
- */
226
- contains(other: IncaNode | null): boolean;
227
405
  /**
228
406
  * Assigning sets the `tabindex` attribute to the value's integer part,
229
407
  * wrapped to 32 bits. Reading returns the `tabindex` attribute as an
@@ -265,8 +443,8 @@ interface IncaElement extends IncaEventTarget, EventHandlers {
265
443
  */
266
444
  readonly attributes: NamedNodeMap;
267
445
  /**
268
- * Whether this element matches the selector list. `:hover`, `:focus` and the other interactive
269
- * and form-state pseudo-classes never match.
446
+ * Whether this element matches the selector list. `:focus-visible` and the other interactive and
447
+ * form-state pseudo-classes never match.
270
448
  * @throws DOMException named `SyntaxError` for an invalid selector, also after this element is
271
449
  * removed
272
450
  * @param selectors - A selector list.
@@ -349,11 +527,6 @@ interface IncaElement extends IncaEventTarget, EventHandlers {
349
527
  * does nothing.
350
528
  */
351
529
  scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;
352
- /**
353
- * The `document` export while the node hangs under the mount container,
354
- * else the topmost node of its subtree, the node itself without a parent.
355
- */
356
- getRootNode(): IncaElement | IncaDocument;
357
530
  }
358
531
  /** The handle of an `<input>`. */
359
532
  interface IncaInputElement extends IncaElement {
@@ -364,18 +537,30 @@ interface IncaInputElement extends IncaElement {
364
537
  value: string;
365
538
  }
366
539
  /** A text leaf node. */
367
- interface IncaText {
540
+ interface IncaText extends NodeMembers, CharacterDataMembers, TextMembers {
368
541
  /** Discriminates this node within the {@link IncaNode} union. */
369
542
  readonly kind: "text";
370
- /** The current parent, or `null` if this node isn't attached to the tree. */
371
- parent: IncaElement | null;
543
+ /** The current parent element or fragment, or `null` if this node isn't attached to the tree. */
544
+ parent: IncaParent | null;
372
545
  /**
373
546
  * The text content, mirroring the value pushed to the native node.
374
547
  */
375
548
  text: string;
376
549
  }
377
- /** Any node the shadow tree holds: an element, comment, or text leaf. */
378
- type IncaNode = IncaElement | IncaText;
550
+ /**
551
+ * The node `document.createDocumentFragment()` returns: a parentless container whose children move
552
+ * into the node it is inserted into.
553
+ */
554
+ interface IncaFragment extends NodeMembers, TextContentMember {
555
+ /** Discriminates this node within the {@link IncaNode} union. */
556
+ readonly kind: "fragment";
557
+ /** A fragment has no parent. */
558
+ parent: null;
559
+ }
560
+ /** A node that can have children. */
561
+ type IncaParent = IncaElement | IncaFragment;
562
+ /** Any node the shadow tree holds: an element, comment, text leaf or fragment. */
563
+ type IncaNode = IncaElement | IncaText | IncaFragment;
379
564
  /**
380
565
  * Stable handle to a node in the native retained tree, returned by `createNode`
381
566
  * and used in every later call that touches that node.
@@ -561,6 +746,11 @@ interface IncaDocument extends IncaEventTarget, EventHandlers<IncaDocument> {
561
746
  * takes effect for this property at once.
562
747
  */
563
748
  readonly activeElement: IncaElement | null;
749
+ /**
750
+ * Creates an empty fragment. Inserting it moves its children into the node it is inserted into.
751
+ * @returns the new fragment
752
+ */
753
+ createDocumentFragment(): IncaFragment;
564
754
  }
565
755
  /**
566
756
  * The event target at the top of every event path.
@@ -622,7 +812,7 @@ interface IncaEvent {
622
812
  readonly defaultPrevented: boolean;
623
813
  /** `true` for events the host dispatches and `false` for events a script dispatches. */
624
814
  readonly isTrusted: boolean;
625
- /** Milliseconds since the host started. */
815
+ /** Milliseconds since the app was loaded. */
626
816
  readonly timeStamp: number;
627
817
  /** A number that grows with each event and is the same on every node that event reaches. */
628
818
  readonly eventId: number;
@@ -885,4 +1075,4 @@ type EventListenerOrObject<E = IncaEvent, T = IncaEventTarget> = EventListener<E
885
1075
  * `dispatchEvent`, and the event handler properties such as `onkeydown`.
886
1076
  */
887
1077
  declare const window: IncaWindow;
888
- export { EventHandlers as A, RectLike as B, Overflow as C, TagName as D, StyleProps as E, IncaText as F, NamedNodeMap as I, NodeListOf as L, IncaElement as M, IncaInputElement as N, Attr as O, IncaNode as P, ScrollIntoViewOptions as R, NodeId as S, ScrollAlignment as T, RectValues as V, IncaPointerEvent as _, EventListener as a, IncaWindow as b, IncaCompositionEvent as c, IncaEventMap as d, IncaEventTarget as f, IncaMouseEvent as g, IncaKeyboardEvent as h, EventLike as i, HTMLCollectionOf as j, EventHandler as k, IncaDocument as l, IncaInputEvent as m, AttributeValue as n, EventListenerObject as o, IncaFocusEvent as p, CallbackId as r, EventListenerOrObject as s, window as t, IncaEvent as u, IncaUIEvent as v, Px as w, ListenerOptions as x, IncaWheelEvent as y, ScrollOptions as z };
1078
+ export { EventHandler as A, NodeListOf as B, Overflow as C, TagName as D, StyleProps as E, IncaInputElement as F, ScrollOptions as G, TextContentMember as H, IncaNode as I, RectLike as K, IncaParent as L, HTMLCollectionOf as M, IncaElement as N, Attr as O, IncaFragment as P, IncaText as R, NodeId as S, ScrollAlignment as T, TextMembers as U, NodeMembers as V, ScrollIntoViewOptions as W, IncaPointerEvent as _, EventListener as a, IncaWindow as b, IncaCompositionEvent as c, IncaEventMap as d, IncaEventTarget as f, IncaMouseEvent as g, IncaKeyboardEvent as h, EventLike as i, EventHandlers as j, CharacterDataMembers as k, IncaDocument as l, IncaInputEvent as m, AttributeValue as n, EventListenerObject as o, IncaFocusEvent as p, RectValues as q, CallbackId as r, EventListenerOrObject as s, window as t, IncaEvent as u, IncaUIEvent as v, Px as w, ListenerOptions as x, IncaWheelEvent as y, NamedNodeMap as z };
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { B as RectLike, D as TagName, E as StyleProps, I as NamedNodeMap, L as NodeListOf, M as IncaElement, N as IncaInputElement, O as Attr, P as IncaNode, R as ScrollIntoViewOptions, S as NodeId, V as RectValues, _ 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 HTMLCollectionOf, 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, z as ScrollOptions } from "./chunks/window-Bdris5XB.js";
1
+ import { B as NodeListOf, D as TagName, E as StyleProps, F as IncaInputElement, G as ScrollOptions, I as IncaNode, K as RectLike, L as IncaParent, M as HTMLCollectionOf, N as IncaElement, O as Attr, P as IncaFragment, S as NodeId, W as ScrollIntoViewOptions, _ 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, l as IncaDocument, m as IncaInputEvent, n as AttributeValue, o as EventListenerObject, p as IncaFocusEvent, q as RectValues, r as CallbackId, s as EventListenerOrObject, t as window, u as IncaEvent, v as IncaUIEvent, w as Px, x as ListenerOptions, y as IncaWheelEvent, z as NamedNodeMap } from "./chunks/window-DIrasL0K.js";
2
2
  /**
3
3
  * The event target between the elements and `window`. An event at an element
4
4
  * passes through it, and it is the next target after the mount container.
5
5
  *
6
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`.
7
+ * `dispatchEvent`, the event handler properties such as `onkeydown`,
8
+ * `activeElement` and `createDocumentFragment()`. A `wheel` listener is passive unless its
9
+ * options say `passive: false`. It is an instance of the global `Document`.
10
10
  */
11
11
  export declare const document: IncaDocument;
12
- export { type Attr, type AttributeValue, type CallbackId, type EventLike, type EventListener, type EventListenerObject, type EventListenerOrObject, type HTMLCollectionOf, 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 NamedNodeMap, type NodeId, type NodeListOf, type Px, type RectLike, type RectValues, type ScrollIntoViewOptions, type ScrollOptions, type StyleProps, type TagName, window };
12
+ export { type Attr, type AttributeValue, type CallbackId, type EventLike, type EventListener, type EventListenerObject, type EventListenerOrObject, type HTMLCollectionOf, type IncaCompositionEvent, type IncaDocument, type IncaElement, type IncaEvent, type IncaEventMap, type IncaEventTarget, type IncaFocusEvent, type IncaFragment, type IncaInputElement, type IncaInputEvent, type IncaKeyboardEvent, type IncaMouseEvent, type IncaNode, type IncaParent, type IncaPointerEvent, type IncaUIEvent, type IncaWheelEvent, type IncaWindow, type ListenerOptions, type NamedNodeMap, type NodeId, type NodeListOf, type Px, type RectLike, type RectValues, type ScrollIntoViewOptions, type ScrollOptions, type StyleProps, type TagName, window };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export{i as document,r as window}from"./chunks/hooks-B-QJlyLk.js";
1
+ export{g as document,t as window}from"./chunks/hooks-BSL3d56y.js";
@@ -1,3 +1,3 @@
1
- import { A as EventHandlers, C as Overflow, D as TagName, E as StyleProps, F as IncaText, I as NamedNodeMap, L as NodeListOf, M as IncaElement, N as IncaInputElement, O as Attr, P as IncaNode, 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 HTMLCollectionOf, k as EventHandler, 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 "./chunks/window-Bdris5XB.js";
2
- import { A as setStyle, C as removeChild, D as scrollNode, E as scrollIntoViewNode, F as focus, I as latestEventId, L as removeEventListener, M as blur, N as click, O as scrollOf, P as dispatchEvent, R as createEventTarget, S as removeAttribute, T as rootNodeId, _ as getAttribute, a as insert, b as layoutOf, c as remove, d as isRemoved, f as createIncaElement, g as focusedNode, h as createNode, i as createTextNode, j as addEventListener, k as setAttribute, 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 holdNode, w as removeStyle, x as releaseNode, y as insertBefore } from "./chunks/rendererCore-DSk9eNTM.js";
3
- export { type Attr, type AttributeValue, type CallbackId, type EventHandler, type EventHandlers, type EventLike, type EventListener, type EventListenerObject, type EventListenerOrObject, type HTMLCollectionOf, 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 NamedNodeMap, type NodeId, type NodeListOf, type Overflow, type Px, type ScrollAlignment, type StyleProps, type TagName, addEventListener, appendChild, blur, click, createCommentNode, createElementNode, createEventTarget, createIncaElement, createNode, createTextNode, dispatchEvent, focus, focusedNode, getAttribute, holdNode, insert, insertBefore, isRemoved, latestEventId, layoutOf, nextSibling, parentNode, releaseNode, remove, removeAttribute, removeChild, removeEventListener, removeStyle, rootElement, rootNodeId, scrollIntoViewNode, scrollNode, scrollOf, setAttribute, setElementText, setStyle, setText, window };
1
+ import { A as EventHandler, B as NodeListOf, C as Overflow, D as TagName, E as StyleProps, F as IncaInputElement, H as TextContentMember, I as IncaNode, L as IncaParent, M as HTMLCollectionOf, N as IncaElement, O as Attr, P as IncaFragment, R as IncaText, S as NodeId, T as ScrollAlignment, U as TextMembers, V as NodeMembers, _ 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 EventHandlers, k as CharacterDataMembers, 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, z as NamedNodeMap } from "./chunks/window-DIrasL0K.js";
2
+ import { A as setStyle, C as removeChild, D as scrollNode, E as scrollIntoViewNode, F as focus, I as latestEventId, L as removeEventListener, M as blur, N as click, O as scrollOf, P as dispatchEvent, R as createEventTarget, S as removeAttribute, T as rootNodeId, _ as getAttribute, a as insert, b as layoutOf, c as remove, d as createElementNode, f as createIncaElement, g as focusedNode, h as createNode, i as setText, j as addEventListener, k as setAttribute, l as isRemoved, m as appendChild, n as createTextNode, o as nextSibling, p as rootElement, r as setElementText, s as parentNode, t as IncaCore, u as createCommentNode, v as holdNode, w as removeStyle, x as releaseNode, y as insertBefore } from "./chunks/rendererCore-D7-q9n5H.js";
3
+ export { type Attr, type AttributeValue, type CallbackId, type CharacterDataMembers, type EventHandler, type EventHandlers, type EventLike, type EventListener, type EventListenerObject, type EventListenerOrObject, type HTMLCollectionOf, type IncaCompositionEvent, IncaCore, type IncaDocument, type IncaElement, type IncaEvent, type IncaEventMap, type IncaEventTarget, type IncaFocusEvent, type IncaFragment, type IncaInputElement, type IncaInputEvent, type IncaKeyboardEvent, type IncaMouseEvent, type IncaNode, type IncaParent, type IncaPointerEvent, type IncaText, type IncaUIEvent, type IncaWheelEvent, type IncaWindow, type ListenerOptions, type NamedNodeMap, type NodeId, type NodeListOf, type NodeMembers, type Overflow, type Px, type ScrollAlignment, type StyleProps, type TagName, type TextContentMember, type TextMembers, addEventListener, appendChild, blur, click, createCommentNode, createElementNode, createEventTarget, createIncaElement, createNode, createTextNode, dispatchEvent, focus, focusedNode, getAttribute, holdNode, insert, insertBefore, isRemoved, latestEventId, layoutOf, nextSibling, parentNode, releaseNode, remove, removeAttribute, removeChild, removeEventListener, removeStyle, rootElement, rootNodeId, scrollIntoViewNode, scrollNode, scrollOf, setAttribute, setElementText, setStyle, setText, window };
@@ -1 +1 @@
1
- import{A as e,C as t,D as n,E as r,F as i,N as a,O as o,S as s,T as c,_ as l,a as u,b as d,c as f,d as p,g as m,h,k as g,l as _,m as v,n as y,o as b,p as x,r as S,s as C,t as w,u as T,v as E,w as D,x as O,y as k}from"./chunks/hooks-B-QJlyLk.js";import{a as A,c as j,i as M,l as N,n as P,o as F,r as I,s as L,u as R}from"./chunks/rendererCore-DYJn9DML.js";export{D as addEventListener,u as appendChild,c as blur,r as click,P as createCommentNode,I as createElementNode,t as createEventTarget,w as createIncaElement,b as createNode,M as createTextNode,n as dispatchEvent,o as focus,C as focusedNode,f as getAttribute,_ as holdNode,A as insert,T as insertBefore,a as isRemoved,g as latestEventId,p as layoutOf,F as nextSibling,L as parentNode,x as releaseNode,i as releaseWhenCollected,j as remove,v as removeAttribute,h as removeChild,e as removeEventListener,m as removeStyle,y as rootElement,l as rootNodeId,E as scrollIntoViewNode,k as scrollNode,d as scrollOf,O as setAttribute,N as setElementText,s as setStyle,R as setText,S as window};
1
+ export{R as addEventListener,_ as appendChild,z as blur,B as click,n as createCommentNode,r as createElementNode,L as createEventTarget,i as createIncaElement,y as createNode,s as createTextNode,V as dispatchEvent,H as focus,b as focusedNode,x as getAttribute,S as holdNode,u as insert,C as insertBefore,G as isRemoved,U as latestEventId,w as layoutOf,f as nextSibling,p as parentNode,D as releaseNode,K as releaseWhenCollected,m as remove,O as removeAttribute,k as removeChild,W as removeEventListener,A as removeStyle,a as rootElement,j as rootNodeId,M as scrollIntoViewNode,N as scrollNode,P as scrollOf,F as setAttribute,c as setElementText,I as setStyle,l as setText,t as window}from"./chunks/hooks-BSL3d56y.js";import"./chunks/rendererCore-CWokQ5X0.js";
@@ -0,0 +1 @@
1
+ export {}
package/dist/style.js ADDED
@@ -0,0 +1 @@
1
+ import{E as e,F as t,T as n,a as r,d as i,h as a,i as o,j as s,k as c,m as l,o as u,r as d,s as f,u as p,v as m,x as h}from"./chunks/hooks-BSL3d56y.js";const g=`data-inca-style`,_=/* @__PURE__ */ new Map;let v=!1;function y(e){let t=o(e,`element`,`style`);for(let n of m(e)){let e=u(n,String(h(n,`value`)??``));i(t,[e],t.__children.length)}let a=r();if(n(e,`parent`)===a.__node_id){let n=m(a.__node_id),r=a.__children.filter(t=>n.indexOf(t.__node_id)<n.indexOf(e));i(a,[t],r.length)}return t}function b(){if(!v){for(let t of e(s(),`style[${g}]`))_.set(String(h(t,g)),y(t));v=!0}}function x(e,t){let n=e.__children.slice();t&&p(f(t),e);for(let e of n)l(e)}function S(e,n){b();let i=_.get(e);if(i!==void 0){x(i,n);return}let a=d(`style`);t(a.__node_id,g,e),x(a,n),p(a,r()),_.set(e,a)}function C(e){b();let t=_.get(e);if(t===void 0)return;let r=n(t.__node_id,`parent`);r!==null&&c(r,t.__node_id),a(t),_.delete(e)}export{C as removeStyle,S as updateStyle};
package/dist/vue.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as IncaElement } from "./chunks/window-Bdris5XB.js";
2
- import "./chunks/rendererCore-DSk9eNTM.js";
1
+ import { N as IncaElement } from "./chunks/window-DIrasL0K.js";
2
+ import "./chunks/rendererCore-D7-q9n5H.js";
3
3
  import { App, Component, ComponentPublicInstance } from "@vue/runtime-core";
4
4
  /**
5
5
  * `@vue/runtime-core`'s `App`, with `mount` also callable with no argument
package/dist/vue.js CHANGED
@@ -1,2 +1,2 @@
1
- import{n as e}from"./chunks/hooks-B-QJlyLk.js";import{t}from"./chunks/rendererCore-DYJn9DML.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?
1
+ import{a as e}from"./chunks/hooks-BSL3d56y.js";import{t}from"./chunks/rendererCore-CWokQ5X0.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(t)),setText:(t,n)=>e.setText(t,n),setElementText:(t,n)=>e.setElementText(t,n),insert:(t,n,r)=>e.insert(t,n,r),setScopeId:(t,n)=>e.setAttribute(t.__node_id,n,``),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
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.isRemoved(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)?n===`hidden`&&typeof i==`string`&&/^until-found$/i.test(i)?e.setAttribute(t.__node_id,n,i):i||i===``?e.setAttribute(t.__node_id,n,``):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.27",
3
+ "version": "0.0.29",
4
4
  "description": "A GPU-native, Webview-free desktop app framework built on GPUI and QuickJS.",
5
5
  "keywords": [
6
6
  "cross-platform",
@@ -35,8 +35,8 @@
35
35
  "sideEffects": [
36
36
  "src/callbacks.mts",
37
37
  "src/targets.mts",
38
+ "src/element/fragment.mts",
38
39
  "src/interfaces.mts",
39
- "src/timers.mts",
40
40
  "dist/chunks/hooks-*.js"
41
41
  ],
42
42
  "main": "./dist/index.js",
@@ -53,6 +53,10 @@
53
53
  "./vue/runtime": {
54
54
  "types": "./dist/vue-runtime.d.ts",
55
55
  "import": "./dist/vue-runtime.js"
56
+ },
57
+ "./style": {
58
+ "types": "./dist/style.d.ts",
59
+ "import": "./dist/style.js"
56
60
  }
57
61
  },
58
62
  "publishConfig": {
@@ -1,2 +0,0 @@
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.keypress.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 WeakSet;function s(e,t){return o.add(e),Object.defineProperty(e,"__node_id",{value:t})}function c(e){return typeof e==`object`&&!!e&&o.has(e)}const l=/* @__PURE__ */ new Map,u=new FinalizationRegistry(e=>{l.get(e)?.deref()||l.delete(e)});function ee(e){l.set(e.__node_id,new WeakRef(e)),u.register(e,e.__node_id)}function te(e){l.delete(e)}function d(e){return l.get(e)?.deref()}const f=/* @__PURE__ */ new WeakSet;function p(e){return f.has(e)||h.has(e)}function m(e){if(f.add(e),e.kind!==`text`)for(let t of e.__children)m(t)}const h=/* @__PURE__ */ new WeakSet;function g(e){return h.has(e)}function _(e){if(h.add(e),e.kind!==`text`){te(e.__node_id);for(let t of e.__children)_(t)}}function ne(e){for(let t of e){let e=d(t);e&&_(e)}}const re=new FinalizationRegistry(t=>e().releaseNode(t)),v=/* @__PURE__ */ new WeakSet;function ie(e){return v.has(e)}function ae(e){v.add(e),re.register(e,e.__node_id)}const y=/* @__PURE__ */ new Map,b=/* @__PURE__ */ new Map,x=()=>globalThis.__inca_callbacks__??={};function oe(e,t,n,r){x()[n]=r;let i=y.get(e);i||y.set(e,i=/* @__PURE__ */ new Map),i.set(t,n),b.set(n,{group:e,listener:t})}function S(e,t){return y.get(e)?.get(t)}function se(e){delete x()[e];let t=b.get(e);if(t===void 0)return;b.delete(e);let n=y.get(t.group);n?.delete(t.listener),n?.size===0&&y.delete(t.group)}function ce(e){for(let t of e)se(t)}const le=(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{ce([e])}catch(e){r||(n=e),r=!0}if(ne(e),r)throw n},configurable:!0});let C=0;function ue(){return C}function de(e){return(...t)=>{let n=t[0]?.eventId;return typeof n==`number`&&n>C&&(C=n),e(...t)}}function fe(t,n,r,i={}){if(r==null)return;let a=le(t,n,i.capture);if(S(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)=>(w(t,n,r,i),o(...e)):o;oe(a,r,e().addEventListener(t,n,i.capture===!0,i.passive===!0),de(s))}function w(t,n,r,i={}){if(r==null)return;let a=S(le(t,n,i.capture),r);a!==void 0&&(e().removeEventListener(t,n,a),se(a))}function T(t,n){return e().dispatchEvent(t,n)}function E(t){e().click(t)}function D(t,n){e().focusNode(t,n)}function O(t){e().blurNode(t)}function pe(t,n){e().setPointerCapture(t,n)}function me(t,n){e().releasePointerCapture(t,n)}function he(t,n){return e().hasPointerCapture(t,n)}function k(e,t=[]){let n=typeof e==`function`?e:()=>e;return{addEventListener(e,r,i){let a=typeof i==`boolean`?{capture:i}:i??{};fe(n(),e,r,{...a,passive:a.passive??t.includes(e)})},removeEventListener(e,t,r){let i=typeof r==`boolean`?r:r?.capture;w(n(),e,t,{capture:i})},dispatchEvent:e=>T(n(),e)}}function A(){throw TypeError(`document cannot be constructed. use the document export of incajs`)}function ge(){throw TypeError(`a shadow root cannot be constructed. the host has no shadow roots`)}Object.defineProperty(globalThis,"Document",{value:A,writable:!0,configurable:!0,enumerable:!1}),Object.defineProperty(globalThis,"ShadowRoot",{value:ge,writable:!0,configurable:!0,enumerable:!1});function j(){return e().rootNodeId()}function _e(t){return e().createNode(t)}function ve(t,n){e().appendChild(t,n)}function ye(t,n,r){e().insertBefore(t,n,r)}function be(t,n){e().removeChild(t,n)}function xe(t){ce(e().releaseListeners(t))}function Se(t){e().holdNode(t)}function Ce(t){e().releaseNode(t)}function M(t,n,r){e().setAttribute(t,n,r)}function N(t,n){return e().getAttribute(t,n)}function we(t){return e().attributeNames(t)}function Te(t,n){return e().matches(t,n)}function Ee(t,n){return e().closest(t,n)}function De(t,n){return e().querySelector(t,n)}function Oe(t,n){return e().querySelectorAll(t,n)}function P(t){e().checkSelector(t)}function F(t){return e().layoutOf(t)}function I(t){return e().scrollOf(t)}function L(t,n,r){e().scrollNode(t,n,r)}function R(t,n,r){e().scrollIntoViewNode(t,n,r)}function z(t,n){e().removeAttribute(t,n)}function ke(t,n,r){e().setStyle(t,n,r)}function Ae(t,n){e().removeStyle(t,n)}function je(t){return e().inputValue(t)}function Me(t,n){e().setInputValue(t,n)}function B(){return e().focusedNode()}function Ne(){let e=B();return e===null?null:d(e)??null}const V=/* @__PURE__ */ Object.defineProperties(Object.setPrototypeOf(a(k(`$document`,[`wheel`]),()=>!1),A.prototype),{[Symbol.toStringTag]:{value:`Document`},activeElement:{get:Ne}}),H=/* @__PURE__ */ Object.defineProperty(a(k(`$window`,[`wheel`]),()=>!1),Symbol.toStringTag,{value:`Window`}),Pe=/^(?:0|[1-9]\d*)$/,Fe=2**32-1;function U(e){return Pe.test(e)&&Number(e)<Fe}function Ie(e,t){return t===``?null:e.find(e=>e.id===t)??e.find(e=>e.getAttribute(`name`)===t)??null}function Le(e){let t=/* @__PURE__ */ new Set;for(let n of e)t.add(n.id),t.add(n.getAttribute(`name`)??``);return t.delete(``),[...t]}function W(e){let{source:t,named:n}=e,r=e=>{if(e!==l)throw TypeError(`the receiver is not a collection. call it on one`)},i={writable:!0,enumerable:!0,configurable:!0},a=Object.create(Object.prototype,{length:{get(){return r(this),t().length},enumerable:!0,configurable:!0},item:{...i,value:Object.defineProperty(function(...e){if(r(this),e.length<1)throw TypeError(`item() needs 1 argument`);return t()[e[0]>>>0]??null},"length",{value:1})},...e.method&&{[e.method]:{...i,value(...t){if(r(this),t.length<1)throw TypeError(`${e.method}() needs 1 argument`);return e.find(`${t[0]}`)}}},...e.arrayMembers&&{forEach:{...i,value:Array.prototype.forEach},entries:{...i,value:Array.prototype.entries},keys:{...i,value:Array.prototype.keys},values:{...i,value:Array.prototype.values}},[Symbol.iterator]:{...i,enumerable:!1,value:Array.prototype.values},[Symbol.toStringTag]:{value:e.tag,configurable:!0}}),o=Object.create(a),s=e=>Object.hasOwn(o,e),c=e=>U(e)||!s(e)&&!(e in a)&&n(e)!==null,l=new Proxy(o,{get(e,r,i){return typeof r==`symbol`?Reflect.get(o,r,i):U(r)?t()[Number(r)]:r in o?Reflect.get(o,r,i):n(r)??void 0},has(e,r){return typeof r==`symbol`||r in o?r in o:U(r)?Number(r)<t().length:n(r)!==null},set(e,t,n,r){return r===l&&typeof t==`string`&&c(t)?!1:Reflect.set(o,t,n,r)},deleteProperty(e,n){if(typeof n==`string`){if(U(n))return Number(n)>=t().length;if(c(n))return!1}return Reflect.deleteProperty(o,n)},preventExtensions:()=>!1,defineProperty(e,t,n){return typeof t==`string`&&c(t)?!1:Reflect.defineProperty(o,t,n)},ownKeys(){let n=t(),r=Array.from(n,(e,t)=>String(t)),i=e.names(n).filter(e=>!U(e)&&!(e in a)&&!s(e)),c=Reflect.ownKeys(o);return[...r,...c,...i]},getOwnPropertyDescriptor(e,r){if(typeof r==`symbol`||s(r))return Reflect.getOwnPropertyDescriptor(o,r);if(U(r)){let e=t()[Number(r)];return e?{value:e,writable:!1,enumerable:!0,configurable:!0}:void 0}let i=r in a?void 0:n(r);return i?{value:i,writable:!1,enumerable:!1,configurable:!0}:void 0}});return l}function Re(e){let t=t=>Ie(e(),t);return W({tag:`HTMLCollection`,method:`namedItem`,source:e,find:t,named:t,names:Le})}function ze(e,t,n){return W({tag:`NamedNodeMap`,method:`getNamedItem`,source:e,find:t,named:n,names:e=>e.map(e=>e.name)})}function G(e){let t=[...e];return W({tag:`NodeList`,arrayMembers:!0,source:()=>t,find:()=>null,named:()=>null,names:()=>[]})}const Be=/* @__PURE__ */ new Set([`\0`,` `,`
2
- `,`\f`,`\r`,` `,`/`,`=`,`>`]);function Ve(e){if(e.length===0)return!1;for(let t of e)if(Be.has(t))return!1;return!0}function K(e){if(typeof e==`symbol`)throw TypeError(`a symbol cannot become text`);return String(e)}function q(e,t,n){if(e.length<t)throw TypeError(`${n}() needs ${t} argument${t===1?``:`s`}`)}function He(e){return e.replace(/[A-Z]/g,e=>e.toLowerCase())}var J=class e{#e;#t;#n;#r;#i;constructor(e,t,n,r,i){this.#e=e,this.#i=t,this.#t=n,this.#r=r,this.#n=i}static detach(e){e.#r=null,e.#n(e)}#a(){if(this.#r===null)return!1;let t=g(this.#r)?null:N(this.#t,this.#e);return t===null?(e.detach(this),!1):(this.#i=K(t),!0)}get name(){return this.#e}get localName(){return this.#e}get value(){return this.#a(),this.#i}set value(e){let t=K(e);this.#a()&&M(this.#t,this.#e,t),this.#i=t}get namespaceURI(){return null}get prefix(){return null}get specified(){return!0}get ownerElement(){return this.#a(),this.#r}get[Symbol.toStringTag](){return`Attr`}};function Ue(e,t){let n=t=>{let n=N(e,t);return n===null?null:K(n)},r=()=>g(t)?[]:we(e),i=/* @__PURE__ */ new Map,a=e=>{i.get(e.name)===e&&i.delete(e.name)},o=(n,r)=>{let o=i.get(n);return o||(o=new J(n,r,e,t,a),i.set(n,o)),o},s=e=>{let r=g(t)?null:n(e);if(r!==null)return o(e,r);let a=i.get(e);return a&&J.detach(a),null},c=()=>{let e=r(),t=new Set(e);for(let[e,n]of i)t.has(e)||J.detach(n);return e.map(e=>i.get(e)??o(e,n(e)))},l;return{getAttribute:(...e)=>(q(e,1,`getAttribute`),g(t)?null:n(K(e[0]))),setAttribute:(...n)=>{q(n,2,`setAttribute`);let r=K(n[0]),i=K(n[1]);if(!Ve(r))throw new DOMException(`the attribute name is not valid. it is empty or holds whitespace, '/', '=' or '>'`,`InvalidCharacterError`);g(t)||M(e,r,i)},hasAttribute:(...e)=>(q(e,1,`hasAttribute`),!g(t)&&n(K(e[0]))!==null),removeAttribute:(...n)=>{q(n,1,`removeAttribute`);let r=K(n[0]);g(t)||z(e,r)},getAttributeNames:()=>r(),get attributes(){return l??=ze(c,e=>s(He(e)),e=>e===He(e)?s(e):null),l}}}function We(e){return e.kind===`element`}function Y(e){return e.__children.filter(We)}function Ge(e,t){let n=e.parent?.__children??[];for(let r=n.indexOf(e)+t;r>=0&&r<n.length;r+=t){let e=n[r];if(We(e))return e}return null}function Ke(e){let t;return{get children(){return t??=Re(()=>Y(e))},get parentElement(){return e.parent},get firstElementChild(){return Y(e)[0]??null},get lastElementChild(){return Y(e).at(-1)??null},get childElementCount(){return Y(e).length},get previousElementSibling(){return Ge(e,-1)},get nextElementSibling(){return Ge(e,1)}}}function X(e){return p(e)?null:F(e.__node_id)}function Z(e){let t=e.parent;return!X(e)||!t||!X(t)?null:t}function qe(e){let t=X(e);if(!t)return{left:0,top:0};let n=Z(e),r=n?X(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 Je(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 Ye(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 Q(e,t,n){if(p(e))return;let[r,i]=t,[a,o]=typeof r==`object`?[r?.left,r?.top]:[r,i],[s,c]=n?I(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)};L(e.__node_id,l(a,s),l(o,c))}function Xe(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 $(e,t){return q(e,1,t),K(e[0])}function Ze(e,t,n=`div`,r=[]){let i=k(()=>e,r),o=()=>p(u)?null:I(e),l={get id(){return g(u)?``:String(N(e,`id`)??``)},set id(t){g(u)||M(e,`id`,String(t))},kind:t,tagName:n.replace(/[a-z]/g,e=>e.toUpperCase()),parent:null,__children:[],focus:t=>{p(u)||D(e,!!t?.preventScroll)},blur:()=>O(e),click:()=>{p(u)||E(e)},setPointerCapture:t=>pe(e,t),releasePointerCapture:t=>me(e,t),hasPointerCapture:t=>he(e,t),contains:e=>{if(e==null)return!1;if(!c(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===u)return!0;return!1},addEventListener:(...e)=>{p(u)||i.addEventListener(...e)},removeEventListener:(...e)=>{p(u)||i.removeEventListener(...e)},dispatchEvent:e=>g(u)||i.dispatchEvent(e),get tabIndex(){return Ye(g(u)?null:N(e,`tabindex`),n)},set tabIndex(t){g(u)||M(e,`tabindex`,t|0)},getBoundingClientRect:()=>Je(X(u)),get offsetWidth(){return Math.round(X(u)?.[2]??0)},get offsetHeight(){return Math.round(X(u)?.[3]??0)},get offsetLeft(){return qe(u).left},get offsetTop(){return qe(u).top},get offsetParent(){return Z(u)},get clientWidth(){let e=X(u);return e?Math.max(0,Math.round(e[2]-2*e[4])):0},get clientHeight(){let e=X(u);return e?Math.max(0,Math.round(e[3]-2*e[4])):0},get clientLeft(){return Math.round(X(u)?.[4]??0)},get clientTop(){return Math.round(X(u)?.[4]??0)},get scrollLeft(){return o()?.[0]??0},set scrollLeft(e){Q(u,[e],!1)},get scrollTop(){return o()?.[1]??0},set scrollTop(e){Q(u,[void 0,e],!1)},get scrollWidth(){return u.clientWidth+Math.round(o()?.[2]??0)},get scrollHeight(){return u.clientHeight+Math.round(o()?.[3]??0)},scrollTo:(...e)=>Q(u,e,!1),scrollBy:(...e)=>Q(u,e,!0),scrollIntoView:t=>{if(p(u))return;let{block:n,inline:r}=Xe(t);R(e,n,r)},matches:(...t)=>{let n=$(t,`matches`);return g(u)?(P(n),!1):Te(e,n)},closest:(...t)=>{let n=$(t,`closest`);if(g(u))return P(n),null;let r=Ee(e,n);if(r===null)return null;let i=u;for(;i!==null&&i.__node_id!==r;)i=i.parent;return i},querySelector:(...t)=>{let n=$(t,`querySelector`);if(g(u))return P(n),null;let r=De(e,n);return r===null?null:d(r)},querySelectorAll:(...t)=>{let n=$(t,`querySelectorAll`);return g(u)?(P(n),G([])):G(Oe(e,n).map(e=>d(e)))},getRootNode:()=>{let e=u;for(;e.parent!==null;)e=e.parent;return e.__node_id===j()?V:e}};n===`input`&&Object.defineProperty(l,"value",{get:()=>g(u)?``:je(e),set:t=>{g(u)||Me(e,t===null?``:String(t))},enumerable:!0,configurable:!0});let u=a(s(l,e),()=>p(u));return Object.defineProperties(u,Object.getOwnPropertyDescriptors(Ue(e,u))),Object.defineProperties(u,Object.getOwnPropertyDescriptors(Ke(u))),t===`element`&&ee(u),u}function Qe(){let e=j();return d(e)??Ze(e,`element`,void 0,[`wheel`])}Object.defineProperty(globalThis,"__inca_targets__",{value:e=>e.map(e=>e===`$document`?V:e===`$window`?H:d(e)??(e===j()?Qe():null)),configurable:!0});export{w as A,k as C,T as D,E,ae as F,s as I,ie as M,p as N,D as O,m as P,ke as S,O as T,j as _,ve as a,I as b,N as c,F as d,xe as f,Ae as g,be as h,V as i,g as j,ue as k,Se as l,z as m,Qe as n,_e as o,Ce as p,H as r,B as s,Ze as t,ye as u,R as v,fe as w,M as x,L as y};
@@ -1 +0,0 @@
1
- import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{A as t,C as n,D as r,E as i,F as a,I as o,M as s,N as c,O as l,P as u,S as d,T as f,_ as p,a as m,b as h,c as g,d as _,f as v,g as y,h as b,j as x,k as S,l as C,m as w,n as T,o as E,p as D,r as O,s as k,t as A,u as j,v as M,w as N,x as P,y as F}from"./hooks-B-QJlyLk.js";function I(e){let t=E(e);return A(t,`element`,e)}function L(e){let t=E(`#text`);return P(t,`value`,e),o({kind:`text`,parent:null,text:e},t)}function R(){let e=E(`#comment`);return d(e,`display`,`none`),A(e,`comment`)}function z(e,t){P(e.__node_id,`value`,t),e.text=t}function B(e,t){for(let t of e.__children.slice())W(t);if(!t)return;let n=L(t);m(e.__node_id,n.__node_id),n.parent=e,e.__children.push(n)}function V(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 H(e){e.parent&&b(e.parent.__node_id,e.__node_id),V(e)}function U(e,t,n){if(n===e&&e.parent===t)return;H(e);let r=n?t.__children.indexOf(n):-1;j(t.__node_id,e.__node_id,n&&r!==-1?n.__node_id:null),r===-1?t.__children.push(e):t.__children.splice(r,0,e),e.parent=t}function W(e){e.parent&&x(e.parent)?V(e):H(e),v(e.__node_id),u(e),e.kind===`element`&&!x(e)&&!s(e)&&(C(e.__node_id),a(e))}function G(e){return e.parent}function K(e){let t=e.parent;if(!t)return null;let n=t.__children.indexOf(e);return t.__children[n+1]??null}var q=/* @__PURE__ */ e({addEventListener:()=>N,appendChild:()=>m,blur:()=>f,click:()=>i,createCommentNode:()=>R,createElementNode:()=>I,createEventTarget:()=>n,createIncaElement:()=>A,createNode:()=>E,createTextNode:()=>L,dispatchEvent:()=>r,focus:()=>l,focusedNode:()=>k,getAttribute:()=>g,holdNode:()=>C,insert:()=>U,insertBefore:()=>j,isRemoved:()=>c,latestEventId:()=>S,layoutOf:()=>_,nextSibling:()=>K,parentNode:()=>G,releaseNode:()=>D,releaseWhenCollected:()=>a,remove:()=>W,removeAttribute:()=>w,removeChild:()=>b,removeEventListener:()=>t,removeStyle:()=>y,rootElement:()=>T,rootNodeId:()=>p,scrollIntoViewNode:()=>M,scrollNode:()=>F,scrollOf:()=>h,setAttribute:()=>P,setElementText:()=>B,setStyle:()=>d,setText:()=>z,window:()=>O});export{U as a,W as c,L as i,B as l,R as n,K as o,I as r,G as s,q as t,z as u};