@trustquery/browser 0.3.1 → 0.3.3

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.
@@ -3566,6 +3566,69 @@ class AttachmentManager {
3566
3566
  // Update metadata
3567
3567
  attachment.metadata.headers = headers;
3568
3568
 
3569
+ // Re-scan headers for matches
3570
+ const newMatches = this.scanCSVHeaders(headers);
3571
+ attachment.matches = newMatches;
3572
+
3573
+ // Update icon visibility based on matches
3574
+ if (attachment.wrapper) {
3575
+ const iconPlaceholder = attachment.wrapper.querySelector('.tq-attachment-icon-placeholder');
3576
+ const existingIcon = iconPlaceholder?.querySelector('.tq-attachment-icon');
3577
+
3578
+ if (newMatches.length === 0 && existingIcon) {
3579
+ // No more matches - remove the icon and collapse placeholder
3580
+ existingIcon.remove();
3581
+
3582
+ // Collapse the icon placeholder by setting width to 0
3583
+ if (iconPlaceholder) {
3584
+ iconPlaceholder.style.width = '0';
3585
+ iconPlaceholder.style.minWidth = '0';
3586
+ }
3587
+
3588
+ if (this.options.debug) {
3589
+ console.log('[AttachmentManager] Removed warning icon - all warnings resolved');
3590
+ }
3591
+ } else if (newMatches.length > 0 && !existingIcon) {
3592
+ // New matches appeared - add icon and expand placeholder
3593
+ const match = newMatches[0];
3594
+ const messageState = match.intent?.handler?.['message-state'] || 'warning';
3595
+ const iconMap = {
3596
+ 'error': 'trustquery-error.svg',
3597
+ 'warning': 'trustquery-warning.svg',
3598
+ 'info': 'trustquery-info.svg'
3599
+ };
3600
+
3601
+ // Expand the icon placeholder back to normal width
3602
+ if (iconPlaceholder) {
3603
+ iconPlaceholder.style.width = '24px';
3604
+ iconPlaceholder.style.minWidth = '24px';
3605
+ }
3606
+
3607
+ const icon = document.createElement('img');
3608
+ icon.className = 'tq-attachment-icon';
3609
+ icon.src = `./assets/${iconMap[messageState] || iconMap.warning}`;
3610
+ icon.title = `CSV column ${messageState} - click to review`;
3611
+
3612
+ // Handle icon click
3613
+ icon.addEventListener('mousedown', (e) => {
3614
+ e.preventDefault();
3615
+ e.stopPropagation();
3616
+ this.handleWarningClick(icon, newMatches, attachment.wrapper, fileName);
3617
+ });
3618
+
3619
+ // Apply styles if styleManager exists
3620
+ if (this.options.styleManager) {
3621
+ this.options.styleManager.applyIconStyles(icon);
3622
+ }
3623
+
3624
+ iconPlaceholder?.appendChild(icon);
3625
+
3626
+ if (this.options.debug) {
3627
+ console.log('[AttachmentManager] Added warning icon - new warnings detected');
3628
+ }
3629
+ }
3630
+ }
3631
+
3569
3632
  if (this.options.debug) {
3570
3633
  console.log('[AttachmentManager] Updated CSV column', colIndex, 'to', headers[colIndex]);
3571
3634
  }
@@ -3768,7 +3831,8 @@ class AttachmentStyleManager {
3768
3831
  display: 'flex',
3769
3832
  alignItems: 'center',
3770
3833
  justifyContent: 'center',
3771
- flexShrink: '0'
3834
+ flexShrink: '0',
3835
+ transition: 'width 0.3s ease, min-width 0.3s ease'
3772
3836
  });
3773
3837
  }
3774
3838