@mingxy/opencode-mascot 0.4.13 → 0.4.15

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.13",
3
+ "version": "0.4.15",
4
4
  "description": "OpenCode TUI mascot plugin framework - customizable ASCII mascots for your terminal",
5
5
  "author": "mingxy",
6
6
  "license": "MIT",
@@ -98,7 +98,6 @@ const yueerEffects: MascotPack["effects"] = {
98
98
 
99
99
  const ahogeAlt = get("ahogeAlt") as boolean;
100
100
  const waveSide = get("waveSide") as boolean;
101
- const zzzPhase = get("zzzPhase") as number;
102
101
  const stompActive = get("stompActive") as boolean;
103
102
  const stompAlt = get("stompAlt") as boolean;
104
103
  const flapAlt = get("flapAlt") as boolean;
@@ -156,18 +155,6 @@ const yueerEffects: MascotPack["effects"] = {
156
155
  }
157
156
  }
158
157
 
159
- if (zzzPhase > 0 && state === "sleeping") {
160
- const baseWidth = 10;
161
- for (let i = 0; i < result.length; i++) {
162
- if (result[i].includes("-.-")) {
163
- const zzz = "Z" + "z".repeat(zzzPhase - 1);
164
- const padded = result[i].padEnd(baseWidth);
165
- result[i] = padded + " " + zzz;
166
- break;
167
- }
168
- }
169
- }
170
-
171
158
  if ((state === "busy" || state === "thinking")) {
172
159
  const idx = get("bubbleIdx") as number;
173
160
  const ahogeLine = result.findIndex(l => l.includes("☆") || l.includes("★"));
@@ -63,8 +63,6 @@ export function HomeMascot(props: HomeMascotProps): JSX.Element {
63
63
  <box
64
64
  left={posX()}
65
65
  top={posY()}
66
- width={12}
67
- height={6}
68
66
  zIndex={zBoost() ? 9999 : 100}
69
67
  flexDirection="column"
70
68
  onMouseDown={(e: any) => {
@@ -97,8 +95,8 @@ export function HomeMascot(props: HomeMascotProps): JSX.Element {
97
95
  setPosY(dragAnchorY + (e.y - dragStartY));
98
96
  }
99
97
  }}
100
- onMouseUp={() => { stopDrag(); }}
101
- onMouseDragEnd={() => { stopDrag(); }}
98
+ onMouseUp={() => { log("MOUSE", `up isDragging=${isDragging}`); stopDrag(); }}
99
+ onMouseDragEnd={() => { log("MOUSE", `dragEnd isDragging=${isDragging}`); stopDrag(); }}
102
100
  >
103
101
  {renderers[currentName()]?.element() ?? null}
104
102
  </box>
@@ -67,9 +67,11 @@ export function createAnimatedRenderer(pack: MascotPack): {
67
67
  const [celebrate, setCelebrate] = createSignal<{ text: string; count: number } | null>(null);
68
68
  const [flashColor, setFlashColor] = createSignal<string | null>(null);
69
69
  const [dragMsg, setDragMsg] = createSignal<string | null>(null);
70
+ const [zzz, setZzz] = createSignal<string | null>(null);
70
71
 
71
72
  let flashTimer: ReturnType<typeof setInterval> | null = null;
72
73
  let dragMsgTimer: ReturnType<typeof setInterval> | null = null;
74
+ let zzzTimer: ReturnType<typeof setInterval> | null = null;
73
75
  let bounceTimers: ReturnType<typeof setTimeout>[] = [];
74
76
  let celebrateTimers: ReturnType<typeof setTimeout>[] = [];
75
77
  let versionTimer: ReturnType<typeof setTimeout> | null = null;
@@ -264,6 +266,7 @@ export function createAnimatedRenderer(pack: MascotPack): {
264
266
  stopBounce();
265
267
  stopCelebrate();
266
268
  stopVersion();
269
+ if (zzzTimer) { clearInterval(zzzTimer); zzzTimer = null; }
267
270
  });
268
271
 
269
272
  // ─── Render ───
@@ -277,6 +280,7 @@ export function createAnimatedRenderer(pack: MascotPack): {
277
280
  celebrate();
278
281
  flashColor();
279
282
  dragMsg();
283
+ zzz();
280
284
 
281
285
  for (const [, [get]] of extraSignals) {
282
286
  get();
@@ -318,6 +322,7 @@ export function createAnimatedRenderer(pack: MascotPack): {
318
322
  <box flexDirection="column" alignItems="flex-start" left={left} top={top}>
319
323
  {cel ? <box position="absolute" top={-1} left={0}><text fg={flashColor() ?? fg}>{cel.text}</text></box> : null}
320
324
  {dm ? <box position="absolute" top={-1} left={0}><text fg="#FF4081">{dm}</text></box> : null}
325
+ {zzz() ? <box position="absolute" top={-1} left={0}><text fg={flashColor() ?? fg}>{zzz()}</text></box> : null}
321
326
  {lines.map((line: string) => (
322
327
  <text fg={flashColor() ?? fg}>{line}</text>
323
328
  ))}
@@ -340,12 +345,25 @@ export function createAnimatedRenderer(pack: MascotPack): {
340
345
 
341
346
  if (s === "thinking" || s === "busy") {
342
347
  stopFlash();
348
+ setZzz(null);
343
349
  flashTimer = setInterval(() => {
344
350
  setFlashColor(FLASH_COLORS[Math.floor(Math.random() * FLASH_COLORS.length)]);
345
351
  }, 120);
346
352
  } else {
347
353
  stopFlash();
348
354
  }
355
+
356
+ if (s === "sleeping") {
357
+ let phase = 1;
358
+ setZzz("Z");
359
+ zzzTimer = setInterval(() => {
360
+ phase = (phase % 3) + 1;
361
+ setZzz("Z" + "z".repeat(phase - 1));
362
+ }, 1500);
363
+ } else {
364
+ if (zzzTimer) { clearInterval(zzzTimer); zzzTimer = null; }
365
+ setZzz(null);
366
+ }
349
367
  };
350
368
 
351
369
  const toggleWalk = () => {