@mingxy/opencode-mascot 0.4.22 → 0.4.24

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.22",
3
+ "version": "0.4.24",
4
4
  "description": "OpenCode TUI mascot plugin framework - customizable ASCII mascots for your terminal",
5
5
  "author": "mingxy",
6
6
  "license": "MIT",
@@ -187,8 +187,12 @@ export function SidebarMascot(props: SidebarMascotProps): JSX.Element {
187
187
 
188
188
  return (
189
189
  <box
190
- overflow="hidden"
191
- width="100%"
190
+ position="absolute"
191
+ left={posX()}
192
+ top={posY()}
193
+ alignItems="center"
194
+ zIndex={zBoost() ? 9999 : 100}
195
+ flexDirection="column"
192
196
  ref={(node: any) => {
193
197
  if (node) {
194
198
  setContainerWidth(node.width || 0);
@@ -199,54 +203,45 @@ export function SidebarMascot(props: SidebarMascotProps): JSX.Element {
199
203
  }
200
204
  }
201
205
  }}
206
+ onMouseDown={(e: any) => {
207
+ if (hideSide) { returnToView(); return; }
208
+
209
+ const now = Date.now();
210
+ if (now - lastClickTime < 300) {
211
+ switchToNext();
212
+ lastClickTime = 0;
213
+ return;
214
+ }
215
+ lastClickTime = now;
216
+
217
+ if (e.modifiers?.alt) {
218
+ dragStartX = e.x;
219
+ dragStartY = e.y;
220
+ dragAnchorX = posX();
221
+ dragAnchorY = posY();
222
+ isDragging = true;
223
+ renderers[currentName()].setDragging(true);
224
+ props.api.renderer.clearSelection();
225
+ }
226
+ }}
227
+ onMouseDrag={(e: any) => {
228
+ if (e.modifiers?.alt && isDragging) {
229
+ setPosX(clampX(dragAnchorX + (e.x - dragStartX)));
230
+ setPosY(clampY(dragAnchorY + (e.y - dragStartY)));
231
+ }
232
+ }}
233
+ onMouseUp={() => {
234
+ isDragging = false;
235
+ renderers[currentName()].setDragging(false);
236
+ checkEdge();
237
+ }}
238
+ onMouseDragEnd={() => {
239
+ isDragging = false;
240
+ renderers[currentName()].setDragging(false);
241
+ checkEdge();
242
+ }}
202
243
  >
203
- <box
204
- position="absolute"
205
- left={posX()}
206
- top={posY()}
207
- alignItems="center"
208
- zIndex={zBoost() ? 9999 : 100}
209
- flexDirection="column"
210
- onMouseDown={(e: any) => {
211
- if (hideSide) { returnToView(); return; }
212
-
213
- const now = Date.now();
214
- if (now - lastClickTime < 300) {
215
- switchToNext();
216
- lastClickTime = 0;
217
- return;
218
- }
219
- lastClickTime = now;
220
-
221
- if (e.modifiers?.alt) {
222
- dragStartX = e.x;
223
- dragStartY = e.y;
224
- dragAnchorX = posX();
225
- dragAnchorY = posY();
226
- isDragging = true;
227
- renderers[currentName()].setDragging(true);
228
- props.api.renderer.clearSelection();
229
- }
230
- }}
231
- onMouseDrag={(e: any) => {
232
- if (e.modifiers?.alt && isDragging) {
233
- setPosX(clampX(dragAnchorX + (e.x - dragStartX)));
234
- setPosY(clampY(dragAnchorY + (e.y - dragStartY)));
235
- }
236
- }}
237
- onMouseUp={() => {
238
- isDragging = false;
239
- renderers[currentName()].setDragging(false);
240
- checkEdge();
241
- }}
242
- onMouseDragEnd={() => {
243
- isDragging = false;
244
- renderers[currentName()].setDragging(false);
245
- checkEdge();
246
- }}
247
- >
248
- {renderers[currentName()]?.element() ?? null}
249
- </box>
244
+ {renderers[currentName()]?.element() ?? null}
250
245
  </box>
251
246
  );
252
247
  }