@vite-plugin-opencode-assistant/components 1.0.25 → 1.0.26
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/src/components/FloatingBubble/FloatingBubble.vue.d.ts +0 -1
- package/es/open-code-widget/src/components/FloatingBubble/FloatingBubble.vue.js +15 -41
- package/es/open-code-widget/src/components/Trigger.vue.d.ts +4 -5
- package/es/open-code-widget/src/components/Trigger.vue.js +4 -15
- package/es/open-code-widget/src/index-sfc.css +1 -1
- package/es/open-code-widget/src/index.vue.js +46 -9
- package/lib/@vite-plugin-opencode-assistant/components.cjs.js +69 -74
- package/lib/@vite-plugin-opencode-assistant/components.es.js +70 -75
- package/lib/components.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/open-code-widget/src/components/FloatingBubble/FloatingBubble.vue.d.ts +0 -1
- package/lib/open-code-widget/src/components/FloatingBubble/FloatingBubble.vue.js +14 -40
- package/lib/open-code-widget/src/components/Trigger.vue.d.ts +4 -5
- package/lib/open-code-widget/src/components/Trigger.vue.js +3 -14
- package/lib/open-code-widget/src/index-sfc.css +1 -1
- package/lib/open-code-widget/src/index.vue.js +45 -8
- package/lib/web-types.json +1 -1
- package/package.json +2 -2
|
@@ -92,6 +92,10 @@ const __vue_sfc__ = /* @__PURE__ */ (0, import_vue.defineComponent)(__spreadProp
|
|
|
92
92
|
},
|
|
93
93
|
emits: ["update:open", "update:selectMode", "update:sessionListCollapsed", "update:currentSessionId", "update:selectedElements", "update:theme", "update:thinking", "toggle", "close", "toggle-session-list", "toggle-select-mode", "toggle-theme", "create-session", "select-session", "delete-session", "click-selected-node", "remove-selected-node", "clear-selected-nodes", "empty-action", "frame-loaded", "thinking-change"],
|
|
94
94
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
95
|
+
(0, import_vue.useCssVars)((_ctx) => ({
|
|
96
|
+
"-chatAnimationOrigin.x": chatAnimationOrigin.value.x,
|
|
97
|
+
"-chatAnimationOrigin.y": chatAnimationOrigin.value.y
|
|
98
|
+
}));
|
|
95
99
|
const props = __props;
|
|
96
100
|
const emit = __emit;
|
|
97
101
|
const slots = (0, import_vue2.useSlots)();
|
|
@@ -250,13 +254,31 @@ const __vue_sfc__ = /* @__PURE__ */ (0, import_vue.defineComponent)(__spreadProp
|
|
|
250
254
|
promptDockVisible.value = !promptDockVisible.value;
|
|
251
255
|
sendMessageToIframe("prompt-dock-visibility-change", { visible: promptDockVisible.value });
|
|
252
256
|
};
|
|
253
|
-
const bubbleOffset = (0, import_vue2.ref)(
|
|
254
|
-
const
|
|
255
|
-
|
|
257
|
+
const bubbleOffset = (0, import_vue2.ref)(void 0);
|
|
258
|
+
const bubbleQuadrant = (0, import_vue2.computed)(() => {
|
|
259
|
+
var _a, _b, _c, _d;
|
|
260
|
+
if (typeof window === "undefined") return "bottom-right";
|
|
256
261
|
const centerX = window.innerWidth / 2;
|
|
257
|
-
|
|
262
|
+
const centerY = window.innerHeight / 2;
|
|
263
|
+
const bubbleSize = 44;
|
|
264
|
+
const effectiveX = ((_b = (_a = bubbleOffset.value) == null ? void 0 : _a.x) != null ? _b : window.innerWidth - bubbleSize - 24) + bubbleSize / 2;
|
|
265
|
+
const effectiveY = ((_d = (_c = bubbleOffset.value) == null ? void 0 : _c.y) != null ? _d : window.innerHeight - bubbleSize - 24) + bubbleSize / 2;
|
|
266
|
+
if (effectiveX >= centerX && effectiveY >= centerY) {
|
|
267
|
+
return "bottom-right";
|
|
268
|
+
} else if (effectiveX < centerX && effectiveY >= centerY) {
|
|
269
|
+
return "bottom-left";
|
|
270
|
+
} else if (effectiveX >= centerX && effectiveY < centerY) {
|
|
271
|
+
return "top-right";
|
|
272
|
+
} else {
|
|
273
|
+
return "top-left";
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
const isBubbleOnRightSide = (0, import_vue2.computed)(() => {
|
|
277
|
+
const quadrant = bubbleQuadrant.value;
|
|
278
|
+
return quadrant === "top-right" || quadrant === "bottom-right";
|
|
258
279
|
});
|
|
259
280
|
const chatPositionStyle = (0, import_vue2.computed)(() => {
|
|
281
|
+
var _a;
|
|
260
282
|
if (typeof window === "undefined") return {};
|
|
261
283
|
const windowWidth = window.innerWidth;
|
|
262
284
|
const windowHeight = window.innerHeight;
|
|
@@ -265,9 +287,10 @@ const __vue_sfc__ = /* @__PURE__ */ (0, import_vue.defineComponent)(__spreadProp
|
|
|
265
287
|
const gap = 24;
|
|
266
288
|
const bubbleSize = 44;
|
|
267
289
|
const screenMargin = 20;
|
|
290
|
+
const effectiveOffset = (_a = bubbleOffset.value) != null ? _a : { x: windowWidth - bubbleSize - gap, y: windowHeight - bubbleSize - gap };
|
|
268
291
|
const style = {};
|
|
269
292
|
if (isBubbleOnRightSide.value) {
|
|
270
|
-
let rightPos = windowWidth -
|
|
293
|
+
let rightPos = windowWidth - effectiveOffset.x + gap;
|
|
271
294
|
const maxRight = windowWidth - chatWidth - screenMargin;
|
|
272
295
|
if (rightPos > maxRight) {
|
|
273
296
|
rightPos = maxRight;
|
|
@@ -275,7 +298,7 @@ const __vue_sfc__ = /* @__PURE__ */ (0, import_vue.defineComponent)(__spreadProp
|
|
|
275
298
|
style.right = `${rightPos}px`;
|
|
276
299
|
style.left = "auto";
|
|
277
300
|
} else {
|
|
278
|
-
let leftPos =
|
|
301
|
+
let leftPos = effectiveOffset.x + bubbleSize + gap;
|
|
279
302
|
const maxLeft = windowWidth - chatWidth - screenMargin;
|
|
280
303
|
if (leftPos > maxLeft) {
|
|
281
304
|
leftPos = maxLeft;
|
|
@@ -283,7 +306,7 @@ const __vue_sfc__ = /* @__PURE__ */ (0, import_vue.defineComponent)(__spreadProp
|
|
|
283
306
|
style.left = `${leftPos}px`;
|
|
284
307
|
style.right = "auto";
|
|
285
308
|
}
|
|
286
|
-
let bottomPos = windowHeight -
|
|
309
|
+
let bottomPos = windowHeight - effectiveOffset.y - bubbleSize;
|
|
287
310
|
const maxBottom = windowHeight - chatHeight - screenMargin;
|
|
288
311
|
if (bottomPos > maxBottom) {
|
|
289
312
|
bottomPos = maxBottom;
|
|
@@ -297,6 +320,20 @@ const __vue_sfc__ = /* @__PURE__ */ (0, import_vue.defineComponent)(__spreadProp
|
|
|
297
320
|
const handleBubbleOffsetChange = (offset) => {
|
|
298
321
|
bubbleOffset.value = offset;
|
|
299
322
|
};
|
|
323
|
+
const chatAnimationOrigin = (0, import_vue2.computed)(() => {
|
|
324
|
+
const quadrant = bubbleQuadrant.value;
|
|
325
|
+
switch (quadrant) {
|
|
326
|
+
case "top-left":
|
|
327
|
+
return { x: "-20px", y: "-20px" };
|
|
328
|
+
case "top-right":
|
|
329
|
+
return { x: "20px", y: "-20px" };
|
|
330
|
+
case "bottom-left":
|
|
331
|
+
return { x: "-20px", y: "20px" };
|
|
332
|
+
case "bottom-right":
|
|
333
|
+
default:
|
|
334
|
+
return { x: "20px", y: "20px" };
|
|
335
|
+
}
|
|
336
|
+
});
|
|
300
337
|
const isDragging = (0, import_vue2.ref)(false);
|
|
301
338
|
let wasOpenBeforeDrag = false;
|
|
302
339
|
const handleDragStart = () => {
|
|
@@ -365,7 +402,7 @@ const __vue_sfc__ = /* @__PURE__ */ (0, import_vue.defineComponent)(__spreadProp
|
|
|
365
402
|
return dialogResolve;
|
|
366
403
|
}, set dialogResolve(v) {
|
|
367
404
|
dialogResolve = v;
|
|
368
|
-
}, showConfirmDialog, handleDialogConfirm, handleDialogCancel, frameRef, triggerRef, sendMessageToIframe, handleFrameLoaded, localSessionListCollapsed, minimized, promptDockVisible, buttonActive, containerClasses, iframeSource, sessionListTitle, resolvedTheme, handleClose, handleEmptyAction, handleToggle, handleToggleSessionList, handleToggleTheme, sessionItems, handleCreateSession, handleDeleteSession, handleSelectSession, bubbleVisible, hasSelectedElements, selectedElementItems, handleClearSelectedNodes, handleClickSelectedNode, handleRemoveSelectedNode, handleToggleSelectMode, highlightVisible, highlightStyle, tooltipVisible, tooltipStyle, tooltipContent, handleToggleMinimize, handleTogglePromptDock, bubbleOffset, isBubbleOnRightSide, chatPositionStyle, handleBubbleOffsetChange, isDragging, get wasOpenBeforeDrag() {
|
|
405
|
+
}, showConfirmDialog, handleDialogConfirm, handleDialogCancel, frameRef, triggerRef, sendMessageToIframe, handleFrameLoaded, localSessionListCollapsed, minimized, promptDockVisible, buttonActive, containerClasses, iframeSource, sessionListTitle, resolvedTheme, handleClose, handleEmptyAction, handleToggle, handleToggleSessionList, handleToggleTheme, sessionItems, handleCreateSession, handleDeleteSession, handleSelectSession, bubbleVisible, hasSelectedElements, selectedElementItems, handleClearSelectedNodes, handleClickSelectedNode, handleRemoveSelectedNode, handleToggleSelectMode, highlightVisible, highlightStyle, tooltipVisible, tooltipStyle, tooltipContent, handleToggleMinimize, handleTogglePromptDock, bubbleOffset, bubbleQuadrant, isBubbleOnRightSide, chatPositionStyle, handleBubbleOffsetChange, chatAnimationOrigin, isDragging, get wasOpenBeforeDrag() {
|
|
369
406
|
return wasOpenBeforeDrag;
|
|
370
407
|
}, set wasOpenBeforeDrag(v) {
|
|
371
408
|
wasOpenBeforeDrag = v;
|
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.26","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.26",
|
|
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.26"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@vitejs/plugin-vue": "^6.0.5",
|