@vite-plugin-opencode-assistant/components 1.0.23 → 1.0.24
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-widget.d.ts +0 -1
- package/es/open-code-widget/composables/use-widget.js +0 -1
- package/es/open-code-widget/src/components/FloatingBubble/FloatingBubble-sfc.css +1 -0
- package/es/open-code-widget/src/components/FloatingBubble/FloatingBubble.vue.d.ts +44 -0
- package/es/open-code-widget/src/components/FloatingBubble/FloatingBubble.vue.js +290 -0
- package/es/open-code-widget/src/components/FloatingBubble/index.d.ts +3 -0
- package/es/open-code-widget/src/components/FloatingBubble/index.js +5 -0
- package/es/open-code-widget/src/components/FloatingBubble/types.d.ts +24 -0
- package/es/open-code-widget/src/components/FloatingBubble/types.js +0 -0
- package/es/open-code-widget/src/components/Trigger-sfc.css +1 -1
- package/es/open-code-widget/src/components/Trigger.vue.d.ts +21 -3
- package/es/open-code-widget/src/components/Trigger.vue.js +127 -48
- package/es/open-code-widget/src/index-sfc.css +1 -1
- package/es/open-code-widget/src/index.vue.d.ts +10 -11
- package/es/open-code-widget/src/index.vue.js +82 -17
- package/es/open-code-widget/src/types.d.ts +1 -2
- package/lib/@vite-plugin-opencode-assistant/components.cjs.js +543 -99
- package/lib/@vite-plugin-opencode-assistant/components.es.js +540 -96
- package/lib/components.css +3 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/open-code-widget/composables/use-widget.d.ts +0 -1
- package/lib/open-code-widget/composables/use-widget.js +0 -1
- package/lib/open-code-widget/src/components/FloatingBubble/FloatingBubble-sfc.css +1 -0
- package/lib/open-code-widget/src/components/FloatingBubble/FloatingBubble.vue.d.ts +44 -0
- package/lib/open-code-widget/src/components/FloatingBubble/FloatingBubble.vue.js +307 -0
- package/lib/open-code-widget/src/components/FloatingBubble/index.d.ts +3 -0
- package/lib/open-code-widget/src/components/FloatingBubble/index.js +35 -0
- package/lib/open-code-widget/src/components/FloatingBubble/types.d.ts +24 -0
- package/lib/open-code-widget/src/components/FloatingBubble/types.js +15 -0
- package/lib/open-code-widget/src/components/Trigger-sfc.css +1 -1
- package/lib/open-code-widget/src/components/Trigger.vue.d.ts +21 -3
- package/lib/open-code-widget/src/components/Trigger.vue.js +137 -48
- package/lib/open-code-widget/src/index-sfc.css +1 -1
- package/lib/open-code-widget/src/index.vue.d.ts +10 -11
- package/lib/open-code-widget/src/index.vue.js +80 -15
- package/lib/open-code-widget/src/types.d.ts +1 -2
- package/lib/web-types.json +1 -1
- package/package.json +2 -2
|
@@ -4,22 +4,22 @@ Object.defineProperties(exports, {
|
|
|
4
4
|
});
|
|
5
5
|
//#region \0rolldown/runtime.js
|
|
6
6
|
var __create = Object.create;
|
|
7
|
-
var __defProp$
|
|
7
|
+
var __defProp$3 = Object.defineProperty;
|
|
8
8
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
9
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10
10
|
var __getProtoOf = Object.getPrototypeOf;
|
|
11
|
-
var __hasOwnProp$
|
|
11
|
+
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
12
12
|
var __copyProps = (to, from, except, desc) => {
|
|
13
13
|
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
14
14
|
key = keys[i];
|
|
15
|
-
if (!__hasOwnProp$
|
|
15
|
+
if (!__hasOwnProp$3.call(to, key) && key !== except) __defProp$3(to, key, {
|
|
16
16
|
get: ((k) => from[k]).bind(null, key),
|
|
17
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
return to;
|
|
21
21
|
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp$
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp$3(target, "default", {
|
|
23
23
|
value: mod,
|
|
24
24
|
enumerable: true
|
|
25
25
|
}) : target, mod));
|
|
@@ -40,24 +40,24 @@ function useOpenCodeWidgetContext() {
|
|
|
40
40
|
}
|
|
41
41
|
//#endregion
|
|
42
42
|
//#region es/open-code-widget/src/components/Frame.vue.js
|
|
43
|
-
var __defProp$
|
|
44
|
-
var __getOwnPropSymbols$
|
|
45
|
-
var __hasOwnProp$
|
|
46
|
-
var __propIsEnum$
|
|
47
|
-
var __defNormalProp$
|
|
43
|
+
var __defProp$2 = Object.defineProperty;
|
|
44
|
+
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
45
|
+
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
46
|
+
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
47
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, {
|
|
48
48
|
enumerable: true,
|
|
49
49
|
configurable: true,
|
|
50
50
|
writable: true,
|
|
51
51
|
value
|
|
52
52
|
}) : obj[key] = value;
|
|
53
|
-
var __spreadValues$
|
|
54
|
-
for (var prop in b || (b = {})) if (__hasOwnProp$
|
|
55
|
-
if (__getOwnPropSymbols$
|
|
56
|
-
for (var prop of __getOwnPropSymbols$
|
|
53
|
+
var __spreadValues$2 = (a, b) => {
|
|
54
|
+
for (var prop in b || (b = {})) if (__hasOwnProp$2.call(b, prop)) __defNormalProp$2(a, prop, b[prop]);
|
|
55
|
+
if (__getOwnPropSymbols$2) {
|
|
56
|
+
for (var prop of __getOwnPropSymbols$2(b)) if (__propIsEnum$2.call(b, prop)) __defNormalProp$2(a, prop, b[prop]);
|
|
57
57
|
}
|
|
58
58
|
return a;
|
|
59
59
|
};
|
|
60
|
-
var __vue_sfc__$
|
|
60
|
+
var __vue_sfc__$7 = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
61
61
|
__name: "Frame",
|
|
62
62
|
setup(__props, { expose: __expose }) {
|
|
63
63
|
const iframeRef = (0, vue.ref)(null);
|
|
@@ -65,7 +65,7 @@ var __vue_sfc__$6 = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
65
65
|
function sendMessageToIframe(type, data) {
|
|
66
66
|
var _a;
|
|
67
67
|
if (!((_a = iframeRef.value) == null ? void 0 : _a.contentWindow)) return;
|
|
68
|
-
iframeRef.value.contentWindow.postMessage(__spreadValues$
|
|
68
|
+
iframeRef.value.contentWindow.postMessage(__spreadValues$2({ type }, data), "*");
|
|
69
69
|
}
|
|
70
70
|
(0, vue.onMounted)(() => {
|
|
71
71
|
if (iframeRef.value) iframeRef.value.addEventListener("load", () => {
|
|
@@ -95,7 +95,7 @@ var __vue_sfc__$6 = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
95
95
|
var _hoisted_1$6 = { class: "opencode-iframe-container" };
|
|
96
96
|
var _hoisted_2$4 = { class: "opencode-empty-state-text" };
|
|
97
97
|
var _hoisted_3$4 = ["src"];
|
|
98
|
-
function __vue_render__$
|
|
98
|
+
function __vue_render__$7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
99
99
|
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$6, [
|
|
100
100
|
(0, vue.createElementVNode)("div", { class: (0, vue.normalizeClass)(["opencode-empty-state-overlay", { visible: $setup.showEmptyState }]) }, [(0, vue.renderSlot)(_ctx.$slots, "empty-state", {}, () => [
|
|
101
101
|
_cache[1] || (_cache[1] = (0, vue.createElementVNode)("div", { class: "opencode-empty-state-icon" }, [(0, vue.createElementVNode)("svg", {
|
|
@@ -129,11 +129,11 @@ function __vue_render__$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
129
129
|
}, null, 8, _hoisted_3$4)])
|
|
130
130
|
]);
|
|
131
131
|
}
|
|
132
|
-
__vue_sfc__$
|
|
133
|
-
var Frame_vue_default = __vue_sfc__$
|
|
132
|
+
__vue_sfc__$7.render = __vue_render__$7;
|
|
133
|
+
var Frame_vue_default = __vue_sfc__$7;
|
|
134
134
|
//#endregion
|
|
135
135
|
//#region es/open-code-widget/src/components/Header.vue.js
|
|
136
|
-
var __vue_sfc__$
|
|
136
|
+
var __vue_sfc__$6 = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
137
137
|
__name: "Header",
|
|
138
138
|
setup(__props, { expose: __expose }) {
|
|
139
139
|
__expose();
|
|
@@ -247,7 +247,7 @@ var _hoisted_14 = {
|
|
|
247
247
|
"stroke-width": "2",
|
|
248
248
|
"aria-hidden": "true"
|
|
249
249
|
};
|
|
250
|
-
function __vue_render__$
|
|
250
|
+
function __vue_render__$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
251
251
|
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$5, [
|
|
252
252
|
(0, vue.createElementVNode)("div", _hoisted_2$3, [
|
|
253
253
|
(0, vue.createElementVNode)("button", {
|
|
@@ -341,11 +341,11 @@ function __vue_render__$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
341
341
|
])
|
|
342
342
|
]);
|
|
343
343
|
}
|
|
344
|
-
__vue_sfc__$
|
|
345
|
-
var Header_vue_default = __vue_sfc__$
|
|
344
|
+
__vue_sfc__$6.render = __vue_render__$6;
|
|
345
|
+
var Header_vue_default = __vue_sfc__$6;
|
|
346
346
|
//#endregion
|
|
347
347
|
//#region es/open-code-widget/src/components/SelectHint.vue.js
|
|
348
|
-
var __vue_sfc__$
|
|
348
|
+
var __vue_sfc__$5 = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
349
349
|
__name: "SelectHint",
|
|
350
350
|
setup(__props, { expose: __expose }) {
|
|
351
351
|
__expose();
|
|
@@ -362,14 +362,14 @@ var __vue_sfc__$4 = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
362
362
|
}
|
|
363
363
|
});
|
|
364
364
|
var _hoisted_1$4 = { class: "opencode-hint-shortcut" };
|
|
365
|
-
function __vue_render__$
|
|
365
|
+
function __vue_render__$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
366
366
|
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", { class: (0, vue.normalizeClass)(["opencode-select-mode-hint", { visible: $setup.visible }]) }, [_cache[0] || (_cache[0] = (0, vue.createElementVNode)("span", null, "🎯 选择模式已开启 - 点击元素进行选择", -1)), (0, vue.createElementVNode)("span", _hoisted_1$4, (0, vue.toDisplayString)($setup.shortcutLabel), 1)], 2);
|
|
367
367
|
}
|
|
368
|
-
__vue_sfc__$
|
|
369
|
-
var SelectHint_vue_default = __vue_sfc__$
|
|
368
|
+
__vue_sfc__$5.render = __vue_render__$5;
|
|
369
|
+
var SelectHint_vue_default = __vue_sfc__$5;
|
|
370
370
|
//#endregion
|
|
371
371
|
//#region es/open-code-widget/src/components/SelectedNodes.vue.js
|
|
372
|
-
var __vue_sfc__$
|
|
372
|
+
var __vue_sfc__$4 = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
373
373
|
__name: "SelectedNodes",
|
|
374
374
|
setup(__props, { expose: __expose }) {
|
|
375
375
|
__expose();
|
|
@@ -398,7 +398,7 @@ var _hoisted_3$2 = { class: "opencode-node-content" };
|
|
|
398
398
|
var _hoisted_4$2 = { class: "opencode-node-text" };
|
|
399
399
|
var _hoisted_5$2 = { class: "opencode-node-file" };
|
|
400
400
|
var _hoisted_6$2 = ["aria-label", "onClick"];
|
|
401
|
-
function __vue_render__$
|
|
401
|
+
function __vue_render__$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
402
402
|
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", { class: (0, vue.normalizeClass)(["opencode-right-toolbar", { collapsed: $setup.items.length === 0 }]) }, [
|
|
403
403
|
_cache[1] || (_cache[1] = (0, vue.createElementVNode)("div", { class: "opencode-selected-nodes-header" }, [(0, vue.createElementVNode)("div", { class: "opencode-selected-nodes-title" }, "已选节点"), (0, vue.createElementVNode)("div", { class: "opencode-selected-nodes-desc" }, "选中的节点会在对话时一起发送给助手")], -1)),
|
|
404
404
|
(0, vue.createElementVNode)("div", _hoisted_1$3, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)($setup.items, (item, index) => {
|
|
@@ -427,11 +427,11 @@ function __vue_render__$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
427
427
|
}, " 一键清空 ")) : (0, vue.createCommentVNode)("v-if", true)
|
|
428
428
|
], 2);
|
|
429
429
|
}
|
|
430
|
-
__vue_sfc__$
|
|
431
|
-
var SelectedNodes_vue_default = __vue_sfc__$
|
|
430
|
+
__vue_sfc__$4.render = __vue_render__$4;
|
|
431
|
+
var SelectedNodes_vue_default = __vue_sfc__$4;
|
|
432
432
|
//#endregion
|
|
433
433
|
//#region es/open-code-widget/src/components/SessionList.vue.js
|
|
434
|
-
var __vue_sfc__$
|
|
434
|
+
var __vue_sfc__$3 = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
435
435
|
__name: "SessionList",
|
|
436
436
|
setup(__props, { expose: __expose }) {
|
|
437
437
|
__expose();
|
|
@@ -496,7 +496,7 @@ var _hoisted_6$1 = { class: "opencode-session-header" };
|
|
|
496
496
|
var _hoisted_7$1 = { class: "opencode-session-title" };
|
|
497
497
|
var _hoisted_8$1 = ["aria-label", "onClick"];
|
|
498
498
|
var _hoisted_9$1 = { class: "opencode-session-meta" };
|
|
499
|
-
function __vue_render__$
|
|
499
|
+
function __vue_render__$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
500
500
|
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", { class: (0, vue.normalizeClass)(["opencode-session-list", { collapsed: $setup.collapsed }]) }, [
|
|
501
501
|
(0, vue.createCommentVNode)(" Header "),
|
|
502
502
|
!$setup.showSkeleton ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$2, [_cache[1] || (_cache[1] = (0, vue.createElementVNode)("span", { id: "opencode-session-list-title" }, "会话列表", -1)), (0, vue.createElementVNode)("button", {
|
|
@@ -528,21 +528,377 @@ function __vue_render__$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
528
528
|
}), 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
529
|
], 2);
|
|
530
530
|
}
|
|
531
|
+
__vue_sfc__$3.render = __vue_render__$3;
|
|
532
|
+
var SessionList_vue_default = __vue_sfc__$3;
|
|
533
|
+
//#endregion
|
|
534
|
+
//#region es/open-code-widget/src/components/FloatingBubble/FloatingBubble.vue.js
|
|
535
|
+
var __defProp$1 = Object.defineProperty;
|
|
536
|
+
var __defProps$1 = Object.defineProperties;
|
|
537
|
+
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
538
|
+
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
539
|
+
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
540
|
+
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
541
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, {
|
|
542
|
+
enumerable: true,
|
|
543
|
+
configurable: true,
|
|
544
|
+
writable: true,
|
|
545
|
+
value
|
|
546
|
+
}) : obj[key] = value;
|
|
547
|
+
var __spreadValues$1 = (a, b) => {
|
|
548
|
+
for (var prop in b || (b = {})) if (__hasOwnProp$1.call(b, prop)) __defNormalProp$1(a, prop, b[prop]);
|
|
549
|
+
if (__getOwnPropSymbols$1) {
|
|
550
|
+
for (var prop of __getOwnPropSymbols$1(b)) if (__propIsEnum$1.call(b, prop)) __defNormalProp$1(a, prop, b[prop]);
|
|
551
|
+
}
|
|
552
|
+
return a;
|
|
553
|
+
};
|
|
554
|
+
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
555
|
+
var __vue_sfc__$2 = /* @__PURE__ */ (0, vue.defineComponent)(__spreadProps$1(__spreadValues$1({}, { name: "FloatingBubble" }), {
|
|
556
|
+
__name: "FloatingBubble",
|
|
557
|
+
props: {
|
|
558
|
+
offset: {
|
|
559
|
+
type: Object,
|
|
560
|
+
required: false,
|
|
561
|
+
default: void 0
|
|
562
|
+
},
|
|
563
|
+
axis: {
|
|
564
|
+
type: String,
|
|
565
|
+
required: false,
|
|
566
|
+
default: "xy"
|
|
567
|
+
},
|
|
568
|
+
magnetic: {
|
|
569
|
+
type: String,
|
|
570
|
+
required: false,
|
|
571
|
+
default: void 0
|
|
572
|
+
},
|
|
573
|
+
gap: {
|
|
574
|
+
type: [Number, Object],
|
|
575
|
+
required: false,
|
|
576
|
+
default: 24
|
|
577
|
+
},
|
|
578
|
+
teleport: {
|
|
579
|
+
type: null,
|
|
580
|
+
required: false,
|
|
581
|
+
default: "body"
|
|
582
|
+
}
|
|
583
|
+
},
|
|
584
|
+
emits: [
|
|
585
|
+
"update:offset",
|
|
586
|
+
"click",
|
|
587
|
+
"offset-change",
|
|
588
|
+
"drag-start",
|
|
589
|
+
"drag-end"
|
|
590
|
+
],
|
|
591
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
592
|
+
const props = __props;
|
|
593
|
+
const emit = __emit;
|
|
594
|
+
const rootRef = (0, vue.ref)(null);
|
|
595
|
+
const state = (0, vue.ref)({
|
|
596
|
+
x: 0,
|
|
597
|
+
y: 0,
|
|
598
|
+
width: 0,
|
|
599
|
+
height: 0
|
|
600
|
+
});
|
|
601
|
+
const isObject = (val) => val !== null && typeof val === "object";
|
|
602
|
+
const gapX = (0, vue.computed)(() => isObject(props.gap) ? props.gap.x : props.gap);
|
|
603
|
+
const gapY = (0, vue.computed)(() => isObject(props.gap) ? props.gap.y : props.gap);
|
|
604
|
+
const windowWidth = (0, vue.ref)(typeof window !== "undefined" ? window.innerWidth : 0);
|
|
605
|
+
const windowHeight = (0, vue.ref)(typeof window !== "undefined" ? window.innerHeight : 0);
|
|
606
|
+
const boundary = (0, vue.computed)(() => ({
|
|
607
|
+
top: gapY.value,
|
|
608
|
+
right: windowWidth.value - state.value.width - gapX.value,
|
|
609
|
+
bottom: windowHeight.value - state.value.height - gapY.value,
|
|
610
|
+
left: gapX.value
|
|
611
|
+
}));
|
|
612
|
+
const dragging = (0, vue.ref)(false);
|
|
613
|
+
const initialized = (0, vue.ref)(false);
|
|
614
|
+
const rootStyle = (0, vue.computed)(() => {
|
|
615
|
+
const style = {};
|
|
616
|
+
style.transform = `translate3d(${`${state.value.x}px`}, ${`${state.value.y}px`}, 0)`;
|
|
617
|
+
if (dragging.value || !initialized.value) style.transition = "none";
|
|
618
|
+
else style.transition = "transform 0.3s ease";
|
|
619
|
+
return style;
|
|
620
|
+
});
|
|
621
|
+
const show = (0, vue.ref)(true);
|
|
622
|
+
const updateState = () => {
|
|
623
|
+
if (!show.value || !rootRef.value || typeof window === "undefined") return;
|
|
624
|
+
const rect = rootRef.value.getBoundingClientRect();
|
|
625
|
+
const { offset } = props;
|
|
626
|
+
let x = offset ? offset.x : windowWidth.value - rect.width - gapX.value;
|
|
627
|
+
let y = offset ? offset.y : windowHeight.value - rect.height - gapY.value;
|
|
628
|
+
const maxX = windowWidth.value - rect.width - gapX.value;
|
|
629
|
+
const maxY = windowHeight.value - rect.height - gapY.value;
|
|
630
|
+
if (x < gapX.value) x = gapX.value;
|
|
631
|
+
if (x > maxX) x = maxX;
|
|
632
|
+
if (y < gapY.value) y = gapY.value;
|
|
633
|
+
if (y > maxY) y = maxY;
|
|
634
|
+
state.value = {
|
|
635
|
+
x,
|
|
636
|
+
y,
|
|
637
|
+
width: rect.width,
|
|
638
|
+
height: rect.height
|
|
639
|
+
};
|
|
640
|
+
};
|
|
641
|
+
const touch = {
|
|
642
|
+
startX: (0, vue.ref)(0),
|
|
643
|
+
startY: (0, vue.ref)(0),
|
|
644
|
+
deltaX: (0, vue.ref)(0),
|
|
645
|
+
deltaY: (0, vue.ref)(0),
|
|
646
|
+
offsetX: (0, vue.ref)(0),
|
|
647
|
+
offsetY: (0, vue.ref)(0),
|
|
648
|
+
isTap: (0, vue.ref)(true),
|
|
649
|
+
start(e) {
|
|
650
|
+
this.startX.value = "touches" in e ? e.touches[0].clientX : e.clientX;
|
|
651
|
+
this.startY.value = "touches" in e ? e.touches[0].clientY : e.clientY;
|
|
652
|
+
this.deltaX.value = 0;
|
|
653
|
+
this.deltaY.value = 0;
|
|
654
|
+
this.offsetX.value = 0;
|
|
655
|
+
this.offsetY.value = 0;
|
|
656
|
+
this.isTap.value = true;
|
|
657
|
+
},
|
|
658
|
+
move(e) {
|
|
659
|
+
const clientX = "touches" in e ? e.touches[0].clientX : e.clientX;
|
|
660
|
+
const clientY = "touches" in e ? e.touches[0].clientY : e.clientY;
|
|
661
|
+
this.deltaX.value = clientX - this.startX.value;
|
|
662
|
+
this.deltaY.value = clientY - this.startY.value;
|
|
663
|
+
this.offsetX.value = Math.abs(this.deltaX.value);
|
|
664
|
+
this.offsetY.value = Math.abs(this.deltaY.value);
|
|
665
|
+
const TAP_OFFSET = 5;
|
|
666
|
+
if (this.isTap.value && (this.offsetX.value > TAP_OFFSET || this.offsetY.value > TAP_OFFSET)) this.isTap.value = false;
|
|
667
|
+
}
|
|
668
|
+
};
|
|
669
|
+
let prevX = 0;
|
|
670
|
+
let prevY = 0;
|
|
671
|
+
const onTouchStart = (e) => {
|
|
672
|
+
touch.start(e);
|
|
673
|
+
dragging.value = true;
|
|
674
|
+
prevX = state.value.x;
|
|
675
|
+
prevY = state.value.y;
|
|
676
|
+
if (!("touches" in e)) {
|
|
677
|
+
window.addEventListener("mousemove", onTouchMove, { passive: false });
|
|
678
|
+
window.addEventListener("mouseup", onTouchEnd);
|
|
679
|
+
}
|
|
680
|
+
};
|
|
681
|
+
const onTouchMove = (e) => {
|
|
682
|
+
if (e.cancelable) e.preventDefault();
|
|
683
|
+
const wasTap = touch.isTap.value;
|
|
684
|
+
touch.move(e);
|
|
685
|
+
if (wasTap && !touch.isTap.value) emit("drag-start");
|
|
686
|
+
if (props.axis === "lock") return;
|
|
687
|
+
if (!touch.isTap.value) {
|
|
688
|
+
if (props.axis === "x" || props.axis === "xy") {
|
|
689
|
+
let nextX = prevX + touch.deltaX.value;
|
|
690
|
+
if (nextX < boundary.value.left) nextX = boundary.value.left;
|
|
691
|
+
if (nextX > boundary.value.right) nextX = boundary.value.right;
|
|
692
|
+
state.value.x = nextX;
|
|
693
|
+
}
|
|
694
|
+
if (props.axis === "y" || props.axis === "xy") {
|
|
695
|
+
let nextY = prevY + touch.deltaY.value;
|
|
696
|
+
if (nextY < boundary.value.top) nextY = boundary.value.top;
|
|
697
|
+
if (nextY > boundary.value.bottom) nextY = boundary.value.bottom;
|
|
698
|
+
state.value.y = nextY;
|
|
699
|
+
}
|
|
700
|
+
emit("update:offset", {
|
|
701
|
+
x: state.value.x,
|
|
702
|
+
y: state.value.y
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
};
|
|
706
|
+
const closest = (arr, target) => {
|
|
707
|
+
return arr.reduce((pre, cur) => Math.abs(pre - target) < Math.abs(cur - target) ? pre : cur);
|
|
708
|
+
};
|
|
709
|
+
const onTouchEnd = (e) => {
|
|
710
|
+
dragging.value = false;
|
|
711
|
+
if (e && !("touches" in e) && e.type === "mouseup") {
|
|
712
|
+
window.removeEventListener("mousemove", onTouchMove);
|
|
713
|
+
window.removeEventListener("mouseup", onTouchEnd);
|
|
714
|
+
}
|
|
715
|
+
requestAnimationFrame(() => {
|
|
716
|
+
if (props.magnetic === "x") {
|
|
717
|
+
const nextX = closest([boundary.value.left, boundary.value.right], state.value.x);
|
|
718
|
+
state.value.x = nextX;
|
|
719
|
+
}
|
|
720
|
+
if (props.magnetic === "y") {
|
|
721
|
+
const nextY = closest([boundary.value.top, boundary.value.bottom], state.value.y);
|
|
722
|
+
state.value.y = nextY;
|
|
723
|
+
}
|
|
724
|
+
if (!touch.isTap.value) {
|
|
725
|
+
emit("drag-end");
|
|
726
|
+
const offset = {
|
|
727
|
+
x: state.value.x,
|
|
728
|
+
y: state.value.y
|
|
729
|
+
};
|
|
730
|
+
emit("update:offset", offset);
|
|
731
|
+
if (prevX !== offset.x || prevY !== offset.y) emit("offset-change", offset);
|
|
732
|
+
}
|
|
733
|
+
});
|
|
734
|
+
};
|
|
735
|
+
const onClick = (e) => {
|
|
736
|
+
if (touch.isTap.value) emit("click", e);
|
|
737
|
+
else e.stopPropagation();
|
|
738
|
+
};
|
|
739
|
+
const handleResize = () => {
|
|
740
|
+
if (typeof window !== "undefined") {
|
|
741
|
+
windowWidth.value = window.innerWidth;
|
|
742
|
+
windowHeight.value = window.innerHeight;
|
|
743
|
+
}
|
|
744
|
+
};
|
|
745
|
+
(0, vue.onMounted)(() => {
|
|
746
|
+
updateState();
|
|
747
|
+
(0, vue.nextTick)(() => {
|
|
748
|
+
initialized.value = true;
|
|
749
|
+
});
|
|
750
|
+
if (typeof window !== "undefined") window.addEventListener("resize", handleResize);
|
|
751
|
+
if (rootRef.value) rootRef.value.addEventListener("touchmove", onTouchMove, { passive: false });
|
|
752
|
+
});
|
|
753
|
+
(0, vue.onUnmounted)(() => {
|
|
754
|
+
if (typeof window !== "undefined") {
|
|
755
|
+
window.removeEventListener("resize", handleResize);
|
|
756
|
+
window.removeEventListener("mousemove", onTouchMove);
|
|
757
|
+
window.removeEventListener("mouseup", onTouchEnd);
|
|
758
|
+
}
|
|
759
|
+
if (rootRef.value) rootRef.value.removeEventListener("touchmove", onTouchMove);
|
|
760
|
+
});
|
|
761
|
+
(0, vue.watch)([
|
|
762
|
+
windowWidth,
|
|
763
|
+
windowHeight,
|
|
764
|
+
gapX,
|
|
765
|
+
gapY,
|
|
766
|
+
() => props.offset
|
|
767
|
+
], updateState, { deep: true });
|
|
768
|
+
const isOnRightSide = (0, vue.computed)(() => {
|
|
769
|
+
return state.value.x > windowWidth.value / 2;
|
|
770
|
+
});
|
|
771
|
+
__expose({
|
|
772
|
+
isOnRightSide,
|
|
773
|
+
offset: (0, vue.computed)(() => ({
|
|
774
|
+
x: state.value.x,
|
|
775
|
+
y: state.value.y
|
|
776
|
+
}))
|
|
777
|
+
});
|
|
778
|
+
const __returned__ = {
|
|
779
|
+
props,
|
|
780
|
+
emit,
|
|
781
|
+
rootRef,
|
|
782
|
+
state,
|
|
783
|
+
isObject,
|
|
784
|
+
gapX,
|
|
785
|
+
gapY,
|
|
786
|
+
windowWidth,
|
|
787
|
+
windowHeight,
|
|
788
|
+
boundary,
|
|
789
|
+
dragging,
|
|
790
|
+
initialized,
|
|
791
|
+
rootStyle,
|
|
792
|
+
show,
|
|
793
|
+
updateState,
|
|
794
|
+
touch,
|
|
795
|
+
get prevX() {
|
|
796
|
+
return prevX;
|
|
797
|
+
},
|
|
798
|
+
set prevX(v) {
|
|
799
|
+
prevX = v;
|
|
800
|
+
},
|
|
801
|
+
get prevY() {
|
|
802
|
+
return prevY;
|
|
803
|
+
},
|
|
804
|
+
set prevY(v) {
|
|
805
|
+
prevY = v;
|
|
806
|
+
},
|
|
807
|
+
onTouchStart,
|
|
808
|
+
onTouchMove,
|
|
809
|
+
closest,
|
|
810
|
+
onTouchEnd,
|
|
811
|
+
onClick,
|
|
812
|
+
handleResize,
|
|
813
|
+
isOnRightSide
|
|
814
|
+
};
|
|
815
|
+
Object.defineProperty(__returned__, "__isScriptSetup", {
|
|
816
|
+
enumerable: false,
|
|
817
|
+
value: true
|
|
818
|
+
});
|
|
819
|
+
return __returned__;
|
|
820
|
+
}
|
|
821
|
+
}));
|
|
822
|
+
function __vue_render__$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
823
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(vue.Teleport, { to: $props.teleport }, [(0, vue.withDirectives)((0, vue.createElementVNode)("div", {
|
|
824
|
+
ref: "rootRef",
|
|
825
|
+
class: "floating-bubble",
|
|
826
|
+
style: (0, vue.normalizeStyle)($setup.rootStyle),
|
|
827
|
+
onTouchstartPassive: $setup.onTouchStart,
|
|
828
|
+
onTouchend: $setup.onTouchEnd,
|
|
829
|
+
onTouchcancel: $setup.onTouchEnd,
|
|
830
|
+
onMousedown: $setup.onTouchStart,
|
|
831
|
+
onClickCapture: $setup.onClick
|
|
832
|
+
}, [(0, vue.renderSlot)(_ctx.$slots, "default")], 36), [[vue.vShow, $setup.show]])], 8, ["to"]);
|
|
833
|
+
}
|
|
531
834
|
__vue_sfc__$2.render = __vue_render__$2;
|
|
532
|
-
var
|
|
835
|
+
var FloatingBubble_vue_default = __vue_sfc__$2;
|
|
533
836
|
//#endregion
|
|
534
837
|
//#region es/open-code-widget/src/components/Trigger.vue.js
|
|
838
|
+
var STORAGE_KEY = "opencode-bubble-offset";
|
|
535
839
|
var __vue_sfc__$1 = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
536
840
|
__name: "Trigger",
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
841
|
+
emits: [
|
|
842
|
+
"offset-change",
|
|
843
|
+
"drag-start",
|
|
844
|
+
"drag-end"
|
|
845
|
+
],
|
|
846
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
847
|
+
const { buttonActive: active, open, hotkeyLabel, thinking, resolvedTheme, handleToggle } = useOpenCodeWidgetContext();
|
|
848
|
+
const loadOffset = () => {
|
|
849
|
+
try {
|
|
850
|
+
const saved = localStorage.getItem(STORAGE_KEY);
|
|
851
|
+
if (saved) {
|
|
852
|
+
const parsed = JSON.parse(saved);
|
|
853
|
+
if (parsed && (parsed.x !== 0 || parsed.y !== 0)) return parsed;
|
|
854
|
+
}
|
|
855
|
+
} catch (e) {}
|
|
856
|
+
return {
|
|
857
|
+
x: 0,
|
|
858
|
+
y: 0
|
|
859
|
+
};
|
|
860
|
+
};
|
|
861
|
+
const offset = (0, vue.ref)(loadOffset());
|
|
862
|
+
const emit = __emit;
|
|
863
|
+
const saveOffset = (value) => {
|
|
864
|
+
try {
|
|
865
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify(value));
|
|
866
|
+
} catch (e) {}
|
|
867
|
+
};
|
|
868
|
+
const handleOffsetChange = (value) => {
|
|
869
|
+
offset.value = value;
|
|
870
|
+
saveOffset(value);
|
|
871
|
+
emit("offset-change", value);
|
|
872
|
+
};
|
|
873
|
+
const bubbleRef = (0, vue.ref)(null);
|
|
874
|
+
const isOnRightSide = (0, vue.computed)(() => {
|
|
875
|
+
if (typeof window === "undefined") return true;
|
|
876
|
+
const centerX = window.innerWidth / 2;
|
|
877
|
+
return offset.value.x > centerX;
|
|
878
|
+
});
|
|
879
|
+
(0, vue.onMounted)(() => {
|
|
880
|
+
if (offset.value.x !== 0 || offset.value.y !== 0) emit("offset-change", offset.value);
|
|
881
|
+
});
|
|
882
|
+
__expose({
|
|
883
|
+
isOnRightSide,
|
|
884
|
+
offset
|
|
885
|
+
});
|
|
540
886
|
const __returned__ = {
|
|
541
887
|
active,
|
|
542
888
|
open,
|
|
543
889
|
hotkeyLabel,
|
|
544
890
|
thinking,
|
|
545
|
-
|
|
891
|
+
resolvedTheme,
|
|
892
|
+
handleToggle,
|
|
893
|
+
STORAGE_KEY,
|
|
894
|
+
loadOffset,
|
|
895
|
+
offset,
|
|
896
|
+
emit,
|
|
897
|
+
saveOffset,
|
|
898
|
+
handleOffsetChange,
|
|
899
|
+
bubbleRef,
|
|
900
|
+
isOnRightSide,
|
|
901
|
+
FloatingBubble: FloatingBubble_vue_default
|
|
546
902
|
};
|
|
547
903
|
Object.defineProperty(__returned__, "__isScriptSetup", {
|
|
548
904
|
enumerable: false,
|
|
@@ -553,43 +909,70 @@ var __vue_sfc__$1 = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
553
909
|
});
|
|
554
910
|
var _hoisted_1$1 = ["aria-expanded", "title"];
|
|
555
911
|
function __vue_render__$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
556
|
-
return (0, vue.openBlock)(), (0, vue.
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
"
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
912
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)($setup["FloatingBubble"], {
|
|
913
|
+
ref: "bubbleRef",
|
|
914
|
+
offset: $setup.offset,
|
|
915
|
+
"onUpdate:offset": _cache[0] || (_cache[0] = ($event) => $setup.offset = $event),
|
|
916
|
+
axis: "xy",
|
|
917
|
+
magnetic: "x",
|
|
918
|
+
gap: 24,
|
|
919
|
+
onClick: $setup.handleToggle,
|
|
920
|
+
onOffsetChange: $setup.handleOffsetChange,
|
|
921
|
+
onDragStart: _cache[1] || (_cache[1] = ($event) => $setup.emit("drag-start")),
|
|
922
|
+
onDragEnd: _cache[2] || (_cache[2] = ($event) => $setup.emit("drag-end"))
|
|
923
|
+
}, {
|
|
924
|
+
default: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("button", {
|
|
925
|
+
class: (0, vue.normalizeClass)(["opencode-button", {
|
|
926
|
+
active: $setup.active,
|
|
927
|
+
thinking: $setup.thinking,
|
|
928
|
+
"opencode-theme-dark": $setup.resolvedTheme === "dark"
|
|
929
|
+
}]),
|
|
930
|
+
type: "button",
|
|
931
|
+
"aria-expanded": $setup.open,
|
|
932
|
+
"aria-label": "打开 AI 助手",
|
|
933
|
+
title: `AI \u52A9\u624B (${$setup.hotkeyLabel})`
|
|
934
|
+
}, [(0, vue.renderSlot)(_ctx.$slots, "default", {}, () => [_cache[3] || (_cache[3] = (0, vue.createElementVNode)("svg", {
|
|
935
|
+
t: "1775402599580",
|
|
936
|
+
class: "icon",
|
|
937
|
+
viewBox: "0 0 1024 1024",
|
|
938
|
+
version: "1.1",
|
|
939
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
940
|
+
"p-id": "5390",
|
|
941
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
942
|
+
width: "100%",
|
|
943
|
+
height: "100%"
|
|
944
|
+
}, [
|
|
945
|
+
(0, vue.createElementVNode)("defs", null, [(0, vue.createElementVNode)("linearGradient", {
|
|
946
|
+
id: "opencode-logo-gradient",
|
|
947
|
+
x1: "0%",
|
|
948
|
+
y1: "0%",
|
|
949
|
+
x2: "100%",
|
|
950
|
+
y2: "100%"
|
|
951
|
+
}, [(0, vue.createElementVNode)("stop", {
|
|
952
|
+
offset: "0%",
|
|
953
|
+
style: { "stop-color": "#667eea" }
|
|
954
|
+
}), (0, vue.createElementVNode)("stop", {
|
|
955
|
+
offset: "100%",
|
|
956
|
+
style: { "stop-color": "#764ba2" }
|
|
957
|
+
})])]),
|
|
958
|
+
(0, vue.createElementVNode)("path", {
|
|
959
|
+
d: "M512 981.33H85.34c-15.85 0-30.38-8.77-37.77-22.81a42.624 42.624 0 0 1 2.6-44.02L135 791.08C75.25 710.5 42.67 612.6 42.67 512 42.67 253.21 253.21 42.67 512 42.67S981.34 253.21 981.34 512 770.8 981.33 512 981.33zM166.44 896H512c211.73 0 384-172.27 384-384S723.73 128 512 128 128 300.27 128 512c0 91.29 32.83 179.9 92.46 249.46 12.58 14.69 13.73 36 2.77 51.94L166.44 896z",
|
|
960
|
+
fill: "url(#opencode-logo-gradient)",
|
|
961
|
+
"p-id": "5391"
|
|
962
|
+
}),
|
|
963
|
+
(0, vue.createElementVNode)("path", {
|
|
964
|
+
d: "M384 448m-64 0a64 64 0 1 0 128 0 64 64 0 1 0 -128 0Z",
|
|
965
|
+
fill: "url(#opencode-logo-gradient)",
|
|
966
|
+
"p-id": "5392"
|
|
967
|
+
}),
|
|
968
|
+
(0, vue.createElementVNode)("path", {
|
|
969
|
+
d: "M640 448m-64 0a64 64 0 1 0 128 0 64 64 0 1 0 -128 0Z",
|
|
970
|
+
fill: "url(#opencode-logo-gradient)",
|
|
971
|
+
"p-id": "5393"
|
|
972
|
+
})
|
|
973
|
+
], -1))])], 10, _hoisted_1$1)]),
|
|
974
|
+
_: 3
|
|
975
|
+
}, 8, ["offset", "onClick"]);
|
|
593
976
|
}
|
|
594
977
|
__vue_sfc__$1.render = __vue_render__$1;
|
|
595
978
|
var Trigger_vue_default = __vue_sfc__$1;
|
|
@@ -802,11 +1185,7 @@ function useWidget(options) {
|
|
|
802
1185
|
if (options.theme.value === "auto") return systemTheme.value;
|
|
803
1186
|
return options.theme.value;
|
|
804
1187
|
});
|
|
805
|
-
const containerClasses = (0, vue.computed)(() => [
|
|
806
|
-
"opencode-widget",
|
|
807
|
-
options.position.value,
|
|
808
|
-
`opencode-theme-${resolvedTheme.value}`
|
|
809
|
-
]);
|
|
1188
|
+
const containerClasses = (0, vue.computed)(() => ["opencode-widget", `opencode-theme-${resolvedTheme.value}`]);
|
|
810
1189
|
const buttonActive = (0, vue.computed)(() => !!(options.open.value || options.selectMode.value));
|
|
811
1190
|
const iframeSource = (0, vue.computed)(() => options.iframeSrc.value || "about:blank");
|
|
812
1191
|
const sessionListTitle = (0, vue.computed)(() => options.sessionListCollapsed.value ? "展开会话列表" : "折叠会话列表");
|
|
@@ -1255,11 +1634,6 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
1255
1634
|
var __vue_sfc__ = /* @__PURE__ */ (0, vue.defineComponent)(__spreadProps(__spreadValues({}, { name: "OpencodeWidget" }), {
|
|
1256
1635
|
__name: "index",
|
|
1257
1636
|
props: {
|
|
1258
|
-
position: {
|
|
1259
|
-
type: String,
|
|
1260
|
-
required: false,
|
|
1261
|
-
default: "bottom-right"
|
|
1262
|
-
},
|
|
1263
1637
|
open: {
|
|
1264
1638
|
type: Boolean,
|
|
1265
1639
|
required: false,
|
|
@@ -1430,6 +1804,7 @@ var __vue_sfc__ = /* @__PURE__ */ (0, vue.defineComponent)(__spreadProps(__sprea
|
|
|
1430
1804
|
if (dialogResolve) dialogResolve(false);
|
|
1431
1805
|
};
|
|
1432
1806
|
const frameRef = (0, vue.ref)(null);
|
|
1807
|
+
const triggerRef = (0, vue.ref)(null);
|
|
1433
1808
|
const sendMessageToIframe = (type, data) => {
|
|
1434
1809
|
var _a;
|
|
1435
1810
|
(_a = frameRef.value) == null || _a.sendMessageToIframe(type, data);
|
|
@@ -1449,7 +1824,6 @@ var __vue_sfc__ = /* @__PURE__ */ (0, vue.defineComponent)(__spreadProps(__sprea
|
|
|
1449
1824
|
localSessionListCollapsed.value = val;
|
|
1450
1825
|
});
|
|
1451
1826
|
const { buttonActive, containerClasses, iframeSource, sessionListTitle, resolvedTheme, handleClose, handleEmptyAction, handleToggle, handleToggleSessionList, handleToggleTheme } = useWidget({
|
|
1452
|
-
position: (0, vue.toRef)(props, "position"),
|
|
1453
1827
|
theme: (0, vue.toRef)(props, "theme"),
|
|
1454
1828
|
open: (0, vue.toRef)(props, "open"),
|
|
1455
1829
|
selectMode: (0, vue.toRef)(props, "selectMode"),
|
|
@@ -1530,6 +1904,59 @@ var __vue_sfc__ = /* @__PURE__ */ (0, vue.defineComponent)(__spreadProps(__sprea
|
|
|
1530
1904
|
promptDockVisible.value = !promptDockVisible.value;
|
|
1531
1905
|
sendMessageToIframe("prompt-dock-visibility-change", { visible: promptDockVisible.value });
|
|
1532
1906
|
};
|
|
1907
|
+
const bubbleOffset = (0, vue.ref)({
|
|
1908
|
+
x: 0,
|
|
1909
|
+
y: 0
|
|
1910
|
+
});
|
|
1911
|
+
const isBubbleOnRightSide = (0, vue.computed)(() => {
|
|
1912
|
+
if (typeof window === "undefined") return true;
|
|
1913
|
+
const centerX = window.innerWidth / 2;
|
|
1914
|
+
return bubbleOffset.value.x > centerX;
|
|
1915
|
+
});
|
|
1916
|
+
const chatPositionStyle = (0, vue.computed)(() => {
|
|
1917
|
+
if (typeof window === "undefined") return {};
|
|
1918
|
+
const windowWidth = window.innerWidth;
|
|
1919
|
+
const windowHeight = window.innerHeight;
|
|
1920
|
+
const chatWidth = minimized.value ? 300 : 700;
|
|
1921
|
+
const chatHeight = minimized.value ? 300 : Math.min(windowHeight * .86, windowHeight - 40);
|
|
1922
|
+
const gap = 24;
|
|
1923
|
+
const bubbleSize = 44;
|
|
1924
|
+
const screenMargin = 20;
|
|
1925
|
+
const style = {};
|
|
1926
|
+
if (isBubbleOnRightSide.value) {
|
|
1927
|
+
let rightPos = windowWidth - bubbleOffset.value.x + gap;
|
|
1928
|
+
const maxRight = windowWidth - chatWidth - screenMargin;
|
|
1929
|
+
if (rightPos > maxRight) rightPos = maxRight;
|
|
1930
|
+
style.right = `${rightPos}px`;
|
|
1931
|
+
style.left = "auto";
|
|
1932
|
+
} else {
|
|
1933
|
+
let leftPos = bubbleOffset.value.x + bubbleSize + gap;
|
|
1934
|
+
const maxLeft = windowWidth - chatWidth - screenMargin;
|
|
1935
|
+
if (leftPos > maxLeft) leftPos = maxLeft;
|
|
1936
|
+
style.left = `${leftPos}px`;
|
|
1937
|
+
style.right = "auto";
|
|
1938
|
+
}
|
|
1939
|
+
let bottomPos = windowHeight - bubbleOffset.value.y - bubbleSize;
|
|
1940
|
+
const maxBottom = windowHeight - chatHeight - screenMargin;
|
|
1941
|
+
if (bottomPos > maxBottom) bottomPos = maxBottom;
|
|
1942
|
+
if (bottomPos < screenMargin) bottomPos = screenMargin;
|
|
1943
|
+
style.bottom = `${bottomPos}px`;
|
|
1944
|
+
return style;
|
|
1945
|
+
});
|
|
1946
|
+
const handleBubbleOffsetChange = (offset) => {
|
|
1947
|
+
bubbleOffset.value = offset;
|
|
1948
|
+
};
|
|
1949
|
+
const isDragging = (0, vue.ref)(false);
|
|
1950
|
+
let wasOpenBeforeDrag = false;
|
|
1951
|
+
const handleDragStart = () => {
|
|
1952
|
+
isDragging.value = true;
|
|
1953
|
+
wasOpenBeforeDrag = props.open;
|
|
1954
|
+
if (props.open) emit("update:open", false);
|
|
1955
|
+
};
|
|
1956
|
+
const handleDragEnd = () => {
|
|
1957
|
+
isDragging.value = false;
|
|
1958
|
+
if (wasOpenBeforeDrag) emit("update:open", true);
|
|
1959
|
+
};
|
|
1533
1960
|
provideOpenCodeWidgetContext({
|
|
1534
1961
|
theme: (0, vue.toRef)(props, "theme"),
|
|
1535
1962
|
resolvedTheme,
|
|
@@ -1601,6 +2028,7 @@ var __vue_sfc__ = /* @__PURE__ */ (0, vue.defineComponent)(__spreadProps(__sprea
|
|
|
1601
2028
|
handleDialogConfirm,
|
|
1602
2029
|
handleDialogCancel,
|
|
1603
2030
|
frameRef,
|
|
2031
|
+
triggerRef,
|
|
1604
2032
|
sendMessageToIframe,
|
|
1605
2033
|
handleFrameLoaded,
|
|
1606
2034
|
localSessionListCollapsed,
|
|
@@ -1634,6 +2062,19 @@ var __vue_sfc__ = /* @__PURE__ */ (0, vue.defineComponent)(__spreadProps(__sprea
|
|
|
1634
2062
|
tooltipContent,
|
|
1635
2063
|
handleToggleMinimize,
|
|
1636
2064
|
handleTogglePromptDock,
|
|
2065
|
+
bubbleOffset,
|
|
2066
|
+
isBubbleOnRightSide,
|
|
2067
|
+
chatPositionStyle,
|
|
2068
|
+
handleBubbleOffsetChange,
|
|
2069
|
+
isDragging,
|
|
2070
|
+
get wasOpenBeforeDrag() {
|
|
2071
|
+
return wasOpenBeforeDrag;
|
|
2072
|
+
},
|
|
2073
|
+
set wasOpenBeforeDrag(v) {
|
|
2074
|
+
wasOpenBeforeDrag = v;
|
|
2075
|
+
},
|
|
2076
|
+
handleDragStart,
|
|
2077
|
+
handleDragEnd,
|
|
1637
2078
|
Frame: Frame_vue_default,
|
|
1638
2079
|
Header: Header_vue_default,
|
|
1639
2080
|
SelectHint: SelectHint_vue_default,
|
|
@@ -1674,16 +2115,24 @@ var _hoisted_9 = {
|
|
|
1674
2115
|
};
|
|
1675
2116
|
function __vue_render__(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1676
2117
|
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", { class: (0, vue.normalizeClass)($setup.containerClasses) }, [
|
|
1677
|
-
(0, vue.createVNode)($setup["Trigger"],
|
|
2118
|
+
(0, vue.createVNode)($setup["Trigger"], {
|
|
2119
|
+
ref: "triggerRef",
|
|
2120
|
+
onOffsetChange: $setup.handleBubbleOffsetChange,
|
|
2121
|
+
onDragStart: $setup.handleDragStart,
|
|
2122
|
+
onDragEnd: $setup.handleDragEnd
|
|
2123
|
+
}, (0, vue.createSlots)({ _: 2 }, [$setup.slots["button-icon"] ? {
|
|
1678
2124
|
name: "default",
|
|
1679
2125
|
fn: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "button-icon")]),
|
|
1680
2126
|
key: "0"
|
|
1681
|
-
} : void 0]),
|
|
1682
|
-
(0, vue.
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
2127
|
+
} : void 0]), 1536),
|
|
2128
|
+
(0, vue.withDirectives)((0, vue.createElementVNode)("div", {
|
|
2129
|
+
class: (0, vue.normalizeClass)(["opencode-chat", {
|
|
2130
|
+
open: $props.open,
|
|
2131
|
+
minimized: $setup.minimized,
|
|
2132
|
+
dragging: $setup.isDragging
|
|
2133
|
+
}]),
|
|
2134
|
+
style: (0, vue.normalizeStyle)($setup.chatPositionStyle)
|
|
2135
|
+
}, [
|
|
1687
2136
|
(0, vue.createVNode)($setup["Header"], null, (0, vue.createSlots)({ _: 2 }, [
|
|
1688
2137
|
$setup.slots["session-toggle-icon"] ? {
|
|
1689
2138
|
name: "session-toggle-icon",
|
|
@@ -1701,7 +2150,6 @@ function __vue_render__(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1701
2150
|
key: "2"
|
|
1702
2151
|
} : void 0
|
|
1703
2152
|
]), 1024),
|
|
1704
|
-
(0, vue.createCommentVNode)(" Notification "),
|
|
1705
2153
|
$setup.notificationVisible && $setup.notificationMode === "widget" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1, (0, vue.toDisplayString)($setup.notificationMessage), 1)) : (0, vue.createCommentVNode)("v-if", true),
|
|
1706
2154
|
(0, vue.createElementVNode)("div", _hoisted_2, [
|
|
1707
2155
|
(0, vue.createVNode)($setup["SessionList"], null, {
|
|
@@ -1732,19 +2180,16 @@ function __vue_render__(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1732
2180
|
]), 1536),
|
|
1733
2181
|
(0, vue.createVNode)($setup["SelectedNodes"])
|
|
1734
2182
|
])
|
|
1735
|
-
],
|
|
2183
|
+
], 6), [[vue.vShow, !$props.selectMode]]),
|
|
1736
2184
|
(0, vue.createVNode)($setup["SelectHint"]),
|
|
1737
|
-
(0, vue.createCommentVNode)(" Inspector Highlight "),
|
|
1738
2185
|
(0, vue.withDirectives)((0, vue.createElementVNode)("div", {
|
|
1739
2186
|
class: "opencode-element-highlight",
|
|
1740
2187
|
style: (0, vue.normalizeStyle)(__spreadValues({ display: $setup.highlightVisible ? "block" : "none" }, $setup.highlightStyle))
|
|
1741
2188
|
}, null, 4), [[vue.vShow, $setup.highlightVisible]]),
|
|
1742
|
-
(0, vue.createCommentVNode)(" Inspector Tooltip "),
|
|
1743
2189
|
(0, vue.withDirectives)((0, vue.createElementVNode)("div", {
|
|
1744
2190
|
class: "opencode-element-tooltip",
|
|
1745
2191
|
style: (0, vue.normalizeStyle)(__spreadValues({ display: $setup.tooltipVisible ? "block" : "none" }, $setup.tooltipStyle))
|
|
1746
2192
|
}, [(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]]),
|
|
1747
|
-
(0, vue.createCommentVNode)(" Dialog "),
|
|
1748
2193
|
$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", {
|
|
1749
2194
|
class: "opencode-dialog-btn cancel",
|
|
1750
2195
|
onClick: $setup.handleDialogCancel
|
|
@@ -1752,7 +2197,6 @@ function __vue_render__(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1752
2197
|
class: "opencode-dialog-btn confirm",
|
|
1753
2198
|
onClick: $setup.handleDialogConfirm
|
|
1754
2199
|
}, "确认")])])])) : (0, vue.createCommentVNode)("v-if", true),
|
|
1755
|
-
(0, vue.createCommentVNode)(" Page-level Notification "),
|
|
1756
2200
|
((0, vue.openBlock)(), (0, vue.createBlock)(vue.Teleport, { to: "body" }, [$setup.notificationVisible && $setup.notificationMode === "page" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_9, (0, vue.toDisplayString)($setup.notificationMessage), 1)) : (0, vue.createCommentVNode)("v-if", true)]))
|
|
1757
2201
|
], 2);
|
|
1758
2202
|
}
|
|
@@ -1762,7 +2206,7 @@ __vue_sfc__.render = __vue_render__;
|
|
|
1762
2206
|
var open_code_widget_default = __vue_sfc__;
|
|
1763
2207
|
//#endregion
|
|
1764
2208
|
//#region es/index.js
|
|
1765
|
-
var version = "1.0.
|
|
2209
|
+
var version = "1.0.24";
|
|
1766
2210
|
function install(app, options) {
|
|
1767
2211
|
[open_code_widget_default].forEach((item) => {
|
|
1768
2212
|
if (item.install) app.use(item, options);
|