@naylabs/agent-lens 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +176 -2
- package/dist/AgentLens.d.ts +3 -0
- package/dist/components/ArcDock.d.ts +13 -0
- package/dist/components/ArcInspector.d.ts +8 -0
- package/dist/components/ArcPinBadge.d.ts +9 -0
- package/dist/components/ArcPopover.d.ts +10 -0
- package/dist/components/ArcTray.d.ts +12 -0
- package/dist/components/icons.d.ts +25 -0
- package/dist/core/extractor.d.ts +5 -0
- package/dist/core/prompt-compiler.d.ts +5 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +552 -0
- package/dist/index.mjs +1324 -0
- package/dist/styles/arc-theme.d.ts +6 -0
- package/dist/types.d.ts +57 -0
- package/package.json +72 -4
package/dist/index.js
ADDED
|
@@ -0,0 +1,552 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),h=require("react"),T=require("react-dom");function R(t){try{const r=t.getAttribute("data-component-id")||t.getAttribute("data-component");if(r)return{componentName:r.split(":")[0]||r,sourceFile:r.includes(":")?r:null};const a=Object.keys(t).find(n=>n.startsWith("__reactFiber$")||n.startsWith("__reactInternalInstance$"));if(!a)return{componentName:null,sourceFile:null};let o=t[a],d=null,x=null;for(;o;){const n=o.type,l=o._debugSource;if(l!=null&&l.fileName&&!x){const s=l.fileName,p=l.lineNumber?`:${l.lineNumber}`:"";x=`${s.replace(/.*\/src\//,"src/")}${p}`}if(typeof n=="function"){const s=n.displayName||n.name;s&&s!=="Anonymous"&&!s.startsWith("_")&&!d&&(d=s)}else if(typeof n=="object"&&n!==null){const s=n.displayName;s&&!d&&(d=s)}if(d&&x)break;o=o.return||null}return{componentName:d,sourceFile:x}}catch{return{componentName:null,sourceFile:null}}}function M(t){if(t.id)return`#${CSS.escape(t.id)}`;const r=t.getAttribute("data-testid");if(r)return`[data-testid="${CSS.escape(r)}"]`;const a=[];let o=t;for(;o&&o.nodeType===Node.ELEMENT_NODE&&o!==document.body;){let d=o.tagName.toLowerCase();if(o.id){d=`#${CSS.escape(o.id)}`,a.unshift(d);break}if(o.className&&typeof o.className=="string"){const n=o.className.trim().split(/\s+/).filter(l=>!l.includes(":")&&!l.includes("/")&&!l.startsWith("[")&&l.length<25);n.length>0&&n[0]&&(d+=`.${CSS.escape(n[0])}`)}const x=o.parentElement;if(x){const n=Array.from(x.children).filter(l=>l.tagName===o.tagName);if(n.length>1){const l=n.indexOf(o)+1;d+=`:nth-of-type(${l})`}}if(a.unshift(d),o=o.parentElement,a.length>=4)break}return a.join(" > ")}function B(t){const r=window.getComputedStyle(t),a={};r.display!=="inline"&&r.display!=="block"&&(a.display=r.display),r.display.includes("flex")&&(a.flexDirection=r.flexDirection,r.gap&&r.gap!=="normal"&&(a.gap=r.gap)),r.display.includes("grid")&&r.gridTemplateColumns&&(a.gridTemplateColumns=r.gridTemplateColumns,r.gap&&r.gap!=="normal"&&(a.gap=r.gap)),r.padding&&r.padding!=="0px"&&(a.padding=r.padding),r.margin&&r.margin!=="0px"&&(a.margin=r.margin);const o=t.getBoundingClientRect();return a.width=`${Math.round(o.width)}px`,a.height=`${Math.round(o.height)}px`,r.backgroundColor&&r.backgroundColor!=="rgba(0, 0, 0, 0)"&&r.backgroundColor!=="transparent"&&(a.backgroundColor=r.backgroundColor),r.color&&(a.color=r.color),r.fontSize&&(a.fontSize=r.fontSize),r.fontWeight&&r.fontWeight!=="400"&&(a.fontWeight=r.fontWeight),r.borderRadius&&r.borderRadius!=="0px"&&(a.borderRadius=r.borderRadius),r.border&&r.border!=="none"&&!r.border.startsWith("0px")&&(a.border=r.border),a}function E(t){const r=t.getBoundingClientRect(),{componentName:a,sourceFile:o}=R(t),d=M(t),x=B(t);let n=null;const s=(t.innerText||t.textContent||"").replace(/\s+/g," ").trim();s&&(n=s.length>50?`${s.slice(0,47)}...`:s);const p=typeof t.className=="string"?t.className.trim():"";return{componentName:a,sourceFile:o,selector:d,tagName:t.tagName.toLowerCase(),classes:p,textSnippet:n,rect:{top:Math.round(r.top+window.scrollY),left:Math.round(r.left+window.scrollX),width:Math.round(r.width),height:Math.round(r.height)},computedStyles:x,viewport:{width:window.innerWidth,height:window.innerHeight},route:window.location.pathname+window.location.search+window.location.hash}}const W={style:"Style",copy:"Copy",layout:"Layout",motion:"Motion",bug:"Bug",general:"Note"};function O(t){return t<640?"Mobile (< 640px)":t<1024?"Tablet (640-1024px)":"Desktop (>= 1024px)"}function P(t){if(t.length===0)return"No visual pins recorded.";const r=t[0],a=r.metadata.viewport,o=r.metadata.route,d=O(a.width),x=[`### AgentLens: Visual UI Feedback (${t.length} ${t.length===1?"item":"items"})`,`**Context:** Route: \`${o}\` | Viewport: \`${a.width} × ${a.height}px\` (${d})`,`**Timestamp:** ${new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}`,"","Please implement the following visual and code adjustments:","","---"].join(`
|
|
2
|
+
`),n=t.map(s=>{const p=s.metadata,v=W[s.category]||"Note",f=p.componentName?`<${p.componentName}> (${p.tagName})`:`<${p.tagName}>`,y=[`#### Pin #${s.number}: ${f}`,`- **Category:** [${v}]`,`- **Instruction:** "${s.instruction.trim()}"`];p.sourceFile&&y.push(`- **Source Component:** \`${p.sourceFile}\``),y.push(`- **CSS Selector:** \`${p.selector}\``),p.textSnippet&&y.push(`- **Current Text Snippet:** "${p.textSnippet}"`),p.classes&&y.push(`- **Current Classes:** \`${p.classes}\``);const i=p.computedStyles,g=[];return g.push(`box: ${i.width||"auto"} × ${i.height||"auto"}`),i.display&&g.push(`display: ${i.display}`),i.gap&&g.push(`gap: ${i.gap}`),i.padding&&g.push(`padding: ${i.padding}`),i.margin&&g.push(`margin: ${i.margin}`),i.backgroundColor&&g.push(`bg: ${i.backgroundColor}`),i.color&&g.push(`color: ${i.color}`),i.fontSize&&g.push(`font-size: ${i.fontSize}`),i.borderRadius&&g.push(`radius: ${i.borderRadius}`),g.length>0&&y.push(`- **Computed Styles:** ${g.join(" | ")}`),y.join(`
|
|
3
|
+
`)}),l=["---","**Implementation Guidance:**","1. Locate each component file indicated above.","2. Apply the requested visual styling, copy, or layout adjustments.","3. Ensure responsive behavior is preserved across breakpoints."].join(`
|
|
4
|
+
`);return[x,...n,l].join(`
|
|
5
|
+
|
|
6
|
+
`)}const Y=`
|
|
7
|
+
:host {
|
|
8
|
+
all: initial;
|
|
9
|
+
position: fixed;
|
|
10
|
+
top: 0;
|
|
11
|
+
left: 0;
|
|
12
|
+
width: 0;
|
|
13
|
+
height: 0;
|
|
14
|
+
z-index: 2147483647;
|
|
15
|
+
font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
16
|
+
-webkit-font-smoothing: antialiased;
|
|
17
|
+
-moz-osx-font-smoothing: grayscale;
|
|
18
|
+
color: #F4F4F5;
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
*, *::before, *::after {
|
|
23
|
+
box-sizing: border-box;
|
|
24
|
+
margin: 0;
|
|
25
|
+
padding: 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* Arc Design System Tokens */
|
|
29
|
+
:host {
|
|
30
|
+
--arc-gradient: linear-gradient(135deg, #FF6EA7 0%, #A855F7 50%, #38BDF8 100%);
|
|
31
|
+
--arc-gradient-subtle: linear-gradient(135deg, rgba(255, 110, 167, 0.12) 0%, rgba(168, 85, 247, 0.12) 50%, rgba(56, 189, 248, 0.12) 100%);
|
|
32
|
+
--arc-cyan: #38BDF8;
|
|
33
|
+
--arc-purple: #A855F7;
|
|
34
|
+
--arc-pink: #FF6EA7;
|
|
35
|
+
--arc-glass-bg: rgba(18, 18, 24, 0.88);
|
|
36
|
+
--arc-glass-surface: rgba(28, 28, 36, 0.72);
|
|
37
|
+
--arc-glass-hover: rgba(42, 42, 54, 0.85);
|
|
38
|
+
--arc-border: rgba(255, 255, 255, 0.1);
|
|
39
|
+
--arc-border-highlight: rgba(255, 255, 255, 0.22);
|
|
40
|
+
--arc-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.08);
|
|
41
|
+
--arc-shadow-hover: 0 20px 48px -8px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.18);
|
|
42
|
+
--arc-radius-pill: 9999px;
|
|
43
|
+
--arc-radius-card: 16px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* Loom / Intercom Floating Trigger Button (Bottom Right) */
|
|
47
|
+
.arc-launcher-btn {
|
|
48
|
+
position: fixed;
|
|
49
|
+
bottom: 24px;
|
|
50
|
+
right: 24px;
|
|
51
|
+
width: 48px;
|
|
52
|
+
height: 48px;
|
|
53
|
+
border-radius: 50%;
|
|
54
|
+
background: var(--arc-glass-bg);
|
|
55
|
+
backdrop-filter: blur(28px) saturate(190%);
|
|
56
|
+
-webkit-backdrop-filter: blur(28px) saturate(190%);
|
|
57
|
+
border: 1px solid var(--arc-border);
|
|
58
|
+
box-shadow: var(--arc-shadow);
|
|
59
|
+
display: flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
justify-content: center;
|
|
62
|
+
color: #FFFFFF;
|
|
63
|
+
cursor: pointer;
|
|
64
|
+
pointer-events: auto;
|
|
65
|
+
user-select: none;
|
|
66
|
+
transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
|
|
67
|
+
z-index: 2147483647;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.arc-launcher-btn:hover {
|
|
71
|
+
transform: translateY(-2px) scale(1.04);
|
|
72
|
+
border-color: var(--arc-border-highlight);
|
|
73
|
+
box-shadow: var(--arc-shadow-hover);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.arc-launcher-btn:active {
|
|
77
|
+
transform: translateY(0) scale(0.96);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.arc-launcher-badge {
|
|
81
|
+
position: absolute;
|
|
82
|
+
top: -3px;
|
|
83
|
+
right: -3px;
|
|
84
|
+
min-width: 18px;
|
|
85
|
+
height: 18px;
|
|
86
|
+
padding: 0 5px;
|
|
87
|
+
border-radius: var(--arc-radius-pill);
|
|
88
|
+
background: var(--arc-gradient);
|
|
89
|
+
color: #FFFFFF;
|
|
90
|
+
font-size: 10px;
|
|
91
|
+
font-weight: 700;
|
|
92
|
+
display: flex;
|
|
93
|
+
align-items: center;
|
|
94
|
+
justify-content: center;
|
|
95
|
+
box-shadow: 0 2px 8px rgba(168, 85, 247, 0.6);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/* Arc Expanded Dock / Toolbar (Docked at Bottom-Right) */
|
|
99
|
+
.arc-dock {
|
|
100
|
+
position: fixed;
|
|
101
|
+
bottom: 24px;
|
|
102
|
+
right: 24px;
|
|
103
|
+
display: flex;
|
|
104
|
+
align-items: center;
|
|
105
|
+
gap: 6px;
|
|
106
|
+
padding: 5px 8px;
|
|
107
|
+
background: var(--arc-glass-bg);
|
|
108
|
+
backdrop-filter: blur(28px) saturate(190%);
|
|
109
|
+
-webkit-backdrop-filter: blur(28px) saturate(190%);
|
|
110
|
+
border: 1px solid var(--arc-border);
|
|
111
|
+
border-radius: var(--arc-radius-pill);
|
|
112
|
+
box-shadow: var(--arc-shadow);
|
|
113
|
+
transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
|
|
114
|
+
pointer-events: auto;
|
|
115
|
+
user-select: none;
|
|
116
|
+
z-index: 2147483647;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.arc-dock:hover {
|
|
120
|
+
border-color: var(--arc-border-highlight);
|
|
121
|
+
box-shadow: var(--arc-shadow-hover);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* Brand Pill */
|
|
125
|
+
.arc-brand-pill {
|
|
126
|
+
display: flex;
|
|
127
|
+
align-items: center;
|
|
128
|
+
gap: 6px;
|
|
129
|
+
padding: 4px 10px;
|
|
130
|
+
border-radius: var(--arc-radius-pill);
|
|
131
|
+
background: rgba(255, 255, 255, 0.04);
|
|
132
|
+
font-size: 12px;
|
|
133
|
+
font-weight: 600;
|
|
134
|
+
letter-spacing: -0.01em;
|
|
135
|
+
color: #FFFFFF;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.arc-brand-dot {
|
|
139
|
+
width: 6px;
|
|
140
|
+
height: 6px;
|
|
141
|
+
border-radius: 50%;
|
|
142
|
+
background: var(--arc-gradient);
|
|
143
|
+
box-shadow: 0 0 8px rgba(168, 85, 247, 0.8);
|
|
144
|
+
animation: arc-pulse 2s infinite ease-in-out;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
@keyframes arc-pulse {
|
|
148
|
+
0%, 100% { opacity: 1; transform: scale(1); }
|
|
149
|
+
50% { opacity: 0.5; transform: scale(0.85); }
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/* Tactile Pill Buttons */
|
|
153
|
+
.arc-btn {
|
|
154
|
+
display: inline-flex;
|
|
155
|
+
align-items: center;
|
|
156
|
+
justify-content: center;
|
|
157
|
+
gap: 6px;
|
|
158
|
+
height: 32px;
|
|
159
|
+
padding: 0 12px;
|
|
160
|
+
background: var(--arc-glass-surface);
|
|
161
|
+
border: 1px solid var(--arc-border);
|
|
162
|
+
border-radius: var(--arc-radius-pill);
|
|
163
|
+
color: #D4D4D8;
|
|
164
|
+
font-size: 12px;
|
|
165
|
+
font-weight: 500;
|
|
166
|
+
cursor: pointer;
|
|
167
|
+
transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
|
|
168
|
+
outline: none;
|
|
169
|
+
user-select: none;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.arc-btn:hover {
|
|
173
|
+
background: var(--arc-glass-hover);
|
|
174
|
+
color: #FFFFFF;
|
|
175
|
+
border-color: var(--arc-border-highlight);
|
|
176
|
+
transform: translateY(-1px);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.arc-btn:active {
|
|
180
|
+
transform: translateY(1px) scale(0.98);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.arc-btn-active {
|
|
184
|
+
background: var(--arc-gradient);
|
|
185
|
+
color: #FFFFFF;
|
|
186
|
+
border-color: rgba(255, 255, 255, 0.3);
|
|
187
|
+
box-shadow: 0 3px 12px rgba(168, 85, 247, 0.45);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.arc-btn-active:hover {
|
|
191
|
+
filter: brightness(1.08);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.arc-btn-gradient {
|
|
195
|
+
background: var(--arc-gradient);
|
|
196
|
+
color: #FFFFFF;
|
|
197
|
+
border: 1px solid rgba(255, 255, 255, 0.25);
|
|
198
|
+
box-shadow: 0 3px 12px rgba(168, 85, 247, 0.35);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.arc-btn-gradient:hover {
|
|
202
|
+
filter: brightness(1.1);
|
|
203
|
+
transform: translateY(-1px);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.arc-btn-success {
|
|
207
|
+
background: #10B981;
|
|
208
|
+
color: #FFFFFF;
|
|
209
|
+
border-color: rgba(255, 255, 255, 0.3);
|
|
210
|
+
box-shadow: 0 3px 12px rgba(16, 185, 129, 0.4);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.arc-badge {
|
|
214
|
+
display: inline-flex;
|
|
215
|
+
align-items: center;
|
|
216
|
+
justify-content: center;
|
|
217
|
+
min-width: 16px;
|
|
218
|
+
height: 16px;
|
|
219
|
+
padding: 0 5px;
|
|
220
|
+
border-radius: var(--arc-radius-pill);
|
|
221
|
+
font-size: 10px;
|
|
222
|
+
font-weight: 600;
|
|
223
|
+
background: rgba(255, 255, 255, 0.12);
|
|
224
|
+
color: #FFFFFF;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/* Hover Inspector Overlay */
|
|
228
|
+
.arc-inspect-box {
|
|
229
|
+
position: fixed;
|
|
230
|
+
pointer-events: none;
|
|
231
|
+
z-index: 2147483640;
|
|
232
|
+
border: 1.5px solid var(--arc-cyan);
|
|
233
|
+
background: rgba(56, 189, 248, 0.06);
|
|
234
|
+
border-radius: 4px;
|
|
235
|
+
transition: all 0.08s ease-out;
|
|
236
|
+
box-shadow: 0 0 16px rgba(56, 189, 248, 0.2);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.arc-inspect-label {
|
|
240
|
+
position: absolute;
|
|
241
|
+
top: -26px;
|
|
242
|
+
left: 0;
|
|
243
|
+
display: flex;
|
|
244
|
+
align-items: center;
|
|
245
|
+
gap: 6px;
|
|
246
|
+
padding: 3px 8px;
|
|
247
|
+
background: rgba(14, 14, 18, 0.94);
|
|
248
|
+
backdrop-filter: blur(12px);
|
|
249
|
+
border: 1px solid rgba(56, 189, 248, 0.5);
|
|
250
|
+
border-radius: 6px;
|
|
251
|
+
font-size: 11px;
|
|
252
|
+
font-weight: 600;
|
|
253
|
+
color: var(--arc-cyan);
|
|
254
|
+
white-space: nowrap;
|
|
255
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.arc-inspect-label .size {
|
|
259
|
+
color: #A1A1AA;
|
|
260
|
+
font-weight: 400;
|
|
261
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
262
|
+
font-size: 10px;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/* Numbered Pin Badges */
|
|
266
|
+
.arc-pin-marker {
|
|
267
|
+
position: absolute;
|
|
268
|
+
z-index: 2147483642;
|
|
269
|
+
width: 26px;
|
|
270
|
+
height: 26px;
|
|
271
|
+
display: flex;
|
|
272
|
+
align-items: center;
|
|
273
|
+
justify-content: center;
|
|
274
|
+
border-radius: 50%;
|
|
275
|
+
background: var(--arc-gradient);
|
|
276
|
+
color: #FFFFFF;
|
|
277
|
+
font-size: 12px;
|
|
278
|
+
font-weight: 700;
|
|
279
|
+
cursor: pointer;
|
|
280
|
+
pointer-events: auto;
|
|
281
|
+
box-shadow: 0 4px 14px rgba(168, 85, 247, 0.5), 0 0 0 2px rgba(255, 255, 255, 0.9);
|
|
282
|
+
transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
|
|
283
|
+
transform: translate(-50%, -50%);
|
|
284
|
+
user-select: none;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.arc-pin-marker:hover {
|
|
288
|
+
transform: translate(-50%, -50%) scale(1.15);
|
|
289
|
+
box-shadow: 0 6px 18px rgba(168, 85, 247, 0.75), 0 0 0 2px #FFFFFF;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.arc-pin-marker.active {
|
|
293
|
+
transform: translate(-50%, -50%) scale(1.2);
|
|
294
|
+
box-shadow: 0 8px 22px rgba(255, 110, 167, 0.8), 0 0 0 2.5px #FFFFFF;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/* Figma-style Comment Popover */
|
|
298
|
+
.arc-popover {
|
|
299
|
+
position: absolute;
|
|
300
|
+
z-index: 2147483645;
|
|
301
|
+
width: 320px;
|
|
302
|
+
background: var(--arc-glass-bg);
|
|
303
|
+
backdrop-filter: blur(32px) saturate(200%);
|
|
304
|
+
-webkit-backdrop-filter: blur(32px) saturate(200%);
|
|
305
|
+
border: 1px solid var(--arc-border);
|
|
306
|
+
border-radius: var(--arc-radius-card);
|
|
307
|
+
padding: 14px;
|
|
308
|
+
box-shadow: var(--arc-shadow-hover);
|
|
309
|
+
pointer-events: auto;
|
|
310
|
+
animation: arc-pop-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
@keyframes arc-pop-in {
|
|
314
|
+
from { opacity: 0; transform: translateY(6px) scale(0.96); }
|
|
315
|
+
to { opacity: 1; transform: translateY(0) scale(1); }
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
.arc-popover-header {
|
|
319
|
+
display: flex;
|
|
320
|
+
align-items: center;
|
|
321
|
+
justify-content: space-between;
|
|
322
|
+
margin-bottom: 10px;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.arc-component-badge {
|
|
326
|
+
display: inline-flex;
|
|
327
|
+
align-items: center;
|
|
328
|
+
gap: 6px;
|
|
329
|
+
padding: 3px 8px;
|
|
330
|
+
border-radius: var(--arc-radius-pill);
|
|
331
|
+
background: rgba(56, 189, 248, 0.12);
|
|
332
|
+
border: 1px solid rgba(56, 189, 248, 0.28);
|
|
333
|
+
color: var(--arc-cyan);
|
|
334
|
+
font-size: 11px;
|
|
335
|
+
font-weight: 600;
|
|
336
|
+
max-width: 230px;
|
|
337
|
+
overflow: hidden;
|
|
338
|
+
text-overflow: ellipsis;
|
|
339
|
+
white-space: nowrap;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/* Category Chips (Clean Text, No Emojis) */
|
|
343
|
+
.arc-chips {
|
|
344
|
+
display: flex;
|
|
345
|
+
flex-wrap: wrap;
|
|
346
|
+
gap: 5px;
|
|
347
|
+
margin-bottom: 10px;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
.arc-chip {
|
|
351
|
+
padding: 3px 9px;
|
|
352
|
+
border-radius: var(--arc-radius-pill);
|
|
353
|
+
background: rgba(255, 255, 255, 0.05);
|
|
354
|
+
border: 1px solid var(--arc-border);
|
|
355
|
+
font-size: 11px;
|
|
356
|
+
font-weight: 500;
|
|
357
|
+
color: #A1A1AA;
|
|
358
|
+
cursor: pointer;
|
|
359
|
+
transition: all 0.15s ease;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
.arc-chip:hover {
|
|
363
|
+
background: rgba(255, 255, 255, 0.1);
|
|
364
|
+
color: #FFFFFF;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.arc-chip.selected {
|
|
368
|
+
background: var(--arc-gradient);
|
|
369
|
+
border-color: rgba(255, 255, 255, 0.3);
|
|
370
|
+
color: #FFFFFF;
|
|
371
|
+
font-weight: 600;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/* Comment Input */
|
|
375
|
+
.arc-textarea {
|
|
376
|
+
width: 100%;
|
|
377
|
+
height: 76px;
|
|
378
|
+
padding: 10px 12px;
|
|
379
|
+
background: rgba(0, 0, 0, 0.32);
|
|
380
|
+
border: 1px solid var(--arc-border);
|
|
381
|
+
border-radius: 10px;
|
|
382
|
+
color: #F4F4F5;
|
|
383
|
+
font-size: 12px;
|
|
384
|
+
line-height: 1.5;
|
|
385
|
+
resize: none;
|
|
386
|
+
outline: none;
|
|
387
|
+
transition: border-color 0.15s ease;
|
|
388
|
+
font-family: inherit;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
.arc-textarea:focus {
|
|
392
|
+
border-color: var(--arc-purple);
|
|
393
|
+
box-shadow: 0 0 0 1px var(--arc-purple);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
.arc-textarea::placeholder {
|
|
397
|
+
color: #71717A;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/* Popover Footer */
|
|
401
|
+
.arc-popover-footer {
|
|
402
|
+
display: flex;
|
|
403
|
+
align-items: center;
|
|
404
|
+
justify-content: space-between;
|
|
405
|
+
margin-top: 10px;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
.arc-btn-icon {
|
|
409
|
+
width: 30px;
|
|
410
|
+
height: 30px;
|
|
411
|
+
display: inline-flex;
|
|
412
|
+
align-items: center;
|
|
413
|
+
justify-content: center;
|
|
414
|
+
border-radius: 50%;
|
|
415
|
+
background: rgba(255, 255, 255, 0.05);
|
|
416
|
+
border: 1px solid var(--arc-border);
|
|
417
|
+
color: #A1A1AA;
|
|
418
|
+
cursor: pointer;
|
|
419
|
+
transition: all 0.15s ease;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
.arc-btn-icon:hover {
|
|
423
|
+
background: rgba(255, 255, 255, 0.12);
|
|
424
|
+
color: #FFFFFF;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
.arc-btn-icon.danger:hover {
|
|
428
|
+
background: rgba(239, 68, 68, 0.2);
|
|
429
|
+
border-color: rgba(239, 68, 68, 0.4);
|
|
430
|
+
color: #EF4444;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/* Slide-up Tray (Docked at Bottom-Right above Launcher) */
|
|
434
|
+
.arc-tray {
|
|
435
|
+
position: fixed;
|
|
436
|
+
bottom: 76px;
|
|
437
|
+
right: 24px;
|
|
438
|
+
width: 380px;
|
|
439
|
+
max-width: 90vw;
|
|
440
|
+
max-height: 360px;
|
|
441
|
+
background: var(--arc-glass-bg);
|
|
442
|
+
backdrop-filter: blur(32px) saturate(200%);
|
|
443
|
+
-webkit-backdrop-filter: blur(32px) saturate(200%);
|
|
444
|
+
border: 1px solid var(--arc-border);
|
|
445
|
+
border-radius: var(--arc-radius-card);
|
|
446
|
+
padding: 14px;
|
|
447
|
+
box-shadow: var(--arc-shadow-hover);
|
|
448
|
+
display: flex;
|
|
449
|
+
flex-direction: column;
|
|
450
|
+
gap: 10px;
|
|
451
|
+
pointer-events: auto;
|
|
452
|
+
animation: arc-pop-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
|
|
453
|
+
z-index: 2147483646;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
.arc-tray-header {
|
|
457
|
+
display: flex;
|
|
458
|
+
align-items: center;
|
|
459
|
+
justify-content: space-between;
|
|
460
|
+
padding-bottom: 8px;
|
|
461
|
+
border-bottom: 1px solid var(--arc-border);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
.arc-tray-title {
|
|
465
|
+
font-size: 12px;
|
|
466
|
+
font-weight: 600;
|
|
467
|
+
color: #FFFFFF;
|
|
468
|
+
display: flex;
|
|
469
|
+
align-items: center;
|
|
470
|
+
gap: 6px;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
.arc-tray-list {
|
|
474
|
+
display: flex;
|
|
475
|
+
flex-direction: column;
|
|
476
|
+
gap: 8px;
|
|
477
|
+
overflow-y: auto;
|
|
478
|
+
max-height: 250px;
|
|
479
|
+
padding-right: 2px;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
.arc-tray-list::-webkit-scrollbar {
|
|
483
|
+
width: 4px;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
.arc-tray-list::-webkit-scrollbar-thumb {
|
|
487
|
+
background: rgba(255, 255, 255, 0.2);
|
|
488
|
+
border-radius: 4px;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
.arc-tray-item {
|
|
492
|
+
display: flex;
|
|
493
|
+
align-items: flex-start;
|
|
494
|
+
justify-content: space-between;
|
|
495
|
+
gap: 10px;
|
|
496
|
+
padding: 8px 10px;
|
|
497
|
+
background: rgba(255, 255, 255, 0.04);
|
|
498
|
+
border: 1px solid var(--arc-border);
|
|
499
|
+
border-radius: 10px;
|
|
500
|
+
cursor: pointer;
|
|
501
|
+
transition: all 0.15s ease;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
.arc-tray-item:hover {
|
|
505
|
+
background: rgba(255, 255, 255, 0.08);
|
|
506
|
+
border-color: var(--arc-border-highlight);
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
.arc-tray-item-left {
|
|
510
|
+
display: flex;
|
|
511
|
+
align-items: flex-start;
|
|
512
|
+
gap: 8px;
|
|
513
|
+
flex: 1;
|
|
514
|
+
min-width: 0;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
.arc-tray-pin-num {
|
|
518
|
+
width: 20px;
|
|
519
|
+
height: 20px;
|
|
520
|
+
border-radius: 50%;
|
|
521
|
+
background: var(--arc-gradient);
|
|
522
|
+
display: flex;
|
|
523
|
+
align-items: center;
|
|
524
|
+
justify-content: center;
|
|
525
|
+
font-size: 10px;
|
|
526
|
+
font-weight: 700;
|
|
527
|
+
color: #FFFFFF;
|
|
528
|
+
flex-shrink: 0;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
.arc-tray-item-content {
|
|
532
|
+
flex: 1;
|
|
533
|
+
min-width: 0;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
.arc-tray-item-meta {
|
|
537
|
+
font-size: 11px;
|
|
538
|
+
color: var(--arc-cyan);
|
|
539
|
+
font-weight: 600;
|
|
540
|
+
margin-bottom: 2px;
|
|
541
|
+
white-space: nowrap;
|
|
542
|
+
overflow: hidden;
|
|
543
|
+
text-overflow: ellipsis;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
.arc-tray-item-text {
|
|
547
|
+
font-size: 11px;
|
|
548
|
+
color: #E4E4E7;
|
|
549
|
+
line-height: 1.4;
|
|
550
|
+
word-break: break-word;
|
|
551
|
+
}
|
|
552
|
+
`,K=({size:t=16})=>e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"22",y1:"12",x2:"18",y2:"12"}),e.jsx("line",{x1:"6",y1:"12",x2:"2",y2:"12"}),e.jsx("line",{x1:"12",y1:"6",x2:"12",y2:"2"}),e.jsx("line",{x1:"12",y1:"22",x2:"12",y2:"18"})]}),A=({size:t=14})=>e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12 17v5"}),e.jsx("path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1z"})]}),_=({size:t=14})=>e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),e.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),V=({size:t=14})=>e.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}),H=({size:t=14})=>e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"3 6 5 6 21 6"}),e.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]}),C=({size:t=14})=>e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),q=({size:t=14})=>e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),e.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),e.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),e.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),e.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),X=({size:t=14})=>e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),e.jsx("line",{x1:"12",y1:"2",x2:"12",y2:"22"}),e.jsx("path",{d:"m20 16-4-4 4-4"}),e.jsx("path",{d:"m4 8 4 4-4 4"}),e.jsx("path",{d:"m16 4-4 4-4-4"}),e.jsx("path",{d:"m8 20 4-4 4 4"})]}),G=({isInspectActive:t,pinCount:r,isTrayOpen:a,freezeCountdown:o,onToggleInspect:d,onToggleTray:x,onTriggerFreeze:n,onCopyPrompt:l})=>{const[s,p]=h.useState(!1),[v,f]=h.useState(!1),y=()=>{l(),p(!0),setTimeout(()=>{p(!1)},2200)},i=b=>{b.stopPropagation(),b.preventDefault()};return v||t||a||o!==null?e.jsxs("div",{className:"arc-dock",onPointerDown:i,children:[e.jsxs("div",{className:"arc-brand-pill",children:[e.jsx("span",{className:"arc-brand-dot"}),e.jsx("span",{children:"AgentLens"})]}),e.jsxs("button",{type:"button",className:`arc-btn ${t?"arc-btn-active":""}`,onPointerDown:i,onClick:d,title:"Inspect element (Hotkey: C or Option+C)",children:[e.jsx(A,{size:13}),e.jsx("span",{children:t?"Click Element...":"Pin"})]}),e.jsxs("button",{type:"button",className:`arc-btn ${o!==null?"arc-btn-active":""}`,onPointerDown:i,onClick:n,disabled:o!==null,title:"3s Freeze countdown: open any popover or hover menu before inspection (Hotkey: Option+F)",children:[e.jsx(X,{size:13}),e.jsx("span",{children:o!==null?`Freeze in ${o}s...`:"Freeze (3s)"})]}),e.jsxs("button",{type:"button",className:`arc-btn ${a?"arc-btn-active":""}`,onPointerDown:i,onClick:x,title:"Review active pins",children:[e.jsx(q,{size:13}),e.jsx("span",{children:"Pins"}),e.jsx("span",{className:"arc-badge",children:r})]}),e.jsx("button",{type:"button",className:`arc-btn ${s?"arc-btn-success":"arc-btn-gradient"}`,onPointerDown:i,onClick:y,disabled:r===0,style:{opacity:r===0?.5:1,cursor:r===0?"not-allowed":"pointer"},title:r===0?"Pin an element first":"Copy prompt for AI agent",children:s?e.jsxs(e.Fragment,{children:[e.jsx(V,{size:13}),e.jsx("span",{children:"Copied!"})]}):e.jsxs(e.Fragment,{children:[e.jsx(_,{size:13}),e.jsx("span",{children:"Copy Prompt"})]})}),e.jsx("button",{type:"button",className:"arc-btn-icon",style:{width:"26px",height:"26px"},onPointerDown:i,onClick:()=>f(!1),title:"Collapse to bottom right",children:e.jsx(C,{size:12})})]}):e.jsxs("button",{type:"button",className:"arc-launcher-btn",onPointerDown:i,onClick:()=>f(!0),title:"Open AgentLens (Hotkey: C or Option+C)",children:[e.jsx(K,{size:20}),r>0&&e.jsx("span",{className:"arc-launcher-badge",children:r})]})},U=({isActive:t,onSelectElement:r,shadowHost:a})=>{const[o,d]=h.useState(null),[x,n]=h.useState(null);if(h.useEffect(()=>{if(!t){d(null),n(null);return}const v=i=>{const g=document.elementFromPoint(i.clientX,i.clientY);if(!g||g===document.body||g===document.documentElement){d(null),n(null);return}if(a&&(a.contains(g)||a===g))return;const b=g.getBoundingClientRect();d(b),n(E(g))},f=i=>{a&&(a.contains(i.target)||a===i.target)||(i.preventDefault(),i.stopPropagation(),i.stopImmediatePropagation())},y=i=>{if(a&&(a.contains(i.target)||a===i.target))return;i.preventDefault(),i.stopPropagation(),i.stopImmediatePropagation();const g=document.elementFromPoint(i.clientX,i.clientY);!g||g===document.body||g===document.documentElement||(r(g),d(null),n(null))};return window.addEventListener("pointermove",v,{passive:!0,capture:!0}),window.addEventListener("pointerdown",f,{capture:!0}),window.addEventListener("mousedown",f,{capture:!0}),window.addEventListener("click",y,{capture:!0}),()=>{window.removeEventListener("pointermove",v,!0),window.removeEventListener("pointerdown",f,!0),window.removeEventListener("mousedown",f,!0),window.removeEventListener("click",y,!0)}},[t,a,r]),!t||!o||!x)return null;const l=x.componentName?`<${x.componentName}>`:x.tagName,s=`${Math.round(o.width)}×${Math.round(o.height)}`,p=o.top>32?-26:o.height+6;return e.jsx("div",{className:"arc-inspect-box",style:{top:`${o.top}px`,left:`${o.left}px`,width:`${o.width}px`,height:`${o.height}px`},children:e.jsxs("div",{className:"arc-inspect-label",style:{top:`${p}px`},children:[e.jsx("span",{children:l}),e.jsx("span",{className:"size",children:s})]})})},J=({pin:t,isActive:r,onClick:a})=>{const[o,d]=h.useState(null),x=h.useCallback(()=>{if(!t.targetElement||!t.targetElement.isConnected){d(null);return}const n=t.targetElement.getBoundingClientRect(),l=n.left+Math.min(16,n.width/2),s=n.top+Math.min(16,n.height/2);d({x:l,y:s})},[t.targetElement]);return h.useEffect(()=>{x();const n=()=>x(),l=()=>x();window.addEventListener("scroll",n,{passive:!0,capture:!0}),window.addEventListener("resize",l,{passive:!0});let s=null;return t.targetElement&&typeof ResizeObserver<"u"&&(s=new ResizeObserver(()=>x()),s.observe(t.targetElement)),()=>{window.removeEventListener("scroll",n,!0),window.removeEventListener("resize",l),s==null||s.disconnect()}},[x,t.targetElement]),o?e.jsx("div",{className:`arc-pin-marker ${r?"active":""}`,style:{left:`${o.x}px`,top:`${o.y}px`},onClick:n=>{n.stopPropagation(),a()},title:`Pin #${t.number}: ${t.metadata.componentName||t.metadata.tagName}`,children:t.number}):null},Q=[{id:"style",label:"Style"},{id:"copy",label:"Copy"},{id:"layout",label:"Layout"},{id:"motion",label:"Motion"},{id:"bug",label:"Bug"}],Z=({pin:t,onSave:r,onDelete:a,onClose:o})=>{var g;const[d,x]=h.useState(t.instruction),[n,l]=h.useState(t.category),s=h.useRef(null);h.useEffect(()=>{setTimeout(()=>{var b;(b=s.current)==null||b.focus()},40)},[]);const p=b=>{(b.metaKey||b.ctrlKey)&&b.key==="Enter"?(b.preventDefault(),r(d,n)):b.key==="Escape"&&(b.preventDefault(),o())},v=(g=t.targetElement)==null?void 0:g.getBoundingClientRect(),f=v?Math.min(window.innerHeight-260,Math.max(16,v.top+28)):100,y=v?Math.min(window.innerWidth-340,Math.max(16,v.left+16)):100,i=t.metadata.componentName?`<${t.metadata.componentName}>`:`<${t.metadata.tagName}>`;return e.jsxs("div",{className:"arc-popover",style:{top:`${f}px`,left:`${y}px`},onClick:b=>b.stopPropagation(),children:[e.jsxs("div",{className:"arc-popover-header",children:[e.jsxs("span",{className:"arc-component-badge",title:t.metadata.sourceFile||t.metadata.selector,children:[e.jsxs("span",{children:["#",t.number]}),e.jsx("span",{children:"•"}),e.jsx("span",{children:i})]}),e.jsx("button",{className:"arc-btn-icon",onClick:o,title:"Close",children:e.jsx(C,{size:12})})]}),e.jsx("div",{className:"arc-chips",children:Q.map(b=>e.jsx("button",{type:"button",className:`arc-chip ${n===b.id?"selected":""}`,onClick:()=>l(b.id),children:b.label},b.id))}),e.jsx("textarea",{ref:s,className:"arc-textarea",placeholder:"Instructions for the agent (e.g. increase padding, rounded-full, change copy...)",value:d,onChange:b=>x(b.target.value),onKeyDown:p}),e.jsxs("div",{className:"arc-popover-footer",children:[e.jsx("button",{className:"arc-btn-icon danger",onClick:a,title:"Delete pin",children:e.jsx(H,{size:13})}),e.jsx("div",{style:{display:"flex",gap:"8px"},children:e.jsx("button",{type:"button",className:"arc-btn arc-btn-gradient",onClick:()=>r(d,n),children:"Save Pin"})})]})]})},ee=({pins:t,isOpen:r,onSelectPin:a,onDeletePin:o,onClearAll:d,onClose:x})=>r?e.jsxs("div",{className:"arc-tray",onClick:n=>n.stopPropagation(),children:[e.jsxs("div",{className:"arc-tray-header",children:[e.jsxs("div",{className:"arc-tray-title",children:[e.jsx(A,{size:13}),e.jsx("span",{children:"Active Pins"}),e.jsx("span",{className:"arc-badge",children:t.length})]}),e.jsxs("div",{style:{display:"flex",gap:"6px"},children:[t.length>0&&e.jsx("button",{type:"button",className:"arc-btn",style:{height:"24px",padding:"0 8px",fontSize:"11px"},onClick:d,children:"Clear All"}),e.jsx("button",{type:"button",className:"arc-btn-icon",style:{width:"24px",height:"24px"},onClick:x,children:e.jsx(C,{size:12})})]})]}),e.jsx("div",{className:"arc-tray-list",children:t.length===0?e.jsx("div",{style:{padding:"24px 12px",textAlign:"center",color:"#71717A",fontSize:"12px"},children:"No pins yet. Press “Pin” (or hit C) to inspect an element."}):t.map(n=>{const l=n.metadata.componentName?`<${n.metadata.componentName}>`:`<${n.metadata.tagName}>`;return e.jsxs("div",{className:"arc-tray-item",onClick:()=>{var s;(s=n.targetElement)==null||s.scrollIntoView({behavior:"smooth",block:"center"}),a(n)},children:[e.jsxs("div",{className:"arc-tray-item-left",children:[e.jsx("div",{className:"arc-tray-pin-num",children:n.number}),e.jsxs("div",{className:"arc-tray-item-content",children:[e.jsxs("div",{className:"arc-tray-item-meta",children:[l," • ",n.metadata.sourceFile||n.metadata.selector]}),e.jsx("div",{className:"arc-tray-item-text",children:n.instruction||e.jsx("em",{children:"(No instruction provided)"})})]})]}),e.jsx("button",{type:"button",className:"arc-btn-icon",style:{width:"24px",height:"24px",flexShrink:0},onClick:s=>{s.stopPropagation(),o(n.id)},title:"Delete pin",children:e.jsx(C,{size:11})})]},n.id)})})]}):null,te=({defaultCategory:t="style",onPromptCopied:r})=>{const[a,o]=h.useState(null),[d,x]=h.useState(null),[n,l]=h.useState([]),[s,p]=h.useState(null),[v,f]=h.useState(!1),[y,i]=h.useState(!1),[g,b]=h.useState(null),F=h.useRef(null);h.useEffect(()=>{const c=document.getElementById("agent-lens-host");c&&c.remove();const u=document.createElement("div");u.id="agent-lens-host",document.body.appendChild(u);const m=u.attachShadow({mode:"open"}),w=document.createElement("style");w.textContent=Y,m.appendChild(w);const k=document.createElement("div");return k.style.position="relative",k.style.zIndex="2147483647",m.appendChild(k),o(u),x(k),()=>{u.remove()}},[]),h.useEffect(()=>{if(!a)return;const c=u=>{const m=u.target;a&&(a.contains(m)||a===m)&&(u.stopPropagation(),u.stopImmediatePropagation())};return window.addEventListener("pointerdown",c,{capture:!0}),window.addEventListener("mousedown",c,{capture:!0}),()=>{window.removeEventListener("pointerdown",c,!0),window.removeEventListener("mousedown",c,!0)}},[a]),h.useEffect(()=>{const c=u=>{const m=document.activeElement,w=(m==null?void 0:m.tagName)==="INPUT"||(m==null?void 0:m.tagName)==="TEXTAREA"||(m==null?void 0:m.isContentEditable),k=u.altKey;if(k&&u.key.toLowerCase()==="c"){u.preventDefault(),f(j=>!j);return}if(k&&u.key.toLowerCase()==="f"){u.preventDefault(),S();return}!w&&u.key.toLowerCase()==="c"&&!u.metaKey&&!u.ctrlKey&&!u.altKey?(u.preventDefault(),f(j=>!j)):u.key==="Escape"&&(F.current&&(clearInterval(F.current),F.current=null,b(null)),f(!1),p(null),i(!1))};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[]);const S=h.useCallback(()=>{F.current&&clearInterval(F.current),b(3);let c=3;F.current=setInterval(()=>{c-=1,c>0?b(c):(F.current&&(clearInterval(F.current),F.current=null),b(null),f(!0))},1e3)},[]),L=h.useCallback(c=>{const u=E(c),m=n.length+1,w=`pin-${Date.now()}`,k={id:w,number:m,targetElement:c,category:t,instruction:"",createdAt:Date.now(),metadata:u};l(j=>[...j,k]),p(w),f(!1)},[n.length,t]),z=h.useCallback((c,u)=>{l(m=>m.map(w=>w.id===s?{...w,instruction:c,category:u}:w)),p(null)},[s]),$=h.useCallback(c=>{l(u=>u.filter(w=>w.id!==c).map((w,k)=>({...w,number:k+1}))),p(u=>u===c?null:u)},[]),D=h.useCallback(()=>{l([]),p(null),i(!1)},[]),I=h.useCallback(()=>{if(n.length===0)return;const c=P(n);navigator.clipboard.writeText(c),r==null||r(c,n.length)},[n,r]);if(!d)return null;const N=n.find(c=>c.id===s);return T.createPortal(e.jsxs(e.Fragment,{children:[e.jsx(U,{isActive:v,onSelectElement:L,shadowHost:a}),n.map(c=>e.jsx(J,{pin:c,isActive:c.id===s,onClick:()=>{p(u=>u===c.id?null:c.id)}},c.id)),N&&e.jsx(Z,{pin:N,onSave:z,onDelete:()=>$(N.id),onClose:()=>p(null)}),e.jsx(ee,{pins:n,isOpen:y,onSelectPin:c=>p(c.id),onDeletePin:$,onClearAll:D,onClose:()=>i(!1)}),e.jsx(G,{isInspectActive:v,pinCount:n.length,isTrayOpen:y,freezeCountdown:g,onToggleInspect:()=>f(c=>!c),onToggleTray:()=>i(c=>!c),onTriggerFreeze:S,onCopyPrompt:I})]}),d)};exports.AgentLens=te;exports.compileAgentPrompt=P;exports.extractElementMetadata=E;
|