@vite-plugin-opencode-assistant/components 1.0.33 → 1.0.34

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.
@@ -33,6 +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
+ 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";
36
47
  function throttle(fn, delay) {
37
48
  let lastCall = 0;
38
49
  let rafId = null;
@@ -98,74 +109,27 @@ function isStateClass(className) {
98
109
  }
99
110
  return false;
100
111
  }
101
- function filterStateClasses(classes) {
102
- return classes.filter((cls) => !isStateClass(cls));
103
- }
104
112
  function getElementDescription(element) {
105
- try {
106
- const selector = (0, import_css_selector_generator.default)(element, {
107
- selectors: ["id", "class", "tag", "nthchild"],
108
- combineWithinSelector: true,
109
- combineBetweenSelectors: true,
110
- maxCombinations: 100,
111
- maxCandidates: 100,
112
- blacklist: [
113
- (selectorValue) => {
114
- const idMatch = selectorValue.match(/^#(.+)$/);
115
- if (idMatch) {
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;
113
+ return (0, import_css_selector_generator.default)(element, {
114
+ selectors: ["id", "class", "tag", "nthchild"],
115
+ combineWithinSelector: true,
116
+ combineBetweenSelectors: true,
117
+ maxCombinations: 100,
118
+ maxCandidates: 100,
119
+ blacklist: [
120
+ (selectorValue) => {
121
+ const idMatch = selectorValue.match(/^#(.+)$/);
122
+ if (idMatch) {
123
+ return isDynamicId(idMatch[1]);
123
124
  }
124
- ]
125
- });
126
- return selector;
127
- } catch (e) {
128
- const tag = element.tagName.toLowerCase();
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(".")}`);
125
+ const classMatch = selectorValue.match(/^\.([a-zA-Z_-][\w-]*)$/);
126
+ if (classMatch) {
127
+ return isStateClass(classMatch[1]);
128
+ }
129
+ return false;
144
130
  }
145
- }
146
- const name = element.getAttribute("name");
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;
131
+ ]
132
+ });
169
133
  }
170
134
  function getFileInfoFromVueInstance(element) {
171
135
  var _a, _b, _c, _d;
@@ -193,61 +157,83 @@ function getFileInfoFromVueInstance(element) {
193
157
  }
194
158
  return null;
195
159
  }
196
- function findFileInfo(element, inspector) {
160
+ function shouldIgnoreElement(el) {
161
+ if (el.hasAttribute(IGNORE_ATTRIBUTE)) return true;
162
+ for (const selector of IGNORE_SELECTORS) {
163
+ if (el.closest(selector)) return true;
164
+ }
165
+ return false;
166
+ }
167
+ function getDataFromElement(el) {
197
168
  var _a, _b;
169
+ const vnodeData = (_b = (_a = el.__vnode) == null ? void 0 : _a.props) == null ? void 0 : _b[KEY_PROPS_DATA];
170
+ if (vnodeData) return vnodeData;
171
+ const attr = el.getAttribute(KEY_DATA);
172
+ return attr != null ? attr : void 0;
173
+ }
174
+ function findInspectorFileInfo(element) {
198
175
  let current = element;
199
- let fallbackFileInfo = null;
200
176
  while (current) {
201
- const attrInfo = getFileInfoFromAttributes(current);
202
- if (attrInfo && attrInfo.line !== null) {
203
- return attrInfo;
177
+ const data = getDataFromElement(current);
178
+ if (data) {
179
+ const splitRE = /(.+):([\d]+):([\d]+)$/;
180
+ const match = data.match(splitRE);
181
+ if (match) {
182
+ return {
183
+ file: match[1],
184
+ line: parseInt(match[2], 10),
185
+ column: parseInt(match[3], 10)
186
+ };
187
+ }
204
188
  }
205
- if (attrInfo && !fallbackFileInfo) {
206
- fallbackFileInfo = attrInfo;
189
+ current = current.parentElement;
190
+ }
191
+ return null;
192
+ }
193
+ function mergeFileInfo(inspectorFileInfo, vueFileInfo) {
194
+ if (!(inspectorFileInfo == null ? void 0 : inspectorFileInfo.file) && !(vueFileInfo == null ? void 0 : vueFileInfo.file)) {
195
+ return { file: null, line: null, column: null };
196
+ }
197
+ const isNodeModules = (path) => path.includes("node_modules");
198
+ if ((inspectorFileInfo == null ? void 0 : inspectorFileInfo.file) && (vueFileInfo == null ? void 0 : vueFileInfo.file)) {
199
+ if (!isNodeModules(inspectorFileInfo.file)) {
200
+ return inspectorFileInfo;
201
+ } else if (!isNodeModules(vueFileInfo.file)) {
202
+ return vueFileInfo;
203
+ } else {
204
+ return inspectorFileInfo;
207
205
  }
208
- const fakeEvent = {
209
- clientX: 0,
210
- clientY: 0,
211
- target: current,
212
- currentTarget: current
213
- };
214
- const { params } = inspector.getTargetNode(fakeEvent);
215
- if (params && params.file) {
216
- const info = {
206
+ } else if (inspectorFileInfo == null ? void 0 : inspectorFileInfo.file) {
207
+ return inspectorFileInfo;
208
+ } else {
209
+ return vueFileInfo;
210
+ }
211
+ }
212
+ function getTargetElement(e) {
213
+ if (!e.target || !(e.target instanceof Element)) return null;
214
+ const el = e.target;
215
+ if (shouldIgnoreElement(el)) return null;
216
+ return el;
217
+ }
218
+ function getFileInfo(e, element) {
219
+ var _a, _b;
220
+ const inspector = window.__VUE_INSPECTOR__;
221
+ let inspectorFileInfo = null;
222
+ if (inspector) {
223
+ const { targetNode, params } = inspector.getTargetNode(e);
224
+ if (targetNode && params && params.file) {
225
+ inspectorFileInfo = {
217
226
  file: params.file,
218
227
  line: (_a = params.line) != null ? _a : null,
219
228
  column: (_b = params.column) != null ? _b : null
220
229
  };
221
- if (info.line !== null) {
222
- return info;
223
- }
224
- if (!fallbackFileInfo) {
225
- fallbackFileInfo = info;
226
- }
227
230
  }
228
- const vueInfo = getFileInfoFromVueInstance(current);
229
- if (vueInfo && !fallbackFileInfo) {
230
- fallbackFileInfo = vueInfo;
231
- }
232
- current = current.parentElement;
233
231
  }
234
- return fallbackFileInfo || { file: null, line: null, column: null };
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
- }
232
+ if (element && !inspectorFileInfo) {
233
+ inspectorFileInfo = findInspectorFileInfo(element);
249
234
  }
250
- return null;
235
+ const vueFileInfo = element ? getFileInfoFromVueInstance(element) : null;
236
+ return mergeFileInfo(inspectorFileInfo, vueFileInfo);
251
237
  }
252
238
  function useInspector(options) {
253
239
  const highlightVisible = (0, import_vue.ref)(false);
@@ -262,84 +248,50 @@ function useInspector(options) {
262
248
  const tooltipContent = (0, import_vue.ref)({ description: "", fileInfo: "" });
263
249
  const INSPECTOR_CHECK_INTERVAL = 500;
264
250
  let inspectorCheckTimer = null;
265
- let currentHighlightElement = null;
266
- let currentFileInfo = { file: null, line: null, column: null };
267
251
  let currentPrimary = "#3b82f6";
268
252
  let currentPrimaryBg = "rgba(59, 130, 246, 0.1)";
269
- let currentDescription = "";
270
- let currentFileInfoText = "";
253
+ function setPointerEventsNone(elements) {
254
+ elements.forEach((el) => {
255
+ if (el) el.style.pointerEvents = "none";
256
+ });
257
+ }
258
+ function setPointerEventsAuto(elements) {
259
+ elements.forEach((el) => {
260
+ if (el) el.style.pointerEvents = "";
261
+ });
262
+ }
271
263
  function handleMouseMoveCore(e) {
272
- var _a, _b;
273
264
  if (!options.selectMode.value) return;
274
- const inspector = window.__VUE_INSPECTOR__;
275
265
  const highlight = document.querySelector(".opencode-element-highlight");
276
266
  const tooltip = document.querySelector(".opencode-element-tooltip");
277
- if (highlight) highlight.style.pointerEvents = "none";
278
- if (tooltip) tooltip.style.pointerEvents = "none";
279
- let elementToHighlight = null;
280
- let targetNode;
281
- let fileInfo = { file: null, line: null, column: null };
282
- try {
283
- if (inspector) {
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
- }
267
+ const selectHint = document.querySelector(".opencode-select-mode-hint");
268
+ const floatingBubble = document.querySelector(".floating-bubble");
269
+ const uiElements = [highlight, tooltip, selectHint, floatingBubble];
270
+ setPointerEventsNone(uiElements);
271
+ const elementToHighlight = getTargetElement(e);
272
+ const fileInfo = getFileInfo(e, elementToHighlight);
273
+ setPointerEventsAuto(uiElements);
311
274
  if (elementToHighlight) {
312
- const elementChanged = currentHighlightElement !== elementToHighlight;
313
- if (elementChanged) {
314
- currentHighlightElement = elementToHighlight;
315
- currentFileInfo = fileInfo;
316
- const widget = document.querySelector(".opencode-widget");
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;
275
+ const widget = document.querySelector(".opencode-widget");
276
+ if (widget) {
277
+ const style = getComputedStyle(widget);
278
+ currentPrimary = style.getPropertyValue("--oc-primary").trim() || currentPrimary;
279
+ currentPrimaryBg = style.getPropertyValue("--oc-primary-bg").trim() || currentPrimaryBg;
325
280
  }
326
- const fileName = currentFileInfo.file ? currentFileInfo.file.split("/").pop() : "";
281
+ const description = getElementDescription(elementToHighlight);
282
+ const fileName = fileInfo.file ? fileInfo.file.split("/").pop() : "";
327
283
  let lineInfo = "";
328
- if (currentFileInfo.line) {
329
- lineInfo = `:${currentFileInfo.line}`;
330
- if (currentFileInfo.column) {
331
- lineInfo += `:${currentFileInfo.column}`;
284
+ if (fileInfo.line) {
285
+ lineInfo = `:${fileInfo.line}`;
286
+ if (fileInfo.column) {
287
+ lineInfo += `:${fileInfo.column}`;
332
288
  }
333
289
  }
334
- const newFileInfoText = fileName ? `${fileName}${lineInfo}` : "";
335
- const fileInfoChanged = currentFileInfoText !== newFileInfoText;
336
- if (elementChanged || fileInfoChanged) {
337
- currentFileInfoText = newFileInfoText;
338
- tooltipContent.value = {
339
- description: currentDescription,
340
- fileInfo: currentFileInfoText
341
- };
342
- }
290
+ const fileInfoText = fileName ? `${fileName}${lineInfo}` : "";
291
+ tooltipContent.value = {
292
+ description,
293
+ fileInfo: fileInfoText
294
+ };
343
295
  const rect = elementToHighlight.getBoundingClientRect();
344
296
  const newTop = `${rect.top}px`;
345
297
  const newLeft = `${rect.left}px`;
@@ -357,13 +309,20 @@ function useInspector(options) {
357
309
  }
358
310
  const tooltipHeight = 50;
359
311
  const tooltipWidth = 200;
312
+ const margin = 10;
360
313
  let tooltipTop = rect.top - tooltipHeight - 8;
361
314
  let tooltipLeft = rect.left;
362
- if (tooltipTop < 10) {
315
+ if (tooltipTop < margin) {
363
316
  tooltipTop = rect.bottom + 8;
364
317
  }
365
- if (tooltipLeft + tooltipWidth > window.innerWidth - 10) {
366
- tooltipLeft = window.innerWidth - tooltipWidth - 10;
318
+ if (tooltipTop + tooltipHeight > window.innerHeight - margin) {
319
+ tooltipTop = Math.max(margin, rect.top - tooltipHeight - 8);
320
+ }
321
+ if (tooltipLeft < margin) {
322
+ tooltipLeft = margin;
323
+ }
324
+ if (tooltipLeft + tooltipWidth > window.innerWidth - margin) {
325
+ tooltipLeft = window.innerWidth - tooltipWidth - margin;
367
326
  }
368
327
  const newTooltipTop = `${tooltipTop}px`;
369
328
  const newTooltipLeft = `${tooltipLeft}px`;
@@ -373,23 +332,11 @@ function useInspector(options) {
373
332
  left: newTooltipLeft
374
333
  };
375
334
  }
376
- if (!highlightVisible.value) {
377
- highlightVisible.value = true;
378
- }
379
- if (!tooltipVisible.value) {
380
- tooltipVisible.value = true;
381
- }
335
+ highlightVisible.value = true;
336
+ tooltipVisible.value = true;
382
337
  } else {
383
- currentHighlightElement = null;
384
- currentDescription = "";
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
- }
338
+ highlightVisible.value = false;
339
+ tooltipVisible.value = false;
393
340
  }
394
341
  }
395
342
  const handleMouseMove = throttle(handleMouseMoveCore, 16);
@@ -398,32 +345,11 @@ function useInspector(options) {
398
345
  if (!inspector || inspector.__opencode_hooked) return;
399
346
  const originalHandleClick = inspector.handleClick.bind(inspector);
400
347
  inspector.handleClick = function(e) {
401
- var _a, _b;
402
348
  if (options.selectMode.value) {
403
349
  e.preventDefault();
404
350
  e.stopPropagation();
405
- let elementToSelect = null;
406
- let fileInfo = { file: null, line: null, column: null };
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
- }
351
+ const elementToSelect = getTargetElement(e);
352
+ const fileInfo = getFileInfo(e, elementToSelect);
427
353
  if (elementToSelect) {
428
354
  const innerText = getDirectText(elementToSelect);
429
355
  const description = getElementDescription(elementToSelect);
@@ -463,10 +389,6 @@ function useInspector(options) {
463
389
  }
464
390
  document.removeEventListener("mousemove", handleMouseMove);
465
391
  document.removeEventListener("keydown", handleKeydown, true);
466
- currentHighlightElement = null;
467
- currentDescription = "";
468
- currentFileInfoText = "";
469
- currentFileInfo = { file: null, line: null, column: null };
470
392
  highlightVisible.value = false;
471
393
  tooltipVisible.value = false;
472
394
  }
@@ -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.33","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"}
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.34","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.33",
3
+ "version": "1.0.34",
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.33"
34
+ "@vite-plugin-opencode-assistant/shared": "1.0.34"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@vitejs/plugin-vue": "^6.0.5",