@eyeglass/inspector 0.1.3 → 0.1.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.
- package/dist/index.js +47 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var R=new Set([0,1,11,14,15]);function F(s){let t=Object.keys(s).find(e=>e.startsWith("__reactFiber$")||e.startsWith("__reactInternalInstance$"));return t?s[t]:null}function H(s){if(!R.has(s.tag)||typeof s.type!="function")return!1;let r=s.type.displayName||s.type.name||"";return!(!r||r.startsWith("Context")||r.endsWith("Provider")||r==="StrictMode")}function C(s){return s.type.displayName||s.type.name||void 0}function B(s){let r=s;for(;r;){if(H(r))return r;r=r.return}return null}function M(s){let r=[],t=s;for(;t;){if(H(t)){let e=C(t);e&&r.push(e)}t=t.return}return r}function T(s){if(!s)return;let r={};for(let[t,e]of Object.entries(s)){if(t==="children")continue;let i=typeof e;(i==="string"||i==="number"||i==="boolean"||e===null)&&(r[t]=e)}return Object.keys(r).length>0?r:void 0}function _(s){let r=s.__vue__;if(r)return{name:"vue",componentName:r.$options?.name||r.$options?._componentTag};let e=Object.keys(s).find(i=>i.startsWith("__vue"));if(e){let i=s[e];if(i){let n=i,a
|
|
1
|
+
var R=new Set([0,1,11,14,15]);function F(s){let t=Object.keys(s).find(e=>e.startsWith("__reactFiber$")||e.startsWith("__reactInternalInstance$"));return t?s[t]:null}function H(s){if(!R.has(s.tag)||typeof s.type!="function")return!1;let r=s.type.displayName||s.type.name||"";return!(!r||r.startsWith("Context")||r.endsWith("Provider")||r==="StrictMode")}function C(s){return s.type.displayName||s.type.name||void 0}function B(s){let r=s;for(;r;){if(H(r))return r;r=r.return}return null}function M(s){let r=[],t=s;for(;t;){if(H(t)){let e=C(t);e&&r.push(e)}t=t.return}return r}function T(s){if(!s)return;let r={};for(let[t,e]of Object.entries(s)){if(t==="children")continue;let i=typeof e;(i==="string"||i==="number"||i==="boolean"||e===null)&&(r[t]=e)}return Object.keys(r).length>0?r:void 0}function _(s){let r=s.__vue__;if(r)return{name:"vue",componentName:r.$options?.name||r.$options?._componentTag};let e=Object.keys(s).find(i=>i.startsWith("__vue"));if(e){let i=s[e];if(i){let n=i,o,a;n?.type?.name?o=n.type.name:n?.type?.__name?o=n.type.__name:n?.component?.type?.name?o=n.component.type.name:n?.component?.type?.__name&&(o=n.component.type.__name);let l=n?.props||n?.component?.props;l&&(a=T(l));let d;return n?.type?.__file?d=n.type.__file:n?.component?.type?.__file&&(d=n.component.type.__file),{name:"vue",componentName:o,filePath:d,props:a}}return{name:"vue"}}return null}function j(s){let t=Object.keys(s).find(e=>e.startsWith("__svelte"));if(t){let e=s[t],i;if(e?.constructor?.name&&e.constructor.name!=="Object"&&(i=e.constructor.name),!i&&e?.$$?.ctx){let n=e.$$.ctx;n?.constructor?.name&&n.constructor.name!=="Object"&&(i=n.constructor.name)}return{name:"svelte",componentName:i}}return null}function I(s){let r=F(s);if(r){let i=B(r);if(i){let o=C(i),a=i._debugSource,l=M(i);return{name:"react",componentName:o,filePath:a?.fileName,lineNumber:a?.lineNumber,props:T(i.memoizedProps),ancestry:l.length>0?l:void 0}}let n=M(r);return{name:"react",ancestry:n.length>0?n:void 0}}let t=_(s);if(t)return t;let e=j(s);return e||{name:"vanilla"}}function O(s){let r=s.getAttribute("aria-label"),t=s.getAttribute("aria-describedby"),e=s.getAttribute("aria-disabled"),i=s.getAttribute("aria-expanded"),n=s.getAttribute("aria-checked"),o=s.getAttribute("aria-hidden"),a=null;t&&(a=document.getElementById(t)?.textContent?.trim()||null);let l=e==="true"||s.disabled||s.hasAttribute("disabled");return{label:r||s.getAttribute("title")||null,description:a,disabled:l,expanded:i?i==="true":void 0,checked:n==="true"?!0:n==="false"?!1:n==="mixed"?"mixed":void 0,hidden:o==="true"||s.hidden||!1}}function G(s){let r=s.getBoundingClientRect();return{x:Math.round(r.x),y:Math.round(r.y),width:Math.round(r.width),height:Math.round(r.height),visible:r.width>0&&r.height>0}}function U(s){let r=getComputedStyle(s);return{display:r.display,position:r.position,flexDirection:r.flexDirection!=="row"?r.flexDirection:void 0,gridTemplate:r.display==="grid"?`${r.gridTemplateColumns} / ${r.gridTemplateRows}`:void 0,padding:r.padding,margin:r.margin,color:r.color,backgroundColor:r.backgroundColor,fontFamily:r.fontFamily,zIndex:r.zIndex}}function Y(s){let r=s.getAttribute("role");if(r)return r;let t=s.tagName.toLowerCase();return{a:"link",button:"button",input:s.type||"textbox",select:"combobox",textarea:"textbox",img:"img",nav:"navigation",main:"main",header:"banner",footer:"contentinfo",aside:"complementary",article:"article",section:"region",form:"form",ul:"list",ol:"list",li:"listitem",table:"table",tr:"row",td:"cell",th:"columnheader",dialog:"dialog",h1:"heading",h2:"heading",h3:"heading",h4:"heading",h5:"heading",h6:"heading"}[t]||"generic"}function W(s){let r=s.getAttribute("aria-label");if(r)return r;let t=s.getAttribute("aria-labelledby");if(t){let i=document.getElementById(t);if(i)return i.textContent?.trim()||""}if(s.tagName==="INPUT"||s.tagName==="SELECT"||s.tagName==="TEXTAREA"){let i=s.getAttribute("id");if(i){let n=document.querySelector(`label[for="${i}"]`);if(n)return n.textContent?.trim()||""}}if(s.tagName==="IMG")return s.alt||"";let e=s.textContent?.trim()||"";return e.length>50?e.slice(0,50)+"...":e}function J(s){let r={},t=s.getAttribute("id");t&&(r.id=t);let e=s.getAttribute("class");e?.trim()&&(r.className=e.trim());let i={};for(let n=0;n<s.attributes.length;n++){let o=s.attributes[n];o.name.startsWith("data-")&&(i[o.name]=o.value)}return Object.keys(i).length>0&&(r.dataAttributes=i),r}function x(s){let r=J(s);return{role:Y(s),name:W(s),tagName:s.tagName.toLowerCase(),...r,framework:I(s),a11y:O(s),geometry:G(s),styles:U(s),timestamp:Date.now(),url:window.location.href}}var b="http://localhost:3300",v="eyeglass_session",P="eyeglass_history",L="eyeglass_enabled",$="eyeglass_autocommit",K=1e4,y=["Ruminating...","Percolating...","Divining...","Grokking...","Communing...","Concocting...","Synthesizing...","Distilling...","Incubating...","Forging...","Scrutinizing...","Triangulating...","Unraveling...","Traversing...","Sifting...","Marshaling...","Hydrating...","Harmonizing...","Indexing...","Entangling..."],Z='url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiM2MzY2ZjEiIHN0cm9rZS13aWR0aD0iMi41IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjxwYXRoIGQ9Ik0xIDEyczQtOCAxMS04IDExIDggMTEgOC00IDgtMTEgOC0xMS04LTExLTh6Ii8+PGNpcmNsZSBjeD0iMTIiIGN5PSIxMiIgcj0iMyIgZmlsbD0iIzYzNjZmMSIvPjwvc3ZnPg==") 8 8, crosshair',X=`
|
|
2
2
|
:host {
|
|
3
3
|
all: initial;
|
|
4
4
|
position: fixed;
|
|
@@ -597,7 +597,6 @@ var R=new Set([0,1,11,14,15]);function F(s){let t=Object.keys(s).find(e=>e.start
|
|
|
597
597
|
.hub-logo {
|
|
598
598
|
width: 20px;
|
|
599
599
|
height: 20px;
|
|
600
|
-
background: var(--accent);
|
|
601
600
|
border-radius: 5px;
|
|
602
601
|
display: flex;
|
|
603
602
|
align-items: center;
|
|
@@ -1173,17 +1172,32 @@ var R=new Set([0,1,11,14,15]);function F(s){let t=Object.keys(s).find(e=>e.start
|
|
|
1173
1172
|
color: var(--accent);
|
|
1174
1173
|
text-align: center;
|
|
1175
1174
|
}
|
|
1176
|
-
`,w=class s extends HTMLElement{constructor(){super();this.highlight=null;this.panel=null;this.toast=null;this.hub=null;this.currentElement=null;this.currentSnapshot=null;this.interactionId=null;this.frozen=!1;this.eventSource=null;this.throttleTimeout=null;this.mode="input";this.activityEvents=[];this.currentStatus="idle";this.hubExpanded=!1;this.hubPage="main";this.inspectorEnabled=!0;this.autoCommitEnabled=!0;this.history=[];this.isDragging=!1;this.dragOffset={x:0,y:0};this.customPanelPosition=null;this.multiSelectMode=!1;this.selectedElements=[];this.selectedSnapshots=[];this.multiSelectHighlights=[];this.submittedSnapshots=[];this.cursorStyleElement=null;this.scrollTimeout=null;this.phraseIndex=0;this.phraseInterval=null;this.handlePanelDrag=t=>{if(!this.isDragging||!this.panel)return;let e=Math.max(0,Math.min(t.clientX-this.dragOffset.x,window.innerWidth-340)),i=Math.max(0,Math.min(t.clientY-this.dragOffset.y,window.innerHeight-100));this.customPanelPosition={x:e,y:i},this.panel.style.left=`${e}px`,this.panel.style.top=`${i}px`};this.handlePanelDragEnd=()=>{this.isDragging=!1,document.removeEventListener("mousemove",this.handlePanelDrag),document.removeEventListener("mouseup",this.handlePanelDragEnd)};this.shadow=this.attachShadow({mode:"closed"})}static{this.MAX_SELECTION=5}connectedCallback(){let t=document.createElement("style");t.textContent=
|
|
1175
|
+
`,w=class s extends HTMLElement{constructor(){super();this.highlight=null;this.panel=null;this.toast=null;this.hub=null;this.currentElement=null;this.currentSnapshot=null;this.interactionId=null;this.frozen=!1;this.eventSource=null;this.throttleTimeout=null;this.mode="input";this.activityEvents=[];this.currentStatus="idle";this.hubExpanded=!1;this.hubPage="main";this.inspectorEnabled=!0;this.autoCommitEnabled=!0;this.history=[];this.isDragging=!1;this.dragOffset={x:0,y:0};this.customPanelPosition=null;this.multiSelectMode=!1;this.selectedElements=[];this.selectedSnapshots=[];this.multiSelectHighlights=[];this.submittedSnapshots=[];this.cursorStyleElement=null;this.scrollTimeout=null;this.phraseIndex=0;this.phraseInterval=null;this.handlePanelDrag=t=>{if(!this.isDragging||!this.panel)return;let e=Math.max(0,Math.min(t.clientX-this.dragOffset.x,window.innerWidth-340)),i=Math.max(0,Math.min(t.clientY-this.dragOffset.y,window.innerHeight-100));this.customPanelPosition={x:e,y:i},this.panel.style.left=`${e}px`,this.panel.style.top=`${i}px`};this.handlePanelDragEnd=()=>{this.isDragging=!1,document.removeEventListener("mousemove",this.handlePanelDrag),document.removeEventListener("mouseup",this.handlePanelDragEnd)};this.shadow=this.attachShadow({mode:"closed"})}static{this.MAX_SELECTION=5}connectedCallback(){let t=document.createElement("style");t.textContent=X,this.shadow.appendChild(t),this.highlight=document.createElement("div"),this.highlight.className="highlight",this.highlight.style.display="none",this.shadow.appendChild(this.highlight),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleClick=this.handleClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handlePanelDragStart=this.handlePanelDragStart.bind(this),this.handleScroll=this.handleScroll.bind(this),document.addEventListener("mousemove",this.handleMouseMove,!0),document.addEventListener("click",this.handleClick,!0),document.addEventListener("keydown",this.handleKeyDown,!0),window.addEventListener("scroll",this.handleScroll,!0),this.loadEnabledState(),this.loadAutoCommitState(),this.loadHistory(),this.renderHub(),this.connectSSE(),this.restoreSession(),this.updateCursor()}saveSession(t){if(!this.interactionId)return;let e={interactionId:this.interactionId,userNote:this._userNote||"",componentName:this.currentSnapshot?.framework.componentName||this.currentSnapshot?.tagName||"element",status:this.currentStatus,message:t,timestamp:Date.now()};try{sessionStorage.setItem(v,JSON.stringify(e))}catch{}}restoreSession(){try{let t=sessionStorage.getItem(v);if(!t)return;let e=JSON.parse(t);if(Date.now()-e.timestamp>K){sessionStorage.removeItem(v);return}(e.status==="success"||e.status==="failed")&&(this.showResultToast(e),sessionStorage.removeItem(v))}catch{}}showResultToast(t){this.toast=document.createElement("div"),this.toast.className="result-toast";let e=t.status==="success",i=e?"\u2713":"\u2715",n=e?"Done!":"Failed";this.toast.innerHTML=`
|
|
1177
1176
|
<div class="toast-icon ${t.status}">${i}</div>
|
|
1178
1177
|
<div class="toast-content">
|
|
1179
1178
|
<div class="toast-title">${n}</div>
|
|
1180
1179
|
<div class="toast-message">${this.escapeHtml(t.message||t.userNote)}</div>
|
|
1181
1180
|
</div>
|
|
1182
1181
|
<button class="toast-close">×</button>
|
|
1183
|
-
`,this.toast.querySelector(".toast-close").addEventListener("click",()=>this.hideToast()),this.shadow.appendChild(this.toast),setTimeout(()=>this.hideToast(),4e3)}hideToast(){this.toast&&(this.toast.remove(),this.toast=null)}loadEnabledState(){try{let t=localStorage.getItem(
|
|
1182
|
+
`,this.toast.querySelector(".toast-close").addEventListener("click",()=>this.hideToast()),this.shadow.appendChild(this.toast),setTimeout(()=>this.hideToast(),4e3)}hideToast(){this.toast&&(this.toast.remove(),this.toast=null)}loadEnabledState(){try{let t=localStorage.getItem(L);t!==null&&(this.inspectorEnabled=t==="true")}catch{}}saveEnabledState(){try{localStorage.setItem(L,String(this.inspectorEnabled))}catch{}}loadAutoCommitState(){try{let t=localStorage.getItem($);t!==null&&(this.autoCommitEnabled=t==="true")}catch{}}saveAutoCommitState(){try{localStorage.setItem($,String(this.autoCommitEnabled))}catch{}}loadHistory(){try{let t=sessionStorage.getItem(P);t&&(this.history=JSON.parse(t))}catch{this.history=[]}}saveHistory(){try{sessionStorage.setItem(P,JSON.stringify(this.history))}catch{}}addToHistory(t){let e=this.history.findIndex(i=>i.interactionId===t.interactionId);e>=0?this.history[e]=t:(this.history.unshift(t),this.history.length>20&&(this.history=this.history.slice(0,20))),this.saveHistory(),this.renderHub()}updateHistoryStatus(t,e){let i=this.history.find(n=>n.interactionId===t);i&&(i.status=e,this.saveHistory(),this.renderHub())}renderHub(){this.hub||(this.hub=document.createElement("div"),this.hub.className="hub",this.shadow.appendChild(this.hub)),this.hubPage==="settings"?this.renderHubSettingsPage():this.renderHubMainPage()}renderHubMainPage(){if(!this.hub)return;let t=this.hubExpanded?"":"collapsed",e=this.inspectorEnabled?"":"disabled",i=this.hubExpanded?"expanded":"",n=this.history.filter(c=>c.status==="pending"||c.status==="fixing").length;this.hub.className=`hub ${t} ${e}`.trim();let o='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/></svg>',a='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"/><line x1="1" y1="1" x2="23" y2="23"/></svg>',l='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>',d=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
|
|
1183
|
+
<defs>
|
|
1184
|
+
<linearGradient id="lensGrad" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
1185
|
+
<stop offset="0%" style="stop-color:#60a5fa;stop-opacity:0.3"/>
|
|
1186
|
+
<stop offset="100%" style="stop-color:#3b82f6;stop-opacity:0.1"/>
|
|
1187
|
+
</linearGradient>
|
|
1188
|
+
</defs>
|
|
1189
|
+
<circle cx="30" cy="50" r="20" fill="url(#lensGrad)" stroke="#3b82f6" stroke-width="3"/>
|
|
1190
|
+
<circle cx="70" cy="50" r="20" fill="url(#lensGrad)" stroke="#3b82f6" stroke-width="3"/>
|
|
1191
|
+
<path d="M 50 50 Q 50 42 50 50" stroke="#3b82f6" stroke-width="3" fill="none"/>
|
|
1192
|
+
<line x1="50" y1="47" x2="50" y2="53" stroke="#3b82f6" stroke-width="3" stroke-linecap="round"/>
|
|
1193
|
+
<line x1="10" y1="50" x2="10" y2="50" stroke="#3b82f6" stroke-width="3"/>
|
|
1194
|
+
<path d="M 10 50 L 5 45" stroke="#3b82f6" stroke-width="3" stroke-linecap="round"/>
|
|
1195
|
+
<path d="M 90 50 L 95 45" stroke="#3b82f6" stroke-width="3" stroke-linecap="round"/>
|
|
1196
|
+
<path d="M 65 45 L 65 60 L 69 56 L 74 63 L 76 61 L 71 54 L 76 54 Z" fill="#3b82f6"/>
|
|
1197
|
+
</svg>`;this.hub.innerHTML=`
|
|
1184
1198
|
<div class="hub-header">
|
|
1185
1199
|
<div class="hub-header-left">
|
|
1186
|
-
<div class="hub-logo"
|
|
1200
|
+
<div class="hub-logo">${d}</div>
|
|
1187
1201
|
<span class="hub-title">Eyeglass</span>
|
|
1188
1202
|
${n>0?`<span class="hub-badge">${n}</span>`:""}
|
|
1189
1203
|
<button class="hub-toggle ${i}" title="Toggle history">\u25BC</button>
|
|
@@ -1191,7 +1205,7 @@ var R=new Set([0,1,11,14,15]);function F(s){let t=Object.keys(s).find(e=>e.start
|
|
|
1191
1205
|
<div class="hub-button-group">
|
|
1192
1206
|
<button class="hub-settings-btn" title="Settings">${l}</button>
|
|
1193
1207
|
<button class="hub-disable ${this.inspectorEnabled?"active":""}" title="${this.inspectorEnabled?"Disable":"Enable"} inspector">
|
|
1194
|
-
${this.inspectorEnabled?a
|
|
1208
|
+
${this.inspectorEnabled?o:a}
|
|
1195
1209
|
</button>
|
|
1196
1210
|
</div>
|
|
1197
1211
|
</div>
|
|
@@ -1215,10 +1229,25 @@ var R=new Set([0,1,11,14,15]);function F(s){let t=Object.keys(s).find(e=>e.start
|
|
|
1215
1229
|
<div class="hub-empty">No requests yet</div>
|
|
1216
1230
|
`}
|
|
1217
1231
|
</div>
|
|
1218
|
-
`;let
|
|
1232
|
+
`;let u=this.hub.querySelector(".hub-header"),f=this.hub.querySelector(".hub-disable"),g=this.hub.querySelector(".hub-settings-btn");u.addEventListener("click",c=>{c.target===f||c.target===g||c.target.closest(".hub-settings-btn")||(this.hubExpanded=!this.hubExpanded,this.renderHub())}),g.addEventListener("click",c=>{c.stopPropagation(),this.hubPage="settings",this.hubExpanded=!0,this.renderHub()}),f.addEventListener("click",c=>{c.stopPropagation(),this.inspectorEnabled=!this.inspectorEnabled,this.saveEnabledState(),this.inspectorEnabled||this.unfreeze(),this.updateCursor(),this.renderHub()}),this.hub.querySelectorAll(".hub-item-undo").forEach(c=>{c.addEventListener("click",h=>{h.stopPropagation();let p=h.currentTarget.dataset.id;this.requestUndo(p)})})}renderHubSettingsPage(){if(!this.hub)return;let t=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
|
|
1233
|
+
<defs>
|
|
1234
|
+
<linearGradient id="lensGrad" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
1235
|
+
<stop offset="0%" style="stop-color:#60a5fa;stop-opacity:0.3"/>
|
|
1236
|
+
<stop offset="100%" style="stop-color:#3b82f6;stop-opacity:0.1"/>
|
|
1237
|
+
</linearGradient>
|
|
1238
|
+
</defs>
|
|
1239
|
+
<circle cx="30" cy="50" r="20" fill="url(#lensGrad)" stroke="#3b82f6" stroke-width="3"/>
|
|
1240
|
+
<circle cx="70" cy="50" r="20" fill="url(#lensGrad)" stroke="#3b82f6" stroke-width="3"/>
|
|
1241
|
+
<path d="M 50 50 Q 50 42 50 50" stroke="#3b82f6" stroke-width="3" fill="none"/>
|
|
1242
|
+
<line x1="50" y1="47" x2="50" y2="53" stroke="#3b82f6" stroke-width="3" stroke-linecap="round"/>
|
|
1243
|
+
<line x1="10" y1="50" x2="10" y2="50" stroke="#3b82f6" stroke-width="3"/>
|
|
1244
|
+
<path d="M 10 50 L 5 45" stroke="#3b82f6" stroke-width="3" stroke-linecap="round"/>
|
|
1245
|
+
<path d="M 90 50 L 95 45" stroke="#3b82f6" stroke-width="3" stroke-linecap="round"/>
|
|
1246
|
+
<path d="M 65 45 L 65 60 L 69 56 L 74 63 L 76 61 L 71 54 L 76 54 Z" fill="#3b82f6"/>
|
|
1247
|
+
</svg>`;this.hub.className="hub",this.hub.innerHTML=`
|
|
1219
1248
|
<div class="hub-header">
|
|
1220
1249
|
<div class="hub-header-left">
|
|
1221
|
-
<div class="hub-logo"
|
|
1250
|
+
<div class="hub-logo">${t}</div>
|
|
1222
1251
|
<span class="hub-title">Eyeglass</span>
|
|
1223
1252
|
</div>
|
|
1224
1253
|
</div>
|
|
@@ -1239,7 +1268,7 @@ var R=new Set([0,1,11,14,15]);function F(s){let t=Object.keys(s).find(e=>e.start
|
|
|
1239
1268
|
</div>
|
|
1240
1269
|
</div>
|
|
1241
1270
|
</div>
|
|
1242
|
-
`,this.hub.querySelector(".hub-back-btn").addEventListener("click",()=>{this.hubPage="main",this.renderHub()}),this.hub.querySelectorAll(".toggle-switch").forEach(
|
|
1271
|
+
`,this.hub.querySelector(".hub-back-btn").addEventListener("click",()=>{this.hubPage="main",this.renderHub()}),this.hub.querySelectorAll(".toggle-switch").forEach(i=>{i.addEventListener("click",n=>{n.currentTarget.dataset.setting==="autoCommit"&&(this.autoCommitEnabled=!this.autoCommitEnabled,this.saveAutoCommitState(),this.renderHub())})})}async requestUndo(t){let e=this.history.findIndex(i=>i.interactionId===t);if(e!==-1){this.history[e].status="pending",this.saveHistory(),this.renderHub();try{(await fetch(`${b}/undo`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({interactionId:t})})).ok?(this.history.splice(e,1),this.saveHistory(),this.renderHub()):(this.history[e].status="failed",this.saveHistory(),this.renderHub())}catch(i){this.history[e]&&(this.history[e].status="failed",this.saveHistory(),this.renderHub()),console.warn("Undo request failed:",i)}}}async requestCommit(t){let e=this.history.findIndex(i=>i.interactionId===t);try{(await fetch(`${b}/commit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({interactionId:t})})).ok?(e>=0&&(this.history[e].status="success",this.saveHistory(),this.renderHub()),this.unfreeze()):console.warn("Commit request failed")}catch(i){console.warn("Commit request failed:",i)}}disconnectedCallback(){document.removeEventListener("mousemove",this.handleMouseMove,!0),document.removeEventListener("click",this.handleClick,!0),document.removeEventListener("keydown",this.handleKeyDown,!0),window.removeEventListener("scroll",this.handleScroll,!0),this.eventSource?.close(),this.cursorStyleElement&&(this.cursorStyleElement.remove(),this.cursorStyleElement=null)}connectSSE(){this.eventSource=new EventSource(`${b}/events`),this.eventSource.onmessage=t=>{try{let e=JSON.parse(t.data);e.type==="activity"&&this.handleActivityEvent(e.payload)}catch{}},this.eventSource.onerror=()=>{this.eventSource?.close(),setTimeout(()=>this.connectSSE(),3e3)}}handleActivityEvent(t){t.type==="status"&&this.updateHistoryStatus(t.interactionId,t.status),t.interactionId===this.interactionId&&(this.activityEvents.push(t),t.type==="status"&&(this.currentStatus=t.status,this.saveSession(t.message),t.status==="fixing"?this.startPhraseRotation():this.stopPhraseRotation(),t.status==="failed"&&setTimeout(()=>this.unfreeze(),4e3)),this.renderPanel())}handleMouseMove(t){if(!this.multiSelectMode&&this.frozen||!this.inspectorEnabled)return;if(t.composedPath().includes(this)){this.multiSelectMode||this.hideHighlight();return}if(this.throttleTimeout)return;this.throttleTimeout=window.setTimeout(()=>{this.throttleTimeout=null},16),this.style.pointerEvents="none";let i=document.elementFromPoint(t.clientX,t.clientY);if(this.style.pointerEvents="",!i||i===document.documentElement||i===document.body){this.multiSelectMode||this.hideHighlight();return}this.shadow.contains(i)||(this.currentElement=i,this.showHighlight(i))}handleClick(t){if(!(!this.inspectorEnabled||!this.currentElement||t.composedPath().some(i=>i===this))){if(t.preventDefault(),t.stopPropagation(),this.multiSelectMode){this.toggleInSelection(this.currentElement);return}this.frozen||this.freeze()}}handleKeyDown(t){t.key==="Escape"&&this.unfreeze()}handleScroll(){this.frozen&&(this.disableHighlightTransitions(),this.currentElement&&this.highlight&&!this.multiSelectMode&&this.showHighlight(this.currentElement),this.multiSelectMode&&this.selectedElements.length>0&&this.updateMultiSelectHighlightPositions(),this.scrollTimeout&&window.clearTimeout(this.scrollTimeout),this.scrollTimeout=window.setTimeout(()=>{this.enableHighlightTransitions(),this.scrollTimeout=null},150))}disableHighlightTransitions(){this.highlight&&this.highlight.classList.add("no-transition"),this.multiSelectHighlights.forEach(t=>t.classList.add("no-transition"))}enableHighlightTransitions(){this.highlight&&this.highlight.classList.remove("no-transition"),this.multiSelectHighlights.forEach(t=>t.classList.remove("no-transition"))}updateMultiSelectHighlightPositions(){this.selectedElements.forEach((e,i)=>{let n=this.multiSelectHighlights[i];if(!n)return;let o=e.getBoundingClientRect();n.style.left=`${o.left-3}px`,n.style.top=`${o.top-3}px`,n.style.width=`${o.width+3*2}px`,n.style.height=`${o.height+3*2}px`})}handlePanelDragStart(t){if(t.target.closest("button"))return;this.isDragging=!0;let e=this.panel.getBoundingClientRect();this.dragOffset={x:t.clientX-e.left,y:t.clientY-e.top},document.addEventListener("mousemove",this.handlePanelDrag),document.addEventListener("mouseup",this.handlePanelDragEnd)}showHighlight(t){if(!this.highlight)return;let e=t.getBoundingClientRect(),i=3;this.highlight.style.display="block",this.highlight.style.left=`${e.left-i}px`,this.highlight.style.top=`${e.top-i}px`,this.highlight.style.width=`${e.width+i*2}px`,this.highlight.style.height=`${e.height+i*2}px`}hideHighlight(){this.highlight&&(this.highlight.style.display="none"),this.currentElement=null}freeze(){this.currentElement&&(this.frozen=!0,this.currentSnapshot=x(this.currentElement),this.selectedElements=[this.currentElement],this.selectedSnapshots=[this.currentSnapshot],this.mode="input",this.activityEvents=[],this.currentStatus="idle",this.updateCursor(),this.renderPanel())}enterMultiSelectMode(){!this.frozen||this.multiSelectMode||(this.multiSelectMode=!0,this.renderMultiSelectHighlights(),this.updateCursor(),this.renderPanel())}toggleInSelection(t){if(!this.multiSelectMode)return;let e=this.selectedElements.indexOf(t);if(e>=0)this.removeFromSelection(e);else{if(this.selectedElements.length>=s.MAX_SELECTION)return;let i=x(t);this.selectedElements.push(t),this.selectedSnapshots.push(i)}this.renderMultiSelectHighlights(),this.renderPanel()}removeFromSelection(t){if(!(t<0||t>=this.selectedElements.length)){if(this.selectedElements.length===1){this.exitMultiSelectMode();return}this.selectedElements.splice(t,1),this.selectedSnapshots.splice(t,1),this.renderMultiSelectHighlights(),this.renderPanel()}}exitMultiSelectMode(){this.multiSelectMode=!1,this.selectedElements.length>0&&(this.currentElement=this.selectedElements[0],this.currentSnapshot=this.selectedSnapshots[0]),this.selectedElements=this.currentElement?[this.currentElement]:[],this.selectedSnapshots=this.currentSnapshot?[this.currentSnapshot]:[],this.clearMultiSelectHighlights(),this.currentElement&&this.showHighlight(this.currentElement),this.updateCursor(),this.renderPanel()}renderMultiSelectHighlights(){this.clearMultiSelectHighlights();let t=3;this.selectedElements.forEach((e,i)=>{let n=e.getBoundingClientRect(),o=document.createElement("div");o.className="highlight multi",o.style.display="block",o.style.left=`${n.left-t}px`,o.style.top=`${n.top-t}px`,o.style.width=`${n.width+t*2}px`,o.style.height=`${n.height+t*2}px`;let a=document.createElement("div");a.className="highlight-badge",a.textContent=String(i+1),o.appendChild(a),this.shadow.appendChild(o),this.multiSelectHighlights.push(o)}),this.highlight&&(this.highlight.style.display="none")}clearMultiSelectHighlights(){this.multiSelectHighlights.forEach(t=>t.remove()),this.multiSelectHighlights=[]}unfreeze(){this.frozen=!1,this.currentSnapshot=null,this.interactionId=null,this.mode="input",this.activityEvents=[],this.customPanelPosition=null,this.multiSelectMode=!1,this.selectedElements=[],this.selectedSnapshots=[],this.submittedSnapshots=[],this.clearMultiSelectHighlights(),this.stopPhraseRotation(),this.hidePanel(),this.hideHighlight(),this.updateCursor();try{sessionStorage.removeItem(v)}catch{}}renderPanel(){if(!this.currentSnapshot||!this.currentElement)return;let t=this.currentElement.getBoundingClientRect(),{framework:e}=this.currentSnapshot;if(this.panel||(this.panel=document.createElement("div"),this.panel.className="glass-panel",this.shadow.appendChild(this.panel)),this.customPanelPosition)this.panel.style.left=`${this.customPanelPosition.x}px`,this.panel.style.top=`${this.customPanelPosition.y}px`;else{let o=window.innerHeight-t.bottom,a=this.mode==="activity"?400:200,l=t.bottom+12;o<a&&t.top>a&&(l=t.top-a-12);let d=t.left;d+340>window.innerWidth-20&&(d=window.innerWidth-360),d<20&&(d=20),this.panel.style.left=`${d}px`,this.panel.style.top=`${l}px`}let i=e.componentName||this.currentSnapshot.tagName,n=e.filePath?e.filePath.split("/").slice(-2).join("/"):null;this.mode==="input"?this.renderInputMode(i,n):this.renderActivityMode(i,n)}renderInputMode(t,e){if(!this.panel)return;let i=this.multiSelectMode,n=i?"multi-select-icon active":"multi-select-icon",o=i?`
|
|
1243
1272
|
<div class="selected-list">
|
|
1244
1273
|
<div class="selected-list-header">
|
|
1245
1274
|
<span class="selected-count">${this.selectedElements.length} element${this.selectedElements.length!==1?"s":""} selected</span>
|
|
@@ -1254,7 +1283,7 @@ var R=new Set([0,1,11,14,15]);function F(s){let t=Object.keys(s).find(e=>e.start
|
|
|
1254
1283
|
`}).join("")}
|
|
1255
1284
|
</div>
|
|
1256
1285
|
</div>
|
|
1257
|
-
`:"",
|
|
1286
|
+
`:"",a=i?`
|
|
1258
1287
|
<div class="multi-mode-hint">Click elements to add/remove from selection (max ${s.MAX_SELECTION})</div>
|
|
1259
1288
|
`:"";this.panel.innerHTML=`
|
|
1260
1289
|
<div class="panel-header">
|
|
@@ -1263,8 +1292,8 @@ var R=new Set([0,1,11,14,15]);function F(s){let t=Object.keys(s).find(e=>e.start
|
|
|
1263
1292
|
<button class="${n}" title="${i?"Exit multi-select":"Select multiple elements"}">+</button>
|
|
1264
1293
|
<button class="close-btn" title="Cancel (Esc)">×</button>
|
|
1265
1294
|
</div>
|
|
1266
|
-
${o}
|
|
1267
1295
|
${a}
|
|
1296
|
+
${o}
|
|
1268
1297
|
<div class="input-area">
|
|
1269
1298
|
<input
|
|
1270
1299
|
type="text"
|
|
@@ -1277,7 +1306,7 @@ var R=new Set([0,1,11,14,15]);function F(s){let t=Object.keys(s).find(e=>e.start
|
|
|
1277
1306
|
<button class="btn btn-primary">Send</button>
|
|
1278
1307
|
</div>
|
|
1279
1308
|
</div>
|
|
1280
|
-
`;let l=this.panel.querySelector(".input-field"),d=this.panel.querySelector(".close-btn"),u=this.panel.querySelector(".btn-secondary"),
|
|
1309
|
+
`;let l=this.panel.querySelector(".input-field"),d=this.panel.querySelector(".close-btn"),u=this.panel.querySelector(".btn-secondary"),f=this.panel.querySelector(".btn-primary"),g=this.panel.querySelector(".multi-select-icon");d.addEventListener("click",()=>this.unfreeze()),u.addEventListener("click",()=>this.unfreeze()),f.addEventListener("click",()=>this.submit(l.value)),l.addEventListener("keydown",h=>{h.key==="Enter"&&l.value.trim()&&this.submit(l.value)}),g.addEventListener("click",()=>{this.multiSelectMode?this.exitMultiSelectMode():this.enterMultiSelectMode()}),this.panel.querySelectorAll(".selected-chip-remove").forEach(h=>{h.addEventListener("click",p=>{p.stopPropagation();let m=parseInt(p.currentTarget.dataset.index,10);this.removeFromSelection(m)})}),this.panel.querySelector(".panel-header").addEventListener("mousedown",this.handlePanelDragStart),requestAnimationFrame(()=>l.focus())}renderActivityMode(t,e){if(!this.panel)return;let i=this.activityEvents.length>0&&this.panel.querySelector(".user-request-text")?.textContent||"",n=this.currentStatus==="success"||this.currentStatus==="failed",o=this.currentStatus==="success"&&!this.autoCommitEnabled,a=this.currentStatus==="success",l=this.submittedSnapshots.length,d=l>1?`${l} elements`:`<${this.escapeHtml(t)} />`;this.panel.innerHTML=`
|
|
1281
1310
|
<div class="panel-header">
|
|
1282
1311
|
<span class="component-tag">${d}</span>
|
|
1283
1312
|
${l<=1&&e?`<span class="file-path">${this.escapeHtml(e)}</span>`:""}
|
|
@@ -1293,14 +1322,14 @@ var R=new Set([0,1,11,14,15]);function F(s){let t=Object.keys(s).find(e=>e.start
|
|
|
1293
1322
|
<div class="panel-footer ${n?"done":""}">
|
|
1294
1323
|
<div class="status-indicator ${this.currentStatus}"></div>
|
|
1295
1324
|
<span class="status-text">${this.getStatusText()}</span>
|
|
1296
|
-
${
|
|
1325
|
+
${o?`
|
|
1297
1326
|
<div class="success-actions">
|
|
1298
1327
|
<button class="action-btn action-btn-undo" title="Discard changes">Undo</button>
|
|
1299
1328
|
<button class="action-btn action-btn-commit" title="Commit changes">Commit</button>
|
|
1300
1329
|
</div>
|
|
1301
1330
|
`:""}
|
|
1302
1331
|
</div>
|
|
1303
|
-
${
|
|
1332
|
+
${a?`
|
|
1304
1333
|
<div class="followup-area">
|
|
1305
1334
|
<div class="followup-row">
|
|
1306
1335
|
<input type="text" class="followup-input" placeholder="Anything else?" />
|
|
@@ -1309,7 +1338,7 @@ var R=new Set([0,1,11,14,15]);function F(s){let t=Object.keys(s).find(e=>e.start
|
|
|
1309
1338
|
</div>
|
|
1310
1339
|
</div>
|
|
1311
1340
|
`:""}
|
|
1312
|
-
`,this.panel.querySelector(".close-btn").addEventListener("click",()=>this.unfreeze()),this.panel.querySelector(".panel-header").addEventListener("mousedown",this.handlePanelDragStart),this.panel.querySelectorAll(".question-option").forEach(
|
|
1341
|
+
`,this.panel.querySelector(".close-btn").addEventListener("click",()=>this.unfreeze()),this.panel.querySelector(".panel-header").addEventListener("mousedown",this.handlePanelDragStart),this.panel.querySelectorAll(".question-option").forEach(k=>{k.addEventListener("click",z=>{let E=z.target,A=E.dataset.questionId,q=E.dataset.answerId,D=E.textContent;this.submitAnswer(A,q,D)})});let g=this.panel.querySelector(".action-btn-commit"),c=this.panel.querySelector(".action-btn-undo");g&&this.interactionId&&g.addEventListener("click",()=>this.requestCommit(this.interactionId)),c&&this.interactionId&&c.addEventListener("click",()=>this.requestUndo(this.interactionId));let h=this.panel.querySelector(".followup-input"),p=this.panel.querySelector(".followup-send"),m=this.panel.querySelector(".followup-done");h&&p&&(p.addEventListener("click",()=>{h.value.trim()&&this.submitFollowUp(h.value)}),h.addEventListener("keydown",k=>{k.key==="Enter"&&h.value.trim()&&this.submitFollowUp(h.value)}),requestAnimationFrame(()=>h.focus())),m&&m.addEventListener("click",()=>this.unfreeze());let S=this.panel.querySelector(".activity-feed");S&&(S.scrollTop=S.scrollHeight)}renderActivityFeed(){let t=this.activityEvents.map(e=>{switch(e.type){case"status":return e.status==="pending"||e.status==="fixing"&&(!e.message||e.message==="Agent is working...")?"":this.renderStatusItem(e);case"thought":return this.renderThoughtItem(e);case"action":return this.renderActionItem(e);case"question":return this.renderQuestionItem(e);default:return""}}).filter(Boolean);return t.length===0&&(this.currentStatus==="pending"||this.currentStatus==="fixing")?`
|
|
1313
1342
|
<div class="skeleton-item">
|
|
1314
1343
|
<div class="skeleton-icon"></div>
|
|
1315
1344
|
<div class="skeleton-line"></div>
|
|
@@ -1356,8 +1385,8 @@ var R=new Set([0,1,11,14,15]);function F(s){let t=Object.keys(s).find(e=>e.start
|
|
|
1356
1385
|
`).join("")}
|
|
1357
1386
|
</div>
|
|
1358
1387
|
</div>
|
|
1359
|
-
`}getUserNote(){let t=this.activityEvents.find(e=>e.type==="status");return this._userNote||""}getStatusText(){switch(this.currentStatus){case"idle":return"Ready";case"pending":return"Waiting for agent...";case"fixing":return y[this.phraseIndex%y.length];case"success":return"Done!";case"failed":return"Failed";default:return this.currentStatus}}startPhraseRotation(){this.phraseInterval||(this.phraseIndex=Math.floor(Math.random()*y.length),this.phraseInterval=window.setInterval(()=>{this.phraseIndex=(this.phraseIndex+1)%y.length,this.updateFooterText()},1e4))}stopPhraseRotation(){this.phraseInterval&&(window.clearInterval(this.phraseInterval),this.phraseInterval=null)}updateFooterText(){if(!this.panel)return;let t=this.panel.querySelector(".status-text");t&&(t.textContent=this.getStatusText())}hidePanel(){this.panel&&(this.panel.remove(),this.panel=null)}async submit(t){if(!t.trim()||this.selectedSnapshots.length===0&&!this.currentSnapshot)return;this.interactionId=`eyeglass-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,this._userNote=t.trim();let e=this.selectedSnapshots.length>0?this.selectedSnapshots:this.currentSnapshot?[this.currentSnapshot]:[];this.submittedSnapshots=[...e];let i={interactionId:this.interactionId,userNote:t.trim(),autoCommit:this.autoCommitEnabled,...e.length===1?{snapshot:e[0]}:{snapshots:e}},n=e.map(u=>u.framework.componentName||u.tagName),
|
|
1388
|
+
`}getUserNote(){let t=this.activityEvents.find(e=>e.type==="status");return this._userNote||""}getStatusText(){switch(this.currentStatus){case"idle":return"Ready";case"pending":return"Waiting for agent...";case"fixing":return y[this.phraseIndex%y.length];case"success":return"Done!";case"failed":return"Failed";default:return this.currentStatus}}startPhraseRotation(){this.phraseInterval||(this.phraseIndex=Math.floor(Math.random()*y.length),this.phraseInterval=window.setInterval(()=>{this.phraseIndex=(this.phraseIndex+1)%y.length,this.updateFooterText()},1e4))}stopPhraseRotation(){this.phraseInterval&&(window.clearInterval(this.phraseInterval),this.phraseInterval=null)}updateFooterText(){if(!this.panel)return;let t=this.panel.querySelector(".status-text");t&&(t.textContent=this.getStatusText())}hidePanel(){this.panel&&(this.panel.remove(),this.panel=null)}async submit(t){if(!t.trim()||this.selectedSnapshots.length===0&&!this.currentSnapshot)return;this.interactionId=`eyeglass-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,this._userNote=t.trim();let e=this.selectedSnapshots.length>0?this.selectedSnapshots:this.currentSnapshot?[this.currentSnapshot]:[];this.submittedSnapshots=[...e];let i={interactionId:this.interactionId,userNote:t.trim(),autoCommit:this.autoCommitEnabled,...e.length===1?{snapshot:e[0]}:{snapshots:e}},n=e.map(u=>u.framework.componentName||u.tagName),o=e.length===1?n[0]:`${n.length} elements`;this.addToHistory({interactionId:this.interactionId,userNote:t.trim(),componentName:o,filePath:e[0]?.framework.filePath,status:"pending",timestamp:Date.now()});let a=this.multiSelectMode,l=[...this.selectedElements],d=[...this.selectedSnapshots];this.clearMultiSelectHighlights(),this.multiSelectMode=!1,this.mode="activity",this.activityEvents=[],this.currentStatus="pending",this.renderPanel();try{let u=await fetch(`${b}/focus`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!u.ok)throw new Error(`HTTP ${u.status}`)}catch{this.currentStatus="failed",this.updateHistoryStatus(this.interactionId,"failed"),this.activityEvents.push({type:"status",interactionId:this.interactionId,status:"failed",message:"Failed to connect to bridge",timestamp:Date.now()}),a&&l.length>1&&(this.multiSelectMode=!0,this.selectedElements=l,this.selectedSnapshots=d,this.mode="input",this.renderMultiSelectHighlights()),this.renderPanel()}}async submitFollowUp(t){if(!t.trim()||this.submittedSnapshots.length===0)return;this.interactionId=`eyeglass-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,this._userNote=t.trim();let e=this.submittedSnapshots,i={interactionId:this.interactionId,userNote:t.trim(),autoCommit:this.autoCommitEnabled,...e.length===1?{snapshot:e[0]}:{snapshots:e}},n=e.map(a=>a.framework.componentName||a.tagName),o=e.length===1?n[0]:`${n.length} elements`;this.addToHistory({interactionId:this.interactionId,userNote:t.trim(),componentName:o,filePath:e[0]?.framework.filePath,status:"pending",timestamp:Date.now()}),this.activityEvents=[],this.currentStatus="pending",this.renderPanel();try{let a=await fetch(`${b}/focus`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!a.ok)throw new Error(`HTTP ${a.status}`)}catch{this.currentStatus="failed",this.updateHistoryStatus(this.interactionId,"failed"),this.activityEvents.push({type:"status",interactionId:this.interactionId,status:"failed",message:"Failed to connect to bridge",timestamp:Date.now()}),this.renderPanel()}}async submitAnswer(t,e,i){if(!this.interactionId)return;let n={interactionId:this.interactionId,questionId:t,answerId:e,answerLabel:i};try{await fetch(`${b}/answer`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}catch{}}escapeHtml(t){let e=document.createElement("div");return e.textContent=t,e.innerHTML}updateCursor(){this.inspectorEnabled&&(!this.frozen||this.multiSelectMode)?(this.cursorStyleElement||(this.cursorStyleElement=document.createElement("style"),this.cursorStyleElement.id="eyeglass-cursor-style",document.head.appendChild(this.cursorStyleElement)),this.cursorStyleElement.textContent=`
|
|
1360
1389
|
html, body, body * {
|
|
1361
|
-
cursor: ${
|
|
1390
|
+
cursor: ${Z} !important;
|
|
1362
1391
|
}
|
|
1363
|
-
`):this.cursorStyleElement&&(this.cursorStyleElement.textContent="")}};customElements.get("eyeglass-inspector")||customElements.define("eyeglass-inspector",w);function
|
|
1392
|
+
`):this.cursorStyleElement&&(this.cursorStyleElement.textContent="")}};customElements.get("eyeglass-inspector")||customElements.define("eyeglass-inspector",w);function N(){if(document.querySelector("eyeglass-inspector")){console.warn("[eyeglass] Inspector already initialized");return}let s=document.createElement("eyeglass-inspector");document.body.appendChild(s),console.log("[eyeglass] Inspector initialized. Hover over elements and click to annotate.")}typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",N):N());export{w as EyeglassInspector,x as captureSnapshot,I as extractFrameworkInfo,N as initInspector};
|