@vite-plugin-opencode-assistant/components 1.0.33 → 1.0.35
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/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/open-code-widget/composables/use-inspector.js +144 -239
- package/es/open-code-widget/src/components/Trigger-sfc.css +1 -1
- package/lib/@vite-plugin-opencode-assistant/components.cjs.js +127 -216
- package/lib/@vite-plugin-opencode-assistant/components.es.js +127 -216
- package/lib/components.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/open-code-widget/composables/use-inspector.js +144 -239
- package/lib/open-code-widget/src/components/Trigger-sfc.css +1 -1
- package/lib/web-types.json +1 -1
- package/package.json +2 -2
|
@@ -33,23 +33,17 @@ module.exports = __toCommonJS(use_inspector_exports);
|
|
|
33
33
|
var import_vue = require("vue");
|
|
34
34
|
var import_shared = require("@vite-plugin-opencode-assistant/shared");
|
|
35
35
|
var import_css_selector_generator = __toESM(require("css-selector-generator"));
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
lastCall = performance.now();
|
|
48
|
-
fn(...args);
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
}
|
|
36
|
+
const IGNORE_SELECTORS = [
|
|
37
|
+
"#vue-inspector-container",
|
|
38
|
+
".opencode-widget",
|
|
39
|
+
".opencode-element-highlight",
|
|
40
|
+
".opencode-element-tooltip",
|
|
41
|
+
".opencode-select-mode-hint",
|
|
42
|
+
".floating-bubble"
|
|
43
|
+
];
|
|
44
|
+
const IGNORE_ATTRIBUTE = "data-v-inspector-ignore";
|
|
45
|
+
const KEY_PROPS_DATA = "__v_inspector";
|
|
46
|
+
const KEY_DATA = "data-v-inspector";
|
|
53
47
|
function getDirectText(element) {
|
|
54
48
|
let text = "";
|
|
55
49
|
for (let i = 0; i < element.childNodes.length; i++) {
|
|
@@ -98,74 +92,27 @@ function isStateClass(className) {
|
|
|
98
92
|
}
|
|
99
93
|
return false;
|
|
100
94
|
}
|
|
101
|
-
function filterStateClasses(classes) {
|
|
102
|
-
return classes.filter((cls) => !isStateClass(cls));
|
|
103
|
-
}
|
|
104
95
|
function getElementDescription(element) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
return isDynamicId(idMatch[1]);
|
|
117
|
-
}
|
|
118
|
-
const classMatch = selectorValue.match(/^\.([a-zA-Z_-][\w-]*)$/);
|
|
119
|
-
if (classMatch) {
|
|
120
|
-
return isStateClass(classMatch[1]);
|
|
121
|
-
}
|
|
122
|
-
return false;
|
|
96
|
+
return (0, import_css_selector_generator.default)(element, {
|
|
97
|
+
selectors: ["id", "class", "tag", "nthchild"],
|
|
98
|
+
combineWithinSelector: true,
|
|
99
|
+
combineBetweenSelectors: true,
|
|
100
|
+
maxCombinations: 100,
|
|
101
|
+
maxCandidates: 100,
|
|
102
|
+
blacklist: [
|
|
103
|
+
(selectorValue) => {
|
|
104
|
+
const idMatch = selectorValue.match(/^#(.+)$/);
|
|
105
|
+
if (idMatch) {
|
|
106
|
+
return isDynamicId(idMatch[1]);
|
|
123
107
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
const parts = [tag];
|
|
130
|
-
const id = element.id;
|
|
131
|
-
if (id && !isDynamicId(id)) parts.push(`#${id}`);
|
|
132
|
-
const className = element.className;
|
|
133
|
-
if (typeof className === "string") {
|
|
134
|
-
const classes = filterStateClasses(className.trim().split(/\s+/).filter(Boolean)).slice(0, 2);
|
|
135
|
-
if (classes.length > 0) parts.push(`.${classes.join(".")}`);
|
|
136
|
-
} else {
|
|
137
|
-
const svgClass = className.baseVal;
|
|
138
|
-
if (svgClass) {
|
|
139
|
-
const classes = filterStateClasses(svgClass.trim().split(/\s+/).filter(Boolean)).slice(
|
|
140
|
-
0,
|
|
141
|
-
2
|
|
142
|
-
);
|
|
143
|
-
if (classes.length > 0) parts.push(`.${classes.join(".")}`);
|
|
108
|
+
const classMatch = selectorValue.match(/^\.([a-zA-Z_-][\w-]*)$/);
|
|
109
|
+
if (classMatch) {
|
|
110
|
+
return isStateClass(classMatch[1]);
|
|
111
|
+
}
|
|
112
|
+
return false;
|
|
144
113
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
if (name) parts.push(`[name="${name}"]`);
|
|
148
|
-
const placeholder = element.getAttribute("placeholder");
|
|
149
|
-
if (placeholder) parts.push(`[placeholder="${placeholder.substring(0, 20)}"]`);
|
|
150
|
-
const src = element.getAttribute("src");
|
|
151
|
-
if (src) parts.push(`[src]`);
|
|
152
|
-
const href = element.getAttribute("href");
|
|
153
|
-
if (href && href !== "#") parts.push(`[href]`);
|
|
154
|
-
return parts.join("");
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
function getFileInfoFromAttributes(element) {
|
|
158
|
-
const file = element.getAttribute("data-v-inspector-file");
|
|
159
|
-
if (file) {
|
|
160
|
-
const line = element.getAttribute("data-v-inspector-line");
|
|
161
|
-
const column = element.getAttribute("data-v-inspector-column");
|
|
162
|
-
return {
|
|
163
|
-
file,
|
|
164
|
-
line: line ? parseInt(line, 10) : null,
|
|
165
|
-
column: column ? parseInt(column, 10) : null
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
return null;
|
|
114
|
+
]
|
|
115
|
+
});
|
|
169
116
|
}
|
|
170
117
|
function getFileInfoFromVueInstance(element) {
|
|
171
118
|
var _a, _b, _c, _d;
|
|
@@ -193,61 +140,83 @@ function getFileInfoFromVueInstance(element) {
|
|
|
193
140
|
}
|
|
194
141
|
return null;
|
|
195
142
|
}
|
|
196
|
-
function
|
|
143
|
+
function shouldIgnoreElement(el) {
|
|
144
|
+
if (el.hasAttribute(IGNORE_ATTRIBUTE)) return true;
|
|
145
|
+
for (const selector of IGNORE_SELECTORS) {
|
|
146
|
+
if (el.closest(selector)) return true;
|
|
147
|
+
}
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
function getDataFromElement(el) {
|
|
197
151
|
var _a, _b;
|
|
152
|
+
const vnodeData = (_b = (_a = el.__vnode) == null ? void 0 : _a.props) == null ? void 0 : _b[KEY_PROPS_DATA];
|
|
153
|
+
if (vnodeData) return vnodeData;
|
|
154
|
+
const attr = el.getAttribute(KEY_DATA);
|
|
155
|
+
return attr != null ? attr : void 0;
|
|
156
|
+
}
|
|
157
|
+
function findInspectorFileInfo(element) {
|
|
198
158
|
let current = element;
|
|
199
|
-
let fallbackFileInfo = null;
|
|
200
159
|
while (current) {
|
|
201
|
-
const
|
|
202
|
-
if (
|
|
203
|
-
|
|
160
|
+
const data = getDataFromElement(current);
|
|
161
|
+
if (data) {
|
|
162
|
+
const splitRE = /(.+):([\d]+):([\d]+)$/;
|
|
163
|
+
const match = data.match(splitRE);
|
|
164
|
+
if (match) {
|
|
165
|
+
return {
|
|
166
|
+
file: match[1],
|
|
167
|
+
line: parseInt(match[2], 10),
|
|
168
|
+
column: parseInt(match[3], 10)
|
|
169
|
+
};
|
|
170
|
+
}
|
|
204
171
|
}
|
|
205
|
-
|
|
206
|
-
|
|
172
|
+
current = current.parentElement;
|
|
173
|
+
}
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
function mergeFileInfo(inspectorFileInfo, vueFileInfo) {
|
|
177
|
+
if (!(inspectorFileInfo == null ? void 0 : inspectorFileInfo.file) && !(vueFileInfo == null ? void 0 : vueFileInfo.file)) {
|
|
178
|
+
return { file: null, line: null, column: null };
|
|
179
|
+
}
|
|
180
|
+
const isNodeModules = (path) => path.includes("node_modules");
|
|
181
|
+
if ((inspectorFileInfo == null ? void 0 : inspectorFileInfo.file) && (vueFileInfo == null ? void 0 : vueFileInfo.file)) {
|
|
182
|
+
if (!isNodeModules(inspectorFileInfo.file)) {
|
|
183
|
+
return inspectorFileInfo;
|
|
184
|
+
} else if (!isNodeModules(vueFileInfo.file)) {
|
|
185
|
+
return vueFileInfo;
|
|
186
|
+
} else {
|
|
187
|
+
return inspectorFileInfo;
|
|
207
188
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
189
|
+
} else if (inspectorFileInfo == null ? void 0 : inspectorFileInfo.file) {
|
|
190
|
+
return inspectorFileInfo;
|
|
191
|
+
} else {
|
|
192
|
+
return vueFileInfo;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
function getTargetElement(e) {
|
|
196
|
+
if (!e.target || !(e.target instanceof Element)) return null;
|
|
197
|
+
const el = e.target;
|
|
198
|
+
if (shouldIgnoreElement(el)) return null;
|
|
199
|
+
return el;
|
|
200
|
+
}
|
|
201
|
+
function getFileInfo(e, element) {
|
|
202
|
+
var _a, _b;
|
|
203
|
+
const inspector = window.__VUE_INSPECTOR__;
|
|
204
|
+
let inspectorFileInfo = null;
|
|
205
|
+
if (inspector) {
|
|
206
|
+
const { targetNode, params } = inspector.getTargetNode(e);
|
|
207
|
+
if (targetNode && params && params.file) {
|
|
208
|
+
inspectorFileInfo = {
|
|
217
209
|
file: params.file,
|
|
218
210
|
line: (_a = params.line) != null ? _a : null,
|
|
219
211
|
column: (_b = params.column) != null ? _b : null
|
|
220
212
|
};
|
|
221
|
-
if (info.line !== null) {
|
|
222
|
-
return info;
|
|
223
|
-
}
|
|
224
|
-
if (!fallbackFileInfo) {
|
|
225
|
-
fallbackFileInfo = info;
|
|
226
|
-
}
|
|
227
213
|
}
|
|
228
|
-
const vueInfo = getFileInfoFromVueInstance(current);
|
|
229
|
-
if (vueInfo && !fallbackFileInfo) {
|
|
230
|
-
fallbackFileInfo = vueInfo;
|
|
231
|
-
}
|
|
232
|
-
current = current.parentElement;
|
|
233
214
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
function getPreciseElementAtPoint(x, y, boundary) {
|
|
237
|
-
const elements = document.elementsFromPoint(x, y);
|
|
238
|
-
for (const el of elements) {
|
|
239
|
-
if (el.closest("#vue-inspector-container")) continue;
|
|
240
|
-
if (el.closest(".opencode-widget")) continue;
|
|
241
|
-
if (el.hasAttribute("data-v-inspector-ignore")) continue;
|
|
242
|
-
if (boundary) {
|
|
243
|
-
if (boundary.contains(el) || el === boundary) {
|
|
244
|
-
return el;
|
|
245
|
-
}
|
|
246
|
-
} else {
|
|
247
|
-
return el;
|
|
248
|
-
}
|
|
215
|
+
if (element && !inspectorFileInfo) {
|
|
216
|
+
inspectorFileInfo = findInspectorFileInfo(element);
|
|
249
217
|
}
|
|
250
|
-
|
|
218
|
+
const vueFileInfo = element ? getFileInfoFromVueInstance(element) : null;
|
|
219
|
+
return mergeFileInfo(inspectorFileInfo, vueFileInfo);
|
|
251
220
|
}
|
|
252
221
|
function useInspector(options) {
|
|
253
222
|
const highlightVisible = (0, import_vue.ref)(false);
|
|
@@ -262,84 +231,50 @@ function useInspector(options) {
|
|
|
262
231
|
const tooltipContent = (0, import_vue.ref)({ description: "", fileInfo: "" });
|
|
263
232
|
const INSPECTOR_CHECK_INTERVAL = 500;
|
|
264
233
|
let inspectorCheckTimer = null;
|
|
265
|
-
let currentHighlightElement = null;
|
|
266
|
-
let currentFileInfo = { file: null, line: null, column: null };
|
|
267
234
|
let currentPrimary = "#3b82f6";
|
|
268
235
|
let currentPrimaryBg = "rgba(59, 130, 246, 0.1)";
|
|
269
|
-
|
|
270
|
-
|
|
236
|
+
function setPointerEventsNone(elements) {
|
|
237
|
+
elements.forEach((el) => {
|
|
238
|
+
if (el) el.style.pointerEvents = "none";
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
function setPointerEventsAuto(elements) {
|
|
242
|
+
elements.forEach((el) => {
|
|
243
|
+
if (el) el.style.pointerEvents = "";
|
|
244
|
+
});
|
|
245
|
+
}
|
|
271
246
|
function handleMouseMoveCore(e) {
|
|
272
|
-
var _a, _b;
|
|
273
247
|
if (!options.selectMode.value) return;
|
|
274
|
-
const inspector = window.__VUE_INSPECTOR__;
|
|
275
248
|
const highlight = document.querySelector(".opencode-element-highlight");
|
|
276
249
|
const tooltip = document.querySelector(".opencode-element-tooltip");
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
const result = inspector.getTargetNode(e);
|
|
285
|
-
targetNode = result.targetNode;
|
|
286
|
-
const params = result.params;
|
|
287
|
-
if (targetNode) {
|
|
288
|
-
const preciseElement = getPreciseElementAtPoint(e.clientX, e.clientY, targetNode);
|
|
289
|
-
elementToHighlight = preciseElement || targetNode;
|
|
290
|
-
if (params && params.file) {
|
|
291
|
-
fileInfo = {
|
|
292
|
-
file: params.file,
|
|
293
|
-
line: (_a = params.line) != null ? _a : null,
|
|
294
|
-
column: (_b = params.column) != null ? _b : null
|
|
295
|
-
};
|
|
296
|
-
} else {
|
|
297
|
-
fileInfo = findFileInfo(targetNode, inspector);
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
if (!elementToHighlight) {
|
|
302
|
-
elementToHighlight = getPreciseElementAtPoint(e.clientX, e.clientY, null);
|
|
303
|
-
}
|
|
304
|
-
if (elementToHighlight && !fileInfo.file) {
|
|
305
|
-
fileInfo = getFileInfoFromVueInstance(elementToHighlight) || fileInfo;
|
|
306
|
-
}
|
|
307
|
-
} finally {
|
|
308
|
-
if (highlight) highlight.style.pointerEvents = "";
|
|
309
|
-
if (tooltip) tooltip.style.pointerEvents = "";
|
|
310
|
-
}
|
|
250
|
+
const selectHint = document.querySelector(".opencode-select-mode-hint");
|
|
251
|
+
const floatingBubble = document.querySelector(".floating-bubble");
|
|
252
|
+
const uiElements = [highlight, tooltip, selectHint, floatingBubble];
|
|
253
|
+
setPointerEventsNone(uiElements);
|
|
254
|
+
const elementToHighlight = getTargetElement(e);
|
|
255
|
+
const fileInfo = getFileInfo(e, elementToHighlight);
|
|
256
|
+
setPointerEventsAuto(uiElements);
|
|
311
257
|
if (elementToHighlight) {
|
|
312
|
-
const
|
|
313
|
-
if (
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
if (widget) {
|
|
318
|
-
const style = getComputedStyle(widget);
|
|
319
|
-
currentPrimary = style.getPropertyValue("--oc-primary").trim() || currentPrimary;
|
|
320
|
-
currentPrimaryBg = style.getPropertyValue("--oc-primary-bg").trim() || currentPrimaryBg;
|
|
321
|
-
}
|
|
322
|
-
currentDescription = getElementDescription(elementToHighlight);
|
|
323
|
-
} else if (!currentFileInfo.file && fileInfo.file) {
|
|
324
|
-
currentFileInfo = fileInfo;
|
|
258
|
+
const widget = document.querySelector(".opencode-widget");
|
|
259
|
+
if (widget) {
|
|
260
|
+
const style = getComputedStyle(widget);
|
|
261
|
+
currentPrimary = style.getPropertyValue("--oc-primary").trim() || currentPrimary;
|
|
262
|
+
currentPrimaryBg = style.getPropertyValue("--oc-primary-bg").trim() || currentPrimaryBg;
|
|
325
263
|
}
|
|
326
|
-
const
|
|
264
|
+
const description = getElementDescription(elementToHighlight);
|
|
265
|
+
const fileName = fileInfo.file ? fileInfo.file.split("/").pop() : "";
|
|
327
266
|
let lineInfo = "";
|
|
328
|
-
if (
|
|
329
|
-
lineInfo = `:${
|
|
330
|
-
if (
|
|
331
|
-
lineInfo += `:${
|
|
267
|
+
if (fileInfo.line) {
|
|
268
|
+
lineInfo = `:${fileInfo.line}`;
|
|
269
|
+
if (fileInfo.column) {
|
|
270
|
+
lineInfo += `:${fileInfo.column}`;
|
|
332
271
|
}
|
|
333
272
|
}
|
|
334
|
-
const
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
description: currentDescription,
|
|
340
|
-
fileInfo: currentFileInfoText
|
|
341
|
-
};
|
|
342
|
-
}
|
|
273
|
+
const fileInfoText = fileName ? `${fileName}${lineInfo}` : "";
|
|
274
|
+
tooltipContent.value = {
|
|
275
|
+
description,
|
|
276
|
+
fileInfo: fileInfoText
|
|
277
|
+
};
|
|
343
278
|
const rect = elementToHighlight.getBoundingClientRect();
|
|
344
279
|
const newTop = `${rect.top}px`;
|
|
345
280
|
const newLeft = `${rect.left}px`;
|
|
@@ -357,13 +292,20 @@ function useInspector(options) {
|
|
|
357
292
|
}
|
|
358
293
|
const tooltipHeight = 50;
|
|
359
294
|
const tooltipWidth = 200;
|
|
295
|
+
const margin = 10;
|
|
360
296
|
let tooltipTop = rect.top - tooltipHeight - 8;
|
|
361
297
|
let tooltipLeft = rect.left;
|
|
362
|
-
if (tooltipTop <
|
|
298
|
+
if (tooltipTop < margin) {
|
|
363
299
|
tooltipTop = rect.bottom + 8;
|
|
364
300
|
}
|
|
365
|
-
if (
|
|
366
|
-
|
|
301
|
+
if (tooltipTop + tooltipHeight > window.innerHeight - margin) {
|
|
302
|
+
tooltipTop = Math.max(margin, rect.top - tooltipHeight - 8);
|
|
303
|
+
}
|
|
304
|
+
if (tooltipLeft < margin) {
|
|
305
|
+
tooltipLeft = margin;
|
|
306
|
+
}
|
|
307
|
+
if (tooltipLeft + tooltipWidth > window.innerWidth - margin) {
|
|
308
|
+
tooltipLeft = window.innerWidth - tooltipWidth - margin;
|
|
367
309
|
}
|
|
368
310
|
const newTooltipTop = `${tooltipTop}px`;
|
|
369
311
|
const newTooltipLeft = `${tooltipLeft}px`;
|
|
@@ -373,57 +315,24 @@ function useInspector(options) {
|
|
|
373
315
|
left: newTooltipLeft
|
|
374
316
|
};
|
|
375
317
|
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
}
|
|
379
|
-
if (!tooltipVisible.value) {
|
|
380
|
-
tooltipVisible.value = true;
|
|
381
|
-
}
|
|
318
|
+
highlightVisible.value = true;
|
|
319
|
+
tooltipVisible.value = true;
|
|
382
320
|
} else {
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
currentFileInfoText = "";
|
|
386
|
-
currentFileInfo = { file: null, line: null, column: null };
|
|
387
|
-
if (highlightVisible.value) {
|
|
388
|
-
highlightVisible.value = false;
|
|
389
|
-
}
|
|
390
|
-
if (tooltipVisible.value) {
|
|
391
|
-
tooltipVisible.value = false;
|
|
392
|
-
}
|
|
321
|
+
highlightVisible.value = false;
|
|
322
|
+
tooltipVisible.value = false;
|
|
393
323
|
}
|
|
394
324
|
}
|
|
395
|
-
const handleMouseMove =
|
|
325
|
+
const handleMouseMove = handleMouseMoveCore;
|
|
396
326
|
function setupInspectorHook() {
|
|
397
327
|
const inspector = window.__VUE_INSPECTOR__;
|
|
398
328
|
if (!inspector || inspector.__opencode_hooked) return;
|
|
399
329
|
const originalHandleClick = inspector.handleClick.bind(inspector);
|
|
400
330
|
inspector.handleClick = function(e) {
|
|
401
|
-
var _a, _b;
|
|
402
331
|
if (options.selectMode.value) {
|
|
403
332
|
e.preventDefault();
|
|
404
333
|
e.stopPropagation();
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
const { targetNode, params } = inspector.getTargetNode(e);
|
|
408
|
-
if (targetNode) {
|
|
409
|
-
const preciseElement = getPreciseElementAtPoint(e.clientX, e.clientY, targetNode);
|
|
410
|
-
elementToSelect = preciseElement || targetNode;
|
|
411
|
-
if (params && params.file) {
|
|
412
|
-
fileInfo = {
|
|
413
|
-
file: params.file,
|
|
414
|
-
line: (_a = params.line) != null ? _a : null,
|
|
415
|
-
column: (_b = params.column) != null ? _b : null
|
|
416
|
-
};
|
|
417
|
-
} else if (elementToSelect) {
|
|
418
|
-
fileInfo = findFileInfo(elementToSelect, inspector);
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
if (!elementToSelect) {
|
|
422
|
-
elementToSelect = getPreciseElementAtPoint(e.clientX, e.clientY, null);
|
|
423
|
-
}
|
|
424
|
-
if (elementToSelect && !fileInfo.file) {
|
|
425
|
-
fileInfo = getFileInfoFromVueInstance(elementToSelect) || fileInfo;
|
|
426
|
-
}
|
|
334
|
+
const elementToSelect = getTargetElement(e);
|
|
335
|
+
const fileInfo = getFileInfo(e, elementToSelect);
|
|
427
336
|
if (elementToSelect) {
|
|
428
337
|
const innerText = getDirectText(elementToSelect);
|
|
429
338
|
const description = getElementDescription(elementToSelect);
|
|
@@ -463,10 +372,6 @@ function useInspector(options) {
|
|
|
463
372
|
}
|
|
464
373
|
document.removeEventListener("mousemove", handleMouseMove);
|
|
465
374
|
document.removeEventListener("keydown", handleKeydown, true);
|
|
466
|
-
currentHighlightElement = null;
|
|
467
|
-
currentDescription = "";
|
|
468
|
-
currentFileInfoText = "";
|
|
469
|
-
currentFileInfo = { file: null, line: null, column: null };
|
|
470
375
|
highlightVisible.value = false;
|
|
471
376
|
tooltipVisible.value = false;
|
|
472
377
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.opencode-button{width:42px;height:42px;border-radius:50%;background:#fff;border:none;cursor:pointer;box-shadow:0 4px 12px rgba(102,126,234,.4);transition:all .3s ease;display:flex;align-items:center;justify-content:center;padding:0;position:relative}.opencode-button svg{transform:rotate(180deg) scale(1.1);transition:transform .3s ease;width:100%;height:100%;display:block}.opencode-button:hover svg{transform:rotate(180deg) scale(1.1)}.opencode-button:hover{transform:scale(1.1);box-shadow:0 6px 16px rgba(102,126,234,.5)}.opencode-button.thinking{background:linear-gradient(135deg,#667eea,#764ba2);animation:thinking-glow
|
|
1
|
+
.opencode-button{width:42px;height:42px;border-radius:50%;background:#fff;border:none;cursor:pointer;box-shadow:0 4px 12px rgba(102,126,234,.4);transition:all .3s ease;display:flex;align-items:center;justify-content:center;padding:0;position:relative}.opencode-button svg{transform:rotate(180deg) scale(1.1);transition:transform .3s ease;width:100%;height:100%;display:block}.opencode-button:hover svg{transform:rotate(180deg) scale(1.1)}.opencode-button:hover{transform:scale(1.1);box-shadow:0 6px 16px rgba(102,126,234,.5)}.opencode-button.thinking{background:linear-gradient(135deg,#667eea,#764ba2);animation:thinking-glow 2s ease-in-out infinite,thinking-pulse 2s ease-in-out infinite;box-shadow:0 0 20px rgba(102,126,234,.6),0 0 40px rgba(118,75,162,.4),0 0 60px rgba(102,126,234,.2)}.opencode-button.thinking svg path{fill:#fff}.opencode-button.thinking:before{content:"";position:absolute;top:-2px;right:-2px;bottom:-2px;left:-2px;border-radius:50%;background:linear-gradient(135deg,#8b9cf5,#9d6bc7);z-index:-1}.opencode-button.thinking:after{content:"";position:absolute;top:-3px;right:-3px;bottom:-3px;left:-3px;border-radius:50%;background:conic-gradient(from 180deg,transparent,rgba(102,126,234,.3),transparent,rgba(118,75,162,.3),transparent);z-index:-2;animation:thinking-rotate 2s linear infinite reverse;filter:blur(8px)}@keyframes thinking-glow{0%,to{box-shadow:0 0 20px rgba(102,126,234,.6),0 0 40px rgba(118,75,162,.4),0 0 60px rgba(102,126,234,.2)}50%{box-shadow:0 0 30px rgba(102,126,234,.8),0 0 60px rgba(118,75,162,.6),0 0 90px rgba(102,126,234,.3)}}@keyframes thinking-rotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes thinking-pulse{0%,to{transform:scale(1)}50%{transform:scale(.92)}}.opencode-button.opencode-theme-dark{background:linear-gradient(135deg,#667eea,#764ba2);box-shadow:0 4px 12px rgba(102,126,234,.3)}.opencode-button.opencode-theme-dark:before{content:"";position:absolute;top:-2px;right:-2px;bottom:-2px;left:-2px;border-radius:50%;background:linear-gradient(135deg,#8b9cf5,#9d6bc7);z-index:-1}.opencode-button.opencode-theme-dark:hover{box-shadow:0 6px 16px rgba(102,126,234,.4)}.opencode-button.opencode-theme-dark svg path{fill:#fff}
|
package/lib/web-types.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$schema":"https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json","framework":"vue","name":"@vite-plugin-opencode-assistant/components","version":"1.0.
|
|
1
|
+
{"$schema":"https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json","framework":"vue","name":"@vite-plugin-opencode-assistant/components","version":"1.0.35","contributions":{"html":{"tags":[{"name":"open-code","attributes":[{"name":"","default":"`'bottom-right'`","description":"挂件显示的位置","value":{"type":"`'bottom-right' | 'bottom-left' | 'top-right' | 'top-left'`","kind":"expression"}},{"name":"","default":"`false`","description":"挂件是否打开","value":{"type":"`boolean`","kind":"expression"}},{"name":"","default":"`'auto'`","description":"主题模式","value":{"type":"`'light' | 'dark' | 'auto'`","kind":"expression"}},{"name":"","default":"`'AI 助手'`","description":"助手头部显示的标题","value":{"type":"`string`","kind":"expression"}},{"name":"","default":"`'Ctrl+K'`","description":"快捷键提示文本","value":{"type":"`string`","kind":"expression"}},{"name":"","default":"`'按 ESC 或 Ctrl+P 退出'`","description":"选择模式快捷键提示文本","value":{"type":"`string`","kind":"expression"}},{"name":"","default":"`false`","description":"是否进入选择页面元素模式","value":{"type":"`boolean`","kind":"expression"}},{"name":"","default":"`true`","description":"会话列表是否折叠","value":{"type":"`boolean`","kind":"expression"}},{"name":"","default":"`'id'`","description":"会话列表项的唯一键字段","value":{"type":"`string`","kind":"expression"}},{"name":"","default":"`false`","description":"iframe 是否显示加载状态","value":{"type":"`boolean`","kind":"expression"}},{"name":"","default":"`undefined`","description":"会话列表是否加载中","value":{"type":"`boolean`","kind":"expression"}},{"name":"","default":"`false`","description":"是否显示会话列表骨架屏","value":{"type":"`boolean`","kind":"expression"}},{"name":"","default":"`false`","description":"是否显示空状态","value":{"type":"`boolean`","kind":"expression"}},{"name":"","default":"`false`","description":"是否显示错误状态","value":{"type":"`boolean`","kind":"expression"}},{"name":"","default":"`'当前项目暂无会话'`","description":"空状态显示的文本","value":{"type":"`string`","kind":"expression"}},{"name":"","default":"`'立即创建'`","description":"空状态操作按钮文本","value":{"type":"`string`","kind":"expression"}},{"name":"","default":"`''`","description":"Web UI 的 URL 来源","value":{"type":"`string`","kind":"expression"}},{"name":"","default":"`[]`","description":"会话列表数据","value":{"type":"`OpenCodeWidgetSession[]`","kind":"expression"}},{"name":"","default":"`null`","description":"当前选中的会话 ID","value":{"type":"`string | null`","kind":"expression"}},{"name":"","default":"`[]`","description":"已选中的元素列表","value":{"type":"`OpenCodeSelectedElement[]`","kind":"expression"}},{"name":"","default":"`true`","description":"是否显示\"一键清空\"按钮","value":{"type":"`boolean`","kind":"expression"}},{"name":"","default":"`true`","description":"是否启用选择模式","value":{"type":"`boolean`","kind":"expression"}},{"name":"","default":"`false`","description":"是否显示思考状态(加载中)","value":{"type":"`boolean`","kind":"expression"}}],"events":[{"name":"`update:open`","description":"当挂件打开或关闭时触发","arguments":[{"name":"open","type":"en"},{"name":"boolean"}]},{"name":"`update:selectMode`","description":"当选择模式切换时触发","arguments":[{"name":"mode","type":"de"},{"name":"boolean"}]},{"name":"`update:sessionListCollapsed`","description":"当会话列表折叠状态改变时触发","arguments":[{"name":"collapsed","type":"ed"},{"name":"boolean"}]},{"name":"`update:currentSessionId`","description":"当选中的会话 ID 改变时触发","arguments":[{"name":"sessionId","type":"Id"},{"name":"string | null"}]},{"name":"`update:selectedElements`","description":"当已选中的元素列表改变时触发","arguments":[{"name":"elements","type":"ts"},{"name":"OpenCodeSelectedElement[]"}]},{"name":"`update:theme`","description":"当主题模式改变时触发","arguments":[{"name":"theme","type":"me"},{"name":"'light' | 'dark' | 'auto'"}]},{"name":"`update:thinking`","description":"当思考状态改变时触发","arguments":[{"name":"thinking","type":"ng"},{"name":"boolean"}]},{"name":"","description":"点击触发挂件开关","arguments":[{"name":"open","type":"en"},{"name":"boolean"}]},{"name":"","description":"点击关闭按钮时触发","arguments":[]},{"name":"`toggle-session-list`","description":"点击会话列表切换按钮时触发","arguments":[{"name":"collapsed","type":"ed"},{"name":"boolean"}]},{"name":"`toggle-select-mode`","description":"点击选择模式切换按钮时触发","arguments":[{"name":"mode","type":"de"},{"name":"boolean"}]},{"name":"`toggle-theme`","description":"点击主题切换按钮时触发","arguments":[{"name":"theme","type":"me"},{"name":"'light' | 'dark' | 'auto'"}]},{"name":"`create-session`","description":"点击创建新会话时触发","arguments":[]},{"name":"`select-session`","description":"选中某个历史会话时触发","arguments":[{"name":"session","type":"on"},{"name":"OpenCodeWidgetSession"}]},{"name":"`delete-session`","description":"删除某个历史会话时触发","arguments":[{"name":"session","type":"on"},{"name":"OpenCodeWidgetSession"}]},{"name":"`click-selected-node`","description":"点击已选中的气泡或节点卡片时触发","arguments":[{"name":"element","type":"nt"},{"name":"OpenCodeSelectedElement"}]},{"name":"`remove-selected-node`","description":"删除已选中的元素时触发","arguments":[{"name":"payload","type":"ad"},{"name":"OpenCodeRemoveSelectedPayload"}]},{"name":"`clear-selected-nodes`","description":"清空所有选中元素时触发","arguments":[]},{"name":"`empty-action`","description":"点击空状态操作按钮时触发","arguments":[]},{"name":"`frame-loaded`","description":"iframe 加载完成时触发","arguments":[]},{"name":"`thinking-change`","description":"思考状态改变时触发(用于显示加载动画)","arguments":[{"name":"thinking","type":"ng"},{"name":"boolean"}]}],"slots":[{"name":"`button-icon`","description":"自定义触发按钮图标"},{"name":"`session-toggle-icon`","description":"自定义会话列表切换图标"},{"name":"`select-icon`","description":"自定义选择模式切换图标"},{"name":"`close-icon`","description":"自定义关闭按钮图标"},{"name":"`theme-icon`","description":"自定义主题切换图标"},{"name":"`sessions-empty`","description":"自定义会话列表空状态"},{"name":"`empty-state`","description":"自定义 iframe 空状态"},{"name":"","description":"自定义 iframe 加载状态"},{"name":"","description":"自定义错误状态"},{"name":"","description":"自定义 iframe 内容"}]}],"attributes":[]}},"js-types-syntax":"typescript"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vite-plugin-opencode-assistant/components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.35",
|
|
4
4
|
"description": "Reusable OpenCode widget components built with Pagoda CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"css-selector-generator": "^3.9.1",
|
|
34
|
-
"@vite-plugin-opencode-assistant/shared": "1.0.
|
|
34
|
+
"@vite-plugin-opencode-assistant/shared": "1.0.35"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@vitejs/plugin-vue": "^6.0.5",
|