@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
|
@@ -216,7 +216,7 @@ var _hoisted_8$2 = {
|
|
|
216
216
|
"aria-hidden": "true"
|
|
217
217
|
};
|
|
218
218
|
var _hoisted_9$2 = { class: "opencode-chat-header-title" };
|
|
219
|
-
var _hoisted_10 = { class: "opencode-chat-header-actions" };
|
|
219
|
+
var _hoisted_10$1 = { class: "opencode-chat-header-actions" };
|
|
220
220
|
var _hoisted_11 = [
|
|
221
221
|
"title",
|
|
222
222
|
"aria-label",
|
|
@@ -298,7 +298,7 @@ function __vue_render__$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
298
298
|
}, [(0, vue.renderSlot)(_ctx.$slots, "theme-icon", {}, () => [$setup.theme === "light" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("svg", _hoisted_6$3, [..._cache[8] || (_cache[8] = [(0, vue.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" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("svg", _hoisted_7$2, [..._cache[9] || (_cache[9] = [(0, vue.createElementVNode)("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" }, null, -1)])])) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("svg", _hoisted_8$2, [..._cache[10] || (_cache[10] = [(0, vue.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)
|
|
299
299
|
]),
|
|
300
300
|
(0, vue.createElementVNode)("span", _hoisted_9$2, (0, vue.toDisplayString)($setup.title), 1),
|
|
301
|
-
(0, vue.createElementVNode)("div", _hoisted_10, [
|
|
301
|
+
(0, vue.createElementVNode)("div", _hoisted_10$1, [
|
|
302
302
|
(0, vue.createElementVNode)("button", {
|
|
303
303
|
class: "opencode-header-btn prompt-dock",
|
|
304
304
|
type: "button",
|
|
@@ -435,7 +435,7 @@ var __vue_sfc__$3 = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
435
435
|
__name: "SessionList",
|
|
436
436
|
setup(__props, { expose: __expose }) {
|
|
437
437
|
__expose();
|
|
438
|
-
const { sessionListCollapsed: collapsed, sessionItems: sessions, loadingSessionList, showSessionListSkeleton, handleCreateSession, handleSelectSession, handleDeleteSession, sessionKey } = useOpenCodeWidgetContext();
|
|
438
|
+
const { sessionListCollapsed: collapsed, sessionItems: sessions, loadingSessionList, showSessionListSkeleton, handleCreateSession, handleSelectSession, handleDeleteSession, sessionKey, sessionStates } = useOpenCodeWidgetContext();
|
|
439
439
|
const isAnimating = (0, vue.ref)(false);
|
|
440
440
|
let animTimer = null;
|
|
441
441
|
(0, vue.watch)(collapsed, () => {
|
|
@@ -445,6 +445,16 @@ var __vue_sfc__$3 = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
445
445
|
isAnimating.value = false;
|
|
446
446
|
}, 200);
|
|
447
447
|
});
|
|
448
|
+
const showSkeleton = (0, vue.computed)(() => {
|
|
449
|
+
if (isAnimating.value) return true;
|
|
450
|
+
if (showSessionListSkeleton.value) return true;
|
|
451
|
+
return false;
|
|
452
|
+
});
|
|
453
|
+
function isSessionThinking(sessionId) {
|
|
454
|
+
var _a, _b;
|
|
455
|
+
if (!(sessionStates == null ? void 0 : sessionStates.value) || !sessionId) return false;
|
|
456
|
+
return (_b = (_a = sessionStates.value[sessionId]) == null ? void 0 : _a.thinking) != null ? _b : false;
|
|
457
|
+
}
|
|
448
458
|
const __returned__ = {
|
|
449
459
|
collapsed,
|
|
450
460
|
sessions,
|
|
@@ -454,6 +464,7 @@ var __vue_sfc__$3 = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
454
464
|
handleSelectSession,
|
|
455
465
|
handleDeleteSession,
|
|
456
466
|
sessionKey,
|
|
467
|
+
sessionStates,
|
|
457
468
|
isAnimating,
|
|
458
469
|
get animTimer() {
|
|
459
470
|
return animTimer;
|
|
@@ -461,11 +472,8 @@ var __vue_sfc__$3 = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
461
472
|
set animTimer(v) {
|
|
462
473
|
animTimer = v;
|
|
463
474
|
},
|
|
464
|
-
showSkeleton
|
|
465
|
-
|
|
466
|
-
if (showSessionListSkeleton.value) return true;
|
|
467
|
-
return false;
|
|
468
|
-
})
|
|
475
|
+
showSkeleton,
|
|
476
|
+
isSessionThinking
|
|
469
477
|
};
|
|
470
478
|
Object.defineProperty(__returned__, "__isScriptSetup", {
|
|
471
479
|
enumerable: false,
|
|
@@ -494,8 +502,12 @@ var _hoisted_4$1 = {
|
|
|
494
502
|
var _hoisted_5$1 = ["aria-selected", "onClick"];
|
|
495
503
|
var _hoisted_6$1 = { class: "opencode-session-header" };
|
|
496
504
|
var _hoisted_7$1 = { class: "opencode-session-title" };
|
|
497
|
-
var _hoisted_8$1 =
|
|
498
|
-
|
|
505
|
+
var _hoisted_8$1 = {
|
|
506
|
+
key: 0,
|
|
507
|
+
class: "opencode-thinking-loading"
|
|
508
|
+
};
|
|
509
|
+
var _hoisted_9$1 = ["aria-label", "onClick"];
|
|
510
|
+
var _hoisted_10 = { class: "opencode-session-meta" };
|
|
499
511
|
function __vue_render__$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
500
512
|
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", { class: (0, vue.normalizeClass)(["opencode-session-list", { collapsed: $setup.collapsed }]) }, [
|
|
501
513
|
(0, vue.createCommentVNode)(" Header "),
|
|
@@ -515,16 +527,19 @@ function __vue_render__$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
515
527
|
}), 64))])) : ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 3 }, [(0, vue.createCommentVNode)(" Content "), (0, vue.createElementVNode)("div", _hoisted_3$1, [$setup.loadingSessionList ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_4$1, [..._cache[4] || (_cache[4] = [(0, vue.createElementVNode)("div", { class: "opencode-loading-spinner small" }, null, -1)])])) : (0, vue.createCommentVNode)("v-if", true), $setup.sessions.length > 0 ? ((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, { key: 1 }, (0, vue.renderList)($setup.sessions, (item) => {
|
|
516
528
|
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
517
529
|
key: item[$setup.sessionKey],
|
|
518
|
-
class: (0, vue.normalizeClass)(["opencode-session-item", {
|
|
530
|
+
class: (0, vue.normalizeClass)(["opencode-session-item", {
|
|
531
|
+
active: item.active,
|
|
532
|
+
thinking: $setup.isSessionThinking(item.id)
|
|
533
|
+
}]),
|
|
519
534
|
role: "option",
|
|
520
535
|
"aria-selected": item.active,
|
|
521
536
|
onClick: ($event) => $setup.handleSelectSession(item)
|
|
522
|
-
}, [(0, vue.createElementVNode)("div", _hoisted_6$1, [(0, vue.createElementVNode)("div", _hoisted_7$1, (0, vue.toDisplayString)(item.title), 1), (0, vue.createElementVNode)("button", {
|
|
537
|
+
}, [(0, vue.createElementVNode)("div", _hoisted_6$1, [(0, vue.createElementVNode)("div", _hoisted_7$1, [$setup.isSessionThinking(item.id) ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_8$1)) : (0, vue.createCommentVNode)("v-if", true), (0, vue.createTextVNode)(" " + (0, vue.toDisplayString)(item.title), 1)]), (0, vue.createElementVNode)("button", {
|
|
523
538
|
class: "opencode-session-delete-btn",
|
|
524
539
|
type: "button",
|
|
525
540
|
"aria-label": `\u5220\u9664\u4F1A\u8BDD: ${item.title}`,
|
|
526
541
|
onClick: (0, vue.withModifiers)(($event) => $setup.handleDeleteSession(item), ["stop"])
|
|
527
|
-
}, " × ", 8,
|
|
542
|
+
}, " × ", 8, _hoisted_9$1)]), (0, vue.createElementVNode)("div", _hoisted_10, (0, vue.toDisplayString)(item.meta), 1)], 10, _hoisted_5$1);
|
|
528
543
|
}), 128)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 2 }, [(0, vue.createCommentVNode)(" Empty State "), (0, vue.renderSlot)(_ctx.$slots, "empty")], 64))])], 2112))
|
|
529
544
|
], 2);
|
|
530
545
|
}
|
|
@@ -609,6 +624,19 @@ var __vue_sfc__$2 = /* @__PURE__ */ (0, vue.defineComponent)(__spreadProps$1(__s
|
|
|
609
624
|
bottom: windowHeight.value - state.value.height - gapY.value,
|
|
610
625
|
left: gapX.value
|
|
611
626
|
}));
|
|
627
|
+
const closest = (arr, target) => {
|
|
628
|
+
return arr.reduce((pre, cur) => Math.abs(pre - target) < Math.abs(cur - target) ? pre : cur);
|
|
629
|
+
};
|
|
630
|
+
const applyMagnetic = () => {
|
|
631
|
+
if (props.magnetic === "x") {
|
|
632
|
+
const nextX = closest([boundary.value.left, boundary.value.right], state.value.x);
|
|
633
|
+
state.value.x = nextX;
|
|
634
|
+
}
|
|
635
|
+
if (props.magnetic === "y") {
|
|
636
|
+
const nextY = closest([boundary.value.top, boundary.value.bottom], state.value.y);
|
|
637
|
+
state.value.y = nextY;
|
|
638
|
+
}
|
|
639
|
+
};
|
|
612
640
|
const dragging = (0, vue.ref)(false);
|
|
613
641
|
const initialized = (0, vue.ref)(false);
|
|
614
642
|
const rootStyle = (0, vue.computed)(() => {
|
|
@@ -630,12 +658,25 @@ var __vue_sfc__$2 = /* @__PURE__ */ (0, vue.defineComponent)(__spreadProps$1(__s
|
|
|
630
658
|
if (x > maxX) x = maxX;
|
|
631
659
|
if (y < gapY.value) y = gapY.value;
|
|
632
660
|
if (y > maxY) y = maxY;
|
|
661
|
+
const oldX = state.value.x;
|
|
662
|
+
const oldY = state.value.y;
|
|
633
663
|
state.value = {
|
|
634
664
|
x,
|
|
635
665
|
y,
|
|
636
666
|
width: rect.width,
|
|
637
667
|
height: rect.height
|
|
638
668
|
};
|
|
669
|
+
if (!dragging.value) {
|
|
670
|
+
applyMagnetic();
|
|
671
|
+
if (state.value.x !== oldX || state.value.y !== oldY) {
|
|
672
|
+
const offset2 = {
|
|
673
|
+
x: state.value.x,
|
|
674
|
+
y: state.value.y
|
|
675
|
+
};
|
|
676
|
+
emit("update:offset", offset2);
|
|
677
|
+
emit("offset-change", offset2);
|
|
678
|
+
}
|
|
679
|
+
}
|
|
639
680
|
};
|
|
640
681
|
const touch = {
|
|
641
682
|
startX: (0, vue.ref)(0),
|
|
@@ -672,6 +713,7 @@ var __vue_sfc__$2 = /* @__PURE__ */ (0, vue.defineComponent)(__spreadProps$1(__s
|
|
|
672
713
|
dragging.value = true;
|
|
673
714
|
prevX = state.value.x;
|
|
674
715
|
prevY = state.value.y;
|
|
716
|
+
document.body.classList.add("floating-bubble-dragging");
|
|
675
717
|
if (!("touches" in e)) {
|
|
676
718
|
window.addEventListener("mousemove", onTouchMove, { passive: false });
|
|
677
719
|
window.addEventListener("mouseup", onTouchEnd);
|
|
@@ -702,24 +744,15 @@ var __vue_sfc__$2 = /* @__PURE__ */ (0, vue.defineComponent)(__spreadProps$1(__s
|
|
|
702
744
|
});
|
|
703
745
|
}
|
|
704
746
|
};
|
|
705
|
-
const closest = (arr, target) => {
|
|
706
|
-
return arr.reduce((pre, cur) => Math.abs(pre - target) < Math.abs(cur - target) ? pre : cur);
|
|
707
|
-
};
|
|
708
747
|
const onTouchEnd = (e) => {
|
|
709
748
|
dragging.value = false;
|
|
749
|
+
document.body.classList.remove("floating-bubble-dragging");
|
|
710
750
|
if (e && !("touches" in e) && e.type === "mouseup") {
|
|
711
751
|
window.removeEventListener("mousemove", onTouchMove);
|
|
712
752
|
window.removeEventListener("mouseup", onTouchEnd);
|
|
713
753
|
}
|
|
714
754
|
requestAnimationFrame(() => {
|
|
715
|
-
|
|
716
|
-
const nextX = closest([boundary.value.left, boundary.value.right], state.value.x);
|
|
717
|
-
state.value.x = nextX;
|
|
718
|
-
}
|
|
719
|
-
if (props.magnetic === "y") {
|
|
720
|
-
const nextY = closest([boundary.value.top, boundary.value.bottom], state.value.y);
|
|
721
|
-
state.value.y = nextY;
|
|
722
|
-
}
|
|
755
|
+
applyMagnetic();
|
|
723
756
|
if (!touch.isTap.value) {
|
|
724
757
|
emit("drag-end");
|
|
725
758
|
const offset = {
|
|
@@ -750,6 +783,7 @@ var __vue_sfc__$2 = /* @__PURE__ */ (0, vue.defineComponent)(__spreadProps$1(__s
|
|
|
750
783
|
if (rootRef.value) rootRef.value.addEventListener("touchmove", onTouchMove, { passive: false });
|
|
751
784
|
});
|
|
752
785
|
(0, vue.onUnmounted)(() => {
|
|
786
|
+
document.body.classList.remove("floating-bubble-dragging");
|
|
753
787
|
if (typeof window !== "undefined") {
|
|
754
788
|
window.removeEventListener("resize", handleResize);
|
|
755
789
|
window.removeEventListener("mousemove", onTouchMove);
|
|
@@ -779,6 +813,8 @@ var __vue_sfc__$2 = /* @__PURE__ */ (0, vue.defineComponent)(__spreadProps$1(__s
|
|
|
779
813
|
windowWidth,
|
|
780
814
|
windowHeight,
|
|
781
815
|
boundary,
|
|
816
|
+
closest,
|
|
817
|
+
applyMagnetic,
|
|
782
818
|
dragging,
|
|
783
819
|
initialized,
|
|
784
820
|
rootStyle,
|
|
@@ -798,7 +834,6 @@ var __vue_sfc__$2 = /* @__PURE__ */ (0, vue.defineComponent)(__spreadProps$1(__s
|
|
|
798
834
|
},
|
|
799
835
|
onTouchStart,
|
|
800
836
|
onTouchMove,
|
|
801
|
-
closest,
|
|
802
837
|
onTouchEnd,
|
|
803
838
|
onClick,
|
|
804
839
|
handleResize
|
|
@@ -826,38 +861,20 @@ __vue_sfc__$2.render = __vue_render__$2;
|
|
|
826
861
|
var FloatingBubble_vue_default = __vue_sfc__$2;
|
|
827
862
|
//#endregion
|
|
828
863
|
//#region es/open-code-widget/src/components/Trigger.vue.js
|
|
829
|
-
var STORAGE_KEY = "opencode-bubble-offset";
|
|
830
864
|
var __vue_sfc__$1 = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
831
865
|
__name: "Trigger",
|
|
832
|
-
emits: [
|
|
833
|
-
"offset-change",
|
|
834
|
-
"drag-start",
|
|
835
|
-
"drag-end"
|
|
836
|
-
],
|
|
866
|
+
emits: ["drag-start", "drag-end"],
|
|
837
867
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
838
|
-
const { buttonActive: active, open, hotkeyLabel, thinking, resolvedTheme, handleToggle } = useOpenCodeWidgetContext();
|
|
839
|
-
const
|
|
840
|
-
try {
|
|
841
|
-
const saved = localStorage.getItem(STORAGE_KEY);
|
|
842
|
-
if (saved) {
|
|
843
|
-
const parsed = JSON.parse(saved);
|
|
844
|
-
if (parsed && (parsed.x !== 0 || parsed.y !== 0)) return parsed;
|
|
845
|
-
}
|
|
846
|
-
} catch (e) {}
|
|
847
|
-
};
|
|
848
|
-
const offset = (0, vue.ref)(loadOffset());
|
|
868
|
+
const { buttonActive: active, open, hotkeyLabel, thinking, resolvedTheme, handleToggle, bubbleOffset, handleBubbleOffsetChange } = useOpenCodeWidgetContext();
|
|
869
|
+
const offset = (0, vue.ref)(bubbleOffset.value);
|
|
849
870
|
const emit = __emit;
|
|
850
|
-
const saveOffset = (value) => {
|
|
851
|
-
try {
|
|
852
|
-
localStorage.setItem(STORAGE_KEY, JSON.stringify(value));
|
|
853
|
-
} catch (e) {}
|
|
854
|
-
};
|
|
855
871
|
const handleOffsetChange = (value) => {
|
|
856
872
|
offset.value = value;
|
|
857
|
-
|
|
858
|
-
emit("offset-change", value);
|
|
873
|
+
handleBubbleOffsetChange(value);
|
|
859
874
|
};
|
|
860
|
-
(0, vue.watch)(
|
|
875
|
+
(0, vue.watch)(bubbleOffset, (newOffset) => {
|
|
876
|
+
offset.value = newOffset;
|
|
877
|
+
});
|
|
861
878
|
__expose({ offset });
|
|
862
879
|
const __returned__ = {
|
|
863
880
|
active,
|
|
@@ -866,11 +883,10 @@ var __vue_sfc__$1 = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
866
883
|
thinking,
|
|
867
884
|
resolvedTheme,
|
|
868
885
|
handleToggle,
|
|
869
|
-
|
|
870
|
-
|
|
886
|
+
bubbleOffset,
|
|
887
|
+
handleBubbleOffsetChange,
|
|
871
888
|
offset,
|
|
872
889
|
emit,
|
|
873
|
-
saveOffset,
|
|
874
890
|
handleOffsetChange,
|
|
875
891
|
FloatingBubble: FloatingBubble_vue_default
|
|
876
892
|
};
|
|
@@ -1374,35 +1390,16 @@ function findFileInfo(element, inspector) {
|
|
|
1374
1390
|
};
|
|
1375
1391
|
}
|
|
1376
1392
|
function getPreciseElementAtPoint(x, y, boundary) {
|
|
1377
|
-
|
|
1378
|
-
const
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
try {
|
|
1386
|
-
const elements = document.elementsFromPoint(x, y);
|
|
1387
|
-
for (const el of elements) {
|
|
1388
|
-
if (el.closest("#vue-inspector-container")) continue;
|
|
1389
|
-
if (el.closest(".opencode-widget")) continue;
|
|
1390
|
-
if (el.hasAttribute("data-v-inspector-ignore")) continue;
|
|
1391
|
-
if (boundary) {
|
|
1392
|
-
if (boundary.contains(el) || el === boundary) {
|
|
1393
|
-
element = el;
|
|
1394
|
-
break;
|
|
1395
|
-
}
|
|
1396
|
-
} else {
|
|
1397
|
-
element = el;
|
|
1398
|
-
break;
|
|
1399
|
-
}
|
|
1400
|
-
}
|
|
1401
|
-
} finally {
|
|
1402
|
-
if (highlight) highlight.style.display = highlightDisplay;
|
|
1403
|
-
if (tooltip) tooltip.style.display = tooltipDisplay;
|
|
1393
|
+
const elements = document.elementsFromPoint(x, y);
|
|
1394
|
+
for (const el of elements) {
|
|
1395
|
+
if (el.closest("#vue-inspector-container")) continue;
|
|
1396
|
+
if (el.closest(".opencode-widget")) continue;
|
|
1397
|
+
if (el.hasAttribute("data-v-inspector-ignore")) continue;
|
|
1398
|
+
if (boundary) {
|
|
1399
|
+
if (boundary.contains(el) || el === boundary) return el;
|
|
1400
|
+
} else return el;
|
|
1404
1401
|
}
|
|
1405
|
-
return
|
|
1402
|
+
return null;
|
|
1406
1403
|
}
|
|
1407
1404
|
function useInspector(options) {
|
|
1408
1405
|
const highlightVisible = (0, vue.ref)(false);
|
|
@@ -1423,74 +1420,117 @@ function useInspector(options) {
|
|
|
1423
1420
|
});
|
|
1424
1421
|
const INSPECTOR_CHECK_INTERVAL = 500;
|
|
1425
1422
|
let inspectorCheckTimer = null;
|
|
1423
|
+
let currentHighlightElement = null;
|
|
1424
|
+
let currentFileInfo = {
|
|
1425
|
+
file: null,
|
|
1426
|
+
line: null,
|
|
1427
|
+
column: null
|
|
1428
|
+
};
|
|
1429
|
+
let currentPrimary = "#3b82f6";
|
|
1430
|
+
let currentPrimaryBg = "rgba(59, 130, 246, 0.1)";
|
|
1431
|
+
let currentDescription = "";
|
|
1432
|
+
let currentFileInfoText = "";
|
|
1426
1433
|
function handleMouseMoveCore(e) {
|
|
1427
1434
|
var _a, _b;
|
|
1428
1435
|
if (!options.selectMode.value) return;
|
|
1429
1436
|
const inspector = window.__VUE_INSPECTOR__;
|
|
1437
|
+
const highlight = document.querySelector(".opencode-element-highlight");
|
|
1438
|
+
const tooltip = document.querySelector(".opencode-element-tooltip");
|
|
1439
|
+
if (highlight) highlight.style.pointerEvents = "none";
|
|
1440
|
+
if (tooltip) tooltip.style.pointerEvents = "none";
|
|
1430
1441
|
let elementToHighlight = null;
|
|
1442
|
+
let targetNode = null;
|
|
1431
1443
|
let fileInfo = {
|
|
1432
1444
|
file: null,
|
|
1433
1445
|
line: null,
|
|
1434
1446
|
column: null
|
|
1435
1447
|
};
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1448
|
+
try {
|
|
1449
|
+
if (inspector) {
|
|
1450
|
+
const result = inspector.getTargetNode(e);
|
|
1451
|
+
targetNode = result.targetNode;
|
|
1452
|
+
const params = result.params;
|
|
1453
|
+
if (targetNode) {
|
|
1454
|
+
elementToHighlight = getPreciseElementAtPoint(e.clientX, e.clientY, targetNode) || targetNode;
|
|
1455
|
+
if (params && params.file) fileInfo = {
|
|
1456
|
+
file: params.file,
|
|
1457
|
+
line: (_a = params.line) != null ? _a : null,
|
|
1458
|
+
column: (_b = params.column) != null ? _b : null
|
|
1459
|
+
};
|
|
1460
|
+
else fileInfo = findFileInfo(targetNode, inspector);
|
|
1461
|
+
}
|
|
1446
1462
|
}
|
|
1463
|
+
if (!elementToHighlight) elementToHighlight = getPreciseElementAtPoint(e.clientX, e.clientY, null);
|
|
1464
|
+
if (elementToHighlight && !fileInfo.file) fileInfo = getFileInfoFromVueInstance(elementToHighlight) || fileInfo;
|
|
1465
|
+
} finally {
|
|
1466
|
+
if (highlight) highlight.style.pointerEvents = "";
|
|
1467
|
+
if (tooltip) tooltip.style.pointerEvents = "";
|
|
1447
1468
|
}
|
|
1448
|
-
if (!elementToHighlight) elementToHighlight = getPreciseElementAtPoint(e.clientX, e.clientY, null);
|
|
1449
|
-
if (elementToHighlight && !fileInfo.file) fileInfo = getFileInfoFromVueInstance(elementToHighlight) || fileInfo;
|
|
1450
1469
|
if (elementToHighlight) {
|
|
1451
|
-
const
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
width: `${rect.width}px`,
|
|
1465
|
-
height: `${rect.height}px`,
|
|
1466
|
-
border: `2px solid ${primary}`,
|
|
1467
|
-
background: primaryBg
|
|
1468
|
-
};
|
|
1469
|
-
const description = getElementDescription(elementToHighlight);
|
|
1470
|
-
const fileName = fileInfo.file ? fileInfo.file.split("/").pop() : "";
|
|
1470
|
+
const elementChanged = currentHighlightElement !== elementToHighlight;
|
|
1471
|
+
if (elementChanged) {
|
|
1472
|
+
currentHighlightElement = elementToHighlight;
|
|
1473
|
+
currentFileInfo = fileInfo;
|
|
1474
|
+
const widget = document.querySelector(".opencode-widget");
|
|
1475
|
+
if (widget) {
|
|
1476
|
+
const style = getComputedStyle(widget);
|
|
1477
|
+
currentPrimary = style.getPropertyValue("--oc-primary").trim() || currentPrimary;
|
|
1478
|
+
currentPrimaryBg = style.getPropertyValue("--oc-primary-bg").trim() || currentPrimaryBg;
|
|
1479
|
+
}
|
|
1480
|
+
currentDescription = getElementDescription(elementToHighlight);
|
|
1481
|
+
} else if (!currentFileInfo.file && fileInfo.file) currentFileInfo = fileInfo;
|
|
1482
|
+
const fileName = currentFileInfo.file ? currentFileInfo.file.split("/").pop() : "";
|
|
1471
1483
|
let lineInfo = "";
|
|
1472
|
-
if (
|
|
1473
|
-
lineInfo = `:${
|
|
1474
|
-
if (
|
|
1484
|
+
if (currentFileInfo.line) {
|
|
1485
|
+
lineInfo = `:${currentFileInfo.line}`;
|
|
1486
|
+
if (currentFileInfo.column) lineInfo += `:${currentFileInfo.column}`;
|
|
1475
1487
|
}
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1488
|
+
const newFileInfoText = fileName ? `${fileName}${lineInfo}` : "";
|
|
1489
|
+
if (elementChanged || currentFileInfoText !== newFileInfoText) {
|
|
1490
|
+
currentFileInfoText = newFileInfoText;
|
|
1491
|
+
tooltipContent.value = {
|
|
1492
|
+
description: currentDescription,
|
|
1493
|
+
fileInfo: currentFileInfoText
|
|
1494
|
+
};
|
|
1495
|
+
}
|
|
1496
|
+
const rect = elementToHighlight.getBoundingClientRect();
|
|
1497
|
+
const newTop = `${rect.top}px`;
|
|
1498
|
+
const newLeft = `${rect.left}px`;
|
|
1499
|
+
const newWidth = `${rect.width}px`;
|
|
1500
|
+
const newHeight = `${rect.height}px`;
|
|
1501
|
+
if (highlightStyle.value.top !== newTop || highlightStyle.value.left !== newLeft || highlightStyle.value.width !== newWidth || highlightStyle.value.height !== newHeight) highlightStyle.value = {
|
|
1502
|
+
top: newTop,
|
|
1503
|
+
left: newLeft,
|
|
1504
|
+
width: newWidth,
|
|
1505
|
+
height: newHeight,
|
|
1506
|
+
border: `2px solid ${currentPrimary}`,
|
|
1507
|
+
background: currentPrimaryBg
|
|
1479
1508
|
};
|
|
1480
|
-
tooltipVisible.value = true;
|
|
1481
1509
|
const tooltipHeight = 50;
|
|
1482
1510
|
const tooltipWidth = 200;
|
|
1483
1511
|
let tooltipTop = rect.top - tooltipHeight - 8;
|
|
1484
1512
|
let tooltipLeft = rect.left;
|
|
1485
1513
|
if (tooltipTop < 10) tooltipTop = rect.bottom + 8;
|
|
1486
1514
|
if (tooltipLeft + tooltipWidth > window.innerWidth - 10) tooltipLeft = window.innerWidth - tooltipWidth - 10;
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1515
|
+
const newTooltipTop = `${tooltipTop}px`;
|
|
1516
|
+
const newTooltipLeft = `${tooltipLeft}px`;
|
|
1517
|
+
if (tooltipStyle.value.top !== newTooltipTop || tooltipStyle.value.left !== newTooltipLeft) tooltipStyle.value = {
|
|
1518
|
+
top: newTooltipTop,
|
|
1519
|
+
left: newTooltipLeft
|
|
1490
1520
|
};
|
|
1521
|
+
if (!highlightVisible.value) highlightVisible.value = true;
|
|
1522
|
+
if (!tooltipVisible.value) tooltipVisible.value = true;
|
|
1491
1523
|
} else {
|
|
1492
|
-
|
|
1493
|
-
|
|
1524
|
+
currentHighlightElement = null;
|
|
1525
|
+
currentDescription = "";
|
|
1526
|
+
currentFileInfoText = "";
|
|
1527
|
+
currentFileInfo = {
|
|
1528
|
+
file: null,
|
|
1529
|
+
line: null,
|
|
1530
|
+
column: null
|
|
1531
|
+
};
|
|
1532
|
+
if (highlightVisible.value) highlightVisible.value = false;
|
|
1533
|
+
if (tooltipVisible.value) tooltipVisible.value = false;
|
|
1494
1534
|
}
|
|
1495
1535
|
}
|
|
1496
1536
|
const handleMouseMove = throttle(handleMouseMoveCore, 16);
|
|
@@ -1554,6 +1594,14 @@ function useInspector(options) {
|
|
|
1554
1594
|
if (inspector) inspector.disable();
|
|
1555
1595
|
document.removeEventListener("mousemove", handleMouseMove);
|
|
1556
1596
|
document.removeEventListener("keydown", handleKeydown, true);
|
|
1597
|
+
currentHighlightElement = null;
|
|
1598
|
+
currentDescription = "";
|
|
1599
|
+
currentFileInfoText = "";
|
|
1600
|
+
currentFileInfo = {
|
|
1601
|
+
file: null,
|
|
1602
|
+
line: null,
|
|
1603
|
+
column: null
|
|
1604
|
+
};
|
|
1557
1605
|
highlightVisible.value = false;
|
|
1558
1606
|
tooltipVisible.value = false;
|
|
1559
1607
|
}
|
|
@@ -1584,6 +1632,62 @@ function useInspector(options) {
|
|
|
1584
1632
|
};
|
|
1585
1633
|
}
|
|
1586
1634
|
//#endregion
|
|
1635
|
+
//#region es/open-code-widget/composables/use-persist-state.js
|
|
1636
|
+
var STORAGE_KEY = "opencode-widget-state";
|
|
1637
|
+
function loadState() {
|
|
1638
|
+
if (typeof window === "undefined") return null;
|
|
1639
|
+
try {
|
|
1640
|
+
const stored = localStorage.getItem(STORAGE_KEY);
|
|
1641
|
+
if (stored) return JSON.parse(stored);
|
|
1642
|
+
} catch (e) {
|
|
1643
|
+
console.warn("[OpenCodeWidget] Failed to load persisted state:", e);
|
|
1644
|
+
}
|
|
1645
|
+
return null;
|
|
1646
|
+
}
|
|
1647
|
+
function saveState(state) {
|
|
1648
|
+
if (typeof window === "undefined") return;
|
|
1649
|
+
try {
|
|
1650
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify(state));
|
|
1651
|
+
} catch (e) {
|
|
1652
|
+
console.warn("[OpenCodeWidget] Failed to save state:", e);
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
function usePersistState(options) {
|
|
1656
|
+
const restoreState = () => {
|
|
1657
|
+
const saved = loadState();
|
|
1658
|
+
if (options.onRestore) options.onRestore(saved || {});
|
|
1659
|
+
return saved;
|
|
1660
|
+
};
|
|
1661
|
+
const getCurrentState = () => ({
|
|
1662
|
+
open: options.open.value,
|
|
1663
|
+
minimized: options.minimized.value,
|
|
1664
|
+
promptDockVisible: options.promptDockVisible.value,
|
|
1665
|
+
bubbleOffset: options.bubbleOffset.value,
|
|
1666
|
+
theme: options.theme.value,
|
|
1667
|
+
sessionListCollapsed: options.sessionListCollapsed.value
|
|
1668
|
+
});
|
|
1669
|
+
const persistState = () => {
|
|
1670
|
+
saveState(getCurrentState());
|
|
1671
|
+
};
|
|
1672
|
+
(0, vue.onMounted)(() => {
|
|
1673
|
+
restoreState();
|
|
1674
|
+
(0, vue.watch)([
|
|
1675
|
+
options.open,
|
|
1676
|
+
options.minimized,
|
|
1677
|
+
options.promptDockVisible,
|
|
1678
|
+
options.bubbleOffset,
|
|
1679
|
+
options.theme,
|
|
1680
|
+
options.sessionListCollapsed
|
|
1681
|
+
], () => {
|
|
1682
|
+
persistState();
|
|
1683
|
+
}, { deep: true });
|
|
1684
|
+
});
|
|
1685
|
+
return {
|
|
1686
|
+
restoreState,
|
|
1687
|
+
persistState
|
|
1688
|
+
};
|
|
1689
|
+
}
|
|
1690
|
+
//#endregion
|
|
1587
1691
|
//#region es/open-code-widget/src/index.vue.js
|
|
1588
1692
|
var __defProp = Object.defineProperty;
|
|
1589
1693
|
var __defProps = Object.defineProperties;
|
|
@@ -1716,6 +1820,10 @@ var __vue_sfc__ = /* @__PURE__ */ (0, vue.defineComponent)(__spreadProps(__sprea
|
|
|
1716
1820
|
type: Boolean,
|
|
1717
1821
|
required: false,
|
|
1718
1822
|
default: false
|
|
1823
|
+
},
|
|
1824
|
+
sessionStates: {
|
|
1825
|
+
type: Object,
|
|
1826
|
+
required: false
|
|
1719
1827
|
}
|
|
1720
1828
|
},
|
|
1721
1829
|
emits: [
|
|
@@ -1787,17 +1895,26 @@ var __vue_sfc__ = /* @__PURE__ */ (0, vue.defineComponent)(__spreadProps(__sprea
|
|
|
1787
1895
|
var _a;
|
|
1788
1896
|
(_a = frameRef.value) == null || _a.sendMessageToIframe(type, data);
|
|
1789
1897
|
};
|
|
1898
|
+
const localSessionListCollapsed = (0, vue.ref)(props.sessionListCollapsed);
|
|
1899
|
+
const minimized = (0, vue.ref)(false);
|
|
1900
|
+
const promptDockVisible = (0, vue.ref)(true);
|
|
1901
|
+
const isRestoring = (0, vue.ref)(true);
|
|
1902
|
+
const iframeLoaded = (0, vue.ref)(false);
|
|
1903
|
+
const syncStateToIframe = () => {
|
|
1904
|
+
if (!iframeLoaded.value) return;
|
|
1905
|
+
sendMessageToIframe("prompt-dock-visibility-change", { visible: promptDockVisible.value });
|
|
1906
|
+
sendMessageToIframe("minimize-state-change", { minimized: minimized.value });
|
|
1907
|
+
};
|
|
1790
1908
|
const handleFrameLoaded = () => {
|
|
1791
1909
|
emit("frame-loaded");
|
|
1910
|
+
iframeLoaded.value = true;
|
|
1911
|
+
syncStateToIframe();
|
|
1792
1912
|
};
|
|
1793
1913
|
__expose({
|
|
1794
1914
|
showNotification,
|
|
1795
1915
|
showConfirmDialog,
|
|
1796
1916
|
sendMessageToIframe
|
|
1797
1917
|
});
|
|
1798
|
-
const localSessionListCollapsed = (0, vue.ref)(props.sessionListCollapsed);
|
|
1799
|
-
const minimized = (0, vue.ref)(false);
|
|
1800
|
-
const promptDockVisible = (0, vue.ref)(true);
|
|
1801
1918
|
(0, vue.watch)(() => props.sessionListCollapsed, (val) => {
|
|
1802
1919
|
localSessionListCollapsed.value = val;
|
|
1803
1920
|
});
|
|
@@ -1872,6 +1989,48 @@ var __vue_sfc__ = /* @__PURE__ */ (0, vue.defineComponent)(__spreadProps(__sprea
|
|
|
1872
1989
|
emit("toggle-select-mode", false);
|
|
1873
1990
|
}
|
|
1874
1991
|
});
|
|
1992
|
+
const bubbleOffset = (0, vue.ref)(void 0);
|
|
1993
|
+
usePersistState({
|
|
1994
|
+
open: (0, vue.toRef)(props, "open"),
|
|
1995
|
+
minimized,
|
|
1996
|
+
promptDockVisible,
|
|
1997
|
+
bubbleOffset,
|
|
1998
|
+
theme: (0, vue.toRef)(props, "theme"),
|
|
1999
|
+
sessionListCollapsed: localSessionListCollapsed,
|
|
2000
|
+
onRestore: (state) => {
|
|
2001
|
+
if (state.open !== void 0 && state.open !== props.open) {
|
|
2002
|
+
emit("update:open", state.open);
|
|
2003
|
+
emit("toggle", state.open);
|
|
2004
|
+
}
|
|
2005
|
+
if (state.minimized !== void 0) minimized.value = state.minimized;
|
|
2006
|
+
if (state.bubbleOffset !== void 0) {
|
|
2007
|
+
const bubbleSize = 44;
|
|
2008
|
+
const margin = 10;
|
|
2009
|
+
const maxX = window.innerWidth - bubbleSize - margin;
|
|
2010
|
+
const maxY = window.innerHeight - bubbleSize - margin;
|
|
2011
|
+
bubbleOffset.value = {
|
|
2012
|
+
x: Math.max(margin, Math.min(state.bubbleOffset.x, maxX)),
|
|
2013
|
+
y: Math.max(margin, Math.min(state.bubbleOffset.y, maxY))
|
|
2014
|
+
};
|
|
2015
|
+
}
|
|
2016
|
+
if (state.theme !== void 0 && state.theme !== props.theme) {
|
|
2017
|
+
emit("update:theme", state.theme);
|
|
2018
|
+
emit("toggle-theme", state.theme);
|
|
2019
|
+
}
|
|
2020
|
+
if (state.sessionListCollapsed !== void 0 && state.sessionListCollapsed !== props.sessionListCollapsed) {
|
|
2021
|
+
localSessionListCollapsed.value = state.sessionListCollapsed;
|
|
2022
|
+
emit("update:sessionListCollapsed", state.sessionListCollapsed);
|
|
2023
|
+
}
|
|
2024
|
+
if (state.promptDockVisible !== void 0) promptDockVisible.value = state.promptDockVisible;
|
|
2025
|
+
else if (minimized.value) promptDockVisible.value = false;
|
|
2026
|
+
(0, vue.nextTick)(() => {
|
|
2027
|
+
syncStateToIframe();
|
|
2028
|
+
setTimeout(() => {
|
|
2029
|
+
isRestoring.value = false;
|
|
2030
|
+
}, 50);
|
|
2031
|
+
});
|
|
2032
|
+
}
|
|
2033
|
+
});
|
|
1875
2034
|
const handleToggleMinimize = () => {
|
|
1876
2035
|
minimized.value = !minimized.value;
|
|
1877
2036
|
promptDockVisible.value = !minimized.value;
|
|
@@ -1882,15 +2041,29 @@ var __vue_sfc__ = /* @__PURE__ */ (0, vue.defineComponent)(__spreadProps(__sprea
|
|
|
1882
2041
|
promptDockVisible.value = !promptDockVisible.value;
|
|
1883
2042
|
sendMessageToIframe("prompt-dock-visibility-change", { visible: promptDockVisible.value });
|
|
1884
2043
|
};
|
|
1885
|
-
const
|
|
2044
|
+
const windowWidth = (0, vue.ref)(typeof window !== "undefined" ? window.innerWidth : 0);
|
|
2045
|
+
const windowHeight = (0, vue.ref)(typeof window !== "undefined" ? window.innerHeight : 0);
|
|
2046
|
+
const handleWindowResize = () => {
|
|
2047
|
+
if (typeof window !== "undefined") {
|
|
2048
|
+
windowWidth.value = window.innerWidth;
|
|
2049
|
+
windowHeight.value = window.innerHeight;
|
|
2050
|
+
}
|
|
2051
|
+
};
|
|
2052
|
+
(0, vue.onMounted)(() => {
|
|
2053
|
+
if (typeof window !== "undefined") window.addEventListener("resize", handleWindowResize);
|
|
2054
|
+
});
|
|
2055
|
+
(0, vue.onUnmounted)(() => {
|
|
2056
|
+
if (typeof window !== "undefined") window.removeEventListener("resize", handleWindowResize);
|
|
2057
|
+
});
|
|
1886
2058
|
const bubbleQuadrant = (0, vue.computed)(() => {
|
|
1887
2059
|
var _a, _b, _c, _d;
|
|
1888
2060
|
if (typeof window === "undefined") return "bottom-right";
|
|
1889
|
-
const centerX =
|
|
1890
|
-
const centerY =
|
|
2061
|
+
const centerX = windowWidth.value / 2;
|
|
2062
|
+
const centerY = windowHeight.value / 2;
|
|
1891
2063
|
const bubbleSize = 44;
|
|
1892
|
-
const
|
|
1893
|
-
const
|
|
2064
|
+
const currentOffset = (_b = (_a = triggerRef.value) == null ? void 0 : _a.offset) != null ? _b : bubbleOffset.value;
|
|
2065
|
+
const effectiveX = ((_c = currentOffset == null ? void 0 : currentOffset.x) != null ? _c : windowWidth.value - bubbleSize - 24) + bubbleSize / 2;
|
|
2066
|
+
const effectiveY = ((_d = currentOffset == null ? void 0 : currentOffset.y) != null ? _d : windowHeight.value - bubbleSize - 24) + bubbleSize / 2;
|
|
1894
2067
|
if (effectiveX >= centerX && effectiveY >= centerY) return "bottom-right";
|
|
1895
2068
|
else if (effectiveX < centerX && effectiveY >= centerY) return "bottom-left";
|
|
1896
2069
|
else if (effectiveX >= centerX && effectiveY < centerY) return "top-right";
|
|
@@ -1901,35 +2074,37 @@ var __vue_sfc__ = /* @__PURE__ */ (0, vue.defineComponent)(__spreadProps(__sprea
|
|
|
1901
2074
|
return quadrant === "top-right" || quadrant === "bottom-right";
|
|
1902
2075
|
});
|
|
1903
2076
|
const chatPositionStyle = (0, vue.computed)(() => {
|
|
1904
|
-
var _a;
|
|
2077
|
+
var _a, _b, _c;
|
|
1905
2078
|
if (typeof window === "undefined") return {};
|
|
1906
|
-
const windowWidth = window.innerWidth;
|
|
1907
|
-
const windowHeight = window.innerHeight;
|
|
1908
2079
|
const chatWidth = minimized.value ? 300 : 700;
|
|
1909
|
-
const chatHeight = minimized.value ? 300 : Math.min(windowHeight * .86, windowHeight - 40);
|
|
2080
|
+
const chatHeight = minimized.value ? 300 : Math.min(windowHeight.value * .86, windowHeight.value - 40);
|
|
1910
2081
|
const gap = 24;
|
|
1911
2082
|
const bubbleSize = 44;
|
|
1912
2083
|
const screenMargin = 20;
|
|
1913
|
-
const effectiveOffset = (_a = bubbleOffset.value) != null ?
|
|
1914
|
-
x: windowWidth - bubbleSize - gap,
|
|
1915
|
-
y: windowHeight - bubbleSize - gap
|
|
2084
|
+
const effectiveOffset = (_c = (_b = (_a = triggerRef.value) == null ? void 0 : _a.offset) != null ? _b : bubbleOffset.value) != null ? _c : {
|
|
2085
|
+
x: windowWidth.value - bubbleSize - gap,
|
|
2086
|
+
y: windowHeight.value - bubbleSize - gap
|
|
1916
2087
|
};
|
|
1917
2088
|
const style = {};
|
|
1918
2089
|
if (isBubbleOnRightSide.value) {
|
|
1919
|
-
let rightPos = windowWidth - effectiveOffset.x + gap;
|
|
1920
|
-
const
|
|
2090
|
+
let rightPos = windowWidth.value - effectiveOffset.x + gap;
|
|
2091
|
+
const minRight = screenMargin;
|
|
2092
|
+
const maxRight = windowWidth.value - chatWidth - screenMargin;
|
|
1921
2093
|
if (rightPos > maxRight) rightPos = maxRight;
|
|
2094
|
+
if (rightPos < minRight) rightPos = minRight;
|
|
1922
2095
|
style.right = `${rightPos}px`;
|
|
1923
2096
|
style.left = "auto";
|
|
1924
2097
|
} else {
|
|
1925
2098
|
let leftPos = effectiveOffset.x + bubbleSize + gap;
|
|
1926
|
-
const
|
|
2099
|
+
const minLeft = screenMargin;
|
|
2100
|
+
const maxLeft = windowWidth.value - chatWidth - screenMargin;
|
|
1927
2101
|
if (leftPos > maxLeft) leftPos = maxLeft;
|
|
2102
|
+
if (leftPos < minLeft) leftPos = minLeft;
|
|
1928
2103
|
style.left = `${leftPos}px`;
|
|
1929
2104
|
style.right = "auto";
|
|
1930
2105
|
}
|
|
1931
|
-
let bottomPos = windowHeight - effectiveOffset.y - bubbleSize;
|
|
1932
|
-
const maxBottom = windowHeight - chatHeight - screenMargin;
|
|
2106
|
+
let bottomPos = windowHeight.value - effectiveOffset.y - bubbleSize;
|
|
2107
|
+
const maxBottom = windowHeight.value - chatHeight - screenMargin;
|
|
1933
2108
|
if (bottomPos > maxBottom) bottomPos = maxBottom;
|
|
1934
2109
|
if (bottomPos < screenMargin) bottomPos = screenMargin;
|
|
1935
2110
|
style.bottom = `${bottomPos}px`;
|
|
@@ -1991,6 +2166,11 @@ var __vue_sfc__ = /* @__PURE__ */ (0, vue.defineComponent)(__spreadProps(__sprea
|
|
|
1991
2166
|
thinking: (0, vue.toRef)(props, "thinking"),
|
|
1992
2167
|
minimized,
|
|
1993
2168
|
promptDockVisible,
|
|
2169
|
+
bubbleOffset,
|
|
2170
|
+
sessionStates: (0, vue.computed)(() => {
|
|
2171
|
+
var _a;
|
|
2172
|
+
return (_a = props.sessionStates) != null ? _a : {};
|
|
2173
|
+
}),
|
|
1994
2174
|
iframeSource,
|
|
1995
2175
|
buttonActive,
|
|
1996
2176
|
sessionListTitle,
|
|
@@ -2012,7 +2192,8 @@ var __vue_sfc__ = /* @__PURE__ */ (0, vue.defineComponent)(__spreadProps(__sprea
|
|
|
2012
2192
|
handleClickSelectedNode,
|
|
2013
2193
|
handleRemoveSelectedNode: (payload) => handleRemoveSelectedNode(payload.item, payload.index, payload.source),
|
|
2014
2194
|
handleClearSelectedNodes,
|
|
2015
|
-
handleFrameLoaded
|
|
2195
|
+
handleFrameLoaded,
|
|
2196
|
+
handleBubbleOffsetChange
|
|
2016
2197
|
});
|
|
2017
2198
|
const __returned__ = {
|
|
2018
2199
|
props,
|
|
@@ -2042,10 +2223,13 @@ var __vue_sfc__ = /* @__PURE__ */ (0, vue.defineComponent)(__spreadProps(__sprea
|
|
|
2042
2223
|
frameRef,
|
|
2043
2224
|
triggerRef,
|
|
2044
2225
|
sendMessageToIframe,
|
|
2045
|
-
handleFrameLoaded,
|
|
2046
2226
|
localSessionListCollapsed,
|
|
2047
2227
|
minimized,
|
|
2048
2228
|
promptDockVisible,
|
|
2229
|
+
isRestoring,
|
|
2230
|
+
iframeLoaded,
|
|
2231
|
+
syncStateToIframe,
|
|
2232
|
+
handleFrameLoaded,
|
|
2049
2233
|
buttonActive,
|
|
2050
2234
|
containerClasses,
|
|
2051
2235
|
iframeSource,
|
|
@@ -2072,9 +2256,12 @@ var __vue_sfc__ = /* @__PURE__ */ (0, vue.defineComponent)(__spreadProps(__sprea
|
|
|
2072
2256
|
tooltipVisible,
|
|
2073
2257
|
tooltipStyle,
|
|
2074
2258
|
tooltipContent,
|
|
2259
|
+
bubbleOffset,
|
|
2075
2260
|
handleToggleMinimize,
|
|
2076
2261
|
handleTogglePromptDock,
|
|
2077
|
-
|
|
2262
|
+
windowWidth,
|
|
2263
|
+
windowHeight,
|
|
2264
|
+
handleWindowResize,
|
|
2078
2265
|
bubbleQuadrant,
|
|
2079
2266
|
isBubbleOnRightSide,
|
|
2080
2267
|
chatPositionStyle,
|
|
@@ -2131,7 +2318,6 @@ function __vue_render__(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2131
2318
|
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", { class: (0, vue.normalizeClass)($setup.containerClasses) }, [
|
|
2132
2319
|
(0, vue.createVNode)($setup["Trigger"], {
|
|
2133
2320
|
ref: "triggerRef",
|
|
2134
|
-
onOffsetChange: $setup.handleBubbleOffsetChange,
|
|
2135
2321
|
onDragStart: $setup.handleDragStart,
|
|
2136
2322
|
onDragEnd: $setup.handleDragEnd
|
|
2137
2323
|
}, (0, vue.createSlots)({ _: 2 }, [$setup.slots["button-icon"] ? {
|
|
@@ -2143,7 +2329,8 @@ function __vue_render__(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2143
2329
|
class: (0, vue.normalizeClass)(["opencode-chat", {
|
|
2144
2330
|
open: $props.open,
|
|
2145
2331
|
minimized: $setup.minimized,
|
|
2146
|
-
dragging: $setup.isDragging
|
|
2332
|
+
dragging: $setup.isDragging,
|
|
2333
|
+
"no-transition": $setup.isRestoring
|
|
2147
2334
|
}]),
|
|
2148
2335
|
style: (0, vue.normalizeStyle)($setup.chatPositionStyle)
|
|
2149
2336
|
}, [
|
|
@@ -2198,11 +2385,11 @@ function __vue_render__(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2198
2385
|
(0, vue.createVNode)($setup["SelectHint"]),
|
|
2199
2386
|
(0, vue.withDirectives)((0, vue.createElementVNode)("div", {
|
|
2200
2387
|
class: "opencode-element-highlight",
|
|
2201
|
-
style: (0, vue.normalizeStyle)(
|
|
2388
|
+
style: (0, vue.normalizeStyle)($setup.highlightStyle)
|
|
2202
2389
|
}, null, 4), [[vue.vShow, $setup.highlightVisible]]),
|
|
2203
2390
|
(0, vue.withDirectives)((0, vue.createElementVNode)("div", {
|
|
2204
2391
|
class: "opencode-element-tooltip",
|
|
2205
|
-
style: (0, vue.normalizeStyle)(
|
|
2392
|
+
style: (0, vue.normalizeStyle)($setup.tooltipStyle)
|
|
2206
2393
|
}, [(0, vue.createElementVNode)("div", _hoisted_3, (0, vue.toDisplayString)($setup.tooltipContent.description), 1), (0, vue.createElementVNode)("div", _hoisted_4, (0, vue.toDisplayString)($setup.tooltipContent.fileInfo), 1)], 4), [[vue.vShow, $setup.tooltipVisible]]),
|
|
2207
2394
|
$setup.dialogVisible ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_5, [(0, vue.createElementVNode)("div", _hoisted_6, [(0, vue.createElementVNode)("div", _hoisted_7, [(0, vue.createElementVNode)("div", _hoisted_8, (0, vue.toDisplayString)($setup.dialogMessage), 1)]), (0, vue.createElementVNode)("div", { class: "opencode-dialog-actions" }, [(0, vue.createElementVNode)("button", {
|
|
2208
2395
|
class: "opencode-dialog-btn cancel",
|
|
@@ -2220,7 +2407,7 @@ __vue_sfc__.render = __vue_render__;
|
|
|
2220
2407
|
var open_code_widget_default = __vue_sfc__;
|
|
2221
2408
|
//#endregion
|
|
2222
2409
|
//#region es/index.js
|
|
2223
|
-
var version = "1.0.
|
|
2410
|
+
var version = "1.0.28";
|
|
2224
2411
|
function install(app, options) {
|
|
2225
2412
|
[open_code_widget_default].forEach((item) => {
|
|
2226
2413
|
if (item.install) app.use(item, options);
|