@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
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var _=Object.defineProperty;var xe=Object.getOwnPropertyDescriptor;var ve=Object.getOwnPropertyNames;var Ne=Object.prototype.hasOwnProperty;var we=(e,n)=>{for(var t in n)_(e,t,{get:n[t],enumerable:!0})},Se=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of ve(n))!Ne.call(e,s)&&s!==t&&_(e,s,{get:()=>n[s],enumerable:!(r=xe(n,s))||r.enumerable});return e};var ye=e=>Se(_({},"__esModule",{value:!0}),e);var Me={};we(Me,{FX_DATA_ID:()=>E,ServerComment:()=>v,ServerElement:()=>m,ServerNode:()=>g,ServerText:()=>h,createRequestContext:()=>C,escapeFxJson:()=>O,getLocals:()=>le,getRequestContext:()=>w,getRequestEvent:()=>z,getRequestLocals:()=>X,getServerData:()=>re,isDomElement:()=>B,isDomNode:()=>G,isDomText:()=>K,isServer:()=>S,isServerNodeValue:()=>Y,renderToString:()=>fe,renderToStringAsync:()=>he,runWithRequestContext:()=>q,serializeNode:()=>f,serializeResourceData:()=>J,setDataRedactor:()=>ge,setRequestStore:()=>ue,setServerMode:()=>N});module.exports=ye(Me);var S=typeof document>"u";function N(e){S=e}var b=Symbol.for("fluixi.server-node"),Te=null;function U(e){Te=e}function G(e){return e!=null&&e[b]===!0?!0:typeof Node<"u"&&e instanceof Node}function B(e){return e!=null&&e[b]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function K(e){return e!=null&&e[b]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var k=1,I=3,j=8,Q;Q=b;var g=class{constructor(){this[Q]=!0;this.parentNode=null;this.childNodes=[]}get firstChild(){return this.childNodes[0]??null}get lastChild(){return this.childNodes[this.childNodes.length-1]??null}get nextSibling(){let n=this.parentNode;if(!n)return null;let t=n.childNodes.indexOf(this);return t>=0?n.childNodes[t+1]??null:null}get previousSibling(){let n=this.parentNode;if(!n)return null;let t=n.childNodes.indexOf(this);return t>0?n.childNodes[t-1]??null:null}get parentElement(){return this.parentNode}appendChild(n){return n.parentNode&&n.parentNode.removeChild(n),n.parentNode=this,this.childNodes.push(n),n}insertBefore(n,t){if(t==null)return this.appendChild(n);n.parentNode&&n.parentNode.removeChild(n);let r=this.childNodes.indexOf(t);return n.parentNode=this,r<0?this.childNodes.push(n):this.childNodes.splice(r,0,n),n}removeChild(n){let t=this.childNodes.indexOf(n);return t>=0&&this.childNodes.splice(t,1),n.parentNode=null,n}replaceChild(n,t){let r=this.childNodes.indexOf(t);return r>=0&&(n.parentNode&&n.parentNode.removeChild(n),n.parentNode=this,this.childNodes[r]=n,t.parentNode=null),t}addEventListener(){}removeEventListener(){}},h=class e extends g{constructor(t){super();this.nodeType=I;this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}get textContent(){return this.data}set textContent(t){this.data=t==null?"":String(t)}cloneNode(){return new e(this.data)}},A=class e extends g{constructor(t){super();this.nodeType=k;this.rawOuterHTML=t}get textContent(){return this.rawOuterHTML.replace(/<[^>]*>/g,"")}cloneNode(){return new e(this.rawOuterHTML)}},v=class e extends g{constructor(t){super();this.nodeType=j;this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}cloneNode(){return new e(this.data)}},L=class{constructor(){this.cssText=""}setProperty(n,t){this[n]=t}removeProperty(n){delete this[n]}},$=class{constructor(n){this.el=n}list(){let n=this.el.getAttribute("class");return n?n.split(/\s+/).filter(Boolean):[]}write(n){n.length?this.el.setAttribute("class",n.join(" ")):this.el.removeAttribute("class")}add(...n){let t=this.list();for(let r of n)t.includes(r)||t.push(r);this.write(t)}remove(...n){this.write(this.list().filter(t=>!n.includes(t)))}contains(n){return this.list().includes(n)}toggle(n,t){let r=this.contains(n),s=t===void 0?!r:t;return s?this.add(n):this.remove(n),s}},m=class e extends g{constructor(t,r=!1){super();this.nodeType=k;this.attributes=new Map;this.style=new L;this.classList=new $(this);this.rawHTML=null;this.localName=t.toLowerCase(),this.tagName=r?t:t.toUpperCase(),this.isSVG=r,this.namespaceURI=r?"http://www.w3.org/2000/svg":null}setAttribute(t,r){this.attributes.set(t,String(r))}removeAttribute(t){this.attributes.delete(t)}getAttribute(t){return this.attributes.has(t)?this.attributes.get(t):null}hasAttribute(t){return this.attributes.has(t)}get id(){return this.getAttribute("id")??""}set id(t){t==null?this.removeAttribute("id"):this.setAttribute("id",t)}get className(){return this.getAttribute("class")??""}set className(t){t==null?this.removeAttribute("class"):this.setAttribute("class",t)}get htmlFor(){return this.getAttribute("for")??""}set htmlFor(t){t==null?this.removeAttribute("for"):this.setAttribute("for",t)}set value(t){t==null?this.removeAttribute("value"):this.setAttribute("value",String(t))}set checked(t){t?this.setAttribute("checked",""):this.removeAttribute("checked")}set selected(t){t?this.setAttribute("selected",""):this.removeAttribute("selected")}set indeterminate(t){}get textContent(){return this.childNodes.map(t=>t.textContent??"").join("")}set textContent(t){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=null,t!=null&&t!==""&&this.appendChild(new h(String(t)))}set innerText(t){this.textContent=t}set innerHTML(t){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=t==null?"":String(t)}cloneNode(t=!1){let r=new e(this.localName,this.isSVG);if(r.attributes=new Map(this.attributes),r.style.cssText=this.style.cssText,r.rawHTML=this.rawHTML,t)for(let s of this.childNodes)r.appendChild(s.cloneNode(!0));return r}};function Y(e){return e instanceof g}var Re=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),ee=/&/g,te=/</g,ne=/>/g,be=/"/g;function H(e){return e.replace(ee,"&").replace(te,"<").replace(ne,">")}function Z(e){return e.replace(ee,"&").replace(be,""").replace(te,"<").replace(ne,">")}function Ee(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,n=>"-"+n.toLowerCase())}function Ce(e){if(!e)return"";let n=[];e.cssText&&n.push(e.cssText.trim().replace(/;\s*$/,""));for(let t of Object.keys(e)){if(t==="cssText")continue;let r=e[t];r==null||r===""||n.push(`${Ee(t)}: ${r}`)}return n.join("; ")}function qe(e){let n="",t=Ce(e.style);for(let[r,s]of e.attributes)r==="style"&&t||(n+=` ${r}="${Z(s)}"`);if(t){let r=e.attributes.get("style"),s=r?`${r.replace(/;\s*$/,"")}; ${t}`:t;n+=` style="${Z(s)}"`}return n}function f(e){if(e==null||e===!1||e===!0)return"";if(typeof e=="string")return H(e);if(typeof e=="number")return H(String(e));if(typeof e=="function")return f(e());if(Array.isArray(e))return e.map(f).join("");if(typeof e.rawOuterHTML=="string")return e.rawOuterHTML;switch(e.nodeType){case I:return H(e.data??"");case j:return`<!--${e.data??""}-->`;case k:{let n=e.localName,t=`<${n}${qe(e)}>`;if(Re.has(n))return t;let r=e.rawHTML!=null?e.rawHTML:(e.childNodes??[]).map(f).join("");return`${t}${r}</${n}>`}}return Array.isArray(e.childNodes)?e.childNodes.map(f).join(""):""}var E="__FX_DATA__";function O(e){return e.replace(/[<>&\u2028\u2029]/g,n=>"\\u"+n.charCodeAt(0).toString(16).padStart(4,"0"))}var F;function re(){let e=globalThis.__FX_DATA__;if(e)return e;if(F!==void 0)return F;let n=null;if(typeof document<"u"){let t=document.getElementById(E)?.textContent;if(t)try{n=JSON.parse(t)}catch{n=null}}return F=n}var P=require("@fluixi/reactive/signal"),c=require("@fluixi/reactive/signal");var Ae=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),ke={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'"};function se(e){return e.replace(/&(#?\w+);/g,(n,t)=>ke[t]??n)}var d=class extends Error{};function oe(e,n=!1){let t=0,r=[],s=[],a=o=>{let u=s[s.length-1];u?u.appendChild(o):r.push(o)};for(;t<e.length;){let o=e.indexOf("<",t);if(o===-1){p(e.slice(t));break}if(o>t&&p(e.slice(t,o)),e.startsWith("<!--",o)){let u=e.indexOf("-->",o);if(u===-1)throw new d(`unterminated comment at ${o}`);a(new v(e.slice(o+4,u))),t=u+3;continue}if(e[o+1]==="/"){let u=e.indexOf(">",o);if(u===-1)throw new d(`unterminated closing tag at ${o}`);let T=e.slice(o+2,u).trim().toLowerCase(),x=s.pop();if(!x||x.localName!==T)throw new d(`</${T}> does not close <${x?.localName??"nothing"}>`);t=u+1;continue}t=y(o)}if(s.length>0)throw new d(`unclosed <${s[s.length-1].localName}>`);let l=r[0];if(r.length!==1||!(l instanceof m))throw new d(`expected exactly one root element, got ${r.length}`);return l;function p(o){o!==""&&a(new h(se(o)))}function y(o){let u=/[\s/>]/.exec(e.slice(o+1));if(!u)throw new d(`unterminated tag at ${o}`);let T=e.slice(o+1,o+1+u.index).toLowerCase(),x=new m(T,n),i=o+1+u.index;for(;i<e.length;){for(;i<e.length&&/\s/.test(e[i]);)i++;if(e[i]===">"){i++;break}if(e[i]==="/"&&e[i+1]===">"){i+=2;break}let me=i;for(;i<e.length&&!/[\s=/>]/.test(e[i]);)i++;let R=e.slice(me,i);if(R==="")throw new d(`malformed attribute at ${i}`);if(e[i]==="="){if(e[i+1]!=='"')throw new d(`attribute ${R} must have a double-quoted value`);let M=e.indexOf('"',i+2);if(M===-1)throw new d(`unterminated value for ${R}`);x.setAttribute(R,se(e.slice(i+2,M))),i=M+1}else x.setAttribute(R,"")}return a(x),Ae.has(T)||s.push(x),i}}var D,ae={getStore:()=>D,run(e,n){let t=D;D=e;try{return n()}finally{D=t}}},V=ae;function ue(e){V=e??ae}function C(e={}){e.locals||(e.locals=e.request?X(e.request):{});let n=0,t=0,r=null,s=new Map,a=new Map;return{event:e,routeData:new Map,matchedRoute:new Map,nextId:()=>`s${n++}`,nextResourceId:()=>{if(r===null)return`r${t++}`;let l=s.get(r)??0;return s.set(r,l+1),`${r}:r${l}`},nextIslandNamespace:l=>{let p=a.get(l)??0;return a.set(l,p+1),`${l}#${p}`},withResourceScope(l,p){let y=r;r=l;try{return p()}finally{r=y}},pending:new Set,data:new Map}}function q(e,n){return V.run(e,n)}function w(){return V.getStore()}function z(){return w()?.event}function le(){let e=z();return e?(e.locals||(e.locals={}),e.locals):{}}var ie=new WeakMap;function X(e){let n=ie.get(e);return n||(n={},ie.set(e,n)),n}var ce=!1;function pe(){ce||(ce=!0,U({createElement:(e,n)=>new m(e,n),createText:e=>new h(e),createRaw:e=>new A(e),parseTemplate:(e,n)=>oe(e,n),createComment:e=>new v(e)}))}function fe(e,n={}){let t=S;pe(),N(!0);let r=C(n.event);try{return q(r,()=>(0,P.createRoot)(s=>{try{let a=typeof e=="function"?e():e;return f(a)}finally{s()}}))}finally{N(t)}}var de=!1;function Oe(){de||(de=!0,(0,c.setResourceTracker)(e=>{w()?.pending.add(e)}),(0,c.setResourceIdSource)(()=>w()?.nextResourceId()??""),(0,c.setResourceDataSink)((e,n)=>{e&&w()?.data.set(e,n)}))}var W=null;function ge(e){W=e}function J(e){if(e.data.size===0)return"";let n={};for(let[r,s]of e.data){let a=s;if(W)try{a=W(s,r)}catch{continue}a!==void 0&&(typeof a=="function"||typeof a=="symbol"||(n[r]=a))}if(Object.keys(n).length===0)return"";let t=O(JSON.stringify(n));return t==="{}"?"":`<script type="application/json" id="${E}">${t}<\/script>`}var De=50;async function he(e,n={}){let t=S;pe(),N(!0),Oe();let r=C(n.event);try{return await q(r,async()=>{n.preload&&await n.preload(n.event);let s,a=null,l=()=>{};(0,P.createRoot)(u=>{l=u,a=(0,c.getOwner)(),s=typeof e=="function"?e():e});let p=()=>{try{(0,c.runWithOwner)(a,()=>f(s))}catch{}};p();let y=0;for(;r.pending.size>0&&y++<De;){let u=Array.from(r.pending);r.pending.clear(),await Promise.allSettled(u),await(0,c.flush)(),p()}let o=(0,c.runWithOwner)(a,()=>f(s))+J(r);return l(),o})}finally{N(t)}}
|
|
1
|
+
"use strict";var L=Object.defineProperty;var ve=Object.getOwnPropertyDescriptor;var Ne=Object.getOwnPropertyNames;var Se=Object.prototype.hasOwnProperty;var we=(e,n)=>{for(var t in n)L(e,t,{get:n[t],enumerable:!0})},ye=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of Ne(n))!Se.call(e,s)&&s!==t&&L(e,s,{get:()=>n[s],enumerable:!(r=ve(n,s))||r.enumerable});return e};var Te=e=>ye(L({},"__esModule",{value:!0}),e);var _e={};we(_e,{FX_DATA_ID:()=>E,ServerComment:()=>v,ServerElement:()=>m,ServerNode:()=>g,ServerText:()=>h,createRequestContext:()=>C,escapeFxJson:()=>O,getLocals:()=>ce,getRequestContext:()=>S,getRequestEvent:()=>X,getRequestLocals:()=>P,getServerData:()=>se,isDomElement:()=>K,isDomNode:()=>B,isDomText:()=>Q,isServer:()=>R,isServerNodeValue:()=>Z,renderToString:()=>ge,renderToStringAsync:()=>me,runWithRequestContext:()=>q,serializeNode:()=>f,serializeResourceData:()=>U,setDataRedactor:()=>he,setRequestStore:()=>le,setServerMode:()=>N});module.exports=Te(_e);var b=Symbol.for("fluixi.server-node"),be=Symbol.for("fluixi.dom.server-host"),Re=globalThis,_=Re[be]??={server:typeof document>"u",nodes:null};function R(){return _.server}function N(e){_.server=e}function G(e){_.nodes=e}function B(e){return e!=null&&e[b]===!0?!0:typeof Node<"u"&&e instanceof Node}function K(e){return e!=null&&e[b]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function Q(e){return e!=null&&e[b]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var k=1,I=3,j=8,Y;Y=b;var g=class{constructor(){this[Y]=!0;this.parentNode=null;this.childNodes=[]}get firstChild(){return this.childNodes[0]??null}get lastChild(){return this.childNodes[this.childNodes.length-1]??null}get nextSibling(){let n=this.parentNode;if(!n)return null;let t=n.childNodes.indexOf(this);return t>=0?n.childNodes[t+1]??null:null}get previousSibling(){let n=this.parentNode;if(!n)return null;let t=n.childNodes.indexOf(this);return t>0?n.childNodes[t-1]??null:null}get parentElement(){return this.parentNode}appendChild(n){return n.parentNode&&n.parentNode.removeChild(n),n.parentNode=this,this.childNodes.push(n),n}insertBefore(n,t){if(t==null)return this.appendChild(n);n.parentNode&&n.parentNode.removeChild(n);let r=this.childNodes.indexOf(t);return n.parentNode=this,r<0?this.childNodes.push(n):this.childNodes.splice(r,0,n),n}removeChild(n){let t=this.childNodes.indexOf(n);return t>=0&&this.childNodes.splice(t,1),n.parentNode=null,n}replaceChild(n,t){let r=this.childNodes.indexOf(t);return r>=0&&(n.parentNode&&n.parentNode.removeChild(n),n.parentNode=this,this.childNodes[r]=n,t.parentNode=null),t}addEventListener(){}removeEventListener(){}},h=class e extends g{constructor(t){super();this.nodeType=I;this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}get textContent(){return this.data}set textContent(t){this.data=t==null?"":String(t)}cloneNode(){return new e(this.data)}},A=class e extends g{constructor(t){super();this.nodeType=k;this.rawOuterHTML=t}get textContent(){return this.rawOuterHTML.replace(/<[^>]*>/g,"")}cloneNode(){return new e(this.rawOuterHTML)}},v=class e extends g{constructor(t){super();this.nodeType=j;this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}cloneNode(){return new e(this.data)}},$=class{constructor(){this.cssText=""}setProperty(n,t){this[n]=t}removeProperty(n){delete this[n]}},H=class{constructor(n){this.el=n}list(){let n=this.el.getAttribute("class");return n?n.split(/\s+/).filter(Boolean):[]}write(n){n.length?this.el.setAttribute("class",n.join(" ")):this.el.removeAttribute("class")}add(...n){let t=this.list();for(let r of n)t.includes(r)||t.push(r);this.write(t)}remove(...n){this.write(this.list().filter(t=>!n.includes(t)))}contains(n){return this.list().includes(n)}toggle(n,t){let r=this.contains(n),s=t===void 0?!r:t;return s?this.add(n):this.remove(n),s}},m=class e extends g{constructor(t,r=!1){super();this.nodeType=k;this.attributes=new Map;this.style=new $;this.classList=new H(this);this.rawHTML=null;this.localName=t.toLowerCase(),this.tagName=r?t:t.toUpperCase(),this.isSVG=r,this.namespaceURI=r?"http://www.w3.org/2000/svg":null}setAttribute(t,r){this.attributes.set(t,String(r))}removeAttribute(t){this.attributes.delete(t)}getAttribute(t){return this.attributes.has(t)?this.attributes.get(t):null}hasAttribute(t){return this.attributes.has(t)}get id(){return this.getAttribute("id")??""}set id(t){t==null?this.removeAttribute("id"):this.setAttribute("id",t)}get className(){return this.getAttribute("class")??""}set className(t){t==null?this.removeAttribute("class"):this.setAttribute("class",t)}get htmlFor(){return this.getAttribute("for")??""}set htmlFor(t){t==null?this.removeAttribute("for"):this.setAttribute("for",t)}set value(t){t==null?this.removeAttribute("value"):this.setAttribute("value",String(t))}set checked(t){t?this.setAttribute("checked",""):this.removeAttribute("checked")}set selected(t){t?this.setAttribute("selected",""):this.removeAttribute("selected")}set indeterminate(t){}get textContent(){return this.childNodes.map(t=>t.textContent??"").join("")}set textContent(t){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=null,t!=null&&t!==""&&this.appendChild(new h(String(t)))}set innerText(t){this.textContent=t}set innerHTML(t){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=t==null?"":String(t)}cloneNode(t=!1){let r=new e(this.localName,this.isSVG);if(r.attributes=new Map(this.attributes),r.style.cssText=this.style.cssText,r.rawHTML=this.rawHTML,t)for(let s of this.childNodes)r.appendChild(s.cloneNode(!0));return r}};function Z(e){return e instanceof g}var Ee=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),te=/&/g,ne=/</g,re=/>/g,Ce=/"/g;function F(e){return e.replace(te,"&").replace(ne,"<").replace(re,">")}function ee(e){return e.replace(te,"&").replace(Ce,""").replace(ne,"<").replace(re,">")}function qe(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,n=>"-"+n.toLowerCase())}function Ae(e){if(!e)return"";let n=[];e.cssText&&n.push(e.cssText.trim().replace(/;\s*$/,""));for(let t of Object.keys(e)){if(t==="cssText")continue;let r=e[t];r==null||r===""||n.push(`${qe(t)}: ${r}`)}return n.join("; ")}function ke(e){let n="",t=Ae(e.style);for(let[r,s]of e.attributes)r==="style"&&t||(n+=` ${r}="${ee(s)}"`);if(t){let r=e.attributes.get("style"),s=r?`${r.replace(/;\s*$/,"")}; ${t}`:t;n+=` style="${ee(s)}"`}return n}function f(e){if(e==null||e===!1||e===!0)return"";if(typeof e=="string")return F(e);if(typeof e=="number")return F(String(e));if(typeof e=="function")return f(e());if(Array.isArray(e))return e.map(f).join("");if(typeof e.rawOuterHTML=="string")return e.rawOuterHTML;switch(e.nodeType){case I:return F(e.data??"");case j:return`<!--${e.data??""}-->`;case k:{let n=e.localName,t=`<${n}${ke(e)}>`;if(Ee.has(n))return t;let r=e.rawHTML!=null?e.rawHTML:(e.childNodes??[]).map(f).join("");return`${t}${r}</${n}>`}}return Array.isArray(e.childNodes)?e.childNodes.map(f).join(""):""}var E="__FX_DATA__";function O(e){return e.replace(/[<>&\u2028\u2029]/g,n=>"\\u"+n.charCodeAt(0).toString(16).padStart(4,"0"))}var V;function se(){let e=globalThis.__FX_DATA__;if(e)return e;if(V!==void 0)return V;let n=null;if(typeof document<"u"){let t=document.getElementById(E)?.textContent;if(t)try{n=JSON.parse(t)}catch{n=null}}return V=n}var J=require("@fluixi/reactive/signal"),c=require("@fluixi/reactive/signal");var Oe=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),De={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'"};function oe(e){return e.replace(/&(#?\w+);/g,(n,t)=>De[t]??n)}var d=class extends Error{};function ie(e,n=!1){let t=0,r=[],s=[],a=o=>{let u=s[s.length-1];u?u.appendChild(o):r.push(o)};for(;t<e.length;){let o=e.indexOf("<",t);if(o===-1){p(e.slice(t));break}if(o>t&&p(e.slice(t,o)),e.startsWith("<!--",o)){let u=e.indexOf("-->",o);if(u===-1)throw new d(`unterminated comment at ${o}`);a(new v(e.slice(o+4,u))),t=u+3;continue}if(e[o+1]==="/"){let u=e.indexOf(">",o);if(u===-1)throw new d(`unterminated closing tag at ${o}`);let y=e.slice(o+2,u).trim().toLowerCase(),x=s.pop();if(!x||x.localName!==y)throw new d(`</${y}> does not close <${x?.localName??"nothing"}>`);t=u+1;continue}t=w(o)}if(s.length>0)throw new d(`unclosed <${s[s.length-1].localName}>`);let l=r[0];if(r.length!==1||!(l instanceof m))throw new d(`expected exactly one root element, got ${r.length}`);return l;function p(o){o!==""&&a(new h(oe(o)))}function w(o){let u=/[\s/>]/.exec(e.slice(o+1));if(!u)throw new d(`unterminated tag at ${o}`);let y=e.slice(o+1,o+1+u.index).toLowerCase(),x=new m(y,n),i=o+1+u.index;for(;i<e.length;){for(;i<e.length&&/\s/.test(e[i]);)i++;if(e[i]===">"){i++;break}if(e[i]==="/"&&e[i+1]===">"){i+=2;break}let xe=i;for(;i<e.length&&!/[\s=/>]/.test(e[i]);)i++;let T=e.slice(xe,i);if(T==="")throw new d(`malformed attribute at ${i}`);if(e[i]==="="){if(e[i+1]!=='"')throw new d(`attribute ${T} must have a double-quoted value`);let M=e.indexOf('"',i+2);if(M===-1)throw new d(`unterminated value for ${T}`);x.setAttribute(T,oe(e.slice(i+2,M))),i=M+1}else x.setAttribute(T,"")}return a(x),Oe.has(y)||s.push(x),i}}var D,ue={getStore:()=>D,run(e,n){let t=D;D=e;try{return n()}finally{D=t}}},z=ue;function le(e){z=e??ue}function C(e={}){e.locals||(e.locals=e.request?P(e.request):{});let n=0,t=0,r=null,s=new Map,a=new Map;return{event:e,routeData:new Map,matchedRoute:new Map,nextId:()=>`s${n++}`,nextResourceId:()=>{if(r===null)return`r${t++}`;let l=s.get(r)??0;return s.set(r,l+1),`${r}:r${l}`},nextIslandNamespace:l=>{let p=a.get(l)??0;return a.set(l,p+1),`${l}#${p}`},withResourceScope(l,p){let w=r;r=l;try{return p()}finally{r=w}},pending:new Set,data:new Map}}function q(e,n){return z.run(e,n)}function S(){return z.getStore()}function X(){return S()?.event}function ce(){let e=X();return e?(e.locals||(e.locals={}),e.locals):{}}var ae=new WeakMap;function P(e){let n=ae.get(e);return n||(n={},ae.set(e,n)),n}var de=!1;function fe(){de||(de=!0,G({createElement:(e,n)=>new m(e,n),createText:e=>new h(e),createRaw:e=>new A(e),parseTemplate:(e,n)=>ie(e,n),createComment:e=>new v(e)}))}function ge(e,n={}){let t=R();fe(),N(!0);let r=C(n.event);try{return q(r,()=>(0,J.createRoot)(s=>{try{let a=typeof e=="function"?e():e;return f(a)}finally{s()}}))}finally{N(t)}}var pe=!1;function Me(){pe||(pe=!0,(0,c.setResourceTracker)(e=>{S()?.pending.add(e)}),(0,c.setResourceIdSource)(()=>S()?.nextResourceId()??""),(0,c.setResourceDataSink)((e,n)=>{e&&S()?.data.set(e,n)}))}var W=null;function he(e){W=e}function U(e){if(e.data.size===0)return"";let n={};for(let[r,s]of e.data){let a=s;if(W)try{a=W(s,r)}catch{continue}a!==void 0&&(typeof a=="function"||typeof a=="symbol"||(n[r]=a))}if(Object.keys(n).length===0)return"";let t=O(JSON.stringify(n));return t==="{}"?"":`<script type="application/json" id="${E}">${t}<\/script>`}var Le=50;async function me(e,n={}){let t=R();fe(),N(!0),Me();let r=C(n.event);try{return await q(r,async()=>{n.preload&&await n.preload(n.event);let s,a=null,l=()=>{};(0,J.createRoot)(u=>{l=u,a=(0,c.getOwner)(),s=typeof e=="function"?e():e});let p=()=>{try{(0,c.runWithOwner)(a,()=>f(s))}catch{}};p();let w=0;for(;r.pending.size>0&&w++<Le;){let u=Array.from(r.pending);r.pending.clear(),await Promise.allSettled(u),await(0,c.flush)(),p()}let o=(0,c.runWithOwner)(a,()=>f(s))+U(r);return l(),o})}finally{N(t)}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var T=typeof document>"u";function v(e){T=e}var R=Symbol.for("fluixi.server-node"),ie=null;function V(e){ie=e}function ae(e){return e!=null&&e[R]===!0?!0:typeof Node<"u"&&e instanceof Node}function ue(e){return e!=null&&e[R]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function le(e){return e!=null&&e[R]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var E=1,_=3,L=8,z;z=R;var g=class{constructor(){this[z]=!0;this.parentNode=null;this.childNodes=[]}get firstChild(){return this.childNodes[0]??null}get lastChild(){return this.childNodes[this.childNodes.length-1]??null}get nextSibling(){let n=this.parentNode;if(!n)return null;let t=n.childNodes.indexOf(this);return t>=0?n.childNodes[t+1]??null:null}get previousSibling(){let n=this.parentNode;if(!n)return null;let t=n.childNodes.indexOf(this);return t>0?n.childNodes[t-1]??null:null}get parentElement(){return this.parentNode}appendChild(n){return n.parentNode&&n.parentNode.removeChild(n),n.parentNode=this,this.childNodes.push(n),n}insertBefore(n,t){if(t==null)return this.appendChild(n);n.parentNode&&n.parentNode.removeChild(n);let r=this.childNodes.indexOf(t);return n.parentNode=this,r<0?this.childNodes.push(n):this.childNodes.splice(r,0,n),n}removeChild(n){let t=this.childNodes.indexOf(n);return t>=0&&this.childNodes.splice(t,1),n.parentNode=null,n}replaceChild(n,t){let r=this.childNodes.indexOf(t);return r>=0&&(n.parentNode&&n.parentNode.removeChild(n),n.parentNode=this,this.childNodes[r]=n,t.parentNode=null),t}addEventListener(){}removeEventListener(){}},h=class e extends g{constructor(t){super();this.nodeType=_;this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}get textContent(){return this.data}set textContent(t){this.data=t==null?"":String(t)}cloneNode(){return new e(this.data)}},b=class e extends g{constructor(t){super();this.nodeType=E;this.rawOuterHTML=t}get textContent(){return this.rawOuterHTML.replace(/<[^>]*>/g,"")}cloneNode(){return new e(this.rawOuterHTML)}},x=class e extends g{constructor(t){super();this.nodeType=L;this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}cloneNode(){return new e(this.data)}},D=class{constructor(){this.cssText=""}setProperty(n,t){this[n]=t}removeProperty(n){delete this[n]}},M=class{constructor(n){this.el=n}list(){let n=this.el.getAttribute("class");return n?n.split(/\s+/).filter(Boolean):[]}write(n){n.length?this.el.setAttribute("class",n.join(" ")):this.el.removeAttribute("class")}add(...n){let t=this.list();for(let r of n)t.includes(r)||t.push(r);this.write(t)}remove(...n){this.write(this.list().filter(t=>!n.includes(t)))}contains(n){return this.list().includes(n)}toggle(n,t){let r=this.contains(n),s=t===void 0?!r:t;return s?this.add(n):this.remove(n),s}},m=class e extends g{constructor(t,r=!1){super();this.nodeType=E;this.attributes=new Map;this.style=new D;this.classList=new M(this);this.rawHTML=null;this.localName=t.toLowerCase(),this.tagName=r?t:t.toUpperCase(),this.isSVG=r,this.namespaceURI=r?"http://www.w3.org/2000/svg":null}setAttribute(t,r){this.attributes.set(t,String(r))}removeAttribute(t){this.attributes.delete(t)}getAttribute(t){return this.attributes.has(t)?this.attributes.get(t):null}hasAttribute(t){return this.attributes.has(t)}get id(){return this.getAttribute("id")??""}set id(t){t==null?this.removeAttribute("id"):this.setAttribute("id",t)}get className(){return this.getAttribute("class")??""}set className(t){t==null?this.removeAttribute("class"):this.setAttribute("class",t)}get htmlFor(){return this.getAttribute("for")??""}set htmlFor(t){t==null?this.removeAttribute("for"):this.setAttribute("for",t)}set value(t){t==null?this.removeAttribute("value"):this.setAttribute("value",String(t))}set checked(t){t?this.setAttribute("checked",""):this.removeAttribute("checked")}set selected(t){t?this.setAttribute("selected",""):this.removeAttribute("selected")}set indeterminate(t){}get textContent(){return this.childNodes.map(t=>t.textContent??"").join("")}set textContent(t){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=null,t!=null&&t!==""&&this.appendChild(new h(String(t)))}set innerText(t){this.textContent=t}set innerHTML(t){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=t==null?"":String(t)}cloneNode(t=!1){let r=new e(this.localName,this.isSVG);if(r.attributes=new Map(this.attributes),r.style.cssText=this.style.cssText,r.rawHTML=this.rawHTML,t)for(let s of this.childNodes)r.appendChild(s.cloneNode(!0));return r}};function ce(e){return e instanceof g}var de=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),W=/&/g,P=/</g,J=/>/g,pe=/"/g;function $(e){return e.replace(W,"&").replace(P,"<").replace(J,">")}function X(e){return e.replace(W,"&").replace(pe,""").replace(P,"<").replace(J,">")}function fe(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,n=>"-"+n.toLowerCase())}function ge(e){if(!e)return"";let n=[];e.cssText&&n.push(e.cssText.trim().replace(/;\s*$/,""));for(let t of Object.keys(e)){if(t==="cssText")continue;let r=e[t];r==null||r===""||n.push(`${fe(t)}: ${r}`)}return n.join("; ")}function he(e){let n="",t=ge(e.style);for(let[r,s]of e.attributes)r==="style"&&t||(n+=` ${r}="${X(s)}"`);if(t){let r=e.attributes.get("style"),s=r?`${r.replace(/;\s*$/,"")}; ${t}`:t;n+=` style="${X(s)}"`}return n}function p(e){if(e==null||e===!1||e===!0)return"";if(typeof e=="string")return $(e);if(typeof e=="number")return $(String(e));if(typeof e=="function")return p(e());if(Array.isArray(e))return e.map(p).join("");if(typeof e.rawOuterHTML=="string")return e.rawOuterHTML;switch(e.nodeType){case _:return $(e.data??"");case L:return`<!--${e.data??""}-->`;case E:{let n=e.localName,t=`<${n}${he(e)}>`;if(de.has(n))return t;let r=e.rawHTML!=null?e.rawHTML:(e.childNodes??[]).map(p).join("");return`${t}${r}</${n}>`}}return Array.isArray(e.childNodes)?e.childNodes.map(p).join(""):""}var C="__FX_DATA__";function j(e){return e.replace(/[<>&\u2028\u2029]/g,n=>"\\u"+n.charCodeAt(0).toString(16).padStart(4,"0"))}var I;function me(){let e=globalThis.__FX_DATA__;if(e)return e;if(I!==void 0)return I;let n=null;if(typeof document<"u"){let t=document.getElementById(C)?.textContent;if(t)try{n=JSON.parse(t)}catch{n=null}}return I=n}import{createRoot as ne}from"@fluixi/reactive/signal";import{setResourceTracker as Se,setResourceIdSource as ye,setResourceDataSink as Te,getOwner as Re,runWithOwner as Z,flush as be}from"@fluixi/reactive/signal";var xe=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),ve={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'"};function U(e){return e.replace(/&(#?\w+);/g,(n,t)=>ve[t]??n)}var c=class extends Error{};function G(e,n=!1){let t=0,r=[],s=[],a=o=>{let u=s[s.length-1];u?u.appendChild(o):r.push(o)};for(;t<e.length;){let o=e.indexOf("<",t);if(o===-1){d(e.slice(t));break}if(o>t&&d(e.slice(t,o)),e.startsWith("<!--",o)){let u=e.indexOf("-->",o);if(u===-1)throw new c(`unterminated comment at ${o}`);a(new x(e.slice(o+4,u))),t=u+3;continue}if(e[o+1]==="/"){let u=e.indexOf(">",o);if(u===-1)throw new c(`unterminated closing tag at ${o}`);let S=e.slice(o+2,u).trim().toLowerCase(),f=s.pop();if(!f||f.localName!==S)throw new c(`</${S}> does not close <${f?.localName??"nothing"}>`);t=u+1;continue}t=w(o)}if(s.length>0)throw new c(`unclosed <${s[s.length-1].localName}>`);let l=r[0];if(r.length!==1||!(l instanceof m))throw new c(`expected exactly one root element, got ${r.length}`);return l;function d(o){o!==""&&a(new h(U(o)))}function w(o){let u=/[\s/>]/.exec(e.slice(o+1));if(!u)throw new c(`unterminated tag at ${o}`);let S=e.slice(o+1,o+1+u.index).toLowerCase(),f=new m(S,n),i=o+1+u.index;for(;i<e.length;){for(;i<e.length&&/\s/.test(e[i]);)i++;if(e[i]===">"){i++;break}if(e[i]==="/"&&e[i+1]===">"){i+=2;break}let oe=i;for(;i<e.length&&!/[\s=/>]/.test(e[i]);)i++;let y=e.slice(oe,i);if(y==="")throw new c(`malformed attribute at ${i}`);if(e[i]==="="){if(e[i+1]!=='"')throw new c(`attribute ${y} must have a double-quoted value`);let O=e.indexOf('"',i+2);if(O===-1)throw new c(`unterminated value for ${y}`);f.setAttribute(y,U(e.slice(i+2,O))),i=O+1}else f.setAttribute(y,"")}return a(f),xe.has(S)||s.push(f),i}}var q,K={getStore:()=>q,run(e,n){let t=q;q=e;try{return n()}finally{q=t}}},H=K;function Ne(e){H=e??K}function A(e={}){e.locals||(e.locals=e.request?Y(e.request):{});let n=0,t=0,r=null,s=new Map,a=new Map;return{event:e,routeData:new Map,matchedRoute:new Map,nextId:()=>`s${n++}`,nextResourceId:()=>{if(r===null)return`r${t++}`;let l=s.get(r)??0;return s.set(r,l+1),`${r}:r${l}`},nextIslandNamespace:l=>{let d=a.get(l)??0;return a.set(l,d+1),`${l}#${d}`},withResourceScope(l,d){let w=r;r=l;try{return d()}finally{r=w}},pending:new Set,data:new Map}}function k(e,n){return H.run(e,n)}function N(){return H.getStore()}function Q(){return N()?.event}function we(){let e=Q();return e?(e.locals||(e.locals={}),e.locals):{}}var B=new WeakMap;function Y(e){let n=B.get(e);return n||(n={},B.set(e,n)),n}var ee=!1;function re(){ee||(ee=!0,V({createElement:(e,n)=>new m(e,n),createText:e=>new h(e),createRaw:e=>new b(e),parseTemplate:(e,n)=>G(e,n),createComment:e=>new x(e)}))}function Ee(e,n={}){let t=T;re(),v(!0);let r=A(n.event);try{return k(r,()=>ne(s=>{try{let a=typeof e=="function"?e():e;return p(a)}finally{s()}}))}finally{v(t)}}var te=!1;function Ce(){te||(te=!0,Se(e=>{N()?.pending.add(e)}),ye(()=>N()?.nextResourceId()??""),Te((e,n)=>{e&&N()?.data.set(e,n)}))}var F=null;function qe(e){F=e}function se(e){if(e.data.size===0)return"";let n={};for(let[r,s]of e.data){let a=s;if(F)try{a=F(s,r)}catch{continue}a!==void 0&&(typeof a=="function"||typeof a=="symbol"||(n[r]=a))}if(Object.keys(n).length===0)return"";let t=j(JSON.stringify(n));return t==="{}"?"":`<script type="application/json" id="${C}">${t}<\/script>`}var Ae=50;async function ke(e,n={}){let t=T;re(),v(!0),Ce();let r=A(n.event);try{return await k(r,async()=>{n.preload&&await n.preload(n.event);let s,a=null,l=()=>{};ne(u=>{l=u,a=Re(),s=typeof e=="function"?e():e});let d=()=>{try{Z(a,()=>p(s))}catch{}};d();let w=0;for(;r.pending.size>0&&w++<Ae;){let u=Array.from(r.pending);r.pending.clear(),await Promise.allSettled(u),await be(),d()}let o=Z(a,()=>p(s))+se(r);return l(),o})}finally{v(t)}}export{C as FX_DATA_ID,x as ServerComment,m as ServerElement,g as ServerNode,h as ServerText,A as createRequestContext,j as escapeFxJson,we as getLocals,N as getRequestContext,Q as getRequestEvent,Y as getRequestLocals,me as getServerData,ue as isDomElement,ae as isDomNode,le as isDomText,T as isServer,ce as isServerNodeValue,Ee as renderToString,ke as renderToStringAsync,k as runWithRequestContext,p as serializeNode,se as serializeResourceData,qe as setDataRedactor,Ne as setRequestStore,v as setServerMode};
|
|
1
|
+
var T=Symbol.for("fluixi.server-node"),ae=Symbol.for("fluixi.dom.server-host"),ue=globalThis,D=ue[ae]??={server:typeof document>"u",nodes:null};function b(){return D.server}function v(e){D.server=e}function z(e){D.nodes=e}function le(e){return e!=null&&e[T]===!0?!0:typeof Node<"u"&&e instanceof Node}function ce(e){return e!=null&&e[T]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function de(e){return e!=null&&e[T]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var E=1,_=3,$=8,X;X=T;var g=class{constructor(){this[X]=!0;this.parentNode=null;this.childNodes=[]}get firstChild(){return this.childNodes[0]??null}get lastChild(){return this.childNodes[this.childNodes.length-1]??null}get nextSibling(){let n=this.parentNode;if(!n)return null;let t=n.childNodes.indexOf(this);return t>=0?n.childNodes[t+1]??null:null}get previousSibling(){let n=this.parentNode;if(!n)return null;let t=n.childNodes.indexOf(this);return t>0?n.childNodes[t-1]??null:null}get parentElement(){return this.parentNode}appendChild(n){return n.parentNode&&n.parentNode.removeChild(n),n.parentNode=this,this.childNodes.push(n),n}insertBefore(n,t){if(t==null)return this.appendChild(n);n.parentNode&&n.parentNode.removeChild(n);let r=this.childNodes.indexOf(t);return n.parentNode=this,r<0?this.childNodes.push(n):this.childNodes.splice(r,0,n),n}removeChild(n){let t=this.childNodes.indexOf(n);return t>=0&&this.childNodes.splice(t,1),n.parentNode=null,n}replaceChild(n,t){let r=this.childNodes.indexOf(t);return r>=0&&(n.parentNode&&n.parentNode.removeChild(n),n.parentNode=this,this.childNodes[r]=n,t.parentNode=null),t}addEventListener(){}removeEventListener(){}},h=class e extends g{constructor(t){super();this.nodeType=_;this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}get textContent(){return this.data}set textContent(t){this.data=t==null?"":String(t)}cloneNode(){return new e(this.data)}},R=class e extends g{constructor(t){super();this.nodeType=E;this.rawOuterHTML=t}get textContent(){return this.rawOuterHTML.replace(/<[^>]*>/g,"")}cloneNode(){return new e(this.rawOuterHTML)}},x=class e extends g{constructor(t){super();this.nodeType=$;this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}cloneNode(){return new e(this.data)}},M=class{constructor(){this.cssText=""}setProperty(n,t){this[n]=t}removeProperty(n){delete this[n]}},L=class{constructor(n){this.el=n}list(){let n=this.el.getAttribute("class");return n?n.split(/\s+/).filter(Boolean):[]}write(n){n.length?this.el.setAttribute("class",n.join(" ")):this.el.removeAttribute("class")}add(...n){let t=this.list();for(let r of n)t.includes(r)||t.push(r);this.write(t)}remove(...n){this.write(this.list().filter(t=>!n.includes(t)))}contains(n){return this.list().includes(n)}toggle(n,t){let r=this.contains(n),s=t===void 0?!r:t;return s?this.add(n):this.remove(n),s}},m=class e extends g{constructor(t,r=!1){super();this.nodeType=E;this.attributes=new Map;this.style=new M;this.classList=new L(this);this.rawHTML=null;this.localName=t.toLowerCase(),this.tagName=r?t:t.toUpperCase(),this.isSVG=r,this.namespaceURI=r?"http://www.w3.org/2000/svg":null}setAttribute(t,r){this.attributes.set(t,String(r))}removeAttribute(t){this.attributes.delete(t)}getAttribute(t){return this.attributes.has(t)?this.attributes.get(t):null}hasAttribute(t){return this.attributes.has(t)}get id(){return this.getAttribute("id")??""}set id(t){t==null?this.removeAttribute("id"):this.setAttribute("id",t)}get className(){return this.getAttribute("class")??""}set className(t){t==null?this.removeAttribute("class"):this.setAttribute("class",t)}get htmlFor(){return this.getAttribute("for")??""}set htmlFor(t){t==null?this.removeAttribute("for"):this.setAttribute("for",t)}set value(t){t==null?this.removeAttribute("value"):this.setAttribute("value",String(t))}set checked(t){t?this.setAttribute("checked",""):this.removeAttribute("checked")}set selected(t){t?this.setAttribute("selected",""):this.removeAttribute("selected")}set indeterminate(t){}get textContent(){return this.childNodes.map(t=>t.textContent??"").join("")}set textContent(t){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=null,t!=null&&t!==""&&this.appendChild(new h(String(t)))}set innerText(t){this.textContent=t}set innerHTML(t){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=t==null?"":String(t)}cloneNode(t=!1){let r=new e(this.localName,this.isSVG);if(r.attributes=new Map(this.attributes),r.style.cssText=this.style.cssText,r.rawHTML=this.rawHTML,t)for(let s of this.childNodes)r.appendChild(s.cloneNode(!0));return r}};function pe(e){return e instanceof g}var fe=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),W=/&/g,J=/</g,U=/>/g,ge=/"/g;function H(e){return e.replace(W,"&").replace(J,"<").replace(U,">")}function P(e){return e.replace(W,"&").replace(ge,""").replace(J,"<").replace(U,">")}function he(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,n=>"-"+n.toLowerCase())}function me(e){if(!e)return"";let n=[];e.cssText&&n.push(e.cssText.trim().replace(/;\s*$/,""));for(let t of Object.keys(e)){if(t==="cssText")continue;let r=e[t];r==null||r===""||n.push(`${he(t)}: ${r}`)}return n.join("; ")}function xe(e){let n="",t=me(e.style);for(let[r,s]of e.attributes)r==="style"&&t||(n+=` ${r}="${P(s)}"`);if(t){let r=e.attributes.get("style"),s=r?`${r.replace(/;\s*$/,"")}; ${t}`:t;n+=` style="${P(s)}"`}return n}function p(e){if(e==null||e===!1||e===!0)return"";if(typeof e=="string")return H(e);if(typeof e=="number")return H(String(e));if(typeof e=="function")return p(e());if(Array.isArray(e))return e.map(p).join("");if(typeof e.rawOuterHTML=="string")return e.rawOuterHTML;switch(e.nodeType){case _:return H(e.data??"");case $:return`<!--${e.data??""}-->`;case E:{let n=e.localName,t=`<${n}${xe(e)}>`;if(fe.has(n))return t;let r=e.rawHTML!=null?e.rawHTML:(e.childNodes??[]).map(p).join("");return`${t}${r}</${n}>`}}return Array.isArray(e.childNodes)?e.childNodes.map(p).join(""):""}var C="__FX_DATA__";function j(e){return e.replace(/[<>&\u2028\u2029]/g,n=>"\\u"+n.charCodeAt(0).toString(16).padStart(4,"0"))}var I;function ve(){let e=globalThis.__FX_DATA__;if(e)return e;if(I!==void 0)return I;let n=null;if(typeof document<"u"){let t=document.getElementById(C)?.textContent;if(t)try{n=JSON.parse(t)}catch{n=null}}return I=n}import{createRoot as re}from"@fluixi/reactive/signal";import{setResourceTracker as Te,setResourceIdSource as be,setResourceDataSink as Re,getOwner as Ee,runWithOwner as ee,flush as Ce}from"@fluixi/reactive/signal";var Ne=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Se={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'"};function G(e){return e.replace(/&(#?\w+);/g,(n,t)=>Se[t]??n)}var c=class extends Error{};function B(e,n=!1){let t=0,r=[],s=[],a=o=>{let u=s[s.length-1];u?u.appendChild(o):r.push(o)};for(;t<e.length;){let o=e.indexOf("<",t);if(o===-1){d(e.slice(t));break}if(o>t&&d(e.slice(t,o)),e.startsWith("<!--",o)){let u=e.indexOf("-->",o);if(u===-1)throw new c(`unterminated comment at ${o}`);a(new x(e.slice(o+4,u))),t=u+3;continue}if(e[o+1]==="/"){let u=e.indexOf(">",o);if(u===-1)throw new c(`unterminated closing tag at ${o}`);let w=e.slice(o+2,u).trim().toLowerCase(),f=s.pop();if(!f||f.localName!==w)throw new c(`</${w}> does not close <${f?.localName??"nothing"}>`);t=u+1;continue}t=S(o)}if(s.length>0)throw new c(`unclosed <${s[s.length-1].localName}>`);let l=r[0];if(r.length!==1||!(l instanceof m))throw new c(`expected exactly one root element, got ${r.length}`);return l;function d(o){o!==""&&a(new h(G(o)))}function S(o){let u=/[\s/>]/.exec(e.slice(o+1));if(!u)throw new c(`unterminated tag at ${o}`);let w=e.slice(o+1,o+1+u.index).toLowerCase(),f=new m(w,n),i=o+1+u.index;for(;i<e.length;){for(;i<e.length&&/\s/.test(e[i]);)i++;if(e[i]===">"){i++;break}if(e[i]==="/"&&e[i+1]===">"){i+=2;break}let ie=i;for(;i<e.length&&!/[\s=/>]/.test(e[i]);)i++;let y=e.slice(ie,i);if(y==="")throw new c(`malformed attribute at ${i}`);if(e[i]==="="){if(e[i+1]!=='"')throw new c(`attribute ${y} must have a double-quoted value`);let O=e.indexOf('"',i+2);if(O===-1)throw new c(`unterminated value for ${y}`);f.setAttribute(y,G(e.slice(i+2,O))),i=O+1}else f.setAttribute(y,"")}return a(f),Ne.has(w)||s.push(f),i}}var q,Q={getStore:()=>q,run(e,n){let t=q;q=e;try{return n()}finally{q=t}}},F=Q;function we(e){F=e??Q}function A(e={}){e.locals||(e.locals=e.request?Z(e.request):{});let n=0,t=0,r=null,s=new Map,a=new Map;return{event:e,routeData:new Map,matchedRoute:new Map,nextId:()=>`s${n++}`,nextResourceId:()=>{if(r===null)return`r${t++}`;let l=s.get(r)??0;return s.set(r,l+1),`${r}:r${l}`},nextIslandNamespace:l=>{let d=a.get(l)??0;return a.set(l,d+1),`${l}#${d}`},withResourceScope(l,d){let S=r;r=l;try{return d()}finally{r=S}},pending:new Set,data:new Map}}function k(e,n){return F.run(e,n)}function N(){return F.getStore()}function Y(){return N()?.event}function ye(){let e=Y();return e?(e.locals||(e.locals={}),e.locals):{}}var K=new WeakMap;function Z(e){let n=K.get(e);return n||(n={},K.set(e,n)),n}var te=!1;function se(){te||(te=!0,z({createElement:(e,n)=>new m(e,n),createText:e=>new h(e),createRaw:e=>new R(e),parseTemplate:(e,n)=>B(e,n),createComment:e=>new x(e)}))}function qe(e,n={}){let t=b();se(),v(!0);let r=A(n.event);try{return k(r,()=>re(s=>{try{let a=typeof e=="function"?e():e;return p(a)}finally{s()}}))}finally{v(t)}}var ne=!1;function Ae(){ne||(ne=!0,Te(e=>{N()?.pending.add(e)}),be(()=>N()?.nextResourceId()??""),Re((e,n)=>{e&&N()?.data.set(e,n)}))}var V=null;function ke(e){V=e}function oe(e){if(e.data.size===0)return"";let n={};for(let[r,s]of e.data){let a=s;if(V)try{a=V(s,r)}catch{continue}a!==void 0&&(typeof a=="function"||typeof a=="symbol"||(n[r]=a))}if(Object.keys(n).length===0)return"";let t=j(JSON.stringify(n));return t==="{}"?"":`<script type="application/json" id="${C}">${t}<\/script>`}var Oe=50;async function De(e,n={}){let t=b();se(),v(!0),Ae();let r=A(n.event);try{return await k(r,async()=>{n.preload&&await n.preload(n.event);let s,a=null,l=()=>{};re(u=>{l=u,a=Ee(),s=typeof e=="function"?e():e});let d=()=>{try{ee(a,()=>p(s))}catch{}};d();let S=0;for(;r.pending.size>0&&S++<Oe;){let u=Array.from(r.pending);r.pending.clear(),await Promise.allSettled(u),await Ce(),d()}let o=ee(a,()=>p(s))+oe(r);return l(),o})}finally{v(t)}}export{C as FX_DATA_ID,x as ServerComment,m as ServerElement,g as ServerNode,h as ServerText,A as createRequestContext,j as escapeFxJson,ye as getLocals,N as getRequestContext,Y as getRequestEvent,Z as getRequestLocals,ve as getServerData,ce as isDomElement,le as isDomNode,de as isDomText,b as isServer,pe as isServerNodeValue,qe as renderToString,De as renderToStringAsync,k as runWithRequestContext,p as serializeNode,oe as serializeResourceData,ke as setDataRedactor,we as setRequestStore,v as setServerMode};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var u=(e,o)=>{for(var s in o)t(e,s,{get:o[s],enumerable:!0})},m=(e,o,s,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of d(o))!f.call(e,r)&&r!==s&&t(e,r,{get:()=>o[r],enumerable:!(n=c(o,r))||n.enumerable});return e};var p=e=>m(t({},"__esModule",{value:!0}),e);var V={};u(V,{registerCoreVersion:()=>x,stampVersions:()=>v,versions:()=>i,warnOnVersionSkew:()=>g});module.exports=p(V);var a="1.0.0-alpha.
|
|
1
|
+
"use strict";var t=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var u=(e,o)=>{for(var s in o)t(e,s,{get:o[s],enumerable:!0})},m=(e,o,s,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of d(o))!f.call(e,r)&&r!==s&&t(e,r,{get:()=>o[r],enumerable:!(n=c(o,r))||n.enumerable});return e};var p=e=>m(t({},"__esModule",{value:!0}),e);var V={};u(V,{registerCoreVersion:()=>x,stampVersions:()=>v,versions:()=>i,warnOnVersionSkew:()=>g});module.exports=p(V);var a="1.0.0-alpha.83";var l=require("@fluixi/reactive/version"),i={dom:a,reactive:l.VERSION};function x(e){i.core=e}function v(e){i.core&&e.setAttribute("fluixi",i.core),e.setAttribute("fx-dom",i.dom),e.setAttribute("fx-reactive",i.reactive),typeof globalThis<"u"&&(globalThis.Fluixi=i)}function g(){let e=[i.core,i.dom,i.reactive].filter(o=>o!==void 0);new Set(e).size<=1||console.warn(`[fluixi] package versions disagree — core ${i.core??"(absent)"}, dom ${i.dom}, reactive ${i.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\`.`)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var o="1.0.0-alpha.
|
|
1
|
+
var o="1.0.0-alpha.83";import{VERSION as s}from"@fluixi/reactive/version";var e={dom:o,reactive:s};function l(i){e.core=i}function c(i){e.core&&i.setAttribute("fluixi",e.core),i.setAttribute("fx-dom",e.dom),i.setAttribute("fx-reactive",e.reactive),typeof globalThis<"u"&&(globalThis.Fluixi=e)}function d(){let i=[e.core,e.dom,e.reactive].filter(r=>r!==void 0);new Set(i).size<=1||console.warn(`[fluixi] package versions disagree — core ${e.core??"(absent)"}, dom ${e.dom}, reactive ${e.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\`.`)}export{l as registerCoreVersion,c as stampVersions,e as versions,d as warnOnVersionSkew};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var i=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var d=(n,o)=>{for(var e in o)i(n,e,{get:o[e],enumerable:!0})},u=(n,o,e,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of a(o))!l.call(n,s)&&s!==e&&i(n,s,{get:()=>o[s],enumerable:!(t=r(o,s))||t.enumerable});return n};var f=n=>u(i({},"__esModule",{value:!0}),n);var C={};d(C,{classMap:()=>p});module.exports=f(C);var c=require("@fluixi/reactive/signal");function p(n){return(0,c.createMemo)(()=>{let o=typeof n=="function"?n():n,e=[];for(let[t,s]of Object.entries(o)){if(!t)continue;(typeof s=="function"?s():s)&&e.push(t)}return e.join(" ")})}
|
|
1
|
+
"use strict";var i=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var d=(n,o)=>{for(var e in o)i(n,e,{get:o[e],enumerable:!0})},u=(n,o,e,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of a(o))!l.call(n,s)&&s!==e&&i(n,s,{get:()=>o[s],enumerable:!(t=r(o,s))||t.enumerable});return n};var f=n=>u(i({},"__esModule",{value:!0}),n);var C={};d(C,{classMap:()=>p});module.exports=f(C);var c=require("@fluixi/reactive/signal");function p(n){return(0,c.createMemo)(()=>{let o=typeof n=="function"?n():n,e=[];for(let[t,s]of Object.entries(o)){if(!t)continue;(typeof s=="function"?s():s)&&e.push(t)}return e.join(" ")},void 0,{name:"ClassMap"})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createMemo as i}from"@fluixi/reactive/signal";function l(n){return i(()=>{let t=typeof n=="function"?n():n,s=[];for(let[e,o]of Object.entries(t)){if(!e)continue;(typeof o=="function"?o():o)&&s.push(e)}return s.join(" ")})}export{l as classMap};
|
|
1
|
+
import{createMemo as i}from"@fluixi/reactive/signal";function l(n){return i(()=>{let t=typeof n=="function"?n():n,s=[];for(let[e,o]of Object.entries(t)){if(!e)continue;(typeof o=="function"?o():o)&&s.push(e)}return s.join(" ")},void 0,{name:"ClassMap"})}export{l as classMap};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var i=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var f=(t,e)=>{for(var r in e)i(t,r,{get:e[r],enumerable:!0})},y=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of d(e))!p.call(t,n)&&n!==r&&i(t,n,{get:()=>e[n],enumerable:!(o=c(e,n))||o.enumerable});return t};var v=t=>y(i({},"__esModule",{value:!0}),t);var
|
|
1
|
+
"use strict";var i=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var f=(t,e)=>{for(var r in e)i(t,r,{get:e[r],enumerable:!0})},y=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of d(e))!p.call(t,n)&&n!==r&&i(t,n,{get:()=>e[n],enumerable:!(o=c(e,n))||o.enumerable});return t};var v=t=>y(i({},"__esModule",{value:!0}),t);var S={};f(S,{ClientOnly:()=>u,NoSsr:()=>N});module.exports=v(S);var a=require("@fluixi/reactive/signal");var m=Symbol.for("fluixi.dom.server-host"),x=globalThis,h=x[m]??={server:typeof document>"u",nodes:null};function l(){return h.server}var s={active:!1,cursor:null,parents:[]};function u(t){if(l())return t.fallback??null;let e=s.active,[r,o]=(0,a.createSignal)(!e);return e&&queueMicrotask(()=>o(!0)),(0,a.createMemo)(()=>r()?t.children:t.fallback??null,void 0,{name:"client-only"})}var N=u;
|
|
@@ -26,7 +26,7 @@ import { hydration } from '../dom/hydration-state.js';
|
|
|
26
26
|
* ClientOnly({ fallback: html`<div class="skeleton"></div>`, children: () => html`<x-chart></x-chart>` })
|
|
27
27
|
*/
|
|
28
28
|
export function ClientOnly(props) {
|
|
29
|
-
if (isServer)
|
|
29
|
+
if (isServer())
|
|
30
30
|
return props.fallback ?? null;
|
|
31
31
|
// Captured now, not read inside the memo: `hydration.active` is a global that
|
|
32
32
|
// flips when the pass ends, and this subtree's behaviour is decided by whether
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createMemo as
|
|
1
|
+
import{createMemo as u,createSignal as c}from"@fluixi/reactive/signal";var i=Symbol.for("fluixi.dom.server-host"),l=globalThis,s=l[i]??={server:typeof document>"u",nodes:null};function r(){return s.server}var n={active:!1,cursor:null,parents:[]};function d(e){if(r())return e.fallback??null;let t=n.active,[o,a]=c(!t);return t&&queueMicrotask(()=>a(!0)),u(()=>o()?e.children:e.fallback??null,void 0,{name:"client-only"})}var x=d;export{d as ClientOnly,x as NoSsr};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var a=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var d=(n,e)=>{for(var s in e)a(n,s,{get:e[s],enumerable:!0})},T=(n,e,s,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of y(e))!l.call(n,t)&&t!==s&&a(n,t,{get:()=>e[t],enumerable:!(c=u(e,t))||c.enumerable});return n};var m=n=>T(a({},"__esModule",{value:!0}),n);var g={};d(g,{Dynamic:()=>A});module.exports=m(g);var r=require("@fluixi/reactive/signal");function f(n){return typeof n=="function"?n:(()=>n)}function A(n){let e=f(n.component),{component:s,...c}=n,t=(0,r.getOwner)(),i=null,p;return(0,r.createMemo)(()=>{let o=e();return o!==p&&(i&&(0,r.disposeScope)(i),i=(0,r.createChildOwner)(t),p=o),o==null?null:typeof o=="string"?{tag:o,props:c}:(0,r.runWithOwner)(i,()=>o(c))},void 0,{name:"Dynamic"})}
|
package/dist/lib/flow/dynamic.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createMemo as
|
|
1
|
+
import{createMemo as a,createChildOwner as p,disposeScope as f,getOwner as u,runWithOwner as y}from"@fluixi/reactive/signal";function s(n){return typeof n=="function"?n:(()=>n)}function g(n){let c=s(n.component),{component:l,...t}=n,i=u(),r=null,o;return a(()=>{let e=c();return e!==o&&(r&&f(r),r=p(i),o=e),e==null?null:typeof e=="string"?{tag:e,props:t}:y(r,()=>e(t))},void 0,{name:"Dynamic"})}export{g as Dynamic};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var l=Object.defineProperty;var
|
|
1
|
+
"use strict";var l=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var y=(n,r)=>{for(var t in r)l(n,t,{get:r[t],enumerable:!0})},d=(n,r,t,c)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of f(r))!i.call(n,e)&&e!==t&&l(n,e,{get:()=>r[e],enumerable:!(c=u(r,e))||c.enumerable});return n};var k=n=>d(l({},"__esModule",{value:!0}),n);var h={};y(h,{ErrorBoundary:()=>b});module.exports=k(h);var a=require("@fluixi/reactive/signal");function b(n){let[r,t]=(0,a.createSignal)(null),c=()=>t(null);return(0,a.createMemo)(()=>{let e=r();if(e!==null)return typeof n.fallback=="function"?n.fallback(e,c):n.fallback;try{return typeof n.children=="function"?n.children():n.children}catch(o){return t(o),typeof n.fallback=="function"?n.fallback(o,c):n.fallback}},void 0,{name:"ErrorBoundary"})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createMemo as o,createSignal as l}from"@fluixi/reactive/signal";function
|
|
1
|
+
import{createMemo as o,createSignal as l}from"@fluixi/reactive/signal";function d(n){let[a,e]=l(null),t=()=>e(null);return o(()=>{let c=a();if(c!==null)return typeof n.fallback=="function"?n.fallback(c,t):n.fallback;try{return typeof n.children=="function"?n.children():n.children}catch(r){return e(r),typeof n.fallback=="function"?n.fallback(r,t):n.fallback}},void 0,{name:"ErrorBoundary"})}export{d as ErrorBoundary};
|
package/dist/lib/flow/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var $=Object.defineProperty;var de=Object.getOwnPropertyDescriptor;var pe=Object.getOwnPropertyNames;var he=Object.prototype.hasOwnProperty;var me=(e,n)=>{for(var t in n)$(e,t,{get:n[t],enumerable:!0})},xe=(e,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of pe(n))!he.call(e,a)&&a!==t&&$(e,a,{get:()=>n[a],enumerable:!(o=de(n,a))||o.enumerable});return e};var ge=e=>xe($({},"__esModule",{value:!0}),e);var Ee={};me(Ee,{ClientOnly:()=>I,Dynamic:()=>Q,ErrorBoundary:()=>fe,For:()=>X,Index:()=>J,Match:()=>Y,NoSsr:()=>se,Portal:()=>ie,Show:()=>q,Switch:()=>Z,classMap:()=>ce,indexArray:()=>P.indexArray,keyArray:()=>P.keyArray,mapArray:()=>P.mapArray,styleMap:()=>ue});module.exports=ge(Ee);var d=require("@fluixi/reactive/signal");function K(e){return typeof e=="function"?e:(()=>e)}function N(e){return()=>{let n=e();return typeof n=="function"?n():n}}function V(e){return e!=null&&e!==!1}function B(e){return!e||typeof e!="object"?!1:!!(typeof e._$litType$<"u"||typeof e._$litDirective$<"u"||Array.isArray(e.strings)&&Array.isArray(e.values))}function q(e){let n=N(()=>e.when),t=(0,d.createMemo)(n,void 0),o=(0,d.createMemo)(t,void 0),a=(0,d.getOwner)(),s=null,f=null,i=r=>{r!==f&&(s&&(0,d.disposeScope)(s),s=(0,d.createChildOwner)(a),f=r)};return(0,d.createMemo)(()=>{let r=o();return i(r?"when":"fallback"),(0,d.runWithOwner)(s,()=>{if(r){let c=e.children;return typeof c=="function"&&!B(c)?typeof t=="function"?(0,d.untrack)(()=>(0,d.untrack)(t)?c(t()):e.fallback):c(t):c}return e.fallback});return e.fallback??null},void 0,{name:"show"})}var C=require("@fluixi/reactive/signal");var x={active:!1,cursor:null,parents:[]},be=null;function z(){return be}function D(e,n){return x.active&&n.parentNode===e}function H(e){let n=x.parents.lastIndexOf(e);n!==-1&&(x.parents.length=n),x.cursor=e.nextSibling}function v(e){if(!x.active||e==null)return;let n=Array.isArray(e)?e[e.length-1]:e;n&&typeof n.nodeType=="number"&&H(n)}function X(e){let n=N(()=>e.each),t=()=>e.fallback??null,o=(a,s)=>{let f=e.children,i=Array.isArray(f)?f.map(r=>typeof r=="function"?r(a,s):r):typeof f=="function"?f(a,s):f;return v(i),i};return e.by?(0,C.keyArray)(n,e.by,(a,s)=>o(a,s),{fallback:t}):(0,C.mapArray)(n,(a,s)=>o(a,s),{fallback:t})}var G=require("@fluixi/reactive/signal");function J(e){let n=N(()=>e.each);return(0,G.indexArray)(n,(t,o)=>{let a=e.children(t,o);return v(a),a},{fallback:()=>e.fallback??null})}var P=require("@fluixi/reactive/signal");var h=require("@fluixi/reactive/signal");var U=Symbol("match");function Y(e){return{[U]:!0,when:N(()=>e.when),get children(){return e.children}}}function Z(e){let n=Array.isArray(e.children)?e.children:[e.children],t=(0,h.getOwner)(),o=null,a=-1,s=f=>{f!==a&&(o&&(0,h.disposeScope)(o),o=(0,h.createChildOwner)(t),a=f)};return(0,h.createMemo)(()=>{for(let f=0;f<n.length;f+=1){let r=n[f],c=0;for(;typeof r=="function"&&!r[U]&&c++<10;)r=r();if(!r||typeof r!="object"||r[U]!==!0)continue;let l=r.when();if(V(l))return s(f),(0,h.runWithOwner)(o,()=>typeof r.children=="function"?r.children(l):r.children)}return s(-2),(0,h.runWithOwner)(o,()=>e.fallback??null)})}var g=require("@fluixi/reactive/signal");function Q(e){let n=K(e.component),{component:t,...o}=e,a=(0,g.getOwner)(),s=null,f;return(0,g.createMemo)(()=>{let i=n();return i!==f&&(s&&(0,g.disposeScope)(s),s=(0,g.createChildOwner)(a),f=i),i==null?null:typeof i=="string"?{tag:i,props:o}:(0,g.runWithOwner)(s,()=>i(o))})}var L=require("@fluixi/reactive/signal");var m=require("@fluixi/reactive/signal");function E(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}var w=require("@fluixi/reactive/signal");var M=typeof document>"u";var ne=Symbol.for("fluixi.server-node"),ee=null;function te(){if(!ee)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return ee}function k(e){return e!=null&&e[ne]===!0?!0:typeof Node<"u"&&e instanceof Node}function oe(e){return e!=null&&e[ne]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}function A(e,n=!1){if(M)return te().createText(e);if(x.active&&!n){let t=z()?.hydrateText(e);if(t)return t}return document.createTextNode(e)}var T=0,Te=200;function Ne(e,n,t,o,a){let s=o,f=new Map;return(0,w.createRenderEffect)(()=>{let i;if(E(e)&&!(0,m.isSignal)(e)){if(!f.has(e)){T++;try{let r=e();f.set(e,r)}finally{T--}}for(i=f.get(e);typeof i=="function"&&(0,m.isSignal)(i);)i=i()}else for(i=e();typeof i=="function"&&(0,m.isSignal)(i);)i=i();{let r=0;for(;typeof i=="function"&&r++<50;)if(E(i)){if(!f.has(i)){let c=i;T++;try{let l=c();f.set(c,l)}finally{T--}}i=f.get(i)}else if((0,m.isSignal)(i))i=i();else if(i=i(),typeof i!="function"||!(0,m.isSignal)(i)&&!E(i))break}T++;try{s=O(n,i,t,s,f),a(s)}finally{T--}})}function W(e,n,t,o){if(T>Te)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;t!==void 0&&!t&&(t=A("",!0),e.appendChild(t));let a=o??null,s=r=>Array.isArray(r)&&r.some(c=>typeof c=="function"),f=r=>typeof r=="function"?r:()=>r;if(typeof n!="function"&&!s(n)){T++;try{a=O(e,n,t,a)}finally{T--}return()=>a}let i=Ne(f(n),e,t,a,r=>{a=r});return()=>(i?.(),a)}function O(e,n,t,o,a){if(n==null||typeof n=="boolean")return S(e,o,t);if(typeof n=="function")for(;typeof n=="function";)n=n();if(n==null||typeof n=="boolean")return S(e,o,t);if(R(n)){let f=A("",!0);return Array.isArray(o)?o.length>0?(e.replaceChild(f,o[0]),S(e,o.slice(1),t)):p(e,f,t):o?e.replaceChild(f,o):p(e,f,t),n.then(i=>{f.parentNode===e&&O(e,i,f.nextSibling,f)}).catch(i=>{console.error("Error resolving promise in insertExpression:",i)}),f}let s=typeof n;if(s==="string"||s==="number"){if(s==="number"&&(n=String(n)),Array.isArray(o)){if(o.length===0){let i=A(n);return p(e,i,t),i}if(o.length===1&&o[0].nodeType===3)return o[0].data=n,o;o=S(e,o,t)}if(o&&oe(o))return o.data=n,o;let f=A(n);return o&&o.parentNode===e?e.replaceChild(f,o):D(e,f)||p(e,f,t),f}if(k(n))return D(e,n)?(H(n),n):Array.isArray(o)?(o.length===0?p(e,n,t):o[0].parentNode===e?(e.replaceChild(n,o[0]),S(e,o.slice(1),t)):p(e,n,t),n):(o?o!==n&&(o.parentNode===e?e.replaceChild(n,o):p(e,n,t)):p(e,n,t),n);if(Array.isArray(n)){let f=[],i=Array.isArray(o)?o:o?[o]:[],r=[];b(n,f,e,t,!0,a,r);let c=Ae(e,i,f,t);for(let l of r){let u=W(e,l.sig,l.marker);(0,w.onCleanup)(()=>{S(e,u()),l.marker.parentNode===e&&e.removeChild(l.marker)})}return c}if(s==="object"&&n!==null&&typeof n=="object"){let f=n;if("type"in f&&"props"in f){let i=f;if(typeof i.type=="function"){let r=i.type(i.props||{});return O(e,r,t,o)}}}return S(e,o,t)}function b(e,n,t,o,a=!0,s,f){for(let i=0;i<e.length;i++){let r=e[i];if(!(r==null||typeof r=="boolean")){for(;typeof r=="function"&&!R(r)&&!(0,m.isSignal)(r)&&!E(r)&&(r=r(),!(r==null||typeof r=="boolean")););if(!(r==null||typeof r=="boolean")){if(typeof r=="function"){let c;for(E(r)&&!(0,m.isSignal)(r)?(s||(s=new Map),s.has(r)||s.set(r,r()),c=s.get(r)):c=r();typeof c=="function"&&!R(c)&&!(0,m.isSignal)(c)&&!E(c);)s||(s=new Map),s.has(c)||s.set(c,c()),c=s.get(c);if(c==null||typeof c=="boolean")continue;if(typeof c=="function"){if((0,m.isSignal)(c)){if(f){let u=A("",!0);n.push(u),f.push({marker:u,sig:c});continue}let l=c();for(;typeof l=="function"&&(0,m.isSignal)(l);)l=l();if(l==null||typeof l=="boolean")continue;Array.isArray(l)?b(l,n,t,o,a,s):b([l],n,t,o,a,s);continue}continue}Array.isArray(c)?b(c,n,t,o,a,s,f):b([c],n,t,o,a,s,f);continue}if(R(r)){let c=A("",!0);n.push(c),r.then(l=>{if(c.parentNode){let u=[];if(b([l],u,c.parentNode,void 0,!1,s),u.length>0){c.parentNode.replaceChild(u[0],c);for(let y=1;y<u.length;y++)c.parentNode?.insertBefore(u[y],u[y-1].nextSibling)}}}).catch(l=>console.error("Error resolving promise in array:",l));continue}if(Array.isArray(r)){b(r,n,t,o,a,s,f);continue}if(k(r)){n.push(r);continue}if(typeof r=="object"&&r!==null&&"type"in r&&"props"in r){let c=r;if(typeof c.type=="function"){let l=c.type(c.props||{});Array.isArray(l)?b(l,n,t,o,!1,s):b([l],n,t,o,!1,s);continue}}if(typeof r=="string"||typeof r=="number"){let c=String(r);if(c.trim()===""&&c!==" ")continue;n.push(A(c));continue}n.push(A(String(r)))}}}}function Ae(e,n,t,o){for(let u=0;u<t.length;u++){let y=t[u].parentNode;y!==null&&y!==e&&y.nodeType!==11&&(t=t.slice(),t[u]=t[u].cloneNode(!0))}let a=t.length,s=n.length,f=a,i=0,r=0,c=s>0?n[s-1].nextSibling??void 0:o,l=null;for(;i<s||r<f;){if(n[i]===t[r]){i++,r++;continue}for(;s>i&&f>r&&n[s-1]===t[f-1];)s--,f--;if(s===i){let u=f<a?r?t[r-1].nextSibling??void 0:t[f-r]:c;for(;r<f;)p(e,t[r++],u)}else if(f===r)for(;i<s;)(!l||!l.has(n[i]))&&n[i].parentNode===e&&e.removeChild(n[i]),i++;else if(n[i]===t[f-1]&&t[r]===n[s-1]){let u=n[--s].nextSibling;p(e,t[r++],n[i++].nextSibling),p(e,t[--f],u),n[s]=n[i-1]}else{if(!l){l=new Map;let y=r;for(;y<f;)l.set(t[y],y++)}let u=l.get(n[i]);if(u!=null)if(r<u&&u<f){let y=i,_=1;for(;++y<s&&y<f&&!(!l.has(n[y])||l.get(n[y])!==u+_);)_++;if(_>u-r){let ye=n[i];for(;r<u;)p(e,t[r++],ye)}else n[i].parentNode===e?e.replaceChild(t[r++],n[i++]):(p(e,t[r++],c),i++)}else i++;else n[i].parentNode===e&&e.removeChild(n[i]),i++}}return t}function S(e,n,t){if(n)if(Array.isArray(n))for(let o=0;o<n.length;o++)n[o].parentNode===e&&e.removeChild(n[o]);else n.parentNode===e&&e.removeChild(n);return null}function p(e,n,t){x.active&&n.parentNode===e||(t&&t.parentNode===e?e.insertBefore(n,t):e.appendChild(n))}function re(e,n){if(e){if(k(e)){let t=n,o=e;if(!t)return;typeof t=="function"?t(o):typeof t=="object"&&"current"in t&&(t.current=o);return}typeof e=="function"?e(n):typeof e=="object"&&"current"in e&&(e.current=n)}}function R(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function ie(e){let n=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,t,o;return(0,L.createRoot)(a=>{t=a,o=document.createElement("div"),o.style.display="contents",n().appendChild(o),W(o,e.children)&&re(e.ref,o)}),(0,L.onCleanup)(()=>{t(),o.remove()}),null}var j=require("@fluixi/reactive/signal");function I(e){if(M)return e.fallback??null;let n=x.active,[t,o]=(0,j.createSignal)(!n);return n&&queueMicrotask(()=>o(!0)),(0,j.createMemo)(()=>t()?e.children:e.fallback??null,void 0,{name:"client-only"})}var se=I;var F=require("@fluixi/reactive/signal");function fe(e){let[n,t]=(0,F.createSignal)(null),o=()=>t(null);return(0,F.createMemo)(()=>{let a=n();if(a!==null)return typeof e.fallback=="function"?e.fallback(a,o):e.fallback;try{return typeof e.children=="function"?e.children():e.children}catch(s){return t(s),typeof e.fallback=="function"?e.fallback(s,o):e.fallback}})}var ae=require("@fluixi/reactive/signal");function ce(e){return(0,ae.createMemo)(()=>{let n=typeof e=="function"?e():e,t=[];for(let[o,a]of Object.entries(n)){if(!o)continue;(typeof a=="function"?a():a)&&t.push(o)}return t.join(" ")})}var le=require("@fluixi/reactive/signal");function we(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`)}function ue(e){return(0,le.createMemo)(()=>{let n=typeof e=="function"?e():e,t=[];for(let[o,a]of Object.entries(n)){if(!o)continue;let s=typeof a=="function"?a():a;s!=null&&t.push(`${we(o)}: ${s}`)}return t.join("; ")})}
|
|
1
|
+
"use strict";var H=Object.defineProperty;var ye=Object.getOwnPropertyDescriptor;var pe=Object.getOwnPropertyNames;var he=Object.prototype.hasOwnProperty;var me=(e,n)=>{for(var o in n)H(e,o,{get:n[o],enumerable:!0})},xe=(e,n,o,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of pe(n))!he.call(e,a)&&a!==o&&H(e,a,{get:()=>n[a],enumerable:!(t=ye(n,a))||t.enumerable});return e};var ge=e=>xe(H({},"__esModule",{value:!0}),e);var ve={};me(ve,{ClientOnly:()=>K,Dynamic:()=>ee,ErrorBoundary:()=>fe,For:()=>X,Index:()=>Y,Match:()=>Z,NoSsr:()=>se,Portal:()=>ie,Show:()=>z,Switch:()=>Q,classMap:()=>ce,indexArray:()=>P.indexArray,keyArray:()=>P.keyArray,mapArray:()=>P.mapArray,styleMap:()=>ue});module.exports=ge(ve);var y=require("@fluixi/reactive/signal");function V(e){return typeof e=="function"?e:(()=>e)}function w(e){return()=>{let n=e();return typeof n=="function"?n():n}}function B(e){return e!=null&&e!==!1}function q(e){return!e||typeof e!="object"?!1:!!(typeof e._$litType$<"u"||typeof e._$litDirective$<"u"||Array.isArray(e.strings)&&Array.isArray(e.values))}function z(e){let n=w(()=>e.when),o=(0,y.createMemo)(n,void 0,{name:"Show.when"}),t=(0,y.createMemo)(o,void 0,{name:"Show.cond"}),a=(0,y.getOwner)(),s=null,f=null,i=r=>{r!==f&&(s&&(0,y.disposeScope)(s),s=(0,y.createChildOwner)(a),f=r)};return(0,y.createMemo)(()=>{let r=t();return i(r?"when":"fallback"),(0,y.runWithOwner)(s,()=>{if(r){let c=e.children;return typeof c=="function"&&!q(c)?typeof o=="function"?(0,y.untrack)(()=>(0,y.untrack)(o)?c(o()):e.fallback):c(o):c}return e.fallback});return e.fallback??null},void 0,{name:"Show.result"})}var C=require("@fluixi/reactive/signal");var g={active:!1,cursor:null,parents:[]},be=null;function G(){return be}function D(e,n){return g.active&&n.parentNode===e}function $(e){let n=g.parents.lastIndexOf(e);n!==-1&&(g.parents.length=n),g.cursor=e.nextSibling}function v(e){if(!g.active||e==null)return;let n=Array.isArray(e)?e[e.length-1]:e;n&&typeof n.nodeType=="number"&&$(n)}function X(e){let n=w(()=>e.each),o=()=>e.fallback??null,t=(a,s)=>{let f=e.children,i=Array.isArray(f)?f.map(r=>typeof r=="function"?r(a,s):r):typeof f=="function"?f(a,s):f;return v(i),i};return e.by?(0,C.keyArray)(n,e.by,(a,s)=>t(a,s),{fallback:o}):(0,C.mapArray)(n,(a,s)=>t(a,s),{fallback:o})}var J=require("@fluixi/reactive/signal");function Y(e){let n=w(()=>e.each);return(0,J.indexArray)(n,(o,t)=>{let a=e.children(o,t);return v(a),a},{fallback:()=>e.fallback??null})}var P=require("@fluixi/reactive/signal");var m=require("@fluixi/reactive/signal");var U=Symbol("match");function Z(e){return{[U]:!0,when:w(()=>e.when),get children(){return e.children}}}function Q(e){let n=Array.isArray(e.children)?e.children:[e.children],o=(0,m.getOwner)(),t=null,a=-1,s=f=>{f!==a&&(t&&(0,m.disposeScope)(t),t=(0,m.createChildOwner)(o),a=f)};return(0,m.createMemo)(()=>{for(let f=0;f<n.length;f+=1){let r=n[f],c=0;for(;typeof r=="function"&&!r[U]&&c++<10;)r=r();if(!r||typeof r!="object"||r[U]!==!0)continue;let l=r.when();if(B(l))return s(f),(0,m.runWithOwner)(t,()=>typeof r.children=="function"?r.children(l):r.children)}return s(-2),(0,m.runWithOwner)(t,()=>e.fallback??null)},void 0,{name:"Switch"})}var b=require("@fluixi/reactive/signal");function ee(e){let n=V(e.component),{component:o,...t}=e,a=(0,b.getOwner)(),s=null,f;return(0,b.createMemo)(()=>{let i=n();return i!==f&&(s&&(0,b.disposeScope)(s),s=(0,b.createChildOwner)(a),f=i),i==null?null:typeof i=="string"?{tag:i,props:t}:(0,b.runWithOwner)(s,()=>i(t))},void 0,{name:"Dynamic"})}var L=require("@fluixi/reactive/signal");var x=require("@fluixi/reactive/signal");function E(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}var h=require("@fluixi/reactive/signal");var ne=Symbol.for("fluixi.server-node"),Te=Symbol.for("fluixi.dom.server-host"),Ne=globalThis,W=Ne[Te]??={server:typeof document>"u",nodes:null};function k(){return W.server}function te(){if(!W.nodes)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return W.nodes}function M(e){return e!=null&&e[ne]===!0?!0:typeof Node<"u"&&e instanceof Node}function oe(e){return e!=null&&e[ne]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var we="__fx_at";function A(e,n=!1){if(k())return te().createText(e);if(g.active&&!n){let o=G()?.hydrateText(e);if(o)return o}return document.createTextNode(e)}var N=0,Ae=200;function Ee(e,n,o,t,a){let s=t,f=new Map;return(0,h.createRenderEffect)(()=>{(0,h.reportReactiveBinding)(o??n,"content",void 0,e);let i;if(E(e)&&!(0,x.isSignal)(e)){if(!f.has(e)){N++;try{let r=e();f.set(e,r)}finally{N--}}for(i=f.get(e);typeof i=="function"&&(0,x.isSignal)(i);)i=i()}else for(i=e();typeof i=="function"&&(0,x.isSignal)(i);)i=i();{let r=0;for(;typeof i=="function"&&r++<50;)if(E(i)){if(!f.has(i)){let c=i;N++;try{let l=c();f.set(c,l)}finally{N--}}i=f.get(i)}else if((0,x.isSignal)(i))i=i();else if(i=i(),typeof i!="function"||!(0,x.isSignal)(i)&&!E(i))break}N++;try{s=O(n,i,o,s,f),a(s)}finally{N--}})}function I(e,n,o,t){if(N>Ae)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;o!==void 0&&!o&&(o=A("",!0),e.appendChild(o));let a=t??null,s=r=>Array.isArray(r)&&r.some(c=>typeof c=="function"),f=r=>typeof r=="function"?r:()=>r;if(typeof n!="function"&&!s(n)){N++;try{a=O(e,n,o,a)}finally{N--}return()=>a}let i=Ee(f(n),e,o,a,r=>{a=r});return()=>(i?.(),a)}function O(e,n,o,t,a){if(n==null||typeof n=="boolean")return S(e,t,o);if(typeof n=="function")for(;typeof n=="function";)n=n();if(n==null||typeof n=="boolean")return S(e,t,o);if(R(n)){let f=A("",!0);return Array.isArray(t)?t.length>0?(e.replaceChild(f,t[0]),S(e,t.slice(1),o)):p(e,f,o):t?e.replaceChild(f,t):p(e,f,o),n.then(i=>{f.parentNode===e&&O(e,i,f.nextSibling,f)}).catch(i=>{console.error("Error resolving promise in insertExpression:",i)}),f}let s=typeof n;if(s==="string"||s==="number"){if(s==="number"&&(n=String(n)),Array.isArray(t)){if(t.length===0){let i=A(n);return p(e,i,o),i}if(t.length===1&&t[0].nodeType===3)return t[0].data=n,t;t=S(e,t,o)}if(t&&oe(t))return t.data=n,t;let f=A(n);return t&&t.parentNode===e?e.replaceChild(f,t):D(e,f)||p(e,f,o),f}if(M(n))return D(e,n)?($(n),n):Array.isArray(t)?(t.length===0?p(e,n,o):t[0].parentNode===e?(e.replaceChild(n,t[0]),S(e,t.slice(1),o)):p(e,n,o),n):(t?t!==n&&(t.parentNode===e?e.replaceChild(n,t):p(e,n,o)):p(e,n,o),n);if(Array.isArray(n)){let f=[],i=Array.isArray(t)?t:t?[t]:[],r=[];T(n,f,e,o,!0,a,r);let c=Se(e,i,f,o);for(let l of r){let u=I(e,l.sig,l.marker);(0,h.onCleanup)(()=>{S(e,u()),l.marker.parentNode===e&&e.removeChild(l.marker)})}return c}if(s==="object"&&n!==null&&typeof n=="object"){let f=n;if("type"in f&&"props"in f){let i=f;if(typeof i.type=="function"){let r=i.type(i.props||{});return O(e,r,o,t)}}}return S(e,t,o)}function T(e,n,o,t,a=!0,s,f){for(let i=0;i<e.length;i++){let r=e[i];if(!(r==null||typeof r=="boolean")){for(;typeof r=="function"&&!R(r)&&!(0,x.isSignal)(r)&&!E(r)&&(r=r(),!(r==null||typeof r=="boolean")););if(!(r==null||typeof r=="boolean")){if(typeof r=="function"){let c;for(E(r)&&!(0,x.isSignal)(r)?(s||(s=new Map),s.has(r)||s.set(r,r()),c=s.get(r)):c=r();typeof c=="function"&&!R(c)&&!(0,x.isSignal)(c)&&!E(c);)s||(s=new Map),s.has(c)||s.set(c,c()),c=s.get(c);if(c==null||typeof c=="boolean")continue;if(typeof c=="function"){if((0,x.isSignal)(c)){if(f){let u=A("",!0);n.push(u),f.push({marker:u,sig:c});continue}let l=c();for(;typeof l=="function"&&(0,x.isSignal)(l);)l=l();if(l==null||typeof l=="boolean")continue;Array.isArray(l)?T(l,n,o,t,a,s):T([l],n,o,t,a,s);continue}continue}Array.isArray(c)?T(c,n,o,t,a,s,f):T([c],n,o,t,a,s,f);continue}if(R(r)){let c=A("",!0);n.push(c),r.then(l=>{if(c.parentNode){let u=[];if(T([l],u,c.parentNode,void 0,!1,s),u.length>0){c.parentNode.replaceChild(u[0],c);for(let d=1;d<u.length;d++)c.parentNode?.insertBefore(u[d],u[d-1].nextSibling)}}}).catch(l=>console.error("Error resolving promise in array:",l));continue}if(Array.isArray(r)){T(r,n,o,t,a,s,f);continue}if(M(r)){n.push(r);continue}if(typeof r=="object"&&r!==null&&"type"in r&&"props"in r){let c=r;if(typeof c.type=="function"){let l=c.type(c.props||{});Array.isArray(l)?T(l,n,o,t,!1,s):T([l],n,o,t,!1,s);continue}}if(typeof r=="string"||typeof r=="number"){let c=String(r);if(c.trim()===""&&c!==" ")continue;n.push(A(c));continue}n.push(A(String(r)))}}}}function Se(e,n,o,t){for(let u=0;u<o.length;u++){let d=o[u].parentNode;d!==null&&d!==e&&d.nodeType!==11&&(o=o.slice(),o[u]=o[u].cloneNode(!0))}let a=o.length,s=n.length,f=a,i=0,r=0,c=s>0?n[s-1].nextSibling??void 0:t,l=null;for(;i<s||r<f;){if(n[i]===o[r]){i++,r++;continue}for(;s>i&&f>r&&n[s-1]===o[f-1];)s--,f--;if(s===i){let u=f<a?r?o[r-1].nextSibling??void 0:o[f-r]:c;for(;r<f;)p(e,o[r++],u)}else if(f===r)for(;i<s;)(!l||!l.has(n[i]))&&n[i].parentNode===e&&e.removeChild(n[i]),i++;else if(n[i]===o[f-1]&&o[r]===n[s-1]){let u=n[--s].nextSibling;p(e,o[r++],n[i++].nextSibling),p(e,o[--f],u),n[s]=n[i-1]}else{if(!l){l=new Map;let d=r;for(;d<f;)l.set(o[d],d++)}let u=l.get(n[i]);if(u!=null)if(r<u&&u<f){let d=i,F=1;for(;++d<s&&d<f&&!(!l.has(n[d])||l.get(n[d])!==u+F);)F++;if(F>u-r){let de=n[i];for(;r<u;)p(e,o[r++],de)}else n[i].parentNode===e?e.replaceChild(o[r++],n[i++]):(p(e,o[r++],c),i++)}else i++;else n[i].parentNode===e&&e.removeChild(n[i]),i++}}return o}function S(e,n,o){if(n)if(Array.isArray(n))for(let t=0;t<n.length;t++)n[t].parentNode===e&&e.removeChild(n[t]);else n.parentNode===e&&e.removeChild(n);return null}function p(e,n,o){g.active&&n.parentNode===e||(o&&o.parentNode===e?e.insertBefore(n,o):e.appendChild(n))}function re(e,n){if(!e)return;let o=e[we]?.name;if((0,h.reportReactiveDirective)(n,"ref",o||typeof e=="function"&&e.name||"ref",e),M(e)){let t=n,a=e;if(!t)return;typeof t=="function"?t(a):typeof t=="object"&&"current"in t&&(t.current=a);return}typeof e=="function"?e(n):typeof e=="object"&&"current"in e&&(e.current=n)}function R(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function ie(e){let n=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,o,t;return(0,L.createRoot)(a=>{o=a,t=document.createElement("div"),t.style.display="contents",n().appendChild(t),I(t,e.children)&&re(e.ref,t)}),(0,L.onCleanup)(()=>{o(),t.remove()}),null}var j=require("@fluixi/reactive/signal");function K(e){if(k())return e.fallback??null;let n=g.active,[o,t]=(0,j.createSignal)(!n);return n&&queueMicrotask(()=>t(!0)),(0,j.createMemo)(()=>o()?e.children:e.fallback??null,void 0,{name:"client-only"})}var se=K;var _=require("@fluixi/reactive/signal");function fe(e){let[n,o]=(0,_.createSignal)(null),t=()=>o(null);return(0,_.createMemo)(()=>{let a=n();if(a!==null)return typeof e.fallback=="function"?e.fallback(a,t):e.fallback;try{return typeof e.children=="function"?e.children():e.children}catch(s){return o(s),typeof e.fallback=="function"?e.fallback(s,t):e.fallback}},void 0,{name:"ErrorBoundary"})}var ae=require("@fluixi/reactive/signal");function ce(e){return(0,ae.createMemo)(()=>{let n=typeof e=="function"?e():e,o=[];for(let[t,a]of Object.entries(n)){if(!t)continue;(typeof a=="function"?a():a)&&o.push(t)}return o.join(" ")},void 0,{name:"ClassMap"})}var le=require("@fluixi/reactive/signal");function Pe(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`)}function ue(e){return(0,le.createMemo)(()=>{let n=typeof e=="function"?e():e,o=[];for(let[t,a]of Object.entries(n)){if(!t)continue;let s=typeof a=="function"?a():a;s!=null&&o.push(`${Pe(t)}: ${s}`)}return o.join("; ")},void 0,{name:"StyleMap"})}
|
package/dist/lib/flow/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createChildOwner as q,createMemo as C,disposeScope as z,getOwner as X,runWithOwner as G,untrack as _}from"@fluixi/reactive/signal";function L(e){return typeof e=="function"?e:(()=>e)}function g(e){return()=>{let n=e();return typeof n=="function"?n():n}}function j(e){return e!=null&&e!==!1}function F(e){return!e||typeof e!="object"?!1:!!(typeof e._$litType$<"u"||typeof e._$litDirective$<"u"||Array.isArray(e.strings)&&Array.isArray(e.values))}function J(e){let n=g(()=>e.when),t=C(n,void 0),r=C(t,void 0),c=X(),s=null,f=null,i=o=>{o!==f&&(s&&z(s),s=q(c),f=o)};return C(()=>{let o=r();return i(o?"when":"fallback"),G(s,()=>{if(o){let a=e.children;return typeof a=="function"&&!F(a)?typeof t=="function"?_(()=>_(t)?a(t()):e.fallback):a(t):a}return e.fallback});return e.fallback??null},void 0,{name:"show"})}import{mapArray as Z,keyArray as Q}from"@fluixi/reactive/signal";var p={active:!1,cursor:null,parents:[]},Y=null;function $(){return Y}function M(e,n){return p.active&&n.parentNode===e}function k(e){let n=p.parents.lastIndexOf(e);n!==-1&&(p.parents.length=n),p.cursor=e.nextSibling}function A(e){if(!p.active||e==null)return;let n=Array.isArray(e)?e[e.length-1]:e;n&&typeof n.nodeType=="number"&&k(n)}function ee(e){let n=g(()=>e.each),t=()=>e.fallback??null,r=(c,s)=>{let f=e.children,i=Array.isArray(f)?f.map(o=>typeof o=="function"?o(c,s):o):typeof f=="function"?f(c,s):f;return A(i),i};return e.by?Q(n,e.by,(c,s)=>r(c,s),{fallback:t}):Z(n,(c,s)=>r(c,s),{fallback:t})}import{indexArray as ne}from"@fluixi/reactive/signal";function te(e){let n=g(()=>e.each);return ne(n,(t,r)=>{let c=e.children(t,r);return A(c),c},{fallback:()=>e.fallback??null})}import{mapArray as Bn,keyArray as qn,indexArray as zn}from"@fluixi/reactive/signal";import{createMemo as oe,createChildOwner as re,disposeScope as ie,getOwner as se,runWithOwner as D}from"@fluixi/reactive/signal";var R=Symbol("match");function fe(e){return{[R]:!0,when:g(()=>e.when),get children(){return e.children}}}function ae(e){let n=Array.isArray(e.children)?e.children:[e.children],t=se(),r=null,c=-1,s=f=>{f!==c&&(r&&ie(r),r=re(t),c=f)};return oe(()=>{for(let f=0;f<n.length;f+=1){let o=n[f],a=0;for(;typeof o=="function"&&!o[R]&&a++<10;)o=o();if(!o||typeof o!="object"||o[R]!==!0)continue;let l=o.when();if(j(l))return s(f),D(r,()=>typeof o.children=="function"?o.children(l):o.children)}return s(-2),D(r,()=>e.fallback??null)})}import{createMemo as ce,createChildOwner as le,disposeScope as ue,getOwner as ye,runWithOwner as de}from"@fluixi/reactive/signal";function pe(e){let n=L(e.component),{component:t,...r}=e,c=ye(),s=null,f;return ce(()=>{let i=n();return i!==f&&(s&&ue(s),s=le(c),f=i),i==null?null:typeof i=="string"?{tag:i,props:r}:de(s,()=>i(r))})}import{createRoot as Te,onCleanup as Ne}from"@fluixi/reactive/signal";import{isSignal as h}from"@fluixi/reactive/signal";function T(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}import{batch as pn,createEffect as hn,createRenderEffect as he,createRoot as mn,onCleanup as me,readChildren as xn}from"@fluixi/reactive/signal";var w=typeof document>"u";var U=Symbol.for("fluixi.server-node"),H=null;function W(){if(!H)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return H}function E(e){return e!=null&&e[U]===!0?!0:typeof Node<"u"&&e instanceof Node}function I(e){return e!=null&&e[U]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}function b(e,n=!1){if(w)return W().createText(e);if(p.active&&!n){let t=$()?.hydrateText(e);if(t)return t}return document.createTextNode(e)}var x=0,xe=200;function ge(e,n,t,r,c){let s=r,f=new Map;return he(()=>{let i;if(T(e)&&!h(e)){if(!f.has(e)){x++;try{let o=e();f.set(e,o)}finally{x--}}for(i=f.get(e);typeof i=="function"&&h(i);)i=i()}else for(i=e();typeof i=="function"&&h(i);)i=i();{let o=0;for(;typeof i=="function"&&o++<50;)if(T(i)){if(!f.has(i)){let a=i;x++;try{let l=a();f.set(a,l)}finally{x--}}i=f.get(i)}else if(h(i))i=i();else if(i=i(),typeof i!="function"||!h(i)&&!T(i))break}x++;try{s=P(n,i,t,s,f),c(s)}finally{x--}})}function O(e,n,t,r){if(x>xe)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;t!==void 0&&!t&&(t=b("",!0),e.appendChild(t));let c=r??null,s=o=>Array.isArray(o)&&o.some(a=>typeof a=="function"),f=o=>typeof o=="function"?o:()=>o;if(typeof n!="function"&&!s(n)){x++;try{c=P(e,n,t,c)}finally{x--}return()=>c}let i=ge(f(n),e,t,c,o=>{c=o});return()=>(i?.(),c)}function P(e,n,t,r,c){if(n==null||typeof n=="boolean")return N(e,r,t);if(typeof n=="function")for(;typeof n=="function";)n=n();if(n==null||typeof n=="boolean")return N(e,r,t);if(S(n)){let f=b("",!0);return Array.isArray(r)?r.length>0?(e.replaceChild(f,r[0]),N(e,r.slice(1),t)):d(e,f,t):r?e.replaceChild(f,r):d(e,f,t),n.then(i=>{f.parentNode===e&&P(e,i,f.nextSibling,f)}).catch(i=>{console.error("Error resolving promise in insertExpression:",i)}),f}let s=typeof n;if(s==="string"||s==="number"){if(s==="number"&&(n=String(n)),Array.isArray(r)){if(r.length===0){let i=b(n);return d(e,i,t),i}if(r.length===1&&r[0].nodeType===3)return r[0].data=n,r;r=N(e,r,t)}if(r&&I(r))return r.data=n,r;let f=b(n);return r&&r.parentNode===e?e.replaceChild(f,r):M(e,f)||d(e,f,t),f}if(E(n))return M(e,n)?(k(n),n):Array.isArray(r)?(r.length===0?d(e,n,t):r[0].parentNode===e?(e.replaceChild(n,r[0]),N(e,r.slice(1),t)):d(e,n,t),n):(r?r!==n&&(r.parentNode===e?e.replaceChild(n,r):d(e,n,t)):d(e,n,t),n);if(Array.isArray(n)){let f=[],i=Array.isArray(r)?r:r?[r]:[],o=[];m(n,f,e,t,!0,c,o);let a=be(e,i,f,t);for(let l of o){let u=O(e,l.sig,l.marker);me(()=>{N(e,u()),l.marker.parentNode===e&&e.removeChild(l.marker)})}return a}if(s==="object"&&n!==null&&typeof n=="object"){let f=n;if("type"in f&&"props"in f){let i=f;if(typeof i.type=="function"){let o=i.type(i.props||{});return P(e,o,t,r)}}}return N(e,r,t)}function m(e,n,t,r,c=!0,s,f){for(let i=0;i<e.length;i++){let o=e[i];if(!(o==null||typeof o=="boolean")){for(;typeof o=="function"&&!S(o)&&!h(o)&&!T(o)&&(o=o(),!(o==null||typeof o=="boolean")););if(!(o==null||typeof o=="boolean")){if(typeof o=="function"){let a;for(T(o)&&!h(o)?(s||(s=new Map),s.has(o)||s.set(o,o()),a=s.get(o)):a=o();typeof a=="function"&&!S(a)&&!h(a)&&!T(a);)s||(s=new Map),s.has(a)||s.set(a,a()),a=s.get(a);if(a==null||typeof a=="boolean")continue;if(typeof a=="function"){if(h(a)){if(f){let u=b("",!0);n.push(u),f.push({marker:u,sig:a});continue}let l=a();for(;typeof l=="function"&&h(l);)l=l();if(l==null||typeof l=="boolean")continue;Array.isArray(l)?m(l,n,t,r,c,s):m([l],n,t,r,c,s);continue}continue}Array.isArray(a)?m(a,n,t,r,c,s,f):m([a],n,t,r,c,s,f);continue}if(S(o)){let a=b("",!0);n.push(a),o.then(l=>{if(a.parentNode){let u=[];if(m([l],u,a.parentNode,void 0,!1,s),u.length>0){a.parentNode.replaceChild(u[0],a);for(let y=1;y<u.length;y++)a.parentNode?.insertBefore(u[y],u[y-1].nextSibling)}}}).catch(l=>console.error("Error resolving promise in array:",l));continue}if(Array.isArray(o)){m(o,n,t,r,c,s,f);continue}if(E(o)){n.push(o);continue}if(typeof o=="object"&&o!==null&&"type"in o&&"props"in o){let a=o;if(typeof a.type=="function"){let l=a.type(a.props||{});Array.isArray(l)?m(l,n,t,r,!1,s):m([l],n,t,r,!1,s);continue}}if(typeof o=="string"||typeof o=="number"){let a=String(o);if(a.trim()===""&&a!==" ")continue;n.push(b(a));continue}n.push(b(String(o)))}}}}function be(e,n,t,r){for(let u=0;u<t.length;u++){let y=t[u].parentNode;y!==null&&y!==e&&y.nodeType!==11&&(t=t.slice(),t[u]=t[u].cloneNode(!0))}let c=t.length,s=n.length,f=c,i=0,o=0,a=s>0?n[s-1].nextSibling??void 0:r,l=null;for(;i<s||o<f;){if(n[i]===t[o]){i++,o++;continue}for(;s>i&&f>o&&n[s-1]===t[f-1];)s--,f--;if(s===i){let u=f<c?o?t[o-1].nextSibling??void 0:t[f-o]:a;for(;o<f;)d(e,t[o++],u)}else if(f===o)for(;i<s;)(!l||!l.has(n[i]))&&n[i].parentNode===e&&e.removeChild(n[i]),i++;else if(n[i]===t[f-1]&&t[o]===n[s-1]){let u=n[--s].nextSibling;d(e,t[o++],n[i++].nextSibling),d(e,t[--f],u),n[s]=n[i-1]}else{if(!l){l=new Map;let y=o;for(;y<f;)l.set(t[y],y++)}let u=l.get(n[i]);if(u!=null)if(o<u&&u<f){let y=i,v=1;for(;++y<s&&y<f&&!(!l.has(n[y])||l.get(n[y])!==u+v);)v++;if(v>u-o){let B=n[i];for(;o<u;)d(e,t[o++],B)}else n[i].parentNode===e?e.replaceChild(t[o++],n[i++]):(d(e,t[o++],a),i++)}else i++;else n[i].parentNode===e&&e.removeChild(n[i]),i++}}return t}function N(e,n,t){if(n)if(Array.isArray(n))for(let r=0;r<n.length;r++)n[r].parentNode===e&&e.removeChild(n[r]);else n.parentNode===e&&e.removeChild(n);return null}function d(e,n,t){p.active&&n.parentNode===e||(t&&t.parentNode===e?e.insertBefore(n,t):e.appendChild(n))}function K(e,n){if(e){if(E(e)){let t=n,r=e;if(!t)return;typeof t=="function"?t(r):typeof t=="object"&&"current"in t&&(t.current=r);return}typeof e=="function"?e(n):typeof e=="object"&&"current"in e&&(e.current=n)}}function S(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function Ae(e){let n=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,t,r;return Te(c=>{t=c,r=document.createElement("div"),r.style.display="contents",n().appendChild(r),O(r,e.children)&&K(e.ref,r)}),Ne(()=>{t(),r.remove()}),null}import{createMemo as we,createSignal as Ee}from"@fluixi/reactive/signal";function V(e){if(w)return e.fallback??null;let n=p.active,[t,r]=Ee(!n);return n&&queueMicrotask(()=>r(!0)),we(()=>t()?e.children:e.fallback??null,void 0,{name:"client-only"})}var Se=V;import{createMemo as Pe,createSignal as ve}from"@fluixi/reactive/signal";function Ce(e){let[n,t]=ve(null),r=()=>t(null);return Pe(()=>{let c=n();if(c!==null)return typeof e.fallback=="function"?e.fallback(c,r):e.fallback;try{return typeof e.children=="function"?e.children():e.children}catch(s){return t(s),typeof e.fallback=="function"?e.fallback(s,r):e.fallback}})}import{createMemo as Me}from"@fluixi/reactive/signal";function ke(e){return Me(()=>{let n=typeof e=="function"?e():e,t=[];for(let[r,c]of Object.entries(n)){if(!r)continue;(typeof c=="function"?c():c)&&t.push(r)}return t.join(" ")})}import{createMemo as Re}from"@fluixi/reactive/signal";function Oe(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`)}function Le(e){return Re(()=>{let n=typeof e=="function"?e():e,t=[];for(let[r,c]of Object.entries(n)){if(!r)continue;let s=typeof c=="function"?c():c;s!=null&&t.push(`${Oe(r)}: ${s}`)}return t.join("; ")})}export{V as ClientOnly,pe as Dynamic,Ce as ErrorBoundary,ee as For,te as Index,fe as Match,Se as NoSsr,Ae as Portal,J as Show,ae as Switch,ke as classMap,zn as indexArray,qn as keyArray,Bn as mapArray,Le as styleMap};
|
|
1
|
+
import{createChildOwner as q,createMemo as C,disposeScope as z,getOwner as G,runWithOwner as X,untrack as H}from"@fluixi/reactive/signal";function j(e){return typeof e=="function"?e:(()=>e)}function g(e){return()=>{let n=e();return typeof n=="function"?n():n}}function _(e){return e!=null&&e!==!1}function F(e){return!e||typeof e!="object"?!1:!!(typeof e._$litType$<"u"||typeof e._$litDirective$<"u"||Array.isArray(e.strings)&&Array.isArray(e.values))}function J(e){let n=g(()=>e.when),o=C(n,void 0,{name:"Show.when"}),t=C(o,void 0,{name:"Show.cond"}),c=G(),s=null,f=null,i=r=>{r!==f&&(s&&z(s),s=q(c),f=r)};return C(()=>{let r=t();return i(r?"when":"fallback"),X(s,()=>{if(r){let a=e.children;return typeof a=="function"&&!F(a)?typeof o=="function"?H(()=>H(o)?a(o()):e.fallback):a(o):a}return e.fallback});return e.fallback??null},void 0,{name:"Show.result"})}import{mapArray as Z,keyArray as Q}from"@fluixi/reactive/signal";var p={active:!1,cursor:null,parents:[]},Y=null;function D(){return Y}function k(e,n){return p.active&&n.parentNode===e}function M(e){let n=p.parents.lastIndexOf(e);n!==-1&&(p.parents.length=n),p.cursor=e.nextSibling}function w(e){if(!p.active||e==null)return;let n=Array.isArray(e)?e[e.length-1]:e;n&&typeof n.nodeType=="number"&&M(n)}function ee(e){let n=g(()=>e.each),o=()=>e.fallback??null,t=(c,s)=>{let f=e.children,i=Array.isArray(f)?f.map(r=>typeof r=="function"?r(c,s):r):typeof f=="function"?f(c,s):f;return w(i),i};return e.by?Q(n,e.by,(c,s)=>t(c,s),{fallback:o}):Z(n,(c,s)=>t(c,s),{fallback:o})}import{indexArray as ne}from"@fluixi/reactive/signal";function te(e){let n=g(()=>e.each);return ne(n,(o,t)=>{let c=e.children(o,t);return w(c),c},{fallback:()=>e.fallback??null})}import{mapArray as Jn,keyArray as Yn,indexArray as Zn}from"@fluixi/reactive/signal";import{createMemo as oe,createChildOwner as re,disposeScope as ie,getOwner as se,runWithOwner as $}from"@fluixi/reactive/signal";var R=Symbol("match");function fe(e){return{[R]:!0,when:g(()=>e.when),get children(){return e.children}}}function ae(e){let n=Array.isArray(e.children)?e.children:[e.children],o=se(),t=null,c=-1,s=f=>{f!==c&&(t&&ie(t),t=re(o),c=f)};return oe(()=>{for(let f=0;f<n.length;f+=1){let r=n[f],a=0;for(;typeof r=="function"&&!r[R]&&a++<10;)r=r();if(!r||typeof r!="object"||r[R]!==!0)continue;let l=r.when();if(_(l))return s(f),$(t,()=>typeof r.children=="function"?r.children(l):r.children)}return s(-2),$(t,()=>e.fallback??null)},void 0,{name:"Switch"})}import{createMemo as ce,createChildOwner as le,disposeScope as ue,getOwner as de,runWithOwner as ye}from"@fluixi/reactive/signal";function pe(e){let n=j(e.component),{component:o,...t}=e,c=de(),s=null,f;return ce(()=>{let i=n();return i!==f&&(s&&ue(s),s=le(c),f=i),i==null?null:typeof i=="string"?{tag:i,props:t}:ye(s,()=>i(t))},void 0,{name:"Dynamic"})}import{createRoot as Se,onCleanup as Pe}from"@fluixi/reactive/signal";import{isSignal as h}from"@fluixi/reactive/signal";function T(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}import{batch as bn,createEffect as Tn,createRenderEffect as xe,createRoot as Nn,onCleanup as ge,readChildren as wn,reportReactiveBinding as be,reportReactiveDirective as Te,untrack as An}from"@fluixi/reactive/signal";var U=Symbol.for("fluixi.server-node"),he=Symbol.for("fluixi.dom.server-host"),me=globalThis,O=me[he]??={server:typeof document>"u",nodes:null};function A(){return O.server}function W(){if(!O.nodes)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return O.nodes}function E(e){return e!=null&&e[U]===!0?!0:typeof Node<"u"&&e instanceof Node}function I(e){return e!=null&&e[U]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var Ne="__fx_at";function b(e,n=!1){if(A())return W().createText(e);if(p.active&&!n){let o=D()?.hydrateText(e);if(o)return o}return document.createTextNode(e)}var x=0,we=200;function Ae(e,n,o,t,c){let s=t,f=new Map;return xe(()=>{be(o??n,"content",void 0,e);let i;if(T(e)&&!h(e)){if(!f.has(e)){x++;try{let r=e();f.set(e,r)}finally{x--}}for(i=f.get(e);typeof i=="function"&&h(i);)i=i()}else for(i=e();typeof i=="function"&&h(i);)i=i();{let r=0;for(;typeof i=="function"&&r++<50;)if(T(i)){if(!f.has(i)){let a=i;x++;try{let l=a();f.set(a,l)}finally{x--}}i=f.get(i)}else if(h(i))i=i();else if(i=i(),typeof i!="function"||!h(i)&&!T(i))break}x++;try{s=P(n,i,o,s,f),c(s)}finally{x--}})}function L(e,n,o,t){if(x>we)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;o!==void 0&&!o&&(o=b("",!0),e.appendChild(o));let c=t??null,s=r=>Array.isArray(r)&&r.some(a=>typeof a=="function"),f=r=>typeof r=="function"?r:()=>r;if(typeof n!="function"&&!s(n)){x++;try{c=P(e,n,o,c)}finally{x--}return()=>c}let i=Ae(f(n),e,o,c,r=>{c=r});return()=>(i?.(),c)}function P(e,n,o,t,c){if(n==null||typeof n=="boolean")return N(e,t,o);if(typeof n=="function")for(;typeof n=="function";)n=n();if(n==null||typeof n=="boolean")return N(e,t,o);if(S(n)){let f=b("",!0);return Array.isArray(t)?t.length>0?(e.replaceChild(f,t[0]),N(e,t.slice(1),o)):y(e,f,o):t?e.replaceChild(f,t):y(e,f,o),n.then(i=>{f.parentNode===e&&P(e,i,f.nextSibling,f)}).catch(i=>{console.error("Error resolving promise in insertExpression:",i)}),f}let s=typeof n;if(s==="string"||s==="number"){if(s==="number"&&(n=String(n)),Array.isArray(t)){if(t.length===0){let i=b(n);return y(e,i,o),i}if(t.length===1&&t[0].nodeType===3)return t[0].data=n,t;t=N(e,t,o)}if(t&&I(t))return t.data=n,t;let f=b(n);return t&&t.parentNode===e?e.replaceChild(f,t):k(e,f)||y(e,f,o),f}if(E(n))return k(e,n)?(M(n),n):Array.isArray(t)?(t.length===0?y(e,n,o):t[0].parentNode===e?(e.replaceChild(n,t[0]),N(e,t.slice(1),o)):y(e,n,o),n):(t?t!==n&&(t.parentNode===e?e.replaceChild(n,t):y(e,n,o)):y(e,n,o),n);if(Array.isArray(n)){let f=[],i=Array.isArray(t)?t:t?[t]:[],r=[];m(n,f,e,o,!0,c,r);let a=Ee(e,i,f,o);for(let l of r){let u=L(e,l.sig,l.marker);ge(()=>{N(e,u()),l.marker.parentNode===e&&e.removeChild(l.marker)})}return a}if(s==="object"&&n!==null&&typeof n=="object"){let f=n;if("type"in f&&"props"in f){let i=f;if(typeof i.type=="function"){let r=i.type(i.props||{});return P(e,r,o,t)}}}return N(e,t,o)}function m(e,n,o,t,c=!0,s,f){for(let i=0;i<e.length;i++){let r=e[i];if(!(r==null||typeof r=="boolean")){for(;typeof r=="function"&&!S(r)&&!h(r)&&!T(r)&&(r=r(),!(r==null||typeof r=="boolean")););if(!(r==null||typeof r=="boolean")){if(typeof r=="function"){let a;for(T(r)&&!h(r)?(s||(s=new Map),s.has(r)||s.set(r,r()),a=s.get(r)):a=r();typeof a=="function"&&!S(a)&&!h(a)&&!T(a);)s||(s=new Map),s.has(a)||s.set(a,a()),a=s.get(a);if(a==null||typeof a=="boolean")continue;if(typeof a=="function"){if(h(a)){if(f){let u=b("",!0);n.push(u),f.push({marker:u,sig:a});continue}let l=a();for(;typeof l=="function"&&h(l);)l=l();if(l==null||typeof l=="boolean")continue;Array.isArray(l)?m(l,n,o,t,c,s):m([l],n,o,t,c,s);continue}continue}Array.isArray(a)?m(a,n,o,t,c,s,f):m([a],n,o,t,c,s,f);continue}if(S(r)){let a=b("",!0);n.push(a),r.then(l=>{if(a.parentNode){let u=[];if(m([l],u,a.parentNode,void 0,!1,s),u.length>0){a.parentNode.replaceChild(u[0],a);for(let d=1;d<u.length;d++)a.parentNode?.insertBefore(u[d],u[d-1].nextSibling)}}}).catch(l=>console.error("Error resolving promise in array:",l));continue}if(Array.isArray(r)){m(r,n,o,t,c,s,f);continue}if(E(r)){n.push(r);continue}if(typeof r=="object"&&r!==null&&"type"in r&&"props"in r){let a=r;if(typeof a.type=="function"){let l=a.type(a.props||{});Array.isArray(l)?m(l,n,o,t,!1,s):m([l],n,o,t,!1,s);continue}}if(typeof r=="string"||typeof r=="number"){let a=String(r);if(a.trim()===""&&a!==" ")continue;n.push(b(a));continue}n.push(b(String(r)))}}}}function Ee(e,n,o,t){for(let u=0;u<o.length;u++){let d=o[u].parentNode;d!==null&&d!==e&&d.nodeType!==11&&(o=o.slice(),o[u]=o[u].cloneNode(!0))}let c=o.length,s=n.length,f=c,i=0,r=0,a=s>0?n[s-1].nextSibling??void 0:t,l=null;for(;i<s||r<f;){if(n[i]===o[r]){i++,r++;continue}for(;s>i&&f>r&&n[s-1]===o[f-1];)s--,f--;if(s===i){let u=f<c?r?o[r-1].nextSibling??void 0:o[f-r]:a;for(;r<f;)y(e,o[r++],u)}else if(f===r)for(;i<s;)(!l||!l.has(n[i]))&&n[i].parentNode===e&&e.removeChild(n[i]),i++;else if(n[i]===o[f-1]&&o[r]===n[s-1]){let u=n[--s].nextSibling;y(e,o[r++],n[i++].nextSibling),y(e,o[--f],u),n[s]=n[i-1]}else{if(!l){l=new Map;let d=r;for(;d<f;)l.set(o[d],d++)}let u=l.get(n[i]);if(u!=null)if(r<u&&u<f){let d=i,v=1;for(;++d<s&&d<f&&!(!l.has(n[d])||l.get(n[d])!==u+v);)v++;if(v>u-r){let B=n[i];for(;r<u;)y(e,o[r++],B)}else n[i].parentNode===e?e.replaceChild(o[r++],n[i++]):(y(e,o[r++],a),i++)}else i++;else n[i].parentNode===e&&e.removeChild(n[i]),i++}}return o}function N(e,n,o){if(n)if(Array.isArray(n))for(let t=0;t<n.length;t++)n[t].parentNode===e&&e.removeChild(n[t]);else n.parentNode===e&&e.removeChild(n);return null}function y(e,n,o){p.active&&n.parentNode===e||(o&&o.parentNode===e?e.insertBefore(n,o):e.appendChild(n))}function K(e,n){if(!e)return;let o=e[Ne]?.name;if(Te(n,"ref",o||typeof e=="function"&&e.name||"ref",e),E(e)){let t=n,c=e;if(!t)return;typeof t=="function"?t(c):typeof t=="object"&&"current"in t&&(t.current=c);return}typeof e=="function"?e(n):typeof e=="object"&&"current"in e&&(e.current=n)}function S(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function ve(e){let n=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,o,t;return Se(c=>{o=c,t=document.createElement("div"),t.style.display="contents",n().appendChild(t),L(t,e.children)&&K(e.ref,t)}),Pe(()=>{o(),t.remove()}),null}import{createMemo as Ce,createSignal as ke}from"@fluixi/reactive/signal";function V(e){if(A())return e.fallback??null;let n=p.active,[o,t]=ke(!n);return n&&queueMicrotask(()=>t(!0)),Ce(()=>o()?e.children:e.fallback??null,void 0,{name:"client-only"})}var Me=V;import{createMemo as Re,createSignal as Oe}from"@fluixi/reactive/signal";function Le(e){let[n,o]=Oe(null),t=()=>o(null);return Re(()=>{let c=n();if(c!==null)return typeof e.fallback=="function"?e.fallback(c,t):e.fallback;try{return typeof e.children=="function"?e.children():e.children}catch(s){return o(s),typeof e.fallback=="function"?e.fallback(s,t):e.fallback}},void 0,{name:"ErrorBoundary"})}import{createMemo as je}from"@fluixi/reactive/signal";function _e(e){return je(()=>{let n=typeof e=="function"?e():e,o=[];for(let[t,c]of Object.entries(n)){if(!t)continue;(typeof c=="function"?c():c)&&o.push(t)}return o.join(" ")},void 0,{name:"ClassMap"})}import{createMemo as Fe}from"@fluixi/reactive/signal";function He(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`)}function De(e){return Fe(()=>{let n=typeof e=="function"?e():e,o=[];for(let[t,c]of Object.entries(n)){if(!t)continue;let s=typeof c=="function"?c():c;s!=null&&o.push(`${He(t)}: ${s}`)}return o.join("; ")},void 0,{name:"StyleMap"})}export{V as ClientOnly,pe as Dynamic,Le as ErrorBoundary,ee as For,te as Index,fe as Match,Me as NoSsr,ve as Portal,J as Show,ae as Switch,_e as classMap,Zn as indexArray,Yn as keyArray,Jn as mapArray,De as styleMap};
|
package/dist/lib/flow/portal.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var P=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var
|
|
1
|
+
"use strict";var P=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var K=Object.prototype.hasOwnProperty;var I=(e,n)=>{for(var t in n)P(e,t,{get:n[t],enumerable:!0})},B=(e,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of W(n))!K.call(e,l)&&l!==t&&P(e,l,{get:()=>n[l],enumerable:!(o=F(n,l))||o.enumerable});return e};var q=e=>B(P({},"__esModule",{value:!0}),e);var Z={};I(Z,{Portal:()=>Q});module.exports=q(Z);var A=require("@fluixi/reactive/signal");var h=require("@fluixi/reactive/signal");function N(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}var p=require("@fluixi/reactive/signal");var R=Symbol.for("fluixi.server-node"),V=Symbol.for("fluixi.dom.server-host"),G=globalThis,C=G[V]??={server:typeof document>"u",nodes:null};function M(){return C.server}function _(){if(!C.nodes)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return C.nodes}function T(e){return e!=null&&e[R]===!0?!0:typeof Node<"u"&&e instanceof Node}function H(e){return e!=null&&e[R]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var b={active:!1,cursor:null,parents:[]},U=null;function j(){return U}function L(e,n){return b.active&&n.parentNode===e}function D(e){let n=b.parents.lastIndexOf(e);n!==-1&&(b.parents.length=n),b.cursor=e.nextSibling}var X="__fx_at";function m(e,n=!1){if(M())return _().createText(e);if(b.active&&!n){let t=j()?.hydrateText(e);if(t)return t}return document.createTextNode(e)}var x=0,z=200;function J(e,n,t,o,l){let u=o,s=new Map;return(0,p.createRenderEffect)(()=>{(0,p.reportReactiveBinding)(t??n,"content",void 0,e);let r;if(N(e)&&!(0,h.isSignal)(e)){if(!s.has(e)){x++;try{let i=e();s.set(e,i)}finally{x--}}for(r=s.get(e);typeof r=="function"&&(0,h.isSignal)(r);)r=r()}else for(r=e();typeof r=="function"&&(0,h.isSignal)(r);)r=r();{let i=0;for(;typeof r=="function"&&i++<50;)if(N(r)){if(!s.has(r)){let f=r;x++;try{let a=f();s.set(f,a)}finally{x--}}r=s.get(r)}else if((0,h.isSignal)(r))r=r();else if(r=r(),typeof r!="function"||!(0,h.isSignal)(r)&&!N(r))break}x++;try{u=S(n,r,t,u,s),l(u)}finally{x--}})}function k(e,n,t,o){if(x>z)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;t!==void 0&&!t&&(t=m("",!0),e.appendChild(t));let l=o??null,u=i=>Array.isArray(i)&&i.some(f=>typeof f=="function"),s=i=>typeof i=="function"?i:()=>i;if(typeof n!="function"&&!u(n)){x++;try{l=S(e,n,t,l)}finally{x--}return()=>l}let r=J(s(n),e,t,l,i=>{l=i});return()=>(r?.(),l)}function S(e,n,t,o,l){if(n==null||typeof n=="boolean")return E(e,o,t);if(typeof n=="function")for(;typeof n=="function";)n=n();if(n==null||typeof n=="boolean")return E(e,o,t);if(w(n)){let s=m("",!0);return Array.isArray(o)?o.length>0?(e.replaceChild(s,o[0]),E(e,o.slice(1),t)):y(e,s,t):o?e.replaceChild(s,o):y(e,s,t),n.then(r=>{s.parentNode===e&&S(e,r,s.nextSibling,s)}).catch(r=>{console.error("Error resolving promise in insertExpression:",r)}),s}let u=typeof n;if(u==="string"||u==="number"){if(u==="number"&&(n=String(n)),Array.isArray(o)){if(o.length===0){let r=m(n);return y(e,r,t),r}if(o.length===1&&o[0].nodeType===3)return o[0].data=n,o;o=E(e,o,t)}if(o&&H(o))return o.data=n,o;let s=m(n);return o&&o.parentNode===e?e.replaceChild(s,o):L(e,s)||y(e,s,t),s}if(T(n))return L(e,n)?(D(n),n):Array.isArray(o)?(o.length===0?y(e,n,t):o[0].parentNode===e?(e.replaceChild(n,o[0]),E(e,o.slice(1),t)):y(e,n,t),n):(o?o!==n&&(o.parentNode===e?e.replaceChild(n,o):y(e,n,t)):y(e,n,t),n);if(Array.isArray(n)){let s=[],r=Array.isArray(o)?o:o?[o]:[],i=[];g(n,s,e,t,!0,l,i);let f=Y(e,r,s,t);for(let a of i){let c=k(e,a.sig,a.marker);(0,p.onCleanup)(()=>{E(e,c()),a.marker.parentNode===e&&e.removeChild(a.marker)})}return f}if(u==="object"&&n!==null&&typeof n=="object"){let s=n;if("type"in s&&"props"in s){let r=s;if(typeof r.type=="function"){let i=r.type(r.props||{});return S(e,i,t,o)}}}return E(e,o,t)}function g(e,n,t,o,l=!0,u,s){for(let r=0;r<e.length;r++){let i=e[r];if(!(i==null||typeof i=="boolean")){for(;typeof i=="function"&&!w(i)&&!(0,h.isSignal)(i)&&!N(i)&&(i=i(),!(i==null||typeof i=="boolean")););if(!(i==null||typeof i=="boolean")){if(typeof i=="function"){let f;for(N(i)&&!(0,h.isSignal)(i)?(u||(u=new Map),u.has(i)||u.set(i,i()),f=u.get(i)):f=i();typeof f=="function"&&!w(f)&&!(0,h.isSignal)(f)&&!N(f);)u||(u=new Map),u.has(f)||u.set(f,f()),f=u.get(f);if(f==null||typeof f=="boolean")continue;if(typeof f=="function"){if((0,h.isSignal)(f)){if(s){let c=m("",!0);n.push(c),s.push({marker:c,sig:f});continue}let a=f();for(;typeof a=="function"&&(0,h.isSignal)(a);)a=a();if(a==null||typeof a=="boolean")continue;Array.isArray(a)?g(a,n,t,o,l,u):g([a],n,t,o,l,u);continue}continue}Array.isArray(f)?g(f,n,t,o,l,u,s):g([f],n,t,o,l,u,s);continue}if(w(i)){let f=m("",!0);n.push(f),i.then(a=>{if(f.parentNode){let c=[];if(g([a],c,f.parentNode,void 0,!1,u),c.length>0){f.parentNode.replaceChild(c[0],f);for(let d=1;d<c.length;d++)f.parentNode?.insertBefore(c[d],c[d-1].nextSibling)}}}).catch(a=>console.error("Error resolving promise in array:",a));continue}if(Array.isArray(i)){g(i,n,t,o,l,u,s);continue}if(T(i)){n.push(i);continue}if(typeof i=="object"&&i!==null&&"type"in i&&"props"in i){let f=i;if(typeof f.type=="function"){let a=f.type(f.props||{});Array.isArray(a)?g(a,n,t,o,!1,u):g([a],n,t,o,!1,u);continue}}if(typeof i=="string"||typeof i=="number"){let f=String(i);if(f.trim()===""&&f!==" ")continue;n.push(m(f));continue}n.push(m(String(i)))}}}}function Y(e,n,t,o){for(let c=0;c<t.length;c++){let d=t[c].parentNode;d!==null&&d!==e&&d.nodeType!==11&&(t=t.slice(),t[c]=t[c].cloneNode(!0))}let l=t.length,u=n.length,s=l,r=0,i=0,f=u>0?n[u-1].nextSibling??void 0:o,a=null;for(;r<u||i<s;){if(n[r]===t[i]){r++,i++;continue}for(;u>r&&s>i&&n[u-1]===t[s-1];)u--,s--;if(u===r){let c=s<l?i?t[i-1].nextSibling??void 0:t[s-i]:f;for(;i<s;)y(e,t[i++],c)}else if(s===i)for(;r<u;)(!a||!a.has(n[r]))&&n[r].parentNode===e&&e.removeChild(n[r]),r++;else if(n[r]===t[s-1]&&t[i]===n[u-1]){let c=n[--u].nextSibling;y(e,t[i++],n[r++].nextSibling),y(e,t[--s],c),n[u]=n[r-1]}else{if(!a){a=new Map;let d=i;for(;d<s;)a.set(t[d],d++)}let c=a.get(n[r]);if(c!=null)if(i<c&&c<s){let d=r,v=1;for(;++d<u&&d<s&&!(!a.has(n[d])||a.get(n[d])!==c+v);)v++;if(v>c-i){let $=n[r];for(;i<c;)y(e,t[i++],$)}else n[r].parentNode===e?e.replaceChild(t[i++],n[r++]):(y(e,t[i++],f),r++)}else r++;else n[r].parentNode===e&&e.removeChild(n[r]),r++}}return t}function E(e,n,t){if(n)if(Array.isArray(n))for(let o=0;o<n.length;o++)n[o].parentNode===e&&e.removeChild(n[o]);else n.parentNode===e&&e.removeChild(n);return null}function y(e,n,t){b.active&&n.parentNode===e||(t&&t.parentNode===e?e.insertBefore(n,t):e.appendChild(n))}function O(e,n){if(!e)return;let t=e[X]?.name;if((0,p.reportReactiveDirective)(n,"ref",t||typeof e=="function"&&e.name||"ref",e),T(e)){let o=n,l=e;if(!o)return;typeof o=="function"?o(l):typeof o=="object"&&"current"in o&&(o.current=l);return}typeof e=="function"?e(n):typeof e=="object"&&"current"in e&&(e.current=n)}function w(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function Q(e){let n=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,t,o;return(0,A.createRoot)(l=>{t=l,o=document.createElement("div"),o.style.display="contents",n().appendChild(o),k(o,e.children)&&O(e.ref,o)}),(0,A.onCleanup)(()=>{t(),o.remove()}),null}
|
package/dist/lib/flow/portal.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRoot as
|
|
1
|
+
import{createRoot as U,onCleanup as X}from"@fluixi/reactive/signal";import{isSignal as p}from"@fluixi/reactive/signal";function m(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}import{batch as oe,createEffect as ie,createRenderEffect as F,createRoot as re,onCleanup as W,readChildren as se,reportReactiveBinding as K,reportReactiveDirective as I,untrack as fe}from"@fluixi/reactive/signal";var C=Symbol.for("fluixi.server-node"),D=Symbol.for("fluixi.dom.server-host"),O=globalThis,A=O[D]??={server:typeof document>"u",nodes:null};function L(){return A.server}function k(){if(!A.nodes)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return A.nodes}function E(e){return e!=null&&e[C]===!0?!0:typeof Node<"u"&&e instanceof Node}function R(e){return e!=null&&e[C]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var N={active:!1,cursor:null,parents:[]},$=null;function M(){return $}function v(e,n){return N.active&&n.parentNode===e}function _(e){let n=N.parents.lastIndexOf(e);n!==-1&&(N.parents.length=n),N.cursor=e.nextSibling}var B="__fx_at";function x(e,n=!1){if(L())return k().createText(e);if(N.active&&!n){let i=M()?.hydrateText(e);if(i)return i}return document.createTextNode(e)}var g=0,q=200;function V(e,n,i,o,c){let u=o,s=new Map;return F(()=>{K(i??n,"content",void 0,e);let r;if(m(e)&&!p(e)){if(!s.has(e)){g++;try{let t=e();s.set(e,t)}finally{g--}}for(r=s.get(e);typeof r=="function"&&p(r);)r=r()}else for(r=e();typeof r=="function"&&p(r);)r=r();{let t=0;for(;typeof r=="function"&&t++<50;)if(m(r)){if(!s.has(r)){let f=r;g++;try{let a=f();s.set(f,a)}finally{g--}}r=s.get(r)}else if(p(r))r=r();else if(r=r(),typeof r!="function"||!p(r)&&!m(r))break}g++;try{u=w(n,r,i,u,s),c(u)}finally{g--}})}function P(e,n,i,o){if(g>q)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;i!==void 0&&!i&&(i=x("",!0),e.appendChild(i));let c=o??null,u=t=>Array.isArray(t)&&t.some(f=>typeof f=="function"),s=t=>typeof t=="function"?t:()=>t;if(typeof n!="function"&&!u(n)){g++;try{c=w(e,n,i,c)}finally{g--}return()=>c}let r=V(s(n),e,i,c,t=>{c=t});return()=>(r?.(),c)}function w(e,n,i,o,c){if(n==null||typeof n=="boolean")return b(e,o,i);if(typeof n=="function")for(;typeof n=="function";)n=n();if(n==null||typeof n=="boolean")return b(e,o,i);if(T(n)){let s=x("",!0);return Array.isArray(o)?o.length>0?(e.replaceChild(s,o[0]),b(e,o.slice(1),i)):y(e,s,i):o?e.replaceChild(s,o):y(e,s,i),n.then(r=>{s.parentNode===e&&w(e,r,s.nextSibling,s)}).catch(r=>{console.error("Error resolving promise in insertExpression:",r)}),s}let u=typeof n;if(u==="string"||u==="number"){if(u==="number"&&(n=String(n)),Array.isArray(o)){if(o.length===0){let r=x(n);return y(e,r,i),r}if(o.length===1&&o[0].nodeType===3)return o[0].data=n,o;o=b(e,o,i)}if(o&&R(o))return o.data=n,o;let s=x(n);return o&&o.parentNode===e?e.replaceChild(s,o):v(e,s)||y(e,s,i),s}if(E(n))return v(e,n)?(_(n),n):Array.isArray(o)?(o.length===0?y(e,n,i):o[0].parentNode===e?(e.replaceChild(n,o[0]),b(e,o.slice(1),i)):y(e,n,i),n):(o?o!==n&&(o.parentNode===e?e.replaceChild(n,o):y(e,n,i)):y(e,n,i),n);if(Array.isArray(n)){let s=[],r=Array.isArray(o)?o:o?[o]:[],t=[];h(n,s,e,i,!0,c,t);let f=G(e,r,s,i);for(let a of t){let l=P(e,a.sig,a.marker);W(()=>{b(e,l()),a.marker.parentNode===e&&e.removeChild(a.marker)})}return f}if(u==="object"&&n!==null&&typeof n=="object"){let s=n;if("type"in s&&"props"in s){let r=s;if(typeof r.type=="function"){let t=r.type(r.props||{});return w(e,t,i,o)}}}return b(e,o,i)}function h(e,n,i,o,c=!0,u,s){for(let r=0;r<e.length;r++){let t=e[r];if(!(t==null||typeof t=="boolean")){for(;typeof t=="function"&&!T(t)&&!p(t)&&!m(t)&&(t=t(),!(t==null||typeof t=="boolean")););if(!(t==null||typeof t=="boolean")){if(typeof t=="function"){let f;for(m(t)&&!p(t)?(u||(u=new Map),u.has(t)||u.set(t,t()),f=u.get(t)):f=t();typeof f=="function"&&!T(f)&&!p(f)&&!m(f);)u||(u=new Map),u.has(f)||u.set(f,f()),f=u.get(f);if(f==null||typeof f=="boolean")continue;if(typeof f=="function"){if(p(f)){if(s){let l=x("",!0);n.push(l),s.push({marker:l,sig:f});continue}let a=f();for(;typeof a=="function"&&p(a);)a=a();if(a==null||typeof a=="boolean")continue;Array.isArray(a)?h(a,n,i,o,c,u):h([a],n,i,o,c,u);continue}continue}Array.isArray(f)?h(f,n,i,o,c,u,s):h([f],n,i,o,c,u,s);continue}if(T(t)){let f=x("",!0);n.push(f),t.then(a=>{if(f.parentNode){let l=[];if(h([a],l,f.parentNode,void 0,!1,u),l.length>0){f.parentNode.replaceChild(l[0],f);for(let d=1;d<l.length;d++)f.parentNode?.insertBefore(l[d],l[d-1].nextSibling)}}}).catch(a=>console.error("Error resolving promise in array:",a));continue}if(Array.isArray(t)){h(t,n,i,o,c,u,s);continue}if(E(t)){n.push(t);continue}if(typeof t=="object"&&t!==null&&"type"in t&&"props"in t){let f=t;if(typeof f.type=="function"){let a=f.type(f.props||{});Array.isArray(a)?h(a,n,i,o,!1,u):h([a],n,i,o,!1,u);continue}}if(typeof t=="string"||typeof t=="number"){let f=String(t);if(f.trim()===""&&f!==" ")continue;n.push(x(f));continue}n.push(x(String(t)))}}}}function G(e,n,i,o){for(let l=0;l<i.length;l++){let d=i[l].parentNode;d!==null&&d!==e&&d.nodeType!==11&&(i=i.slice(),i[l]=i[l].cloneNode(!0))}let c=i.length,u=n.length,s=c,r=0,t=0,f=u>0?n[u-1].nextSibling??void 0:o,a=null;for(;r<u||t<s;){if(n[r]===i[t]){r++,t++;continue}for(;u>r&&s>t&&n[u-1]===i[s-1];)u--,s--;if(u===r){let l=s<c?t?i[t-1].nextSibling??void 0:i[s-t]:f;for(;t<s;)y(e,i[t++],l)}else if(s===t)for(;r<u;)(!a||!a.has(n[r]))&&n[r].parentNode===e&&e.removeChild(n[r]),r++;else if(n[r]===i[s-1]&&i[t]===n[u-1]){let l=n[--u].nextSibling;y(e,i[t++],n[r++].nextSibling),y(e,i[--s],l),n[u]=n[r-1]}else{if(!a){a=new Map;let d=t;for(;d<s;)a.set(i[d],d++)}let l=a.get(n[r]);if(l!=null)if(t<l&&l<s){let d=r,S=1;for(;++d<u&&d<s&&!(!a.has(n[d])||a.get(n[d])!==l+S);)S++;if(S>l-t){let j=n[r];for(;t<l;)y(e,i[t++],j)}else n[r].parentNode===e?e.replaceChild(i[t++],n[r++]):(y(e,i[t++],f),r++)}else r++;else n[r].parentNode===e&&e.removeChild(n[r]),r++}}return i}function b(e,n,i){if(n)if(Array.isArray(n))for(let o=0;o<n.length;o++)n[o].parentNode===e&&e.removeChild(n[o]);else n.parentNode===e&&e.removeChild(n);return null}function y(e,n,i){N.active&&n.parentNode===e||(i&&i.parentNode===e?e.insertBefore(n,i):e.appendChild(n))}function H(e,n){if(!e)return;let i=e[B]?.name;if(I(n,"ref",i||typeof e=="function"&&e.name||"ref",e),E(e)){let o=n,c=e;if(!o)return;typeof o=="function"?o(c):typeof o=="object"&&"current"in o&&(o.current=c);return}typeof e=="function"?e(n):typeof e=="object"&&"current"in e&&(e.current=n)}function T(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function ye(e){let n=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,i,o;return U(c=>{i=c,o=document.createElement("div"),o.style.display="contents",n().appendChild(o),P(o,e.children)&&H(e.ref,o)}),X(()=>{i(),o.remove()}),null}export{ye as Portal};
|
package/dist/lib/flow/show.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var l=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var w=(e,n)=>{for(var t in n)l(e,t,{get:n[t],enumerable:!0})},m=(e,n,t,
|
|
1
|
+
"use strict";var l=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var w=(e,n)=>{for(var t in n)l(e,t,{get:n[t],enumerable:!0})},m=(e,n,t,c)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of h(n))!p.call(e,o)&&o!==t&&l(e,o,{get:()=>n[o],enumerable:!(c=y(n,o))||c.enumerable});return e};var A=e=>m(l({},"__esModule",{value:!0}),e);var S={};w(S,{Show:()=>b});module.exports=A(S);var r=require("@fluixi/reactive/signal");function u(e){return()=>{let n=e();return typeof n=="function"?n():n}}function T(e){return!e||typeof e!="object"?!1:!!(typeof e._$litType$<"u"||typeof e._$litDirective$<"u"||Array.isArray(e.strings)&&Array.isArray(e.values))}function b(e){let n=u(()=>e.when),t=(0,r.createMemo)(n,void 0,{name:"Show.when"}),c=(0,r.createMemo)(t,void 0,{name:"Show.cond"}),o=(0,r.getOwner)(),s=null,f=null,d=a=>{a!==f&&(s&&(0,r.disposeScope)(s),s=(0,r.createChildOwner)(o),f=a)};return(0,r.createMemo)(()=>{let a=c();return d(a?"when":"fallback"),(0,r.runWithOwner)(s,()=>{if(a){let i=e.children;return typeof i=="function"&&!T(i)?typeof t=="function"?(0,r.untrack)(()=>(0,r.untrack)(t)?i(t()):e.fallback):i(t):i}return e.fallback});return e.fallback??null},void 0,{name:"Show.result"})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"show.d.ts","sourceRoot":"","sources":["../../../src/lib/flow/show.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,QAAQ,EAAc,MAAM,yBAAyB,CAAC;AAE/D;;GAEG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,MAAM,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,CAAC,SAAS,MAAM,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAGtG,MAAM,WAAW,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG;IACnC,yDAAyD;IACzD,IAAI,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,KAAK,CAAC;IACjD,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf;;;;;;OAMG;IACH,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC;IAC3C,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED;;;;;;;;;;;;GAYG;AAcH,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,GAAG,
|
|
1
|
+
{"version":3,"file":"show.d.ts","sourceRoot":"","sources":["../../../src/lib/flow/show.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,QAAQ,EAAc,MAAM,yBAAyB,CAAC;AAE/D;;GAEG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,MAAM,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,CAAC,SAAS,MAAM,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAGtG,MAAM,WAAW,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG;IACnC,yDAAyD;IACzD,IAAI,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,KAAK,CAAC;IACjD,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf;;;;;;OAMG;IACH,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC;IAC3C,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED;;;;;;;;;;;;GAYG;AAcH,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,GAAG,CAoGhD"}
|
package/dist/lib/flow/show.js
CHANGED
|
@@ -31,8 +31,10 @@ export function Show(props) {
|
|
|
31
31
|
// still work — resolveReactiveProp unwraps the accessor form once.
|
|
32
32
|
const when = resolveReactiveProp(() => props.when);
|
|
33
33
|
// const {when} = props
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
// Named for a watcher: three memos at one line, two of them anonymous, is what a graph of
|
|
35
|
+
// a page with a few conditions turns into.
|
|
36
|
+
const value = createMemo(when, undefined, { name: 'Show.when' });
|
|
37
|
+
const cond = createMemo(value, undefined, { name: 'Show.cond' });
|
|
36
38
|
// Each branch renders in its own scope so that leaving it tears down whatever
|
|
37
39
|
// it registered — an event listener, an observer, a timer. Without this the
|
|
38
40
|
// branch's `onCleanup`s land on the enclosing owner and only run when the
|
|
@@ -115,7 +117,10 @@ export function Show(props) {
|
|
|
115
117
|
// return children;
|
|
116
118
|
// }
|
|
117
119
|
return props.fallback ?? null;
|
|
118
|
-
}, undefined,
|
|
120
|
+
}, undefined,
|
|
121
|
+
// Not `Show`: the compiler already marks the memo it wraps the component in with that,
|
|
122
|
+
// and two cards of the same name in one graph is worse than a longer one.
|
|
123
|
+
{ name: 'Show.result' });
|
|
119
124
|
}
|
|
120
125
|
// export function Show1<T>(props: ShowProps<T>): any {
|
|
121
126
|
// const when = normalizeAccessor(props.when);
|
package/dist/lib/flow/show.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createChildOwner as y,createMemo as
|
|
1
|
+
import{createChildOwner as y,createMemo as i,disposeScope as h,getOwner as p,runWithOwner as w,untrack as f}from"@fluixi/reactive/signal";function s(e){return()=>{let n=e();return typeof n=="function"?n():n}}function l(e){return!e||typeof e!="object"?!1:!!(typeof e._$litType$<"u"||typeof e._$litDirective$<"u"||Array.isArray(e.strings)&&Array.isArray(e.values))}function O(e){let n=s(()=>e.when),r=i(n,void 0,{name:"Show.when"}),u=i(r,void 0,{name:"Show.cond"}),T=p(),a=null,c=null,d=t=>{t!==c&&(a&&h(a),a=y(T),c=t)};return i(()=>{let t=u();return d(t?"when":"fallback"),w(a,()=>{if(t){let o=e.children;return typeof o=="function"&&!l(o)?typeof r=="function"?f(()=>f(r)?o(r()):e.fallback):o(r):o}return e.fallback});return e.fallback??null},void 0,{name:"Show.result"})}export{O as Show};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var o=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var f=(e,
|
|
1
|
+
"use strict";var o=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var f=(e,n)=>{for(var r in n)o(e,r,{get:n[r],enumerable:!0})},d=(e,n,r,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of c(n))!a.call(e,t)&&t!==r&&o(e,t,{get:()=>n[t],enumerable:!(s=i(n,t))||s.enumerable});return e};var p=e=>d(o({},"__esModule",{value:!0}),e);var m={};f(m,{styleMap:()=>y});module.exports=p(m);var l=require("@fluixi/reactive/signal");function g(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`)}function y(e){return(0,l.createMemo)(()=>{let n=typeof e=="function"?e():e,r=[];for(let[s,t]of Object.entries(n)){if(!s)continue;let u=typeof t=="function"?t():t;u!=null&&r.push(`${g(s)}: ${u}`)}return r.join("; ")},void 0,{name:"StyleMap"})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createMemo as u}from"@fluixi/reactive/signal";function l(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,
|
|
1
|
+
import{createMemo as u}from"@fluixi/reactive/signal";function l(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`)}function a(e){return u(()=>{let n=typeof e=="function"?e():e,r=[];for(let[s,t]of Object.entries(n)){if(!s)continue;let o=typeof t=="function"?t():t;o!=null&&r.push(`${l(s)}: ${o}`)}return r.join("; ")},void 0,{name:"StyleMap"})}export{a as styleMap};
|
package/dist/lib/flow/switch.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var l=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var w=(e,n)=>{for(var a in n)l(e,a,{get:n[a],enumerable:!0})},b=(e,n,a,c)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of p(n))!A.call(e,o)&&o!==a&&l(e,o,{get:()=>n[o],enumerable:!(c=y(n,o))||c.enumerable});return e};var M=e=>b(l({},"__esModule",{value:!0}),e);var x={};w(x,{Match:()=>m,Switch:()=>N});module.exports=M(x);var t=require("@fluixi/reactive/signal");function h(e){return()=>{let n=e();return typeof n=="function"?n():n}}function d(e){return e!=null&&e!==!1}var s=Symbol("match");function m(e){return{[s]:!0,when:h(()=>e.when),get children(){return e.children}}}function N(e){let n=Array.isArray(e.children)?e.children:[e.children],a=(0,t.getOwner)(),c=null,o=-1,f=i=>{i!==o&&(c&&(0,t.disposeScope)(c),c=(0,t.createChildOwner)(a),o=i)};return(0,t.createMemo)(()=>{for(let i=0;i<n.length;i+=1){let r=n[i],T=0;for(;typeof r=="function"&&!r[s]&&T++<10;)r=r();if(!r||typeof r!="object"||r[s]!==!0)continue;let u=r.when();if(d(u))return f(i),(0,t.runWithOwner)(c,()=>typeof r.children=="function"?r.children(u):r.children)}return f(-2),(0,t.runWithOwner)(c,()=>e.fallback??null)},void 0,{name:"Switch"})}
|
package/dist/lib/flow/switch.js
CHANGED