@mingxy/opencode-mascot 0.4.8 → 0.4.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mingxy/opencode-mascot",
3
- "version": "0.4.8",
3
+ "version": "0.4.10",
4
4
  "description": "OpenCode TUI mascot plugin framework - customizable ASCII mascots for your terminal",
5
5
  "author": "mingxy",
6
6
  "license": "MIT",
@@ -5,6 +5,7 @@ import type { JSX } from "@opentui/solid";
5
5
  import type { MascotPack } from "../core/types";
6
6
  import { createAnimatedRenderer } from "../core/ascii-renderer";
7
7
  import { onCelebrate, onVersion } from "../core/celebration-bus";
8
+ import { log } from "../core/logger";
8
9
 
9
10
  interface HomeMascotProps {
10
11
  mascots: Record<string, MascotPack>;
@@ -57,10 +58,12 @@ export function HomeMascot(props: HomeMascotProps): JSX.Element {
57
58
  <box
58
59
  left={posX()}
59
60
  top={posY()}
60
- alignItems="center"
61
+ width={12}
62
+ height={6}
61
63
  zIndex={100}
62
64
  flexDirection="column"
63
65
  onMouseDown={(e: any) => {
66
+ log("MOUSE", `down x=${e.x} y=${e.y} alt=${!!e.modifiers?.alt} btn=${e.button}`);
64
67
  const now = Date.now();
65
68
  if (now - lastClickTime < 300) {
66
69
  switchToNext();
@@ -75,19 +78,23 @@ export function HomeMascot(props: HomeMascotProps): JSX.Element {
75
78
  dragAnchorX = posX();
76
79
  dragAnchorY = posY();
77
80
  isDragging = true;
81
+ log("DRAG", `start anchorX=${dragAnchorX} anchorY=${dragAnchorY} startX=${dragStartX} startY=${dragStartY}`);
78
82
  renderers[currentName()].setDragging(true);
79
83
  props.api.renderer.clearSelection();
80
84
  }
81
85
  }}
82
86
  onMouseDrag={(e: any) => {
87
+ if (isDragging) {
88
+ log("MOUSE", `drag x=${e.x} y=${e.y} alt=${!!e.modifiers?.alt} dx=${e.x - dragStartX} dy=${e.y - dragStartY}`);
89
+ }
83
90
  if (e.modifiers?.alt && isDragging) {
84
91
  setPosX(dragAnchorX + (e.x - dragStartX));
85
92
  setPosY(dragAnchorY + (e.y - dragStartY));
86
93
  }
87
94
  }}
88
- onMouseUp={() => { stopDrag(); }}
89
- onMouseDragEnd={() => { stopDrag(); }}
90
- onMouseOut={() => { stopDrag(); }}
95
+ onMouseUp={() => { log("MOUSE", `up isDragging=${isDragging}`); stopDrag(); }}
96
+ onMouseDragEnd={() => { log("MOUSE", `dragEnd isDragging=${isDragging}`); stopDrag(); }}
97
+ onMouseOut={() => { log("MOUSE", `out isDragging=${isDragging}`); if (isDragging) stopDrag(); }}
91
98
  >
92
99
  {renderers[currentName()]?.element() ?? null}
93
100
  </box>