@vite-plugin-opencode-assistant/components 1.0.26 → 1.0.28
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 +118 -79
- package/es/open-code-widget/composables/use-persist-state.d.ts +24 -0
- package/es/open-code-widget/composables/use-persist-state.js +59 -0
- package/es/open-code-widget/src/components/FloatingBubble/FloatingBubble-sfc.css +1 -1
- package/es/open-code-widget/src/components/FloatingBubble/FloatingBubble.vue.d.ts +2 -2
- package/es/open-code-widget/src/components/FloatingBubble/FloatingBubble.vue.js +37 -21
- package/es/open-code-widget/src/components/SessionList-sfc.css +1 -1
- package/es/open-code-widget/src/components/SessionList.vue.js +27 -16
- package/es/open-code-widget/src/components/Trigger-sfc.css +1 -1
- package/es/open-code-widget/src/components/Trigger.vue.d.ts +0 -2
- package/es/open-code-widget/src/components/Trigger.vue.js +10 -27
- package/es/open-code-widget/src/context.d.ts +5 -1
- package/es/open-code-widget/src/index-sfc.css +1 -1
- package/es/open-code-widget/src/index.vue.d.ts +11 -11
- package/es/open-code-widget/src/index.vue.js +113 -30
- package/es/open-code-widget/src/types.d.ts +1 -1
- package/lib/@vite-plugin-opencode-assistant/components.cjs.js +340 -153
- package/lib/@vite-plugin-opencode-assistant/components.es.js +341 -154
- package/lib/components.css +4 -4
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/open-code-widget/composables/use-inspector.js +118 -79
- package/lib/open-code-widget/composables/use-persist-state.d.ts +24 -0
- package/lib/open-code-widget/composables/use-persist-state.js +78 -0
- package/lib/open-code-widget/src/components/FloatingBubble/FloatingBubble-sfc.css +1 -1
- package/lib/open-code-widget/src/components/FloatingBubble/FloatingBubble.vue.d.ts +2 -2
- package/lib/open-code-widget/src/components/FloatingBubble/FloatingBubble.vue.js +37 -21
- package/lib/open-code-widget/src/components/SessionList-sfc.css +1 -1
- package/lib/open-code-widget/src/components/SessionList.vue.js +26 -15
- package/lib/open-code-widget/src/components/Trigger-sfc.css +1 -1
- package/lib/open-code-widget/src/components/Trigger.vue.d.ts +0 -2
- package/lib/open-code-widget/src/components/Trigger.vue.js +10 -27
- package/lib/open-code-widget/src/context.d.ts +5 -1
- package/lib/open-code-widget/src/index-sfc.css +1 -1
- package/lib/open-code-widget/src/index.vue.d.ts +11 -11
- package/lib/open-code-widget/src/index.vue.js +112 -29
- package/lib/open-code-widget/src/types.d.ts +1 -1
- package/lib/web-types.json +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fragment, Teleport, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createStaticVNode, createVNode, defineComponent, inject, normalizeClass, normalizeStyle, onMounted, onUnmounted, openBlock, provide, ref, renderList, renderSlot, toDisplayString, toRef, useCssVars, useSlots, vShow, watch, withCtx, withDirectives, withModifiers } from "vue";
|
|
1
|
+
import { Fragment, Teleport, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createStaticVNode, createTextVNode, createVNode, defineComponent, inject, nextTick, normalizeClass, normalizeStyle, onMounted, onUnmounted, openBlock, provide, ref, renderList, renderSlot, toDisplayString, toRef, useCssVars, useSlots, vShow, watch, withCtx, withDirectives, withModifiers } from "vue";
|
|
2
2
|
import { truncate } from "@vite-plugin-opencode-assistant/shared";
|
|
3
3
|
import getCssSelector from "css-selector-generator";
|
|
4
4
|
//#region es/open-code-widget/src/context.js
|
|
@@ -189,7 +189,7 @@ var _hoisted_8$2 = {
|
|
|
189
189
|
"aria-hidden": "true"
|
|
190
190
|
};
|
|
191
191
|
var _hoisted_9$2 = { class: "opencode-chat-header-title" };
|
|
192
|
-
var _hoisted_10 = { class: "opencode-chat-header-actions" };
|
|
192
|
+
var _hoisted_10$1 = { class: "opencode-chat-header-actions" };
|
|
193
193
|
var _hoisted_11 = [
|
|
194
194
|
"title",
|
|
195
195
|
"aria-label",
|
|
@@ -271,7 +271,7 @@ function __vue_render__$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
271
271
|
}, [renderSlot(_ctx.$slots, "theme-icon", {}, () => [$setup.theme === "light" ? (openBlock(), createElementBlock("svg", _hoisted_6$3, [..._cache[8] || (_cache[8] = [createStaticVNode("<circle cx=\"12\" cy=\"12\" r=\"5\"></circle><line x1=\"12\" y1=\"1\" x2=\"12\" y2=\"3\"></line><line x1=\"12\" y1=\"21\" x2=\"12\" y2=\"23\"></line><line x1=\"4.22\" y1=\"4.22\" x2=\"5.64\" y2=\"5.64\"></line><line x1=\"18.36\" y1=\"18.36\" x2=\"19.78\" y2=\"19.78\"></line><line x1=\"1\" y1=\"12\" x2=\"3\" y2=\"12\"></line><line x1=\"21\" y1=\"12\" x2=\"23\" y2=\"12\"></line><line x1=\"4.22\" y1=\"19.78\" x2=\"5.64\" y2=\"18.36\"></line><line x1=\"18.36\" y1=\"5.64\" x2=\"19.78\" y2=\"4.22\"></line>", 9)])])) : $setup.theme === "dark" ? (openBlock(), createElementBlock("svg", _hoisted_7$2, [..._cache[9] || (_cache[9] = [createElementVNode("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" }, null, -1)])])) : (openBlock(), createElementBlock("svg", _hoisted_8$2, [..._cache[10] || (_cache[10] = [createStaticVNode("<rect x=\"2\" y=\"3\" width=\"20\" height=\"14\" rx=\"2\" ry=\"2\"></rect><line x1=\"8\" y1=\"21\" x2=\"16\" y2=\"21\"></line><line x1=\"12\" y1=\"17\" x2=\"12\" y2=\"21\"></line><circle cx=\"12\" cy=\"10\" r=\"3\"></circle><path d=\"M7 7l2 2M17 7l-2 2M7 13l2-2M17 13l-2-2\"></path>", 5)])]))])], 8, _hoisted_5$3)
|
|
272
272
|
]),
|
|
273
273
|
createElementVNode("span", _hoisted_9$2, toDisplayString($setup.title), 1),
|
|
274
|
-
createElementVNode("div", _hoisted_10, [
|
|
274
|
+
createElementVNode("div", _hoisted_10$1, [
|
|
275
275
|
createElementVNode("button", {
|
|
276
276
|
class: "opencode-header-btn prompt-dock",
|
|
277
277
|
type: "button",
|
|
@@ -408,7 +408,7 @@ var __vue_sfc__$3 = /* @__PURE__ */ defineComponent({
|
|
|
408
408
|
__name: "SessionList",
|
|
409
409
|
setup(__props, { expose: __expose }) {
|
|
410
410
|
__expose();
|
|
411
|
-
const { sessionListCollapsed: collapsed, sessionItems: sessions, loadingSessionList, showSessionListSkeleton, handleCreateSession, handleSelectSession, handleDeleteSession, sessionKey } = useOpenCodeWidgetContext();
|
|
411
|
+
const { sessionListCollapsed: collapsed, sessionItems: sessions, loadingSessionList, showSessionListSkeleton, handleCreateSession, handleSelectSession, handleDeleteSession, sessionKey, sessionStates } = useOpenCodeWidgetContext();
|
|
412
412
|
const isAnimating = ref(false);
|
|
413
413
|
let animTimer = null;
|
|
414
414
|
watch(collapsed, () => {
|
|
@@ -418,6 +418,16 @@ var __vue_sfc__$3 = /* @__PURE__ */ defineComponent({
|
|
|
418
418
|
isAnimating.value = false;
|
|
419
419
|
}, 200);
|
|
420
420
|
});
|
|
421
|
+
const showSkeleton = computed(() => {
|
|
422
|
+
if (isAnimating.value) return true;
|
|
423
|
+
if (showSessionListSkeleton.value) return true;
|
|
424
|
+
return false;
|
|
425
|
+
});
|
|
426
|
+
function isSessionThinking(sessionId) {
|
|
427
|
+
var _a, _b;
|
|
428
|
+
if (!(sessionStates == null ? void 0 : sessionStates.value) || !sessionId) return false;
|
|
429
|
+
return (_b = (_a = sessionStates.value[sessionId]) == null ? void 0 : _a.thinking) != null ? _b : false;
|
|
430
|
+
}
|
|
421
431
|
const __returned__ = {
|
|
422
432
|
collapsed,
|
|
423
433
|
sessions,
|
|
@@ -427,6 +437,7 @@ var __vue_sfc__$3 = /* @__PURE__ */ defineComponent({
|
|
|
427
437
|
handleSelectSession,
|
|
428
438
|
handleDeleteSession,
|
|
429
439
|
sessionKey,
|
|
440
|
+
sessionStates,
|
|
430
441
|
isAnimating,
|
|
431
442
|
get animTimer() {
|
|
432
443
|
return animTimer;
|
|
@@ -434,11 +445,8 @@ var __vue_sfc__$3 = /* @__PURE__ */ defineComponent({
|
|
|
434
445
|
set animTimer(v) {
|
|
435
446
|
animTimer = v;
|
|
436
447
|
},
|
|
437
|
-
showSkeleton
|
|
438
|
-
|
|
439
|
-
if (showSessionListSkeleton.value) return true;
|
|
440
|
-
return false;
|
|
441
|
-
})
|
|
448
|
+
showSkeleton,
|
|
449
|
+
isSessionThinking
|
|
442
450
|
};
|
|
443
451
|
Object.defineProperty(__returned__, "__isScriptSetup", {
|
|
444
452
|
enumerable: false,
|
|
@@ -467,8 +475,12 @@ var _hoisted_4$1 = {
|
|
|
467
475
|
var _hoisted_5$1 = ["aria-selected", "onClick"];
|
|
468
476
|
var _hoisted_6$1 = { class: "opencode-session-header" };
|
|
469
477
|
var _hoisted_7$1 = { class: "opencode-session-title" };
|
|
470
|
-
var _hoisted_8$1 =
|
|
471
|
-
|
|
478
|
+
var _hoisted_8$1 = {
|
|
479
|
+
key: 0,
|
|
480
|
+
class: "opencode-thinking-loading"
|
|
481
|
+
};
|
|
482
|
+
var _hoisted_9$1 = ["aria-label", "onClick"];
|
|
483
|
+
var _hoisted_10 = { class: "opencode-session-meta" };
|
|
472
484
|
function __vue_render__$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
473
485
|
return openBlock(), createElementBlock("div", { class: normalizeClass(["opencode-session-list", { collapsed: $setup.collapsed }]) }, [
|
|
474
486
|
createCommentVNode(" Header "),
|
|
@@ -488,16 +500,19 @@ function __vue_render__$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
488
500
|
}), 64))])) : (openBlock(), createElementBlock(Fragment, { key: 3 }, [createCommentVNode(" Content "), createElementVNode("div", _hoisted_3$1, [$setup.loadingSessionList ? (openBlock(), createElementBlock("div", _hoisted_4$1, [..._cache[4] || (_cache[4] = [createElementVNode("div", { class: "opencode-loading-spinner small" }, null, -1)])])) : createCommentVNode("v-if", true), $setup.sessions.length > 0 ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList($setup.sessions, (item) => {
|
|
489
501
|
return openBlock(), createElementBlock("div", {
|
|
490
502
|
key: item[$setup.sessionKey],
|
|
491
|
-
class: normalizeClass(["opencode-session-item", {
|
|
503
|
+
class: normalizeClass(["opencode-session-item", {
|
|
504
|
+
active: item.active,
|
|
505
|
+
thinking: $setup.isSessionThinking(item.id)
|
|
506
|
+
}]),
|
|
492
507
|
role: "option",
|
|
493
508
|
"aria-selected": item.active,
|
|
494
509
|
onClick: ($event) => $setup.handleSelectSession(item)
|
|
495
|
-
}, [createElementVNode("div", _hoisted_6$1, [createElementVNode("div", _hoisted_7$1, toDisplayString(item.title), 1), createElementVNode("button", {
|
|
510
|
+
}, [createElementVNode("div", _hoisted_6$1, [createElementVNode("div", _hoisted_7$1, [$setup.isSessionThinking(item.id) ? (openBlock(), createElementBlock("span", _hoisted_8$1)) : createCommentVNode("v-if", true), createTextVNode(" " + toDisplayString(item.title), 1)]), createElementVNode("button", {
|
|
496
511
|
class: "opencode-session-delete-btn",
|
|
497
512
|
type: "button",
|
|
498
513
|
"aria-label": `\u5220\u9664\u4F1A\u8BDD: ${item.title}`,
|
|
499
514
|
onClick: withModifiers(($event) => $setup.handleDeleteSession(item), ["stop"])
|
|
500
|
-
}, " × ", 8,
|
|
515
|
+
}, " × ", 8, _hoisted_9$1)]), createElementVNode("div", _hoisted_10, toDisplayString(item.meta), 1)], 10, _hoisted_5$1);
|
|
501
516
|
}), 128)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [createCommentVNode(" Empty State "), renderSlot(_ctx.$slots, "empty")], 64))])], 2112))
|
|
502
517
|
], 2);
|
|
503
518
|
}
|
|
@@ -582,6 +597,19 @@ var __vue_sfc__$2 = /* @__PURE__ */ defineComponent(__spreadProps$1(__spreadValu
|
|
|
582
597
|
bottom: windowHeight.value - state.value.height - gapY.value,
|
|
583
598
|
left: gapX.value
|
|
584
599
|
}));
|
|
600
|
+
const closest = (arr, target) => {
|
|
601
|
+
return arr.reduce((pre, cur) => Math.abs(pre - target) < Math.abs(cur - target) ? pre : cur);
|
|
602
|
+
};
|
|
603
|
+
const applyMagnetic = () => {
|
|
604
|
+
if (props.magnetic === "x") {
|
|
605
|
+
const nextX = closest([boundary.value.left, boundary.value.right], state.value.x);
|
|
606
|
+
state.value.x = nextX;
|
|
607
|
+
}
|
|
608
|
+
if (props.magnetic === "y") {
|
|
609
|
+
const nextY = closest([boundary.value.top, boundary.value.bottom], state.value.y);
|
|
610
|
+
state.value.y = nextY;
|
|
611
|
+
}
|
|
612
|
+
};
|
|
585
613
|
const dragging = ref(false);
|
|
586
614
|
const initialized = ref(false);
|
|
587
615
|
const rootStyle = computed(() => {
|
|
@@ -603,12 +631,25 @@ var __vue_sfc__$2 = /* @__PURE__ */ defineComponent(__spreadProps$1(__spreadValu
|
|
|
603
631
|
if (x > maxX) x = maxX;
|
|
604
632
|
if (y < gapY.value) y = gapY.value;
|
|
605
633
|
if (y > maxY) y = maxY;
|
|
634
|
+
const oldX = state.value.x;
|
|
635
|
+
const oldY = state.value.y;
|
|
606
636
|
state.value = {
|
|
607
637
|
x,
|
|
608
638
|
y,
|
|
609
639
|
width: rect.width,
|
|
610
640
|
height: rect.height
|
|
611
641
|
};
|
|
642
|
+
if (!dragging.value) {
|
|
643
|
+
applyMagnetic();
|
|
644
|
+
if (state.value.x !== oldX || state.value.y !== oldY) {
|
|
645
|
+
const offset2 = {
|
|
646
|
+
x: state.value.x,
|
|
647
|
+
y: state.value.y
|
|
648
|
+
};
|
|
649
|
+
emit("update:offset", offset2);
|
|
650
|
+
emit("offset-change", offset2);
|
|
651
|
+
}
|
|
652
|
+
}
|
|
612
653
|
};
|
|
613
654
|
const touch = {
|
|
614
655
|
startX: ref(0),
|
|
@@ -645,6 +686,7 @@ var __vue_sfc__$2 = /* @__PURE__ */ defineComponent(__spreadProps$1(__spreadValu
|
|
|
645
686
|
dragging.value = true;
|
|
646
687
|
prevX = state.value.x;
|
|
647
688
|
prevY = state.value.y;
|
|
689
|
+
document.body.classList.add("floating-bubble-dragging");
|
|
648
690
|
if (!("touches" in e)) {
|
|
649
691
|
window.addEventListener("mousemove", onTouchMove, { passive: false });
|
|
650
692
|
window.addEventListener("mouseup", onTouchEnd);
|
|
@@ -675,24 +717,15 @@ var __vue_sfc__$2 = /* @__PURE__ */ defineComponent(__spreadProps$1(__spreadValu
|
|
|
675
717
|
});
|
|
676
718
|
}
|
|
677
719
|
};
|
|
678
|
-
const closest = (arr, target) => {
|
|
679
|
-
return arr.reduce((pre, cur) => Math.abs(pre - target) < Math.abs(cur - target) ? pre : cur);
|
|
680
|
-
};
|
|
681
720
|
const onTouchEnd = (e) => {
|
|
682
721
|
dragging.value = false;
|
|
722
|
+
document.body.classList.remove("floating-bubble-dragging");
|
|
683
723
|
if (e && !("touches" in e) && e.type === "mouseup") {
|
|
684
724
|
window.removeEventListener("mousemove", onTouchMove);
|
|
685
725
|
window.removeEventListener("mouseup", onTouchEnd);
|
|
686
726
|
}
|
|
687
727
|
requestAnimationFrame(() => {
|
|
688
|
-
|
|
689
|
-
const nextX = closest([boundary.value.left, boundary.value.right], state.value.x);
|
|
690
|
-
state.value.x = nextX;
|
|
691
|
-
}
|
|
692
|
-
if (props.magnetic === "y") {
|
|
693
|
-
const nextY = closest([boundary.value.top, boundary.value.bottom], state.value.y);
|
|
694
|
-
state.value.y = nextY;
|
|
695
|
-
}
|
|
728
|
+
applyMagnetic();
|
|
696
729
|
if (!touch.isTap.value) {
|
|
697
730
|
emit("drag-end");
|
|
698
731
|
const offset = {
|
|
@@ -723,6 +756,7 @@ var __vue_sfc__$2 = /* @__PURE__ */ defineComponent(__spreadProps$1(__spreadValu
|
|
|
723
756
|
if (rootRef.value) rootRef.value.addEventListener("touchmove", onTouchMove, { passive: false });
|
|
724
757
|
});
|
|
725
758
|
onUnmounted(() => {
|
|
759
|
+
document.body.classList.remove("floating-bubble-dragging");
|
|
726
760
|
if (typeof window !== "undefined") {
|
|
727
761
|
window.removeEventListener("resize", handleResize);
|
|
728
762
|
window.removeEventListener("mousemove", onTouchMove);
|
|
@@ -752,6 +786,8 @@ var __vue_sfc__$2 = /* @__PURE__ */ defineComponent(__spreadProps$1(__spreadValu
|
|
|
752
786
|
windowWidth,
|
|
753
787
|
windowHeight,
|
|
754
788
|
boundary,
|
|
789
|
+
closest,
|
|
790
|
+
applyMagnetic,
|
|
755
791
|
dragging,
|
|
756
792
|
initialized,
|
|
757
793
|
rootStyle,
|
|
@@ -771,7 +807,6 @@ var __vue_sfc__$2 = /* @__PURE__ */ defineComponent(__spreadProps$1(__spreadValu
|
|
|
771
807
|
},
|
|
772
808
|
onTouchStart,
|
|
773
809
|
onTouchMove,
|
|
774
|
-
closest,
|
|
775
810
|
onTouchEnd,
|
|
776
811
|
onClick,
|
|
777
812
|
handleResize
|
|
@@ -799,38 +834,20 @@ __vue_sfc__$2.render = __vue_render__$2;
|
|
|
799
834
|
var FloatingBubble_vue_default = __vue_sfc__$2;
|
|
800
835
|
//#endregion
|
|
801
836
|
//#region es/open-code-widget/src/components/Trigger.vue.js
|
|
802
|
-
var STORAGE_KEY = "opencode-bubble-offset";
|
|
803
837
|
var __vue_sfc__$1 = /* @__PURE__ */ defineComponent({
|
|
804
838
|
__name: "Trigger",
|
|
805
|
-
emits: [
|
|
806
|
-
"offset-change",
|
|
807
|
-
"drag-start",
|
|
808
|
-
"drag-end"
|
|
809
|
-
],
|
|
839
|
+
emits: ["drag-start", "drag-end"],
|
|
810
840
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
811
|
-
const { buttonActive: active, open, hotkeyLabel, thinking, resolvedTheme, handleToggle } = useOpenCodeWidgetContext();
|
|
812
|
-
const
|
|
813
|
-
try {
|
|
814
|
-
const saved = localStorage.getItem(STORAGE_KEY);
|
|
815
|
-
if (saved) {
|
|
816
|
-
const parsed = JSON.parse(saved);
|
|
817
|
-
if (parsed && (parsed.x !== 0 || parsed.y !== 0)) return parsed;
|
|
818
|
-
}
|
|
819
|
-
} catch (e) {}
|
|
820
|
-
};
|
|
821
|
-
const offset = ref(loadOffset());
|
|
841
|
+
const { buttonActive: active, open, hotkeyLabel, thinking, resolvedTheme, handleToggle, bubbleOffset, handleBubbleOffsetChange } = useOpenCodeWidgetContext();
|
|
842
|
+
const offset = ref(bubbleOffset.value);
|
|
822
843
|
const emit = __emit;
|
|
823
|
-
const saveOffset = (value) => {
|
|
824
|
-
try {
|
|
825
|
-
localStorage.setItem(STORAGE_KEY, JSON.stringify(value));
|
|
826
|
-
} catch (e) {}
|
|
827
|
-
};
|
|
828
844
|
const handleOffsetChange = (value) => {
|
|
829
845
|
offset.value = value;
|
|
830
|
-
|
|
831
|
-
emit("offset-change", value);
|
|
846
|
+
handleBubbleOffsetChange(value);
|
|
832
847
|
};
|
|
833
|
-
watch(
|
|
848
|
+
watch(bubbleOffset, (newOffset) => {
|
|
849
|
+
offset.value = newOffset;
|
|
850
|
+
});
|
|
834
851
|
__expose({ offset });
|
|
835
852
|
const __returned__ = {
|
|
836
853
|
active,
|
|
@@ -839,11 +856,10 @@ var __vue_sfc__$1 = /* @__PURE__ */ defineComponent({
|
|
|
839
856
|
thinking,
|
|
840
857
|
resolvedTheme,
|
|
841
858
|
handleToggle,
|
|
842
|
-
|
|
843
|
-
|
|
859
|
+
bubbleOffset,
|
|
860
|
+
handleBubbleOffsetChange,
|
|
844
861
|
offset,
|
|
845
862
|
emit,
|
|
846
|
-
saveOffset,
|
|
847
863
|
handleOffsetChange,
|
|
848
864
|
FloatingBubble: FloatingBubble_vue_default
|
|
849
865
|
};
|
|
@@ -1347,35 +1363,16 @@ function findFileInfo(element, inspector) {
|
|
|
1347
1363
|
};
|
|
1348
1364
|
}
|
|
1349
1365
|
function getPreciseElementAtPoint(x, y, boundary) {
|
|
1350
|
-
|
|
1351
|
-
const
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
try {
|
|
1359
|
-
const elements = document.elementsFromPoint(x, y);
|
|
1360
|
-
for (const el of elements) {
|
|
1361
|
-
if (el.closest("#vue-inspector-container")) continue;
|
|
1362
|
-
if (el.closest(".opencode-widget")) continue;
|
|
1363
|
-
if (el.hasAttribute("data-v-inspector-ignore")) continue;
|
|
1364
|
-
if (boundary) {
|
|
1365
|
-
if (boundary.contains(el) || el === boundary) {
|
|
1366
|
-
element = el;
|
|
1367
|
-
break;
|
|
1368
|
-
}
|
|
1369
|
-
} else {
|
|
1370
|
-
element = el;
|
|
1371
|
-
break;
|
|
1372
|
-
}
|
|
1373
|
-
}
|
|
1374
|
-
} finally {
|
|
1375
|
-
if (highlight) highlight.style.display = highlightDisplay;
|
|
1376
|
-
if (tooltip) tooltip.style.display = tooltipDisplay;
|
|
1366
|
+
const elements = document.elementsFromPoint(x, y);
|
|
1367
|
+
for (const el of elements) {
|
|
1368
|
+
if (el.closest("#vue-inspector-container")) continue;
|
|
1369
|
+
if (el.closest(".opencode-widget")) continue;
|
|
1370
|
+
if (el.hasAttribute("data-v-inspector-ignore")) continue;
|
|
1371
|
+
if (boundary) {
|
|
1372
|
+
if (boundary.contains(el) || el === boundary) return el;
|
|
1373
|
+
} else return el;
|
|
1377
1374
|
}
|
|
1378
|
-
return
|
|
1375
|
+
return null;
|
|
1379
1376
|
}
|
|
1380
1377
|
function useInspector(options) {
|
|
1381
1378
|
const highlightVisible = ref(false);
|
|
@@ -1396,74 +1393,117 @@ function useInspector(options) {
|
|
|
1396
1393
|
});
|
|
1397
1394
|
const INSPECTOR_CHECK_INTERVAL = 500;
|
|
1398
1395
|
let inspectorCheckTimer = null;
|
|
1396
|
+
let currentHighlightElement = null;
|
|
1397
|
+
let currentFileInfo = {
|
|
1398
|
+
file: null,
|
|
1399
|
+
line: null,
|
|
1400
|
+
column: null
|
|
1401
|
+
};
|
|
1402
|
+
let currentPrimary = "#3b82f6";
|
|
1403
|
+
let currentPrimaryBg = "rgba(59, 130, 246, 0.1)";
|
|
1404
|
+
let currentDescription = "";
|
|
1405
|
+
let currentFileInfoText = "";
|
|
1399
1406
|
function handleMouseMoveCore(e) {
|
|
1400
1407
|
var _a, _b;
|
|
1401
1408
|
if (!options.selectMode.value) return;
|
|
1402
1409
|
const inspector = window.__VUE_INSPECTOR__;
|
|
1410
|
+
const highlight = document.querySelector(".opencode-element-highlight");
|
|
1411
|
+
const tooltip = document.querySelector(".opencode-element-tooltip");
|
|
1412
|
+
if (highlight) highlight.style.pointerEvents = "none";
|
|
1413
|
+
if (tooltip) tooltip.style.pointerEvents = "none";
|
|
1403
1414
|
let elementToHighlight = null;
|
|
1415
|
+
let targetNode = null;
|
|
1404
1416
|
let fileInfo = {
|
|
1405
1417
|
file: null,
|
|
1406
1418
|
line: null,
|
|
1407
1419
|
column: null
|
|
1408
1420
|
};
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1421
|
+
try {
|
|
1422
|
+
if (inspector) {
|
|
1423
|
+
const result = inspector.getTargetNode(e);
|
|
1424
|
+
targetNode = result.targetNode;
|
|
1425
|
+
const params = result.params;
|
|
1426
|
+
if (targetNode) {
|
|
1427
|
+
elementToHighlight = getPreciseElementAtPoint(e.clientX, e.clientY, targetNode) || targetNode;
|
|
1428
|
+
if (params && params.file) fileInfo = {
|
|
1429
|
+
file: params.file,
|
|
1430
|
+
line: (_a = params.line) != null ? _a : null,
|
|
1431
|
+
column: (_b = params.column) != null ? _b : null
|
|
1432
|
+
};
|
|
1433
|
+
else fileInfo = findFileInfo(targetNode, inspector);
|
|
1434
|
+
}
|
|
1419
1435
|
}
|
|
1436
|
+
if (!elementToHighlight) elementToHighlight = getPreciseElementAtPoint(e.clientX, e.clientY, null);
|
|
1437
|
+
if (elementToHighlight && !fileInfo.file) fileInfo = getFileInfoFromVueInstance(elementToHighlight) || fileInfo;
|
|
1438
|
+
} finally {
|
|
1439
|
+
if (highlight) highlight.style.pointerEvents = "";
|
|
1440
|
+
if (tooltip) tooltip.style.pointerEvents = "";
|
|
1420
1441
|
}
|
|
1421
|
-
if (!elementToHighlight) elementToHighlight = getPreciseElementAtPoint(e.clientX, e.clientY, null);
|
|
1422
|
-
if (elementToHighlight && !fileInfo.file) fileInfo = getFileInfoFromVueInstance(elementToHighlight) || fileInfo;
|
|
1423
1442
|
if (elementToHighlight) {
|
|
1424
|
-
const
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
width: `${rect.width}px`,
|
|
1438
|
-
height: `${rect.height}px`,
|
|
1439
|
-
border: `2px solid ${primary}`,
|
|
1440
|
-
background: primaryBg
|
|
1441
|
-
};
|
|
1442
|
-
const description = getElementDescription(elementToHighlight);
|
|
1443
|
-
const fileName = fileInfo.file ? fileInfo.file.split("/").pop() : "";
|
|
1443
|
+
const elementChanged = currentHighlightElement !== elementToHighlight;
|
|
1444
|
+
if (elementChanged) {
|
|
1445
|
+
currentHighlightElement = elementToHighlight;
|
|
1446
|
+
currentFileInfo = fileInfo;
|
|
1447
|
+
const widget = document.querySelector(".opencode-widget");
|
|
1448
|
+
if (widget) {
|
|
1449
|
+
const style = getComputedStyle(widget);
|
|
1450
|
+
currentPrimary = style.getPropertyValue("--oc-primary").trim() || currentPrimary;
|
|
1451
|
+
currentPrimaryBg = style.getPropertyValue("--oc-primary-bg").trim() || currentPrimaryBg;
|
|
1452
|
+
}
|
|
1453
|
+
currentDescription = getElementDescription(elementToHighlight);
|
|
1454
|
+
} else if (!currentFileInfo.file && fileInfo.file) currentFileInfo = fileInfo;
|
|
1455
|
+
const fileName = currentFileInfo.file ? currentFileInfo.file.split("/").pop() : "";
|
|
1444
1456
|
let lineInfo = "";
|
|
1445
|
-
if (
|
|
1446
|
-
lineInfo = `:${
|
|
1447
|
-
if (
|
|
1457
|
+
if (currentFileInfo.line) {
|
|
1458
|
+
lineInfo = `:${currentFileInfo.line}`;
|
|
1459
|
+
if (currentFileInfo.column) lineInfo += `:${currentFileInfo.column}`;
|
|
1448
1460
|
}
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1461
|
+
const newFileInfoText = fileName ? `${fileName}${lineInfo}` : "";
|
|
1462
|
+
if (elementChanged || currentFileInfoText !== newFileInfoText) {
|
|
1463
|
+
currentFileInfoText = newFileInfoText;
|
|
1464
|
+
tooltipContent.value = {
|
|
1465
|
+
description: currentDescription,
|
|
1466
|
+
fileInfo: currentFileInfoText
|
|
1467
|
+
};
|
|
1468
|
+
}
|
|
1469
|
+
const rect = elementToHighlight.getBoundingClientRect();
|
|
1470
|
+
const newTop = `${rect.top}px`;
|
|
1471
|
+
const newLeft = `${rect.left}px`;
|
|
1472
|
+
const newWidth = `${rect.width}px`;
|
|
1473
|
+
const newHeight = `${rect.height}px`;
|
|
1474
|
+
if (highlightStyle.value.top !== newTop || highlightStyle.value.left !== newLeft || highlightStyle.value.width !== newWidth || highlightStyle.value.height !== newHeight) highlightStyle.value = {
|
|
1475
|
+
top: newTop,
|
|
1476
|
+
left: newLeft,
|
|
1477
|
+
width: newWidth,
|
|
1478
|
+
height: newHeight,
|
|
1479
|
+
border: `2px solid ${currentPrimary}`,
|
|
1480
|
+
background: currentPrimaryBg
|
|
1452
1481
|
};
|
|
1453
|
-
tooltipVisible.value = true;
|
|
1454
1482
|
const tooltipHeight = 50;
|
|
1455
1483
|
const tooltipWidth = 200;
|
|
1456
1484
|
let tooltipTop = rect.top - tooltipHeight - 8;
|
|
1457
1485
|
let tooltipLeft = rect.left;
|
|
1458
1486
|
if (tooltipTop < 10) tooltipTop = rect.bottom + 8;
|
|
1459
1487
|
if (tooltipLeft + tooltipWidth > window.innerWidth - 10) tooltipLeft = window.innerWidth - tooltipWidth - 10;
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1488
|
+
const newTooltipTop = `${tooltipTop}px`;
|
|
1489
|
+
const newTooltipLeft = `${tooltipLeft}px`;
|
|
1490
|
+
if (tooltipStyle.value.top !== newTooltipTop || tooltipStyle.value.left !== newTooltipLeft) tooltipStyle.value = {
|
|
1491
|
+
top: newTooltipTop,
|
|
1492
|
+
left: newTooltipLeft
|
|
1463
1493
|
};
|
|
1494
|
+
if (!highlightVisible.value) highlightVisible.value = true;
|
|
1495
|
+
if (!tooltipVisible.value) tooltipVisible.value = true;
|
|
1464
1496
|
} else {
|
|
1465
|
-
|
|
1466
|
-
|
|
1497
|
+
currentHighlightElement = null;
|
|
1498
|
+
currentDescription = "";
|
|
1499
|
+
currentFileInfoText = "";
|
|
1500
|
+
currentFileInfo = {
|
|
1501
|
+
file: null,
|
|
1502
|
+
line: null,
|
|
1503
|
+
column: null
|
|
1504
|
+
};
|
|
1505
|
+
if (highlightVisible.value) highlightVisible.value = false;
|
|
1506
|
+
if (tooltipVisible.value) tooltipVisible.value = false;
|
|
1467
1507
|
}
|
|
1468
1508
|
}
|
|
1469
1509
|
const handleMouseMove = throttle(handleMouseMoveCore, 16);
|
|
@@ -1527,6 +1567,14 @@ function useInspector(options) {
|
|
|
1527
1567
|
if (inspector) inspector.disable();
|
|
1528
1568
|
document.removeEventListener("mousemove", handleMouseMove);
|
|
1529
1569
|
document.removeEventListener("keydown", handleKeydown, true);
|
|
1570
|
+
currentHighlightElement = null;
|
|
1571
|
+
currentDescription = "";
|
|
1572
|
+
currentFileInfoText = "";
|
|
1573
|
+
currentFileInfo = {
|
|
1574
|
+
file: null,
|
|
1575
|
+
line: null,
|
|
1576
|
+
column: null
|
|
1577
|
+
};
|
|
1530
1578
|
highlightVisible.value = false;
|
|
1531
1579
|
tooltipVisible.value = false;
|
|
1532
1580
|
}
|
|
@@ -1557,6 +1605,62 @@ function useInspector(options) {
|
|
|
1557
1605
|
};
|
|
1558
1606
|
}
|
|
1559
1607
|
//#endregion
|
|
1608
|
+
//#region es/open-code-widget/composables/use-persist-state.js
|
|
1609
|
+
var STORAGE_KEY = "opencode-widget-state";
|
|
1610
|
+
function loadState() {
|
|
1611
|
+
if (typeof window === "undefined") return null;
|
|
1612
|
+
try {
|
|
1613
|
+
const stored = localStorage.getItem(STORAGE_KEY);
|
|
1614
|
+
if (stored) return JSON.parse(stored);
|
|
1615
|
+
} catch (e) {
|
|
1616
|
+
console.warn("[OpenCodeWidget] Failed to load persisted state:", e);
|
|
1617
|
+
}
|
|
1618
|
+
return null;
|
|
1619
|
+
}
|
|
1620
|
+
function saveState(state) {
|
|
1621
|
+
if (typeof window === "undefined") return;
|
|
1622
|
+
try {
|
|
1623
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify(state));
|
|
1624
|
+
} catch (e) {
|
|
1625
|
+
console.warn("[OpenCodeWidget] Failed to save state:", e);
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
function usePersistState(options) {
|
|
1629
|
+
const restoreState = () => {
|
|
1630
|
+
const saved = loadState();
|
|
1631
|
+
if (options.onRestore) options.onRestore(saved || {});
|
|
1632
|
+
return saved;
|
|
1633
|
+
};
|
|
1634
|
+
const getCurrentState = () => ({
|
|
1635
|
+
open: options.open.value,
|
|
1636
|
+
minimized: options.minimized.value,
|
|
1637
|
+
promptDockVisible: options.promptDockVisible.value,
|
|
1638
|
+
bubbleOffset: options.bubbleOffset.value,
|
|
1639
|
+
theme: options.theme.value,
|
|
1640
|
+
sessionListCollapsed: options.sessionListCollapsed.value
|
|
1641
|
+
});
|
|
1642
|
+
const persistState = () => {
|
|
1643
|
+
saveState(getCurrentState());
|
|
1644
|
+
};
|
|
1645
|
+
onMounted(() => {
|
|
1646
|
+
restoreState();
|
|
1647
|
+
watch([
|
|
1648
|
+
options.open,
|
|
1649
|
+
options.minimized,
|
|
1650
|
+
options.promptDockVisible,
|
|
1651
|
+
options.bubbleOffset,
|
|
1652
|
+
options.theme,
|
|
1653
|
+
options.sessionListCollapsed
|
|
1654
|
+
], () => {
|
|
1655
|
+
persistState();
|
|
1656
|
+
}, { deep: true });
|
|
1657
|
+
});
|
|
1658
|
+
return {
|
|
1659
|
+
restoreState,
|
|
1660
|
+
persistState
|
|
1661
|
+
};
|
|
1662
|
+
}
|
|
1663
|
+
//#endregion
|
|
1560
1664
|
//#region es/open-code-widget/src/index.vue.js
|
|
1561
1665
|
var __defProp = Object.defineProperty;
|
|
1562
1666
|
var __defProps = Object.defineProperties;
|
|
@@ -1689,6 +1793,10 @@ var __vue_sfc__ = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
1689
1793
|
type: Boolean,
|
|
1690
1794
|
required: false,
|
|
1691
1795
|
default: false
|
|
1796
|
+
},
|
|
1797
|
+
sessionStates: {
|
|
1798
|
+
type: Object,
|
|
1799
|
+
required: false
|
|
1692
1800
|
}
|
|
1693
1801
|
},
|
|
1694
1802
|
emits: [
|
|
@@ -1760,17 +1868,26 @@ var __vue_sfc__ = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
1760
1868
|
var _a;
|
|
1761
1869
|
(_a = frameRef.value) == null || _a.sendMessageToIframe(type, data);
|
|
1762
1870
|
};
|
|
1871
|
+
const localSessionListCollapsed = ref(props.sessionListCollapsed);
|
|
1872
|
+
const minimized = ref(false);
|
|
1873
|
+
const promptDockVisible = ref(true);
|
|
1874
|
+
const isRestoring = ref(true);
|
|
1875
|
+
const iframeLoaded = ref(false);
|
|
1876
|
+
const syncStateToIframe = () => {
|
|
1877
|
+
if (!iframeLoaded.value) return;
|
|
1878
|
+
sendMessageToIframe("prompt-dock-visibility-change", { visible: promptDockVisible.value });
|
|
1879
|
+
sendMessageToIframe("minimize-state-change", { minimized: minimized.value });
|
|
1880
|
+
};
|
|
1763
1881
|
const handleFrameLoaded = () => {
|
|
1764
1882
|
emit("frame-loaded");
|
|
1883
|
+
iframeLoaded.value = true;
|
|
1884
|
+
syncStateToIframe();
|
|
1765
1885
|
};
|
|
1766
1886
|
__expose({
|
|
1767
1887
|
showNotification,
|
|
1768
1888
|
showConfirmDialog,
|
|
1769
1889
|
sendMessageToIframe
|
|
1770
1890
|
});
|
|
1771
|
-
const localSessionListCollapsed = ref(props.sessionListCollapsed);
|
|
1772
|
-
const minimized = ref(false);
|
|
1773
|
-
const promptDockVisible = ref(true);
|
|
1774
1891
|
watch(() => props.sessionListCollapsed, (val) => {
|
|
1775
1892
|
localSessionListCollapsed.value = val;
|
|
1776
1893
|
});
|
|
@@ -1845,6 +1962,48 @@ var __vue_sfc__ = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
1845
1962
|
emit("toggle-select-mode", false);
|
|
1846
1963
|
}
|
|
1847
1964
|
});
|
|
1965
|
+
const bubbleOffset = ref(void 0);
|
|
1966
|
+
usePersistState({
|
|
1967
|
+
open: toRef(props, "open"),
|
|
1968
|
+
minimized,
|
|
1969
|
+
promptDockVisible,
|
|
1970
|
+
bubbleOffset,
|
|
1971
|
+
theme: toRef(props, "theme"),
|
|
1972
|
+
sessionListCollapsed: localSessionListCollapsed,
|
|
1973
|
+
onRestore: (state) => {
|
|
1974
|
+
if (state.open !== void 0 && state.open !== props.open) {
|
|
1975
|
+
emit("update:open", state.open);
|
|
1976
|
+
emit("toggle", state.open);
|
|
1977
|
+
}
|
|
1978
|
+
if (state.minimized !== void 0) minimized.value = state.minimized;
|
|
1979
|
+
if (state.bubbleOffset !== void 0) {
|
|
1980
|
+
const bubbleSize = 44;
|
|
1981
|
+
const margin = 10;
|
|
1982
|
+
const maxX = window.innerWidth - bubbleSize - margin;
|
|
1983
|
+
const maxY = window.innerHeight - bubbleSize - margin;
|
|
1984
|
+
bubbleOffset.value = {
|
|
1985
|
+
x: Math.max(margin, Math.min(state.bubbleOffset.x, maxX)),
|
|
1986
|
+
y: Math.max(margin, Math.min(state.bubbleOffset.y, maxY))
|
|
1987
|
+
};
|
|
1988
|
+
}
|
|
1989
|
+
if (state.theme !== void 0 && state.theme !== props.theme) {
|
|
1990
|
+
emit("update:theme", state.theme);
|
|
1991
|
+
emit("toggle-theme", state.theme);
|
|
1992
|
+
}
|
|
1993
|
+
if (state.sessionListCollapsed !== void 0 && state.sessionListCollapsed !== props.sessionListCollapsed) {
|
|
1994
|
+
localSessionListCollapsed.value = state.sessionListCollapsed;
|
|
1995
|
+
emit("update:sessionListCollapsed", state.sessionListCollapsed);
|
|
1996
|
+
}
|
|
1997
|
+
if (state.promptDockVisible !== void 0) promptDockVisible.value = state.promptDockVisible;
|
|
1998
|
+
else if (minimized.value) promptDockVisible.value = false;
|
|
1999
|
+
nextTick(() => {
|
|
2000
|
+
syncStateToIframe();
|
|
2001
|
+
setTimeout(() => {
|
|
2002
|
+
isRestoring.value = false;
|
|
2003
|
+
}, 50);
|
|
2004
|
+
});
|
|
2005
|
+
}
|
|
2006
|
+
});
|
|
1848
2007
|
const handleToggleMinimize = () => {
|
|
1849
2008
|
minimized.value = !minimized.value;
|
|
1850
2009
|
promptDockVisible.value = !minimized.value;
|
|
@@ -1855,15 +2014,29 @@ var __vue_sfc__ = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
1855
2014
|
promptDockVisible.value = !promptDockVisible.value;
|
|
1856
2015
|
sendMessageToIframe("prompt-dock-visibility-change", { visible: promptDockVisible.value });
|
|
1857
2016
|
};
|
|
1858
|
-
const
|
|
2017
|
+
const windowWidth = ref(typeof window !== "undefined" ? window.innerWidth : 0);
|
|
2018
|
+
const windowHeight = ref(typeof window !== "undefined" ? window.innerHeight : 0);
|
|
2019
|
+
const handleWindowResize = () => {
|
|
2020
|
+
if (typeof window !== "undefined") {
|
|
2021
|
+
windowWidth.value = window.innerWidth;
|
|
2022
|
+
windowHeight.value = window.innerHeight;
|
|
2023
|
+
}
|
|
2024
|
+
};
|
|
2025
|
+
onMounted(() => {
|
|
2026
|
+
if (typeof window !== "undefined") window.addEventListener("resize", handleWindowResize);
|
|
2027
|
+
});
|
|
2028
|
+
onUnmounted(() => {
|
|
2029
|
+
if (typeof window !== "undefined") window.removeEventListener("resize", handleWindowResize);
|
|
2030
|
+
});
|
|
1859
2031
|
const bubbleQuadrant = computed(() => {
|
|
1860
2032
|
var _a, _b, _c, _d;
|
|
1861
2033
|
if (typeof window === "undefined") return "bottom-right";
|
|
1862
|
-
const centerX =
|
|
1863
|
-
const centerY =
|
|
2034
|
+
const centerX = windowWidth.value / 2;
|
|
2035
|
+
const centerY = windowHeight.value / 2;
|
|
1864
2036
|
const bubbleSize = 44;
|
|
1865
|
-
const
|
|
1866
|
-
const
|
|
2037
|
+
const currentOffset = (_b = (_a = triggerRef.value) == null ? void 0 : _a.offset) != null ? _b : bubbleOffset.value;
|
|
2038
|
+
const effectiveX = ((_c = currentOffset == null ? void 0 : currentOffset.x) != null ? _c : windowWidth.value - bubbleSize - 24) + bubbleSize / 2;
|
|
2039
|
+
const effectiveY = ((_d = currentOffset == null ? void 0 : currentOffset.y) != null ? _d : windowHeight.value - bubbleSize - 24) + bubbleSize / 2;
|
|
1867
2040
|
if (effectiveX >= centerX && effectiveY >= centerY) return "bottom-right";
|
|
1868
2041
|
else if (effectiveX < centerX && effectiveY >= centerY) return "bottom-left";
|
|
1869
2042
|
else if (effectiveX >= centerX && effectiveY < centerY) return "top-right";
|
|
@@ -1874,35 +2047,37 @@ var __vue_sfc__ = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
1874
2047
|
return quadrant === "top-right" || quadrant === "bottom-right";
|
|
1875
2048
|
});
|
|
1876
2049
|
const chatPositionStyle = computed(() => {
|
|
1877
|
-
var _a;
|
|
2050
|
+
var _a, _b, _c;
|
|
1878
2051
|
if (typeof window === "undefined") return {};
|
|
1879
|
-
const windowWidth = window.innerWidth;
|
|
1880
|
-
const windowHeight = window.innerHeight;
|
|
1881
2052
|
const chatWidth = minimized.value ? 300 : 700;
|
|
1882
|
-
const chatHeight = minimized.value ? 300 : Math.min(windowHeight * .86, windowHeight - 40);
|
|
2053
|
+
const chatHeight = minimized.value ? 300 : Math.min(windowHeight.value * .86, windowHeight.value - 40);
|
|
1883
2054
|
const gap = 24;
|
|
1884
2055
|
const bubbleSize = 44;
|
|
1885
2056
|
const screenMargin = 20;
|
|
1886
|
-
const effectiveOffset = (_a = bubbleOffset.value) != null ?
|
|
1887
|
-
x: windowWidth - bubbleSize - gap,
|
|
1888
|
-
y: windowHeight - bubbleSize - gap
|
|
2057
|
+
const effectiveOffset = (_c = (_b = (_a = triggerRef.value) == null ? void 0 : _a.offset) != null ? _b : bubbleOffset.value) != null ? _c : {
|
|
2058
|
+
x: windowWidth.value - bubbleSize - gap,
|
|
2059
|
+
y: windowHeight.value - bubbleSize - gap
|
|
1889
2060
|
};
|
|
1890
2061
|
const style = {};
|
|
1891
2062
|
if (isBubbleOnRightSide.value) {
|
|
1892
|
-
let rightPos = windowWidth - effectiveOffset.x + gap;
|
|
1893
|
-
const
|
|
2063
|
+
let rightPos = windowWidth.value - effectiveOffset.x + gap;
|
|
2064
|
+
const minRight = screenMargin;
|
|
2065
|
+
const maxRight = windowWidth.value - chatWidth - screenMargin;
|
|
1894
2066
|
if (rightPos > maxRight) rightPos = maxRight;
|
|
2067
|
+
if (rightPos < minRight) rightPos = minRight;
|
|
1895
2068
|
style.right = `${rightPos}px`;
|
|
1896
2069
|
style.left = "auto";
|
|
1897
2070
|
} else {
|
|
1898
2071
|
let leftPos = effectiveOffset.x + bubbleSize + gap;
|
|
1899
|
-
const
|
|
2072
|
+
const minLeft = screenMargin;
|
|
2073
|
+
const maxLeft = windowWidth.value - chatWidth - screenMargin;
|
|
1900
2074
|
if (leftPos > maxLeft) leftPos = maxLeft;
|
|
2075
|
+
if (leftPos < minLeft) leftPos = minLeft;
|
|
1901
2076
|
style.left = `${leftPos}px`;
|
|
1902
2077
|
style.right = "auto";
|
|
1903
2078
|
}
|
|
1904
|
-
let bottomPos = windowHeight - effectiveOffset.y - bubbleSize;
|
|
1905
|
-
const maxBottom = windowHeight - chatHeight - screenMargin;
|
|
2079
|
+
let bottomPos = windowHeight.value - effectiveOffset.y - bubbleSize;
|
|
2080
|
+
const maxBottom = windowHeight.value - chatHeight - screenMargin;
|
|
1906
2081
|
if (bottomPos > maxBottom) bottomPos = maxBottom;
|
|
1907
2082
|
if (bottomPos < screenMargin) bottomPos = screenMargin;
|
|
1908
2083
|
style.bottom = `${bottomPos}px`;
|
|
@@ -1964,6 +2139,11 @@ var __vue_sfc__ = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
1964
2139
|
thinking: toRef(props, "thinking"),
|
|
1965
2140
|
minimized,
|
|
1966
2141
|
promptDockVisible,
|
|
2142
|
+
bubbleOffset,
|
|
2143
|
+
sessionStates: computed(() => {
|
|
2144
|
+
var _a;
|
|
2145
|
+
return (_a = props.sessionStates) != null ? _a : {};
|
|
2146
|
+
}),
|
|
1967
2147
|
iframeSource,
|
|
1968
2148
|
buttonActive,
|
|
1969
2149
|
sessionListTitle,
|
|
@@ -1985,7 +2165,8 @@ var __vue_sfc__ = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
1985
2165
|
handleClickSelectedNode,
|
|
1986
2166
|
handleRemoveSelectedNode: (payload) => handleRemoveSelectedNode(payload.item, payload.index, payload.source),
|
|
1987
2167
|
handleClearSelectedNodes,
|
|
1988
|
-
handleFrameLoaded
|
|
2168
|
+
handleFrameLoaded,
|
|
2169
|
+
handleBubbleOffsetChange
|
|
1989
2170
|
});
|
|
1990
2171
|
const __returned__ = {
|
|
1991
2172
|
props,
|
|
@@ -2015,10 +2196,13 @@ var __vue_sfc__ = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
2015
2196
|
frameRef,
|
|
2016
2197
|
triggerRef,
|
|
2017
2198
|
sendMessageToIframe,
|
|
2018
|
-
handleFrameLoaded,
|
|
2019
2199
|
localSessionListCollapsed,
|
|
2020
2200
|
minimized,
|
|
2021
2201
|
promptDockVisible,
|
|
2202
|
+
isRestoring,
|
|
2203
|
+
iframeLoaded,
|
|
2204
|
+
syncStateToIframe,
|
|
2205
|
+
handleFrameLoaded,
|
|
2022
2206
|
buttonActive,
|
|
2023
2207
|
containerClasses,
|
|
2024
2208
|
iframeSource,
|
|
@@ -2045,9 +2229,12 @@ var __vue_sfc__ = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
2045
2229
|
tooltipVisible,
|
|
2046
2230
|
tooltipStyle,
|
|
2047
2231
|
tooltipContent,
|
|
2232
|
+
bubbleOffset,
|
|
2048
2233
|
handleToggleMinimize,
|
|
2049
2234
|
handleTogglePromptDock,
|
|
2050
|
-
|
|
2235
|
+
windowWidth,
|
|
2236
|
+
windowHeight,
|
|
2237
|
+
handleWindowResize,
|
|
2051
2238
|
bubbleQuadrant,
|
|
2052
2239
|
isBubbleOnRightSide,
|
|
2053
2240
|
chatPositionStyle,
|
|
@@ -2104,7 +2291,6 @@ function __vue_render__(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2104
2291
|
return openBlock(), createElementBlock("div", { class: normalizeClass($setup.containerClasses) }, [
|
|
2105
2292
|
createVNode($setup["Trigger"], {
|
|
2106
2293
|
ref: "triggerRef",
|
|
2107
|
-
onOffsetChange: $setup.handleBubbleOffsetChange,
|
|
2108
2294
|
onDragStart: $setup.handleDragStart,
|
|
2109
2295
|
onDragEnd: $setup.handleDragEnd
|
|
2110
2296
|
}, createSlots({ _: 2 }, [$setup.slots["button-icon"] ? {
|
|
@@ -2116,7 +2302,8 @@ function __vue_render__(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2116
2302
|
class: normalizeClass(["opencode-chat", {
|
|
2117
2303
|
open: $props.open,
|
|
2118
2304
|
minimized: $setup.minimized,
|
|
2119
|
-
dragging: $setup.isDragging
|
|
2305
|
+
dragging: $setup.isDragging,
|
|
2306
|
+
"no-transition": $setup.isRestoring
|
|
2120
2307
|
}]),
|
|
2121
2308
|
style: normalizeStyle($setup.chatPositionStyle)
|
|
2122
2309
|
}, [
|
|
@@ -2171,11 +2358,11 @@ function __vue_render__(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2171
2358
|
createVNode($setup["SelectHint"]),
|
|
2172
2359
|
withDirectives(createElementVNode("div", {
|
|
2173
2360
|
class: "opencode-element-highlight",
|
|
2174
|
-
style: normalizeStyle(
|
|
2361
|
+
style: normalizeStyle($setup.highlightStyle)
|
|
2175
2362
|
}, null, 4), [[vShow, $setup.highlightVisible]]),
|
|
2176
2363
|
withDirectives(createElementVNode("div", {
|
|
2177
2364
|
class: "opencode-element-tooltip",
|
|
2178
|
-
style: normalizeStyle(
|
|
2365
|
+
style: normalizeStyle($setup.tooltipStyle)
|
|
2179
2366
|
}, [createElementVNode("div", _hoisted_3, toDisplayString($setup.tooltipContent.description), 1), createElementVNode("div", _hoisted_4, toDisplayString($setup.tooltipContent.fileInfo), 1)], 4), [[vShow, $setup.tooltipVisible]]),
|
|
2180
2367
|
$setup.dialogVisible ? (openBlock(), createElementBlock("div", _hoisted_5, [createElementVNode("div", _hoisted_6, [createElementVNode("div", _hoisted_7, [createElementVNode("div", _hoisted_8, toDisplayString($setup.dialogMessage), 1)]), createElementVNode("div", { class: "opencode-dialog-actions" }, [createElementVNode("button", {
|
|
2181
2368
|
class: "opencode-dialog-btn cancel",
|
|
@@ -2193,7 +2380,7 @@ __vue_sfc__.render = __vue_render__;
|
|
|
2193
2380
|
var open_code_widget_default = __vue_sfc__;
|
|
2194
2381
|
//#endregion
|
|
2195
2382
|
//#region es/index.js
|
|
2196
|
-
var version = "1.0.
|
|
2383
|
+
var version = "1.0.28";
|
|
2197
2384
|
function install(app, options) {
|
|
2198
2385
|
[open_code_widget_default].forEach((item) => {
|
|
2199
2386
|
if (item.install) app.use(item, options);
|