@vite-plugin-opencode-assistant/components 1.0.18 → 1.0.19

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.
@@ -1,6 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __export = (target, all) => {
6
8
  for (var name in all)
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
14
16
  }
15
17
  return to;
16
18
  };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
17
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
28
  var use_inspector_exports = {};
19
29
  __export(use_inspector_exports, {
@@ -22,6 +32,24 @@ __export(use_inspector_exports, {
22
32
  module.exports = __toCommonJS(use_inspector_exports);
23
33
  var import_vue = require("vue");
24
34
  var import_shared = require("@vite-plugin-opencode-assistant/shared");
35
+ var import_css_selector_generator = __toESM(require("css-selector-generator"));
36
+ function throttle(fn, delay) {
37
+ let lastCall = 0;
38
+ let rafId = null;
39
+ return ((...args) => {
40
+ const now = performance.now();
41
+ if (now - lastCall >= delay) {
42
+ lastCall = now;
43
+ fn(...args);
44
+ } else if (!rafId) {
45
+ rafId = requestAnimationFrame(() => {
46
+ rafId = null;
47
+ lastCall = performance.now();
48
+ fn(...args);
49
+ });
50
+ }
51
+ });
52
+ }
25
53
  function getDirectText(element) {
26
54
  let text = "";
27
55
  for (let i = 0; i < element.childNodes.length; i++) {
@@ -32,24 +60,178 @@ function getDirectText(element) {
32
60
  }
33
61
  return text.trim();
34
62
  }
63
+ const DYNAMIC_ID_PATTERN = /^(?:el-|:r[0-9]+:|radix-|uid-|ts-|uuid-|id-[a-f0-9]{4,}|.*[0-9]{4,}.*|.*-[a-f0-9]{6,}$)/i;
64
+ const STATE_CLASS_PATTERN = /^(?:hover|active|focus|focus-visible|focus-within|disabled|enabled|checked|selected|open|closed|loading|error|success|warning|hidden|visible|show|hide|current|expanded|collapsed|pressed|dragging|droppable|sortable|placeholder|transition|enter|leave|appear|move)$/i;
65
+ const STATE_CLASS_PREFIX_PATTERN = /^(?:is-|has-|was-|are-|can-|should-|will-|did-|does-|on-|off-|in-|out-|at-|to-|from-)/i;
66
+ function isDynamicId(id) {
67
+ if (!id) return false;
68
+ if (DYNAMIC_ID_PATTERN.test(id)) {
69
+ return true;
70
+ }
71
+ const digitCount = (id.match(/\d/g) || []).length;
72
+ const letterCount = (id.match(/[a-zA-Z]/g) || []).length;
73
+ if (digitCount > letterCount && digitCount >= 3) {
74
+ return true;
75
+ }
76
+ const dashParts = id.split("-");
77
+ if (dashParts.length >= 3) {
78
+ const lastPart = dashParts[dashParts.length - 1];
79
+ if (/^\d+$/.test(lastPart) || /^[a-f0-9]{4,}$/i.test(lastPart)) {
80
+ return true;
81
+ }
82
+ }
83
+ return false;
84
+ }
85
+ function isStateClass(className) {
86
+ if (!className) return false;
87
+ if (STATE_CLASS_PATTERN.test(className)) {
88
+ return true;
89
+ }
90
+ if (STATE_CLASS_PREFIX_PATTERN.test(className)) {
91
+ return true;
92
+ }
93
+ if (className.includes("-active") || className.includes("-hover") || className.includes("-focus")) {
94
+ return true;
95
+ }
96
+ if (/^(?:router-link|nuxt-link)/.test(className)) {
97
+ return true;
98
+ }
99
+ return false;
100
+ }
101
+ function filterStateClasses(classes) {
102
+ return classes.filter((cls) => !isStateClass(cls));
103
+ }
35
104
  function getElementDescription(element) {
36
- const tag = element.tagName.toLowerCase();
37
- const parts = [tag];
38
- const id = element.id;
39
- if (id) parts.push(`#${id}`);
40
- if (typeof element.className === "string") {
41
- const className = element.className.trim().split(/\s+/).filter(Boolean).slice(0, 2).join(".");
42
- if (className) parts.push(`.${className}`);
43
- }
44
- const name = element.getAttribute("name");
45
- if (name) parts.push(`[name="${name}"]`);
46
- const placeholder = element.getAttribute("placeholder");
47
- if (placeholder) parts.push(`[placeholder="${placeholder.substring(0, 20)}"]`);
48
- const src = element.getAttribute("src");
49
- if (src) parts.push(`[src]`);
50
- const href = element.getAttribute("href");
51
- if (href && href !== "#") parts.push(`[href]`);
52
- return parts.join("");
105
+ try {
106
+ const selector = (0, import_css_selector_generator.default)(element, {
107
+ selectors: ["id", "class", "tag", "attribute", "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;
123
+ }
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(".")}`);
144
+ }
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;
169
+ }
170
+ function getFileInfoFromVueInstance(element) {
171
+ var _a, _b, _c, _d;
172
+ const vue3Instance = element.__vueParentComponent;
173
+ if (vue3Instance) {
174
+ let current = vue3Instance;
175
+ while (current) {
176
+ const file = ((_a = current.type) == null ? void 0 : _a.__file) || ((_c = (_b = current.vnode) == null ? void 0 : _b.type) == null ? void 0 : _c.__file);
177
+ if (file) {
178
+ return { file, line: null, column: null };
179
+ }
180
+ current = current.parent;
181
+ }
182
+ }
183
+ const vue2Instance = element.__vue__;
184
+ if (vue2Instance) {
185
+ let current = vue2Instance;
186
+ while (current) {
187
+ const file = (_d = current.$options) == null ? void 0 : _d.__file;
188
+ if (file) {
189
+ return { file, line: null, column: null };
190
+ }
191
+ current = current.$parent;
192
+ }
193
+ }
194
+ return null;
195
+ }
196
+ function findFileInfo(element, inspector) {
197
+ var _a, _b;
198
+ let current = element;
199
+ let fallbackFileInfo = null;
200
+ while (current) {
201
+ const attrInfo = getFileInfoFromAttributes(current);
202
+ if (attrInfo && attrInfo.line !== null) {
203
+ return attrInfo;
204
+ }
205
+ if (attrInfo && !fallbackFileInfo) {
206
+ fallbackFileInfo = attrInfo;
207
+ }
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 = {
217
+ file: params.file,
218
+ line: (_a = params.line) != null ? _a : null,
219
+ column: (_b = params.column) != null ? _b : null
220
+ };
221
+ if (info.line !== null) {
222
+ return info;
223
+ }
224
+ if (!fallbackFileInfo) {
225
+ fallbackFileInfo = info;
226
+ }
227
+ }
228
+ const vueInfo = getFileInfoFromVueInstance(current);
229
+ if (vueInfo && !fallbackFileInfo) {
230
+ fallbackFileInfo = vueInfo;
231
+ }
232
+ current = current.parentElement;
233
+ }
234
+ return fallbackFileInfo || { file: null, line: null, column: null };
53
235
  }
54
236
  function getPreciseElementAtPoint(x, y, boundary) {
55
237
  var _a, _b;
@@ -66,7 +248,12 @@ function getPreciseElementAtPoint(x, y, boundary) {
66
248
  if (el.closest("#vue-inspector-container")) continue;
67
249
  if (el.closest(".opencode-widget")) continue;
68
250
  if (el.hasAttribute("data-v-inspector-ignore")) continue;
69
- if (boundary.contains(el) || el === boundary) {
251
+ if (boundary) {
252
+ if (boundary.contains(el) || el === boundary) {
253
+ element = el;
254
+ break;
255
+ }
256
+ } else {
70
257
  element = el;
71
258
  break;
72
259
  }
@@ -90,14 +277,35 @@ function useInspector(options) {
90
277
  const tooltipContent = (0, import_vue.ref)({ description: "", fileInfo: "" });
91
278
  const INSPECTOR_CHECK_INTERVAL = 500;
92
279
  let inspectorCheckTimer = null;
93
- function handleMouseMove(e) {
280
+ function handleMouseMoveCore(e) {
281
+ var _a, _b;
94
282
  if (!options.selectMode.value) return;
95
283
  const inspector = window.__VUE_INSPECTOR__;
96
- if (!inspector) return;
97
- const { targetNode, params } = inspector.getTargetNode(e);
98
- if (targetNode && params) {
99
- const preciseElement = getPreciseElementAtPoint(e.clientX, e.clientY, targetNode);
100
- const elementToHighlight = preciseElement || targetNode;
284
+ let elementToHighlight = null;
285
+ let fileInfo = { file: null, line: null, column: null };
286
+ if (inspector) {
287
+ const { targetNode, params } = inspector.getTargetNode(e);
288
+ if (targetNode) {
289
+ const preciseElement = getPreciseElementAtPoint(e.clientX, e.clientY, targetNode);
290
+ elementToHighlight = preciseElement || targetNode;
291
+ if (params && params.file) {
292
+ fileInfo = {
293
+ file: params.file,
294
+ line: (_a = params.line) != null ? _a : null,
295
+ column: (_b = params.column) != null ? _b : null
296
+ };
297
+ } else if (elementToHighlight) {
298
+ fileInfo = findFileInfo(elementToHighlight, inspector);
299
+ }
300
+ }
301
+ }
302
+ if (!elementToHighlight) {
303
+ elementToHighlight = getPreciseElementAtPoint(e.clientX, e.clientY, null);
304
+ }
305
+ if (elementToHighlight && !fileInfo.file) {
306
+ fileInfo = getFileInfoFromVueInstance(elementToHighlight) || fileInfo;
307
+ }
308
+ if (elementToHighlight) {
101
309
  const rect = elementToHighlight.getBoundingClientRect();
102
310
  const widget = document.querySelector(".opencode-widget");
103
311
  let primary = "#3b82f6";
@@ -117,12 +325,12 @@ function useInspector(options) {
117
325
  background: primaryBg
118
326
  };
119
327
  const description = getElementDescription(elementToHighlight);
120
- const fileName = params.file ? params.file.split("/").pop() : "";
328
+ const fileName = fileInfo.file ? fileInfo.file.split("/").pop() : "";
121
329
  let lineInfo = "";
122
- if (params.line) {
123
- lineInfo = `:${params.line}`;
124
- if (params.column) {
125
- lineInfo += `:${params.column}`;
330
+ if (fileInfo.line) {
331
+ lineInfo = `:${fileInfo.line}`;
332
+ if (fileInfo.column) {
333
+ lineInfo += `:${fileInfo.column}`;
126
334
  }
127
335
  }
128
336
  tooltipContent.value = {
@@ -149,23 +357,43 @@ function useInspector(options) {
149
357
  tooltipVisible.value = false;
150
358
  }
151
359
  }
360
+ const handleMouseMove = throttle(handleMouseMoveCore, 16);
152
361
  function setupInspectorHook() {
153
362
  const inspector = window.__VUE_INSPECTOR__;
154
363
  if (!inspector || inspector.__opencode_hooked) return;
155
364
  const originalHandleClick = inspector.handleClick.bind(inspector);
156
365
  inspector.handleClick = function(e) {
157
- var _a, _b, _c;
366
+ var _a, _b;
158
367
  if (options.selectMode.value) {
368
+ let elementToSelect = null;
369
+ let fileInfo = { file: null, line: null, column: null };
159
370
  const { targetNode, params } = inspector.getTargetNode(e);
160
- if (targetNode && params) {
371
+ if (targetNode) {
161
372
  const preciseElement = getPreciseElementAtPoint(e.clientX, e.clientY, targetNode);
162
- const elementToSelect = preciseElement || targetNode;
373
+ elementToSelect = preciseElement || targetNode;
374
+ if (params && params.file) {
375
+ fileInfo = {
376
+ file: params.file,
377
+ line: (_a = params.line) != null ? _a : null,
378
+ column: (_b = params.column) != null ? _b : null
379
+ };
380
+ } else if (elementToSelect) {
381
+ fileInfo = findFileInfo(elementToSelect, inspector);
382
+ }
383
+ }
384
+ if (!elementToSelect) {
385
+ elementToSelect = getPreciseElementAtPoint(e.clientX, e.clientY, null);
386
+ }
387
+ if (elementToSelect && !fileInfo.file) {
388
+ fileInfo = getFileInfoFromVueInstance(elementToSelect) || fileInfo;
389
+ }
390
+ if (elementToSelect) {
163
391
  const innerText = getDirectText(elementToSelect);
164
392
  const description = getElementDescription(elementToSelect);
165
393
  const elementInfo = {
166
- filePath: (_a = params.file) != null ? _a : null,
167
- line: (_b = params.line) != null ? _b : null,
168
- column: (_c = params.column) != null ? _c : null,
394
+ filePath: fileInfo.file,
395
+ line: fileInfo.line,
396
+ column: fileInfo.column,
169
397
  innerText: (0, import_shared.truncate)(innerText, 200),
170
398
  description
171
399
  };
@@ -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.18","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.19","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.18",
3
+ "version": "1.0.19",
4
4
  "description": "Reusable OpenCode widget components built with Pagoda CLI",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -30,7 +30,8 @@
30
30
  "vue": "^3.5.0"
31
31
  },
32
32
  "dependencies": {
33
- "@vite-plugin-opencode-assistant/shared": "1.0.18"
33
+ "css-selector-generator": "^3.9.1",
34
+ "@vite-plugin-opencode-assistant/shared": "1.0.19"
34
35
  },
35
36
  "devDependencies": {
36
37
  "@vitejs/plugin-vue": "^6.0.5",