incajs 0.0.28 → 0.0.30

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=((...e)=>e)(`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`);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 WeakMap,te=/* @__PURE__ */ new WeakMap;function f(e){return e.kind===`element`?ee.get(e):void 0}function ne(e,t){ee.set(e,t),te.set(t,e)}const re=/* @__PURE__ */ new WeakSet;function p(e){return re.has(e)||h.has(e)}function m(e){if(re.add(e),e.kind===`text`)return;for(let t of e.__children)m(t);let t=f(e);t&&m(t)}const h=/* @__PURE__ */ new WeakSet;function g(e){return h.has(e)}function _(e){if(h.has(e)||(h.add(e),l(e.__node_id),e.kind===`text`))return;for(let t of e.__children)_(t);let t=f(e);t&&_(t);let n=e.kind===`fragment`?te.get(e):void 0;n&&_(n)}function ie(e){for(let t of e){let e=u(t);e&&_(e)}}const ae=new FinalizationRegistry(e=>n().releaseNode(e)),oe=/* @__PURE__ */ new WeakSet;function se(e){return oe.has(e)}function v(e){oe.add(e),ae.register(e,e.__node_id)}const y=/* @__PURE__ */ new Map,b=/* @__PURE__ */ new Map;function ce(e,t,n){let r=y.get(e);r||y.set(e,r=/* @__PURE__ */ new Map),r.set(t,n),b.set(n,{group:e,listener:t})}function le(e,t){return y.get(e)?.get(t)}function ue(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 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),ie(e)},configurable:!0});let x=0;function pe(){return x}function me(e){return(...t)=>{let n=t[0]?.eventId;return typeof n==`number`&&n>x&&(x=n),e(...t)}}function he(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)=>(S(e,t,r,i),o(...n)):o;ce(a,r,n().addEventListener(e,t,me(s),i.capture===!0,i.passive===!0))}function S(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 ge(e,t){return n().dispatchEvent(e,t)}function _e(e){n().click(e)}function ve(e,t){n().focusNode(e,t)}function ye(e){n().blurNode(e)}function be(e,t){n().setPointerCapture(e,t)}function xe(e,t){n().releasePointerCapture(e,t)}function Se(e,t){return n().hasPointerCapture(e,t)}function C(e,t=[]){let n=typeof e==`function`?e:()=>e;return{addEventListener(e,r,i){let a=typeof i==`boolean`?{capture:i}:i??{};he(n(),e,r,{...a,passive:a.passive??t.includes(e)})},removeEventListener(e,t,r){let i=typeof r==`boolean`?r:r?.capture;S(n(),e,t,{capture:i})},dispatchEvent:e=>ge(n(),e)}}function Ce(){throw TypeError(`document cannot be constructed. use the document export of incajs`)}function we(){throw TypeError(`a shadow root cannot be constructed. the host has no shadow roots`)}Object.defineProperty(globalThis,"Document",{value:Ce,writable:!0,configurable:!0,enumerable:!1}),Object.defineProperty(globalThis,"ShadowRoot",{value:we,writable:!0,configurable:!0,enumerable:!1});function w(){return n().rootNodeId()}function T(e){return n().createNode(e)}function E(e,t){return n().appendChild(e,t)}function D(e,t,r){return n().insertBefore(e,t,r)}function O(e,t){n().removeChild(e,t)}function Te(e,t,r){return n().replaceChild(e,t,r)}function Ee(e,t){return n().cloneNode(e,t)}function De(e){return n().innerHtml(e)}function Oe(e){return n().outerHtml(e)}function ke(e,t){return n().setInnerHtml(e,t)}function Ae(e,t){return n().setOuterHtml(e,t)}function je(e,t,r){return n().insertAdjacentHtml(e,t,r)}function Me(e){return n().rootOf(e)}function Ne(e,t){return n().compareNodePosition(e,t)}function Pe(e,t){return n().isEqualNode(e,t)}function Fe(e){de(n().releaseListeners(e))}function k(e){n().holdNode(e)}function Ie(e){n().releaseNode(e)}function A(e,t,r){n().setAttribute(e,t,r)}function j(e,t){return n().getAttribute(e,t)}function Le(e){return n().attributeNames(e)}function Re(e,t){return n().linkedNode(e,t)}function ze(e){return n().childNodeIds(e)}function Be(e){return n().isConnected(e)}function Ve(e){return n().textContent(e)}function He(e){return n().wholeText(e)}function Ue(e,t,r){return n().substringData(e,t,r)}function We(e,t,r,i){n().replaceData(e,t,r,i)}function Ge(e,t){return n().splitText(e,t)}function Ke(e,t){return n().matches(e,t)}function qe(e,t){return n().closest(e,t)}function Je(e,t){return n().querySelector(e,t)}function Ye(e,t){return n().querySelectorAll(e,t)}function M(e){n().checkSelector(e)}function Xe(e){return n().layoutOf(e)}function N(e){return n().scrollOf(e)}function Ze(e,t,r){n().scrollNode(e,t,r)}function Qe(e,t,r){n().scrollIntoViewNode(e,t,r)}function $e(e,t){n().removeAttribute(e,t)}function et(e,t,r){n().setStyle(e,t,r)}function tt(e,t){n().removeStyle(e,t)}function nt(e){return n().inputValue(e)}function rt(e,t){n().setInputValue(e,t)}function it(){return n().focusedNode()}function at(){let e=it();return e===null?null:d(e)??null}const P=/* @__PURE__ */ Object.defineProperties(Object.setPrototypeOf(t(C(`$document`,[`wheel`]),()=>!1),Ce.prototype),{[Symbol.toStringTag]:{value:`Document`},activeElement:{get:at}}),ot=/^(?:0|[1-9]\d*)$/,st=2**32-1;function F(e){return ot.test(e)&&Number(e)<st}function ct(e,t){return t===``?null:e.find(e=>e.id===t)??e.find(e=>e.getAttribute(`name`)===t)??null}function lt(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 I(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=>F(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):F(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:F(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(F(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=>!F(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(F(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 ut(e){let t=t=>ct(e(),t);return I({tag:`HTMLCollection`,method:`namedItem`,source:e,find:t,named:t,names:lt})}function dt(e,t,n){return I({tag:`NamedNodeMap`,method:`getNamedItem`,source:e,find:t,named:n,names:e=>e.map(e=>e.name)})}function L(e){return I({tag:`NodeList`,arrayMembers:!0,source:e,find:()=>null,named:()=>null,names:()=>[]})}const ft=/* @__PURE__ */ new Set([`\0`,` `,`
2
+ `,`\f`,`\r`,` `,`/`,`=`,`>`]);function pt(e){if(e.length===0)return!1;for(let t of e)if(ft.has(t))return!1;return!0}function R(e){if(typeof e==`symbol`)throw TypeError(`a symbol cannot become text`);return String(e)}function z(e,t,n){if(e.length<t)throw TypeError(`${n}() needs ${t} argument${t===1?``:`s`}`)}function mt(e){return e.replace(/[A-Z]/g,e=>e.toLowerCase())}var B=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:j(this.#t,this.#e);return t===null?(e.detach(this),!1):(this.#i=R(t),!0)}get name(){return this.#e}get localName(){return this.#e}get value(){return this.#a(),this.#i}set value(e){let t=R(e);this.#a()&&A(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 ht(e,t){let n=t=>{let n=j(e,t);return n===null?null:R(n)},r=()=>g(t)?[]:Le(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 B(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&&B.detach(a),null},c=()=>{let e=r(),t=new Set(e);for(let[e,n]of i)t.has(e)||B.detach(n);return e.map(e=>i.get(e)??o(e,n(e)))},l;return{getAttribute:(...e)=>(z(e,1,`getAttribute`),g(t)?null:n(R(e[0]))),setAttribute:(...n)=>{z(n,2,`setAttribute`);let r=R(n[0]),i=R(n[1]);if(!pt(r))throw new DOMException(`the attribute name is not valid. it is empty or holds whitespace, '/', '=' or '>'`,`InvalidCharacterError`);g(t)||A(e,r,i)},hasAttribute:(...e)=>(z(e,1,`hasAttribute`),!g(t)&&n(R(e[0]))!==null),removeAttribute:(...n)=>{z(n,1,`removeAttribute`);let r=R(n[0]);g(t)||$e(e,r)},getAttributeNames:()=>r(),get attributes(){return l??=dt(c,e=>s(mt(e)),e=>e===mt(e)?s(e):null),l}}}function gt(e){return e.kind===`element`}function V(e){return e.__children.filter(gt)}function _t(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(gt(e))return e}return null}function vt(e){let t;return{get children(){return t??=ut(()=>V(e))},get parentElement(){return e.parent?.kind===`element`?e.parent:null},get firstElementChild(){return V(e)[0]??null},get lastElementChild(){return V(e).at(-1)??null},get childElementCount(){return V(e).length},get previousElementSibling(){return _t(e,-1)},get nextElementSibling(){return _t(e,1)}}}function H(e){return p(e)?null:Xe(e.__node_id)}function yt(e){let t=e.parent;return!H(e)||t?.kind!==`element`||!H(t)?null:t}function bt(e){let t=H(e);if(!t)return{left:0,top:0};let n=yt(e),r=n?H(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 xt(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 St(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 U(e){g(e)||se(e)||(k(e.__node_id),v(e))}function W(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 G(e,t,n){e.__children.splice(n,0,...t);for(let n of t)n.parent=e}function Ct(e){e.parent&&O(e.parent.__node_id,e.__node_id),W(e)}function wt(e,t,n){if(n===e&&e.parent===t)return;Ct(e);let r=n?t.__children.indexOf(n):-1;D(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 Tt(e){e.parent&&g(e.parent)?W(e):Ct(e),Fe(e.__node_id),m(e),U(e)}function Et(e){return e.parent?.kind===`element`?e.parent:null}function Dt(e){let t=e.parent;if(!t)return null;let n=t.__children.indexOf(e);return t.__children[n+1]??null}function Ot(e){return e===null?``:R(e)}function kt(e,t){let n=/* @__PURE__ */ new Map,r=[];for(let[i,a,o,s]of e[1]){let e=n.get(o);if(a===`#fragment`){n.set(i,f(e));continue}let c=a===`#text`?t.text(i,s??``):a===`#comment`?t.element(i,`comment`):t.element(i,`element`,a);n.set(i,c),e?G(e,[c],e.__children.length):r.push(c)}return r}function At(e,t){let n=e.__node_id,r=(e,n)=>G(n,kt(e,t),e[0]);return{get innerHTML(){return g(e)?``:De(n)},set innerHTML(t){let i=Ot(t);if(g(e))return;let a=f(e)??e,o=ke(n,i);for(let e of a.__children.slice())W(e),U(e);r(o,a)},get outerHTML(){return g(e)?``:Oe(n)},set outerHTML(t){let i=Ot(t);if(g(e))return;let a=Ae(n,i),o=e.parent;a!==null&&(W(e),U(e),r(a,o))},insertAdjacentHTML:(...t)=>{z(t,2,`insertAdjacentHTML`);let i=R(t[0]),a=R(t[1]);if(g(e))return;let o=je(n,i,a),s=/^(beforebegin|afterend)$/i.test(i);r(o,s?e.parent:e)}}}function K(e){return e.toLowerCase()===`template`}function jt(e,t){ne(e,t(n().templateContent(e.__node_id))),n().holdNode(e.__node_id),v(e)}function Mt(){return new DOMException(`the node was freed. pass a child of the node you call it on`,`NotFoundError`)}function q(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 Nt(e){return e.kind===`fragment`?e.__children.slice():[e]}function Pt(e,t,n){let r=Ee(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(e.kind===`element`&&K(e.tagName)){i++;let n=f(c);if(t)for(let t of f(e).__children)G(n,[a(t)],n.__children.length)}if(!t)return c;for(let t of e.__children)G(c,[a(t)],c.__children.length);return c},o=a(e);return U(o),o}function Ft(e,t){let n=e.__node_id,r=e,i=(e,t)=>{let n=Nt(e),i=t();for(let e of n)W(e);G(r,n,i)};return{appendChild:(...e)=>{z(e,1,`appendChild`);let t=q(e[0],1);return i(t,()=>E(n,t.__node_id)),t},insertBefore:(...e)=>{z(e,2,`insertBefore`);let t=q(e[0],1),r=e[1]===null||e[1]===void 0?null:q(e[1],2);if(r&&g(r))throw Mt();return i(t,()=>D(n,t.__node_id,r?.__node_id??null)),t},removeChild:(...e)=>{z(e,1,`removeChild`);let t=q(e[0],1);if(g(t))throw Mt();return O(n,t.__node_id),W(t),U(t),t},replaceChild:(...e)=>{z(e,2,`replaceChild`);let t=q(e[0],1),i=q(e[1],2);if(g(i))throw Mt();let a=Nt(t),o=Te(n,t.__node_id,i.__node_id);for(let e of a)W(e);return W(i),i!==t&&U(i),G(r,a,o),i},cloneNode:n=>Pt(e,!!n,t)}}function It(e){let t=e.__node_id,n=e=>e==null?null:q(e,1);return{contains:r=>{let i=n(r);return i===null?!1:i===e?!0:g(e)||g(i)?!1:!!(Ne(t,i.__node_id)&16)},getRootNode:()=>{if(g(e))return e;let n=Me(t);return n===w()?P:u(n)},compareDocumentPosition:(...n)=>{z(n,1,`compareDocumentPosition`);let r=q(n[0],1);return r===e?0:g(e)||g(r)?33|(r.__node_id<t?2:4):Ne(t,r.__node_id)},isSameNode:t=>n(t)===e,isEqualNode:r=>{let i=n(r);return i===null?!1:g(e)||g(i)?i===e:Pe(t,i.__node_id)}}}const Lt={element:1,text:3,comment:8,fragment:11};function J(e){return g(e)?e.kind===`text`?e.text:``:String(j(e.__node_id,`value`)??``)}function Rt(e,t){e.kind===`element`||e.kind===`fragment`||g(e)||(A(e.__node_id,`value`,t),e.kind===`text`&&(e.text=t))}function zt(e){let t=e.__node_id,n=n=>{if(g(e))return null;let r=Re(t,n);return r===null?null:u(r)??null},r,i=()=>g(e)?[]:ze(t).flatMap(e=>u(e)??[]);return{get nodeType(){return Lt[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:J(e)},set nodeValue(t){Rt(e,String(t??``))},get isConnected(){return!g(e)&&Be(t)},get ownerDocument(){return P},get parentNode(){let e=n(`parent`);return e===null?t===w()?P: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??=L(i)},hasChildNodes:()=>i().length>0}}function Y(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?N(e.__node_id)??[0,0]:[0,0],l=(e,t)=>{if(e===void 0)return null;let r=Number(e);return(n?t:0)+(Number.isFinite(r)?r:0)};Ze(e.__node_id,l(a,s),l(o,c))}function Bt(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 Vt(e){return e==null?``:R(e)}function Ht(e){let t=e.__node_id,n=(n,r,i)=>{g(e)||(We(t,n,r,i),e.kind===`text`&&(e.text=J(e)))};return{get data(){return J(e)},set data(t){Rt(e,t===null?``:R(t))},get length(){return J(e).length},get textContent(){return J(e)},set textContent(t){Rt(e,Vt(t))},substringData:(...n)=>{if(z(n,2,`substringData`),!g(e))return Ue(t,n[0],n[1]);let r=n[0]>>>0;return J(e).slice(r,r+(n[1]>>>0))},appendData:(...t)=>{z(t,1,`appendData`),n(J(e).length,0,R(t[0]))},insertData:(...e)=>{z(e,2,`insertData`),n(e[0],0,R(e[1]))},deleteData:(...e)=>{z(e,2,`deleteData`),n(e[0],e[1],``)},replaceData:(...e)=>{z(e,3,`replaceData`),n(e[0],e[1],R(e[2]))}}}function Ut(e){let t=e.__node_id;return{get wholeText(){return g(e)?e.text:He(t)},splitText:(...n)=>{if(z(n,1,`splitText`),g(e))throw TypeError(`the text node was freed. create a new one`);let r=Ge(t,n[0]),i=X(r,String(j(r,`value`)??``));e.text=J(e);let a=e.parent;return a===null?(k(i.__node_id),v(i)):(a.__children.splice(a.__children.indexOf(e)+1,0,i),i.parent=a),i}}}function Wt(e){let t=T(`#text`);return A(t,`value`,e),X(t,e)}function Gt(e,t){A(e.__node_id,`value`,t),e.text=t}function Kt(e,t){for(let t of e.__children.slice())O(e.__node_id,t.__node_id),W(t),U(t);if(!t)return;let n=Wt(t);E(e.__node_id,n.__node_id),n.parent=e,e.__children.push(n)}function X(e,t){let n=i({kind:`text`,parent:null,text:t},e);for(let e of[zt(n),Ft(n,{text:X}),It(n),Ht(n),Ut(n)])Object.defineProperties(n,Object.getOwnPropertyDescriptors(e));return c(n),n}function Z(e,t){return z(e,1,t),R(e[0])}const qt={element:Q,text:X,fragment:$};function Q(e,n,r=`div`,a=[]){let o=C(()=>e,a),s=()=>p(u)?null:N(e),l={get id(){return g(u)?``:String(j(e,`id`)??``)},set id(t){g(u)||A(e,`id`,String(t))},kind:n,tagName:r.replace(/[a-z]/g,e=>e.toUpperCase()),parent:null,__children:[],focus:t=>{p(u)||ve(e,!!t?.preventScroll)},blur:()=>ye(e),click:()=>{p(u)||_e(e)},setPointerCapture:t=>be(e,t),releasePointerCapture:t=>xe(e,t),hasPointerCapture:t=>Se(e,t),addEventListener:(...e)=>{p(u)||o.addEventListener(...e)},removeEventListener:(...e)=>{p(u)||o.removeEventListener(...e)},dispatchEvent:e=>g(u)||o.dispatchEvent(e),get tabIndex(){return St(g(u)?null:j(e,`tabindex`),r)},set tabIndex(t){g(u)||A(e,`tabindex`,t|0)},getBoundingClientRect:()=>xt(H(u)),get offsetWidth(){return Math.round(H(u)?.[2]??0)},get offsetHeight(){return Math.round(H(u)?.[3]??0)},get offsetLeft(){return bt(u).left},get offsetTop(){return bt(u).top},get offsetParent(){return yt(u)},get clientWidth(){let e=H(u);return e?Math.max(0,Math.round(e[2]-2*e[4])):0},get clientHeight(){let e=H(u);return e?Math.max(0,Math.round(e[3]-2*e[4])):0},get clientLeft(){return Math.round(H(u)?.[4]??0)},get clientTop(){return Math.round(H(u)?.[4]??0)},get scrollLeft(){return s()?.[0]??0},set scrollLeft(e){Y(u,[e],!1)},get scrollTop(){return s()?.[1]??0},set scrollTop(e){Y(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)=>Y(u,e,!1),scrollBy:(...e)=>Y(u,e,!0),scrollIntoView:t=>{if(p(u))return;let{block:n,inline:r}=Bt(t);Qe(e,n,r)},matches:(...t)=>{let n=Z(t,`matches`);return g(u)?(M(n),!1):Ke(e,n)},closest:(...t)=>{let n=Z(t,`closest`);if(g(u))return M(n),null;let r=qe(e,n);return r===null?null:d(r)},querySelector:(...t)=>{let n=Z(t,`querySelector`);if(g(u))return M(n),null;let r=Je(e,n);return r===null?null:d(r)},querySelectorAll:(...t)=>{let n=Z(t,`querySelectorAll`);if(g(u))return M(n),L(()=>[]);let r=Ye(e,n).map(e=>d(e));return L(()=>r)}};K(r)&&Object.defineProperty(l,"content",{get:()=>f(u),enumerable:!0,configurable:!0}),r===`input`&&Object.defineProperty(l,"value",{get:()=>g(u)?``:nt(e),set:t=>{g(u)||rt(e,t===null?``:String(t))},enumerable:!0,configurable:!0});let u=t(i(l,e),()=>p(u));return Object.defineProperties(u,Object.getOwnPropertyDescriptors(ht(e,u))),Object.defineProperties(u,Object.getOwnPropertyDescriptors(vt(u))),Object.defineProperties(u,Object.getOwnPropertyDescriptors(zt(u))),Object.defineProperties(u,Object.getOwnPropertyDescriptors(Ft(u,qt))),Object.defineProperties(u,Object.getOwnPropertyDescriptors(It(u))),Object.defineProperties(u,Object.getOwnPropertyDescriptors(n===`comment`?Ht(u):Jt(u))),n!==`comment`&&Object.defineProperties(u,Object.getOwnPropertyDescriptors(At(u,qt))),c(u),K(r)&&jt(u,$),u}function Jt(e){return{get textContent(){return g(e)?``:Ve(e.__node_id)},set textContent(t){g(e)||Kt(e,Vt(t))}}}function Yt(e){return Q(T(e),`element`,e)}function Xt(e=``){let t=T(`#comment`);return et(t,`display`,`none`),A(t,`value`,e),Q(t,`comment`)}function Zt(){let e=w();return d(e)??Q(e,`element`,void 0,[`wheel`])}function $(e){let t=i({kind:`fragment`,parent:null,__children:[]},e),n={get textContent(){return g(t)?``:Ve(e)},set textContent(e){g(t)||Kt(t,Vt(e))}};for(let e of[zt(t),Ft(t,qt),It(t),n])Object.defineProperties(t,Object.getOwnPropertyDescriptors(e));return c(t),t}function Qt(){let e=$(T(`#fragment`));return k(e.__node_id),v(e),e}Object.defineProperty(P,"createDocumentFragment",{value:Qt,configurable:!0,writable:!0});const $t=/* @__PURE__ */ Object.defineProperty(t(C(`$window`,[`wheel`]),()=>!1),Symbol.toStringTag,{value:`Window`});Object.defineProperty(globalThis,"__inca_targets__",{value:e=>e.map(e=>e===`$document`?P:e===`$window`?$t:d(e)??(e===w()?Zt():null)),configurable:!0});export{tt as A,_e as B,D as C,Ie as D,Ye as E,A as F,p as G,ve as H,et as I,v as K,C as L,Qe as M,Ze as N,$e as O,N as P,he as R,k as S,Re as T,pe as U,ge as V,S as W,E as _,Zt as a,it as b,Kt as c,G as d,Dt as f,P as g,W as h,Q as i,w as j,O as k,Gt as l,Tt as m,Xt as n,X as o,Et as p,Yt as r,Wt as s,$t as t,wt as u,ze as v,Xe as w,j as x,T as y,ye 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-DBW76Ks_.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,6 +1,13 @@
1
- import { A as EventHandler, B as TextContentMember, C as Overflow, D as TagName, E as StyleProps, F as IncaNode, I as IncaText, L as NamedNodeMap, M as HTMLCollectionOf, N as IncaElement, O as Attr, P as IncaInputElement, R as NodeListOf, S as NodeId, T as ScrollAlignment, V as TextMembers, _ 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 NodeMembers } from "./window-BhkZc6km.js";
1
+ import { A as EventHandler, B as IncaText, C as Overflow, D as TagName, E as StyleProps, F as IncaFragment, G as TextMembers, H as NodeListOf, I as IncaInputElement, L as IncaNode, M as HTMLCollectionOf, N as HtmlMembers, O as Attr, P as IncaElement, R as IncaParent, S as NodeId, T as ScrollAlignment, U as NodeMembers, V as NamedNodeMap, W as TextContentMember, _ 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 IncaTemplateElement } from "./window-BhilMnbc.js";
2
2
  /** How {@link IncaNative.linkedNode} names the node to reach from a node. */
3
3
  type NodeLink = "parent" | "first" | "last" | "previous" | "next";
4
+ /** One node of a parsed fragment: id, tag, parent id and the text of a text node or a comment. */
5
+ type ParsedEntry = [id: NodeId, tag: string, parentId: NodeId, data: string | null];
6
+ /**
7
+ * What a parse writes into the tree: the position of the first inserted node among the children of
8
+ * its container, and the nodes in pre-order. An entry whose parent is no entry is a root.
9
+ */
10
+ type Parsed = [position: number, entries: ParsedEntry[]];
4
11
  /** What a listener or a dispatch names: a node id, or the tag of `document` or `window`. */
5
12
  type EventTargetId = NodeId | "$document" | "$window";
6
13
  /**
@@ -10,9 +17,20 @@ type EventTargetId = NodeId | "$document" | "$window";
10
17
  interface IncaNative {
11
18
  rootNodeId(): NodeId;
12
19
  createNode(tag: string): NodeId;
13
- appendChild(parentId: NodeId, childId: NodeId): void;
14
- insertBefore(parentId: NodeId, childId: NodeId, anchorId: NodeId | null): void;
20
+ appendChild(parentId: NodeId, nodeId: NodeId): number;
21
+ insertBefore(parentId: NodeId, nodeId: NodeId, refId: NodeId | null): number;
15
22
  removeChild(parentId: NodeId, childId: NodeId): void;
23
+ replaceChild(parentId: NodeId, nodeId: NodeId, childId: NodeId): number;
24
+ cloneNode(nodeId: NodeId, deep: boolean): [NodeId, string][];
25
+ templateContent(nodeId: NodeId): NodeId | null;
26
+ innerHtml(nodeId: NodeId): string;
27
+ outerHtml(nodeId: NodeId): string;
28
+ setInnerHtml(nodeId: NodeId, html: string): Parsed;
29
+ setOuterHtml(nodeId: NodeId, html: string): Parsed | null;
30
+ insertAdjacentHtml(nodeId: NodeId, position: string, html: string): Parsed;
31
+ rootOf(nodeId: NodeId): NodeId;
32
+ compareNodePosition(nodeId: NodeId, otherId: NodeId): number;
33
+ isEqualNode(nodeId: NodeId, otherId: NodeId): boolean;
16
34
  setAttribute(nodeId: NodeId, key: string, value: AttributeValue): void;
17
35
  getAttribute(nodeId: NodeId, key: string): AttributeValue | null;
18
36
  removeAttribute(nodeId: NodeId, key: string): void;
@@ -160,28 +178,35 @@ declare function rootNodeId(): NodeId;
160
178
  */
161
179
  declare function createNode(tag: TagName): NodeId;
162
180
  /**
163
- * Attaches `childId` as the last child of `parentId`. A thin wrapper over
181
+ * Attaches `nodeId` as the last child of `parentId`. A thin wrapper over
164
182
  * {@link insertBefore} with no anchor.
165
183
  * @param parentId - the container to attach to
166
- * @param childId - the node being attached
184
+ * @param nodeId - the node being attached, or a fragment whose children are attached
185
+ * @returns the position of the first attached node among the children of `parentId`
186
+ * @throws {DOMException} `HierarchyRequestError` as {@link insertBefore} does
167
187
  */
168
- declare function appendChild(parentId: NodeId, childId: NodeId): void;
188
+ declare function appendChild(parentId: NodeId, nodeId: NodeId): number;
169
189
  /**
170
- * Attaches `childId` as a child of `parentId`, positioned before `anchorId`
171
- * (or at the end, if `anchorId` is `null`). If `anchorId` names a real node
172
- * that just isn't currently a child of `parentId`, this falls back to
173
- * appending at the end. Only a wholly unknown `anchorId` raises.
190
+ * Attaches `nodeId` as a child of `parentId`, positioned before `refId`
191
+ * (or at the end, if `refId` is `null`). A fragment attaches its children in order.
174
192
  * @param parentId - the container to attach to
175
- * @param childId - the node being attached
176
- * @param anchorId - the sibling to insert before, or `null` to append at the end
193
+ * @param nodeId - the node being attached, or a fragment whose children are attached
194
+ * @param refId - the sibling to insert before, or `null` to append at the end
195
+ * @returns the position of the first attached node among the children of `parentId`
196
+ * @throws {DOMException} `HierarchyRequestError` when `parentId` is a text node or a comment,
197
+ * `nodeId` is `parentId` or an ancestor of it, or `nodeId` is the root container;
198
+ * `NotFoundError` when `refId` is not a child of `parentId`
199
+ * @throws {TypeError} when an id names no node
177
200
  */
178
- declare function insertBefore(parentId: NodeId, childId: NodeId, anchorId: NodeId | null): void;
201
+ declare function insertBefore(parentId: NodeId, nodeId: NodeId, refId: NodeId | null): number;
179
202
  /**
180
- * Detaches `childId` from `parentId`. The detached node keeps its own children
203
+ * Detaches `childId` from `parentId`. The detached node keeps its own children and its listeners,
181
204
  * and is freed at the start of the next frame unless it is inserted or held
182
- * with {@link holdNode} by then.
205
+ * with {@link holdNode} by then. An unknown `childId` does nothing.
183
206
  * @param parentId - the current container
184
207
  * @param childId - the node being detached
208
+ * @throws {DOMException} `NotFoundError` when `childId` is a node that is not a child of `parentId`
209
+ * @throws {TypeError} when `parentId` names no node
185
210
  */
186
211
  declare function removeChild(parentId: NodeId, childId: NodeId): void;
187
212
  /**
@@ -293,8 +318,8 @@ declare function focusedNode(): NodeId | null;
293
318
  /**
294
319
  * Builds the {@link IncaElement} handle for a native node: parentless,
295
320
  * childless, with `id`, `focus()`, `blur()`, `click()`, the pointer capture
296
- * methods, `contains()`, the listener methods of an event target, `tabIndex`,
297
- * the `value` of an `input`, `getRootNode()`, the layout members, the node members and the event
321
+ * methods, the listener methods of an event target, `tabIndex`,
322
+ * the `value` of an `input`, the layout members, the node members and the event
298
323
  * handler properties, all driven through the host.
299
324
  * @param id - the native node's id
300
325
  * @param kind - whether the node is an element or a comment stand-in
@@ -332,25 +357,6 @@ declare function rootElement(): IncaElement;
332
357
  * @returns `true` after {@link markRemoved} or {@link markDestroyed} reached `node`
333
358
  */
334
359
  declare function isRemoved(node: IncaNode): boolean;
335
- /**
336
- * Creates a text leaf.
337
- * @param text - the initial text content
338
- * @returns the new text leaf
339
- */
340
- declare function createTextNode(text: string): IncaText;
341
- /**
342
- * Updates a text leaf's content in place.
343
- * @param node - the text leaf to update
344
- * @param text - the new text content
345
- */
346
- declare function setText(node: IncaText, text: string): void;
347
- /**
348
- * Replaces all of `el`'s children with at most a single text child holding
349
- * `text`. An empty string leaves `el` childless.
350
- * @param el - the container whose children are replaced
351
- * @param text - the new text content
352
- */
353
- declare function setElementText(el: IncaElement, text: string): void;
354
360
  /**
355
361
  * Attaches `child` to `parent`, before `anchor` or at the end when `anchor` is
356
362
  * omitted or `null`. If `anchor` is `child` itself and `child` is already in
@@ -373,7 +379,7 @@ declare function remove(child: IncaNode): void;
373
379
  /**
374
380
  * Looks up the current parent.
375
381
  * @param node - the node to query
376
- * @returns the current parent, or `null` if it isn't attached
382
+ * @returns the current parent, or `null` if it isn't attached or sits in a fragment
377
383
  */
378
384
  declare function parentNode(node: IncaNode): IncaElement | null;
379
385
  /**
@@ -382,12 +388,31 @@ declare function parentNode(node: IncaNode): IncaElement | null;
382
388
  * @returns the sibling immediately after `node` in its parent's children, or `null` if there is none (or `node` isn't attached)
383
389
  */
384
390
  declare function nextSibling(node: IncaNode): IncaNode | null;
391
+ /**
392
+ * Creates a text leaf.
393
+ * @param text - the initial text content
394
+ * @returns the new text leaf
395
+ */
396
+ declare function createTextNode(text: string): IncaText;
397
+ /**
398
+ * Updates a text leaf's content in place.
399
+ * @param node - the text leaf to update
400
+ * @param text - the new text content
401
+ */
402
+ declare function setText(node: IncaText, text: string): void;
403
+ /**
404
+ * Replaces all of `el`'s children with at most a single text child holding
405
+ * `text`. The old children keep their listeners. An empty string leaves `el` childless.
406
+ * @param el - the element or fragment whose children are replaced
407
+ * @param text - the new text content
408
+ */
409
+ declare function setElementText(el: IncaParent, text: string): void;
385
410
  declare namespace rendererCore_d_exports {
386
- export { Attr, AttributeValue, CallbackId, CharacterDataMembers, 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, 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 };
411
+ export { Attr, AttributeValue, CallbackId, CharacterDataMembers, EventHandler, EventHandlers, EventLike, EventListener, EventListenerObject, EventListenerOrObject, HTMLCollectionOf, HtmlMembers, IncaCompositionEvent, IncaCore, IncaDocument, IncaElement, IncaEvent, IncaEventMap, IncaEventTarget, IncaFocusEvent, IncaFragment, IncaInputElement, IncaInputEvent, IncaKeyboardEvent, IncaMouseEvent, IncaNode, IncaParent, IncaPointerEvent, IncaTemplateElement, 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 };
387
412
  }
388
413
  /**
389
414
  * What a custom renderer (`incajs/vue`) drives the host through: the tree and
390
415
  * event calls, the element handles and the shadow tree.
391
416
  */
392
417
  type IncaCore = typeof rendererCore_d_exports;
393
- 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 _, parentNode as a, layoutOf as b, setText as c, createElementNode as d, createIncaElement as f, focusedNode as g, createNode as h, nextSibling as i, addEventListener as j, setAttribute as k, isRemoved as l, appendChild as m, createTextNode as n, remove as o, rootElement as p, insert as r, setElementText as s, IncaCore as t, createCommentNode as u, holdNode as v, removeStyle as w, releaseNode as x, insertBefore as y };
418
+ 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 };
@@ -1,15 +1,3 @@
1
- declare global {
2
- function setTimeout<A extends unknown[]>(handler: (...args: A) => void, delay?: number, ...args: A): number;
3
- function setInterval<A extends unknown[]>(handler: (...args: A) => void, delay?: number, ...args: A): number;
4
- function clearTimeout(id?: number): void;
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;
12
- }
13
1
  /** The events whose handler property every element has. */
14
2
  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"];
15
3
  /** The plain values of a {@link RectLike}, as `toJSON` returns them. */
@@ -127,7 +115,7 @@ interface Attr {
127
115
  /** The element that holds the attribute, or `null` once the attribute is removed. */
128
116
  readonly ownerElement: IncaElement | null;
129
117
  }
130
- /** A live, read-only list of the attributes of an element in alphabetical order of the name. */
118
+ /** A live, read-only list of the attributes of an element in the order they were set. */
131
119
  interface NamedNodeMap {
132
120
  readonly [index: number]: Attr;
133
121
  /** The number of attributes. */
@@ -150,17 +138,20 @@ interface NamedNodeMap {
150
138
  }
151
139
  /** The members every node has: what it is, its data and its place in the tree. */
152
140
  interface NodeMembers {
153
- /** `1` for an element, `3` for a text node and `8` for a comment stand-in. */
154
- readonly nodeType: 1 | 3 | 8;
155
141
  /**
156
- * The {@link IncaElement.tagName} of an element, `"#text"` for a text node and `"#comment"` for a
157
- * comment stand-in.
142
+ * `1` for an element, `3` for a text node, `8` for a comment stand-in and `11` for a
143
+ * fragment.
144
+ */
145
+ readonly nodeType: 1 | 3 | 8 | 11;
146
+ /**
147
+ * The {@link IncaElement.tagName} of an element, `"#text"` for a text node, `"#comment"` for a
148
+ * comment stand-in and `"#document-fragment"` for a fragment.
158
149
  */
159
150
  readonly nodeName: string;
160
151
  /**
161
- * The data of a text node or a comment stand-in, and `null` for an element. Assigning `null` or
162
- * `undefined` stores `""` and any other value stores its string. Assigning to an element or to a
163
- * freed node does nothing.
152
+ * The data of a text node or a comment stand-in, and `null` for an element or a
153
+ * fragment. Assigning `null` or `undefined` stores `""` and any other value stores its string.
154
+ * Assigning to an element, a fragment or a freed node does nothing.
164
155
  */
165
156
  nodeValue: string | null;
166
157
  /** Whether the node hangs under the mount container, which counts as connected. */
@@ -168,10 +159,10 @@ interface NodeMembers {
168
159
  /** The `document` export. */
169
160
  readonly ownerDocument: IncaDocument;
170
161
  /**
171
- * The parent, `document` for the mount container and `null` for a detached node. A freed node
172
- * reads `null`.
162
+ * The parent, `document` for the mount container and `null` for a detached node. A node inside
163
+ * a fragment reads the fragment. A freed node reads `null`.
173
164
  */
174
- readonly parentNode: IncaElement | IncaDocument | null;
165
+ readonly parentNode: IncaElement | IncaFragment | IncaDocument | null;
175
166
  /** The first child, or `null`. */
176
167
  readonly firstChild: IncaNode | null;
177
168
  /** The last child, or `null`. */
@@ -187,6 +178,70 @@ interface NodeMembers {
187
178
  readonly childNodes: NodeListOf<IncaNode>;
188
179
  /** Whether the node has a child. */
189
180
  hasChildNodes(): boolean;
181
+ /**
182
+ * Appends `node` as the last child. A fragment gives up its children in order and stays empty.
183
+ * A node that has a parent moves. Throws `HierarchyRequestError` when this node is a text node or
184
+ * a comment, or when `node` is this node or one of its ancestors.
185
+ * @returns `node`
186
+ */
187
+ appendChild<T extends IncaNode>(node: T): T;
188
+ /**
189
+ * Inserts `node` before `child`, or last when `child` is `null` or `undefined`. A fragment gives
190
+ * up its children in order and stays empty. Throws `HierarchyRequestError` as
191
+ * {@link NodeMembers.appendChild} does, and `NotFoundError` when `child` is not a child of this
192
+ * node.
193
+ * @returns `node`
194
+ */
195
+ insertBefore<T extends IncaNode>(node: T, child: IncaNode | null | undefined): T;
196
+ /**
197
+ * Removes `child`, which keeps its listeners and can be inserted again. Throws `NotFoundError`
198
+ * when `child` is not a child of this node.
199
+ * @returns `child`
200
+ */
201
+ removeChild<T extends IncaNode>(child: T): T;
202
+ /**
203
+ * Puts `node` in the place of `child`, which keeps its listeners and can be inserted again.
204
+ * Throws as {@link NodeMembers.insertBefore} does, with `child` as the node that has to be a
205
+ * child of this node.
206
+ * @returns `child`
207
+ */
208
+ replaceChild<T extends IncaNode>(node: IncaNode, child: T): T;
209
+ /**
210
+ * Copies the node: its tag, attributes and style, and with `deep` its descendants. The copy has
211
+ * no parent, no listeners and no scroll offset, and the text of an `input` carries over.
212
+ * @param deep - whether the descendants are copied too
213
+ * @returns the copy
214
+ */
215
+ cloneNode(deep?: boolean): this;
216
+ /**
217
+ * Whether `other` is this node or one of its descendants in the tree as rendered. `null` and
218
+ * `undefined` give `false`, and any other value that is not a node throws a `TypeError`. After
219
+ * the node is removed, it still answers for the subtree it keeps. A freed node contains only
220
+ * itself.
221
+ */
222
+ contains(other: IncaNode | null): boolean;
223
+ /**
224
+ * The `document` export while the node hangs under the mount container, else the topmost node
225
+ * of its subtree, the node itself without a parent.
226
+ */
227
+ getRootNode(): IncaNode | IncaDocument;
228
+ /**
229
+ * The position of `other` relative to this node as a bit mask: `1` disconnected, `2` preceding,
230
+ * `4` following, `8` contains, `16` contained by and `32` implementation specific. Nodes of
231
+ * different trees give `1 | 32` plus `2` or `4`, with opposite directions for the two orders of
232
+ * the pair. A freed node is a tree of its own: it gives `1 | 32` plus `2` or `4` by the order of
233
+ * the two ids, and `0` for itself.
234
+ * @throws {TypeError} when `other` is not a node
235
+ */
236
+ compareDocumentPosition(other: IncaNode): number;
237
+ /** Whether `other` is this node. `null` and `undefined` give `false`. */
238
+ isSameNode(other: IncaNode | null): boolean;
239
+ /**
240
+ * Whether `other` has the same tag, attributes, style and children, compared in depth. The typed
241
+ * text of an `input` is not compared. `null` and `undefined` give `false`. A freed node equals
242
+ * only itself.
243
+ */
244
+ isEqualNode(other: IncaNode | null): boolean;
190
245
  }
191
246
  /** The `textContent` of a node. */
192
247
  interface TextContentMember {
@@ -254,6 +309,27 @@ interface TextMembers {
254
309
  */
255
310
  splitText(offset: number): IncaText;
256
311
  }
312
+ /** The members that read and write the markup of an element. */
313
+ interface HtmlMembers {
314
+ /**
315
+ * The markup of the children. Assigning replaces all children with the nodes the string parses
316
+ * to in the context of the element, and `null` assigns `""`. A template reads and replaces its
317
+ * content.
318
+ */
319
+ innerHTML: string;
320
+ /**
321
+ * The markup of the element and its children. Assigning replaces the element with the nodes the
322
+ * string parses to in the context of its parent, and `null` assigns `""`. An element without a
323
+ * parent keeps its place. The mount container throws a `NoModificationAllowedError`.
324
+ */
325
+ outerHTML: string;
326
+ /**
327
+ * Parses `text` and inserts the nodes at `position`: `beforebegin`, `afterbegin`, `beforeend` or
328
+ * `afterend`, in any ASCII case. Another position throws a `SyntaxError`. `beforebegin` and
329
+ * `afterend` on an element without a parent throw a `NoModificationAllowedError`.
330
+ */
331
+ insertAdjacentHTML(position: string, text: string): void;
332
+ }
257
333
  /**
258
334
  * A container node: either a real element or the hidden stand-in that
259
335
  * `createCommentNode` makes. It is the only node type that can act as a
@@ -264,7 +340,7 @@ interface TextMembers {
264
340
  * call, an assignment to a handler property does nothing, and `dispatchEvent()` runs no listener
265
341
  * on it.
266
342
  */
267
- interface IncaElement extends IncaEventTarget, EventHandlers, NodeMembers, TextContentMember {
343
+ interface IncaElement extends IncaEventTarget, EventHandlers, NodeMembers, TextContentMember, HtmlMembers {
268
344
  /**
269
345
  * The `id` attribute, or an empty string when it is unset. Assigning sets
270
346
  * the attribute to the value as a string.
@@ -280,14 +356,17 @@ interface IncaElement extends IncaEventTarget, EventHandlers, NodeMembers, TextC
280
356
  * `"DIV"`.
281
357
  */
282
358
  readonly tagName: string;
283
- /** The current parent, or `null` if this node isn't attached to the tree. */
284
- parent: IncaElement | null;
359
+ /** The current parent element or fragment, or `null` if this node isn't attached to the tree. */
360
+ parent: IncaParent | null;
285
361
  /**
286
362
  * The child elements in order, as a live collection. Every read returns the same object, which
287
363
  * follows later changes. A removed element lists the element children it kept.
288
364
  */
289
365
  readonly children: HTMLCollectionOf<IncaElement>;
290
- /** The parent element, or `null` for a detached node and for the mount container. */
366
+ /**
367
+ * The parent element, or `null` for a detached node, a node inside a fragment and the mount
368
+ * container.
369
+ */
291
370
  readonly parentElement: IncaElement | null;
292
371
  /** The first child that is an element, or `null`. */
293
372
  readonly firstElementChild: IncaElement | null;
@@ -332,13 +411,6 @@ interface IncaElement extends IncaEventTarget, EventHandlers, NodeMembers, TextC
332
411
  * removed.
333
412
  */
334
413
  hasPointerCapture(pointerId: number): boolean;
335
- /**
336
- * Whether `other` is this node or one of its descendants in the tree as
337
- * rendered. `null` and `undefined` give `false`, and any other value that is
338
- * not a node throws a `TypeError`. After the node is removed, it still answers
339
- * for the subtree it keeps.
340
- */
341
- contains(other: IncaNode | null): boolean;
342
414
  /**
343
415
  * Assigning sets the `tabindex` attribute to the value's integer part,
344
416
  * wrapped to 32 bits. Reading returns the `tabindex` attribute as an
@@ -372,7 +444,7 @@ interface IncaElement extends IncaEventTarget, EventHandlers, NodeMembers, TextC
372
444
  * @param name - The attribute name.
373
445
  */
374
446
  removeAttribute(name: string): void;
375
- /** The names of the set attributes in alphabetical order. */
447
+ /** The names of the set attributes in the order they were set. */
376
448
  getAttributeNames(): string[];
377
449
  /**
378
450
  * The set attributes as a live map. Every read returns the same object, which follows later
@@ -380,8 +452,8 @@ interface IncaElement extends IncaEventTarget, EventHandlers, NodeMembers, TextC
380
452
  */
381
453
  readonly attributes: NamedNodeMap;
382
454
  /**
383
- * Whether this element matches the selector list. `:hover`, `:focus` and the other interactive
384
- * and form-state pseudo-classes never match.
455
+ * Whether this element matches the selector list. `:focus-visible` and the other interactive and
456
+ * form-state pseudo-classes never match.
385
457
  * @throws DOMException named `SyntaxError` for an invalid selector, also after this element is
386
458
  * removed
387
459
  * @param selectors - A selector list.
@@ -464,11 +536,6 @@ interface IncaElement extends IncaEventTarget, EventHandlers, NodeMembers, TextC
464
536
  * does nothing.
465
537
  */
466
538
  scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;
467
- /**
468
- * The `document` export while the node hangs under the mount container,
469
- * else the topmost node of its subtree, the node itself without a parent.
470
- */
471
- getRootNode(): IncaElement | IncaDocument;
472
539
  }
473
540
  /** The handle of an `<input>`. */
474
541
  interface IncaInputElement extends IncaElement {
@@ -478,19 +545,36 @@ interface IncaInputElement extends IncaElement {
478
545
  */
479
546
  value: string;
480
547
  }
548
+ /** The handle of a `<template>`. */
549
+ interface IncaTemplateElement extends IncaElement {
550
+ /** The fragment that holds the markup of the template. It is never drawn or connected. */
551
+ readonly content: IncaFragment;
552
+ }
481
553
  /** A text leaf node. */
482
554
  interface IncaText extends NodeMembers, CharacterDataMembers, TextMembers {
483
555
  /** Discriminates this node within the {@link IncaNode} union. */
484
556
  readonly kind: "text";
485
- /** The current parent, or `null` if this node isn't attached to the tree. */
486
- parent: IncaElement | null;
557
+ /** The current parent element or fragment, or `null` if this node isn't attached to the tree. */
558
+ parent: IncaParent | null;
487
559
  /**
488
560
  * The text content, mirroring the value pushed to the native node.
489
561
  */
490
562
  text: string;
491
563
  }
492
- /** Any node the shadow tree holds: an element, comment, or text leaf. */
493
- type IncaNode = IncaElement | IncaText;
564
+ /**
565
+ * The node `document.createDocumentFragment()` returns: a parentless container whose children move
566
+ * into the node it is inserted into.
567
+ */
568
+ interface IncaFragment extends NodeMembers, TextContentMember {
569
+ /** Discriminates this node within the {@link IncaNode} union. */
570
+ readonly kind: "fragment";
571
+ /** A fragment has no parent. */
572
+ parent: null;
573
+ }
574
+ /** A node that can have children. */
575
+ type IncaParent = IncaElement | IncaFragment;
576
+ /** Any node the shadow tree holds: an element, comment, text leaf or fragment. */
577
+ type IncaNode = IncaElement | IncaText | IncaFragment;
494
578
  /**
495
579
  * Stable handle to a node in the native retained tree, returned by `createNode`
496
580
  * and used in every later call that touches that node.
@@ -676,6 +760,11 @@ interface IncaDocument extends IncaEventTarget, EventHandlers<IncaDocument> {
676
760
  * takes effect for this property at once.
677
761
  */
678
762
  readonly activeElement: IncaElement | null;
763
+ /**
764
+ * Creates an empty fragment. Inserting it moves its children into the node it is inserted into.
765
+ * @returns the new fragment
766
+ */
767
+ createDocumentFragment(): IncaFragment;
679
768
  }
680
769
  /**
681
770
  * The event target at the top of every event path.
@@ -1000,4 +1089,4 @@ type EventListenerOrObject<E = IncaEvent, T = IncaEventTarget> = EventListener<E
1000
1089
  * `dispatchEvent`, and the event handler properties such as `onkeydown`.
1001
1090
  */
1002
1091
  declare const window: IncaWindow;
1003
- export { EventHandler as A, TextContentMember as B, Overflow as C, TagName as D, StyleProps as E, IncaNode as F, RectValues as G, ScrollIntoViewOptions as H, IncaText as I, NamedNodeMap as L, HTMLCollectionOf as M, IncaElement as N, Attr as O, IncaInputElement as P, NodeListOf as R, NodeId as S, ScrollAlignment as T, ScrollOptions as U, TextMembers as V, RectLike 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, CallbackId as r, EventListenerOrObject as s, window as t, IncaEvent as u, IncaUIEvent as v, Px as w, ListenerOptions as x, IncaWheelEvent as y, NodeMembers as z };
1092
+ export { EventHandler as A, IncaText as B, Overflow as C, TagName as D, StyleProps as E, IncaFragment as F, TextMembers as G, NodeListOf as H, IncaInputElement as I, RectLike as J, ScrollIntoViewOptions as K, IncaNode as L, HTMLCollectionOf as M, HtmlMembers as N, Attr as O, IncaElement as P, IncaParent as R, NodeId as S, ScrollAlignment as T, NodeMembers as U, NamedNodeMap as V, TextContentMember as W, RectValues as Y, 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, ScrollOptions 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, IncaTemplateElement as z };
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { D as TagName, E as StyleProps, F as IncaNode, G as RectValues, H as ScrollIntoViewOptions, L as NamedNodeMap, M as HTMLCollectionOf, N as IncaElement, O as Attr, P as IncaInputElement, R as NodeListOf, S as NodeId, U as ScrollOptions, W as RectLike, _ 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, 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-BhkZc6km.js";
1
+ import { D as TagName, E as StyleProps, F as IncaFragment, H as NodeListOf, I as IncaInputElement, J as RectLike, K as ScrollIntoViewOptions, L as IncaNode, M as HTMLCollectionOf, O as Attr, P as IncaElement, R as IncaParent, S as NodeId, V as NamedNodeMap, Y 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, l as IncaDocument, m as IncaInputEvent, n as AttributeValue, o as EventListenerObject, p as IncaFocusEvent, q as ScrollOptions, 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 IncaTemplateElement } from "./chunks/window-BhilMnbc.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 IncaTemplateElement, 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{p as document,f as window}from"./chunks/hooks-CNWfrFj9.js";
1
+ export{g as document,t as window}from"./chunks/hooks-DBW76Ks_.js";
@@ -1,3 +1,3 @@
1
- import { A as EventHandler, B as TextContentMember, C as Overflow, D as TagName, E as StyleProps, F as IncaNode, I as IncaText, L as NamedNodeMap, M as HTMLCollectionOf, N as IncaElement, O as Attr, P as IncaInputElement, R as NodeListOf, S as NodeId, T as ScrollAlignment, V as TextMembers, _ 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 NodeMembers } from "./chunks/window-BhkZc6km.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 parentNode, b as layoutOf, c as setText, d as createElementNode, f as createIncaElement, g as focusedNode, h as createNode, i as nextSibling, j as addEventListener, k as setAttribute, l as isRemoved, m as appendChild, n as createTextNode, o as remove, p as rootElement, r as insert, s as setElementText, t as IncaCore, u as createCommentNode, v as holdNode, w as removeStyle, x as releaseNode, y as insertBefore } from "./chunks/rendererCore-B2W5p9bR.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 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 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
+ import { A as EventHandler, B as IncaText, C as Overflow, D as TagName, E as StyleProps, F as IncaFragment, G as TextMembers, H as NodeListOf, I as IncaInputElement, L as IncaNode, M as HTMLCollectionOf, N as HtmlMembers, O as Attr, P as IncaElement, R as IncaParent, S as NodeId, T as ScrollAlignment, U as NodeMembers, V as NamedNodeMap, W as TextContentMember, _ 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 IncaTemplateElement } from "./chunks/window-BhilMnbc.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-yHZ0cch6.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 HtmlMembers, 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 IncaTemplateElement, 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
- export{M as addEventListener,m as appendChild,N as blur,P as click,t as createCommentNode,n as createElementNode,j as createEventTarget,r as createIncaElement,h as createNode,a as createTextNode,F as dispatchEvent,I as focus,g as focusedNode,_ as getAttribute,v as holdNode,o as insert,y as insertBefore,z as isRemoved,L as latestEventId,b as layoutOf,s as nextSibling,c as parentNode,x as releaseNode,B as releaseWhenCollected,l as remove,S as removeAttribute,C as removeChild,R as removeEventListener,w as removeStyle,i as rootElement,T as rootNodeId,E as scrollIntoViewNode,D as scrollNode,O as scrollOf,k as setAttribute,u as setElementText,A as setStyle,d as setText,f as window}from"./chunks/hooks-CNWfrFj9.js";import"./chunks/rendererCore-D82agHLO.js";
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-DBW76Ks_.js";import"./chunks/rendererCore-CHTgc735.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-DBW76Ks_.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 { N as IncaElement } from "./chunks/window-BhkZc6km.js";
2
- import "./chunks/rendererCore-B2W5p9bR.js";
1
+ import { P as IncaElement } from "./chunks/window-BhilMnbc.js";
2
+ import "./chunks/rendererCore-yHZ0cch6.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{i as e}from"./chunks/hooks-CNWfrFj9.js";import{t}from"./chunks/rendererCore-D82agHLO.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),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-DBW76Ks_.js";import{t}from"./chunks/rendererCore-CHTgc735.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.28",
3
+ "version": "0.0.30",
4
4
  "description": "A GPU-native, Webview-free desktop app framework built on GPUI and QuickJS.",
5
5
  "keywords": [
6
6
  "cross-platform",
@@ -28,6 +28,7 @@
28
28
  },
29
29
  "files": [
30
30
  "dist",
31
+ "src/globals.d.mts",
31
32
  "LICENSE-MIT",
32
33
  "LICENSE-APACHE"
33
34
  ],
@@ -35,6 +36,7 @@
35
36
  "sideEffects": [
36
37
  "src/callbacks.mts",
37
38
  "src/targets.mts",
39
+ "src/element/fragment.mts",
38
40
  "src/interfaces.mts",
39
41
  "dist/chunks/hooks-*.js"
40
42
  ],
@@ -52,6 +54,13 @@
52
54
  "./vue/runtime": {
53
55
  "types": "./dist/vue-runtime.d.ts",
54
56
  "import": "./dist/vue-runtime.js"
57
+ },
58
+ "./style": {
59
+ "types": "./dist/style.d.ts",
60
+ "import": "./dist/style.js"
61
+ },
62
+ "./globals": {
63
+ "types": "./src/globals.d.mts"
55
64
  }
56
65
  },
57
66
  "publishConfig": {
@@ -0,0 +1,136 @@
1
+ // Copyright (c) 2026 tom96da
2
+ // SPDX-License-Identifier: MIT OR Apache-2.0
3
+
4
+ // The host defines these globals before the app runs. This file carries their types.
5
+
6
+ declare global {
7
+ function setTimeout<A extends unknown[]>(
8
+ handler: (...args: A) => void,
9
+ delay?: number,
10
+ ...args: A
11
+ ): number;
12
+ function setInterval<A extends unknown[]>(
13
+ handler: (...args: A) => void,
14
+ delay?: number,
15
+ ...args: A
16
+ ): number;
17
+ function clearTimeout(id?: number): void;
18
+ function clearInterval(id?: number): void;
19
+
20
+ type FrameRequestCallback = (time: number) => void;
21
+ function requestAnimationFrame(callback: FrameRequestCallback): number;
22
+ function cancelAnimationFrame(handle: number): void;
23
+
24
+ interface Performance {
25
+ now(): number;
26
+ }
27
+ var performance: Performance;
28
+
29
+ interface Console {
30
+ assert(condition?: boolean, ...data: unknown[]): void;
31
+ clear(): void;
32
+ count(label?: string): void;
33
+ countReset(label?: string): void;
34
+ debug(...data: unknown[]): void;
35
+ dir(item?: unknown, options?: unknown): void;
36
+ dirxml(...data: unknown[]): void;
37
+ error(...data: unknown[]): void;
38
+ group(...data: unknown[]): void;
39
+ groupCollapsed(...data: unknown[]): void;
40
+ groupEnd(): void;
41
+ info(...data: unknown[]): void;
42
+ log(...data: unknown[]): void;
43
+ table(tabularData?: unknown, properties?: string[]): void;
44
+ time(label?: string): void;
45
+ timeEnd(label?: string): void;
46
+ timeLog(label?: string, ...data: unknown[]): void;
47
+ trace(...data: unknown[]): void;
48
+ warn(...data: unknown[]): void;
49
+ }
50
+ var console: Console;
51
+
52
+ interface TextEncoderEncodeIntoResult {
53
+ read: number;
54
+ written: number;
55
+ }
56
+ interface TextEncoder {
57
+ readonly encoding: string;
58
+ encode(input?: string): Uint8Array<ArrayBuffer>;
59
+ encodeInto(source: string, destination: Uint8Array): TextEncoderEncodeIntoResult;
60
+ }
61
+ var TextEncoder: {
62
+ new (): TextEncoder;
63
+ prototype: TextEncoder;
64
+ };
65
+
66
+ type AllowSharedBufferSource = ArrayBufferLike | ArrayBufferView;
67
+ interface TextDecoderOptions {
68
+ fatal?: boolean;
69
+ ignoreBOM?: boolean;
70
+ }
71
+ interface TextDecodeOptions {
72
+ stream?: boolean;
73
+ }
74
+ interface TextDecoder {
75
+ readonly encoding: string;
76
+ readonly fatal: boolean;
77
+ readonly ignoreBOM: boolean;
78
+ decode(input?: AllowSharedBufferSource, options?: TextDecodeOptions): string;
79
+ }
80
+ var TextDecoder: {
81
+ new (label?: string, options?: TextDecoderOptions): TextDecoder;
82
+ prototype: TextDecoder;
83
+ };
84
+
85
+ interface URL {
86
+ href: string;
87
+ protocol: string;
88
+ username: string;
89
+ password: string;
90
+ host: string;
91
+ hostname: string;
92
+ port: string;
93
+ pathname: string;
94
+ search: string;
95
+ hash: string;
96
+ readonly origin: string;
97
+ readonly searchParams: URLSearchParams;
98
+ toString(): string;
99
+ toJSON(): string;
100
+ }
101
+ var URL: {
102
+ new (url: string | URL, base?: string | URL): URL;
103
+ prototype: URL;
104
+ canParse(url: string | URL, base?: string | URL): boolean;
105
+ parse(url: string | URL, base?: string | URL): URL | null;
106
+ };
107
+
108
+ interface URLSearchParamsIterator<T> extends IteratorObject<T, BuiltinIteratorReturn, unknown> {
109
+ [Symbol.iterator](): URLSearchParamsIterator<T>;
110
+ }
111
+ interface URLSearchParams {
112
+ readonly size: number;
113
+ append(name: string, value: string): void;
114
+ delete(name: string, value?: string): void;
115
+ get(name: string): string | null;
116
+ getAll(name: string): string[];
117
+ has(name: string, value?: string): boolean;
118
+ set(name: string, value: string): void;
119
+ sort(): void;
120
+ forEach(
121
+ callback: (value: string, key: string, parent: URLSearchParams) => void,
122
+ thisArg?: unknown,
123
+ ): void;
124
+ entries(): URLSearchParamsIterator<[string, string]>;
125
+ keys(): URLSearchParamsIterator<string>;
126
+ values(): URLSearchParamsIterator<string>;
127
+ [Symbol.iterator](): URLSearchParamsIterator<[string, string]>;
128
+ toString(): string;
129
+ }
130
+ var URLSearchParams: {
131
+ new (init?: string | string[][] | Record<string, string> | URLSearchParams): URLSearchParams;
132
+ prototype: URLSearchParams;
133
+ };
134
+ }
135
+
136
+ export {};
@@ -1,2 +0,0 @@
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 f=/* @__PURE__ */ new WeakSet;function p(e){return f.has(e)||m.has(e)}function ee(e){if(f.add(e),e.kind!==`text`)for(let t of e.__children)ee(t)}const m=/* @__PURE__ */ new WeakSet;function h(e){return m.has(e)}function g(e){if(m.add(e),l(e.__node_id),e.kind!==`text`)for(let t of e.__children)g(t)}function te(e){for(let t of e){let e=u(t);e&&g(e)}}const ne=new FinalizationRegistry(e=>n().releaseNode(e)),re=/* @__PURE__ */ new WeakSet;function ie(e){return re.has(e)}function _(e){re.add(e),ne.register(e,e.__node_id)}const v=/* @__PURE__ */ new Map,y=/* @__PURE__ */ new Map;function ae(e,t,n){let r=v.get(e);r||v.set(e,r=/* @__PURE__ */ new Map),r.set(t,n),y.set(n,{group:e,listener:t})}function b(e,t){return v.get(e)?.get(t)}function x(e){let t=y.get(e);if(t===void 0)return;y.delete(e);let n=v.get(t.group);n?.delete(t.listener),n?.size===0&&v.delete(t.group)}function S(e){for(let t of e)x(t)}const oe=(e,t,n)=>`${e}:${t}:${n===!0}`;Object.defineProperty(globalThis,"__inca_released__",{value:(e,t)=>{S(t),te(e)},configurable:!0});let C=0;function se(){return C}function ce(e){return(...t)=>{let n=t[0]?.eventId;return typeof n==`number`&&n>C&&(C=n),e(...t)}}function le(e,t,r,i={}){if(r==null)return;let a=oe(e,t,i.capture);if(b(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)=>(w(e,t,r,i),o(...n)):o;ae(a,r,n().addEventListener(e,t,ce(s),i.capture===!0,i.passive===!0))}function w(e,t,r,i={}){if(r==null)return;let a=b(oe(e,t,i.capture),r);a!==void 0&&(n().removeEventListener(e,t,a),x(a))}function ue(e,t){return n().dispatchEvent(e,t)}function de(e){n().click(e)}function fe(e,t){n().focusNode(e,t)}function pe(e){n().blurNode(e)}function me(e,t){n().setPointerCapture(e,t)}function he(e,t){n().releasePointerCapture(e,t)}function ge(e,t){return n().hasPointerCapture(e,t)}function T(e,t=[]){let n=typeof e==`function`?e:()=>e;return{addEventListener(e,r,i){let a=typeof i==`boolean`?{capture:i}:i??{};le(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=>ue(n(),e)}}function _e(){throw TypeError(`document cannot be constructed. use the document export of incajs`)}function ve(){throw TypeError(`a shadow root cannot be constructed. the host has no shadow roots`)}Object.defineProperty(globalThis,"Document",{value:_e,writable:!0,configurable:!0,enumerable:!1}),Object.defineProperty(globalThis,"ShadowRoot",{value:ve,writable:!0,configurable:!0,enumerable:!1});function E(){return n().rootNodeId()}function D(e){return n().createNode(e)}function O(e,t){n().appendChild(e,t)}function k(e,t,r){n().insertBefore(e,t,r)}function A(e,t){n().removeChild(e,t)}function ye(e){S(n().releaseListeners(e))}function j(e){n().holdNode(e)}function be(e){n().releaseNode(e)}function M(e,t,r){n().setAttribute(e,t,r)}function N(e,t){return n().getAttribute(e,t)}function xe(e){return n().attributeNames(e)}function Se(e,t){return n().linkedNode(e,t)}function Ce(e){return n().childNodeIds(e)}function we(e){return n().isConnected(e)}function Te(e){return n().textContent(e)}function Ee(e){return n().wholeText(e)}function De(e,t,r){return n().substringData(e,t,r)}function Oe(e,t,r,i){n().replaceData(e,t,r,i)}function ke(e,t){return n().splitText(e,t)}function Ae(e,t){return n().matches(e,t)}function je(e,t){return n().closest(e,t)}function Me(e,t){return n().querySelector(e,t)}function Ne(e,t){return n().querySelectorAll(e,t)}function P(e){n().checkSelector(e)}function F(e){return n().layoutOf(e)}function I(e){return n().scrollOf(e)}function L(e,t,r){n().scrollNode(e,t,r)}function R(e,t,r){n().scrollIntoViewNode(e,t,r)}function Pe(e,t){n().removeAttribute(e,t)}function Fe(e,t,r){n().setStyle(e,t,r)}function Ie(e,t){n().removeStyle(e,t)}function Le(e){return n().inputValue(e)}function Re(e,t){n().setInputValue(e,t)}function ze(){return n().focusedNode()}function Be(){let e=ze();return e===null?null:d(e)??null}const z=/* @__PURE__ */ Object.defineProperties(Object.setPrototypeOf(t(T(`$document`,[`wheel`]),()=>!1),_e.prototype),{[Symbol.toStringTag]:{value:`Document`},activeElement:{get:Be}}),Ve=/* @__PURE__ */ Object.defineProperty(t(T(`$window`,[`wheel`]),()=>!1),Symbol.toStringTag,{value:`Window`}),He=/^(?:0|[1-9]\d*)$/,Ue=2**32-1;function B(e){return He.test(e)&&Number(e)<Ue}function We(e,t){return t===``?null:e.find(e=>e.id===t)??e.find(e=>e.getAttribute(`name`)===t)??null}function Ge(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 V(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=>B(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):B(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:B(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(B(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=>!B(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(B(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 Ke(e){let t=t=>We(e(),t);return V({tag:`HTMLCollection`,method:`namedItem`,source:e,find:t,named:t,names:Ge})}function qe(e,t,n){return V({tag:`NamedNodeMap`,method:`getNamedItem`,source:e,find:t,named:n,names:e=>e.map(e=>e.name)})}function H(e){return V({tag:`NodeList`,arrayMembers:!0,source:e,find:()=>null,named:()=>null,names:()=>[]})}const Je=/* @__PURE__ */ new Set([`\0`,` `,`
2
- `,`\f`,`\r`,` `,`/`,`=`,`>`]);function Ye(e){if(e.length===0)return!1;for(let t of e)if(Je.has(t))return!1;return!0}function U(e){if(typeof e==`symbol`)throw TypeError(`a symbol cannot become text`);return String(e)}function W(e,t,n){if(e.length<t)throw TypeError(`${n}() needs ${t} argument${t===1?``:`s`}`)}function Xe(e){return e.replace(/[A-Z]/g,e=>e.toLowerCase())}var G=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=h(this.#r)?null:N(this.#t,this.#e);return t===null?(e.detach(this),!1):(this.#i=U(t),!0)}get name(){return this.#e}get localName(){return this.#e}get value(){return this.#a(),this.#i}set value(e){let t=U(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 Ze(e,t){let n=t=>{let n=N(e,t);return n===null?null:U(n)},r=()=>h(t)?[]:xe(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 G(n,r,e,t,a),i.set(n,o)),o},s=e=>{let r=h(t)?null:n(e);if(r!==null)return o(e,r);let a=i.get(e);return a&&G.detach(a),null},c=()=>{let e=r(),t=new Set(e);for(let[e,n]of i)t.has(e)||G.detach(n);return e.map(e=>i.get(e)??o(e,n(e)))},l;return{getAttribute:(...e)=>(W(e,1,`getAttribute`),h(t)?null:n(U(e[0]))),setAttribute:(...n)=>{W(n,2,`setAttribute`);let r=U(n[0]),i=U(n[1]);if(!Ye(r))throw new DOMException(`the attribute name is not valid. it is empty or holds whitespace, '/', '=' or '>'`,`InvalidCharacterError`);h(t)||M(e,r,i)},hasAttribute:(...e)=>(W(e,1,`hasAttribute`),!h(t)&&n(U(e[0]))!==null),removeAttribute:(...n)=>{W(n,1,`removeAttribute`);let r=U(n[0]);h(t)||Pe(e,r)},getAttributeNames:()=>r(),get attributes(){return l??=qe(c,e=>s(Xe(e)),e=>e===Xe(e)?s(e):null),l}}}function Qe(e){return e.kind===`element`}function K(e){return e.__children.filter(Qe)}function $e(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(Qe(e))return e}return null}function et(e){let t;return{get children(){return t??=Ke(()=>K(e))},get parentElement(){return e.parent},get firstElementChild(){return K(e)[0]??null},get lastElementChild(){return K(e).at(-1)??null},get childElementCount(){return K(e).length},get previousElementSibling(){return $e(e,-1)},get nextElementSibling(){return $e(e,1)}}}function q(e){return p(e)?null:F(e.__node_id)}function tt(e){let t=e.parent;return!q(e)||!t||!q(t)?null:t}function nt(e){let t=q(e);if(!t)return{left:0,top:0};let n=tt(e),r=n?q(n):null;return{left:Math.round(t[0]-(r?r[0]+r[4]:0)+t[5])||0,top:Math.round(t[1]-(r?r[1]+r[4]:0)+t[6])||0}}function rt(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 it(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}const at={element:1,text:3,comment:8};function J(e){return h(e)?e.kind===`text`?e.text:``:String(N(e.__node_id,`value`)??``)}function Y(e,t){e.kind===`element`||h(e)||(M(e.__node_id,`value`,t),e.kind===`text`&&(e.text=t))}function ot(e){let t=e.__node_id,n=n=>{if(h(e))return null;let r=Se(t,n);return r===null?null:u(r)??null},r,i=()=>h(e)?[]:Ce(t).flatMap(e=>u(e)??[]);return{get nodeType(){return at[e.kind]},get nodeName(){return e.kind===`element`?e.tagName:`#${e.kind}`},get nodeValue(){return e.kind===`element`?null:J(e)},set nodeValue(t){Y(e,String(t??``))},get isConnected(){return!h(e)&&we(t)},get ownerDocument(){return z},get parentNode(){let e=n(`parent`);return e===null?t===E()?z: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??=H(i)},hasChildNodes:()=>i().length>0}}function X(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 st(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 ct(e){return e==null?``:U(e)}function lt(e){let t=e.__node_id,n=(n,r,i)=>{h(e)||(Oe(t,n,r,i),e.kind===`text`&&(e.text=J(e)))};return{get data(){return J(e)},set data(t){Y(e,t===null?``:U(t))},get length(){return J(e).length},get textContent(){return J(e)},set textContent(t){Y(e,ct(t))},substringData:(...n)=>{if(W(n,2,`substringData`),!h(e))return De(t,n[0],n[1]);let r=n[0]>>>0;return J(e).slice(r,r+(n[1]>>>0))},appendData:(...t)=>{W(t,1,`appendData`),n(J(e).length,0,U(t[0]))},insertData:(...e)=>{W(e,2,`insertData`),n(e[0],0,U(e[1]))},deleteData:(...e)=>{W(e,2,`deleteData`),n(e[0],e[1],``)},replaceData:(...e)=>{W(e,3,`replaceData`),n(e[0],e[1],U(e[2]))}}}function ut(e){let t=e.__node_id;return{get wholeText(){return h(e)?e.text:Ee(t)},splitText:(...n)=>{if(W(n,1,`splitText`),h(e))throw TypeError(`the text node was freed. create a new one`);let r=ke(t,n[0]),i=dt(r,String(N(r,`value`)??``));e.text=J(e);let a=e.parent;return a===null?(j(i.__node_id),_(i)):(a.__children.splice(a.__children.indexOf(e)+1,0,i),i.parent=a),i}}}function dt(e,t){let n=i({kind:`text`,parent:null,text:t},e);for(let e of[ot(n),lt(n),ut(n)])Object.defineProperties(n,Object.getOwnPropertyDescriptors(e));return c(n),n}function ft(e){let t=D(`#text`);return M(t,`value`,e),dt(t,e)}function pt(e,t){M(e.__node_id,`value`,t),e.text=t}function mt(e,t){for(let t of e.__children.slice())_t(t);if(!t)return;let n=ft(t);O(e.__node_id,n.__node_id),n.parent=e,e.__children.push(n)}function Z(e){let t=e.parent;if(!t)return;let n=t.__children.indexOf(e);n!==-1&&t.__children.splice(n,1),e.parent=null}function ht(e){e.parent&&A(e.parent.__node_id,e.__node_id),Z(e)}function gt(e,t,n){if(n===e&&e.parent===t)return;ht(e);let r=n?t.__children.indexOf(n):-1;k(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 _t(e){e.parent&&h(e.parent)?Z(e):ht(e),ye(e.__node_id),ee(e),e.kind===`element`&&!h(e)&&!ie(e)&&(j(e.__node_id),_(e))}function vt(e){return e.parent}function yt(e){let t=e.parent;if(!t)return null;let n=t.__children.indexOf(e);return t.__children[n+1]??null}function Q(e,t){return W(e,1,t),U(e[0])}function $(e,n,r=`div`,o=[]){let s=T(()=>e,o),l=()=>p(f)?null:I(e),u={get id(){return h(f)?``:String(N(e,`id`)??``)},set id(t){h(f)||M(e,`id`,String(t))},kind:n,tagName:r.replace(/[a-z]/g,e=>e.toUpperCase()),parent:null,__children:[],focus:t=>{p(f)||fe(e,!!t?.preventScroll)},blur:()=>pe(e),click:()=>{p(f)||de(e)},setPointerCapture:t=>me(e,t),releasePointerCapture:t=>he(e,t),hasPointerCapture:t=>ge(e,t),contains:e=>{if(e==null)return!1;if(!a(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===f)return!0;return!1},addEventListener:(...e)=>{p(f)||s.addEventListener(...e)},removeEventListener:(...e)=>{p(f)||s.removeEventListener(...e)},dispatchEvent:e=>h(f)||s.dispatchEvent(e),get tabIndex(){return it(h(f)?null:N(e,`tabindex`),r)},set tabIndex(t){h(f)||M(e,`tabindex`,t|0)},getBoundingClientRect:()=>rt(q(f)),get offsetWidth(){return Math.round(q(f)?.[2]??0)},get offsetHeight(){return Math.round(q(f)?.[3]??0)},get offsetLeft(){return nt(f).left},get offsetTop(){return nt(f).top},get offsetParent(){return tt(f)},get clientWidth(){let e=q(f);return e?Math.max(0,Math.round(e[2]-2*e[4])):0},get clientHeight(){let e=q(f);return e?Math.max(0,Math.round(e[3]-2*e[4])):0},get clientLeft(){return Math.round(q(f)?.[4]??0)},get clientTop(){return Math.round(q(f)?.[4]??0)},get scrollLeft(){return l()?.[0]??0},set scrollLeft(e){X(f,[e],!1)},get scrollTop(){return l()?.[1]??0},set scrollTop(e){X(f,[void 0,e],!1)},get scrollWidth(){return f.clientWidth+Math.round(l()?.[2]??0)},get scrollHeight(){return f.clientHeight+Math.round(l()?.[3]??0)},scrollTo:(...e)=>X(f,e,!1),scrollBy:(...e)=>X(f,e,!0),scrollIntoView:t=>{if(p(f))return;let{block:n,inline:r}=st(t);R(e,n,r)},matches:(...t)=>{let n=Q(t,`matches`);return h(f)?(P(n),!1):Ae(e,n)},closest:(...t)=>{let n=Q(t,`closest`);if(h(f))return P(n),null;let r=je(e,n);if(r===null)return null;let i=f;for(;i!==null&&i.__node_id!==r;)i=i.parent;return i},querySelector:(...t)=>{let n=Q(t,`querySelector`);if(h(f))return P(n),null;let r=Me(e,n);return r===null?null:d(r)},querySelectorAll:(...t)=>{let n=Q(t,`querySelectorAll`);if(h(f))return P(n),H(()=>[]);let r=Ne(e,n).map(e=>d(e));return H(()=>r)},getRootNode:()=>{let e=f;for(;e.parent!==null;)e=e.parent;return e.__node_id===E()?z:e}};r===`input`&&Object.defineProperty(u,"value",{get:()=>h(f)?``:Le(e),set:t=>{h(f)||Re(e,t===null?``:String(t))},enumerable:!0,configurable:!0});let f=t(i(u,e),()=>p(f));return Object.defineProperties(f,Object.getOwnPropertyDescriptors(Ze(e,f))),Object.defineProperties(f,Object.getOwnPropertyDescriptors(et(f))),Object.defineProperties(f,Object.getOwnPropertyDescriptors(ot(f))),Object.defineProperties(f,Object.getOwnPropertyDescriptors(n===`comment`?lt(f):bt(f))),c(f),f}function bt(e){return{get textContent(){return h(e)?``:Te(e.__node_id)},set textContent(t){h(e)||mt(e,ct(t))}}}function xt(e){return $(D(e),`element`,e)}function St(e=``){let t=D(`#comment`);return Fe(t,`display`,`none`),M(t,`value`,e),$(t,`comment`)}function Ct(){let e=E();return d(e)??$(e,`element`,void 0,[`wheel`])}Object.defineProperty(globalThis,"__inca_targets__",{value:e=>e.map(e=>e===`$document`?z:e===`$window`?Ve:d(e)??(e===E()?Ct():null)),configurable:!0});export{Fe as A,_ as B,A as C,L as D,R as E,ue as F,fe as I,se as L,le as M,pe as N,I as O,de as P,w as R,Pe as S,E as T,N as _,ft as a,F as b,vt as c,pt as d,Ve as f,ze as g,D as h,Ct as i,T as j,M as k,_t as l,O as m,xt as n,gt as o,z as p,$ as r,yt as s,St as t,mt as u,j as v,Ie as w,be as x,k as y,p as z};
@@ -1 +0,0 @@
1
- import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{A as t,B as n,C as r,D as i,E as a,F as o,I as s,L as c,M as l,N as u,O as d,P as f,R as p,S as m,T as h,_ as g,a as _,b as v,c as y,d as b,f as x,g as S,h as C,i as w,j as T,k as E,l as D,m as O,n as k,o as A,r as j,s as M,t as N,u as P,v as F,w as I,x as L,y as R,z}from"./hooks-CNWfrFj9.js";var B=/* @__PURE__ */ e({addEventListener:()=>l,appendChild:()=>O,blur:()=>u,click:()=>f,createCommentNode:()=>N,createElementNode:()=>k,createEventTarget:()=>T,createIncaElement:()=>j,createNode:()=>C,createTextNode:()=>_,dispatchEvent:()=>o,focus:()=>s,focusedNode:()=>S,getAttribute:()=>g,holdNode:()=>F,insert:()=>A,insertBefore:()=>R,isRemoved:()=>z,latestEventId:()=>c,layoutOf:()=>v,nextSibling:()=>M,parentNode:()=>y,releaseNode:()=>L,releaseWhenCollected:()=>n,remove:()=>D,removeAttribute:()=>m,removeChild:()=>r,removeEventListener:()=>p,removeStyle:()=>I,rootElement:()=>w,rootNodeId:()=>h,scrollIntoViewNode:()=>a,scrollNode:()=>i,scrollOf:()=>d,setAttribute:()=>E,setElementText:()=>P,setStyle:()=>t,setText:()=>b,window:()=>x});export{B as t};