@visulima/dev-toolbar 1.0.0-alpha.5 → 1.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -0
- package/bin/mcp.js +29 -0
- package/dist/apps/annotations/annotations-app.d.ts +4 -0
- package/dist/apps/annotations/index.d.ts +3 -0
- package/dist/apps/annotations/index.js +18 -0
- package/dist/apps/inspector/a11y-capture.d.ts +12 -0
- package/dist/apps/inspector/annotation-overlay.d.ts +55 -0
- package/dist/apps/inspector/annotation-settings.d.ts +33 -0
- package/dist/apps/inspector/element-utils.d.ts +115 -0
- package/dist/apps/inspector/freeze-animations.d.ts +22 -0
- package/dist/apps/inspector/index.js +15 -2
- package/dist/apps/inspector/rulers.d.ts +14 -0
- package/dist/apps/inspector/theme-palette.d.ts +34 -0
- package/dist/apps/seo/index.js +2 -2
- package/dist/apps/settings/index.js +2 -2
- package/dist/client/overlay.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.d.ts +12 -0
- package/dist/mcp/server.js +1 -0
- package/dist/packem_chunks/inject-source.js +6 -6
- package/dist/packem_shared/Select-C0CQOOqZ.js +1 -0
- package/dist/packem_shared/annotation-settings-DOyUbJ_T.js +1 -0
- package/dist/packem_shared/annotation-store-bLQRYMaI.js +1 -0
- package/dist/packem_shared/createServerRPCContext-CJ6F87o_.js +1 -0
- package/dist/packem_shared/sharedToolbarStylesheet-CaTdYhVe.js +2 -0
- package/dist/rpc/functions/annotations.d.ts +28 -0
- package/dist/rpc/functions/vite-config.d.ts +1 -1
- package/dist/store/annotation-store.d.ts +41 -0
- package/dist/toolbar/index.js +1 -1
- package/dist/types/annotations.d.ts +156 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/rpc.d.ts +33 -0
- package/dist/ui/components/select.d.ts +54 -0
- package/dist/ui/index.d.ts +2 -0
- package/dist/ui/index.js +1 -1
- package/dist/vite-plugin.d.ts +1 -0
- package/dist/vite-plugin.js +5 -2
- package/package.json +27 -6
- package/dist/packem_shared/createServerRPCContext-CJXa8ezf.js +0 -1
- package/dist/packem_shared/sharedToolbarStylesheet-JFwZE8kq.js +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,51 @@
|
|
|
1
|
+
## @visulima/dev-toolbar [1.0.0-alpha.7](https://github.com/visulima/visulima/compare/@visulima/dev-toolbar@1.0.0-alpha.6...@visulima/dev-toolbar@1.0.0-alpha.7) (2026-03-26)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* **web:** auto-generate packages page from workspace metadata ([623e520](https://github.com/visulima/visulima/commit/623e5207693a7fe720f5f2f179593a3654c880e3))
|
|
6
|
+
|
|
7
|
+
## @visulima/dev-toolbar [1.0.0-alpha.6](https://github.com/visulima/visulima/compare/@visulima/dev-toolbar@1.0.0-alpha.5...@visulima/dev-toolbar@1.0.0-alpha.6) (2026-03-26)
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **dev-toolbar:** add accessibility info capture to inspector ([2b98ee6](https://github.com/visulima/visulima/commit/2b98ee6249759d1d2c42504354ebf3a92db4a6e6))
|
|
12
|
+
* **dev-toolbar:** add custom Select component replacing native <select> ([c9c8685](https://github.com/visulima/visulima/commit/c9c8685ea3a05c28ea89d5f5d852d56bc8cbcad0))
|
|
13
|
+
* **dev-toolbar:** add viewport rulers with draggable guidelines to inspector ([9df079a](https://github.com/visulima/visulima/commit/9df079a83563b1afc617d76df78259082ea98817))
|
|
14
|
+
* **dev-toolbar:** add visual annotation system with MCP agent integration ([be88cfe](https://github.com/visulima/visulima/commit/be88cfe30f3f624075167762e9c9780653dd34e9))
|
|
15
|
+
* **dev-toolbar:** redesign annotation popups, add toast notifications, improve docs ([cca080f](https://github.com/visulima/visulima/commit/cca080fc6098a692e681ee5b140f8c5c3a810a2c))
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **api-platform:** use workspace:* for internal [@visulima](https://github.com/visulima) deps ([daa2b0b](https://github.com/visulima/visulima/commit/daa2b0bfb491b42bc83c369fec2dcd7950f082b0))
|
|
20
|
+
* **dev-toolbar:** address code review findings across toolbar components ([449a300](https://github.com/visulima/visulima/commit/449a300226e4ccaee52ad258d5eccf6f77a72343))
|
|
21
|
+
* **dev-toolbar:** align inspector floating badge with main toolbar styling ([8ea1814](https://github.com/visulima/visulima/commit/8ea1814b596126b71231fd124c036f1e450275ef))
|
|
22
|
+
* **dev-toolbar:** audit Select component, add tests, fix pre-existing type error ([c8452d3](https://github.com/visulima/visulima/commit/c8452d3b495e9707579490155e6689c40cff9568))
|
|
23
|
+
* **dev-toolbar:** auto-detect TanStack Start and shield Preact from React Compiler ([6e9fa57](https://github.com/visulima/visulima/commit/6e9fa571ded1ff53d8809cee47fb404897320e9f))
|
|
24
|
+
* **dev-toolbar:** fix coordinate bugs, orphaned elements, and doc inaccuracies ([efa9c54](https://github.com/visulima/visulima/commit/efa9c544c9a8591c6efe6fd4a9995b411c054f54))
|
|
25
|
+
* **dev-toolbar:** open inspector popup at click point and add visible drag handle ([c012aed](https://github.com/visulima/visulima/commit/c012aed47eeabf2047d5a7a7e46cab807de902f3))
|
|
26
|
+
* **dev-toolbar:** prevent querySelector crash on area selection element paths ([ecd64d4](https://github.com/visulima/visulima/commit/ecd64d4b418e74cc582da0cd5efdb9f5e8e95d2b))
|
|
27
|
+
* **dev-toolbar:** resolve all TypeScript, ESLint, and Prettier errors in annotation system ([2fae465](https://github.com/visulima/visulima/commit/2fae4658017d61262293a41bef13348bbfc70e41))
|
|
28
|
+
* **dev-toolbar:** use correct ARIA role in select search tests ([2e1ddfe](https://github.com/visulima/visulima/commit/2e1ddfed1b49697a2d772c5a6b61bf3b6538a43b))
|
|
29
|
+
* **dev-toolbar:** use workspace:* for internal [@visulima](https://github.com/visulima) deps ([26ea008](https://github.com/visulima/visulima/commit/26ea00878218a34f89587fb9a2157cb379e98733))
|
|
30
|
+
* **web:** improve build setup with incremental stats caching and prod install ([fe33e75](https://github.com/visulima/visulima/commit/fe33e75827586779b4b3a0c6d57b39f889ee6207))
|
|
31
|
+
|
|
32
|
+
### Documentation
|
|
33
|
+
|
|
34
|
+
* **dev-toolbar:** update examples to use native Vite 8 resolve.tsconfigPaths ([d54d3f7](https://github.com/visulima/visulima/commit/d54d3f71714fc600e4b965e1ab2bdbe0cc442ba6))
|
|
35
|
+
|
|
36
|
+
### Miscellaneous Chores
|
|
37
|
+
|
|
38
|
+
* **dev-toolbar:** migrate deps to pnpm catalogs ([a43badc](https://github.com/visulima/visulima/commit/a43badcc8cd19d9c3c9cda4b2d75e272d76d51c8))
|
|
39
|
+
* **dev-toolbar:** update dependencies ([8cac2a2](https://github.com/visulima/visulima/commit/8cac2a2068d902ee8196f8e1f50d658644be7e70))
|
|
40
|
+
* update gen file ([8794258](https://github.com/visulima/visulima/commit/87942584bc22cab96a14094d2ec46ec667179490))
|
|
41
|
+
* visulima website ([#591](https://github.com/visulima/visulima/issues/591)) ([59ab2e2](https://github.com/visulima/visulima/commit/59ab2e2befb03e51cd2088956f83d9b87de6d033))
|
|
42
|
+
|
|
43
|
+
### Code Refactoring
|
|
44
|
+
|
|
45
|
+
* **dev-toolbar:** use native Vite 8 tsconfigPaths in cloudflare example ([fb15d1d](https://github.com/visulima/visulima/commit/fb15d1df62040853a36e7926382765e902380d3a))
|
|
46
|
+
* **dev-toolbar:** use native Vite 8 tsconfigPaths in tanstack-start example ([d89aef7](https://github.com/visulima/visulima/commit/d89aef7c2ba4a8443897d3f7cb9ada494d38d2c4))
|
|
47
|
+
* **docs:** migrate Nextra components to fumadocs-ui, remove Nextra stripping ([484878f](https://github.com/visulima/visulima/commit/484878f01879363ef5e9a0282904dc4627d6060c))
|
|
48
|
+
|
|
1
49
|
## @visulima/dev-toolbar [1.0.0-alpha.5](https://github.com/visulima/visulima/compare/@visulima/dev-toolbar@1.0.0-alpha.4...@visulima/dev-toolbar@1.0.0-alpha.5) (2026-03-06)
|
|
2
50
|
|
|
3
51
|
### Features
|
package/bin/mcp.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* MCP server for @visulima/dev-toolbar annotations.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* npx visulima-dev-toolbar-mcp
|
|
8
|
+
*
|
|
9
|
+
* Configure in .mcp.json:
|
|
10
|
+
* {
|
|
11
|
+
* "mcpServers": {
|
|
12
|
+
* "dev-toolbar": {
|
|
13
|
+
* "command": "npx",
|
|
14
|
+
* "args": ["visulima-dev-toolbar-mcp"],
|
|
15
|
+
* "cwd": "/absolute/path/to/project"
|
|
16
|
+
* }
|
|
17
|
+
* }
|
|
18
|
+
* }
|
|
19
|
+
*
|
|
20
|
+
* Requires @modelcontextprotocol/sdk to be installed.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
// eslint-disable-next-line antfu/no-import-dist -- bin entry point runs after build
|
|
24
|
+
import { startMcpServer } from "../dist/mcp/server.js";
|
|
25
|
+
|
|
26
|
+
startMcpServer().catch((error) => {
|
|
27
|
+
console.error("Failed to start MCP server:", error);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var j=Object.defineProperty;var z=(t,s)=>j(t,"name",{value:s,configurable:!0});import{addHookName as c}from"preact/devtools";import{clsx as h}from"../../packem_shared/clsx-wGlvpUfw.js";import{useState as p,useCallback as S,useEffect as q}from"preact/hooks";import{s as Q,M as H,l as K}from"../../packem_shared/annotation-settings-DOyUbJ_T.js";import{jsx as e,jsxs as r}from"preact/jsx-runtime";import g from"../../packem_shared/Button-Bkx66Co7.js";import U from"../../packem_shared/Textarea-Yfg3dLZi.js";const V=`<!-- @license lucide-static v0.577.0 - ISC -->
|
|
2
|
+
<svg
|
|
3
|
+
class="lucide lucide-message-square-plus"
|
|
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="M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z" />
|
|
15
|
+
<path d="M12 8v6" />
|
|
16
|
+
<path d="M9 11h6" />
|
|
17
|
+
</svg>
|
|
18
|
+
`;var G=Object.defineProperty,a=z((t,s)=>G(t,"name",{value:s,configurable:!0}),"o");const I={approve:"Approve",change:"Change",fix:"Fix",question:"Question"},M={approve:"bg-green-500/20 text-green-400 border-green-500/30",change:"bg-yellow-500/20 text-yellow-400 border-yellow-500/30",fix:"bg-destructive/20 text-destructive border-destructive/30",question:"bg-blue-500/20 text-blue-400 border-blue-500/30"},F={blocking:"Blocking",important:"Important",suggestion:"Suggestion"},$={blocking:"text-destructive",important:"text-warning-foreground",suggestion:"text-muted-foreground"},A={acknowledged:"Acknowledged",dismissed:"Dismissed",pending:"Pending",resolved:"Resolved"},Y=a(({active:t,counts:s,onFilter:i})=>e("div",{class:"flex gap-1.5",children:["all","pending","acknowledged","resolved","dismissed"].map(n=>r("button",{class:h("px-2.5 py-1 text-[0.65rem] font-medium border cursor-pointer transition-colors",t===n?"bg-primary/10 border-primary/30 text-primary":"bg-foreground/3 border-border text-muted-foreground hover:bg-foreground/6"),onClick:a(()=>i(n),"onClick"),type:"button",children:[n==="all"?"All":A[n]," (",s[n],")"]},n))}),"StatusFilters"),_=a(({annotation:t,isSelected:s,onClick:i,onDelete:n,onDismiss:d,onResolve:m})=>r("div",{class:h("p-3 border cursor-pointer transition-colors",s?"bg-foreground/6 border-primary/30":"border-border hover:bg-foreground/3"),onClick:i,children:[r("div",{class:"flex items-start gap-2 mb-1.5",children:[e("span",{class:h("text-[0.6rem] font-bold uppercase px-1.5 py-0.5 border shrink-0",M[t.intent]),children:I[t.intent]}),e("span",{class:h("text-[0.6rem] font-semibold uppercase tracking-wide shrink-0",$[t.severity]),children:F[t.severity]}),e("span",{class:"flex-1"}),t.resolvedBy&&r("span",{class:"text-[0.58rem] text-muted-foreground/60",children:["by ",t.resolvedBy]}),e("span",{class:"text-[0.58rem] text-muted-foreground/60",children:A[t.status]})]}),e("p",{class:"text-[0.7rem] text-foreground leading-relaxed mb-1.5 line-clamp-2",children:t.comment}),e("div",{class:"flex items-center gap-2 mb-1.5",children:r("code",{class:"text-[0.62rem] text-foreground/60 font-mono bg-foreground/5 px-1.5 py-0.5 truncate",children:[t.elementTag,t.elementPath?` · ${t.elementPath}`:""]})}),t.source&&e("div",{class:"mb-1.5",children:e("code",{class:"text-[0.6rem] text-primary/60 font-mono",children:t.source})}),e("div",{class:"text-[0.58rem] text-muted-foreground/50 truncate mb-2",children:t.url}),t.thread&&t.thread.length>0&&r("div",{class:"text-[0.6rem] text-muted-foreground/60 mb-2",children:[t.thread.length," message",t.thread.length===1?"":"s"," in thread"]}),t.status==="pending"&&r("div",{class:"flex items-center gap-1.5",onClick:a(u=>u.stopPropagation(),"onClick"),children:[e(g,{class:"h-auto py-0.5 px-2 text-[0.6rem]",onClick:m,size:"sm",variant:"outline",children:"Resolve"}),e(g,{class:"h-auto py-0.5 px-2 text-[0.6rem]",onClick:d,size:"sm",variant:"outline",children:"Dismiss"}),e("span",{class:"flex-1"}),e(g,{class:"h-auto py-0.5 px-2 text-[0.6rem] text-destructive hover:text-destructive",onClick:n,size:"sm",variant:"ghost",children:"Delete"})]})]}),"AnnotationCard"),J=a(({annotation:t,helpers:s,onBack:i,onRefresh:n})=>{const[d,m]=c(p(""),"message"),u=S(async()=>{const l=d.trim();l&&(await s.rpc.updateAnnotation?.(t.id,{threadMessage:{content:l,role:"human",timestamp:new Date().toISOString()}}),m(""),n())},[t.id,s,d,n]);return r("div",{class:"p-4 space-y-3",children:[e(g,{class:"h-auto py-0.5 px-2 text-[0.65rem]",onClick:i,size:"sm",variant:"ghost",children:"← Back"}),r("div",{class:"flex items-center gap-2 flex-wrap",children:[e("span",{class:h("text-[0.65rem] font-bold uppercase px-2 py-0.5 border",M[t.intent]),children:I[t.intent]}),e("span",{class:h("text-[0.65rem] font-semibold",$[t.severity]),children:F[t.severity]}),e("span",{class:"text-[0.6rem] text-muted-foreground ml-auto",children:A[t.status]})]}),e("div",{class:"text-[0.75rem] text-foreground leading-relaxed border border-border p-3",children:t.comment}),r("div",{class:"space-y-1 text-[0.65rem]",children:[r("div",{class:"flex gap-2",children:[e("span",{class:"text-muted-foreground w-16 shrink-0",children:"Element"}),r("code",{class:"text-foreground/70 font-mono",children:[t.elementTag,t.cssClasses?` .${t.cssClasses}`:""]})]}),t.source&&r("div",{class:"flex gap-2",children:[e("span",{class:"text-muted-foreground w-16 shrink-0",children:"Source"}),e("code",{class:"text-primary/70 font-mono",children:t.source})]}),r("div",{class:"flex gap-2",children:[e("span",{class:"text-muted-foreground w-16 shrink-0",children:"URL"}),e("span",{class:"text-foreground/60 truncate",children:t.url})]}),r("div",{class:"flex gap-2",children:[e("span",{class:"text-muted-foreground w-16 shrink-0",children:"Created"}),e("span",{class:"text-foreground/60",children:new Date(t.createdAt).toLocaleString()})]})]}),r("div",{children:[r("div",{class:"text-[0.65rem] font-bold uppercase tracking-[0.1em] text-muted-foreground mb-2",children:[e("span",{"aria-hidden":"true",class:"text-primary/50",children:"// "}),"Thread (",t.thread?.length??0,")"]}),t.thread&&t.thread.length>0&&e("div",{class:"space-y-2 mb-3",children:t.thread.map(l=>r("div",{class:"border border-border p-2",children:[r("div",{class:"flex items-center gap-2 mb-1",children:[e("span",{class:"text-[0.62rem] font-semibold text-primary/70",children:l.role}),e("span",{class:"text-[0.55rem] text-muted-foreground/50",children:new Date(l.timestamp).toLocaleString()})]}),e("p",{class:"text-[0.68rem] text-foreground/80 leading-relaxed whitespace-pre-wrap",children:l.content})]},`${l.role}-${l.timestamp}`))}),r("div",{class:"space-y-2",children:[e(U,{class:"text-[0.7rem] min-h-[60px]",onChange:a(l=>m(l.target.value),"onChange"),placeholder:"Add a message to the thread...",value:d}),e(g,{class:"text-[0.65rem]",disabled:!d.trim(),onClick:u,size:"sm",variant:"outline",children:"Send"})]})]})]})},"AnnotationDetail"),W=a(({onChange:t,settings:s})=>{const i=a(n=>{const d={...s,...n};Q(d),t(d)},"update");return r("div",{class:"space-y-3 p-4 border-t border-border",children:[r("div",{class:"text-[0.65rem] font-bold uppercase tracking-[0.1em] text-muted-foreground",children:[e("span",{"aria-hidden":"true",class:"text-primary/50",children:"// "}),"Settings"]}),r("label",{class:"flex items-center gap-2 text-[0.7rem] text-foreground",children:[e("span",{class:"text-muted-foreground w-24 shrink-0",children:"Output Detail"}),r("select",{class:"flex-1 bg-card border border-border text-foreground text-[0.65rem] px-1.5 py-1 cursor-pointer",onChange:a(n=>i({outputDetail:n.target.value}),"onChange"),style:"color-scheme: dark",value:s.outputDetail,children:[e("option",{value:"compact",children:"Compact"}),e("option",{value:"standard",children:"Standard"}),e("option",{value:"detailed",children:"Detailed"}),e("option",{value:"forensic",children:"Forensic"})]})]}),r("div",{class:"flex items-center gap-2 text-[0.7rem]",children:[e("span",{class:"text-muted-foreground w-24 shrink-0",children:"Marker Color"}),e("div",{class:"flex gap-1.5",children:H.map(n=>e("button",{class:h("w-5 h-5 rounded-full border-2 cursor-pointer p-0 transition-all",n.name===s.markerColorName?"border-foreground scale-110":"border-transparent hover:scale-110"),onClick:a(()=>i({markerColorName:n.name}),"onClick"),style:{background:n.bg},title:n.label,type:"button"},n.name))})]}),r("label",{class:"flex items-center gap-2 text-[0.7rem] text-foreground",children:[e("span",{class:"text-muted-foreground w-24 shrink-0",children:"Marker Click"}),r("select",{class:"flex-1 bg-card border border-border text-foreground text-[0.65rem] px-1.5 py-1 cursor-pointer",onChange:a(n=>i({markerClickBehavior:n.target.value}),"onChange"),style:"color-scheme: dark",value:s.markerClickBehavior,children:[e("option",{value:"detail",children:"Show Detail"}),e("option",{value:"edit",children:"Edit"}),e("option",{value:"delete",children:"Delete"})]})]}),r("label",{class:"flex items-center gap-2 text-[0.7rem] text-foreground cursor-pointer",children:[e("input",{checked:s.blockInteractions,class:"cursor-pointer",onChange:a(n=>i({blockInteractions:n.target.checked}),"onChange"),type:"checkbox"}),e("span",{children:"Block page interactions while inspecting"})]})]})},"AnnotationSettingsPanel"),X=a(({helpers:t})=>{const[s,i]=c(p([]),"annotations"),[n,d]=c(p(!1),"loading"),[m,u]=c(p(),"error"),[l,E]=c(p("pending"),"filterStatus"),[b,P]=c(p("all"),"filterIntent"),[k,D]=c(p(),"selectedId"),[y,L]=c(p(!1),"showSettings"),[N,O]=c(p(()=>K()),"settings"),x=S(async()=>{d(!0),u(void 0);try{const o=await t.rpc.getAnnotations?.();i(o??[])}catch(o){u(o instanceof Error?o.message:String(o))}finally{d(!1)}},[t]);q(()=>{x().catch(()=>{})},[x]);const R=s.filter(o=>!(l!=="all"&&o.status!==l||b!=="all"&&o.intent!==b)),f=a(o=>s.filter(v=>v.status===o).length,"countByStatus"),T={acknowledged:f("acknowledged"),all:s.length,dismissed:f("dismissed"),pending:f("pending"),resolved:f("resolved")},B=k?s.find(o=>o.id===k):void 0,C=S(async(o,v)=>{try{await(v==="delete"?t.rpc.deleteAnnotation?.(o):t.rpc.updateAnnotation?.(o,{status:v==="resolve"?"resolved":"dismissed"})),await x()}catch(w){console.error(`[annotations] ${v} failed for ${o}:`,w),u(w instanceof Error?w.message:`Failed to ${v} annotation`)}},[t,x]);return B?e(J,{annotation:B,helpers:t,onBack:a(()=>D(void 0),"onBack"),onRefresh:a(()=>x().catch(()=>{}),"onRefresh")}):r("div",{class:"flex flex-col h-full",children:[r("div",{class:"shrink-0 flex items-center gap-2 px-4 py-2.5 border-b border-border bg-foreground/2 flex-wrap",children:[e(g,{disabled:n,onClick:a(()=>x().catch(()=>{}),"onClick"),size:"sm",variant:"outline",children:n?"Loading…":"Refresh"}),e(g,{class:h("text-[0.65rem]",y&&"bg-primary/10 text-primary"),onClick:a(()=>L(!y),"onClick"),size:"sm",variant:"ghost",children:"Settings"}),e("span",{class:"flex-1"}),r("select",{class:"bg-card border border-border text-foreground text-[0.65rem] px-1.5 py-1 cursor-pointer",onChange:a(o=>P(o.target.value),"onChange"),style:"color-scheme: dark",value:b,children:[e("option",{value:"all",children:"All intents"}),e("option",{value:"fix",children:"Fix"}),e("option",{value:"change",children:"Change"}),e("option",{value:"question",children:"Question"}),e("option",{value:"approve",children:"Approve"})]})]}),r("div",{class:"flex-1 overflow-y-auto devtools-content-scroll",children:[m&&e("div",{class:"p-3 text-[0.7rem] text-destructive bg-destructive/10 border-b border-destructive/20",children:m}),r("div",{class:"p-4 space-y-3",children:[e(Y,{active:l,counts:T,onFilter:E}),R.length===0?r("div",{class:"p-6 text-center border border-border",children:[e("p",{class:"text-[0.8125rem] font-medium text-foreground/70",children:s.length===0?"No annotations yet":"No annotations match filters"}),e("p",{class:"mt-1 text-[0.7rem] text-muted-foreground",children:s.length===0?'Use the Inspector to click an element and select "Annotate".':"Try changing the status or intent filter."})]}):e("div",{class:"space-y-2",children:R.map(o=>e(_,{annotation:o,isSelected:k===o.id,onClick:a(()=>D(o.id),"onClick"),onDelete:a(()=>C(o.id,"delete").catch(()=>{}),"onDelete"),onDismiss:a(()=>C(o.id,"dismiss").catch(()=>{}),"onDismiss"),onResolve:a(()=>C(o.id,"resolve").catch(()=>{}),"onResolve")},o.id))})]})]}),y&&e(W,{onChange:O,settings:N})]})},"AnnotationsApp"),le={component:X,icon:V,id:"dev-toolbar:annotations",name:"Annotations"};export{le as default};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface A11yInfo {
|
|
2
|
+
ariaAttributes: Record<string, string>;
|
|
3
|
+
focusable: boolean;
|
|
4
|
+
role: string | null;
|
|
5
|
+
tabindex: number | null;
|
|
6
|
+
}
|
|
7
|
+
/** Collect accessibility-relevant attributes from an element. */
|
|
8
|
+
declare const captureA11yInfo: (element: Element) => A11yInfo;
|
|
9
|
+
/** Format A11yInfo as a plain-text summary for clipboard. */
|
|
10
|
+
declare const formatA11yText: (info: A11yInfo) => string;
|
|
11
|
+
export { captureA11yInfo, formatA11yText };
|
|
12
|
+
export type { A11yInfo };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Annotation overlay — renders annotation markers on the page canvas,
|
|
3
|
+
* provides inline annotation form, detail popup, edit mode, screenshot capture,
|
|
4
|
+
* freeze mode, markdown export, and SPA navigation persistence.
|
|
5
|
+
*
|
|
6
|
+
* All DOM elements are injected into document.body (outside Shadow DOM)
|
|
7
|
+
* to match the inspector's rendering approach.
|
|
8
|
+
*/
|
|
9
|
+
import type { Annotation } from "../../types/annotations.d.ts";
|
|
10
|
+
/**
|
|
11
|
+
* Returns true when the Annotations panel app is registered in the toolbar.
|
|
12
|
+
*/
|
|
13
|
+
export declare const isAnnotationsAppEnabled: () => boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Convert viewport click coords to page-absolute coords for storage.
|
|
16
|
+
* x = percentage of viewport width, y = absolute page Y (scrollY + clientY).
|
|
17
|
+
* For fixed elements, y stays as viewport-relative (no scrollY offset).
|
|
18
|
+
*/
|
|
19
|
+
export declare const toPageCoords: (clientX: number, clientY: number, fixed?: boolean) => {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
};
|
|
23
|
+
/** Load annotations from server and render markers. */
|
|
24
|
+
export declare const loadAndShowMarkers: () => Promise<void>;
|
|
25
|
+
/** Remove all annotation markers and detach listeners. */
|
|
26
|
+
export declare const removeAllMarkers: () => void;
|
|
27
|
+
/** Close all annotation popups (form, detail) and area outline, but keep markers. */
|
|
28
|
+
export declare const closeAnnotationPopups: () => void;
|
|
29
|
+
/** Whether the annotation form popup is currently open. */
|
|
30
|
+
export declare const isAnnotationFormOpen: () => boolean;
|
|
31
|
+
/** Shake the annotation form to draw attention. */
|
|
32
|
+
export declare const shakeAnnotationForm: () => void;
|
|
33
|
+
/**
|
|
34
|
+
* Show annotation form popup. Captures selectedText, nearbyText, framework context,
|
|
35
|
+
* and generates a smart CSS selector.
|
|
36
|
+
*/
|
|
37
|
+
export declare const showAnnotationForm: (element: Element, rect: DOMRect, source: string | undefined, editAnnotation?: Annotation, clickPoint?: {
|
|
38
|
+
x: number;
|
|
39
|
+
y: number;
|
|
40
|
+
}) => void;
|
|
41
|
+
/**
|
|
42
|
+
* Show annotation form for a multi-select (drag) region.
|
|
43
|
+
* Creates a single annotation covering multiple elements.
|
|
44
|
+
*/
|
|
45
|
+
export declare const showMultiSelectForm: (elements: Element[], selectionRect: DOMRect, boundingBoxes: import("../../types/annotations").BoundingBox[]) => void;
|
|
46
|
+
/**
|
|
47
|
+
* Show annotation form for an empty area selection (no elements found in drag region).
|
|
48
|
+
* Like agentation: creates an "Area selection" annotation with the region as bounding box.
|
|
49
|
+
* Shows a green dashed outline around the selected region.
|
|
50
|
+
*/
|
|
51
|
+
export declare const showAreaSelectionForm: (selectionRect: DOMRect) => void;
|
|
52
|
+
export declare const attachMarkdownShortcut: () => void;
|
|
53
|
+
export declare const detachMarkdownShortcut: () => void;
|
|
54
|
+
/** Check if a target is over an annotation overlay element. */
|
|
55
|
+
export declare const isOverAnnotationOverlay: (target: Element | undefined) => boolean;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Annotation-specific settings — output detail level, marker appearance,
|
|
3
|
+
* interaction behavior. Persisted in localStorage.
|
|
4
|
+
*/
|
|
5
|
+
export type OutputDetailLevel = "compact" | "detailed" | "forensic" | "standard";
|
|
6
|
+
export type MarkerClickBehavior = "delete" | "detail" | "edit";
|
|
7
|
+
export interface MarkerColor {
|
|
8
|
+
/** Solid background for the marker */
|
|
9
|
+
bg: string;
|
|
10
|
+
/** Slightly darker ring / shadow tint */
|
|
11
|
+
border: string;
|
|
12
|
+
/** Text color inside the marker (white or dark for contrast) */
|
|
13
|
+
fg: string;
|
|
14
|
+
/** Translucent version for hover highlight overlay on elements */
|
|
15
|
+
highlightBg: string;
|
|
16
|
+
label: string;
|
|
17
|
+
name: string;
|
|
18
|
+
}
|
|
19
|
+
export declare const MARKER_COLORS: MarkerColor[];
|
|
20
|
+
export interface AnnotationSettings {
|
|
21
|
+
/** Block clicks on interactive elements (buttons, links, inputs) while active */
|
|
22
|
+
blockInteractions: boolean;
|
|
23
|
+
/** What happens when you click a marker */
|
|
24
|
+
markerClickBehavior: MarkerClickBehavior;
|
|
25
|
+
/** Marker color name (from MARKER_COLORS) */
|
|
26
|
+
markerColorName: string;
|
|
27
|
+
/** Output detail level for markdown export */
|
|
28
|
+
outputDetail: OutputDetailLevel;
|
|
29
|
+
}
|
|
30
|
+
export declare const DEFAULT_SETTINGS: AnnotationSettings;
|
|
31
|
+
export declare const loadSettings: () => AnnotationSettings;
|
|
32
|
+
export declare const saveSettings: (settings: AnnotationSettings) => void;
|
|
33
|
+
export declare const getMarkerColor: (settings?: AnnotationSettings) => MarkerColor;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Element utility functions for annotation — shadow DOM piercing, CSS selector
|
|
3
|
+
* generation, smart naming, text extraction, a11y capture, computed styles,
|
|
4
|
+
* framework detection, screenshot, freeze, markdown export.
|
|
5
|
+
*/
|
|
6
|
+
import type { AccessibilityInfo, BoundingBox, FrameworkContext } from "../../types/annotations.d.ts";
|
|
7
|
+
export declare const deepElementFromPoint: (x: number, y: number) => Element | null;
|
|
8
|
+
/**
|
|
9
|
+
* Get the viewport-relative bounding rect for an element, accounting for
|
|
10
|
+
* it potentially being inside nested iframes.
|
|
11
|
+
*/
|
|
12
|
+
export declare const getViewportRect: (element: Element) => DOMRect;
|
|
13
|
+
/**
|
|
14
|
+
* Pierce mode: Cmd+hover to find the actual element underneath invisible
|
|
15
|
+
* overlays, animation wrappers, and empty container divs.
|
|
16
|
+
*
|
|
17
|
+
* Two-pass approach:
|
|
18
|
+
* 1. Find elements with direct text content (skips empty wrappers)
|
|
19
|
+
* 2. If no text found, return the smallest visible element (catches
|
|
20
|
+
* visual-only elements like timeline bars, chart segments, swatches)
|
|
21
|
+
*/
|
|
22
|
+
export declare const pierceElementFromPoint: (x: number, y: number) => Element | null;
|
|
23
|
+
export declare const getParentElement: (element: Element) => Element | null;
|
|
24
|
+
/**
|
|
25
|
+
* Check if element or any ancestor has fixed or sticky positioning.
|
|
26
|
+
*/
|
|
27
|
+
export declare const isElementFixed: (element: Element) => boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Generate a human-readable element label like agentation:
|
|
30
|
+
* button "Submit", link to /page, image "alt text", input[type=email]
|
|
31
|
+
*/
|
|
32
|
+
export declare const getElementLabel: (element: Element) => string;
|
|
33
|
+
/**
|
|
34
|
+
* Generate a unique CSS selector for an element.
|
|
35
|
+
* Strategy: ID → unique class combo → nth-of-type fallback.
|
|
36
|
+
*/
|
|
37
|
+
export declare const generateSelector: (element: Element) => string;
|
|
38
|
+
/**
|
|
39
|
+
* Clean CSS classes by stripping module hash suffixes.
|
|
40
|
+
*/
|
|
41
|
+
export declare const cleanCssClasses: (classes: DOMTokenList) => string;
|
|
42
|
+
/**
|
|
43
|
+
* Build full DOM ancestry path (body > main > article > section > p).
|
|
44
|
+
* Marks shadow DOM boundary crossings with ⟨shadow⟩.
|
|
45
|
+
*/
|
|
46
|
+
export declare const getFullDomPath: (element: Element) => string;
|
|
47
|
+
/**
|
|
48
|
+
* Get sibling elements as context (up to 5 siblings).
|
|
49
|
+
*/
|
|
50
|
+
export declare const getNearbyElements: (element: Element) => string;
|
|
51
|
+
/**
|
|
52
|
+
* Extract nearby text content from an element (up to maxLength chars).
|
|
53
|
+
*/
|
|
54
|
+
export declare const getNearbyText: (element: Element, maxLength?: number) => string;
|
|
55
|
+
/**
|
|
56
|
+
* Capture currently selected text (up to maxLength chars).
|
|
57
|
+
*/
|
|
58
|
+
export declare const getSelectedText: (maxLength?: number) => string;
|
|
59
|
+
/**
|
|
60
|
+
* Capture accessibility attributes from an element.
|
|
61
|
+
*/
|
|
62
|
+
export declare const captureAccessibility: (element: Element) => AccessibilityInfo;
|
|
63
|
+
/**
|
|
64
|
+
* Capture key computed styles for forensic context.
|
|
65
|
+
*/
|
|
66
|
+
export declare const captureComputedStyles: (element: Element) => string;
|
|
67
|
+
/**
|
|
68
|
+
* Detect framework component for an element.
|
|
69
|
+
*/
|
|
70
|
+
export declare const detectFrameworkComponent: (element: Element) => FrameworkContext | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* Capture a screenshot of an element's bounding area.
|
|
73
|
+
*
|
|
74
|
+
* Uses the Screen Capture API (getDisplayMedia) to capture a frame from the
|
|
75
|
+
* screen, then crops to the element's bounding rect. This is the most reliable
|
|
76
|
+
* approach — works with external CSS, images, shadow DOM, and canvas content.
|
|
77
|
+
*
|
|
78
|
+
* Falls back to null if the user denies permission or the API is unavailable.
|
|
79
|
+
*/
|
|
80
|
+
export declare const captureElementScreenshot: (element: Element) => Promise<string | null>;
|
|
81
|
+
/**
|
|
82
|
+
* Get all elements within a rectangular region.
|
|
83
|
+
* Searches across shadow DOM and same-origin iframes.
|
|
84
|
+
*/
|
|
85
|
+
export declare const getElementsInRect: (rect: DOMRect) => Element[];
|
|
86
|
+
/**
|
|
87
|
+
* Get bounding boxes from a list of elements (iframe-aware).
|
|
88
|
+
*/
|
|
89
|
+
export declare const getElementBoundingBoxes: (elements: Element[]) => BoundingBox[];
|
|
90
|
+
/**
|
|
91
|
+
* Output detail levels:
|
|
92
|
+
* - compact: "Element: comment (re: "selected text...")"
|
|
93
|
+
* - standard: Element + location + component + feedback
|
|
94
|
+
* - detailed: + classes, position, context text
|
|
95
|
+
* - forensic: + full DOM path, styles, accessibility, nearby elements
|
|
96
|
+
*/
|
|
97
|
+
export declare const annotationsToMarkdown: (annotations: {
|
|
98
|
+
accessibility?: AccessibilityInfo;
|
|
99
|
+
comment: string;
|
|
100
|
+
computedStyles?: string;
|
|
101
|
+
cssClasses?: string;
|
|
102
|
+
elementLabel?: string;
|
|
103
|
+
elementPath?: string;
|
|
104
|
+
elementTag: string;
|
|
105
|
+
frameworkContext?: FrameworkContext;
|
|
106
|
+
fullPath?: string;
|
|
107
|
+
intent: string;
|
|
108
|
+
nearbyElements?: string;
|
|
109
|
+
nearbyText?: string;
|
|
110
|
+
selectedText?: string;
|
|
111
|
+
severity: string;
|
|
112
|
+
source?: string;
|
|
113
|
+
status: string;
|
|
114
|
+
url: string;
|
|
115
|
+
}[], detail?: "compact" | "detailed" | "forensic" | "standard") => string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Freeze Animations — comprehensive animation/timer freeze system.
|
|
3
|
+
*
|
|
4
|
+
* Monkey-patches setTimeout, setInterval, and requestAnimationFrame so that
|
|
5
|
+
* callbacks are silently queued while frozen. Also injects CSS to pause
|
|
6
|
+
* CSS animations/transitions, pauses WAAPI animations, and pauses videos.
|
|
7
|
+
*
|
|
8
|
+
* Patches are installed as a side effect of importing this module.
|
|
9
|
+
* Toolbar/popup code must import `originalSetTimeout` to bypass the patch.
|
|
10
|
+
*
|
|
11
|
+
* Based on agentation's freeze-animations.ts pattern.
|
|
12
|
+
*/
|
|
13
|
+
/** Original (unpatched) setTimeout — use for toolbar/popup animations */
|
|
14
|
+
export declare const originalSetTimeout: typeof setTimeout;
|
|
15
|
+
/** Whether animations are currently frozen */
|
|
16
|
+
export declare const isFrozen: () => boolean;
|
|
17
|
+
/** Freeze all animations, timers, and videos */
|
|
18
|
+
export declare const freezeAll: () => void;
|
|
19
|
+
/** Unfreeze — resume everything and replay queued callbacks */
|
|
20
|
+
export declare const unfreezeAll: () => void;
|
|
21
|
+
/** Toggle freeze state */
|
|
22
|
+
export declare const toggleFreeze: () => boolean;
|