@mingxy/opencode-mascot 0.4.0 → 0.4.1

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.0",
3
+ "version": "0.4.1",
4
4
  "description": "OpenCode TUI mascot plugin framework - customizable ASCII mascots for your terminal",
5
5
  "author": "mingxy",
6
6
  "license": "MIT",
@@ -54,47 +54,49 @@ export function HomeMascot(props: HomeMascotProps): JSX.Element {
54
54
  };
55
55
 
56
56
  return (
57
- <box
58
- left={posX()}
59
- top={posY()}
60
- alignItems="center"
61
- zIndex={9999}
62
- flexDirection="column"
63
- onMouseDown={(e: any) => {
64
- const now = Date.now();
65
- if (now - lastClickTime < 300) {
66
- switchToNext();
67
- lastClickTime = 0;
68
- return;
69
- }
70
- lastClickTime = now;
57
+ <box height={5} zIndex={9999}>
58
+ <box
59
+ position="absolute"
60
+ left={posX()}
61
+ top={posY()}
62
+ alignItems="center"
63
+ flexDirection="column"
64
+ onMouseDown={(e: any) => {
65
+ const now = Date.now();
66
+ if (now - lastClickTime < 300) {
67
+ switchToNext();
68
+ lastClickTime = 0;
69
+ return;
70
+ }
71
+ lastClickTime = now;
71
72
 
72
- if (e.modifiers?.alt) {
73
- dragStartX = e.x;
74
- dragStartY = e.y;
75
- dragAnchorX = posX();
76
- dragAnchorY = posY();
77
- isDragging = true;
78
- renderers[currentName()].setDragging(true);
79
- e.preventDefault();
80
- e.stopPropagation();
81
- props.api.renderer.clearSelection();
82
- }
83
- }}
84
- onMouseDrag={(e: any) => {
85
- if (e.modifiers?.alt && isDragging) {
86
- setPosX(dragAnchorX + (e.x - dragStartX));
87
- setPosY(dragAnchorY + (e.y - dragStartY));
88
- e.preventDefault();
89
- e.stopPropagation();
90
- props.api.renderer.clearSelection();
91
- }
92
- }}
93
- onMouseUp={() => { stopDrag(); }}
94
- onMouseDragEnd={() => { stopDrag(); }}
95
- onMouseOut={() => { stopDrag(); }}
96
- >
97
- {renderers[currentName()]?.element() ?? null}
73
+ if (e.modifiers?.alt) {
74
+ dragStartX = e.x;
75
+ dragStartY = e.y;
76
+ dragAnchorX = posX();
77
+ dragAnchorY = posY();
78
+ isDragging = true;
79
+ renderers[currentName()].setDragging(true);
80
+ e.preventDefault();
81
+ e.stopPropagation();
82
+ props.api.renderer.clearSelection();
83
+ }
84
+ }}
85
+ onMouseDrag={(e: any) => {
86
+ if (e.modifiers?.alt && isDragging) {
87
+ setPosX(dragAnchorX + (e.x - dragStartX));
88
+ setPosY(dragAnchorY + (e.y - dragStartY));
89
+ e.preventDefault();
90
+ e.stopPropagation();
91
+ props.api.renderer.clearSelection();
92
+ }
93
+ }}
94
+ onMouseUp={() => { stopDrag(); }}
95
+ onMouseDragEnd={() => { stopDrag(); }}
96
+ onMouseOut={() => { stopDrag(); }}
97
+ >
98
+ {renderers[currentName()]?.element() ?? null}
99
+ </box>
98
100
  </box>
99
101
  );
100
102
  }
@@ -315,14 +315,12 @@ export function createAnimatedRenderer(pack: MascotPack): {
315
315
  const dm = dragMsg();
316
316
 
317
317
  return (
318
- <box flexDirection="column" width={10} overflow="visible" left={left} top={top}>
319
- {cel ? <text fg={flashColor() ?? fg} selectable={false}>{cel.text}</text> : null}
320
- {dm ? <text fg="#FF4081" selectable={false}>{dm}</text> : null}
321
- <box flexDirection="column" width={10} alignItems="flex-start">
322
- {lines.map((line: string) => (
323
- <text fg={flashColor() ?? fg} selectable={false}>{line}</text>
324
- ))}
325
- </box>
318
+ <box flexDirection="column" left={left} top={top}>
319
+ {cel ? <text fg={flashColor() ?? fg}>{cel.text}</text> : null}
320
+ {dm ? <text fg="#FF4081">{dm}</text> : null}
321
+ {lines.map((line: string) => (
322
+ <text fg={flashColor() ?? fg}>{line}</text>
323
+ ))}
326
324
  </box>
327
325
  );
328
326
  };