@luckydraw/cumulus 0.27.16 → 0.27.18
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/dist/gateway/static/widget.js +82 -20
- package/package.json +1 -1
|
@@ -720,16 +720,32 @@
|
|
|
720
720
|
'.cumulus-panel-action-btn:hover { color: #ddd; border-color: #555; }',
|
|
721
721
|
'.cumulus-panel-action-btn.active { color: #e0e0e0; border-color: #0066cc; background: rgba(0,102,204,0.12); }',
|
|
722
722
|
|
|
723
|
-
/* ──
|
|
724
|
-
'.cumulus-
|
|
725
|
-
'
|
|
726
|
-
'
|
|
727
|
-
'
|
|
728
|
-
'
|
|
729
|
-
'
|
|
723
|
+
/* ── Context menu (right-click on thread) ── */
|
|
724
|
+
'.cumulus-context-menu {',
|
|
725
|
+
' position: fixed; z-index: 300; background: #2a2a2a; border: 1px solid #444;',
|
|
726
|
+
' border-radius: 6px; padding: 4px 0; min-width: 140px;',
|
|
727
|
+
' box-shadow: 0 4px 12px rgba(0,0,0,0.5); font-size: 13px;',
|
|
728
|
+
'}',
|
|
729
|
+
'.cumulus-context-menu-item {',
|
|
730
|
+
' padding: 6px 14px; color: #ccc; cursor: pointer; display: block;',
|
|
731
|
+
' width: 100%; border: none; background: none; text-align: left;',
|
|
732
|
+
' font-family: inherit; font-size: inherit;',
|
|
733
|
+
'}',
|
|
734
|
+
'.cumulus-context-menu-item:hover { background: #3a3a3a; color: #fff; }',
|
|
735
|
+
'.cumulus-context-menu-item.danger { color: #ef4444; }',
|
|
736
|
+
'.cumulus-context-menu-item.danger:hover { background: rgba(239,68,68,0.15); color: #ff6b6b; }',
|
|
737
|
+
|
|
738
|
+
/* ── Unread dot (glowing) ── */
|
|
739
|
+
'.cumulus-thread-unread {',
|
|
740
|
+
' width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;',
|
|
741
|
+
' background: #3b82f6;',
|
|
742
|
+
' box-shadow: 0 0 4px #3b82f6, 0 0 8px rgba(59,130,246,0.4);',
|
|
743
|
+
' animation: cumulus-unread-pulse 2s ease-in-out infinite;',
|
|
744
|
+
'}',
|
|
745
|
+
'@keyframes cumulus-unread-pulse {',
|
|
746
|
+
' 0%, 100% { box-shadow: 0 0 4px #3b82f6, 0 0 8px rgba(59,130,246,0.4); }',
|
|
747
|
+
' 50% { box-shadow: 0 0 6px #3b82f6, 0 0 14px rgba(59,130,246,0.6); }',
|
|
730
748
|
'}',
|
|
731
|
-
'.cumulus-thread-item:hover .cumulus-thread-delete-btn { display: block; }',
|
|
732
|
-
'.cumulus-thread-delete-btn:hover { color: #ef4444; background: rgba(239,68,68,0.1); }',
|
|
733
749
|
|
|
734
750
|
/* ── Message checkbox (selection mode) ── */
|
|
735
751
|
'.cumulus-msg-checkbox {',
|
|
@@ -2201,6 +2217,9 @@
|
|
|
2201
2217
|
// Thread list from server: [{ name, messageCount, lastActivity }]
|
|
2202
2218
|
var allThreads = [];
|
|
2203
2219
|
|
|
2220
|
+
// Unread threads: threadName -> true
|
|
2221
|
+
var unreadThreads = {};
|
|
2222
|
+
|
|
2204
2223
|
// Currently visible panel names (ordered, max 3)
|
|
2205
2224
|
var visibleThreads = [];
|
|
2206
2225
|
|
|
@@ -2484,7 +2503,9 @@
|
|
|
2484
2503
|
item.setAttribute('data-thread-name', name);
|
|
2485
2504
|
|
|
2486
2505
|
var dot = document.createElement('span');
|
|
2487
|
-
dot.className =
|
|
2506
|
+
dot.className = unreadThreads[name]
|
|
2507
|
+
? 'cumulus-thread-unread'
|
|
2508
|
+
: 'cumulus-thread-dot ' + (isActive ? 'active' : 'inactive');
|
|
2488
2509
|
item.appendChild(dot);
|
|
2489
2510
|
|
|
2490
2511
|
var nameEl = document.createElement('span');
|
|
@@ -2507,17 +2528,12 @@
|
|
|
2507
2528
|
item.appendChild(countEl);
|
|
2508
2529
|
}
|
|
2509
2530
|
|
|
2510
|
-
//
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
deleteBtn.setAttribute('title', 'Delete thread');
|
|
2514
|
-
deleteBtn.setAttribute('data-testid', 'webchat-thread-delete');
|
|
2515
|
-
deleteBtn.textContent = '\u2715';
|
|
2516
|
-
deleteBtn.addEventListener('click', function (e) {
|
|
2531
|
+
// Right-click context menu
|
|
2532
|
+
item.addEventListener('contextmenu', function (e) {
|
|
2533
|
+
e.preventDefault();
|
|
2517
2534
|
e.stopPropagation();
|
|
2518
|
-
|
|
2535
|
+
showThreadContextMenu(name, e.clientX, e.clientY);
|
|
2519
2536
|
});
|
|
2520
|
-
item.appendChild(deleteBtn);
|
|
2521
2537
|
|
|
2522
2538
|
item.addEventListener('click', function (e) {
|
|
2523
2539
|
var multiSelect = e.metaKey || e.ctrlKey;
|
|
@@ -2531,8 +2547,48 @@
|
|
|
2531
2547
|
return item;
|
|
2532
2548
|
}
|
|
2533
2549
|
|
|
2550
|
+
// ── Thread context menu (right-click) ──
|
|
2551
|
+
function dismissContextMenu() {
|
|
2552
|
+
var existing = document.querySelector('.cumulus-context-menu');
|
|
2553
|
+
if (existing) existing.remove();
|
|
2554
|
+
document.removeEventListener('click', dismissContextMenu);
|
|
2555
|
+
document.removeEventListener('contextmenu', dismissContextMenu);
|
|
2556
|
+
}
|
|
2557
|
+
|
|
2558
|
+
function showThreadContextMenu(threadName, x, y) {
|
|
2559
|
+
dismissContextMenu();
|
|
2560
|
+
|
|
2561
|
+
var menu = document.createElement('div');
|
|
2562
|
+
menu.className = 'cumulus-context-menu';
|
|
2563
|
+
menu.style.left = x + 'px';
|
|
2564
|
+
menu.style.top = y + 'px';
|
|
2565
|
+
|
|
2566
|
+
var deleteItem = document.createElement('button');
|
|
2567
|
+
deleteItem.className = 'cumulus-context-menu-item danger';
|
|
2568
|
+
deleteItem.textContent = 'Delete thread';
|
|
2569
|
+
deleteItem.setAttribute('data-testid', 'webchat-thread-delete');
|
|
2570
|
+
deleteItem.addEventListener('click', function () {
|
|
2571
|
+
dismissContextMenu();
|
|
2572
|
+
showThreadDeleteConfirm(threadName);
|
|
2573
|
+
});
|
|
2574
|
+
menu.appendChild(deleteItem);
|
|
2575
|
+
|
|
2576
|
+
document.body.appendChild(menu);
|
|
2577
|
+
|
|
2578
|
+
// Clamp to viewport
|
|
2579
|
+
var rect = menu.getBoundingClientRect();
|
|
2580
|
+
if (rect.right > window.innerWidth) menu.style.left = (window.innerWidth - rect.width - 4) + 'px';
|
|
2581
|
+
if (rect.bottom > window.innerHeight) menu.style.top = (window.innerHeight - rect.height - 4) + 'px';
|
|
2582
|
+
|
|
2583
|
+
// Dismiss on next click or right-click anywhere
|
|
2584
|
+
setTimeout(function () {
|
|
2585
|
+
document.addEventListener('click', dismissContextMenu);
|
|
2586
|
+
document.addEventListener('contextmenu', dismissContextMenu);
|
|
2587
|
+
}, 0);
|
|
2588
|
+
}
|
|
2589
|
+
|
|
2534
2590
|
// ── Thread delete confirmation ──
|
|
2535
|
-
function showThreadDeleteConfirm(threadName
|
|
2591
|
+
function showThreadDeleteConfirm(threadName) {
|
|
2536
2592
|
// Remove any existing confirm dialogs
|
|
2537
2593
|
var existing = document.querySelector('.cumulus-confirm-dialog[data-context="thread-delete"]');
|
|
2538
2594
|
if (existing) {
|
|
@@ -2602,6 +2658,7 @@
|
|
|
2602
2658
|
|
|
2603
2659
|
// ── Panel management ──
|
|
2604
2660
|
function soloThread(name) {
|
|
2661
|
+
delete unreadThreads[name];
|
|
2605
2662
|
visibleThreads = [name];
|
|
2606
2663
|
renderSidebar();
|
|
2607
2664
|
renderContentArea();
|
|
@@ -2610,6 +2667,7 @@
|
|
|
2610
2667
|
}
|
|
2611
2668
|
|
|
2612
2669
|
function togglePanelThread(name) {
|
|
2670
|
+
delete unreadThreads[name];
|
|
2613
2671
|
// On mobile, always solo (no side-by-side)
|
|
2614
2672
|
if (isMobile()) {
|
|
2615
2673
|
soloThread(name);
|
|
@@ -3828,6 +3886,10 @@
|
|
|
3828
3886
|
break;
|
|
3829
3887
|
}
|
|
3830
3888
|
}
|
|
3889
|
+
// Mark unread if thread is not currently visible
|
|
3890
|
+
if (visibleThreads.indexOf(threadName) === -1) {
|
|
3891
|
+
unreadThreads[threadName] = true;
|
|
3892
|
+
}
|
|
3831
3893
|
// Re-render sidebar to reflect new sort order / move thread up
|
|
3832
3894
|
renderSidebar();
|
|
3833
3895
|
}
|