@mingxy/opencode-mascot 0.2.9 → 0.3.0
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
|
@@ -81,17 +81,18 @@ export function HomeMascot(props: HomeMascotProps): JSX.Element {
|
|
|
81
81
|
setPosX(dragAnchorX + (e.x - dragStartX));
|
|
82
82
|
setPosY(dragAnchorY + (e.y - dragStartY));
|
|
83
83
|
e.preventDefault();
|
|
84
|
-
e.stopPropagation();
|
|
85
84
|
props.api.renderer.clearSelection();
|
|
86
85
|
}
|
|
87
86
|
}}
|
|
88
87
|
onMouseUp={() => {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
renderers[currentName()].setDragging(false);
|
|
92
|
-
}
|
|
88
|
+
isDragging = false;
|
|
89
|
+
renderers[currentName()].setDragging(false);
|
|
93
90
|
}}
|
|
94
91
|
onMouseDragEnd={() => {
|
|
92
|
+
isDragging = false;
|
|
93
|
+
renderers[currentName()].setDragging(false);
|
|
94
|
+
}}
|
|
95
|
+
onMouseOut={() => {
|
|
95
96
|
if (isDragging) {
|
|
96
97
|
isDragging = false;
|
|
97
98
|
renderers[currentName()].setDragging(false);
|
|
@@ -226,22 +226,23 @@ export function SidebarMascot(props: SidebarMascotProps): JSX.Element {
|
|
|
226
226
|
setPosX(clampX(dragAnchorX + (e.x - dragStartX)));
|
|
227
227
|
setPosY(clampY(dragAnchorY + (e.y - dragStartY)));
|
|
228
228
|
e.preventDefault();
|
|
229
|
-
e.stopPropagation();
|
|
230
229
|
props.api.renderer.clearSelection();
|
|
231
230
|
}
|
|
232
231
|
}}
|
|
233
232
|
onMouseUp={() => {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
checkEdge();
|
|
238
|
-
}
|
|
233
|
+
isDragging = false;
|
|
234
|
+
renderers[currentName()].setDragging(false);
|
|
235
|
+
checkEdge();
|
|
239
236
|
}}
|
|
240
237
|
onMouseDragEnd={() => {
|
|
238
|
+
isDragging = false;
|
|
239
|
+
renderers[currentName()].setDragging(false);
|
|
240
|
+
checkEdge();
|
|
241
|
+
}}
|
|
242
|
+
onMouseOut={() => {
|
|
241
243
|
if (isDragging) {
|
|
242
244
|
isDragging = false;
|
|
243
245
|
renderers[currentName()].setDragging(false);
|
|
244
|
-
checkEdge();
|
|
245
246
|
}
|
|
246
247
|
}}
|
|
247
248
|
>
|
|
@@ -44,16 +44,6 @@ function getFrameLines(pack: MascotPack, frameName: string): string[] {
|
|
|
44
44
|
return frames[frameName] ?? frames["default"] ?? [];
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
function renderLines(lines: string[], fg?: string): JSX.Element {
|
|
48
|
-
return (
|
|
49
|
-
<box flexDirection="column">
|
|
50
|
-
{lines.map((line: string) => (
|
|
51
|
-
<text fg={fg}>{line}</text>
|
|
52
|
-
))}
|
|
53
|
-
</box>
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
47
|
export function createAnimatedRenderer(pack: MascotPack): {
|
|
58
48
|
element: () => JSX.Element;
|
|
59
49
|
setState: (s: MascotState) => void;
|
|
@@ -297,13 +287,16 @@ export function createAnimatedRenderer(pack: MascotPack): {
|
|
|
297
287
|
const left = offset > 0 ? offset : 0;
|
|
298
288
|
const cel = celebrate();
|
|
299
289
|
const dm = dragMsg();
|
|
300
|
-
const color = flashColor() ?? fg;
|
|
301
290
|
|
|
302
291
|
return (
|
|
303
292
|
<box flexDirection="column" left={left} top={top}>
|
|
304
|
-
{cel ? <text fg={
|
|
293
|
+
{cel ? <text fg={flashColor() ?? fg}>{cel.text}</text> : null}
|
|
305
294
|
{dm ? <text fg="#FF4081">{dm}</text> : null}
|
|
306
|
-
|
|
295
|
+
<box flexDirection="column">
|
|
296
|
+
{lines.map((line: string) => (
|
|
297
|
+
<text fg={flashColor() ?? fg}>{line}</text>
|
|
298
|
+
))}
|
|
299
|
+
</box>
|
|
307
300
|
</box>
|
|
308
301
|
);
|
|
309
302
|
};
|
|
@@ -353,9 +346,14 @@ export function createAnimatedRenderer(pack: MascotPack): {
|
|
|
353
346
|
dragMsgTimer = setInterval(() => {
|
|
354
347
|
setDragMsg(DRAG_MSGS[Math.floor(Math.random() * DRAG_MSGS.length)]);
|
|
355
348
|
}, 800);
|
|
349
|
+
stopFlash();
|
|
350
|
+
flashTimer = setInterval(() => {
|
|
351
|
+
setFlashColor(FLASH_COLORS[Math.floor(Math.random() * FLASH_COLORS.length)]);
|
|
352
|
+
}, 100);
|
|
356
353
|
} else {
|
|
357
354
|
setJumpOffset(0);
|
|
358
355
|
stopDragMsg();
|
|
356
|
+
stopFlash();
|
|
359
357
|
}
|
|
360
358
|
};
|
|
361
359
|
|