@vite-plugin-opencode-assistant/components 1.0.74 → 1.0.75

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.
Files changed (31) hide show
  1. package/es/index.d.ts +1 -1
  2. package/es/index.mjs +1 -1
  3. package/es/open-code-widget/composables/use-split.d.ts +1 -0
  4. package/es/open-code-widget/composables/use-split.mjs +15 -8
  5. package/es/open-code-widget/src/components/ChatPanel-sfc.css +1 -1
  6. package/es/open-code-widget/src/components/ChatPanel.vue.d.ts +2 -0
  7. package/es/open-code-widget/src/components/ChatPanel.vue.mjs +9 -4
  8. package/es/open-code-widget/src/components/Frame-sfc.css +1 -1
  9. package/es/open-code-widget/src/components/Header.vue.mjs +61 -28
  10. package/es/open-code-widget/src/context.d.ts +1 -0
  11. package/es/open-code-widget/src/index-sfc.css +1 -1
  12. package/es/open-code-widget/src/index.vue.d.ts +1 -0
  13. package/es/open-code-widget/src/index.vue.mjs +137 -120
  14. package/lib/@vite-plugin-opencode-assistant/components.cjs.js +189 -137
  15. package/lib/@vite-plugin-opencode-assistant/components.es.js +190 -138
  16. package/lib/components.css +3 -3
  17. package/lib/index.cjs +1 -1
  18. package/lib/index.d.ts +1 -1
  19. package/lib/open-code-widget/composables/use-split.cjs +15 -8
  20. package/lib/open-code-widget/composables/use-split.d.ts +1 -0
  21. package/lib/open-code-widget/src/components/ChatPanel-sfc.css +1 -1
  22. package/lib/open-code-widget/src/components/ChatPanel.vue.cjs +9 -4
  23. package/lib/open-code-widget/src/components/ChatPanel.vue.d.ts +2 -0
  24. package/lib/open-code-widget/src/components/Frame-sfc.css +1 -1
  25. package/lib/open-code-widget/src/components/Header.vue.cjs +61 -28
  26. package/lib/open-code-widget/src/context.d.ts +1 -0
  27. package/lib/open-code-widget/src/index-sfc.css +1 -1
  28. package/lib/open-code-widget/src/index.vue.cjs +136 -119
  29. package/lib/open-code-widget/src/index.vue.d.ts +1 -0
  30. package/lib/web-types.json +1 -1
  31. package/package.json +2 -2
@@ -30,6 +30,7 @@ import { useInspector } from "../composables/use-inspector.mjs";
30
30
  import { usePersistState } from "../composables/use-persist-state.mjs";
31
31
  import { useSplitMode } from "../composables/use-split.mjs";
32
32
  import { provideOpenCodeWidgetContext } from "./context.mjs";
33
+ import { WIDGET_MSG } from "@vite-plugin-opencode-assistant/shared";
33
34
  const __vue_sfc__ = /* @__PURE__ */ _defineComponent(__spreadProps(__spreadValues({}, {
34
35
  name: "OpencodeWidget"
35
36
  }), {
@@ -60,7 +61,8 @@ const __vue_sfc__ = /* @__PURE__ */ _defineComponent(__spreadProps(__spreadValue
60
61
  sessionStates: { type: Object, required: false },
61
62
  displayMode: { type: String, required: false, default: "bubble" },
62
63
  splitMode: { type: Object, required: false, default: void 0 },
63
- splitPanelWidth: { type: Number, required: false, default: 500 }
64
+ splitPanelWidth: { type: Number, required: false, default: 500 },
65
+ hideBubble: { type: Boolean, required: false, default: false }
64
66
  },
65
67
  emits: ["update:open", "update:selectMode", "update:sessionListCollapsed", "update:currentSessionId", "update:selectedElements", "update:theme", "update:thinking", "update:splitPanelWidth", "toggle", "close", "toggle-session-list", "toggle-select-mode", "toggle-theme", "create-session", "select-session", "delete-session", "click-selected-node", "remove-selected-node", "clear-selected-nodes", "empty-action", "frame-loaded", "thinking-change", "split-panel-width-change"],
66
68
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -122,8 +124,8 @@ const __vue_sfc__ = /* @__PURE__ */ _defineComponent(__spreadProps(__spreadValue
122
124
  const splitPanelWidth = ref(props.splitPanelWidth);
123
125
  const syncStateToIframe = () => {
124
126
  if (!iframeLoaded.value) return;
125
- sendMessageToIframe("prompt-dock-visibility-change", { visible: promptDockVisible.value });
126
- sendMessageToIframe("minimize-state-change", { minimized: minimized.value });
127
+ sendMessageToIframe(WIDGET_MSG.PROMPT_DOCK_VISIBILITY, { visible: promptDockVisible.value });
128
+ sendMessageToIframe(WIDGET_MSG.MINIMIZE_STATE, { minimized: minimized.value });
127
129
  };
128
130
  const handleFrameLoaded = () => {
129
131
  emit("frame-loaded");
@@ -149,6 +151,7 @@ const __vue_sfc__ = /* @__PURE__ */ _defineComponent(__spreadProps(__spreadValue
149
151
  }
150
152
  );
151
153
  const handleToggleDisplayMode = () => {
154
+ if (localDisplayMode.value === "extension" || localDisplayMode.value === "extension-selector") return;
152
155
  const modes = ["bubble", "split", "auto"];
153
156
  const currentIndex = modes.indexOf(localDisplayMode.value);
154
157
  const nextIndex = (currentIndex + 1) % modes.length;
@@ -248,6 +251,7 @@ const __vue_sfc__ = /* @__PURE__ */ _defineComponent(__spreadProps(__spreadValue
248
251
  const {
249
252
  effectiveMode,
250
253
  isSplitMode,
254
+ isExtensionMode,
251
255
  panelWidth,
252
256
  splitConfig,
253
257
  splitPosition,
@@ -333,12 +337,15 @@ const __vue_sfc__ = /* @__PURE__ */ _defineComponent(__spreadProps(__spreadValue
333
337
  const handleToggleMinimize = () => {
334
338
  minimized.value = !minimized.value;
335
339
  promptDockVisible.value = !minimized.value;
336
- sendMessageToIframe("prompt-dock-visibility-change", { visible: promptDockVisible.value });
337
- sendMessageToIframe("minimize-state-change", { minimized: minimized.value });
340
+ sendMessageToIframe(WIDGET_MSG.PROMPT_DOCK_VISIBILITY, { visible: promptDockVisible.value });
341
+ sendMessageToIframe(WIDGET_MSG.MINIMIZE_STATE, { minimized: minimized.value });
338
342
  };
339
343
  const handleTogglePromptDock = () => {
340
344
  promptDockVisible.value = !promptDockVisible.value;
341
- sendMessageToIframe("prompt-dock-visibility-change", { visible: promptDockVisible.value });
345
+ sendMessageToIframe(WIDGET_MSG.PROMPT_DOCK_VISIBILITY, { visible: promptDockVisible.value });
346
+ };
347
+ const handleRefresh = () => {
348
+ window.location.reload();
342
349
  };
343
350
  const windowWidth = ref(typeof window !== "undefined" ? window.innerWidth : 0);
344
351
  const windowHeight = ref(typeof window !== "undefined" ? window.innerHeight : 0);
@@ -519,7 +526,8 @@ const __vue_sfc__ = /* @__PURE__ */ _defineComponent(__spreadProps(__spreadValue
519
526
  handleRemoveSelectedNode: (payload) => handleRemoveSelectedNode(payload.item, payload.index, payload.source),
520
527
  handleClearSelectedNodes,
521
528
  handleFrameLoaded,
522
- handleBubbleOffsetChange
529
+ handleBubbleOffsetChange,
530
+ handleRefresh
523
531
  });
524
532
  __expose({
525
533
  showNotification,
@@ -535,7 +543,7 @@ const __vue_sfc__ = /* @__PURE__ */ _defineComponent(__spreadProps(__spreadValue
535
543
  return dialogResolve;
536
544
  }, set dialogResolve(v) {
537
545
  dialogResolve = v;
538
- }, showConfirmDialog, handleDialogConfirm, handleDialogCancel, frameRef, triggerRef, sendMessageToIframe, localSessionListCollapsed, localDisplayMode, localSplitPosition, minimized, promptDockVisible, isRestoring, iframeLoaded, splitPanelWidth, syncStateToIframe, handleFrameLoaded, handleToggleDisplayMode, buttonActive, containerClasses, iframeSource, sessionListTitle, resolvedTheme, handleClose, handleEmptyAction, handleToggle, handleToggleSessionList, handleToggleTheme, sessionItems, handleCreateSession, handleDeleteSession, handleSelectSession, bubbleVisible, hasSelectedElements, selectedElementItems, handleClearSelectedNodes, handleClickSelectedNode, handleRemoveSelectedNode, handleToggleSelectMode, highlightVisible, highlightStyle, tooltipVisible, tooltipStyle, tooltipContent, bubbleOffset, effectiveMode, isSplitMode, panelWidth, splitConfig, splitPosition, handleResize, handleSplitToggle, handleTogglePosition, handleToggleMinimize, handleTogglePromptDock, windowWidth, windowHeight, handleWindowResize, bubbleQuadrant, isBubbleOnRightSide, chatPositionStyle, handleBubbleOffsetChange, handleResizeStart, handleResizeEnd, chatAnimationOrigin, isDragging, get wasOpenBeforeDrag() {
546
+ }, showConfirmDialog, handleDialogConfirm, handleDialogCancel, frameRef, triggerRef, sendMessageToIframe, localSessionListCollapsed, localDisplayMode, localSplitPosition, minimized, promptDockVisible, isRestoring, iframeLoaded, splitPanelWidth, syncStateToIframe, handleFrameLoaded, handleToggleDisplayMode, buttonActive, containerClasses, iframeSource, sessionListTitle, resolvedTheme, handleClose, handleEmptyAction, handleToggle, handleToggleSessionList, handleToggleTheme, sessionItems, handleCreateSession, handleDeleteSession, handleSelectSession, bubbleVisible, hasSelectedElements, selectedElementItems, handleClearSelectedNodes, handleClickSelectedNode, handleRemoveSelectedNode, handleToggleSelectMode, highlightVisible, highlightStyle, tooltipVisible, tooltipStyle, tooltipContent, bubbleOffset, effectiveMode, isSplitMode, isExtensionMode, panelWidth, splitConfig, splitPosition, handleResize, handleSplitToggle, handleTogglePosition, handleToggleMinimize, handleTogglePromptDock, handleRefresh, windowWidth, windowHeight, handleWindowResize, bubbleQuadrant, isBubbleOnRightSide, chatPositionStyle, handleBubbleOffsetChange, handleResizeStart, handleResizeEnd, chatAnimationOrigin, isDragging, get wasOpenBeforeDrag() {
539
547
  return wasOpenBeforeDrag;
540
548
  }, set wasOpenBeforeDrag(v) {
541
549
  wasOpenBeforeDrag = v;
@@ -544,7 +552,7 @@ const __vue_sfc__ = /* @__PURE__ */ _defineComponent(__spreadProps(__spreadValue
544
552
  return __returned__;
545
553
  }
546
554
  }));
547
- import { renderSlot as _renderSlot, withCtx as _withCtx, createSlots as _createSlots, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, createElementVNode as _createElementVNode, createVNode as _createVNode, vShow as _vShow, normalizeStyle as _normalizeStyle, withDirectives as _withDirectives, toDisplayString as _toDisplayString, createElementBlock as _createElementBlock, Teleport as _Teleport, normalizeClass as _normalizeClass } from "vue";
555
+ import { renderSlot as _renderSlot, withCtx as _withCtx, createSlots as _createSlots, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, createElementVNode as _createElementVNode, createVNode as _createVNode, Fragment as _Fragment, createElementBlock as _createElementBlock, vShow as _vShow, normalizeStyle as _normalizeStyle, withDirectives as _withDirectives, toDisplayString as _toDisplayString, Teleport as _Teleport, normalizeClass as _normalizeClass } from "vue";
548
556
  const _hoisted_1 = { class: "opencode-tooltip-tag" };
549
557
  const _hoisted_2 = { class: "opencode-tooltip-file" };
550
558
  const _hoisted_3 = {
@@ -567,121 +575,130 @@ function __vue_render__(_ctx, _cache, $props, $setup, $data, $options) {
567
575
  return _openBlock(), _createElementBlock(
568
576
  "div",
569
577
  {
570
- class: _normalizeClass($setup.containerClasses)
578
+ class: _normalizeClass([...$setup.containerClasses, { "extension-mode": $setup.isExtensionMode }])
571
579
  },
572
580
  [
573
- !$setup.isSplitMode ? (_openBlock(), _createBlock(
574
- $setup["Trigger"],
575
- {
576
- key: 0,
577
- ref: "triggerRef",
578
- onDragStart: $setup.handleDragStart,
579
- onDragEnd: $setup.handleDragEnd
580
- },
581
- _createSlots({
582
- _: 2
583
- /* DYNAMIC */
584
- }, [
585
- $setup.slots["button-icon"] ? {
586
- name: "default",
587
- fn: _withCtx(() => [
588
- _renderSlot(_ctx.$slots, "button-icon")
581
+ $props.displayMode !== "extension-selector" ? (_openBlock(), _createElementBlock(
582
+ _Fragment,
583
+ { key: 0 },
584
+ [
585
+ !$setup.isSplitMode && !$setup.props.hideBubble ? (_openBlock(), _createBlock(
586
+ $setup["Trigger"],
587
+ {
588
+ key: 0,
589
+ ref: "triggerRef",
590
+ onDragStart: $setup.handleDragStart,
591
+ onDragEnd: $setup.handleDragEnd
592
+ },
593
+ _createSlots({
594
+ _: 2
595
+ /* DYNAMIC */
596
+ }, [
597
+ $setup.slots["button-icon"] ? {
598
+ name: "default",
599
+ fn: _withCtx(() => [
600
+ _renderSlot(_ctx.$slots, "button-icon")
601
+ ]),
602
+ key: "0"
603
+ } : void 0
589
604
  ]),
590
- key: "0"
591
- } : void 0
592
- ]),
593
- 1536
594
- /* NEED_PATCH, DYNAMIC_SLOTS */
605
+ 1536
606
+ /* NEED_PATCH, DYNAMIC_SLOTS */
607
+ )) : _createCommentVNode("v-if", true),
608
+ _createVNode($setup["ChatPanel"], {
609
+ ref: "frameRef",
610
+ mode: $setup.effectiveMode,
611
+ open: $props.open,
612
+ minimized: $setup.minimized,
613
+ "position-style": $setup.chatPositionStyle,
614
+ "animation-origin": $setup.chatAnimationOrigin,
615
+ "panel-width": $setup.panelWidth,
616
+ resizable: $setup.splitConfig.resizable,
617
+ "min-width": $setup.splitConfig.minWidth,
618
+ "max-width": $setup.splitConfig.maxWidth,
619
+ "no-transition": $setup.isRestoring,
620
+ dragging: $setup.isDragging,
621
+ "notification-visible": $setup.notificationVisible,
622
+ "notification-message": $setup.notificationMessage,
623
+ "notification-mode": $setup.notificationMode,
624
+ thinking: $props.thinking,
625
+ "resolved-theme": $setup.resolvedTheme,
626
+ "split-position": $setup.splitPosition,
627
+ extension: $setup.isExtensionMode,
628
+ onResize: $setup.handleResize,
629
+ onResizeStart: $setup.handleResizeStart,
630
+ onResizeEnd: $setup.handleResizeEnd,
631
+ onToggle: $setup.handleSplitToggle
632
+ }, _createSlots({
633
+ "sessions-empty": _withCtx(() => [
634
+ _renderSlot(_ctx.$slots, "sessions-empty", {}, () => [
635
+ _cache[0] || (_cache[0] = _createElementVNode(
636
+ "div",
637
+ { class: "opencode-session-empty" },
638
+ "\u6682\u65E0\u4F1A\u8BDD",
639
+ -1
640
+ /* CACHED */
641
+ ))
642
+ ])
643
+ ]),
644
+ _: 2
645
+ /* DYNAMIC */
646
+ }, [
647
+ $setup.slots["session-toggle-icon"] ? {
648
+ name: "session-toggle-icon",
649
+ fn: _withCtx(() => [
650
+ _renderSlot(_ctx.$slots, "session-toggle-icon")
651
+ ]),
652
+ key: "0"
653
+ } : void 0,
654
+ $setup.slots["select-icon"] ? {
655
+ name: "select-icon",
656
+ fn: _withCtx(() => [
657
+ _renderSlot(_ctx.$slots, "select-icon")
658
+ ]),
659
+ key: "1"
660
+ } : void 0,
661
+ $setup.slots["close-icon"] ? {
662
+ name: "close-icon",
663
+ fn: _withCtx(() => [
664
+ _renderSlot(_ctx.$slots, "close-icon")
665
+ ]),
666
+ key: "2"
667
+ } : void 0,
668
+ $setup.slots["empty-state"] ? {
669
+ name: "empty-state",
670
+ fn: _withCtx(() => [
671
+ _renderSlot(_ctx.$slots, "empty-state")
672
+ ]),
673
+ key: "3"
674
+ } : void 0,
675
+ $setup.slots.loading ? {
676
+ name: "loading",
677
+ fn: _withCtx(() => [
678
+ _renderSlot(_ctx.$slots, "loading")
679
+ ]),
680
+ key: "4"
681
+ } : void 0,
682
+ $setup.slots.error ? {
683
+ name: "error",
684
+ fn: _withCtx(() => [
685
+ _renderSlot(_ctx.$slots, "error")
686
+ ]),
687
+ key: "5"
688
+ } : void 0,
689
+ $setup.slots.content ? {
690
+ name: "content",
691
+ fn: _withCtx(() => [
692
+ _renderSlot(_ctx.$slots, "content")
693
+ ]),
694
+ key: "6"
695
+ } : void 0
696
+ ]), 1032, ["mode", "open", "minimized", "position-style", "animation-origin", "panel-width", "resizable", "min-width", "max-width", "no-transition", "dragging", "notification-visible", "notification-message", "notification-mode", "thinking", "resolved-theme", "split-position", "extension", "onResize", "onToggle"]),
697
+ _createVNode($setup["SelectHint"])
698
+ ],
699
+ 64
700
+ /* STABLE_FRAGMENT */
595
701
  )) : _createCommentVNode("v-if", true),
596
- _createVNode($setup["ChatPanel"], {
597
- ref: "frameRef",
598
- mode: $setup.effectiveMode,
599
- open: $props.open,
600
- minimized: $setup.minimized,
601
- "position-style": $setup.chatPositionStyle,
602
- "animation-origin": $setup.chatAnimationOrigin,
603
- "panel-width": $setup.panelWidth,
604
- resizable: $setup.splitConfig.resizable,
605
- "min-width": $setup.splitConfig.minWidth,
606
- "max-width": $setup.splitConfig.maxWidth,
607
- "no-transition": $setup.isRestoring,
608
- dragging: $setup.isDragging,
609
- "notification-visible": $setup.notificationVisible,
610
- "notification-message": $setup.notificationMessage,
611
- "notification-mode": $setup.notificationMode,
612
- thinking: $props.thinking,
613
- "resolved-theme": $setup.resolvedTheme,
614
- "split-position": $setup.splitPosition,
615
- onResize: $setup.handleResize,
616
- onResizeStart: $setup.handleResizeStart,
617
- onResizeEnd: $setup.handleResizeEnd,
618
- onToggle: $setup.handleSplitToggle
619
- }, _createSlots({
620
- "sessions-empty": _withCtx(() => [
621
- _renderSlot(_ctx.$slots, "sessions-empty", {}, () => [
622
- _cache[0] || (_cache[0] = _createElementVNode(
623
- "div",
624
- { class: "opencode-session-empty" },
625
- "\u6682\u65E0\u4F1A\u8BDD",
626
- -1
627
- /* CACHED */
628
- ))
629
- ])
630
- ]),
631
- _: 2
632
- /* DYNAMIC */
633
- }, [
634
- $setup.slots["session-toggle-icon"] ? {
635
- name: "session-toggle-icon",
636
- fn: _withCtx(() => [
637
- _renderSlot(_ctx.$slots, "session-toggle-icon")
638
- ]),
639
- key: "0"
640
- } : void 0,
641
- $setup.slots["select-icon"] ? {
642
- name: "select-icon",
643
- fn: _withCtx(() => [
644
- _renderSlot(_ctx.$slots, "select-icon")
645
- ]),
646
- key: "1"
647
- } : void 0,
648
- $setup.slots["close-icon"] ? {
649
- name: "close-icon",
650
- fn: _withCtx(() => [
651
- _renderSlot(_ctx.$slots, "close-icon")
652
- ]),
653
- key: "2"
654
- } : void 0,
655
- $setup.slots["empty-state"] ? {
656
- name: "empty-state",
657
- fn: _withCtx(() => [
658
- _renderSlot(_ctx.$slots, "empty-state")
659
- ]),
660
- key: "3"
661
- } : void 0,
662
- $setup.slots.loading ? {
663
- name: "loading",
664
- fn: _withCtx(() => [
665
- _renderSlot(_ctx.$slots, "loading")
666
- ]),
667
- key: "4"
668
- } : void 0,
669
- $setup.slots.error ? {
670
- name: "error",
671
- fn: _withCtx(() => [
672
- _renderSlot(_ctx.$slots, "error")
673
- ]),
674
- key: "5"
675
- } : void 0,
676
- $setup.slots.content ? {
677
- name: "content",
678
- fn: _withCtx(() => [
679
- _renderSlot(_ctx.$slots, "content")
680
- ]),
681
- key: "6"
682
- } : void 0
683
- ]), 1032, ["mode", "open", "minimized", "position-style", "animation-origin", "panel-width", "resizable", "min-width", "max-width", "no-transition", "dragging", "notification-visible", "notification-message", "notification-mode", "thinking", "resolved-theme", "split-position", "onResize", "onToggle"]),
684
- _createVNode($setup["SelectHint"]),
685
702
  _withDirectives(_createElementVNode(
686
703
  "div",
687
704
  {