@customviews-js/customviews 1.1.4 → 1.1.5

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.
@@ -368,10 +368,17 @@ const TABGROUP_SELECTOR = 'cv-tabgroup';
368
368
  const TAB_SELECTOR = 'cv-tab';
369
369
  const NAV_AUTO_SELECTOR = 'cv-tabgroup[nav="auto"], cv-tabgroup:not([nav])';
370
370
  const NAV_CONTAINER_CLASS = 'cv-tabs-nav';
371
- /**
372
- * TabManager handles discovery, visibility, and navigation for tab groups and tabs
373
- */
371
+ const NAV_HIDE_ROOT_CLASS = 'cv-hide-tab-navs';
372
+ const NAV_HIDDEN_CLASS = 'cv-tabs-nav-hidden';
374
373
  class TabManager {
374
+ /**
375
+ * Split a tab ID into multiple IDs if it contains spaces or |
376
+ */
377
+ static splitTabIds(tabId) {
378
+ const splitIds = tabId.split(/[\s|]+/).filter(id => id.trim() !== '');
379
+ const trimmedIds = splitIds.map(id => id.trim());
380
+ return trimmedIds;
381
+ }
375
382
  /**
376
383
  * Apply tab selections to all tab groups in the DOM
377
384
  */
@@ -383,22 +390,26 @@ class TabManager {
383
390
  if (!groupId)
384
391
  return;
385
392
  // Determine the active tab for this group
386
- const activeTabId = this.resolveActiveTab(groupId, tabs, cfgGroups, groupEl);
393
+ const activeTabId = this.resolveActiveTabForGroup(groupId, tabs, cfgGroups, groupEl);
387
394
  // Apply visibility to direct child cv-tab elements only (not nested ones)
388
395
  const tabElements = Array.from(groupEl.children).filter((child) => child.tagName.toLowerCase() === TAB_SELECTOR);
389
396
  tabElements.forEach((tabEl) => {
390
397
  const tabId = tabEl.getAttribute('id');
391
398
  if (!tabId)
392
399
  return;
393
- const isActive = tabId === activeTabId;
400
+ // Split IDs and check if any match the active tab
401
+ const splitIds = this.splitTabIds(tabId);
402
+ const isActive = splitIds.includes(activeTabId || '');
394
403
  this.applyTabVisibility(tabEl, isActive);
395
404
  });
396
405
  });
397
406
  }
398
407
  /**
399
408
  * Resolve the active tab for a group based on state, config, and DOM
409
+ *
410
+ * Pass in the current tabs state, config groups, and the group element
400
411
  */
401
- static resolveActiveTab(groupId, tabs, cfgGroups, groupEl) {
412
+ static resolveActiveTabForGroup(groupId, tabs, cfgGroups, groupEl) {
402
413
  // 1. Check state
403
414
  if (tabs[groupId]) {
404
415
  return tabs[groupId];
@@ -420,7 +431,8 @@ class TabManager {
420
431
  // 3. Fallback to first direct cv-tab child in DOM
421
432
  const firstTab = Array.from(groupEl.children).find((child) => child.tagName.toLowerCase() === TAB_SELECTOR);
422
433
  if (firstTab) {
423
- return firstTab.getAttribute('id');
434
+ const splitIds = this.splitTabIds(firstTab.getAttribute('id') || '');
435
+ return splitIds[0] || null;
424
436
  }
425
437
  return null;
426
438
  }
@@ -440,7 +452,7 @@ class TabManager {
440
452
  /**
441
453
  * Build navigation for tab groups with nav="auto" (one-time setup)
442
454
  */
443
- static buildNavs(rootEl, cfgGroups, onTabClick) {
455
+ static buildNavs(rootEl, cfgGroups, onTabClick, onTabDoubleClick) {
444
456
  // Find all cv-tabgroup elements with nav="auto" or no nav attribute
445
457
  const tabGroups = rootEl.querySelectorAll(NAV_AUTO_SELECTOR);
446
458
  // Check if any tab headers contain Font Awesome shortcodes
@@ -451,11 +463,14 @@ class TabManager {
451
463
  if (!groupId)
452
464
  return;
453
465
  const tabElements = Array.from(groupEl.children).filter((child) => child.tagName.toLowerCase() === 'cv-tab');
466
+ // Check for Font Awesome shortcodes in tab headers
454
467
  tabElements.forEach((tabEl) => {
455
468
  const tabId = tabEl.getAttribute('id');
456
469
  if (!tabId)
457
470
  return;
458
- const header = tabEl.getAttribute('header') || this.getTabLabel(tabId, groupId, cfgGroups) || tabId;
471
+ const splitIds = this.splitTabIds(tabId);
472
+ const firstId = splitIds[0] || tabId;
473
+ const header = tabEl.getAttribute('header') || this.getTabLabel(firstId, groupId, cfgGroups) || firstId || '';
459
474
  if (/:fa-[\w-]+:/.test(header)) {
460
475
  hasFontAwesomeShortcodes = true;
461
476
  }
@@ -481,41 +496,90 @@ class TabManager {
481
496
  navContainer = document.createElement('ul');
482
497
  navContainer.className = `${NAV_CONTAINER_CLASS} nav-tabs`;
483
498
  navContainer.setAttribute('role', 'tablist');
499
+ // Respect viewer preference on the root to show/hide navs
500
+ const showNavs = !rootEl.classList.contains(NAV_HIDE_ROOT_CLASS);
501
+ if (!showNavs) {
502
+ navContainer.classList.add(NAV_HIDDEN_CLASS);
503
+ navContainer.setAttribute('aria-hidden', 'true');
504
+ }
505
+ else {
506
+ navContainer.setAttribute('aria-hidden', 'false');
507
+ }
484
508
  groupEl.insertBefore(navContainer, groupEl.firstChild);
485
509
  // Build nav items
486
510
  tabElements.forEach((tabEl) => {
487
511
  const tabId = tabEl.getAttribute('id');
488
512
  if (!tabId)
489
513
  return;
490
- const header = tabEl.getAttribute('header') || this.getTabLabel(tabId, groupId, cfgGroups) || tabId;
491
- const listItem = document.createElement('li');
492
- listItem.className = 'nav-item';
493
- const navLink = document.createElement('a');
494
- navLink.className = 'nav-link';
495
- // Replace icon shortcodes in header
496
- navLink.innerHTML = replaceIconShortcodes(header);
497
- navLink.href = '#';
498
- navLink.setAttribute('data-tab-id', tabId);
499
- navLink.setAttribute('data-group-id', groupId);
500
- navLink.setAttribute('role', 'tab');
501
- // Check if this tab is currently active
502
- const isActive = tabEl.classList.contains('cv-visible');
503
- if (isActive) {
504
- navLink.classList.add('active');
505
- navLink.setAttribute('aria-selected', 'true');
514
+ const splitIds = this.splitTabIds(tabId);
515
+ // Header demarcation: if header contains |, split and use per tab.
516
+ // If header attribute is present and not demarcated, use it as the fallback header.
517
+ const headerAttr = tabEl.getAttribute('header') || '';
518
+ let headerParts = [];
519
+ if (headerAttr && headerAttr.includes('|')) {
520
+ headerParts = headerAttr.split('|').map(h => h.trim());
506
521
  }
507
- else {
508
- navLink.setAttribute('aria-selected', 'false');
522
+ const firstId = splitIds[0] || tabId;
523
+ let fallbackHeader = '';
524
+ if (headerAttr && !headerAttr.includes('|')) {
525
+ // Single header provided on the element: use for all split IDs
526
+ fallbackHeader = headerAttr;
509
527
  }
510
- // Add click handler
511
- if (onTabClick) {
512
- navLink.addEventListener('click', (e) => {
513
- e.preventDefault();
514
- onTabClick(groupId, tabId);
515
- });
528
+ else {
529
+ // No header attribute or multi-part header: use config label or id as fallback
530
+ fallbackHeader = this.getTabLabel(firstId, groupId, cfgGroups) || firstId || '';
516
531
  }
517
- listItem.appendChild(navLink);
518
- navContainer.appendChild(listItem);
532
+ // Create nav links for each split ID
533
+ splitIds.forEach((splitId, idx) => {
534
+ const listItem = document.createElement('li');
535
+ listItem.className = 'nav-item';
536
+ const navLink = document.createElement('a');
537
+ navLink.className = 'nav-link';
538
+ // Use demarcated header if available, else prefer config label for this specific splitId
539
+ let header = fallbackHeader;
540
+ if (headerParts.length === splitIds.length) {
541
+ header = headerParts[idx] ?? fallbackHeader;
542
+ }
543
+ else if (!headerAttr || headerAttr.includes('|')) {
544
+ // Prefer the config label for the individual splitId over using firstId
545
+ header = this.getTabLabel(splitId, groupId, cfgGroups) || splitId || '';
546
+ }
547
+ navLink.innerHTML = replaceIconShortcodes(header);
548
+ navLink.href = '#';
549
+ navLink.setAttribute('data-tab-id', splitId);
550
+ navLink.setAttribute('data-group-id', groupId);
551
+ navLink.setAttribute('role', 'tab');
552
+ // Check if this split ID is active (same logic as applySelections)
553
+ const activeTabId = this.resolveActiveTabForGroup(groupId, {}, cfgGroups, groupEl); // Pass empty tabs for initial state
554
+ const isActive = splitIds.includes(activeTabId || '');
555
+ if (isActive) {
556
+ navLink.classList.add('active');
557
+ navLink.setAttribute('aria-selected', 'true');
558
+ }
559
+ else {
560
+ navLink.setAttribute('aria-selected', 'false');
561
+ }
562
+ // Add click handler for local tab switch
563
+ if (onTabClick) {
564
+ navLink.addEventListener('click', (e) => {
565
+ e.preventDefault();
566
+ // console.log("Single-click detected");
567
+ onTabClick(groupId, splitId, groupEl);
568
+ });
569
+ }
570
+ // Add double-click handler for sync
571
+ if (onTabDoubleClick) {
572
+ navLink.addEventListener('dblclick', (e) => {
573
+ e.preventDefault();
574
+ // console.log("Double-click detected");
575
+ onTabDoubleClick(groupId, splitId, groupEl);
576
+ });
577
+ }
578
+ // Add tooltip for UX feedback (use native title attribute)
579
+ navLink.setAttribute('title', 'Double click to change switch tabs across all groups');
580
+ listItem.appendChild(navLink);
581
+ navContainer.appendChild(listItem);
582
+ });
519
583
  });
520
584
  // Add bottom border line at the end of the tab group
521
585
  const bottomBorder = document.createElement('div');
@@ -523,6 +587,44 @@ class TabManager {
523
587
  groupEl.appendChild(bottomBorder);
524
588
  });
525
589
  }
590
+ /**
591
+ * Toggle nav visibility for all tab groups (viewer-controlled)
592
+ */
593
+ static setNavsVisibility(rootEl, visible) {
594
+ if (visible) {
595
+ rootEl.classList.remove(NAV_HIDE_ROOT_CLASS);
596
+ }
597
+ else {
598
+ rootEl.classList.add(NAV_HIDE_ROOT_CLASS);
599
+ }
600
+ const navContainers = rootEl.querySelectorAll(`.${NAV_CONTAINER_CLASS}`);
601
+ navContainers.forEach((nav) => {
602
+ if (visible) {
603
+ nav.classList.remove(NAV_HIDDEN_CLASS);
604
+ nav.setAttribute('aria-hidden', 'false');
605
+ }
606
+ else {
607
+ nav.classList.add(NAV_HIDDEN_CLASS);
608
+ nav.setAttribute('aria-hidden', 'true');
609
+ }
610
+ });
611
+ // Also hide/show the bottom border of tab groups
612
+ const bottomBorders = rootEl.querySelectorAll('.cv-tabgroup-bottom-border');
613
+ bottomBorders.forEach((border) => {
614
+ if (visible) {
615
+ border.classList.remove('cv-hidden');
616
+ }
617
+ else {
618
+ border.classList.add('cv-hidden');
619
+ }
620
+ });
621
+ }
622
+ /**
623
+ * Read current nav visibility (viewer preference)
624
+ */
625
+ static areNavsVisible(rootEl) {
626
+ return !rootEl.classList.contains(NAV_HIDE_ROOT_CLASS);
627
+ }
526
628
  /**
527
629
  * Get tab label from config
528
630
  */
@@ -536,23 +638,25 @@ class TabManager {
536
638
  return tabCfg?.label || null;
537
639
  }
538
640
  /**
539
- * Update active state in navs after selection change (single group)
641
+ * Update active state in navs for a specific tabgroup element only
540
642
  */
541
- static updateNavActiveState(rootEl, groupId, activeTabId) {
542
- const tabGroups = rootEl.querySelectorAll(`${TABGROUP_SELECTOR}[id="${groupId}"]`);
543
- tabGroups.forEach((groupEl) => {
544
- const navLinks = groupEl.querySelectorAll('.nav-link');
545
- navLinks.forEach((link) => {
546
- const tabId = link.getAttribute('data-tab-id');
547
- if (tabId === activeTabId) {
548
- link.classList.add('active');
549
- link.setAttribute('aria-selected', 'true');
550
- }
551
- else {
552
- link.classList.remove('active');
553
- link.setAttribute('aria-selected', 'false');
554
- }
555
- });
643
+ static updateNavActiveState(groupEl, activeTabId) {
644
+ const navLinks = groupEl.querySelectorAll('.nav-link');
645
+ navLinks.forEach((link) => {
646
+ const linkTabId = link.getAttribute('data-tab-id');
647
+ if (!linkTabId)
648
+ return;
649
+ // Check if activeTabId matches or is in the split IDs of this link
650
+ const splitIds = this.splitTabIds(linkTabId);
651
+ const isActive = linkTabId === activeTabId || splitIds.includes(activeTabId);
652
+ if (isActive) {
653
+ link.classList.add('active');
654
+ link.setAttribute('aria-selected', 'true');
655
+ }
656
+ else {
657
+ link.classList.remove('active');
658
+ link.setAttribute('aria-selected', 'false');
659
+ }
556
660
  });
557
661
  }
558
662
  /**
@@ -565,14 +669,19 @@ class TabManager {
565
669
  if (!groupId)
566
670
  return;
567
671
  // Determine the active tab for this group
568
- const activeTabId = this.resolveActiveTab(groupId, tabs, cfgGroups, groupEl);
672
+ const activeTabId = this.resolveActiveTabForGroup(groupId, tabs, cfgGroups, groupEl);
569
673
  if (!activeTabId)
570
674
  return;
571
675
  // Update nav links for this group
572
676
  const navLinks = groupEl.querySelectorAll('.nav-link');
573
677
  navLinks.forEach((link) => {
574
- const tabId = link.getAttribute('data-tab-id');
575
- if (tabId === activeTabId) {
678
+ const linkTabId = link.getAttribute('data-tab-id');
679
+ if (!linkTabId)
680
+ return;
681
+ // Check if activeTabId matches or is in the split IDs of this link
682
+ const splitIds = this.splitTabIds(linkTabId);
683
+ const isActive = linkTabId === activeTabId || splitIds.includes(activeTabId);
684
+ if (isActive) {
576
685
  link.classList.add('active');
577
686
  link.setAttribute('aria-selected', 'true');
578
687
  }
@@ -583,6 +692,47 @@ class TabManager {
583
692
  });
584
693
  });
585
694
  }
695
+ /**
696
+ * Apply tab selection to a specific tabgroup element only (not globally).
697
+ * Used for single-click behavior to update only the clicked tabgroup.
698
+ */
699
+ static applyTabLocalOnly(groupEl, activeTabId) {
700
+ const tabElements = Array.from(groupEl.children).filter((child) => child.tagName.toLowerCase() === TAB_SELECTOR);
701
+ tabElements.forEach((tabEl) => {
702
+ const tabId = tabEl.getAttribute('id');
703
+ if (!tabId)
704
+ return;
705
+ const splitIds = this.splitTabIds(tabId);
706
+ const isActive = splitIds.includes(activeTabId);
707
+ this.applyTabVisibility(tabEl, isActive);
708
+ });
709
+ }
710
+ /**
711
+ * Check if a tabgroup element contains a specific tab ID (respects split IDs).
712
+ * Accepts groupEl to avoid repeated DOM queries.
713
+ */
714
+ static groupHasTab(groupEl, tabId) {
715
+ const tabElements = Array.from(groupEl.children).filter((child) => child.tagName.toLowerCase() === TAB_SELECTOR);
716
+ return tabElements.some((tabEl) => {
717
+ const idAttr = tabEl.getAttribute('id') || '';
718
+ const splitIds = this.splitTabIds(idAttr);
719
+ return splitIds.includes(tabId);
720
+ });
721
+ }
722
+ /**
723
+ * Returns array of group elements to be synced (excluding source).
724
+ */
725
+ static getTabgroupsWithId(rootEl, sourceGroupId, tabId) {
726
+ const syncedGroupEls = [];
727
+ const allGroupEls = Array.from(rootEl.querySelectorAll(`${TABGROUP_SELECTOR}[id="${sourceGroupId}"]`));
728
+ allGroupEls.forEach((targetGroupEl) => {
729
+ // Only sync if target group actually contains this tab
730
+ if (this.groupHasTab(targetGroupEl, tabId)) {
731
+ syncedGroupEls.push(targetGroupEl);
732
+ }
733
+ });
734
+ return syncedGroupEls;
735
+ }
586
736
  }
587
737
 
588
738
  class AssetsManager {
@@ -837,6 +987,18 @@ cv-tabgroup {
837
987
  .cv-tab-content {
838
988
  padding: 1rem 0;
839
989
  }
990
+
991
+ /* Viewer-controlled nav visibility: hide nav containers when requested */
992
+ .cv-tabs-nav-hidden {
993
+ display: none !important;
994
+ }
995
+
996
+ /* Print-friendly: hide tab navigation when printing to reduce clutter */
997
+ @media print {
998
+ .cv-tabs-nav {
999
+ display: none !important;
1000
+ }
1001
+ }
840
1002
  `;
841
1003
 
842
1004
  /**
@@ -904,33 +1066,51 @@ class CustomViewsCore {
904
1066
  /**
905
1067
  * Set active tab for a group and apply state
906
1068
  */
907
- setActiveTab(groupId, tabId) {
908
- // Get current state
909
- const currentToggles = this.getCurrentActiveToggles();
910
- const currentTabs = this.getCurrentActiveTabs();
911
- // Merge new tab selection
912
- const newTabs = { ...currentTabs, [groupId]: tabId };
913
- // Create new state
914
- const newState = {
915
- toggles: currentToggles,
916
- tabs: newTabs
917
- };
918
- // Apply the state
919
- this.applyState(newState);
920
- // Emit custom event
921
- const event = new CustomEvent('customviews:tab-change', {
922
- detail: { groupId, tabId },
923
- bubbles: true
924
- });
925
- document.dispatchEvent(event);
1069
+ setActiveTab(groupId, tabId, groupEl) {
1070
+ // If groupEl is provided, apply tab selection locally to just that element
1071
+ // Single-click: only updates DOM visually, no persistence
1072
+ if (groupEl) {
1073
+ TabManager.applyTabLocalOnly(groupEl, tabId);
1074
+ // Update nav active state for this group element only
1075
+ TabManager.updateNavActiveState(groupEl, tabId);
1076
+ // Emit custom event for local tab change
1077
+ const event = new CustomEvent('customviews:tab-change', {
1078
+ detail: { groupId, tabId, synced: false },
1079
+ bubbles: true
1080
+ });
1081
+ document.dispatchEvent(event);
1082
+ }
926
1083
  }
927
1084
  // Inject styles, setup listeners and call rendering logic
928
1085
  async init() {
929
1086
  injectCoreStyles();
930
- // Build navigation once (with click handlers)
931
- TabManager.buildNavs(this.rootEl, this.config.tabGroups, (groupId, tabId) => {
932
- this.setActiveTab(groupId, tabId);
1087
+ // Build navigation once (with click and double-click handlers)
1088
+ TabManager.buildNavs(this.rootEl, this.config.tabGroups,
1089
+ // Single click: update clicked group only (local, no persistence)
1090
+ (groupId, tabId, groupEl) => {
1091
+ this.setActiveTab(groupId, tabId, groupEl);
1092
+ },
1093
+ // Double click: sync across all tabgroups with same id (with persistence)
1094
+ (groupId, tabId, _groupEl) => {
1095
+ const currentTabs = this.getCurrentActiveTabs();
1096
+ currentTabs[groupId] = tabId;
1097
+ const currentToggles = this.getCurrentActiveToggles();
1098
+ const newState = {
1099
+ toggles: currentToggles,
1100
+ tabs: currentTabs
1101
+ };
1102
+ // applyState() will handle all visual updates via renderState()
1103
+ this.applyState(newState);
933
1104
  });
1105
+ // Apply stored nav visibility preference on page load
1106
+ try {
1107
+ const navPref = localStorage.getItem('cv-tab-navs-visible');
1108
+ if (navPref !== null) {
1109
+ const visible = navPref === 'true';
1110
+ TabManager.setNavsVisibility(this.rootEl, visible);
1111
+ }
1112
+ }
1113
+ catch (e) { /* ignore */ }
934
1114
  // For session history, clicks on back/forward button
935
1115
  window.addEventListener("popstate", () => {
936
1116
  this.loadAndCallApplyState();
@@ -1462,13 +1642,14 @@ const WIDGET_STYLES = `
1462
1642
 
1463
1643
  .cv-widget-modal {
1464
1644
  background: white;
1465
- border-radius: 8px;
1466
- box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
1467
- max-width: 400px;
1645
+ border-radius: 0.75rem;
1646
+ box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
1647
+ max-width: 32rem;
1468
1648
  width: 90vw;
1469
1649
  max-height: 80vh;
1470
- overflow-y: auto;
1471
1650
  animation: slideIn 0.2s ease;
1651
+ display: flex;
1652
+ flex-direction: column;
1472
1653
  }
1473
1654
 
1474
1655
  @keyframes slideIn {
@@ -1482,47 +1663,96 @@ const WIDGET_STYLES = `
1482
1663
  }
1483
1664
  }
1484
1665
 
1485
- .cv-widget-modal-header {
1666
+ .cv-modal-header {
1486
1667
  display: flex;
1668
+ align-items: center;
1487
1669
  justify-content: space-between;
1670
+ padding: 0.5rem 1rem;
1671
+ border-bottom: 1px solid rgba(0, 0, 0, 0.1);
1672
+ }
1673
+
1674
+ .cv-modal-header-content {
1675
+ display: flex;
1488
1676
  align-items: center;
1489
- padding: 16px 20px;
1490
- border-bottom: 1px solid #e9ecef;
1491
- background: #f8f9fa;
1492
- border-radius: 8px 8px 0 0;
1677
+ gap: 0.75rem;
1678
+ }
1679
+
1680
+ .cv-modal-icon {
1681
+ position: relative;
1682
+ width: 1rem;
1683
+ height: 1rem;
1684
+ display: flex;
1685
+ align-items: center;
1686
+ justify-content: center;
1687
+ border-radius: 9999px;
1688
+ }
1689
+
1690
+ .cv-modal-icon-svg {
1691
+ width: 100%;
1692
+ height: 100%;
1693
+ opacity: 1;
1493
1694
  }
1494
1695
 
1495
- .cv-widget-modal-header h3 {
1696
+ .cv-modal-title {
1697
+ font-size: 1.125rem;
1698
+ font-weight: bold;
1699
+ color: rgba(0, 0, 0, 0.9);
1496
1700
  margin: 0;
1497
- font-size: 18px;
1498
- font-weight: 600;
1499
- color: #333;
1500
1701
  }
1501
1702
 
1502
- .cv-widget-modal-close {
1503
- background: none;
1504
- border: none;
1505
- font-size: 20px;
1506
- cursor: pointer;
1507
- padding: 0;
1508
- width: 32px;
1509
- height: 32px;
1703
+ .cv-modal-close {
1704
+ width: 2rem;
1705
+ height: 2rem;
1510
1706
  display: flex;
1511
1707
  align-items: center;
1512
1708
  justify-content: center;
1513
- border-radius: 4px;
1514
- color: #666;
1515
- line-height: 1;
1709
+ border-radius: 9999px;
1710
+ background: transparent;
1711
+ border: none;
1712
+ color: rgba(0, 0, 0, 0.6);
1713
+ cursor: pointer;
1516
1714
  transition: all 0.2s ease;
1517
1715
  }
1518
1716
 
1519
- .cv-widget-modal-close:hover {
1520
- background: #e9ecef;
1521
- color: #333;
1717
+ .cv-modal-close:hover {
1718
+ background: rgba(62, 132, 244, 0.1);
1719
+ color: #3e84f4;
1720
+ }
1721
+
1722
+ .cv-modal-close-icon {
1723
+ width: 1.25rem;
1724
+ height: 1.25rem;
1522
1725
  }
1523
1726
 
1524
- .cv-widget-modal-content {
1525
- padding: 20px;
1727
+ .cv-modal-main {
1728
+ padding: 1rem;
1729
+ flex: 1;
1730
+ display: flex;
1731
+ flex-direction: column;
1732
+ gap: 1rem;
1733
+ overflow-y: auto;
1734
+ max-height: calc(80vh - 8rem);
1735
+ }
1736
+
1737
+ .cv-modal-description {
1738
+ font-size: 0.875rem;
1739
+ color: rgba(0, 0, 0, 0.8);
1740
+ margin: 0;
1741
+ line-height: 1.4;
1742
+ }
1743
+
1744
+ .cv-content-section,
1745
+ .cv-tab-groups-section {
1746
+ display: flex;
1747
+ flex-direction: column;
1748
+ gap: 0.75rem;
1749
+ }
1750
+
1751
+ .cv-section-heading {
1752
+ font-size: 1rem;
1753
+ font-weight: bold;
1754
+ color: rgba(0, 0, 0, 0.9);
1755
+ margin: 0;
1526
1756
  }
1527
1757
 
1528
1758
  .cv-widget-modal-actions {
@@ -1564,32 +1794,83 @@ const WIDGET_STYLES = `
1564
1794
  background: #0056b3;
1565
1795
  }
1566
1796
 
1567
- /* Dark theme modal styles */
1568
1797
  .cv-widget-theme-dark .cv-widget-modal {
1569
- background: #2d3748;
1798
+ background: #101722;
1570
1799
  color: #e2e8f0;
1571
1800
  }
1572
1801
 
1573
- .cv-widget-theme-dark .cv-widget-modal-header {
1574
- background: #1a202c;
1575
- border-color: #4a5568;
1802
+ .cv-widget-theme-dark .cv-modal-header {
1803
+ border-color: rgba(255, 255, 255, 0.1);
1576
1804
  }
1577
1805
 
1578
- .cv-widget-theme-dark .cv-widget-modal-header h3 {
1806
+ .cv-widget-theme-dark .cv-modal-title {
1579
1807
  color: #e2e8f0;
1580
1808
  }
1581
1809
 
1582
- .cv-widget-theme-dark .cv-widget-modal-close {
1583
- color: #a0aec0;
1810
+ .cv-widget-theme-dark .cv-modal-close {
1811
+ color: rgba(255, 255, 255, 0.6);
1584
1812
  }
1585
1813
 
1586
- .cv-widget-theme-dark .cv-widget-modal-close:hover {
1587
- background: #4a5568;
1814
+ .cv-widget-theme-dark .cv-modal-close:hover {
1815
+ background: rgba(62, 132, 244, 0.2);
1816
+ color: #3e84f4;
1817
+ }
1818
+
1819
+ .cv-widget-theme-dark .cv-modal-description {
1820
+ color: rgba(255, 255, 255, 0.8);
1821
+ }
1822
+
1823
+ .cv-widget-theme-dark .cv-section-heading {
1824
+ color: #e2e8f0;
1825
+ }
1826
+
1827
+ .cv-widget-theme-dark .cv-toggles-container
1828
+ .cv-widget-theme-dark .cv-tabgroups-container {
1829
+ border-color: rgba(255, 255, 255, 0.1);
1830
+ }
1831
+
1832
+ .cv-widget-theme-dark .cv-toggle-card,
1833
+ .cv-widget-theme-dark .cv-tabgroup-card {
1834
+ background: #101722;
1835
+ border-color: rgba(255, 255, 255, 0.1);
1836
+ }
1837
+
1838
+ .cv-widget-theme-dark .cv-toggle-title,
1839
+ .cv-widget-theme-dark .cv-tabgroup-title {
1840
+ color: #e2e8f0;
1841
+ }
1842
+
1843
+ .cv-widget-theme-dark .cv-toggle-description,
1844
+ .cv-widget-theme-dark .cv-tabgroup-description {
1845
+ color: rgba(255, 255, 255, 0.6);
1846
+ }
1847
+
1848
+ .cv-widget-theme-dark .cv-toggle-slider {
1849
+ background: rgba(255, 255, 255, 0.2);
1850
+ }
1851
+
1852
+ .cv-widget-theme-dark .cv-tab-group-description {
1853
+ color: rgba(255, 255, 255, 0.8);
1854
+ }
1855
+
1856
+ .cv-widget-theme-dark .cv-tabgroup-select {
1857
+ background: #101722;
1858
+ border-color: rgba(255, 255, 255, 0.2);
1588
1859
  color: #e2e8f0;
1589
1860
  }
1590
1861
 
1591
- .cv-widget-theme-dark .cv-widget-modal-actions {
1592
- border-color: #4a5568;
1862
+ .cv-widget-theme-dark .cv-modal-footer {
1863
+ border-color: rgba(255, 255, 255, 0.1);
1864
+ background: #101722;
1865
+ }
1866
+
1867
+ .cv-widget-theme-dark .cv-reset-btn {
1868
+ color: #e2e8f0;
1869
+ background: rgba(255, 255, 255, 0.1);
1870
+ }
1871
+
1872
+ .cv-widget-theme-dark .cv-reset-btn:hover {
1873
+ background: rgba(255, 255, 255, 0.2);
1593
1874
  }
1594
1875
 
1595
1876
  /* Custom state creator styles */
@@ -1597,8 +1878,7 @@ const WIDGET_STYLES = `
1597
1878
  max-width: 500px;
1598
1879
  }
1599
1880
 
1600
- .cv-custom-state-form h4 {
1601
- margin: 20px 0 10px 0;
1881
+ .cv-custom-state-form .cv-section-header {
1602
1882
  font-size: 16px;
1603
1883
  font-weight: 600;
1604
1884
  color: #333;
@@ -1640,63 +1920,89 @@ const WIDGET_STYLES = `
1640
1920
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
1641
1921
  }
1642
1922
 
1643
- .cv-custom-toggles {
1644
- display: grid;
1645
- grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
1646
- gap: 10px;
1923
+ /* Toggles Container */
1924
+ .cv-toggles-container {
1925
+ display: flex;
1926
+ flex-direction: column;
1927
+ gap: 0.5rem;
1928
+ border-radius: 0.5rem;
1929
+ border: 1px solid rgba(0, 0, 0, 0.1);
1930
+ overflow: hidden;
1647
1931
  }
1648
1932
 
1649
- .cv-custom-state-toggle {
1650
- display: flex;
1651
- align-items: center;
1933
+ .cv-toggle-card,
1934
+ .cv-tabgroup-card {
1935
+ background: white;
1936
+ border-bottom: 1px solid rgba(0, 0, 0, 0.1);
1937
+ }
1938
+
1939
+ .cv-toggle-card:last-child {
1940
+ border-bottom: none;
1652
1941
  }
1653
1942
 
1654
- .cv-custom-state-toggle label {
1943
+ .cv-toggle-content {
1655
1944
  display: flex;
1656
1945
  align-items: center;
1657
- cursor: pointer;
1658
- font-weight: normal;
1946
+ justify-content: space-between;
1947
+ padding: 0.75rem;
1948
+ }
1949
+
1950
+ .cv-toggle-title {
1951
+ font-weight: 500;
1952
+ font-size: 0.875rem;
1953
+ color: rgba(0, 0, 0, 0.9);
1954
+ margin: 0 0 0.125rem 0;
1955
+ }
1956
+
1957
+ .cv-toggle-description {
1958
+ font-size: 0.75rem;
1959
+ color: rgba(0, 0, 0, 0.6);
1659
1960
  margin: 0;
1660
1961
  }
1661
1962
 
1662
- .cv-toggle-switch {
1963
+ .cv-toggle-label{
1663
1964
  position: relative;
1664
- width: 44px;
1665
- height: 24px;
1666
- background: #ccc;
1667
- border-radius: 12px;
1668
- margin-right: 12px;
1965
+ display: inline-block;
1966
+ width: 2.75rem;
1967
+ height: 1.5rem;
1669
1968
  cursor: pointer;
1670
- transition: background-color 0.3s ease;
1671
- flex-shrink: 0;
1672
1969
  }
1673
1970
 
1674
- .cv-toggle-switch:hover {
1675
- background: #bbb;
1971
+ .cv-toggle-input {
1972
+ opacity: 0;
1973
+ width: 0;
1974
+ height: 0;
1676
1975
  }
1677
1976
 
1678
- .cv-toggle-switch.cv-toggle-active {
1679
- background: #007bff;
1680
- }
1681
-
1682
- .cv-toggle-switch.cv-toggle-active:hover {
1683
- background: #0056b3;
1977
+ .cv-toggle-slider {
1978
+ position: absolute;
1979
+ top: 0;
1980
+ left: 0;
1981
+ right: 0;
1982
+ bottom: 0;
1983
+ background: rgba(0, 0, 0, 0.2);
1984
+ border-radius: 9999px;
1985
+ transition: background-color 0.2s ease;
1684
1986
  }
1685
1987
 
1686
- .cv-toggle-handle {
1988
+ .cv-toggle-slider:before {
1687
1989
  position: absolute;
1688
- top: 2px;
1689
- left: 2px;
1690
- width: 20px;
1691
- height: 20px;
1990
+ content: "";
1991
+ height: 1rem;
1992
+ width: 1rem;
1993
+ left: 0.25rem;
1994
+ bottom: 0.25rem;
1692
1995
  background: white;
1693
1996
  border-radius: 50%;
1694
- transition: transform 0.3s ease;
1695
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
1997
+ transition: transform 0.2s ease;
1696
1998
  }
1697
1999
 
1698
- .cv-toggle-switch.cv-toggle-active .cv-toggle-handle {
1699
- transform: translateX(20px);
2000
+ .cv-toggle-input:checked + .cv-toggle-slider {
2001
+ background: #3e84f4;
2002
+ }
2003
+
2004
+ .cv-toggle-input:checked + .cv-toggle-slider:before {
2005
+ transform: translateX(1.25rem);
1700
2006
  }
1701
2007
 
1702
2008
  /* Dark theme toggle switch styles */
@@ -1716,200 +2022,371 @@ const WIDGET_STYLES = `
1716
2022
  background: #4299e1;
1717
2023
  }
1718
2024
 
1719
- .cv-tab-groups {
1720
- margin-top: 20px;
2025
+ /* Tab Groups Container */
2026
+ .cv-tab-groups-list {
2027
+ display: flex;
2028
+ flex-direction: column;
2029
+ gap: 1px;
2030
+ border: 1px solid rgba(0, 0, 0, 0.1);
2031
+ border-radius: 0.5rem;
2032
+ overflow: hidden;
1721
2033
  }
1722
2034
 
1723
- .cv-tab-group-control {
1724
- margin-bottom: 15px;
2035
+ /* Tab Group Card - Header (Navigation Headers toggle) */
2036
+ .cv-tabgroup-card.cv-tabgroup-header {
2037
+ display: flex;
2038
+ align-items: center;
2039
+ justify-content: space-between;
2040
+ padding: 0.75rem;
2041
+ border-bottom: 0px;
1725
2042
  }
1726
2043
 
1727
- .cv-tab-group-control label {
1728
- display: block;
1729
- margin-bottom: 5px;
2044
+ .cv-tabgroup-card.cv-tabgroup-header .cv-tabgroup-row {
2045
+ display: flex;
2046
+ align-items: center;
2047
+ justify-content: space-between;
2048
+ width: 100%;
2049
+ gap: 1rem;
2050
+ }
2051
+
2052
+ /* Tab Group Card - Items */
2053
+ .cv-tabgroup-card.cv-tabgroup-item {
2054
+ display: flex;
2055
+ flex-direction: column;
2056
+ gap: 0.5rem;
2057
+ padding: 0.75rem;
2058
+ background: white;
2059
+ border-bottom: 1px solid rgba(0, 0, 0, 0.05);
2060
+ }
2061
+
2062
+ .cv-tabgroup-card.cv-tabgroup-item:last-child {
2063
+ border-bottom: none;
2064
+ }
2065
+
2066
+ /* Tab Group Info */
2067
+ .cv-tabgroup-info {
2068
+ flex: 1;
2069
+ }
2070
+
2071
+ .cv-tabgroup-title {
1730
2072
  font-weight: 500;
1731
- font-size: 14px;
2073
+ font-size: 0.875rem;
2074
+ color: rgba(0, 0, 0, 0.9);
2075
+ margin: 0 0 0.25rem 0;
1732
2076
  }
1733
2077
 
1734
- .cv-tab-group-select {
1735
- width: 100%;
1736
- padding: 8px 12px;
1737
- border: 1px solid #ced4da;
1738
- border-radius: 4px;
1739
- font-size: 14px;
1740
- background-color: white;
2078
+ .cv-tabgroup-description {
2079
+ font-size: 0.75rem;
2080
+ color: rgba(0, 0, 0, 0.6);
2081
+ margin: 0;
2082
+ line-height: 1.3;
2083
+ }
2084
+
2085
+ /* Tab Group Label (for select dropdowns) */
2086
+ .cv-tabgroup-label {
2087
+ font-size: 0.875rem;
2088
+ color: rgba(0, 0, 0, 0.8);
2089
+ margin: 0;
2090
+ line-height: 1.4;
2091
+ font-weight: 500;
2092
+ display: block;
1741
2093
  cursor: pointer;
1742
2094
  }
1743
2095
 
1744
- .cv-tab-group-select:focus {
1745
- outline: none;
1746
- border-color: #007bff;
1747
- box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
2096
+ /* Tab Group Select */
2097
+ .cv-tabgroup-select {
2098
+ width: 100%;
2099
+ border-radius: 0.5rem;
2100
+ background: white;
2101
+ border: 1px solid rgba(0, 0, 0, 0.15);
2102
+ color: rgba(0, 0, 0, 0.9);
2103
+ padding: 0.5rem 0.75rem;
2104
+ font-size: 0.875rem;
2105
+ cursor: pointer;
2106
+ transition: all 0.15s ease;
2107
+ font-family: inherit;
1748
2108
  }
1749
2109
 
1750
- .cv-widget-theme-dark .cv-tab-group-select {
1751
- background-color: #2d3748;
1752
- border-color: #4a5568;
1753
- color: #e2e8f0;
2110
+ .cv-tabgroup-select:hover {
2111
+ border-color: rgba(0, 0, 0, 0.25);
1754
2112
  }
1755
2113
 
1756
- .cv-custom-state-actions {
1757
- display: flex;
1758
- gap: 10px;
1759
- margin-top: 20px;
1760
- padding-top: 16px;
1761
- border-top: 1px solid #e9ecef;
2114
+ .cv-tabgroup-select:focus {
2115
+ outline: none;
2116
+ border-color: #3e84f4;
2117
+ box-shadow: 0 0 0 2px rgba(62, 132, 244, 0.2);
1762
2118
  }
1763
2119
 
1764
- .cv-custom-state-cancel,
1765
- .cv-custom-state-copy-url {
1766
- flex: 1;
1767
- padding: 10px 16px;
1768
- border: none;
1769
- border-radius: 4px;
2120
+ /* Modern Toggle Switch */
2121
+ .cv-toggle-switch {
2122
+ position: relative;
2123
+ display: inline-flex;
2124
+ align-items: center;
2125
+ width: 44px;
2126
+ height: 24px;
2127
+ background: rgba(0, 0, 0, 0.1);
2128
+ border-radius: 9999px;
2129
+ padding: 2px;
2130
+ box-sizing: border-box;
1770
2131
  cursor: pointer;
1771
- font-size: 14px;
1772
- font-weight: 500;
2132
+ transition: background-color 0.2s ease;
2133
+ border: none;
1773
2134
  }
1774
2135
 
1775
- .cv-custom-state-reset {
1776
- flex: 1;
1777
- padding: 10px 16px;
1778
- border: none;
1779
- border-radius: 4px;
1780
- cursor: pointer;
1781
- font-size: 14px;
1782
- font-weight: 500;
1783
- background: #dc3545;
1784
- color: white;
2136
+ .cv-toggle-switch input {
2137
+ display: none;
1785
2138
  }
1786
2139
 
1787
- .cv-custom-state-reset:hover {
1788
- background: #c82333;
2140
+ .cv-toggle-switch .cv-switch-bg {
2141
+ position: absolute;
2142
+ inset: 0;
2143
+ border-radius: 9999px;
2144
+ background: rgba(0, 0, 0, 0.1);
2145
+ transition: background-color 0.2s ease;
2146
+ pointer-events: none;
1789
2147
  }
1790
2148
 
1791
- .cv-custom-state-cancel {
1792
- background: #6c757d;
1793
- color: white;
2149
+ .cv-toggle-switch .cv-switch-knob {
2150
+ position: relative;
2151
+ width: 20px;
2152
+ height: 20px;
2153
+ background: white;
2154
+ border-radius: 50%;
2155
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
2156
+ transition: transform 0.2s ease;
2157
+ z-index: 1;
1794
2158
  }
1795
2159
 
1796
- .cv-custom-state-cancel:hover {
1797
- background: #5a6268;
2160
+ .cv-toggle-switch input:checked + .cv-switch-bg {
2161
+ background: #3e84f4;
1798
2162
  }
1799
2163
 
1800
- .cv-custom-state-copy-url {
1801
- background: #28a745;
1802
- color: white;
2164
+ .cv-toggle-switch input:checked ~ .cv-switch-knob {
2165
+ transform: translateX(20px);
1803
2166
  }
1804
2167
 
1805
- .cv-custom-state-copy-url:hover {
1806
- background: #218838;
2168
+ /* Dark Theme - Tab Groups */
2169
+ .cv-widget-theme-dark .cv-tabgroup-card.cv-tabgroup-header {
2170
+ background: #101722;
2171
+ border-bottom-color: rgba(255, 255, 255, 0.1);
1807
2172
  }
1808
2173
 
1809
- /* Dark theme custom state styles */
1810
- .cv-widget-theme-dark .cv-custom-state-form h4 {
2174
+ .cv-widget-theme-dark .cv-tabgroup-card.cv-tabgroup-item {
2175
+ background: #101722;
2176
+ border-bottom-color: rgba(255, 255, 255, 0.05);
2177
+ }
2178
+
2179
+ .cv-widget-theme-dark .cv-tabgroup-title {
1811
2180
  color: #e2e8f0;
1812
- border-color: #4a5568;
1813
2181
  }
1814
2182
 
1815
- .cv-widget-theme-dark .cv-custom-state-form p {
1816
- color: #cbd5e0;
2183
+ .cv-widget-theme-dark .cv-tabgroup-description {
2184
+ color: rgba(255, 255, 255, 0.6);
1817
2185
  }
1818
2186
 
1819
- .cv-widget-theme-dark .cv-custom-state-section label {
1820
- color: #a0aec0;
2187
+ .cv-widget-theme-dark .cv-tabgroup-label {
2188
+ color: rgba(255, 255, 255, 0.8);
1821
2189
  }
1822
2190
 
1823
- .cv-widget-theme-dark .cv-custom-state-input {
1824
- background: #1a202c;
1825
- border-color: #4a5568;
2191
+ .cv-widget-theme-dark .cv-tab-groups-list {
2192
+ border-color: rgba(255, 255, 255, 0.1);
2193
+ }
2194
+
2195
+ .cv-widget-theme-dark .cv-tabgroup-select {
2196
+ background: #101722;
2197
+ border-color: rgba(255, 255, 255, 0.15);
1826
2198
  color: #e2e8f0;
1827
2199
  }
1828
2200
 
1829
- .cv-widget-theme-dark .cv-custom-state-actions {
1830
- border-color: #4a5568;
2201
+ .cv-widget-theme-dark .cv-tabgroup-select:hover {
2202
+ border-color: rgba(255, 255, 255, 0.25);
2203
+ }
2204
+
2205
+ .cv-widget-theme-dark .cv-tabgroup-select:focus {
2206
+ border-color: #60a5fa;
2207
+ box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2);
2208
+ }
2209
+
2210
+ /* Dark Theme - Toggle Switch */
2211
+ .cv-widget-theme-dark .cv-toggle-switch .cv-switch-bg {
2212
+ background: rgba(255, 255, 255, 0.1);
1831
2213
  }
1832
2214
 
2215
+ .cv-widget-theme-dark .cv-toggle-switch .cv-switch-knob {
2216
+ background: #e2e8f0;
2217
+ }
2218
+
2219
+ .cv-widget-theme-dark .cv-toggle-switch input:checked + .cv-switch-bg {
2220
+ background: #63b3ed;
2221
+ }
2222
+
2223
+ .cv-modal-footer {
2224
+ display: flex;
2225
+ justify-content: space-between;
2226
+ align-items: center;
2227
+ padding: 0.75rem;
2228
+ border-top: 1px solid rgba(0, 0, 0, 0.1);
2229
+ }
2230
+
2231
+ .cv-reset-btn,
2232
+ .cv-share-btn {
2233
+ display: flex;
2234
+ align-items: center;
2235
+ gap: 0.5rem;
2236
+ padding: 0.375rem 0.75rem;
2237
+ border-radius: 0.5rem;
2238
+ font-weight: 600;
2239
+ font-size: 0.875rem;
2240
+ cursor: pointer;
2241
+ transition: all 0.2s ease;
2242
+ border: none;
2243
+ }
2244
+
2245
+ .cv-reset-btn {
2246
+ color: rgba(0, 0, 0, 0.9);
2247
+ background: rgba(0, 0, 0, 0.1);
2248
+ }
2249
+
2250
+ .cv-reset-btn:hover {
2251
+ background: rgba(0, 0, 0, 0.2);
2252
+ }
2253
+
2254
+ .cv-share-btn {
2255
+ color: white;
2256
+ background: #3e84f4;
2257
+ }
2258
+
2259
+ .cv-share-btn:hover {
2260
+ background: rgba(62, 132, 244, 0.9);
2261
+ }
2262
+
2263
+ .cv-btn-icon {
2264
+ width: 1rem;
2265
+ height: 1rem;
2266
+ }
2267
+
2268
+ /* Dark theme custom state styles */
1833
2269
  /* Welcome modal styles */
1834
2270
  .cv-welcome-modal {
1835
- max-width: 500px;
2271
+ max-width: 32rem;
2272
+ width: 90vw;
2273
+ background: white;
2274
+ border-radius: 0.75rem;
2275
+ box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
2276
+ animation: slideIn 0.2s ease;
2277
+ display: flex;
2278
+ flex-direction: column;
2279
+ }
2280
+
2281
+ .cv-modal-main {
2282
+ padding: 1rem;
2283
+ flex: 1;
2284
+ display: flex;
2285
+ flex-direction: column;
2286
+ gap: 1rem;
2287
+ overflow-y: auto;
2288
+ max-height: calc(80vh - 8rem);
1836
2289
  }
1837
2290
 
1838
- .cv-welcome-content {
2291
+ .cv-welcome-message {
2292
+ font-size: 0.875rem;
2293
+ color: rgba(0, 0, 0, 0.8);
2294
+ margin: 0;
2295
+ line-height: 1.4;
1839
2296
  text-align: center;
1840
2297
  }
1841
2298
 
1842
- .cv-welcome-content p {
1843
- font-size: 15px;
1844
- line-height: 1.6;
1845
- color: #555;
1846
- margin-bottom: 24px;
2299
+ .cv-welcome-message a {
2300
+ color: #3e84f4;
1847
2301
  text-align: justify;
2302
+ text-decoration: none;
2303
+ }
2304
+
2305
+ .cv-welcome-message a:hover {
2306
+ text-decoration: underline;
1848
2307
  }
1849
2308
 
1850
2309
  .cv-welcome-widget-preview {
1851
2310
  display: flex;
1852
- flex-direction: column;
1853
2311
  align-items: center;
1854
- gap: 12px;
1855
- padding: 20px;
2312
+ justify-content: center;
2313
+ gap: 1rem;
2314
+ padding: 1rem;
1856
2315
  background: #f8f9fa;
1857
- border-radius: 8px;
1858
- margin-bottom: 24px;
2316
+ border-radius: 0.5rem;
2317
+ margin: 1rem 0;
1859
2318
  }
1860
2319
 
1861
2320
  .cv-welcome-widget-icon {
1862
- width: 36px;
1863
- height: 36px;
1864
- background: white;
1865
- color: black;
1866
- border-radius: 0 18px 18px 0;
2321
+ width: 2rem;
2322
+ height: 2rem;
2323
+ background: rgba(62, 132, 244, 0.1);
2324
+ border-radius: 9999px;
1867
2325
  display: flex;
1868
2326
  align-items: center;
1869
2327
  justify-content: center;
1870
- font-size: 18px;
1871
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
2328
+ animation: cv-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
2329
+ color: #3e84f4;
1872
2330
  }
1873
2331
 
1874
2332
  .cv-welcome-widget-label {
1875
- font-size: 14px;
1876
- color: #666;
1877
- margin: 0;
2333
+ font-size: 0.875rem;
1878
2334
  font-weight: 500;
2335
+ color: rgba(0, 0, 0, 0.8);
2336
+ margin: 0;
1879
2337
  }
1880
2338
 
1881
2339
  .cv-welcome-got-it {
1882
2340
  width: 100%;
1883
- padding: 12px 24px;
1884
- background: #007bff;
2341
+ background: #3e84f4;
1885
2342
  color: white;
2343
+ font-weight: 600;
2344
+ padding: 0.75rem 1rem;
2345
+ border-radius: 0.5rem;
1886
2346
  border: none;
1887
- border-radius: 4px;
1888
2347
  cursor: pointer;
1889
- font-size: 16px;
1890
- font-weight: 600;
1891
- transition: background 0.2s ease;
2348
+ font-size: 0.875rem;
2349
+ transition: background-color 0.2s ease;
2350
+ outline: none;
1892
2351
  }
1893
2352
 
1894
2353
  .cv-welcome-got-it:hover {
1895
- background: #0056b3;
2354
+ background: rgba(62, 132, 244, 0.9);
2355
+ }
2356
+
2357
+ .cv-welcome-got-it:focus {
2358
+ box-shadow: 0 0 0 2px rgba(62, 132, 244, 0.5);
1896
2359
  }
1897
2360
 
1898
- .cv-welcome-got-it:active {
1899
- background: #004494;
2361
+ /* Animations */
2362
+ @keyframes cv-pulse {
2363
+ 0%, 100% {
2364
+ opacity: 1;
2365
+ }
2366
+ 50% {
2367
+ opacity: 0.5;
2368
+ }
1900
2369
  }
1901
2370
 
1902
2371
  /* Dark theme welcome modal styles */
1903
- .cv-widget-theme-dark .cv-welcome-content p {
1904
- color: #cbd5e0;
2372
+ .cv-widget-theme-dark .cv-welcome-modal {
2373
+ background: #101722;
2374
+ }
2375
+
2376
+ .cv-widget-theme-dark .cv-welcome-message {
2377
+ color: rgba(255, 255, 255, 0.8);
2378
+ }
2379
+
2380
+ .cv-widget-theme-dark .cv-welcome-message a {
2381
+ color: #60a5fa;
1905
2382
  }
1906
2383
 
1907
2384
  .cv-widget-theme-dark .cv-welcome-widget-preview {
1908
- background: #1a202c;
2385
+ background: rgba(255, 255, 255, 0.1);
1909
2386
  }
1910
2387
 
1911
2388
  .cv-widget-theme-dark .cv-welcome-widget-label {
1912
- color: #a0aec0;
2389
+ color: #e2e8f0;
1913
2390
  }
1914
2391
  `;
1915
2392
  /**
@@ -1925,6 +2402,45 @@ function injectWidgetStyles() {
1925
2402
  document.head.appendChild(style);
1926
2403
  }
1927
2404
 
2405
+ /**
2406
+ * Icon utilities for CustomViews widget
2407
+ * Centralized SVG icons for better maintainability and reusability
2408
+ */
2409
+ /**
2410
+ * Settings gear icon for modal header
2411
+ */
2412
+ function getGearIcon() {
2413
+ return `<svg class="cv-modal-icon-svg" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
2414
+ <path xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" d="M12 8.00002C9.79085 8.00002 7.99999 9.79088 7.99999 12C7.99999 14.2092 9.79085 16 12 16C14.2091 16 16 14.2092 16 12C16 9.79088 14.2091 8.00002 12 8.00002ZM9.99999 12C9.99999 10.8955 10.8954 10 12 10C13.1046 10 14 10.8955 14 12C14 13.1046 13.1046 14 12 14C10.8954 14 9.99999 13.1046 9.99999 12Z" fill="#0F1729"/>
2415
+ <path xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" d="M10.7673 1.01709C10.9925 0.999829 11.2454 0.99993 11.4516 1.00001L12.5484 1.00001C12.7546 0.99993 13.0075 0.999829 13.2327 1.01709C13.4989 1.03749 13.8678 1.08936 14.2634 1.26937C14.7635 1.49689 15.1915 1.85736 15.5007 2.31147C15.7454 2.67075 15.8592 3.0255 15.9246 3.2843C15.9799 3.50334 16.0228 3.75249 16.0577 3.9557L16.1993 4.77635L16.2021 4.77788C16.2369 4.79712 16.2715 4.81659 16.306 4.8363L16.3086 4.83774L17.2455 4.49865C17.4356 4.42978 17.6693 4.34509 17.8835 4.28543C18.1371 4.2148 18.4954 4.13889 18.9216 4.17026C19.4614 4.20998 19.9803 4.39497 20.4235 4.70563C20.7734 4.95095 21.0029 5.23636 21.1546 5.4515C21.2829 5.63326 21.4103 5.84671 21.514 6.02029L22.0158 6.86003C22.1256 7.04345 22.2594 7.26713 22.3627 7.47527C22.4843 7.7203 22.6328 8.07474 22.6777 8.52067C22.7341 9.08222 22.6311 9.64831 22.3803 10.1539C22.1811 10.5554 21.9171 10.8347 21.7169 11.0212C21.5469 11.1795 21.3428 11.3417 21.1755 11.4746L20.5 12L21.1755 12.5254C21.3428 12.6584 21.5469 12.8205 21.7169 12.9789C21.9171 13.1653 22.1811 13.4446 22.3802 13.8461C22.631 14.3517 22.7341 14.9178 22.6776 15.4794C22.6328 15.9253 22.4842 16.2797 22.3626 16.5248C22.2593 16.7329 22.1255 16.9566 22.0158 17.14L21.5138 17.9799C21.4102 18.1535 21.2828 18.3668 21.1546 18.5485C21.0028 18.7637 20.7734 19.0491 20.4234 19.2944C19.9803 19.6051 19.4613 19.7901 18.9216 19.8298C18.4954 19.8612 18.1371 19.7852 17.8835 19.7146C17.6692 19.6549 17.4355 19.5703 17.2454 19.5014L16.3085 19.1623L16.306 19.1638C16.2715 19.1835 16.2369 19.2029 16.2021 19.2222L16.1993 19.2237L16.0577 20.0443C16.0228 20.2475 15.9799 20.4967 15.9246 20.7157C15.8592 20.9745 15.7454 21.3293 15.5007 21.6886C15.1915 22.1427 14.7635 22.5032 14.2634 22.7307C13.8678 22.9107 13.4989 22.9626 13.2327 22.983C13.0074 23.0002 12.7546 23.0001 12.5484 23H11.4516C11.2454 23.0001 10.9925 23.0002 10.7673 22.983C10.5011 22.9626 10.1322 22.9107 9.73655 22.7307C9.23648 22.5032 8.80849 22.1427 8.49926 21.6886C8.25461 21.3293 8.14077 20.9745 8.07542 20.7157C8.02011 20.4967 7.97723 20.2475 7.94225 20.0443L7.80068 19.2237L7.79791 19.2222C7.7631 19.2029 7.72845 19.1835 7.69396 19.1637L7.69142 19.1623L6.75458 19.5014C6.5645 19.5702 6.33078 19.6549 6.11651 19.7146C5.86288 19.7852 5.50463 19.8611 5.07841 19.8298C4.53866 19.7901 4.01971 19.6051 3.57654 19.2944C3.2266 19.0491 2.99714 18.7637 2.84539 18.5485C2.71718 18.3668 2.58974 18.1534 2.4861 17.9798L1.98418 17.14C1.87447 16.9566 1.74067 16.7329 1.63737 16.5248C1.51575 16.2797 1.36719 15.9253 1.32235 15.4794C1.26588 14.9178 1.36897 14.3517 1.61976 13.8461C1.81892 13.4446 2.08289 13.1653 2.28308 12.9789C2.45312 12.8205 2.65717 12.6584 2.82449 12.5254L3.47844 12.0054V11.9947L2.82445 11.4746C2.65712 11.3417 2.45308 11.1795 2.28304 11.0212C2.08285 10.8347 1.81888 10.5554 1.61972 10.1539C1.36893 9.64832 1.26584 9.08224 1.3223 8.52069C1.36714 8.07476 1.51571 7.72032 1.63732 7.47528C1.74062 7.26715 1.87443 7.04347 1.98414 6.86005L2.48605 6.02026C2.58969 5.84669 2.71714 5.63326 2.84534 5.45151C2.9971 5.23637 3.22655 4.95096 3.5765 4.70565C4.01966 4.39498 4.53862 4.20999 5.07837 4.17027C5.50458 4.1389 5.86284 4.21481 6.11646 4.28544C6.33072 4.34511 6.56444 4.4298 6.75451 4.49867L7.69141 4.83775L7.69394 4.8363C7.72844 4.8166 7.7631 4.79712 7.79791 4.77788L7.80068 4.77635L7.94225 3.95571C7.97723 3.7525 8.02011 3.50334 8.07542 3.2843C8.14077 3.0255 8.25461 2.67075 8.49926 2.31147C8.80849 1.85736 9.23648 1.49689 9.73655 1.26937C10.1322 1.08936 10.5011 1.03749 10.7673 1.01709ZM14.0938 4.3363C14.011 3.85634 13.9696 3.61637 13.8476 3.43717C13.7445 3.2858 13.6019 3.16564 13.4352 3.0898C13.2378 3.00002 12.9943 3.00002 12.5073 3.00002H11.4927C11.0057 3.00002 10.7621 3.00002 10.5648 3.0898C10.3981 3.16564 10.2555 3.2858 10.1524 3.43717C10.0304 3.61637 9.98895 3.85634 9.90615 4.3363L9.75012 5.24064C9.69445 5.56333 9.66662 5.72467 9.60765 5.84869C9.54975 5.97047 9.50241 6.03703 9.40636 6.13166C9.30853 6.22804 9.12753 6.3281 8.76554 6.52822C8.73884 6.54298 8.71227 6.55791 8.68582 6.57302C8.33956 6.77078 8.16643 6.86966 8.03785 6.90314C7.91158 6.93602 7.83293 6.94279 7.70289 6.93196C7.57049 6.92094 7.42216 6.86726 7.12551 6.7599L6.11194 6.39308C5.66271 6.2305 5.43809 6.14921 5.22515 6.16488C5.04524 6.17811 4.87225 6.23978 4.72453 6.34333C4.5497 6.46589 4.42715 6.67094 4.18206 7.08103L3.72269 7.84965C3.46394 8.2826 3.33456 8.49907 3.31227 8.72078C3.29345 8.90796 3.32781 9.09665 3.41141 9.26519C3.51042 9.4648 3.7078 9.62177 4.10256 9.9357L4.82745 10.5122C5.07927 10.7124 5.20518 10.8126 5.28411 10.9199C5.36944 11.036 5.40583 11.1114 5.44354 11.2504C5.47844 11.379 5.47844 11.586 5.47844 12C5.47844 12.414 5.47844 12.621 5.44354 12.7497C5.40582 12.8887 5.36944 12.9641 5.28413 13.0801C5.20518 13.1875 5.07927 13.2876 4.82743 13.4879L4.10261 14.0643C3.70785 14.3783 3.51047 14.5352 3.41145 14.7349C3.32785 14.9034 3.29349 15.0921 3.31231 15.2793C3.33461 15.501 3.46398 15.7174 3.72273 16.1504L4.1821 16.919C4.4272 17.3291 4.54974 17.5342 4.72457 17.6567C4.8723 17.7603 5.04528 17.8219 5.2252 17.8352C5.43813 17.8508 5.66275 17.7695 6.11199 17.607L7.12553 17.2402C7.42216 17.1328 7.5705 17.0791 7.7029 17.0681C7.83294 17.0573 7.91159 17.064 8.03786 17.0969C8.16644 17.1304 8.33956 17.2293 8.68582 17.427C8.71228 17.4421 8.73885 17.4571 8.76554 17.4718C9.12753 17.6719 9.30853 17.772 9.40635 17.8684C9.50241 17.963 9.54975 18.0296 9.60765 18.1514C9.66662 18.2754 9.69445 18.4367 9.75012 18.7594L9.90615 19.6637C9.98895 20.1437 10.0304 20.3837 10.1524 20.5629C10.2555 20.7142 10.3981 20.8344 10.5648 20.9102C10.7621 21 11.0057 21 11.4927 21H12.5073C12.9943 21 13.2378 21 13.4352 20.9102C13.6019 20.8344 13.7445 20.7142 13.8476 20.5629C13.9696 20.3837 14.011 20.1437 14.0938 19.6637L14.2499 18.7594C14.3055 18.4367 14.3334 18.2754 14.3923 18.1514C14.4502 18.0296 14.4976 17.963 14.5936 17.8684C14.6915 17.772 14.8725 17.6719 15.2344 17.4718C15.2611 17.4571 15.2877 17.4421 15.3141 17.427C15.6604 17.2293 15.8335 17.1304 15.9621 17.0969C16.0884 17.064 16.167 17.0573 16.2971 17.0681C16.4295 17.0791 16.5778 17.1328 16.8744 17.2402L17.888 17.607C18.3372 17.7696 18.5619 17.8509 18.7748 17.8352C18.9547 17.8219 19.1277 17.7603 19.2754 17.6567C19.4502 17.5342 19.5728 17.3291 19.8179 16.919L20.2773 16.1504C20.536 15.7175 20.6654 15.501 20.6877 15.2793C20.7065 15.0921 20.6721 14.9034 20.5885 14.7349C20.4895 14.5353 20.2921 14.3783 19.8974 14.0643L19.1726 13.4879C18.9207 13.2876 18.7948 13.1875 18.7159 13.0801C18.6306 12.9641 18.5942 12.8887 18.5564 12.7497C18.5215 12.6211 18.5215 12.414 18.5215 12C18.5215 11.586 18.5215 11.379 18.5564 11.2504C18.5942 11.1114 18.6306 11.036 18.7159 10.9199C18.7948 10.8126 18.9207 10.7124 19.1725 10.5122L19.8974 9.9357C20.2922 9.62176 20.4896 9.46479 20.5886 9.26517C20.6722 9.09664 20.7065 8.90795 20.6877 8.72076C20.6654 8.49906 20.5361 8.28259 20.2773 7.84964L19.8179 7.08102C19.5728 6.67093 19.4503 6.46588 19.2755 6.34332C19.1277 6.23977 18.9548 6.1781 18.7748 6.16486C18.5619 6.14919 18.3373 6.23048 17.888 6.39307L16.8745 6.75989C16.5778 6.86725 16.4295 6.92093 16.2971 6.93195C16.167 6.94278 16.0884 6.93601 15.9621 6.90313C15.8335 6.86965 15.6604 6.77077 15.3142 6.57302C15.2877 6.55791 15.2611 6.54298 15.2345 6.52822C14.8725 6.3281 14.6915 6.22804 14.5936 6.13166C14.4976 6.03703 14.4502 5.97047 14.3923 5.84869C14.3334 5.72467 14.3055 5.56332 14.2499 5.24064L14.0938 4.3363Z" fill="#0F1729"/>
2416
+ </svg>`;
2417
+ }
2418
+ /**
2419
+ * Close/X icon for modal close button
2420
+ */
2421
+ function getCloseIcon() {
2422
+ return `<svg class="cv-modal-close-icon" fill="currentColor" height="20px" viewBox="0 0 256 256" width="20px" xmlns="http://www.w3.org/2000/svg">
2423
+ <path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"></path>
2424
+ </svg>`;
2425
+ }
2426
+ /**
2427
+ * Reset/refresh icon for reset button
2428
+ */
2429
+ function getResetIcon() {
2430
+ return `<svg class="cv-btn-icon" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
2431
+ <path d="M22.719 12A10.719 10.719 0 0 1 1.28 12h.838a9.916 9.916 0 1 0 1.373-5H8v1H2V2h1v4.2A10.71 10.71 0 0 1 22.719 12z"/><path fill="none" d="M0 0h24v24H0z"/>
2432
+ </svg>`;
2433
+ }
2434
+ /**
2435
+ * Share icon for share button
2436
+ */
2437
+ function getShareIcon() {
2438
+ return `<svg class="cv-btn-icon" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
2439
+ <path xmlns="http://www.w3.org/2000/svg" d="M6 11C6 8.17157 6 6.75736 6.87868 5.87868C7.75736 5 9.17157 5 12 5H15C17.8284 5 19.2426 5 20.1213 5.87868C21 6.75736 21 8.17157 21 11V16C21 18.8284 21 20.2426 20.1213 21.1213C19.2426 22 17.8284 22 15 22H12C9.17157 22 7.75736 22 6.87868 21.1213C6 20.2426 6 18.8284 6 16V11Z" stroke="#1C274C" stroke-width="1.5"/>
2440
+ <path xmlns="http://www.w3.org/2000/svg" opacity="0.5" d="M6 19C4.34315 19 3 17.6569 3 16V10C3 6.22876 3 4.34315 4.17157 3.17157C5.34315 2 7.22876 2 11 2H15C16.6569 2 18 3.34315 18 5" stroke="#1C274C" stroke-width="1.5"/>
2441
+ </svg>`;
2442
+ }
2443
+
1928
2444
  class CustomViewsWidget {
1929
2445
  core;
1930
2446
  container;
@@ -1943,7 +2459,7 @@ class CustomViewsWidget {
1943
2459
  theme: options.theme || 'light',
1944
2460
  showReset: options.showReset ?? true,
1945
2461
  title: options.title || 'Customize View',
1946
- description: options.description || 'Toggle different content sections to customize your view. Changes are applied instantly and the URL will be updated for sharing.',
2462
+ description: options.description || '',
1947
2463
  showWelcome: options.showWelcome ?? false,
1948
2464
  welcomeTitle: options.welcomeTitle || 'Site Customization',
1949
2465
  welcomeMessage: options.welcomeMessage || 'This site is powered by Custom Views. Use the widget on the side (⚙) to customize your experience. Your preferences will be saved and can be shared via URL.<br><br>Learn more at <a href="https://github.com/customviews-js/customviews" target="_blank">customviews GitHub</a>.',
@@ -2025,21 +2541,24 @@ class CustomViewsWidget {
2025
2541
  this.modal = document.createElement('div');
2026
2542
  this.modal.className = 'cv-widget-modal-overlay';
2027
2543
  this.applyThemeToModal();
2028
- const toggleControls = toggles.length
2029
- ? toggles.map(toggle => `
2030
- <div class="cv-custom-state-toggle">
2031
- <label>
2032
- <div class="cv-toggle-switch" data-toggle="${toggle}">
2033
- <div class="cv-toggle-handle"></div>
2034
- </div>
2035
- ${this.formatToggleName(toggle)}
2544
+ const toggleControlsHtml = toggles.map(toggle => `
2545
+ <div class="cv-toggle-card">
2546
+ <div class="cv-toggle-content">
2547
+ <div>
2548
+ <p class="cv-toggle-title">${this.formatToggleName(toggle)}</p>
2549
+ </div>
2550
+ <label class="cv-toggle-label">
2551
+ <input class="cv-toggle-input" type="checkbox" data-toggle="${toggle}"/>
2552
+ <span class="cv-toggle-slider"></span>
2036
2553
  </label>
2037
2554
  </div>
2038
- `).join('')
2039
- : `<p class="cv-no-toggles">No configurable sections available.</p>`;
2555
+ </div>
2556
+ `).join('');
2557
+ // Todo: Re-add description if needed (Line 168, add label field to toggles if needed change structure)
2558
+ // <p class="cv-toggle-description">Show or hide the ${this.formatToggleName(toggle).toLowerCase()} area </p>
2040
2559
  // Get tab groups
2041
2560
  const tabGroups = this.core.getTabGroups();
2042
- let tabGroupsHTML = '';
2561
+ let tabGroupControlsHTML = '';
2043
2562
  // Check if any tab group or tab labels contain Font Awesome shortcodes
2044
2563
  let hasFontAwesomeShortcodes = false;
2045
2564
  if (this.options.showTabGroups && tabGroups && tabGroups.length > 0) {
@@ -2063,47 +2582,81 @@ class CustomViewsWidget {
2063
2582
  ensureFontAwesomeInjected();
2064
2583
  }
2065
2584
  if (this.options.showTabGroups && tabGroups && tabGroups.length > 0) {
2066
- const tabGroupControls = tabGroups.map(group => {
2067
- const options = group.tabs.map(tab => `<option value="${tab.id}">${replaceIconShortcodes(tab.label || tab.id)}</option>`).join('');
2068
- return `
2069
- <div class="cv-tab-group-control">
2070
- <label for="tab-group-${group.id}">${replaceIconShortcodes(group.label || group.id)}</label>
2071
- <select id="tab-group-${group.id}" class="cv-tab-group-select" data-group-id="${group.id}">
2072
- ${options}
2073
- </select>
2585
+ tabGroupControlsHTML = `
2586
+ <div class="cv-tabgroup-card cv-tabgroup-header">
2587
+ <div class="cv-tabgroup-row">
2588
+ <div class="cv-tabgroup-info">
2589
+ <p class="cv-tabgroup-title">Navigation Headers</p>
2590
+ <p class="cv-tabgroup-description">Show or hide navigation headers</p>
2591
+ </div>
2592
+ <label class="cv-toggle-switch cv-nav-toggle">
2593
+ <input class="cv-nav-pref-input" type="checkbox" aria-label="Show or hide navigation headers" />
2594
+ <span class="cv-switch-bg"></span>
2595
+ <span class="cv-switch-knob"></span>
2596
+ </label>
2074
2597
  </div>
2075
- `;
2076
- }).join('');
2077
- tabGroupsHTML = `
2078
- <h4>Tab Groups</h4>
2079
- <div class="cv-tab-groups">
2080
- ${tabGroupControls}
2598
+ </div>
2599
+ <div class="cv-tab-groups-list">
2600
+ ${tabGroups.map(group => `
2601
+ <div class="cv-tabgroup-card cv-tabgroup-item">
2602
+ <label class="cv-tabgroup-label" for="tab-group-${group.id}">
2603
+ ${replaceIconShortcodes(group.label || group.id)}
2604
+ </label>
2605
+ <select id="tab-group-${group.id}" class="cv-tabgroup-select" data-group-id="${group.id}">
2606
+ ${group.tabs.map(tab => `<option value="${tab.id}">${replaceIconShortcodes(tab.label || tab.id)}</option>`).join('')}
2607
+ </select>
2608
+ </div>
2609
+ `).join('')}
2081
2610
  </div>
2082
2611
  `;
2083
2612
  }
2084
2613
  this.modal.innerHTML = `
2085
2614
  <div class="cv-widget-modal cv-custom-state-modal">
2086
- <div class="cv-widget-modal-header">
2087
- <h3>${this.options.title}</h3>
2088
- <button class="cv-widget-modal-close" aria-label="Close modal">×</button>
2089
- </div>
2090
- <div class="cv-widget-modal-content">
2091
- <div class="cv-custom-state-form">
2092
- <p>${this.options.description}</p>
2093
-
2094
- <h4>Content Sections</h4>
2095
- <div class="cv-custom-toggles">
2096
- ${toggleControls}
2615
+ <header class="cv-modal-header">
2616
+ <div class="cv-modal-header-content">
2617
+ <div class="cv-modal-icon">
2618
+ ${getGearIcon()}
2097
2619
  </div>
2098
-
2099
- ${tabGroupsHTML}
2100
-
2101
- <div class="cv-custom-state-actions">
2102
- ${this.options.showReset ? `<button class="cv-custom-state-reset">Reset to Default</button>` : ''}
2103
- <button class="cv-custom-state-copy-url">Copy Shareable URL</button>
2620
+ <div class="cv-modal-title">${this.options.title}</div>
2621
+ </div>
2622
+ <button class="cv-modal-close" aria-label="Close modal">
2623
+ ${getCloseIcon()}
2624
+ </button>
2625
+ </header>
2626
+ <main class="cv-modal-main">
2627
+ ${this.options.description ? `<p class="cv-modal-description">${this.options.description}</p>` : ''}
2628
+
2629
+ ${toggles.length ? `
2630
+ <div class="cv-content-section">
2631
+ <div class="cv-section-heading">Toggles</div>
2632
+ <div class="cv-toggles-container">
2633
+ ${toggleControlsHtml}
2104
2634
  </div>
2105
2635
  </div>
2106
- </div>
2636
+ ` : ''}
2637
+
2638
+ ${this.options.showTabGroups && tabGroups && tabGroups.length > 0 ? `
2639
+ <div class="cv-content-section">
2640
+ <div class="cv-section-heading">Tab Groups</div>
2641
+ <div class="cv-tabgroups-container">
2642
+ ${tabGroupControlsHTML}
2643
+ </div>
2644
+ </div>
2645
+ ` : ''}
2646
+ </main>
2647
+
2648
+ <footer class="cv-modal-footer">
2649
+ ${this.options.showReset ? `
2650
+ <button class="cv-reset-btn">
2651
+ ${getResetIcon()}
2652
+ <span>Reset to Default</span>
2653
+ </button>
2654
+ ` : ''}
2655
+ <button class="cv-share-btn">
2656
+ ${getShareIcon()}
2657
+ <span>Copy Shareable URL</span>
2658
+ </button>
2659
+ </footer>
2107
2660
  </div>
2108
2661
  `;
2109
2662
  document.body.appendChild(this.modal);
@@ -2118,21 +2671,21 @@ class CustomViewsWidget {
2118
2671
  if (!this.modal)
2119
2672
  return;
2120
2673
  // Close button
2121
- const closeBtn = this.modal.querySelector('.cv-widget-modal-close');
2674
+ const closeBtn = this.modal.querySelector('.cv-modal-close');
2122
2675
  if (closeBtn) {
2123
2676
  closeBtn.addEventListener('click', () => {
2124
2677
  this.closeModal();
2125
2678
  });
2126
2679
  }
2127
2680
  // Copy URL button
2128
- const copyUrlBtn = this.modal.querySelector('.cv-custom-state-copy-url');
2681
+ const copyUrlBtn = this.modal.querySelector('.cv-share-btn');
2129
2682
  if (copyUrlBtn) {
2130
2683
  copyUrlBtn.addEventListener('click', () => {
2131
2684
  this.copyShareableURL();
2132
2685
  });
2133
2686
  }
2134
2687
  // Reset to default button
2135
- const resetBtn = this.modal.querySelector('.cv-custom-state-reset');
2688
+ const resetBtn = this.modal.querySelector('.cv-reset-btn');
2136
2689
  if (resetBtn) {
2137
2690
  resetBtn.addEventListener('click', () => {
2138
2691
  this.core.resetToDefault();
@@ -2140,25 +2693,55 @@ class CustomViewsWidget {
2140
2693
  });
2141
2694
  }
2142
2695
  // Listen to toggle switches
2143
- const toggleSwitches = this.modal.querySelectorAll('.cv-toggle-switch');
2144
- toggleSwitches.forEach(toggleSwitch => {
2145
- toggleSwitch.addEventListener('click', () => {
2146
- toggleSwitch.classList.toggle('cv-toggle-active');
2696
+ const toggleInputs = this.modal.querySelectorAll('.cv-toggle-input');
2697
+ toggleInputs.forEach(toggleInput => {
2698
+ toggleInput.addEventListener('change', () => {
2147
2699
  const state = this.getCurrentCustomStateFromModal();
2148
2700
  this.core.applyState(state);
2149
2701
  });
2150
2702
  });
2151
2703
  // Listen to tab group selects
2152
- const tabGroupSelects = this.modal.querySelectorAll('.cv-tab-group-select');
2704
+ const tabGroupSelects = this.modal.querySelectorAll('.cv-tabgroup-select');
2153
2705
  tabGroupSelects.forEach(select => {
2154
2706
  select.addEventListener('change', () => {
2155
2707
  const groupId = select.dataset.groupId;
2156
2708
  const tabId = select.value;
2157
2709
  if (groupId && tabId) {
2158
- this.core.setActiveTab(groupId, tabId);
2710
+ // Get current state and update the tab for this group, then apply globally
2711
+ // This triggers sync behavior and persistence
2712
+ const currentTabs = this.core.getCurrentActiveTabs();
2713
+ currentTabs[groupId] = tabId;
2714
+ // Apply state globally for persistence and sync
2715
+ const currentToggles = this.core.getCurrentActiveToggles();
2716
+ const newState = {
2717
+ toggles: currentToggles,
2718
+ tabs: currentTabs
2719
+ };
2720
+ this.core.applyState(newState);
2159
2721
  }
2160
2722
  });
2161
2723
  });
2724
+ // Listener for show/hide tab navs
2725
+ const tabNavToggle = this.modal.querySelector('.cv-nav-pref-input');
2726
+ if (tabNavToggle) {
2727
+ tabNavToggle.addEventListener('change', () => {
2728
+ const visible = tabNavToggle.checked;
2729
+ // Persist preference
2730
+ try {
2731
+ localStorage.setItem('cv-tab-navs-visible', visible ? 'true' : 'false');
2732
+ }
2733
+ catch (e) { /* ignore */ }
2734
+ // Apply to DOM using TabManager via core
2735
+ try {
2736
+ const rootEl = document.body;
2737
+ TabManager.setNavsVisibility(rootEl, visible);
2738
+ }
2739
+ catch (e) {
2740
+ // ignore errors
2741
+ console.error('Failed to set tab nav visibility:', e);
2742
+ }
2743
+ });
2744
+ }
2162
2745
  // Overlay click to close
2163
2746
  this.modal.addEventListener('click', (e) => {
2164
2747
  if (e.target === this.modal) {
@@ -2196,15 +2779,15 @@ class CustomViewsWidget {
2196
2779
  }
2197
2780
  // Collect toggle values
2198
2781
  const toggles = [];
2199
- const toggleSwitches = this.modal.querySelectorAll('.cv-toggle-switch');
2200
- toggleSwitches.forEach(toggleSwitch => {
2201
- const toggle = toggleSwitch.dataset.toggle;
2202
- if (toggle && toggleSwitch.classList.contains('cv-toggle-active')) {
2782
+ const toggleInputs = this.modal.querySelectorAll('.cv-toggle-input');
2783
+ toggleInputs.forEach(toggleInput => {
2784
+ const toggle = toggleInput.dataset.toggle;
2785
+ if (toggle && toggleInput.checked) {
2203
2786
  toggles.push(toggle);
2204
2787
  }
2205
2788
  });
2206
2789
  // Collect tab selections
2207
- const tabGroupSelects = this.modal.querySelectorAll('.cv-tab-group-select');
2790
+ const tabGroupSelects = this.modal.querySelectorAll('.cv-tabgroup-select');
2208
2791
  const tabs = {};
2209
2792
  tabGroupSelects.forEach(select => {
2210
2793
  const groupId = select.dataset.groupId;
@@ -2236,27 +2819,45 @@ class CustomViewsWidget {
2236
2819
  return;
2237
2820
  // Get currently active toggles (from custom state or default configuration)
2238
2821
  const activeToggles = this.core.getCurrentActiveToggles();
2239
- // First, deactivate all toggle switches
2240
- const allToggleSwitches = this.modal.querySelectorAll('.cv-toggle-switch');
2241
- allToggleSwitches.forEach(toggleSwitch => {
2242
- toggleSwitch.classList.remove('cv-toggle-active');
2822
+ // First, uncheck all toggle inputs
2823
+ const allToggleInputs = this.modal.querySelectorAll('.cv-toggle-input');
2824
+ allToggleInputs.forEach(toggleInput => {
2825
+ toggleInput.checked = false;
2243
2826
  });
2244
- // Then activate the ones that should be active
2827
+ // Then check the ones that should be active
2245
2828
  activeToggles.forEach(toggle => {
2246
- const toggleSwitch = this.modal?.querySelector(`[data-toggle="${toggle}"]`);
2247
- if (toggleSwitch) {
2248
- toggleSwitch.classList.add('cv-toggle-active');
2829
+ const toggleInput = this.modal?.querySelector(`[data-toggle="${toggle}"]`);
2830
+ if (toggleInput) {
2831
+ toggleInput.checked = true;
2249
2832
  }
2250
2833
  });
2251
2834
  // Load tab group selections
2252
2835
  const activeTabs = this.core.getCurrentActiveTabs();
2253
- const tabGroupSelects = this.modal.querySelectorAll('.cv-tab-group-select');
2836
+ const tabGroupSelects = this.modal.querySelectorAll('.cv-tab-groupselect');
2254
2837
  tabGroupSelects.forEach(select => {
2255
2838
  const groupId = select.dataset.groupId;
2256
2839
  if (groupId && activeTabs[groupId]) {
2257
2840
  select.value = activeTabs[groupId];
2258
2841
  }
2259
2842
  });
2843
+ // Load tab nav visibility preference
2844
+ const navPref = (() => {
2845
+ try {
2846
+ const raw = localStorage.getItem('cv-tab-navs-visible');
2847
+ if (raw === null)
2848
+ return TabManager.areNavsVisible(document.body);
2849
+ return raw === 'true';
2850
+ }
2851
+ catch (e) {
2852
+ return TabManager.areNavsVisible(document.body);
2853
+ }
2854
+ })();
2855
+ const tabNavToggle = this.modal.querySelector('.cv-nav-pref-input');
2856
+ if (tabNavToggle) {
2857
+ tabNavToggle.checked = navPref;
2858
+ // Ensure UI matches actual visibility
2859
+ TabManager.setNavsVisibility(document.body, navPref);
2860
+ }
2260
2861
  }
2261
2862
  /**
2262
2863
  * Format toggle name for display
@@ -2292,21 +2893,25 @@ class CustomViewsWidget {
2292
2893
  this.applyThemeToModal();
2293
2894
  this.modal.innerHTML = `
2294
2895
  <div class="cv-widget-modal cv-welcome-modal">
2295
- <div class="cv-widget-modal-header">
2296
- <h3>${this.options.welcomeTitle}</h3>
2297
- <button class="cv-widget-modal-close" aria-label="Close modal">×</button>
2298
- </div>
2299
- <div class="cv-widget-modal-content">
2300
- <div class="cv-welcome-content">
2301
- <p style="text-align: justify;">${this.options.welcomeMessage}</p>
2302
-
2303
- <div class="cv-welcome-widget-preview">
2304
- <div class="cv-welcome-widget-icon">⚙</div>
2305
- <p class="cv-welcome-widget-label">Look for this widget on the side of the screen</p>
2896
+ <header class="cv-modal-header">
2897
+ <div class="cv-modal-header-content">
2898
+ <div class="cv-modal-icon">
2899
+ ${getGearIcon()}
2900
+ </div>
2901
+ <h1 class="cv-modal-title">${this.options.welcomeTitle}</h1>
2902
+ </div>
2903
+ </header>
2904
+ <div class="cv-modal-main">
2905
+ <p class="cv-welcome-message">${this.options.welcomeMessage}</p>
2906
+
2907
+ <div class="cv-welcome-widget-preview">
2908
+ <div class="cv-welcome-widget-icon">
2909
+ ${getGearIcon()}
2306
2910
  </div>
2307
-
2308
- <button class="cv-welcome-got-it">Got it!</button>
2911
+ <p class="cv-welcome-widget-label">Look for this widget</p>
2309
2912
  </div>
2913
+
2914
+ <button class="cv-welcome-got-it">Got it!</button>
2310
2915
  </div>
2311
2916
  </div>
2312
2917
  `;
@@ -2319,13 +2924,6 @@ class CustomViewsWidget {
2319
2924
  attachWelcomeModalEventListeners() {
2320
2925
  if (!this.modal)
2321
2926
  return;
2322
- // Close button
2323
- const closeBtn = this.modal.querySelector('.cv-widget-modal-close');
2324
- if (closeBtn) {
2325
- closeBtn.addEventListener('click', () => {
2326
- this.closeModal();
2327
- });
2328
- }
2329
2927
  // Got it button
2330
2928
  const gotItBtn = this.modal.querySelector('.cv-welcome-got-it');
2331
2929
  if (gotItBtn) {