@vite-plugin-opencode-assistant/components 1.0.12 → 1.0.13

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  import OpenCodeWidget from './open-code-widget';
2
2
  import type { App } from 'vue';
3
- declare const version = "1.0.12";
3
+ declare const version = "1.0.13";
4
4
  declare function install(app: App<any>, options?: any): void;
5
5
  export { install, version, OpenCodeWidget };
6
6
  export default install;
package/es/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import OpenCodeWidget from "./open-code-widget";
2
- const version = "1.0.12";
2
+ const version = "1.0.13";
3
3
  function install(app, options) {
4
4
  const components = [
5
5
  OpenCodeWidget
@@ -32,6 +32,32 @@ function getElementDescription(element) {
32
32
  if (href && href !== "#") parts.push(`[href]`);
33
33
  return parts.join("");
34
34
  }
35
+ function getPreciseElementAtPoint(x, y, boundary) {
36
+ var _a, _b;
37
+ const highlight = document.querySelector(".opencode-element-highlight");
38
+ const tooltip = document.querySelector(".opencode-element-tooltip");
39
+ const highlightDisplay = ((_a = highlight == null ? void 0 : highlight.getAttribute("style")) == null ? void 0 : _a.includes("display: block")) ? "block" : "none";
40
+ const tooltipDisplay = ((_b = tooltip == null ? void 0 : tooltip.getAttribute("style")) == null ? void 0 : _b.includes("display: block")) ? "block" : "none";
41
+ if (highlight) highlight.style.display = "none";
42
+ if (tooltip) tooltip.style.display = "none";
43
+ let element = null;
44
+ try {
45
+ const elements = document.elementsFromPoint(x, y);
46
+ for (const el of elements) {
47
+ if (el.closest("#vue-inspector-container")) continue;
48
+ if (el.closest(".opencode-widget")) continue;
49
+ if (el.hasAttribute("data-v-inspector-ignore")) continue;
50
+ if (boundary.contains(el) || el === boundary) {
51
+ element = el;
52
+ break;
53
+ }
54
+ }
55
+ } finally {
56
+ if (highlight) highlight.style.display = highlightDisplay;
57
+ if (tooltip) tooltip.style.display = tooltipDisplay;
58
+ }
59
+ return element;
60
+ }
35
61
  function useInspector(options) {
36
62
  const highlightVisible = ref(false);
37
63
  const highlightStyle = ref({
@@ -51,7 +77,9 @@ function useInspector(options) {
51
77
  if (!inspector) return;
52
78
  const { targetNode, params } = inspector.getTargetNode(e);
53
79
  if (targetNode && params) {
54
- const rect = targetNode.getBoundingClientRect();
80
+ const preciseElement = getPreciseElementAtPoint(e.clientX, e.clientY, targetNode);
81
+ const elementToHighlight = preciseElement || targetNode;
82
+ const rect = elementToHighlight.getBoundingClientRect();
55
83
  const widget = document.querySelector(".opencode-widget");
56
84
  let primary = "#3b82f6";
57
85
  let primaryBg = "rgba(59, 130, 246, 0.1)";
@@ -69,7 +97,7 @@ function useInspector(options) {
69
97
  border: `2px solid ${primary}`,
70
98
  background: primaryBg
71
99
  };
72
- const description = getElementDescription(targetNode);
100
+ const description = getElementDescription(elementToHighlight);
73
101
  const fileName = params.file ? params.file.split("/").pop() : "";
74
102
  let lineInfo = "";
75
103
  if (params.line) {
@@ -111,8 +139,10 @@ function useInspector(options) {
111
139
  if (options.selectMode.value) {
112
140
  const { targetNode, params } = inspector.getTargetNode(e);
113
141
  if (targetNode && params) {
114
- const innerText = getDirectText(targetNode);
115
- const description = getElementDescription(targetNode);
142
+ const preciseElement = getPreciseElementAtPoint(e.clientX, e.clientY, targetNode);
143
+ const elementToSelect = preciseElement || targetNode;
144
+ const innerText = getDirectText(elementToSelect);
145
+ const description = getElementDescription(elementToSelect);
116
146
  const elementInfo = {
117
147
  filePath: (_a = params.file) != null ? _a : null,
118
148
  line: (_b = params.line) != null ? _b : null,
@@ -867,6 +867,32 @@ function getElementDescription(element) {
867
867
  if (href && href !== "#") parts.push(`[href]`);
868
868
  return parts.join("");
869
869
  }
870
+ function getPreciseElementAtPoint(x, y, boundary) {
871
+ var _a, _b;
872
+ const highlight = document.querySelector(".opencode-element-highlight");
873
+ const tooltip = document.querySelector(".opencode-element-tooltip");
874
+ const highlightDisplay = ((_a = highlight == null ? void 0 : highlight.getAttribute("style")) == null ? void 0 : _a.includes("display: block")) ? "block" : "none";
875
+ const tooltipDisplay = ((_b = tooltip == null ? void 0 : tooltip.getAttribute("style")) == null ? void 0 : _b.includes("display: block")) ? "block" : "none";
876
+ if (highlight) highlight.style.display = "none";
877
+ if (tooltip) tooltip.style.display = "none";
878
+ let element = null;
879
+ try {
880
+ const elements = document.elementsFromPoint(x, y);
881
+ for (const el of elements) {
882
+ if (el.closest("#vue-inspector-container")) continue;
883
+ if (el.closest(".opencode-widget")) continue;
884
+ if (el.hasAttribute("data-v-inspector-ignore")) continue;
885
+ if (boundary.contains(el) || el === boundary) {
886
+ element = el;
887
+ break;
888
+ }
889
+ }
890
+ } finally {
891
+ if (highlight) highlight.style.display = highlightDisplay;
892
+ if (tooltip) tooltip.style.display = tooltipDisplay;
893
+ }
894
+ return element;
895
+ }
870
896
  function useInspector(options) {
871
897
  const highlightVisible = (0, vue.ref)(false);
872
898
  const highlightStyle = (0, vue.ref)({
@@ -892,7 +918,8 @@ function useInspector(options) {
892
918
  if (!inspector) return;
893
919
  const { targetNode, params } = inspector.getTargetNode(e);
894
920
  if (targetNode && params) {
895
- const rect = targetNode.getBoundingClientRect();
921
+ const elementToHighlight = getPreciseElementAtPoint(e.clientX, e.clientY, targetNode) || targetNode;
922
+ const rect = elementToHighlight.getBoundingClientRect();
896
923
  const widget = document.querySelector(".opencode-widget");
897
924
  let primary = "#3b82f6";
898
925
  let primaryBg = "rgba(59, 130, 246, 0.1)";
@@ -910,7 +937,7 @@ function useInspector(options) {
910
937
  border: `2px solid ${primary}`,
911
938
  background: primaryBg
912
939
  };
913
- const description = getElementDescription(targetNode);
940
+ const description = getElementDescription(elementToHighlight);
914
941
  const fileName = params.file ? params.file.split("/").pop() : "";
915
942
  let lineInfo = "";
916
943
  if (params.line) {
@@ -946,8 +973,9 @@ function useInspector(options) {
946
973
  if (options.selectMode.value) {
947
974
  const { targetNode, params } = inspector.getTargetNode(e);
948
975
  if (targetNode && params) {
949
- const innerText = getDirectText(targetNode);
950
- const description = getElementDescription(targetNode);
976
+ const elementToSelect = getPreciseElementAtPoint(e.clientX, e.clientY, targetNode) || targetNode;
977
+ const innerText = getDirectText(elementToSelect);
978
+ const description = getElementDescription(elementToSelect);
951
979
  const elementInfo = {
952
980
  filePath: (_a = params.file) != null ? _a : null,
953
981
  line: (_b = params.line) != null ? _b : null,
@@ -1469,7 +1497,7 @@ __vue_sfc__.render = __vue_render__;
1469
1497
  var open_code_widget_default = __vue_sfc__;
1470
1498
  //#endregion
1471
1499
  //#region es/index.js
1472
- var version = "1.0.12";
1500
+ var version = "1.0.13";
1473
1501
  function install(app, options) {
1474
1502
  [open_code_widget_default].forEach((item) => {
1475
1503
  if (item.install) app.use(item, options);
@@ -863,6 +863,32 @@ function getElementDescription(element) {
863
863
  if (href && href !== "#") parts.push(`[href]`);
864
864
  return parts.join("");
865
865
  }
866
+ function getPreciseElementAtPoint(x, y, boundary) {
867
+ var _a, _b;
868
+ const highlight = document.querySelector(".opencode-element-highlight");
869
+ const tooltip = document.querySelector(".opencode-element-tooltip");
870
+ const highlightDisplay = ((_a = highlight == null ? void 0 : highlight.getAttribute("style")) == null ? void 0 : _a.includes("display: block")) ? "block" : "none";
871
+ const tooltipDisplay = ((_b = tooltip == null ? void 0 : tooltip.getAttribute("style")) == null ? void 0 : _b.includes("display: block")) ? "block" : "none";
872
+ if (highlight) highlight.style.display = "none";
873
+ if (tooltip) tooltip.style.display = "none";
874
+ let element = null;
875
+ try {
876
+ const elements = document.elementsFromPoint(x, y);
877
+ for (const el of elements) {
878
+ if (el.closest("#vue-inspector-container")) continue;
879
+ if (el.closest(".opencode-widget")) continue;
880
+ if (el.hasAttribute("data-v-inspector-ignore")) continue;
881
+ if (boundary.contains(el) || el === boundary) {
882
+ element = el;
883
+ break;
884
+ }
885
+ }
886
+ } finally {
887
+ if (highlight) highlight.style.display = highlightDisplay;
888
+ if (tooltip) tooltip.style.display = tooltipDisplay;
889
+ }
890
+ return element;
891
+ }
866
892
  function useInspector(options) {
867
893
  const highlightVisible = ref(false);
868
894
  const highlightStyle = ref({
@@ -888,7 +914,8 @@ function useInspector(options) {
888
914
  if (!inspector) return;
889
915
  const { targetNode, params } = inspector.getTargetNode(e);
890
916
  if (targetNode && params) {
891
- const rect = targetNode.getBoundingClientRect();
917
+ const elementToHighlight = getPreciseElementAtPoint(e.clientX, e.clientY, targetNode) || targetNode;
918
+ const rect = elementToHighlight.getBoundingClientRect();
892
919
  const widget = document.querySelector(".opencode-widget");
893
920
  let primary = "#3b82f6";
894
921
  let primaryBg = "rgba(59, 130, 246, 0.1)";
@@ -906,7 +933,7 @@ function useInspector(options) {
906
933
  border: `2px solid ${primary}`,
907
934
  background: primaryBg
908
935
  };
909
- const description = getElementDescription(targetNode);
936
+ const description = getElementDescription(elementToHighlight);
910
937
  const fileName = params.file ? params.file.split("/").pop() : "";
911
938
  let lineInfo = "";
912
939
  if (params.line) {
@@ -942,8 +969,9 @@ function useInspector(options) {
942
969
  if (options.selectMode.value) {
943
970
  const { targetNode, params } = inspector.getTargetNode(e);
944
971
  if (targetNode && params) {
945
- const innerText = getDirectText(targetNode);
946
- const description = getElementDescription(targetNode);
972
+ const elementToSelect = getPreciseElementAtPoint(e.clientX, e.clientY, targetNode) || targetNode;
973
+ const innerText = getDirectText(elementToSelect);
974
+ const description = getElementDescription(elementToSelect);
947
975
  const elementInfo = {
948
976
  filePath: (_a = params.file) != null ? _a : null,
949
977
  line: (_b = params.line) != null ? _b : null,
@@ -1465,7 +1493,7 @@ __vue_sfc__.render = __vue_render__;
1465
1493
  var open_code_widget_default = __vue_sfc__;
1466
1494
  //#endregion
1467
1495
  //#region es/index.js
1468
- var version = "1.0.12";
1496
+ var version = "1.0.13";
1469
1497
  function install(app, options) {
1470
1498
  [open_code_widget_default].forEach((item) => {
1471
1499
  if (item.install) app.use(item, options);
package/lib/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import OpenCodeWidget from './open-code-widget';
2
2
  import type { App } from 'vue';
3
- declare const version = "1.0.12";
3
+ declare const version = "1.0.13";
4
4
  declare function install(app: App<any>, options?: any): void;
5
5
  export { install, version, OpenCodeWidget };
6
6
  export default install;
package/lib/index.js CHANGED
@@ -34,7 +34,7 @@ __export(lib_exports, {
34
34
  });
35
35
  module.exports = __toCommonJS(lib_exports);
36
36
  var import_open_code_widget = __toESM(require("./open-code-widget"));
37
- const version = "1.0.12";
37
+ const version = "1.0.13";
38
38
  function install(app, options) {
39
39
  const components = [
40
40
  import_open_code_widget.default
@@ -54,6 +54,32 @@ function getElementDescription(element) {
54
54
  if (href && href !== "#") parts.push(`[href]`);
55
55
  return parts.join("");
56
56
  }
57
+ function getPreciseElementAtPoint(x, y, boundary) {
58
+ var _a, _b;
59
+ const highlight = document.querySelector(".opencode-element-highlight");
60
+ const tooltip = document.querySelector(".opencode-element-tooltip");
61
+ const highlightDisplay = ((_a = highlight == null ? void 0 : highlight.getAttribute("style")) == null ? void 0 : _a.includes("display: block")) ? "block" : "none";
62
+ const tooltipDisplay = ((_b = tooltip == null ? void 0 : tooltip.getAttribute("style")) == null ? void 0 : _b.includes("display: block")) ? "block" : "none";
63
+ if (highlight) highlight.style.display = "none";
64
+ if (tooltip) tooltip.style.display = "none";
65
+ let element = null;
66
+ try {
67
+ const elements = document.elementsFromPoint(x, y);
68
+ for (const el of elements) {
69
+ if (el.closest("#vue-inspector-container")) continue;
70
+ if (el.closest(".opencode-widget")) continue;
71
+ if (el.hasAttribute("data-v-inspector-ignore")) continue;
72
+ if (boundary.contains(el) || el === boundary) {
73
+ element = el;
74
+ break;
75
+ }
76
+ }
77
+ } finally {
78
+ if (highlight) highlight.style.display = highlightDisplay;
79
+ if (tooltip) tooltip.style.display = tooltipDisplay;
80
+ }
81
+ return element;
82
+ }
57
83
  function useInspector(options) {
58
84
  const highlightVisible = (0, import_vue.ref)(false);
59
85
  const highlightStyle = (0, import_vue.ref)({
@@ -73,7 +99,9 @@ function useInspector(options) {
73
99
  if (!inspector) return;
74
100
  const { targetNode, params } = inspector.getTargetNode(e);
75
101
  if (targetNode && params) {
76
- const rect = targetNode.getBoundingClientRect();
102
+ const preciseElement = getPreciseElementAtPoint(e.clientX, e.clientY, targetNode);
103
+ const elementToHighlight = preciseElement || targetNode;
104
+ const rect = elementToHighlight.getBoundingClientRect();
77
105
  const widget = document.querySelector(".opencode-widget");
78
106
  let primary = "#3b82f6";
79
107
  let primaryBg = "rgba(59, 130, 246, 0.1)";
@@ -91,7 +119,7 @@ function useInspector(options) {
91
119
  border: `2px solid ${primary}`,
92
120
  background: primaryBg
93
121
  };
94
- const description = getElementDescription(targetNode);
122
+ const description = getElementDescription(elementToHighlight);
95
123
  const fileName = params.file ? params.file.split("/").pop() : "";
96
124
  let lineInfo = "";
97
125
  if (params.line) {
@@ -133,8 +161,10 @@ function useInspector(options) {
133
161
  if (options.selectMode.value) {
134
162
  const { targetNode, params } = inspector.getTargetNode(e);
135
163
  if (targetNode && params) {
136
- const innerText = getDirectText(targetNode);
137
- const description = getElementDescription(targetNode);
164
+ const preciseElement = getPreciseElementAtPoint(e.clientX, e.clientY, targetNode);
165
+ const elementToSelect = preciseElement || targetNode;
166
+ const innerText = getDirectText(elementToSelect);
167
+ const description = getElementDescription(elementToSelect);
138
168
  const elementInfo = {
139
169
  filePath: (_a = params.file) != null ? _a : null,
140
170
  line: (_b = params.line) != null ? _b : null,
@@ -1 +1 @@
1
- {"$schema":"https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json","framework":"vue","name":"@vite-plugin-opencode-assistant/components","version":"1.0.12","contributions":{"html":{"tags":[{"name":"open-code","attributes":[{"name":"","default":"`'bottom-right'`","description":"挂件显示的位置","value":{"type":"`'bottom-right' | 'bottom-left' | 'top-right' | 'top-left'`","kind":"expression"}},{"name":"","default":"`false`","description":"挂件是否打开","value":{"type":"`boolean`","kind":"expression"}},{"name":"","default":"`'light'`","description":"主题模式","value":{"type":"`'light' | 'dark' | 'auto'`","kind":"expression"}},{"name":"","default":"`'AI 助手'`","description":"助手头部显示的标题","value":{"type":"`string`","kind":"expression"}},{"name":"","default":"`''`","description":"Web UI 的 URL 来源","value":{"type":"`string`","kind":"expression"}},{"name":"","default":"`false`","description":"是否进入选择页面元素模式","value":{"type":"`boolean`","kind":"expression"}},{"name":"","default":"`false`","description":"是否显示加载状态","value":{"type":"`boolean`","kind":"expression"}},{"name":"","default":"`[]`","description":"会话列表数据","value":{"type":"`OpenCodeWidgetSessionItem[]`","kind":"expression"}},{"name":"","default":"`null`","description":"当前选中的会话 ID","value":{"type":"`string | null`","kind":"expression"}},{"name":"","default":"`[]`","description":"已选中的元素列表","value":{"type":"`OpenCodeSelectedElement[]`","kind":"expression"}}],"events":[{"name":"`update:open`","description":"当挂件打开或关闭时触发","arguments":[{"name":"open","type":"en"},{"name":"boolean"}]},{"name":"","description":"点击触发挂件开关","arguments":[{"name":"open","type":"en"},{"name":"boolean"}]},{"name":"","description":"点击关闭按钮时触发","arguments":[]},{"name":"`toggle-select-mode`","description":"点击选择模式切换按钮时触发","arguments":[{"name":"mode","type":"de"},{"name":"boolean"}]},{"name":"`click-selected-node`","description":"点击已选中的气泡或节点卡片时触发","arguments":[{"name":"element","type":"nt"},{"name":"OpenCodeSelectedElement"}]},{"name":"`remove-selected-node`","description":"删除已选中的元素时触发","arguments":[{"name":"payload","type":"ad"},{"name":"OpenCodeRemoveSelectedPayload"}]},{"name":"`clear-selected-nodes`","description":"清空所有选中元素时触发","arguments":[]},{"name":"`create-session`","description":"点击创建新会话时触发","arguments":[]},{"name":"`select-session`","description":"选中某个历史会话时触发","arguments":[{"name":"session","type":"on"},{"name":"OpenCodeWidgetSessionItem"}]},{"name":"`delete-session`","description":"删除某个历史会话时触发","arguments":[{"name":"session","type":"on"},{"name":"OpenCodeWidgetSessionItem"}]}]}],"attributes":[]}},"js-types-syntax":"typescript"}
1
+ {"$schema":"https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json","framework":"vue","name":"@vite-plugin-opencode-assistant/components","version":"1.0.13","contributions":{"html":{"tags":[{"name":"open-code","attributes":[{"name":"","default":"`'bottom-right'`","description":"挂件显示的位置","value":{"type":"`'bottom-right' | 'bottom-left' | 'top-right' | 'top-left'`","kind":"expression"}},{"name":"","default":"`false`","description":"挂件是否打开","value":{"type":"`boolean`","kind":"expression"}},{"name":"","default":"`'light'`","description":"主题模式","value":{"type":"`'light' | 'dark' | 'auto'`","kind":"expression"}},{"name":"","default":"`'AI 助手'`","description":"助手头部显示的标题","value":{"type":"`string`","kind":"expression"}},{"name":"","default":"`''`","description":"Web UI 的 URL 来源","value":{"type":"`string`","kind":"expression"}},{"name":"","default":"`false`","description":"是否进入选择页面元素模式","value":{"type":"`boolean`","kind":"expression"}},{"name":"","default":"`false`","description":"是否显示加载状态","value":{"type":"`boolean`","kind":"expression"}},{"name":"","default":"`[]`","description":"会话列表数据","value":{"type":"`OpenCodeWidgetSessionItem[]`","kind":"expression"}},{"name":"","default":"`null`","description":"当前选中的会话 ID","value":{"type":"`string | null`","kind":"expression"}},{"name":"","default":"`[]`","description":"已选中的元素列表","value":{"type":"`OpenCodeSelectedElement[]`","kind":"expression"}}],"events":[{"name":"`update:open`","description":"当挂件打开或关闭时触发","arguments":[{"name":"open","type":"en"},{"name":"boolean"}]},{"name":"","description":"点击触发挂件开关","arguments":[{"name":"open","type":"en"},{"name":"boolean"}]},{"name":"","description":"点击关闭按钮时触发","arguments":[]},{"name":"`toggle-select-mode`","description":"点击选择模式切换按钮时触发","arguments":[{"name":"mode","type":"de"},{"name":"boolean"}]},{"name":"`click-selected-node`","description":"点击已选中的气泡或节点卡片时触发","arguments":[{"name":"element","type":"nt"},{"name":"OpenCodeSelectedElement"}]},{"name":"`remove-selected-node`","description":"删除已选中的元素时触发","arguments":[{"name":"payload","type":"ad"},{"name":"OpenCodeRemoveSelectedPayload"}]},{"name":"`clear-selected-nodes`","description":"清空所有选中元素时触发","arguments":[]},{"name":"`create-session`","description":"点击创建新会话时触发","arguments":[]},{"name":"`select-session`","description":"选中某个历史会话时触发","arguments":[{"name":"session","type":"on"},{"name":"OpenCodeWidgetSessionItem"}]},{"name":"`delete-session`","description":"删除某个历史会话时触发","arguments":[{"name":"session","type":"on"},{"name":"OpenCodeWidgetSessionItem"}]}]}],"attributes":[]}},"js-types-syntax":"typescript"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vite-plugin-opencode-assistant/components",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "Reusable OpenCode widget components built with Pagoda CLI",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",