@mingxy/opencode-mascot 0.4.3 → 0.4.5

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.3",
3
+ "version": "0.4.5",
4
4
  "description": "OpenCode TUI mascot plugin framework - customizable ASCII mascots for your terminal",
5
5
  "author": "mingxy",
6
6
  "license": "MIT",
@@ -55,8 +55,11 @@ export function HomeMascot(props: HomeMascotProps): JSX.Element {
55
55
 
56
56
  return (
57
57
  <box
58
- height={5}
59
- zIndex={9999}
58
+ left={posX()}
59
+ top={posY()}
60
+ alignItems="center"
61
+ zIndex={100}
62
+ flexDirection="column"
60
63
  onMouseDown={(e: any) => {
61
64
  const now = Date.now();
62
65
  if (now - lastClickTime < 300) {
@@ -75,30 +78,19 @@ export function HomeMascot(props: HomeMascotProps): JSX.Element {
75
78
  renderers[currentName()].setDragging(true);
76
79
  e.preventDefault();
77
80
  e.stopPropagation();
78
- props.api.renderer.clearSelection();
79
81
  }
80
82
  }}
81
83
  onMouseDrag={(e: any) => {
82
84
  if (e.modifiers?.alt && isDragging) {
83
85
  setPosX(dragAnchorX + (e.x - dragStartX));
84
86
  setPosY(dragAnchorY + (e.y - dragStartY));
85
- e.preventDefault();
86
- e.stopPropagation();
87
- props.api.renderer.clearSelection();
88
87
  }
89
88
  }}
90
89
  onMouseUp={() => { stopDrag(); }}
91
90
  onMouseDragEnd={() => { stopDrag(); }}
92
91
  onMouseOut={() => { stopDrag(); }}
93
92
  >
94
- <box
95
- position="absolute"
96
- left={posX()}
97
- top={posY()}
98
- flexDirection="column"
99
- >
100
- {renderers[currentName()]?.element() ?? null}
101
- </box>
93
+ {renderers[currentName()]?.element() ?? null}
102
94
  </box>
103
95
  );
104
96
  }
@@ -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) {
@@ -218,16 +218,12 @@ export function SidebarMascot(props: SidebarMascotProps): JSX.Element {
218
218
  renderers[currentName()].setDragging(true);
219
219
  e.preventDefault();
220
220
  e.stopPropagation();
221
- props.api.renderer.clearSelection();
222
221
  }
223
222
  }}
224
223
  onMouseDrag={(e: any) => {
225
224
  if (e.modifiers?.alt && isDragging) {
226
225
  setPosX(clampX(dragAnchorX + (e.x - dragStartX)));
227
226
  setPosY(clampY(dragAnchorY + (e.y - dragStartY)));
228
- e.preventDefault();
229
- e.stopPropagation();
230
- props.api.renderer.clearSelection();
231
227
  }
232
228
  }}
233
229
  onMouseUp={() => {
@@ -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
  ))}