bloby-bot 0.18.1 → 0.18.2

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": "bloby-bot",
3
- "version": "0.18.1",
3
+ "version": "0.18.2",
4
4
  "releaseNotes": [
5
5
  "1. react router implemented",
6
6
  "2. new workspace design",
@@ -63,6 +63,12 @@
63
63
  var BUBBLE_SIZE = 60;
64
64
  var BUBBLE_MARGIN = 24;
65
65
 
66
+ // ── Badge element (HTML, not canvas — avoids border-radius clipping) ──
67
+ var badgeEl = document.createElement('div');
68
+ badgeEl.id = 'bloby-widget-badge';
69
+ badgeEl.style.cssText = 'display:none;position:fixed;bottom:' + (BUBBLE_MARGIN + BUBBLE_SIZE - 14) + 'px;right:' + (BUBBLE_MARGIN - 5) + 'px;z-index:99999;min-width:20px;height:20px;border-radius:10px;background:#F04D68;color:#fff;font:bold 11px -apple-system,BlinkMacSystemFont,sans-serif;text-align:center;line-height:20px;padding:0 5px;box-sizing:border-box;pointer-events:none;';
70
+ document.body.appendChild(badgeEl);
71
+
66
72
  // ══════════════════════════════════════════════════════════════════
67
73
  // ── Headphones Sprite Sheet Config ───────────────────────────────
68
74
  // ══════════════════════════════════════════════════════════════════
@@ -389,23 +395,13 @@
389
395
  ctx.restore();
390
396
  }
391
397
 
392
- function drawBadge() {
393
- if (unreadCount <= 0 || canvasPhase !== 'bubble') return;
394
- var text = unreadCount > 9 ? '9+' : String(unreadCount);
395
- var size = 18;
396
- var x = W - size / 2 - 1;
397
- var y = size / 2 + 1;
398
-
399
- ctx.beginPath();
400
- ctx.arc(x, y, size / 2, 0, Math.PI * 2);
401
- ctx.fillStyle = '#F04D68';
402
- ctx.fill();
403
-
404
- ctx.fillStyle = '#fff';
405
- ctx.font = 'bold 11px -apple-system, BlinkMacSystemFont, sans-serif';
406
- ctx.textAlign = 'center';
407
- ctx.textBaseline = 'middle';
408
- ctx.fillText(text, x, y + 0.5);
398
+ function updateBadge() {
399
+ if (unreadCount <= 0 || canvasPhase !== 'bubble' || isOpen) {
400
+ badgeEl.style.display = 'none';
401
+ return;
402
+ }
403
+ badgeEl.textContent = unreadCount > 9 ? '9+' : String(unreadCount);
404
+ badgeEl.style.display = 'block';
409
405
  }
410
406
 
411
407
  function draw(now) {
@@ -433,8 +429,6 @@
433
429
  } else {
434
430
  drawBlobFrame(currentFrame, center.x, center.y);
435
431
  }
436
-
437
- drawBadge();
438
432
  }
439
433
 
440
434
  // ── Animation loop ──
@@ -452,6 +446,7 @@
452
446
 
453
447
  function enterHpCanvasMode() {
454
448
  canvasPhase = 'headphones';
449
+ badgeEl.style.display = 'none';
455
450
  // Expand canvas, keeping center roughly aligned with the bubble center
456
451
  var bubbleCenterFromRight = BUBBLE_MARGIN + BUBBLE_SIZE / 2;
457
452
  var bubbleCenterFromBottom = BUBBLE_MARGIN + BUBBLE_SIZE / 2;
@@ -764,6 +759,7 @@
764
759
  backdrop.classList.toggle('open', isOpen);
765
760
  canvas.style.display = isOpen ? 'none' : 'block';
766
761
  if (isOpen) unreadCount = 0;
762
+ updateBadge();
767
763
  }
768
764
 
769
765
  // ── Bubble pointer handlers (tap → open panel, long-press → headphones mic) ──
@@ -845,6 +841,7 @@
845
841
  // New message from agent — badge the bubble if panel is closed
846
842
  if (e.data.type === 'bloby:new-message' && !isOpen) {
847
843
  unreadCount++;
844
+ updateBadge();
848
845
  }
849
846
 
850
847
  if (e.data.type === 'bloby:install-app') {