@fluixi/dom 1.0.0-alpha.82 → 1.0.0-alpha.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/dom-client.cjs +1 -1
- package/dist/cdn/dom-client.global.js +1 -1
- package/dist/cdn/dom-client.mjs +1 -1
- package/dist/cdn/dom.cjs +1 -1
- package/dist/cdn/dom.global.js +1 -1
- package/dist/cdn/dom.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/lib/dom/dynamic-element.cjs +1 -1
- package/dist/lib/dom/dynamic-element.js +1 -1
- package/dist/lib/dom/dynamic-element.mjs +1 -1
- package/dist/lib/dom/hydration.cjs +1 -1
- package/dist/lib/dom/hydration.mjs +1 -1
- package/dist/lib/dom/index.cjs +1 -1
- package/dist/lib/dom/index.mjs +1 -1
- package/dist/lib/dom/integration.cjs +1 -1
- package/dist/lib/dom/integration.d.ts.map +1 -1
- package/dist/lib/dom/integration.js +13 -4
- package/dist/lib/dom/integration.mjs +1 -1
- package/dist/lib/dom/island.cjs +1 -1
- package/dist/lib/dom/island.js +1 -1
- package/dist/lib/dom/island.mjs +1 -1
- package/dist/lib/dom/runtime.cjs +1 -1
- package/dist/lib/dom/runtime.d.ts +11 -2
- package/dist/lib/dom/runtime.d.ts.map +1 -1
- package/dist/lib/dom/runtime.js +142 -24
- package/dist/lib/dom/runtime.mjs +1 -1
- package/dist/lib/dom/server/host.cjs +1 -1
- package/dist/lib/dom/server/host.d.ts +8 -2
- package/dist/lib/dom/server/host.d.ts.map +1 -1
- package/dist/lib/dom/server/host.js +31 -9
- package/dist/lib/dom/server/host.mjs +1 -1
- package/dist/lib/dom/server/index.cjs +1 -1
- package/dist/lib/dom/server/index.mjs +1 -1
- package/dist/lib/dom/server/nodes.cjs +1 -1
- package/dist/lib/dom/server/nodes.mjs +1 -1
- package/dist/lib/dom/server/parse-template.cjs +1 -1
- package/dist/lib/dom/server/parse-template.mjs +1 -1
- package/dist/lib/dom/server/render.cjs +1 -1
- package/dist/lib/dom/server/render.js +2 -2
- package/dist/lib/dom/server/render.mjs +1 -1
- package/dist/lib/dom/server/serialize.cjs +1 -1
- package/dist/lib/dom/server/serialize.mjs +1 -1
- package/dist/lib/dom/server-renderer.cjs +1 -1
- package/dist/lib/dom/server-renderer.mjs +1 -1
- package/dist/lib/dom/versions.cjs +1 -1
- package/dist/lib/dom/versions.mjs +1 -1
- package/dist/lib/flow/class-map.cjs +1 -1
- package/dist/lib/flow/class-map.js +1 -1
- package/dist/lib/flow/class-map.mjs +1 -1
- package/dist/lib/flow/client-only.cjs +1 -1
- package/dist/lib/flow/client-only.js +1 -1
- package/dist/lib/flow/client-only.mjs +1 -1
- package/dist/lib/flow/dynamic.cjs +1 -1
- package/dist/lib/flow/dynamic.js +1 -1
- package/dist/lib/flow/dynamic.mjs +1 -1
- package/dist/lib/flow/error-boundary.cjs +1 -1
- package/dist/lib/flow/error-boundary.js +1 -1
- package/dist/lib/flow/error-boundary.mjs +1 -1
- package/dist/lib/flow/index.cjs +1 -1
- package/dist/lib/flow/index.mjs +1 -1
- package/dist/lib/flow/portal.cjs +1 -1
- package/dist/lib/flow/portal.mjs +1 -1
- package/dist/lib/flow/show.cjs +1 -1
- package/dist/lib/flow/show.d.ts.map +1 -1
- package/dist/lib/flow/show.js +8 -3
- package/dist/lib/flow/show.mjs +1 -1
- package/dist/lib/flow/style-map.cjs +1 -1
- package/dist/lib/flow/style-map.js +1 -1
- package/dist/lib/flow/style-map.mjs +1 -1
- package/dist/lib/flow/switch.cjs +1 -1
- package/dist/lib/flow/switch.js +1 -1
- package/dist/lib/flow/switch.mjs +1 -1
- package/dist/lib/index.cjs +1 -1
- package/dist/lib/index.mjs +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/version.generated.cjs +1 -1
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +1 -1
- package/dist/version.generated.mjs +1 -1
- package/package.json +3 -3
package/dist/lib/dom/runtime.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var k=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var ye=Object.getOwnPropertyNames;var ge=Object.prototype.hasOwnProperty;var he=(e,t)=>{for(var n in t)k(e,n,{get:t[n],enumerable:!0})},me=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ye(t))!ge.call(e,s)&&s!==n&&k(e,s,{get:()=>t[s],enumerable:!(o=pe(t,s))||o.enumerable});return e};var xe=e=>me(k({},"__esModule",{value:!0}),e);var Ue={};he(Ue,{addDelegatedEventListener:()=>ae,addNativeEventListener:()=>J,applyProps:()=>Ie,applyUse:()=>U,bindPair:()=>Je,cleanChildren:()=>N,cloneTemplate:()=>ue,createNativeElement:()=>Pe,createPortal:()=>Ke,createTemplate:()=>le,delegateEvents:()=>z,escapeHTML:()=>Ge,fnName:()=>$e,generateID:()=>Se,getStableElementId:()=>we,handleRef:()=>Z,holeContent:()=>He,holeEnd:()=>Oe,holeScope:()=>Re,insert:()=>X,insertExpression:()=>C,isAccessor:()=>ze,isDelegatedEvent:()=>Ce,isFunction:()=>Le,isNativeElement:()=>Be,isPromise:()=>A,isSVGElement:()=>qe,iterateFn:()=>je,makeArrayFlat:()=>ce,mergeProps:()=>Ve,removeDelegatedEventListener:()=>G,render:()=>Xe,setClassList:()=>M,setClassName:()=>P,setDynamicAttribute:()=>j,setDynamicBoolAttribute:()=>Y,setDynamicProperty:()=>F,setProperty:()=>L,setStyle:()=>R,splitProps:()=>We,spread:()=>ke,templateNode:()=>Me});module.exports=xe(Ue);var g=require("@fluixi/reactive/signal");var I="http://www.w3.org/2000/svg";function be(e){return e.localName.includes("-")}function V(e,t,n,o=!1){if(n==null){e.removeAttribute(t);return}if(be(e)){e[t]=n;return}w(e,t,n,o)}var W=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]);function w(e,t,n,o=!1){if(n==null||n===!1){e.removeAttribute(t);return}if(n===!0){e.setAttribute(t,"");return}if(typeof n=="object"){e.setAttribute(t,JSON.stringify(n));return}e.setAttribute(t,String(n))}var Ze=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;var Q="1.0.0-alpha.82";var ee=require("@fluixi/reactive/version"),m={dom:Q,reactive:ee.VERSION};function te(e){m.core&&e.setAttribute("fluixi",m.core),e.setAttribute("fx-dom",m.dom),e.setAttribute("fx-reactive",m.reactive),typeof globalThis<"u"&&(globalThis.Fluixi=m)}function ne(){let e=[m.core,m.dom,m.reactive].filter(t=>t!==void 0);new Set(e).size<=1||console.warn(`[fluixi] package versions disagree — core ${m.core??"(absent)"}, dom ${m.dom}, reactive ${m.reactive}. These ship as one release, so a mismatch usually means a stale lockfile or two copies resolved side by side. Reinstall, or check for duplicates with \`pnpm why @fluixi/dom\`.`)}function x(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}var u=require("@fluixi/reactive/signal");var S=typeof document>"u";var K=Symbol.for("fluixi.server-node"),oe=null;function O(){if(!oe)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return oe}function v(e){return e!=null&&e[K]===!0?!0:typeof Node<"u"&&e instanceof Node}function ie(e){return e!=null&&e[K]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function re(e){return e!=null&&e[K]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var p={active:!1,cursor:null,parents:[]},Ee=null;function H(){return Ee}function B(e,t){return p.active&&t.parentNode===e}function se(e){let t=p.parents.lastIndexOf(e);t!==-1&&(p.parents.length=t),p.cursor=e.nextSibling}function q(e,t){if(!e||e.parentNode==null)return t();let n=p.active,o=p.cursor,s=p.parents;p.active=!0,p.cursor=e,p.parents=[];try{return t()}finally{p.active=n,p.cursor=o,p.parents=s}}function Ne(e){let t=[];for(;e&&e.nodeType===1;){let n=e.tagName.toLowerCase();if(e.id){n+=`#${e.id}`,t.unshift(n);break}e.getAttribute("data-id")&&(n+=`[data-id="${e.getAttribute("data-id")}"]`);let o=0,s=e;for(;s=s.previousElementSibling;)s.tagName===e.tagName&&o++;n+=`:nth-of-type(${o+1})`,t.unshift(n),e=e.parentElement}return t.join(">")}function Te(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return`el_${Math.abs(t)}`}function we(e){return Te(Ne(e))}var Se=()=>"xxyxxxxxxy-4xx8".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),ve={};var fe=new Map,$=new Set,D=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function z(e){if(!S)for(let t of e)$.has(t)||D.has(t)||($.add(t),document.addEventListener(t,Ae))}function Ae(e){let t=`$$${e.type}`,n=e.composedPath&&e.composedPath()[0]||e.target;for(;n;){let o=n[t];if(o&&!n.disabled&&(o(e),e.cancelBubble))return;n=n.host&&n.host!==n&&n.host instanceof Element?n.host:n.parentNode}}function ae(e,t,n){if(e[`$$${t}`]=n,D.has(t)){let o=`__fx_${t}`;if(!e[o]){let s=a=>{e[`$$${t}`]?.(a)};e.addEventListener(t,s),e[o]=s}return}$.has(t)||z([t])}function G(e,t){delete e[`$$${t}`];let n=`__fx_${t}`,o=e[n];o&&(e.removeEventListener(t,o),delete e[n])}function Ce(e){return!D.has(e)}function Le(e){return typeof e=="function"}function T(e,t=!1){if(S)return O().createText(e);if(p.active&&!t){let n=H()?.hydrateText(e);if(n)return n}return document.createTextNode(e)}function Pe(e,t=!1){if(S)return O().createElement(e,t);if(p.active){let n=H()?.hydrateElement(e);if(n)return n}return t?document.createElementNS(I,e):document.createElement(e)}function le(e,t=!1){let n=fe.get(e);if(n)return n;let o=document.createElement("template");return t?o.innerHTML=`<svg>${e}</svg>`:o.innerHTML=e,fe.set(e,o),o}function Me(e,t,n=!1,o=!1){if(S){let s=O();return n?s.parseTemplate(e,o):s.createRaw(e)}if(p.active){let s=H()?.hydrateStatic(t);if(s)return s}return ue(le(e,o),o).firstChild}function Re(e,t){if(!p.active)return t();let n=q(e.nextSibling,t);if(typeof n=="function"){let o=n;return((...s)=>p.active?q(e.nextSibling,()=>o(...s)):o(...s))}return n}function Oe(e){for(let t=e.nextSibling;t;t=t.nextSibling)if(t.nodeType===8&&t.data==="fx/")return t;throw new Error("[fluixi] template hole is missing its closing marker")}function He(e,t){let n=[];for(let o=e.nextSibling;o&&o!==t;o=o.nextSibling)n.push(o);return n}function ue(e,t=!1){let n=e.content.cloneNode(!0);return t?n.firstChild:n}function ce(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?ce(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}function $e(e){return typeof e!="function"?null:e._name||e.name||"anonymous"}function je(e){if((0,g.isSignal)(e)||x(e)||typeof e!="function")return e;let t=e();for(;typeof t=="function"&&!(0,g.isSignal)(t)&&!x(t);)t=t();return t}var E=0,Fe=200;function De(e,t,n,o,s){let a=o,f=new Map;return(0,u.createRenderEffect)(()=>{let r;if(x(e)&&!(0,g.isSignal)(e)){if(!f.has(e)){E++;try{let i=e();f.set(e,i)}finally{E--}}for(r=f.get(e);typeof r=="function"&&(0,g.isSignal)(r);)r=r()}else for(r=e();typeof r=="function"&&(0,g.isSignal)(r);)r=r();{let i=0;for(;typeof r=="function"&&i++<50;)if(x(r)){if(!f.has(r)){let l=r;E++;try{let c=l();f.set(l,c)}finally{E--}}r=f.get(r)}else if((0,g.isSignal)(r))r=r();else if(r=r(),typeof r!="function"||!(0,g.isSignal)(r)&&!x(r))break}E++;try{a=C(t,r,n,a,f),s(a)}finally{E--}})}function X(e,t,n,o){if(E>Fe)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;n!==void 0&&!n&&(n=T("",!0),e.appendChild(n));let s=o??null,a=i=>Array.isArray(i)&&i.some(l=>typeof l=="function"),f=i=>typeof i=="function"?i:()=>i;if(typeof t!="function"&&!a(t)){E++;try{s=C(e,t,n,s)}finally{E--}return()=>s}let r=De(f(t),e,n,s,i=>{s=i});return()=>(r?.(),s)}function C(e,t,n,o,s){if(t==null||typeof t=="boolean")return N(e,o,n);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return N(e,o,n);if(A(t)){let f=T("",!0);return Array.isArray(o)?o.length>0?(e.replaceChild(f,o[0]),N(e,o.slice(1),n)):h(e,f,n):o?e.replaceChild(f,o):h(e,f,n),t.then(r=>{f.parentNode===e&&C(e,r,f.nextSibling,f)}).catch(r=>{console.error("Error resolving promise in insertExpression:",r)}),f}let a=typeof t;if(a==="string"||a==="number"){if(a==="number"&&(t=String(t)),Array.isArray(o)){if(o.length===0){let r=T(t);return h(e,r,n),r}if(o.length===1&&o[0].nodeType===3)return o[0].data=t,o;o=N(e,o,n)}if(o&&re(o))return o.data=t,o;let f=T(t);return o&&o.parentNode===e?e.replaceChild(f,o):B(e,f)||h(e,f,n),f}if(v(t))return B(e,t)?(se(t),t):Array.isArray(o)?(o.length===0?h(e,t,n):o[0].parentNode===e?(e.replaceChild(t,o[0]),N(e,o.slice(1),n)):h(e,t,n),t):(o?o!==t&&(o.parentNode===e?e.replaceChild(t,o):h(e,t,n)):h(e,t,n),t);if(Array.isArray(t)){let f=[],r=Array.isArray(o)?o:o?[o]:[],i=[];b(t,f,e,n,!0,s,i);let l=_e(e,r,f,n);for(let c of i){let d=X(e,c.sig,c.marker);(0,u.onCleanup)(()=>{N(e,d()),c.marker.parentNode===e&&e.removeChild(c.marker)})}return l}if(a==="object"&&t!==null&&typeof t=="object"){let f=t;if("type"in f&&"props"in f){let r=f;if(typeof r.type=="function"){let i=r.type(r.props||{});return C(e,i,n,o)}}}return N(e,o,n)}function b(e,t,n,o,s=!0,a,f){for(let r=0;r<e.length;r++){let i=e[r];if(!(i==null||typeof i=="boolean")){for(;typeof i=="function"&&!A(i)&&!(0,g.isSignal)(i)&&!x(i)&&(i=i(),!(i==null||typeof i=="boolean")););if(!(i==null||typeof i=="boolean")){if(typeof i=="function"){let l;for(x(i)&&!(0,g.isSignal)(i)?(a||(a=new Map),a.has(i)||a.set(i,i()),l=a.get(i)):l=i();typeof l=="function"&&!A(l)&&!(0,g.isSignal)(l)&&!x(l);)a||(a=new Map),a.has(l)||a.set(l,l()),l=a.get(l);if(l==null||typeof l=="boolean")continue;if(typeof l=="function"){if((0,g.isSignal)(l)){if(f){let d=T("",!0);t.push(d),f.push({marker:d,sig:l});continue}let c=l();for(;typeof c=="function"&&(0,g.isSignal)(c);)c=c();if(c==null||typeof c=="boolean")continue;Array.isArray(c)?b(c,t,n,o,s,a):b([c],t,n,o,s,a);continue}continue}Array.isArray(l)?b(l,t,n,o,s,a,f):b([l],t,n,o,s,a,f);continue}if(A(i)){let l=T("",!0);t.push(l),i.then(c=>{if(l.parentNode){let d=[];if(b([c],d,l.parentNode,void 0,!1,a),d.length>0){l.parentNode.replaceChild(d[0],l);for(let y=1;y<d.length;y++)l.parentNode?.insertBefore(d[y],d[y-1].nextSibling)}}}).catch(c=>console.error("Error resolving promise in array:",c));continue}if(Array.isArray(i)){b(i,t,n,o,s,a,f);continue}if(v(i)){t.push(i);continue}if(typeof i=="object"&&i!==null&&"type"in i&&"props"in i){let l=i;if(typeof l.type=="function"){let c=l.type(l.props||{});Array.isArray(c)?b(c,t,n,o,!1,a):b([c],t,n,o,!1,a);continue}}if(typeof i=="string"||typeof i=="number"){let l=String(i);if(l.trim()===""&&l!==" ")continue;t.push(T(l));continue}t.push(T(String(i)))}}}}function _e(e,t,n,o){for(let d=0;d<n.length;d++){let y=n[d].parentNode;y!==null&&y!==e&&y.nodeType!==11&&(n=n.slice(),n[d]=n[d].cloneNode(!0))}let s=n.length,a=t.length,f=s,r=0,i=0,l=a>0?t[a-1].nextSibling??void 0:o,c=null;for(;r<a||i<f;){if(t[r]===n[i]){r++,i++;continue}for(;a>r&&f>i&&t[a-1]===n[f-1];)a--,f--;if(a===r){let d=f<s?i?n[i-1].nextSibling??void 0:n[f-i]:l;for(;i<f;)h(e,n[i++],d)}else if(f===i)for(;r<a;)(!c||!c.has(t[r]))&&t[r].parentNode===e&&e.removeChild(t[r]),r++;else if(t[r]===n[f-1]&&n[i]===t[a-1]){let d=t[--a].nextSibling;h(e,n[i++],t[r++].nextSibling),h(e,n[--f],d),t[a]=t[r-1]}else{if(!c){c=new Map;let y=i;for(;y<f;)c.set(n[y],y++)}let d=c.get(t[r]);if(d!=null)if(i<d&&d<f){let y=r,_=1;for(;++y<a&&y<f&&!(!c.has(t[y])||c.get(t[y])!==d+_);)_++;if(_>d-i){let de=t[r];for(;i<d;)h(e,n[i++],de)}else t[r].parentNode===e?e.replaceChild(n[i++],t[r++]):(h(e,n[i++],l),r++)}else r++;else t[r].parentNode===e&&e.removeChild(t[r]),r++}}return n}function N(e,t,n){if(t)if(Array.isArray(t))for(let o=0;o<t.length;o++)t[o].parentNode===e&&e.removeChild(t[o]);else t.parentNode===e&&e.removeChild(t);return null}function h(e,t,n){p.active&&t.parentNode===e||(n&&n.parentNode===e?e.insertBefore(t,n):e.appendChild(t))}function L(e,t,n){n==null?delete e[t]:e[t]=n}function J(e,t,n){let o=n,s;return Array.isArray(n)&&(o=n[0],s=n[1]),typeof o!="function"?()=>{}:(e.addEventListener(t,o,s),()=>e.removeEventListener(t,o,s))}function U(e,t){let n=(o,s)=>{typeof o=="function"&&o(e,s??(()=>{}))};if(typeof t=="function"){n(t);return}if(Array.isArray(t)){if(typeof t[0]=="function"){n(t[0],t[1]);return}for(let o of t)Array.isArray(o)?n(o[0],o[1]):n(o)}}function j(e,t,n,o=!1){return typeof n!="function"?(w(e,t,n,o),()=>{}):(0,u.createRenderEffect)(()=>{let s=typeof n=="function"?n():n;w(e,t,s,o)})}function F(e,t,n){return typeof n!="function"?(L(e,t,n),()=>{}):(0,u.createRenderEffect)(()=>{let o=typeof n=="function"?n():n;L(e,t,o)})}function Y(e,t,n){return typeof n!="function"?(w(e,t,!!n),()=>{}):(0,u.createRenderEffect)(()=>{let o=n();w(e,t,!!o)})}function P(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){(0,u.createRenderEffect)(()=>P(e,t()));return}if(typeof t=="string"){e.setAttribute("class",t);return}if(Array.isArray(t)){e.setAttribute("class",t.filter(Boolean).join(" "));return}if(typeof t=="object"){let n=Object.keys(t).filter(o=>{let s=t[o];return typeof s=="function"?s():!!s}).join(" ");e.setAttribute("class",n);return}e.setAttribute("class",String(t))}function M(e,t,n){if(!(!t||typeof t!="object"))for(let o in t){let s=t[o],a=o.split(/\s+/).filter(Boolean);if(typeof s=="function"&&n)n.push((0,u.createRenderEffect)(()=>{let f=!!s();for(let r of a)e.classList.toggle(r,f)}));else{let f=!!(typeof s=="function"?s():s);for(let r of a)e.classList.toggle(r,f)}}}function R(e,t){let n=t;for(;typeof n=="function";)n=n();if(n==null){e.removeAttribute("style");return}if(typeof n=="string"){e.style.cssText=n;return}if(typeof n=="object")for(let o in n){let s=n[o];s==null?e.style[o]="":e.style[o]=s}}function ke(e){let{element:t,props:n,prevProps:o=ve,isSVG:s=!1,skipChildren:a=!1}=e;if(!t||!ie(t))return console.error("[spread] Error: element is not a DOM Element!"),()=>{};if(!n)return console.warn("[spread] Warning: props is undefined!"),()=>{};let f=s||t.namespaceURI===I,r=[];for(let i in n){if(a&&i==="children")continue;let l=n[i],c=o[i];if(l===c)continue;if(i==="ref"){Z(l,t);continue}if(i==="use"){U(t,l);continue}if(i.startsWith("on:")){r.push(J(t,i.slice(3),l));continue}if(i.startsWith("prop:")){r.push(F(t,i.slice(5),l));continue}if(i.startsWith("attr:")){r.push(j(t,i.slice(5),l,f));continue}if(i.startsWith("bool:")){r.push(Y(t,i.slice(5),l));continue}if(i==="class"||i==="className"){typeof l=="function"?r.push((0,u.createRenderEffect)(()=>P(t,l()))):P(t,l);continue}if(i==="classList"){typeof l=="function"?r.push((0,u.createRenderEffect)(()=>M(t,l()))):M(t,l,r);continue}if(i==="style"){typeof l=="function"?r.push((0,u.createRenderEffect)(()=>R(t,l()))):R(t,l);continue}if(i.startsWith("on")){let y=i.slice(2).toLowerCase();c&&G(t,y),l&&ae(t,y,l);continue}let d=W.has(i)||!f&&i in t;typeof l=="function"?r.push(d?F(t,i,l):j(t,i,l,f)):r.push((0,u.createRenderEffect)(()=>d?L(t,i,n[i]):w(t,i,n[i],f)))}for(let i in o)if(!(i in n))if(i.startsWith("on")){let l=i.slice(2).toLowerCase();G(t,l)}else W.has(i)?L(t,i,null):t.removeAttribute(i);return()=>{r.forEach(i=>i())}}function Ie(e,t,n=!1){for(let o in t){let s=t[o];if(o==="ref"){Z(s,e);continue}if(o!=="children"){if(o==="use"){U(e,s);continue}if(o.startsWith("on:")){J(e,o.slice(3),s);continue}if(o.startsWith("prop:")){F(e,o.slice(5),s);continue}if(o.startsWith("attr:")){j(e,o.slice(5),s,n);continue}if(o.startsWith("bool:")){Y(e,o.slice(5),s);continue}if(o.startsWith("on")&&o.length>2){let a=o.slice(2).toLowerCase();if(typeof s=="function")if(D.has(a)){e[`$$${a}`]=s;let f=`__fx_${a}`;if(!e[f]){let r=i=>{e[`$$${a}`]?.(i)};e.addEventListener(a,r),e[f]=r}}else e[`$$${a}`]=s,$.has(a)||z([a]);continue}if(o==="class"||o==="className"){P(e,s);continue}if(o==="classList"){typeof s=="function"?(0,u.createRenderEffect)(()=>M(e,s())):M(e,s);continue}if(o==="style"){typeof s=="function"?(0,u.createRenderEffect)(()=>R(e,s())):R(e,s);continue}if(o==="innerHTML"){if(typeof s=="function"){let a=(0,u.createEffect)(()=>{let f=s();for(;typeof f=="function";)f=f();e.innerHTML=f});(0,u.onCleanup)(()=>a())}else e.innerHTML=s;continue}if(o==="value"&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA")){if(typeof s=="function"){let a=(0,u.createEffect)(()=>{let f=s();for(;typeof f=="function"&&f.length===0;)f=f();document.activeElement!==e&&(e.value=f??"")});(0,u.onCleanup)(()=>{a()})}else(0,u.createRenderEffect)(()=>{document.activeElement!==e&&(e.value=t[o]??"")});continue}if(o==="checked"&&e.tagName==="INPUT"){if(typeof s=="function"){let a=(0,u.createEffect)(()=>{let f=s();for(;typeof f=="function"&&f.length===0;)f=f();document.activeElement!==e&&(e.checked=f??"")});(0,u.onCleanup)(()=>{a()})}else(0,u.createRenderEffect)(()=>{document.activeElement!==e&&(e.checked=t[o]??"")});continue}if(o==="value"&&e.tagName==="SELECT"){if(typeof s=="function"){let a=!0,f=(0,u.createEffect)(()=>{let r=s();for(;typeof r=="function"&&r.length===0;)r=r();a?(a=!1,queueMicrotask(()=>{e.value=r??""})):e.value=r??""});(0,u.onCleanup)(()=>{f()})}else{let a=!0;(0,u.createRenderEffect)(()=>{let f=t[o];a?(a=!1,queueMicrotask(()=>{e.value=f??""})):e.value=f??""})}continue}if(typeof s=="function"){let a=(0,u.createEffect)(()=>{let f=s();for(;typeof f=="function"&&f.length===0;)f=f();V(e,o,f,n)});(0,u.onCleanup)(()=>{a()})}else(0,u.createRenderEffect)(()=>V(e,o,t[o],n))}}}function Ve(...e){let t=o=>{for(let s=e.length-1;s>=0;s--){let a=e[s];if(a&&o in a&&a[o]!==void 0)return a[o]}},n=o=>{for(let s of e)if(s&&o in s)return!0;return!1};return new Proxy({},{get:(o,s)=>t(s),has:(o,s)=>n(s),ownKeys:()=>{let o=new Set;for(let s of e)if(s)for(let a of Reflect.ownKeys(s))o.add(a);return[...o]},getOwnPropertyDescriptor:(o,s)=>n(s)?{enumerable:!0,configurable:!0,get:()=>t(s)}:void 0})}function We(e,...t){let n=new Set;for(let f of t)for(let r of f)n.add(r);let o=f=>({enumerable:!0,configurable:!0,get:()=>e[f]}),s=t.map(f=>{let r=new Set(f);return new Proxy({},{get:(i,l)=>r.has(l)?e[l]:void 0,has:(i,l)=>r.has(l)&&l in e,ownKeys:()=>Array.from(r).filter(i=>i in e),getOwnPropertyDescriptor:(i,l)=>r.has(l)&&l in e?o(l):void 0})}),a=new Proxy({},{get:(f,r)=>n.has(r)?void 0:e[r],has:(f,r)=>!n.has(r)&&r in e,ownKeys:()=>Reflect.ownKeys(e).filter(f=>!n.has(f)),getOwnPropertyDescriptor:(f,r)=>!n.has(r)&&r in e?o(r):void 0});return[...s,a]}function Z(e,t){if(e){if(v(e)){let n=t,o=e;if(!n)return;typeof n=="function"?n(o):typeof n=="object"&&"current"in n&&(n.current=o);return}typeof e=="function"?e(t):typeof e=="object"&&"current"in e&&(e.current=t)}}function Ke(e,t,n){let o=t||document.body,s=(0,u.readChildren)(()=>e),a=[];return(0,u.batch)(()=>{let f=(0,u.createRenderEffect)(()=>{let r=s();Array.isArray(r)?(r.forEach(i=>o.appendChild(i)),a.push(()=>{r.forEach(i=>{i.parentNode===o&&o.removeChild(i)})})):v(r)&&(o.appendChild(r),a.push(()=>{r.parentNode===o&&o.removeChild(r)}))});a.push(f),(0,u.onCleanup)(()=>{a.forEach(r=>r())})}),null}function Be(e){return typeof e=="string"&&e.toLowerCase()===e}function qe(e){return e==="svg"||e==="path"||e==="circle"||e==="rect"||e==="line"||e==="polygon"||e==="polyline"||e==="ellipse"||e==="g"||e==="defs"||e==="clipPath"||e==="text"}function Ge(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function A(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function ze(e){return typeof e=="function"&&e.length===0&&(0,g.isSignal)(e)}function Xe(e,t,n){if(!t)throw new Error("Container element is required");let o,s,a=[];return(0,u.createRoot)(f=>{(0,u.batch)(()=>{p.active||(t.textContent=""),te(t),ne(),X(t,e)}),s=f}),()=>{s?.(),o?.(),a.forEach(f=>f()),t.textContent=""}}function Je(e){if(Array.isArray(e))return e;if(typeof e=="function"&&typeof e.set=="function")return[e,e.set];throw new TypeError("[fluixi] bind: needs a signal — either `signal(…)` or the `[get, set]` pair from `createSignal(…)`.")}
|
|
1
|
+
"use strict";var V=Object.defineProperty;var be=Object.getOwnPropertyDescriptor;var Ee=Object.getOwnPropertyNames;var Ne=Object.prototype.hasOwnProperty;var Te=(e,t)=>{for(var n in t)V(e,n,{get:t[n],enumerable:!0})},we=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ee(t))!Ne.call(e,i)&&i!==n&&V(e,i,{get:()=>t[i],enumerable:!(o=be(t,i))||o.enumerable});return e};var Se=e=>we(V({},"__esModule",{value:!0}),e);var rt={};Te(rt,{addDelegatedEventListener:()=>pe,addNativeEventListener:()=>Z,applyProps:()=>Je,applyUse:()=>Q,bindPair:()=>it,cleanChildren:()=>N,cloneTemplate:()=>ge,createNativeElement:()=>$e,createPortal:()=>Ze,createTemplate:()=>ye,delegateEvents:()=>U,escapeHTML:()=>tt,fnName:()=>Ke,generateID:()=>Oe,getStableElementId:()=>Re,handleRef:()=>te,holeContent:()=>We,holeEnd:()=>Ve,holeScope:()=>De,insert:()=>Y,insertExpression:()=>C,isAccessor:()=>nt,isDelegatedEvent:()=>je,isFunction:()=>_e,isNativeElement:()=>Qe,isPromise:()=>A,isSVGElement:()=>et,iterateFn:()=>qe,makeArrayFlat:()=>me,mergeProps:()=>Ue,removeDelegatedEventListener:()=>J,render:()=>ot,setClassList:()=>M,setClassName:()=>L,setDynamicAttribute:()=>$,setDynamicBoolAttribute:()=>ee,setDynamicProperty:()=>F,setProperty:()=>P,setStyle:()=>R,splitProps:()=>Ye,spread:()=>Xe,templateNode:()=>Fe});module.exports=Se(rt);var g=require("@fluixi/reactive/signal");var W="http://www.w3.org/2000/svg";function ve(e){return e.localName.includes("-")}function K(e,t,n,o=!1){if(n==null){e.removeAttribute(t);return}if(ve(e)){e[t]=n;return}w(e,t,n,o)}var q=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]);function w(e,t,n,o=!1){if(n==null||n===!1){e.removeAttribute(t);return}if(n===!0){e.setAttribute(t,"");return}if(typeof n=="object"){e.setAttribute(t,JSON.stringify(n));return}e.setAttribute(t,String(n))}var ft=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;var ne="1.0.0-alpha.83";var oe=require("@fluixi/reactive/version"),x={dom:ne,reactive:oe.VERSION};function ie(e){x.core&&e.setAttribute("fluixi",x.core),e.setAttribute("fx-dom",x.dom),e.setAttribute("fx-reactive",x.reactive),typeof globalThis<"u"&&(globalThis.Fluixi=x)}function re(){let e=[x.core,x.dom,x.reactive].filter(t=>t!==void 0);new Set(e).size<=1||console.warn(`[fluixi] package versions disagree — core ${x.core??"(absent)"}, dom ${x.dom}, reactive ${x.reactive}. These ship as one release, so a mismatch usually means a stale lockfile or two copies resolved side by side. Reinstall, or check for duplicates with \`pnpm why @fluixi/dom\`.`)}function h(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}var u=require("@fluixi/reactive/signal");var G=Symbol.for("fluixi.server-node"),Ae=Symbol.for("fluixi.dom.server-host"),Ce=globalThis,B=Ce[Ae]??={server:typeof document>"u",nodes:null};function S(){return B.server}function O(){if(!B.nodes)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return B.nodes}function v(e){return e!=null&&e[G]===!0?!0:typeof Node<"u"&&e instanceof Node}function se(e){return e!=null&&e[G]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function fe(e){return e!=null&&e[G]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var p={active:!1,cursor:null,parents:[]},Pe=null;function H(){return Pe}function z(e,t){return p.active&&t.parentNode===e}function ae(e){let t=p.parents.lastIndexOf(e);t!==-1&&(p.parents.length=t),p.cursor=e.nextSibling}function X(e,t){if(!e||e.parentNode==null)return t();let n=p.active,o=p.cursor,i=p.parents;p.active=!0,p.cursor=e,p.parents=[];try{return t()}finally{p.active=n,p.cursor=o,p.parents=i}}function Le(e){let t=[];for(;e&&e.nodeType===1;){let n=e.tagName.toLowerCase();if(e.id){n+=`#${e.id}`,t.unshift(n);break}e.getAttribute("data-id")&&(n+=`[data-id="${e.getAttribute("data-id")}"]`);let o=0,i=e;for(;i=i.previousElementSibling;)i.tagName===e.tagName&&o++;n+=`:nth-of-type(${o+1})`,t.unshift(n),e=e.parentElement}return t.join(">")}function Me(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return`el_${Math.abs(t)}`}function Re(e){return Me(Le(e))}var Oe=()=>"xxyxxxxxxy-4xx8".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),He={};var k="__fx_at",de="__fx_loc";function le(e,t){return t&&(e[de]=t),e}var ue=new Map,j=new Set,D=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function U(e){if(!S())for(let t of e)j.has(t)||D.has(t)||(j.add(t),document.addEventListener(t,ke))}function ke(e){let t=`$$${e.type}`,n=e.composedPath&&e.composedPath()[0]||e.target;for(;n;){let o=n[t];if(o&&!n.disabled&&(o(e),e.cancelBubble))return;n=n.host&&n.host!==n&&n.host instanceof Element?n.host:n.parentNode}}function pe(e,t,n){if(e[`$$${t}`]=n,D.has(t)){let o=`__fx_${t}`;if(!e[o]){let i=a=>{e[`$$${t}`]?.(a)};e.addEventListener(t,i),e[o]=i}return}j.has(t)||U([t])}function J(e,t){delete e[`$$${t}`];let n=`__fx_${t}`,o=e[n];o&&(e.removeEventListener(t,o),delete e[n])}function je(e){return!D.has(e)}function _e(e){return typeof e=="function"}function T(e,t=!1){if(S())return O().createText(e);if(p.active&&!t){let n=H()?.hydrateText(e);if(n)return n}return document.createTextNode(e)}function $e(e,t=!1,n){if(S())return O().createElement(e,t);if(p.active){let o=H()?.hydrateElement(e);if(o)return n?le(o,n):o}return le(t?document.createElementNS(W,e):document.createElement(e),n)}function ye(e,t=!1){let n=ue.get(e);if(n)return n;let o=document.createElement("template");return t?o.innerHTML=`<svg>${e}</svg>`:o.innerHTML=e,ue.set(e,o),o}function Fe(e,t,n=!1,o=!1,i){if(S()){let a=O();return n?a.parseTemplate(e,o):a.createRaw(e)}if(p.active){let a=H()?.hydrateStatic(t);if(a)return ce(a,i)}return ce(ge(ye(e,o),o).firstChild,i)}function ce(e,t){let n=e;if(!t||typeof n?.querySelectorAll!="function")return e;let o=[n,...n.querySelectorAll("*")];for(let i=0;i<o.length&&i*2+1<t.pos.length;i++){let a=t.pos[i*2];a&&(o[i][de]={file:t.file,line:a,column:t.pos[i*2+1]})}return e}function De(e,t){if(!p.active)return t();let n=X(e.nextSibling,t);if(typeof n=="function"){let o=n;return Ie(o,(...a)=>p.active?X(e.nextSibling,()=>o(...a)):o(...a))}return n}function Ie(e,t){let n=e[k];return n!==void 0&&(t[k]=n),t}function Ve(e){for(let t=e.nextSibling;t;t=t.nextSibling)if(t.nodeType===8&&t.data==="fx/")return t;throw new Error("[fluixi] template hole is missing its closing marker")}function We(e,t){let n=[];for(let o=e.nextSibling;o&&o!==t;o=o.nextSibling)n.push(o);return n}function ge(e,t=!1){let n=e.content.cloneNode(!0);return t?n.firstChild:n}function me(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?me(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}function Ke(e){return typeof e!="function"?null:e._name||e.name||"anonymous"}function qe(e){if((0,g.isSignal)(e)||h(e)||typeof e!="function")return e;let t=e();for(;typeof t=="function"&&!(0,g.isSignal)(t)&&!h(t);)t=t();return t}var E=0,Be=200;function Ge(e,t,n,o,i){let a=o,f=new Map;return(0,u.createRenderEffect)(()=>{(0,u.reportReactiveBinding)(n??t,"content",void 0,e);let s;if(h(e)&&!(0,g.isSignal)(e)){if(!f.has(e)){E++;try{let r=e();f.set(e,r)}finally{E--}}for(s=f.get(e);typeof s=="function"&&(0,g.isSignal)(s);)s=s()}else for(s=e();typeof s=="function"&&(0,g.isSignal)(s);)s=s();{let r=0;for(;typeof s=="function"&&r++<50;)if(h(s)){if(!f.has(s)){let l=s;E++;try{let c=l();f.set(l,c)}finally{E--}}s=f.get(s)}else if((0,g.isSignal)(s))s=s();else if(s=s(),typeof s!="function"||!(0,g.isSignal)(s)&&!h(s))break}E++;try{a=C(t,s,n,a,f),i(a)}finally{E--}})}function Y(e,t,n,o){if(E>Be)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;n!==void 0&&!n&&(n=T("",!0),e.appendChild(n));let i=o??null,a=r=>Array.isArray(r)&&r.some(l=>typeof l=="function"),f=r=>typeof r=="function"?r:()=>r;if(typeof t!="function"&&!a(t)){E++;try{i=C(e,t,n,i)}finally{E--}return()=>i}let s=Ge(f(t),e,n,i,r=>{i=r});return()=>(s?.(),i)}function C(e,t,n,o,i){if(t==null||typeof t=="boolean")return N(e,o,n);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return N(e,o,n);if(A(t)){let f=T("",!0);return Array.isArray(o)?o.length>0?(e.replaceChild(f,o[0]),N(e,o.slice(1),n)):m(e,f,n):o?e.replaceChild(f,o):m(e,f,n),t.then(s=>{f.parentNode===e&&C(e,s,f.nextSibling,f)}).catch(s=>{console.error("Error resolving promise in insertExpression:",s)}),f}let a=typeof t;if(a==="string"||a==="number"){if(a==="number"&&(t=String(t)),Array.isArray(o)){if(o.length===0){let s=T(t);return m(e,s,n),s}if(o.length===1&&o[0].nodeType===3)return o[0].data=t,o;o=N(e,o,n)}if(o&&fe(o))return o.data=t,o;let f=T(t);return o&&o.parentNode===e?e.replaceChild(f,o):z(e,f)||m(e,f,n),f}if(v(t))return z(e,t)?(ae(t),t):Array.isArray(o)?(o.length===0?m(e,t,n):o[0].parentNode===e?(e.replaceChild(t,o[0]),N(e,o.slice(1),n)):m(e,t,n),t):(o?o!==t&&(o.parentNode===e?e.replaceChild(t,o):m(e,t,n)):m(e,t,n),t);if(Array.isArray(t)){let f=[],s=Array.isArray(o)?o:o?[o]:[],r=[];b(t,f,e,n,!0,i,r);let l=ze(e,s,f,n);for(let c of r){let d=Y(e,c.sig,c.marker);(0,u.onCleanup)(()=>{N(e,d()),c.marker.parentNode===e&&e.removeChild(c.marker)})}return l}if(a==="object"&&t!==null&&typeof t=="object"){let f=t;if("type"in f&&"props"in f){let s=f;if(typeof s.type=="function"){let r=s.type(s.props||{});return C(e,r,n,o)}}}return N(e,o,n)}function b(e,t,n,o,i=!0,a,f){for(let s=0;s<e.length;s++){let r=e[s];if(!(r==null||typeof r=="boolean")){for(;typeof r=="function"&&!A(r)&&!(0,g.isSignal)(r)&&!h(r)&&(r=r(),!(r==null||typeof r=="boolean")););if(!(r==null||typeof r=="boolean")){if(typeof r=="function"){let l;for(h(r)&&!(0,g.isSignal)(r)?(a||(a=new Map),a.has(r)||a.set(r,r()),l=a.get(r)):l=r();typeof l=="function"&&!A(l)&&!(0,g.isSignal)(l)&&!h(l);)a||(a=new Map),a.has(l)||a.set(l,l()),l=a.get(l);if(l==null||typeof l=="boolean")continue;if(typeof l=="function"){if((0,g.isSignal)(l)){if(f){let d=T("",!0);t.push(d),f.push({marker:d,sig:l});continue}let c=l();for(;typeof c=="function"&&(0,g.isSignal)(c);)c=c();if(c==null||typeof c=="boolean")continue;Array.isArray(c)?b(c,t,n,o,i,a):b([c],t,n,o,i,a);continue}continue}Array.isArray(l)?b(l,t,n,o,i,a,f):b([l],t,n,o,i,a,f);continue}if(A(r)){let l=T("",!0);t.push(l),r.then(c=>{if(l.parentNode){let d=[];if(b([c],d,l.parentNode,void 0,!1,a),d.length>0){l.parentNode.replaceChild(d[0],l);for(let y=1;y<d.length;y++)l.parentNode?.insertBefore(d[y],d[y-1].nextSibling)}}}).catch(c=>console.error("Error resolving promise in array:",c));continue}if(Array.isArray(r)){b(r,t,n,o,i,a,f);continue}if(v(r)){t.push(r);continue}if(typeof r=="object"&&r!==null&&"type"in r&&"props"in r){let l=r;if(typeof l.type=="function"){let c=l.type(l.props||{});Array.isArray(c)?b(c,t,n,o,!1,a):b([c],t,n,o,!1,a);continue}}if(typeof r=="string"||typeof r=="number"){let l=String(r);if(l.trim()===""&&l!==" ")continue;t.push(T(l));continue}t.push(T(String(r)))}}}}function ze(e,t,n,o){for(let d=0;d<n.length;d++){let y=n[d].parentNode;y!==null&&y!==e&&y.nodeType!==11&&(n=n.slice(),n[d]=n[d].cloneNode(!0))}let i=n.length,a=t.length,f=i,s=0,r=0,l=a>0?t[a-1].nextSibling??void 0:o,c=null;for(;s<a||r<f;){if(t[s]===n[r]){s++,r++;continue}for(;a>s&&f>r&&t[a-1]===n[f-1];)a--,f--;if(a===s){let d=f<i?r?n[r-1].nextSibling??void 0:n[f-r]:l;for(;r<f;)m(e,n[r++],d)}else if(f===r)for(;s<a;)(!c||!c.has(t[s]))&&t[s].parentNode===e&&e.removeChild(t[s]),s++;else if(t[s]===n[f-1]&&n[r]===t[a-1]){let d=t[--a].nextSibling;m(e,n[r++],t[s++].nextSibling),m(e,n[--f],d),t[a]=t[s-1]}else{if(!c){c=new Map;let y=r;for(;y<f;)c.set(n[y],y++)}let d=c.get(t[s]);if(d!=null)if(r<d&&d<f){let y=s,I=1;for(;++y<a&&y<f&&!(!c.has(t[y])||c.get(t[y])!==d+I);)I++;if(I>d-r){let he=t[s];for(;r<d;)m(e,n[r++],he)}else t[s].parentNode===e?e.replaceChild(n[r++],t[s++]):(m(e,n[r++],l),s++)}else s++;else t[s].parentNode===e&&e.removeChild(t[s]),s++}}return n}function N(e,t,n){if(t)if(Array.isArray(t))for(let o=0;o<t.length;o++)t[o].parentNode===e&&e.removeChild(t[o]);else t.parentNode===e&&e.removeChild(t);return null}function m(e,t,n){p.active&&t.parentNode===e||(n&&n.parentNode===e?e.insertBefore(t,n):e.appendChild(t))}function P(e,t,n){n==null?delete e[t]:e[t]=n}function Z(e,t,n){let o=n,i;return Array.isArray(n)&&(o=n[0],i=n[1]),typeof o!="function"?()=>{}:(e.addEventListener(t,o,i),()=>e.removeEventListener(t,o,i))}function xe(e,t){if(!t||typeof t!="function")return;let n=t[k]?.name;if(!n)return;let o=n.indexOf(":");o!==-1&&(0,u.reportReactiveDirective)(e,n.slice(0,o),n.slice(o+1),t)}function _(e,t,n){let o=typeof n=="function"?(0,u.untrack)(()=>n()):n;if(!(!o||typeof o!="object"))for(let i of Object.keys(o))(0,u.reportReactiveDirective)(e,t,i)}function Q(e,t){let n=(o,i)=>{typeof o=="function"&&((0,u.reportReactiveDirective)(e,"use",o.name||"use",i),o(e,i??(()=>{})))};if(typeof t=="function"){n(t);return}if(Array.isArray(t)){if(typeof t[0]=="function"){n(t[0],t[1]);return}for(let o of t)Array.isArray(o)?n(o[0],o[1]):n(o)}}function $(e,t,n,o=!1){return xe(e,n),typeof n!="function"?(w(e,t,n,o),()=>{}):(0,u.createRenderEffect)(()=>{(0,u.reportReactiveBinding)(e,"attribute",t,n);let i=typeof n=="function"?n():n;w(e,t,i,o)})}function F(e,t,n){return typeof n!="function"?(P(e,t,n),()=>{}):(xe(e,n),(0,u.createRenderEffect)(()=>{(0,u.reportReactiveBinding)(e,"property",t,n);let o=typeof n=="function"?n():n;P(e,t,o)}))}function ee(e,t,n){return typeof n!="function"?(w(e,t,!!n),()=>{}):(0,u.createRenderEffect)(()=>{(0,u.reportReactiveBinding)(e,"attribute",t,n);let o=n();w(e,t,!!o)})}function L(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){(0,u.createRenderEffect)(()=>{(0,u.reportReactiveBinding)(e,"attribute","class",t),L(e,t())});return}if(typeof t=="string"){e.setAttribute("class",t);return}if(Array.isArray(t)){e.setAttribute("class",t.filter(Boolean).join(" "));return}if(typeof t=="object"){let n=Object.keys(t).filter(o=>{let i=t[o];return typeof i=="function"?i():!!i}).join(" ");e.setAttribute("class",n);return}e.setAttribute("class",String(t))}function M(e,t,n){if(!(!t||typeof t!="object"))for(let o in t){let i=t[o],a=o.split(/\s+/).filter(Boolean);if(typeof i=="function"&&n)n.push((0,u.createRenderEffect)(()=>{let f=!!i();for(let s of a)e.classList.toggle(s,f)}));else{let f=!!(typeof i=="function"?i():i);for(let s of a)e.classList.toggle(s,f)}}}function R(e,t){let n=t;for(;typeof n=="function";)n=n();if(n==null){e.removeAttribute("style");return}if(typeof n=="string"){e.style.cssText=n;return}if(typeof n=="object")for(let o in n){let i=n[o];i==null?e.style[o]="":e.style[o]=i}}function Xe(e){let{element:t,props:n,prevProps:o=He,isSVG:i=!1,skipChildren:a=!1}=e;if(!t||!se(t))return console.error("[spread] Error: element is not a DOM Element!"),()=>{};if(!n)return console.warn("[spread] Warning: props is undefined!"),()=>{};let f=i||t.namespaceURI===W,s=[];for(let r in n){if(a&&r==="children")continue;let l=n[r],c=o[r];if(l===c)continue;if(r==="ref"){te(l,t);continue}if(r==="use"){Q(t,l);continue}if(r.startsWith("on:")){s.push(Z(t,r.slice(3),l));continue}if(r.startsWith("prop:")){(0,u.reportReactiveDirective)(t,"prop",r.slice(5),l),s.push(F(t,r.slice(5),l));continue}if(r.startsWith("attr:")){(0,u.reportReactiveDirective)(t,"attr",r.slice(5),l),s.push($(t,r.slice(5),l,f));continue}if(r.startsWith("bool:")){(0,u.reportReactiveDirective)(t,"bool",r.slice(5),l),s.push(ee(t,r.slice(5),l));continue}if(r==="class"||r==="className"){typeof l=="function"?s.push((0,u.createRenderEffect)(()=>{(0,u.reportReactiveBinding)(t,"attribute","class",l),L(t,l())})):L(t,l);continue}if(r==="classList"){_(t,"class",l),typeof l=="function"?s.push((0,u.createRenderEffect)(()=>{(0,u.reportReactiveBinding)(t,"attribute","class",l),M(t,l())})):M(t,l,s);continue}if(r==="style"){_(t,"style",l),typeof l=="function"?s.push((0,u.createRenderEffect)(()=>{(0,u.reportReactiveBinding)(t,"attribute","style",l),R(t,l())})):R(t,l);continue}if(r.startsWith("on")){let y=r.slice(2).toLowerCase();c&&J(t,y),l&&pe(t,y,l);continue}let d=q.has(r)||!f&&r in t;typeof l=="function"?s.push(d?F(t,r,l):$(t,r,l,f)):s.push((0,u.createRenderEffect)(()=>d?P(t,r,n[r]):w(t,r,n[r],f)))}for(let r in o)if(!(r in n))if(r.startsWith("on")){let l=r.slice(2).toLowerCase();J(t,l)}else q.has(r)?P(t,r,null):t.removeAttribute(r);return()=>{s.forEach(r=>r())}}function Je(e,t,n=!1){for(let o in t){let i=t[o];if(o==="ref"){te(i,e);continue}if(o!=="children"){if(o==="use"){Q(e,i);continue}if(o.startsWith("on:")){Z(e,o.slice(3),i);continue}if(o.startsWith("prop:")){(0,u.reportReactiveDirective)(e,"prop",o.slice(5),i),F(e,o.slice(5),i);continue}if(o.startsWith("attr:")){(0,u.reportReactiveDirective)(e,"attr",o.slice(5),i),$(e,o.slice(5),i,n);continue}if(o.startsWith("bool:")){(0,u.reportReactiveDirective)(e,"bool",o.slice(5),i),ee(e,o.slice(5),i);continue}if(o.startsWith("on")&&o.length>2){let a=o.slice(2).toLowerCase();if(typeof i=="function")if(D.has(a)){e[`$$${a}`]=i;let f=`__fx_${a}`;if(!e[f]){let s=r=>{e[`$$${a}`]?.(r)};e.addEventListener(a,s),e[f]=s}}else e[`$$${a}`]=i,j.has(a)||U([a]);continue}if(o==="class"||o==="className"){L(e,i);continue}if(o==="classList"){_(e,"class",i),typeof i=="function"?(0,u.createRenderEffect)(()=>{(0,u.reportReactiveBinding)(e,"attribute","class",i),M(e,i())}):M(e,i);continue}if(o==="style"){_(e,"style",i),typeof i=="function"?(0,u.createRenderEffect)(()=>{(0,u.reportReactiveBinding)(e,"attribute","style",i),R(e,i())}):R(e,i);continue}if(o==="innerHTML"){if(typeof i=="function"){let a=(0,u.createEffect)(()=>{let f=i();for(;typeof f=="function";)f=f();e.innerHTML=f});(0,u.onCleanup)(()=>a())}else e.innerHTML=i;continue}if(o==="value"&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA")){if(typeof i=="function"){let a=(0,u.createEffect)(()=>{let f=i();for(;typeof f=="function"&&f.length===0;)f=f();document.activeElement!==e&&(e.value=f??"")});(0,u.onCleanup)(()=>{a()})}else(0,u.createRenderEffect)(()=>{document.activeElement!==e&&(e.value=t[o]??"")});continue}if(o==="checked"&&e.tagName==="INPUT"){if(typeof i=="function"){let a=(0,u.createEffect)(()=>{let f=i();for(;typeof f=="function"&&f.length===0;)f=f();document.activeElement!==e&&(e.checked=f??"")});(0,u.onCleanup)(()=>{a()})}else(0,u.createRenderEffect)(()=>{document.activeElement!==e&&(e.checked=t[o]??"")});continue}if(o==="value"&&e.tagName==="SELECT"){if(typeof i=="function"){let a=!0,f=(0,u.createEffect)(()=>{let s=i();for(;typeof s=="function"&&s.length===0;)s=s();a?(a=!1,queueMicrotask(()=>{e.value=s??""})):e.value=s??""});(0,u.onCleanup)(()=>{f()})}else{let a=!0;(0,u.createRenderEffect)(()=>{let f=t[o];a?(a=!1,queueMicrotask(()=>{e.value=f??""})):e.value=f??""})}continue}if(typeof i=="function"){let a=(0,u.createEffect)(()=>{let f=i();for(;typeof f=="function"&&f.length===0;)f=f();K(e,o,f,n)});(0,u.onCleanup)(()=>{a()})}else(0,u.createRenderEffect)(()=>K(e,o,t[o],n))}}}function Ue(...e){let t=o=>{for(let i=e.length-1;i>=0;i--){let a=e[i];if(a&&o in a&&a[o]!==void 0)return a[o]}},n=o=>{for(let i of e)if(i&&o in i)return!0;return!1};return new Proxy({},{get:(o,i)=>t(i),has:(o,i)=>n(i),ownKeys:()=>{let o=new Set;for(let i of e)if(i)for(let a of Reflect.ownKeys(i))o.add(a);return[...o]},getOwnPropertyDescriptor:(o,i)=>n(i)?{enumerable:!0,configurable:!0,get:()=>t(i)}:void 0})}function Ye(e,...t){let n=new Set;for(let f of t)for(let s of f)n.add(s);let o=f=>({enumerable:!0,configurable:!0,get:()=>e[f]}),i=t.map(f=>{let s=new Set(f);return new Proxy({},{get:(r,l)=>s.has(l)?e[l]:void 0,has:(r,l)=>s.has(l)&&l in e,ownKeys:()=>Array.from(s).filter(r=>r in e),getOwnPropertyDescriptor:(r,l)=>s.has(l)&&l in e?o(l):void 0})}),a=new Proxy({},{get:(f,s)=>n.has(s)?void 0:e[s],has:(f,s)=>!n.has(s)&&s in e,ownKeys:()=>Reflect.ownKeys(e).filter(f=>!n.has(f)),getOwnPropertyDescriptor:(f,s)=>!n.has(s)&&s in e?o(s):void 0});return[...i,a]}function te(e,t){if(!e)return;let n=e[k]?.name;if((0,u.reportReactiveDirective)(t,"ref",n||typeof e=="function"&&e.name||"ref",e),v(e)){let o=t,i=e;if(!o)return;typeof o=="function"?o(i):typeof o=="object"&&"current"in o&&(o.current=i);return}typeof e=="function"?e(t):typeof e=="object"&&"current"in e&&(e.current=t)}function Ze(e,t,n){let o=t||document.body,i=(0,u.readChildren)(()=>e),a=[];return(0,u.batch)(()=>{let f=(0,u.createRenderEffect)(()=>{let s=i();Array.isArray(s)?(s.forEach(r=>o.appendChild(r)),a.push(()=>{s.forEach(r=>{r.parentNode===o&&o.removeChild(r)})})):v(s)&&(o.appendChild(s),a.push(()=>{s.parentNode===o&&o.removeChild(s)}))});a.push(f),(0,u.onCleanup)(()=>{a.forEach(s=>s())})}),null}function Qe(e){return typeof e=="string"&&e.toLowerCase()===e}function et(e){return e==="svg"||e==="path"||e==="circle"||e==="rect"||e==="line"||e==="polygon"||e==="polyline"||e==="ellipse"||e==="g"||e==="defs"||e==="clipPath"||e==="text"}function tt(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function A(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function nt(e){return typeof e=="function"&&e.length===0&&(0,g.isSignal)(e)}function ot(e,t,n){if(!t)throw new Error("Container element is required");let o,i,a=[];return(0,u.createRoot)(f=>{(0,u.batch)(()=>{p.active||(t.textContent=""),ie(t),re(),Y(t,e)}),i=f}),()=>{i?.(),o?.(),a.forEach(f=>f()),t.textContent=""}}function it(e){if(Array.isArray(e))return e;if(typeof e=="function"&&typeof e.set=="function")return[e,e.set];throw new TypeError("[fluixi] bind: needs a signal — either `signal(…)` or the `[get, set]` pair from `createSignal(…)`.")}
|
|
@@ -50,7 +50,11 @@ export declare function isDelegatedEvent(name: string): boolean;
|
|
|
50
50
|
* Check if value is a function
|
|
51
51
|
*/
|
|
52
52
|
export declare function isFunction(value: any): value is Function;
|
|
53
|
-
export declare function createNativeElement(tag: string, isSVG?: boolean
|
|
53
|
+
export declare function createNativeElement(tag: string, isSVG?: boolean, at?: {
|
|
54
|
+
file: string;
|
|
55
|
+
line: number;
|
|
56
|
+
column: number;
|
|
57
|
+
}): Element;
|
|
54
58
|
export declare function createTemplate(html: string, isSVG?: boolean): HTMLTemplateElement;
|
|
55
59
|
/**
|
|
56
60
|
* A node for a compiler-emitted static template, built the way the current environment
|
|
@@ -66,7 +70,12 @@ export declare function createTemplate(html: string, isSVG?: boolean): HTMLTempl
|
|
|
66
70
|
* is inert, so there is nothing inside to wire up.
|
|
67
71
|
* - **client** — parse once (cached by HTML) and clone per instance.
|
|
68
72
|
*/
|
|
69
|
-
export declare function templateNode(html: string, tag: string, holes?: boolean, isSVG?: boolean): Node;
|
|
73
|
+
export declare function templateNode(html: string, tag: string, holes?: boolean, isSVG?: boolean, at?: TemplatePositions): Node;
|
|
74
|
+
/** Line and column per element of a template, flattened, in document order. */
|
|
75
|
+
export interface TemplatePositions {
|
|
76
|
+
file: string;
|
|
77
|
+
pos: number[];
|
|
78
|
+
}
|
|
70
79
|
/**
|
|
71
80
|
* Evaluate a hole's content with the hydration cursor placed at what the server rendered
|
|
72
81
|
* for *that hole*.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/lib/dom/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAyEH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,OAAO,GAAG,MAAM,CAEtD;AACD,eAAO,MAAM,UAAU,cAMtB,CAAC;AAMF,KAAK,QAAQ,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC;AAE3B,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,IAAI,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,MAAM,aAAa,GAAG,GAAG,CAAC;AAChC,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;AAC1E,MAAM,MAAM,QAAQ,GAChB,IAAI,GACJ,IAAI,EAAE,GACN,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,GACT,CAAC,MAAM,GAAG,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/lib/dom/runtime.ts"],"names":[],"mappings":"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"}
|
package/dist/lib/dom/runtime.js
CHANGED
|
@@ -19,7 +19,7 @@ import { isComponent } from '../component/modifiers.js';
|
|
|
19
19
|
// Reactive primitives come straight from the signal core (the globalThis-singleton graph makes
|
|
20
20
|
// this duplication-safe). The integration bridge is only for framework-provided glue that is
|
|
21
21
|
// NOT in the reactive core (e.g. createComponent).
|
|
22
|
-
import { batch, createEffect, createRenderEffect, createRoot, onCleanup, readChildren } from '@fluixi/reactive/signal';
|
|
22
|
+
import { batch, createEffect, createRenderEffect, createRoot, onCleanup, readChildren, reportReactiveBinding, reportReactiveDirective, untrack } from '@fluixi/reactive/signal';
|
|
23
23
|
import { isServer, getServerNodes, isDomNode, isDomElement, isDomText, } from './server/host.js';
|
|
24
24
|
import { hydration, getHydrationWalker, isAdopted, runHydrationAt, ascendPast, } from './hydration-state.js';
|
|
25
25
|
function getElementFingerprint(el) {
|
|
@@ -71,6 +71,16 @@ export const generateID = () => {
|
|
|
71
71
|
// ============================================================================
|
|
72
72
|
const EMPTY_OBJ = {};
|
|
73
73
|
const EMPTY_ARR = [];
|
|
74
|
+
/** Where devtools leaves the source position of a hole. Absent in a production build. */
|
|
75
|
+
const HOLE_TAG = '__fx_at';
|
|
76
|
+
/** Where an element's own source position goes, for devtools to read back. */
|
|
77
|
+
const LOC_TAG = '__fx_loc';
|
|
78
|
+
/** Only ever called with a position when the compiler recorded one. */
|
|
79
|
+
function located(element, at) {
|
|
80
|
+
if (at)
|
|
81
|
+
element[LOC_TAG] = at;
|
|
82
|
+
return element;
|
|
83
|
+
}
|
|
74
84
|
// Template cache
|
|
75
85
|
const templateCache = new Map();
|
|
76
86
|
// ============================================================================
|
|
@@ -88,7 +98,7 @@ const NON_DELEGATED = new Set(['scroll', 'focus', 'blur', 'load', 'error', 'resi
|
|
|
88
98
|
* Stores handlers as `element.$$eventname = handler` properties.
|
|
89
99
|
*/
|
|
90
100
|
export function delegateEvents(eventNames) {
|
|
91
|
-
if (isServer)
|
|
101
|
+
if (isServer())
|
|
92
102
|
return; // no document to attach to; events are inert in SSR
|
|
93
103
|
for (const name of eventNames) {
|
|
94
104
|
if (delegatedSet.has(name) || NON_DELEGATED.has(name))
|
|
@@ -163,7 +173,7 @@ export function isFunction(value) {
|
|
|
163
173
|
return typeof value === 'function';
|
|
164
174
|
}
|
|
165
175
|
function createTextNode(value, anchor = false) {
|
|
166
|
-
if (isServer)
|
|
176
|
+
if (isServer())
|
|
167
177
|
return getServerNodes().createText(value);
|
|
168
178
|
// Anchors/placeholders (insert markers) are client-only insertion points — the server
|
|
169
179
|
// serialized nothing for them, so they must never adopt a server text node. Only real
|
|
@@ -176,7 +186,7 @@ function createTextNode(value, anchor = false) {
|
|
|
176
186
|
return document.createTextNode(value);
|
|
177
187
|
}
|
|
178
188
|
function createMarker(value) {
|
|
179
|
-
if (isServer)
|
|
189
|
+
if (isServer())
|
|
180
190
|
return getServerNodes().createComment(value);
|
|
181
191
|
if (hydration.active) {
|
|
182
192
|
const node = getHydrationWalker()?.hydrateMarker(value);
|
|
@@ -185,17 +195,15 @@ function createMarker(value) {
|
|
|
185
195
|
}
|
|
186
196
|
return document.createComment(value);
|
|
187
197
|
}
|
|
188
|
-
export function createNativeElement(tag, isSVG = false) {
|
|
189
|
-
if (isServer)
|
|
198
|
+
export function createNativeElement(tag, isSVG = false, at) {
|
|
199
|
+
if (isServer())
|
|
190
200
|
return getServerNodes().createElement(tag, isSVG);
|
|
191
201
|
if (hydration.active) {
|
|
192
202
|
const node = getHydrationWalker()?.hydrateElement(tag);
|
|
193
203
|
if (node)
|
|
194
|
-
return node;
|
|
204
|
+
return at ? located(node, at) : node;
|
|
195
205
|
}
|
|
196
|
-
return isSVG
|
|
197
|
-
? document.createElementNS(SVG_NAMESPACE, tag)
|
|
198
|
-
: document.createElement(tag);
|
|
206
|
+
return located(isSVG ? document.createElementNS(SVG_NAMESPACE, tag) : document.createElement(tag), at);
|
|
199
207
|
}
|
|
200
208
|
export function createTemplate(html, isSVG = false) {
|
|
201
209
|
const cached = templateCache.get(html);
|
|
@@ -225,8 +233,8 @@ export function createTemplate(html, isSVG = false) {
|
|
|
225
233
|
* is inert, so there is nothing inside to wire up.
|
|
226
234
|
* - **client** — parse once (cached by HTML) and clone per instance.
|
|
227
235
|
*/
|
|
228
|
-
export function templateNode(html, tag, holes = false, isSVG = false) {
|
|
229
|
-
if (isServer) {
|
|
236
|
+
export function templateNode(html, tag, holes = false, isSVG = false, at) {
|
|
237
|
+
if (isServer()) {
|
|
230
238
|
// With holes the server needs real nodes for the hole content to be inserted into;
|
|
231
239
|
// without them the string can be written out untouched, which is strictly cheaper.
|
|
232
240
|
const nodes = getServerNodes();
|
|
@@ -237,9 +245,31 @@ export function templateNode(html, tag, holes = false, isSVG = false) {
|
|
|
237
245
|
// through the adopted tree, whose structure matches the template by construction.
|
|
238
246
|
const node = getHydrationWalker()?.hydrateStatic(tag);
|
|
239
247
|
if (node)
|
|
240
|
-
return node;
|
|
248
|
+
return stampPositions(node, at);
|
|
249
|
+
}
|
|
250
|
+
return stampPositions(cloneTemplate(createTemplate(html, isSVG), isSVG).firstChild, at);
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Write each element's own source position onto it.
|
|
254
|
+
*
|
|
255
|
+
* The whole template is one string, so a source map traces every element in it back to the
|
|
256
|
+
* line the root opens at — devtools would name the component and nothing finer. This is the
|
|
257
|
+
* one moment the two line up: the tree holds exactly the elements the compiler listed, in
|
|
258
|
+
* the same order, because holes are filled after this returns.
|
|
259
|
+
*
|
|
260
|
+
* Only reached when the compiler emitted positions, which it does for a dev build.
|
|
261
|
+
*/
|
|
262
|
+
function stampPositions(node, at) {
|
|
263
|
+
const root = node;
|
|
264
|
+
if (!at || typeof root?.querySelectorAll !== 'function')
|
|
265
|
+
return node;
|
|
266
|
+
const all = [root, ...root.querySelectorAll('*')];
|
|
267
|
+
for (let i = 0; i < all.length && i * 2 + 1 < at.pos.length; i++) {
|
|
268
|
+
const line = at.pos[i * 2];
|
|
269
|
+
if (line)
|
|
270
|
+
all[i][LOC_TAG] = { file: at.file, line, column: at.pos[i * 2 + 1] };
|
|
241
271
|
}
|
|
242
|
-
return
|
|
272
|
+
return node;
|
|
243
273
|
}
|
|
244
274
|
/**
|
|
245
275
|
* Evaluate a hole's content with the hydration cursor placed at what the server rendered
|
|
@@ -267,12 +297,25 @@ export function holeScope(start, produce) {
|
|
|
267
297
|
// hydration is over, later updates must render normally rather than re-enter it.
|
|
268
298
|
if (typeof value === 'function') {
|
|
269
299
|
const accessor = value;
|
|
270
|
-
|
|
300
|
+
const wrapped = (...args) => hydration.active
|
|
271
301
|
? runHydrationAt(start.nextSibling, () => accessor(...args))
|
|
272
|
-
: accessor(...args)
|
|
302
|
+
: accessor(...args);
|
|
303
|
+
return carryHoleTag(accessor, wrapped);
|
|
273
304
|
}
|
|
274
305
|
return value;
|
|
275
306
|
}
|
|
307
|
+
/**
|
|
308
|
+
* The compiler tags a hole's accessor with where it was written, and devtools reads the tag
|
|
309
|
+
* off whatever finally reaches `insert`. Under hydration that is this wrapper, not the
|
|
310
|
+
* accessor, so the tag has to come along — otherwise the binding reports the frame it was
|
|
311
|
+
* created from, which is a line in this file.
|
|
312
|
+
*/
|
|
313
|
+
function carryHoleTag(from, to) {
|
|
314
|
+
const tag = from[HOLE_TAG];
|
|
315
|
+
if (tag !== undefined)
|
|
316
|
+
to[HOLE_TAG] = tag;
|
|
317
|
+
return to;
|
|
318
|
+
}
|
|
276
319
|
/**
|
|
277
320
|
* The closing marker for a hole opened at `start`.
|
|
278
321
|
*
|
|
@@ -372,6 +415,11 @@ function _createInsertEffect(getAccessor, parent, marker, initialCurrent, setCur
|
|
|
372
415
|
let current = initialCurrent;
|
|
373
416
|
const componentCache = new Map();
|
|
374
417
|
return createRenderEffect(() => {
|
|
418
|
+
// The accessor, never its result: it carries the compiler's hole position, and calling it
|
|
419
|
+
// again here builds the dom twice — during hydration, a duplicated subtree.
|
|
420
|
+
//
|
|
421
|
+
// Every run, because what this effect writes into moves as the value does.
|
|
422
|
+
reportReactiveBinding(marker ?? parent, 'content', undefined, getAccessor);
|
|
375
423
|
let value;
|
|
376
424
|
// ── 0. If accessor itself is a component thunk (not a signal/memo), call it once via cache ──
|
|
377
425
|
// must check !isSignal to avoid caching reactive values that are also
|
|
@@ -965,10 +1013,41 @@ export function addNativeEventListener(element, name, value) {
|
|
|
965
1013
|
element.addEventListener(name, handler, options);
|
|
966
1014
|
return () => element.removeEventListener(name, handler, options);
|
|
967
1015
|
}
|
|
1016
|
+
/**
|
|
1017
|
+
* Name each key of a class or style object as the directive it came from.
|
|
1018
|
+
*
|
|
1019
|
+
* `class:a class:b` are merged by the compiler into one classList prop, so the keys are the
|
|
1020
|
+
* only record that two directives were written.
|
|
1021
|
+
*/
|
|
1022
|
+
/**
|
|
1023
|
+
* A directive the compiler had to name, because the runtime sees only what it lowers to.
|
|
1024
|
+
* `bind:value` arrives as an ordinary value and an input handler.
|
|
1025
|
+
*/
|
|
1026
|
+
function reportMarked(element, accessor) {
|
|
1027
|
+
if (!accessor || typeof accessor !== 'function')
|
|
1028
|
+
return;
|
|
1029
|
+
const written = accessor[HOLE_TAG]?.name;
|
|
1030
|
+
if (!written)
|
|
1031
|
+
return;
|
|
1032
|
+
const colon = written.indexOf(':');
|
|
1033
|
+
if (colon === -1)
|
|
1034
|
+
return;
|
|
1035
|
+
reportReactiveDirective(element, written.slice(0, colon), written.slice(colon + 1), accessor);
|
|
1036
|
+
}
|
|
1037
|
+
function reportKeys(element, kind, value) {
|
|
1038
|
+
const from = typeof value === 'function' ? untrack(() => value()) : value;
|
|
1039
|
+
if (!from || typeof from !== 'object')
|
|
1040
|
+
return;
|
|
1041
|
+
for (const key of Object.keys(from))
|
|
1042
|
+
reportReactiveDirective(element, kind, key);
|
|
1043
|
+
}
|
|
968
1044
|
export function applyUse(element, value) {
|
|
969
1045
|
const call = (dir, accessor) => {
|
|
970
|
-
if (typeof dir
|
|
971
|
-
|
|
1046
|
+
if (typeof dir !== 'function')
|
|
1047
|
+
return;
|
|
1048
|
+
// Named so a watcher can tell one directive from another. Nothing else reads it.
|
|
1049
|
+
reportReactiveDirective(element, 'use', dir.name || 'use', accessor);
|
|
1050
|
+
dir(element, accessor ?? (() => undefined));
|
|
972
1051
|
};
|
|
973
1052
|
if (typeof value === 'function') {
|
|
974
1053
|
call(value);
|
|
@@ -989,11 +1068,13 @@ export function applyUse(element, value) {
|
|
|
989
1068
|
}
|
|
990
1069
|
}
|
|
991
1070
|
export function setDynamicAttribute(element, name, accessor, isSVG = false) {
|
|
1071
|
+
reportMarked(element, accessor);
|
|
992
1072
|
if (typeof accessor !== 'function') {
|
|
993
1073
|
setAttribute(element, name, accessor, isSVG);
|
|
994
1074
|
return () => { };
|
|
995
1075
|
}
|
|
996
1076
|
return createRenderEffect(() => {
|
|
1077
|
+
reportReactiveBinding(element, 'attribute', name, accessor);
|
|
997
1078
|
const value = typeof accessor === 'function' ? accessor() : accessor;
|
|
998
1079
|
setAttribute(element, name, value, isSVG);
|
|
999
1080
|
});
|
|
@@ -1003,7 +1084,9 @@ export function setDynamicProperty(element, name, accessor) {
|
|
|
1003
1084
|
setProperty(element, name, accessor);
|
|
1004
1085
|
return () => { };
|
|
1005
1086
|
}
|
|
1087
|
+
reportMarked(element, accessor);
|
|
1006
1088
|
return createRenderEffect(() => {
|
|
1089
|
+
reportReactiveBinding(element, 'property', name, accessor);
|
|
1007
1090
|
const value = typeof accessor === 'function' ? accessor() : accessor;
|
|
1008
1091
|
setProperty(element, name, value);
|
|
1009
1092
|
});
|
|
@@ -1016,6 +1099,7 @@ export function setDynamicBoolAttribute(element, name, accessor) {
|
|
|
1016
1099
|
return () => { };
|
|
1017
1100
|
}
|
|
1018
1101
|
return createRenderEffect(() => {
|
|
1102
|
+
reportReactiveBinding(element, 'attribute', name, accessor);
|
|
1019
1103
|
const value = accessor();
|
|
1020
1104
|
setAttribute(element, name, !!value);
|
|
1021
1105
|
});
|
|
@@ -1031,7 +1115,10 @@ export function setClassName(element, value) {
|
|
|
1031
1115
|
if (typeof value === 'function') {
|
|
1032
1116
|
// A render effect, like every other attribute binding — `spread` already wraps
|
|
1033
1117
|
// class this way, so going through `applyProps` shouldn't schedule it later.
|
|
1034
|
-
createRenderEffect(() =>
|
|
1118
|
+
createRenderEffect(() => {
|
|
1119
|
+
reportReactiveBinding(element, 'attribute', 'class', value);
|
|
1120
|
+
setClassName(element, value());
|
|
1121
|
+
});
|
|
1035
1122
|
return;
|
|
1036
1123
|
}
|
|
1037
1124
|
if (typeof value === 'string') {
|
|
@@ -1153,20 +1240,26 @@ export function spread(options) {
|
|
|
1153
1240
|
// Forced bindings: prop:x always assigns the property, attr:x always sets the
|
|
1154
1241
|
// attribute, bool:x toggles a boolean attribute — skipping the heuristic below.
|
|
1155
1242
|
if (key.startsWith('prop:')) {
|
|
1243
|
+
reportReactiveDirective(element, 'prop', key.slice(5), value);
|
|
1156
1244
|
disposers.push(setDynamicProperty(element, key.slice(5), value));
|
|
1157
1245
|
continue;
|
|
1158
1246
|
}
|
|
1159
1247
|
if (key.startsWith('attr:')) {
|
|
1248
|
+
reportReactiveDirective(element, 'attr', key.slice(5), value);
|
|
1160
1249
|
disposers.push(setDynamicAttribute(element, key.slice(5), value, elementIsSVG));
|
|
1161
1250
|
continue;
|
|
1162
1251
|
}
|
|
1163
1252
|
if (key.startsWith('bool:')) {
|
|
1253
|
+
reportReactiveDirective(element, 'bool', key.slice(5), value);
|
|
1164
1254
|
disposers.push(setDynamicBoolAttribute(element, key.slice(5), value));
|
|
1165
1255
|
continue;
|
|
1166
1256
|
}
|
|
1167
1257
|
if (key === 'class' || key === 'className') {
|
|
1168
1258
|
if (typeof value === 'function') {
|
|
1169
|
-
disposers.push(createRenderEffect(() =>
|
|
1259
|
+
disposers.push(createRenderEffect(() => {
|
|
1260
|
+
reportReactiveBinding(element, 'attribute', 'class', value);
|
|
1261
|
+
setClassName(element, value());
|
|
1262
|
+
}));
|
|
1170
1263
|
}
|
|
1171
1264
|
else {
|
|
1172
1265
|
setClassName(element, value);
|
|
@@ -1174,8 +1267,12 @@ export function spread(options) {
|
|
|
1174
1267
|
continue;
|
|
1175
1268
|
}
|
|
1176
1269
|
if (key === 'classList') {
|
|
1270
|
+
reportKeys(element, 'class', value);
|
|
1177
1271
|
if (typeof value === 'function') {
|
|
1178
|
-
disposers.push(createRenderEffect(() =>
|
|
1272
|
+
disposers.push(createRenderEffect(() => {
|
|
1273
|
+
reportReactiveBinding(element, 'attribute', 'class', value);
|
|
1274
|
+
setClassList(element, value());
|
|
1275
|
+
}));
|
|
1179
1276
|
}
|
|
1180
1277
|
else {
|
|
1181
1278
|
setClassList(element, value, disposers);
|
|
@@ -1183,8 +1280,12 @@ export function spread(options) {
|
|
|
1183
1280
|
continue;
|
|
1184
1281
|
}
|
|
1185
1282
|
if (key === 'style') {
|
|
1283
|
+
reportKeys(element, 'style', value);
|
|
1186
1284
|
if (typeof value === 'function') {
|
|
1187
|
-
disposers.push(createRenderEffect(() =>
|
|
1285
|
+
disposers.push(createRenderEffect(() => {
|
|
1286
|
+
reportReactiveBinding(element, 'attribute', 'style', value);
|
|
1287
|
+
setStyle(element, value());
|
|
1288
|
+
}));
|
|
1188
1289
|
}
|
|
1189
1290
|
else {
|
|
1190
1291
|
setStyle(element, value);
|
|
@@ -1257,14 +1358,17 @@ export function applyProps(element, props, isSVG = false) {
|
|
|
1257
1358
|
}
|
|
1258
1359
|
// Forced bindings — see spread().
|
|
1259
1360
|
if (key.startsWith('prop:')) {
|
|
1361
|
+
reportReactiveDirective(element, 'prop', key.slice(5), val);
|
|
1260
1362
|
setDynamicProperty(element, key.slice(5), val);
|
|
1261
1363
|
continue;
|
|
1262
1364
|
}
|
|
1263
1365
|
if (key.startsWith('attr:')) {
|
|
1366
|
+
reportReactiveDirective(element, 'attr', key.slice(5), val);
|
|
1264
1367
|
setDynamicAttribute(element, key.slice(5), val, isSVG);
|
|
1265
1368
|
continue;
|
|
1266
1369
|
}
|
|
1267
1370
|
if (key.startsWith('bool:')) {
|
|
1371
|
+
reportReactiveDirective(element, 'bool', key.slice(5), val);
|
|
1268
1372
|
setDynamicBoolAttribute(element, key.slice(5), val);
|
|
1269
1373
|
continue;
|
|
1270
1374
|
}
|
|
@@ -1298,8 +1402,12 @@ export function applyProps(element, props, isSVG = false) {
|
|
|
1298
1402
|
continue;
|
|
1299
1403
|
}
|
|
1300
1404
|
if (key === 'classList') {
|
|
1405
|
+
reportKeys(element, 'class', val);
|
|
1301
1406
|
if (typeof val === 'function')
|
|
1302
|
-
createRenderEffect(() =>
|
|
1407
|
+
createRenderEffect(() => {
|
|
1408
|
+
reportReactiveBinding(element, 'attribute', 'class', val);
|
|
1409
|
+
setClassList(element, val());
|
|
1410
|
+
});
|
|
1303
1411
|
else
|
|
1304
1412
|
setClassList(element, val);
|
|
1305
1413
|
continue;
|
|
@@ -1309,8 +1417,12 @@ export function applyProps(element, props, isSVG = false) {
|
|
|
1309
1417
|
// style through a props object rather than as a compiled JSX attribute —
|
|
1310
1418
|
// which is what every polymorphic/`as` wrapper does. class and classList
|
|
1311
1419
|
// already handled that; style applied once and never updated.
|
|
1420
|
+
reportKeys(element, 'style', val);
|
|
1312
1421
|
if (typeof val === 'function')
|
|
1313
|
-
createRenderEffect(() =>
|
|
1422
|
+
createRenderEffect(() => {
|
|
1423
|
+
reportReactiveBinding(element, 'attribute', 'style', val);
|
|
1424
|
+
setStyle(element, val());
|
|
1425
|
+
});
|
|
1314
1426
|
else
|
|
1315
1427
|
setStyle(element, val);
|
|
1316
1428
|
continue;
|
|
@@ -1536,6 +1648,12 @@ export function splitProps(props, ...keys) {
|
|
|
1536
1648
|
export function handleRef(ref, element) {
|
|
1537
1649
|
if (!ref)
|
|
1538
1650
|
return;
|
|
1651
|
+
// Which variable ends up holding the element is the question a ref raises, and only the
|
|
1652
|
+
// compiler's mark on the value can answer it.
|
|
1653
|
+
// The compiler's mark names the variable it is stored in; a function's own name is the
|
|
1654
|
+
// next best thing.
|
|
1655
|
+
const held = ref[HOLE_TAG]?.name;
|
|
1656
|
+
reportReactiveDirective(element, 'ref', held || (typeof ref === 'function' ? ref.name || 'ref' : 'ref'), ref);
|
|
1539
1657
|
// Swapped-argument guard
|
|
1540
1658
|
if (isDomNode(ref)) {
|
|
1541
1659
|
const actualRef = element;
|
package/dist/lib/dom/runtime.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isSignal as h}from"@fluixi/reactive/signal";var k="http://www.w3.org/2000/svg";function ue(e){return e.localName.includes("-")}function I(e,t,n,o=!1){if(n==null){e.removeAttribute(t);return}if(ue(e)){e[t]=n;return}T(e,t,n,o)}var V=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]);function T(e,t,n,o=!1){if(n==null||n===!1){e.removeAttribute(t);return}if(n===!0){e.setAttribute(t,"");return}if(typeof n=="object"){e.setAttribute(t,JSON.stringify(n));return}e.setAttribute(t,String(n))}var Ae=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;var z="1.0.0-alpha.82";import{VERSION as ce}from"@fluixi/reactive/version";var m={dom:z,reactive:ce};function X(e){m.core&&e.setAttribute("fluixi",m.core),e.setAttribute("fx-dom",m.dom),e.setAttribute("fx-reactive",m.reactive),typeof globalThis<"u"&&(globalThis.Fluixi=m)}function J(){let e=[m.core,m.dom,m.reactive].filter(t=>t!==void 0);new Set(e).size<=1||console.warn(`[fluixi] package versions disagree — core ${m.core??"(absent)"}, dom ${m.dom}, reactive ${m.reactive}. These ship as one release, so a mismatch usually means a stale lockfile or two copies resolved side by side. Reinstall, or check for duplicates with \`pnpm why @fluixi/dom\`.`)}function x(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}import{batch as ne,createEffect as C,createRenderEffect as y,createRoot as pe,onCleanup as S,readChildren as ye}from"@fluixi/reactive/signal";var v=typeof document>"u";var W=Symbol.for("fluixi.server-node"),U=null;function L(){if(!U)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return U}function A(e){return e!=null&&e[W]===!0?!0:typeof Node<"u"&&e instanceof Node}function Y(e){return e!=null&&e[W]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function Z(e){return e!=null&&e[W]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var d={active:!1,cursor:null,parents:[]},de=null;function P(){return de}function K(e,t){return d.active&&t.parentNode===e}function Q(e){let t=d.parents.lastIndexOf(e);t!==-1&&(d.parents.length=t),d.cursor=e.nextSibling}function B(e,t){if(!e||e.parentNode==null)return t();let n=d.active,o=d.cursor,s=d.parents;d.active=!0,d.cursor=e,d.parents=[];try{return t()}finally{d.active=n,d.cursor=o,d.parents=s}}function ge(e){let t=[];for(;e&&e.nodeType===1;){let n=e.tagName.toLowerCase();if(e.id){n+=`#${e.id}`,t.unshift(n);break}e.getAttribute("data-id")&&(n+=`[data-id="${e.getAttribute("data-id")}"]`);let o=0,s=e;for(;s=s.previousElementSibling;)s.tagName===e.tagName&&o++;n+=`:nth-of-type(${o+1})`,t.unshift(n),e=e.parentElement}return t.join(">")}function he(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return`el_${Math.abs(t)}`}function Ke(e){return he(ge(e))}var Be=()=>"xxyxxxxxxy-4xx8".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),me={};var ee=new Map,R=new Set,D=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function oe(e){if(!v)for(let t of e)R.has(t)||D.has(t)||(R.add(t),document.addEventListener(t,xe))}function xe(e){let t=`$$${e.type}`,n=e.composedPath&&e.composedPath()[0]||e.target;for(;n;){let o=n[t];if(o&&!n.disabled&&(o(e),e.cancelBubble))return;n=n.host&&n.host!==n&&n.host instanceof Element?n.host:n.parentNode}}function be(e,t,n){if(e[`$$${t}`]=n,D.has(t)){let o=`__fx_${t}`;if(!e[o]){let s=a=>{e[`$$${t}`]?.(a)};e.addEventListener(t,s),e[o]=s}return}R.has(t)||oe([t])}function te(e,t){delete e[`$$${t}`];let n=`__fx_${t}`,o=e[n];o&&(e.removeEventListener(t,o),delete e[n])}function qe(e){return!D.has(e)}function Ge(e){return typeof e=="function"}function N(e,t=!1){if(v)return L().createText(e);if(d.active&&!t){let n=P()?.hydrateText(e);if(n)return n}return document.createTextNode(e)}function ze(e,t=!1){if(v)return L().createElement(e,t);if(d.active){let n=P()?.hydrateElement(e);if(n)return n}return t?document.createElementNS(k,e):document.createElement(e)}function Ee(e,t=!1){let n=ee.get(e);if(n)return n;let o=document.createElement("template");return t?o.innerHTML=`<svg>${e}</svg>`:o.innerHTML=e,ee.set(e,o),o}function Xe(e,t,n=!1,o=!1){if(v){let s=L();return n?s.parseTemplate(e,o):s.createRaw(e)}if(d.active){let s=P()?.hydrateStatic(t);if(s)return s}return Ne(Ee(e,o),o).firstChild}function Je(e,t){if(!d.active)return t();let n=B(e.nextSibling,t);if(typeof n=="function"){let o=n;return((...s)=>d.active?B(e.nextSibling,()=>o(...s)):o(...s))}return n}function Ue(e){for(let t=e.nextSibling;t;t=t.nextSibling)if(t.nodeType===8&&t.data==="fx/")return t;throw new Error("[fluixi] template hole is missing its closing marker")}function Ye(e,t){let n=[];for(let o=e.nextSibling;o&&o!==t;o=o.nextSibling)n.push(o);return n}function Ne(e,t=!1){let n=e.content.cloneNode(!0);return t?n.firstChild:n}function Te(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?Te(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}function Ze(e){return typeof e!="function"?null:e._name||e.name||"anonymous"}function Qe(e){if(h(e)||x(e)||typeof e!="function")return e;let t=e();for(;typeof t=="function"&&!h(t)&&!x(t);)t=t();return t}var E=0,we=200;function Se(e,t,n,o,s){let a=o,f=new Map;return y(()=>{let r;if(x(e)&&!h(e)){if(!f.has(e)){E++;try{let i=e();f.set(e,i)}finally{E--}}for(r=f.get(e);typeof r=="function"&&h(r);)r=r()}else for(r=e();typeof r=="function"&&h(r);)r=r();{let i=0;for(;typeof r=="function"&&i++<50;)if(x(r)){if(!f.has(r)){let l=r;E++;try{let u=l();f.set(l,u)}finally{E--}}r=f.get(r)}else if(h(r))r=r();else if(r=r(),typeof r!="function"||!h(r)&&!x(r))break}E++;try{a=O(t,r,n,a,f),s(a)}finally{E--}})}function ie(e,t,n,o){if(E>we)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;n!==void 0&&!n&&(n=N("",!0),e.appendChild(n));let s=o??null,a=i=>Array.isArray(i)&&i.some(l=>typeof l=="function"),f=i=>typeof i=="function"?i:()=>i;if(typeof t!="function"&&!a(t)){E++;try{s=O(e,t,n,s)}finally{E--}return()=>s}let r=Se(f(t),e,n,s,i=>{s=i});return()=>(r?.(),s)}function O(e,t,n,o,s){if(t==null||typeof t=="boolean")return w(e,o,n);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return w(e,o,n);if(M(t)){let f=N("",!0);return Array.isArray(o)?o.length>0?(e.replaceChild(f,o[0]),w(e,o.slice(1),n)):g(e,f,n):o?e.replaceChild(f,o):g(e,f,n),t.then(r=>{f.parentNode===e&&O(e,r,f.nextSibling,f)}).catch(r=>{console.error("Error resolving promise in insertExpression:",r)}),f}let a=typeof t;if(a==="string"||a==="number"){if(a==="number"&&(t=String(t)),Array.isArray(o)){if(o.length===0){let r=N(t);return g(e,r,n),r}if(o.length===1&&o[0].nodeType===3)return o[0].data=t,o;o=w(e,o,n)}if(o&&Z(o))return o.data=t,o;let f=N(t);return o&&o.parentNode===e?e.replaceChild(f,o):K(e,f)||g(e,f,n),f}if(A(t))return K(e,t)?(Q(t),t):Array.isArray(o)?(o.length===0?g(e,t,n):o[0].parentNode===e?(e.replaceChild(t,o[0]),w(e,o.slice(1),n)):g(e,t,n),t):(o?o!==t&&(o.parentNode===e?e.replaceChild(t,o):g(e,t,n)):g(e,t,n),t);if(Array.isArray(t)){let f=[],r=Array.isArray(o)?o:o?[o]:[],i=[];b(t,f,e,n,!0,s,i);let l=ve(e,r,f,n);for(let u of i){let c=ie(e,u.sig,u.marker);S(()=>{w(e,c()),u.marker.parentNode===e&&e.removeChild(u.marker)})}return l}if(a==="object"&&t!==null&&typeof t=="object"){let f=t;if("type"in f&&"props"in f){let r=f;if(typeof r.type=="function"){let i=r.type(r.props||{});return O(e,i,n,o)}}}return w(e,o,n)}function b(e,t,n,o,s=!0,a,f){for(let r=0;r<e.length;r++){let i=e[r];if(!(i==null||typeof i=="boolean")){for(;typeof i=="function"&&!M(i)&&!h(i)&&!x(i)&&(i=i(),!(i==null||typeof i=="boolean")););if(!(i==null||typeof i=="boolean")){if(typeof i=="function"){let l;for(x(i)&&!h(i)?(a||(a=new Map),a.has(i)||a.set(i,i()),l=a.get(i)):l=i();typeof l=="function"&&!M(l)&&!h(l)&&!x(l);)a||(a=new Map),a.has(l)||a.set(l,l()),l=a.get(l);if(l==null||typeof l=="boolean")continue;if(typeof l=="function"){if(h(l)){if(f){let c=N("",!0);t.push(c),f.push({marker:c,sig:l});continue}let u=l();for(;typeof u=="function"&&h(u);)u=u();if(u==null||typeof u=="boolean")continue;Array.isArray(u)?b(u,t,n,o,s,a):b([u],t,n,o,s,a);continue}continue}Array.isArray(l)?b(l,t,n,o,s,a,f):b([l],t,n,o,s,a,f);continue}if(M(i)){let l=N("",!0);t.push(l),i.then(u=>{if(l.parentNode){let c=[];if(b([u],c,l.parentNode,void 0,!1,a),c.length>0){l.parentNode.replaceChild(c[0],l);for(let p=1;p<c.length;p++)l.parentNode?.insertBefore(c[p],c[p-1].nextSibling)}}}).catch(u=>console.error("Error resolving promise in array:",u));continue}if(Array.isArray(i)){b(i,t,n,o,s,a,f);continue}if(A(i)){t.push(i);continue}if(typeof i=="object"&&i!==null&&"type"in i&&"props"in i){let l=i;if(typeof l.type=="function"){let u=l.type(l.props||{});Array.isArray(u)?b(u,t,n,o,!1,a):b([u],t,n,o,!1,a);continue}}if(typeof i=="string"||typeof i=="number"){let l=String(i);if(l.trim()===""&&l!==" ")continue;t.push(N(l));continue}t.push(N(String(i)))}}}}function ve(e,t,n,o){for(let c=0;c<n.length;c++){let p=n[c].parentNode;p!==null&&p!==e&&p.nodeType!==11&&(n=n.slice(),n[c]=n[c].cloneNode(!0))}let s=n.length,a=t.length,f=s,r=0,i=0,l=a>0?t[a-1].nextSibling??void 0:o,u=null;for(;r<a||i<f;){if(t[r]===n[i]){r++,i++;continue}for(;a>r&&f>i&&t[a-1]===n[f-1];)a--,f--;if(a===r){let c=f<s?i?n[i-1].nextSibling??void 0:n[f-i]:l;for(;i<f;)g(e,n[i++],c)}else if(f===i)for(;r<a;)(!u||!u.has(t[r]))&&t[r].parentNode===e&&e.removeChild(t[r]),r++;else if(t[r]===n[f-1]&&n[i]===t[a-1]){let c=t[--a].nextSibling;g(e,n[i++],t[r++].nextSibling),g(e,n[--f],c),t[a]=t[r-1]}else{if(!u){u=new Map;let p=i;for(;p<f;)u.set(n[p],p++)}let c=u.get(t[r]);if(c!=null)if(i<c&&c<f){let p=r,_=1;for(;++p<a&&p<f&&!(!u.has(t[p])||u.get(t[p])!==c+_);)_++;if(_>c-i){let le=t[r];for(;i<c;)g(e,n[i++],le)}else t[r].parentNode===e?e.replaceChild(n[i++],t[r++]):(g(e,n[i++],l),r++)}else r++;else t[r].parentNode===e&&e.removeChild(t[r]),r++}}return n}function w(e,t,n){if(t)if(Array.isArray(t))for(let o=0;o<t.length;o++)t[o].parentNode===e&&e.removeChild(t[o]);else t.parentNode===e&&e.removeChild(t);return null}function g(e,t,n){d.active&&t.parentNode===e||(n&&n.parentNode===e?e.insertBefore(t,n):e.appendChild(t))}function H(e,t,n){n==null?delete e[t]:e[t]=n}function re(e,t,n){let o=n,s;return Array.isArray(n)&&(o=n[0],s=n[1]),typeof o!="function"?()=>{}:(e.addEventListener(t,o,s),()=>e.removeEventListener(t,o,s))}function se(e,t){let n=(o,s)=>{typeof o=="function"&&o(e,s??(()=>{}))};if(typeof t=="function"){n(t);return}if(Array.isArray(t)){if(typeof t[0]=="function"){n(t[0],t[1]);return}for(let o of t)Array.isArray(o)?n(o[0],o[1]):n(o)}}function q(e,t,n,o=!1){return typeof n!="function"?(T(e,t,n,o),()=>{}):y(()=>{let s=typeof n=="function"?n():n;T(e,t,s,o)})}function G(e,t,n){return typeof n!="function"?(H(e,t,n),()=>{}):y(()=>{let o=typeof n=="function"?n():n;H(e,t,o)})}function fe(e,t,n){return typeof n!="function"?(T(e,t,!!n),()=>{}):y(()=>{let o=n();T(e,t,!!o)})}function $(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){y(()=>$(e,t()));return}if(typeof t=="string"){e.setAttribute("class",t);return}if(Array.isArray(t)){e.setAttribute("class",t.filter(Boolean).join(" "));return}if(typeof t=="object"){let n=Object.keys(t).filter(o=>{let s=t[o];return typeof s=="function"?s():!!s}).join(" ");e.setAttribute("class",n);return}e.setAttribute("class",String(t))}function j(e,t,n){if(!(!t||typeof t!="object"))for(let o in t){let s=t[o],a=o.split(/\s+/).filter(Boolean);if(typeof s=="function"&&n)n.push(y(()=>{let f=!!s();for(let r of a)e.classList.toggle(r,f)}));else{let f=!!(typeof s=="function"?s():s);for(let r of a)e.classList.toggle(r,f)}}}function F(e,t){let n=t;for(;typeof n=="function";)n=n();if(n==null){e.removeAttribute("style");return}if(typeof n=="string"){e.style.cssText=n;return}if(typeof n=="object")for(let o in n){let s=n[o];s==null?e.style[o]="":e.style[o]=s}}function et(e){let{element:t,props:n,prevProps:o=me,isSVG:s=!1,skipChildren:a=!1}=e;if(!t||!Y(t))return console.error("[spread] Error: element is not a DOM Element!"),()=>{};if(!n)return console.warn("[spread] Warning: props is undefined!"),()=>{};let f=s||t.namespaceURI===k,r=[];for(let i in n){if(a&&i==="children")continue;let l=n[i],u=o[i];if(l===u)continue;if(i==="ref"){ae(l,t);continue}if(i==="use"){se(t,l);continue}if(i.startsWith("on:")){r.push(re(t,i.slice(3),l));continue}if(i.startsWith("prop:")){r.push(G(t,i.slice(5),l));continue}if(i.startsWith("attr:")){r.push(q(t,i.slice(5),l,f));continue}if(i.startsWith("bool:")){r.push(fe(t,i.slice(5),l));continue}if(i==="class"||i==="className"){typeof l=="function"?r.push(y(()=>$(t,l()))):$(t,l);continue}if(i==="classList"){typeof l=="function"?r.push(y(()=>j(t,l()))):j(t,l,r);continue}if(i==="style"){typeof l=="function"?r.push(y(()=>F(t,l()))):F(t,l);continue}if(i.startsWith("on")){let p=i.slice(2).toLowerCase();u&&te(t,p),l&&be(t,p,l);continue}let c=V.has(i)||!f&&i in t;typeof l=="function"?r.push(c?G(t,i,l):q(t,i,l,f)):r.push(y(()=>c?H(t,i,n[i]):T(t,i,n[i],f)))}for(let i in o)if(!(i in n))if(i.startsWith("on")){let l=i.slice(2).toLowerCase();te(t,l)}else V.has(i)?H(t,i,null):t.removeAttribute(i);return()=>{r.forEach(i=>i())}}function tt(e,t,n=!1){for(let o in t){let s=t[o];if(o==="ref"){ae(s,e);continue}if(o!=="children"){if(o==="use"){se(e,s);continue}if(o.startsWith("on:")){re(e,o.slice(3),s);continue}if(o.startsWith("prop:")){G(e,o.slice(5),s);continue}if(o.startsWith("attr:")){q(e,o.slice(5),s,n);continue}if(o.startsWith("bool:")){fe(e,o.slice(5),s);continue}if(o.startsWith("on")&&o.length>2){let a=o.slice(2).toLowerCase();if(typeof s=="function")if(D.has(a)){e[`$$${a}`]=s;let f=`__fx_${a}`;if(!e[f]){let r=i=>{e[`$$${a}`]?.(i)};e.addEventListener(a,r),e[f]=r}}else e[`$$${a}`]=s,R.has(a)||oe([a]);continue}if(o==="class"||o==="className"){$(e,s);continue}if(o==="classList"){typeof s=="function"?y(()=>j(e,s())):j(e,s);continue}if(o==="style"){typeof s=="function"?y(()=>F(e,s())):F(e,s);continue}if(o==="innerHTML"){if(typeof s=="function"){let a=C(()=>{let f=s();for(;typeof f=="function";)f=f();e.innerHTML=f});S(()=>a())}else e.innerHTML=s;continue}if(o==="value"&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA")){if(typeof s=="function"){let a=C(()=>{let f=s();for(;typeof f=="function"&&f.length===0;)f=f();document.activeElement!==e&&(e.value=f??"")});S(()=>{a()})}else y(()=>{document.activeElement!==e&&(e.value=t[o]??"")});continue}if(o==="checked"&&e.tagName==="INPUT"){if(typeof s=="function"){let a=C(()=>{let f=s();for(;typeof f=="function"&&f.length===0;)f=f();document.activeElement!==e&&(e.checked=f??"")});S(()=>{a()})}else y(()=>{document.activeElement!==e&&(e.checked=t[o]??"")});continue}if(o==="value"&&e.tagName==="SELECT"){if(typeof s=="function"){let a=!0,f=C(()=>{let r=s();for(;typeof r=="function"&&r.length===0;)r=r();a?(a=!1,queueMicrotask(()=>{e.value=r??""})):e.value=r??""});S(()=>{f()})}else{let a=!0;y(()=>{let f=t[o];a?(a=!1,queueMicrotask(()=>{e.value=f??""})):e.value=f??""})}continue}if(typeof s=="function"){let a=C(()=>{let f=s();for(;typeof f=="function"&&f.length===0;)f=f();I(e,o,f,n)});S(()=>{a()})}else y(()=>I(e,o,t[o],n))}}}function nt(...e){let t=o=>{for(let s=e.length-1;s>=0;s--){let a=e[s];if(a&&o in a&&a[o]!==void 0)return a[o]}},n=o=>{for(let s of e)if(s&&o in s)return!0;return!1};return new Proxy({},{get:(o,s)=>t(s),has:(o,s)=>n(s),ownKeys:()=>{let o=new Set;for(let s of e)if(s)for(let a of Reflect.ownKeys(s))o.add(a);return[...o]},getOwnPropertyDescriptor:(o,s)=>n(s)?{enumerable:!0,configurable:!0,get:()=>t(s)}:void 0})}function ot(e,...t){let n=new Set;for(let f of t)for(let r of f)n.add(r);let o=f=>({enumerable:!0,configurable:!0,get:()=>e[f]}),s=t.map(f=>{let r=new Set(f);return new Proxy({},{get:(i,l)=>r.has(l)?e[l]:void 0,has:(i,l)=>r.has(l)&&l in e,ownKeys:()=>Array.from(r).filter(i=>i in e),getOwnPropertyDescriptor:(i,l)=>r.has(l)&&l in e?o(l):void 0})}),a=new Proxy({},{get:(f,r)=>n.has(r)?void 0:e[r],has:(f,r)=>!n.has(r)&&r in e,ownKeys:()=>Reflect.ownKeys(e).filter(f=>!n.has(f)),getOwnPropertyDescriptor:(f,r)=>!n.has(r)&&r in e?o(r):void 0});return[...s,a]}function ae(e,t){if(e){if(A(e)){let n=t,o=e;if(!n)return;typeof n=="function"?n(o):typeof n=="object"&&"current"in n&&(n.current=o);return}typeof e=="function"?e(t):typeof e=="object"&&"current"in e&&(e.current=t)}}function it(e,t,n){let o=t||document.body,s=ye(()=>e),a=[];return ne(()=>{let f=y(()=>{let r=s();Array.isArray(r)?(r.forEach(i=>o.appendChild(i)),a.push(()=>{r.forEach(i=>{i.parentNode===o&&o.removeChild(i)})})):A(r)&&(o.appendChild(r),a.push(()=>{r.parentNode===o&&o.removeChild(r)}))});a.push(f),S(()=>{a.forEach(r=>r())})}),null}function rt(e){return typeof e=="string"&&e.toLowerCase()===e}function st(e){return e==="svg"||e==="path"||e==="circle"||e==="rect"||e==="line"||e==="polygon"||e==="polyline"||e==="ellipse"||e==="g"||e==="defs"||e==="clipPath"||e==="text"}function ft(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function M(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function at(e){return typeof e=="function"&&e.length===0&&h(e)}function lt(e,t,n){if(!t)throw new Error("Container element is required");let o,s,a=[];return pe(f=>{ne(()=>{d.active||(t.textContent=""),X(t),J(),ie(t,e)}),s=f}),()=>{s?.(),o?.(),a.forEach(f=>f()),t.textContent=""}}function ut(e){if(Array.isArray(e))return e;if(typeof e=="function"&&typeof e.set=="function")return[e,e.set];throw new TypeError("[fluixi] bind: needs a signal — either `signal(…)` or the `[get, set]` pair from `createSignal(…)`.")}export{be as addDelegatedEventListener,re as addNativeEventListener,tt as applyProps,se as applyUse,ut as bindPair,w as cleanChildren,Ne as cloneTemplate,ze as createNativeElement,it as createPortal,Ee as createTemplate,oe as delegateEvents,ft as escapeHTML,Ze as fnName,Be as generateID,Ke as getStableElementId,ae as handleRef,Ye as holeContent,Ue as holeEnd,Je as holeScope,ie as insert,O as insertExpression,at as isAccessor,qe as isDelegatedEvent,Ge as isFunction,rt as isNativeElement,M as isPromise,st as isSVGElement,Qe as iterateFn,Te as makeArrayFlat,nt as mergeProps,te as removeDelegatedEventListener,lt as render,j as setClassList,$ as setClassName,q as setDynamicAttribute,fe as setDynamicBoolAttribute,G as setDynamicProperty,H as setProperty,F as setStyle,ot as splitProps,et as spread,Xe as templateNode};
|
|
1
|
+
import{isSignal as m}from"@fluixi/reactive/signal";var K="http://www.w3.org/2000/svg";function he(e){return e.localName.includes("-")}function q(e,t,n,o=!1){if(n==null){e.removeAttribute(t);return}if(he(e)){e[t]=n;return}S(e,t,n,o)}var B=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]);function S(e,t,n,o=!1){if(n==null||n===!1){e.removeAttribute(t);return}if(n===!0){e.setAttribute(t,"");return}if(typeof n=="object"){e.setAttribute(t,JSON.stringify(n));return}e.setAttribute(t,String(n))}var Fe=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;var Z="1.0.0-alpha.83";import{VERSION as be}from"@fluixi/reactive/version";var x={dom:Z,reactive:be};function Q(e){x.core&&e.setAttribute("fluixi",x.core),e.setAttribute("fx-dom",x.dom),e.setAttribute("fx-reactive",x.reactive),typeof globalThis<"u"&&(globalThis.Fluixi=x)}function ee(){let e=[x.core,x.dom,x.reactive].filter(t=>t!==void 0);new Set(e).size<=1||console.warn(`[fluixi] package versions disagree — core ${x.core??"(absent)"}, dom ${x.dom}, reactive ${x.reactive}. These ship as one release, so a mismatch usually means a stale lockfile or two copies resolved side by side. Reinstall, or check for duplicates with \`pnpm why @fluixi/dom\`.`)}function E(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}import{batch as ae,createEffect as L,createRenderEffect as y,createRoot as we,onCleanup as A,readChildren as Se,reportReactiveBinding as h,reportReactiveDirective as b,untrack as ve}from"@fluixi/reactive/signal";var z=Symbol.for("fluixi.server-node"),Ee=Symbol.for("fluixi.dom.server-host"),Ne=globalThis,G=Ne[Ee]??={server:typeof document>"u",nodes:null};function C(){return G.server}function M(){if(!G.nodes)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return G.nodes}function P(e){return e!=null&&e[z]===!0?!0:typeof Node<"u"&&e instanceof Node}function te(e){return e!=null&&e[z]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function ne(e){return e!=null&&e[z]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var d={active:!1,cursor:null,parents:[]},Te=null;function R(){return Te}function X(e,t){return d.active&&t.parentNode===e}function oe(e){let t=d.parents.lastIndexOf(e);t!==-1&&(d.parents.length=t),d.cursor=e.nextSibling}function J(e,t){if(!e||e.parentNode==null)return t();let n=d.active,o=d.cursor,i=d.parents;d.active=!0,d.cursor=e,d.parents=[];try{return t()}finally{d.active=n,d.cursor=o,d.parents=i}}function Ae(e){let t=[];for(;e&&e.nodeType===1;){let n=e.tagName.toLowerCase();if(e.id){n+=`#${e.id}`,t.unshift(n);break}e.getAttribute("data-id")&&(n+=`[data-id="${e.getAttribute("data-id")}"]`);let o=0,i=e;for(;i=i.previousElementSibling;)i.tagName===e.tagName&&o++;n+=`:nth-of-type(${o+1})`,t.unshift(n),e=e.parentElement}return t.join(">")}function Ce(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return`el_${Math.abs(t)}`}function et(e){return Ce(Ae(e))}var tt=()=>"xxyxxxxxxy-4xx8".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),Pe={};var H="__fx_at",le="__fx_loc";function ie(e,t){return t&&(e[le]=t),e}var re=new Map,k=new Set,V=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function ue(e){if(!C())for(let t of e)k.has(t)||V.has(t)||(k.add(t),document.addEventListener(t,Le))}function Le(e){let t=`$$${e.type}`,n=e.composedPath&&e.composedPath()[0]||e.target;for(;n;){let o=n[t];if(o&&!n.disabled&&(o(e),e.cancelBubble))return;n=n.host&&n.host!==n&&n.host instanceof Element?n.host:n.parentNode}}function Me(e,t,n){if(e[`$$${t}`]=n,V.has(t)){let o=`__fx_${t}`;if(!e[o]){let i=a=>{e[`$$${t}`]?.(a)};e.addEventListener(t,i),e[o]=i}return}k.has(t)||ue([t])}function se(e,t){delete e[`$$${t}`];let n=`__fx_${t}`,o=e[n];o&&(e.removeEventListener(t,o),delete e[n])}function nt(e){return!V.has(e)}function ot(e){return typeof e=="function"}function w(e,t=!1){if(C())return M().createText(e);if(d.active&&!t){let n=R()?.hydrateText(e);if(n)return n}return document.createTextNode(e)}function it(e,t=!1,n){if(C())return M().createElement(e,t);if(d.active){let o=R()?.hydrateElement(e);if(o)return n?ie(o,n):o}return ie(t?document.createElementNS(K,e):document.createElement(e),n)}function Re(e,t=!1){let n=re.get(e);if(n)return n;let o=document.createElement("template");return t?o.innerHTML=`<svg>${e}</svg>`:o.innerHTML=e,re.set(e,o),o}function rt(e,t,n=!1,o=!1,i){if(C()){let a=M();return n?a.parseTemplate(e,o):a.createRaw(e)}if(d.active){let a=R()?.hydrateStatic(t);if(a)return fe(a,i)}return fe(He(Re(e,o),o).firstChild,i)}function fe(e,t){let n=e;if(!t||typeof n?.querySelectorAll!="function")return e;let o=[n,...n.querySelectorAll("*")];for(let i=0;i<o.length&&i*2+1<t.pos.length;i++){let a=t.pos[i*2];a&&(o[i][le]={file:t.file,line:a,column:t.pos[i*2+1]})}return e}function st(e,t){if(!d.active)return t();let n=J(e.nextSibling,t);if(typeof n=="function"){let o=n;return Oe(o,(...a)=>d.active?J(e.nextSibling,()=>o(...a)):o(...a))}return n}function Oe(e,t){let n=e[H];return n!==void 0&&(t[H]=n),t}function ft(e){for(let t=e.nextSibling;t;t=t.nextSibling)if(t.nodeType===8&&t.data==="fx/")return t;throw new Error("[fluixi] template hole is missing its closing marker")}function at(e,t){let n=[];for(let o=e.nextSibling;o&&o!==t;o=o.nextSibling)n.push(o);return n}function He(e,t=!1){let n=e.content.cloneNode(!0);return t?n.firstChild:n}function ke(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?ke(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}function lt(e){return typeof e!="function"?null:e._name||e.name||"anonymous"}function ut(e){if(m(e)||E(e)||typeof e!="function")return e;let t=e();for(;typeof t=="function"&&!m(t)&&!E(t);)t=t();return t}var T=0,je=200;function _e(e,t,n,o,i){let a=o,f=new Map;return y(()=>{h(n??t,"content",void 0,e);let s;if(E(e)&&!m(e)){if(!f.has(e)){T++;try{let r=e();f.set(e,r)}finally{T--}}for(s=f.get(e);typeof s=="function"&&m(s);)s=s()}else for(s=e();typeof s=="function"&&m(s);)s=s();{let r=0;for(;typeof s=="function"&&r++<50;)if(E(s)){if(!f.has(s)){let l=s;T++;try{let u=l();f.set(l,u)}finally{T--}}s=f.get(s)}else if(m(s))s=s();else if(s=s(),typeof s!="function"||!m(s)&&!E(s))break}T++;try{a=j(t,s,n,a,f),i(a)}finally{T--}})}function ce(e,t,n,o){if(T>je)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;n!==void 0&&!n&&(n=w("",!0),e.appendChild(n));let i=o??null,a=r=>Array.isArray(r)&&r.some(l=>typeof l=="function"),f=r=>typeof r=="function"?r:()=>r;if(typeof t!="function"&&!a(t)){T++;try{i=j(e,t,n,i)}finally{T--}return()=>i}let s=_e(f(t),e,n,i,r=>{i=r});return()=>(s?.(),i)}function j(e,t,n,o,i){if(t==null||typeof t=="boolean")return v(e,o,n);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return v(e,o,n);if(O(t)){let f=w("",!0);return Array.isArray(o)?o.length>0?(e.replaceChild(f,o[0]),v(e,o.slice(1),n)):g(e,f,n):o?e.replaceChild(f,o):g(e,f,n),t.then(s=>{f.parentNode===e&&j(e,s,f.nextSibling,f)}).catch(s=>{console.error("Error resolving promise in insertExpression:",s)}),f}let a=typeof t;if(a==="string"||a==="number"){if(a==="number"&&(t=String(t)),Array.isArray(o)){if(o.length===0){let s=w(t);return g(e,s,n),s}if(o.length===1&&o[0].nodeType===3)return o[0].data=t,o;o=v(e,o,n)}if(o&&ne(o))return o.data=t,o;let f=w(t);return o&&o.parentNode===e?e.replaceChild(f,o):X(e,f)||g(e,f,n),f}if(P(t))return X(e,t)?(oe(t),t):Array.isArray(o)?(o.length===0?g(e,t,n):o[0].parentNode===e?(e.replaceChild(t,o[0]),v(e,o.slice(1),n)):g(e,t,n),t):(o?o!==t&&(o.parentNode===e?e.replaceChild(t,o):g(e,t,n)):g(e,t,n),t);if(Array.isArray(t)){let f=[],s=Array.isArray(o)?o:o?[o]:[],r=[];N(t,f,e,n,!0,i,r);let l=$e(e,s,f,n);for(let u of r){let c=ce(e,u.sig,u.marker);A(()=>{v(e,c()),u.marker.parentNode===e&&e.removeChild(u.marker)})}return l}if(a==="object"&&t!==null&&typeof t=="object"){let f=t;if("type"in f&&"props"in f){let s=f;if(typeof s.type=="function"){let r=s.type(s.props||{});return j(e,r,n,o)}}}return v(e,o,n)}function N(e,t,n,o,i=!0,a,f){for(let s=0;s<e.length;s++){let r=e[s];if(!(r==null||typeof r=="boolean")){for(;typeof r=="function"&&!O(r)&&!m(r)&&!E(r)&&(r=r(),!(r==null||typeof r=="boolean")););if(!(r==null||typeof r=="boolean")){if(typeof r=="function"){let l;for(E(r)&&!m(r)?(a||(a=new Map),a.has(r)||a.set(r,r()),l=a.get(r)):l=r();typeof l=="function"&&!O(l)&&!m(l)&&!E(l);)a||(a=new Map),a.has(l)||a.set(l,l()),l=a.get(l);if(l==null||typeof l=="boolean")continue;if(typeof l=="function"){if(m(l)){if(f){let c=w("",!0);t.push(c),f.push({marker:c,sig:l});continue}let u=l();for(;typeof u=="function"&&m(u);)u=u();if(u==null||typeof u=="boolean")continue;Array.isArray(u)?N(u,t,n,o,i,a):N([u],t,n,o,i,a);continue}continue}Array.isArray(l)?N(l,t,n,o,i,a,f):N([l],t,n,o,i,a,f);continue}if(O(r)){let l=w("",!0);t.push(l),r.then(u=>{if(l.parentNode){let c=[];if(N([u],c,l.parentNode,void 0,!1,a),c.length>0){l.parentNode.replaceChild(c[0],l);for(let p=1;p<c.length;p++)l.parentNode?.insertBefore(c[p],c[p-1].nextSibling)}}}).catch(u=>console.error("Error resolving promise in array:",u));continue}if(Array.isArray(r)){N(r,t,n,o,i,a,f);continue}if(P(r)){t.push(r);continue}if(typeof r=="object"&&r!==null&&"type"in r&&"props"in r){let l=r;if(typeof l.type=="function"){let u=l.type(l.props||{});Array.isArray(u)?N(u,t,n,o,!1,a):N([u],t,n,o,!1,a);continue}}if(typeof r=="string"||typeof r=="number"){let l=String(r);if(l.trim()===""&&l!==" ")continue;t.push(w(l));continue}t.push(w(String(r)))}}}}function $e(e,t,n,o){for(let c=0;c<n.length;c++){let p=n[c].parentNode;p!==null&&p!==e&&p.nodeType!==11&&(n=n.slice(),n[c]=n[c].cloneNode(!0))}let i=n.length,a=t.length,f=i,s=0,r=0,l=a>0?t[a-1].nextSibling??void 0:o,u=null;for(;s<a||r<f;){if(t[s]===n[r]){s++,r++;continue}for(;a>s&&f>r&&t[a-1]===n[f-1];)a--,f--;if(a===s){let c=f<i?r?n[r-1].nextSibling??void 0:n[f-r]:l;for(;r<f;)g(e,n[r++],c)}else if(f===r)for(;s<a;)(!u||!u.has(t[s]))&&t[s].parentNode===e&&e.removeChild(t[s]),s++;else if(t[s]===n[f-1]&&n[r]===t[a-1]){let c=t[--a].nextSibling;g(e,n[r++],t[s++].nextSibling),g(e,n[--f],c),t[a]=t[s-1]}else{if(!u){u=new Map;let p=r;for(;p<f;)u.set(n[p],p++)}let c=u.get(t[s]);if(c!=null)if(r<c&&c<f){let p=s,W=1;for(;++p<a&&p<f&&!(!u.has(t[p])||u.get(t[p])!==c+W);)W++;if(W>c-r){let xe=t[s];for(;r<c;)g(e,n[r++],xe)}else t[s].parentNode===e?e.replaceChild(n[r++],t[s++]):(g(e,n[r++],l),s++)}else s++;else t[s].parentNode===e&&e.removeChild(t[s]),s++}}return n}function v(e,t,n){if(t)if(Array.isArray(t))for(let o=0;o<t.length;o++)t[o].parentNode===e&&e.removeChild(t[o]);else t.parentNode===e&&e.removeChild(t);return null}function g(e,t,n){d.active&&t.parentNode===e||(n&&n.parentNode===e?e.insertBefore(t,n):e.appendChild(t))}function _(e,t,n){n==null?delete e[t]:e[t]=n}function de(e,t,n){let o=n,i;return Array.isArray(n)&&(o=n[0],i=n[1]),typeof o!="function"?()=>{}:(e.addEventListener(t,o,i),()=>e.removeEventListener(t,o,i))}function pe(e,t){if(!t||typeof t!="function")return;let n=t[H]?.name;if(!n)return;let o=n.indexOf(":");o!==-1&&b(e,n.slice(0,o),n.slice(o+1),t)}function $(e,t,n){let o=typeof n=="function"?ve(()=>n()):n;if(!(!o||typeof o!="object"))for(let i of Object.keys(o))b(e,t,i)}function ye(e,t){let n=(o,i)=>{typeof o=="function"&&(b(e,"use",o.name||"use",i),o(e,i??(()=>{})))};if(typeof t=="function"){n(t);return}if(Array.isArray(t)){if(typeof t[0]=="function"){n(t[0],t[1]);return}for(let o of t)Array.isArray(o)?n(o[0],o[1]):n(o)}}function U(e,t,n,o=!1){return pe(e,n),typeof n!="function"?(S(e,t,n,o),()=>{}):y(()=>{h(e,"attribute",t,n);let i=typeof n=="function"?n():n;S(e,t,i,o)})}function Y(e,t,n){return typeof n!="function"?(_(e,t,n),()=>{}):(pe(e,n),y(()=>{h(e,"property",t,n);let o=typeof n=="function"?n():n;_(e,t,o)}))}function ge(e,t,n){return typeof n!="function"?(S(e,t,!!n),()=>{}):y(()=>{h(e,"attribute",t,n);let o=n();S(e,t,!!o)})}function F(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){y(()=>{h(e,"attribute","class",t),F(e,t())});return}if(typeof t=="string"){e.setAttribute("class",t);return}if(Array.isArray(t)){e.setAttribute("class",t.filter(Boolean).join(" "));return}if(typeof t=="object"){let n=Object.keys(t).filter(o=>{let i=t[o];return typeof i=="function"?i():!!i}).join(" ");e.setAttribute("class",n);return}e.setAttribute("class",String(t))}function D(e,t,n){if(!(!t||typeof t!="object"))for(let o in t){let i=t[o],a=o.split(/\s+/).filter(Boolean);if(typeof i=="function"&&n)n.push(y(()=>{let f=!!i();for(let s of a)e.classList.toggle(s,f)}));else{let f=!!(typeof i=="function"?i():i);for(let s of a)e.classList.toggle(s,f)}}}function I(e,t){let n=t;for(;typeof n=="function";)n=n();if(n==null){e.removeAttribute("style");return}if(typeof n=="string"){e.style.cssText=n;return}if(typeof n=="object")for(let o in n){let i=n[o];i==null?e.style[o]="":e.style[o]=i}}function ct(e){let{element:t,props:n,prevProps:o=Pe,isSVG:i=!1,skipChildren:a=!1}=e;if(!t||!te(t))return console.error("[spread] Error: element is not a DOM Element!"),()=>{};if(!n)return console.warn("[spread] Warning: props is undefined!"),()=>{};let f=i||t.namespaceURI===K,s=[];for(let r in n){if(a&&r==="children")continue;let l=n[r],u=o[r];if(l===u)continue;if(r==="ref"){me(l,t);continue}if(r==="use"){ye(t,l);continue}if(r.startsWith("on:")){s.push(de(t,r.slice(3),l));continue}if(r.startsWith("prop:")){b(t,"prop",r.slice(5),l),s.push(Y(t,r.slice(5),l));continue}if(r.startsWith("attr:")){b(t,"attr",r.slice(5),l),s.push(U(t,r.slice(5),l,f));continue}if(r.startsWith("bool:")){b(t,"bool",r.slice(5),l),s.push(ge(t,r.slice(5),l));continue}if(r==="class"||r==="className"){typeof l=="function"?s.push(y(()=>{h(t,"attribute","class",l),F(t,l())})):F(t,l);continue}if(r==="classList"){$(t,"class",l),typeof l=="function"?s.push(y(()=>{h(t,"attribute","class",l),D(t,l())})):D(t,l,s);continue}if(r==="style"){$(t,"style",l),typeof l=="function"?s.push(y(()=>{h(t,"attribute","style",l),I(t,l())})):I(t,l);continue}if(r.startsWith("on")){let p=r.slice(2).toLowerCase();u&&se(t,p),l&&Me(t,p,l);continue}let c=B.has(r)||!f&&r in t;typeof l=="function"?s.push(c?Y(t,r,l):U(t,r,l,f)):s.push(y(()=>c?_(t,r,n[r]):S(t,r,n[r],f)))}for(let r in o)if(!(r in n))if(r.startsWith("on")){let l=r.slice(2).toLowerCase();se(t,l)}else B.has(r)?_(t,r,null):t.removeAttribute(r);return()=>{s.forEach(r=>r())}}function dt(e,t,n=!1){for(let o in t){let i=t[o];if(o==="ref"){me(i,e);continue}if(o!=="children"){if(o==="use"){ye(e,i);continue}if(o.startsWith("on:")){de(e,o.slice(3),i);continue}if(o.startsWith("prop:")){b(e,"prop",o.slice(5),i),Y(e,o.slice(5),i);continue}if(o.startsWith("attr:")){b(e,"attr",o.slice(5),i),U(e,o.slice(5),i,n);continue}if(o.startsWith("bool:")){b(e,"bool",o.slice(5),i),ge(e,o.slice(5),i);continue}if(o.startsWith("on")&&o.length>2){let a=o.slice(2).toLowerCase();if(typeof i=="function")if(V.has(a)){e[`$$${a}`]=i;let f=`__fx_${a}`;if(!e[f]){let s=r=>{e[`$$${a}`]?.(r)};e.addEventListener(a,s),e[f]=s}}else e[`$$${a}`]=i,k.has(a)||ue([a]);continue}if(o==="class"||o==="className"){F(e,i);continue}if(o==="classList"){$(e,"class",i),typeof i=="function"?y(()=>{h(e,"attribute","class",i),D(e,i())}):D(e,i);continue}if(o==="style"){$(e,"style",i),typeof i=="function"?y(()=>{h(e,"attribute","style",i),I(e,i())}):I(e,i);continue}if(o==="innerHTML"){if(typeof i=="function"){let a=L(()=>{let f=i();for(;typeof f=="function";)f=f();e.innerHTML=f});A(()=>a())}else e.innerHTML=i;continue}if(o==="value"&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA")){if(typeof i=="function"){let a=L(()=>{let f=i();for(;typeof f=="function"&&f.length===0;)f=f();document.activeElement!==e&&(e.value=f??"")});A(()=>{a()})}else y(()=>{document.activeElement!==e&&(e.value=t[o]??"")});continue}if(o==="checked"&&e.tagName==="INPUT"){if(typeof i=="function"){let a=L(()=>{let f=i();for(;typeof f=="function"&&f.length===0;)f=f();document.activeElement!==e&&(e.checked=f??"")});A(()=>{a()})}else y(()=>{document.activeElement!==e&&(e.checked=t[o]??"")});continue}if(o==="value"&&e.tagName==="SELECT"){if(typeof i=="function"){let a=!0,f=L(()=>{let s=i();for(;typeof s=="function"&&s.length===0;)s=s();a?(a=!1,queueMicrotask(()=>{e.value=s??""})):e.value=s??""});A(()=>{f()})}else{let a=!0;y(()=>{let f=t[o];a?(a=!1,queueMicrotask(()=>{e.value=f??""})):e.value=f??""})}continue}if(typeof i=="function"){let a=L(()=>{let f=i();for(;typeof f=="function"&&f.length===0;)f=f();q(e,o,f,n)});A(()=>{a()})}else y(()=>q(e,o,t[o],n))}}}function pt(...e){let t=o=>{for(let i=e.length-1;i>=0;i--){let a=e[i];if(a&&o in a&&a[o]!==void 0)return a[o]}},n=o=>{for(let i of e)if(i&&o in i)return!0;return!1};return new Proxy({},{get:(o,i)=>t(i),has:(o,i)=>n(i),ownKeys:()=>{let o=new Set;for(let i of e)if(i)for(let a of Reflect.ownKeys(i))o.add(a);return[...o]},getOwnPropertyDescriptor:(o,i)=>n(i)?{enumerable:!0,configurable:!0,get:()=>t(i)}:void 0})}function yt(e,...t){let n=new Set;for(let f of t)for(let s of f)n.add(s);let o=f=>({enumerable:!0,configurable:!0,get:()=>e[f]}),i=t.map(f=>{let s=new Set(f);return new Proxy({},{get:(r,l)=>s.has(l)?e[l]:void 0,has:(r,l)=>s.has(l)&&l in e,ownKeys:()=>Array.from(s).filter(r=>r in e),getOwnPropertyDescriptor:(r,l)=>s.has(l)&&l in e?o(l):void 0})}),a=new Proxy({},{get:(f,s)=>n.has(s)?void 0:e[s],has:(f,s)=>!n.has(s)&&s in e,ownKeys:()=>Reflect.ownKeys(e).filter(f=>!n.has(f)),getOwnPropertyDescriptor:(f,s)=>!n.has(s)&&s in e?o(s):void 0});return[...i,a]}function me(e,t){if(!e)return;let n=e[H]?.name;if(b(t,"ref",n||typeof e=="function"&&e.name||"ref",e),P(e)){let o=t,i=e;if(!o)return;typeof o=="function"?o(i):typeof o=="object"&&"current"in o&&(o.current=i);return}typeof e=="function"?e(t):typeof e=="object"&&"current"in e&&(e.current=t)}function gt(e,t,n){let o=t||document.body,i=Se(()=>e),a=[];return ae(()=>{let f=y(()=>{let s=i();Array.isArray(s)?(s.forEach(r=>o.appendChild(r)),a.push(()=>{s.forEach(r=>{r.parentNode===o&&o.removeChild(r)})})):P(s)&&(o.appendChild(s),a.push(()=>{s.parentNode===o&&o.removeChild(s)}))});a.push(f),A(()=>{a.forEach(s=>s())})}),null}function mt(e){return typeof e=="string"&&e.toLowerCase()===e}function xt(e){return e==="svg"||e==="path"||e==="circle"||e==="rect"||e==="line"||e==="polygon"||e==="polyline"||e==="ellipse"||e==="g"||e==="defs"||e==="clipPath"||e==="text"}function ht(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function O(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function bt(e){return typeof e=="function"&&e.length===0&&m(e)}function Et(e,t,n){if(!t)throw new Error("Container element is required");let o,i,a=[];return we(f=>{ae(()=>{d.active||(t.textContent=""),Q(t),ee(),ce(t,e)}),i=f}),()=>{i?.(),o?.(),a.forEach(f=>f()),t.textContent=""}}function Nt(e){if(Array.isArray(e))return e;if(typeof e=="function"&&typeof e.set=="function")return[e,e.set];throw new TypeError("[fluixi] bind: needs a signal — either `signal(…)` or the `[get, set]` pair from `createSignal(…)`.")}export{Me as addDelegatedEventListener,de as addNativeEventListener,dt as applyProps,ye as applyUse,Nt as bindPair,v as cleanChildren,He as cloneTemplate,it as createNativeElement,gt as createPortal,Re as createTemplate,ue as delegateEvents,ht as escapeHTML,lt as fnName,tt as generateID,et as getStableElementId,me as handleRef,at as holeContent,ft as holeEnd,st as holeScope,ce as insert,j as insertExpression,bt as isAccessor,nt as isDelegatedEvent,ot as isFunction,mt as isNativeElement,O as isPromise,xt as isSVGElement,ut as iterateFn,ke as makeArrayFlat,pt as mergeProps,se as removeDelegatedEventListener,Et as render,D as setClassList,F as setClassName,U as setDynamicAttribute,ge as setDynamicBoolAttribute,Y as setDynamicProperty,_ as setProperty,I as setStyle,yt as splitProps,ct as spread,rt as templateNode};
|