@visulima/dev-toolbar 0.0.1 → 1.0.0-alpha.1

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.
Files changed (95) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/LICENSE.md +77 -0
  3. package/README.md +277 -29
  4. package/dist/apps/a11y/a11y-app.d.ts +5 -0
  5. package/dist/apps/a11y/a11y-store.d.ts +46 -0
  6. package/dist/apps/a11y/a11y-tooltip.d.ts +11 -0
  7. package/dist/apps/a11y/index.d.ts +3 -0
  8. package/dist/apps/a11y/index.js +21 -0
  9. package/dist/apps/module-graph/index.d.ts +3 -0
  10. package/dist/apps/module-graph/index.js +20 -0
  11. package/dist/apps/module-graph/module-graph-app.d.ts +5 -0
  12. package/dist/apps/more/index.d.ts +3 -0
  13. package/dist/apps/more/index.js +19 -0
  14. package/dist/apps/more/more-app.d.ts +5 -0
  15. package/dist/apps/performance/index.d.ts +3 -0
  16. package/dist/apps/performance/index.js +17 -0
  17. package/dist/apps/performance/performance-app.d.ts +5 -0
  18. package/dist/apps/performance/performance-tooltip.d.ts +5 -0
  19. package/dist/apps/seo/index.d.ts +3 -0
  20. package/dist/apps/seo/index.js +17 -0
  21. package/dist/apps/seo/seo-app.d.ts +5 -0
  22. package/dist/apps/settings/index.d.ts +3 -0
  23. package/dist/apps/settings/index.js +17 -0
  24. package/dist/apps/settings/settings-app.d.ts +5 -0
  25. package/dist/apps/timeline/index.d.ts +3 -0
  26. package/dist/apps/timeline/index.js +18 -0
  27. package/dist/apps/timeline/timeline-app.d.ts +5 -0
  28. package/dist/apps/vite-config/index.d.ts +3 -0
  29. package/dist/apps/vite-config/index.js +16 -0
  30. package/dist/apps/vite-config/vite-config-app.d.ts +5 -0
  31. package/dist/client/overlay.d.ts +1 -0
  32. package/dist/client/overlay.js +1 -0
  33. package/dist/hooks/create-hook.d.ts +10 -0
  34. package/dist/hooks/events.d.ts +5 -0
  35. package/dist/hooks/global-hook.d.ts +15 -0
  36. package/dist/hooks/index.d.ts +6 -0
  37. package/dist/index.d.ts +6 -0
  38. package/dist/index.js +1 -0
  39. package/dist/packem_shared/TimelineStore-BgBrirKd.js +1 -0
  40. package/dist/packem_shared/cn-BEsR6GkP.js +1 -0
  41. package/dist/packem_shared/createClientRPCContext-DzKQpKTk.js +1 -0
  42. package/dist/packem_shared/createDevToolbarHook-DGNxqk8N.js +1 -0
  43. package/dist/packem_shared/createServerRPCContext-BVSesPXu.js +1 -0
  44. package/dist/packem_shared/icon-BUQ92HaT.js +1 -0
  45. package/dist/packem_shared/loadSettings-hvjR4fcS.js +1 -0
  46. package/dist/packem_shared/setupGlobalHook-CFuxsCyl.js +1 -0
  47. package/dist/packem_shared/store-BxE0w51s.js +1 -0
  48. package/dist/performance/monitor.d.ts +115 -0
  49. package/dist/rpc/client.d.ts +7 -0
  50. package/dist/rpc/functions/module-graph.d.ts +17 -0
  51. package/dist/rpc/functions/open-in-editor.d.ts +9 -0
  52. package/dist/rpc/functions/vite-config.d.ts +7 -0
  53. package/dist/rpc/index.d.ts +8 -0
  54. package/dist/rpc/server.d.ts +9 -0
  55. package/dist/timeline/index.d.ts +6 -0
  56. package/dist/timeline/store.d.ts +52 -0
  57. package/dist/toolbar/app-manager.d.ts +95 -0
  58. package/dist/toolbar/components/app-button.d.ts +19 -0
  59. package/dist/toolbar/components/app-canvas.d.ts +13 -0
  60. package/dist/toolbar/components/app-tooltip-overlay.d.ts +13 -0
  61. package/dist/toolbar/components/first-visit-hint.d.ts +16 -0
  62. package/dist/toolbar/components/index.d.ts +4 -0
  63. package/dist/toolbar/components/pinned-tooltip-card.d.ts +23 -0
  64. package/dist/toolbar/components/toolbar-bar.d.ts +15 -0
  65. package/dist/toolbar/components/toolbar-container.d.ts +55 -0
  66. package/dist/toolbar/components/vite-overlay-button.d.ts +15 -0
  67. package/dist/toolbar/context/index.d.ts +2 -0
  68. package/dist/toolbar/context/toolbar-context.d.ts +106 -0
  69. package/dist/toolbar/global-api.d.ts +23 -0
  70. package/dist/toolbar/helpers.d.ts +6 -0
  71. package/dist/toolbar/hooks/index.d.ts +10 -0
  72. package/dist/toolbar/hooks/use-apps.d.ts +13 -0
  73. package/dist/toolbar/hooks/use-frame-state.d.ts +94 -0
  74. package/dist/toolbar/hooks/use-panel-visible.d.ts +21 -0
  75. package/dist/toolbar/hooks/use-position.d.ts +22 -0
  76. package/dist/toolbar/hooks/use-theme.d.ts +13 -0
  77. package/dist/toolbar/hooks/use-toolbar.d.ts +14 -0
  78. package/dist/toolbar/index.d.ts +58 -0
  79. package/dist/toolbar/index.js +22 -0
  80. package/dist/toolbar/settings.d.ts +17 -0
  81. package/dist/toolbar/stylesheet.d.ts +1 -0
  82. package/dist/toolbar/utils/index.d.ts +12 -0
  83. package/dist/types/app.d.ts +163 -0
  84. package/dist/types/global-api.d.ts +95 -0
  85. package/dist/types/hooks.d.ts +88 -0
  86. package/dist/types/index.d.ts +12 -0
  87. package/dist/types/messaging.d.ts +43 -0
  88. package/dist/types/rpc.d.ts +95 -0
  89. package/dist/types/timeline.d.ts +62 -0
  90. package/dist/types/toolbar.d.ts +56 -0
  91. package/dist/ui/components/icon.d.ts +21 -0
  92. package/dist/utils/cn.d.ts +8 -0
  93. package/dist/vite-plugin.d.ts +106 -0
  94. package/dist/vite-plugin.js +2 -0
  95. package/package.json +105 -7
@@ -0,0 +1,17 @@
1
+ var $=Object.defineProperty;var f=(t,e)=>$(t,"name",{value:e,configurable:!0});import{addHookName as y}from"preact/devtools";import{useState as C,useRef as M,useEffect as H}from"preact/hooks";import{m as d}from"../../packem_shared/cn-BEsR6GkP.js";import{jsx as r,jsxs as i}from"preact/jsx-runtime";const L=`<!-- @license lucide-static v0.575.0 - ISC -->
2
+ <svg
3
+ class="lucide lucide-gauge"
4
+ xmlns="http://www.w3.org/2000/svg"
5
+ width="24"
6
+ height="24"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ stroke-width="2"
11
+ stroke-linecap="round"
12
+ stroke-linejoin="round"
13
+ >
14
+ <path d="m12 14 4-4" />
15
+ <path d="M3.34 19a10 10 0 1 1 17.32 0" />
16
+ </svg>
17
+ `;var j=Object.defineProperty,b=f((t,e)=>j(t,"name",{value:e,configurable:!0}),"s$1");const I={cls:{good:.1,poor:.25},fcp:{good:1800,poor:3e3},fid:{good:100,poor:300},lcp:{good:2500,poor:4e3},ttfb:{good:800,poor:1800}},x=b((t,e)=>{const{good:s,poor:n}=I[t];return e<=s?"good":e<=n?"needs-improvement":"poor"},"getCwvRating");class z{static{f(this,"PerformanceMonitor")}static{b(this,"PerformanceMonitor")}clsValue=0;fpsSamples=[];listeners=new Set;longTaskIdCounter=0;longTasks=[];memory=null;memoryInterval=null;observers=[];rafId=null;running=!1;vitals={cls:null,fcp:null,fid:null,lcp:null,ttfb:null};clearLongTasks(){this.longTasks=[],this.emit()}getSnapshot(){return{fps:this.currentFps(),longTasks:[...this.longTasks],memory:this.memory,vitals:{...this.vitals}}}start(){this.running||typeof window>"u"||(this.running=!0,this.startFps(),this.startMemory(),this.startCwv(),this.startLongTasks(),this.loadTtfb())}stop(){if(this.running){this.running=!1,this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.memoryInterval!==null&&(clearInterval(this.memoryInterval),this.memoryInterval=null);for(const e of this.observers)e.disconnect();this.observers=[]}}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}currentFps(){if(this.fpsSamples.length<2)return 0;const e=this.fpsSamples.slice(-Math.min(this.fpsSamples.length,10));if(e.length<2)return 0;let s=0,n=0;for(let l=1;l<e.length;l++){const a=e[l]-e[l-1];a>0&&a<500&&(s+=a,n++)}return n===0?0:Math.min(60,Math.round(1e3/(s/n)))}emit(){const e=this.getSnapshot();for(const s of this.listeners)s(e)}loadTtfb(){const e=performance.getEntriesByType("navigation");e.length>0&&e[0]&&(this.vitals.ttfb=Math.round(e[0].responseStart-e[0].requestStart),this.emit())}startCwv(){this.tryObserve("largest-contentful-paint",e=>{const s=e.getEntries().at(-1);s&&(this.vitals.lcp=Math.round(s.startTime),this.emit())}),this.tryObserve("layout-shift",e=>{for(const s of e.getEntries()){const n=s;n.hadRecentInput||(this.clsValue+=n.value,this.vitals.cls=Math.round(this.clsValue*1e3)/1e3)}this.emit()}),this.tryObserve("first-input",e=>{const s=e.getEntries()[0];s&&(this.vitals.fid=Math.round(s.processingStart-s.startTime),this.emit())}),this.tryObserve("paint",e=>{for(const s of e.getEntries())s.name==="first-contentful-paint"&&(this.vitals.fcp=Math.round(s.startTime),this.emit())})}startFps(){let e=null;const s=b(n=>{this.running&&(e!==null&&(this.fpsSamples.push(n),this.fpsSamples.length>60&&this.fpsSamples.shift(),this.fpsSamples.length%16===0&&this.emit()),e=n,this.rafId=requestAnimationFrame(s))},"tick");this.rafId=requestAnimationFrame(s)}startLongTasks(){this.tryObserve("longtask",e=>{for(const s of e.getEntries())this.longTaskIdCounter++,this.longTasks.push({duration:Math.round(s.duration),id:`lt-${this.longTaskIdCounter}`,startTime:Math.round(s.startTime)}),this.longTasks.length>100&&this.longTasks.shift();this.emit()})}startMemory(){const e=performance;if(!e.memory)return;const s=b(()=>{e.memory&&(this.memory={jsHeapSizeLimit:e.memory.jsHeapSizeLimit,totalJSHeapSize:e.memory.totalJSHeapSize,usedJSHeapSize:e.memory.usedJSHeapSize},this.emit())},"read");s(),this.memoryInterval=setInterval(s,1e3)}tryObserve(e,s){try{const n=new PerformanceObserver(s);n.observe({buffered:!0,type:e}),this.observers.push(n)}catch{}}}const p=new z;var P=Object.defineProperty,u=f((t,e)=>P(t,"name",{value:e,configurable:!0}),"s");const S=u(t=>t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`,"formatBytes"),B=u(t=>`${t} ms`,"formatMs"),k={good:"text-success-foreground","needs-improvement":"text-warning-foreground",poor:"text-destructive"},J={good:"bg-success/10 border-success/30","needs-improvement":"bg-warning/10 border-warning/30",poor:"bg-destructive/10 border-destructive/30"},O=u(({samples:t})=>{if(t.length<2)return r("svg",{height:36,width:120});const e=120/(t.length-1),s=t.map((n,l)=>{const a=l*e,o=36-n/60*36;return`${a.toFixed(1)},${o.toFixed(1)}`}).join(" ");return r("svg",{height:36,style:"overflow: visible",width:120,children:r("polyline",{fill:"none",points:s,stroke:"currentColor","stroke-linejoin":"round","stroke-width":"1.5"})})},"FpsSparkline"),R=u(({memory:t})=>{const e=t.usedJSHeapSize/t.jsHeapSizeLimit*100,s=t.totalJSHeapSize/t.jsHeapSizeLimit*100,n=e>80?"bg-destructive":e>50?"bg-warning":"bg-success";return i("div",{class:"space-y-1.5",children:[i("div",{class:"relative h-2 bg-foreground/8 rounded-full overflow-hidden",children:[r("div",{class:"absolute left-0 top-0 h-full bg-foreground/12 rounded-full",style:{width:`${s}%`}}),r("div",{class:d("absolute left-0 top-0 h-full rounded-full",n),style:{width:`${e}%`}})]}),i("div",{class:"flex justify-between text-[0.65rem] text-muted-foreground",children:[i("span",{children:["Used: ",r("span",{class:"text-foreground font-medium",children:S(t.usedJSHeapSize)})]}),i("span",{children:["Total: ",r("span",{class:"text-foreground font-medium",children:S(t.totalJSHeapSize)})]}),i("span",{children:["Limit: ",r("span",{class:"text-foreground font-medium",children:S(t.jsHeapSizeLimit)})]})]})]})},"MemoryBar"),E=u(({label:t,metric:e,unit:s,value:n})=>{if(n===null)return i("div",{class:"flex flex-col items-center gap-1 p-3 border border-border bg-foreground/2 min-w-0",children:[r("span",{class:"text-[0.6rem] text-muted-foreground uppercase tracking-wider font-semibold truncate w-full text-center",children:t}),r("span",{class:"text-[0.7rem] text-muted-foreground/50",children:"—"})]});const l=x(e,n),a=e==="cls"?n.toFixed(3):B(n);return i("div",{class:d("flex flex-col items-center gap-1 p-3 border min-w-0",J[l]),children:[r("span",{class:"text-[0.6rem] text-muted-foreground uppercase tracking-wider font-semibold truncate w-full text-center",children:t}),r("span",{class:d("text-[0.9rem] font-bold tabular-nums",k[l]),children:a}),r("span",{class:"text-[0.6rem] text-muted-foreground/70 uppercase tracking-wide",children:s})]})},"CwvCard"),V=u(({task:t})=>i("div",{class:"flex items-center gap-3 px-3 py-2 border-b border-border/50 last:border-0 text-[0.7rem]",children:[i("span",{class:"text-muted-foreground tabular-nums w-20 shrink-0",children:[t.startTime.toLocaleString()," ms"]}),r("div",{class:"flex-1 bg-foreground/6 rounded-sm overflow-hidden h-2",children:r("div",{class:"h-full bg-warning",style:{width:`${Math.min(100,t.duration/200*100)}%`},title:`${t.duration} ms`})}),i("span",{class:"text-warning-foreground font-semibold tabular-nums w-16 text-right shrink-0",children:[t.duration," ms"]})]}),"LongTaskRow"),g=u(({children:t,title:e,action:s})=>i("section",{class:"border border-border",children:[i("div",{class:"flex items-center justify-between px-4 py-2.5 bg-foreground/3 border-b border-border",children:[r("span",{class:"text-[0.7rem] font-semibold text-foreground uppercase tracking-wide",children:e}),s]}),r("div",{class:"p-4",children:t})]}),"Section"),A=120,q=u(t=>{const[e,s]=y(C(()=>p.getSnapshot()),"snapshot"),n=y(M([]),"fpsHistoryRef");H(()=>(p.start(),p.subscribe(c=>{n.current.push(c.fps),n.current.length>A&&n.current.shift(),s(c)})),[]);const{fps:l,longTasks:a,memory:o,vitals:m}=e,h=l>=50?"good":l>=30?"needs-improvement":"poor",F=[{label:"LCP",metric:"lcp",unit:"ms",value:m.lcp},{label:"FID",metric:"fid",unit:"ms",value:m.fid},{label:"CLS",metric:"cls",unit:"score",value:m.cls},{label:"FCP",metric:"fcp",unit:"ms",value:m.fcp},{label:"TTFB",metric:"ttfb",unit:"ms",value:m.ttfb}];return i("div",{class:"p-5 space-y-4",children:[r(g,{title:"FPS",children:i("div",{class:"flex items-end gap-5",children:[i("div",{class:"flex flex-col items-center gap-0.5 shrink-0",children:[r("span",{class:d("text-3xl font-bold tabular-nums leading-none",k[h]),children:l}),r("span",{class:"text-[0.6rem] text-muted-foreground uppercase tracking-wide",children:"fps"})]}),r("div",{class:d("flex-1 min-w-0",k[h]),children:r(O,{samples:n.current})}),i("div",{class:"flex flex-col justify-between h-9 text-[0.6rem] text-muted-foreground/50 shrink-0 tabular-nums",children:[r("span",{children:"60"}),r("span",{children:"30"}),r("span",{children:"0"})]})]})}),o?r(g,{title:"JS Heap Memory",children:r(R,{memory:o})}):r(g,{title:"JS Heap Memory",children:i("p",{class:"text-[0.72rem] text-muted-foreground text-center py-2",children:["Not available — enable"," ",r("code",{class:"font-mono text-foreground/70",children:"--enable-precise-memory-info"})," in Chrome flags."]})}),i(g,{title:"Core Web Vitals",children:[r("div",{class:"grid grid-cols-3 gap-2",children:F.map(c=>r(E,{label:c.label,metric:c.metric,unit:c.unit,value:c.value},c.metric))}),r("p",{class:"mt-2 text-[0.62rem] text-muted-foreground/60",children:"Measured from page load. Reload to refresh. LCP and FID update as the page is interacted with."})]}),r(g,{action:a.length>0?r("button",{class:"px-2 py-0.5 text-[0.65rem] border border-border text-muted-foreground hover:text-foreground cursor-pointer bg-transparent transition-colors",onClick:u(()=>p.clearLongTasks(),"onClick"),type:"button",children:"Clear"}):void 0,title:`Long Tasks${a.length>0?` (${a.length})`:""}`,children:a.length===0?r("p",{class:"text-[0.72rem] text-muted-foreground text-center py-2",children:"No long tasks detected yet."}):r("div",{class:"max-h-48 overflow-y-auto devtools-content-scroll",children:a.map(c=>r(V,{task:c},c.id))})})]})},"PerformanceApp");var D=Object.defineProperty,w=f((t,e)=>D(t,"name",{value:e,configurable:!0}),"c");const T=w(t=>t<1024*1024?`${(t/1024).toFixed(0)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`,"formatBytes"),v={good:"text-success-foreground","needs-improvement":"text-warning-foreground",poor:"text-destructive"},N=w(({samples:t})=>{if(t.length<2)return r("svg",{height:24,width:60});const e=60/(t.length-1),s=t.map((n,l)=>`${(l*e).toFixed(1)},${(24-n/60*24).toFixed(1)}`).join(" ");return r("svg",{height:24,style:"overflow:visible",width:60,children:r("polyline",{fill:"none",points:s,stroke:"currentColor","stroke-linejoin":"round","stroke-width":"1.5"})})},"MiniSparkline"),K=w(({memory:t})=>{const e=t.usedJSHeapSize/t.jsHeapSizeLimit*100,s=e>80?"bg-destructive":e>50?"bg-warning":"bg-success";return i("div",{class:"flex items-center gap-2",children:[r("div",{class:"flex-1 h-1.5 bg-foreground/8 rounded-full overflow-hidden",children:r("div",{class:d("h-full rounded-full",s),style:{width:`${e}%`}})}),i("span",{class:"text-[0.65rem] tabular-nums text-muted-foreground shrink-0",children:[T(t.usedJSHeapSize)," / ",T(t.jsHeapSizeLimit)]})]})},"MiniMemoryBar"),W=60,U=w(t=>{const[e,s]=y(C(()=>p.getSnapshot()),"snapshot"),n=y(M([]),"fpsHistoryRef");H(()=>(p.start(),p.subscribe(h=>{n.current.push(h.fps),n.current.length>W&&n.current.shift(),s(h)})),[]);const{fps:l,memory:a,vitals:o}=e,m=l>=50?"good":l>=30?"needs-improvement":"poor";return i("div",{class:"space-y-3 min-w-[200px]",children:[i("div",{class:"flex items-end gap-3",children:[i("div",{class:"flex flex-col items-center gap-0 shrink-0",children:[r("span",{class:d("text-2xl font-bold tabular-nums leading-none",v[m]),children:l}),r("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide",children:"fps"})]}),r("div",{class:d("flex-1 min-w-0",v[m]),children:r(N,{samples:n.current})})]}),i("div",{class:"flex gap-3",children:[o.lcp!==null&&i("div",{class:"flex flex-col gap-0.5",children:[r("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide",children:"LCP"}),i("span",{class:d("text-[0.8rem] font-semibold tabular-nums",v[x("lcp",o.lcp)]),children:[o.lcp," ms"]})]}),o.fcp!==null&&i("div",{class:"flex flex-col gap-0.5",children:[r("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide",children:"FCP"}),i("span",{class:d("text-[0.8rem] font-semibold tabular-nums",v[x("fcp",o.fcp)]),children:[o.fcp," ms"]})]}),o.cls!==null&&i("div",{class:"flex flex-col gap-0.5",children:[r("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide",children:"CLS"}),r("span",{class:d("text-[0.8rem] font-semibold tabular-nums",v[x("cls",o.cls)]),children:o.cls.toFixed(3)})]}),o.lcp===null&&o.fcp===null&&o.cls===null&&r("span",{class:"text-[0.65rem] text-muted-foreground/50",children:"Collecting metrics…"})]}),a&&i("div",{children:[r("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide block mb-1",children:"Heap"}),r(K,{memory:a})]})]})},"PerformanceTooltip"),Z={component:q,icon:L,id:"dev-toolbar:performance",name:"Performance",tooltip:U};export{Z as default};
@@ -0,0 +1,5 @@
1
+ /** @jsxImportSource preact */
2
+ import type { ComponentChildren } from "preact";
3
+ import type { AppComponentProps } from "../../types/app.d.ts";
4
+ declare const PerformanceApp: (_props: AppComponentProps) => ComponentChildren;
5
+ export default PerformanceApp;
@@ -0,0 +1,5 @@
1
+ /** @jsxImportSource preact */
2
+ import type { ComponentChildren } from "preact";
3
+ import type { AppTooltipProps } from "../../types/app.d.ts";
4
+ declare const PerformanceTooltip: (_props: AppTooltipProps) => ComponentChildren;
5
+ export default PerformanceTooltip;
@@ -0,0 +1,3 @@
1
+ import type { DevToolbarApp } from "../../types/app.d.ts";
2
+ declare const seoApp: DevToolbarApp;
3
+ export default seoApp;
@@ -0,0 +1,17 @@
1
+ var y=Object.defineProperty;var u=(r,e)=>y(r,"name",{value:e,configurable:!0});import{addHookName as m}from"preact/devtools";import{useState as p,useEffect as f}from"preact/hooks";import{m as g}from"../../packem_shared/cn-BEsR6GkP.js";import{jsxs as a,jsx as t}from"preact/jsx-runtime";const v=`<!-- @license lucide-static v0.575.0 - ISC -->
2
+ <svg
3
+ class="lucide lucide-search"
4
+ xmlns="http://www.w3.org/2000/svg"
5
+ width="24"
6
+ height="24"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ stroke-width="2"
11
+ stroke-linecap="round"
12
+ stroke-linejoin="round"
13
+ >
14
+ <path d="m21 21-4.34-4.34" />
15
+ <circle cx="11" cy="11" r="8" />
16
+ </svg>
17
+ `;var w=Object.defineProperty,s=u((r,e)=>w(r,"name",{value:e,configurable:!0}),"a");const x=s(()=>{const r=s(n=>document.querySelector(`meta[name="${n}"]`)?.content??"","getMeta"),e=s(n=>document.querySelector(`meta[property="og:${n}"]`)?.content??"","getOg"),l=s(n=>document.querySelector(`meta[name="twitter:${n}"]`)?.content??document.querySelector(`meta[property="twitter:${n}"]`)?.content??"","getTwitter");return{title:document.title??"",description:r("description"),canonical:document.querySelector('link[rel="canonical"]')?.href??"",ogTitle:e("title"),ogDescription:e("description"),ogImage:e("image"),ogUrl:e("url"),ogType:e("type"),twitterCard:l("card"),twitterTitle:l("title"),twitterDescription:l("description"),twitterImage:l("image"),twitterSite:l("site")}},"readMetaTags"),h=[{id:"facebook",name:"Facebook",accentClass:"border-blue-500/30",titleKey:"ogTitle",descKey:"ogDescription",imageKey:"ogImage",urlKey:"ogUrl",requiredKeys:["ogTitle","ogDescription","ogImage"]},{id:"twitter",name:"X / Twitter",accentClass:"border-foreground/20",titleKey:"twitterTitle",descKey:"twitterDescription",imageKey:"twitterImage",urlKey:"ogUrl",requiredKeys:["twitterTitle","twitterDescription","twitterImage","twitterCard"]},{id:"linkedin",name:"LinkedIn",accentClass:"border-blue-600/30",titleKey:"ogTitle",descKey:"ogDescription",imageKey:"ogImage",urlKey:"ogUrl",requiredKeys:["ogTitle","ogDescription","ogImage"]},{id:"discord",name:"Discord",accentClass:"border-indigo-500/30",titleKey:"ogTitle",descKey:"ogDescription",imageKey:"ogImage",urlKey:"ogUrl",requiredKeys:["ogTitle","ogDescription"]},{id:"slack",name:"Slack",accentClass:"border-green-500/30",titleKey:"ogTitle",descKey:"ogDescription",imageKey:"ogImage",urlKey:"ogUrl",requiredKeys:["ogTitle","ogDescription"]},{id:"mastodon",name:"Mastodon",accentClass:"border-purple-500/30",titleKey:"ogTitle",descKey:"ogDescription",imageKey:"ogImage",urlKey:"ogUrl",requiredKeys:["ogTitle","ogDescription"]},{id:"bluesky",name:"Bluesky",accentClass:"border-sky-500/30",titleKey:"ogTitle",descKey:"ogDescription",imageKey:"ogImage",urlKey:"ogUrl",requiredKeys:["ogTitle","ogDescription"]}],K=s(({platform:r,meta:e})=>{const l=e[r.titleKey]||e.title||"No title",n=e[r.descKey]||e.description||"",c=e[r.imageKey]||"",d=e[r.urlKey]||e.canonical||"",i=r.requiredKeys.filter(b=>!e[b]);return a("div",{class:g("border bg-card overflow-hidden",r.accentClass),children:[a("div",{class:"flex items-center justify-between gap-2 px-3 py-2 border-b border-border/50 bg-foreground/2",children:[t("span",{class:"text-[0.65rem] font-bold uppercase tracking-wider text-muted-foreground",children:r.name}),i.length>0&&a("span",{class:"text-[0.6rem] px-1.5 py-0.5 bg-warning/10 text-warning border border-warning/20 font-medium",children:["Missing: ",i.join(", ")]})]}),a("div",{class:"p-3",children:[t("div",{class:"w-full aspect-[1200/630] bg-foreground/6 border border-border/50 mb-2.5 overflow-hidden relative",children:c?t("img",{alt:"OG image preview",class:"w-full h-full object-cover",loading:"lazy",src:c}):t("div",{class:"absolute inset-0 flex items-center justify-center",children:t("span",{class:"text-[0.65rem] text-muted-foreground/40 uppercase tracking-wider",children:"No image"})})}),d&&t("div",{class:"text-[0.6rem] text-muted-foreground/60 uppercase tracking-wider truncate mb-1",children:d}),t("div",{class:"text-[0.8rem] font-semibold text-foreground line-clamp-1",children:l}),n&&t("div",{class:"text-[0.7rem] text-muted-foreground line-clamp-2 mt-0.5",children:n})]})]})},"SocialPreview"),o=s(({label:r,value:e,required:l=!1})=>a("div",{class:"flex items-start gap-3 py-2 border-b border-border/30 last:border-0",children:[t("div",{class:"w-36 shrink-0",children:t("span",{class:"text-[0.7rem] font-mono text-muted-foreground",children:r})}),t("div",{class:"flex-1 min-w-0",children:e?t("span",{class:"text-[0.75rem] text-foreground break-all",children:e}):t("span",{class:g("text-[0.7rem]",l?"text-warning":"text-muted-foreground/40"),children:l?"⚠ Missing":"—"})})]}),"MetaRow"),T=s(r=>{const[e,l]=m(p(null),"meta"),[n,c]=m(p("preview"),"activeTab"),d=s(()=>{l(x())},"refresh");return f(()=>{d()},[]),e?a("div",{class:"flex flex-col h-full",children:[a("div",{class:"flex items-center justify-between gap-3 px-4 py-2.5 border-b border-border shrink-0",children:[t("div",{class:"flex items-center gap-0",children:["preview","tags"].map(i=>t("button",{class:g("px-3 py-1.5 text-[0.75rem] font-medium border-0 cursor-pointer transition-colors capitalize",n===i?"text-foreground border-b-2 border-primary bg-transparent":"text-muted-foreground bg-transparent hover:text-foreground"),onClick:s(()=>c(i),"onClick"),type:"button",children:i==="preview"?"Social Previews":"Meta Tags"},i))}),t("button",{class:"px-2.5 py-1 text-[0.725rem] border border-border text-muted-foreground hover:text-foreground cursor-pointer bg-transparent transition-colors",onClick:d,type:"button",children:"Refresh"})]}),t("div",{class:"flex-1 overflow-auto",children:n==="preview"?t("div",{class:"p-4 grid grid-cols-2 gap-4",children:h.map(i=>t(K,{meta:e,platform:i},i.id))}):t("div",{class:"p-5",children:t("div",{class:"border border-border bg-card divide-y divide-border/30",children:a("div",{class:"px-4",children:[t(o,{label:"title",value:e.title,required:!0}),t(o,{label:"description",value:e.description,required:!0}),t(o,{label:"canonical",value:e.canonical}),t(o,{label:"og:title",value:e.ogTitle,required:!0}),t(o,{label:"og:description",value:e.ogDescription,required:!0}),t(o,{label:"og:image",value:e.ogImage,required:!0}),t(o,{label:"og:url",value:e.ogUrl}),t(o,{label:"og:type",value:e.ogType}),t(o,{label:"twitter:card",value:e.twitterCard,required:!0}),t(o,{label:"twitter:title",value:e.twitterTitle}),t(o,{label:"twitter:description",value:e.twitterDescription}),t(o,{label:"twitter:image",value:e.twitterImage}),t(o,{label:"twitter:site",value:e.twitterSite})]})})})})]}):a("div",{class:"flex flex-col items-center justify-center h-full gap-3 p-8 select-none",children:[t("div",{class:"flex gap-1.5 items-center","aria-hidden":"true",children:[0,160,320].map(i=>t("span",{class:"size-1.5 bg-primary/50 rounded-full animate-pulse",style:{animationDelay:`${i}ms`}},i))}),t("span",{class:"text-[0.75rem] text-muted-foreground",children:"Reading meta tags…"})]})},"SeoApp"),S={component:T,icon:v,id:"dev-toolbar:seo",name:"SEO"};export{S as default};
@@ -0,0 +1,5 @@
1
+ /** @jsxImportSource preact */
2
+ import type { ComponentChildren } from "preact";
3
+ import type { AppComponentProps } from "../../types/app.d.ts";
4
+ declare const SeoApp: (_props: AppComponentProps) => ComponentChildren;
5
+ export default SeoApp;
@@ -0,0 +1,3 @@
1
+ import type { DevToolbarApp } from "../../types/app.d.ts";
2
+ declare const settingsApp: DevToolbarApp;
3
+ export default settingsApp;
@@ -0,0 +1,17 @@
1
+ var C=Object.defineProperty;var v=(t,n)=>C(t,"name",{value:n,configurable:!0});import{addHookName as f}from"preact/devtools";import{useState as D,useRef as k,useEffect as y}from"preact/hooks";import{i as m,u as w,a as F,D as c}from"../../packem_shared/icon-BUQ92HaT.js";import{m as g}from"../../packem_shared/cn-BEsR6GkP.js";import{jsxs as l,jsx as e}from"preact/jsx-runtime";const E=`<!-- @license lucide-static v0.575.0 - ISC -->
2
+ <svg
3
+ class="lucide lucide-settings"
4
+ xmlns="http://www.w3.org/2000/svg"
5
+ width="24"
6
+ height="24"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ stroke-width="2"
11
+ stroke-linecap="round"
12
+ stroke-linejoin="round"
13
+ >
14
+ <path d="M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915" />
15
+ <circle cx="12" cy="12" r="3" />
16
+ </svg>
17
+ `,S="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-monitor%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Crect%20width%3D%2220%22%20height%3D%2214%22%20x%3D%222%22%20y%3D%223%22%20rx%3D%222%22%20%2F%3E%20%3Cline%20x1%3D%228%22%20x2%3D%2216%22%20y1%3D%2221%22%20y2%3D%2221%22%20%2F%3E%20%3Cline%20x1%3D%2212%22%20x2%3D%2212%22%20y1%3D%2217%22%20y2%3D%2221%22%20%2F%3E%20%3C%2Fsvg%3E",T="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-moon%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M20.985%2012.486a9%209%200%201%201-9.473-9.472c.405-.022.617.46.402.803a6%206%200%200%200%208.268%208.268c.344-.215.825-.004.803.401%22%20%2F%3E%20%3C%2Fsvg%3E",A="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-sun%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%224%22%20%2F%3E%20%3Cpath%20d%3D%22M12%202v2%22%20%2F%3E%20%3Cpath%20d%3D%22M12%2020v2%22%20%2F%3E%20%3Cpath%20d%3D%22m4.93%204.93%201.41%201.41%22%20%2F%3E%20%3Cpath%20d%3D%22m17.66%2017.66%201.41%201.41%22%20%2F%3E%20%3Cpath%20d%3D%22M2%2012h2%22%20%2F%3E%20%3Cpath%20d%3D%22M20%2012h2%22%20%2F%3E%20%3Cpath%20d%3D%22m6.34%2017.66-1.41%201.41%22%20%2F%3E%20%3Cpath%20d%3D%22m19.07%204.93-1.41%201.41%22%20%2F%3E%20%3C%2Fsvg%3E";var K=Object.defineProperty,r=v((t,n)=>K(t,"name",{value:n,configurable:!0}),"o");const d=r(({label:t,description:n,control:o})=>l("div",{class:"flex items-center justify-between gap-6 py-3.5",children:[l("div",{class:"min-w-0",children:[e("div",{class:"text-[0.8125rem] font-medium text-foreground leading-none mb-0.5",children:t}),n&&e("div",{class:"text-[0.725rem] text-muted-foreground leading-snug mt-1",children:n})]}),e("div",{class:"shrink-0",children:o})]}),"SettingRow"),h=r(({title:t,children:n})=>l("section",{children:[l("h3",{class:"text-[0.65rem] font-bold uppercase tracking-[0.1em] text-muted-foreground mb-2 px-1 flex items-center gap-1.5",children:[e("span",{"aria-hidden":"true",class:"text-primary/50",children:"//"}),t]}),e("div",{class:"rounded-none border border-border bg-card divide-y divide-border overflow-hidden border-l-2 border-l-primary/20",children:e("div",{class:"px-4",children:n})})]}),"Section"),b=r(({checked:t,onChange:n})=>e("button",{"aria-checked":t,class:g("relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-none border-2 border-transparent","transition-colors duration-200 ease-in-out","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t?"bg-primary":"bg-foreground/15"),onClick:r(()=>n(!t),"onClick"),role:"switch",type:"button",children:e("span",{class:g("pointer-events-none inline-block h-4 w-4 shadow-sm","transition-all duration-200 ease-in-out",t?"translate-x-4 bg-primary-foreground":"translate-x-0 bg-white")})}),"Toggle"),M=r(({value:t,onChange:n})=>{const o=[{label:"Light",value:"light",icon:e(m,{size:13,src:A})},{label:"Dark",value:"dark",icon:e(m,{size:13,src:T})},{label:"System",value:"system",icon:e(m,{size:13,src:S})}];return e("div",{class:"flex items-center gap-0.5 bg-foreground/6 p-0.5",children:o.map(s=>l("button",{"aria-pressed":t===s.value,class:g("flex items-center gap-1.5 px-2.5 py-1.5 text-[0.75rem] font-medium","transition-all duration-150 cursor-pointer border-0",t===s.value?"bg-background text-foreground shadow-sm":"bg-transparent text-muted-foreground hover:text-foreground"),onClick:r(()=>n(s.value),"onClick"),type:"button",children:[s.icon,s.label]},s.value))})},"ThemeControl"),j=[{label:"Never",value:-1},{label:"Always",value:0},{label:"2s",value:2e3},{label:"5s",value:5e3},{label:"10s",value:1e4},{label:"30s",value:3e4}],P=r(({value:t,onChange:n})=>e("select",{class:g("bg-foreground/6 border border-border","text-[0.775rem] font-medium text-foreground","px-2.5 py-1.5 cursor-pointer","focus:outline-none focus:ring-1 focus:ring-ring","transition-colors duration-150"),onChange:r(o=>n(Number(o.target.value)),"onChange"),value:String(t),children:j.map(o=>e("option",{value:String(o.value),children:o.label},o.value))}),"HideDelayControl"),R=r(t=>t.split("+"),"formatBinding"),B=r(({part:t})=>e("span",{class:"inline-flex items-center px-1.5 py-0.5 text-[0.65rem] font-mono font-medium bg-foreground/8 border border-border text-foreground",children:t}),"KeyBadge"),x=r(({value:t,onChange:n})=>{const[o,s]=f(D(!1),"capturing"),p=f(k(null),"buttonRef");return y(()=>{if(!o)return;const i=r(a=>{if(a.preventDefault(),a.stopPropagation(),["Alt","Shift","Control","Meta"].includes(a.key))return;const u=[];a.altKey&&u.push("Alt"),a.ctrlKey&&u.push("Control"),a.metaKey&&u.push("Meta"),a.shiftKey&&u.push("Shift"),u.push(a.key),n(u.join("+")),s(!1)},"handleKeyDown");return window.addEventListener("keydown",i,!0),()=>window.removeEventListener("keydown",i,!0)},[o,n]),l("div",{class:"flex items-center gap-2",children:[e("div",{class:"flex items-center gap-0.5",children:R(t).map((i,a)=>l("span",{class:"flex items-center gap-0.5",children:[a>0&&e("span",{class:"text-muted-foreground/40 text-[0.6rem] mx-0.5",children:"+"}),e(B,{part:i})]},a))}),e("button",{ref:p,class:g("px-2 py-0.5 text-[0.7rem] font-medium border cursor-pointer transition-colors",o?"border-primary text-primary bg-primary/8 animate-pulse":"border-border text-muted-foreground hover:text-foreground bg-transparent"),onClick:r(()=>s(i=>!i),"onClick"),type:"button",children:o?"Press keys…":"Record"}),e("button",{class:"px-2 py-0.5 text-[0.7rem] font-medium border border-border/50 text-muted-foreground/60 hover:text-foreground bg-transparent cursor-pointer transition-colors",onClick:r(()=>{s(!1)},"onClick"),title:"Cancel",type:"button",children:"✕"})]})},"KeyCapture"),N=r(t=>{const{state:n,updateState:o}=w(),{theme:s,setTheme:p}=F();return l("div",{class:"p-5 space-y-5 max-w-2xl",children:[l(h,{title:"Appearance",children:[e(d,{label:"Theme",description:"Color scheme for the DevTools panel.",control:e(M,{value:s,onChange:p})}),e(d,{label:"Reduce motion",description:"Disable animations and transitions throughout the toolbar.",control:e(b,{checked:n.reduceMotion,onChange:r(i=>o({reduceMotion:i}),"onChange")})})]}),l(h,{title:"Toolbar",children:[e(d,{label:"Auto-hide when inactive",description:"Collapse the toolbar pill after a period of inactivity. Set 'Never' to always keep it visible.",control:e(P,{value:n.minimizePanelInactive,onChange:r(i=>o({minimizePanelInactive:i}),"onChange")})}),e(d,{label:"Show toolbar when panel is closed",description:"Keep the toolbar pill visible even when the DevTools panel is not open.",control:e(b,{checked:n.preferShowFloatingPanel,onChange:r(i=>o({preferShowFloatingPanel:i}),"onChange")})})]}),e(h,{title:"Panel",children:e(d,{label:"Close on outside click",description:"Close the DevTools panel when clicking outside of it.",control:e(b,{checked:n.closeOnOutsideClick,onChange:r(i=>o({closeOnOutsideClick:i}),"onChange")})})}),l(h,{title:"Keyboard Shortcuts",children:[e(d,{label:"Toggle toolbar",description:"Open or close the DevTools panel.",control:l("div",{class:"flex items-center gap-2",children:[e(x,{value:n.keybindings?.toggle??c.toggle,onChange:r(i=>o({keybindings:{...n.keybindings??c,toggle:i}}),"onChange")}),n.keybindings?.toggle!==c.toggle&&e("button",{class:"text-[0.65rem] text-muted-foreground/50 hover:text-foreground underline cursor-pointer border-0 bg-transparent",onClick:r(()=>o({keybindings:{...n.keybindings??c,toggle:c.toggle}}),"onClick"),type:"button",children:"Reset"})]})}),e(d,{label:"Close panel",description:"Dismiss the active app or close the panel.",control:l("div",{class:"flex items-center gap-2",children:[e(x,{value:n.keybindings?.close??c.close,onChange:r(i=>o({keybindings:{...n.keybindings??c,close:i}}),"onChange")}),n.keybindings?.close!==c.close&&e("button",{class:"text-[0.65rem] text-muted-foreground/50 hover:text-foreground underline cursor-pointer border-0 bg-transparent",onClick:r(()=>o({keybindings:{...n.keybindings??c,close:c.close}}),"onClick"),type:"button",children:"Reset"})]})})]})]})},"SettingsApp"),U={component:N,defaultOpen:!0,icon:E,id:"dev-toolbar:settings",name:"Settings"};export{U as default};
@@ -0,0 +1,5 @@
1
+ /** @jsxImportSource preact */
2
+ import type { ComponentChildren } from "preact";
3
+ import type { AppComponentProps } from "../../types/app.d.ts";
4
+ declare const SettingsApp: (_props: AppComponentProps) => ComponentChildren;
5
+ export default SettingsApp;
@@ -0,0 +1,3 @@
1
+ import type { DevToolbarApp } from "../../types/app.d.ts";
2
+ declare const timelineApp: DevToolbarApp;
3
+ export default timelineApp;
@@ -0,0 +1,18 @@
1
+ var D=Object.defineProperty;var b=(t,o)=>D(t,"name",{value:o,configurable:!0});import{addHookName as c}from"preact/devtools";import{useState as p,useRef as I,useEffect as L}from"preact/hooks";import{g as w,D as z}from"../../packem_shared/store-BxE0w51s.js";import{m as u}from"../../packem_shared/cn-BEsR6GkP.js";import{jsx as r,jsxs as n}from"preact/jsx-runtime";const A=`<!-- @license lucide-static v0.575.0 - ISC -->
2
+ <svg
3
+ class="lucide lucide-gantt-chart"
4
+ xmlns="http://www.w3.org/2000/svg"
5
+ width="24"
6
+ height="24"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ stroke-width="2"
11
+ stroke-linecap="round"
12
+ stroke-linejoin="round"
13
+ >
14
+ <path d="M6 5h12" />
15
+ <path d="M4 12h10" />
16
+ <path d="M12 19h8" />
17
+ </svg>
18
+ `;var N=Object.defineProperty,l=b((t,o)=>N(t,"name",{value:o,configurable:!0}),"i");const O=500,g="all",k=l(t=>new Date(t).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3}),"formatTime"),y=l(({level:t})=>{if(!t)return null;const o={error:"bg-destructive/15 text-destructive border-destructive/30",info:"bg-info/15 text-info border-info/30",warning:"bg-warning/15 text-warning border-warning/30"};return r("span",{class:u("inline-flex items-center px-1.5 py-0.5 text-[0.6rem] font-bold uppercase tracking-wider border",o[t]??o.info),children:t})},"LevelBadge"),R=l(({event:t,onClose:o})=>n("div",{class:"border-l border-border bg-background h-full flex flex-col min-w-0 w-80 shrink-0",children:[n("div",{class:"flex items-center justify-between gap-2 px-4 py-3 border-b border-border shrink-0",children:[r("span",{class:"text-[0.75rem] font-semibold text-foreground truncate",children:t.title}),r("button",{"aria-label":"Close detail",class:"size-5 flex items-center justify-center text-muted-foreground hover:text-foreground cursor-pointer border-0 bg-transparent shrink-0",onClick:o,type:"button",children:"✕"})]}),n("div",{class:"flex-1 overflow-auto p-4 space-y-3",children:[n("div",{class:"space-y-1",children:[r("div",{class:"text-[0.65rem] uppercase tracking-wider text-muted-foreground font-medium",children:"Time"}),r("div",{class:"text-[0.8rem] font-mono text-foreground",children:k(t.time)})]}),t.subtitle&&n("div",{class:"space-y-1",children:[r("div",{class:"text-[0.65rem] uppercase tracking-wider text-muted-foreground font-medium",children:"Subtitle"}),r("div",{class:"text-[0.8rem] text-foreground",children:t.subtitle})]}),t.duration!==void 0&&n("div",{class:"space-y-1",children:[r("div",{class:"text-[0.65rem] uppercase tracking-wider text-muted-foreground font-medium",children:"Duration"}),n("div",{class:"text-[0.8rem] font-mono text-foreground",children:[t.duration,"ms"]})]}),t.level&&n("div",{class:"space-y-1",children:[r("div",{class:"text-[0.65rem] uppercase tracking-wider text-muted-foreground font-medium",children:"Level"}),r(y,{level:t.level})]}),t.data&&Object.keys(t.data).length>0&&n("div",{class:"space-y-1",children:[r("div",{class:"text-[0.65rem] uppercase tracking-wider text-muted-foreground font-medium",children:"Data"}),r("pre",{class:"text-[0.7rem] font-mono text-foreground/80 bg-foreground/4 p-3 overflow-auto border border-border/50 whitespace-pre-wrap break-all",children:JSON.stringify(t.data,null,2)})]})]})]}),"EventDetail"),B=l(t=>{const[o,C]=c(p(g),"activeTab"),[d,j]=c(p([]),"groups"),[s,a]=c(p(null),"selectedEvent"),m=c(I(null),"intervalRef"),f=l(()=>{const e=w();j(e.getGroups().map(i=>({...i,events:[...i.events]})))},"refresh");L(()=>(f(),m.current=setInterval(f,O),()=>{m.current!==null&&clearInterval(m.current)}),[]);const x=new Map(z.map(e=>[e.id,e.color])),M=[{id:g,label:"All",color:void 0},...d.map(e=>({id:e.id,label:e.label,color:x.get(e.id)??e.color}))],h=o===g?d.flatMap(e=>e.events).sort((e,i)=>e.time-i.time):d.find(e=>e.id===o)?.events??[],T=l(()=>{w().clearAll(),a(null),f()},"clearAll");return n("div",{class:"flex flex-col h-full",children:[n("div",{class:"flex items-center justify-between gap-2 px-4 py-2 border-b border-border shrink-0",children:[r("div",{class:"flex items-center gap-0 overflow-x-auto",children:M.map(e=>n("button",{class:u("px-3 py-1.5 text-[0.75rem] font-medium whitespace-nowrap border-0 cursor-pointer transition-colors duration-150",o===e.id?"text-foreground border-b-2 border-primary bg-transparent":"text-muted-foreground bg-transparent hover:text-foreground"),onClick:l(()=>{C(e.id),a(null)},"onClick"),type:"button",children:[e.color&&r("span",{class:"inline-block size-2 rounded-full mr-1.5 align-middle",style:{backgroundColor:e.color}}),e.label]},e.id))}),r("button",{class:u("px-2.5 py-1 text-[0.725rem] font-medium border border-border","text-muted-foreground hover:text-foreground hover:border-foreground/30","cursor-pointer bg-transparent transition-colors duration-150"),onClick:T,title:"Clear all events",type:"button",children:"Clear"})]}),n("div",{class:"flex flex-1 min-h-0 overflow-hidden",children:[r("div",{class:"flex-1 overflow-auto",children:h.length===0?n("div",{class:"flex flex-col items-center justify-center h-full gap-4 p-8 text-center select-none",children:[r("div",{class:"size-12 border border-border/50 bg-foreground/2 flex items-center justify-center",children:r("svg",{"aria-hidden":"true",class:"size-5 text-muted-foreground/40",fill:"none",stroke:"currentColor","stroke-width":"1.5",viewBox:"0 0 24 24",children:r("path",{d:"M12 6v6h4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z","stroke-linecap":"round","stroke-linejoin":"round"})})}),n("div",{class:"space-y-1",children:[r("p",{class:"text-[0.8rem] font-medium text-foreground/60",children:"No events recorded yet"}),r("p",{class:"text-[0.7rem] text-muted-foreground",children:"Events appear here as your app runs"}),r("p",{class:"text-[0.65rem] text-muted-foreground/50 mt-2 max-w-[240px] leading-relaxed",children:"HMR updates, network requests, and custom events are captured automatically"})]})]}):r("div",{class:"divide-y divide-border/50",children:h.map(e=>{const i=d.find(S=>S.events.some(E=>E.id===e.id)),v=x.get(i?.id??"")??i?.color;return n("button",{class:u("w-full flex items-start gap-3 px-4 py-3 text-left border-0 bg-transparent cursor-pointer","hover:bg-foreground/4 transition-colors duration-100",s?.id===e.id&&"bg-primary/6"),onClick:l(()=>a(s?.id===e.id?null:e),"onClick"),type:"button",children:[v&&r("span",{class:"mt-1 size-1.5 rounded-full shrink-0",style:{backgroundColor:v}}),n("div",{class:"flex-1 min-w-0",children:[n("div",{class:"flex items-center gap-2 flex-wrap",children:[r("span",{class:"text-[0.8rem] font-medium text-foreground truncate",children:e.title}),r(y,{level:e.level})]}),e.subtitle&&r("div",{class:"text-[0.725rem] text-muted-foreground truncate mt-0.5",children:e.subtitle})]}),r("span",{class:"text-[0.65rem] font-mono text-muted-foreground/70 shrink-0 mt-0.5",children:k(e.time)})]},e.id)})})}),s&&r(R,{event:s,onClose:l(()=>a(null),"onClose")})]})]})},"TimelineApp"),F={component:B,icon:A,id:"dev-toolbar:timeline",name:"Timeline"};export{F as default};
@@ -0,0 +1,5 @@
1
+ /** @jsxImportSource preact */
2
+ import type { ComponentChildren } from "preact";
3
+ import type { AppComponentProps } from "../../types/app.d.ts";
4
+ declare const TimelineApp: (_props: AppComponentProps) => ComponentChildren;
5
+ export default TimelineApp;
@@ -0,0 +1,3 @@
1
+ import type { DevToolbarApp } from "../../types/app.d.ts";
2
+ declare const viteConfigApp: DevToolbarApp;
3
+ export default viteConfigApp;
@@ -0,0 +1,16 @@
1
+ var x=Object.defineProperty;var b=(t,e)=>x(t,"name",{value:e,configurable:!0});import{addHookName as d}from"preact/devtools";import{useState as c,useEffect as h}from"preact/hooks";import{m as g}from"../../packem_shared/cn-BEsR6GkP.js";import{jsx as r,jsxs as o}from"preact/jsx-runtime";const y=`<!-- @license lucide-static v0.575.0 - ISC -->
2
+ <svg
3
+ class="lucide lucide-zap"
4
+ xmlns="http://www.w3.org/2000/svg"
5
+ width="24"
6
+ height="24"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ stroke-width="2"
11
+ stroke-linecap="round"
12
+ stroke-linejoin="round"
13
+ >
14
+ <path d="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z" />
15
+ </svg>
16
+ `;var v=Object.defineProperty,a=b((t,e)=>v(t,"name",{value:e,configurable:!0}),"s");const w=a(({text:t})=>{const[e,i]=d(c(!1),"copied"),n=a(()=>{navigator.clipboard.writeText(t).then(()=>{i(!0),setTimeout(()=>i(!1),1500)}).catch(()=>{})},"copy");return r("button",{class:g("px-2 py-0.5 text-[0.65rem] font-medium border cursor-pointer transition-colors duration-150",e?"border-primary/40 text-primary bg-primary/8":"border-border text-muted-foreground hover:text-foreground hover:border-foreground/30 bg-transparent"),onClick:n,title:"Copy to clipboard",type:"button",children:e?"Copied!":"Copy"})},"CopyButton"),m=a(({title:t,data:e,defaultOpen:i=!0})=>{const[n,p]=d(c(i),"open"),u=JSON.stringify(e,null,2);return o("section",{class:"border border-border",children:[o("button",{class:"w-full flex items-center justify-between gap-2 px-4 py-3 bg-foreground/3 hover:bg-foreground/6 transition-colors cursor-pointer border-0 text-left",onClick:a(()=>p(s=>!s),"onClick"),type:"button",children:[r("span",{class:"text-[0.75rem] font-semibold text-foreground uppercase tracking-wide",children:t}),o("div",{class:"flex items-center gap-2",children:[r(w,{text:u}),r("span",{class:g("text-muted-foreground text-[0.7rem] transition-transform duration-200",n&&"rotate-90"),children:"▶"})]})]}),n&&r("pre",{class:"text-[0.7rem] font-mono text-foreground/80 bg-transparent p-4 overflow-auto whitespace-pre-wrap break-all border-t border-border",children:u})]})},"Section"),C=a(({helpers:t})=>{const[e,i]=d(c(null),"config"),[n,p]=d(c(null),"error"),[u,s]=d(c(!0),"loading"),f=a(()=>{s(!0),p(null),t.rpc.getViteConfig().then(l=>{i(l),s(!1)}).catch(l=>{p(l.message??"Failed to load Vite config"),s(!1)})},"load");return h(()=>{f()},[]),u?o("div",{class:"flex flex-col items-center justify-center h-full gap-3 p-8 select-none",children:[r("div",{class:"flex gap-1.5 items-center","aria-hidden":"true",children:[0,160,320].map(l=>r("span",{class:"size-1.5 bg-primary/50 rounded-full animate-pulse",style:{animationDelay:`${l}ms`}},l))}),r("span",{class:"text-[0.75rem] text-muted-foreground",children:"Loading Vite config…"})]}):n||!e?o("div",{class:"flex flex-col items-center justify-center h-full gap-3 p-8 text-center",children:[r("p",{class:"text-[0.8rem] text-destructive",children:n??"No config available"}),r("button",{class:"px-3 py-1.5 text-[0.75rem] border border-border text-muted-foreground hover:text-foreground cursor-pointer bg-transparent",onClick:f,type:"button",children:"Retry"})]}):o("div",{class:"p-5 space-y-4",children:[o("div",{class:"flex items-center gap-2 flex-wrap",children:[e.mode&&r("span",{class:"inline-flex items-center px-2.5 py-1 text-[0.7rem] font-bold uppercase tracking-wider bg-primary/10 text-primary border border-primary/20",children:e.mode}),e.root&&r("code",{class:"text-[0.7rem] font-mono text-muted-foreground bg-foreground/5 px-2 py-1 border border-border/50",children:e.root}),e.base&&e.base!=="/"&&o("code",{class:"text-[0.7rem] font-mono text-muted-foreground bg-foreground/5 px-2 py-1 border border-border/50",children:["base: ",e.base]}),r("button",{class:"ml-auto px-2.5 py-1 text-[0.725rem] border border-border text-muted-foreground hover:text-foreground cursor-pointer bg-transparent transition-colors",onClick:f,type:"button",children:"Refresh"})]}),e.server&&r(m,{data:e.server,defaultOpen:!0,title:"Server"}),e.build&&r(m,{data:e.build,defaultOpen:!1,title:"Build"}),e.resolve&&r(m,{data:e.resolve,defaultOpen:!1,title:"Resolve / Alias"})]})},"ViteConfigApp"),A={component:C,icon:y,id:"dev-toolbar:vite-config",name:"Vite Config"};export{A as default};
@@ -0,0 +1,5 @@
1
+ /** @jsxImportSource preact */
2
+ import type { ComponentChildren } from "preact";
3
+ import type { AppComponentProps } from "../../types/app.d.ts";
4
+ declare const ViteConfigApp: ({ helpers }: AppComponentProps) => ComponentChildren;
5
+ export default ViteConfigApp;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ var I=Object.defineProperty;var d=(e,t)=>I(e,"name",{value:t,configurable:!0});import r from"virtual:visulima-dev-toolbar-options";var c=Object.defineProperty,m=d((e,t)=>c(e,"name",{value:t,configurable:!0}),"r");globalThis.__VISULIMA_DEV_TOOLBAR_OPTIONS__=r;const g=m(()=>{if(!r.requireUrlFlag)return!0;const e=r.urlFlagName??"devtools";return new URLSearchParams(globalThis.window?.location.search).get(e)==="true"},"isUrlFlagPresent"),o=m(async()=>{if(globalThis.window===void 0||!g()||globalThis.__VISULIMA_DEVTOOLS_INITIALIZED__)return;globalThis.__VISULIMA_DEVTOOLS_INITIALIZED__=!0;let e=null;try{await import("virtual:visulima-dev-toolbar-path:toolbar/index.js");const{apps:t}=r,[l,i,a,n,u,s,p,_]=await Promise.all([t.settings?import("virtual:visulima-dev-toolbar-path:apps/settings/index.js"):null,t.timeline?import("virtual:visulima-dev-toolbar-path:apps/timeline/index.js"):null,t.viteConfig?import("virtual:visulima-dev-toolbar-path:apps/vite-config/index.js"):null,t.moduleGraph?import("virtual:visulima-dev-toolbar-path:apps/module-graph/index.js"):null,t.seo?import("virtual:visulima-dev-toolbar-path:apps/seo/index.js"):null,t.performance?import("virtual:visulima-dev-toolbar-path:apps/performance/index.js"):null,t.a11y?import("virtual:visulima-dev-toolbar-path:apps/a11y/index.js"):null,import("virtual:visulima-dev-toolbar-path:apps/more/index.js")]);e=document.createElement("dev-toolbar"),document.body.append(e),e.registerApp&&(l&&e.registerApp(l.default,!0),i&&e.registerApp(i.default,!0),a&&e.registerApp(a.default,!0),n&&e.registerApp(n.default,!0),u&&e.registerApp(u.default,!0),s&&e.registerApp(s.default,!0),p&&e.registerApp(p.default,!0),e.registerApp(_.default,!0)),e.init&&e.init(),console.log("[dev-toolbar] Initialized successfully")}catch(t){e?.isConnected&&e.remove(),globalThis.__VISULIMA_DEVTOOLS_INITIALIZED__=!1,console.error("[dev-toolbar] Failed to initialize:",t)}},"initToolbar");typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",o):o());import.meta.hot&&import.meta.hot.on("dev-toolbar:init",()=>{const e=document.querySelector("dev-toolbar");e&&e.remove(),globalThis.__VISULIMA_DEVTOOLS_INITIALIZED__=!1,o()});
@@ -0,0 +1,10 @@
1
+ import type { DevToolbarApp } from "../types/app.d.ts";
2
+ import type { DevToolbarHook } from "../types/hooks.d.ts";
3
+ import type { TimelineEvent } from "../types/timeline.d.ts";
4
+ /**
5
+ * Creates a dev toolbar hook instance
6
+ * @param onRegisterApp Callback when app is registered
7
+ * @param onTimelineEvent Callback when timeline event is added
8
+ * @returns Hook instance
9
+ */
10
+ export declare const createDevToolbarHook: (onRegisterApp?: (app: DevToolbarApp) => void, onTimelineEvent?: (groupId: string, event: TimelineEvent) => void) => DevToolbarHook;
@@ -0,0 +1,5 @@
1
+ import type { HookEvents } from "../types/hooks.d.ts";
2
+ /**
3
+ * Hook event names
4
+ */
5
+ export declare const HOOK_EVENT_NAMES: (keyof HookEvents)[];
@@ -0,0 +1,15 @@
1
+ import type { DevToolbarApp } from "../types/app.d.ts";
2
+ import type { DevToolbarHook } from "../types/hooks.d.ts";
3
+ import type { TimelineEvent } from "../types/timeline.d.ts";
4
+ /**
5
+ * Setup global hook on window object
6
+ * @param onRegisterApp Callback when app is registered
7
+ * @param onTimelineEvent Callback when timeline event is added
8
+ * @returns Hook instance
9
+ */
10
+ export declare const setupGlobalHook: (onRegisterApp?: (app: DevToolbarApp) => void, onTimelineEvent?: (groupId: string, event: TimelineEvent) => void) => DevToolbarHook;
11
+ /**
12
+ * Get the global hook instance
13
+ * @returns Hook instance or undefined
14
+ */
15
+ export declare const getGlobalHook: () => DevToolbarHook | undefined;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Hook system exports
3
+ */
4
+ export { createDevToolbarHook } from "./create-hook.d.ts";
5
+ export { HOOK_EVENT_NAMES } from "./events.d.ts";
6
+ export { getGlobalHook, setupGlobalHook } from "./global-hook.d.ts";
@@ -0,0 +1,6 @@
1
+ export { createDevToolbarHook, getGlobalHook, setupGlobalHook } from "./hooks/index.d.ts";
2
+ export { createClientRPCContext, createServerRPCContext } from "./rpc/index.d.ts";
3
+ export { getTimelineStore, TimelineStore } from "./timeline/index.d.ts";
4
+ export { DevToolbar } from "./toolbar/index.d.ts";
5
+ export { loadSettings, saveSettings, updateSettings } from "./toolbar/settings.d.ts";
6
+ export type * from "./types/index.d.ts";
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ import{DevToolbar as t}from"./toolbar/index.js";import{loadSettings as a,saveSettings as l,updateSettings as m}from"./packem_shared/loadSettings-hvjR4fcS.js";import{T as x,g as i}from"./packem_shared/store-BxE0w51s.js";import{createClientRPCContext as f}from"./packem_shared/createClientRPCContext-DzKQpKTk.js";import{createDevToolbarHook as g}from"./packem_shared/createDevToolbarHook-DGNxqk8N.js";import{createServerRPCContext as C}from"./packem_shared/createServerRPCContext-BVSesPXu.js";import{getGlobalHook as b,setupGlobalHook as v}from"./packem_shared/setupGlobalHook-CFuxsCyl.js";export{t as DevToolbar,x as TimelineStore,f as createClientRPCContext,g as createDevToolbarHook,C as createServerRPCContext,b as getGlobalHook,i as getTimelineStore,a as loadSettings,l as saveSettings,v as setupGlobalHook,m as updateSettings};
@@ -0,0 +1 @@
1
+ import{T as o,g as r}from"./store-BxE0w51s.js";export{o as TimelineStore,r as getTimelineStore};
@@ -0,0 +1 @@
1
+ var t=Object.defineProperty;var o=(r,e)=>t(r,"name",{value:e,configurable:!0});import{clsx as m}from"clsx";import{twMerge as a}from"tailwind-merge";var c=Object.defineProperty,n=o((r,e)=>c(r,"name",{value:e,configurable:!0}),"t");const l=n((...r)=>a(m(r)),"cn");export{l as m};
@@ -0,0 +1 @@
1
+ var s=Object.defineProperty;var d=(a,n)=>s(a,"name",{value:n,configurable:!0});var m=Object.defineProperty,c=d((a,n)=>m(a,"name",{value:n,configurable:!0}),"r");const p=c(a=>{const n={onConfigChange:c(()=>{},"onConfigChange"),onHMRUpdate:c(()=>{},"onHMRUpdate"),onModuleUpdate:c(()=>{},"onModuleUpdate"),...a},t=new Map;return globalThis.window!==void 0&&import.meta.hot&&(import.meta.hot.on("dev-toolbar:rpc:response",e=>{const o=t.get(e.id);o&&(t.delete(e.id),o.resolve(e.result))}),import.meta.hot.on("dev-toolbar:rpc:error",e=>{const o=t.get(e.id);o&&(t.delete(e.id),o.reject(new Error(e.error)))}),import.meta.hot.on("dev-toolbar:client",e=>{const{args:o,method:r}=e,i=n[r];if(i)try{i(...o)}catch(l){console.error(`[dev-toolbar] Error calling client function ${r}:`,l)}})),{async callServer(e,...o){if(globalThis.window===void 0||!import.meta.hot)throw new Error("RPC calls can only be made in browser environment with HMR");const r=`${Date.now()}-${Math.random().toString(36).slice(7)}`;return new Promise((i,l)=>{t.set(r,{reject:l,resolve:i}),setTimeout(()=>{t.has(r)&&(t.delete(r),l(new Error(`RPC call timeout: ${e}`)))},3e4),import.meta.hot.send("dev-toolbar:rpc",{args:o,id:r,method:e})})},registerFunction(e,o){n[e]=o}}},"createClientRPCContext");export{p as createClientRPCContext};
@@ -0,0 +1 @@
1
+ var d=Object.defineProperty;var c=(n,a)=>d(n,"name",{value:a,configurable:!0});var f=Object.defineProperty,l=c((n,a)=>f(n,"name",{value:a,configurable:!0}),"v");const g=l((n,a)=>{const r=new Map;return{addTimelineEvent(e,t){a&&a(e,t),this.emit("timeline:event",t)},emit(e,...t){const o=r.get(e);if(o)for(const i of o)try{i(...t)}catch(s){console.error(`[dev-toolbar] Error in hook handler for ${String(e)}:`,s)}},off(e,t){const o=r.get(e);o&&(t?(o.delete(t),o.size===0&&r.delete(e)):r.delete(e))},on(e,t){return r.has(e)||r.set(e,new Set),r.get(e).add(t),()=>{const o=r.get(e);o&&(o.delete(t),o.size===0&&r.delete(e))}},once(e,t){const o=l(((...i)=>{t(...i),this.off(e,o)}),"onceHandler");this.on(e,o)},registerApp(e){n&&n(e)}}},"createDevToolbarHook");export{g as createDevToolbarHook};
@@ -0,0 +1 @@
1
+ var p=Object.defineProperty;var l=(e,r)=>p(e,"name",{value:r,configurable:!0});var g=Object.defineProperty,v=l((e,r)=>g(e,"name",{value:r,configurable:!0}),"u");const f=v(async e=>{const{moduleGraph:r}=e,t=[];return r.idToModuleMap.forEach(o=>{const n=[];o.importers.forEach(a=>{const s=a.url??a.id;s&&n.push(s)});const c=o.id??o.url,i=o.url??o.id;!c||!i||t.push({id:c,importerCount:o.importers.size,importerUrls:n,url:i})}),t},"getModuleGraph");var h=Object.defineProperty,m=l((e,r)=>h(e,"name",{value:r,configurable:!0}),"n$1");const b=m(async(e,r,t,o)=>{const n=e;if(n.openInEditor){await n.openInEditor(r,{column:o,line:t});return}const c=process.env.EDITOR||process.env.VISUAL||"code",i=r.startsWith("/")?r:`${e.config.root}/${r}`,a=t&&o?`:${t}:${o}`:t?`:${t}`:"",{spawn:s}=require("node:child_process");s(c,[`${i}${a}`],{detached:!0,stdio:"ignore"})},"openInEditor");var y=Object.defineProperty,$=l((e,r)=>y(e,"name",{value:r,configurable:!0}),"t");const C=$(async e=>({base:e.config.base,build:{outDir:e.config.build?.outDir},mode:e.config.mode,resolve:{alias:e.config.resolve.alias},root:e.config.root,server:{host:e.config.server?.host,https:e.config.server?.https,port:e.config.server?.port}}),"getViteConfig");var E=Object.defineProperty,d=l((e,r)=>E(e,"name",{value:r,configurable:!0}),"n");const I=d(e=>({getModuleGraph:d(async()=>f(e),"getModuleGraph"),getViteConfig:d(async()=>C(e),"getViteConfig"),openInEditor:d(async(r,t,o)=>b(e,r,t,o),"openInEditor"),readFile:d(async r=>{const{readFile:t}=await import("node:fs/promises"),o=r.startsWith("/")?r:`${e.config.root}/${r}`;return t(o,"utf-8")},"readFile")}),"createDefaultServerFunctions"),P=d((e,r)=>{const t={...I(e),...r};return e.ws.on("dev-toolbar:rpc",async(o,n)=>{const{args:c,id:i,method:a}=o,s=t[a];if(!s){n.send("dev-toolbar:rpc:error",{error:`Unknown RPC method: ${a}`,id:i});return}try{const u=await s(e,...c);n.send("dev-toolbar:rpc:response",{id:i,result:u})}catch(u){n.send("dev-toolbar:rpc:error",{error:u instanceof Error?u.message:String(u),id:i})}}),{callClient(o,...n){e.ws.send({data:{args:n,method:o},event:"dev-toolbar:client",type:"custom"})},registerFunction(o,n){t[o]=n},server:e}},"createServerRPCContext");export{P as createServerRPCContext};
@@ -0,0 +1 @@
1
+ var S=Object.defineProperty;var l=(e,t)=>S(e,"name",{value:t,configurable:!0});import{addHookName as g}from"preact/devtools";import{useState as f,useEffect as v}from"preact/hooks";import{m as w}from"./cn-BEsR6GkP.js";import{jsx as T}from"preact/jsx-runtime";var O=Object.defineProperty,s=l((e,t)=>O(e,"name",{value:t,configurable:!0}),"t$2");const _={toggle:"Alt+Shift+D",close:"Escape"},k="__v_dt__frame_state",a={closeOnOutsideClick:!0,height:60,isPip:!1,isFirstVisit:!0,keybindings:_,left:50,minimizePanelInactive:5e3,open:!1,position:"bottom",preferShowFloatingPanel:!0,reduceMotion:!1,route:"/",top:0,viewMode:"default",width:80},I=s(()=>{const e=globalThis.__VISULIMA_DEV_TOOLBAR_OPTIONS__;return e?{...a,closeOnOutsideClick:e.closeOnOutsideClick??a.closeOnOutsideClick,height:e.height??a.height,keybindings:{..._,...e.keybindings},minimizePanelInactive:e.minimizePanelInactive??a.minimizePanelInactive,position:e.position??a.position,reduceMotion:e.reduceMotion??a.reduceMotion,width:e.width??a.width}:{...a}},"buildEffectiveDefaults"),L=s(()=>{const e=I();if(globalThis.window===void 0)return e;try{const t=localStorage.getItem(k);if(t){const i=JSON.parse(t);return{...e,...i,keybindings:{...e.keybindings,...i.keybindings},open:!1}}}catch{}return e},"loadState"),M=s(e=>{if(globalThis.window!==void 0)try{localStorage.setItem(k,JSON.stringify(e))}catch{}},"saveState");let c=L();const d=new Set,$=s(()=>{for(const e of d)e()},"notifyListeners"),P=s(e=>{c={...c,...e},M(c),$()},"updateSharedState"),V=s(()=>{const[,e]=g(f(0),"forceUpdate");return v(()=>{const t=s(()=>{e(i=>i+1)},"listener");return d.add(t),()=>{d.delete(t)}},[]),{state:c,updateState:P}},"useFrameState");var E=Object.defineProperty,o=l((e,t)=>E(e,"name",{value:t,configurable:!0}),"t$1");const b="__v_dt__theme",h=o(()=>globalThis.window===void 0?"light":globalThis.window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light","getSystemTheme"),z=o(()=>{if(globalThis.window===void 0)return"system";try{const e=localStorage.getItem(b);if(e==="light"||e==="dark"||e==="system")return e}catch(e){console.warn("[dev-toolbar] Failed to load theme:",e)}return"system"},"loadTheme"),C=o(e=>{if(globalThis.window!==void 0)try{localStorage.setItem(b,e)}catch(t){console.warn("[dev-toolbar] Failed to save theme:",t)}},"saveTheme");let n=z(),r=n==="system"?h():n;const m=new Set,p=o(()=>{for(const e of m)e()},"notifyThemeListeners"),y=o(e=>{try{localStorage.setItem("__v-o__theme",e)}catch{}const t=globalThis.__v_o__current?.shadowRoot?.querySelector("#__v_o__root");t&&(e==="dark"?t.classList.add("dark"):t.classList.remove("dark"))},"syncViteOverlayTheme"),u=o(e=>{n=e,r=e==="system"?h():e,C(e),y(r),p()},"setSharedTheme");if(globalThis.window!==void 0){const e=globalThis.window.matchMedia("(prefers-color-scheme: dark)"),t=o(()=>{n==="system"&&(r=h(),y(r),p())},"handleSystemChange");e.addEventListener?e.addEventListener("change",t):e.addListener&&e.addListener(t)}const W=o(()=>{const[,e]=g(f(0),"forceUpdate");return v(()=>{const t=o(()=>{e(i=>i+1)},"listener");return m.add(t),()=>{m.delete(t)}},[]),{resolvedTheme:r,setTheme:u,theme:n,toggleTheme:o(()=>{u(r==="dark"?"light":"dark")},"toggleTheme")}},"useTheme");var F=Object.defineProperty,D=l((e,t)=>F(e,"name",{value:t,configurable:!0}),"o");const x=D(({src:e,size:t=13,class:i})=>T("span",{class:w("inline-block shrink-0",i),style:{backgroundColor:"currentColor",height:t,maskImage:`url(${e})`,maskRepeat:"no-repeat",maskSize:"contain",WebkitMaskImage:`url(${e})`,WebkitMaskRepeat:"no-repeat",WebkitMaskSize:"contain",width:t}}),"Icon");export{_ as D,W as a,x as i,V as u};
@@ -0,0 +1 @@
1
+ var i=Object.defineProperty;var a=(t,e)=>i(t,"name",{value:e,configurable:!0});const o={defaultVisible:!0,placement:"bottom-center",showNotifications:!0};var r=Object.defineProperty,n=a((t,e)=>r(t,"name",{value:e,configurable:!0}),"e");const s="__v_dt__settings",l=n(()=>{if(globalThis.window===void 0)return{...o};try{const t=localStorage.getItem(s);if(t){const e=JSON.parse(t);return{...o,...e}}}catch(t){console.warn("[dev-toolbar] Failed to load settings:",t)}return{...o}},"loadSettings"),c=n(t=>{if(globalThis.window!==void 0)try{localStorage.setItem(s,JSON.stringify(t))}catch(e){console.warn("[dev-toolbar] Failed to save settings:",e)}},"saveSettings"),g=n(t=>{const e={...l(),...t};return c(e),e},"updateSettings");export{l as loadSettings,c as saveSettings,g as updateSettings};
@@ -0,0 +1 @@
1
+ var r=Object.defineProperty;var _=(o,l)=>r(o,"name",{value:l,configurable:!0});import{createDevToolbarHook as t}from"./createDevToolbarHook-DGNxqk8N.js";var O=Object.defineProperty,a=_((o,l)=>O(o,"name",{value:l,configurable:!0}),"n");let e;const n=a((o,l)=>e||(e=t(o,l),globalThis.window!==void 0&&(globalThis.__DEV_TOOLBAR_HOOK__=e),e),"setupGlobalHook"),s=a(()=>{const o=globalThis;return globalThis.window!==void 0&&o.__DEV_TOOLBAR_HOOK__?o.__DEV_TOOLBAR_HOOK__:e},"getGlobalHook");export{s as getGlobalHook,n as setupGlobalHook};
@@ -0,0 +1 @@
1
+ var v=Object.defineProperty;var o=(r,e)=>v(r,"name",{value:e,configurable:!0});const a=[{color:"#10B981",events:[],id:"hmr",label:"HMR Updates"},{color:"#3B82F6",events:[],id:"network",label:"Network"},{color:"#EF4444",events:[],id:"errors",label:"Errors"},{color:"#8B5CF6",events:[],id:"custom",label:"Custom"}];var g=Object.defineProperty,i=o((r,e)=>g(r,"name",{value:e,configurable:!0}),"i");class c{static{o(this,"TimelineStore")}static{i(this,"TimelineStore")}groups;maxEvents;constructor(e=1e3){this.maxEvents=e,this.groups=new Map;for(const t of a)this.groups.set(t.id,{...t,events:[]})}addEvent(e,t){let s=this.groups.get(e);s||(s={events:[],id:e,label:e},this.groups.set(e,s)),s.events.push(t),s.events.length>this.maxEvents&&s.events.shift(),s.events.sort((l,u)=>l.time-u.time)}getGroups(){return[...this.groups.values()]}getGroupEvents(e){return this.groups.get(e)?.events||[]}getAllEvents(){const e=[];for(const t of this.groups.values())e.push(...t.events);return e.sort((t,s)=>t.time-s.time)}clearGroup(e){const t=this.groups.get(e);t&&(t.events=[])}clearAll(){for(const e of this.groups.values())e.events=[]}getEventsInRange(e,t){return this.getAllEvents().filter(s=>s.time>=e&&s.time<=t)}}let n;const h=i(()=>(n||(n=new c),n),"getTimelineStore");export{a as D,c as T,h as g};
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Performance Monitor — singleton that collects browser performance metrics.
3
+ *
4
+ * Metrics collected:
5
+ * - FPS via requestAnimationFrame circular buffer (last 60 samples)
6
+ * - Memory via performance.memory (Chrome only, 1-second polling)
7
+ * - Core Web Vitals: LCP, CLS, FID, FCP, TTFB (PerformanceObserver, buffered)
8
+ * - Long tasks (>50 ms blocking) via PerformanceObserver
9
+ */
10
+ export interface MemoryInfo {
11
+ /** JS heap size limit in bytes */
12
+ jsHeapSizeLimit: number;
13
+ /** Total allocated JS heap in bytes */
14
+ totalJSHeapSize: number;
15
+ /** Currently used JS heap in bytes */
16
+ usedJSHeapSize: number;
17
+ }
18
+ export interface LongTask {
19
+ /** Duration in milliseconds */
20
+ duration: number;
21
+ /** Unique id */
22
+ id: string;
23
+ /** Start time (DOMHighResTimeStamp) */
24
+ startTime: number;
25
+ }
26
+ export interface CoreWebVitals {
27
+ /** Cumulative Layout Shift score */
28
+ cls: null | number;
29
+ /** First Contentful Paint in ms */
30
+ fcp: null | number;
31
+ /** First Input Delay in ms */
32
+ fid: null | number;
33
+ /** Largest Contentful Paint in ms */
34
+ lcp: null | number;
35
+ /** Time to First Byte in ms */
36
+ ttfb: null | number;
37
+ }
38
+ export interface PerformanceSnapshot {
39
+ /** Current FPS (0–60) */
40
+ fps: number;
41
+ /** Long tasks captured since start */
42
+ longTasks: LongTask[];
43
+ /** Memory info (Chrome only, otherwise null) */
44
+ memory: MemoryInfo | null;
45
+ /** Core Web Vitals */
46
+ vitals: CoreWebVitals;
47
+ }
48
+ type Listener = (snapshot: PerformanceSnapshot) => void;
49
+ export declare const CWV_THRESHOLDS: {
50
+ readonly cls: {
51
+ readonly good: 0.1;
52
+ readonly poor: 0.25;
53
+ };
54
+ readonly fcp: {
55
+ readonly good: 1800;
56
+ readonly poor: 3000;
57
+ };
58
+ readonly fid: {
59
+ readonly good: 100;
60
+ readonly poor: 300;
61
+ };
62
+ readonly lcp: {
63
+ readonly good: 2500;
64
+ readonly poor: 4000;
65
+ };
66
+ readonly ttfb: {
67
+ readonly good: 800;
68
+ readonly poor: 1800;
69
+ };
70
+ };
71
+ export type CwvRating = "good" | "needs-improvement" | "poor";
72
+ export declare const getCwvRating: (metric: keyof typeof CWV_THRESHOLDS, value: number) => CwvRating;
73
+ export declare class PerformanceMonitor {
74
+ private clsValue;
75
+ private fpsSamples;
76
+ private listeners;
77
+ private longTaskIdCounter;
78
+ private longTasks;
79
+ private memory;
80
+ private memoryInterval;
81
+ private observers;
82
+ private rafId;
83
+ private running;
84
+ private vitals;
85
+ /**
86
+ * Remove all collected long tasks (useful for the "Clear" button in the UI).
87
+ */
88
+ clearLongTasks(): void;
89
+ /**
90
+ * Return a snapshot of the current metrics (no subscription).
91
+ */
92
+ getSnapshot(): PerformanceSnapshot;
93
+ /**
94
+ * Start collecting metrics. Safe to call multiple times — starts once.
95
+ */
96
+ start(): void;
97
+ /**
98
+ * Stop all observers and timers.
99
+ */
100
+ stop(): void;
101
+ /**
102
+ * Subscribe to metric updates. Returns an unsubscribe function.
103
+ */
104
+ subscribe(listener: Listener): () => void;
105
+ private currentFps;
106
+ private emit;
107
+ private loadTtfb;
108
+ private startCwv;
109
+ private startFps;
110
+ private startLongTasks;
111
+ private startMemory;
112
+ private tryObserve;
113
+ }
114
+ export declare const performanceMonitor: PerformanceMonitor;
115
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { ClientFunctions, ClientRPCContext } from "../types/rpc.d.ts";
2
+ /**
3
+ * Creates client-side RPC context
4
+ * @param customFunctions Custom client functions to register
5
+ * @returns Client RPC context
6
+ */
7
+ export declare const createClientRPCContext: (customFunctions?: Partial<ClientFunctions>) => ClientRPCContext;
@@ -0,0 +1,17 @@
1
+ import type { ViteDevServer } from "vite";
2
+ export interface SerializableModuleNode {
3
+ id: string;
4
+ importerCount: number;
5
+ importerUrls: string[];
6
+ url: string;
7
+ }
8
+ /**
9
+ * Get module dependency graph as serializable objects.
10
+ * Raw ModuleNode objects contain circular references (importers/importedModules)
11
+ * which cannot be JSON-serialized; this function returns a flat, safe representation.
12
+ * Importer URLs are extracted from each ModuleNode's importers Set before serialization
13
+ * so the client can display the full "imported by" list without a second RPC call.
14
+ * @param {import('vite').ViteDevServer} server Vite dev server instance
15
+ * @returns {Promise<SerializableModuleNode[]>} Array of serializable module entries
16
+ */
17
+ export declare const getModuleGraph: (server: ViteDevServer) => Promise<SerializableModuleNode[]>;
@@ -0,0 +1,9 @@
1
+ import type { ViteDevServer } from "vite";
2
+ /**
3
+ * Open file in editor
4
+ * @param server Vite dev server instance
5
+ * @param file File path
6
+ * @param line Line number (1-based)
7
+ * @param column Column number (1-based)
8
+ */
9
+ export declare const openInEditor: (server: ViteDevServer, file: string, line?: number, column?: number) => Promise<void>;
@@ -0,0 +1,7 @@
1
+ import type { ViteDevServer } from "vite";
2
+ /**
3
+ * Get Vite configuration
4
+ * @param server Vite dev server instance
5
+ * @returns Vite config object
6
+ */
7
+ export declare const getViteConfig: (server: ViteDevServer) => Promise<Record<string, any>>;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * RPC layer exports
3
+ */
4
+ export { createClientRPCContext } from "./client.d.ts";
5
+ export { getModuleGraph, type SerializableModuleNode } from "./functions/module-graph.d.ts";
6
+ export { openInEditor } from "./functions/open-in-editor.d.ts";
7
+ export { getViteConfig } from "./functions/vite-config.d.ts";
8
+ export { createServerRPCContext } from "./server.d.ts";
@@ -0,0 +1,9 @@
1
+ import type { ViteDevServer } from "vite";
2
+ import type { ServerFunctions, ServerRPCContext } from "../types/rpc.d.ts";
3
+ /**
4
+ * Creates server-side RPC context
5
+ * @param server Vite dev server instance
6
+ * @param customFunctions Custom server functions to register
7
+ * @returns Server RPC context
8
+ */
9
+ export declare const createServerRPCContext: (server: ViteDevServer, customFunctions?: Partial<ServerFunctions>) => ServerRPCContext;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Timeline system exports
3
+ */
4
+ export type { TimelineEvent, TimelineEventLevel, TimelineGroup } from "../types/timeline.d.ts";
5
+ export { DEFAULT_TIMELINE_GROUPS } from "../types/timeline.d.ts";
6
+ export { getTimelineStore, TimelineStore } from "./store.d.ts";