vite-plugin-kiru 0.25.0 → 0.26.0
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/index.js +32 -91
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1692,7 +1692,7 @@ var dist_default = `<!DOCTYPE html>
|
|
|
1692
1692
|
<link rel="icon" type="image/svg+xml" href="./favicon.svg" />
|
|
1693
1693
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
1694
1694
|
<title>Kiru Devtools</title>
|
|
1695
|
-
<script type="module" crossorigin>import*as m from"kiru";import{useState as xe,useEffect as ct,useCallback as Te,createContext as ol,useContext as rl,useMemo as jn,unwrap as al,useRequestUpdate as te,requestUpdate as ll,useSignal as Q,sideEffectsEnabled as mr,useHook as br,depsRequireChange as xr,cleanupHook as yr,useLayoutEffect as Ki,signal as ht,useRef as Ce,computed as vr,mount as cl}from"kiru";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();const hl=Symbol.for("kiru.fragment"),ul=8;new Array;var zs;(function(e){e.Start="start",e.End="end"})(zs||(zs={}));function dl(e){return(e.flags&ul)!==0}function fl(e){return e.type===hl}function gl(e){return typeof e.type=="function"&&"displayName"in e.type&&e.type.displayName==="Kiru.lazy"}function pl(e){return typeof e.type=="function"&&"displayName"in e.type&&e.type.displayName==="Kiru.memo"}function Mi(...e){return e.filter(Boolean).join(" ")}function Zi(e,t,n){let i=e;for(let s=0;s<t.length;s++){const o=t[s];s===t.length-1?i[o]=n:i=i[o]}}function _r(e){return e.type.displayName??(e.type.name||"Anonymous Function")}const ml=e=>e.__devtoolsFileLink??null;function an(e){return e.name==="kiru.devtools"}function wr(e){return Array.from(e.entries())}function bl(e){return m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e},m.createElement("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),m.createElement("path",{d:"M12 9v11"}),m.createElement("path",{d:"M2 9h13a2 2 0 0 1 2 2v9"}))}function Kt(e){return m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1rem",height:"1rem",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m.createElement("path",{d:"m9 18 6-6-6-6"}))}function xl(e){return m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m.createElement("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),m.createElement("circle",{cx:"12",cy:"12",r:"3"}))}function yl(e){return m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m.createElement("path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6"}),m.createElement("path",{d:"m21 3-9 9"}),m.createElement("path",{d:"M15 3h6v6"}))}function vl(e){return m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m.createElement("path",{d:"m12 14 4-4"}),m.createElement("path",{d:"M3.34 19a10 10 0 1 1 17.32 0"}))}function _l(e){return m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m.createElement("circle",{cx:"12",cy:"12",r:"10"}),m.createElement("path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}),m.createElement("path",{d:"M2 12h20"}))}function wl(e){return m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m.createElement("path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}),m.createElement("path",{d:"M21 3v5h-5"}),m.createElement("path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}),m.createElement("path",{d:"M8 16H3v5"}))}function El(e){return m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e},m.createElement("path",{d:"M22 8.35V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8.35A2 2 0 0 1 3.26 6.5l8-3.2a2 2 0 0 1 1.48 0l8 3.2A2 2 0 0 1 22 8.35Z"}),m.createElement("path",{d:"M6 18h12"}),m.createElement("path",{d:"M6 14h12"}),m.createElement("rect",{width:"12",height:"12",x:"6",y:"10"}))}function Er(e){return m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m.createElement("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}),m.createElement("path",{d:"M12 9v4"}),m.createElement("path",{d:"M12 17h.01"}))}function Sr({title:e,children:t,className:n,disabled:i,...s}){const[o,r]=xe(!0);ct(()=>{!o&&i&&r(!0)},[i]);const a=Te(l=>{l.preventDefault(),l.stopImmediatePropagation(),r(c=>!c)},[]);return m.createElement("div",{className:"flex flex-col"},m.createElement("button",{onclick:a,disabled:i,className:\`\${i?"opacity-50 cursor-default":"cursor-pointer"}\`},m.createElement("span",{className:"flex items-center gap-2 font-medium"},m.createElement(Kt,{className:\`transition \${o?"":"rotate-90"}\`}),e)),o?null:m.createElement("div",{className:\`p-2 \${n||""}\`,...s},t))}const Qi={arrayChunkSize:10,objectKeysChunkSize:100};function kr(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;const n=new Set([...Object.keys(e),...Object.keys(t)]);for(const i in n)if(typeof t[i]!=typeof e[i]||typeof e[i]=="object"&&!kr(e[i],t[i]))return!1;return!0}function Tr(e,t,n){for(const i in t)typeof e[i]>"u"&&(e[i]=structuredClone(t[i]));for(const i in e)typeof e[i]=="object"?Tr(e[i],t[i],n):n(e,i,e[i])}let Mr={...Qi};const Fs=localStorage.getItem("kiru.devtools.userSettings");if(Fs)try{const e=JSON.parse(Fs);kr(Qi,e)&&(Mr=e)}catch(e){console.error("kiru.devtools.userSettings error",e)}const Or=ol({userSettings:null,saveUserSettings:()=>{}}),ei=()=>rl(Or);function Sl({children:e}){const[t,n]=xe(Mr),i=s=>{localStorage.setItem("kiru.devtools.userSettings",JSON.stringify(s)),n(s)};return m.createElement(Or.Provider,{value:{userSettings:t,saveUserSettings:i}},e)}function kl(){const{userSettings:e,saveUserSettings:t}=ei();return m.createElement("div",{className:"rounded bg-neutral-400 bg-opacity-5 border border-white border-opacity-10 overflow-hidden"},m.createElement(ye,{border:!1,data:e,onChange:(n,i)=>{const s={...e};Zi(s,n,i),Tr(s,Qi,(o,r,a)=>{o[r]=a<1?1:a}),t(s)},mutable:!0,objectRefAcc:[]}))}const Tl=Object.freeze(()=>{});function ye({data:e,onChange:t,mutable:n,objectRefAcc:i,keys:s=[],className:o,border:r=!0}){const{userSettings:{objectKeysChunkSize:a}}=ei(),[l,c]=xe(0),h=jn(()=>Object.keys(e).slice(0,(l+1)*a),[l,a,e]),d=()=>{h.forEach(p=>{typeof e[p]=="object"&&i.splice(i.indexOf(e[p]),1)}),c(l+1)},g=h.length<Object.keys(e).length;return m.createElement(m.Fragment,null,m.createElement("div",{className:Mi("flex flex-col items-start w-full",r&&"border border-neutral-700",al(o))},h.map(p=>{const y=s.concat(p),x=y.join(".");return m.createElement("div",{key:x,"data-key":x,className:"flex flex-col items-start w-full gap-2 pl-2 py-1 pr-1 border-b border-neutral-700 last:border-b-0"},m.createElement(Ji,{value:e[p],onChange:t,keys:y,path:x,label:p,mutable:n,objectRefAcc:i}))})),g&&m.createElement("button",{onclick:d,title:"Show more",className:"p-1 border font-bold border-neutral-700 hover:bg-neutral-700"},m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1rem",height:"1rem",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},m.createElement("circle",{cx:"12",cy:"12",r:"1"}),m.createElement("circle",{cx:"19",cy:"12",r:"1"}),m.createElement("circle",{cx:"5",cy:"12",r:"1"}))))}function Un(e,t){Array.isArray(e)?(t(e),e.forEach(n=>Un(n,t))):typeof e=="object"&&e!==null&&(t(e),Object.values(e).forEach(n=>Un(n,t)))}function Ji({value:e,onChange:t,keys:n,path:i,mutable:s,objectRefAcc:o,label:r}){const{userSettings:{arrayChunkSize:a}}=ei(),[l,c]=xe(!0),h=r!==void 0&&m.createElement("label",{htmlFor:i,className:"text-xs truncate",title:i,children:r});if(e===null)return m.createElement(pt,null,h,m.createElement(jt,null,"null"));if(e===void 0)return m.createElement(pt,null,h,m.createElement(jt,null,"undefined"));const d=window.opener?window.opener.Node:Node;if(e instanceof d)return m.createElement(pt,null,h,m.createElement(jt,null,"<",m.createElement("span",{style:{color:"#f0a05e"}},e.nodeName),"/>"));const g=window.opener?window.opener.Error:Error;if(e instanceof g)return m.createElement(pt,null,h,"cause"in e&&e.cause?m.createElement(jt,null,e.message," (",String(e.cause),")"):m.createElement(jt,null,e.message));const p=y=>t(n,y);switch(typeof e){case"string":return m.createElement(pt,null,h,m.createElement(pi,{disabled:!s,id:i,type:"text",value:e,onchange:y=>p(y.target.value)}));case"number":return m.createElement(pt,null,h,m.createElement(pi,{disabled:!s,id:i,type:"number",value:e,placeholder:"NaN",onchange:y=>p(Number(y.target.value))}));case"bigint":return m.createElement(pt,null,h,m.createElement(pi,{disabled:!s,id:i,type:"number",value:e.toString(),onchange:y=>p(BigInt(y.target.value))}));case"boolean":return m.createElement(pt,null,h,m.createElement("input",{disabled:!s,id:i,type:"checkbox",checked:e,onchange:y=>p(y.target.checked),className:"accent-red-500"}));case"function":return m.createElement(pt,null,h,m.createElement(jt,null,\`\u0192 \${e.name||"anonymous"}()\`));default:return Array.isArray(e)?m.createElement(pt,null,m.createElement("button",{className:"text-xs flex items-center gap-1 cursor-pointer w-full",title:i,onclick:()=>{Un(e,y=>o.splice(o.indexOf(y),1)),c(y=>!y)}},r,m.createElement(Kt,{width:10,height:10,className:\`transition \${l?"":"rotate-90"}\`})),l?m.createElement(jt,null,"Array(",e.length,")"):e.length>a?m.createElement(Ml,{array:e,objectRefAcc:o}):m.createElement("div",{className:"flex flex-col items-start gap-1 w-full"},e.map((y,x)=>m.createElement(Ji,{value:y,onChange:t,keys:[...n,x.toString()],path:i.concat(".",x.toString()),label:x.toString(),mutable:s,objectRefAcc:o})))):o.includes(e)?m.createElement(pt,null,h,m.createElement(jt,null,"Object(circular reference)")):(o.push(e),m.createElement(pt,null,m.createElement("button",{className:"text-xs flex items-center gap-1 cursor-pointer w-full",title:i,onclick:()=>{Un(e,y=>o.splice(o.indexOf(y),1)),c(y=>!y)}},r,m.createElement(Kt,{width:10,height:10,className:\`transition \${l?"":"rotate-90"}\`})),l?null:m.createElement(ye,{data:e,onChange:t,keys:n,mutable:s,objectRefAcc:o})))}}function pt({children:e}){return m.createElement("div",{className:"flex flex-col items-start gap-1 w-full"},e)}function pi(e){return m.createElement("input",{className:"flex-grow text-xs px-2 py-1 text-neutral-300 w-full",...e})}function jt({children:e}){return m.createElement("small",{className:"text-neutral-300"},m.createElement("i",null,e))}function Ml({array:e,objectRefAcc:t}){const{userSettings:{arrayChunkSize:n}}=ei(),i=e.length,s=Math.ceil(i/n);return m.createElement("div",{className:"flex flex-col items-start gap-1 w-full"},Array.from({length:s}).map((o,r)=>m.createElement(Ol,{array:e,range:{start:r*n,end:(r+1)*n},objectRefAcc:t})))}function Ol({array:e,range:t,objectRefAcc:n}){const[i,s]=xe(!0);let o;return i?o=void 0:o=e.slice(t.start,t.end),m.createElement("div",{className:"flex flex-col items-start gap-1 w-full"},m.createElement("button",{className:"text-xs flex items-center gap-1 cursor-pointer w-full",onclick:()=>{n.splice(n.indexOf(e),1),s(r=>!r)}},"[",t.start,"..",(t.end<e.length?t.end:e.length)-1,"]",m.createElement(Kt,{width:10,height:10,className:\`transition \${i?"":"rotate-90"}\`})),o&&m.createElement("div",{className:"flex flex-col items-start gap-1 w-full"},o.map((r,a)=>m.createElement(Ji,{value:r,onChange:Tl,label:(t.start+a).toString(),keys:[a.toString()],path:a.toString(),mutable:!1,objectRefAcc:n}))))}const Cl="kiru-devtools";"window"in globalThis&&(window.__devtoolsSelection??=null);class Pl extends BroadcastChannel{send(t){super.postMessage(t)}removeEventListener(t){return super.removeEventListener("message",t)}addEventListener(t){return super.addEventListener("message",t)}}const Pe=new Pl(Cl);function ts({fn:e,onclick:t}){const n=jn(()=>ml(e),[e]);return n?m.createElement("a",{className:"flex items-center gap-1 text-[10px] opacity-50 hover:opacity-100 transition-opacity",href:n,onclick:i=>{i.preventDefault(),Pe.send({type:"open-editor",fileLink:n}),t?.(i)},title:"Open in editor"},"Open in editor",m.createElement(yl,{width:"0.65rem",height:"0.65rem"})):null}function Dl({selectedApp:e,selectedNode:t,setSelectedNode:n,kiruGlobal:i}){const s=te();ct(()=>{const l=c=>{c===e&&(dl(t)?n(null):s())};return i?.on("update",l),()=>i?.off("update",l)},[]);const o=()=>{!t||!e?.mounted||ll(t)},r={...t.props};delete r.children;const a=Nl(t);return m.createElement("div",{className:"flex-grow p-2 sticky top-0"},m.createElement("h2",{className:"flex justify-between items-center font-bold mb-2 pb-2 border-b-2 border-neutral-800"},m.createElement("div",{className:"flex gap-2 items-center"},"<"+_r(t)+">",m.createElement(ts,{fn:t.type})),m.createElement("button",{onclick:o},m.createElement(wl,{className:"w-5 h-5"}))),m.createElement(Sr,{title:"props",disabled:Object.keys(r).length===0},m.createElement(ye,{data:r,onChange:()=>{},mutable:!1,objectRefAcc:[]})),m.createElement(Cr,{node:a,selectedApp:e}))}function Al(e){return e.name==="devtools:useHookDebugGroup"}function Il(e){return Oi in e}const Oi=Symbol.for("devtools.hookGroup");function Nl(e){const t={parent:null,name:"hooks",children:[],[Oi]:!0};if(e.hooks?.length){let n=t;for(let i=0;i<e.hooks.length;i++){const s=e.hooks[i];if(Al(s)){switch(s.action){case"start":const o={parent:n,name:s.displayName,children:[],[Oi]:!0};n.children.push(o),n=o;break;case"end":if(n.name!==s.displayName||n.parent===null)throw new Error("useHookDebugGroup:end called with no start");n=n.parent;break}continue}n.children.push(s)}}return t}function Cr({node:e,selectedApp:t,depth:n=0}){if(Il(e))return m.createElement(Sr,{title:e.name,className:"bg-[#ffffff04] border border-[#fff1] flex flex-col gap-2 pl-6",disabled:e.children.length===0},e.children.map(h=>m.createElement(Cr,{node:h,selectedApp:t,depth:n+1})));const{name:i,dev:s,cleanup:o,...r}=e,a=s?.devtools,l=typeof a?.get=="function"?a.get():r,c=(h,d)=>{if(!t?.mounted||!a?.set||!a?.get)return;const g=a.get();Zi(g,h,d),a.set(g)};return m.createElement("div",null,m.createElement("i",{className:"text-neutral-300 text-sm"},i||"anonymous hook"),m.createElement("div",{className:"p-2"},m.createElement(ye,{data:l,onChange:c,mutable:!!a?.set,objectRefAcc:[]})))}const ge=(e,t,n={})=>{ct(()=>{let i=window;const s=n?.ref?.();return s?i=s:n.ref&&console.warn("useEventListener ref failed, using window"),i.addEventListener(e,t,n),()=>{i.removeEventListener(e,t,n)}},[t])},Ll=()=>{const e=Q({x:0,y:0}),t=Q({x:0,y:0}),n=Q({x:0,y:0});return ge("mousemove",i=>{e.value={x:i.x,y:i.y},t.value={x:i.movementX,y:i.movementY},n.value={x:i.clientX,y:i.clientY}}),{mouse:e,delta:t,client:n}},Sn="window"in globalThis&&"ResizeObserver"in globalThis.window,Rl=(e,t,n=void 0)=>mr()?Sn?br("useResizeObserver",{resizeObserver:null,deps:[e.current]},({isInit:i,hook:s,queueEffect:o})=>(i&&(s.resizeObserver=new ResizeObserver(t),s.cleanup=()=>{s.resizeObserver?.disconnect?.(),s.resizeObserver=null}),o(()=>{xr([e.current],s.deps)&&(s.deps=[e.current],s.resizeObserver?.disconnect?.(),e.current&&s.resizeObserver?.observe(e.current,n))}),{isSupported:Sn,start:()=>{s.resizeObserver==null&&(s.resizeObserver=new ResizeObserver(t),e.current&&s.resizeObserver.observe(e.current,n),s.cleanup=()=>{s.resizeObserver?.disconnect?.(),s.resizeObserver=null})},stop:()=>{yr(s)}})):{isSupported:Sn,start:()=>{},stop:()=>{}}:{isSupported:Sn,start:()=>{},stop:()=>{}},kn="window"in globalThis&&"MutationObserver"in globalThis.window,zl=(e,t,n=void 0)=>mr()?kn?br("useMutationObserver",{mutationObserver:null,deps:[e.current]},({isInit:i,hook:s,queueEffect:o})=>(i?(o(()=>{s.deps=[e.current],s.mutationObserver=new MutationObserver(t),e.current&&s.mutationObserver.observe(e.current,n)}),s.cleanup=()=>{s.mutationObserver?.disconnect?.(),s.mutationObserver=null}):xr([e.current],s.deps)&&(s.deps=[e.current],s.mutationObserver?.disconnect?.(),e.current&&s.mutationObserver?.observe(e.current,n)),{isSupported:kn,start:()=>{s.mutationObserver==null&&(s.mutationObserver=new MutationObserver(t),e.current&&s.mutationObserver.observe(e.current,n),s.cleanup=()=>{s.mutationObserver?.disconnect?.(),s.mutationObserver=null})},stop:()=>{yr(s)}})):{isSupported:kn,start:()=>{},stop:()=>{}}:{isSupported:kn,start:()=>{},stop:()=>{}},Fl=(e,t={windowScroll:!0,windowResize:!0})=>{const n=t?.windowScroll??!0,i=t?.windowResize??!0,s=t.immediate??!0,o=Q(0),r=Q(0),a=Q(0),l=Q(0),c=Q(0),h=Q(0),d=Q(0),g=Q(0),p=()=>{const y=e.current;if(!y){o.value=0,r.value=0,a.value=0,l.value=0,c.value=0,h.value=0,d.value=0,g.value=0;return}const x=y.getBoundingClientRect();o.value=x.width,r.value=x.height,a.value=x.top,l.value=x.right,c.value=x.bottom,h.value=x.left,d.value=x.x,g.value=x.y};return Rl(e,p),zl(e,p,{attributeFilter:["style","class"]}),ge("scroll",()=>{n&&p()},{capture:!0,passive:!0}),ge("resize",()=>{i&&p()},{passive:!0}),Ki(()=>{s&&p()},[]),{width:o,height:r,top:a,right:l,bottom:c,left:h,x:d,y:g,update:p}};function Hl(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}const Hs=(e,t,n={})=>{const{ref:i,eventName:s="keydown",passive:o=!1}=n,r=Hl(e);return ge(s,l=>{l.repeat&&!n.repeat||r(l)&&t(l)},{ref:i,passive:o})};function Pr({value:e,className:t,...n}){return m.createElement("div",{className:Mi("w-full p-2 z-10","bg-[#1d1d1d] border border-white border-opacity-10 rounded",t?.toString()),...n},m.createElement("input",{className:Mi("px-2 py-1 w-full rounded focus:outline focus:outline-primary","bg-[#212121] border border-white border-opacity-10 rounded"),placeholder:"Filter...",type:"text","bind:value":e}))}let U;"window"in globalThis&&window.opener&&(U=window.opener.__kiru);const Me=ht(!1);Pe.addEventListener(e=>{e.data.type==="set-inspect-enabled"&&(Me.value=e.data.value)});const Dr=(U?.apps??[]).filter(e=>!an(e)),Xt=ht(Dr);ht(null);const Pt=ht(Dr[0]??null),qt=ht(null);U?.on("mount",e=>{an(e)||(Xt.value=[...Xt.peek(),e],Pt.peek()===null&&(Pt.value=e))});U?.on("unmount",e=>{Xt.value=Xt.peek().filter(t=>t!==e),Pt.peek()===e&&(Pt.value=Xt.peek()[0]??null)});const Ci=ht(new Map),Dt=ht(null),es=ht("");function Bl(e){return e.type.displayName??(e.type.name||"Anonymous Function")}function Wl(e,t){const n=t.toLowerCase();return e.every(i=>n.includes(i))}function Pi(e){return typeof e.type=="function"&&!fl(e)&&!gl(e)&&!pl(e)}function Vl(e){let t=[e];for(;t.length;){const n=t.pop();if(Pi(n))return!0;n.child&&t.push(n.child),n.sibling&&t.push(n.sibling)}return!1}const jl=(e,t)=>{const n=[t.parent];for(;n.length;){const i=n.pop();if(e===i)return!0;i?.parent&&n.push(i.parent)}return!1};function Di(e,t){if(!e)return null;const n=t(e),i=Di(e.sibling,t),s=Di(e.child,t);return n?{ref:e,sibling:i??null,child:s??null}:i||s||null}function Yn({node:e,traverseSiblings:t=!0}){const[n,i]=xe(!0),o=qt.value===e,r=jn(()=>crypto.randomUUID(),[]),a=jn(()=>Dt.value==null?null:jl(e,Dt.value),[Dt.value,e]);ct(()=>{a&&i(!1)},[a]),ct(()=>{if(!(!e||!Pi(e)))return Ci.peek().set(r,{vNode:e,setCollapsed:i}),()=>{Ci.peek().delete(r)}});const l=es.value;if(!e)return null;if(!Pi(e)||l.length>0&&!Wl(l.toLowerCase().split(" "),e.type.name))return m.createElement(m.Fragment,null,e.child&&m.createElement(Yn,{node:e.child}),t&&m.createElement(Bs,{node:e}));const c=e.child&&Vl(e.child);return m.createElement(m.Fragment,null,m.createElement("div",{className:"pl-4 mb-1"},m.createElement("h2",{onclick:()=>{Dt.value=null,qt.value=o?null:e},className:\`flex gap-2 items-center cursor-pointer mb-1 scroll-m-12 \${o?"font-medium bg-primary selected-vnode":""}\`,"data-id":r},c&&m.createElement(Kt,{className:\`cursor-pointer transition \${n?"":"rotate-90"}\`,onclick:h=>{h.preventDefault(),h.stopImmediatePropagation(),Dt.value=null,i(d=>!d)}}),m.createElement("div",{className:c?"":"ml-6"},m.createElement("span",{className:o?"":"text-neutral-400"},"<"),m.createElement("span",{className:o?"":"text-primary"},Bl(e)),m.createElement("span",{className:o?"":"text-neutral-400"},">"))),!n&&e.child||a!=null&&a&&e.child?m.createElement(Yn,{node:e.child}):null),t&&m.createElement(Bs,{node:e}))}function Bs({node:e}){if(!e)return null;let t=[],n=e.sibling;for(;n;)t.push(n),n=n.sibling;return m.createElement(m.Fragment,null,t.map(i=>m.createElement(Yn,{node:i,traverseSiblings:!1})))}const Ul=()=>{const e=Ce(null),t=r=>{if(!r)return null;const a=r.getAttribute("data-id");if(a!=null)return Ci.peek().get(a)},n=r=>{if(!r)return;const a=t(r);a!=null&&(r.scrollIntoView({behavior:"smooth"}),qt.value=a.vNode)},i=r=>{if(!r||r===document.body)return null;const a=r.parentElement,l=a?.nextElementSibling?.querySelector("h2[data-id]");return l||i(a)},s=()=>{const r=document.querySelector("h2[data-id]");n(r)},o=()=>{const r=document.querySelectorAll("h2[data-id]"),a=r.item(r.length-1);a&&n(a)};return Hs(["ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],r=>{if(Dt.value&&(Dt.value=null),document.activeElement&&document.activeElement instanceof HTMLInputElement&&document.activeElement!=e.current)return;r.preventDefault();const a=document.querySelector(".selected-vnode");if(a===null){r.key==="ArrowDown"?s():r.key==="ArrowUp"&&o();return}if(r.key==="ArrowRight"){const l=t(a);l&&l.setCollapsed(!1);return}else if(r.key==="ArrowLeft"){const l=t(a);l&&l.setCollapsed(!0);return}if(r.key==="ArrowDown"){const l=a?.nextElementSibling?.querySelector("h2[data-id]");if(l)return n(l);const c=a.parentElement?.nextElementSibling?.querySelector("h2[data-id]");if(c)return n(c);const h=i(a);return h?n(h):s()}else if(r.key==="ArrowUp"){const l=a.parentElement?.previousElementSibling;if(l?.matches("h2[data-id]"))return n(l);const c=l?.querySelectorAll("h2[data-id]");return c?.length!=null&&c?.length>=1?n(c?.item?.(c.length-1)):o()}}),Hs("l",r=>{r.ctrlKey&&(r.preventDefault(),e.current?.focus({preventScroll:!1}))}),{searchRef:e}},Yl=e=>{es.value=e.target.value,Dt.value&&(Dt.value=null)};function $l(){const{searchRef:e}=Ul(),t=Pt.value;return m.createElement("div",{className:"flex-grow p-2 sticky top-0"},m.createElement("div",{className:"flex gap-4 pb-2 border-b-2 border-neutral-800 mb-2 items-center"},m.createElement("input",{ref:e,className:"bg-[#171616] px-1 py-2 w-full focus:outline focus:outline-primary",placeholder:"Search for component",type:"text",value:es,oninput:Yl})),t?.rootNode&&m.createElement(Yn,{node:t.rootNode}))}const Xl=e=>{const{mouse:t}=Ll(),n=Q(null),i=Q(0),s=Q(0),o=Ce(null),r=Fl(o),a=Ce(null),[l,c]=Array.isArray(e.children)?e.children:[];return Ki(()=>{a.current&&(s.value=a.current.clientWidth/2)},[a.current]),ge("mouseup",Te(()=>n.value=null,[])),ge("mousemove",Te(h=>{if(n.value==null||a.current==null)return;const d=Math.max(i.value+h.x-n.value.x,250);s.value=Math.min(d,a.current.clientWidth-250)},[])),ge("resize",Te(()=>{a.current!=null&&a.current.clientWidth-250<s.value&&(s.value=Math.max(a.current.clientWidth-250,250))},[])),m.createElement("div",{onmousemove:h=>{h.x},ref:a,className:"flex-grow grid gap-2 items-start w-full relative",style:{gridTemplateColumns:\`\${s}px 1fr\`}},m.createElement("div",{ref:o,className:"firstContainer w-full h-full"},l),r.width.value!=0&&m.createElement("div",{className:"w-8 flex justify-center h-full absolute top-0 -translate-x-1/2 cursor-col-resize z-[9999]",style:{left:\`\${r.width}px\`},onmousedown:h=>{h.preventDefault(),n.value={...t.value},i.value=s.value}},m.createElement("div",{className:"dividerLine w-[5px] bg-neutral-800 h-full"})),m.createElement("div",{className:"secondContainer h-full"},c))},ql=()=>m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-square-mouse-pointer"},m.createElement("path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z"}),m.createElement("path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"})),Gl=()=>{Me.value=!Me.value,Pe.send({type:"set-inspect-enabled",value:Me.value})};function Kl(){const e=Pt.value,t=qt.value,n=te();return ct(()=>{const i=s=>{s===e&&n()};return U?.on("update",i),()=>U?.off("update",i)},[Pt]),ct(()=>{const i=s=>{if(s.data.type!=="select-node")return;if(!window.__devtoolsSelection){console.error("no selection ptr");return}const{app:o,node:r}=window.__devtoolsSelection;window.__devtoolsSelection=null,Pt.value=o,qt.value=r,Dt.value=r,Me.value=!1};return Pe.addEventListener(i),()=>Pe.removeEventListener(i)},[Pt]),m.createElement(m.Fragment,null,m.createElement("div",{className:"flex items-center justify-between gap-4 p-2 bg-neutral-400 bg-opacity-5 border border-white border-opacity-10 rounded"},m.createElement("div",{className:"flex items-center gap-4"},m.createElement("select",{className:"px-2 py-1 bg-neutral-800 text-neutral-100 rounded border border-white border-opacity-10",value:e?.name??"",onchange:i=>Pt.value=Xt.peek().find(s=>s.name===i.currentTarget.value)??null},m.createElement("option",{value:"",disabled:!0},"Select App"),Xt.value.map(i=>m.createElement("option",{key:i.id,value:i.name},i.name))),m.createElement("button",{title:"Toggle Component Inspection",onclick:Gl,className:\`p-1 rounded \${Me.value?"bg-neutral-900":""}\`},m.createElement(ql,null)))),m.createElement(Xl,null,e&&m.createElement($l,null),t&&e&&m.createElement(Dl,{selectedApp:e,selectedNode:t,setSelectedNode:i=>qt.value=i,kiruGlobal:U})))}const Ai=ht({}),ue=ht([]);U?.stores?.subscribe(e=>{Ai.value=e,ue.value=ue.value.filter(t=>Object.values(Ai.value).includes(t))});const Ar=ht(""),Zl=vr(()=>Ar.value.toLowerCase().split(" ").filter(e=>e.length>0));function Ql(e){return Zl.value.every(t=>e.toLowerCase().includes(t))}function Jl(){const e=Object.entries(Ai.value);return e.length===0?m.createElement("div",{className:"flex flex-col items-center justify-center h-full text-neutral-400"},m.createElement(Er,null),m.createElement("h2",{className:"text-lg italic"},"No stores detected")):m.createElement("div",{className:"flex flex-col gap-2 items-start"},m.createElement(Pr,{value:Ar,className:"sticky top-0"}),m.createElement("div",{className:"flex flex-col gap-2 w-full"},e.filter(([t])=>Ql(t)).map(([t,n])=>m.createElement(tc,{key:t,name:t,store:n}))))}function tc({name:e,store:t}){const n=ue.value.includes(t),i=te(),{value:s}=Ir(t);Ki(()=>{const r=t.subscribe(()=>i());return()=>r()},[]);const o=Te(()=>{n?ue.value=ue.value.filter(r=>r!==t):ue.value=[...ue.value,t]},[n]);return m.createElement("div",{className:"flex flex-col"},m.createElement("button",{onclick:o,className:"flex items-center gap-2 justify-between p-2 border border-white border-opacity-10 cursor-pointer"+(n?" bg-white bg-opacity-5 text-neutral-100 rounded-t":" hover:bg-white hover:bg-opacity-10 text-neutral-400 rounded")},e,m.createElement("div",{className:"flex gap-2"},m.createElement(ts,{fn:t,onclick:r=>r.stopPropagation()}),m.createElement(Kt,{className:"transition-all"+(n?" rotate-90":"")}))),n&&m.createElement("div",{className:"flex flex-col gap-2 p-2 border border-white border-opacity-10"},m.createElement(ye,{data:{value:s},mutable:!0,objectRefAcc:[],onChange:(r,a)=>{const l=structuredClone({value:s});Zi(l,r,a),t.setState(l.value)}}),m.createElement(ec,{store:t})))}function ec({store:e}){const t=Xt.value;return t.length===0?null:m.createElement(m.Fragment,null,t.map(n=>!n.mounted||!n.rootNode?null:m.createElement(nc,{store:e,app:n})))}const Ws=Symbol.for("kiru.hmrAccept"),Ir=e=>{if(Ws in e)return e[Ws].provide().current;throw new Error("Unable to get store subscribers")};function nc({store:e,app:t}){const n=te(),{subscribers:i,nodeStateMap:s}=Ir(e),o=t.rootNode.child;if(ct(()=>{const a=l=>{l===t&&n()};return U?.on("update",a),()=>U?.off("update",a)},[]),!o)return null;const r=Di(o,a=>i.has(a));return m.createElement("div",{className:"flex flex-col gap-2 p-2 rounded-b border border-white border-opacity-10"},m.createElement("b",null,t.name),r&&m.createElement("ul",{className:"pl-8"},m.createElement(Ii,{node:r,nodeStateMap:s})))}function Ii({node:e,nodeStateMap:t}){const[n,i]=xe(!1),o=t.get(e.ref)?.slices??[];return m.createElement(m.Fragment,null,m.createElement("li",{className:"flex flex-col gap-2"},m.createElement("div",{className:"flex flex-col border border-white border-opacity-10 rounded"+(n?" bg-white bg-opacity-5 text-neutral-100":" hover:bg-white hover:bg-opacity-10 text-neutral-400")},m.createElement("button",{onclick:()=>i(!n),className:"flex gap-2 p-2 justify-between cursor-pointer"},m.createElement("span",null,"<"+_r(e.ref)+" />"),m.createElement("div",{className:"flex gap-2 items-center"},m.createElement(ts,{fn:e.ref.type,onclick:r=>r.stopPropagation()}),m.createElement(Kt,{className:"transition-all"+(n?" rotate-90":"")}))),n&&m.createElement("div",{className:"flex flex-col gap-2 p-2 bg-[#1a1a1a]"},o.length===0&&m.createElement("div",{className:"p-2 bg-black bg-opacity-30 text-sm"},m.createElement("h5",{className:"border-b border-white border-opacity-10"},"No slices")),o.map(r=>m.createElement("div",{className:"flex flex-col gap-2"},m.createElement("div",{className:"p-2 bg-black bg-opacity-30 text-sm"},m.createElement("h5",{className:"border-b border-white border-opacity-10"},"Slice:"),m.createElement("pre",{className:"text-neutral-400"},m.createElement(ye,{data:{value:r.value},mutable:!1,objectRefAcc:[],onChange:()=>{}}))),m.createElement("div",{className:"p-2 bg-black bg-opacity-30 text-sm"},m.createElement("h5",{className:"border-b border-white border-opacity-10"},"SliceFn:"),m.createElement("pre",{className:"text-neutral-400"},r.sliceFn?r.sliceFn.toString():"null")),r.eq&&m.createElement("div",{className:"p-2 bg-black bg-opacity-30 text-sm"},m.createElement("h5",{className:"border-b border-white border-opacity-10"},"eq:"),m.createElement("pre",{className:"text-neutral-400"},r.eq.toString())))))),e.child&&m.createElement("ul",{className:"pl-8 flex flex-col gap-2"},m.createElement(Ii,{node:e.child,nodeStateMap:t}))),e.sibling&&m.createElement(Ii,{node:e.sibling,nodeStateMap:t}))}/*!
|
|
1695
|
+
<script type="module" crossorigin>import*as m from"kiru";import{useState as xe,useEffect as ct,useCallback as Te,createContext as ol,useContext as rl,useMemo as jn,unwrap as al,useRequestUpdate as te,requestUpdate as ll,useSignal as Q,sideEffectsEnabled as mr,useHook as br,depsRequireChange as xr,cleanupHook as yr,useLayoutEffect as Ki,signal as ht,useRef as Ce,computed as vr,mount as cl}from"kiru";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();const hl=Symbol.for("kiru.fragment"),ul=8;new Array;var zs;(function(e){e.Start="start",e.End="end"})(zs||(zs={}));function dl(e){return(e.flags&ul)!==0}function fl(e){return e.type===hl}function gl(e){return typeof e.type=="function"&&"displayName"in e.type&&e.type.displayName==="Kiru.lazy"}function pl(e){return typeof e.type=="function"&&"displayName"in e.type&&e.type.displayName==="Kiru.memo"}function Mi(...e){return e.filter(Boolean).join(" ")}function Zi(e,t,n){let i=e;for(let s=0;s<t.length;s++){const o=t[s];s===t.length-1?i[o]=n:i=i[o]}}function _r(e){return e.type.displayName??(e.type.name||"Anonymous Function")}const ml=e=>e.__devtoolsFileLink??null;function an(e){return e.name==="kiru.devtools"}function wr(e){return Array.from(e.entries())}function bl(e){return m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e},m.createElement("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),m.createElement("path",{d:"M12 9v11"}),m.createElement("path",{d:"M2 9h13a2 2 0 0 1 2 2v9"}))}function Kt(e){return m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1rem",height:"1rem",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m.createElement("path",{d:"m9 18 6-6-6-6"}))}function xl(e){return m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m.createElement("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),m.createElement("circle",{cx:"12",cy:"12",r:"3"}))}function yl(e){return m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m.createElement("path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6"}),m.createElement("path",{d:"m21 3-9 9"}),m.createElement("path",{d:"M15 3h6v6"}))}function vl(e){return m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m.createElement("path",{d:"m12 14 4-4"}),m.createElement("path",{d:"M3.34 19a10 10 0 1 1 17.32 0"}))}function _l(e){return m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m.createElement("circle",{cx:"12",cy:"12",r:"10"}),m.createElement("path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}),m.createElement("path",{d:"M2 12h20"}))}function wl(e){return m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m.createElement("path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}),m.createElement("path",{d:"M21 3v5h-5"}),m.createElement("path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}),m.createElement("path",{d:"M8 16H3v5"}))}function El(e){return m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e},m.createElement("path",{d:"M22 8.35V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8.35A2 2 0 0 1 3.26 6.5l8-3.2a2 2 0 0 1 1.48 0l8 3.2A2 2 0 0 1 22 8.35Z"}),m.createElement("path",{d:"M6 18h12"}),m.createElement("path",{d:"M6 14h12"}),m.createElement("rect",{width:"12",height:"12",x:"6",y:"10"}))}function Er(e){return m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},m.createElement("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}),m.createElement("path",{d:"M12 9v4"}),m.createElement("path",{d:"M12 17h.01"}))}function Sr({title:e,children:t,className:n,disabled:i,...s}){const[o,r]=xe(!0);ct(()=>{!o&&i&&r(!0)},[i]);const a=Te(l=>{l.preventDefault(),l.stopImmediatePropagation(),r(c=>!c)},[]);return m.createElement("div",{className:"flex flex-col"},m.createElement("button",{onclick:a,disabled:i,className:\`\${i?"opacity-50 cursor-default":"cursor-pointer"}\`},m.createElement("span",{className:"flex items-center gap-2 font-medium"},m.createElement(Kt,{className:\`transition \${o?"":"rotate-90"}\`}),e)),o?null:m.createElement("div",{className:\`p-2 \${n||""}\`,...s},t))}const Qi={arrayChunkSize:10,objectKeysChunkSize:100};function kr(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;const n=new Set([...Object.keys(e),...Object.keys(t)]);for(const i in n)if(typeof t[i]!=typeof e[i]||typeof e[i]=="object"&&!kr(e[i],t[i]))return!1;return!0}function Tr(e,t,n){for(const i in t)typeof e[i]>"u"&&(e[i]=structuredClone(t[i]));for(const i in e)typeof e[i]=="object"?Tr(e[i],t[i],n):n(e,i,e[i])}let Mr={...Qi};const Fs=localStorage.getItem("kiru.devtools.userSettings");if(Fs)try{const e=JSON.parse(Fs);kr(Qi,e)&&(Mr=e)}catch(e){console.error("kiru.devtools.userSettings error",e)}const Or=ol({userSettings:null,saveUserSettings:()=>{}}),ei=()=>rl(Or);function Sl({children:e}){const[t,n]=xe(Mr),i=s=>{localStorage.setItem("kiru.devtools.userSettings",JSON.stringify(s)),n(s)};return m.createElement(Or.Provider,{value:{userSettings:t,saveUserSettings:i}},e)}function kl(){const{userSettings:e,saveUserSettings:t}=ei();return m.createElement("div",{className:"rounded bg-neutral-400 bg-opacity-5 border border-white border-opacity-10 overflow-hidden"},m.createElement(ye,{border:!1,data:e,onChange:(n,i)=>{const s={...e};Zi(s,n,i),Tr(s,Qi,(o,r,a)=>{o[r]=a<1?1:a}),t(s)},mutable:!0,objectRefAcc:[]}))}const Tl=Object.freeze(()=>{});function ye({data:e,onChange:t,mutable:n,objectRefAcc:i,keys:s=[],className:o,border:r=!0}){const{userSettings:{objectKeysChunkSize:a}}=ei(),[l,c]=xe(0),h=jn(()=>Object.keys(e).slice(0,(l+1)*a),[l,a,e]),d=()=>{h.forEach(p=>{typeof e[p]=="object"&&i.splice(i.indexOf(e[p]),1)}),c(l+1)},g=h.length<Object.keys(e).length;return m.createElement(m.Fragment,null,m.createElement("div",{className:Mi("flex flex-col items-start w-full",r&&"border border-neutral-700",al(o))},h.map(p=>{const y=s.concat(p),x=y.join(".");return m.createElement("div",{key:x,"data-key":x,className:"flex flex-col items-start w-full gap-2 pl-2 py-1 pr-1 border-b border-neutral-700 last:border-b-0"},m.createElement(Ji,{value:e[p],onChange:t,keys:y,path:x,label:p,mutable:n,objectRefAcc:i}))})),g&&m.createElement("button",{onclick:d,title:"Show more",className:"p-1 border font-bold border-neutral-700 hover:bg-neutral-700"},m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1rem",height:"1rem",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},m.createElement("circle",{cx:"12",cy:"12",r:"1"}),m.createElement("circle",{cx:"19",cy:"12",r:"1"}),m.createElement("circle",{cx:"5",cy:"12",r:"1"}))))}function Un(e,t){Array.isArray(e)?(t(e),e.forEach(n=>Un(n,t))):typeof e=="object"&&e!==null&&(t(e),Object.values(e).forEach(n=>Un(n,t)))}function Ji({value:e,onChange:t,keys:n,path:i,mutable:s,objectRefAcc:o,label:r}){const{userSettings:{arrayChunkSize:a}}=ei(),[l,c]=xe(!0),h=r!==void 0&&m.createElement("label",{htmlFor:i,className:"text-xs truncate",title:i,children:r});if(e===null)return m.createElement(pt,null,h,m.createElement(jt,null,"null"));if(e===void 0)return m.createElement(pt,null,h,m.createElement(jt,null,"undefined"));const d=window.opener?window.opener.Node:Node;if(e instanceof d)return m.createElement(pt,null,h,m.createElement(jt,null,"<",m.createElement("span",{style:{color:"#f0a05e"}},e.nodeName),"/>"));const g=window.opener?window.opener.Error:Error;if(e instanceof g)return m.createElement(pt,null,h,"cause"in e&&e.cause?m.createElement(jt,null,e.message," (",String(e.cause),")"):m.createElement(jt,null,e.message));const p=y=>t(n,y);switch(typeof e){case"string":return m.createElement(pt,null,h,m.createElement(pi,{disabled:!s,id:i,type:"text",value:e,onchange:y=>p(y.target.value)}));case"number":return m.createElement(pt,null,h,m.createElement(pi,{disabled:!s,id:i,type:"number",value:e,placeholder:"NaN",onchange:y=>p(Number(y.target.value))}));case"bigint":return m.createElement(pt,null,h,m.createElement(pi,{disabled:!s,id:i,type:"number",value:e.toString(),onchange:y=>p(BigInt(y.target.value))}));case"boolean":return m.createElement(pt,null,h,m.createElement("input",{disabled:!s,id:i,type:"checkbox",checked:e,onchange:y=>p(y.target.checked),className:"accent-red-500"}));case"function":return m.createElement(pt,null,h,m.createElement(jt,null,\`\u0192 \${e.name||"anonymous"}()\`));default:return Array.isArray(e)?m.createElement(pt,null,m.createElement("button",{className:"text-xs flex items-center gap-1 cursor-pointer w-full",title:i,onclick:()=>{Un(e,y=>o.splice(o.indexOf(y),1)),c(y=>!y)}},r,m.createElement(Kt,{width:10,height:10,className:\`transition \${l?"":"rotate-90"}\`})),l?m.createElement(jt,null,"Array(",e.length,")"):e.length>a?m.createElement(Ml,{array:e,objectRefAcc:o}):m.createElement("div",{className:"flex flex-col items-start gap-1 w-full"},e.map((y,x)=>m.createElement(Ji,{value:y,onChange:t,keys:[...n,x.toString()],path:i.concat(".",x.toString()),label:x.toString(),mutable:s,objectRefAcc:o})))):o.includes(e)?m.createElement(pt,null,h,m.createElement(jt,null,"Object(circular reference)")):(o.push(e),m.createElement(pt,null,m.createElement("button",{className:"text-xs flex items-center gap-1 cursor-pointer w-full",title:i,onclick:()=>{Un(e,y=>o.splice(o.indexOf(y),1)),c(y=>!y)}},r,m.createElement(Kt,{width:10,height:10,className:\`transition \${l?"":"rotate-90"}\`})),l?null:m.createElement(ye,{data:e,onChange:t,keys:n,mutable:s,objectRefAcc:o})))}}function pt({children:e}){return m.createElement("div",{className:"flex flex-col items-start gap-1 w-full"},e)}function pi(e){return m.createElement("input",{className:"flex-grow text-xs px-2 py-1 text-neutral-300 w-full",...e})}function jt({children:e}){return m.createElement("small",{className:"text-neutral-300"},m.createElement("i",null,e))}function Ml({array:e,objectRefAcc:t}){const{userSettings:{arrayChunkSize:n}}=ei(),i=e.length,s=Math.ceil(i/n);return m.createElement("div",{className:"flex flex-col items-start gap-1 w-full"},Array.from({length:s}).map((o,r)=>m.createElement(Ol,{array:e,range:{start:r*n,end:(r+1)*n},objectRefAcc:t})))}function Ol({array:e,range:t,objectRefAcc:n}){const[i,s]=xe(!0);let o;return i?o=void 0:o=e.slice(t.start,t.end),m.createElement("div",{className:"flex flex-col items-start gap-1 w-full"},m.createElement("button",{className:"text-xs flex items-center gap-1 cursor-pointer w-full",onclick:()=>{n.splice(n.indexOf(e),1),s(r=>!r)}},"[",t.start,"..",(t.end<e.length?t.end:e.length)-1,"]",m.createElement(Kt,{width:10,height:10,className:\`transition \${i?"":"rotate-90"}\`})),o&&m.createElement("div",{className:"flex flex-col items-start gap-1 w-full"},o.map((r,a)=>m.createElement(Ji,{value:r,onChange:Tl,label:(t.start+a).toString(),keys:[a.toString()],path:a.toString(),mutable:!1,objectRefAcc:n}))))}const Cl="kiru-devtools";"window"in globalThis&&(window.__devtoolsSelection??=null);class Pl extends BroadcastChannel{send(t){super.postMessage(t)}removeEventListener(t){return super.removeEventListener("message",t)}addEventListener(t){return super.addEventListener("message",t)}}const Pe=new Pl(Cl);function ts({fn:e,onclick:t}){const n=jn(()=>ml(e),[e]);return n?m.createElement("a",{className:"flex items-center gap-1 text-[10px] opacity-50 hover:opacity-100 transition-opacity",href:n,onclick:i=>{i.preventDefault(),Pe.send({type:"open-editor",fileLink:n}),t?.(i)},title:"Open in editor"},"Open in editor",m.createElement(yl,{width:"0.65rem",height:"0.65rem"})):null}function Dl({selectedApp:e,selectedNode:t,setSelectedNode:n,kiruGlobal:i}){const s=te();ct(()=>{const l=c=>{c===e&&(dl(t)?n(null):s())};return i?.on("update",l),()=>i?.off("update",l)},[]);const o=()=>{t&&ll(t)},r={...t.props};delete r.children;const a=Nl(t);return m.createElement("div",{className:"flex-grow p-2 sticky top-0"},m.createElement("h2",{className:"flex justify-between items-center font-bold mb-2 pb-2 border-b-2 border-neutral-800"},m.createElement("div",{className:"flex gap-2 items-center"},"<"+_r(t)+">",m.createElement(ts,{fn:t.type})),m.createElement("button",{onclick:o},m.createElement(wl,{className:"w-5 h-5"}))),m.createElement(Sr,{title:"props",disabled:Object.keys(r).length===0},m.createElement(ye,{data:r,onChange:()=>{},mutable:!1,objectRefAcc:[]})),m.createElement(Cr,{node:a,selectedApp:e}))}function Al(e){return e.name==="devtools:useHookDebugGroup"}function Il(e){return Oi in e}const Oi=Symbol.for("devtools.hookGroup");function Nl(e){const t={parent:null,name:"hooks",children:[],[Oi]:!0};if(e.hooks?.length){let n=t;for(let i=0;i<e.hooks.length;i++){const s=e.hooks[i];if(Al(s)){switch(s.action){case"start":const o={parent:n,name:s.displayName,children:[],[Oi]:!0};n.children.push(o),n=o;break;case"end":if(n.name!==s.displayName||n.parent===null)throw new Error("useHookDebugGroup:end called with no start");n=n.parent;break}continue}n.children.push(s)}}return t}function Cr({node:e,selectedApp:t,depth:n=0}){if(Il(e))return m.createElement(Sr,{title:e.name,className:"bg-[#ffffff04] border border-[#fff1] flex flex-col gap-2 pl-6",disabled:e.children.length===0},e.children.map(h=>m.createElement(Cr,{node:h,selectedApp:t,depth:n+1})));const{name:i,dev:s,cleanup:o,...r}=e,a=s?.devtools,l=typeof a?.get=="function"?a.get():r,c=(h,d)=>{if(!t||!a?.set||!a?.get)return;const g=a.get();Zi(g,h,d),a.set(g)};return m.createElement("div",null,m.createElement("i",{className:"text-neutral-300 text-sm"},i||"anonymous hook"),m.createElement("div",{className:"p-2"},m.createElement(ye,{data:l,onChange:c,mutable:!!a?.set,objectRefAcc:[]})))}const ge=(e,t,n={})=>{ct(()=>{let i=window;const s=n?.ref?.();return s?i=s:n.ref&&console.warn("useEventListener ref failed, using window"),i.addEventListener(e,t,n),()=>{i.removeEventListener(e,t,n)}},[t])},Ll=()=>{const e=Q({x:0,y:0}),t=Q({x:0,y:0}),n=Q({x:0,y:0});return ge("mousemove",i=>{e.value={x:i.x,y:i.y},t.value={x:i.movementX,y:i.movementY},n.value={x:i.clientX,y:i.clientY}}),{mouse:e,delta:t,client:n}},Sn="window"in globalThis&&"ResizeObserver"in globalThis.window,Rl=(e,t,n=void 0)=>mr()?Sn?br("useResizeObserver",{resizeObserver:null,deps:[e.current]},({isInit:i,hook:s,queueEffect:o})=>(i&&(s.resizeObserver=new ResizeObserver(t),s.cleanup=()=>{s.resizeObserver?.disconnect?.(),s.resizeObserver=null}),o(()=>{xr([e.current],s.deps)&&(s.deps=[e.current],s.resizeObserver?.disconnect?.(),e.current&&s.resizeObserver?.observe(e.current,n))}),{isSupported:Sn,start:()=>{s.resizeObserver==null&&(s.resizeObserver=new ResizeObserver(t),e.current&&s.resizeObserver.observe(e.current,n),s.cleanup=()=>{s.resizeObserver?.disconnect?.(),s.resizeObserver=null})},stop:()=>{yr(s)}})):{isSupported:Sn,start:()=>{},stop:()=>{}}:{isSupported:Sn,start:()=>{},stop:()=>{}},kn="window"in globalThis&&"MutationObserver"in globalThis.window,zl=(e,t,n=void 0)=>mr()?kn?br("useMutationObserver",{mutationObserver:null,deps:[e.current]},({isInit:i,hook:s,queueEffect:o})=>(i?(o(()=>{s.deps=[e.current],s.mutationObserver=new MutationObserver(t),e.current&&s.mutationObserver.observe(e.current,n)}),s.cleanup=()=>{s.mutationObserver?.disconnect?.(),s.mutationObserver=null}):xr([e.current],s.deps)&&(s.deps=[e.current],s.mutationObserver?.disconnect?.(),e.current&&s.mutationObserver?.observe(e.current,n)),{isSupported:kn,start:()=>{s.mutationObserver==null&&(s.mutationObserver=new MutationObserver(t),e.current&&s.mutationObserver.observe(e.current,n),s.cleanup=()=>{s.mutationObserver?.disconnect?.(),s.mutationObserver=null})},stop:()=>{yr(s)}})):{isSupported:kn,start:()=>{},stop:()=>{}}:{isSupported:kn,start:()=>{},stop:()=>{}},Fl=(e,t={windowScroll:!0,windowResize:!0})=>{const n=t?.windowScroll??!0,i=t?.windowResize??!0,s=t.immediate??!0,o=Q(0),r=Q(0),a=Q(0),l=Q(0),c=Q(0),h=Q(0),d=Q(0),g=Q(0),p=()=>{const y=e.current;if(!y){o.value=0,r.value=0,a.value=0,l.value=0,c.value=0,h.value=0,d.value=0,g.value=0;return}const x=y.getBoundingClientRect();o.value=x.width,r.value=x.height,a.value=x.top,l.value=x.right,c.value=x.bottom,h.value=x.left,d.value=x.x,g.value=x.y};return Rl(e,p),zl(e,p,{attributeFilter:["style","class"]}),ge("scroll",()=>{n&&p()},{capture:!0,passive:!0}),ge("resize",()=>{i&&p()},{passive:!0}),Ki(()=>{s&&p()},[]),{width:o,height:r,top:a,right:l,bottom:c,left:h,x:d,y:g,update:p}};function Hl(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}const Hs=(e,t,n={})=>{const{ref:i,eventName:s="keydown",passive:o=!1}=n,r=Hl(e);return ge(s,l=>{l.repeat&&!n.repeat||r(l)&&t(l)},{ref:i,passive:o})};function Pr({value:e,className:t,...n}){return m.createElement("div",{className:Mi("w-full p-2 z-10","bg-[#1d1d1d] border border-white border-opacity-10 rounded",t?.toString()),...n},m.createElement("input",{className:Mi("px-2 py-1 w-full rounded focus:outline focus:outline-primary","bg-[#212121] border border-white border-opacity-10 rounded"),placeholder:"Filter...",type:"text","bind:value":e}))}let U;"window"in globalThis&&window.opener&&(U=window.opener.__kiru);const Me=ht(!1);Pe.addEventListener(e=>{e.data.type==="set-inspect-enabled"&&(Me.value=e.data.value)});const Dr=(U?.apps??[]).filter(e=>!an(e)),Xt=ht(Dr);ht(null);const Pt=ht(Dr[0]??null),qt=ht(null);U?.on("mount",e=>{an(e)||(Xt.value=[...Xt.peek(),e],Pt.peek()===null&&(Pt.value=e))});U?.on("unmount",e=>{Xt.value=Xt.peek().filter(t=>t!==e),Pt.peek()===e&&(Pt.value=Xt.peek()[0]??null)});const Ci=ht(new Map),Dt=ht(null),es=ht("");function Bl(e){return e.type.displayName??(e.type.name||"Anonymous Function")}function Wl(e,t){const n=t.toLowerCase();return e.every(i=>n.includes(i))}function Pi(e){return typeof e.type=="function"&&!fl(e)&&!gl(e)&&!pl(e)}function Vl(e){let t=[e];for(;t.length;){const n=t.pop();if(Pi(n))return!0;n.child&&t.push(n.child),n.sibling&&t.push(n.sibling)}return!1}const jl=(e,t)=>{const n=[t.parent];for(;n.length;){const i=n.pop();if(e===i)return!0;i?.parent&&n.push(i.parent)}return!1};function Di(e,t){if(!e)return null;const n=t(e),i=Di(e.sibling,t),s=Di(e.child,t);return n?{ref:e,sibling:i??null,child:s??null}:i||s||null}function Yn({node:e,traverseSiblings:t=!0}){const[n,i]=xe(!0),o=qt.value===e,r=jn(()=>crypto.randomUUID(),[]),a=jn(()=>Dt.value==null?null:jl(e,Dt.value),[Dt.value,e]);ct(()=>{a&&i(!1)},[a]),ct(()=>{if(!(!e||!Pi(e)))return Ci.peek().set(r,{vNode:e,setCollapsed:i}),()=>{Ci.peek().delete(r)}});const l=es.value;if(!e)return null;if(!Pi(e)||l.length>0&&!Wl(l.toLowerCase().split(" "),e.type.name))return m.createElement(m.Fragment,null,e.child&&m.createElement(Yn,{node:e.child}),t&&m.createElement(Bs,{node:e}));const c=e.child&&Vl(e.child);return m.createElement(m.Fragment,null,m.createElement("div",{className:"pl-4 mb-1"},m.createElement("h2",{onclick:()=>{Dt.value=null,qt.value=o?null:e},className:\`flex gap-2 items-center cursor-pointer mb-1 scroll-m-12 \${o?"font-medium bg-primary selected-vnode":""}\`,"data-id":r},c&&m.createElement(Kt,{className:\`cursor-pointer transition \${n?"":"rotate-90"}\`,onclick:h=>{h.preventDefault(),h.stopImmediatePropagation(),Dt.value=null,i(d=>!d)}}),m.createElement("div",{className:c?"":"ml-6"},m.createElement("span",{className:o?"":"text-neutral-400"},"<"),m.createElement("span",{className:o?"":"text-primary"},Bl(e)),m.createElement("span",{className:o?"":"text-neutral-400"},">"))),!n&&e.child||a!=null&&a&&e.child?m.createElement(Yn,{node:e.child}):null),t&&m.createElement(Bs,{node:e}))}function Bs({node:e}){if(!e)return null;let t=[],n=e.sibling;for(;n;)t.push(n),n=n.sibling;return m.createElement(m.Fragment,null,t.map(i=>m.createElement(Yn,{node:i,traverseSiblings:!1})))}const Ul=()=>{const e=Ce(null),t=r=>{if(!r)return null;const a=r.getAttribute("data-id");if(a!=null)return Ci.peek().get(a)},n=r=>{if(!r)return;const a=t(r);a!=null&&(r.scrollIntoView({behavior:"smooth"}),qt.value=a.vNode)},i=r=>{if(!r||r===document.body)return null;const a=r.parentElement,l=a?.nextElementSibling?.querySelector("h2[data-id]");return l||i(a)},s=()=>{const r=document.querySelector("h2[data-id]");n(r)},o=()=>{const r=document.querySelectorAll("h2[data-id]"),a=r.item(r.length-1);a&&n(a)};return Hs(["ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],r=>{if(Dt.value&&(Dt.value=null),document.activeElement&&document.activeElement instanceof HTMLInputElement&&document.activeElement!=e.current)return;r.preventDefault();const a=document.querySelector(".selected-vnode");if(a===null){r.key==="ArrowDown"?s():r.key==="ArrowUp"&&o();return}if(r.key==="ArrowRight"){const l=t(a);l&&l.setCollapsed(!1);return}else if(r.key==="ArrowLeft"){const l=t(a);l&&l.setCollapsed(!0);return}if(r.key==="ArrowDown"){const l=a?.nextElementSibling?.querySelector("h2[data-id]");if(l)return n(l);const c=a.parentElement?.nextElementSibling?.querySelector("h2[data-id]");if(c)return n(c);const h=i(a);return h?n(h):s()}else if(r.key==="ArrowUp"){const l=a.parentElement?.previousElementSibling;if(l?.matches("h2[data-id]"))return n(l);const c=l?.querySelectorAll("h2[data-id]");return c?.length!=null&&c?.length>=1?n(c?.item?.(c.length-1)):o()}}),Hs("l",r=>{r.ctrlKey&&(r.preventDefault(),e.current?.focus({preventScroll:!1}))}),{searchRef:e}},Yl=e=>{es.value=e.target.value,Dt.value&&(Dt.value=null)};function $l(){const{searchRef:e}=Ul(),t=Pt.value;return m.createElement("div",{className:"flex-grow p-2 sticky top-0"},m.createElement("div",{className:"flex gap-4 pb-2 border-b-2 border-neutral-800 mb-2 items-center"},m.createElement("input",{ref:e,className:"bg-[#171616] px-1 py-2 w-full focus:outline focus:outline-primary",placeholder:"Search for component",type:"text",value:es,oninput:Yl})),t?.rootNode&&m.createElement(Yn,{node:t.rootNode}))}const Xl=e=>{const{mouse:t}=Ll(),n=Q(null),i=Q(0),s=Q(0),o=Ce(null),r=Fl(o),a=Ce(null),[l,c]=Array.isArray(e.children)?e.children:[];return Ki(()=>{a.current&&(s.value=a.current.clientWidth/2)},[a.current]),ge("mouseup",Te(()=>n.value=null,[])),ge("mousemove",Te(h=>{if(n.value==null||a.current==null)return;const d=Math.max(i.value+h.x-n.value.x,250);s.value=Math.min(d,a.current.clientWidth-250)},[])),ge("resize",Te(()=>{a.current!=null&&a.current.clientWidth-250<s.value&&(s.value=Math.max(a.current.clientWidth-250,250))},[])),m.createElement("div",{onmousemove:h=>{h.x},ref:a,className:"flex-grow grid gap-2 items-start w-full relative",style:{gridTemplateColumns:\`\${s}px 1fr\`}},m.createElement("div",{ref:o,className:"firstContainer w-full h-full"},l),r.width.value!=0&&m.createElement("div",{className:"w-8 flex justify-center h-full absolute top-0 -translate-x-1/2 cursor-col-resize z-[9999]",style:{left:\`\${r.width}px\`},onmousedown:h=>{h.preventDefault(),n.value={...t.value},i.value=s.value}},m.createElement("div",{className:"dividerLine w-[5px] bg-neutral-800 h-full"})),m.createElement("div",{className:"secondContainer h-full"},c))},ql=()=>m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-square-mouse-pointer"},m.createElement("path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z"}),m.createElement("path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"})),Gl=()=>{Me.value=!Me.value,Pe.send({type:"set-inspect-enabled",value:Me.value})};function Kl(){const e=Pt.value,t=qt.value,n=te();return ct(()=>{const i=s=>{s===e&&n()};return U?.on("update",i),()=>U?.off("update",i)},[Pt]),ct(()=>{const i=s=>{if(s.data.type!=="select-node")return;if(!window.__devtoolsSelection){console.error("no selection ptr");return}const{app:o,node:r}=window.__devtoolsSelection;window.__devtoolsSelection=null,Pt.value=o,qt.value=r,Dt.value=r,Me.value=!1};return Pe.addEventListener(i),()=>Pe.removeEventListener(i)},[Pt]),m.createElement(m.Fragment,null,m.createElement("div",{className:"flex items-center justify-between gap-4 p-2 bg-neutral-400 bg-opacity-5 border border-white border-opacity-10 rounded"},m.createElement("div",{className:"flex items-center gap-4"},m.createElement("select",{className:"px-2 py-1 bg-neutral-800 text-neutral-100 rounded border border-white border-opacity-10",value:e?.name??"",onchange:i=>Pt.value=Xt.peek().find(s=>s.name===i.currentTarget.value)??null},m.createElement("option",{value:"",disabled:!0},"Select App"),Xt.value.map(i=>m.createElement("option",{key:i.id,value:i.name},i.name))),m.createElement("button",{title:"Toggle Component Inspection",onclick:Gl,className:\`p-1 rounded \${Me.value?"bg-neutral-900":""}\`},m.createElement(ql,null)))),m.createElement(Xl,null,e&&m.createElement($l,null),t&&e&&m.createElement(Dl,{selectedApp:e,selectedNode:t,setSelectedNode:i=>qt.value=i,kiruGlobal:U})))}const Ai=ht({}),ue=ht([]);U?.stores?.subscribe(e=>{Ai.value=e,ue.value=ue.value.filter(t=>Object.values(Ai.value).includes(t))});const Ar=ht(""),Zl=vr(()=>Ar.value.toLowerCase().split(" ").filter(e=>e.length>0));function Ql(e){return Zl.value.every(t=>e.toLowerCase().includes(t))}function Jl(){const e=Object.entries(Ai.value);return e.length===0?m.createElement("div",{className:"flex flex-col items-center justify-center h-full text-neutral-400"},m.createElement(Er,null),m.createElement("h2",{className:"text-lg italic"},"No stores detected")):m.createElement("div",{className:"flex flex-col gap-2 items-start"},m.createElement(Pr,{value:Ar,className:"sticky top-0"}),m.createElement("div",{className:"flex flex-col gap-2 w-full"},e.filter(([t])=>Ql(t)).map(([t,n])=>m.createElement(tc,{key:t,name:t,store:n}))))}function tc({name:e,store:t}){const n=ue.value.includes(t),i=te(),{value:s}=Ir(t);Ki(()=>{const r=t.subscribe(()=>i());return()=>r()},[]);const o=Te(()=>{n?ue.value=ue.value.filter(r=>r!==t):ue.value=[...ue.value,t]},[n]);return m.createElement("div",{className:"flex flex-col"},m.createElement("button",{onclick:o,className:"flex items-center gap-2 justify-between p-2 border border-white border-opacity-10 cursor-pointer"+(n?" bg-white bg-opacity-5 text-neutral-100 rounded-t":" hover:bg-white hover:bg-opacity-10 text-neutral-400 rounded")},e,m.createElement("div",{className:"flex gap-2"},m.createElement(ts,{fn:t,onclick:r=>r.stopPropagation()}),m.createElement(Kt,{className:"transition-all"+(n?" rotate-90":"")}))),n&&m.createElement("div",{className:"flex flex-col gap-2 p-2 border border-white border-opacity-10"},m.createElement(ye,{data:{value:s},mutable:!0,objectRefAcc:[],onChange:(r,a)=>{const l=structuredClone({value:s});Zi(l,r,a),t.setState(l.value)}}),m.createElement(ec,{store:t})))}function ec({store:e}){const t=Xt.value;return t.length===0?null:m.createElement(m.Fragment,null,t.map(n=>m.createElement(nc,{store:e,app:n})))}const Ws=Symbol.for("kiru.hmrAccept"),Ir=e=>{if(Ws in e)return e[Ws].provide().current;throw new Error("Unable to get store subscribers")};function nc({store:e,app:t}){const n=te(),{subscribers:i,nodeStateMap:s}=Ir(e),o=t.rootNode.child;if(ct(()=>{const a=l=>{l===t&&n()};return U?.on("update",a),()=>U?.off("update",a)},[]),!o)return null;const r=Di(o,a=>i.has(a));return m.createElement("div",{className:"flex flex-col gap-2 p-2 rounded-b border border-white border-opacity-10"},m.createElement("b",null,t.name),r&&m.createElement("ul",{className:"pl-8"},m.createElement(Ii,{node:r,nodeStateMap:s})))}function Ii({node:e,nodeStateMap:t}){const[n,i]=xe(!1),o=t.get(e.ref)?.slices??[];return m.createElement(m.Fragment,null,m.createElement("li",{className:"flex flex-col gap-2"},m.createElement("div",{className:"flex flex-col border border-white border-opacity-10 rounded"+(n?" bg-white bg-opacity-5 text-neutral-100":" hover:bg-white hover:bg-opacity-10 text-neutral-400")},m.createElement("button",{onclick:()=>i(!n),className:"flex gap-2 p-2 justify-between cursor-pointer"},m.createElement("span",null,"<"+_r(e.ref)+" />"),m.createElement("div",{className:"flex gap-2 items-center"},m.createElement(ts,{fn:e.ref.type,onclick:r=>r.stopPropagation()}),m.createElement(Kt,{className:"transition-all"+(n?" rotate-90":"")}))),n&&m.createElement("div",{className:"flex flex-col gap-2 p-2 bg-[#1a1a1a]"},o.length===0&&m.createElement("div",{className:"p-2 bg-black bg-opacity-30 text-sm"},m.createElement("h5",{className:"border-b border-white border-opacity-10"},"No slices")),o.map(r=>m.createElement("div",{className:"flex flex-col gap-2"},m.createElement("div",{className:"p-2 bg-black bg-opacity-30 text-sm"},m.createElement("h5",{className:"border-b border-white border-opacity-10"},"Slice:"),m.createElement("pre",{className:"text-neutral-400"},m.createElement(ye,{data:{value:r.value},mutable:!1,objectRefAcc:[],onChange:()=>{}}))),m.createElement("div",{className:"p-2 bg-black bg-opacity-30 text-sm"},m.createElement("h5",{className:"border-b border-white border-opacity-10"},"SliceFn:"),m.createElement("pre",{className:"text-neutral-400"},r.sliceFn?r.sliceFn.toString():"null")),r.eq&&m.createElement("div",{className:"p-2 bg-black bg-opacity-30 text-sm"},m.createElement("h5",{className:"border-b border-white border-opacity-10"},"eq:"),m.createElement("pre",{className:"text-neutral-400"},r.eq.toString())))))),e.child&&m.createElement("ul",{className:"pl-8 flex flex-col gap-2"},m.createElement(Ii,{node:e.child,nodeStateMap:t}))),e.sibling&&m.createElement(Ii,{node:e.sibling,nodeStateMap:t}))}/*!
|
|
1696
1696
|
* @kurkle/color v0.3.4
|
|
1697
1697
|
* https://github.com/kurkle/color#readme
|
|
1698
1698
|
* (c) 2024 Jukka Kurkela
|
|
@@ -1720,7 +1720,7 @@ var dist_default = `<!DOCTYPE html>
|
|
|
1720
1720
|
* https://www.chartjs.org/chartjs-plugin-zoom/2.2.0/
|
|
1721
1721
|
* (c) 2016-2024 chartjs-plugin-zoom Contributors
|
|
1722
1722
|
* Released under the MIT License
|
|
1723
|
-
*/const dn=e=>e&&e.enabled&&e.modifierKey,xa=(e,t)=>e&&t[e+"Key"],ms=(e,t)=>e&&!t[e+"Key"];function Jt(e,t,n){return e===void 0?!0:typeof e=="string"?e.indexOf(t)!==-1:typeof e=="function"?e({chart:n}).indexOf(t)!==-1:!1}function Ti(e,t){return typeof e=="function"&&(e=e({chart:t})),typeof e=="string"?{x:e.indexOf("x")!==-1,y:e.indexOf("y")!==-1}:{x:!1,y:!1}}function cf(e,t){let n;return function(){return clearTimeout(n),n=setTimeout(e,t),t}}function hf({x:e,y:t},n){const i=n.scales,s=Object.keys(i);for(let o=0;o<s.length;o++){const r=i[s[o]];if(t>=r.top&&t<=r.bottom&&e>=r.left&&e<=r.right)return r}return null}function ya(e,t,n){const{mode:i="xy",scaleMode:s,overScaleMode:o}=e||{},r=hf(t,n),a=Ti(i,n),l=Ti(s,n);if(o){const h=Ti(o,n);for(const d of["x","y"])h[d]&&(l[d]=a[d],a[d]=!1)}if(r&&l[r.axis])return[r];const c=[];return z(n.scales,function(h){a[h.axis]&&c.push(h)}),c}const ji=new WeakMap;function j(e){let t=ji.get(e);return t||(t={originalScaleLimits:{},updatedScaleLimits:{},handlers:{},panDelta:{},dragging:!1,panning:!1},ji.set(e,t)),t}function uf(e){ji.delete(e)}function va(e,t,n,i){const s=Math.max(0,Math.min(1,(e-t)/n||0)),o=1-s;return{min:i*s,max:i*o}}function _a(e,t){const n=e.isHorizontal()?t.x:t.y;return e.getValueForPixel(n)}function wa(e,t,n){const i=e.max-e.min,s=i*(t-1),o=_a(e,n);return va(o,e.min,i,s)}function df(e,t,n){const i=_a(e,n);if(i===void 0)return{min:e.min,max:e.max};const s=Math.log10(e.min),o=Math.log10(e.max),r=Math.log10(i),a=o-s,l=a*(t-1),c=va(r,s,a,l);return{min:Math.pow(10,s+c.min),max:Math.pow(10,o-c.max)}}function ff(e,t){return t&&(t[e.id]||t[e.axis])||{}}function er(e,t,n,i,s){let o=n[i];if(o==="original"){const r=e.originalScaleLimits[t.id][i];o=L(r.options,r.scale)}return L(o,s)}function gf(e,t,n){const i=e.getValueForPixel(t),s=e.getValueForPixel(n);return{min:Math.min(i,s),max:Math.max(i,s)}}function pf(e,{min:t,max:n,minLimit:i,maxLimit:s},o){const r=(e-n+t)/2;t-=r,n+=r;const a=o.min.options??o.min.scale,l=o.max.options??o.max.scale,c=e/1e6;return pe(t,a,c)&&(t=a),pe(n,l,c)&&(n=l),t<i?(t=i,n=Math.min(i+e,s)):n>s&&(n=s,t=Math.max(s-e,i)),{min:t,max:n}}function _e(e,{min:t,max:n},i,s=!1){const o=j(e.chart),{options:r}=e,a=ff(e,i),{minRange:l=0}=a,c=er(o,e,a,"min",-1/0),h=er(o,e,a,"max",1/0);if(s==="pan"&&(t<c||n>h))return!0;const d=e.max-e.min,g=s?Math.max(n-t,l):d;if(s&&g===l&&d<=l)return!0;const p=pf(g,{min:t,max:n,minLimit:c,maxLimit:h},o.originalScaleLimits[e.id]);return r.min=p.min,r.max=p.max,o.updatedScaleLimits[e.id]=p,e.parse(p.min)!==e.min||e.parse(p.max)!==e.max}function mf(e,t,n,i){const s=wa(e,t,n),o={min:e.min+s.min,max:e.max-s.max};return _e(e,o,i,!0)}function bf(e,t,n,i){const s=df(e,t,n);return _e(e,s,i,!0)}function xf(e,t,n,i){_e(e,gf(e,t,n),i,!0)}const nr=e=>e===0||isNaN(e)?0:e<0?Math.min(Math.round(e),-1):Math.max(Math.round(e),1);function yf(e){const n=e.getLabels().length-1;e.min>0&&(e.min-=1),e.max<n&&(e.max+=1)}function vf(e,t,n,i){const s=wa(e,t,n);e.min===e.max&&t<1&&yf(e);const o={min:e.min+nr(s.min),max:e.max-nr(s.max)};return _e(e,o,i,!0)}function _f(e){return e.isHorizontal()?e.width:e.height}function wf(e,t,n){const s=e.getLabels().length-1;let{min:o,max:r}=e;const a=Math.max(r-o,1),l=Math.round(_f(e)/Math.max(a,10)),c=Math.round(Math.abs(t/l));let h;return t<-l?(r=Math.min(r+c,s),o=a===1?r:r-a,h=r===s):t>l&&(o=Math.max(0,o-c),r=a===1?o:o+a,h=o===0),_e(e,{min:o,max:r},n)||h}const Ef={second:500,minute:30*1e3,hour:1800*1e3,day:720*60*1e3,week:3.5*24*60*60*1e3,month:360*60*60*1e3,quarter:1440*60*60*1e3,year:4368*60*60*1e3};function Ea(e,t,n,i=!1){const{min:s,max:o,options:r}=e,a=r.time&&r.time.round,l=Ef[a]||0,c=e.getValueForPixel(e.getPixelForValue(s+l)-t),h=e.getValueForPixel(e.getPixelForValue(o+l)-t);return isNaN(c)||isNaN(h)?!0:_e(e,{min:c,max:h},n,i?"pan":!1)}function ir(e,t,n){return Ea(e,t,n,!0)}const Ui={category:vf,default:mf,logarithmic:bf},Yi={default:xf},$i={category:wf,default:Ea,logarithmic:ir,timeseries:ir};function Sf(e,t,n){const{id:i,options:{min:s,max:o}}=e;if(!t[i]||!n[i])return!0;const r=n[i];return r.min!==s||r.max!==o}function sr(e,t){z(e,(n,i)=>{t[i]||delete e[i]})}function Re(e,t){const{scales:n}=e,{originalScaleLimits:i,updatedScaleLimits:s}=t;return z(n,function(o){Sf(o,i,s)&&(i[o.id]={min:{scale:o.min,options:o.options.min},max:{scale:o.max,options:o.options.max}})}),sr(i,n),sr(s,n),i}function or(e,t,n,i){const s=Ui[e.type]||Ui.default;I(s,[e,t,n,i])}function rr(e,t,n,i){const s=Yi[e.type]||Yi.default;I(s,[e,t,n,i])}function kf(e){const t=e.chartArea;return{x:(t.left+t.right)/2,y:(t.top+t.bottom)/2}}function bs(e,t,n="none",i="api"){const{x:s=1,y:o=1,focalPoint:r=kf(e)}=typeof t=="number"?{x:t,y:t}:t,a=j(e),{options:{limits:l,zoom:c}}=a;Re(e,a);const h=s!==1,d=o!==1,g=ya(c,r,e);z(g||e.scales,function(p){p.isHorizontal()&&h?or(p,s,r,l):!p.isHorizontal()&&d&&or(p,o,r,l)}),e.update(n),I(c.onZoom,[{chart:e,trigger:i}])}function Sa(e,t,n,i="none",s="api"){const o=j(e),{options:{limits:r,zoom:a}}=o,{mode:l="xy"}=a;Re(e,o);const c=Jt(l,"x",e),h=Jt(l,"y",e);z(e.scales,function(d){d.isHorizontal()&&c?rr(d,t.x,n.x,r):!d.isHorizontal()&&h&&rr(d,t.y,n.y,r)}),e.update(i),I(a.onZoom,[{chart:e,trigger:s}])}function Tf(e,t,n,i="none",s="api"){const o=j(e);Re(e,o);const r=e.scales[t];_e(r,n,void 0,!0),e.update(i),I(o.options.zoom?.onZoom,[{chart:e,trigger:s}])}function Mf(e,t="default"){const n=j(e),i=Re(e,n);z(e.scales,function(s){const o=s.options;i[s.id]?(o.min=i[s.id].min.options,o.max=i[s.id].max.options):(delete o.min,delete o.max),delete n.updatedScaleLimits[s.id]}),e.update(t),I(n.options.zoom.onZoomComplete,[{chart:e}])}function Of(e,t){const n=e.originalScaleLimits[t];if(!n)return;const{min:i,max:s}=n;return L(s.options,s.scale)-L(i.options,i.scale)}function Cf(e){const t=j(e);let n=1,i=1;return z(e.scales,function(s){const o=Of(t,s.id);if(o){const r=Math.round(o/(s.max-s.min)*100)/100;n=Math.min(n,r),i=Math.max(i,r)}}),n<1?n:i}function ar(e,t,n,i){const{panDelta:s}=i,o=s[e.id]||0;Qt(o)===Qt(t)&&(t+=o);const r=$i[e.type]||$i.default;I(r,[e,t,n])?s[e.id]=0:s[e.id]=t}function ka(e,t,n,i="none"){const{x:s=0,y:o=0}=typeof t=="number"?{x:t,y:t}:t,r=j(e),{options:{pan:a,limits:l}}=r,{onPan:c}=a||{};Re(e,r);const h=s!==0,d=o!==0;z(n||e.scales,function(g){g.isHorizontal()&&h?ar(g,s,l,r):!g.isHorizontal()&&d&&ar(g,o,l,r)}),e.update(i),I(c,[{chart:e}])}function Ta(e){const t=j(e);Re(e,t);const n={};for(const i of Object.keys(e.scales)){const{min:s,max:o}=t.originalScaleLimits[i]||{min:{},max:{}};n[i]={min:s.scale,max:o.scale}}return n}function Pf(e){const t=j(e),n={};for(const i of Object.keys(e.scales))n[i]=t.updatedScaleLimits[i];return n}function Df(e){const t=Ta(e);for(const n of Object.keys(e.scales)){const{min:i,max:s}=t[n];if(i!==void 0&&e.scales[n].min!==i||s!==void 0&&e.scales[n].max!==s)return!0}return!1}function lr(e){const t=j(e);return t.panning||t.dragging}const cr=(e,t,n)=>Math.min(n,Math.max(t,e));function rt(e,t){const{handlers:n}=j(e),i=n[t];i&&i.target&&(i.target.removeEventListener(t,i),delete n[t])}function rn(e,t,n,i){const{handlers:s,options:o}=j(e),r=s[n];if(r&&r.target===t)return;rt(e,n),s[n]=l=>i(e,l,o),s[n].target=t;const a=n==="wheel"?!1:void 0;t.addEventListener(n,s[n],{passive:a})}function Af(e,t){const n=j(e);n.dragStart&&(n.dragging=!0,n.dragEnd=t,e.update("none"))}function If(e,t){const n=j(e);!n.dragStart||t.key!=="Escape"||(rt(e,"keydown"),n.dragging=!1,n.dragStart=n.dragEnd=null,e.update("none"))}function Xi(e,t){if(e.target!==t.canvas){const n=t.canvas.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}}return Ct(e,t)}function Ma(e,t,n){const{onZoomStart:i,onZoomRejected:s}=n;if(i){const o=Xi(t,e);if(I(i,[{chart:e,event:t,point:o}])===!1)return I(s,[{chart:e,event:t}]),!1}}function Nf(e,t){if(e.legend){const o=Ct(t,e);if(De(o,e.legend))return}const n=j(e),{pan:i,zoom:s={}}=n.options;if(t.button!==0||xa(dn(i),t)||ms(dn(s.drag),t))return I(s.onZoomRejected,[{chart:e,event:t}]);Ma(e,t,s)!==!1&&(n.dragStart=t,rn(e,e.canvas.ownerDocument,"mousemove",Af),rn(e,window.document,"keydown",If))}function Lf({begin:e,end:t},n){let i=t.x-e.x,s=t.y-e.y;const o=Math.abs(i/s);o>n?i=Math.sign(i)*Math.abs(s*n):o<n&&(s=Math.sign(s)*Math.abs(i/n)),t.x=e.x+i,t.y=e.y+s}function hr(e,t,n,{min:i,max:s,prop:o}){e[i]=cr(Math.min(n.begin[o],n.end[o]),t[i],t[s]),e[s]=cr(Math.max(n.begin[o],n.end[o]),t[i],t[s])}function Rf(e,t,n){const i={begin:Xi(t.dragStart,e),end:Xi(t.dragEnd,e)};if(n){const s=e.chartArea.width/e.chartArea.height;Lf(i,s)}return i}function Oa(e,t,n,i){const s=Jt(t,"x",e),o=Jt(t,"y",e),{top:r,left:a,right:l,bottom:c,width:h,height:d}=e.chartArea,g={top:r,left:a,right:l,bottom:c},p=Rf(e,n,i&&s&&o);s&&hr(g,e.chartArea,p,{min:"left",max:"right",prop:"x"}),o&&hr(g,e.chartArea,p,{min:"top",max:"bottom",prop:"y"});const y=g.right-g.left,x=g.bottom-g.top;return{...g,width:y,height:x,zoomX:s&&y?1+(h-y)/h:1,zoomY:o&&x?1+(d-x)/d:1}}function zf(e,t){const n=j(e);if(!n.dragStart)return;rt(e,"mousemove");const{mode:i,onZoomComplete:s,drag:{threshold:o=0,maintainAspectRatio:r}}=n.options.zoom,a=Oa(e,i,{dragStart:n.dragStart,dragEnd:t},r),l=Jt(i,"x",e)?a.width:0,c=Jt(i,"y",e)?a.height:0,h=Math.sqrt(l*l+c*c);if(n.dragStart=n.dragEnd=null,h<=o){n.dragging=!1,e.update("none");return}Sa(e,{x:a.left,y:a.top},{x:a.right,y:a.bottom},"zoom","drag"),n.dragging=!1,n.filterNextClick=!0,I(s,[{chart:e}])}function Ff(e,t,n){if(ms(dn(n.wheel),t)){I(n.onZoomRejected,[{chart:e,event:t}]);return}if(Ma(e,t,n)!==!1&&(t.cancelable&&t.preventDefault(),t.deltaY!==void 0))return!0}function Hf(e,t){const{handlers:{onZoomComplete:n},options:{zoom:i}}=j(e);if(!Ff(e,t,i))return;const s=t.target.getBoundingClientRect(),o=i.wheel.speed,r=t.deltaY>=0?2-1/(1-o):1+o,a={x:r,y:r,focalPoint:{x:t.clientX-s.left,y:t.clientY-s.top}};bs(e,a,"zoom","wheel"),I(n,[{chart:e}])}function Bf(e,t,n,i){n&&(j(e).handlers[t]=cf(()=>I(n,[{chart:e}]),i))}function Wf(e,t){const n=e.canvas,{wheel:i,drag:s,onZoomComplete:o}=t.zoom;i.enabled?(rn(e,n,"wheel",Hf),Bf(e,"onZoomComplete",o,250)):rt(e,"wheel"),s.enabled?(rn(e,n,"mousedown",Nf),rn(e,n.ownerDocument,"mouseup",zf)):(rt(e,"mousedown"),rt(e,"mousemove"),rt(e,"mouseup"),rt(e,"keydown"))}function Vf(e){rt(e,"mousedown"),rt(e,"mousemove"),rt(e,"mouseup"),rt(e,"wheel"),rt(e,"click"),rt(e,"keydown")}function jf(e,t){return function(n,i){const{pan:s,zoom:o={}}=t.options;if(!s||!s.enabled)return!1;const r=i&&i.srcEvent;return r&&!t.panning&&i.pointerType==="mouse"&&(ms(dn(s),r)||xa(dn(o.drag),r))?(I(s.onPanRejected,[{chart:e,event:i}]),!1):!0}}function Uf(e,t){const n=Math.abs(e.clientX-t.clientX),i=Math.abs(e.clientY-t.clientY),s=n/i;let o,r;return s>.3&&s<1.7?o=r=!0:n>i?o=!0:r=!0,{x:o,y:r}}function Ca(e,t,n){if(t.scale){const{center:i,pointers:s}=n,o=1/t.scale*n.scale,r=n.target.getBoundingClientRect(),a=Uf(s[0],s[1]),l=t.options.zoom.mode,c={x:a.x&&Jt(l,"x",e)?o:1,y:a.y&&Jt(l,"y",e)?o:1,focalPoint:{x:i.x-r.left,y:i.y-r.top}};bs(e,c,"zoom","pinch"),t.scale=n.scale}}function Yf(e,t,n){if(t.options.zoom.pinch.enabled){const i=Ct(n,e);I(t.options.zoom.onZoomStart,[{chart:e,event:n,point:i}])===!1?(t.scale=null,I(t.options.zoom.onZoomRejected,[{chart:e,event:n}])):t.scale=1}}function $f(e,t,n){t.scale&&(Ca(e,t,n),t.scale=null,I(t.options.zoom.onZoomComplete,[{chart:e}]))}function Pa(e,t,n){const i=t.delta;i&&(t.panning=!0,ka(e,{x:n.deltaX-i.x,y:n.deltaY-i.y},t.panScales),t.delta={x:n.deltaX,y:n.deltaY})}function Xf(e,t,n){const{enabled:i,onPanStart:s,onPanRejected:o}=t.options.pan;if(!i)return;const r=n.target.getBoundingClientRect(),a={x:n.center.x-r.left,y:n.center.y-r.top};if(I(s,[{chart:e,event:n,point:a}])===!1)return I(o,[{chart:e,event:n}]);t.panScales=ya(t.options.pan,a,e),t.delta={x:0,y:0},Pa(e,t,n)}function qf(e,t){t.delta=null,t.panning&&(t.panning=!1,t.filterNextClick=!0,I(t.options.pan.onPanComplete,[{chart:e}]))}const qi=new WeakMap;function ur(e,t){const n=j(e),i=e.canvas,{pan:s,zoom:o}=t,r=new on.Manager(i);o&&o.pinch.enabled&&(r.add(new on.Pinch),r.on("pinchstart",a=>Yf(e,n,a)),r.on("pinch",a=>Ca(e,n,a)),r.on("pinchend",a=>$f(e,n,a))),s&&s.enabled&&(r.add(new on.Pan({threshold:s.threshold,enable:jf(e,n)})),r.on("panstart",a=>Xf(e,n,a)),r.on("panmove",a=>Pa(e,n,a)),r.on("panend",()=>qf(e,n))),qi.set(e,r)}function dr(e){const t=qi.get(e);t&&(t.remove("pinchstart"),t.remove("pinch"),t.remove("pinchend"),t.remove("panstart"),t.remove("pan"),t.remove("panend"),t.destroy(),qi.delete(e))}function Gf(e,t){const{pan:n,zoom:i}=e,{pan:s,zoom:o}=t;return i?.zoom?.pinch?.enabled!==o?.zoom?.pinch?.enabled||n?.enabled!==s?.enabled||n?.threshold!==s?.threshold}var Kf="2.2.0";function Bn(e,t,n){const i=n.zoom.drag,{dragStart:s,dragEnd:o}=j(e);if(i.drawTime!==t||!o)return;const{left:r,top:a,width:l,height:c}=Oa(e,n.zoom.mode,{dragStart:s,dragEnd:o},i.maintainAspectRatio),h=e.ctx;h.save(),h.beginPath(),h.fillStyle=i.backgroundColor||"rgba(225,225,225,0.3)",h.fillRect(r,a,l,c),i.borderWidth>0&&(h.lineWidth=i.borderWidth,h.strokeStyle=i.borderColor||"rgba(225,225,225)",h.strokeRect(r,a,l,c)),h.restore()}var Zf={id:"zoom",version:Kf,defaults:{pan:{enabled:!1,mode:"xy",threshold:10,modifierKey:null},zoom:{wheel:{enabled:!1,speed:.1,modifierKey:null},drag:{enabled:!1,drawTime:"beforeDatasetsDraw",modifierKey:null},pinch:{enabled:!1},mode:"xy"}},start:function(e,t,n){const i=j(e);i.options=n,Object.prototype.hasOwnProperty.call(n.zoom,"enabled")&&console.warn("The option \`zoom.enabled\` is no longer supported. Please use \`zoom.wheel.enabled\`, \`zoom.drag.enabled\`, or \`zoom.pinch.enabled\`."),(Object.prototype.hasOwnProperty.call(n.zoom,"overScaleMode")||Object.prototype.hasOwnProperty.call(n.pan,"overScaleMode"))&&console.warn("The option \`overScaleMode\` is deprecated. Please use \`scaleMode\` instead (and update \`mode\` as desired)."),on&&ur(e,n),e.pan=(s,o,r)=>ka(e,s,o,r),e.zoom=(s,o)=>bs(e,s,o),e.zoomRect=(s,o,r)=>Sa(e,s,o,r),e.zoomScale=(s,o,r)=>Tf(e,s,o,r),e.resetZoom=s=>Mf(e,s),e.getZoomLevel=()=>Cf(e),e.getInitialScaleBounds=()=>Ta(e),e.getZoomedScaleBounds=()=>Pf(e),e.isZoomedOrPanned=()=>Df(e),e.isZoomingOrPanning=()=>lr(e)},beforeEvent(e,{event:t}){if(lr(e))return!1;if(t.type==="click"||t.type==="mouseup"){const n=j(e);if(n.filterNextClick)return n.filterNextClick=!1,!1}},beforeUpdate:function(e,t,n){const i=j(e),s=i.options;i.options=n,Gf(s,n)&&(dr(e),ur(e,n)),Wf(e,n)},beforeDatasetsDraw(e,t,n){Bn(e,"beforeDatasetsDraw",n)},afterDatasetsDraw(e,t,n){Bn(e,"afterDatasetsDraw",n)},beforeDraw(e,t,n){Bn(e,"beforeDraw",n)},afterDraw(e,t,n){Bn(e,"afterDraw",n)},stop:function(e){Vf(e),on&&dr(e),uf(e)},panFunctions:$i,zoomFunctions:Ui,zoomRectFunctions:Yi};function Qf({data:e,...t}){const n=Ce(null),i=Ce(null);return ct(()=>{Wi.register(Zf,ef,gu,Qd,Nd,Id,Bd,qd);const s=i.current,o=n.current=new Wi(s,{type:"line",data:e.peek(),options:{scales:{y:{min:0}},animation:!1,responsive:!0,plugins:{zoom:{pan:{enabled:!0,mode:"x"},zoom:{wheel:{enabled:!0},mode:"x"}},legend:{position:"top"},title:{display:!1}}}}),r=e.subscribe(a=>{o.data=a,o.update()});return()=>{o.destroy(),r()}},[]),m.createElement("canvas",{ref:i,...t})}function Jf(){const e=te();ct(()=>{const n=i=>{an(i)||e()};return U?.on("mount",n),U?.on("unmount",n),()=>{U?.off("mount",n),U?.off("unmount",n)}},[]);const t=U?.profilingContext;return m.createElement("div",{className:"flex flex-col gap-2"},wr(t.appStats).filter(([n])=>!an(n)).map(([n])=>m.createElement(tg,{key:n.id,app:n})))}const fr=100,gr=e=>Object.entries(e).map(([t,{values:n,color:i}])=>({label:t,data:n,fill:!1,borderColor:i,tension:.1}));function tg({app:e}){const t=te(),n=Ce({update:{values:[0],color:"#ad981f"},updateDirtied:{values:[0],color:"#b21f3a"},createNode:{values:[0],color:"#198019"},removeNode:{values:[0],color:"#5F3691"},updateNode:{values:[0],color:"#2f2f9d"},signalAttrUpdate:{values:[0],color:"#28888f"},signalTextUpdate:{values:[0],color:"#9b3b98"}}),i=Q({labels:[(performance.now()/1e3).toFixed(2)],datasets:gr(n.current)}),s=Q(!1),o=U?.profilingContext;return ct(()=>{const r=a=>{a.id===e.id&&t()};return U?.on("update",r),()=>U?.off("update",r)},[]),ct(()=>{const r=[];Object.entries(n.current).forEach(([l,{values:c}])=>{const h=g=>{g.id===e.id&&s.peek()!==!0&&c[c.length-1]++},d=l;o.addEventListener(d,h),r.push(()=>o.removeEventListener(d,h))});const a=setInterval(()=>{if(s.peek()===!0)return;const l=[...i.value.labels];Object.values(n.current).forEach(c=>{c.values.push(0),c.values.length>fr&&c.values.shift()}),l.push((performance.now()/1e3).toFixed(2)),l.length>fr&&l.shift(),i.value={labels:l,datasets:gr(n.current)}},100);return()=>{r.forEach(l=>l()),clearInterval(a)}},[]),m.createElement("div",{className:"flex flex-col gap-2 border border-white border-opacity-10 rounded bg-neutral-400 bg-opacity-5 text-neutral-400 p-2"},m.createElement("div",{className:"grid items-start gap-2",style:"grid-template-columns: 1fr max-content;"},m.createElement("div",{className:"flex flex-col gap-2"},m.createElement("span",null,e.name),m.createElement(Qf,{data:i,className:"w-full max-w-full min-h-20 bg-black bg-opacity-30",onmouseenter:()=>s.value=!0,onmouseleave:()=>s.value=!1})),m.createElement("div",{className:"text-xs grid grid-cols-2 gap-x-4",style:"grid-template-columns: auto auto;"},m.createElement("span",{className:"text-right"},"Mount duration:"),o.mountDuration(e).toFixed(2)," ms",m.createElement("span",{className:"text-right"},"Total updates:"),m.createElement("span",null,o.totalTicks(e).toLocaleString()),m.createElement("span",{className:"text-right"},"Avg. update duration:"),o.averageTickDuration(e).toFixed(2)," ms",m.createElement("span",{className:"text-right"},"Latest update:"),m.createElement("span",null,o.lastTickDuration(e).toFixed(2)," ms"))))}const Ge=ht([]),Da=ht(""),eg=vr(()=>Da.value.toLowerCase().split(" ").filter(e=>e.length>0));function ng(e){return eg.value.every(t=>e.toLowerCase().includes(t))}function ig(){const e=te();ct(()=>{const n=i=>{an(i)||e()};return U?.on("update",n),()=>U?.off("update",n)},[]);const t=U?.globalState[Symbol.for("SWR_GLOBAL")]??new Map;return t.size===0?m.createElement("div",{className:"flex flex-col items-center justify-center h-full text-neutral-400"},m.createElement(Er,null),m.createElement("h2",{className:"text-lg italic"},"No SWR detected")):m.createElement("div",{className:"flex flex-col gap-2 items-start"},m.createElement(Pr,{value:Da,className:"sticky top-0"}),m.createElement("div",{className:"flex flex-col gap-2 w-full"},wr(t).filter(([n])=>ng(n)).map(([n,i])=>m.createElement(sg,{key:n,entry:i}))))}function sg({key:e,entry:t}){const n=Ge.value.includes(e),i=te();ct(()=>{const{resource:o,isValidating:r,isMutating:a}=t,l=[o.subscribe(i),r.subscribe(i),a.subscribe(i)];return()=>l.forEach(c=>c())},[]);const s=Te(()=>{n?Ge.value=Ge.value.filter(o=>o!==e):Ge.value=[...Ge.value,e]},[n]);return m.createElement("div",{className:"flex flex-col"},m.createElement("button",{onclick:s,className:"flex items-center gap-2 justify-between p-2 border border-white border-opacity-10 cursor-pointer"+(n?" bg-white bg-opacity-5 text-neutral-100 rounded-t":" hover:bg-white hover:bg-opacity-10 text-neutral-400 rounded")},e,m.createElement(Kt,{className:"transition-all"+(n?" rotate-90":"")})),n&&m.createElement("div",{className:"flex flex-col gap-2 p-2 border border-white border-opacity-10"},m.createElement(ye,{data:{resource:t.resource.peek(),isMutating:t.isMutating.peek(),isValidating:t.isValidating.peek()},mutable:!1,objectRefAcc:[],keys:[],onChange:()=>{}})))}const og=e=>m.createElement("main",{className:"flex flex-col flex-1 max-h-[calc(100vh-1rem)] overflow-y-auto",style:e.active?{}:{display:"none"}},e.children),Gi={Apps:{Icon:bl,View:Kl},Stores:{Icon:El,View:Jl},SWR:{Icon:_l,View:ig},Profiling:{Icon:vl,View:Jf},Settings:{Icon:xl,View:kl}},ti=ht("Apps");let pr=qt.peek();qt.subscribe(e=>{e!==pr&&e!==null&&(ti.value="Apps"),pr=e});function rg(){return m.createElement(Sl,null,m.createElement("nav",{className:"flex flex-col gap-2 justify-between p-2 bg-neutral-400 bg-opacity-5 border border-white border-opacity-10 rounded"},m.createElement("div",{className:"flex flex-col gap-2"},Object.keys(Gi).map(e=>m.createElement(ag,{key:e,title:e})))),Object.entries(Gi).map(([e,{View:t}])=>m.createElement(og,{key:e,active:ti.value===e},m.createElement(t,null))))}function ag({title:e}){const{Icon:t}=Gi[e];return m.createElement("button",{key:e,onclick:()=>{ti.value=e},className:"flex items-center px-2 py-1 gap-2 rounded border text-xs border-white border-opacity-10"+(ti.value===e?" bg-white bg-opacity-5 text-neutral-100":" hover:bg-white hover:bg-opacity-10 text-neutral-400"),title:e},m.createElement(t,{className:"text-primary"}),m.createElement("span",{className:"hidden sm:inline"},e))}cl(rg,document.getElementById("app")).then(()=>{Pe.send({type:"ready"}),setInterval(()=>{window.opener||window.close()},250)});</script>
|
|
1723
|
+
*/const dn=e=>e&&e.enabled&&e.modifierKey,xa=(e,t)=>e&&t[e+"Key"],ms=(e,t)=>e&&!t[e+"Key"];function Jt(e,t,n){return e===void 0?!0:typeof e=="string"?e.indexOf(t)!==-1:typeof e=="function"?e({chart:n}).indexOf(t)!==-1:!1}function Ti(e,t){return typeof e=="function"&&(e=e({chart:t})),typeof e=="string"?{x:e.indexOf("x")!==-1,y:e.indexOf("y")!==-1}:{x:!1,y:!1}}function cf(e,t){let n;return function(){return clearTimeout(n),n=setTimeout(e,t),t}}function hf({x:e,y:t},n){const i=n.scales,s=Object.keys(i);for(let o=0;o<s.length;o++){const r=i[s[o]];if(t>=r.top&&t<=r.bottom&&e>=r.left&&e<=r.right)return r}return null}function ya(e,t,n){const{mode:i="xy",scaleMode:s,overScaleMode:o}=e||{},r=hf(t,n),a=Ti(i,n),l=Ti(s,n);if(o){const h=Ti(o,n);for(const d of["x","y"])h[d]&&(l[d]=a[d],a[d]=!1)}if(r&&l[r.axis])return[r];const c=[];return z(n.scales,function(h){a[h.axis]&&c.push(h)}),c}const ji=new WeakMap;function j(e){let t=ji.get(e);return t||(t={originalScaleLimits:{},updatedScaleLimits:{},handlers:{},panDelta:{},dragging:!1,panning:!1},ji.set(e,t)),t}function uf(e){ji.delete(e)}function va(e,t,n,i){const s=Math.max(0,Math.min(1,(e-t)/n||0)),o=1-s;return{min:i*s,max:i*o}}function _a(e,t){const n=e.isHorizontal()?t.x:t.y;return e.getValueForPixel(n)}function wa(e,t,n){const i=e.max-e.min,s=i*(t-1),o=_a(e,n);return va(o,e.min,i,s)}function df(e,t,n){const i=_a(e,n);if(i===void 0)return{min:e.min,max:e.max};const s=Math.log10(e.min),o=Math.log10(e.max),r=Math.log10(i),a=o-s,l=a*(t-1),c=va(r,s,a,l);return{min:Math.pow(10,s+c.min),max:Math.pow(10,o-c.max)}}function ff(e,t){return t&&(t[e.id]||t[e.axis])||{}}function er(e,t,n,i,s){let o=n[i];if(o==="original"){const r=e.originalScaleLimits[t.id][i];o=L(r.options,r.scale)}return L(o,s)}function gf(e,t,n){const i=e.getValueForPixel(t),s=e.getValueForPixel(n);return{min:Math.min(i,s),max:Math.max(i,s)}}function pf(e,{min:t,max:n,minLimit:i,maxLimit:s},o){const r=(e-n+t)/2;t-=r,n+=r;const a=o.min.options??o.min.scale,l=o.max.options??o.max.scale,c=e/1e6;return pe(t,a,c)&&(t=a),pe(n,l,c)&&(n=l),t<i?(t=i,n=Math.min(i+e,s)):n>s&&(n=s,t=Math.max(s-e,i)),{min:t,max:n}}function _e(e,{min:t,max:n},i,s=!1){const o=j(e.chart),{options:r}=e,a=ff(e,i),{minRange:l=0}=a,c=er(o,e,a,"min",-1/0),h=er(o,e,a,"max",1/0);if(s==="pan"&&(t<c||n>h))return!0;const d=e.max-e.min,g=s?Math.max(n-t,l):d;if(s&&g===l&&d<=l)return!0;const p=pf(g,{min:t,max:n,minLimit:c,maxLimit:h},o.originalScaleLimits[e.id]);return r.min=p.min,r.max=p.max,o.updatedScaleLimits[e.id]=p,e.parse(p.min)!==e.min||e.parse(p.max)!==e.max}function mf(e,t,n,i){const s=wa(e,t,n),o={min:e.min+s.min,max:e.max-s.max};return _e(e,o,i,!0)}function bf(e,t,n,i){const s=df(e,t,n);return _e(e,s,i,!0)}function xf(e,t,n,i){_e(e,gf(e,t,n),i,!0)}const nr=e=>e===0||isNaN(e)?0:e<0?Math.min(Math.round(e),-1):Math.max(Math.round(e),1);function yf(e){const n=e.getLabels().length-1;e.min>0&&(e.min-=1),e.max<n&&(e.max+=1)}function vf(e,t,n,i){const s=wa(e,t,n);e.min===e.max&&t<1&&yf(e);const o={min:e.min+nr(s.min),max:e.max-nr(s.max)};return _e(e,o,i,!0)}function _f(e){return e.isHorizontal()?e.width:e.height}function wf(e,t,n){const s=e.getLabels().length-1;let{min:o,max:r}=e;const a=Math.max(r-o,1),l=Math.round(_f(e)/Math.max(a,10)),c=Math.round(Math.abs(t/l));let h;return t<-l?(r=Math.min(r+c,s),o=a===1?r:r-a,h=r===s):t>l&&(o=Math.max(0,o-c),r=a===1?o:o+a,h=o===0),_e(e,{min:o,max:r},n)||h}const Ef={second:500,minute:30*1e3,hour:1800*1e3,day:720*60*1e3,week:3.5*24*60*60*1e3,month:360*60*60*1e3,quarter:1440*60*60*1e3,year:4368*60*60*1e3};function Ea(e,t,n,i=!1){const{min:s,max:o,options:r}=e,a=r.time&&r.time.round,l=Ef[a]||0,c=e.getValueForPixel(e.getPixelForValue(s+l)-t),h=e.getValueForPixel(e.getPixelForValue(o+l)-t);return isNaN(c)||isNaN(h)?!0:_e(e,{min:c,max:h},n,i?"pan":!1)}function ir(e,t,n){return Ea(e,t,n,!0)}const Ui={category:vf,default:mf,logarithmic:bf},Yi={default:xf},$i={category:wf,default:Ea,logarithmic:ir,timeseries:ir};function Sf(e,t,n){const{id:i,options:{min:s,max:o}}=e;if(!t[i]||!n[i])return!0;const r=n[i];return r.min!==s||r.max!==o}function sr(e,t){z(e,(n,i)=>{t[i]||delete e[i]})}function Re(e,t){const{scales:n}=e,{originalScaleLimits:i,updatedScaleLimits:s}=t;return z(n,function(o){Sf(o,i,s)&&(i[o.id]={min:{scale:o.min,options:o.options.min},max:{scale:o.max,options:o.options.max}})}),sr(i,n),sr(s,n),i}function or(e,t,n,i){const s=Ui[e.type]||Ui.default;I(s,[e,t,n,i])}function rr(e,t,n,i){const s=Yi[e.type]||Yi.default;I(s,[e,t,n,i])}function kf(e){const t=e.chartArea;return{x:(t.left+t.right)/2,y:(t.top+t.bottom)/2}}function bs(e,t,n="none",i="api"){const{x:s=1,y:o=1,focalPoint:r=kf(e)}=typeof t=="number"?{x:t,y:t}:t,a=j(e),{options:{limits:l,zoom:c}}=a;Re(e,a);const h=s!==1,d=o!==1,g=ya(c,r,e);z(g||e.scales,function(p){p.isHorizontal()&&h?or(p,s,r,l):!p.isHorizontal()&&d&&or(p,o,r,l)}),e.update(n),I(c.onZoom,[{chart:e,trigger:i}])}function Sa(e,t,n,i="none",s="api"){const o=j(e),{options:{limits:r,zoom:a}}=o,{mode:l="xy"}=a;Re(e,o);const c=Jt(l,"x",e),h=Jt(l,"y",e);z(e.scales,function(d){d.isHorizontal()&&c?rr(d,t.x,n.x,r):!d.isHorizontal()&&h&&rr(d,t.y,n.y,r)}),e.update(i),I(a.onZoom,[{chart:e,trigger:s}])}function Tf(e,t,n,i="none",s="api"){const o=j(e);Re(e,o);const r=e.scales[t];_e(r,n,void 0,!0),e.update(i),I(o.options.zoom?.onZoom,[{chart:e,trigger:s}])}function Mf(e,t="default"){const n=j(e),i=Re(e,n);z(e.scales,function(s){const o=s.options;i[s.id]?(o.min=i[s.id].min.options,o.max=i[s.id].max.options):(delete o.min,delete o.max),delete n.updatedScaleLimits[s.id]}),e.update(t),I(n.options.zoom.onZoomComplete,[{chart:e}])}function Of(e,t){const n=e.originalScaleLimits[t];if(!n)return;const{min:i,max:s}=n;return L(s.options,s.scale)-L(i.options,i.scale)}function Cf(e){const t=j(e);let n=1,i=1;return z(e.scales,function(s){const o=Of(t,s.id);if(o){const r=Math.round(o/(s.max-s.min)*100)/100;n=Math.min(n,r),i=Math.max(i,r)}}),n<1?n:i}function ar(e,t,n,i){const{panDelta:s}=i,o=s[e.id]||0;Qt(o)===Qt(t)&&(t+=o);const r=$i[e.type]||$i.default;I(r,[e,t,n])?s[e.id]=0:s[e.id]=t}function ka(e,t,n,i="none"){const{x:s=0,y:o=0}=typeof t=="number"?{x:t,y:t}:t,r=j(e),{options:{pan:a,limits:l}}=r,{onPan:c}=a||{};Re(e,r);const h=s!==0,d=o!==0;z(n||e.scales,function(g){g.isHorizontal()&&h?ar(g,s,l,r):!g.isHorizontal()&&d&&ar(g,o,l,r)}),e.update(i),I(c,[{chart:e}])}function Ta(e){const t=j(e);Re(e,t);const n={};for(const i of Object.keys(e.scales)){const{min:s,max:o}=t.originalScaleLimits[i]||{min:{},max:{}};n[i]={min:s.scale,max:o.scale}}return n}function Pf(e){const t=j(e),n={};for(const i of Object.keys(e.scales))n[i]=t.updatedScaleLimits[i];return n}function Df(e){const t=Ta(e);for(const n of Object.keys(e.scales)){const{min:i,max:s}=t[n];if(i!==void 0&&e.scales[n].min!==i||s!==void 0&&e.scales[n].max!==s)return!0}return!1}function lr(e){const t=j(e);return t.panning||t.dragging}const cr=(e,t,n)=>Math.min(n,Math.max(t,e));function rt(e,t){const{handlers:n}=j(e),i=n[t];i&&i.target&&(i.target.removeEventListener(t,i),delete n[t])}function rn(e,t,n,i){const{handlers:s,options:o}=j(e),r=s[n];if(r&&r.target===t)return;rt(e,n),s[n]=l=>i(e,l,o),s[n].target=t;const a=n==="wheel"?!1:void 0;t.addEventListener(n,s[n],{passive:a})}function Af(e,t){const n=j(e);n.dragStart&&(n.dragging=!0,n.dragEnd=t,e.update("none"))}function If(e,t){const n=j(e);!n.dragStart||t.key!=="Escape"||(rt(e,"keydown"),n.dragging=!1,n.dragStart=n.dragEnd=null,e.update("none"))}function Xi(e,t){if(e.target!==t.canvas){const n=t.canvas.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}}return Ct(e,t)}function Ma(e,t,n){const{onZoomStart:i,onZoomRejected:s}=n;if(i){const o=Xi(t,e);if(I(i,[{chart:e,event:t,point:o}])===!1)return I(s,[{chart:e,event:t}]),!1}}function Nf(e,t){if(e.legend){const o=Ct(t,e);if(De(o,e.legend))return}const n=j(e),{pan:i,zoom:s={}}=n.options;if(t.button!==0||xa(dn(i),t)||ms(dn(s.drag),t))return I(s.onZoomRejected,[{chart:e,event:t}]);Ma(e,t,s)!==!1&&(n.dragStart=t,rn(e,e.canvas.ownerDocument,"mousemove",Af),rn(e,window.document,"keydown",If))}function Lf({begin:e,end:t},n){let i=t.x-e.x,s=t.y-e.y;const o=Math.abs(i/s);o>n?i=Math.sign(i)*Math.abs(s*n):o<n&&(s=Math.sign(s)*Math.abs(i/n)),t.x=e.x+i,t.y=e.y+s}function hr(e,t,n,{min:i,max:s,prop:o}){e[i]=cr(Math.min(n.begin[o],n.end[o]),t[i],t[s]),e[s]=cr(Math.max(n.begin[o],n.end[o]),t[i],t[s])}function Rf(e,t,n){const i={begin:Xi(t.dragStart,e),end:Xi(t.dragEnd,e)};if(n){const s=e.chartArea.width/e.chartArea.height;Lf(i,s)}return i}function Oa(e,t,n,i){const s=Jt(t,"x",e),o=Jt(t,"y",e),{top:r,left:a,right:l,bottom:c,width:h,height:d}=e.chartArea,g={top:r,left:a,right:l,bottom:c},p=Rf(e,n,i&&s&&o);s&&hr(g,e.chartArea,p,{min:"left",max:"right",prop:"x"}),o&&hr(g,e.chartArea,p,{min:"top",max:"bottom",prop:"y"});const y=g.right-g.left,x=g.bottom-g.top;return{...g,width:y,height:x,zoomX:s&&y?1+(h-y)/h:1,zoomY:o&&x?1+(d-x)/d:1}}function zf(e,t){const n=j(e);if(!n.dragStart)return;rt(e,"mousemove");const{mode:i,onZoomComplete:s,drag:{threshold:o=0,maintainAspectRatio:r}}=n.options.zoom,a=Oa(e,i,{dragStart:n.dragStart,dragEnd:t},r),l=Jt(i,"x",e)?a.width:0,c=Jt(i,"y",e)?a.height:0,h=Math.sqrt(l*l+c*c);if(n.dragStart=n.dragEnd=null,h<=o){n.dragging=!1,e.update("none");return}Sa(e,{x:a.left,y:a.top},{x:a.right,y:a.bottom},"zoom","drag"),n.dragging=!1,n.filterNextClick=!0,I(s,[{chart:e}])}function Ff(e,t,n){if(ms(dn(n.wheel),t)){I(n.onZoomRejected,[{chart:e,event:t}]);return}if(Ma(e,t,n)!==!1&&(t.cancelable&&t.preventDefault(),t.deltaY!==void 0))return!0}function Hf(e,t){const{handlers:{onZoomComplete:n},options:{zoom:i}}=j(e);if(!Ff(e,t,i))return;const s=t.target.getBoundingClientRect(),o=i.wheel.speed,r=t.deltaY>=0?2-1/(1-o):1+o,a={x:r,y:r,focalPoint:{x:t.clientX-s.left,y:t.clientY-s.top}};bs(e,a,"zoom","wheel"),I(n,[{chart:e}])}function Bf(e,t,n,i){n&&(j(e).handlers[t]=cf(()=>I(n,[{chart:e}]),i))}function Wf(e,t){const n=e.canvas,{wheel:i,drag:s,onZoomComplete:o}=t.zoom;i.enabled?(rn(e,n,"wheel",Hf),Bf(e,"onZoomComplete",o,250)):rt(e,"wheel"),s.enabled?(rn(e,n,"mousedown",Nf),rn(e,n.ownerDocument,"mouseup",zf)):(rt(e,"mousedown"),rt(e,"mousemove"),rt(e,"mouseup"),rt(e,"keydown"))}function Vf(e){rt(e,"mousedown"),rt(e,"mousemove"),rt(e,"mouseup"),rt(e,"wheel"),rt(e,"click"),rt(e,"keydown")}function jf(e,t){return function(n,i){const{pan:s,zoom:o={}}=t.options;if(!s||!s.enabled)return!1;const r=i&&i.srcEvent;return r&&!t.panning&&i.pointerType==="mouse"&&(ms(dn(s),r)||xa(dn(o.drag),r))?(I(s.onPanRejected,[{chart:e,event:i}]),!1):!0}}function Uf(e,t){const n=Math.abs(e.clientX-t.clientX),i=Math.abs(e.clientY-t.clientY),s=n/i;let o,r;return s>.3&&s<1.7?o=r=!0:n>i?o=!0:r=!0,{x:o,y:r}}function Ca(e,t,n){if(t.scale){const{center:i,pointers:s}=n,o=1/t.scale*n.scale,r=n.target.getBoundingClientRect(),a=Uf(s[0],s[1]),l=t.options.zoom.mode,c={x:a.x&&Jt(l,"x",e)?o:1,y:a.y&&Jt(l,"y",e)?o:1,focalPoint:{x:i.x-r.left,y:i.y-r.top}};bs(e,c,"zoom","pinch"),t.scale=n.scale}}function Yf(e,t,n){if(t.options.zoom.pinch.enabled){const i=Ct(n,e);I(t.options.zoom.onZoomStart,[{chart:e,event:n,point:i}])===!1?(t.scale=null,I(t.options.zoom.onZoomRejected,[{chart:e,event:n}])):t.scale=1}}function $f(e,t,n){t.scale&&(Ca(e,t,n),t.scale=null,I(t.options.zoom.onZoomComplete,[{chart:e}]))}function Pa(e,t,n){const i=t.delta;i&&(t.panning=!0,ka(e,{x:n.deltaX-i.x,y:n.deltaY-i.y},t.panScales),t.delta={x:n.deltaX,y:n.deltaY})}function Xf(e,t,n){const{enabled:i,onPanStart:s,onPanRejected:o}=t.options.pan;if(!i)return;const r=n.target.getBoundingClientRect(),a={x:n.center.x-r.left,y:n.center.y-r.top};if(I(s,[{chart:e,event:n,point:a}])===!1)return I(o,[{chart:e,event:n}]);t.panScales=ya(t.options.pan,a,e),t.delta={x:0,y:0},Pa(e,t,n)}function qf(e,t){t.delta=null,t.panning&&(t.panning=!1,t.filterNextClick=!0,I(t.options.pan.onPanComplete,[{chart:e}]))}const qi=new WeakMap;function ur(e,t){const n=j(e),i=e.canvas,{pan:s,zoom:o}=t,r=new on.Manager(i);o&&o.pinch.enabled&&(r.add(new on.Pinch),r.on("pinchstart",a=>Yf(e,n,a)),r.on("pinch",a=>Ca(e,n,a)),r.on("pinchend",a=>$f(e,n,a))),s&&s.enabled&&(r.add(new on.Pan({threshold:s.threshold,enable:jf(e,n)})),r.on("panstart",a=>Xf(e,n,a)),r.on("panmove",a=>Pa(e,n,a)),r.on("panend",()=>qf(e,n))),qi.set(e,r)}function dr(e){const t=qi.get(e);t&&(t.remove("pinchstart"),t.remove("pinch"),t.remove("pinchend"),t.remove("panstart"),t.remove("pan"),t.remove("panend"),t.destroy(),qi.delete(e))}function Gf(e,t){const{pan:n,zoom:i}=e,{pan:s,zoom:o}=t;return i?.zoom?.pinch?.enabled!==o?.zoom?.pinch?.enabled||n?.enabled!==s?.enabled||n?.threshold!==s?.threshold}var Kf="2.2.0";function Bn(e,t,n){const i=n.zoom.drag,{dragStart:s,dragEnd:o}=j(e);if(i.drawTime!==t||!o)return;const{left:r,top:a,width:l,height:c}=Oa(e,n.zoom.mode,{dragStart:s,dragEnd:o},i.maintainAspectRatio),h=e.ctx;h.save(),h.beginPath(),h.fillStyle=i.backgroundColor||"rgba(225,225,225,0.3)",h.fillRect(r,a,l,c),i.borderWidth>0&&(h.lineWidth=i.borderWidth,h.strokeStyle=i.borderColor||"rgba(225,225,225)",h.strokeRect(r,a,l,c)),h.restore()}var Zf={id:"zoom",version:Kf,defaults:{pan:{enabled:!1,mode:"xy",threshold:10,modifierKey:null},zoom:{wheel:{enabled:!1,speed:.1,modifierKey:null},drag:{enabled:!1,drawTime:"beforeDatasetsDraw",modifierKey:null},pinch:{enabled:!1},mode:"xy"}},start:function(e,t,n){const i=j(e);i.options=n,Object.prototype.hasOwnProperty.call(n.zoom,"enabled")&&console.warn("The option \`zoom.enabled\` is no longer supported. Please use \`zoom.wheel.enabled\`, \`zoom.drag.enabled\`, or \`zoom.pinch.enabled\`."),(Object.prototype.hasOwnProperty.call(n.zoom,"overScaleMode")||Object.prototype.hasOwnProperty.call(n.pan,"overScaleMode"))&&console.warn("The option \`overScaleMode\` is deprecated. Please use \`scaleMode\` instead (and update \`mode\` as desired)."),on&&ur(e,n),e.pan=(s,o,r)=>ka(e,s,o,r),e.zoom=(s,o)=>bs(e,s,o),e.zoomRect=(s,o,r)=>Sa(e,s,o,r),e.zoomScale=(s,o,r)=>Tf(e,s,o,r),e.resetZoom=s=>Mf(e,s),e.getZoomLevel=()=>Cf(e),e.getInitialScaleBounds=()=>Ta(e),e.getZoomedScaleBounds=()=>Pf(e),e.isZoomedOrPanned=()=>Df(e),e.isZoomingOrPanning=()=>lr(e)},beforeEvent(e,{event:t}){if(lr(e))return!1;if(t.type==="click"||t.type==="mouseup"){const n=j(e);if(n.filterNextClick)return n.filterNextClick=!1,!1}},beforeUpdate:function(e,t,n){const i=j(e),s=i.options;i.options=n,Gf(s,n)&&(dr(e),ur(e,n)),Wf(e,n)},beforeDatasetsDraw(e,t,n){Bn(e,"beforeDatasetsDraw",n)},afterDatasetsDraw(e,t,n){Bn(e,"afterDatasetsDraw",n)},beforeDraw(e,t,n){Bn(e,"beforeDraw",n)},afterDraw(e,t,n){Bn(e,"afterDraw",n)},stop:function(e){Vf(e),on&&dr(e),uf(e)},panFunctions:$i,zoomFunctions:Ui,zoomRectFunctions:Yi};function Qf({data:e,...t}){const n=Ce(null),i=Ce(null);return ct(()=>{Wi.register(Zf,ef,gu,Qd,Nd,Id,Bd,qd);const s=i.current,o=n.current=new Wi(s,{type:"line",data:e.peek(),options:{scales:{y:{min:0}},animation:!1,responsive:!0,plugins:{zoom:{pan:{enabled:!0,mode:"x"},zoom:{wheel:{enabled:!0},mode:"x"}},legend:{position:"top"},title:{display:!1}}}}),r=e.subscribe(a=>{o.data=a,o.update()});return()=>{o.destroy(),r()}},[]),m.createElement("canvas",{ref:i,...t})}function Jf(){const e=te();ct(()=>{const n=i=>{an(i)||e()};return U?.on("mount",n),U?.on("unmount",n),()=>{U?.off("mount",n),U?.off("unmount",n)}},[]);const t=U?.profilingContext;return m.createElement("div",{className:"flex flex-col gap-2"},wr(t.appStats).filter(([n])=>!an(n)).map(([n])=>m.createElement(tg,{key:n.id,app:n})))}const fr=100,gr=e=>Object.entries(e).map(([t,{values:n,color:i}])=>({label:t,data:n,fill:!1,borderColor:i,tension:.1}));function tg({app:e}){const t=te(),n=Ce({update:{values:[0],color:"#ad981f"},updateDirtied:{values:[0],color:"#b21f3a"},createNode:{values:[0],color:"#198019"},removeNode:{values:[0],color:"#5F3691"},updateNode:{values:[0],color:"#2f2f9d"},signalAttrUpdate:{values:[0],color:"#28888f"},signalTextUpdate:{values:[0],color:"#9b3b98"}}),i=Q({labels:[(performance.now()/1e3).toFixed(2)],datasets:gr(n.current)}),s=Q(!1),o=U?.profilingContext;return ct(()=>{const r=a=>{a.id===e.id&&t()};return U?.on("update",r),()=>U?.off("update",r)},[]),ct(()=>{const r=[];Object.entries(n.current).forEach(([l,{values:c}])=>{const h=g=>{g.id===e.id&&s.peek()!==!0&&c[c.length-1]++},d=l;o.addEventListener(d,h),r.push(()=>o.removeEventListener(d,h))});const a=setInterval(()=>{if(s.peek()===!0)return;const l=[...i.value.labels];Object.values(n.current).forEach(c=>{c.values.push(0),c.values.length>fr&&c.values.shift()}),l.push((performance.now()/1e3).toFixed(2)),l.length>fr&&l.shift(),i.value={labels:l,datasets:gr(n.current)}},100);return()=>{r.forEach(l=>l()),clearInterval(a)}},[]),m.createElement("div",{className:"flex flex-col gap-2 border border-white border-opacity-10 rounded bg-neutral-400 bg-opacity-5 text-neutral-400 p-2"},m.createElement("div",{className:"grid items-start gap-2",style:"grid-template-columns: 1fr max-content;"},m.createElement("div",{className:"flex flex-col gap-2"},m.createElement("span",null,e.name),m.createElement(Qf,{data:i,className:"w-full max-w-full min-h-20 bg-black bg-opacity-30",onmouseenter:()=>s.value=!0,onmouseleave:()=>s.value=!1})),m.createElement("div",{className:"text-xs grid grid-cols-2 gap-x-4",style:"grid-template-columns: auto auto;"},m.createElement("span",{className:"text-right"},"Mount duration:"),o.mountDuration(e).toFixed(2)," ms",m.createElement("span",{className:"text-right"},"Total updates:"),m.createElement("span",null,o.totalTicks(e).toLocaleString()),m.createElement("span",{className:"text-right"},"Avg. update duration:"),o.averageTickDuration(e).toFixed(2)," ms",m.createElement("span",{className:"text-right"},"Latest update:"),m.createElement("span",null,o.lastTickDuration(e).toFixed(2)," ms"))))}const Ge=ht([]),Da=ht(""),eg=vr(()=>Da.value.toLowerCase().split(" ").filter(e=>e.length>0));function ng(e){return eg.value.every(t=>e.toLowerCase().includes(t))}function ig(){const e=te();ct(()=>{const n=i=>{an(i)||e()};return U?.on("update",n),()=>U?.off("update",n)},[]);const t=U?.globalState[Symbol.for("SWR_GLOBAL")]??new Map;return t.size===0?m.createElement("div",{className:"flex flex-col items-center justify-center h-full text-neutral-400"},m.createElement(Er,null),m.createElement("h2",{className:"text-lg italic"},"No SWR detected")):m.createElement("div",{className:"flex flex-col gap-2 items-start"},m.createElement(Pr,{value:Da,className:"sticky top-0"}),m.createElement("div",{className:"flex flex-col gap-2 w-full"},wr(t).filter(([n])=>ng(n)).map(([n,i])=>m.createElement(sg,{key:n,entry:i}))))}function sg({key:e,entry:t}){const n=Ge.value.includes(e),i=te();ct(()=>{const{resource:o,isValidating:r,isMutating:a}=t,l=[o.subscribe(i),r.subscribe(i),a.subscribe(i)];return()=>l.forEach(c=>c())},[]);const s=Te(()=>{n?Ge.value=Ge.value.filter(o=>o!==e):Ge.value=[...Ge.value,e]},[n]);return m.createElement("div",{className:"flex flex-col"},m.createElement("button",{onclick:s,className:"flex items-center gap-2 justify-between p-2 border border-white border-opacity-10 cursor-pointer"+(n?" bg-white bg-opacity-5 text-neutral-100 rounded-t":" hover:bg-white hover:bg-opacity-10 text-neutral-400 rounded")},e,m.createElement(Kt,{className:"transition-all"+(n?" rotate-90":"")})),n&&m.createElement("div",{className:"flex flex-col gap-2 p-2 border border-white border-opacity-10"},m.createElement(ye,{data:{resource:t.resource.peek(),isMutating:t.isMutating.peek(),isValidating:t.isValidating.peek()},mutable:!1,objectRefAcc:[],keys:[],onChange:()=>{}})))}const og=e=>m.createElement("main",{className:"flex flex-col flex-1 max-h-[calc(100vh-1rem)] overflow-y-auto",style:e.active?{}:{display:"none"}},e.children),Gi={Apps:{Icon:bl,View:Kl},Stores:{Icon:El,View:Jl},SWR:{Icon:_l,View:ig},Profiling:{Icon:vl,View:Jf},Settings:{Icon:xl,View:kl}},ti=ht("Apps");let pr=qt.peek();qt.subscribe(e=>{e!==pr&&e!==null&&(ti.value="Apps"),pr=e});function rg(){return m.createElement(Sl,null,m.createElement("nav",{className:"flex flex-col gap-2 justify-between p-2 bg-neutral-400 bg-opacity-5 border border-white border-opacity-10 rounded"},m.createElement("div",{className:"flex flex-col gap-2"},Object.keys(Gi).map(e=>m.createElement(ag,{key:e,title:e})))),Object.entries(Gi).map(([e,{View:t}])=>m.createElement(og,{key:e,active:ti.value===e},m.createElement(t,null))))}function ag({title:e}){const{Icon:t}=Gi[e];return m.createElement("button",{key:e,onclick:()=>{ti.value=e},className:"flex items-center px-2 py-1 gap-2 rounded border text-xs border-white border-opacity-10"+(ti.value===e?" bg-white bg-opacity-5 text-neutral-100":" hover:bg-white hover:bg-opacity-10 text-neutral-400"),title:e},m.createElement(t,{className:"text-primary"}),m.createElement("span",{className:"hidden sm:inline"},e))}cl(m.createElement(rg,null),document.getElementById("app"));Pe.send({type:"ready"});setInterval(()=>{window.opener||window.close()},250);</script>
|
|
1724
1724
|
<style rel="stylesheet" crossorigin>*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.top-0{top:0}.z-10{z-index:10}.z-\\[9999\\]{z-index:9999}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.ml-6{margin-left:1.5rem}.flex{display:flex}.grid{display:grid}.hidden{display:none}.h-5{height:1.25rem}.h-full{height:100%}.max-h-\\[calc\\(100vh-1rem\\)\\]{max-height:calc(100vh - 1rem)}.min-h-20{min-height:5rem}.min-h-screen{min-height:100vh}.w-5{width:1.25rem}.w-8{width:2rem}.w-\\[5px\\]{width:5px}.w-full{width:100%}.max-w-full{max-width:100%}.flex-1{flex:1 1 0%}.flex-grow{flex-grow:1}.-translate-x-1\\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-col-resize{cursor:col-resize}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.resize{resize:both}.scroll-m-12{scroll-margin:3rem}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-4{gap:1rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rounded{border-radius:.25rem}.rounded-b{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-\\[\\#fff1\\]{border-color:#fff1}.border-neutral-700{--tw-border-opacity: 1;border-color:rgb(64 64 64 / var(--tw-border-opacity, 1))}.border-neutral-800{--tw-border-opacity: 1;border-color:rgb(38 38 38 / var(--tw-border-opacity, 1))}.border-white{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.border-opacity-10{--tw-border-opacity: .1}.bg-\\[\\#171616\\]{--tw-bg-opacity: 1;background-color:rgb(23 22 22 / var(--tw-bg-opacity, 1))}.bg-\\[\\#1a1a1a\\]{--tw-bg-opacity: 1;background-color:rgb(26 26 26 / var(--tw-bg-opacity, 1))}.bg-\\[\\#1d1d1d\\]{--tw-bg-opacity: 1;background-color:rgb(29 29 29 / var(--tw-bg-opacity, 1))}.bg-\\[\\#212121\\]{--tw-bg-opacity: 1;background-color:rgb(33 33 33 / var(--tw-bg-opacity, 1))}.bg-\\[\\#ffffff04\\]{background-color:#ffffff04}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-neutral-400{--tw-bg-opacity: 1;background-color:rgb(163 163 163 / var(--tw-bg-opacity, 1))}.bg-neutral-800{--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity, 1))}.bg-neutral-900{--tw-bg-opacity: 1;background-color:rgb(23 23 23 / var(--tw-bg-opacity, 1))}.bg-primary{--tw-bg-opacity: 1;background-color:rgb(220 20 60 / var(--tw-bg-opacity, 1))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-opacity-30{--tw-bg-opacity: .3}.bg-opacity-5{--tw-bg-opacity: .05}.p-1{padding:.25rem}.p-2{padding:.5rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.pb-2{padding-bottom:.5rem}.pl-2{padding-left:.5rem}.pl-4{padding-left:1rem}.pl-6{padding-left:1.5rem}.pl-8{padding-left:2rem}.pr-1{padding-right:.25rem}.text-right{text-align:right}.text-\\[10px\\]{font-size:10px}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.italic{font-style:italic}.text-neutral-100{--tw-text-opacity: 1;color:rgb(245 245 245 / var(--tw-text-opacity, 1))}.text-neutral-300{--tw-text-opacity: 1;color:rgb(212 212 212 / var(--tw-text-opacity, 1))}.text-neutral-400{--tw-text-opacity: 1;color:rgb(163 163 163 / var(--tw-text-opacity, 1))}.text-primary{--tw-text-opacity: 1;color:rgb(220 20 60 / var(--tw-text-opacity, 1))}.accent-red-500{accent-color:#ef4444}.opacity-50{opacity:.5}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}:root{color-scheme:dark}#app{min-width:-moz-fit-content;min-width:fit-content;background-image:linear-gradient(#171616,#0e0e0e);color:#fff;min-height:100vh;width:100%;display:flex;flex-direction:row;padding:.5rem;gap:.5rem}select{background:url("data:image/svg+xml,<svg height='10px' width='10px' viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'><path d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/></svg>") no-repeat;background-position:calc(100% - .75rem) center!important;-moz-appearance:none!important;-webkit-appearance:none!important;appearance:none!important;padding-right:2rem!important}select:not([disabled]){cursor:pointer}.last\\:border-b-0:last-child{border-bottom-width:0px}.hover\\:bg-neutral-700:hover{--tw-bg-opacity: 1;background-color:rgb(64 64 64 / var(--tw-bg-opacity, 1))}.hover\\:bg-white:hover{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.hover\\:bg-opacity-10:hover{--tw-bg-opacity: .1}.hover\\:opacity-100:hover{opacity:1}.focus\\:outline:focus{outline-style:solid}.focus\\:outline-primary:focus{outline-color:#dc143c}@media (min-width: 640px){.sm\\:inline{display:inline}}</style>
|
|
1725
1725
|
</head>
|
|
1726
1726
|
<body class="w-full min-h-screen">
|
|
@@ -1735,7 +1735,7 @@ var dist_default2 = `var __defProp = Object.defineProperty;
|
|
|
1735
1735
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
1736
1736
|
|
|
1737
1737
|
// src/index.ts
|
|
1738
|
-
import { mount } from "kiru";
|
|
1738
|
+
import { createElement as createElement7, mount } from "kiru";
|
|
1739
1739
|
|
|
1740
1740
|
// src/App.tsx
|
|
1741
1741
|
import * as kiru6 from "kiru";
|
|
@@ -1761,7 +1761,14 @@ var Flame = /* @__PURE__ */ __name(() => {
|
|
|
1761
1761
|
}, "Flame");
|
|
1762
1762
|
|
|
1763
1763
|
// src/hooks/useAnchorPos.ts
|
|
1764
|
-
import {
|
|
1764
|
+
import {
|
|
1765
|
+
useCallback as useCallback2,
|
|
1766
|
+
useComputed as useComputed2,
|
|
1767
|
+
useLayoutEffect as useLayoutEffect2,
|
|
1768
|
+
useRef,
|
|
1769
|
+
useSignal as useSignal5,
|
|
1770
|
+
useWatch as useWatch2
|
|
1771
|
+
} from "kiru";
|
|
1765
1772
|
|
|
1766
1773
|
// src/utils/constants.ts
|
|
1767
1774
|
var PADDING = 16;
|
|
@@ -1786,6 +1793,7 @@ var FLAG_UPDATE = 1 << 1;
|
|
|
1786
1793
|
var FLAG_PLACEMENT = 1 << 2;
|
|
1787
1794
|
var FLAG_DELETION = 1 << 3;
|
|
1788
1795
|
var FLAG_HAS_MEMO_ANCESTOR = 1 << 4;
|
|
1796
|
+
var FLAG_STATIC_DOM = 1 << 5;
|
|
1789
1797
|
|
|
1790
1798
|
// ../lib/dist/env.js
|
|
1791
1799
|
var NODE_ENV = "development";
|
|
@@ -2338,50 +2346,6 @@ var useElementByPoint = /* @__PURE__ */ __name((options) => {
|
|
|
2338
2346
|
};
|
|
2339
2347
|
}, "useElementByPoint");
|
|
2340
2348
|
|
|
2341
|
-
// ../devtools-shared/src/hooks/useEffectDeep.ts
|
|
2342
|
-
import { useHook as useHook5, cleanupHook as cleanupHook4, sideEffectsEnabled as sideEffectsEnabled5 } from "kiru";
|
|
2343
|
-
var deepEqual = /* @__PURE__ */ __name((a, b) => {
|
|
2344
|
-
if (a === b) {
|
|
2345
|
-
return true;
|
|
2346
|
-
}
|
|
2347
|
-
if (typeof a != "object" || typeof b != "object" || a == null || b == null) {
|
|
2348
|
-
return false;
|
|
2349
|
-
}
|
|
2350
|
-
const aKeys = Object.keys(a);
|
|
2351
|
-
const bKeys = Object.keys(b);
|
|
2352
|
-
if (aKeys.length != bKeys.length) {
|
|
2353
|
-
return false;
|
|
2354
|
-
}
|
|
2355
|
-
for (let key of aKeys) {
|
|
2356
|
-
if (!bKeys.includes(key) || !deepEqual(a[key], b[key])) {
|
|
2357
|
-
return false;
|
|
2358
|
-
}
|
|
2359
|
-
}
|
|
2360
|
-
return true;
|
|
2361
|
-
}, "deepEqual");
|
|
2362
|
-
var depsRequireChange3 = /* @__PURE__ */ __name((a, b) => {
|
|
2363
|
-
return !deepEqual(a, b);
|
|
2364
|
-
}, "depsRequireChange");
|
|
2365
|
-
var useEffectDeep = /* @__PURE__ */ __name((callback, deps) => {
|
|
2366
|
-
if (!sideEffectsEnabled5()) return;
|
|
2367
|
-
useHook5(
|
|
2368
|
-
"useEffectDeep",
|
|
2369
|
-
{ callback, deps },
|
|
2370
|
-
({ hook, isInit, queueEffect }) => {
|
|
2371
|
-
if (isInit || depsRequireChange3(deps, hook.deps)) {
|
|
2372
|
-
hook.deps = structuredClone(deps);
|
|
2373
|
-
cleanupHook4(hook);
|
|
2374
|
-
queueEffect(() => {
|
|
2375
|
-
const cleanup = callback();
|
|
2376
|
-
if (cleanup && typeof cleanup === "function") {
|
|
2377
|
-
hook.cleanup = cleanup;
|
|
2378
|
-
}
|
|
2379
|
-
});
|
|
2380
|
-
}
|
|
2381
|
-
}
|
|
2382
|
-
);
|
|
2383
|
-
}, "useEffectDeep");
|
|
2384
|
-
|
|
2385
2349
|
// src/hooks/useAnchorPos.ts
|
|
2386
2350
|
var useAnchorPos = /* @__PURE__ */ __name(() => {
|
|
2387
2351
|
const { mouse } = useMouse();
|
|
@@ -2413,14 +2377,15 @@ var useAnchorPos = /* @__PURE__ */ __name(() => {
|
|
|
2413
2377
|
Math.round(elementBound.width.value),
|
|
2414
2378
|
Math.round(elementBound.height.value)
|
|
2415
2379
|
]);
|
|
2416
|
-
const distanceCovered =
|
|
2417
|
-
if (startMouse.value === null) return null;
|
|
2380
|
+
const distanceCovered = useComputed2(() => {
|
|
2418
2381
|
const { x, y } = mouse.value;
|
|
2382
|
+
if (startMouse.value === null) return null;
|
|
2383
|
+
const { x: startX, y: startY } = startMouse.value;
|
|
2419
2384
|
return {
|
|
2420
|
-
x: x -
|
|
2421
|
-
y: y -
|
|
2385
|
+
x: x - startX,
|
|
2386
|
+
y: y - startY
|
|
2422
2387
|
};
|
|
2423
|
-
}
|
|
2388
|
+
});
|
|
2424
2389
|
useEventListener(
|
|
2425
2390
|
"dragstart",
|
|
2426
2391
|
(e) => {
|
|
@@ -2437,7 +2402,7 @@ var useAnchorPos = /* @__PURE__ */ __name(() => {
|
|
|
2437
2402
|
clearTimeout(timeoutRef.current);
|
|
2438
2403
|
timeoutRef.current = null;
|
|
2439
2404
|
}
|
|
2440
|
-
if (startMouse.
|
|
2405
|
+
if (startMouse.peek()) {
|
|
2441
2406
|
startMouse.value = null;
|
|
2442
2407
|
localStorage.setItem(
|
|
2443
2408
|
LOCAL_KEY,
|
|
@@ -2491,9 +2456,9 @@ var useAnchorPos = /* @__PURE__ */ __name(() => {
|
|
|
2491
2456
|
};
|
|
2492
2457
|
}
|
|
2493
2458
|
}, []);
|
|
2494
|
-
|
|
2495
|
-
if (
|
|
2496
|
-
const { x, y } =
|
|
2459
|
+
useWatch2([distanceCovered, mouse], (dist, mouse2) => {
|
|
2460
|
+
if (dist === null || !viewPortRef.current) return;
|
|
2461
|
+
const { x, y } = mouse2;
|
|
2497
2462
|
const viewportWidth = viewPortRef.current.offsetWidth;
|
|
2498
2463
|
const isInBottomSeg = y >= window.innerHeight - 100;
|
|
2499
2464
|
const isInTopSeg = y <= 100;
|
|
@@ -2505,10 +2470,7 @@ var useAnchorPos = /* @__PURE__ */ __name(() => {
|
|
|
2505
2470
|
snapSide.value = isInTopSeg ? "top" : "bottom";
|
|
2506
2471
|
}
|
|
2507
2472
|
if (snapSide.value === "right") {
|
|
2508
|
-
const min2 = Math.min(
|
|
2509
|
-
-PADDING,
|
|
2510
|
-
lastDroppedCoord.value.y + distanceCovered.y
|
|
2511
|
-
);
|
|
2473
|
+
const min2 = Math.min(-PADDING, lastDroppedCoord.value.y + dist.y);
|
|
2512
2474
|
anchorCoords.value = {
|
|
2513
2475
|
x: -PADDING,
|
|
2514
2476
|
y: Math.max(
|
|
@@ -2518,7 +2480,7 @@ var useAnchorPos = /* @__PURE__ */ __name(() => {
|
|
|
2518
2480
|
};
|
|
2519
2481
|
return;
|
|
2520
2482
|
} else if (snapSide.value === "left") {
|
|
2521
|
-
const min2 = Math.min(0, lastDroppedCoord.value.y +
|
|
2483
|
+
const min2 = Math.min(0, lastDroppedCoord.value.y + dist.y);
|
|
2522
2484
|
anchorCoords.value = {
|
|
2523
2485
|
x: (viewportWidth - elementBound.width.value) * -1 + PADDING,
|
|
2524
2486
|
y: Math.max(
|
|
@@ -2528,10 +2490,7 @@ var useAnchorPos = /* @__PURE__ */ __name(() => {
|
|
|
2528
2490
|
};
|
|
2529
2491
|
return;
|
|
2530
2492
|
} else if (snapSide.value === "top") {
|
|
2531
|
-
const min2 = Math.min(
|
|
2532
|
-
-PADDING,
|
|
2533
|
-
lastDroppedCoord.value.x + distanceCovered.x
|
|
2534
|
-
);
|
|
2493
|
+
const min2 = Math.min(-PADDING, lastDroppedCoord.value.x + dist.x);
|
|
2535
2494
|
anchorCoords.value = {
|
|
2536
2495
|
x: Math.max(
|
|
2537
2496
|
min2,
|
|
@@ -2541,7 +2500,7 @@ var useAnchorPos = /* @__PURE__ */ __name(() => {
|
|
|
2541
2500
|
};
|
|
2542
2501
|
return;
|
|
2543
2502
|
}
|
|
2544
|
-
const min = Math.min(-PADDING, lastDroppedCoord.value.x +
|
|
2503
|
+
const min = Math.min(-PADDING, lastDroppedCoord.value.x + dist.x);
|
|
2545
2504
|
anchorCoords.value = {
|
|
2546
2505
|
y: -PADDING,
|
|
2547
2506
|
x: Math.max(
|
|
@@ -2549,7 +2508,7 @@ var useAnchorPos = /* @__PURE__ */ __name(() => {
|
|
|
2549
2508
|
(viewportWidth - elementBound.width.value) * -1 + PADDING
|
|
2550
2509
|
)
|
|
2551
2510
|
};
|
|
2552
|
-
}
|
|
2511
|
+
});
|
|
2553
2512
|
const onResize = useCallback2(() => {
|
|
2554
2513
|
if (viewPortRef.current === null) return;
|
|
2555
2514
|
anchorCoords.value = reinitializeAnchorPos(
|
|
@@ -2832,19 +2791,13 @@ __name(useLerpedVec2, "useLerpedVec2");
|
|
|
2832
2791
|
function App() {
|
|
2833
2792
|
const toggled = useSignal6(false);
|
|
2834
2793
|
const handleOpen = useDevTools();
|
|
2835
|
-
const {
|
|
2836
|
-
anchorCoords,
|
|
2837
|
-
anchorRef,
|
|
2838
|
-
viewPortRef,
|
|
2839
|
-
startMouse,
|
|
2840
|
-
snapSide,
|
|
2841
|
-
updateAnchorPos
|
|
2842
|
-
} = useAnchorPos();
|
|
2794
|
+
const { anchorCoords, anchorRef, viewPortRef, startMouse, snapSide } = useAnchorPos();
|
|
2843
2795
|
const isHorizontalSnap = snapSide.value === "left" || snapSide.value === "right";
|
|
2844
2796
|
const isMounted = useRef3(false);
|
|
2845
2797
|
const smoothedCoords = useLerpedVec2(anchorCoords.value, {
|
|
2846
2798
|
damping: 0.4
|
|
2847
2799
|
});
|
|
2800
|
+
kiru6.useWatch([anchorCoords], smoothedCoords.set);
|
|
2848
2801
|
useLayoutEffect3(() => {
|
|
2849
2802
|
if (isMounted.current === false) {
|
|
2850
2803
|
smoothedCoords.set(anchorCoords.value, {
|
|
@@ -2853,9 +2806,6 @@ function App() {
|
|
|
2853
2806
|
}
|
|
2854
2807
|
isMounted.current = true;
|
|
2855
2808
|
}, []);
|
|
2856
|
-
useEffectDeep(() => {
|
|
2857
|
-
smoothedCoords.set(anchorCoords.value);
|
|
2858
|
-
}, [anchorCoords.value]);
|
|
2859
2809
|
return /* @__PURE__ */ kiru6.createElement(kiru6.Fragment, null, /* @__PURE__ */ kiru6.createElement(
|
|
2860
2810
|
"div",
|
|
2861
2811
|
{
|
|
@@ -2912,15 +2862,7 @@ function App() {
|
|
|
2912
2862
|
"button",
|
|
2913
2863
|
{
|
|
2914
2864
|
className: "bg-crimson rounded-full p-1" + (startMouse.value ? " pointer-events-none" : ""),
|
|
2915
|
-
onclick:
|
|
2916
|
-
toggled.value = !toggled.value;
|
|
2917
|
-
kiru6.flushSync();
|
|
2918
|
-
requestAnimationFrame(() => {
|
|
2919
|
-
requestAnimationFrame(() => {
|
|
2920
|
-
updateAnchorPos();
|
|
2921
|
-
});
|
|
2922
|
-
});
|
|
2923
|
-
},
|
|
2865
|
+
onclick: () => toggled.value = !toggled.value,
|
|
2924
2866
|
tabIndex: -1
|
|
2925
2867
|
},
|
|
2926
2868
|
/* @__PURE__ */ kiru6.createElement(Flame, null)
|
|
@@ -2929,7 +2871,7 @@ function App() {
|
|
|
2929
2871
|
}
|
|
2930
2872
|
__name(App, "App");
|
|
2931
2873
|
|
|
2932
|
-
//
|
|
2874
|
+
// _ekfsstq70:C:\\repos\\kiru\\packages\\devtools-host\\src\\style.css
|
|
2933
2875
|
var style_default = "*, ::before, ::after {\\n --tw-border-spacing-x: 0;\\n --tw-border-spacing-y: 0;\\n --tw-translate-x: 0;\\n --tw-translate-y: 0;\\n --tw-rotate: 0;\\n --tw-skew-x: 0;\\n --tw-skew-y: 0;\\n --tw-scale-x: 1;\\n --tw-scale-y: 1;\\n --tw-pan-x: ;\\n --tw-pan-y: ;\\n --tw-pinch-zoom: ;\\n --tw-scroll-snap-strictness: proximity;\\n --tw-gradient-from-position: ;\\n --tw-gradient-via-position: ;\\n --tw-gradient-to-position: ;\\n --tw-ordinal: ;\\n --tw-slashed-zero: ;\\n --tw-numeric-figure: ;\\n --tw-numeric-spacing: ;\\n --tw-numeric-fraction: ;\\n --tw-ring-inset: ;\\n --tw-ring-offset-width: 0px;\\n --tw-ring-offset-color: #fff;\\n --tw-ring-color: rgb(59 130 246 / 0.5);\\n --tw-ring-offset-shadow: 0 0 #0000;\\n --tw-ring-shadow: 0 0 #0000;\\n --tw-shadow: 0 0 #0000;\\n --tw-shadow-colored: 0 0 #0000;\\n --tw-blur: ;\\n --tw-brightness: ;\\n --tw-contrast: ;\\n --tw-grayscale: ;\\n --tw-hue-rotate: ;\\n --tw-invert: ;\\n --tw-saturate: ;\\n --tw-sepia: ;\\n --tw-drop-shadow: ;\\n --tw-backdrop-blur: ;\\n --tw-backdrop-brightness: ;\\n --tw-backdrop-contrast: ;\\n --tw-backdrop-grayscale: ;\\n --tw-backdrop-hue-rotate: ;\\n --tw-backdrop-invert: ;\\n --tw-backdrop-opacity: ;\\n --tw-backdrop-saturate: ;\\n --tw-backdrop-sepia: ;\\n --tw-contain-size: ;\\n --tw-contain-layout: ;\\n --tw-contain-paint: ;\\n --tw-contain-style: ;\\n}\\n\\n::backdrop {\\n --tw-border-spacing-x: 0;\\n --tw-border-spacing-y: 0;\\n --tw-translate-x: 0;\\n --tw-translate-y: 0;\\n --tw-rotate: 0;\\n --tw-skew-x: 0;\\n --tw-skew-y: 0;\\n --tw-scale-x: 1;\\n --tw-scale-y: 1;\\n --tw-pan-x: ;\\n --tw-pan-y: ;\\n --tw-pinch-zoom: ;\\n --tw-scroll-snap-strictness: proximity;\\n --tw-gradient-from-position: ;\\n --tw-gradient-via-position: ;\\n --tw-gradient-to-position: ;\\n --tw-ordinal: ;\\n --tw-slashed-zero: ;\\n --tw-numeric-figure: ;\\n --tw-numeric-spacing: ;\\n --tw-numeric-fraction: ;\\n --tw-ring-inset: ;\\n --tw-ring-offset-width: 0px;\\n --tw-ring-offset-color: #fff;\\n --tw-ring-color: rgb(59 130 246 / 0.5);\\n --tw-ring-offset-shadow: 0 0 #0000;\\n --tw-ring-shadow: 0 0 #0000;\\n --tw-shadow: 0 0 #0000;\\n --tw-shadow-colored: 0 0 #0000;\\n --tw-blur: ;\\n --tw-brightness: ;\\n --tw-contrast: ;\\n --tw-grayscale: ;\\n --tw-hue-rotate: ;\\n --tw-invert: ;\\n --tw-saturate: ;\\n --tw-sepia: ;\\n --tw-drop-shadow: ;\\n --tw-backdrop-blur: ;\\n --tw-backdrop-brightness: ;\\n --tw-backdrop-contrast: ;\\n --tw-backdrop-grayscale: ;\\n --tw-backdrop-hue-rotate: ;\\n --tw-backdrop-invert: ;\\n --tw-backdrop-opacity: ;\\n --tw-backdrop-saturate: ;\\n --tw-backdrop-sepia: ;\\n --tw-contain-size: ;\\n --tw-contain-layout: ;\\n --tw-contain-paint: ;\\n --tw-contain-style: ;\\n}/*\\n! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com\\n*//*\\n1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\\n2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)\\n*/\\n\\n*,\\n::before,\\n::after {\\n box-sizing: border-box; /* 1 */\\n border-width: 0; /* 2 */\\n border-style: solid; /* 2 */\\n border-color: #e5e7eb; /* 2 */\\n}\\n\\n::before,\\n::after {\\n --tw-content: '';\\n}\\n\\n/*\\n1. Use a consistent sensible line-height in all browsers.\\n2. Prevent adjustments of font size after orientation changes in iOS.\\n3. Use a more readable tab size.\\n4. Use the user's configured \`sans\` font-family by default.\\n5. Use the user's configured \`sans\` font-feature-settings by default.\\n6. Use the user's configured \`sans\` font-variation-settings by default.\\n7. Disable tap highlights on iOS\\n*/\\n\\nhtml,\\n:host {\\n line-height: 1.5; /* 1 */\\n -webkit-text-size-adjust: 100%; /* 2 */\\n -moz-tab-size: 4; /* 3 */\\n -o-tab-size: 4;\\n tab-size: 4; /* 3 */\\n font-family: ui-sans-serif, system-ui, sans-serif, \\"Apple Color Emoji\\", \\"Segoe UI Emoji\\", \\"Segoe UI Symbol\\", \\"Noto Color Emoji\\"; /* 4 */\\n font-feature-settings: normal; /* 5 */\\n font-variation-settings: normal; /* 6 */\\n -webkit-tap-highlight-color: transparent; /* 7 */\\n}\\n\\n/*\\n1. Remove the margin in all browsers.\\n2. Inherit line-height from \`html\` so users can set them as a class directly on the \`html\` element.\\n*/\\n\\nbody {\\n margin: 0; /* 1 */\\n line-height: inherit; /* 2 */\\n}\\n\\n/*\\n1. Add the correct height in Firefox.\\n2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\\n3. Ensure horizontal rules are visible by default.\\n*/\\n\\nhr {\\n height: 0; /* 1 */\\n color: inherit; /* 2 */\\n border-top-width: 1px; /* 3 */\\n}\\n\\n/*\\nAdd the correct text decoration in Chrome, Edge, and Safari.\\n*/\\n\\nabbr:where([title]) {\\n -webkit-text-decoration: underline dotted;\\n text-decoration: underline dotted;\\n}\\n\\n/*\\nRemove the default font size and weight for headings.\\n*/\\n\\nh1,\\nh2,\\nh3,\\nh4,\\nh5,\\nh6 {\\n font-size: inherit;\\n font-weight: inherit;\\n}\\n\\n/*\\nReset links to optimize for opt-in styling instead of opt-out.\\n*/\\n\\na {\\n color: inherit;\\n text-decoration: inherit;\\n}\\n\\n/*\\nAdd the correct font weight in Edge and Safari.\\n*/\\n\\nb,\\nstrong {\\n font-weight: bolder;\\n}\\n\\n/*\\n1. Use the user's configured \`mono\` font-family by default.\\n2. Use the user's configured \`mono\` font-feature-settings by default.\\n3. Use the user's configured \`mono\` font-variation-settings by default.\\n4. Correct the odd \`em\` font sizing in all browsers.\\n*/\\n\\ncode,\\nkbd,\\nsamp,\\npre {\\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \\"Liberation Mono\\", \\"Courier New\\", monospace; /* 1 */\\n font-feature-settings: normal; /* 2 */\\n font-variation-settings: normal; /* 3 */\\n font-size: 1em; /* 4 */\\n}\\n\\n/*\\nAdd the correct font size in all browsers.\\n*/\\n\\nsmall {\\n font-size: 80%;\\n}\\n\\n/*\\nPrevent \`sub\` and \`sup\` elements from affecting the line height in all browsers.\\n*/\\n\\nsub,\\nsup {\\n font-size: 75%;\\n line-height: 0;\\n position: relative;\\n vertical-align: baseline;\\n}\\n\\nsub {\\n bottom: -0.25em;\\n}\\n\\nsup {\\n top: -0.5em;\\n}\\n\\n/*\\n1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\\n2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\\n3. Remove gaps between table borders by default.\\n*/\\n\\ntable {\\n text-indent: 0; /* 1 */\\n border-color: inherit; /* 2 */\\n border-collapse: collapse; /* 3 */\\n}\\n\\n/*\\n1. Change the font styles in all browsers.\\n2. Remove the margin in Firefox and Safari.\\n3. Remove default padding in all browsers.\\n*/\\n\\nbutton,\\ninput,\\noptgroup,\\nselect,\\ntextarea {\\n font-family: inherit; /* 1 */\\n font-feature-settings: inherit; /* 1 */\\n font-variation-settings: inherit; /* 1 */\\n font-size: 100%; /* 1 */\\n font-weight: inherit; /* 1 */\\n line-height: inherit; /* 1 */\\n letter-spacing: inherit; /* 1 */\\n color: inherit; /* 1 */\\n margin: 0; /* 2 */\\n padding: 0; /* 3 */\\n}\\n\\n/*\\nRemove the inheritance of text transform in Edge and Firefox.\\n*/\\n\\nbutton,\\nselect {\\n text-transform: none;\\n}\\n\\n/*\\n1. Correct the inability to style clickable types in iOS and Safari.\\n2. Remove default button styles.\\n*/\\n\\nbutton,\\ninput:where([type='button']),\\ninput:where([type='reset']),\\ninput:where([type='submit']) {\\n -webkit-appearance: button; /* 1 */\\n background-color: transparent; /* 2 */\\n background-image: none; /* 2 */\\n}\\n\\n/*\\nUse the modern Firefox focus style for all focusable elements.\\n*/\\n\\n:-moz-focusring {\\n outline: auto;\\n}\\n\\n/*\\nRemove the additional \`:invalid\` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)\\n*/\\n\\n:-moz-ui-invalid {\\n box-shadow: none;\\n}\\n\\n/*\\nAdd the correct vertical alignment in Chrome and Firefox.\\n*/\\n\\nprogress {\\n vertical-align: baseline;\\n}\\n\\n/*\\nCorrect the cursor style of increment and decrement buttons in Safari.\\n*/\\n\\n::-webkit-inner-spin-button,\\n::-webkit-outer-spin-button {\\n height: auto;\\n}\\n\\n/*\\n1. Correct the odd appearance in Chrome and Safari.\\n2. Correct the outline style in Safari.\\n*/\\n\\n[type='search'] {\\n -webkit-appearance: textfield; /* 1 */\\n outline-offset: -2px; /* 2 */\\n}\\n\\n/*\\nRemove the inner padding in Chrome and Safari on macOS.\\n*/\\n\\n::-webkit-search-decoration {\\n -webkit-appearance: none;\\n}\\n\\n/*\\n1. Correct the inability to style clickable types in iOS and Safari.\\n2. Change font properties to \`inherit\` in Safari.\\n*/\\n\\n::-webkit-file-upload-button {\\n -webkit-appearance: button; /* 1 */\\n font: inherit; /* 2 */\\n}\\n\\n/*\\nAdd the correct display in Chrome and Safari.\\n*/\\n\\nsummary {\\n display: list-item;\\n}\\n\\n/*\\nRemoves the default spacing and border for appropriate elements.\\n*/\\n\\nblockquote,\\ndl,\\ndd,\\nh1,\\nh2,\\nh3,\\nh4,\\nh5,\\nh6,\\nhr,\\nfigure,\\np,\\npre {\\n margin: 0;\\n}\\n\\nfieldset {\\n margin: 0;\\n padding: 0;\\n}\\n\\nlegend {\\n padding: 0;\\n}\\n\\nol,\\nul,\\nmenu {\\n list-style: none;\\n margin: 0;\\n padding: 0;\\n}\\n\\n/*\\nReset default styling for dialogs.\\n*/\\ndialog {\\n padding: 0;\\n}\\n\\n/*\\nPrevent resizing textareas horizontally by default.\\n*/\\n\\ntextarea {\\n resize: vertical;\\n}\\n\\n/*\\n1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\\n2. Set the default placeholder color to the user's configured gray 400 color.\\n*/\\n\\ninput::-moz-placeholder, textarea::-moz-placeholder {\\n opacity: 1; /* 1 */\\n color: #9ca3af; /* 2 */\\n}\\n\\ninput::placeholder,\\ntextarea::placeholder {\\n opacity: 1; /* 1 */\\n color: #9ca3af; /* 2 */\\n}\\n\\n/*\\nSet the default cursor for buttons.\\n*/\\n\\nbutton,\\n[role=\\"button\\"] {\\n cursor: pointer;\\n}\\n\\n/*\\nMake sure disabled buttons don't get the pointer cursor.\\n*/\\n:disabled {\\n cursor: default;\\n}\\n\\n/*\\n1. Make replaced elements \`display: block\` by default. (https://github.com/mozdevs/cssremedy/issues/14)\\n2. Add \`vertical-align: middle\` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)\\n This can trigger a poorly considered lint error in some tools but is included by design.\\n*/\\n\\nimg,\\nsvg,\\nvideo,\\ncanvas,\\naudio,\\niframe,\\nembed,\\nobject {\\n display: block; /* 1 */\\n vertical-align: middle; /* 2 */\\n}\\n\\n/*\\nConstrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)\\n*/\\n\\nimg,\\nvideo {\\n max-width: 100%;\\n height: auto;\\n}\\n\\n/* Make elements with the HTML hidden attribute stay hidden by default */\\n[hidden]:where(:not([hidden=\\"until-found\\"])) {\\n display: none;\\n}\\n.pointer-events-none {\\n pointer-events: none;\\n}\\n.fixed {\\n position: fixed;\\n}\\n.sticky {\\n position: sticky;\\n}\\n.bottom-0 {\\n bottom: 0px;\\n}\\n.left-0 {\\n left: 0px;\\n}\\n.right-0 {\\n right: 0px;\\n}\\n.top-0 {\\n top: 0px;\\n}\\n.z-10 {\\n z-index: 10;\\n}\\n.z-\\\\[-9999\\\\] {\\n z-index: -9999;\\n}\\n.z-\\\\[9999999\\\\] {\\n z-index: 9999999;\\n}\\n.mb-2 {\\n margin-bottom: 0.5rem;\\n}\\n.inline {\\n display: inline;\\n}\\n.flex {\\n display: flex;\\n}\\n.grid {\\n display: grid;\\n}\\n.contents {\\n display: contents;\\n}\\n.h-0 {\\n height: 0px;\\n}\\n.h-5 {\\n height: 1.25rem;\\n}\\n.w-5 {\\n width: 1.25rem;\\n}\\n.w-full {\\n width: 100%;\\n}\\n.flex-grow {\\n flex-grow: 1;\\n}\\n.rotate-90 {\\n --tw-rotate: 90deg;\\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\\n}\\n.transform {\\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\\n}\\n.cursor-default {\\n cursor: default;\\n}\\n.cursor-pointer {\\n cursor: pointer;\\n}\\n.resize {\\n resize: both;\\n}\\n.flex-col {\\n flex-direction: column;\\n}\\n.place-content-center {\\n place-content: center;\\n}\\n.items-start {\\n align-items: flex-start;\\n}\\n.items-center {\\n align-items: center;\\n}\\n.justify-between {\\n justify-content: space-between;\\n}\\n.gap-1 {\\n gap: 0.25rem;\\n}\\n.gap-2 {\\n gap: 0.5rem;\\n}\\n.overflow-hidden {\\n overflow: hidden;\\n}\\n.overflow-scroll {\\n overflow: scroll;\\n}\\n.truncate {\\n overflow: hidden;\\n text-overflow: ellipsis;\\n white-space: nowrap;\\n}\\n.rounded {\\n border-radius: 0.25rem;\\n}\\n.rounded-3xl {\\n border-radius: 1.5rem;\\n}\\n.rounded-full {\\n border-radius: 9999px;\\n}\\n.border {\\n border-width: 1px;\\n}\\n.border-b {\\n border-bottom-width: 1px;\\n}\\n.border-b-2 {\\n border-bottom-width: 2px;\\n}\\n.border-\\\\[\\\\#fff1\\\\] {\\n border-color: #fff1;\\n}\\n.border-neutral-700 {\\n --tw-border-opacity: 1;\\n border-color: rgb(64 64 64 / var(--tw-border-opacity, 1));\\n}\\n.border-neutral-800 {\\n --tw-border-opacity: 1;\\n border-color: rgb(38 38 38 / var(--tw-border-opacity, 1));\\n}\\n.border-white {\\n --tw-border-opacity: 1;\\n border-color: rgb(255 255 255 / var(--tw-border-opacity, 1));\\n}\\n.border-opacity-10 {\\n --tw-border-opacity: 0.1;\\n}\\n.bg-\\\\[\\\\#0003\\\\] {\\n background-color: #0003;\\n}\\n.bg-\\\\[\\\\#1d1d1d\\\\] {\\n --tw-bg-opacity: 1;\\n background-color: rgb(29 29 29 / var(--tw-bg-opacity, 1));\\n}\\n.bg-\\\\[\\\\#212121\\\\] {\\n --tw-bg-opacity: 1;\\n background-color: rgb(33 33 33 / var(--tw-bg-opacity, 1));\\n}\\n.bg-\\\\[\\\\#ffffff04\\\\] {\\n background-color: #ffffff04;\\n}\\n.bg-\\\\[crimson\\\\]\\\\/80 {\\n background-color: rgb(220 20 60 / 0.8);\\n}\\n.bg-crimson {\\n --tw-bg-opacity: 1;\\n background-color: rgb(220 20 60 / var(--tw-bg-opacity, 1));\\n}\\n.bg-neutral-400 {\\n --tw-bg-opacity: 1;\\n background-color: rgb(163 163 163 / var(--tw-bg-opacity, 1));\\n}\\n.bg-opacity-5 {\\n --tw-bg-opacity: 0.05;\\n}\\n.p-1 {\\n padding: 0.25rem;\\n}\\n.p-2 {\\n padding: 0.5rem;\\n}\\n.px-2 {\\n padding-left: 0.5rem;\\n padding-right: 0.5rem;\\n}\\n.py-1 {\\n padding-top: 0.25rem;\\n padding-bottom: 0.25rem;\\n}\\n.pb-2 {\\n padding-bottom: 0.5rem;\\n}\\n.pl-2 {\\n padding-left: 0.5rem;\\n}\\n.pl-6 {\\n padding-left: 1.5rem;\\n}\\n.pr-1 {\\n padding-right: 0.25rem;\\n}\\n.text-\\\\[10px\\\\] {\\n font-size: 10px;\\n}\\n.text-sm {\\n font-size: 0.875rem;\\n line-height: 1.25rem;\\n}\\n.text-xs {\\n font-size: 0.75rem;\\n line-height: 1rem;\\n}\\n.font-bold {\\n font-weight: 700;\\n}\\n.font-medium {\\n font-weight: 500;\\n}\\n.text-neutral-300 {\\n --tw-text-opacity: 1;\\n color: rgb(212 212 212 / var(--tw-text-opacity, 1));\\n}\\n.text-white {\\n --tw-text-opacity: 1;\\n color: rgb(255 255 255 / var(--tw-text-opacity, 1));\\n}\\n.accent-red-500 {\\n accent-color: #ef4444;\\n}\\n.opacity-50 {\\n opacity: 0.5;\\n}\\n.shadow {\\n --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);\\n --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);\\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\\n}\\n.filter {\\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\\n}\\n.transition {\\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;\\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;\\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;\\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\\n transition-duration: 150ms;\\n}\\n.transition-opacity {\\n transition-property: opacity;\\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\\n transition-duration: 150ms;\\n}\\n.will-change-transform {\\n will-change: transform;\\n}\\n.last\\\\:border-b-0:last-child {\\n border-bottom-width: 0px;\\n}\\n.hover\\\\:bg-\\\\[\\\\#0003\\\\]:hover {\\n background-color: #0003;\\n}\\n.hover\\\\:bg-neutral-700:hover {\\n --tw-bg-opacity: 1;\\n background-color: rgb(64 64 64 / var(--tw-bg-opacity, 1));\\n}\\n.hover\\\\:opacity-100:hover {\\n opacity: 1;\\n}\\n.focus\\\\:outline:focus {\\n outline-style: solid;\\n}\\n";
|
|
2934
2876
|
|
|
2935
2877
|
// src/index.ts
|
|
@@ -2946,8 +2888,7 @@ if ("window" in globalThis) {
|
|
|
2946
2888
|
className: "fixed flex bottom-0 right-0 z-[9999999]"
|
|
2947
2889
|
});
|
|
2948
2890
|
shadow.appendChild(appRoot);
|
|
2949
|
-
mount(App, {
|
|
2950
|
-
root: appRoot,
|
|
2891
|
+
mount(createElement7(App, {}), appRoot, {
|
|
2951
2892
|
name: "kiru.devtools"
|
|
2952
2893
|
});
|
|
2953
2894
|
const handleMainWindowClose = /* @__PURE__ */ __name(() => popup.value?.close(), "handleMainWindowClose");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-kiru",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"author": "",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"peerDependencies": {
|
|
12
|
-
"kiru": ">=0.
|
|
12
|
+
"kiru": ">=0.47.0"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@types/node": "^22.17.0",
|