@vite-plugin-opencode-assistant/components 1.0.23 → 1.0.25
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 +309 -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 +562 -99
- package/lib/@vite-plugin-opencode-assistant/components.es.js +558 -95
- 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 +326 -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,396 @@ 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 getInitialState = () => {
|
|
596
|
+
if (props.offset) return {
|
|
597
|
+
x: props.offset.x,
|
|
598
|
+
y: props.offset.y,
|
|
599
|
+
width: 0,
|
|
600
|
+
height: 0
|
|
601
|
+
};
|
|
602
|
+
if (typeof window !== "undefined") return {
|
|
603
|
+
x: window.innerWidth - 42 - 24,
|
|
604
|
+
y: window.innerHeight - 42 - 24,
|
|
605
|
+
width: 0,
|
|
606
|
+
height: 0
|
|
607
|
+
};
|
|
608
|
+
return {
|
|
609
|
+
x: 0,
|
|
610
|
+
y: 0,
|
|
611
|
+
width: 0,
|
|
612
|
+
height: 0
|
|
613
|
+
};
|
|
614
|
+
};
|
|
615
|
+
const state = (0, vue.ref)(getInitialState());
|
|
616
|
+
const isObject = (val) => val !== null && typeof val === "object";
|
|
617
|
+
const gapX = (0, vue.computed)(() => isObject(props.gap) ? props.gap.x : props.gap);
|
|
618
|
+
const gapY = (0, vue.computed)(() => isObject(props.gap) ? props.gap.y : props.gap);
|
|
619
|
+
const windowWidth = (0, vue.ref)(typeof window !== "undefined" ? window.innerWidth : 0);
|
|
620
|
+
const windowHeight = (0, vue.ref)(typeof window !== "undefined" ? window.innerHeight : 0);
|
|
621
|
+
const boundary = (0, vue.computed)(() => ({
|
|
622
|
+
top: gapY.value,
|
|
623
|
+
right: windowWidth.value - state.value.width - gapX.value,
|
|
624
|
+
bottom: windowHeight.value - state.value.height - gapY.value,
|
|
625
|
+
left: gapX.value
|
|
626
|
+
}));
|
|
627
|
+
const dragging = (0, vue.ref)(false);
|
|
628
|
+
const initialized = (0, vue.ref)(false);
|
|
629
|
+
const rootStyle = (0, vue.computed)(() => {
|
|
630
|
+
const style = {};
|
|
631
|
+
style.transform = `translate3d(${`${state.value.x}px`}, ${`${state.value.y}px`}, 0)`;
|
|
632
|
+
if (dragging.value) style.transition = "none";
|
|
633
|
+
else style.transition = "transform 0.3s ease";
|
|
634
|
+
return style;
|
|
635
|
+
});
|
|
636
|
+
const show = (0, vue.ref)(true);
|
|
637
|
+
const updateState = () => {
|
|
638
|
+
if (!show.value || !rootRef.value || typeof window === "undefined") return;
|
|
639
|
+
const rect = rootRef.value.getBoundingClientRect();
|
|
640
|
+
if (rect.width === 0 || rect.height === 0) return;
|
|
641
|
+
const { offset } = props;
|
|
642
|
+
let x = offset ? offset.x : windowWidth.value - rect.width - gapX.value;
|
|
643
|
+
let y = offset ? offset.y : windowHeight.value - rect.height - gapY.value;
|
|
644
|
+
const maxX = windowWidth.value - rect.width - gapX.value;
|
|
645
|
+
const maxY = windowHeight.value - rect.height - gapY.value;
|
|
646
|
+
if (x < gapX.value) x = gapX.value;
|
|
647
|
+
if (x > maxX) x = maxX;
|
|
648
|
+
if (y < gapY.value) y = gapY.value;
|
|
649
|
+
if (y > maxY) y = maxY;
|
|
650
|
+
state.value = {
|
|
651
|
+
x,
|
|
652
|
+
y,
|
|
653
|
+
width: rect.width,
|
|
654
|
+
height: rect.height
|
|
655
|
+
};
|
|
656
|
+
};
|
|
657
|
+
const touch = {
|
|
658
|
+
startX: (0, vue.ref)(0),
|
|
659
|
+
startY: (0, vue.ref)(0),
|
|
660
|
+
deltaX: (0, vue.ref)(0),
|
|
661
|
+
deltaY: (0, vue.ref)(0),
|
|
662
|
+
offsetX: (0, vue.ref)(0),
|
|
663
|
+
offsetY: (0, vue.ref)(0),
|
|
664
|
+
isTap: (0, vue.ref)(true),
|
|
665
|
+
start(e) {
|
|
666
|
+
this.startX.value = "touches" in e ? e.touches[0].clientX : e.clientX;
|
|
667
|
+
this.startY.value = "touches" in e ? e.touches[0].clientY : e.clientY;
|
|
668
|
+
this.deltaX.value = 0;
|
|
669
|
+
this.deltaY.value = 0;
|
|
670
|
+
this.offsetX.value = 0;
|
|
671
|
+
this.offsetY.value = 0;
|
|
672
|
+
this.isTap.value = true;
|
|
673
|
+
},
|
|
674
|
+
move(e) {
|
|
675
|
+
const clientX = "touches" in e ? e.touches[0].clientX : e.clientX;
|
|
676
|
+
const clientY = "touches" in e ? e.touches[0].clientY : e.clientY;
|
|
677
|
+
this.deltaX.value = clientX - this.startX.value;
|
|
678
|
+
this.deltaY.value = clientY - this.startY.value;
|
|
679
|
+
this.offsetX.value = Math.abs(this.deltaX.value);
|
|
680
|
+
this.offsetY.value = Math.abs(this.deltaY.value);
|
|
681
|
+
const TAP_OFFSET = 5;
|
|
682
|
+
if (this.isTap.value && (this.offsetX.value > TAP_OFFSET || this.offsetY.value > TAP_OFFSET)) this.isTap.value = false;
|
|
683
|
+
}
|
|
684
|
+
};
|
|
685
|
+
let prevX = 0;
|
|
686
|
+
let prevY = 0;
|
|
687
|
+
const onTouchStart = (e) => {
|
|
688
|
+
touch.start(e);
|
|
689
|
+
dragging.value = true;
|
|
690
|
+
prevX = state.value.x;
|
|
691
|
+
prevY = state.value.y;
|
|
692
|
+
if (!("touches" in e)) {
|
|
693
|
+
window.addEventListener("mousemove", onTouchMove, { passive: false });
|
|
694
|
+
window.addEventListener("mouseup", onTouchEnd);
|
|
695
|
+
}
|
|
696
|
+
};
|
|
697
|
+
const onTouchMove = (e) => {
|
|
698
|
+
if (e.cancelable) e.preventDefault();
|
|
699
|
+
const wasTap = touch.isTap.value;
|
|
700
|
+
touch.move(e);
|
|
701
|
+
if (wasTap && !touch.isTap.value) emit("drag-start");
|
|
702
|
+
if (props.axis === "lock") return;
|
|
703
|
+
if (!touch.isTap.value) {
|
|
704
|
+
if (props.axis === "x" || props.axis === "xy") {
|
|
705
|
+
let nextX = prevX + touch.deltaX.value;
|
|
706
|
+
if (nextX < boundary.value.left) nextX = boundary.value.left;
|
|
707
|
+
if (nextX > boundary.value.right) nextX = boundary.value.right;
|
|
708
|
+
state.value.x = nextX;
|
|
709
|
+
}
|
|
710
|
+
if (props.axis === "y" || props.axis === "xy") {
|
|
711
|
+
let nextY = prevY + touch.deltaY.value;
|
|
712
|
+
if (nextY < boundary.value.top) nextY = boundary.value.top;
|
|
713
|
+
if (nextY > boundary.value.bottom) nextY = boundary.value.bottom;
|
|
714
|
+
state.value.y = nextY;
|
|
715
|
+
}
|
|
716
|
+
emit("update:offset", {
|
|
717
|
+
x: state.value.x,
|
|
718
|
+
y: state.value.y
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
};
|
|
722
|
+
const closest = (arr, target) => {
|
|
723
|
+
return arr.reduce((pre, cur) => Math.abs(pre - target) < Math.abs(cur - target) ? pre : cur);
|
|
724
|
+
};
|
|
725
|
+
const onTouchEnd = (e) => {
|
|
726
|
+
dragging.value = false;
|
|
727
|
+
if (e && !("touches" in e) && e.type === "mouseup") {
|
|
728
|
+
window.removeEventListener("mousemove", onTouchMove);
|
|
729
|
+
window.removeEventListener("mouseup", onTouchEnd);
|
|
730
|
+
}
|
|
731
|
+
requestAnimationFrame(() => {
|
|
732
|
+
if (props.magnetic === "x") {
|
|
733
|
+
const nextX = closest([boundary.value.left, boundary.value.right], state.value.x);
|
|
734
|
+
state.value.x = nextX;
|
|
735
|
+
}
|
|
736
|
+
if (props.magnetic === "y") {
|
|
737
|
+
const nextY = closest([boundary.value.top, boundary.value.bottom], state.value.y);
|
|
738
|
+
state.value.y = nextY;
|
|
739
|
+
}
|
|
740
|
+
if (!touch.isTap.value) {
|
|
741
|
+
emit("drag-end");
|
|
742
|
+
const offset = {
|
|
743
|
+
x: state.value.x,
|
|
744
|
+
y: state.value.y
|
|
745
|
+
};
|
|
746
|
+
emit("update:offset", offset);
|
|
747
|
+
if (prevX !== offset.x || prevY !== offset.y) emit("offset-change", offset);
|
|
748
|
+
}
|
|
749
|
+
});
|
|
750
|
+
};
|
|
751
|
+
const onClick = (e) => {
|
|
752
|
+
if (touch.isTap.value) emit("click", e);
|
|
753
|
+
else e.stopPropagation();
|
|
754
|
+
};
|
|
755
|
+
const handleResize = () => {
|
|
756
|
+
if (typeof window !== "undefined") {
|
|
757
|
+
windowWidth.value = window.innerWidth;
|
|
758
|
+
windowHeight.value = window.innerHeight;
|
|
759
|
+
}
|
|
760
|
+
};
|
|
761
|
+
(0, vue.onMounted)(() => {
|
|
762
|
+
requestAnimationFrame(() => {
|
|
763
|
+
updateState();
|
|
764
|
+
requestAnimationFrame(() => {
|
|
765
|
+
initialized.value = true;
|
|
766
|
+
});
|
|
767
|
+
});
|
|
768
|
+
if (typeof window !== "undefined") window.addEventListener("resize", handleResize);
|
|
769
|
+
if (rootRef.value) rootRef.value.addEventListener("touchmove", onTouchMove, { passive: false });
|
|
770
|
+
});
|
|
771
|
+
(0, vue.onUnmounted)(() => {
|
|
772
|
+
if (typeof window !== "undefined") {
|
|
773
|
+
window.removeEventListener("resize", handleResize);
|
|
774
|
+
window.removeEventListener("mousemove", onTouchMove);
|
|
775
|
+
window.removeEventListener("mouseup", onTouchEnd);
|
|
776
|
+
}
|
|
777
|
+
if (rootRef.value) rootRef.value.removeEventListener("touchmove", onTouchMove);
|
|
778
|
+
});
|
|
779
|
+
(0, vue.watch)([
|
|
780
|
+
windowWidth,
|
|
781
|
+
windowHeight,
|
|
782
|
+
gapX,
|
|
783
|
+
gapY,
|
|
784
|
+
() => props.offset
|
|
785
|
+
], updateState, { deep: true });
|
|
786
|
+
const isOnRightSide = (0, vue.computed)(() => {
|
|
787
|
+
return state.value.x > windowWidth.value / 2;
|
|
788
|
+
});
|
|
789
|
+
__expose({
|
|
790
|
+
isOnRightSide,
|
|
791
|
+
offset: (0, vue.computed)(() => ({
|
|
792
|
+
x: state.value.x,
|
|
793
|
+
y: state.value.y
|
|
794
|
+
}))
|
|
795
|
+
});
|
|
796
|
+
const __returned__ = {
|
|
797
|
+
props,
|
|
798
|
+
emit,
|
|
799
|
+
rootRef,
|
|
800
|
+
getInitialState,
|
|
801
|
+
state,
|
|
802
|
+
isObject,
|
|
803
|
+
gapX,
|
|
804
|
+
gapY,
|
|
805
|
+
windowWidth,
|
|
806
|
+
windowHeight,
|
|
807
|
+
boundary,
|
|
808
|
+
dragging,
|
|
809
|
+
initialized,
|
|
810
|
+
rootStyle,
|
|
811
|
+
show,
|
|
812
|
+
updateState,
|
|
813
|
+
touch,
|
|
814
|
+
get prevX() {
|
|
815
|
+
return prevX;
|
|
816
|
+
},
|
|
817
|
+
set prevX(v) {
|
|
818
|
+
prevX = v;
|
|
819
|
+
},
|
|
820
|
+
get prevY() {
|
|
821
|
+
return prevY;
|
|
822
|
+
},
|
|
823
|
+
set prevY(v) {
|
|
824
|
+
prevY = v;
|
|
825
|
+
},
|
|
826
|
+
onTouchStart,
|
|
827
|
+
onTouchMove,
|
|
828
|
+
closest,
|
|
829
|
+
onTouchEnd,
|
|
830
|
+
onClick,
|
|
831
|
+
handleResize,
|
|
832
|
+
isOnRightSide
|
|
833
|
+
};
|
|
834
|
+
Object.defineProperty(__returned__, "__isScriptSetup", {
|
|
835
|
+
enumerable: false,
|
|
836
|
+
value: true
|
|
837
|
+
});
|
|
838
|
+
return __returned__;
|
|
839
|
+
}
|
|
840
|
+
}));
|
|
841
|
+
function __vue_render__$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
842
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(vue.Teleport, { to: $props.teleport }, [(0, vue.withDirectives)((0, vue.createElementVNode)("div", {
|
|
843
|
+
ref: "rootRef",
|
|
844
|
+
class: "floating-bubble",
|
|
845
|
+
style: (0, vue.normalizeStyle)($setup.rootStyle),
|
|
846
|
+
onTouchstartPassive: $setup.onTouchStart,
|
|
847
|
+
onTouchend: $setup.onTouchEnd,
|
|
848
|
+
onTouchcancel: $setup.onTouchEnd,
|
|
849
|
+
onMousedown: $setup.onTouchStart,
|
|
850
|
+
onClickCapture: $setup.onClick
|
|
851
|
+
}, [(0, vue.renderSlot)(_ctx.$slots, "default")], 36), [[vue.vShow, $setup.show && $setup.initialized]])], 8, ["to"]);
|
|
852
|
+
}
|
|
531
853
|
__vue_sfc__$2.render = __vue_render__$2;
|
|
532
|
-
var
|
|
854
|
+
var FloatingBubble_vue_default = __vue_sfc__$2;
|
|
533
855
|
//#endregion
|
|
534
856
|
//#region es/open-code-widget/src/components/Trigger.vue.js
|
|
857
|
+
var STORAGE_KEY = "opencode-bubble-offset";
|
|
535
858
|
var __vue_sfc__$1 = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
536
859
|
__name: "Trigger",
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
860
|
+
emits: [
|
|
861
|
+
"offset-change",
|
|
862
|
+
"drag-start",
|
|
863
|
+
"drag-end"
|
|
864
|
+
],
|
|
865
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
866
|
+
const { buttonActive: active, open, hotkeyLabel, thinking, resolvedTheme, handleToggle } = useOpenCodeWidgetContext();
|
|
867
|
+
const loadOffset = () => {
|
|
868
|
+
try {
|
|
869
|
+
const saved = localStorage.getItem(STORAGE_KEY);
|
|
870
|
+
if (saved) {
|
|
871
|
+
const parsed = JSON.parse(saved);
|
|
872
|
+
if (parsed && (parsed.x !== 0 || parsed.y !== 0)) return parsed;
|
|
873
|
+
}
|
|
874
|
+
} catch (e) {}
|
|
875
|
+
return {
|
|
876
|
+
x: 0,
|
|
877
|
+
y: 0
|
|
878
|
+
};
|
|
879
|
+
};
|
|
880
|
+
const offset = (0, vue.ref)(loadOffset());
|
|
881
|
+
const emit = __emit;
|
|
882
|
+
const saveOffset = (value) => {
|
|
883
|
+
try {
|
|
884
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify(value));
|
|
885
|
+
} catch (e) {}
|
|
886
|
+
};
|
|
887
|
+
const handleOffsetChange = (value) => {
|
|
888
|
+
offset.value = value;
|
|
889
|
+
saveOffset(value);
|
|
890
|
+
emit("offset-change", value);
|
|
891
|
+
};
|
|
892
|
+
const bubbleRef = (0, vue.ref)(null);
|
|
893
|
+
const isOnRightSide = (0, vue.computed)(() => {
|
|
894
|
+
if (typeof window === "undefined") return true;
|
|
895
|
+
const centerX = window.innerWidth / 2;
|
|
896
|
+
return offset.value.x > centerX;
|
|
897
|
+
});
|
|
898
|
+
(0, vue.onMounted)(() => {
|
|
899
|
+
if (offset.value.x !== 0 || offset.value.y !== 0) emit("offset-change", offset.value);
|
|
900
|
+
});
|
|
901
|
+
__expose({
|
|
902
|
+
isOnRightSide,
|
|
903
|
+
offset
|
|
904
|
+
});
|
|
540
905
|
const __returned__ = {
|
|
541
906
|
active,
|
|
542
907
|
open,
|
|
543
908
|
hotkeyLabel,
|
|
544
909
|
thinking,
|
|
545
|
-
|
|
910
|
+
resolvedTheme,
|
|
911
|
+
handleToggle,
|
|
912
|
+
STORAGE_KEY,
|
|
913
|
+
loadOffset,
|
|
914
|
+
offset,
|
|
915
|
+
emit,
|
|
916
|
+
saveOffset,
|
|
917
|
+
handleOffsetChange,
|
|
918
|
+
bubbleRef,
|
|
919
|
+
isOnRightSide,
|
|
920
|
+
FloatingBubble: FloatingBubble_vue_default
|
|
546
921
|
};
|
|
547
922
|
Object.defineProperty(__returned__, "__isScriptSetup", {
|
|
548
923
|
enumerable: false,
|
|
@@ -553,43 +928,70 @@ var __vue_sfc__$1 = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
553
928
|
});
|
|
554
929
|
var _hoisted_1$1 = ["aria-expanded", "title"];
|
|
555
930
|
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
|
-
|
|
931
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)($setup["FloatingBubble"], {
|
|
932
|
+
ref: "bubbleRef",
|
|
933
|
+
offset: $setup.offset,
|
|
934
|
+
"onUpdate:offset": _cache[0] || (_cache[0] = ($event) => $setup.offset = $event),
|
|
935
|
+
axis: "xy",
|
|
936
|
+
magnetic: "x",
|
|
937
|
+
gap: 24,
|
|
938
|
+
onClick: $setup.handleToggle,
|
|
939
|
+
onOffsetChange: $setup.handleOffsetChange,
|
|
940
|
+
onDragStart: _cache[1] || (_cache[1] = ($event) => $setup.emit("drag-start")),
|
|
941
|
+
onDragEnd: _cache[2] || (_cache[2] = ($event) => $setup.emit("drag-end"))
|
|
942
|
+
}, {
|
|
943
|
+
default: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("button", {
|
|
944
|
+
class: (0, vue.normalizeClass)(["opencode-button", {
|
|
945
|
+
active: $setup.active,
|
|
946
|
+
thinking: $setup.thinking,
|
|
947
|
+
"opencode-theme-dark": $setup.resolvedTheme === "dark"
|
|
948
|
+
}]),
|
|
949
|
+
type: "button",
|
|
950
|
+
"aria-expanded": $setup.open,
|
|
951
|
+
"aria-label": "打开 AI 助手",
|
|
952
|
+
title: `AI \u52A9\u624B (${$setup.hotkeyLabel})`
|
|
953
|
+
}, [(0, vue.renderSlot)(_ctx.$slots, "default", {}, () => [_cache[3] || (_cache[3] = (0, vue.createElementVNode)("svg", {
|
|
954
|
+
t: "1775402599580",
|
|
955
|
+
class: "icon",
|
|
956
|
+
viewBox: "0 0 1024 1024",
|
|
957
|
+
version: "1.1",
|
|
958
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
959
|
+
"p-id": "5390",
|
|
960
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
961
|
+
width: "100%",
|
|
962
|
+
height: "100%"
|
|
963
|
+
}, [
|
|
964
|
+
(0, vue.createElementVNode)("defs", null, [(0, vue.createElementVNode)("linearGradient", {
|
|
965
|
+
id: "opencode-logo-gradient",
|
|
966
|
+
x1: "0%",
|
|
967
|
+
y1: "0%",
|
|
968
|
+
x2: "100%",
|
|
969
|
+
y2: "100%"
|
|
970
|
+
}, [(0, vue.createElementVNode)("stop", {
|
|
971
|
+
offset: "0%",
|
|
972
|
+
style: { "stop-color": "#667eea" }
|
|
973
|
+
}), (0, vue.createElementVNode)("stop", {
|
|
974
|
+
offset: "100%",
|
|
975
|
+
style: { "stop-color": "#764ba2" }
|
|
976
|
+
})])]),
|
|
977
|
+
(0, vue.createElementVNode)("path", {
|
|
978
|
+
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",
|
|
979
|
+
fill: "url(#opencode-logo-gradient)",
|
|
980
|
+
"p-id": "5391"
|
|
981
|
+
}),
|
|
982
|
+
(0, vue.createElementVNode)("path", {
|
|
983
|
+
d: "M384 448m-64 0a64 64 0 1 0 128 0 64 64 0 1 0 -128 0Z",
|
|
984
|
+
fill: "url(#opencode-logo-gradient)",
|
|
985
|
+
"p-id": "5392"
|
|
986
|
+
}),
|
|
987
|
+
(0, vue.createElementVNode)("path", {
|
|
988
|
+
d: "M640 448m-64 0a64 64 0 1 0 128 0 64 64 0 1 0 -128 0Z",
|
|
989
|
+
fill: "url(#opencode-logo-gradient)",
|
|
990
|
+
"p-id": "5393"
|
|
991
|
+
})
|
|
992
|
+
], -1))])], 10, _hoisted_1$1)]),
|
|
993
|
+
_: 3
|
|
994
|
+
}, 8, ["offset", "onClick"]);
|
|
593
995
|
}
|
|
594
996
|
__vue_sfc__$1.render = __vue_render__$1;
|
|
595
997
|
var Trigger_vue_default = __vue_sfc__$1;
|
|
@@ -802,11 +1204,7 @@ function useWidget(options) {
|
|
|
802
1204
|
if (options.theme.value === "auto") return systemTheme.value;
|
|
803
1205
|
return options.theme.value;
|
|
804
1206
|
});
|
|
805
|
-
const containerClasses = (0, vue.computed)(() => [
|
|
806
|
-
"opencode-widget",
|
|
807
|
-
options.position.value,
|
|
808
|
-
`opencode-theme-${resolvedTheme.value}`
|
|
809
|
-
]);
|
|
1207
|
+
const containerClasses = (0, vue.computed)(() => ["opencode-widget", `opencode-theme-${resolvedTheme.value}`]);
|
|
810
1208
|
const buttonActive = (0, vue.computed)(() => !!(options.open.value || options.selectMode.value));
|
|
811
1209
|
const iframeSource = (0, vue.computed)(() => options.iframeSrc.value || "about:blank");
|
|
812
1210
|
const sessionListTitle = (0, vue.computed)(() => options.sessionListCollapsed.value ? "展开会话列表" : "折叠会话列表");
|
|
@@ -1255,11 +1653,6 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
1255
1653
|
var __vue_sfc__ = /* @__PURE__ */ (0, vue.defineComponent)(__spreadProps(__spreadValues({}, { name: "OpencodeWidget" }), {
|
|
1256
1654
|
__name: "index",
|
|
1257
1655
|
props: {
|
|
1258
|
-
position: {
|
|
1259
|
-
type: String,
|
|
1260
|
-
required: false,
|
|
1261
|
-
default: "bottom-right"
|
|
1262
|
-
},
|
|
1263
1656
|
open: {
|
|
1264
1657
|
type: Boolean,
|
|
1265
1658
|
required: false,
|
|
@@ -1430,6 +1823,7 @@ var __vue_sfc__ = /* @__PURE__ */ (0, vue.defineComponent)(__spreadProps(__sprea
|
|
|
1430
1823
|
if (dialogResolve) dialogResolve(false);
|
|
1431
1824
|
};
|
|
1432
1825
|
const frameRef = (0, vue.ref)(null);
|
|
1826
|
+
const triggerRef = (0, vue.ref)(null);
|
|
1433
1827
|
const sendMessageToIframe = (type, data) => {
|
|
1434
1828
|
var _a;
|
|
1435
1829
|
(_a = frameRef.value) == null || _a.sendMessageToIframe(type, data);
|
|
@@ -1449,7 +1843,6 @@ var __vue_sfc__ = /* @__PURE__ */ (0, vue.defineComponent)(__spreadProps(__sprea
|
|
|
1449
1843
|
localSessionListCollapsed.value = val;
|
|
1450
1844
|
});
|
|
1451
1845
|
const { buttonActive, containerClasses, iframeSource, sessionListTitle, resolvedTheme, handleClose, handleEmptyAction, handleToggle, handleToggleSessionList, handleToggleTheme } = useWidget({
|
|
1452
|
-
position: (0, vue.toRef)(props, "position"),
|
|
1453
1846
|
theme: (0, vue.toRef)(props, "theme"),
|
|
1454
1847
|
open: (0, vue.toRef)(props, "open"),
|
|
1455
1848
|
selectMode: (0, vue.toRef)(props, "selectMode"),
|
|
@@ -1530,6 +1923,59 @@ var __vue_sfc__ = /* @__PURE__ */ (0, vue.defineComponent)(__spreadProps(__sprea
|
|
|
1530
1923
|
promptDockVisible.value = !promptDockVisible.value;
|
|
1531
1924
|
sendMessageToIframe("prompt-dock-visibility-change", { visible: promptDockVisible.value });
|
|
1532
1925
|
};
|
|
1926
|
+
const bubbleOffset = (0, vue.ref)({
|
|
1927
|
+
x: 0,
|
|
1928
|
+
y: 0
|
|
1929
|
+
});
|
|
1930
|
+
const isBubbleOnRightSide = (0, vue.computed)(() => {
|
|
1931
|
+
if (typeof window === "undefined") return true;
|
|
1932
|
+
const centerX = window.innerWidth / 2;
|
|
1933
|
+
return bubbleOffset.value.x > centerX;
|
|
1934
|
+
});
|
|
1935
|
+
const chatPositionStyle = (0, vue.computed)(() => {
|
|
1936
|
+
if (typeof window === "undefined") return {};
|
|
1937
|
+
const windowWidth = window.innerWidth;
|
|
1938
|
+
const windowHeight = window.innerHeight;
|
|
1939
|
+
const chatWidth = minimized.value ? 300 : 700;
|
|
1940
|
+
const chatHeight = minimized.value ? 300 : Math.min(windowHeight * .86, windowHeight - 40);
|
|
1941
|
+
const gap = 24;
|
|
1942
|
+
const bubbleSize = 44;
|
|
1943
|
+
const screenMargin = 20;
|
|
1944
|
+
const style = {};
|
|
1945
|
+
if (isBubbleOnRightSide.value) {
|
|
1946
|
+
let rightPos = windowWidth - bubbleOffset.value.x + gap;
|
|
1947
|
+
const maxRight = windowWidth - chatWidth - screenMargin;
|
|
1948
|
+
if (rightPos > maxRight) rightPos = maxRight;
|
|
1949
|
+
style.right = `${rightPos}px`;
|
|
1950
|
+
style.left = "auto";
|
|
1951
|
+
} else {
|
|
1952
|
+
let leftPos = bubbleOffset.value.x + bubbleSize + gap;
|
|
1953
|
+
const maxLeft = windowWidth - chatWidth - screenMargin;
|
|
1954
|
+
if (leftPos > maxLeft) leftPos = maxLeft;
|
|
1955
|
+
style.left = `${leftPos}px`;
|
|
1956
|
+
style.right = "auto";
|
|
1957
|
+
}
|
|
1958
|
+
let bottomPos = windowHeight - bubbleOffset.value.y - bubbleSize;
|
|
1959
|
+
const maxBottom = windowHeight - chatHeight - screenMargin;
|
|
1960
|
+
if (bottomPos > maxBottom) bottomPos = maxBottom;
|
|
1961
|
+
if (bottomPos < screenMargin) bottomPos = screenMargin;
|
|
1962
|
+
style.bottom = `${bottomPos}px`;
|
|
1963
|
+
return style;
|
|
1964
|
+
});
|
|
1965
|
+
const handleBubbleOffsetChange = (offset) => {
|
|
1966
|
+
bubbleOffset.value = offset;
|
|
1967
|
+
};
|
|
1968
|
+
const isDragging = (0, vue.ref)(false);
|
|
1969
|
+
let wasOpenBeforeDrag = false;
|
|
1970
|
+
const handleDragStart = () => {
|
|
1971
|
+
isDragging.value = true;
|
|
1972
|
+
wasOpenBeforeDrag = props.open;
|
|
1973
|
+
if (props.open) emit("update:open", false);
|
|
1974
|
+
};
|
|
1975
|
+
const handleDragEnd = () => {
|
|
1976
|
+
isDragging.value = false;
|
|
1977
|
+
if (wasOpenBeforeDrag) emit("update:open", true);
|
|
1978
|
+
};
|
|
1533
1979
|
provideOpenCodeWidgetContext({
|
|
1534
1980
|
theme: (0, vue.toRef)(props, "theme"),
|
|
1535
1981
|
resolvedTheme,
|
|
@@ -1601,6 +2047,7 @@ var __vue_sfc__ = /* @__PURE__ */ (0, vue.defineComponent)(__spreadProps(__sprea
|
|
|
1601
2047
|
handleDialogConfirm,
|
|
1602
2048
|
handleDialogCancel,
|
|
1603
2049
|
frameRef,
|
|
2050
|
+
triggerRef,
|
|
1604
2051
|
sendMessageToIframe,
|
|
1605
2052
|
handleFrameLoaded,
|
|
1606
2053
|
localSessionListCollapsed,
|
|
@@ -1634,6 +2081,19 @@ var __vue_sfc__ = /* @__PURE__ */ (0, vue.defineComponent)(__spreadProps(__sprea
|
|
|
1634
2081
|
tooltipContent,
|
|
1635
2082
|
handleToggleMinimize,
|
|
1636
2083
|
handleTogglePromptDock,
|
|
2084
|
+
bubbleOffset,
|
|
2085
|
+
isBubbleOnRightSide,
|
|
2086
|
+
chatPositionStyle,
|
|
2087
|
+
handleBubbleOffsetChange,
|
|
2088
|
+
isDragging,
|
|
2089
|
+
get wasOpenBeforeDrag() {
|
|
2090
|
+
return wasOpenBeforeDrag;
|
|
2091
|
+
},
|
|
2092
|
+
set wasOpenBeforeDrag(v) {
|
|
2093
|
+
wasOpenBeforeDrag = v;
|
|
2094
|
+
},
|
|
2095
|
+
handleDragStart,
|
|
2096
|
+
handleDragEnd,
|
|
1637
2097
|
Frame: Frame_vue_default,
|
|
1638
2098
|
Header: Header_vue_default,
|
|
1639
2099
|
SelectHint: SelectHint_vue_default,
|
|
@@ -1674,16 +2134,24 @@ var _hoisted_9 = {
|
|
|
1674
2134
|
};
|
|
1675
2135
|
function __vue_render__(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1676
2136
|
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", { class: (0, vue.normalizeClass)($setup.containerClasses) }, [
|
|
1677
|
-
(0, vue.createVNode)($setup["Trigger"],
|
|
2137
|
+
(0, vue.createVNode)($setup["Trigger"], {
|
|
2138
|
+
ref: "triggerRef",
|
|
2139
|
+
onOffsetChange: $setup.handleBubbleOffsetChange,
|
|
2140
|
+
onDragStart: $setup.handleDragStart,
|
|
2141
|
+
onDragEnd: $setup.handleDragEnd
|
|
2142
|
+
}, (0, vue.createSlots)({ _: 2 }, [$setup.slots["button-icon"] ? {
|
|
1678
2143
|
name: "default",
|
|
1679
2144
|
fn: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "button-icon")]),
|
|
1680
2145
|
key: "0"
|
|
1681
|
-
} : void 0]),
|
|
1682
|
-
(0, vue.
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
2146
|
+
} : void 0]), 1536),
|
|
2147
|
+
(0, vue.withDirectives)((0, vue.createElementVNode)("div", {
|
|
2148
|
+
class: (0, vue.normalizeClass)(["opencode-chat", {
|
|
2149
|
+
open: $props.open,
|
|
2150
|
+
minimized: $setup.minimized,
|
|
2151
|
+
dragging: $setup.isDragging
|
|
2152
|
+
}]),
|
|
2153
|
+
style: (0, vue.normalizeStyle)($setup.chatPositionStyle)
|
|
2154
|
+
}, [
|
|
1687
2155
|
(0, vue.createVNode)($setup["Header"], null, (0, vue.createSlots)({ _: 2 }, [
|
|
1688
2156
|
$setup.slots["session-toggle-icon"] ? {
|
|
1689
2157
|
name: "session-toggle-icon",
|
|
@@ -1701,7 +2169,6 @@ function __vue_render__(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1701
2169
|
key: "2"
|
|
1702
2170
|
} : void 0
|
|
1703
2171
|
]), 1024),
|
|
1704
|
-
(0, vue.createCommentVNode)(" Notification "),
|
|
1705
2172
|
$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
2173
|
(0, vue.createElementVNode)("div", _hoisted_2, [
|
|
1707
2174
|
(0, vue.createVNode)($setup["SessionList"], null, {
|
|
@@ -1732,19 +2199,16 @@ function __vue_render__(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1732
2199
|
]), 1536),
|
|
1733
2200
|
(0, vue.createVNode)($setup["SelectedNodes"])
|
|
1734
2201
|
])
|
|
1735
|
-
],
|
|
2202
|
+
], 6), [[vue.vShow, !$props.selectMode]]),
|
|
1736
2203
|
(0, vue.createVNode)($setup["SelectHint"]),
|
|
1737
|
-
(0, vue.createCommentVNode)(" Inspector Highlight "),
|
|
1738
2204
|
(0, vue.withDirectives)((0, vue.createElementVNode)("div", {
|
|
1739
2205
|
class: "opencode-element-highlight",
|
|
1740
2206
|
style: (0, vue.normalizeStyle)(__spreadValues({ display: $setup.highlightVisible ? "block" : "none" }, $setup.highlightStyle))
|
|
1741
2207
|
}, null, 4), [[vue.vShow, $setup.highlightVisible]]),
|
|
1742
|
-
(0, vue.createCommentVNode)(" Inspector Tooltip "),
|
|
1743
2208
|
(0, vue.withDirectives)((0, vue.createElementVNode)("div", {
|
|
1744
2209
|
class: "opencode-element-tooltip",
|
|
1745
2210
|
style: (0, vue.normalizeStyle)(__spreadValues({ display: $setup.tooltipVisible ? "block" : "none" }, $setup.tooltipStyle))
|
|
1746
2211
|
}, [(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
2212
|
$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
2213
|
class: "opencode-dialog-btn cancel",
|
|
1750
2214
|
onClick: $setup.handleDialogCancel
|
|
@@ -1752,7 +2216,6 @@ function __vue_render__(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1752
2216
|
class: "opencode-dialog-btn confirm",
|
|
1753
2217
|
onClick: $setup.handleDialogConfirm
|
|
1754
2218
|
}, "确认")])])])) : (0, vue.createCommentVNode)("v-if", true),
|
|
1755
|
-
(0, vue.createCommentVNode)(" Page-level Notification "),
|
|
1756
2219
|
((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
2220
|
], 2);
|
|
1758
2221
|
}
|
|
@@ -1762,7 +2225,7 @@ __vue_sfc__.render = __vue_render__;
|
|
|
1762
2225
|
var open_code_widget_default = __vue_sfc__;
|
|
1763
2226
|
//#endregion
|
|
1764
2227
|
//#region es/index.js
|
|
1765
|
-
var version = "1.0.
|
|
2228
|
+
var version = "1.0.25";
|
|
1766
2229
|
function install(app, options) {
|
|
1767
2230
|
[open_code_widget_default].forEach((item) => {
|
|
1768
2231
|
if (item.install) app.use(item, options);
|