@mingxy/opencode-mascot 0.4.10 → 0.4.12

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.10",
3
+ "version": "0.4.12",
4
4
  "description": "OpenCode TUI mascot plugin framework - customizable ASCII mascots for your terminal",
5
5
  "author": "mingxy",
6
6
  "license": "MIT",
@@ -23,6 +23,7 @@ export function HomeMascot(props: HomeMascotProps): JSX.Element {
23
23
  const [currentName, setCurrentName] = createSignal(initialName);
24
24
  const [posX, setPosX] = createSignal(0);
25
25
  const [posY, setPosY] = createSignal(0);
26
+ const [zBoost, setZBoost] = createSignal(false);
26
27
  let dragStartX = 0;
27
28
  let dragStartY = 0;
28
29
  let dragAnchorX = 0;
@@ -42,11 +43,15 @@ export function HomeMascot(props: HomeMascotProps): JSX.Element {
42
43
  };
43
44
 
44
45
  onCelebrate((newVersion) => {
46
+ setZBoost(true);
45
47
  renderers[currentName()].celebrateUpdate(newVersion);
48
+ setTimeout(() => setZBoost(false), 2000);
46
49
  });
47
50
 
48
51
  onVersion((version) => {
52
+ setZBoost(true);
49
53
  renderers[currentName()].showVersion(version);
54
+ setTimeout(() => setZBoost(false), 3500);
50
55
  });
51
56
 
52
57
  const stopDrag = () => {
@@ -60,7 +65,7 @@ export function HomeMascot(props: HomeMascotProps): JSX.Element {
60
65
  top={posY()}
61
66
  width={12}
62
67
  height={6}
63
- zIndex={100}
68
+ zIndex={zBoost() ? 9999 : 100}
64
69
  flexDirection="column"
65
70
  onMouseDown={(e: any) => {
66
71
  log("MOUSE", `down x=${e.x} y=${e.y} alt=${!!e.modifiers?.alt} btn=${e.button}`);
@@ -92,9 +97,8 @@ export function HomeMascot(props: HomeMascotProps): JSX.Element {
92
97
  setPosY(dragAnchorY + (e.y - dragStartY));
93
98
  }
94
99
  }}
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(); }}
100
+ onMouseUp={() => { stopDrag(); }}
101
+ onMouseDragEnd={() => { stopDrag(); }}
98
102
  >
99
103
  {renderers[currentName()]?.element() ?? null}
100
104
  </box>
@@ -43,6 +43,7 @@ export function SidebarMascot(props: SidebarMascotProps): JSX.Element {
43
43
  const [posX, setPosX] = createSignal(20);
44
44
  const [posY, setPosY] = createSignal(2);
45
45
  const [containerWidth, setContainerWidth] = createSignal(0);
46
+ const [zBoost, setZBoost] = createSignal(false);
46
47
  let dragStartX = 0;
47
48
  let dragStartY = 0;
48
49
  let dragAnchorX = 0;
@@ -173,11 +174,15 @@ export function SidebarMascot(props: SidebarMascotProps): JSX.Element {
173
174
  });
174
175
 
175
176
  onCelebrate((newVersion) => {
177
+ setZBoost(true);
176
178
  renderers[currentName()].celebrateUpdate(newVersion);
179
+ setTimeout(() => setZBoost(false), 2000);
177
180
  });
178
181
 
179
182
  onVersion((version) => {
183
+ setZBoost(true);
180
184
  renderers[currentName()].showVersion(version);
185
+ setTimeout(() => setZBoost(false), 3500);
181
186
  });
182
187
 
183
188
  return (
@@ -186,7 +191,7 @@ export function SidebarMascot(props: SidebarMascotProps): JSX.Element {
186
191
  left={posX()}
187
192
  top={posY()}
188
193
  alignItems="center"
189
- zIndex={100}
194
+ zIndex={zBoost() ? 9999 : 100}
190
195
  flexDirection="column"
191
196
  ref={(node: any) => {
192
197
  if (node) {
@@ -235,12 +240,6 @@ export function SidebarMascot(props: SidebarMascotProps): JSX.Element {
235
240
  renderers[currentName()].setDragging(false);
236
241
  checkEdge();
237
242
  }}
238
- onMouseOut={() => {
239
- if (isDragging) {
240
- isDragging = false;
241
- renderers[currentName()].setDragging(false);
242
- }
243
- }}
244
243
  >
245
244
  {renderers[currentName()]?.element() ?? null}
246
245
  </box>