@visulima/dev-toolbar 1.0.0-alpha.9 → 1.0.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.
- package/CHANGELOG.md +473 -0
- package/LICENSE.md +21 -0
- package/README.md +64 -17
- package/bin/mcp.js +1 -1
- package/dist/apps/a11y/index.d.ts +3 -2
- package/dist/apps/a11y/index.js +3 -3
- package/dist/apps/annotations/index.d.ts +3 -2
- package/dist/apps/annotations/index.js +2 -2
- package/dist/apps/assets/index.d.ts +3 -2
- package/dist/apps/assets/index.js +2 -2
- package/dist/apps/inspector/index.d.ts +3 -2
- package/dist/apps/inspector/index.js +11 -11
- package/dist/apps/module-graph/index.d.ts +3 -2
- package/dist/apps/module-graph/index.js +2 -2
- package/dist/apps/performance/index.d.ts +3 -2
- package/dist/apps/performance/index.js +2 -2
- package/dist/apps/seo/index.d.ts +3 -2
- package/dist/apps/seo/index.js +2 -2
- package/dist/apps/settings/index.d.ts +3 -2
- package/dist/apps/settings/index.js +2 -2
- package/dist/apps/tailwind/index.d.ts +3 -2
- package/dist/apps/tailwind/index.js +5 -5
- package/dist/apps/timeline/index.d.ts +3 -2
- package/dist/apps/timeline/index.js +2 -2
- package/dist/apps/vite-config/index.d.ts +3 -2
- package/dist/apps/vite-config/index.js +2 -2
- package/dist/client/overlay.d.ts +1 -1
- package/dist/client/overlay.js +1 -1
- package/dist/index.d.ts +133 -8
- package/dist/index.js +1 -1
- package/dist/mcp/server.d.ts +2 -12
- package/dist/mcp/server.js +1 -1
- package/dist/packem_chunks/inject-source.js +7 -9
- package/dist/packem_shared/Alert-CZq7C43v.js +1 -0
- package/dist/packem_shared/Badge-PpblpNWg.js +1 -0
- package/dist/packem_shared/Button-CAKvtfij.js +1 -0
- package/dist/packem_shared/Card-BSy2oRiS.js +1 -0
- package/dist/packem_shared/Icon-0XYV-4AL.js +1 -0
- package/dist/packem_shared/{Input-Cs6aduTi.js → Input-Dc1WiT01.js} +1 -1
- package/dist/packem_shared/Label-BZh8XxUb.js +1 -0
- package/dist/packem_shared/Popover-DuiU8EPg.js +1 -0
- package/dist/packem_shared/Progress-C90LC--2.js +1 -0
- package/dist/packem_shared/Select-CwD-d0pi.js +1 -0
- package/dist/packem_shared/Separator-PSjfhX_W.js +1 -0
- package/dist/packem_shared/Skeleton-BAFrGUR1.js +1 -0
- package/dist/packem_shared/Switch-Wpsp5M3p.js +1 -0
- package/dist/packem_shared/Tabs-BdNFQd3c.js +1 -0
- package/dist/packem_shared/{Textarea-Yfg3dLZi.js → Textarea-DP9gpte-.js} +1 -1
- package/dist/packem_shared/Tooltip-DVeuszoY.js +1 -0
- package/dist/packem_shared/annotation-settings-DlLZO5Zp.js +1 -0
- package/dist/packem_shared/annotation-store-WIJhHG5y.js +1 -0
- package/dist/packem_shared/app.d-SmKEDxsI.d.ts +229 -0
- package/dist/packem_shared/clsx-CtZWcPHt.js +1 -0
- package/dist/packem_shared/createClientRPCContext-5Bh0Q7ai.js +1 -0
- package/dist/packem_shared/createDevToolbarHook-C_TF-RyL.js +1 -0
- package/dist/packem_shared/createServerRPCContext-0Fs78uvP.js +1 -0
- package/dist/packem_shared/getGlobalHook-D6jRtv7N.js +1 -0
- package/dist/packem_shared/getTimelineStore-BT5sImVb.js +1 -0
- package/dist/packem_shared/global-api.d-DeaCvII9.d.ts +546 -0
- package/dist/packem_shared/loadSettings-C0pUyx9j.js +1 -0
- package/dist/packem_shared/server.d-ZkcY0pge.d.ts +39 -0
- package/dist/packem_shared/sharedToolbarStylesheet-BRJrLf-_.js +2 -0
- package/dist/packem_shared/store-Dqy0FbGw.js +1 -0
- package/dist/packem_shared/use-theme-DIqZkPAe.js +1 -0
- package/dist/toolbar/index.d.ts +152 -48
- package/dist/toolbar/index.js +3 -3
- package/dist/ui/index.d.ts +382 -18
- package/dist/ui/index.js +1 -1
- package/dist/vite-plugin.d.ts +183 -146
- package/dist/vite-plugin.js +4 -4
- package/package.json +30 -32
- package/dist/apps/a11y/a11y-app.d.ts +0 -4
- package/dist/apps/a11y/a11y-store.d.ts +0 -42
- package/dist/apps/a11y/a11y-tooltip.d.ts +0 -10
- package/dist/apps/annotations/annotations-app.d.ts +0 -4
- package/dist/apps/assets/assets-app.d.ts +0 -4
- package/dist/apps/inspector/a11y-capture.d.ts +0 -12
- package/dist/apps/inspector/annotation-overlay.d.ts +0 -55
- package/dist/apps/inspector/annotation-settings.d.ts +0 -33
- package/dist/apps/inspector/element-utils.d.ts +0 -115
- package/dist/apps/inspector/freeze-animations.d.ts +0 -22
- package/dist/apps/inspector/inspector-app.d.ts +0 -14
- package/dist/apps/inspector/rulers.d.ts +0 -14
- package/dist/apps/inspector/theme-palette.d.ts +0 -34
- package/dist/apps/module-graph/module-graph-app.d.ts +0 -4
- package/dist/apps/performance/performance-app.d.ts +0 -4
- package/dist/apps/performance/performance-tooltip.d.ts +0 -4
- package/dist/apps/seo/seo-app.d.ts +0 -4
- package/dist/apps/settings/settings-app.d.ts +0 -4
- package/dist/apps/tailwind/tailwind-app.d.ts +0 -4
- package/dist/apps/timeline/timeline-app.d.ts +0 -4
- package/dist/apps/vite-config/vite-config-app.d.ts +0 -4
- package/dist/hooks/create-hook.d.ts +0 -12
- package/dist/hooks/events.d.ts +0 -7
- package/dist/hooks/global-hook.d.ts +0 -15
- package/dist/hooks/index.d.ts +0 -6
- package/dist/packem_shared/Alert-D2CvX4fw.js +0 -1
- package/dist/packem_shared/Badge-BEgU04nl.js +0 -1
- package/dist/packem_shared/Button-Bkx66Co7.js +0 -1
- package/dist/packem_shared/Card-CJa4vHVc.js +0 -1
- package/dist/packem_shared/Icon-B6UHkC0o.js +0 -1
- package/dist/packem_shared/Label-DyCng4Cp.js +0 -1
- package/dist/packem_shared/Popover-BtFVaZYg.js +0 -1
- package/dist/packem_shared/Progress-DN6zn-0l.js +0 -1
- package/dist/packem_shared/Select-DgQ4ss-s.js +0 -1
- package/dist/packem_shared/Separator-D38mKeZv.js +0 -1
- package/dist/packem_shared/Skeleton-Dv-tcA1P.js +0 -1
- package/dist/packem_shared/Switch-C3NTpeoR.js +0 -1
- package/dist/packem_shared/Tabs-DKWMiawt.js +0 -1
- package/dist/packem_shared/Tooltip-CioncSXj.js +0 -1
- package/dist/packem_shared/annotation-settings-Bv0TH4WI.js +0 -1
- package/dist/packem_shared/annotation-store-bLQRYMaI.js +0 -1
- package/dist/packem_shared/clsx-wGlvpUfw.js +0 -1
- package/dist/packem_shared/createClientRPCContext-DgRxrllw.js +0 -1
- package/dist/packem_shared/createDevToolbarHook-4bZZiHPI.js +0 -1
- package/dist/packem_shared/createServerRPCContext-CJ6F87o_.js +0 -1
- package/dist/packem_shared/getTimelineStore-B1cfjWV8.js +0 -1
- package/dist/packem_shared/loadSettings-hvjR4fcS.js +0 -1
- package/dist/packem_shared/setupGlobalHook-CCf9Logv.js +0 -1
- package/dist/packem_shared/sharedToolbarStylesheet-CaTdYhVe.js +0 -2
- package/dist/packem_shared/store-DaUtLjf3.js +0 -1
- package/dist/packem_shared/use-frame-state-CxrlPUM5.js +0 -1
- package/dist/packem_shared/use-theme-zpm4zmqP.js +0 -1
- package/dist/performance/monitor.d.ts +0 -116
- package/dist/rpc/client.d.ts +0 -9
- package/dist/rpc/functions/annotations.d.ts +0 -28
- package/dist/rpc/functions/assets.d.ts +0 -16
- package/dist/rpc/functions/module-graph.d.ts +0 -17
- package/dist/rpc/functions/open-in-editor.d.ts +0 -16
- package/dist/rpc/functions/tailwind-config.d.ts +0 -15
- package/dist/rpc/functions/vite-config.d.ts +0 -83
- package/dist/rpc/server.d.ts +0 -15
- package/dist/store/annotation-store.d.ts +0 -41
- package/dist/timeline/capture.d.ts +0 -8
- package/dist/timeline/index.d.ts +0 -8
- package/dist/timeline/store.d.ts +0 -42
- package/dist/toolbar/app-manager.d.ts +0 -104
- package/dist/toolbar/components/app-button.d.ts +0 -18
- package/dist/toolbar/components/app-canvas.d.ts +0 -12
- package/dist/toolbar/components/app-tooltip-overlay.d.ts +0 -12
- package/dist/toolbar/components/first-visit-hint.d.ts +0 -15
- package/dist/toolbar/components/index.d.ts +0 -4
- package/dist/toolbar/components/pinned-tooltip-card.d.ts +0 -22
- package/dist/toolbar/components/toolbar-bar.d.ts +0 -9
- package/dist/toolbar/components/toolbar-container.d.ts +0 -49
- package/dist/toolbar/components/vite-overlay-button.d.ts +0 -14
- package/dist/toolbar/context/index.d.ts +0 -2
- package/dist/toolbar/context/toolbar-context.d.ts +0 -107
- package/dist/toolbar/global-api.d.ts +0 -24
- package/dist/toolbar/helpers.d.ts +0 -8
- package/dist/toolbar/hooks/index.d.ts +0 -10
- package/dist/toolbar/hooks/use-apps.d.ts +0 -15
- package/dist/toolbar/hooks/use-frame-state.d.ts +0 -110
- package/dist/toolbar/hooks/use-panel-visible.d.ts +0 -23
- package/dist/toolbar/hooks/use-position.d.ts +0 -24
- package/dist/toolbar/hooks/use-theme.d.ts +0 -15
- package/dist/toolbar/hooks/use-toolbar.d.ts +0 -16
- package/dist/toolbar/settings.d.ts +0 -17
- package/dist/toolbar/stylesheet.d.ts +0 -3
- package/dist/toolbar/utils/index.d.ts +0 -12
- package/dist/types/annotations.d.ts +0 -156
- package/dist/types/app.d.ts +0 -175
- package/dist/types/global-api.d.ts +0 -91
- package/dist/types/hooks.d.ts +0 -86
- package/dist/types/index.d.ts +0 -13
- package/dist/types/messaging.d.ts +0 -43
- package/dist/types/rpc.d.ts +0 -137
- package/dist/types/timeline.d.ts +0 -62
- package/dist/types/toolbar.d.ts +0 -56
- package/dist/ui/components/alert.d.ts +0 -19
- package/dist/ui/components/badge.d.ts +0 -9
- package/dist/ui/components/button.d.ts +0 -11
- package/dist/ui/components/card.d.ts +0 -16
- package/dist/ui/components/icon.d.ts +0 -19
- package/dist/ui/components/input.d.ts +0 -7
- package/dist/ui/components/label.d.ts +0 -7
- package/dist/ui/components/popover.d.ts +0 -27
- package/dist/ui/components/progress.d.ts +0 -7
- package/dist/ui/components/select.d.ts +0 -54
- package/dist/ui/components/separator.d.ts +0 -8
- package/dist/ui/components/skeleton.d.ts +0 -6
- package/dist/ui/components/switch.d.ts +0 -11
- package/dist/ui/components/tabs.d.ts +0 -28
- package/dist/ui/components/textarea.d.ts +0 -7
- package/dist/ui/components/tooltip.d.ts +0 -19
- package/dist/vite/inject-source.d.ts +0 -24
- package/dist/vite/matcher.d.ts +0 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import{addHookName as g}from"preact/devtools";import{clsx as C}from"../../packem_shared/clsx-CtZWcPHt.js";import{useState as w,useRef as q,useEffect as _,useMemo as H}from"preact/hooks";import{jsxs as n,jsx as e,Fragment as K}from"preact/jsx-runtime";const Q=/^\w+-\d+$/,G=/-\d+$/,R=/-(\d+)$/,U=/^--/,ee=s=>s.split(",").some(o=>{const r=o.trim();return r===":root"||r==="html"}),te=(s,o)=>{for(let r=0;r<s.length;r+=1){const l=s[r];if(l.startsWith("--")&&!l.startsWith("--tw-")&&!l.startsWith("--brand-")){const a=s.getPropertyValue(l).trim();a&&o.set(l,a)}}},J=(s,o)=>{for(const r of s)r instanceof CSSStyleRule?ee(r.selectorText)&&te(r.style,o):"cssRules"in r&&r.cssRules instanceof CSSRuleList&&J(r.cssRules,o)},re=()=>{const s=new Map;for(const o of document.styleSheets)try{J(o.cssRules,s)}catch{}return s},x=s=>s.endsWith("rem")?Number.parseFloat(s)*16:s.endsWith("px")?Number.parseFloat(s):s.endsWith("em")?Number.parseFloat(s)*16:0,se=s=>{const o=[],r=[],l=[],a=[],p=[],h=[];for(const[d,i]of s)d.startsWith("--color-")?o.push({cssVar:d,name:d.slice(8),value:i}):d.startsWith("--spacing-")?r.push({cssVar:d,name:d.slice(10),numericPx:x(i),value:i}):d.startsWith("--text-")&&!d.includes("--line-height")&&!d.endsWith("--font-weight")?l.push({cssVar:d,name:d.slice(7),sizePx:x(i),value:i}):d.startsWith("--font-")?a.push({cssVar:d,name:d.slice(7),value:i}):d.startsWith("--radius-")?p.push({cssVar:d,name:d.slice(9),value:i}):(d.startsWith("--shadow-")||d.startsWith("--drop-shadow-"))&&h.push({cssVar:d,name:d.slice(2),value:i});const u=r.toSorted((d,i)=>d.numericPx-i.numericPx),y=l.toSorted((d,i)=>d.sizePx-i.sizePx);return{colors:o,fontFamilies:a,fontSizes:y,radii:p,shadows:h,spacing:u}},$=s=>Q.test(s),oe=s=>{const o=[],r=new Map;for(const l of s)if($(l.name)){const a=l.name.replace(G,""),p=r.get(a)??[];p.push(l),r.set(a,p)}else o.push(l);for(const[l,a]of r)r.set(l,a.toSorted((p,h)=>{const u=Number.parseInt(p.name.match(R)?.[1]??"0",10),y=Number.parseInt(h.name.match(R)?.[1]??"0",10);return u-y}));return{scales:r,semantic:o}},O=()=>{const[s,o]=g(w(!1),"copied"),r=g(q(null),"timer");return{copied:s,copy:l=>{navigator.clipboard.writeText(l).catch(()=>{}),o(!0),r.current&&clearTimeout(r.current),r.current=setTimeout(o,1500,!1)}}},W=({count:s,title:o})=>n("div",{class:"flex items-center gap-2 px-3 py-1.5 bg-foreground/3 border-b border-border/40",children:[n("span",{class:"text-[0.58rem] font-bold uppercase tracking-[0.12em] text-muted-foreground/70",children:[e("span",{class:"text-primary/50",children:"// "}),o]}),s!==void 0&&s>0&&e("span",{class:"ml-auto text-[0.58rem] font-mono text-muted-foreground/50",children:s})]}),ne=({token:s})=>{const{copied:o,copy:r}=O();return n("button",{class:"group flex items-center gap-2.5 w-full text-left hover:bg-foreground/4 px-3 py-1.5 transition-colors cursor-pointer bg-transparent border-0",onClick:()=>{r(s.cssVar)},title:`Click to copy ${s.cssVar}`,type:"button",children:[e("span",{class:"shrink-0 size-5 border border-black/10 dark:border-white/10",style:{background:`var(${s.cssVar})`}}),n("span",{class:"flex-1 min-w-0",children:[e("span",{class:"block text-[0.68rem] font-mono text-foreground truncate",children:s.name}),e("span",{class:"block text-[0.6rem] font-mono text-muted-foreground/60 truncate",children:s.value})]}),e("span",{class:C("text-[0.6rem] font-mono shrink-0 transition-opacity",o?"text-primary opacity-100":"text-muted-foreground/40 opacity-0 group-hover:opacity-100"),children:o?"copied!":"copy"})]})},le=({name:s,tokens:o})=>{const{copied:r,copy:l}=O();return n("div",{class:"px-3 py-2",children:[n("div",{class:"flex items-center gap-2 mb-1.5",children:[e("span",{class:"text-[0.65rem] font-mono text-muted-foreground/70 w-16 shrink-0",children:s}),e("div",{class:"flex flex-1 gap-px overflow-hidden",children:o.map(a=>e("button",{class:"flex-1 h-5 border-0 cursor-pointer transition-transform hover:scale-110 hover:z-10",onClick:()=>{l(a.cssVar)},style:{background:`var(${a.cssVar})`,minWidth:0},title:`${a.name}
|
|
2
2
|
${a.value}
|
|
3
|
-
Click to copy ${a.cssVar}`,type:"button"},a.cssVar))})]}),
|
|
4
|
-
${
|
|
5
|
-
Click to copy`,type:"button"},a))})]}),o&&e("span",{class:"text-[0.6rem] font-mono text-primary/70 pl-[72px]",children:"copied!"})]})},"ConfigColorScaleRow"),H=p(({cssVar:r,isCustom:n,value:o})=>{const{copied:l,copy:a}=O(),m=r.slice(8);return s("button",{class:"group flex items-center gap-2.5 w-full text-left hover:bg-foreground/4 px-3 py-1.5 transition-colors cursor-pointer bg-transparent border-0",onClick:p(()=>{a(r)},"onClick"),title:`Click to copy ${r}`,type:"button",children:[e("span",{class:"shrink-0 size-5 border border-black/10",style:{background:o}}),s("span",{class:"flex-1 min-w-0",children:[s("span",{class:"flex items-center gap-1.5",children:[e("span",{class:"text-[0.68rem] font-mono text-foreground truncate",children:m}),n&&e("span",{class:"text-[0.55rem] font-bold uppercase tracking-wide text-primary/70 bg-primary/10 px-1",children:"custom"})]}),e("span",{class:"block text-[0.6rem] font-mono text-muted-foreground/60 truncate",children:o})]}),e("span",{class:S("text-[0.6rem] font-mono shrink-0 transition-opacity",l?"text-primary opacity-100":"text-muted-foreground/40 opacity-0 group-hover:opacity-100"),children:l?"copied!":"copy"})]})},"ConfigSemanticColorItem"),x=p(({children:r,count:n,defaultOpen:o=!0,title:l})=>{const[a,m]=b(C(o),"open");return s("div",{class:"border-b border-border/40",children:[s("button",{class:"w-full flex items-center gap-2 px-3 py-1.5 bg-foreground/3 hover:bg-foreground/5 transition-colors cursor-pointer border-0 text-left",onClick:p(()=>{m(h=>!h)},"onClick"),type:"button",children:[s("span",{class:"text-[0.58rem] font-bold uppercase tracking-[0.12em] text-muted-foreground/70 flex-1",children:[e("span",{class:"text-primary/50",children:"// "}),l]}),e("span",{class:"text-[0.58rem] font-mono text-muted-foreground/50",children:n}),e("span",{class:S("text-muted-foreground/40 text-[0.6rem] transition-transform duration-150 ml-1",a&&"rotate-90"),children:"▶"})]}),a&&r]})},"ConfigSection"),z=p(({cssVar:r,isCustom:n,value:o})=>{const{copied:l,copy:a}=O(),m=r.replace(oe,"");return s("button",{class:"group flex items-center gap-2.5 w-full text-left hover:bg-foreground/4 px-3 py-1.5 transition-colors cursor-pointer bg-transparent border-0",onClick:p(()=>{a(r)},"onClick"),type:"button",children:[e("span",{class:"flex-1 min-w-0",children:s("span",{class:"flex items-center gap-1.5",children:[e("code",{class:"text-[0.68rem] font-mono text-foreground truncate",children:m}),n&&e("span",{class:"text-[0.55rem] font-bold uppercase tracking-wide text-primary/70 bg-primary/10 px-1 shrink-0",children:"custom"})]})}),e("code",{class:"text-[0.62rem] font-mono text-muted-foreground/60 truncate max-w-[160px] shrink-0",children:o}),e("span",{class:S("text-[0.6rem] font-mono shrink-0 transition-opacity w-8 text-right",l?"text-primary opacity-100":"text-muted-foreground/40 opacity-0 group-hover:opacity-100"),children:l?"✓":"copy"})]})},"ConfigTokenRow"),xe=p(({configData:r,error:n,loading:o,onRetry:l})=>{const[a,m]=b(C(""),"colorSearch");if(o)return s("div",{class:"flex flex-col items-center justify-center h-full gap-3 p-8 select-none",children:[e("div",{"aria-hidden":"true",class:"flex gap-1.5 items-center",children:[0,160,320].map(t=>e("span",{class:"size-1.5 bg-primary/50 rounded-full animate-pulse",style:{animationDelay:`${t}ms`}},t))}),e("span",{class:"text-[0.75rem] text-muted-foreground",children:"Loading Tailwind config…"})]});if(n||!r)return s("div",{class:"flex flex-col items-center justify-center h-full gap-3 p-8 text-center",children:[e("p",{class:"text-[0.8rem] text-destructive",children:n??"No config available"}),e("button",{class:"px-3 py-1.5 text-[0.75rem] border border-border text-muted-foreground hover:text-foreground cursor-pointer bg-transparent",onClick:l,type:"button",children:"Retry"})]});const{cssFiles:h,customTheme:u,defaultTheme:v,version:d}=r,i={...v,...u},j=Object.entries(i).filter(([t])=>t.startsWith("--color-")),w=j.filter(([t])=>!$(t.slice(8))),R=j.filter(([t])=>$(t.slice(8))),y=new Map;for(const[t,c]of R){const k=t.slice(8).replace(K,""),T=y.get(k)??[];T.push([t,c]),y.set(k,T)}for(const[t,c]of y)y.set(t,c.toSorted((k,T)=>{const _=Number.parseInt(k[0].match(N)?.[1]??"0",10),U=Number.parseInt(T[0].match(N)?.[1]??"0",10);return _-U}));const f=a?[...y.entries()].filter(([t])=>t.toLowerCase().includes(a.toLowerCase())):[...y.entries()],V=Object.entries(i).filter(([t])=>t.startsWith("--spacing-")).toSorted(([,t],[,c])=>g(t)-g(c)),P=Object.entries(i).filter(([t])=>t.startsWith("--font-")),M=Object.entries(i).filter(([t])=>t.startsWith("--text-")&&!t.includes("--line-height")&&!t.endsWith("--font-weight")).toSorted(([,t],[,c])=>g(t)-g(c)),I=Object.entries(i).filter(([t])=>t.startsWith("--breakpoint-")).toSorted(([,t],[,c])=>g(t)-g(c)),D=Object.entries(i).filter(([t])=>t.startsWith("--radius-")),A=Object.entries(i).filter(([t])=>t.startsWith("--shadow-")||t.startsWith("--drop-shadow-")),B=Object.entries(i).filter(([t])=>t.startsWith("--blur-")),E=Object.entries(i).filter(([t])=>t.startsWith("--animate-")),X=["--color-","--spacing-","--font-","--text-","--breakpoint-","--radius-","--shadow-","--drop-shadow-","--blur-","--animate-","--tw-","--brand-"],L=Object.entries(i).filter(([t])=>!X.some(c=>t.startsWith(c)));let F=1;for(const[,t]of V)F=Math.max(F,g(t));return s("div",{children:[s("div",{class:"flex items-center gap-2 px-3 py-2 border-b border-border/40 bg-foreground/2 shrink-0",children:[e("span",{class:S("text-[0.6rem] font-bold uppercase tracking-wide px-1.5 py-0.5 shrink-0",d==="v4"&&"bg-cyan-500/10 text-cyan-600 dark:text-cyan-400 border border-cyan-500/20",d==="v3"&&"bg-primary/10 text-primary border border-primary/20",d==="unknown"&&"bg-foreground/8 text-muted-foreground border border-border"),children:d==="unknown"?"Tailwind":`Tailwind ${d}`}),h.length>0&&s("code",{class:"text-[0.62rem] font-mono text-muted-foreground/70 truncate flex-1",children:[h[0],h.length>1&&s("span",{class:"text-muted-foreground/40",children:[" +",h.length-1]})]}),s("span",{class:"text-[0.6rem] font-mono text-muted-foreground/50 shrink-0",children:[Object.keys(i).length," tokens"]})]}),Object.keys(u).length>0&&e(x,{count:Object.keys(u).length,title:"Custom Overrides",children:e("div",{class:"py-1",children:Object.entries(u).map(([t,c])=>t.startsWith("--color-")&&!$(t.slice(8))?e(H,{cssVar:t,isCustom:!0,value:c},t):e(z,{cssVar:t,isCustom:!0,value:c},t))})}),w.length>0&&e(x,{count:w.length,title:"Semantic Colors",children:e("div",{class:"py-1",children:w.map(([t,c])=>e(H,{cssVar:t,isCustom:t in u,value:c},t))})}),y.size>0&&s(x,{count:y.size,defaultOpen:!1,title:"Color Palette",children:[e("div",{class:"px-3 pt-2 pb-1 border-b border-border/20",children:e("input",{class:"w-full bg-foreground/4 border border-border/40 px-2 py-1 text-[0.68rem] font-mono text-foreground placeholder:text-muted-foreground/40 outline-none focus:border-primary/40",onInput:p(t=>{m(t.target.value)},"onInput"),placeholder:"Filter scales…",type:"text",value:a})}),s("div",{class:"py-1 divide-y divide-border/20",children:[f.map(([t,c])=>e(he,{name:t,tokens:c},t)),f.length===0&&e("p",{class:"text-center text-[0.7rem] text-muted-foreground/50 py-4",children:"No colors match"})]})]}),V.length>0&&e(x,{count:V.length,defaultOpen:!1,title:"Spacing",children:e("div",{class:"p-3 space-y-1",children:V.map(([t,c])=>{const k=g(c),T=F>0?Math.max(k/F*100,1):1;return s("div",{class:"flex items-center gap-2.5",children:[e("span",{class:"text-[0.62rem] font-mono text-muted-foreground/70 w-10 shrink-0 text-right",children:t.slice(10)}),e("div",{class:"flex-1 h-3 bg-foreground/5 border border-border/30 overflow-hidden",children:e("div",{class:"h-full bg-primary/30 border-r border-primary/40",style:{width:`${T}%`}})}),e("code",{class:"text-[0.62rem] font-mono text-muted-foreground/60 w-14 text-right shrink-0",children:c})]},t)})})}),I.length>0&&e(x,{count:I.length,defaultOpen:!1,title:"Breakpoints",children:e("div",{class:"p-3 space-y-1.5",children:I.map(([t,c])=>e(z,{cssVar:t,isCustom:t in u,value:c},t))})}),P.length>0&&e(x,{count:P.length,defaultOpen:!1,title:"Font Families",children:e("div",{class:"p-3 space-y-2",children:P.map(([t,c])=>s("div",{class:"space-y-0.5",children:[e("code",{class:"text-[0.68rem] font-mono text-foreground",children:t.slice(7)}),e("p",{class:"text-[0.75rem] text-foreground/70 truncate",style:{fontFamily:c.startsWith("--theme(")?"inherit":c},children:"The quick brown fox"}),e("code",{class:"block text-[0.58rem] font-mono text-muted-foreground/50 truncate",children:c})]},t))})}),M.length>0&&e(x,{count:M.length,defaultOpen:!1,title:"Font Sizes",children:e("div",{class:"p-3 space-y-1.5",children:M.map(([t,c])=>{const k=Math.min(g(c)||14,48);return s("div",{class:"flex items-center gap-3",children:[e("span",{class:"text-[0.6rem] font-mono text-muted-foreground/60 w-12 shrink-0 text-right",children:t.slice(7)}),e("span",{class:"text-foreground leading-none truncate flex-1",style:{fontSize:`${k}px`},children:"Ag"}),e("code",{class:"text-[0.62rem] font-mono text-muted-foreground/60 shrink-0",children:c})]},t)})})}),D.length>0&&e(x,{count:D.length,defaultOpen:!1,title:"Border Radius",children:e("div",{class:"p-3 flex flex-wrap gap-3",children:D.map(([t,c])=>s("div",{class:"flex flex-col items-center gap-1.5",children:[e("div",{class:"size-10 border-2 border-primary/40 bg-primary/8",style:{borderRadius:c.startsWith("--theme(")?"4px":c}}),e("code",{class:"text-[0.6rem] font-mono text-muted-foreground/70",children:t.slice(9)}),e("code",{class:"text-[0.58rem] font-mono text-muted-foreground/50",children:c})]},t))})}),A.length>0&&e(x,{count:A.length,defaultOpen:!1,title:"Shadows",children:e("div",{class:"p-3 space-y-3",children:A.map(([t,c])=>s("div",{class:"space-y-1",children:[e("code",{class:"text-[0.68rem] font-mono text-foreground",children:t.slice(2)}),!c.startsWith("--theme(")&&e("div",{class:"h-8 bg-card border border-border/40",style:{boxShadow:c}}),e("code",{class:"block text-[0.58rem] font-mono text-muted-foreground/50 truncate",children:c})]},t))})}),B.length>0&&e(x,{count:B.length,defaultOpen:!1,title:"Blur",children:e("div",{class:"py-1",children:B.map(([t,c])=>e(z,{cssVar:t,isCustom:t in u,value:c},t))})}),E.length>0&&e(x,{count:E.length,defaultOpen:!1,title:"Animations",children:e("div",{class:"py-1",children:E.map(([t,c])=>e(z,{cssVar:t,isCustom:t in u,value:c},t))})}),L.length>0&&e(x,{count:L.length,defaultOpen:!1,title:"Other",children:e("div",{class:"py-1",children:L.map(([t,c])=>e(z,{cssVar:t,isCustom:t in u,value:c},t))})})]})},"ConfigTab"),ge=p(()=>s("div",{class:"flex flex-col items-center justify-center h-full gap-4 py-16 px-8 text-center select-none",children:[e("div",{class:"size-12 border border-primary/20 bg-primary/5 flex items-center justify-center text-primary/30 text-2xl",children:"◻"}),s("div",{class:"space-y-1.5",children:[e("p",{class:"text-[0.8rem] font-medium text-foreground/70",children:"No design tokens detected"}),s("p",{class:"text-[0.7rem] text-muted-foreground leading-relaxed max-w-[240px]",children:["This app reads CSS custom properties from your page's ",e("code",{class:"font-mono text-[0.65rem]",children:":root"})," selector. Make sure your app uses Tailwind CSS v4 or defines custom properties."]})]})]}),"EmptyState"),be=p(({helpers:r})=>{const[n,o]=b(C("colors"),"tab"),[l,a]=b(C(void 0),"configData"),[m,h]=b(C(!1),"configLoading"),[u,v]=b(C(void 0),"configError"),d=b(G(void 0),"tokensRef");if(!d.current){const f=le();d.current=ce(f)}const i=d.current,j=p(()=>{h(!0),v(void 0),r.rpc.getTailwindConfig().then(f=>(a(f),h(!1),f)).catch(f=>{v(f.message??"Failed to load Tailwind config"),h(!1)})},"loadConfig");Z(()=>{n==="config"&&!l&&!m&&!u&&j()},[n]);const w=i.colors.length+i.spacing.length+i.fontSizes.length+i.radii.length,R={colors:i.colors.length,config:l?Object.keys(l.defaultTheme).length+Object.keys(l.customTheme).length:0,effects:i.radii.length+i.shadows.length,spacing:i.spacing.length,type:i.fontSizes.length+i.fontFamilies.length},y=[{id:"colors",label:"Colors"},{id:"spacing",label:"Spacing"},{id:"type",label:"Type"},{id:"effects",label:"Effects"},{id:"config",label:"Config"}];return s("div",{class:"flex flex-col h-full",children:[s("div",{class:"flex items-center justify-between gap-3 px-4 py-3 border-b border-border shrink-0",children:[e("span",{class:"text-[0.75rem] font-medium text-foreground",children:"Design Tokens"}),w>0&&s("span",{class:"text-[0.65rem] font-mono text-muted-foreground/60 bg-foreground/5 px-2 py-0.5 border border-border/40",children:[w," page tokens"]})]}),w===0&&n!=="config"?e(ge,{}):s(ee,{children:[e("div",{class:"flex border-b border-border shrink-0 overflow-x-auto",children:y.map(({id:f,label:V})=>s("button",{class:S("flex-shrink-0 px-3 py-2 text-[0.68rem] font-medium transition-colors cursor-pointer border-0 border-b-2 -mb-px",n===f?"text-primary border-primary bg-primary/4":"text-muted-foreground hover:text-foreground border-transparent bg-transparent"),onClick:p(()=>{o(f)},"onClick"),type:"button",children:[V,R[f]>0&&e("span",{class:S("ml-1.5 text-[0.58rem] font-mono",n===f?"text-primary/70":"text-muted-foreground/50"),children:R[f]})]},f))}),s("div",{class:"flex-1 overflow-auto devtools-content-scroll",children:[n==="colors"&&e(pe,{colors:i.colors}),n==="spacing"&&e(me,{spacing:i.spacing}),n==="type"&&e(ue,{fontFamilies:i.fontFamilies,fontSizes:i.fontSizes}),n==="effects"&&e(fe,{radii:i.radii,shadows:i.shadows}),n==="config"&&e(xe,{configData:l,error:u,loading:m,onRetry:j})]})]})]})},"TailwindApp"),ye=`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 54 33">
|
|
3
|
+
Click to copy ${a.cssVar}`,type:"button"},a.cssVar))})]}),r&&e("span",{class:"text-[0.6rem] font-mono text-primary/70 pl-[72px]",children:"copied!"})]})},ce=({colors:s})=>{const{scales:o,semantic:r}=g(H(()=>oe(s),[s]),"scales");return s.length===0?n("div",{class:"flex flex-col items-center justify-center py-16 gap-3 text-center px-6",children:[e("span",{class:"text-3xl text-muted-foreground/20",children:"◫"}),e("p",{class:"text-[0.75rem] text-muted-foreground/60",children:"No color tokens found"}),n("p",{class:"text-[0.65rem] text-muted-foreground/40 leading-relaxed",children:["Color tokens are read from ",e("code",{class:"font-mono",children:"--color-*"})," CSS variables on ",e("code",{class:"font-mono",children:":root"})]})]}):n("div",{children:[r.length>0&&n("div",{class:"border-b border-border/40",children:[e(W,{count:r.length,title:"Semantic"}),e("div",{class:"py-1",children:r.map(l=>e(ne,{token:l},l.cssVar))})]}),o.size>0&&n("div",{children:[e(W,{count:o.size,title:"Palette"}),e("div",{class:"py-1 divide-y divide-border/20",children:Array.from(o.entries(),([l,a])=>e(le,{name:l,tokens:a},l))})]})]})},ie=({spacing:s})=>{const o=g(H(()=>Math.max(...s.map(r=>r.numericPx),1),[s]),"maxPx");return s.length===0?n("div",{class:"flex flex-col items-center justify-center py-16 gap-3 text-center px-6",children:[e("span",{class:"text-3xl text-muted-foreground/20",children:"↔"}),e("p",{class:"text-[0.75rem] text-muted-foreground/60",children:"No spacing tokens found"}),n("p",{class:"text-[0.65rem] text-muted-foreground/40 leading-relaxed",children:["Spacing tokens are read from ",e("code",{class:"font-mono",children:"--spacing-*"})," CSS variables"]})]}):e("div",{class:"p-3 space-y-1",children:s.map(r=>{const l=o>0?Math.max(r.numericPx/o*100,2):2;return n("div",{class:"flex items-center gap-2.5",children:[e("span",{class:"text-[0.62rem] font-mono text-muted-foreground/70 w-8 shrink-0 text-right",children:r.name}),e("div",{class:"flex-1 flex items-center gap-1.5",children:e("div",{class:"flex-1 h-3.5 bg-foreground/5 border border-border/30 overflow-hidden",children:e("div",{class:"h-full bg-primary/30 border-r border-primary/40",style:{width:`${l}%`}})})}),e("code",{class:"text-[0.62rem] font-mono text-muted-foreground/60 w-14 text-right shrink-0",children:r.value})]},r.cssVar)})})},ae=({fontFamilies:s,fontSizes:o})=>o.length===0&&s.length===0?n("div",{class:"flex flex-col items-center justify-center py-16 gap-3 text-center px-6",children:[e("span",{class:"text-3xl text-muted-foreground/20",children:"Aa"}),e("p",{class:"text-[0.75rem] text-muted-foreground/60",children:"No typography tokens found"}),n("p",{class:"text-[0.65rem] text-muted-foreground/40 leading-relaxed",children:["Font size tokens are read from ",e("code",{class:"font-mono",children:"--text-*"})," and font family tokens from ",e("code",{class:"font-mono",children:"--font-*"})]})]}):n("div",{children:[o.length>0&&n("div",{class:"border-b border-border/40",children:[e(W,{count:o.length,title:"Font Sizes"}),e("div",{class:"p-3 space-y-1.5",children:o.map(r=>{const l=Math.min(r.sizePx||14,48);return n("div",{class:"flex items-center gap-3",children:[e("span",{class:"text-[0.6rem] font-mono text-muted-foreground/60 w-10 shrink-0 text-right",children:r.name}),e("span",{class:"text-foreground leading-none truncate flex-1",style:{fontSize:`${l}px`},children:"Ag"}),e("code",{class:"text-[0.62rem] font-mono text-muted-foreground/60 shrink-0",children:r.value})]},r.cssVar)})})]}),s.length>0&&n("div",{children:[e(W,{count:s.length,title:"Font Families"}),e("div",{class:"p-3 space-y-2",children:s.map(r=>n("div",{class:"space-y-0.5",children:[e("div",{class:"flex items-center justify-between gap-2",children:e("code",{class:"text-[0.68rem] font-mono text-foreground",children:r.name})}),e("p",{class:"text-[0.75rem] text-foreground/70 truncate",style:{fontFamily:`var(${r.cssVar})`},children:"The quick brown fox"}),e("code",{class:"block text-[0.58rem] font-mono text-muted-foreground/50 truncate",children:r.value})]},r.cssVar))})]})]}),de=({radii:s,shadows:o})=>s.length===0&&o.length===0?n("div",{class:"flex flex-col items-center justify-center py-16 gap-3 text-center px-6",children:[e("span",{class:"text-3xl text-muted-foreground/20",children:"◻"}),e("p",{class:"text-[0.75rem] text-muted-foreground/60",children:"No effect tokens found"}),n("p",{class:"text-[0.65rem] text-muted-foreground/40 leading-relaxed",children:["Radius tokens from ",e("code",{class:"font-mono",children:"--radius-*"})," and shadow tokens from ",e("code",{class:"font-mono",children:"--shadow-*"})]})]}):n("div",{children:[s.length>0&&n("div",{class:"border-b border-border/40",children:[e(W,{count:s.length,title:"Border Radius"}),e("div",{class:"p-3 flex flex-wrap gap-3",children:s.map(r=>n("div",{class:"flex flex-col items-center gap-1.5",children:[e("div",{class:"size-10 border-2 border-primary/40 bg-primary/8",style:{borderRadius:`var(${r.cssVar})`}}),e("code",{class:"text-[0.6rem] font-mono text-muted-foreground/70",children:r.name}),e("code",{class:"text-[0.58rem] font-mono text-muted-foreground/50",children:r.value})]},r.cssVar))})]}),o.length>0&&n("div",{children:[e(W,{count:o.length,title:"Shadows"}),e("div",{class:"p-3 space-y-3",children:o.map(r=>n("div",{class:"space-y-1.5",children:[e("div",{class:"flex items-center justify-between gap-2",children:e("code",{class:"text-[0.68rem] font-mono text-foreground",children:r.name})}),e("div",{class:"h-10 bg-card border border-border/40",style:{boxShadow:`var(${r.cssVar})`}}),e("code",{class:"block text-[0.58rem] font-mono text-muted-foreground/50 truncate",children:r.value})]},r.cssVar))})]})]}),pe=({name:s,tokens:o})=>{const{copied:r,copy:l}=O();return n("div",{class:"px-3 py-2",children:[n("div",{class:"flex items-center gap-2 mb-1",children:[e("span",{class:"text-[0.65rem] font-mono text-muted-foreground/70 w-16 shrink-0",children:s}),e("div",{class:"flex flex-1 gap-px overflow-hidden",children:o.map(([a,p])=>e("button",{class:"flex-1 h-5 border-0 cursor-pointer transition-transform hover:scale-110 hover:z-10",onClick:()=>{l(a)},style:{background:p},title:`${a}
|
|
4
|
+
${p}
|
|
5
|
+
Click to copy`,type:"button"},a))})]}),r&&e("span",{class:"text-[0.6rem] font-mono text-primary/70 pl-[72px]",children:"copied!"})]})},E=({cssVar:s,isCustom:o,value:r})=>{const{copied:l,copy:a}=O(),p=s.slice(8);return n("button",{class:"group flex items-center gap-2.5 w-full text-left hover:bg-foreground/4 px-3 py-1.5 transition-colors cursor-pointer bg-transparent border-0",onClick:()=>{a(s)},title:`Click to copy ${s}`,type:"button",children:[e("span",{class:"shrink-0 size-5 border border-black/10",style:{background:r}}),n("span",{class:"flex-1 min-w-0",children:[n("span",{class:"flex items-center gap-1.5",children:[e("span",{class:"text-[0.68rem] font-mono text-foreground truncate",children:p}),o&&e("span",{class:"text-[0.55rem] font-bold uppercase tracking-wide text-primary/70 bg-primary/10 px-1",children:"custom"})]}),e("span",{class:"block text-[0.6rem] font-mono text-muted-foreground/60 truncate",children:r})]}),e("span",{class:C("text-[0.6rem] font-mono shrink-0 transition-opacity",l?"text-primary opacity-100":"text-muted-foreground/40 opacity-0 group-hover:opacity-100"),children:l?"copied!":"copy"})]})},f=({children:s,count:o,defaultOpen:r=!0,title:l})=>{const[a,p]=g(w(r),"open");return n("div",{class:"border-b border-border/40",children:[n("button",{class:"w-full flex items-center gap-2 px-3 py-1.5 bg-foreground/3 hover:bg-foreground/5 transition-colors cursor-pointer border-0 text-left",onClick:()=>{p(h=>!h)},type:"button",children:[n("span",{class:"text-[0.58rem] font-bold uppercase tracking-[0.12em] text-muted-foreground/70 flex-1",children:[e("span",{class:"text-primary/50",children:"// "}),l]}),e("span",{class:"text-[0.58rem] font-mono text-muted-foreground/50",children:o}),e("span",{class:C("text-muted-foreground/40 text-[0.6rem] transition-transform duration-150 ml-1",a&&"rotate-90"),children:"▶"})]}),a&&s]})},z=({cssVar:s,isCustom:o,value:r})=>{const{copied:l,copy:a}=O(),p=s.replace(U,"");return n("button",{class:"group flex items-center gap-2.5 w-full text-left hover:bg-foreground/4 px-3 py-1.5 transition-colors cursor-pointer bg-transparent border-0",onClick:()=>{a(s)},type:"button",children:[e("span",{class:"flex-1 min-w-0",children:n("span",{class:"flex items-center gap-1.5",children:[e("code",{class:"text-[0.68rem] font-mono text-foreground truncate",children:p}),o&&e("span",{class:"text-[0.55rem] font-bold uppercase tracking-wide text-primary/70 bg-primary/10 px-1 shrink-0",children:"custom"})]})}),e("code",{class:"text-[0.62rem] font-mono text-muted-foreground/60 truncate max-w-[160px] shrink-0",children:r}),e("span",{class:C("text-[0.6rem] font-mono shrink-0 transition-opacity w-8 text-right",l?"text-primary opacity-100":"text-muted-foreground/40 opacity-0 group-hover:opacity-100"),children:l?"✓":"copy"})]})},ue=({configData:s,error:o,loading:r,onRetry:l})=>{const[a,p]=g(w(""),"colorSearch");if(r)return n("div",{class:"flex flex-col items-center justify-center h-full gap-3 p-8 select-none",children:[e("div",{"aria-hidden":"true",class:"flex gap-1.5 items-center",children:[0,160,320].map(t=>e("span",{class:"size-1.5 bg-primary/50 rounded-full animate-pulse",style:{animationDelay:`${t}ms`}},t))}),e("span",{class:"text-[0.75rem] text-muted-foreground",children:"Loading Tailwind config…"})]});if(o||!s)return n("div",{class:"flex flex-col items-center justify-center h-full gap-3 p-8 text-center",children:[e("p",{class:"text-[0.8rem] text-destructive",children:o??"No config available"}),e("button",{class:"px-3 py-1.5 text-[0.75rem] border border-border text-muted-foreground hover:text-foreground cursor-pointer bg-transparent",onClick:l,type:"button",children:"Retry"})]});const{cssFiles:h,customTheme:u,defaultTheme:y,version:d}=s,i={...y,...u},j=Object.entries(i).filter(([t])=>t.startsWith("--color-")),k=j.filter(([t])=>!$(t.slice(8))),F=j.filter(([t])=>$(t.slice(8))),b=new Map;for(const[t,c]of F){const v=t.slice(8).replace(G,""),V=b.get(v)??[];V.push([t,c]),b.set(v,V)}for(const[t,c]of b)b.set(t,c.toSorted((v,V)=>{const Y=Number.parseInt(v[0].match(R)?.[1]??"0",10),Z=Number.parseInt(V[0].match(R)?.[1]??"0",10);return Y-Z}));const m=a?[...b.entries()].filter(([t])=>t.toLowerCase().includes(a.toLowerCase())):[...b.entries()],S=Object.entries(i).filter(([t])=>t.startsWith("--spacing-")).toSorted(([,t],[,c])=>x(t)-x(c)),N=Object.entries(i).filter(([t])=>t.startsWith("--font-")),M=Object.entries(i).filter(([t])=>t.startsWith("--text-")&&!t.includes("--line-height")&&!t.endsWith("--font-weight")).toSorted(([,t],[,c])=>x(t)-x(c)),P=Object.entries(i).filter(([t])=>t.startsWith("--breakpoint-")).toSorted(([,t],[,c])=>x(t)-x(c)),B=Object.entries(i).filter(([t])=>t.startsWith("--radius-")),D=Object.entries(i).filter(([t])=>t.startsWith("--shadow-")||t.startsWith("--drop-shadow-")),A=Object.entries(i).filter(([t])=>t.startsWith("--blur-")),I=Object.entries(i).filter(([t])=>t.startsWith("--animate-")),X=["--color-","--spacing-","--font-","--text-","--breakpoint-","--radius-","--shadow-","--drop-shadow-","--blur-","--animate-","--tw-","--brand-"],L=Object.entries(i).filter(([t])=>!X.some(c=>t.startsWith(c)));let T=1;for(const[,t]of S)T=Math.max(T,x(t));return n("div",{children:[n("div",{class:"flex items-center gap-2 px-3 py-2 border-b border-border/40 bg-foreground/2 shrink-0",children:[e("span",{class:C("text-[0.6rem] font-bold uppercase tracking-wide px-1.5 py-0.5 shrink-0",d==="v4"&&"bg-cyan-500/10 text-cyan-600 dark:text-cyan-400 border border-cyan-500/20",d==="v3"&&"bg-primary/10 text-primary border border-primary/20",d==="unknown"&&"bg-foreground/8 text-muted-foreground border border-border"),children:d==="unknown"?"Tailwind":`Tailwind ${d}`}),h.length>0&&n("code",{class:"text-[0.62rem] font-mono text-muted-foreground/70 truncate flex-1",children:[h[0],h.length>1&&n("span",{class:"text-muted-foreground/40",children:[" +",h.length-1]})]}),n("span",{class:"text-[0.6rem] font-mono text-muted-foreground/50 shrink-0",children:[Object.keys(i).length," tokens"]})]}),Object.keys(u).length>0&&e(f,{count:Object.keys(u).length,title:"Custom Overrides",children:e("div",{class:"py-1",children:Object.entries(u).map(([t,c])=>t.startsWith("--color-")&&!$(t.slice(8))?e(E,{cssVar:t,isCustom:!0,value:c},t):e(z,{cssVar:t,isCustom:!0,value:c},t))})}),k.length>0&&e(f,{count:k.length,title:"Semantic Colors",children:e("div",{class:"py-1",children:k.map(([t,c])=>e(E,{cssVar:t,isCustom:t in u,value:c},t))})}),b.size>0&&n(f,{count:b.size,defaultOpen:!1,title:"Color Palette",children:[e("div",{class:"px-3 pt-2 pb-1 border-b border-border/20",children:e("input",{class:"w-full bg-foreground/4 border border-border/40 px-2 py-1 text-[0.68rem] font-mono text-foreground placeholder:text-muted-foreground/40 outline-none focus:border-primary/40",onInput:t=>{p(t.target.value)},placeholder:"Filter scales…",type:"text",value:a})}),n("div",{class:"py-1 divide-y divide-border/20",children:[m.map(([t,c])=>e(pe,{name:t,tokens:c},t)),m.length===0&&e("p",{class:"text-center text-[0.7rem] text-muted-foreground/50 py-4",children:"No colors match"})]})]}),S.length>0&&e(f,{count:S.length,defaultOpen:!1,title:"Spacing",children:e("div",{class:"p-3 space-y-1",children:S.map(([t,c])=>{const v=x(c),V=T>0?Math.max(v/T*100,1):1;return n("div",{class:"flex items-center gap-2.5",children:[e("span",{class:"text-[0.62rem] font-mono text-muted-foreground/70 w-10 shrink-0 text-right",children:t.slice(10)}),e("div",{class:"flex-1 h-3 bg-foreground/5 border border-border/30 overflow-hidden",children:e("div",{class:"h-full bg-primary/30 border-r border-primary/40",style:{width:`${V}%`}})}),e("code",{class:"text-[0.62rem] font-mono text-muted-foreground/60 w-14 text-right shrink-0",children:c})]},t)})})}),P.length>0&&e(f,{count:P.length,defaultOpen:!1,title:"Breakpoints",children:e("div",{class:"p-3 space-y-1.5",children:P.map(([t,c])=>e(z,{cssVar:t,isCustom:t in u,value:c},t))})}),N.length>0&&e(f,{count:N.length,defaultOpen:!1,title:"Font Families",children:e("div",{class:"p-3 space-y-2",children:N.map(([t,c])=>n("div",{class:"space-y-0.5",children:[e("code",{class:"text-[0.68rem] font-mono text-foreground",children:t.slice(7)}),e("p",{class:"text-[0.75rem] text-foreground/70 truncate",style:{fontFamily:c.startsWith("--theme(")?"inherit":c},children:"The quick brown fox"}),e("code",{class:"block text-[0.58rem] font-mono text-muted-foreground/50 truncate",children:c})]},t))})}),M.length>0&&e(f,{count:M.length,defaultOpen:!1,title:"Font Sizes",children:e("div",{class:"p-3 space-y-1.5",children:M.map(([t,c])=>{const v=Math.min(x(c)||14,48);return n("div",{class:"flex items-center gap-3",children:[e("span",{class:"text-[0.6rem] font-mono text-muted-foreground/60 w-12 shrink-0 text-right",children:t.slice(7)}),e("span",{class:"text-foreground leading-none truncate flex-1",style:{fontSize:`${v}px`},children:"Ag"}),e("code",{class:"text-[0.62rem] font-mono text-muted-foreground/60 shrink-0",children:c})]},t)})})}),B.length>0&&e(f,{count:B.length,defaultOpen:!1,title:"Border Radius",children:e("div",{class:"p-3 flex flex-wrap gap-3",children:B.map(([t,c])=>n("div",{class:"flex flex-col items-center gap-1.5",children:[e("div",{class:"size-10 border-2 border-primary/40 bg-primary/8",style:{borderRadius:c.startsWith("--theme(")?"4px":c}}),e("code",{class:"text-[0.6rem] font-mono text-muted-foreground/70",children:t.slice(9)}),e("code",{class:"text-[0.58rem] font-mono text-muted-foreground/50",children:c})]},t))})}),D.length>0&&e(f,{count:D.length,defaultOpen:!1,title:"Shadows",children:e("div",{class:"p-3 space-y-3",children:D.map(([t,c])=>n("div",{class:"space-y-1",children:[e("code",{class:"text-[0.68rem] font-mono text-foreground",children:t.slice(2)}),!c.startsWith("--theme(")&&e("div",{class:"h-8 bg-card border border-border/40",style:{boxShadow:c}}),e("code",{class:"block text-[0.58rem] font-mono text-muted-foreground/50 truncate",children:c})]},t))})}),A.length>0&&e(f,{count:A.length,defaultOpen:!1,title:"Blur",children:e("div",{class:"py-1",children:A.map(([t,c])=>e(z,{cssVar:t,isCustom:t in u,value:c},t))})}),I.length>0&&e(f,{count:I.length,defaultOpen:!1,title:"Animations",children:e("div",{class:"py-1",children:I.map(([t,c])=>e(z,{cssVar:t,isCustom:t in u,value:c},t))})}),L.length>0&&e(f,{count:L.length,defaultOpen:!1,title:"Other",children:e("div",{class:"py-1",children:L.map(([t,c])=>e(z,{cssVar:t,isCustom:t in u,value:c},t))})})]})},me=()=>n("div",{class:"flex flex-col items-center justify-center h-full gap-4 py-16 px-8 text-center select-none",children:[e("div",{class:"size-12 border border-primary/20 bg-primary/5 flex items-center justify-center text-primary/30 text-2xl",children:"◻"}),n("div",{class:"space-y-1.5",children:[e("p",{class:"text-[0.8rem] font-medium text-foreground/70",children:"No design tokens detected"}),n("p",{class:"text-[0.7rem] text-muted-foreground leading-relaxed max-w-[240px]",children:["This app reads CSS custom properties from your page's ",e("code",{class:"font-mono text-[0.65rem]",children:":root"})," selector. Make sure your app uses Tailwind CSS v4 or defines custom properties."]})]})]}),he=({helpers:s})=>{const[o,r]=g(w("colors"),"tab"),[l,a]=g(w(void 0),"configData"),[p,h]=g(w(!1),"configLoading"),[u,y]=g(w(void 0),"configError"),d=g(q(void 0),"tokensRef");if(!d.current){const m=re();d.current=se(m)}const i=d.current,j=()=>{h(!0),y(void 0),s.rpc.getTailwindConfig().then(m=>(a(m),h(!1),m)).catch(m=>{y(m.message??"Failed to load Tailwind config"),h(!1)})};_(()=>{o==="config"&&!l&&!p&&!u&&j()},[o]);const k=i.colors.length+i.spacing.length+i.fontSizes.length+i.radii.length,F={colors:i.colors.length,config:l?Object.keys(l.defaultTheme).length+Object.keys(l.customTheme).length:0,effects:i.radii.length+i.shadows.length,spacing:i.spacing.length,type:i.fontSizes.length+i.fontFamilies.length},b=[{id:"colors",label:"Colors"},{id:"spacing",label:"Spacing"},{id:"type",label:"Type"},{id:"effects",label:"Effects"},{id:"config",label:"Config"}];return n("div",{class:"flex flex-col h-full",children:[n("div",{class:"flex items-center justify-between gap-3 px-4 py-3 border-b border-border shrink-0",children:[e("span",{class:"text-[0.75rem] font-medium text-foreground",children:"Design Tokens"}),k>0&&n("span",{class:"text-[0.65rem] font-mono text-muted-foreground/60 bg-foreground/5 px-2 py-0.5 border border-border/40",children:[k," page tokens"]})]}),k===0&&o!=="config"?e(me,{}):n(K,{children:[e("div",{class:"flex border-b border-border shrink-0 overflow-x-auto",children:b.map(({id:m,label:S})=>n("button",{class:C("flex-shrink-0 px-3 py-2 text-[0.68rem] font-medium transition-colors cursor-pointer border-0 border-b-2 -mb-px",o===m?"text-primary border-primary bg-primary/4":"text-muted-foreground hover:text-foreground border-transparent bg-transparent"),onClick:()=>{r(m)},type:"button",children:[S,F[m]>0&&e("span",{class:C("ml-1.5 text-[0.58rem] font-mono",o===m?"text-primary/70":"text-muted-foreground/50"),children:F[m]})]},m))}),n("div",{class:"flex-1 overflow-auto devtools-content-scroll",children:[o==="colors"&&e(ce,{colors:i.colors}),o==="spacing"&&e(ie,{spacing:i.spacing}),o==="type"&&e(ae,{fontFamilies:i.fontFamilies,fontSizes:i.fontSizes}),o==="effects"&&e(de,{radii:i.radii,shadows:i.shadows}),o==="config"&&e(ue,{configData:l,error:u,loading:p,onRetry:j})]})]})]})},fe=`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 54 33">
|
|
6
6
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M27 0c-7.2 0-11.7 3.6-13.5 10.8 2.7-3.6 5.85-4.95 9.45-4.05 2.054.513 3.522 2.004 5.147 3.653C30.744 13.09 33.808 16.2 40.5 16.2c7.2 0 11.7-3.6 13.5-10.8-2.7 3.6-5.85 4.95-9.45 4.05-2.054-.513-3.522-2.004-5.147-3.653C36.756 3.11 33.692 0 27 0zM13.5 16.2C6.3 16.2 1.8 19.8 0 27c2.7-3.6 5.85-4.95 9.45-4.05 2.054.514 3.522 2.004 5.147 3.653C17.244 29.29 20.308 32.4 27 32.4c7.2 0 11.7-3.6 13.5-10.8-2.7 3.6-5.85 4.95-9.45 4.05-2.054-.513-3.522-2.004-5.147-3.653C23.256 19.31 20.192 16.2 13.5 16.2z" fill="#06B6D4"/>
|
|
7
|
-
</svg>`,
|
|
7
|
+
</svg>`,ve={component:he,icon:fe,id:"dev-toolbar:tailwind",name:"Design Tokens"};export{ve as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import{u as w,D as _}from"../../packem_shared/store-Dqy0FbGw.js";import{addHookName as g}from"preact/devtools";import{clsx as y}from"../../packem_shared/clsx-CtZWcPHt.js";import{useState as b,useRef as M,useEffect as R}from"preact/hooks";import{jsxs as l,jsx as r}from"preact/jsx-runtime";import T from"../../packem_shared/Button-CAKvtfij.js";import U from"../../packem_shared/Badge-PpblpNWg.js";const z=`<!-- @license lucide-static v1.23.0 - ISC -->
|
|
2
2
|
<svg
|
|
3
3
|
class="lucide lucide-gantt-chart"
|
|
4
4
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -15,4 +15,4 @@ var R=Object.defineProperty;var x=(e,t)=>R(e,"name",{value:t,configurable:!0});i
|
|
|
15
15
|
<path d="M4 12h10" />
|
|
16
16
|
<path d="M12 19h8" />
|
|
17
17
|
</svg>
|
|
18
|
-
|
|
18
|
+
`,E="__visulima_timeline_capture__",m=e=>`${e}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,7)}`,L=e=>e.startsWith("/@")||e.includes("/__vite")||e.includes("__visulima-dev-toolbar")||e.startsWith("data:")||e.startsWith("blob:"),I=()=>{if(globalThis[E])return;globalThis[E]=!0;const e=w();if(import.meta.hot&&(import.meta.hot.on("vite:beforeUpdate",o=>{const n=o,i=n.updates?.map(h=>h.path).join(", ")??"";e.addEvent("hmr",{data:{updates:n.updates},id:m("hmr"),level:"info",subtitle:i||void 0,time:Date.now(),title:"HMR Update"})}),import.meta.hot.on("vite:beforeFullReload",o=>{const n=o;e.addEvent("hmr",{id:m("hmr-reload"),level:"warning",subtitle:n.path??void 0,time:Date.now(),title:"Full Reload"})}),import.meta.hot.on("vite:error",o=>{const n=o,{err:i}=n;e.addEvent("errors",{data:i?{loc:i.loc,message:i.message,plugin:i.plugin,stack:i.stack}:void 0,id:m("vite-err"),level:"error",subtitle:i?.message??"Unknown error",time:Date.now(),title:"Vite Error"})})),globalThis.window!==void 0&&typeof globalThis.fetch=="function"){const o=globalThis.fetch.bind(globalThis);globalThis.fetch=async(...n)=>{const i=n[0],h=n[1],f=i instanceof URL?i.href:i.url,a=typeof i=="string"?i:f,d=(h?.method??(i instanceof Request?i.method:"GET")).toUpperCase();if(L(a))return o(...n);const c=Date.now();try{const s=await o(...n),v=Date.now()-c;return e.addEvent("network",{data:{method:d,status:s.status,statusText:s.statusText,url:a},duration:v,id:m("net"),level:s.ok?"info":"warning",subtitle:`${s.status} ${s.statusText}`,time:c,title:`${d} ${a}`}),s}catch(s){const v=Date.now()-c,p=s instanceof Error?s.message:"Network error";throw e.addEvent("network",{data:{error:p,method:d,url:a},duration:v,id:m("net-err"),level:"error",subtitle:p,time:c,title:`${d} ${a}`}),s}}}globalThis.window!==void 0&&(globalThis.addEventListener("error",o=>{o.filename?.includes("visulima-dev-toolbar")||e.addEvent("errors",{data:{colno:o.colno,filename:o.filename,lineno:o.lineno,message:o.message},id:m("err"),level:"error",subtitle:o.filename?`${o.filename}:${o.lineno}:${o.colno}`:void 0,time:Date.now(),title:o.message||"JavaScript Error"})}),globalThis.addEventListener("unhandledrejection",o=>{const{reason:n}=o,i=n instanceof Error?n.message:String(n??"Unhandled promise rejection");e.addEvent("errors",{data:{reason:String(n)},id:m("rej"),level:"error",subtitle:i,time:Date.now(),title:"Unhandled Promise Rejection"})}))},N=500,x="all",C=e=>new Date(e).toLocaleTimeString("en-US",{fractionalSecondDigits:3,hour:"2-digit",hour12:!1,minute:"2-digit",second:"2-digit"}),A={error:"destructive",info:"info",warning:"warning"},D=({level:e})=>{if(e)return r(U,{class:"text-[0.6rem] uppercase tracking-wider",variant:A[e]??"info",children:e})},F=({event:e,onClose:o})=>l("div",{class:"border-l border-border bg-background h-full flex flex-col min-w-0 w-80 shrink-0",children:[l("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:e.title}),r(T,{"aria-label":"Close detail",class:"h-5 w-5 shrink-0",onClick:o,size:"icon",variant:"ghost",children:"✕"})]}),l("div",{class:"flex-1 overflow-auto p-4 space-y-3",children:[l("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:C(e.time)})]}),e.subtitle&&l("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:e.subtitle})]}),e.duration!==void 0&&l("div",{class:"space-y-1",children:[r("div",{class:"text-[0.65rem] uppercase tracking-wider text-muted-foreground font-medium",children:"Duration"}),l("div",{class:"text-[0.8rem] font-mono text-foreground",children:[e.duration,"ms"]})]}),e.level&&l("div",{class:"space-y-1",children:[r("div",{class:"text-[0.65rem] uppercase tracking-wider text-muted-foreground font-medium",children:"Level"}),r(D,{level:e.level})]}),e.data&&Object.keys(e.data).length>0&&l("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(e.data,void 0,2)})]})]})]}),G=e=>{const[o,n]=g(b(x),"activeTab"),[i,h]=g(b([]),"groups"),[f,a]=g(b(void 0),"selectedEvent"),d=g(M(void 0),"intervalRef"),c=()=>{const t=w();h(t.getGroups().map(u=>({...u,events:[...u.events]})))};R(()=>(c(),d.current=setInterval(c,N),()=>{d.current!==void 0&&clearInterval(d.current)}),[]);const s=new Map(_.map(t=>[t.id,t.color])),v=[{color:void 0,id:x,label:"All"},...i.map(t=>({color:s.get(t.id)??t.color,id:t.id,label:t.label}))],p=o===x?i.flatMap(t=>t.events).toSorted((t,u)=>t.time-u.time):i.find(t=>t.id===o)?.events??[],$=()=>{w().clearAll(),a(void 0),c()};return l("div",{class:"flex flex-col h-full",children:[l("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:v.map(t=>l("button",{class:y("px-3 py-1.5 text-[0.75rem] font-medium whitespace-nowrap border-0 cursor-pointer transition-colors duration-150",o===t.id?"text-foreground border-b-2 border-primary bg-transparent":"text-muted-foreground bg-transparent hover:text-foreground"),onClick:()=>{n(t.id),a(void 0)},type:"button",children:[t.color&&r("span",{class:"inline-block size-2 rounded-full mr-1.5 align-middle",style:{backgroundColor:t.color}}),t.label]},t.id))}),r(T,{onClick:$,size:"sm",title:"Clear all events",variant:"outline",children:"Clear"})]}),l("div",{class:"flex flex-1 min-h-0 overflow-hidden",children:[r("div",{class:"flex-1 overflow-auto",children:p.length===0?l("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"})})}),l("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:p.map(t=>{const u=i.find(j=>j.events.some(S=>S.id===t.id)),k=s.get(u?.id??"")??u?.color;return l("button",{class:y("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",f?.id===t.id&&"bg-primary/6"),onClick:()=>{a(f?.id===t.id?void 0:t)},type:"button",children:[k&&r("span",{class:"mt-1 size-1.5 rounded-full shrink-0",style:{backgroundColor:k}}),l("div",{class:"flex-1 min-w-0",children:[l("div",{class:"flex items-center gap-2 flex-wrap",children:[r("span",{class:"text-[0.8rem] font-medium text-foreground truncate",children:t.title}),r(D,{level:t.level})]}),t.subtitle&&r("div",{class:"text-[0.725rem] text-muted-foreground truncate mt-0.5",children:t.subtitle})]}),r("span",{class:"text-[0.65rem] font-mono text-muted-foreground/70 shrink-0 mt-0.5",children:C(t.time)})]},t.id)})})}),f&&r(F,{event:f,onClose:()=>{a(void 0)}})]})]})};I();const V={component:G,icon:z,id:"dev-toolbar:timeline",name:"Timeline"};export{V as default};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { D as DevToolbarApp } from "../../packem_shared/app.d-SmKEDxsI.js";
|
|
2
|
+
import 'preact';
|
|
2
3
|
declare const viteConfigApp: DevToolbarApp;
|
|
3
|
-
export default
|
|
4
|
+
export { viteConfigApp as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import{addHookName as u}from"preact/devtools";import{clsx as h}from"../../packem_shared/clsx-CtZWcPHt.js";import{useState as p,useEffect as $,useRef as O}from"preact/hooks";import D from"../../packem_shared/Icon-0XYV-4AL.js";import{jsx as e,jsxs as l}from"preact/jsx-runtime";import w from"../../packem_shared/Badge-PpblpNWg.js";import j from"../../packem_shared/Button-CAKvtfij.js";import{Tabs as T,TabsList as P,TabsTrigger as L,TabsContent as v}from"../../packem_shared/Tabs-BdNFQd3c.js";import M from"../../packem_shared/Input-Dc1WiT01.js";import{Tooltip as V,TooltipTrigger as N,TooltipContent as B}from"../../packem_shared/Tooltip-DVeuszoY.js";const I=`<!-- @license lucide-static v1.23.0 - ISC -->
|
|
2
2
|
<svg
|
|
3
3
|
class="lucide lucide-zap"
|
|
4
4
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -13,4 +13,4 @@ var O=Object.defineProperty;var F=(t,e)=>O(t,"name",{value:e,configurable:!0});i
|
|
|
13
13
|
>
|
|
14
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
15
|
</svg>
|
|
16
|
-
`,A="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-eye%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%22M2.062%2012.348a1%201%200%200%201%200-.696%2010.75%2010.75%200%200%201%2019.876%200%201%201%200%200%201%200%20.696%2010.75%2010.75%200%200%201-19.876%200%22%20%2F%3E%20%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%223%22%20%2F%3E%20%3C%2Fsvg%3E",T="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-eye-off%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%22M10.733%205.076a10.744%2010.744%200%200%201%2011.205%206.575%201%201%200%200%201%200%20.696%2010.747%2010.747%200%200%201-1.444%202.49%22%20%2F%3E%20%3Cpath%20d%3D%22M14.084%2014.158a3%203%200%200%201-4.242-4.242%22%20%2F%3E%20%3Cpath%20d%3D%22M17.479%2017.499a10.75%2010.75%200%200%201-15.417-5.151%201%201%200%200%201%200-.696%2010.75%2010.75%200%200%201%204.446-5.143%22%20%2F%3E%20%3Cpath%20d%3D%22m2%202%2020%2020%22%20%2F%3E%20%3C%2Fsvg%3E",W="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-search%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%22m21%2021-4.34-4.34%22%20%2F%3E%20%3Ccircle%20cx%3D%2211%22%20cy%3D%2211%22%20r%3D%228%22%20%2F%3E%20%3C%2Fsvg%3E";var q=Object.defineProperty,a=F((t,e)=>q(t,"name",{value:e,configurable:!0}),"s");const d=a(({children:t,title:e})=>l("section",{class:"space-y-1.5",children:[e&&l("h3",{class:"text-xxs font-bold uppercase tracking-widest text-muted-foreground px-1 flex items-center gap-1.5",children:[r("span",{"aria-hidden":"true",class:"text-primary opacity-50",children:"//"}),e]}),r("div",{class:"rounded-none border border-border bg-card divide-y divide-border overflow-hidden border-l-2 border-l-primary/20",children:t})]}),"Section"),C=a(({text:t})=>{const[e,n]=p(x(!1),"copied"),s=a(()=>{navigator.clipboard.writeText(t).then(()=>{n(!0),setTimeout(n,1500,!1)}).catch(()=>{})},"copy");return r("button",{class:m("inline-flex items-center px-1.5 py-0.5 text-xxs font-mono border transition-colors duration-150 cursor-pointer",e?"border-primary text-primary bg-card":"border-border text-muted-foreground hover:text-foreground hover:border-foreground bg-transparent"),onClick:s,title:"Copy to clipboard",type:"button",children:e?"copied":"copy"})},"CopyButton"),G=a(({value:t})=>l("span",{class:"inline-flex items-center gap-1.5",children:[r("span",{"aria-hidden":"true",class:m("inline-block size-1.5 rounded-full",t?"bg-success":"bg-border")}),r("span",{class:m("text-xs font-mono font-medium",t?"text-success":"text-muted-foreground"),children:t?"true":"false"})]}),"BoolValue"),U=a(({items:t})=>t.length===0?r("span",{class:"text-muted-foreground text-xs italic opacity-50",children:"empty"}):r("div",{class:"flex flex-wrap gap-1",children:t.map(e=>r("span",{class:"inline-flex items-center px-1.5 py-0.5 text-xxs font-mono font-medium bg-secondary border border-border text-secondary-foreground",children:e},e))}),"TagList"),z=a(({path:t})=>{const e=t.replaceAll("\\","/").split("/").filter(Boolean),n=e.length>3?`…/${e.slice(-3).join("/")}`:t;return r("code",{class:"text-xs font-mono text-foreground break-all leading-relaxed",title:t,children:n})},"ShortPath"),V=/^\/|^[A-Z]:\\/i,Z=a(({value:t})=>{if(t==null)return r("span",{class:"text-muted-foreground text-xs opacity-40",children:"—"});if(typeof t=="boolean")return r(G,{value:t});if(Array.isArray(t))return r(U,{items:t.map(String)});if(typeof t=="object"){const n=JSON.stringify(t,void 0,2);return l("div",{class:"flex items-start gap-2",children:[r("pre",{class:"text-xs font-mono text-foreground bg-secondary border border-border px-2 py-1 overflow-auto max-h-24 flex-1 leading-relaxed",children:n}),r(C,{text:n})]})}const e=String(t);return V.test(e)&&e.length>40?r(z,{path:e}):r("code",{class:"text-xs font-mono text-foreground break-all leading-relaxed",children:e})},"ValueCell"),o=a(({label:t,value:e})=>{if(e!=null)return l("div",{class:"grid grid-cols-2 gap-4 px-4 py-1.5 hover:bg-secondary transition-colors duration-100",children:[r("span",{class:"text-xs text-muted-foreground font-mono select-none self-center",children:t}),r("div",{class:"text-xs min-w-0 self-center",children:r(Z,{value:e})})]})},"KVRow"),Q=a(()=>l("div",{class:"flex flex-col items-center justify-center h-full gap-3 p-8 select-none",children:[r("div",{"aria-hidden":"true",class:"flex gap-1.5 items-center",children:[0,160,320].map(t=>r("span",{class:"size-1.5 bg-primary rounded-full animate-pulse opacity-50",style:{animationDelay:`${t}ms`}},t))}),r("span",{class:"text-xs text-muted-foreground",children:"Loading Vite config…"})]}),"LoadingState"),X=a(({error:t,onRetry:e})=>l("div",{class:"flex flex-col items-center justify-center h-full gap-3 p-8 text-center",children:[r("p",{class:"text-sm text-destructive",children:t}),r(R,{onClick:e,size:"sm",variant:"outline",children:"Retry"})]}),"ErrorState"),Y={post:"bg-blue-500/15 text-blue-400 border-blue-500/30",pre:"bg-amber-500/15 text-amber-400 border-amber-500/30"},_=a(({index:t,plugin:e})=>l("div",{class:"flex items-center gap-3 px-4 py-1.5 hover:bg-secondary transition-colors duration-100",children:[r("span",{class:"text-xxs text-muted-foreground font-mono tabular-nums w-5 shrink-0 text-right select-none opacity-40",children:t+1}),r("span",{class:"text-xs font-mono text-foreground flex-1 truncate",children:e.name}),e.enforce?r("span",{class:m("text-xxs font-mono font-bold px-1.5 py-0.5 border uppercase tracking-wide",Y[e.enforce]),children:e.enforce}):r("span",{class:"text-xxs font-mono text-muted-foreground px-1.5 py-0.5 bg-secondary border border-border",children:"normal"})]}),"PluginRow"),ee=a(({plugins:t})=>{const[e,n]=p(x(""),"query"),s=p($(null),"inputRef"),c=e?t.filter(i=>i.name.toLowerCase().includes(e.toLowerCase())):t;return l(d,{children:[l("div",{class:"flex items-center gap-2 px-4 py-1.5 bg-secondary border-b border-border",children:[r("span",{class:"text-xxs font-bold uppercase tracking-widest text-muted-foreground w-6 shrink-0",children:"#"}),l("div",{class:"flex-1 flex items-center gap-2",children:[r(k,{class:"text-muted-foreground shrink-0",size:11,src:W}),r(L,{class:"h-5 text-xs bg-transparent border-0 border-b border-border rounded-none px-0 py-0 focus-visible:ring-0 focus-visible:border-foreground placeholder:text-muted-foreground",onInput:a(i=>{n(i.target.value)},"onInput"),placeholder:`filter ${t.length} plugins…`,ref:s,type:"search",value:e})]}),r("span",{class:"text-xxs font-bold uppercase tracking-widest text-muted-foreground w-14 text-right",children:"Enforce"})]}),c.length===0?l("div",{class:"px-4 py-6 text-center text-xs text-muted-foreground",children:['No plugins match "',e,'"']}):c.map(i=>r(_,{index:t.indexOf(i),plugin:i},i.name)),e&&c.length>0&&r("div",{class:"px-4 py-1.5 bg-secondary border-t border-border text-right",children:l("span",{class:"text-xxs text-muted-foreground",children:[c.length," of ",t.length]})})]})},"PluginList"),E="text-xxs font-bold uppercase tracking-widest text-muted-foreground",S=a(({col1:t,col2:e,extra:n})=>l("div",{class:"grid grid-cols-2 gap-4 px-4 py-1.5 bg-secondary border-b border-border",children:[r("span",{class:E,children:t}),l("div",{class:"flex items-center justify-between gap-2",children:[r("span",{class:E,children:e}),n]})]}),"GridHead"),re=a(({alias:t})=>{if(!t)return;let e=[];if(Array.isArray(t)?e=t.filter(n=>n?.find!==void 0):typeof t=="object"&&t!==null&&(e=Object.entries(t).map(([n,s])=>({find:n,replacement:s}))),e.length!==0)return l(d,{title:"Alias",children:[r(S,{col1:"Find",col2:"Replacement"}),e.map(({find:n,replacement:s})=>l("div",{class:"grid grid-cols-2 gap-4 px-4 py-1.5 border-t border-border hover:bg-secondary transition-colors duration-100",children:[r("code",{class:"text-xs font-mono text-primary break-all leading-relaxed self-center",children:n}),r("div",{class:"self-center",children:V.test(s)&&s.length>40?r(z,{path:s}):r("code",{class:"text-xs font-mono text-foreground break-all leading-relaxed",children:s})})]},n??s))]})},"AliasTable"),te=new Set(["BASE_URL","DEV","MODE","PROD","SSR"]),le=36,oe=a(({forceVisible:t,tag:e,value:n})=>{const[s,c]=p(x(!1),"localRevealed"),i=t||s,f=i&&n.length>le,b=i?r("code",{class:"text-xs font-mono text-foreground truncate block",children:n}):r("span",{class:"text-xs font-mono text-muted-foreground tracking-widest select-none",children:"••••••••"});return l("div",{class:"flex items-center gap-2 w-full min-w-0",children:[r("span",{class:"flex-1 min-w-0 overflow-hidden",children:f?l(B,{children:[r(M,{class:"w-full block cursor-default",children:b}),r(I,{side:"top",children:r("code",{class:"text-xs font-mono break-all max-w-xs block",children:n})})]}):b}),e,r("button",{"aria-label":i?"Hide value":"Reveal value",class:"shrink-0 text-muted-foreground hover:text-foreground transition-colors duration-150 cursor-pointer p-0.5",onClick:a(()=>{c(g=>!g)},"onClick"),title:i?"Hide value":"Reveal value",type:"button",children:r(k,{size:11,src:i?T:A})}),r(C,{text:n})]})},"SecretValue"),ne=a(({entries:t})=>{const[e,n]=p(x(!1),"revealAll");return l(d,{title:"Environment Variables",children:[r(S,{col1:"Key",col2:"Value",extra:l("button",{class:"inline-flex items-center gap-1 text-xxs font-mono text-muted-foreground hover:text-foreground transition-colors duration-150 cursor-pointer",onClick:a(()=>{n(s=>!s)},"onClick"),type:"button",children:[r(k,{size:10,src:e?T:A}),e?"hide all":"reveal all"]})}),t.map(([s,c])=>{const i=te.has(s);return l("div",{class:"grid grid-cols-2 gap-4 px-4 py-1.5 border-t border-border hover:bg-secondary transition-colors duration-100",children:[r("code",{class:"text-xs font-mono text-primary truncate self-center",children:s}),r("div",{class:"self-center min-w-0",children:r(oe,{forceVisible:e,tag:r("span",{class:"text-xxs font-mono text-muted-foreground px-1 py-0.5 bg-secondary border border-border uppercase tracking-wide shrink-0 mr-5",children:i?"built-in":"user"}),value:c})})]},s)})]})},"EnvVariableTable"),se=a(({entries:t})=>{if(t.length!==0)return l(d,{title:"Define Constants",children:[r(S,{col1:"Identifier",col2:"Replacement"}),t.map(([e,n])=>l("div",{class:"grid grid-cols-2 gap-4 px-4 py-1.5 border-t border-border hover:bg-secondary transition-colors duration-100",children:[r("code",{class:"text-xs font-mono text-amber-400 break-all leading-relaxed self-center",children:e}),l("div",{class:"flex items-center gap-2 self-center min-w-0",children:[r("code",{class:"text-xs font-mono text-foreground break-all leading-relaxed flex-1",children:JSON.stringify(n)}),r(C,{text:`${e}=${JSON.stringify(n)}`})]})]},e))]})},"DefineTable"),ae=a(({helpers:t})=>{const[e,n]=p(x(void 0),"config"),[s,c]=p(x(void 0),"error"),[i,f]=p(x(!0),"loading"),b=a(()=>{f(!0),c(void 0),t.rpc.getViteConfig().then(u=>{n(u),f(!1)}).catch(u=>{c(u.message??"Failed to load Vite config"),f(!1)})},"load");if(P(()=>{b()},[]),i)return r(Q,{});if(s||!e)return r(X,{error:s??"No config available",onRetry:b});const g=e.plugins?.length??0,y=Object.keys(e.env??{}).length,j=Object.keys(e.define??{}).length;let w=0;return Array.isArray(e.resolve?.alias)?w=e.resolve.alias.length:typeof e.resolve?.alias=="object"&&e.resolve.alias!==null&&(w=Object.keys(e.resolve.alias).length),l("div",{class:"flex flex-col h-full",children:[l("div",{class:"flex items-center gap-2 px-4 py-2.5 border-b border-border shrink-0 flex-wrap",children:[e.mode&&r(D,{class:"uppercase tracking-wider text-xxs",variant:e.mode==="production"?"destructive":"default",children:e.mode}),e.server?.https&&r(D,{class:"uppercase tracking-wider text-xxs",variant:"success",children:"HTTPS"}),e.ssr&&r(D,{class:"uppercase tracking-wider text-xxs",variant:"secondary",children:"SSR"}),l("code",{class:"text-xs font-mono text-muted-foreground bg-secondary px-1.5 py-0.5 border border-border truncate max-w-xs",title:e.root,children:["…/",e.root.replaceAll("\\","/").split("/").slice(-2).join("/")]}),e.base&&e.base!=="/"&&l("code",{class:"text-xs font-mono text-muted-foreground bg-secondary px-1.5 py-0.5 border border-border",children:["base: ",e.base]}),r(R,{class:"ml-auto shrink-0 text-xs",onClick:b,size:"sm",variant:"outline",children:"Refresh"})]}),r("div",{class:"grid grid-cols-4 divide-x divide-border border-b border-border shrink-0",children:[{label:"plugins",value:g},{label:"env vars",value:y},{label:"defines",value:j},{label:"aliases",value:w}].map(({label:u,value:h})=>l("div",{class:"flex flex-col items-center py-2 gap-0.5",children:[r("span",{class:"text-sm font-semibold tabular-nums leading-none text-foreground",children:h}),r("span",{class:"text-xxs uppercase tracking-wider text-muted-foreground font-medium",children:u})]},u))}),l(N,{class:"flex flex-col flex-1 min-h-0",defaultValue:"server",children:[r("div",{class:"shrink-0 border-b border-border bg-muted",children:r(H,{class:"w-full rounded-none h-auto p-0 bg-transparent justify-start gap-0 overflow-x-auto",children:[{label:"Server",value:"server"},{label:`Plugins (${g})`,value:"plugins"},{label:"Build",value:"build"},{label:"Resolve",value:"resolve"},{label:`Env & Define (${y+j})`,value:"env"}].map(({label:u,value:h})=>r(J,{class:"rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-foreground data-[state=active]:shadow-none px-4 py-2 text-xs font-medium shrink-0 text-muted-foreground hover:text-foreground transition-colors cursor-pointer",value:h,children:u},h))})}),l(v,{class:"flex-1 overflow-auto p-4 space-y-4 mt-0",value:"server",children:[l(d,{children:[r(o,{label:"host",value:e.server?.host??!1}),r(o,{label:"port",value:e.server?.port}),r(o,{label:"strictPort",value:e.server?.strictPort}),r(o,{label:"https",value:e.server?.https}),r(o,{label:"open",value:e.server?.open}),r(o,{label:"cors",value:e.server?.cors}),r(o,{label:"origin",value:e.server?.origin}),r(o,{label:"middlewareMode",value:e.server?.middlewareMode})]}),l(d,{title:"HMR",children:[r(o,{label:"enabled",value:e.server?.hmrEnabled??!0}),e.server?.hmrPort!==void 0&&r(o,{label:"port",value:e.server.hmrPort})]}),e.server?.proxy&&e.server.proxy.length>0&&r(d,{title:"Proxy Routes",children:e.server.proxy.map(u=>r("div",{class:"flex items-center gap-3 px-4 py-1.5 hover:bg-secondary transition-colors duration-100",children:r("code",{class:"text-xs font-mono text-primary",children:u})},u))})]}),r(v,{class:"flex-1 overflow-auto p-4 mt-0",value:"plugins",children:g===0?r("p",{class:"text-sm text-muted-foreground text-center py-8",children:"No plugins registered"}):r(ee,{plugins:e.plugins??[]})}),l(v,{class:"flex-1 overflow-auto p-4 space-y-4 mt-0",value:"build",children:[l(d,{children:[r(o,{label:"outDir",value:e.build?.outDir}),r(o,{label:"target",value:e.build?.target}),r(o,{label:"minify",value:e.build?.minify}),r(o,{label:"sourcemap",value:e.build?.sourcemap}),r(o,{label:"cssCodeSplit",value:e.build?.cssCodeSplit}),r(o,{label:"assetsDir",value:e.build?.assetsDir}),r(o,{label:"assetsInlineLimit",value:e.build?.assetsInlineLimit}),r(o,{label:"chunkSizeWarningLimit",value:e.build?.chunkSizeWarningLimit}),r(o,{label:"emptyOutDir",value:e.build?.emptyOutDir}),r(o,{label:"reportCompressedSize",value:e.build?.reportCompressedSize})]}),e.esbuild&&l(d,{title:"esbuild Transform",children:[r(o,{label:"jsx",value:e.esbuild.jsx}),r(o,{label:"jsxFactory",value:e.esbuild.jsxFactory}),r(o,{label:"jsxFragment",value:e.esbuild.jsxFragment}),r(o,{label:"jsxImportSource",value:e.esbuild.jsxImportSource}),r(o,{label:"target",value:e.esbuild.target})]}),l(d,{title:"CSS",children:[r(o,{label:"devSourcemap",value:e.css?.devSourcemap}),r(o,{label:"preprocessors",value:e.css?.preprocessors})]}),(e.optimizeDeps?.include?.length??0)>0||(e.optimizeDeps?.exclude?.length??0)>0?l(d,{title:"Optimize Deps",children:[r(o,{label:"include",value:e.optimizeDeps?.include}),r(o,{label:"exclude",value:e.optimizeDeps?.exclude})]}):void 0,e.ssr&&l(d,{title:"SSR",children:[r(o,{label:"target",value:e.ssr.target}),r(o,{label:"external",value:e.ssr.external}),r(o,{label:"noExternal",value:e.ssr.noExternal})]})]}),l(v,{class:"flex-1 overflow-auto p-4 space-y-4 mt-0",value:"resolve",children:[l(d,{children:[r(o,{label:"extensions",value:e.resolve?.extensions}),r(o,{label:"conditions",value:e.resolve?.conditions}),r(o,{label:"mainFields",value:e.resolve?.mainFields}),r(o,{label:"dedupe",value:e.resolve?.dedupe}),r(o,{label:"preserveSymlinks",value:e.resolve?.preserveSymlinks})]}),r(re,{alias:e.resolve?.alias}),l(d,{title:"Paths",children:[r(o,{label:"root",value:e.root}),r(o,{label:"publicDir",value:e.publicDir}),r(o,{label:"cacheDir",value:e.cacheDir}),r(o,{label:"envDir",value:e.envDir}),r(o,{label:"envPrefix",value:e.envPrefix})]})]}),l(v,{class:"flex-1 overflow-auto p-4 space-y-4 mt-0",value:"env",children:[y>0?r(ne,{entries:Object.entries(e.env??{})}):r("div",{class:"rounded-none border border-border bg-card border-l-2 border-l-primary/20 px-4 py-3",children:r("p",{class:"text-xs text-muted-foreground",children:"No environment variables exposed to the client."})}),r(se,{entries:Object.entries(e.define??{})})]})]})]})},"ViteConfigApp"),me={component:ae,icon:K,id:"dev-toolbar:vite-config",name:"Vite Config"};export{me as default};
|
|
16
|
+
`,E="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-eye%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%22M2.062%2012.348a1%201%200%200%201%200-.696%2010.75%2010.75%200%200%201%2019.876%200%201%201%200%200%201%200%20.696%2010.75%2010.75%200%200%201-19.876%200%22%20%2F%3E%20%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%223%22%20%2F%3E%20%3C%2Fsvg%3E",R="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-eye-off%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%22M10.733%205.076a10.744%2010.744%200%200%201%2011.205%206.575%201%201%200%200%201%200%20.696%2010.747%2010.747%200%200%201-1.444%202.49%22%20%2F%3E%20%3Cpath%20d%3D%22M14.084%2014.158a3%203%200%200%201-4.242-4.242%22%20%2F%3E%20%3Cpath%20d%3D%22M17.479%2017.499a10.75%2010.75%200%200%201-15.417-5.151%201%201%200%200%201%200-.696%2010.75%2010.75%200%200%201%204.446-5.143%22%20%2F%3E%20%3Cpath%20d%3D%22m2%202%2020%2020%22%20%2F%3E%20%3C%2Fsvg%3E",H="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-search%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%22m21%2021-4.34-4.34%22%20%2F%3E%20%3Ccircle%20cx%3D%2211%22%20cy%3D%2211%22%20r%3D%228%22%20%2F%3E%20%3C%2Fsvg%3E",i=({children:t,title:r})=>l("section",{class:"space-y-1.5",children:[r&&l("h3",{class:"text-xxs font-bold uppercase tracking-widest text-muted-foreground px-1 flex items-center gap-1.5",children:[e("span",{"aria-hidden":"true",class:"text-primary opacity-50",children:"//"}),r]}),e("div",{class:"rounded-none border border-border bg-card divide-y divide-border overflow-hidden border-l-2 border-l-primary/20",children:t})]}),k=({text:t})=>{const[r,o]=u(p(!1),"copied"),n=()=>{navigator.clipboard.writeText(t).then(()=>{o(!0),setTimeout(o,1500,!1)}).catch(()=>{})};return e("button",{class:h("inline-flex items-center px-1.5 py-0.5 text-xxs font-mono border transition-colors duration-150 cursor-pointer",r?"border-primary text-primary bg-card":"border-border text-muted-foreground hover:text-foreground hover:border-foreground bg-transparent"),onClick:n,title:"Copy to clipboard",type:"button",children:r?"copied":"copy"})},J=({value:t})=>l("span",{class:"inline-flex items-center gap-1.5",children:[e("span",{"aria-hidden":"true",class:h("inline-block size-1.5 rounded-full",t?"bg-success":"bg-border")}),e("span",{class:h("text-xs font-mono font-medium",t?"text-success":"text-muted-foreground"),children:t?"true":"false"})]}),W=({items:t})=>t.length===0?e("span",{class:"text-muted-foreground text-xs italic opacity-50",children:"empty"}):e("div",{class:"flex flex-wrap gap-1",children:t.map(r=>e("span",{class:"inline-flex items-center px-1.5 py-0.5 text-xxs font-mono font-medium bg-secondary border border-border text-secondary-foreground",children:r},r))}),z=({path:t})=>{const r=t.replaceAll("\\","/").split("/").filter(Boolean),o=r.length>3?`…/${r.slice(-3).join("/")}`:t;return e("code",{class:"text-xs font-mono text-foreground break-all leading-relaxed",title:t,children:o})},A=/^\/|^[A-Z]:\\/i,q=({value:t})=>{if(t==null)return e("span",{class:"text-muted-foreground text-xs opacity-40",children:"—"});if(typeof t=="boolean")return e(J,{value:t});if(Array.isArray(t))return e(W,{items:t.map(String)});if(typeof t=="object"){const o=JSON.stringify(t,void 0,2);return l("div",{class:"flex items-start gap-2",children:[e("pre",{class:"text-xs font-mono text-foreground bg-secondary border border-border px-2 py-1 overflow-auto max-h-24 flex-1 leading-relaxed",children:o}),e(k,{text:o})]})}const r=String(t);return A.test(r)&&r.length>40?e(z,{path:r}):e("code",{class:"text-xs font-mono text-foreground break-all leading-relaxed",children:r})},s=({label:t,value:r})=>{if(r!=null)return l("div",{class:"grid grid-cols-2 gap-4 px-4 py-1.5 hover:bg-secondary transition-colors duration-100",children:[e("span",{class:"text-xs text-muted-foreground font-mono select-none self-center",children:t}),e("div",{class:"text-xs min-w-0 self-center",children:e(q,{value:r})})]})},K=()=>l("div",{class:"flex flex-col items-center justify-center h-full gap-3 p-8 select-none",children:[e("div",{"aria-hidden":"true",class:"flex gap-1.5 items-center",children:[0,160,320].map(t=>e("span",{class:"size-1.5 bg-primary rounded-full animate-pulse opacity-50",style:{animationDelay:`${t}ms`}},t))}),e("span",{class:"text-xs text-muted-foreground",children:"Loading Vite config…"})]}),U=({error:t,onRetry:r})=>l("div",{class:"flex flex-col items-center justify-center h-full gap-3 p-8 text-center",children:[e("p",{class:"text-sm text-destructive",children:t}),e(j,{onClick:r,size:"sm",variant:"outline",children:"Retry"})]}),Z={post:"bg-blue-500/15 text-blue-400 border-blue-500/30",pre:"bg-amber-500/15 text-amber-400 border-amber-500/30"},G=({index:t,plugin:r})=>l("div",{class:"flex items-center gap-3 px-4 py-1.5 hover:bg-secondary transition-colors duration-100",children:[e("span",{class:"text-xxs text-muted-foreground font-mono tabular-nums w-5 shrink-0 text-right select-none opacity-40",children:t+1}),e("span",{class:"text-xs font-mono text-foreground flex-1 truncate",children:r.name}),r.enforce?e("span",{class:h("text-xxs font-mono font-bold px-1.5 py-0.5 border uppercase tracking-wide",Z[r.enforce]),children:r.enforce}):e("span",{class:"text-xxs font-mono text-muted-foreground px-1.5 py-0.5 bg-secondary border border-border",children:"normal"})]}),Q=({plugins:t})=>{const[r,o]=u(p(""),"query"),n=u(O(null),"inputRef"),d=r?t.filter(a=>a.name.toLowerCase().includes(r.toLowerCase())):t;return l(i,{children:[l("div",{class:"flex items-center gap-2 px-4 py-1.5 bg-secondary border-b border-border",children:[e("span",{class:"text-xxs font-bold uppercase tracking-widest text-muted-foreground w-6 shrink-0",children:"#"}),l("div",{class:"flex-1 flex items-center gap-2",children:[e(D,{class:"text-muted-foreground shrink-0",size:11,src:H}),e(M,{class:"h-5 text-xs bg-transparent border-0 border-b border-border rounded-none px-0 py-0 focus-visible:ring-0 focus-visible:border-foreground placeholder:text-muted-foreground",onInput:a=>{o(a.target.value)},placeholder:`filter ${t.length} plugins…`,ref:n,type:"search",value:r})]}),e("span",{class:"text-xxs font-bold uppercase tracking-widest text-muted-foreground w-14 text-right",children:"Enforce"})]}),d.length===0?l("div",{class:"px-4 py-6 text-center text-xs text-muted-foreground",children:['No plugins match "',r,'"']}):d.map(a=>e(G,{index:t.indexOf(a),plugin:a},a.name)),r&&d.length>0&&e("div",{class:"px-4 py-1.5 bg-secondary border-t border-border text-right",children:l("span",{class:"text-xxs text-muted-foreground",children:[d.length," of ",t.length]})})]})},F="text-xxs font-bold uppercase tracking-widest text-muted-foreground",C=({col1:t,col2:r,extra:o})=>l("div",{class:"grid grid-cols-2 gap-4 px-4 py-1.5 bg-secondary border-b border-border",children:[e("span",{class:F,children:t}),l("div",{class:"flex items-center justify-between gap-2",children:[e("span",{class:F,children:r}),o]})]}),X=({alias:t})=>{if(!t)return;let r=[];if(Array.isArray(t)?r=t.filter(o=>o?.find!==void 0):typeof t=="object"&&t!==null&&(r=Object.entries(t).map(([o,n])=>({find:o,replacement:n}))),r.length!==0)return l(i,{title:"Alias",children:[e(C,{col1:"Find",col2:"Replacement"}),r.map(({find:o,replacement:n})=>l("div",{class:"grid grid-cols-2 gap-4 px-4 py-1.5 border-t border-border hover:bg-secondary transition-colors duration-100",children:[e("code",{class:"text-xs font-mono text-primary break-all leading-relaxed self-center",children:o}),e("div",{class:"self-center",children:A.test(n)&&n.length>40?e(z,{path:n}):e("code",{class:"text-xs font-mono text-foreground break-all leading-relaxed",children:n})})]},o??n))]})},Y=new Set(["BASE_URL","DEV","MODE","PROD","SSR"]),_=36,ee=({forceVisible:t,tag:r,value:o})=>{const[n,d]=u(p(!1),"localRevealed"),a=t||n,b=a&&o.length>_,x=a?e("code",{class:"text-xs font-mono text-foreground truncate block",children:o}):e("span",{class:"text-xs font-mono text-muted-foreground tracking-widest select-none",children:"••••••••"});return l("div",{class:"flex items-center gap-2 w-full min-w-0",children:[e("span",{class:"flex-1 min-w-0 overflow-hidden",children:b?l(V,{children:[e(N,{class:"w-full block cursor-default",children:x}),e(B,{side:"top",children:e("code",{class:"text-xs font-mono break-all max-w-xs block",children:o})})]}):x}),r,e("button",{"aria-label":a?"Hide value":"Reveal value",class:"shrink-0 text-muted-foreground hover:text-foreground transition-colors duration-150 cursor-pointer p-0.5",onClick:()=>{d(f=>!f)},title:a?"Hide value":"Reveal value",type:"button",children:e(D,{size:11,src:a?R:E})}),e(k,{text:o})]})},re=({entries:t})=>{const[r,o]=u(p(!1),"revealAll");return l(i,{title:"Environment Variables",children:[e(C,{col1:"Key",col2:"Value",extra:l("button",{class:"inline-flex items-center gap-1 text-xxs font-mono text-muted-foreground hover:text-foreground transition-colors duration-150 cursor-pointer",onClick:()=>{o(n=>!n)},type:"button",children:[e(D,{size:10,src:r?R:E}),r?"hide all":"reveal all"]})}),t.map(([n,d])=>{const a=Y.has(n);return l("div",{class:"grid grid-cols-2 gap-4 px-4 py-1.5 border-t border-border hover:bg-secondary transition-colors duration-100",children:[e("code",{class:"text-xs font-mono text-primary truncate self-center",children:n}),e("div",{class:"self-center min-w-0",children:e(ee,{forceVisible:r,tag:e("span",{class:"text-xxs font-mono text-muted-foreground px-1 py-0.5 bg-secondary border border-border uppercase tracking-wide shrink-0 mr-5",children:a?"built-in":"user"}),value:d})})]},n)})]})},te=({entries:t})=>{if(t.length!==0)return l(i,{title:"Define Constants",children:[e(C,{col1:"Identifier",col2:"Replacement"}),t.map(([r,o])=>l("div",{class:"grid grid-cols-2 gap-4 px-4 py-1.5 border-t border-border hover:bg-secondary transition-colors duration-100",children:[e("code",{class:"text-xs font-mono text-amber-400 break-all leading-relaxed self-center",children:r}),l("div",{class:"flex items-center gap-2 self-center min-w-0",children:[e("code",{class:"text-xs font-mono text-foreground break-all leading-relaxed flex-1",children:JSON.stringify(o)}),e(k,{text:`${r}=${JSON.stringify(o)}`})]})]},r))]})},le=({helpers:t})=>{const[r,o]=u(p(void 0),"config"),[n,d]=u(p(void 0),"error"),[a,b]=u(p(!0),"loading"),x=()=>{b(!0),d(void 0),t.rpc.getViteConfig().then(c=>{o(c),b(!1)}).catch(c=>{d(c.message??"Failed to load Vite config"),b(!1)})};if($(()=>{x()},[]),a)return e(K,{});if(n||!r)return e(U,{error:n??"No config available",onRetry:x});const f=r.plugins?.length??0,m=Object.keys(r.env??{}).length,S=Object.keys(r.define??{}).length;let y=0;return Array.isArray(r.resolve?.alias)?y=r.resolve.alias.length:typeof r.resolve?.alias=="object"&&r.resolve.alias!==null&&(y=Object.keys(r.resolve.alias).length),l("div",{class:"flex flex-col h-full",children:[l("div",{class:"flex items-center gap-2 px-4 py-2.5 border-b border-border shrink-0 flex-wrap",children:[r.mode&&e(w,{class:"uppercase tracking-wider text-xxs",variant:r.mode==="production"?"destructive":"default",children:r.mode}),r.server?.https&&e(w,{class:"uppercase tracking-wider text-xxs",variant:"success",children:"HTTPS"}),r.ssr&&e(w,{class:"uppercase tracking-wider text-xxs",variant:"secondary",children:"SSR"}),l("code",{class:"text-xs font-mono text-muted-foreground bg-secondary px-1.5 py-0.5 border border-border truncate max-w-xs",title:r.root,children:["…/",r.root.replaceAll("\\","/").split("/").slice(-2).join("/")]}),r.base&&r.base!=="/"&&l("code",{class:"text-xs font-mono text-muted-foreground bg-secondary px-1.5 py-0.5 border border-border",children:["base: ",r.base]}),e(j,{class:"ml-auto shrink-0 text-xs",onClick:x,size:"sm",variant:"outline",children:"Refresh"})]}),e("div",{class:"grid grid-cols-4 divide-x divide-border border-b border-border shrink-0",children:[{label:"plugins",value:f},{label:"env vars",value:m},{label:"defines",value:S},{label:"aliases",value:y}].map(({label:c,value:g})=>l("div",{class:"flex flex-col items-center py-2 gap-0.5",children:[e("span",{class:"text-sm font-semibold tabular-nums leading-none text-foreground",children:g}),e("span",{class:"text-xxs uppercase tracking-wider text-muted-foreground font-medium",children:c})]},c))}),l(T,{class:"flex flex-col flex-1 min-h-0",defaultValue:"server",children:[e("div",{class:"shrink-0 border-b border-border bg-muted",children:e(P,{class:"w-full rounded-none h-auto p-0 bg-transparent justify-start gap-0 overflow-x-auto",children:[{label:"Server",value:"server"},{label:`Plugins (${f})`,value:"plugins"},{label:"Build",value:"build"},{label:"Resolve",value:"resolve"},{label:`Env & Define (${m+S})`,value:"env"}].map(({label:c,value:g})=>e(L,{class:"rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-foreground data-[state=active]:shadow-none px-4 py-2 text-xs font-medium shrink-0 text-muted-foreground hover:text-foreground transition-colors cursor-pointer",value:g,children:c},g))})}),l(v,{class:"flex-1 overflow-auto p-4 space-y-4 mt-0",value:"server",children:[l(i,{children:[e(s,{label:"host",value:r.server?.host??!1}),e(s,{label:"port",value:r.server?.port}),e(s,{label:"strictPort",value:r.server?.strictPort}),e(s,{label:"https",value:r.server?.https}),e(s,{label:"open",value:r.server?.open}),e(s,{label:"cors",value:r.server?.cors}),e(s,{label:"origin",value:r.server?.origin}),e(s,{label:"middlewareMode",value:r.server?.middlewareMode})]}),l(i,{title:"HMR",children:[e(s,{label:"enabled",value:r.server?.hmrEnabled??!0}),r.server?.hmrPort!==void 0&&e(s,{label:"port",value:r.server.hmrPort})]}),r.server?.proxy&&r.server.proxy.length>0&&e(i,{title:"Proxy Routes",children:r.server.proxy.map(c=>e("div",{class:"flex items-center gap-3 px-4 py-1.5 hover:bg-secondary transition-colors duration-100",children:e("code",{class:"text-xs font-mono text-primary",children:c})},c))})]}),e(v,{class:"flex-1 overflow-auto p-4 mt-0",value:"plugins",children:f===0?e("p",{class:"text-sm text-muted-foreground text-center py-8",children:"No plugins registered"}):e(Q,{plugins:r.plugins??[]})}),l(v,{class:"flex-1 overflow-auto p-4 space-y-4 mt-0",value:"build",children:[l(i,{children:[e(s,{label:"outDir",value:r.build?.outDir}),e(s,{label:"target",value:r.build?.target}),e(s,{label:"minify",value:r.build?.minify}),e(s,{label:"sourcemap",value:r.build?.sourcemap}),e(s,{label:"cssCodeSplit",value:r.build?.cssCodeSplit}),e(s,{label:"assetsDir",value:r.build?.assetsDir}),e(s,{label:"assetsInlineLimit",value:r.build?.assetsInlineLimit}),e(s,{label:"chunkSizeWarningLimit",value:r.build?.chunkSizeWarningLimit}),e(s,{label:"emptyOutDir",value:r.build?.emptyOutDir}),e(s,{label:"reportCompressedSize",value:r.build?.reportCompressedSize})]}),r.esbuild&&l(i,{title:"esbuild Transform",children:[e(s,{label:"jsx",value:r.esbuild.jsx}),e(s,{label:"jsxFactory",value:r.esbuild.jsxFactory}),e(s,{label:"jsxFragment",value:r.esbuild.jsxFragment}),e(s,{label:"jsxImportSource",value:r.esbuild.jsxImportSource}),e(s,{label:"target",value:r.esbuild.target})]}),l(i,{title:"CSS",children:[e(s,{label:"devSourcemap",value:r.css?.devSourcemap}),e(s,{label:"preprocessors",value:r.css?.preprocessors})]}),(r.optimizeDeps?.include?.length??0)>0||(r.optimizeDeps?.exclude?.length??0)>0?l(i,{title:"Optimize Deps",children:[e(s,{label:"include",value:r.optimizeDeps?.include}),e(s,{label:"exclude",value:r.optimizeDeps?.exclude})]}):void 0,r.ssr&&l(i,{title:"SSR",children:[e(s,{label:"target",value:r.ssr.target}),e(s,{label:"external",value:r.ssr.external}),e(s,{label:"noExternal",value:r.ssr.noExternal})]})]}),l(v,{class:"flex-1 overflow-auto p-4 space-y-4 mt-0",value:"resolve",children:[l(i,{children:[e(s,{label:"extensions",value:r.resolve?.extensions}),e(s,{label:"conditions",value:r.resolve?.conditions}),e(s,{label:"mainFields",value:r.resolve?.mainFields}),e(s,{label:"dedupe",value:r.resolve?.dedupe}),e(s,{label:"preserveSymlinks",value:r.resolve?.preserveSymlinks})]}),e(X,{alias:r.resolve?.alias}),l(i,{title:"Paths",children:[e(s,{label:"root",value:r.root}),e(s,{label:"publicDir",value:r.publicDir}),e(s,{label:"cacheDir",value:r.cacheDir}),e(s,{label:"envDir",value:r.envDir}),e(s,{label:"envPrefix",value:r.envPrefix})]})]}),l(v,{class:"flex-1 overflow-auto p-4 space-y-4 mt-0",value:"env",children:[m>0?e(re,{entries:Object.entries(r.env??{})}):e("div",{class:"rounded-none border border-border bg-card border-l-2 border-l-primary/20 px-4 py-3",children:e("p",{class:"text-xs text-muted-foreground",children:"No environment variables exposed to the client."})}),e(te,{entries:Object.entries(r.define??{})})]})]})]})},be={component:le,icon:I,id:"dev-toolbar:vite-config",name:"Vite Config"};export{be as default};
|
package/dist/client/overlay.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export { };
|
package/dist/client/overlay.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import t from"virtual:visulima-dev-toolbar-options";globalThis.__VISULIMA_DEV_TOOLBAR_OPTIONS__=t;const f=()=>{if(!t.requireUrlFlag)return!0;const o=t.urlFlagName??"devtools";return new URLSearchParams(globalThis.window?.location.search).get(o)==="true"},g=o=>Promise.all([o.settings?import("virtual:visulima-dev-toolbar-path:apps/settings/index.js"):void 0,o.timeline?import("virtual:visulima-dev-toolbar-path:apps/timeline/index.js"):void 0,o.viteConfig?import("virtual:visulima-dev-toolbar-path:apps/vite-config/index.js"):void 0,o.moduleGraph?import("virtual:visulima-dev-toolbar-path:apps/module-graph/index.js"):void 0,o.seo?import("virtual:visulima-dev-toolbar-path:apps/seo/index.js"):void 0,o.performance?import("virtual:visulima-dev-toolbar-path:apps/performance/index.js"):void 0,o.a11y?import("virtual:visulima-dev-toolbar-path:apps/a11y/index.js"):void 0,o.inspector?import("virtual:visulima-dev-toolbar-path:apps/inspector/index.js"):void 0,o.tailwind?import("virtual:visulima-dev-toolbar-path:apps/tailwind/index.js"):void 0,o.assets?import("virtual:visulima-dev-toolbar-path:apps/assets/index.js"):void 0,o.annotations?import("virtual:visulima-dev-toolbar-path:apps/annotations/index.js"):void 0]),T=(o,i)=>{const[e,r,l,s,d,c,m,p,_,I,u]=i;if(!o.registerApp)return;const v=[r,l,s,d,c,m,p,_,I,u];for(const n of v)n&&o.registerApp(n.default,!0);e&&o.registerApp(e.default,!0)},a=async()=>{if(globalThis.window===void 0||!f()||globalThis.__VISULIMA_DEVTOOLS_INITIALIZED__)return;globalThis.__VISULIMA_DEVTOOLS_INITIALIZED__=!0;let o;try{await import("virtual:visulima-dev-toolbar-path:toolbar/index.js");const{apps:i}=t,e=await g(i);if(o=document.createElement("dev-toolbar"),document.body.append(o),T(o,e),t.customApps)for(const r of t.customApps)o.registerApp(r,!1);o.init&&o.init(),console.log("[dev-toolbar] Initialized successfully")}catch(i){o?.isConnected&&o.remove(),globalThis.__VISULIMA_DEVTOOLS_INITIALIZED__=!1,console.error("[dev-toolbar] Failed to initialize:",i)}};typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",a):a().catch(()=>{}));import.meta.hot&&import.meta.hot.on("dev-toolbar:init",()=>{const o=document.querySelector("dev-toolbar");o&&o.remove(),globalThis.__VISULIMA_DEVTOOLS_INITIALIZED__=!1,a().catch(()=>{})});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,133 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
export type {
|
|
5
|
-
export {
|
|
6
|
-
export { DevToolbar } from "./toolbar/index.
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { D as DevToolbarApp, T as ToolbarSettings } from "./packem_shared/app.d-SmKEDxsI.js";
|
|
2
|
+
export type { A as AppView, b as DEFAULT_TOOLBAR_SETTINGS, a as DevToolbarAppState, F as FrameState, N as NotificationLevel, P as PositionAnchor, S as ServerFunctions, c as ServerHelpers, d as ToolbarAppEventTarget, e as ToolbarPlacement } from "./packem_shared/app.d-SmKEDxsI.js";
|
|
3
|
+
import { T as TimelineEvent, D as DevToolbarHook, C as ClientFunctions, b as ClientRPCContext, c as TimelineGroup } from "./packem_shared/global-api.d-DeaCvII9.js";
|
|
4
|
+
export type { A as AccessibilityInfo, d as Annotation, e as AnnotationIntent, f as AnnotationSeverity, g as AnnotationStatus, B as BoundingBox, h as CreateAnnotationData, i as DEFAULT_TIMELINE_GROUPS, F as FrameworkContext, H as HookEvents, S as RPCServerFunctions, a as ServerRPCContext, j as ThreadMessage, k as TimelineEventLevel, U as UpdateAnnotationData, V as VisulimaDevTools } from "./packem_shared/global-api.d-DeaCvII9.js";
|
|
5
|
+
export { type R as ReadFileOptions, type S as ServerRPCOptions, c as createServerRPCContext } from "./packem_shared/server.d-ZkcY0pge.js";
|
|
6
|
+
export { DevToolbar } from "./toolbar/index.js";
|
|
7
|
+
import 'preact';
|
|
8
|
+
import 'vite';
|
|
9
|
+
/**
|
|
10
|
+
* Creates a dev toolbar hook instance.
|
|
11
|
+
* @param onRegisterApp Callback when app is registered.
|
|
12
|
+
* @param onTimelineEvent Callback when timeline event is added.
|
|
13
|
+
* @returns Hook instance.
|
|
14
|
+
*/
|
|
15
|
+
declare const createDevToolbarHook: (onRegisterApp?: (app: DevToolbarApp) => void, onTimelineEvent?: (groupId: string, event: TimelineEvent) => void) => DevToolbarHook;
|
|
16
|
+
/**
|
|
17
|
+
* Setup global hook on window object.
|
|
18
|
+
* @param onRegisterApp Callback when app is registered.
|
|
19
|
+
* @param onTimelineEvent Callback when timeline event is added.
|
|
20
|
+
* @returns Hook instance.
|
|
21
|
+
*/
|
|
22
|
+
declare const setupGlobalHook: (onRegisterApp?: (app: DevToolbarApp) => void, onTimelineEvent?: (groupId: string, event: TimelineEvent) => void) => DevToolbarHook;
|
|
23
|
+
/**
|
|
24
|
+
* Get the global hook instance.
|
|
25
|
+
* @returns Hook instance or undefined.
|
|
26
|
+
*/
|
|
27
|
+
declare const getGlobalHook: () => DevToolbarHook | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Creates client-side RPC context.
|
|
30
|
+
* @param customFunctions Custom client functions to register.
|
|
31
|
+
* @returns Client RPC context.
|
|
32
|
+
*/
|
|
33
|
+
declare const createClientRPCContext: (customFunctions?: Partial<ClientFunctions>) => ClientRPCContext;
|
|
34
|
+
/**
|
|
35
|
+
* Timeline store for managing timeline events.
|
|
36
|
+
*/
|
|
37
|
+
declare class TimelineStore {
|
|
38
|
+
private groups;
|
|
39
|
+
private maxEvents;
|
|
40
|
+
constructor(maxEvents?: number);
|
|
41
|
+
/**
|
|
42
|
+
* Adds an event to a group.
|
|
43
|
+
*/
|
|
44
|
+
addEvent(groupId: string, event: TimelineEvent): void;
|
|
45
|
+
/**
|
|
46
|
+
* Gets all timeline groups.
|
|
47
|
+
*/
|
|
48
|
+
getGroups(): TimelineGroup[];
|
|
49
|
+
/**
|
|
50
|
+
* Gets events for a specific group.
|
|
51
|
+
*/
|
|
52
|
+
getGroupEvents(groupId: string): TimelineEvent[];
|
|
53
|
+
/**
|
|
54
|
+
* Gets all events across all groups.
|
|
55
|
+
*/
|
|
56
|
+
getAllEvents(): TimelineEvent[];
|
|
57
|
+
/**
|
|
58
|
+
* Clears events for a specific group.
|
|
59
|
+
*/
|
|
60
|
+
clearGroup(groupId: string): void;
|
|
61
|
+
/**
|
|
62
|
+
* Clears all events from all groups.
|
|
63
|
+
*/
|
|
64
|
+
clearAll(): void;
|
|
65
|
+
/**
|
|
66
|
+
* Gets events within a time range.
|
|
67
|
+
*/
|
|
68
|
+
getEventsInRange(startTime: number, endTime: number): TimelineEvent[];
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Gets or creates the timeline store singleton instance.
|
|
72
|
+
*/
|
|
73
|
+
declare const getTimelineStore: () => TimelineStore;
|
|
74
|
+
/**
|
|
75
|
+
* Message channel interface for bidirectional communication
|
|
76
|
+
*/
|
|
77
|
+
interface MessageChannel<TEvents extends Record<string, (...args: any[]) => void>> {
|
|
78
|
+
/**
|
|
79
|
+
* Unsubscribe from an event
|
|
80
|
+
* @param event Event name
|
|
81
|
+
* @param handler Optional specific handler to remove
|
|
82
|
+
*/
|
|
83
|
+
off: <K extends keyof TEvents>(event: K, handler?: TEvents[K]) => void;
|
|
84
|
+
/**
|
|
85
|
+
* Subscribe to an event
|
|
86
|
+
* @param event Event name
|
|
87
|
+
* @param handler Event handler
|
|
88
|
+
* @returns Unsubscribe function
|
|
89
|
+
*/
|
|
90
|
+
on: <K extends keyof TEvents>(event: K, handler: TEvents[K]) => () => void;
|
|
91
|
+
/**
|
|
92
|
+
* Subscribe to an event once
|
|
93
|
+
* @param event Event name
|
|
94
|
+
* @param handler Event handler
|
|
95
|
+
*/
|
|
96
|
+
once: <K extends keyof TEvents>(event: K, handler: TEvents[K]) => void;
|
|
97
|
+
/**
|
|
98
|
+
* Send a message/event
|
|
99
|
+
* @param event Event name
|
|
100
|
+
* @param data Event data
|
|
101
|
+
*/
|
|
102
|
+
send: <K extends keyof TEvents>(event: K, ...args: Parameters<TEvents[K]>) => void;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Channel factory function
|
|
106
|
+
*/
|
|
107
|
+
type ChannelFactory<TEvents extends Record<string, (...args: any[]) => void>> = () => MessageChannel<TEvents>;
|
|
108
|
+
/**
|
|
109
|
+
* Factory result providing a method to instantiate named message channels.
|
|
110
|
+
*/
|
|
111
|
+
interface MessageChannelContext<TEvents extends Record<string, (...args: any[]) => void>> {
|
|
112
|
+
/**
|
|
113
|
+
* Creates and returns a new channel instance.
|
|
114
|
+
*/
|
|
115
|
+
createChannel: () => MessageChannel<TEvents>;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Loads settings from localStorage, merging with defaults.
|
|
119
|
+
* @returns Toolbar settings.
|
|
120
|
+
*/
|
|
121
|
+
declare const loadSettings: () => ToolbarSettings;
|
|
122
|
+
/**
|
|
123
|
+
* Saves settings to localStorage.
|
|
124
|
+
* @param settings Toolbar settings to save.
|
|
125
|
+
*/
|
|
126
|
+
declare const saveSettings: (settings: ToolbarSettings) => void;
|
|
127
|
+
/**
|
|
128
|
+
* Merges partial updates into the current settings and persists them.
|
|
129
|
+
* @param updates Partial settings to update.
|
|
130
|
+
* @returns Updated settings.
|
|
131
|
+
*/
|
|
132
|
+
declare const updateSettings: (updates: Partial<ToolbarSettings>) => ToolbarSettings;
|
|
133
|
+
export { type ChannelFactory, type ClientRPCContext, type DevToolbarApp, type DevToolbarHook, type MessageChannel, type MessageChannelContext, type ClientFunctions as RPCClientFunctions, type TimelineEvent, type TimelineGroup, type TimelineStore, type ToolbarSettings, createClientRPCContext, createDevToolbarHook, getGlobalHook, getTimelineStore, loadSettings, saveSettings, setupGlobalHook, updateSettings };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createClientRPCContext as t}from"./packem_shared/createClientRPCContext-
|
|
1
|
+
import{createClientRPCContext as t}from"./packem_shared/createClientRPCContext-5Bh0Q7ai.js";import{createServerRPCContext as a}from"./packem_shared/createServerRPCContext-0Fs78uvP.js";import{DevToolbar as p}from"./toolbar/index.js";import{loadSettings as m,saveSettings as f,updateSettings as n}from"./packem_shared/loadSettings-C0pUyx9j.js";import{createDevToolbarHook as s}from"./packem_shared/createDevToolbarHook-C_TF-RyL.js";import{getGlobalHook as C,setupGlobalHook as S}from"./packem_shared/getGlobalHook-D6jRtv7N.js";import{u as v}from"./packem_shared/store-Dqy0FbGw.js";export{p as DevToolbar,t as createClientRPCContext,s as createDevToolbarHook,a as createServerRPCContext,C as getGlobalHook,v as getTimelineStore,m as loadSettings,f as saveSettings,S as setupGlobalHook,n as updateSettings};
|
package/dist/mcp/server.d.ts
CHANGED
|
@@ -1,12 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* Provides tools for AI agents (e.g. Claude Code) to read, resolve, and
|
|
5
|
-
* interact with visual annotations created through the dev toolbar.
|
|
6
|
-
*
|
|
7
|
-
* Usage:
|
|
8
|
-
* npx visulima-dev-toolbar-mcp
|
|
9
|
-
*
|
|
10
|
-
* Requires: @modelcontextprotocol/sdk (optional peer dependency)
|
|
11
|
-
*/
|
|
12
|
-
export declare const startMcpServer: () => Promise<void>;
|
|
1
|
+
declare const startMcpServer: () => Promise<void>;
|
|
2
|
+
export { startMcpServer };
|
package/dist/mcp/server.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{createRequire as k}from"node:module";import{r as d,S as D,a as E,i as j,w as v,d as M,b as x}from"../packem_shared/annotation-store-WIJhHG5y.js";const J=k(import.meta.url),p=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,O=f=>{if(typeof p<"u"&&p.versions&&p.versions.node){const[m,s]=p.versions.node.split(".").map(Number);if(m>22||m===22&&s>=3||m===20&&s>=16)return p.getBuiltinModule(f)}return J(f)},A=O("node:fs/promises"),I=O("node:path"),U=async()=>{const{McpServer:f}=await import("@modelcontextprotocol/sdk/server/mcp.js"),{StdioServerTransport:m}=await import("@modelcontextprotocol/sdk/server/stdio.js"),{z:s}=await import("zod"),a=process.cwd(),u=new f({name:"visulima-dev-toolbar",version:"1.0.0-alpha.5"});u.tool("get_pending_annotations","Get all pending visual annotations from the dev toolbar. Returns annotations with metadata but not screenshot binary data — use get_screenshot for that.",{},async()=>{const i=(await d(a)).filter(t=>t.status==="pending").map(t=>({...t,screenshot:!!t.screenshot}));return{content:[{text:JSON.stringify({annotations:i,count:i.length},void 0,2),type:"text"}]}}),u.tool("get_screenshot","Get the screenshot image for an annotation as base64 data. Use this after get_pending_annotations to see what the user annotated.",{annotation_id:s.string().describe("The annotation ID to get the screenshot for")},async({annotation_id:i})=>{const t=(await d(a)).find(o=>o.id===i);if(!t)return{content:[{text:JSON.stringify({error:"Annotation not found"}),type:"text"}],isError:!0};if(!t.screenshot)return{content:[{text:JSON.stringify({error:"No screenshot for this annotation"}),type:"text"}],isError:!0};if(!t.screenshot.startsWith(`${D}/`))return{content:[{text:JSON.stringify({error:"Invalid screenshot path"}),type:"text"}],isError:!0};const{base:n}=E(a),e=I.join(n,t.screenshot);if(!j(e,n))return{content:[{text:JSON.stringify({error:"Invalid screenshot path"}),type:"text"}],isError:!0};try{const o=await A.readFile(e),r=I.extname(e).slice(1),g=r==="svg"?"image/svg+xml":r==="jpg"?"image/jpeg":`image/${r}`;return{content:[{data:o.toString("base64"),mimeType:g,type:"image"}]}}catch{return{content:[{text:JSON.stringify({error:"Screenshot file not found"}),type:"text"}],isError:!0}}}),u.tool("resolve_annotation","Mark an annotation as resolved after fixing the issue. Automatically deletes the associated screenshot.",{annotation_id:s.string().describe("The annotation ID to resolve")},async({annotation_id:i})=>v(async()=>{const t=await d(a),n=t.findIndex(o=>o.id===i);if(n===-1)return{content:[{text:JSON.stringify({error:"Annotation not found"}),type:"text"}],isError:!0};const e=t[n];return e.status="resolved",e.resolvedBy="agent",e.updatedAt=new Date().toISOString(),e.screenshot&&(await M(a,e.screenshot),e.screenshot=void 0),t[n]=e,await x(a,t),{content:[{text:JSON.stringify({annotation:e,ok:!0},void 0,2),type:"text"}]}})),u.tool("add_thread_message","Add a message to an annotation's conversation thread. Use this to communicate with the developer about the annotation.",{annotation_id:s.string().describe("The annotation ID to add a message to"),message:s.string().describe("The message content")},async({annotation_id:i,message:t})=>v(async()=>{const n=await d(a),e=n.findIndex(r=>r.id===i);if(e===-1)return{content:[{text:JSON.stringify({error:"Annotation not found"}),type:"text"}],isError:!0};const o=n[e];return o.thread||(o.thread=[]),o.thread.push({content:t,id:crypto.randomUUID(),role:"agent",timestamp:new Date().toISOString()}),o.updatedAt=new Date().toISOString(),n[e]=o,await x(a,n),{content:[{text:JSON.stringify({annotation:o,ok:!0},void 0,2),type:"text"}]}})),u.tool("acknowledge_annotation","Mark an annotation as acknowledged — signals to the developer that the agent has seen it and will work on it. Use this before starting to fix an issue.",{annotation_id:s.string().describe("The annotation ID to acknowledge")},async({annotation_id:i})=>v(async()=>{const t=await d(a),n=t.findIndex(o=>o.id===i);if(n===-1)return{content:[{text:JSON.stringify({error:"Annotation not found"}),type:"text"}],isError:!0};const e=t[n];return e.status="acknowledged",e.updatedAt=new Date().toISOString(),t[n]=e,await x(a,t),{content:[{text:JSON.stringify({annotation:e,ok:!0},void 0,2),type:"text"}]}})),u.tool("watch_annotations","Block until new pending annotations appear. Use this for hands-free mode: call in a loop to automatically detect when the developer adds feedback. Returns after the batch window (default 10s) to collect multiple annotations submitted in quick succession.",{batch_window_ms:s.number().optional().describe("How long to wait for additional annotations after the first one arrives (default: 10000ms)"),timeout_ms:s.number().optional().describe("Maximum time to wait before returning empty (default: 300000ms = 5 minutes)")},async({batch_window_ms:i,timeout_ms:t})=>{const n=i??1e4,e=t??3e5,o=2e3,r=new Set((await d(a)).filter(l=>l.status==="pending").map(l=>l.id));let g,w;const y=await Promise.race([new Promise(l=>{w=setTimeout(l,e,{timedOut:!0})}),new Promise((l,S)=>{g=setInterval(()=>{d(a).then(_=>{_.filter(h=>h.status==="pending").filter(h=>!r.has(h.id)).map(h=>h.id).length>0&&(clearInterval(g),clearTimeout(w),setTimeout(()=>{d(a).then(h=>{const b=h.filter(c=>c.status==="pending"),T=b.filter(c=>!r.has(c.id)).map(c=>c.id);l({annotations:b.map(c=>({...c,screenshot:!!c.screenshot})),newIds:T})}).catch(S)},n))}).catch(_=>{clearInterval(g),clearTimeout(w),S(_)})},o)})]);return clearInterval(g),clearTimeout(w),"timedOut"in y?{content:[{text:JSON.stringify({annotations:[],count:0,newCount:0,timedOut:!0}),type:"text"}]}:{content:[{text:JSON.stringify({annotations:y.annotations,count:y.annotations.length,newCount:y.newIds.length},void 0,2),type:"text"}]}});const N=new m;await u.connect(N)};export{U as startMcpServer};
|