@visulima/dev-toolbar 1.0.0-alpha.3 → 1.0.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/apps/a11y/a11y-store.d.ts +12 -16
  3. package/dist/apps/a11y/index.js +2 -21
  4. package/dist/apps/inspector/index.js +1 -17
  5. package/dist/apps/module-graph/index.js +1 -20
  6. package/dist/apps/more/index.js +2 -19
  7. package/dist/apps/performance/index.js +1 -17
  8. package/dist/apps/seo/index.js +1 -17
  9. package/dist/apps/settings/index.js +1 -17
  10. package/dist/apps/tailwind/index.js +6 -6
  11. package/dist/apps/timeline/index.js +1 -18
  12. package/dist/apps/vite-config/index.js +1 -16
  13. package/dist/client/overlay.js +1 -1
  14. package/dist/hooks/create-hook.d.ts +7 -5
  15. package/dist/hooks/events.d.ts +4 -2
  16. package/dist/hooks/global-hook.d.ts +6 -6
  17. package/dist/index.d.ts +2 -1
  18. package/dist/index.js +1 -1
  19. package/dist/packem_chunks/inject-source.js +1 -1
  20. package/dist/packem_shared/Popover-CLt7YhUF.js +1 -0
  21. package/dist/packem_shared/Tabs-CXERaeAp.js +1 -0
  22. package/dist/packem_shared/Tooltip-tlBN-NdK.js +1 -0
  23. package/dist/packem_shared/createClientRPCContext-DgRxrllw.js +1 -0
  24. package/dist/packem_shared/createDevToolbarHook-4bZZiHPI.js +1 -0
  25. package/dist/packem_shared/createServerRPCContext-CEm1Ymkn.js +1 -0
  26. package/dist/packem_shared/getTimelineStore-B1cfjWV8.js +1 -0
  27. package/dist/packem_shared/{setupGlobalHook-CFuxsCyl.js → setupGlobalHook-CCf9Logv.js} +1 -1
  28. package/dist/packem_shared/sharedToolbarStylesheet-DOV-Jwcm.js +2 -0
  29. package/dist/packem_shared/store-DaUtLjf3.js +1 -0
  30. package/dist/packem_shared/{use-theme-CX1gG6Sv.js → use-theme-BOw3dPpY.js} +1 -1
  31. package/dist/performance/monitor.d.ts +27 -26
  32. package/dist/rpc/client.d.ts +6 -4
  33. package/dist/rpc/functions/open-in-editor.d.ts +7 -5
  34. package/dist/rpc/functions/tailwind-config.d.ts +7 -4
  35. package/dist/rpc/functions/vite-config.d.ts +6 -4
  36. package/dist/rpc/server.d.ts +9 -6
  37. package/dist/timeline/capture.d.ts +3 -1
  38. package/dist/timeline/index.d.ts +2 -1
  39. package/dist/timeline/store.d.ts +12 -22
  40. package/dist/toolbar/app-manager.d.ts +45 -43
  41. package/dist/toolbar/components/app-canvas.d.ts +1 -1
  42. package/dist/toolbar/components/toolbar-container.d.ts +1 -1
  43. package/dist/toolbar/components/vite-overlay-button.d.ts +2 -2
  44. package/dist/toolbar/context/toolbar-context.d.ts +20 -19
  45. package/dist/toolbar/global-api.d.ts +3 -3
  46. package/dist/toolbar/helpers.d.ts +5 -3
  47. package/dist/toolbar/hooks/use-apps.d.ts +5 -3
  48. package/dist/toolbar/hooks/use-frame-state.d.ts +16 -10
  49. package/dist/toolbar/hooks/use-panel-visible.d.ts +9 -7
  50. package/dist/toolbar/hooks/use-position.d.ts +7 -5
  51. package/dist/toolbar/hooks/use-theme.d.ts +6 -4
  52. package/dist/toolbar/hooks/use-toolbar.d.ts +4 -2
  53. package/dist/toolbar/index.d.ts +8 -14
  54. package/dist/toolbar/index.js +3 -3
  55. package/dist/toolbar/settings.d.ts +7 -7
  56. package/dist/toolbar/stylesheet.d.ts +3 -1
  57. package/dist/toolbar/utils/index.d.ts +3 -3
  58. package/dist/types/global-api.d.ts +22 -33
  59. package/dist/types/hooks.d.ts +32 -34
  60. package/dist/types/messaging.d.ts +2 -2
  61. package/dist/types/rpc.d.ts +3 -6
  62. package/dist/types/timeline.d.ts +3 -3
  63. package/dist/types/toolbar.d.ts +1 -1
  64. package/dist/ui/components/icon.d.ts +3 -4
  65. package/dist/ui/components/popover.d.ts +1 -1
  66. package/dist/ui/components/tabs.d.ts +1 -1
  67. package/dist/ui/components/tooltip.d.ts +1 -1
  68. package/dist/ui/index.js +1 -1
  69. package/dist/utils/cn.d.ts +3 -3
  70. package/dist/vite/inject-source.d.ts +0 -1
  71. package/dist/vite/matcher.d.ts +2 -1
  72. package/dist/vite-plugin.d.ts +5 -5
  73. package/dist/vite-plugin.js +2 -2
  74. package/package.json +4 -3
  75. package/dist/packem_shared/Popover-o3Vkvndp.js +0 -1
  76. package/dist/packem_shared/Tabs-BBc4S-2T.js +0 -1
  77. package/dist/packem_shared/TimelineStore-BgBrirKd.js +0 -1
  78. package/dist/packem_shared/Tooltip-BwK-2I9P.js +0 -1
  79. package/dist/packem_shared/createClientRPCContext-DzKQpKTk.js +0 -1
  80. package/dist/packem_shared/createDevToolbarHook-DGNxqk8N.js +0 -1
  81. package/dist/packem_shared/createServerRPCContext-CRd6VAWp.js +0 -1
  82. package/dist/packem_shared/sharedToolbarStylesheet-DHHoFz2-.js +0 -2
  83. package/dist/packem_shared/store-BxE0w51s.js +0 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ## @visulima/dev-toolbar [1.0.0-alpha.4](https://github.com/visulima/visulima/compare/@visulima/dev-toolbar@1.0.0-alpha.3...@visulima/dev-toolbar@1.0.0-alpha.4) (2026-03-04)
2
+
3
+ ### Bug Fixes
4
+
5
+ * allowed vite 8 ([807071e](https://github.com/visulima/visulima/commit/807071ea041e1beaf7e773ac6bbd23efa9f33b32))
6
+ * **dev-toolbar:** exclude inspector and tailwind from More "Additional Apps" ([812252a](https://github.com/visulima/visulima/commit/812252a96916ac346765631a0997ff2150e54e40))
7
+
8
+ ### Miscellaneous Chores
9
+
10
+ * deps update ([9be09e9](https://github.com/visulima/visulima/commit/9be09e95e2bce8fe52e88b186c43b8cc6bae865c))
11
+ * **dev-toolbar:** fix all ESLint errors and warnings across src and tests ([a14d2ed](https://github.com/visulima/visulima/commit/a14d2ed116b23ff1c61db28324b76aa55931919c))
12
+ * **dev-toolbar:** remove external Google Fonts dependency ([2e81646](https://github.com/visulima/visulima/commit/2e81646f49a886d8ef9df7f9c951c87363f9b50d))
13
+
1
14
  ## @visulima/dev-toolbar [1.0.0-alpha.3](https://github.com/visulima/visulima/compare/@visulima/dev-toolbar@1.0.0-alpha.2...@visulima/dev-toolbar@1.0.0-alpha.3) (2026-03-03)
2
15
 
3
16
  ### Features
@@ -1,10 +1,10 @@
1
- export type Severity = "critical" | "minor" | "moderate" | "serious";
2
- export type Standard = "best-practice" | "wcag21aa" | "wcag22aa" | "wcag2a";
3
- export interface A11yNode {
1
+ type Severity = "critical" | "minor" | "moderate" | "serious";
2
+ type Standard = "best-practice" | "wcag21aa" | "wcag22aa" | "wcag2a";
3
+ interface A11yNode {
4
4
  html: string;
5
5
  selector: string;
6
6
  }
7
- export interface A11yIssue {
7
+ interface A11yIssue {
8
8
  helpUrl: string;
9
9
  id: string;
10
10
  impact: Severity;
@@ -12,35 +12,31 @@ export interface A11yIssue {
12
12
  nodes: A11yNode[];
13
13
  wcagTags: string[];
14
14
  }
15
- export interface A11yStoreState {
15
+ interface A11yStoreState {
16
16
  isScanning: boolean;
17
17
  issues: A11yIssue[];
18
- lastScan: null | string;
19
- scanError: null | string;
18
+ lastScan: string | undefined;
19
+ scanError: string | undefined;
20
20
  showOverlays: boolean;
21
21
  standard: Standard;
22
22
  }
23
- export declare const SEVERITY_ORDER: Severity[];
23
+ declare const SEVERITY_ORDER: Severity[];
24
24
  type Listener = () => void;
25
25
  declare class A11yStore {
26
26
  private listeners;
27
27
  private state;
28
28
  constructor();
29
- /** Remove all outline highlights from the page */
30
29
  clearHighlights(): void;
31
30
  getState(): Readonly<A11yStoreState>;
32
- /** Scroll to and outline a single issue's elements */
33
31
  highlightIssue(issue: A11yIssue): void;
34
- /** Run an axe-core scan and persist results */
35
32
  scan(disabledRules?: string[]): Promise<void>;
36
- /** Toggle overlay highlights on all affected elements */
37
33
  setShowOverlays(show: boolean): void;
38
- /** Change the WCAG standard used for future scans */
39
34
  setStandard(standard: Standard): void;
40
- subscribe(function_: Listener): () => void;
35
+ subscribe(listener: Listener): () => void;
41
36
  private notify;
42
37
  private persist;
43
38
  private update;
44
39
  }
45
- export declare const a11yStore: A11yStore;
46
- export {};
40
+ declare const a11yStore: A11yStore;
41
+ export type { A11yIssue, A11yNode, A11yStoreState, Severity, Standard };
42
+ export { a11yStore, SEVERITY_ORDER };
@@ -1,21 +1,2 @@
1
- var Y=Object.defineProperty;var A=(a,e)=>Y(a,"name",{value:e,configurable:!0});import{addHookName as S}from"preact/devtools";import{useState as w,useEffect as U}from"preact/hooks";import u from"../../packem_shared/cn-DWLJYh3h.js";import{jsxs as i,jsx as t,Fragment as H}from"preact/jsx-runtime";import y from"../../packem_shared/Button-DODNCTPZ.js";import{Alert as X,AlertDescription as Z}from"../../packem_shared/Alert-H-x1JuZ0.js";const ee=`<!-- @license lucide-static v0.576.0 - ISC -->
2
- <svg
3
- class="lucide lucide-accessibility"
4
- xmlns="http://www.w3.org/2000/svg"
5
- width="24"
6
- height="24"
7
- viewBox="0 0 24 24"
8
- fill="none"
9
- stroke="currentColor"
10
- stroke-width="2"
11
- stroke-linecap="round"
12
- stroke-linejoin="round"
13
- >
14
- <circle cx="16" cy="4" r="1" />
15
- <path d="m18 19 1-7-6 1" />
16
- <path d="m5 8 3-3 5.5 3-2.36 3.5" />
17
- <path d="M4.24 14.5a5 5 0 0 0 6.88 6" />
18
- <path d="M13.76 17.5a5 5 0 0 0-6.88-6" />
19
- </svg>
20
- `;var te=Object.defineProperty,f=A((a,e)=>te(a,"name",{value:e,configurable:!0}),"i$2");const M=["critical","serious","moderate","minor"],re={critical:"rgb(239,68,68)",minor:"rgb(100,116,139)",moderate:"rgb(249,115,22)",serious:"rgb(234,179,8)"},ne={"best-practice":["best-practice"],wcag2a:["wcag2a"],wcag21aa:["wcag2a","wcag2aa","wcag21a","wcag21aa"],wcag22aa:["wcag2a","wcag2aa","wcag21a","wcag21aa","wcag22a","wcag22aa"]},_="__vdt_a11y__",se=f(()=>{try{const a=sessionStorage.getItem(_);if(a){const e=JSON.parse(a);if(Array.isArray(e.issues))return{issues:e.issues,lastScan:e.lastScan??null}}}catch{}return{issues:[],lastScan:null}},"loadFromSession"),W=f((a,e)=>{const s=a;s.dataset.vdtA11y=e,s.style.setProperty("outline",`2px solid ${re[e]}`,"important"),s.style.setProperty("outline-offset","2px","important")},"setHighlight"),$=f(()=>{for(const a of document.querySelectorAll("[data-vdt-a11y]")){const e=a;delete e.dataset.vdtA11y,e.style.removeProperty("outline"),e.style.removeProperty("outline-offset")}},"clearHighlightsDOM"),G=f(a=>{$();for(const e of a)for(const s of e.nodes)try{const r=document.querySelector(s.selector);r&&W(r,e.impact)}catch{}},"applyOverlaysDOM"),ae=f(a=>{const e=a.at(-1);return Array.isArray(e)?e.join(" "):String(e??"")},"nodeSelector"),ie=f((a,e)=>{const s=[];for(const r of a)e.includes(r.id)||s.push({helpUrl:r.helpUrl,id:r.id,impact:r.impact??"minor",message:r.help,nodes:r.nodes.map(o=>({html:o.html,selector:ae(o.target)})),wcagTags:r.tags.filter(o=>o.startsWith("wcag")||o==="best-practice")});return s},"convertViolations"),oe=f(async a=>{const e=await import("axe-core"),s=typeof e.default?.run=="function"?e.default:e;if(typeof s.run!="function")throw new TypeError("axe-core could not be loaded — .run is not available");return s.run(document,{exclude:[["dev-toolbar"]],runOnly:{type:"tag",values:ne[a]}})},"runAxeScan");class le{static{A(this,"f")}static{f(this,"A11yStore")}listeners=new Set;state;constructor(){const{issues:e,lastScan:s}=se();this.state={isScanning:!1,issues:e,lastScan:s,scanError:null,showOverlays:!1,standard:"wcag21aa"}}clearHighlights(){$()}getState(){return this.state}highlightIssue(e){$();let s=!1;for(const r of e.nodes)try{const o=document.querySelector(r.selector);o&&(W(o,e.impact),s||(o.scrollIntoView({behavior:"smooth",block:"center"}),s=!0))}catch{}}async scan(e=[]){if(!this.state.isScanning){this.update({isScanning:!0,scanError:null});try{const s=await oe(this.state.standard),r=ie(s.violations,e);this.update({isScanning:!1,issues:r,lastScan:new Date().toISOString()}),this.persist(),this.state.showOverlays&&G(r)}catch(s){this.update({isScanning:!1,scanError:s instanceof Error?s.message:String(s)})}}}setShowOverlays(e){this.update({showOverlays:e}),e?G(this.state.issues):$()}setStandard(e){this.update({standard:e})}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}notify(){for(const e of this.listeners)e()}persist(){try{sessionStorage.setItem(_,JSON.stringify({issues:this.state.issues,lastScan:this.state.lastScan}))}catch{}}update(e){this.state={...this.state,...e},this.notify()}}const c=new le;var ce=Object.defineProperty,l=A((a,e)=>ce(a,"name",{value:e,configurable:!0}),"o");const I={critical:"Critical",minor:"Minor",moderate:"Moderate",serious:"Serious"},z={critical:"text-destructive",minor:"text-muted-foreground",moderate:"text-warning-foreground",serious:"text-warning-foreground"},de={critical:"bg-destructive/10 border-destructive/30",minor:"bg-foreground/4 border-border",moderate:"bg-warning/10 border-warning/30",serious:"bg-warning/10 border-warning/30"},ue={critical:"bg-destructive",minor:"bg-muted-foreground/50",moderate:"bg-warning",serious:"bg-warning"},ge=l(({count:a,isActive:e,onClick:s,severity:r})=>i("button",{class:u("flex flex-col items-center gap-1 px-3 py-2.5 border cursor-pointer transition-colors",e?"ring-1 ring-inset ring-primary/40":"hover:bg-foreground/6",de[r]),onClick:s,title:`${e?"Clear":"Filter by"} ${I[r]}`,type:"button",children:[t("span",{class:u("text-xl font-bold tabular-nums leading-none",z[r]),children:a}),t("span",{class:"text-[0.6rem] font-semibold uppercase tracking-wider text-muted-foreground",children:I[r]})]}),"SeverityBucket"),pe=l(({isSelected:a,issue:e,onClick:s,onDisable:r})=>i("div",{class:u("p-3 border cursor-pointer transition-colors",a?"bg-foreground/6 border-primary/30":"border-border hover:bg-foreground/3"),onClick:s,children:[i("div",{class:"flex items-start gap-2 mb-1.5",children:[t("span",{class:u("mt-1 size-2 rounded-full shrink-0",ue[e.impact])}),t("span",{class:"text-[0.75rem] font-semibold text-foreground flex-1 leading-snug",children:e.id}),t("span",{class:u("text-[0.6rem] font-bold uppercase tracking-wide shrink-0",z[e.impact]),children:I[e.impact]})]}),t("p",{class:"text-[0.7rem] text-muted-foreground leading-relaxed mb-2 ml-4",children:e.message}),e.nodes.length>0&&i("div",{class:"mb-2 ml-4 space-y-0.5",children:[e.nodes.slice(0,3).map((o,p)=>t("code",{class:"block text-[0.65rem] text-foreground/70 font-mono bg-foreground/5 px-2 py-1 truncate",children:o.selector},p)),e.nodes.length>3&&i("span",{class:"text-[0.62rem] text-muted-foreground/60",children:["+",e.nodes.length-3," more element",e.nodes.length>4?"s":""]})]}),i("div",{class:"flex items-center gap-2 flex-wrap ml-4",children:[e.wcagTags.slice(0,3).map(o=>t("span",{class:"text-[0.58rem] font-mono uppercase bg-primary/8 text-primary/70 border border-primary/20 px-1.5 py-0.5",children:o},o)),t("span",{class:"flex-1"}),t("a",{class:"text-[0.62rem] text-primary/70 hover:text-primary transition-colors",href:e.helpUrl,onClick:l(o=>o.stopPropagation(),"onClick"),rel:"noopener noreferrer",target:"_blank",children:"Learn more ↗"}),t("button",{class:"text-[0.62rem] text-muted-foreground/60 hover:text-muted-foreground transition-colors cursor-pointer bg-transparent border-0 p-0",onClick:l(o=>{o.stopPropagation(),r(e.id)},"onClick"),title:"Disable this rule for current session",type:"button",children:"Disable"})]})]}),"IssueCard"),me=l(a=>{const[e,s]=S(w(()=>c.getState()),"storeState"),[r,o]=S(w([]),"disabledRules"),[p,j]=S(w(null),"minSeverity"),[v,k]=S(w(null),"activeIssueId"),[m,d]=S(w(null),"filterSeverity");U(()=>c.subscribe(()=>s(c.getState())),[]),U(()=>c.clearHighlights.bind(c),[]);const{isScanning:h,issues:b,lastScan:J,scanError:R,showOverlays:N,standard:V}=e,T=J!==null||R!==null,L=l(()=>{d(null),k(null),c.scan(r)},"handleScan"),q=l(n=>{v===n.id?(k(null),c.clearHighlights(),N&&c.setShowOverlays(!0)):(k(n.id),c.highlightIssue(n))},"handleIssueClick"),F=l(n=>{o(g=>[...g,n])},"handleDisableRule"),E=b.filter(n=>!(r.includes(n.id)||m&&n.impact!==m||p&&M.indexOf(n.impact)>M.indexOf(p))),K=l(n=>b.filter(g=>!r.includes(g.id)&&g.impact===n).length,"countBy");return i("div",{class:"flex flex-col h-full",children:[i("div",{class:"shrink-0 flex items-center gap-2 px-4 py-2.5 border-b border-border bg-foreground/2 flex-wrap",children:[t(y,{class:u(h?"border-primary/30 text-primary/50 bg-primary/5":""),disabled:h,onClick:L,size:"sm",variant:"outline",children:h?"Scanning…":"Scan page"}),i("label",{class:"flex items-center gap-1.5 text-[0.7rem] text-muted-foreground",children:["Standard",i("select",{class:"bg-card border border-border text-foreground text-[0.7rem] px-1.5 py-1 cursor-pointer",onChange:l(n=>c.setStandard(n.target.value),"onChange"),style:"color-scheme: dark",value:V,children:[t("option",{value:"wcag21aa",children:"WCAG 2.1 AA"}),t("option",{value:"wcag22aa",children:"WCAG 2.2 AA"}),t("option",{value:"wcag2a",children:"WCAG 2.0 A"}),t("option",{value:"best-practice",children:"Best Practice"})]})]}),i("label",{class:"flex items-center gap-1.5 text-[0.7rem] text-muted-foreground",children:["Min",i("select",{class:"bg-card border border-border text-foreground text-[0.7rem] px-1.5 py-1 cursor-pointer",onChange:l(n=>{const{value:g}=n.target;j(g||null)},"onChange"),style:"color-scheme: dark",value:p??"",children:[t("option",{value:"",children:"All"}),t("option",{value:"critical",children:"Critical only"}),t("option",{value:"serious",children:"Serious+"}),t("option",{value:"moderate",children:"Moderate+"})]})]}),t(y,{class:u(N?"border-primary/30 text-primary bg-primary/8":""),onClick:l(()=>c.setShowOverlays(!N),"onClick"),size:"sm",title:"Toggle visual highlights on affected elements",variant:"outline",children:"Overlays"}),T&&b.length>0&&i(H,{children:[t(y,{class:"ml-auto",onClick:l(()=>{const n=new Blob([JSON.stringify(b,null,2)],{type:"application/json"}),g=URL.createObjectURL(n),C=document.createElement("a");C.href=g,C.download="a11y-audit.json",C.click(),URL.revokeObjectURL(g)},"onClick"),size:"sm",title:"Export audit results as JSON",variant:"outline",children:"JSON"}),t(y,{onClick:l(()=>{const n=l(x=>`"${x.replaceAll('"','""')}"`,"q"),g=["Rule ID","Severity","Message","Selector","HTML","WCAG Tags"].join(","),C=b.flatMap(x=>x.nodes.map(B=>[n(x.id),n(x.impact),n(x.message),n(B.selector),n(B.html),n(x.wcagTags.join("; "))].join(","))),Q=new Blob([[g,...C].join(`
21
- `)],{type:"text/csv"}),P=URL.createObjectURL(Q),D=document.createElement("a");D.href=P,D.download="a11y-audit.csv",D.click(),URL.revokeObjectURL(P)},"onClick"),size:"sm",title:"Export audit results as CSV",variant:"outline",children:"CSV"})]})]}),i("div",{class:"flex-1 overflow-y-auto devtools-content-scroll",children:[R&&t(X,{class:"rounded-none border-x-0 border-t-0",variant:"destructive",children:i(Z,{children:["Scan failed: ",R]})}),!T&&!h&&i("div",{class:"flex flex-col items-center justify-center gap-4 p-8 min-h-48 text-center",children:[t("p",{class:"text-[0.8125rem] text-muted-foreground max-w-sm",children:"Run an accessibility audit using axe-core to detect WCAG violations on this page."}),t(y,{onClick:L,variant:"outline",children:"Start scan"})]}),h&&t("div",{class:"flex items-center justify-center gap-3 p-8 min-h-48",children:t("span",{class:"text-[0.8rem] text-muted-foreground",children:"Scanning for accessibility issues…"})}),T&&!h&&!R&&i("div",{class:"p-5 space-y-4",children:[t("div",{class:"grid grid-cols-4 gap-2",children:M.map(n=>t(ge,{count:K(n),isActive:m===n,onClick:l(()=>d(m===n?null:n),"onClick"),severity:n},n))}),E.length===0?i("div",{class:"p-6 text-center border border-border",children:[t("p",{class:"text-[0.8125rem] font-medium text-foreground/70",children:b.length===0?"No violations found!":"No issues match the current filters."}),b.length===0&&t("p",{class:"mt-1 text-[0.7rem] text-muted-foreground",children:"Great — the page passes all rules for the selected standard."})]}):i("section",{children:[i("div",{class:"flex items-center gap-2 mb-2",children:[i("span",{class:"text-[0.65rem] font-bold uppercase tracking-[0.1em] text-muted-foreground",children:[t("span",{"aria-hidden":"true",class:"text-primary/50",children:"//"})," ",E.length," issue",E.length===1?"":"s",m?` · ${I[m]} only`:""]}),m&&t(y,{class:"h-auto p-0 text-[0.62rem]",onClick:l(()=>d(null),"onClick"),variant:"link",children:"Clear ×"})]}),t("div",{class:"space-y-2",children:E.map(n=>t(pe,{isSelected:v===n.id,issue:n,onClick:l(()=>q(n),"onClick"),onDisable:F},n.id))})]}),r.length>0&&i("div",{class:"flex items-center gap-2 text-[0.65rem] text-muted-foreground/60",children:[i("span",{children:[r.length," rule",r.length===1?"":"s"," disabled this session."]}),t(y,{class:"h-auto p-0 text-[0.62rem]",onClick:l(()=>o([]),"onClick"),variant:"link",children:"Reset"})]})]})]})]})},"A11yApp");var he=Object.defineProperty,O=A((a,e)=>he(a,"name",{value:e,configurable:!0}),"i$1");const fe={critical:"text-destructive",minor:"text-muted-foreground",moderate:"text-warning-foreground",serious:"text-warning-foreground"},be={critical:"Crit",minor:"Min",moderate:"Mod",serious:"Ser"},xe=O(a=>{const e=new Date(a).getTime();if(Number.isNaN(e))return"unknown";const s=Math.max(0,Math.floor((Date.now()-e)/1e3));if(s<10)return"just now";if(s<60)return`${s}s ago`;const r=Math.floor(s/60);return r<60?`${r} min ago`:`${Math.floor(r/60)} hr ago`},"formatElapsed"),ye=O(a=>{const[e,s]=S(w(()=>c.getState()),"state");U(()=>c.subscribe(()=>s(c.getState())),[]);const{isScanning:r,issues:o,lastScan:p,showOverlays:j}=e,v=o.length,k=o.reduce((d,h)=>(d[h.impact]=(d[h.impact]??0)+1,d),{critical:0,minor:0,moderate:0,serious:0}),m=O(d=>k[d],"countBy");return i("div",{class:"space-y-3 min-w-[200px]",children:[p?i(H,{children:[i("div",{class:"flex items-baseline gap-2",children:[t("span",{class:u("text-2xl font-bold tabular-nums leading-none",v>0?"text-destructive":"text-success-foreground"),children:v}),i("span",{class:"text-[0.65rem] text-muted-foreground",children:["violation",v===1?"":"s"]})]}),t("div",{class:"grid grid-cols-4 gap-1.5",children:M.map(d=>i("div",{class:"flex flex-col items-center gap-0.5",children:[t("span",{class:u("text-[0.85rem] font-bold tabular-nums leading-none",fe[d]),children:m(d)}),t("span",{class:"text-[0.55rem] uppercase tracking-wide text-muted-foreground/70",children:be[d]})]},d))}),i("p",{class:"text-[0.62rem] text-muted-foreground/50",children:["Scanned ",xe(p)]})]}):i("div",{children:[t("p",{class:"text-[0.72rem] text-muted-foreground",children:"No scan run yet."}),t("p",{class:"text-[0.65rem] text-muted-foreground/50 mt-0.5",children:"Scan this page to detect WCAG violations."})]}),i("div",{class:"flex items-center gap-2 pt-2 border-t border-border/50",children:[t("button",{class:u("flex-1 px-2.5 py-1.5 text-[0.7rem] font-medium border transition-colors cursor-pointer",r?"border-primary/30 text-primary/50 bg-primary/5 cursor-not-allowed":"border-border text-foreground bg-transparent hover:bg-foreground/5"),disabled:r,onClick:O(()=>{c.scan()},"onClick"),type:"button",children:r?"Scanning…":p?"Re-scan":"Scan"}),t("button",{class:u("px-2.5 py-1.5 text-[0.7rem] border transition-colors",o.length===0?"border-border/50 text-muted-foreground/40 bg-transparent cursor-not-allowed":u("cursor-pointer",j?"border-primary/30 text-primary bg-primary/8":"border-border text-muted-foreground bg-transparent hover:text-foreground")),disabled:o.length===0,onClick:O(()=>c.setShowOverlays(!j),"onClick"),title:"Toggle visual highlights on affected elements",type:"button",children:"Overlays"})]})]})},"A11yTooltip"),je={component:me,icon:ee,id:"dev-toolbar:a11y",name:"Accessibility",tooltip:ye};export{je as default};
1
+ var X=Object.defineProperty;var O=(n,e)=>X(n,"name",{value:e,configurable:!0});import Y from"lucide-static/icons/accessibility.svg?raw";import{addHookName as k}from"preact/devtools";import{useState as C,useEffect as L}from"preact/hooks";import d from"../../packem_shared/cn-DWLJYh3h.js";import{jsxs as i,jsx as t,Fragment as W}from"preact/jsx-runtime";import S from"../../packem_shared/Button-DODNCTPZ.js";import{Alert as Z,AlertDescription as ee}from"../../packem_shared/Alert-H-x1JuZ0.js";var te=Object.defineProperty,x=O((n,e)=>te(n,"name",{value:e,configurable:!0}),"i$3");const E=["critical","serious","moderate","minor"],re={critical:"rgb(239,68,68)",minor:"rgb(100,116,139)",moderate:"rgb(249,115,22)",serious:"rgb(234,179,8)"},se={"best-practice":["best-practice"],wcag2a:["wcag2a"],wcag21aa:["wcag2a","wcag2aa","wcag21a","wcag21aa"],wcag22aa:["wcag2a","wcag2aa","wcag21a","wcag21aa","wcag22a","wcag22aa"]},_="__vdt_a11y__",ae=x(()=>{try{const n=sessionStorage.getItem(_);if(n){const e=JSON.parse(n);if(Array.isArray(e.issues))return{issues:e.issues,lastScan:e.lastScan??void 0}}}catch{}return{issues:[],lastScan:void 0}},"loadFromSession"),z=x((n,e)=>{const a=n;a.dataset.vdtA11y=e,a.style.setProperty("outline",`2px solid ${re[e]}`,"important"),a.style.setProperty("outline-offset","2px","important")},"setHighlight"),N=x(()=>{for(const n of document.querySelectorAll("[data-vdt-a11y]")){const e=n;delete e.dataset.vdtA11y,e.style.removeProperty("outline"),e.style.removeProperty("outline-offset")}},"clearHighlightsDOM"),B=x(n=>{N();for(const e of n)for(const a of e.nodes)try{const r=document.querySelector(a.selector);r&&z(r,e.impact)}catch{}},"applyOverlaysDOM"),ne=x(n=>{const e=n.at(-1);return Array.isArray(e)?e.join(" "):String(e??"")},"nodeSelector"),ie=x((n,e)=>{const a=[];for(const r of n)e.includes(r.id)||a.push({helpUrl:r.helpUrl,id:r.id,impact:r.impact??"minor",message:r.help,nodes:r.nodes.map(o=>({html:o.html,selector:ne(o.target)})),wcagTags:r.tags.filter(o=>o.startsWith("wcag")||o==="best-practice")});return a},"convertViolations"),oe=x(async n=>{const e=await import("axe-core"),a=typeof e.default?.run=="function"?e.default:e;if(typeof a.run!="function")throw new TypeError("axe-core could not be loaded — .run is not available");return a.run(document,{exclude:[["dev-toolbar"]],runOnly:{type:"tag",values:se[n]}})},"runAxeScan");class le{static{O(this,"v")}static{x(this,"A11yStore")}listeners=new Set;state;constructor(){const{issues:e,lastScan:a}=ae();this.state={isScanning:!1,issues:e,lastScan:a,scanError:void 0,showOverlays:!1,standard:"wcag21aa"}}clearHighlights(){N()}getState(){return this.state}highlightIssue(e){N();let a=!1;for(const r of e.nodes)try{const o=document.querySelector(r.selector);o&&(z(o,e.impact),a||(o.scrollIntoView({behavior:"smooth",block:"center"}),a=!0))}catch{}}async scan(e=[]){if(!this.state.isScanning){this.update({isScanning:!0,scanError:void 0});try{const a=await oe(this.state.standard),r=ie(a.violations,e);this.update({isScanning:!1,issues:r,lastScan:new Date().toISOString()}),this.persist(),this.state.showOverlays&&B(r)}catch(a){this.update({isScanning:!1,scanError:a instanceof Error?a.message:String(a)})}}}setShowOverlays(e){this.update({showOverlays:e}),e?B(this.state.issues):N()}setStandard(e){this.update({standard:e})}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}notify(){for(const e of this.listeners)e()}persist(){try{sessionStorage.setItem(_,JSON.stringify({issues:this.state.issues,lastScan:this.state.lastScan}))}catch{}}update(e){this.state={...this.state,...e},this.notify()}}const c=new le;var ce=Object.defineProperty,l=O((n,e)=>ce(n,"name",{value:e,configurable:!0}),"i$2");const I={critical:"Critical",minor:"Minor",moderate:"Moderate",serious:"Serious"},J={critical:"text-destructive",minor:"text-muted-foreground",moderate:"text-warning-foreground",serious:"text-warning-foreground"},de={critical:"bg-destructive/10 border-destructive/30",minor:"bg-foreground/4 border-border",moderate:"bg-warning/10 border-warning/30",serious:"bg-warning/10 border-warning/30"},ue={critical:"bg-destructive",minor:"bg-muted-foreground/50",moderate:"bg-warning",serious:"bg-warning"},ge=l(({count:n,isActive:e,onClick:a,severity:r})=>i("button",{class:d("flex flex-col items-center gap-1 px-3 py-2.5 border cursor-pointer transition-colors",e?"ring-1 ring-inset ring-primary/40":"hover:bg-foreground/6",de[r]),onClick:a,title:`${e?"Clear":"Filter by"} ${I[r]}`,type:"button",children:[t("span",{class:d("text-xl font-bold tabular-nums leading-none",J[r]),children:n}),t("span",{class:"text-[0.6rem] font-semibold uppercase tracking-wider text-muted-foreground",children:I[r]})]}),"SeverityBucket"),me=l(({isSelected:n,issue:e,onClick:a,onDisable:r})=>i("div",{class:d("p-3 border cursor-pointer transition-colors",n?"bg-foreground/6 border-primary/30":"border-border hover:bg-foreground/3"),onClick:a,children:[i("div",{class:"flex items-start gap-2 mb-1.5",children:[t("span",{class:d("mt-1 size-2 rounded-full shrink-0",ue[e.impact])}),t("span",{class:"text-[0.75rem] font-semibold text-foreground flex-1 leading-snug",children:e.id}),t("span",{class:d("text-[0.6rem] font-bold uppercase tracking-wide shrink-0",J[e.impact]),children:I[e.impact]})]}),t("p",{class:"text-[0.7rem] text-muted-foreground leading-relaxed mb-2 ml-4",children:e.message}),e.nodes.length>0&&i("div",{class:"mb-2 ml-4 space-y-0.5",children:[e.nodes.slice(0,3).map((o,m)=>t("code",{class:"block text-[0.65rem] text-foreground/70 font-mono bg-foreground/5 px-2 py-1 truncate",children:o.selector},m)),e.nodes.length>3&&i("span",{class:"text-[0.62rem] text-muted-foreground/60",children:["+",e.nodes.length-3," more element",e.nodes.length>4?"s":""]})]}),i("div",{class:"flex items-center gap-2 flex-wrap ml-4",children:[e.wcagTags.slice(0,3).map(o=>t("span",{class:"text-[0.58rem] font-mono uppercase bg-primary/8 text-primary/70 border border-primary/20 px-1.5 py-0.5",children:o},o)),t("span",{class:"flex-1"}),t("a",{class:"text-[0.62rem] text-primary/70 hover:text-primary transition-colors",href:e.helpUrl,onClick:l(o=>o.stopPropagation(),"onClick"),rel:"noopener noreferrer",target:"_blank",children:"Learn more ↗"}),t("button",{class:"text-[0.62rem] text-muted-foreground/60 hover:text-muted-foreground transition-colors cursor-pointer bg-transparent border-0 p-0",onClick:l(o=>{o.stopPropagation(),r(e.id)},"onClick"),title:"Disable this rule for current session",type:"button",children:"Disable"})]})]}),"IssueCard"),pe=l(n=>{const[e,a]=k(C(()=>c.getState()),"storeState"),[r,o]=k(C([]),"disabledRules"),[m,$]=k(C(void 0),"minSeverity"),[w,v]=k(C(void 0),"activeIssueId"),[p,f]=k(C(void 0),"filterSeverity");L(()=>c.subscribe(()=>a(c.getState())),[]),L(()=>c.clearHighlights.bind(c),[]);const{isScanning:b,issues:h,lastScan:u,scanError:M,showOverlays:T,standard:q}=e,U=u!==void 0||M!==void 0,P=l(()=>{f(void 0),v(void 0),c.scan(r).catch(()=>{})},"handleScan"),V=l(s=>{w===s.id?(v(void 0),c.clearHighlights(),T&&c.setShowOverlays(!0)):(v(s.id),c.highlightIssue(s))},"handleIssueClick"),F=l(s=>{o(g=>[...g,s])},"handleDisableRule"),R=h.filter(s=>!(r.includes(s.id)||p&&s.impact!==p||m&&E.indexOf(s.impact)>E.indexOf(m))),K=l(s=>h.filter(g=>!r.includes(g.id)&&g.impact===s).length,"countBy");return i("div",{class:"flex flex-col h-full",children:[i("div",{class:"shrink-0 flex items-center gap-2 px-4 py-2.5 border-b border-border bg-foreground/2 flex-wrap",children:[t(S,{class:d(b?"border-primary/30 text-primary/50 bg-primary/5":""),disabled:b,onClick:P,size:"sm",variant:"outline",children:b?"Scanning…":"Scan page"}),i("label",{class:"flex items-center gap-1.5 text-[0.7rem] text-muted-foreground",children:["Standard",i("select",{class:"bg-card border border-border text-foreground text-[0.7rem] px-1.5 py-1 cursor-pointer",onChange:l(s=>c.setStandard(s.target.value),"onChange"),style:"color-scheme: dark",value:q,children:[t("option",{value:"wcag21aa",children:"WCAG 2.1 AA"}),t("option",{value:"wcag22aa",children:"WCAG 2.2 AA"}),t("option",{value:"wcag2a",children:"WCAG 2.0 A"}),t("option",{value:"best-practice",children:"Best Practice"})]})]}),i("label",{class:"flex items-center gap-1.5 text-[0.7rem] text-muted-foreground",children:["Min",i("select",{class:"bg-card border border-border text-foreground text-[0.7rem] px-1.5 py-1 cursor-pointer",onChange:l(s=>{const{value:g}=s.target;$(g||void 0)},"onChange"),style:"color-scheme: dark",value:m??"",children:[t("option",{value:"",children:"All"}),t("option",{value:"critical",children:"Critical only"}),t("option",{value:"serious",children:"Serious+"}),t("option",{value:"moderate",children:"Moderate+"})]})]}),t(S,{class:d(T?"border-primary/30 text-primary bg-primary/8":""),onClick:l(()=>c.setShowOverlays(!T),"onClick"),size:"sm",title:"Toggle visual highlights on affected elements",variant:"outline",children:"Overlays"}),U&&h.length>0&&i(W,{children:[t(S,{class:"ml-auto",onClick:l(()=>{const s=new Blob([JSON.stringify(h,void 0,2)],{type:"application/json"}),g=URL.createObjectURL(s),A=document.createElement("a");A.href=g,A.download="a11y-audit.json",A.click(),URL.revokeObjectURL(g)},"onClick"),size:"sm",title:"Export audit results as JSON",variant:"outline",children:"JSON"}),t(S,{onClick:l(()=>{const s=l(y=>`"${y.replaceAll('"','""')}"`,"q"),g=["Rule ID","Severity","Message","Selector","HTML","WCAG Tags"].join(","),A=h.flatMap(y=>y.nodes.map(H=>[s(y.id),s(y.impact),s(y.message),s(H.selector),s(H.html),s(y.wcagTags.join("; "))].join(","))),Q=new Blob([[g,...A].join(`
2
+ `)],{type:"text/csv"}),G=URL.createObjectURL(Q),D=document.createElement("a");D.href=G,D.download="a11y-audit.csv",D.click(),URL.revokeObjectURL(G)},"onClick"),size:"sm",title:"Export audit results as CSV",variant:"outline",children:"CSV"})]})]}),i("div",{class:"flex-1 overflow-y-auto devtools-content-scroll",children:[M&&t(Z,{class:"rounded-none border-x-0 border-t-0",variant:"destructive",children:i(ee,{children:["Scan failed: ",M]})}),!U&&!b&&i("div",{class:"flex flex-col items-center justify-center gap-4 p-8 min-h-48 text-center",children:[t("p",{class:"text-[0.8125rem] text-muted-foreground max-w-sm",children:"Run an accessibility audit using axe-core to detect WCAG violations on this page."}),t(S,{onClick:P,variant:"outline",children:"Start scan"})]}),b&&t("div",{class:"flex items-center justify-center gap-3 p-8 min-h-48",children:t("span",{class:"text-[0.8rem] text-muted-foreground",children:"Scanning for accessibility issues…"})}),U&&!b&&!M&&i("div",{class:"p-5 space-y-4",children:[t("div",{class:"grid grid-cols-4 gap-2",children:E.map(s=>t(ge,{count:K(s),isActive:p===s,onClick:l(()=>f(p===s?void 0:s),"onClick"),severity:s},s))}),R.length===0?i("div",{class:"p-6 text-center border border-border",children:[t("p",{class:"text-[0.8125rem] font-medium text-foreground/70",children:h.length===0?"No violations found!":"No issues match the current filters."}),h.length===0&&t("p",{class:"mt-1 text-[0.7rem] text-muted-foreground",children:"Great — the page passes all rules for the selected standard."})]}):i("section",{children:[i("div",{class:"flex items-center gap-2 mb-2",children:[i("span",{class:"text-[0.65rem] font-bold uppercase tracking-[0.1em] text-muted-foreground",children:[t("span",{"aria-hidden":"true",class:"text-primary/50",children:"//"})," ",R.length," issue",R.length===1?"":"s",p?` · ${I[p]} only`:""]}),p&&t(S,{class:"h-auto p-0 text-[0.62rem]",onClick:l(()=>f(void 0),"onClick"),variant:"link",children:"Clear ×"})]}),t("div",{class:"space-y-2",children:R.map(s=>t(me,{isSelected:w===s.id,issue:s,onClick:l(()=>V(s),"onClick"),onDisable:F},s.id))})]}),r.length>0&&i("div",{class:"flex items-center gap-2 text-[0.65rem] text-muted-foreground/60",children:[i("span",{children:[r.length," rule",r.length===1?"":"s"," disabled this session."]}),t(S,{class:"h-auto p-0 text-[0.62rem]",onClick:l(()=>o([]),"onClick"),variant:"link",children:"Reset"})]})]})]})]})},"A11yApp");var he=Object.defineProperty,j=O((n,e)=>he(n,"name",{value:e,configurable:!0}),"i$1");const fe={critical:"text-destructive",minor:"text-muted-foreground",moderate:"text-warning-foreground",serious:"text-warning-foreground"},be={critical:"Crit",minor:"Min",moderate:"Mod",serious:"Ser"},xe=j(n=>{const e=new Date(n).getTime();if(Number.isNaN(e))return"unknown";const a=Math.max(0,Math.floor((Date.now()-e)/1e3));if(a<10)return"just now";if(a<60)return`${a}s ago`;const r=Math.floor(a/60);return r<60?`${r} min ago`:`${Math.floor(r/60)} hr ago`},"formatElapsed"),ve=j(n=>{const[e,a]=k(C(()=>c.getState()),"state");L(()=>c.subscribe(()=>a(c.getState())),[]);const{isScanning:r,issues:o,lastScan:m,showOverlays:$}=e,w=o.length,v={critical:0,minor:0,moderate:0,serious:0};for(const u of o)v[u.impact]=(v[u.impact]??0)+1;const p=j(u=>v[u],"countBy");let f;r?f="Scanning…":m?f="Re-scan":f="Scan";const b=$?"border-primary/30 text-primary bg-primary/8":"border-border text-muted-foreground bg-transparent hover:text-foreground",h=o.length===0?"border-border/50 text-muted-foreground/40 bg-transparent cursor-not-allowed":d("cursor-pointer",b);return i("div",{class:"space-y-3 min-w-[200px]",children:[m?i(W,{children:[i("div",{class:"flex items-baseline gap-2",children:[t("span",{class:d("text-2xl font-bold tabular-nums leading-none",w>0?"text-destructive":"text-success-foreground"),children:w}),i("span",{class:"text-[0.65rem] text-muted-foreground",children:["violation",w===1?"":"s"]})]}),t("div",{class:"grid grid-cols-4 gap-1.5",children:E.map(u=>i("div",{class:"flex flex-col items-center gap-0.5",children:[t("span",{class:d("text-[0.85rem] font-bold tabular-nums leading-none",fe[u]),children:p(u)}),t("span",{class:"text-[0.55rem] uppercase tracking-wide text-muted-foreground/70",children:be[u]})]},u))}),i("p",{class:"text-[0.62rem] text-muted-foreground/50",children:["Scanned ",xe(m)]})]}):i("div",{children:[t("p",{class:"text-[0.72rem] text-muted-foreground",children:"No scan run yet."}),t("p",{class:"text-[0.65rem] text-muted-foreground/50 mt-0.5",children:"Scan this page to detect WCAG violations."})]}),i("div",{class:"flex items-center gap-2 pt-2 border-t border-border/50",children:[t("button",{class:d("flex-1 px-2.5 py-1.5 text-[0.7rem] font-medium border transition-colors cursor-pointer",r?"border-primary/30 text-primary/50 bg-primary/5 cursor-not-allowed":"border-border text-foreground bg-transparent hover:bg-foreground/5"),disabled:r,onClick:j(()=>{c.scan().catch(()=>{})},"onClick"),type:"button",children:f}),t("button",{class:d("px-2.5 py-1.5 text-[0.7rem] border transition-colors",h),disabled:o.length===0,onClick:j(()=>c.setShowOverlays(!$),"onClick"),title:"Toggle visual highlights on affected elements",type:"button",children:"Overlays"})]})]})},"A11yTooltip"),$e={component:pe,icon:Y,id:"dev-toolbar:a11y",name:"Accessibility",tooltip:ve};export{$e as default};
@@ -1,17 +1 @@
1
- var A=Object.defineProperty;var w=(t,e)=>A(t,"name",{value:e,configurable:!0});const j=`<!-- @license lucide-static v0.576.0 - ISC -->
2
- <svg
3
- class="lucide lucide-inspect"
4
- xmlns="http://www.w3.org/2000/svg"
5
- width="24"
6
- height="24"
7
- viewBox="0 0 24 24"
8
- fill="none"
9
- stroke="currentColor"
10
- stroke-width="2"
11
- stroke-linecap="round"
12
- stroke-linejoin="round"
13
- >
14
- <path d="M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z" />
15
- <path d="M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6" />
16
- </svg>
17
- `;var H=Object.defineProperty,r=w((t,e)=>H(t,"name",{value:e,configurable:!0}),"r");const _={bg:"#18181b",btnBg:"rgba(196,181,253,0.08)",btnBgHover:"rgba(196,181,253,0.16)",btnBorder:"rgba(196,181,253,0.25)",btnBorderHover:"rgba(196,181,253,0.5)",fg:"#fafafa",muted:"#a1a1aa",overlayBg:"rgba(196,181,253,0.06)",overlayBorder:"rgba(196,181,253,0.7)",primary:"#c4b5fd",shadow:"0 8px 32px rgba(0,0,0,.75)"},$={bg:"#ffffff",btnBg:"rgba(124,58,237,0.08)",btnBgHover:"rgba(124,58,237,0.16)",btnBorder:"rgba(124,58,237,0.25)",btnBorderHover:"rgba(124,58,237,0.5)",fg:"#18181b",muted:"#52525b",overlayBg:"rgba(124,58,237,0.06)",overlayBorder:"rgba(124,58,237,0.7)",primary:"#7c3aed",shadow:"0 8px 32px rgba(0,0,0,.15)"},y=r(()=>{try{const t=localStorage.getItem("__v_dt__theme");if(t==="light")return $;if(t==="dark")return _}catch{}return globalThis.window?.matchMedia("(prefers-color-scheme: dark)").matches?_:$},"getThemePalette"),x="__vdt_inspector_overlay",I="__vdt_inspector_label",h="__vdt_inspector_cursor",E="__vdt_inspector_badge",k="__vdt_inspector_kf",T="__vdt_inspector_result",S=r(()=>{let t=document.getElementById(x);if(!t){const e=y();t=document.createElement("div"),t.id=x,t.style.cssText=["position:fixed","pointer-events:none","z-index:2147483644","box-sizing:border-box",`border:1px solid ${e.overlayBorder}`,`background:${e.overlayBg}`,"transition:top 60ms,left 60ms,width 60ms,height 60ms","display:none"].join(";");const o=document.createElement("div");o.id=I,o.style.cssText=["position:absolute","bottom:calc(100% + 2px)","left:0",`background:${e.bg}`,`color:${e.primary}`,"font:11px/1.2 'JetBrains Mono',monospace","padding:2px 6px","white-space:nowrap","pointer-events:none",`border:1px solid ${e.btnBorder}`].join(";"),t.append(o),document.body.append(t)}return t},"getOrCreateOverlay"),O=r(t=>{let e=t;for(;e;){const o=e.dataset.vdtSource;if(o)return o;e=e.parentElement}return null},"findSource"),P=r(t=>{const e=t.split(":");if(e.length<3)return t;const o=e[e.length-2],n=e.slice(0,-2).join(":");return`${n.split("/").pop()??n}:${o}`},"formatSourceShort"),D=r(t=>{const e=document.getElementById(x);if(!e)return;const o=t.getBoundingClientRect();e.style.display="block",e.style.top=`${o.top}px`,e.style.left=`${o.left}px`,e.style.width=`${o.width}px`,e.style.height=`${o.height}px`;const n=document.getElementById(I);if(n){const a=t.tagName.toLowerCase(),l=t.id?`#${t.id}`:"",c=t.classList.length>0?`.${[...t.classList].slice(0,3).join(".")}`:"",d=`${a}${l}${c}`,i=O(t);n.textContent=i?`${d} · ${P(i)}`:d,o.top<28?(n.style.bottom="auto",n.style.top="calc(100% + 2px)"):(n.style.top="",n.style.bottom="calc(100% + 2px)")}},"updateOverlayPosition"),L=r(()=>{const t=document.getElementById(x);t&&(t.style.display="none")},"hideOverlay"),R=r(()=>{document.getElementById(x)?.remove(),document.getElementById(h)?.remove()},"removeOverlay"),C=r(t=>{let e=document.getElementById(h);t?(e||(e=document.createElement("style"),e.id=h,document.head.append(e)),e.textContent="*, *::before, *::after { cursor: crosshair !important; }"):e&&e.remove()},"setCrosshairCursor"),V=r(t=>{if(!document.getElementById(k)){const d=document.createElement("style");d.id=k,d.textContent="@keyframes __vdt_pulse{0%,100%{opacity:1}50%{opacity:.3}}",document.head.append(d)}M();const e=y(),o=document.createElement("div");o.id=E,o.style.cssText=["position:fixed","bottom:4rem","left:50%","transform:translateX(-50%)","z-index:2147483645","display:flex","align-items:center","gap:8px","padding:6px 14px 6px 10px",`background:${e.bg}`,`border:1px solid ${e.btnBorder}`,`box-shadow:${e.shadow}`,"font:12px/1 'JetBrains Mono',monospace",`color:${e.fg}`,"pointer-events:auto","user-select:none","white-space:nowrap"].join(";");const n=document.createElement("span");n.style.cssText=`display:inline-block;width:7px;height:7px;border-radius:50%;background:${e.primary};animation:__vdt_pulse 1.4s ease-in-out infinite;flex-shrink:0;`;const a=document.createElement("span");a.textContent="Click any element to inspect";const l=document.createElement("span");l.style.cssText=`color:${e.muted};margin:0 4px;`,l.textContent="·";const c=document.createElement("button");c.textContent="Cancel",c.style.cssText=`background:transparent;border:none;color:${e.primary};cursor:pointer;padding:0;font:12px/1 'JetBrains Mono',monospace;text-decoration:underline;text-underline-offset:3px;`,c.addEventListener("click",d=>{d.stopPropagation(),t()}),o.append(n,a,l,c),document.body.append(o)},"createFloatingBadge"),M=r(()=>{document.getElementById(E)?.remove()},"removeFloatingBadge"),z=r(t=>{const e=t.split(":"),o=Number.parseInt(e.at(-1)??"0",10)||void 0,n=Number.parseInt(e.at(-2)??"0",10)||void 0,a=e.slice(0,-2).join(":");globalThis.__VISULIMA_DEVTOOLS__?.rpc?.openInEditor?.(a,n,o)},"openInEditor"),g=r(()=>{document.getElementById(T)?.remove()},"removeResultPopup"),f=r((t,e)=>{const o=y(),n=document.createElement("button");return n.textContent=t,n.style.cssText=[`background:${o.btnBg}`,`border:1px solid ${o.btnBorder}`,`color:${o.primary}`,"cursor:pointer","font:11px/1 'JetBrains Mono',monospace","padding:5px 10px","white-space:nowrap"].join(";"),n.addEventListener("pointerover",()=>{n.style.background=o.btnBgHover,n.style.borderColor=o.btnBorderHover}),n.addEventListener("pointerout",()=>{n.style.background=o.btnBg,n.style.borderColor=o.btnBorder}),n.addEventListener("click",a=>{a.stopPropagation(),e()}),n},"makeActionButton"),J=r((t,e,o)=>{g();const n=y(),a=document.createElement("div");a.id=T,a.style.cssText=["position:fixed","z-index:2147483646",`background:${n.bg}`,`border:1px solid ${n.btnBorder}`,"padding:10px 32px 10px 12px","font:12px/1.4 'JetBrains Mono',monospace",`color:${n.fg}`,`box-shadow:${n.shadow}`,"min-width:200px","max-width:400px","pointer-events:auto"].join(";");let l=e.bottom+8;l+110>window.innerHeight&&(l=e.top-110-8);let{left:c}=e;c+280>window.innerWidth&&(c=Math.max(8,window.innerWidth-288)),a.style.top=`${l}px`,a.style.left=`${c}px`;const d=t.tagName.toLowerCase(),i=t.id?`#${t.id}`:"",s=t.classList.length>0?`.${[...t.classList].slice(0,3).join(".")}`:"",b=document.createElement("div");if(b.style.cssText=`color:${n.primary};font-weight:bold;margin-bottom:4px;word-break:break-all;`,b.textContent=`${d}${i}${s}`,a.append(b),o){const u=document.createElement("div");u.style.cssText=`color:${n.muted};margin-bottom:10px;word-break:break-all;font-size:10px;`,u.textContent=o,a.append(u)}const m=document.createElement("div");m.style.cssText="display:flex;gap:6px;flex-wrap:wrap;",o&&m.append(f("Open in editor",()=>{z(o),g()})),m.append(f("Copy HTML",()=>{navigator.clipboard.writeText(t.outerHTML),g()})),o&&m.append(f("Copy path",()=>{navigator.clipboard.writeText(o),g()})),a.append(m);const p=document.createElement("button");p.textContent="×",p.style.cssText=["position:absolute","top:6px","right:8px","background:transparent","border:none",`color:${n.muted}`,"cursor:pointer","font:16px/1 'JetBrains Mono',monospace","padding:0","line-height:1","transition:color 0.15s"].join(";"),p.addEventListener("pointerover",()=>{p.style.color=n.fg}),p.addEventListener("pointerout",()=>{p.style.color=n.muted}),p.addEventListener("click",u=>{u.stopPropagation(),g()}),a.append(p),document.body.append(a);const B=r(u=>{a.contains(u.target)||(g(),document.removeEventListener("click",B,!0))},"handleOutside");setTimeout(()=>{document.addEventListener("click",B,!0)},100)},"showResultPopup");let v=null;const N=r((t,e)=>{v?.(),S(),C(!0);const o=r(()=>document.getElementById(E),"badgeElement"),n=r(i=>{if(!i)return!1;const s=o();return!!(s&&(i===s||s.contains(i)))},"isOverBadge"),a=r(i=>{const s=i.target;if(!s||s.tagName==="DEV-TOOLBAR"||n(s)){L();return}D(s)},"handleMouseMove"),l=r(i=>{const s=i.target;if(!s||s.tagName==="DEV-TOOLBAR"||n(s))return;i.preventDefault(),i.stopPropagation();const b=s.getBoundingClientRect(),m=O(s);d(),t(),J(s,b,m)},"handleClick"),c=r(i=>{i.key==="Escape"&&(d(),e())},"handleKeyDown"),d=r(()=>{document.removeEventListener("mousemove",a),document.removeEventListener("click",l,!0),document.removeEventListener("keydown",c),L(),R(),C(!1),M(),v=null},"cleanup");V(()=>{d(),e()}),document.addEventListener("mousemove",a),document.addEventListener("click",l,!0),document.addEventListener("keydown",c),v=d},"startGlobalInspection"),G=r(()=>{v?.(),g()},"stopGlobalInspection"),U={icon:j,id:"dev-toolbar:inspector",name:"Inspector",onClick(){const t=globalThis.__VISULIMA_DEVTOOLS__;N(()=>{t?.setAppActive&&t.setAppActive("dev-toolbar:inspector",!1)},()=>{t?.setAppActive&&t.setAppActive("dev-toolbar:inspector",!1)})},onDeactivate(){G()}};export{U as default};
1
+ var I=Object.defineProperty;var w=(t,e)=>I(t,"name",{value:e,configurable:!0});import A from"lucide-static/icons/inspect.svg?raw";var q=Object.defineProperty,s=w((t,e)=>q(t,"name",{value:e,configurable:!0}),"s");const E={bg:"#18181b",btnBg:"rgba(196,181,253,0.08)",btnBgHover:"rgba(196,181,253,0.16)",btnBorder:"rgba(196,181,253,0.25)",btnBorderHover:"rgba(196,181,253,0.5)",fg:"#fafafa",muted:"#a1a1aa",overlayBg:"rgba(196,181,253,0.06)",overlayBorder:"rgba(196,181,253,0.7)",primary:"#c4b5fd",shadow:"0 8px 32px rgba(0,0,0,.75)"},k={bg:"#ffffff",btnBg:"rgba(124,58,237,0.08)",btnBgHover:"rgba(124,58,237,0.16)",btnBorder:"rgba(124,58,237,0.25)",btnBorderHover:"rgba(124,58,237,0.5)",fg:"#18181b",muted:"#52525b",overlayBg:"rgba(124,58,237,0.06)",overlayBorder:"rgba(124,58,237,0.7)",primary:"#7c3aed",shadow:"0 8px 32px rgba(0,0,0,.15)"},y=s(()=>{try{const t=localStorage.getItem("__v_dt__theme");if(t==="light")return k;if(t==="dark")return E}catch{}return globalThis.window?.matchMedia("(prefers-color-scheme: dark)").matches?E:k},"getThemePalette"),v="__vdt_inspector_overlay",T="__vdt_inspector_label",h="__vdt_inspector_cursor",$="__vdt_inspector_badge",B="__vdt_inspector_kf",S="__vdt_inspector_result",j=s(()=>{let t=document.querySelector(`#${v}`);if(!t){const e=y();t=document.createElement("div"),t.id=v,t.style.cssText=["position:fixed","pointer-events:none","z-index:2147483644","box-sizing:border-box",`border:1px solid ${e.overlayBorder}`,`background:${e.overlayBg}`,"transition:top 60ms,left 60ms,width 60ms,height 60ms","display:none"].join(";");const o=document.createElement("div");o.id=T,o.style.cssText=["position:absolute","bottom:calc(100% + 2px)","left:0",`background:${e.bg}`,`color:${e.primary}`,"font:11px/1.2 'JetBrains Mono',monospace","padding:2px 6px","white-space:nowrap","pointer-events:none",`border:1px solid ${e.btnBorder}`].join(";"),t.append(o),document.body.append(t)}return t},"getOrCreateOverlay"),M=s(t=>{let e=t;for(;e;){const o=e.dataset.vdtSource;if(o)return o;e=e.parentElement??void 0}},"findSource"),D=s(t=>{const e=t.split(":");if(e.length<3)return t;const o=e[e.length-2],n=e.slice(0,-2).join(":");return`${n.split("/").pop()??n}:${o}`},"formatSourceShort"),H=s(t=>{const e=document.querySelector(`#${v}`);if(!e)return;const o=t.getBoundingClientRect();e.style.display="block",e.style.top=`${o.top}px`,e.style.left=`${o.left}px`,e.style.width=`${o.width}px`,e.style.height=`${o.height}px`;const n=document.querySelector(`#${T}`);if(n){const r=t.tagName.toLowerCase(),c=t.id?`#${t.id}`:"",d=t.classList.length>0?`.${[...t.classList].slice(0,3).join(".")}`:"",l=`${r}${c}${d}`,g=M(t);n.textContent=g?`${l} · ${D(g)}`:l,o.top<28?(n.style.bottom="auto",n.style.top="calc(100% + 2px)"):(n.style.top="",n.style.bottom="calc(100% + 2px)")}},"updateOverlayPosition"),L=s(()=>{const t=document.querySelector(`#${v}`);t&&(t.style.display="none")},"hideOverlay"),P=s(()=>{document.querySelector(`#${v}`)?.remove(),document.querySelector(`#${h}`)?.remove()},"removeOverlay"),C=s(t=>{let e=document.querySelector(`#${h}`);t?(e||(e=document.createElement("style"),e.id=h,document.head.append(e)),e.textContent="*, *::before, *::after { cursor: crosshair !important; }"):e&&e.remove()},"setCrosshairCursor"),O=s(()=>{document.querySelector(`#${$}`)?.remove()},"removeFloatingBadge"),R=s(t=>{if(!document.querySelector(`#${B}`)){const l=document.createElement("style");l.id=B,l.textContent="@keyframes __vdt_pulse{0%,100%{opacity:1}50%{opacity:.3}}",document.head.append(l)}O();const e=y(),o=document.createElement("div");o.id=$,o.style.cssText=["position:fixed","bottom:4rem","left:50%","transform:translateX(-50%)","z-index:2147483645","display:flex","align-items:center","gap:8px","padding:6px 14px 6px 10px",`background:${e.bg}`,`border:1px solid ${e.btnBorder}`,`box-shadow:${e.shadow}`,"font:12px/1 'JetBrains Mono',monospace",`color:${e.fg}`,"pointer-events:auto","user-select:none","white-space:nowrap"].join(";");const n=document.createElement("span");n.style.cssText=`display:inline-block;width:7px;height:7px;border-radius:50%;background:${e.primary};animation:__vdt_pulse 1.4s ease-in-out infinite;flex-shrink:0;`;const r=document.createElement("span");r.textContent="Click any element to inspect";const c=document.createElement("span");c.style.cssText=`color:${e.muted};margin:0 4px;`,c.textContent="·";const d=document.createElement("button");d.textContent="Cancel",d.style.cssText=`background:transparent;border:none;color:${e.primary};cursor:pointer;padding:0;font:12px/1 'JetBrains Mono',monospace;text-decoration:underline;text-underline-offset:3px;`,d.addEventListener("click",l=>{l.stopPropagation(),t()}),o.append(n,r,c,d),document.body.append(o)},"createFloatingBadge"),J=s(t=>{const e=t.split(":"),o=Number.parseInt(e.at(-1)??"0",10)||void 0,n=Number.parseInt(e.at(-2)??"0",10)||void 0,r=e.slice(0,-2).join(":");globalThis.__VISULIMA_DEVTOOLS__?.rpc?.openInEditor?.(r,n,o).catch(()=>{})},"openInEditor"),b=s(()=>{document.querySelector(`#${S}`)?.remove()},"removeResultPopup"),f=s((t,e)=>{const o=y(),n=document.createElement("button");return n.textContent=t,n.style.cssText=[`background:${o.btnBg}`,`border:1px solid ${o.btnBorder}`,`color:${o.primary}`,"cursor:pointer","font:11px/1 'JetBrains Mono',monospace","padding:5px 10px","white-space:nowrap"].join(";"),n.addEventListener("pointerover",()=>{n.style.background=o.btnBgHover,n.style.borderColor=o.btnBorderHover}),n.addEventListener("pointerout",()=>{n.style.background=o.btnBg,n.style.borderColor=o.btnBorder}),n.addEventListener("click",r=>{r.stopPropagation(),e()}),n},"makeActionButton"),N=s((t,e,o)=>{b();const n=y(),r=document.createElement("div");r.id=S,r.style.cssText=["position:fixed","z-index:2147483646",`background:${n.bg}`,`border:1px solid ${n.btnBorder}`,"padding:10px 32px 10px 12px","font:12px/1.4 'JetBrains Mono',monospace",`color:${n.fg}`,`box-shadow:${n.shadow}`,"min-width:200px","max-width:400px","pointer-events:auto"].join(";");let c=e.bottom+8;c+110>window.innerHeight&&(c=e.top-110-8);let{left:d}=e;d+280>window.innerWidth&&(d=Math.max(8,window.innerWidth-288)),r.style.top=`${c}px`,r.style.left=`${d}px`;const l=t.tagName.toLowerCase(),g=t.id?`#${t.id}`:"",i=t.classList.length>0?`.${[...t.classList].slice(0,3).join(".")}`:"",a=document.createElement("div");if(a.style.cssText=`color:${n.primary};font-weight:bold;margin-bottom:4px;word-break:break-all;`,a.textContent=`${l}${g}${i}`,r.append(a),o){const m=document.createElement("div");m.style.cssText=`color:${n.muted};margin-bottom:10px;word-break:break-all;font-size:10px;`,m.textContent=o,r.append(m)}const u=document.createElement("div");u.style.cssText="display:flex;gap:6px;flex-wrap:wrap;",o&&u.append(f("Open in editor",()=>{J(o),b()})),u.append(f("Copy HTML",()=>{navigator.clipboard.writeText(t.outerHTML).catch(()=>{}),b()})),o&&u.append(f("Copy path",()=>{navigator.clipboard.writeText(o).catch(()=>{}),b()})),r.append(u);const p=document.createElement("button");p.textContent="×",p.style.cssText=["position:absolute","top:6px","right:8px","background:transparent","border:none",`color:${n.muted}`,"cursor:pointer","font:16px/1 'JetBrains Mono',monospace","padding:0","line-height:1","transition:color 0.15s"].join(";"),p.addEventListener("pointerover",()=>{p.style.color=n.fg}),p.addEventListener("pointerout",()=>{p.style.color=n.muted}),p.addEventListener("click",m=>{m.stopPropagation(),b()}),r.append(p),document.body.append(r);const _=s(m=>{r.contains(m.target)||(b(),document.removeEventListener("click",_,!0))},"handleOutside");setTimeout(()=>{document.addEventListener("click",_,!0)},100)},"showResultPopup");let x;const V=s((t,e)=>{x?.(),j(),C(!0);const o=s(()=>document.querySelector(`#${$}`)??void 0,"badgeElement"),n=s(i=>{if(!i)return!1;const a=o();return!!(a&&(i===a||a.contains(i)))},"isOverBadge"),r={cleanup(){document.removeEventListener("mousemove",r.handleMouseMove),document.removeEventListener("click",r.handleClick,!0),document.removeEventListener("keydown",r.handleKeyDown),L(),P(),C(!1),O(),x=void 0},handleClick(i){const a=i.target;if(!a||a.tagName==="DEV-TOOLBAR"||n(a))return;i.preventDefault(),i.stopPropagation();const u=a.getBoundingClientRect(),p=M(a);r.cleanup(),t(),N(a,u,p)},handleKeyDown(i){i.key==="Escape"&&(r.cleanup(),e())},handleMouseMove(i){const a=i.target;if(!a||a.tagName==="DEV-TOOLBAR"||n(a)){L();return}H(a)}},{cleanup:c,handleClick:d,handleKeyDown:l,handleMouseMove:g}=r;R(()=>{c(),e()}),document.addEventListener("mousemove",g),document.addEventListener("click",d,!0),document.addEventListener("keydown",l),x=c},"startGlobalInspection"),z=s(()=>{x?.(),b()},"stopGlobalInspection"),F={icon:A,id:"dev-toolbar:inspector",name:"Inspector",onClick(){const t=globalThis.__VISULIMA_DEVTOOLS__;V(()=>{t?.setAppActive&&t.setAppActive("dev-toolbar:inspector",!1)},()=>{t?.setAppActive&&t.setAppActive("dev-toolbar:inspector",!1)})},onDeactivate(){z()}};export{F as default};
@@ -1,20 +1 @@
1
- var U=Object.defineProperty;var k=(o,d)=>U(o,"name",{value:d,configurable:!0});import{addHookName as i}from"preact/devtools";import{useState as s,useRef as E,useEffect as S}from"preact/hooks";import j from"../../packem_shared/cn-DWLJYh3h.js";import{jsx as r,jsxs as t}from"preact/jsx-runtime";import b from"../../packem_shared/Button-DODNCTPZ.js";import $ from"../../packem_shared/Input-GfbOwAkK.js";const A=`<!-- @license lucide-static v0.576.0 - ISC -->
2
- <svg
3
- class="lucide lucide-network"
4
- xmlns="http://www.w3.org/2000/svg"
5
- width="24"
6
- height="24"
7
- viewBox="0 0 24 24"
8
- fill="none"
9
- stroke="currentColor"
10
- stroke-width="2"
11
- stroke-linecap="round"
12
- stroke-linejoin="round"
13
- >
14
- <rect x="16" y="16" width="6" height="6" rx="1" />
15
- <rect x="2" y="16" width="6" height="6" rx="1" />
16
- <rect x="9" y="2" width="6" height="6" rx="1" />
17
- <path d="M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3" />
18
- <path d="M12 12V8" />
19
- </svg>
20
- `;var B=Object.defineProperty,n=k((o,d)=>B(o,"name",{value:d,configurable:!0}),"o");const F={css:"bg-purple-500/15 text-purple-400 border-purple-500/30",js:"bg-green-500/15 text-green-400 border-green-500/30",json:"bg-yellow-500/15 text-yellow-400 border-yellow-500/30",jsx:"bg-green-500/15 text-green-400 border-green-500/30",svg:"bg-orange-500/15 text-orange-400 border-orange-500/30",ts:"bg-blue-500/15 text-blue-400 border-blue-500/30",tsx:"bg-blue-500/15 text-blue-400 border-blue-500/30",vue:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30"},G=n(o=>o.match(/\.([a-z]+)(?:\?|$)/i)?.[1]?.toLowerCase()??"?","getExtension"),C=n(({ext:o})=>r("span",{class:j("inline-flex px-1.5 py-0.5 text-[0.6rem] font-mono font-bold uppercase border",F[o]??"bg-foreground/6 text-muted-foreground border-border"),children:o}),"ExtBadge"),H=n(({helpers:o})=>{const[d,I]=i(s([]),"modules"),[M,p]=i(s(!0),"loading"),[v,w]=i(s(null),"error"),[x,L]=i(s(""),"search"),[c,u]=i(s(null),"selectedId"),[y,h]=i(s([]),"importersList"),R=i(E(null),"searchRef"),f=n(()=>{p(!0),w(null),u(null),o.rpc.getModuleGraph().then(e=>{const a=e.map(l=>({ext:G(l.url??l.id??""),id:l.id??l.url??"",importers:l.importerCount??0,importerUrls:Array.isArray(l.importerUrls)?l.importerUrls:[],url:l.url??l.id??""}));I(a),p(!1)}).catch(e=>{w(e.message??"Failed to load module graph"),p(!1)})},"load");S(()=>{f()},[]);const g=d.filter(e=>{const a=x.toLowerCase();return!a||e.url.toLowerCase().includes(a)||e.ext.includes(a)}),m=c?d.find(e=>e.id===c):null,z=n(e=>{if(c===e.id){u(null),h([]);return}u(e.id),h(e.importerUrls)},"showImporters");return M?t("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(e=>r("span",{class:"size-1.5 bg-primary/50 rounded-full animate-pulse",style:{animationDelay:`${e}ms`}},e))}),r("span",{class:"text-[0.75rem] text-muted-foreground",children:"Scanning module graph…"})]}):v?t("div",{class:"flex flex-col items-center justify-center h-full gap-3 p-8 text-center",children:[r("p",{class:"text-[0.8rem] text-destructive",children:v}),r(b,{onClick:f,size:"sm",variant:"outline",children:"Retry"})]}):t("div",{class:"flex flex-col h-full",children:[t("div",{class:"flex items-center gap-2 px-4 py-2.5 border-b border-border shrink-0",children:[r($,{class:"flex-1 bg-foreground/4 font-mono text-[0.8rem] placeholder:text-muted-foreground/50 focus-visible:border-primary/50 border-border",onInput:n(e=>L(e.target.value),"onInput"),placeholder:"Filter modules…",ref:R,type:"text",value:x}),t("span",{class:"text-[0.7rem] text-muted-foreground shrink-0",children:[g.length," / ",d.length]}),r(b,{onClick:f,size:"sm",variant:"outline",children:"Refresh"})]}),t("div",{class:"flex flex-1 min-h-0 overflow-hidden",children:[r("div",{class:"flex-1 overflow-auto divide-y divide-border/30",children:g.length===0?t("div",{class:"flex items-center justify-center p-8 text-[0.8rem] text-muted-foreground",children:['No modules match "',x,'"']}):g.map(e=>t("button",{class:j("w-full flex items-center gap-3 px-4 py-2.5 text-left border-0 bg-transparent cursor-pointer","hover:bg-foreground/4 transition-colors duration-100",c===e.id&&"bg-primary/6"),onClick:n(()=>z(e),"onClick"),type:"button",children:[r(C,{ext:e.ext}),r("span",{class:"flex-1 text-[0.775rem] font-mono text-foreground/80 truncate min-w-0",children:e.url}),e.importers>0&&t("span",{class:"shrink-0 text-[0.65rem] text-muted-foreground px-1.5 py-0.5 bg-foreground/6 border border-border/50",children:[e.importers,"↑"]})]},e.id))}),m&&t("div",{class:"border-l border-border bg-background w-72 shrink-0 flex flex-col overflow-hidden",children:[t("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.7rem] font-semibold text-foreground uppercase tracking-wide",children:"Module Info"}),r(b,{"aria-label":"Close",class:"h-6 w-6 text-xs",onClick:n(()=>{u(null),h([])},"onClick"),size:"icon",variant:"ghost",children:"✕"})]}),t("div",{class:"flex-1 overflow-auto p-4 space-y-3",children:[t("div",{children:[r("div",{class:"text-[0.6rem] uppercase tracking-wider text-muted-foreground mb-1",children:"URL"}),r("code",{class:"text-[0.7rem] font-mono text-foreground/80 break-all",children:m.url})]}),t("div",{children:[r("div",{class:"text-[0.6rem] uppercase tracking-wider text-muted-foreground mb-1",children:"Type"}),r(C,{ext:m.ext})]}),t("div",{children:[r("div",{class:"text-[0.6rem] uppercase tracking-wider text-muted-foreground mb-1",children:"Importers"}),r("span",{class:"text-[0.8rem] font-mono text-foreground",children:m.importers})]}),y.length>0&&t("div",{children:[r("div",{class:"text-[0.6rem] uppercase tracking-wider text-muted-foreground mb-1",children:"Imported by"}),r("div",{class:"space-y-1",children:y.map(e=>r("code",{class:"block text-[0.65rem] font-mono text-muted-foreground break-all",children:e},e))})]})]})]})]})]})},"ModuleGraphApp"),J={component:H,icon:A,id:"dev-toolbar:module-graph",name:"Modules"};export{J as default};
1
+ var U=Object.defineProperty;var w=(o,i)=>U(o,"name",{value:i,configurable:!0});import $ from"lucide-static/icons/network.svg?raw";import{addHookName as n}from"preact/devtools";import{useState as s,useRef as E,useEffect as A}from"preact/hooks";import C from"../../packem_shared/cn-DWLJYh3h.js";import{jsx as r,jsxs as t}from"preact/jsx-runtime";import h from"../../packem_shared/Button-DODNCTPZ.js";import G from"../../packem_shared/Input-GfbOwAkK.js";var S=Object.defineProperty,d=w((o,i)=>S(o,"name",{value:i,configurable:!0}),"o");const F={css:"bg-purple-500/15 text-purple-400 border-purple-500/30",js:"bg-green-500/15 text-green-400 border-green-500/30",json:"bg-yellow-500/15 text-yellow-400 border-yellow-500/30",jsx:"bg-green-500/15 text-green-400 border-green-500/30",svg:"bg-orange-500/15 text-orange-400 border-orange-500/30",ts:"bg-blue-500/15 text-blue-400 border-blue-500/30",tsx:"bg-blue-500/15 text-blue-400 border-blue-500/30",vue:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30"},H=/\.([a-z]+)(?:\?|$)/i,N=d(o=>o.match(H)?.[1]?.toLowerCase()??"?","getExtension"),j=d(({ext:o})=>r("span",{class:C("inline-flex px-1.5 py-0.5 text-[0.6rem] font-mono font-bold uppercase border",F[o]??"bg-foreground/6 text-muted-foreground border-border"),children:o}),"ExtensionBadge"),T=d(({helpers:o})=>{const[i,I]=n(s([]),"modules"),[L,p]=n(s(!0),"loading"),[v,y]=n(s(void 0),"error"),[f,R]=n(s(""),"search"),[c,u]=n(s(void 0),"selectedId"),[k,x]=n(s([]),"importersList"),z=n(E(null),"searchRef"),g=d(()=>{p(!0),y(void 0),u(void 0),o.rpc.getModuleGraph().then(e=>{const a=e.map(l=>({ext:N(l.url??l.id??""),id:l.id??l.url??"",importers:l.importerCount??0,importerUrls:Array.isArray(l.importerUrls)?l.importerUrls:[],url:l.url??l.id??""}));I(a),p(!1)}).catch(e=>{y(e.message??"Failed to load module graph"),p(!1)})},"load");A(()=>{g()},[]);const b=i.filter(e=>{const a=f.toLowerCase();return!a||e.url.toLowerCase().includes(a)||e.ext.includes(a)}),m=c?i.find(e=>e.id===c):void 0,M=d(e=>{if(c===e.id){u(void 0),x([]);return}u(e.id),x(e.importerUrls)},"showImporters");return L?t("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(e=>r("span",{class:"size-1.5 bg-primary/50 rounded-full animate-pulse",style:{animationDelay:`${e}ms`}},e))}),r("span",{class:"text-[0.75rem] text-muted-foreground",children:"Scanning module graph…"})]}):v?t("div",{class:"flex flex-col items-center justify-center h-full gap-3 p-8 text-center",children:[r("p",{class:"text-[0.8rem] text-destructive",children:v}),r(h,{onClick:g,size:"sm",variant:"outline",children:"Retry"})]}):t("div",{class:"flex flex-col h-full",children:[t("div",{class:"flex items-center gap-2 px-4 py-2.5 border-b border-border shrink-0",children:[r(G,{class:"flex-1 bg-foreground/4 font-mono text-[0.8rem] placeholder:text-muted-foreground/50 focus-visible:border-primary/50 border-border",onInput:d(e=>R(e.target.value),"onInput"),placeholder:"Filter modules…",ref:z,type:"text",value:f}),t("span",{class:"text-[0.7rem] text-muted-foreground shrink-0",children:[b.length," / ",i.length]}),r(h,{onClick:g,size:"sm",variant:"outline",children:"Refresh"})]}),t("div",{class:"flex flex-1 min-h-0 overflow-hidden",children:[r("div",{class:"flex-1 overflow-auto divide-y divide-border/30",children:b.length===0?t("div",{class:"flex items-center justify-center p-8 text-[0.8rem] text-muted-foreground",children:['No modules match "',f,'"']}):b.map(e=>t("button",{class:C("w-full flex items-center gap-3 px-4 py-2.5 text-left border-0 bg-transparent cursor-pointer","hover:bg-foreground/4 transition-colors duration-100",c===e.id&&"bg-primary/6"),onClick:d(()=>M(e),"onClick"),type:"button",children:[r(j,{ext:e.ext}),r("span",{class:"flex-1 text-[0.775rem] font-mono text-foreground/80 truncate min-w-0",children:e.url}),e.importers>0&&t("span",{class:"shrink-0 text-[0.65rem] text-muted-foreground px-1.5 py-0.5 bg-foreground/6 border border-border/50",children:[e.importers,"↑"]})]},e.id))}),m&&t("div",{class:"border-l border-border bg-background w-72 shrink-0 flex flex-col overflow-hidden",children:[t("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.7rem] font-semibold text-foreground uppercase tracking-wide",children:"Module Info"}),r(h,{"aria-label":"Close",class:"h-6 w-6 text-xs",onClick:d(()=>{u(void 0),x([])},"onClick"),size:"icon",variant:"ghost",children:"✕"})]}),t("div",{class:"flex-1 overflow-auto p-4 space-y-3",children:[t("div",{children:[r("div",{class:"text-[0.6rem] uppercase tracking-wider text-muted-foreground mb-1",children:"URL"}),r("code",{class:"text-[0.7rem] font-mono text-foreground/80 break-all",children:m.url})]}),t("div",{children:[r("div",{class:"text-[0.6rem] uppercase tracking-wider text-muted-foreground mb-1",children:"Type"}),r(j,{ext:m.ext})]}),t("div",{children:[r("div",{class:"text-[0.6rem] uppercase tracking-wider text-muted-foreground mb-1",children:"Importers"}),r("span",{class:"text-[0.8rem] font-mono text-foreground",children:m.importers})]}),k.length>0&&t("div",{children:[r("div",{class:"text-[0.6rem] uppercase tracking-wider text-muted-foreground mb-1",children:"Imported by"}),r("div",{class:"space-y-1",children:k.map(e=>r("code",{class:"block text-[0.65rem] font-mono text-muted-foreground break-all",children:e},e))})]})]})]})]})]})},"ModuleGraphApp"),V={component:T,icon:$,id:"dev-toolbar:module-graph",name:"Modules"};export{V as default};
@@ -1,19 +1,2 @@
1
- var p=Object.defineProperty;var s=(n,t)=>p(n,"name",{value:t,configurable:!0});import{addHookName as m}from"preact/devtools";import{useState as u,useEffect as f}from"preact/hooks";import g from"../../packem_shared/cn-DWLJYh3h.js";import{jsxs as o,jsx as r}from"preact/jsx-runtime";const h=`<!-- @license lucide-static v0.576.0 - ISC -->
2
- <svg
3
- class="lucide lucide-more-horizontal"
4
- xmlns="http://www.w3.org/2000/svg"
5
- width="24"
6
- height="24"
7
- viewBox="0 0 24 24"
8
- fill="none"
9
- stroke="currentColor"
10
- stroke-width="2"
11
- stroke-linecap="round"
12
- stroke-linejoin="round"
13
- >
14
- <circle cx="12" cy="12" r="1" />
15
- <circle cx="19" cy="12" r="1" />
16
- <circle cx="5" cy="12" r="1" />
17
- </svg>
18
- `;var x=Object.defineProperty,i=s((n,t)=>x(n,"name",{value:t,configurable:!0}),"s");const b=i(n=>{const[t,c]=m(u([]),"apps");f(()=>{const e=globalThis.__VISULIMA_DEVTOOLS__;if(!e)return;const a=(e.getApps()??[]).filter(d=>!["dev-toolbar:a11y","dev-toolbar:module-graph","dev-toolbar:more","dev-toolbar:performance","dev-toolbar:seo","dev-toolbar:settings","dev-toolbar:timeline","dev-toolbar:vite-config"].includes(d.id));c(a)},[]);const l=i(e=>{globalThis.__VISULIMA_DEVTOOLS__?.openApp(e).catch(console.error)},"openApp");return t.length===0?o("div",{class:"p-8 flex flex-col items-center justify-center min-h-48 gap-5 text-center select-none",children:[r("div",{class:"size-14 bg-primary/5 border border-primary/20 flex items-center justify-center",children:r("svg",{"aria-hidden":"true",class:"size-6 text-primary/40",fill:"none",stroke:"currentColor","stroke-width":"1.5",viewBox:"0 0 24 24",children:r("path",{d:"M12 6v6m0 0v6m0-6h6m-6 0H6","stroke-linecap":"round","stroke-linejoin":"round"})})}),o("div",{class:"space-y-1.5",children:[r("p",{class:"text-[0.8125rem] font-medium text-foreground/70",children:"No additional apps registered"}),r("p",{class:"text-[0.725rem] text-muted-foreground",children:"Register a custom app to see it here"}),r("pre",{class:"mt-3 text-[0.65rem] font-mono text-primary/70 bg-primary/5 border border-primary/15 px-3 py-2 text-left",children:`window.__VISULIMA_DEVTOOLS__
19
- .registerApp({ id, name, icon })`})]})]}):o("div",{class:"p-5",children:[o("h2",{class:"text-[0.65rem] font-bold uppercase tracking-[0.1em] text-muted-foreground mb-3 flex items-center gap-1.5",children:[r("span",{"aria-hidden":"true",class:"text-primary/50",children:"//"}),"Additional Apps"]}),r("div",{class:"grid grid-cols-2 gap-2",children:t.map(e=>o("button",{class:g("flex items-center gap-3 p-3","border border-border bg-card hover:bg-foreground/4","text-left cursor-pointer transition-colors duration-150"),onClick:i(()=>l(e.id),"onClick"),title:e.name,type:"button",children:[r("span",{class:"size-5 shrink-0 flex items-center justify-center text-[0.65rem] font-bold uppercase bg-foreground/8 text-foreground/70",children:e.name.slice(0,2)}),r("span",{class:"text-[0.8125rem] font-medium text-foreground truncate",children:e.name})]},e.id))})]})},"MoreApp"),A={component:b,icon:h,id:"dev-toolbar:more",name:"More"};export{A as default};
1
+ var p=Object.defineProperty;var s=(i,t)=>p(i,"name",{value:t,configurable:!0});import m from"lucide-static/icons/more-horizontal.svg?raw";import{addHookName as f}from"preact/devtools";import{useState as u,useEffect as b}from"preact/hooks";import g from"../../packem_shared/cn-DWLJYh3h.js";import{jsxs as o,jsx as r}from"preact/jsx-runtime";var h=Object.defineProperty,n=s((i,t)=>h(i,"name",{value:t,configurable:!0}),"n");const x=n(i=>{const[t,a]=f(u([]),"apps");b(()=>{const e=globalThis.__VISULIMA_DEVTOOLS__;if(!e)return;const l=(e.getApps()??[]).filter(c=>!["dev-toolbar:a11y","dev-toolbar:inspector","dev-toolbar:module-graph","dev-toolbar:more","dev-toolbar:performance","dev-toolbar:seo","dev-toolbar:settings","dev-toolbar:tailwind","dev-toolbar:timeline","dev-toolbar:vite-config"].includes(c.id));a(l)},[]);const d=n(e=>{globalThis.__VISULIMA_DEVTOOLS__?.openApp(e).catch(()=>{})},"openApp");return t.length===0?o("div",{class:"p-8 flex flex-col items-center justify-center min-h-48 gap-5 text-center select-none",children:[r("div",{class:"size-14 bg-primary/5 border border-primary/20 flex items-center justify-center",children:r("svg",{"aria-hidden":"true",class:"size-6 text-primary/40",fill:"none",stroke:"currentColor","stroke-width":"1.5",viewBox:"0 0 24 24",children:r("path",{d:"M12 6v6m0 0v6m0-6h6m-6 0H6","stroke-linecap":"round","stroke-linejoin":"round"})})}),o("div",{class:"space-y-1.5",children:[r("p",{class:"text-[0.8125rem] font-medium text-foreground/70",children:"No additional apps registered"}),r("p",{class:"text-[0.725rem] text-muted-foreground",children:"Register a custom app to see it here"}),r("pre",{class:"mt-3 text-[0.65rem] font-mono text-primary/70 bg-primary/5 border border-primary/15 px-3 py-2 text-left",children:`window.__VISULIMA_DEVTOOLS__
2
+ .registerApp({ id, name, icon })`})]})]}):o("div",{class:"p-5",children:[o("h2",{class:"text-[0.65rem] font-bold uppercase tracking-[0.1em] text-muted-foreground mb-3 flex items-center gap-1.5",children:[r("span",{"aria-hidden":"true",class:"text-primary/50",children:"//"}),"Additional Apps"]}),r("div",{class:"grid grid-cols-2 gap-2",children:t.map(e=>o("button",{class:g("flex items-center gap-3 p-3","border border-border bg-card hover:bg-foreground/4","text-left cursor-pointer transition-colors duration-150"),onClick:n(()=>d(e.id),"onClick"),title:e.name,type:"button",children:[r("span",{class:"size-5 shrink-0 flex items-center justify-center text-[0.65rem] font-bold uppercase bg-foreground/8 text-foreground/70",children:e.name.slice(0,2)}),r("span",{class:"text-[0.8125rem] font-medium text-foreground truncate",children:e.name})]},e.id))})]})},"MoreApp"),O={component:x,icon:m,id:"dev-toolbar:more",name:"More"};export{O as default};
@@ -1,17 +1 @@
1
- var L=Object.defineProperty;var f=(t,e)=>L(t,"name",{value:e,configurable:!0});import{addHookName as y}from"preact/devtools";import{useState as C,useRef as M,useEffect as H}from"preact/hooks";import d from"../../packem_shared/cn-DWLJYh3h.js";import{jsx as r,jsxs as i}from"preact/jsx-runtime";const $=`<!-- @license lucide-static v0.576.0 - ISC -->
2
- <svg
3
- class="lucide lucide-gauge"
4
- xmlns="http://www.w3.org/2000/svg"
5
- width="24"
6
- height="24"
7
- viewBox="0 0 24 24"
8
- fill="none"
9
- stroke="currentColor"
10
- stroke-width="2"
11
- stroke-linecap="round"
12
- stroke-linejoin="round"
13
- >
14
- <path d="m12 14 4-4" />
15
- <path d="M3.34 19a10 10 0 1 1 17.32 0" />
16
- </svg>
17
- `;var j=Object.defineProperty,b=f((t,e)=>j(t,"name",{value:e,configurable:!0}),"s$1");const I={cls:{good:.1,poor:.25},fcp:{good:1800,poor:3e3},fid:{good:100,poor:300},lcp:{good:2500,poor:4e3},ttfb:{good:800,poor:1800}},x=b((t,e)=>{const{good:s,poor:n}=I[t];return e<=s?"good":e<=n?"needs-improvement":"poor"},"getCwvRating");class z{static{f(this,"PerformanceMonitor")}static{b(this,"PerformanceMonitor")}clsValue=0;fpsSamples=[];listeners=new Set;longTaskIdCounter=0;longTasks=[];memory=null;memoryInterval=null;observers=[];rafId=null;running=!1;vitals={cls:null,fcp:null,fid:null,lcp:null,ttfb:null};clearLongTasks(){this.longTasks=[],this.emit()}getSnapshot(){return{fps:this.currentFps(),longTasks:[...this.longTasks],memory:this.memory,vitals:{...this.vitals}}}start(){this.running||globalThis.window===void 0||(this.running=!0,this.startFps(),this.startMemory(),this.startCwv(),this.startLongTasks(),this.loadTtfb())}stop(){if(this.running){this.running=!1,this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.memoryInterval!==null&&(clearInterval(this.memoryInterval),this.memoryInterval=null);for(const e of this.observers)e.disconnect();this.observers=[]}}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}currentFps(){if(this.fpsSamples.length<2)return 0;const e=this.fpsSamples.slice(-Math.min(this.fpsSamples.length,10));if(e.length<2)return 0;let s=0,n=0;for(let l=1;l<e.length;l++){const a=e[l]-e[l-1];a>0&&a<500&&(s+=a,n++)}return n===0?0:Math.min(60,Math.round(1e3/(s/n)))}emit(){const e=this.getSnapshot();for(const s of this.listeners)s(e)}loadTtfb(){const e=performance.getEntriesByType("navigation");e.length>0&&e[0]&&(this.vitals.ttfb=Math.round(e[0].responseStart-e[0].requestStart),this.emit())}startCwv(){this.tryObserve("largest-contentful-paint",e=>{const s=e.getEntries().at(-1);s&&(this.vitals.lcp=Math.round(s.startTime),this.emit())}),this.tryObserve("layout-shift",e=>{for(const s of e.getEntries()){const n=s;n.hadRecentInput||(this.clsValue+=n.value,this.vitals.cls=Math.round(this.clsValue*1e3)/1e3)}this.emit()}),this.tryObserve("first-input",e=>{const s=e.getEntries()[0];s&&(this.vitals.fid=Math.round(s.processingStart-s.startTime),this.emit())}),this.tryObserve("paint",e=>{for(const s of e.getEntries())s.name==="first-contentful-paint"&&(this.vitals.fcp=Math.round(s.startTime),this.emit())})}startFps(){let e=null;const s=b(n=>{this.running&&(e!==null&&(this.fpsSamples.push(n),this.fpsSamples.length>60&&this.fpsSamples.shift(),this.fpsSamples.length%16===0&&this.emit()),e=n,this.rafId=requestAnimationFrame(s))},"tick");this.rafId=requestAnimationFrame(s)}startLongTasks(){this.tryObserve("longtask",e=>{for(const s of e.getEntries())this.longTaskIdCounter++,this.longTasks.push({duration:Math.round(s.duration),id:`lt-${this.longTaskIdCounter}`,startTime:Math.round(s.startTime)}),this.longTasks.length>100&&this.longTasks.shift();this.emit()})}startMemory(){const e=performance;if(!e.memory)return;const s=b(()=>{e.memory&&(this.memory={jsHeapSizeLimit:e.memory.jsHeapSizeLimit,totalJSHeapSize:e.memory.totalJSHeapSize,usedJSHeapSize:e.memory.usedJSHeapSize},this.emit())},"read");s(),this.memoryInterval=setInterval(s,1e3)}tryObserve(e,s){try{const n=new PerformanceObserver(s);n.observe({buffered:!0,type:e}),this.observers.push(n)}catch{}}}const p=new z;var P=Object.defineProperty,u=f((t,e)=>P(t,"name",{value:e,configurable:!0}),"s");const S=u(t=>t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`,"formatBytes"),B=u(t=>`${t} ms`,"formatMs"),k={good:"text-success-foreground","needs-improvement":"text-warning-foreground",poor:"text-destructive"},J={good:"bg-success/10 border-success/30","needs-improvement":"bg-warning/10 border-warning/30",poor:"bg-destructive/10 border-destructive/30"},O=u(({samples:t})=>{if(t.length<2)return r("svg",{height:36,width:120});const e=120/(t.length-1),s=t.map((n,l)=>{const a=l*e,o=36-n/60*36;return`${a.toFixed(1)},${o.toFixed(1)}`}).join(" ");return r("svg",{height:36,style:"overflow: visible",width:120,children:r("polyline",{fill:"none",points:s,stroke:"currentColor","stroke-linejoin":"round","stroke-width":"1.5"})})},"FpsSparkline"),R=u(({memory:t})=>{const e=t.usedJSHeapSize/t.jsHeapSizeLimit*100,s=t.totalJSHeapSize/t.jsHeapSizeLimit*100,n=e>80?"bg-destructive":e>50?"bg-warning":"bg-success";return i("div",{class:"space-y-1.5",children:[i("div",{class:"relative h-2 bg-foreground/8 rounded-full overflow-hidden",children:[r("div",{class:"absolute left-0 top-0 h-full bg-foreground/12 rounded-full",style:{width:`${s}%`}}),r("div",{class:d("absolute left-0 top-0 h-full rounded-full",n),style:{width:`${e}%`}})]}),i("div",{class:"flex justify-between text-[0.65rem] text-muted-foreground",children:[i("span",{children:["Used: ",r("span",{class:"text-foreground font-medium",children:S(t.usedJSHeapSize)})]}),i("span",{children:["Total: ",r("span",{class:"text-foreground font-medium",children:S(t.totalJSHeapSize)})]}),i("span",{children:["Limit: ",r("span",{class:"text-foreground font-medium",children:S(t.jsHeapSizeLimit)})]})]})]})},"MemoryBar"),E=u(({label:t,metric:e,unit:s,value:n})=>{if(n===null)return i("div",{class:"flex flex-col items-center gap-1 p-3 border border-border bg-foreground/2 min-w-0",children:[r("span",{class:"text-[0.6rem] text-muted-foreground uppercase tracking-wider font-semibold truncate w-full text-center",children:t}),r("span",{class:"text-[0.7rem] text-muted-foreground/50",children:"—"})]});const l=x(e,n),a=e==="cls"?n.toFixed(3):B(n);return i("div",{class:d("flex flex-col items-center gap-1 p-3 border min-w-0",J[l]),children:[r("span",{class:"text-[0.6rem] text-muted-foreground uppercase tracking-wider font-semibold truncate w-full text-center",children:t}),r("span",{class:d("text-[0.9rem] font-bold tabular-nums",k[l]),children:a}),r("span",{class:"text-[0.6rem] text-muted-foreground/70 uppercase tracking-wide",children:s})]})},"CwvCard"),V=u(({task:t})=>i("div",{class:"flex items-center gap-3 px-3 py-2 border-b border-border/50 last:border-0 text-[0.7rem]",children:[i("span",{class:"text-muted-foreground tabular-nums w-20 shrink-0",children:[t.startTime.toLocaleString()," ms"]}),r("div",{class:"flex-1 bg-foreground/6 rounded-sm overflow-hidden h-2",children:r("div",{class:"h-full bg-warning",style:{width:`${Math.min(100,t.duration/200*100)}%`},title:`${t.duration} ms`})}),i("span",{class:"text-warning-foreground font-semibold tabular-nums w-16 text-right shrink-0",children:[t.duration," ms"]})]}),"LongTaskRow"),g=u(({action:t,children:e,title:s})=>i("section",{class:"border border-border",children:[i("div",{class:"flex items-center justify-between px-4 py-2.5 bg-foreground/3 border-b border-border",children:[r("span",{class:"text-[0.7rem] font-semibold text-foreground uppercase tracking-wide",children:s}),t]}),r("div",{class:"p-4",children:e})]}),"Section"),A=120,q=u(t=>{const[e,s]=y(C(()=>p.getSnapshot()),"snapshot"),n=y(M([]),"fpsHistoryRef");H(()=>(p.start(),p.subscribe(c=>{n.current.push(c.fps),n.current.length>A&&n.current.shift(),s(c)})),[]);const{fps:l,longTasks:a,memory:o,vitals:m}=e,h=l>=50?"good":l>=30?"needs-improvement":"poor",F=[{label:"LCP",metric:"lcp",unit:"ms",value:m.lcp},{label:"FID",metric:"fid",unit:"ms",value:m.fid},{label:"CLS",metric:"cls",unit:"score",value:m.cls},{label:"FCP",metric:"fcp",unit:"ms",value:m.fcp},{label:"TTFB",metric:"ttfb",unit:"ms",value:m.ttfb}];return i("div",{class:"p-5 space-y-4",children:[r(g,{title:"FPS",children:i("div",{class:"flex items-end gap-5",children:[i("div",{class:"flex flex-col items-center gap-0.5 shrink-0",children:[r("span",{class:d("text-3xl font-bold tabular-nums leading-none",k[h]),children:l}),r("span",{class:"text-[0.6rem] text-muted-foreground uppercase tracking-wide",children:"fps"})]}),r("div",{class:d("flex-1 min-w-0",k[h]),children:r(O,{samples:n.current})}),i("div",{class:"flex flex-col justify-between h-9 text-[0.6rem] text-muted-foreground/50 shrink-0 tabular-nums",children:[r("span",{children:"60"}),r("span",{children:"30"}),r("span",{children:"0"})]})]})}),o?r(g,{title:"JS Heap Memory",children:r(R,{memory:o})}):r(g,{title:"JS Heap Memory",children:i("p",{class:"text-[0.72rem] text-muted-foreground text-center py-2",children:["Not available — enable ",r("code",{class:"font-mono text-foreground/70",children:"--enable-precise-memory-info"})," in Chrome flags."]})}),i(g,{title:"Core Web Vitals",children:[r("div",{class:"grid grid-cols-3 gap-2",children:F.map(c=>r(E,{label:c.label,metric:c.metric,unit:c.unit,value:c.value},c.metric))}),r("p",{class:"mt-2 text-[0.62rem] text-muted-foreground/60",children:"Measured from page load. Reload to refresh. LCP and FID update as the page is interacted with."})]}),r(g,{action:a.length>0?r("button",{class:"px-2 py-0.5 text-[0.65rem] border border-border text-muted-foreground hover:text-foreground cursor-pointer bg-transparent transition-colors",onClick:u(()=>p.clearLongTasks(),"onClick"),type:"button",children:"Clear"}):void 0,title:`Long Tasks${a.length>0?` (${a.length})`:""}`,children:a.length===0?r("p",{class:"text-[0.72rem] text-muted-foreground text-center py-2",children:"No long tasks detected yet."}):r("div",{class:"max-h-48 overflow-y-auto devtools-content-scroll",children:a.map(c=>r(V,{task:c},c.id))})})]})},"PerformanceApp");var D=Object.defineProperty,w=f((t,e)=>D(t,"name",{value:e,configurable:!0}),"c");const T=w(t=>t<1024*1024?`${(t/1024).toFixed(0)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`,"formatBytes"),v={good:"text-success-foreground","needs-improvement":"text-warning-foreground",poor:"text-destructive"},N=w(({samples:t})=>{if(t.length<2)return r("svg",{height:24,width:60});const e=60/(t.length-1),s=t.map((n,l)=>`${(l*e).toFixed(1)},${(24-n/60*24).toFixed(1)}`).join(" ");return r("svg",{height:24,style:"overflow:visible",width:60,children:r("polyline",{fill:"none",points:s,stroke:"currentColor","stroke-linejoin":"round","stroke-width":"1.5"})})},"MiniSparkline"),K=w(({memory:t})=>{const e=t.usedJSHeapSize/t.jsHeapSizeLimit*100,s=e>80?"bg-destructive":e>50?"bg-warning":"bg-success";return i("div",{class:"flex items-center gap-2",children:[r("div",{class:"flex-1 h-1.5 bg-foreground/8 rounded-full overflow-hidden",children:r("div",{class:d("h-full rounded-full",s),style:{width:`${e}%`}})}),i("span",{class:"text-[0.65rem] tabular-nums text-muted-foreground shrink-0",children:[T(t.usedJSHeapSize)," / ",T(t.jsHeapSizeLimit)]})]})},"MiniMemoryBar"),W=60,U=w(t=>{const[e,s]=y(C(()=>p.getSnapshot()),"snapshot"),n=y(M([]),"fpsHistoryRef");H(()=>(p.start(),p.subscribe(h=>{n.current.push(h.fps),n.current.length>W&&n.current.shift(),s(h)})),[]);const{fps:l,memory:a,vitals:o}=e,m=l>=50?"good":l>=30?"needs-improvement":"poor";return i("div",{class:"space-y-3 min-w-[200px]",children:[i("div",{class:"flex items-end gap-3",children:[i("div",{class:"flex flex-col items-center gap-0 shrink-0",children:[r("span",{class:d("text-2xl font-bold tabular-nums leading-none",v[m]),children:l}),r("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide",children:"fps"})]}),r("div",{class:d("flex-1 min-w-0",v[m]),children:r(N,{samples:n.current})})]}),i("div",{class:"flex gap-3",children:[o.lcp!==null&&i("div",{class:"flex flex-col gap-0.5",children:[r("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide",children:"LCP"}),i("span",{class:d("text-[0.8rem] font-semibold tabular-nums",v[x("lcp",o.lcp)]),children:[o.lcp," ms"]})]}),o.fcp!==null&&i("div",{class:"flex flex-col gap-0.5",children:[r("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide",children:"FCP"}),i("span",{class:d("text-[0.8rem] font-semibold tabular-nums",v[x("fcp",o.fcp)]),children:[o.fcp," ms"]})]}),o.cls!==null&&i("div",{class:"flex flex-col gap-0.5",children:[r("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide",children:"CLS"}),r("span",{class:d("text-[0.8rem] font-semibold tabular-nums",v[x("cls",o.cls)]),children:o.cls.toFixed(3)})]}),o.lcp===null&&o.fcp===null&&o.cls===null&&r("span",{class:"text-[0.65rem] text-muted-foreground/50",children:"Collecting metrics…"})]}),a&&i("div",{children:[r("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide block mb-1",children:"Heap"}),r(K,{memory:a})]})]})},"PerformanceTooltip"),Z={component:q,icon:$,id:"dev-toolbar:performance",name:"Performance",tooltip:U};export{Z as default};
1
+ var L=Object.defineProperty;var f=(t,e)=>L(t,"name",{value:e,configurable:!0});import j from"lucide-static/icons/gauge.svg?raw";import{addHookName as w}from"preact/devtools";import{useState as M,useRef as H,useEffect as C}from"preact/hooks";import c from"../../packem_shared/cn-DWLJYh3h.js";import{jsx as r,jsxs as n}from"preact/jsx-runtime";var I=Object.defineProperty,x=f((t,e)=>I(t,"name",{value:e,configurable:!0}),"n");const z={cls:{good:.1,poor:.25},fcp:{good:1800,poor:3e3},fid:{good:100,poor:300},lcp:{good:2500,poor:4e3},ttfb:{good:800,poor:1800}},y=x((t,e)=>{const{good:s,poor:i}=z[t];return e<=s?"good":e<=i?"needs-improvement":"poor"},"getCwvRating");class P{static{f(this,"f")}static{x(this,"PerformanceMonitor")}clsValue=0;fpsSamples=[];listeners=new Set;longTaskIdCounter=0;longTasks=[];memory=void 0;memoryInterval=void 0;observers=[];rafId=void 0;running=!1;vitals={cls:void 0,fcp:void 0,fid:void 0,lcp:void 0,ttfb:void 0};clearLongTasks(){this.longTasks=[],this.emit()}getSnapshot(){return{fps:this.currentFps(),longTasks:[...this.longTasks],memory:this.memory,vitals:{...this.vitals}}}start(){this.running||globalThis.window===void 0||(this.running=!0,this.startFps(),this.startMemory(),this.startCwv(),this.startLongTasks(),this.loadTtfb())}stop(){if(this.running){this.running=!1,this.rafId!==void 0&&(cancelAnimationFrame(this.rafId),this.rafId=void 0),this.memoryInterval!==void 0&&(clearInterval(this.memoryInterval),this.memoryInterval=void 0);for(const e of this.observers)e.disconnect();this.observers=[]}}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}currentFps(){if(this.fpsSamples.length<2)return 0;const e=this.fpsSamples.slice(-Math.min(this.fpsSamples.length,10));if(e.length<2)return 0;let s=0,i=0;for(let o=1;o<e.length;o+=1){const a=e[o]-e[o-1];a>0&&a<500&&(s+=a,i+=1)}return i===0?0:Math.min(60,Math.round(1e3/(s/i)))}emit(){const e=this.getSnapshot();for(const s of this.listeners)s(e)}loadTtfb(){const e=performance.getEntriesByType("navigation");e.length>0&&e[0]&&(this.vitals.ttfb=Math.round(e[0].responseStart-e[0].requestStart),this.emit())}startCwv(){this.tryObserve("largest-contentful-paint",e=>{const s=e.getEntries().at(-1);s&&(this.vitals.lcp=Math.round(s.startTime),this.emit())}),this.tryObserve("layout-shift",e=>{for(const s of e.getEntries()){const i=s;i.hadRecentInput||(this.clsValue+=i.value,this.vitals.cls=Math.round(this.clsValue*1e3)/1e3)}this.emit()}),this.tryObserve("first-input",e=>{const s=e.getEntries()[0];s&&(this.vitals.fid=Math.round(s.processingStart-s.startTime),this.emit())}),this.tryObserve("paint",e=>{for(const s of e.getEntries())s.name==="first-contentful-paint"&&(this.vitals.fcp=Math.round(s.startTime),this.emit())})}startFps(){let e;const s=x(i=>{this.running&&(e!==void 0&&(this.fpsSamples.push(i),this.fpsSamples.length>60&&this.fpsSamples.shift(),this.fpsSamples.length%16===0&&this.emit()),e=i,this.rafId=requestAnimationFrame(s))},"tick");this.rafId=requestAnimationFrame(s)}startLongTasks(){this.tryObserve("longtask",e=>{for(const s of e.getEntries())this.longTaskIdCounter+=1,this.longTasks.push({duration:Math.round(s.duration),id:`lt-${this.longTaskIdCounter}`,startTime:Math.round(s.startTime)}),this.longTasks.length>100&&this.longTasks.shift();this.emit()})}startMemory(){const e=performance;if(!e.memory)return;const s=x(()=>{e.memory&&(this.memory={jsHeapSizeLimit:e.memory.jsHeapSizeLimit,totalJSHeapSize:e.memory.totalJSHeapSize,usedJSHeapSize:e.memory.usedJSHeapSize},this.emit())},"read");s(),this.memoryInterval=setInterval(s,1e3)}tryObserve(e,s){try{const i=new PerformanceObserver(s);i.observe({buffered:!0,type:e}),this.observers.push(i)}catch{}}}const p=new P;var J=Object.defineProperty,m=f((t,e)=>J(t,"name",{value:e,configurable:!0}),"i");const k=m(t=>t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`,"formatBytes"),B=m(t=>`${t} ms`,"formatMs"),T={good:"text-success-foreground","needs-improvement":"text-warning-foreground",poor:"text-destructive"},O={good:"bg-success/10 border-success/30","needs-improvement":"bg-warning/10 border-warning/30",poor:"bg-destructive/10 border-destructive/30"},R=m(({samples:t})=>{if(t.length<2)return r("svg",{height:36,width:120});const e=120/(t.length-1),s=t.map((i,o)=>{const a=o*e,l=36-i/60*36;return`${a.toFixed(1)},${l.toFixed(1)}`}).join(" ");return r("svg",{height:36,style:"overflow: visible",width:120,children:r("polyline",{fill:"none",points:s,stroke:"currentColor","stroke-linejoin":"round","stroke-width":"1.5"})})},"FpsSparkline"),E=m(({memory:t})=>{const e=t.usedJSHeapSize/t.jsHeapSizeLimit*100,s=t.totalJSHeapSize/t.jsHeapSizeLimit*100,i=e>50?"bg-warning":"bg-success",o=e>80?"bg-destructive":i;return n("div",{class:"space-y-1.5",children:[n("div",{class:"relative h-2 bg-foreground/8 rounded-full overflow-hidden",children:[r("div",{class:"absolute left-0 top-0 h-full bg-foreground/12 rounded-full",style:{width:`${s}%`}}),r("div",{class:c("absolute left-0 top-0 h-full rounded-full",o),style:{width:`${e}%`}})]}),n("div",{class:"flex justify-between text-[0.65rem] text-muted-foreground",children:[n("span",{children:["Used: ",r("span",{class:"text-foreground font-medium",children:k(t.usedJSHeapSize)})]}),n("span",{children:["Total: ",r("span",{class:"text-foreground font-medium",children:k(t.totalJSHeapSize)})]}),n("span",{children:["Limit: ",r("span",{class:"text-foreground font-medium",children:k(t.jsHeapSizeLimit)})]})]})]})},"MemoryBar"),A=m(({label:t,metric:e,unit:s,value:i})=>{if(i===void 0)return n("div",{class:"flex flex-col items-center gap-1 p-3 border border-border bg-foreground/2 min-w-0",children:[r("span",{class:"text-[0.6rem] text-muted-foreground uppercase tracking-wider font-semibold truncate w-full text-center",children:t}),r("span",{class:"text-[0.7rem] text-muted-foreground/50",children:"—"})]});const o=y(e,i),a=e==="cls"?i.toFixed(3):B(i);return n("div",{class:c("flex flex-col items-center gap-1 p-3 border min-w-0",O[o]),children:[r("span",{class:"text-[0.6rem] text-muted-foreground uppercase tracking-wider font-semibold truncate w-full text-center",children:t}),r("span",{class:c("text-[0.9rem] font-bold tabular-nums",T[o]),children:a}),r("span",{class:"text-[0.6rem] text-muted-foreground/70 uppercase tracking-wide",children:s})]})},"CwvCard"),V=m(({task:t})=>n("div",{class:"flex items-center gap-3 px-3 py-2 border-b border-border/50 last:border-0 text-[0.7rem]",children:[n("span",{class:"text-muted-foreground tabular-nums w-20 shrink-0",children:[t.startTime.toLocaleString()," ms"]}),r("div",{class:"flex-1 bg-foreground/6 rounded-sm overflow-hidden h-2",children:r("div",{class:"h-full bg-warning",style:{width:`${Math.min(100,t.duration/200*100)}%`},title:`${t.duration} ms`})}),n("span",{class:"text-warning-foreground font-semibold tabular-nums w-16 text-right shrink-0",children:[t.duration," ms"]})]}),"LongTaskRow"),g=m(({action:t,children:e,title:s})=>n("section",{class:"border border-border",children:[n("div",{class:"flex items-center justify-between px-4 py-2.5 bg-foreground/3 border-b border-border",children:[r("span",{class:"text-[0.7rem] font-semibold text-foreground uppercase tracking-wide",children:s}),t]}),r("div",{class:"p-4",children:e})]}),"Section"),q=120,N=m(t=>{const[e,s]=w(M(()=>p.getSnapshot()),"snapshot"),i=w(H([]),"fpsHistoryRef");C(()=>(p.start(),p.subscribe(d=>{i.current.push(d.fps),i.current.length>q&&i.current.shift(),s(d)})),[]);const{fps:o,longTasks:a,memory:l,vitals:u}=e,b=o>=30?"needs-improvement":"poor",h=o>=50?"good":b,$=[{label:"LCP",metric:"lcp",unit:"ms",value:u.lcp},{label:"FID",metric:"fid",unit:"ms",value:u.fid},{label:"CLS",metric:"cls",unit:"score",value:u.cls},{label:"FCP",metric:"fcp",unit:"ms",value:u.fcp},{label:"TTFB",metric:"ttfb",unit:"ms",value:u.ttfb}];return n("div",{class:"p-5 space-y-4",children:[r(g,{title:"FPS",children:n("div",{class:"flex items-end gap-5",children:[n("div",{class:"flex flex-col items-center gap-0.5 shrink-0",children:[r("span",{class:c("text-3xl font-bold tabular-nums leading-none",T[h]),children:o}),r("span",{class:"text-[0.6rem] text-muted-foreground uppercase tracking-wide",children:"fps"})]}),r("div",{class:c("flex-1 min-w-0",T[h]),children:r(R,{samples:i.current})}),n("div",{class:"flex flex-col justify-between h-9 text-[0.6rem] text-muted-foreground/50 shrink-0 tabular-nums",children:[r("span",{children:"60"}),r("span",{children:"30"}),r("span",{children:"0"})]})]})}),l?r(g,{title:"JS Heap Memory",children:r(E,{memory:l})}):r(g,{title:"JS Heap Memory",children:n("p",{class:"text-[0.72rem] text-muted-foreground text-center py-2",children:["Not available — enable ",r("code",{class:"font-mono text-foreground/70",children:"--enable-precise-memory-info"})," in Chrome flags."]})}),n(g,{title:"Core Web Vitals",children:[r("div",{class:"grid grid-cols-3 gap-2",children:$.map(d=>r(A,{label:d.label,metric:d.metric,unit:d.unit,value:d.value},d.metric))}),r("p",{class:"mt-2 text-[0.62rem] text-muted-foreground/60",children:"Measured from page load. Reload to refresh. LCP and FID update as the page is interacted with."})]}),r(g,{action:a.length>0?r("button",{class:"px-2 py-0.5 text-[0.65rem] border border-border text-muted-foreground hover:text-foreground cursor-pointer bg-transparent transition-colors",onClick:m(()=>p.clearLongTasks(),"onClick"),type:"button",children:"Clear"}):void 0,title:`Long Tasks${a.length>0?` (${a.length})`:""}`,children:a.length===0?r("p",{class:"text-[0.72rem] text-muted-foreground text-center py-2",children:"No long tasks detected yet."}):r("div",{class:"max-h-48 overflow-y-auto devtools-content-scroll",children:a.map(d=>r(V,{task:d},d.id))})})]})},"PerformanceApp");var D=Object.defineProperty,S=f((t,e)=>D(t,"name",{value:e,configurable:!0}),"l");const F=S(t=>t<1024*1024?`${(t/1024).toFixed(0)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`,"formatBytes"),v={good:"text-success-foreground","needs-improvement":"text-warning-foreground",poor:"text-destructive"},K=S(({samples:t})=>{if(t.length<2)return r("svg",{height:24,width:60});const e=60/(t.length-1),s=t.map((i,o)=>`${(o*e).toFixed(1)},${(24-i/60*24).toFixed(1)}`).join(" ");return r("svg",{height:24,style:"overflow:visible",width:60,children:r("polyline",{fill:"none",points:s,stroke:"currentColor","stroke-linejoin":"round","stroke-width":"1.5"})})},"MiniSparkline"),W=S(({memory:t})=>{const e=t.usedJSHeapSize/t.jsHeapSizeLimit*100,s=e>50?"bg-warning":"bg-success",i=e>80?"bg-destructive":s;return n("div",{class:"flex items-center gap-2",children:[r("div",{class:"flex-1 h-1.5 bg-foreground/8 rounded-full overflow-hidden",children:r("div",{class:c("h-full rounded-full",i),style:{width:`${e}%`}})}),n("span",{class:"text-[0.65rem] tabular-nums text-muted-foreground shrink-0",children:[F(t.usedJSHeapSize)," / ",F(t.jsHeapSizeLimit)]})]})},"MiniMemoryBar"),U=60,G=S(t=>{const[e,s]=w(M(()=>p.getSnapshot()),"snapshot"),i=w(H([]),"fpsHistoryRef");C(()=>(p.start(),p.subscribe(h=>{i.current.push(h.fps),i.current.length>U&&i.current.shift(),s(h)})),[]);const{fps:o,memory:a,vitals:l}=e,u=o>=30?"needs-improvement":"poor",b=o>=50?"good":u;return n("div",{class:"space-y-3 min-w-[200px]",children:[n("div",{class:"flex items-end gap-3",children:[n("div",{class:"flex flex-col items-center gap-0 shrink-0",children:[r("span",{class:c("text-2xl font-bold tabular-nums leading-none",v[b]),children:o}),r("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide",children:"fps"})]}),r("div",{class:c("flex-1 min-w-0",v[b]),children:r(K,{samples:i.current})})]}),n("div",{class:"flex gap-3",children:[l.lcp!==void 0&&n("div",{class:"flex flex-col gap-0.5",children:[r("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide",children:"LCP"}),n("span",{class:c("text-[0.8rem] font-semibold tabular-nums",v[y("lcp",l.lcp)]),children:[l.lcp," ms"]})]}),l.fcp!==void 0&&n("div",{class:"flex flex-col gap-0.5",children:[r("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide",children:"FCP"}),n("span",{class:c("text-[0.8rem] font-semibold tabular-nums",v[y("fcp",l.fcp)]),children:[l.fcp," ms"]})]}),l.cls!==void 0&&n("div",{class:"flex flex-col gap-0.5",children:[r("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide",children:"CLS"}),r("span",{class:c("text-[0.8rem] font-semibold tabular-nums",v[y("cls",l.cls)]),children:l.cls.toFixed(3)})]}),l.lcp===void 0&&l.fcp===void 0&&l.cls===void 0&&r("span",{class:"text-[0.65rem] text-muted-foreground/50",children:"Collecting metrics…"})]}),a&&n("div",{children:[r("span",{class:"text-[0.55rem] text-muted-foreground uppercase tracking-wide block mb-1",children:"Heap"}),r(W,{memory:a})]})]})},"PerformanceTooltip"),te={component:N,icon:j,id:"dev-toolbar:performance",name:"Performance",tooltip:G};export{te as default};
@@ -1,17 +1 @@
1
- var C=Object.defineProperty;var w=(i,t)=>C(i,"name",{value:t,configurable:!0});import{addHookName as u}from"preact/devtools";import{useState as h,useRef as S,useEffect as D}from"preact/hooks";import b from"../../packem_shared/cn-DWLJYh3h.js";import{jsxs as r,jsx as e,Fragment as I}from"preact/jsx-runtime";import k from"../../packem_shared/Button-DODNCTPZ.js";import T from"../../packem_shared/Badge-C30mDKKG.js";const j=`<!-- @license lucide-static v0.576.0 - ISC -->
2
- <svg
3
- class="lucide lucide-search"
4
- xmlns="http://www.w3.org/2000/svg"
5
- width="24"
6
- height="24"
7
- viewBox="0 0 24 24"
8
- fill="none"
9
- stroke="currentColor"
10
- stroke-width="2"
11
- stroke-linecap="round"
12
- stroke-linejoin="round"
13
- >
14
- <path d="m21 21-4.34-4.34" />
15
- <circle cx="11" cy="11" r="8" />
16
- </svg>
17
- `;var _=Object.defineProperty,s=w((i,t)=>_(i,"name",{value:t,configurable:!0}),"c");const A=s(()=>{const i=s(c=>document.querySelector(`meta[name="${c}"]`)?.content??"","getMeta"),t=s(c=>document.querySelector(`meta[property="og:${c}"]`)?.content??"","getOg"),l=s(c=>document.querySelector(`meta[name="twitter:${c}"]`)?.content??document.querySelector(`meta[property="twitter:${c}"]`)?.content??"","getTwitter"),n=s(c=>document.querySelector(`meta[property="article:${c}"]`)?.content??"","getArticle");return{articleAuthor:n("author"),articleModifiedTime:n("modified_time"),articlePublishedTime:n("published_time"),articleSection:n("section"),canonical:document.querySelector('link[rel="canonical"]')?.href??"",description:i("description"),ogDescription:t("description"),ogImage:t("image"),ogImageAlt:t("image:alt"),ogLocale:t("locale"),ogSiteName:t("site_name"),ogTitle:t("title"),ogType:t("type"),ogUrl:t("url"),title:document.title??"",twitterCard:l("card"),twitterCreator:l("creator"),twitterDescription:l("description"),twitterImage:l("image"),twitterImageAlt:l("image:alt"),twitterSite:l("site"),twitterTitle:l("title")}},"readMetaTags"),v=[{description:"Page title shown in browser tabs and search engine results",key:"title",label:"title",priority:"required",snippet:"<title>Your Page Title</title>"},{description:"Title shown when your page is shared on social media",key:"ogTitle",label:"og:title",priority:"required",snippet:'<meta property="og:title" content="Your Page Title" />'},{description:"Description shown when sharing on social media (max 200 chars)",key:"ogDescription",label:"og:description",priority:"required",snippet:'<meta property="og:description" content="Your page description" />'},{description:"Image shown when sharing (recommended: 1200 × 630 px)",key:"ogImage",label:"og:image",priority:"required",snippet:'<meta property="og:image" content="https://yoursite.com/og-image.jpg" />'},{description:"Twitter card format — controls how link previews appear on X / Twitter",key:"twitterCard",label:"twitter:card",priority:"required",snippet:'<meta name="twitter:card" content="summary_large_image" />'},{description:"Meta description used by search engines (max 160 chars)",key:"description",label:"description",priority:"recommended",snippet:'<meta name="description" content="Your page description" />'},{description:"Canonical URL to prevent duplicate content issues with search engines",key:"canonical",label:"canonical",priority:"recommended",snippet:'<link rel="canonical" href="https://yoursite.com/page" />'},{description:"Canonical page URL for Open Graph — should match the canonical link tag",key:"ogUrl",label:"og:url",priority:"recommended",snippet:'<meta property="og:url" content="https://yoursite.com/page" />'},{description:"Type of content: website, article, product, video.movie, etc.",key:"ogType",label:"og:type",priority:"recommended",snippet:'<meta property="og:type" content="website" />'},{description:"Your website name — shown for consistent branding on social platforms",key:"ogSiteName",label:"og:site_name",priority:"recommended",snippet:'<meta property="og:site_name" content="Your Site Name" />'},{description:"Language and territory of page content (e.g. en_US, de_DE, fr_FR)",key:"ogLocale",label:"og:locale",priority:"recommended",snippet:'<meta property="og:locale" content="en_US" />'},{description:"Alt text for the OG image — important for accessibility on social platforms",key:"ogImageAlt",label:"og:image:alt",priority:"recommended",snippet:'<meta property="og:image:alt" content="Description of the shared image" />'},{description:"Override title specifically for X / Twitter cards (falls back to og:title)",key:"twitterTitle",label:"twitter:title",priority:"recommended",snippet:'<meta name="twitter:title" content="Your Page Title" />'},{description:"Override description for X / Twitter cards (falls back to og:description)",key:"twitterDescription",label:"twitter:description",priority:"recommended",snippet:'<meta name="twitter:description" content="Your page description" />'},{description:"Override image for X / Twitter cards (falls back to og:image)",key:"twitterImage",label:"twitter:image",priority:"recommended",snippet:'<meta name="twitter:image" content="https://yoursite.com/twitter-card.jpg" />'},{description:"X / Twitter handle of the website owner (e.g. @yourhandle)",key:"twitterSite",label:"twitter:site",priority:"recommended",snippet:'<meta name="twitter:site" content="@yourhandle" />'}],U=[{accentClass:"border-blue-500/30",descKey:"ogDescription",id:"facebook",imageKey:"ogImage",name:"Facebook",requiredKeys:["ogTitle","ogDescription","ogImage"],titleKey:"ogTitle",urlKey:"ogUrl"},{accentClass:"border-foreground/20",descKey:"twitterDescription",id:"twitter",imageKey:"twitterImage",name:"X / Twitter",requiredKeys:["twitterTitle","twitterDescription","twitterImage","twitterCard"],titleKey:"twitterTitle",urlKey:"ogUrl"},{accentClass:"border-blue-600/30",descKey:"ogDescription",id:"linkedin",imageKey:"ogImage",name:"LinkedIn",requiredKeys:["ogTitle","ogDescription","ogImage"],titleKey:"ogTitle",urlKey:"ogUrl"},{accentClass:"border-indigo-500/30",descKey:"ogDescription",id:"discord",imageKey:"ogImage",name:"Discord",requiredKeys:["ogTitle","ogDescription"],titleKey:"ogTitle",urlKey:"ogUrl"},{accentClass:"border-green-500/30",descKey:"ogDescription",id:"slack",imageKey:"ogImage",name:"Slack",requiredKeys:["ogTitle","ogDescription"],titleKey:"ogTitle",urlKey:"ogUrl"},{accentClass:"border-purple-500/30",descKey:"ogDescription",id:"mastodon",imageKey:"ogImage",name:"Mastodon",requiredKeys:["ogTitle","ogDescription"],titleKey:"ogTitle",urlKey:"ogUrl"},{accentClass:"border-sky-500/30",descKey:"ogDescription",id:"bluesky",imageKey:"ogImage",name:"Bluesky",requiredKeys:["ogTitle","ogDescription"],titleKey:"ogTitle",urlKey:"ogUrl"}],M=s(({meta:i,platform:t})=>{const l=i[t.titleKey]||i.title||"No title",n=i[t.descKey]||i.description||"",c=i[t.imageKey]||"",g=i[t.urlKey]||i.canonical||"",d=t.requiredKeys.filter(p=>!i[p]);return r("div",{class:b("border bg-card overflow-hidden",t.accentClass),children:[r("div",{class:"flex items-center justify-between gap-2 px-3 py-2 border-b border-border/50 bg-foreground/2",children:[e("span",{class:"text-[0.65rem] font-bold uppercase tracking-wider text-muted-foreground",children:t.name}),d.length>0&&r("span",{class:"text-[0.6rem] px-1.5 py-0.5 bg-warning/10 text-warning border border-warning/20 font-medium",children:["Missing: ",d.join(", ")]})]}),r("div",{class:"p-3",children:[e("div",{class:"w-full aspect-[1200/630] bg-foreground/6 border border-border/50 mb-2.5 overflow-hidden relative",children:c?e("img",{alt:"OG image preview",class:"w-full h-full object-cover",loading:"lazy",src:c}):e("div",{class:"absolute inset-0 flex items-center justify-center",children:e("span",{class:"text-[0.65rem] text-muted-foreground/40 uppercase tracking-wider",children:"No image"})})}),g&&e("div",{class:"text-[0.6rem] text-muted-foreground/60 uppercase tracking-wider truncate mb-1",children:g}),e("div",{class:"text-[0.8rem] font-semibold text-foreground line-clamp-1",children:l}),n&&e("div",{class:"text-[0.7rem] text-muted-foreground line-clamp-2 mt-0.5",children:n})]})]})},"SocialPreview"),a=s(({label:i,required:t=!1,value:l})=>r("div",{class:"flex items-start gap-3 py-2 border-b border-border/30 last:border-0",children:[e("div",{class:"w-44 shrink-0",children:e("span",{class:"text-[0.7rem] font-mono text-muted-foreground",children:i})}),e("div",{class:"flex-1 min-w-0",children:l?e("span",{class:"text-[0.75rem] text-foreground break-all",children:l}):e("span",{class:b("text-[0.7rem]",t?"text-warning":"text-muted-foreground/40"),children:t?"⚠ Missing":"—"})})]}),"MetaRow"),m=s(({children:i})=>r("p",{class:"text-[0.58rem] font-bold uppercase tracking-[0.12em] text-muted-foreground/60 mb-2",children:[e("span",{class:"text-primary/50",children:"// "}),i]}),"SectionHeading"),O=s(({text:i})=>{const[t,l]=u(h(!1),"copied"),n=u(S(null),"timerRef"),c=s(()=>{navigator.clipboard.writeText(i).then(()=>{l(!0),n.current&&clearTimeout(n.current),n.current=setTimeout(l,2e3,!1)}).catch(console.error)},"handleCopy");return e(k,{class:b("text-[0.6rem] font-mono shrink-0",t?"border-success/40 text-success bg-success/8":""),onClick:c,size:"sm",variant:"outline",children:t?"Copied!":"Copy"})},"CopyButton"),x=s(({def:i})=>r("div",{class:"border border-border/60 bg-card p-3 space-y-2",children:[r("div",{class:"flex items-start justify-between gap-3",children:[e("code",{class:"text-[0.7rem] font-mono font-bold text-foreground",children:i.label}),e(T,{class:"text-[0.58rem] uppercase tracking-wide shrink-0",variant:i.priority==="required"?"destructive":"warning",children:i.priority})]}),e("p",{class:"text-[0.7rem] text-muted-foreground leading-relaxed",children:i.description}),r("div",{class:"flex items-center gap-2",children:[e("code",{class:"flex-1 min-w-0 text-[0.65rem] font-mono text-muted-foreground bg-foreground/4 border border-border/40 px-2 py-1 overflow-x-auto whitespace-nowrap block",children:i.snippet}),e(O,{text:i.snippet})]})]}),"MissingTagCard"),P=s(i=>{const[t,l]=u(h(null),"meta"),[n,c]=u(h("preview"),"activeTab"),g=s(()=>{l(A())},"refresh");if(D(()=>{g()},[]),!t)return r("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(o=>e("span",{class:"size-1.5 bg-primary/50 rounded-full animate-pulse",style:{animationDelay:`${o}ms`}},o))}),e("span",{class:"text-[0.75rem] text-muted-foreground",children:"Reading meta tags…"})]});const d=v.filter(o=>o.priority==="required"&&!t[o.key]),p=v.filter(o=>o.priority==="recommended"&&!t[o.key]),y=d.length+p.length,K=t.ogType==="article"||!!(t.articleAuthor||t.articlePublishedTime||t.articleModifiedTime||t.articleSection);return r("div",{class:"flex flex-col h-full",children:[r("div",{class:"flex items-center justify-between gap-3 px-4 py-2.5 border-b border-border shrink-0",children:[e("div",{class:"flex items-center gap-0",children:["preview","tags","missing"].map(o=>{const q=o==="preview"?"Social Previews":o==="tags"?"Meta Tags":"Missing",f=o==="missing"&&y>0?y:null;return r("button",{class:b("flex items-center gap-1.5 px-3 py-1.5 text-[0.75rem] font-medium border-0 cursor-pointer transition-colors capitalize",n===o?"text-foreground border-b-2 border-primary bg-transparent":"text-muted-foreground bg-transparent hover:text-foreground"),onClick:s(()=>c(o),"onClick"),type:"button",children:[q,f!==null&&e(T,{class:"text-[0.58rem] min-w-[1.1rem] text-center",variant:d.length>0?"destructive":"warning",children:f})]},o)})}),e(k,{onClick:g,size:"sm",variant:"outline",children:"Refresh"})]}),r("div",{class:"flex-1 overflow-auto",children:[n==="preview"&&e("div",{class:"p-4 grid grid-cols-2 gap-4",children:U.map(o=>e(M,{meta:t,platform:o},o.id))}),n==="tags"&&r("div",{class:"p-5 space-y-5",children:[r("div",{children:[e(m,{children:"Basic"}),e("div",{class:"border border-border bg-card",children:r("div",{class:"px-4",children:[e(a,{label:"title",required:!0,value:t.title}),e(a,{label:"description",required:!0,value:t.description}),e(a,{label:"canonical",value:t.canonical})]})})]}),r("div",{children:[e(m,{children:"Open Graph"}),e("div",{class:"border border-border bg-card",children:r("div",{class:"px-4",children:[e(a,{label:"og:title",required:!0,value:t.ogTitle}),e(a,{label:"og:description",required:!0,value:t.ogDescription}),e(a,{label:"og:image",required:!0,value:t.ogImage}),e(a,{label:"og:image:alt",value:t.ogImageAlt}),e(a,{label:"og:url",value:t.ogUrl}),e(a,{label:"og:type",value:t.ogType}),e(a,{label:"og:site_name",value:t.ogSiteName}),e(a,{label:"og:locale",value:t.ogLocale})]})})]}),K&&r("div",{children:[e(m,{children:"Article"}),e("div",{class:"border border-border bg-card",children:r("div",{class:"px-4",children:[e(a,{label:"article:author",value:t.articleAuthor}),e(a,{label:"article:published_time",value:t.articlePublishedTime}),e(a,{label:"article:modified_time",value:t.articleModifiedTime}),e(a,{label:"article:section",value:t.articleSection})]})})]}),r("div",{children:[e(m,{children:"X / Twitter"}),e("div",{class:"border border-border bg-card",children:r("div",{class:"px-4",children:[e(a,{label:"twitter:card",required:!0,value:t.twitterCard}),e(a,{label:"twitter:title",value:t.twitterTitle}),e(a,{label:"twitter:description",value:t.twitterDescription}),e(a,{label:"twitter:image",value:t.twitterImage}),e(a,{label:"twitter:image:alt",value:t.twitterImageAlt}),e(a,{label:"twitter:site",value:t.twitterSite}),e(a,{label:"twitter:creator",value:t.twitterCreator})]})})]})]}),n==="missing"&&e("div",{class:"p-5 space-y-5",children:y===0?r("div",{class:"flex flex-col items-center justify-center py-12 gap-3",children:[e("div",{class:"size-10 border border-success/30 bg-success/8 flex items-center justify-center text-success text-lg select-none",children:"✓"}),e("p",{class:"text-[0.8rem] font-medium text-foreground/70",children:"All recommended tags are present"}),e("p",{class:"text-[0.7rem] text-muted-foreground",children:"Your page has all required and recommended meta tags."})]}):r(I,{children:[d.length>0&&r("div",{children:[r("p",{class:"text-[0.58rem] font-bold uppercase tracking-[0.12em] text-destructive/80 mb-2 flex items-center gap-1.5",children:[e("span",{children:"Required"}),e("span",{class:"bg-destructive/10 border border-destructive/25 text-destructive px-1 font-bold",children:d.length})]}),e("div",{class:"space-y-2",children:d.map(o=>e(x,{def:o},o.key))})]}),p.length>0&&r("div",{children:[r("p",{class:"text-[0.58rem] font-bold uppercase tracking-[0.12em] text-warning/80 mb-2 flex items-center gap-1.5",children:[e("span",{children:"Recommended"}),e("span",{class:"bg-warning/10 border border-warning/25 text-warning px-1 font-bold",children:p.length})]}),e("div",{class:"space-y-2",children:p.map(o=>e(x,{def:o},o.key))})]})]})})]})]})},"SeoApp"),B={component:P,icon:j,id:"dev-toolbar:seo",name:"SEO"};export{B as default};
1
+ var C=Object.defineProperty;var w=(i,t)=>C(i,"name",{value:t,configurable:!0});import S from"lucide-static/icons/search.svg?raw";import{addHookName as u}from"preact/devtools";import{useState as h,useRef as D,useEffect as I}from"preact/hooks";import b from"../../packem_shared/cn-DWLJYh3h.js";import{jsxs as r,jsx as e,Fragment as _}from"preact/jsx-runtime";import k from"../../packem_shared/Button-DODNCTPZ.js";import T from"../../packem_shared/Badge-C30mDKKG.js";var j=Object.defineProperty,s=w((i,t)=>j(i,"name",{value:t,configurable:!0}),"c");const A=s(()=>{const i=s(c=>document.querySelector(`meta[name="${c}"]`)?.content??"","getMeta"),t=s(c=>document.querySelector(`meta[property="og:${c}"]`)?.content??"","getOg"),l=s(c=>document.querySelector(`meta[name="twitter:${c}"]`)?.content??document.querySelector(`meta[property="twitter:${c}"]`)?.content??"","getTwitter"),n=s(c=>document.querySelector(`meta[property="article:${c}"]`)?.content??"","getArticle");return{articleAuthor:n("author"),articleModifiedTime:n("modified_time"),articlePublishedTime:n("published_time"),articleSection:n("section"),canonical:document.querySelector('link[rel="canonical"]')?.href??"",description:i("description"),ogDescription:t("description"),ogImage:t("image"),ogImageAlt:t("image:alt"),ogLocale:t("locale"),ogSiteName:t("site_name"),ogTitle:t("title"),ogType:t("type"),ogUrl:t("url"),title:document.title??"",twitterCard:l("card"),twitterCreator:l("creator"),twitterDescription:l("description"),twitterImage:l("image"),twitterImageAlt:l("image:alt"),twitterSite:l("site"),twitterTitle:l("title")}},"readMetaTags"),v=[{description:"Page title shown in browser tabs and search engine results",key:"title",label:"title",priority:"required",snippet:"<title>Your Page Title</title>"},{description:"Title shown when your page is shared on social media",key:"ogTitle",label:"og:title",priority:"required",snippet:'<meta property="og:title" content="Your Page Title" />'},{description:"Description shown when sharing on social media (max 200 chars)",key:"ogDescription",label:"og:description",priority:"required",snippet:'<meta property="og:description" content="Your page description" />'},{description:"Image shown when sharing (recommended: 1200 × 630 px)",key:"ogImage",label:"og:image",priority:"required",snippet:'<meta property="og:image" content="https://yoursite.com/og-image.jpg" />'},{description:"Twitter card format — controls how link previews appear on X / Twitter",key:"twitterCard",label:"twitter:card",priority:"required",snippet:'<meta name="twitter:card" content="summary_large_image" />'},{description:"Meta description used by search engines (max 160 chars)",key:"description",label:"description",priority:"recommended",snippet:'<meta name="description" content="Your page description" />'},{description:"Canonical URL to prevent duplicate content issues with search engines",key:"canonical",label:"canonical",priority:"recommended",snippet:'<link rel="canonical" href="https://yoursite.com/page" />'},{description:"Canonical page URL for Open Graph — should match the canonical link tag",key:"ogUrl",label:"og:url",priority:"recommended",snippet:'<meta property="og:url" content="https://yoursite.com/page" />'},{description:"Type of content: website, article, product, video.movie, etc.",key:"ogType",label:"og:type",priority:"recommended",snippet:'<meta property="og:type" content="website" />'},{description:"Your website name — shown for consistent branding on social platforms",key:"ogSiteName",label:"og:site_name",priority:"recommended",snippet:'<meta property="og:site_name" content="Your Site Name" />'},{description:"Language and territory of page content (e.g. en_US, de_DE, fr_FR)",key:"ogLocale",label:"og:locale",priority:"recommended",snippet:'<meta property="og:locale" content="en_US" />'},{description:"Alt text for the OG image — important for accessibility on social platforms",key:"ogImageAlt",label:"og:image:alt",priority:"recommended",snippet:'<meta property="og:image:alt" content="Description of the shared image" />'},{description:"Override title specifically for X / Twitter cards (falls back to og:title)",key:"twitterTitle",label:"twitter:title",priority:"recommended",snippet:'<meta name="twitter:title" content="Your Page Title" />'},{description:"Override description for X / Twitter cards (falls back to og:description)",key:"twitterDescription",label:"twitter:description",priority:"recommended",snippet:'<meta name="twitter:description" content="Your page description" />'},{description:"Override image for X / Twitter cards (falls back to og:image)",key:"twitterImage",label:"twitter:image",priority:"recommended",snippet:'<meta name="twitter:image" content="https://yoursite.com/twitter-card.jpg" />'},{description:"X / Twitter handle of the website owner (e.g. @yourhandle)",key:"twitterSite",label:"twitter:site",priority:"recommended",snippet:'<meta name="twitter:site" content="@yourhandle" />'}],U=[{accentClass:"border-blue-500/30",descKey:"ogDescription",id:"facebook",imageKey:"ogImage",name:"Facebook",requiredKeys:["ogTitle","ogDescription","ogImage"],titleKey:"ogTitle",urlKey:"ogUrl"},{accentClass:"border-foreground/20",descKey:"twitterDescription",id:"twitter",imageKey:"twitterImage",name:"X / Twitter",requiredKeys:["twitterTitle","twitterDescription","twitterImage","twitterCard"],titleKey:"twitterTitle",urlKey:"ogUrl"},{accentClass:"border-blue-600/30",descKey:"ogDescription",id:"linkedin",imageKey:"ogImage",name:"LinkedIn",requiredKeys:["ogTitle","ogDescription","ogImage"],titleKey:"ogTitle",urlKey:"ogUrl"},{accentClass:"border-indigo-500/30",descKey:"ogDescription",id:"discord",imageKey:"ogImage",name:"Discord",requiredKeys:["ogTitle","ogDescription"],titleKey:"ogTitle",urlKey:"ogUrl"},{accentClass:"border-green-500/30",descKey:"ogDescription",id:"slack",imageKey:"ogImage",name:"Slack",requiredKeys:["ogTitle","ogDescription"],titleKey:"ogTitle",urlKey:"ogUrl"},{accentClass:"border-purple-500/30",descKey:"ogDescription",id:"mastodon",imageKey:"ogImage",name:"Mastodon",requiredKeys:["ogTitle","ogDescription"],titleKey:"ogTitle",urlKey:"ogUrl"},{accentClass:"border-sky-500/30",descKey:"ogDescription",id:"bluesky",imageKey:"ogImage",name:"Bluesky",requiredKeys:["ogTitle","ogDescription"],titleKey:"ogTitle",urlKey:"ogUrl"}],M=s(({meta:i,platform:t})=>{const l=i[t.titleKey]||i.title||"No title",n=i[t.descKey]||i.description||"",c=i[t.imageKey]||"",m=i[t.urlKey]||i.canonical||"",d=t.requiredKeys.filter(p=>!i[p]);return r("div",{class:b("border bg-card overflow-hidden",t.accentClass),children:[r("div",{class:"flex items-center justify-between gap-2 px-3 py-2 border-b border-border/50 bg-foreground/2",children:[e("span",{class:"text-[0.65rem] font-bold uppercase tracking-wider text-muted-foreground",children:t.name}),d.length>0&&r("span",{class:"text-[0.6rem] px-1.5 py-0.5 bg-warning/10 text-warning border border-warning/20 font-medium",children:["Missing: ",d.join(", ")]})]}),r("div",{class:"p-3",children:[e("div",{class:"w-full aspect-[1200/630] bg-foreground/6 border border-border/50 mb-2.5 overflow-hidden relative",children:c?e("img",{alt:"OG image preview",class:"w-full h-full object-cover",loading:"lazy",src:c}):e("div",{class:"absolute inset-0 flex items-center justify-center",children:e("span",{class:"text-[0.65rem] text-muted-foreground/40 uppercase tracking-wider",children:"No image"})})}),m&&e("div",{class:"text-[0.6rem] text-muted-foreground/60 uppercase tracking-wider truncate mb-1",children:m}),e("div",{class:"text-[0.8rem] font-semibold text-foreground line-clamp-1",children:l}),n&&e("div",{class:"text-[0.7rem] text-muted-foreground line-clamp-2 mt-0.5",children:n})]})]})},"SocialPreview"),a=s(({label:i,required:t=!1,value:l})=>r("div",{class:"flex items-start gap-3 py-2 border-b border-border/30 last:border-0",children:[e("div",{class:"w-44 shrink-0",children:e("span",{class:"text-[0.7rem] font-mono text-muted-foreground",children:i})}),e("div",{class:"flex-1 min-w-0",children:l?e("span",{class:"text-[0.75rem] text-foreground break-all",children:l}):e("span",{class:b("text-[0.7rem]",t?"text-warning":"text-muted-foreground/40"),children:t?"⚠ Missing":"—"})})]}),"MetaRow"),g=s(({children:i})=>r("p",{class:"text-[0.58rem] font-bold uppercase tracking-[0.12em] text-muted-foreground/60 mb-2",children:[e("span",{class:"text-primary/50",children:"// "}),i]}),"SectionHeading"),O=s(({text:i})=>{const[t,l]=u(h(!1),"copied"),n=u(D(void 0),"timerRef"),c=s(()=>{navigator.clipboard.writeText(i).then(()=>{l(!0),n.current&&clearTimeout(n.current),n.current=setTimeout(l,2e3,!1)}).catch(()=>{})},"handleCopy");return e(k,{class:b("text-[0.6rem] font-mono shrink-0",t?"border-success/40 text-success bg-success/8":""),onClick:c,size:"sm",variant:"outline",children:t?"Copied!":"Copy"})},"CopyButton"),x=s(({def:i})=>r("div",{class:"border border-border/60 bg-card p-3 space-y-2",children:[r("div",{class:"flex items-start justify-between gap-3",children:[e("code",{class:"text-[0.7rem] font-mono font-bold text-foreground",children:i.label}),e(T,{class:"text-[0.58rem] uppercase tracking-wide shrink-0",variant:i.priority==="required"?"destructive":"warning",children:i.priority})]}),e("p",{class:"text-[0.7rem] text-muted-foreground leading-relaxed",children:i.description}),r("div",{class:"flex items-center gap-2",children:[e("code",{class:"flex-1 min-w-0 text-[0.65rem] font-mono text-muted-foreground bg-foreground/4 border border-border/40 px-2 py-1 overflow-x-auto whitespace-nowrap block",children:i.snippet}),e(O,{text:i.snippet})]})]}),"MissingTagCard"),P=s(i=>{const[t,l]=u(h(void 0),"meta"),[n,c]=u(h("preview"),"activeTab"),m=s(()=>{l(A())},"refresh");if(I(()=>{m()},[]),!t)return r("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(o=>e("span",{class:"size-1.5 bg-primary/50 rounded-full animate-pulse",style:{animationDelay:`${o}ms`}},o))}),e("span",{class:"text-[0.75rem] text-muted-foreground",children:"Reading meta tags…"})]});const d=v.filter(o=>o.priority==="required"&&!t[o.key]),p=v.filter(o=>o.priority==="recommended"&&!t[o.key]),y=d.length+p.length,K=t.ogType==="article"||!!(t.articleAuthor||t.articlePublishedTime||t.articleModifiedTime||t.articleSection);return r("div",{class:"flex flex-col h-full",children:[r("div",{class:"flex items-center justify-between gap-3 px-4 py-2.5 border-b border-border shrink-0",children:[e("div",{class:"flex items-center gap-0",children:["preview","tags","missing"].map(o=>{const q=o==="preview"?"Social Previews":o==="tags"?"Meta Tags":"Missing",f=o==="missing"&&y>0?y:void 0;return r("button",{class:b("flex items-center gap-1.5 px-3 py-1.5 text-[0.75rem] font-medium border-0 cursor-pointer transition-colors capitalize",n===o?"text-foreground border-b-2 border-primary bg-transparent":"text-muted-foreground bg-transparent hover:text-foreground"),onClick:s(()=>c(o),"onClick"),type:"button",children:[q,f!==void 0&&e(T,{class:"text-[0.58rem] min-w-[1.1rem] text-center",variant:d.length>0?"destructive":"warning",children:f})]},o)})}),e(k,{onClick:m,size:"sm",variant:"outline",children:"Refresh"})]}),r("div",{class:"flex-1 overflow-auto",children:[n==="preview"&&e("div",{class:"p-4 grid grid-cols-2 gap-4",children:U.map(o=>e(M,{meta:t,platform:o},o.id))}),n==="tags"&&r("div",{class:"p-5 space-y-5",children:[r("div",{children:[e(g,{children:"Basic"}),e("div",{class:"border border-border bg-card",children:r("div",{class:"px-4",children:[e(a,{label:"title",required:!0,value:t.title}),e(a,{label:"description",required:!0,value:t.description}),e(a,{label:"canonical",value:t.canonical})]})})]}),r("div",{children:[e(g,{children:"Open Graph"}),e("div",{class:"border border-border bg-card",children:r("div",{class:"px-4",children:[e(a,{label:"og:title",required:!0,value:t.ogTitle}),e(a,{label:"og:description",required:!0,value:t.ogDescription}),e(a,{label:"og:image",required:!0,value:t.ogImage}),e(a,{label:"og:image:alt",value:t.ogImageAlt}),e(a,{label:"og:url",value:t.ogUrl}),e(a,{label:"og:type",value:t.ogType}),e(a,{label:"og:site_name",value:t.ogSiteName}),e(a,{label:"og:locale",value:t.ogLocale})]})})]}),K&&r("div",{children:[e(g,{children:"Article"}),e("div",{class:"border border-border bg-card",children:r("div",{class:"px-4",children:[e(a,{label:"article:author",value:t.articleAuthor}),e(a,{label:"article:published_time",value:t.articlePublishedTime}),e(a,{label:"article:modified_time",value:t.articleModifiedTime}),e(a,{label:"article:section",value:t.articleSection})]})})]}),r("div",{children:[e(g,{children:"X / Twitter"}),e("div",{class:"border border-border bg-card",children:r("div",{class:"px-4",children:[e(a,{label:"twitter:card",required:!0,value:t.twitterCard}),e(a,{label:"twitter:title",value:t.twitterTitle}),e(a,{label:"twitter:description",value:t.twitterDescription}),e(a,{label:"twitter:image",value:t.twitterImage}),e(a,{label:"twitter:image:alt",value:t.twitterImageAlt}),e(a,{label:"twitter:site",value:t.twitterSite}),e(a,{label:"twitter:creator",value:t.twitterCreator})]})})]})]}),n==="missing"&&e("div",{class:"p-5 space-y-5",children:y===0?r("div",{class:"flex flex-col items-center justify-center py-12 gap-3",children:[e("div",{class:"size-10 border border-success/30 bg-success/8 flex items-center justify-center text-success text-lg select-none",children:"✓"}),e("p",{class:"text-[0.8rem] font-medium text-foreground/70",children:"All recommended tags are present"}),e("p",{class:"text-[0.7rem] text-muted-foreground",children:"Your page has all required and recommended meta tags."})]}):r(_,{children:[d.length>0&&r("div",{children:[r("p",{class:"text-[0.58rem] font-bold uppercase tracking-[0.12em] text-destructive/80 mb-2 flex items-center gap-1.5",children:[e("span",{children:"Required"}),e("span",{class:"bg-destructive/10 border border-destructive/25 text-destructive px-1 font-bold",children:d.length})]}),e("div",{class:"space-y-2",children:d.map(o=>e(x,{def:o},o.key))})]}),p.length>0&&r("div",{children:[r("p",{class:"text-[0.58rem] font-bold uppercase tracking-[0.12em] text-warning/80 mb-2 flex items-center gap-1.5",children:[e("span",{children:"Recommended"}),e("span",{class:"bg-warning/10 border border-warning/25 text-warning px-1 font-bold",children:p.length})]}),e("div",{class:"space-y-2",children:p.map(o=>e(x,{def:o},o.key))})]})]})})]})]})},"SeoApp"),B={component:P,icon:S,id:"dev-toolbar:seo",name:"SEO"};export{B as default};