@mingxy/opencode-mascot 0.4.2 → 0.4.4

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