@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.
@@ -374,10 +374,17 @@
374
374
  const TAB_SELECTOR = 'cv-tab';
375
375
  const NAV_AUTO_SELECTOR = 'cv-tabgroup[nav="auto"], cv-tabgroup:not([nav])';
376
376
  const NAV_CONTAINER_CLASS = 'cv-tabs-nav';
377
- /**
378
- * TabManager handles discovery, visibility, and navigation for tab groups and tabs
379
- */
377
+ const NAV_HIDE_ROOT_CLASS = 'cv-hide-tab-navs';
378
+ const NAV_HIDDEN_CLASS = 'cv-tabs-nav-hidden';
380
379
  class TabManager {
380
+ /**
381
+ * Split a tab ID into multiple IDs if it contains spaces or |
382
+ */
383
+ static splitTabIds(tabId) {
384
+ const splitIds = tabId.split(/[\s|]+/).filter(id => id.trim() !== '');
385
+ const trimmedIds = splitIds.map(id => id.trim());
386
+ return trimmedIds;
387
+ }
381
388
  /**
382
389
  * Apply tab selections to all tab groups in the DOM
383
390
  */
@@ -389,22 +396,26 @@
389
396
  if (!groupId)
390
397
  return;
391
398
  // Determine the active tab for this group
392
- const activeTabId = this.resolveActiveTab(groupId, tabs, cfgGroups, groupEl);
399
+ const activeTabId = this.resolveActiveTabForGroup(groupId, tabs, cfgGroups, groupEl);
393
400
  // Apply visibility to direct child cv-tab elements only (not nested ones)
394
401
  const tabElements = Array.from(groupEl.children).filter((child) => child.tagName.toLowerCase() === TAB_SELECTOR);
395
402
  tabElements.forEach((tabEl) => {
396
403
  const tabId = tabEl.getAttribute('id');
397
404
  if (!tabId)
398
405
  return;
399
- const isActive = tabId === activeTabId;
406
+ // Split IDs and check if any match the active tab
407
+ const splitIds = this.splitTabIds(tabId);
408
+ const isActive = splitIds.includes(activeTabId || '');
400
409
  this.applyTabVisibility(tabEl, isActive);
401
410
  });
402
411
  });
403
412
  }
404
413
  /**
405
414
  * Resolve the active tab for a group based on state, config, and DOM
415
+ *
416
+ * Pass in the current tabs state, config groups, and the group element
406
417
  */
407
- static resolveActiveTab(groupId, tabs, cfgGroups, groupEl) {
418
+ static resolveActiveTabForGroup(groupId, tabs, cfgGroups, groupEl) {
408
419
  // 1. Check state
409
420
  if (tabs[groupId]) {
410
421
  return tabs[groupId];
@@ -426,7 +437,8 @@
426
437
  // 3. Fallback to first direct cv-tab child in DOM
427
438
  const firstTab = Array.from(groupEl.children).find((child) => child.tagName.toLowerCase() === TAB_SELECTOR);
428
439
  if (firstTab) {
429
- return firstTab.getAttribute('id');
440
+ const splitIds = this.splitTabIds(firstTab.getAttribute('id') || '');
441
+ return splitIds[0] || null;
430
442
  }
431
443
  return null;
432
444
  }
@@ -446,7 +458,7 @@
446
458
  /**
447
459
  * Build navigation for tab groups with nav="auto" (one-time setup)
448
460
  */
449
- static buildNavs(rootEl, cfgGroups, onTabClick) {
461
+ static buildNavs(rootEl, cfgGroups, onTabClick, onTabDoubleClick) {
450
462
  // Find all cv-tabgroup elements with nav="auto" or no nav attribute
451
463
  const tabGroups = rootEl.querySelectorAll(NAV_AUTO_SELECTOR);
452
464
  // Check if any tab headers contain Font Awesome shortcodes
@@ -457,11 +469,14 @@
457
469
  if (!groupId)
458
470
  return;
459
471
  const tabElements = Array.from(groupEl.children).filter((child) => child.tagName.toLowerCase() === 'cv-tab');
472
+ // Check for Font Awesome shortcodes in tab headers
460
473
  tabElements.forEach((tabEl) => {
461
474
  const tabId = tabEl.getAttribute('id');
462
475
  if (!tabId)
463
476
  return;
464
- const header = tabEl.getAttribute('header') || this.getTabLabel(tabId, groupId, cfgGroups) || tabId;
477
+ const splitIds = this.splitTabIds(tabId);
478
+ const firstId = splitIds[0] || tabId;
479
+ const header = tabEl.getAttribute('header') || this.getTabLabel(firstId, groupId, cfgGroups) || firstId || '';
465
480
  if (/:fa-[\w-]+:/.test(header)) {
466
481
  hasFontAwesomeShortcodes = true;
467
482
  }
@@ -487,41 +502,90 @@
487
502
  navContainer = document.createElement('ul');
488
503
  navContainer.className = `${NAV_CONTAINER_CLASS} nav-tabs`;
489
504
  navContainer.setAttribute('role', 'tablist');
505
+ // Respect viewer preference on the root to show/hide navs
506
+ const showNavs = !rootEl.classList.contains(NAV_HIDE_ROOT_CLASS);
507
+ if (!showNavs) {
508
+ navContainer.classList.add(NAV_HIDDEN_CLASS);
509
+ navContainer.setAttribute('aria-hidden', 'true');
510
+ }
511
+ else {
512
+ navContainer.setAttribute('aria-hidden', 'false');
513
+ }
490
514
  groupEl.insertBefore(navContainer, groupEl.firstChild);
491
515
  // Build nav items
492
516
  tabElements.forEach((tabEl) => {
493
517
  const tabId = tabEl.getAttribute('id');
494
518
  if (!tabId)
495
519
  return;
496
- const header = tabEl.getAttribute('header') || this.getTabLabel(tabId, groupId, cfgGroups) || tabId;
497
- const listItem = document.createElement('li');
498
- listItem.className = 'nav-item';
499
- const navLink = document.createElement('a');
500
- navLink.className = 'nav-link';
501
- // Replace icon shortcodes in header
502
- navLink.innerHTML = replaceIconShortcodes(header);
503
- navLink.href = '#';
504
- navLink.setAttribute('data-tab-id', tabId);
505
- navLink.setAttribute('data-group-id', groupId);
506
- navLink.setAttribute('role', 'tab');
507
- // Check if this tab is currently active
508
- const isActive = tabEl.classList.contains('cv-visible');
509
- if (isActive) {
510
- navLink.classList.add('active');
511
- navLink.setAttribute('aria-selected', 'true');
520
+ const splitIds = this.splitTabIds(tabId);
521
+ // Header demarcation: if header contains |, split and use per tab.
522
+ // If header attribute is present and not demarcated, use it as the fallback header.
523
+ const headerAttr = tabEl.getAttribute('header') || '';
524
+ let headerParts = [];
525
+ if (headerAttr && headerAttr.includes('|')) {
526
+ headerParts = headerAttr.split('|').map(h => h.trim());
512
527
  }
513
- else {
514
- navLink.setAttribute('aria-selected', 'false');
528
+ const firstId = splitIds[0] || tabId;
529
+ let fallbackHeader = '';
530
+ if (headerAttr && !headerAttr.includes('|')) {
531
+ // Single header provided on the element: use for all split IDs
532
+ fallbackHeader = headerAttr;
515
533
  }
516
- // Add click handler
517
- if (onTabClick) {
518
- navLink.addEventListener('click', (e) => {
519
- e.preventDefault();
520
- onTabClick(groupId, tabId);
521
- });
534
+ else {
535
+ // No header attribute or multi-part header: use config label or id as fallback
536
+ fallbackHeader = this.getTabLabel(firstId, groupId, cfgGroups) || firstId || '';
522
537
  }
523
- listItem.appendChild(navLink);
524
- navContainer.appendChild(listItem);
538
+ // Create nav links for each split ID
539
+ splitIds.forEach((splitId, idx) => {
540
+ const listItem = document.createElement('li');
541
+ listItem.className = 'nav-item';
542
+ const navLink = document.createElement('a');
543
+ navLink.className = 'nav-link';
544
+ // Use demarcated header if available, else prefer config label for this specific splitId
545
+ let header = fallbackHeader;
546
+ if (headerParts.length === splitIds.length) {
547
+ header = headerParts[idx] ?? fallbackHeader;
548
+ }
549
+ else if (!headerAttr || headerAttr.includes('|')) {
550
+ // Prefer the config label for the individual splitId over using firstId
551
+ header = this.getTabLabel(splitId, groupId, cfgGroups) || splitId || '';
552
+ }
553
+ navLink.innerHTML = replaceIconShortcodes(header);
554
+ navLink.href = '#';
555
+ navLink.setAttribute('data-tab-id', splitId);
556
+ navLink.setAttribute('data-group-id', groupId);
557
+ navLink.setAttribute('role', 'tab');
558
+ // Check if this split ID is active (same logic as applySelections)
559
+ const activeTabId = this.resolveActiveTabForGroup(groupId, {}, cfgGroups, groupEl); // Pass empty tabs for initial state
560
+ const isActive = splitIds.includes(activeTabId || '');
561
+ if (isActive) {
562
+ navLink.classList.add('active');
563
+ navLink.setAttribute('aria-selected', 'true');
564
+ }
565
+ else {
566
+ navLink.setAttribute('aria-selected', 'false');
567
+ }
568
+ // Add click handler for local tab switch
569
+ if (onTabClick) {
570
+ navLink.addEventListener('click', (e) => {
571
+ e.preventDefault();
572
+ // console.log("Single-click detected");
573
+ onTabClick(groupId, splitId, groupEl);
574
+ });
575
+ }
576
+ // Add double-click handler for sync
577
+ if (onTabDoubleClick) {
578
+ navLink.addEventListener('dblclick', (e) => {
579
+ e.preventDefault();
580
+ // console.log("Double-click detected");
581
+ onTabDoubleClick(groupId, splitId, groupEl);
582
+ });
583
+ }
584
+ // Add tooltip for UX feedback (use native title attribute)
585
+ navLink.setAttribute('title', 'Double click to change switch tabs across all groups');
586
+ listItem.appendChild(navLink);
587
+ navContainer.appendChild(listItem);
588
+ });
525
589
  });
526
590
  // Add bottom border line at the end of the tab group
527
591
  const bottomBorder = document.createElement('div');
@@ -529,6 +593,44 @@
529
593
  groupEl.appendChild(bottomBorder);
530
594
  });
531
595
  }
596
+ /**
597
+ * Toggle nav visibility for all tab groups (viewer-controlled)
598
+ */
599
+ static setNavsVisibility(rootEl, visible) {
600
+ if (visible) {
601
+ rootEl.classList.remove(NAV_HIDE_ROOT_CLASS);
602
+ }
603
+ else {
604
+ rootEl.classList.add(NAV_HIDE_ROOT_CLASS);
605
+ }
606
+ const navContainers = rootEl.querySelectorAll(`.${NAV_CONTAINER_CLASS}`);
607
+ navContainers.forEach((nav) => {
608
+ if (visible) {
609
+ nav.classList.remove(NAV_HIDDEN_CLASS);
610
+ nav.setAttribute('aria-hidden', 'false');
611
+ }
612
+ else {
613
+ nav.classList.add(NAV_HIDDEN_CLASS);
614
+ nav.setAttribute('aria-hidden', 'true');
615
+ }
616
+ });
617
+ // Also hide/show the bottom border of tab groups
618
+ const bottomBorders = rootEl.querySelectorAll('.cv-tabgroup-bottom-border');
619
+ bottomBorders.forEach((border) => {
620
+ if (visible) {
621
+ border.classList.remove('cv-hidden');
622
+ }
623
+ else {
624
+ border.classList.add('cv-hidden');
625
+ }
626
+ });
627
+ }
628
+ /**
629
+ * Read current nav visibility (viewer preference)
630
+ */
631
+ static areNavsVisible(rootEl) {
632
+ return !rootEl.classList.contains(NAV_HIDE_ROOT_CLASS);
633
+ }
532
634
  /**
533
635
  * Get tab label from config
534
636
  */
@@ -542,23 +644,25 @@
542
644
  return tabCfg?.label || null;
543
645
  }
544
646
  /**
545
- * Update active state in navs after selection change (single group)
647
+ * Update active state in navs for a specific tabgroup element only
546
648
  */
547
- static updateNavActiveState(rootEl, groupId, activeTabId) {
548
- const tabGroups = rootEl.querySelectorAll(`${TABGROUP_SELECTOR}[id="${groupId}"]`);
549
- tabGroups.forEach((groupEl) => {
550
- const navLinks = groupEl.querySelectorAll('.nav-link');
551
- navLinks.forEach((link) => {
552
- const tabId = link.getAttribute('data-tab-id');
553
- if (tabId === activeTabId) {
554
- link.classList.add('active');
555
- link.setAttribute('aria-selected', 'true');
556
- }
557
- else {
558
- link.classList.remove('active');
559
- link.setAttribute('aria-selected', 'false');
560
- }
561
- });
649
+ static updateNavActiveState(groupEl, activeTabId) {
650
+ const navLinks = groupEl.querySelectorAll('.nav-link');
651
+ navLinks.forEach((link) => {
652
+ const linkTabId = link.getAttribute('data-tab-id');
653
+ if (!linkTabId)
654
+ return;
655
+ // Check if activeTabId matches or is in the split IDs of this link
656
+ const splitIds = this.splitTabIds(linkTabId);
657
+ const isActive = linkTabId === activeTabId || splitIds.includes(activeTabId);
658
+ if (isActive) {
659
+ link.classList.add('active');
660
+ link.setAttribute('aria-selected', 'true');
661
+ }
662
+ else {
663
+ link.classList.remove('active');
664
+ link.setAttribute('aria-selected', 'false');
665
+ }
562
666
  });
563
667
  }
564
668
  /**
@@ -571,14 +675,19 @@
571
675
  if (!groupId)
572
676
  return;
573
677
  // Determine the active tab for this group
574
- const activeTabId = this.resolveActiveTab(groupId, tabs, cfgGroups, groupEl);
678
+ const activeTabId = this.resolveActiveTabForGroup(groupId, tabs, cfgGroups, groupEl);
575
679
  if (!activeTabId)
576
680
  return;
577
681
  // Update nav links for this group
578
682
  const navLinks = groupEl.querySelectorAll('.nav-link');
579
683
  navLinks.forEach((link) => {
580
- const tabId = link.getAttribute('data-tab-id');
581
- if (tabId === activeTabId) {
684
+ const linkTabId = link.getAttribute('data-tab-id');
685
+ if (!linkTabId)
686
+ return;
687
+ // Check if activeTabId matches or is in the split IDs of this link
688
+ const splitIds = this.splitTabIds(linkTabId);
689
+ const isActive = linkTabId === activeTabId || splitIds.includes(activeTabId);
690
+ if (isActive) {
582
691
  link.classList.add('active');
583
692
  link.setAttribute('aria-selected', 'true');
584
693
  }
@@ -589,6 +698,47 @@
589
698
  });
590
699
  });
591
700
  }
701
+ /**
702
+ * Apply tab selection to a specific tabgroup element only (not globally).
703
+ * Used for single-click behavior to update only the clicked tabgroup.
704
+ */
705
+ static applyTabLocalOnly(groupEl, activeTabId) {
706
+ const tabElements = Array.from(groupEl.children).filter((child) => child.tagName.toLowerCase() === TAB_SELECTOR);
707
+ tabElements.forEach((tabEl) => {
708
+ const tabId = tabEl.getAttribute('id');
709
+ if (!tabId)
710
+ return;
711
+ const splitIds = this.splitTabIds(tabId);
712
+ const isActive = splitIds.includes(activeTabId);
713
+ this.applyTabVisibility(tabEl, isActive);
714
+ });
715
+ }
716
+ /**
717
+ * Check if a tabgroup element contains a specific tab ID (respects split IDs).
718
+ * Accepts groupEl to avoid repeated DOM queries.
719
+ */
720
+ static groupHasTab(groupEl, tabId) {
721
+ const tabElements = Array.from(groupEl.children).filter((child) => child.tagName.toLowerCase() === TAB_SELECTOR);
722
+ return tabElements.some((tabEl) => {
723
+ const idAttr = tabEl.getAttribute('id') || '';
724
+ const splitIds = this.splitTabIds(idAttr);
725
+ return splitIds.includes(tabId);
726
+ });
727
+ }
728
+ /**
729
+ * Returns array of group elements to be synced (excluding source).
730
+ */
731
+ static getTabgroupsWithId(rootEl, sourceGroupId, tabId) {
732
+ const syncedGroupEls = [];
733
+ const allGroupEls = Array.from(rootEl.querySelectorAll(`${TABGROUP_SELECTOR}[id="${sourceGroupId}"]`));
734
+ allGroupEls.forEach((targetGroupEl) => {
735
+ // Only sync if target group actually contains this tab
736
+ if (this.groupHasTab(targetGroupEl, tabId)) {
737
+ syncedGroupEls.push(targetGroupEl);
738
+ }
739
+ });
740
+ return syncedGroupEls;
741
+ }
592
742
  }
593
743
 
594
744
  class AssetsManager {
@@ -843,6 +993,18 @@ cv-tabgroup {
843
993
  .cv-tab-content {
844
994
  padding: 1rem 0;
845
995
  }
996
+
997
+ /* Viewer-controlled nav visibility: hide nav containers when requested */
998
+ .cv-tabs-nav-hidden {
999
+ display: none !important;
1000
+ }
1001
+
1002
+ /* Print-friendly: hide tab navigation when printing to reduce clutter */
1003
+ @media print {
1004
+ .cv-tabs-nav {
1005
+ display: none !important;
1006
+ }
1007
+ }
846
1008
  `;
847
1009
 
848
1010
  /**
@@ -910,33 +1072,51 @@ ${TAB_STYLES}
910
1072
  /**
911
1073
  * Set active tab for a group and apply state
912
1074
  */
913
- setActiveTab(groupId, tabId) {
914
- // Get current state
915
- const currentToggles = this.getCurrentActiveToggles();
916
- const currentTabs = this.getCurrentActiveTabs();
917
- // Merge new tab selection
918
- const newTabs = { ...currentTabs, [groupId]: tabId };
919
- // Create new state
920
- const newState = {
921
- toggles: currentToggles,
922
- tabs: newTabs
923
- };
924
- // Apply the state
925
- this.applyState(newState);
926
- // Emit custom event
927
- const event = new CustomEvent('customviews:tab-change', {
928
- detail: { groupId, tabId },
929
- bubbles: true
930
- });
931
- document.dispatchEvent(event);
1075
+ setActiveTab(groupId, tabId, groupEl) {
1076
+ // If groupEl is provided, apply tab selection locally to just that element
1077
+ // Single-click: only updates DOM visually, no persistence
1078
+ if (groupEl) {
1079
+ TabManager.applyTabLocalOnly(groupEl, tabId);
1080
+ // Update nav active state for this group element only
1081
+ TabManager.updateNavActiveState(groupEl, tabId);
1082
+ // Emit custom event for local tab change
1083
+ const event = new CustomEvent('customviews:tab-change', {
1084
+ detail: { groupId, tabId, synced: false },
1085
+ bubbles: true
1086
+ });
1087
+ document.dispatchEvent(event);
1088
+ }
932
1089
  }
933
1090
  // Inject styles, setup listeners and call rendering logic
934
1091
  async init() {
935
1092
  injectCoreStyles();
936
- // Build navigation once (with click handlers)
937
- TabManager.buildNavs(this.rootEl, this.config.tabGroups, (groupId, tabId) => {
938
- this.setActiveTab(groupId, tabId);
1093
+ // Build navigation once (with click and double-click handlers)
1094
+ TabManager.buildNavs(this.rootEl, this.config.tabGroups,
1095
+ // Single click: update clicked group only (local, no persistence)
1096
+ (groupId, tabId, groupEl) => {
1097
+ this.setActiveTab(groupId, tabId, groupEl);
1098
+ },
1099
+ // Double click: sync across all tabgroups with same id (with persistence)
1100
+ (groupId, tabId, _groupEl) => {
1101
+ const currentTabs = this.getCurrentActiveTabs();
1102
+ currentTabs[groupId] = tabId;
1103
+ const currentToggles = this.getCurrentActiveToggles();
1104
+ const newState = {
1105
+ toggles: currentToggles,
1106
+ tabs: currentTabs
1107
+ };
1108
+ // applyState() will handle all visual updates via renderState()
1109
+ this.applyState(newState);
939
1110
  });
1111
+ // Apply stored nav visibility preference on page load
1112
+ try {
1113
+ const navPref = localStorage.getItem('cv-tab-navs-visible');
1114
+ if (navPref !== null) {
1115
+ const visible = navPref === 'true';
1116
+ TabManager.setNavsVisibility(this.rootEl, visible);
1117
+ }
1118
+ }
1119
+ catch (e) { /* ignore */ }
940
1120
  // For session history, clicks on back/forward button
941
1121
  window.addEventListener("popstate", () => {
942
1122
  this.loadAndCallApplyState();
@@ -1468,13 +1648,14 @@ ${TAB_STYLES}
1468
1648
 
1469
1649
  .cv-widget-modal {
1470
1650
  background: white;
1471
- border-radius: 8px;
1472
- box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
1473
- max-width: 400px;
1651
+ border-radius: 0.75rem;
1652
+ box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
1653
+ max-width: 32rem;
1474
1654
  width: 90vw;
1475
1655
  max-height: 80vh;
1476
- overflow-y: auto;
1477
1656
  animation: slideIn 0.2s ease;
1657
+ display: flex;
1658
+ flex-direction: column;
1478
1659
  }
1479
1660
 
1480
1661
  @keyframes slideIn {
@@ -1488,47 +1669,96 @@ ${TAB_STYLES}
1488
1669
  }
1489
1670
  }
1490
1671
 
1491
- .cv-widget-modal-header {
1672
+ .cv-modal-header {
1492
1673
  display: flex;
1674
+ align-items: center;
1493
1675
  justify-content: space-between;
1676
+ padding: 0.5rem 1rem;
1677
+ border-bottom: 1px solid rgba(0, 0, 0, 0.1);
1678
+ }
1679
+
1680
+ .cv-modal-header-content {
1681
+ display: flex;
1494
1682
  align-items: center;
1495
- padding: 16px 20px;
1496
- border-bottom: 1px solid #e9ecef;
1497
- background: #f8f9fa;
1498
- border-radius: 8px 8px 0 0;
1683
+ gap: 0.75rem;
1684
+ }
1685
+
1686
+ .cv-modal-icon {
1687
+ position: relative;
1688
+ width: 1rem;
1689
+ height: 1rem;
1690
+ display: flex;
1691
+ align-items: center;
1692
+ justify-content: center;
1693
+ border-radius: 9999px;
1694
+ }
1695
+
1696
+ .cv-modal-icon-svg {
1697
+ width: 100%;
1698
+ height: 100%;
1699
+ opacity: 1;
1499
1700
  }
1500
1701
 
1501
- .cv-widget-modal-header h3 {
1702
+ .cv-modal-title {
1703
+ font-size: 1.125rem;
1704
+ font-weight: bold;
1705
+ color: rgba(0, 0, 0, 0.9);
1502
1706
  margin: 0;
1503
- font-size: 18px;
1504
- font-weight: 600;
1505
- color: #333;
1506
1707
  }
1507
1708
 
1508
- .cv-widget-modal-close {
1509
- background: none;
1510
- border: none;
1511
- font-size: 20px;
1512
- cursor: pointer;
1513
- padding: 0;
1514
- width: 32px;
1515
- height: 32px;
1709
+ .cv-modal-close {
1710
+ width: 2rem;
1711
+ height: 2rem;
1516
1712
  display: flex;
1517
1713
  align-items: center;
1518
1714
  justify-content: center;
1519
- border-radius: 4px;
1520
- color: #666;
1521
- line-height: 1;
1715
+ border-radius: 9999px;
1716
+ background: transparent;
1717
+ border: none;
1718
+ color: rgba(0, 0, 0, 0.6);
1719
+ cursor: pointer;
1522
1720
  transition: all 0.2s ease;
1523
1721
  }
1524
1722
 
1525
- .cv-widget-modal-close:hover {
1526
- background: #e9ecef;
1527
- color: #333;
1723
+ .cv-modal-close:hover {
1724
+ background: rgba(62, 132, 244, 0.1);
1725
+ color: #3e84f4;
1726
+ }
1727
+
1728
+ .cv-modal-close-icon {
1729
+ width: 1.25rem;
1730
+ height: 1.25rem;
1528
1731
  }
1529
1732
 
1530
- .cv-widget-modal-content {
1531
- padding: 20px;
1733
+ .cv-modal-main {
1734
+ padding: 1rem;
1735
+ flex: 1;
1736
+ display: flex;
1737
+ flex-direction: column;
1738
+ gap: 1rem;
1739
+ overflow-y: auto;
1740
+ max-height: calc(80vh - 8rem);
1741
+ }
1742
+
1743
+ .cv-modal-description {
1744
+ font-size: 0.875rem;
1745
+ color: rgba(0, 0, 0, 0.8);
1746
+ margin: 0;
1747
+ line-height: 1.4;
1748
+ }
1749
+
1750
+ .cv-content-section,
1751
+ .cv-tab-groups-section {
1752
+ display: flex;
1753
+ flex-direction: column;
1754
+ gap: 0.75rem;
1755
+ }
1756
+
1757
+ .cv-section-heading {
1758
+ font-size: 1rem;
1759
+ font-weight: bold;
1760
+ color: rgba(0, 0, 0, 0.9);
1761
+ margin: 0;
1532
1762
  }
1533
1763
 
1534
1764
  .cv-widget-modal-actions {
@@ -1570,32 +1800,83 @@ ${TAB_STYLES}
1570
1800
  background: #0056b3;
1571
1801
  }
1572
1802
 
1573
- /* Dark theme modal styles */
1574
1803
  .cv-widget-theme-dark .cv-widget-modal {
1575
- background: #2d3748;
1804
+ background: #101722;
1576
1805
  color: #e2e8f0;
1577
1806
  }
1578
1807
 
1579
- .cv-widget-theme-dark .cv-widget-modal-header {
1580
- background: #1a202c;
1581
- border-color: #4a5568;
1808
+ .cv-widget-theme-dark .cv-modal-header {
1809
+ border-color: rgba(255, 255, 255, 0.1);
1582
1810
  }
1583
1811
 
1584
- .cv-widget-theme-dark .cv-widget-modal-header h3 {
1812
+ .cv-widget-theme-dark .cv-modal-title {
1585
1813
  color: #e2e8f0;
1586
1814
  }
1587
1815
 
1588
- .cv-widget-theme-dark .cv-widget-modal-close {
1589
- color: #a0aec0;
1816
+ .cv-widget-theme-dark .cv-modal-close {
1817
+ color: rgba(255, 255, 255, 0.6);
1590
1818
  }
1591
1819
 
1592
- .cv-widget-theme-dark .cv-widget-modal-close:hover {
1593
- background: #4a5568;
1820
+ .cv-widget-theme-dark .cv-modal-close:hover {
1821
+ background: rgba(62, 132, 244, 0.2);
1822
+ color: #3e84f4;
1823
+ }
1824
+
1825
+ .cv-widget-theme-dark .cv-modal-description {
1826
+ color: rgba(255, 255, 255, 0.8);
1827
+ }
1828
+
1829
+ .cv-widget-theme-dark .cv-section-heading {
1830
+ color: #e2e8f0;
1831
+ }
1832
+
1833
+ .cv-widget-theme-dark .cv-toggles-container
1834
+ .cv-widget-theme-dark .cv-tabgroups-container {
1835
+ border-color: rgba(255, 255, 255, 0.1);
1836
+ }
1837
+
1838
+ .cv-widget-theme-dark .cv-toggle-card,
1839
+ .cv-widget-theme-dark .cv-tabgroup-card {
1840
+ background: #101722;
1841
+ border-color: rgba(255, 255, 255, 0.1);
1842
+ }
1843
+
1844
+ .cv-widget-theme-dark .cv-toggle-title,
1845
+ .cv-widget-theme-dark .cv-tabgroup-title {
1846
+ color: #e2e8f0;
1847
+ }
1848
+
1849
+ .cv-widget-theme-dark .cv-toggle-description,
1850
+ .cv-widget-theme-dark .cv-tabgroup-description {
1851
+ color: rgba(255, 255, 255, 0.6);
1852
+ }
1853
+
1854
+ .cv-widget-theme-dark .cv-toggle-slider {
1855
+ background: rgba(255, 255, 255, 0.2);
1856
+ }
1857
+
1858
+ .cv-widget-theme-dark .cv-tab-group-description {
1859
+ color: rgba(255, 255, 255, 0.8);
1860
+ }
1861
+
1862
+ .cv-widget-theme-dark .cv-tabgroup-select {
1863
+ background: #101722;
1864
+ border-color: rgba(255, 255, 255, 0.2);
1594
1865
  color: #e2e8f0;
1595
1866
  }
1596
1867
 
1597
- .cv-widget-theme-dark .cv-widget-modal-actions {
1598
- border-color: #4a5568;
1868
+ .cv-widget-theme-dark .cv-modal-footer {
1869
+ border-color: rgba(255, 255, 255, 0.1);
1870
+ background: #101722;
1871
+ }
1872
+
1873
+ .cv-widget-theme-dark .cv-reset-btn {
1874
+ color: #e2e8f0;
1875
+ background: rgba(255, 255, 255, 0.1);
1876
+ }
1877
+
1878
+ .cv-widget-theme-dark .cv-reset-btn:hover {
1879
+ background: rgba(255, 255, 255, 0.2);
1599
1880
  }
1600
1881
 
1601
1882
  /* Custom state creator styles */
@@ -1603,8 +1884,7 @@ ${TAB_STYLES}
1603
1884
  max-width: 500px;
1604
1885
  }
1605
1886
 
1606
- .cv-custom-state-form h4 {
1607
- margin: 20px 0 10px 0;
1887
+ .cv-custom-state-form .cv-section-header {
1608
1888
  font-size: 16px;
1609
1889
  font-weight: 600;
1610
1890
  color: #333;
@@ -1646,63 +1926,89 @@ ${TAB_STYLES}
1646
1926
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
1647
1927
  }
1648
1928
 
1649
- .cv-custom-toggles {
1650
- display: grid;
1651
- grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
1652
- gap: 10px;
1929
+ /* Toggles Container */
1930
+ .cv-toggles-container {
1931
+ display: flex;
1932
+ flex-direction: column;
1933
+ gap: 0.5rem;
1934
+ border-radius: 0.5rem;
1935
+ border: 1px solid rgba(0, 0, 0, 0.1);
1936
+ overflow: hidden;
1653
1937
  }
1654
1938
 
1655
- .cv-custom-state-toggle {
1656
- display: flex;
1657
- align-items: center;
1939
+ .cv-toggle-card,
1940
+ .cv-tabgroup-card {
1941
+ background: white;
1942
+ border-bottom: 1px solid rgba(0, 0, 0, 0.1);
1943
+ }
1944
+
1945
+ .cv-toggle-card:last-child {
1946
+ border-bottom: none;
1658
1947
  }
1659
1948
 
1660
- .cv-custom-state-toggle label {
1949
+ .cv-toggle-content {
1661
1950
  display: flex;
1662
1951
  align-items: center;
1663
- cursor: pointer;
1664
- font-weight: normal;
1952
+ justify-content: space-between;
1953
+ padding: 0.75rem;
1954
+ }
1955
+
1956
+ .cv-toggle-title {
1957
+ font-weight: 500;
1958
+ font-size: 0.875rem;
1959
+ color: rgba(0, 0, 0, 0.9);
1960
+ margin: 0 0 0.125rem 0;
1961
+ }
1962
+
1963
+ .cv-toggle-description {
1964
+ font-size: 0.75rem;
1965
+ color: rgba(0, 0, 0, 0.6);
1665
1966
  margin: 0;
1666
1967
  }
1667
1968
 
1668
- .cv-toggle-switch {
1969
+ .cv-toggle-label{
1669
1970
  position: relative;
1670
- width: 44px;
1671
- height: 24px;
1672
- background: #ccc;
1673
- border-radius: 12px;
1674
- margin-right: 12px;
1971
+ display: inline-block;
1972
+ width: 2.75rem;
1973
+ height: 1.5rem;
1675
1974
  cursor: pointer;
1676
- transition: background-color 0.3s ease;
1677
- flex-shrink: 0;
1678
1975
  }
1679
1976
 
1680
- .cv-toggle-switch:hover {
1681
- background: #bbb;
1977
+ .cv-toggle-input {
1978
+ opacity: 0;
1979
+ width: 0;
1980
+ height: 0;
1682
1981
  }
1683
1982
 
1684
- .cv-toggle-switch.cv-toggle-active {
1685
- background: #007bff;
1686
- }
1687
-
1688
- .cv-toggle-switch.cv-toggle-active:hover {
1689
- background: #0056b3;
1983
+ .cv-toggle-slider {
1984
+ position: absolute;
1985
+ top: 0;
1986
+ left: 0;
1987
+ right: 0;
1988
+ bottom: 0;
1989
+ background: rgba(0, 0, 0, 0.2);
1990
+ border-radius: 9999px;
1991
+ transition: background-color 0.2s ease;
1690
1992
  }
1691
1993
 
1692
- .cv-toggle-handle {
1994
+ .cv-toggle-slider:before {
1693
1995
  position: absolute;
1694
- top: 2px;
1695
- left: 2px;
1696
- width: 20px;
1697
- height: 20px;
1996
+ content: "";
1997
+ height: 1rem;
1998
+ width: 1rem;
1999
+ left: 0.25rem;
2000
+ bottom: 0.25rem;
1698
2001
  background: white;
1699
2002
  border-radius: 50%;
1700
- transition: transform 0.3s ease;
1701
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
2003
+ transition: transform 0.2s ease;
1702
2004
  }
1703
2005
 
1704
- .cv-toggle-switch.cv-toggle-active .cv-toggle-handle {
1705
- transform: translateX(20px);
2006
+ .cv-toggle-input:checked + .cv-toggle-slider {
2007
+ background: #3e84f4;
2008
+ }
2009
+
2010
+ .cv-toggle-input:checked + .cv-toggle-slider:before {
2011
+ transform: translateX(1.25rem);
1706
2012
  }
1707
2013
 
1708
2014
  /* Dark theme toggle switch styles */
@@ -1722,200 +2028,371 @@ ${TAB_STYLES}
1722
2028
  background: #4299e1;
1723
2029
  }
1724
2030
 
1725
- .cv-tab-groups {
1726
- margin-top: 20px;
2031
+ /* Tab Groups Container */
2032
+ .cv-tab-groups-list {
2033
+ display: flex;
2034
+ flex-direction: column;
2035
+ gap: 1px;
2036
+ border: 1px solid rgba(0, 0, 0, 0.1);
2037
+ border-radius: 0.5rem;
2038
+ overflow: hidden;
1727
2039
  }
1728
2040
 
1729
- .cv-tab-group-control {
1730
- margin-bottom: 15px;
2041
+ /* Tab Group Card - Header (Navigation Headers toggle) */
2042
+ .cv-tabgroup-card.cv-tabgroup-header {
2043
+ display: flex;
2044
+ align-items: center;
2045
+ justify-content: space-between;
2046
+ padding: 0.75rem;
2047
+ border-bottom: 0px;
1731
2048
  }
1732
2049
 
1733
- .cv-tab-group-control label {
1734
- display: block;
1735
- margin-bottom: 5px;
2050
+ .cv-tabgroup-card.cv-tabgroup-header .cv-tabgroup-row {
2051
+ display: flex;
2052
+ align-items: center;
2053
+ justify-content: space-between;
2054
+ width: 100%;
2055
+ gap: 1rem;
2056
+ }
2057
+
2058
+ /* Tab Group Card - Items */
2059
+ .cv-tabgroup-card.cv-tabgroup-item {
2060
+ display: flex;
2061
+ flex-direction: column;
2062
+ gap: 0.5rem;
2063
+ padding: 0.75rem;
2064
+ background: white;
2065
+ border-bottom: 1px solid rgba(0, 0, 0, 0.05);
2066
+ }
2067
+
2068
+ .cv-tabgroup-card.cv-tabgroup-item:last-child {
2069
+ border-bottom: none;
2070
+ }
2071
+
2072
+ /* Tab Group Info */
2073
+ .cv-tabgroup-info {
2074
+ flex: 1;
2075
+ }
2076
+
2077
+ .cv-tabgroup-title {
1736
2078
  font-weight: 500;
1737
- font-size: 14px;
2079
+ font-size: 0.875rem;
2080
+ color: rgba(0, 0, 0, 0.9);
2081
+ margin: 0 0 0.25rem 0;
1738
2082
  }
1739
2083
 
1740
- .cv-tab-group-select {
1741
- width: 100%;
1742
- padding: 8px 12px;
1743
- border: 1px solid #ced4da;
1744
- border-radius: 4px;
1745
- font-size: 14px;
1746
- background-color: white;
2084
+ .cv-tabgroup-description {
2085
+ font-size: 0.75rem;
2086
+ color: rgba(0, 0, 0, 0.6);
2087
+ margin: 0;
2088
+ line-height: 1.3;
2089
+ }
2090
+
2091
+ /* Tab Group Label (for select dropdowns) */
2092
+ .cv-tabgroup-label {
2093
+ font-size: 0.875rem;
2094
+ color: rgba(0, 0, 0, 0.8);
2095
+ margin: 0;
2096
+ line-height: 1.4;
2097
+ font-weight: 500;
2098
+ display: block;
1747
2099
  cursor: pointer;
1748
2100
  }
1749
2101
 
1750
- .cv-tab-group-select:focus {
1751
- outline: none;
1752
- border-color: #007bff;
1753
- box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
2102
+ /* Tab Group Select */
2103
+ .cv-tabgroup-select {
2104
+ width: 100%;
2105
+ border-radius: 0.5rem;
2106
+ background: white;
2107
+ border: 1px solid rgba(0, 0, 0, 0.15);
2108
+ color: rgba(0, 0, 0, 0.9);
2109
+ padding: 0.5rem 0.75rem;
2110
+ font-size: 0.875rem;
2111
+ cursor: pointer;
2112
+ transition: all 0.15s ease;
2113
+ font-family: inherit;
1754
2114
  }
1755
2115
 
1756
- .cv-widget-theme-dark .cv-tab-group-select {
1757
- background-color: #2d3748;
1758
- border-color: #4a5568;
1759
- color: #e2e8f0;
2116
+ .cv-tabgroup-select:hover {
2117
+ border-color: rgba(0, 0, 0, 0.25);
1760
2118
  }
1761
2119
 
1762
- .cv-custom-state-actions {
1763
- display: flex;
1764
- gap: 10px;
1765
- margin-top: 20px;
1766
- padding-top: 16px;
1767
- border-top: 1px solid #e9ecef;
2120
+ .cv-tabgroup-select:focus {
2121
+ outline: none;
2122
+ border-color: #3e84f4;
2123
+ box-shadow: 0 0 0 2px rgba(62, 132, 244, 0.2);
1768
2124
  }
1769
2125
 
1770
- .cv-custom-state-cancel,
1771
- .cv-custom-state-copy-url {
1772
- flex: 1;
1773
- padding: 10px 16px;
1774
- border: none;
1775
- border-radius: 4px;
2126
+ /* Modern Toggle Switch */
2127
+ .cv-toggle-switch {
2128
+ position: relative;
2129
+ display: inline-flex;
2130
+ align-items: center;
2131
+ width: 44px;
2132
+ height: 24px;
2133
+ background: rgba(0, 0, 0, 0.1);
2134
+ border-radius: 9999px;
2135
+ padding: 2px;
2136
+ box-sizing: border-box;
1776
2137
  cursor: pointer;
1777
- font-size: 14px;
1778
- font-weight: 500;
2138
+ transition: background-color 0.2s ease;
2139
+ border: none;
1779
2140
  }
1780
2141
 
1781
- .cv-custom-state-reset {
1782
- flex: 1;
1783
- padding: 10px 16px;
1784
- border: none;
1785
- border-radius: 4px;
1786
- cursor: pointer;
1787
- font-size: 14px;
1788
- font-weight: 500;
1789
- background: #dc3545;
1790
- color: white;
2142
+ .cv-toggle-switch input {
2143
+ display: none;
1791
2144
  }
1792
2145
 
1793
- .cv-custom-state-reset:hover {
1794
- background: #c82333;
2146
+ .cv-toggle-switch .cv-switch-bg {
2147
+ position: absolute;
2148
+ inset: 0;
2149
+ border-radius: 9999px;
2150
+ background: rgba(0, 0, 0, 0.1);
2151
+ transition: background-color 0.2s ease;
2152
+ pointer-events: none;
1795
2153
  }
1796
2154
 
1797
- .cv-custom-state-cancel {
1798
- background: #6c757d;
1799
- color: white;
2155
+ .cv-toggle-switch .cv-switch-knob {
2156
+ position: relative;
2157
+ width: 20px;
2158
+ height: 20px;
2159
+ background: white;
2160
+ border-radius: 50%;
2161
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
2162
+ transition: transform 0.2s ease;
2163
+ z-index: 1;
1800
2164
  }
1801
2165
 
1802
- .cv-custom-state-cancel:hover {
1803
- background: #5a6268;
2166
+ .cv-toggle-switch input:checked + .cv-switch-bg {
2167
+ background: #3e84f4;
1804
2168
  }
1805
2169
 
1806
- .cv-custom-state-copy-url {
1807
- background: #28a745;
1808
- color: white;
2170
+ .cv-toggle-switch input:checked ~ .cv-switch-knob {
2171
+ transform: translateX(20px);
1809
2172
  }
1810
2173
 
1811
- .cv-custom-state-copy-url:hover {
1812
- background: #218838;
2174
+ /* Dark Theme - Tab Groups */
2175
+ .cv-widget-theme-dark .cv-tabgroup-card.cv-tabgroup-header {
2176
+ background: #101722;
2177
+ border-bottom-color: rgba(255, 255, 255, 0.1);
1813
2178
  }
1814
2179
 
1815
- /* Dark theme custom state styles */
1816
- .cv-widget-theme-dark .cv-custom-state-form h4 {
2180
+ .cv-widget-theme-dark .cv-tabgroup-card.cv-tabgroup-item {
2181
+ background: #101722;
2182
+ border-bottom-color: rgba(255, 255, 255, 0.05);
2183
+ }
2184
+
2185
+ .cv-widget-theme-dark .cv-tabgroup-title {
1817
2186
  color: #e2e8f0;
1818
- border-color: #4a5568;
1819
2187
  }
1820
2188
 
1821
- .cv-widget-theme-dark .cv-custom-state-form p {
1822
- color: #cbd5e0;
2189
+ .cv-widget-theme-dark .cv-tabgroup-description {
2190
+ color: rgba(255, 255, 255, 0.6);
1823
2191
  }
1824
2192
 
1825
- .cv-widget-theme-dark .cv-custom-state-section label {
1826
- color: #a0aec0;
2193
+ .cv-widget-theme-dark .cv-tabgroup-label {
2194
+ color: rgba(255, 255, 255, 0.8);
1827
2195
  }
1828
2196
 
1829
- .cv-widget-theme-dark .cv-custom-state-input {
1830
- background: #1a202c;
1831
- border-color: #4a5568;
2197
+ .cv-widget-theme-dark .cv-tab-groups-list {
2198
+ border-color: rgba(255, 255, 255, 0.1);
2199
+ }
2200
+
2201
+ .cv-widget-theme-dark .cv-tabgroup-select {
2202
+ background: #101722;
2203
+ border-color: rgba(255, 255, 255, 0.15);
1832
2204
  color: #e2e8f0;
1833
2205
  }
1834
2206
 
1835
- .cv-widget-theme-dark .cv-custom-state-actions {
1836
- border-color: #4a5568;
2207
+ .cv-widget-theme-dark .cv-tabgroup-select:hover {
2208
+ border-color: rgba(255, 255, 255, 0.25);
2209
+ }
2210
+
2211
+ .cv-widget-theme-dark .cv-tabgroup-select:focus {
2212
+ border-color: #60a5fa;
2213
+ box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2);
2214
+ }
2215
+
2216
+ /* Dark Theme - Toggle Switch */
2217
+ .cv-widget-theme-dark .cv-toggle-switch .cv-switch-bg {
2218
+ background: rgba(255, 255, 255, 0.1);
1837
2219
  }
1838
2220
 
2221
+ .cv-widget-theme-dark .cv-toggle-switch .cv-switch-knob {
2222
+ background: #e2e8f0;
2223
+ }
2224
+
2225
+ .cv-widget-theme-dark .cv-toggle-switch input:checked + .cv-switch-bg {
2226
+ background: #63b3ed;
2227
+ }
2228
+
2229
+ .cv-modal-footer {
2230
+ display: flex;
2231
+ justify-content: space-between;
2232
+ align-items: center;
2233
+ padding: 0.75rem;
2234
+ border-top: 1px solid rgba(0, 0, 0, 0.1);
2235
+ }
2236
+
2237
+ .cv-reset-btn,
2238
+ .cv-share-btn {
2239
+ display: flex;
2240
+ align-items: center;
2241
+ gap: 0.5rem;
2242
+ padding: 0.375rem 0.75rem;
2243
+ border-radius: 0.5rem;
2244
+ font-weight: 600;
2245
+ font-size: 0.875rem;
2246
+ cursor: pointer;
2247
+ transition: all 0.2s ease;
2248
+ border: none;
2249
+ }
2250
+
2251
+ .cv-reset-btn {
2252
+ color: rgba(0, 0, 0, 0.9);
2253
+ background: rgba(0, 0, 0, 0.1);
2254
+ }
2255
+
2256
+ .cv-reset-btn:hover {
2257
+ background: rgba(0, 0, 0, 0.2);
2258
+ }
2259
+
2260
+ .cv-share-btn {
2261
+ color: white;
2262
+ background: #3e84f4;
2263
+ }
2264
+
2265
+ .cv-share-btn:hover {
2266
+ background: rgba(62, 132, 244, 0.9);
2267
+ }
2268
+
2269
+ .cv-btn-icon {
2270
+ width: 1rem;
2271
+ height: 1rem;
2272
+ }
2273
+
2274
+ /* Dark theme custom state styles */
1839
2275
  /* Welcome modal styles */
1840
2276
  .cv-welcome-modal {
1841
- max-width: 500px;
2277
+ max-width: 32rem;
2278
+ width: 90vw;
2279
+ background: white;
2280
+ border-radius: 0.75rem;
2281
+ box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
2282
+ animation: slideIn 0.2s ease;
2283
+ display: flex;
2284
+ flex-direction: column;
2285
+ }
2286
+
2287
+ .cv-modal-main {
2288
+ padding: 1rem;
2289
+ flex: 1;
2290
+ display: flex;
2291
+ flex-direction: column;
2292
+ gap: 1rem;
2293
+ overflow-y: auto;
2294
+ max-height: calc(80vh - 8rem);
1842
2295
  }
1843
2296
 
1844
- .cv-welcome-content {
2297
+ .cv-welcome-message {
2298
+ font-size: 0.875rem;
2299
+ color: rgba(0, 0, 0, 0.8);
2300
+ margin: 0;
2301
+ line-height: 1.4;
1845
2302
  text-align: center;
1846
2303
  }
1847
2304
 
1848
- .cv-welcome-content p {
1849
- font-size: 15px;
1850
- line-height: 1.6;
1851
- color: #555;
1852
- margin-bottom: 24px;
2305
+ .cv-welcome-message a {
2306
+ color: #3e84f4;
1853
2307
  text-align: justify;
2308
+ text-decoration: none;
2309
+ }
2310
+
2311
+ .cv-welcome-message a:hover {
2312
+ text-decoration: underline;
1854
2313
  }
1855
2314
 
1856
2315
  .cv-welcome-widget-preview {
1857
2316
  display: flex;
1858
- flex-direction: column;
1859
2317
  align-items: center;
1860
- gap: 12px;
1861
- padding: 20px;
2318
+ justify-content: center;
2319
+ gap: 1rem;
2320
+ padding: 1rem;
1862
2321
  background: #f8f9fa;
1863
- border-radius: 8px;
1864
- margin-bottom: 24px;
2322
+ border-radius: 0.5rem;
2323
+ margin: 1rem 0;
1865
2324
  }
1866
2325
 
1867
2326
  .cv-welcome-widget-icon {
1868
- width: 36px;
1869
- height: 36px;
1870
- background: white;
1871
- color: black;
1872
- border-radius: 0 18px 18px 0;
2327
+ width: 2rem;
2328
+ height: 2rem;
2329
+ background: rgba(62, 132, 244, 0.1);
2330
+ border-radius: 9999px;
1873
2331
  display: flex;
1874
2332
  align-items: center;
1875
2333
  justify-content: center;
1876
- font-size: 18px;
1877
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
2334
+ animation: cv-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
2335
+ color: #3e84f4;
1878
2336
  }
1879
2337
 
1880
2338
  .cv-welcome-widget-label {
1881
- font-size: 14px;
1882
- color: #666;
1883
- margin: 0;
2339
+ font-size: 0.875rem;
1884
2340
  font-weight: 500;
2341
+ color: rgba(0, 0, 0, 0.8);
2342
+ margin: 0;
1885
2343
  }
1886
2344
 
1887
2345
  .cv-welcome-got-it {
1888
2346
  width: 100%;
1889
- padding: 12px 24px;
1890
- background: #007bff;
2347
+ background: #3e84f4;
1891
2348
  color: white;
2349
+ font-weight: 600;
2350
+ padding: 0.75rem 1rem;
2351
+ border-radius: 0.5rem;
1892
2352
  border: none;
1893
- border-radius: 4px;
1894
2353
  cursor: pointer;
1895
- font-size: 16px;
1896
- font-weight: 600;
1897
- transition: background 0.2s ease;
2354
+ font-size: 0.875rem;
2355
+ transition: background-color 0.2s ease;
2356
+ outline: none;
1898
2357
  }
1899
2358
 
1900
2359
  .cv-welcome-got-it:hover {
1901
- background: #0056b3;
2360
+ background: rgba(62, 132, 244, 0.9);
2361
+ }
2362
+
2363
+ .cv-welcome-got-it:focus {
2364
+ box-shadow: 0 0 0 2px rgba(62, 132, 244, 0.5);
1902
2365
  }
1903
2366
 
1904
- .cv-welcome-got-it:active {
1905
- background: #004494;
2367
+ /* Animations */
2368
+ @keyframes cv-pulse {
2369
+ 0%, 100% {
2370
+ opacity: 1;
2371
+ }
2372
+ 50% {
2373
+ opacity: 0.5;
2374
+ }
1906
2375
  }
1907
2376
 
1908
2377
  /* Dark theme welcome modal styles */
1909
- .cv-widget-theme-dark .cv-welcome-content p {
1910
- color: #cbd5e0;
2378
+ .cv-widget-theme-dark .cv-welcome-modal {
2379
+ background: #101722;
2380
+ }
2381
+
2382
+ .cv-widget-theme-dark .cv-welcome-message {
2383
+ color: rgba(255, 255, 255, 0.8);
2384
+ }
2385
+
2386
+ .cv-widget-theme-dark .cv-welcome-message a {
2387
+ color: #60a5fa;
1911
2388
  }
1912
2389
 
1913
2390
  .cv-widget-theme-dark .cv-welcome-widget-preview {
1914
- background: #1a202c;
2391
+ background: rgba(255, 255, 255, 0.1);
1915
2392
  }
1916
2393
 
1917
2394
  .cv-widget-theme-dark .cv-welcome-widget-label {
1918
- color: #a0aec0;
2395
+ color: #e2e8f0;
1919
2396
  }
1920
2397
  `;
1921
2398
  /**
@@ -1931,6 +2408,45 @@ ${TAB_STYLES}
1931
2408
  document.head.appendChild(style);
1932
2409
  }
1933
2410
 
2411
+ /**
2412
+ * Icon utilities for CustomViews widget
2413
+ * Centralized SVG icons for better maintainability and reusability
2414
+ */
2415
+ /**
2416
+ * Settings gear icon for modal header
2417
+ */
2418
+ function getGearIcon() {
2419
+ return `<svg class="cv-modal-icon-svg" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
2420
+ <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"/>
2421
+ <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"/>
2422
+ </svg>`;
2423
+ }
2424
+ /**
2425
+ * Close/X icon for modal close button
2426
+ */
2427
+ function getCloseIcon() {
2428
+ 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">
2429
+ <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>
2430
+ </svg>`;
2431
+ }
2432
+ /**
2433
+ * Reset/refresh icon for reset button
2434
+ */
2435
+ function getResetIcon() {
2436
+ return `<svg class="cv-btn-icon" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
2437
+ <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"/>
2438
+ </svg>`;
2439
+ }
2440
+ /**
2441
+ * Share icon for share button
2442
+ */
2443
+ function getShareIcon() {
2444
+ return `<svg class="cv-btn-icon" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
2445
+ <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"/>
2446
+ <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"/>
2447
+ </svg>`;
2448
+ }
2449
+
1934
2450
  class CustomViewsWidget {
1935
2451
  core;
1936
2452
  container;
@@ -1949,7 +2465,7 @@ ${TAB_STYLES}
1949
2465
  theme: options.theme || 'light',
1950
2466
  showReset: options.showReset ?? true,
1951
2467
  title: options.title || 'Customize View',
1952
- description: options.description || 'Toggle different content sections to customize your view. Changes are applied instantly and the URL will be updated for sharing.',
2468
+ description: options.description || '',
1953
2469
  showWelcome: options.showWelcome ?? false,
1954
2470
  welcomeTitle: options.welcomeTitle || 'Site Customization',
1955
2471
  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>.',
@@ -2031,21 +2547,24 @@ ${TAB_STYLES}
2031
2547
  this.modal = document.createElement('div');
2032
2548
  this.modal.className = 'cv-widget-modal-overlay';
2033
2549
  this.applyThemeToModal();
2034
- const toggleControls = toggles.length
2035
- ? toggles.map(toggle => `
2036
- <div class="cv-custom-state-toggle">
2037
- <label>
2038
- <div class="cv-toggle-switch" data-toggle="${toggle}">
2039
- <div class="cv-toggle-handle"></div>
2040
- </div>
2041
- ${this.formatToggleName(toggle)}
2550
+ const toggleControlsHtml = toggles.map(toggle => `
2551
+ <div class="cv-toggle-card">
2552
+ <div class="cv-toggle-content">
2553
+ <div>
2554
+ <p class="cv-toggle-title">${this.formatToggleName(toggle)}</p>
2555
+ </div>
2556
+ <label class="cv-toggle-label">
2557
+ <input class="cv-toggle-input" type="checkbox" data-toggle="${toggle}"/>
2558
+ <span class="cv-toggle-slider"></span>
2042
2559
  </label>
2043
2560
  </div>
2044
- `).join('')
2045
- : `<p class="cv-no-toggles">No configurable sections available.</p>`;
2561
+ </div>
2562
+ `).join('');
2563
+ // Todo: Re-add description if needed (Line 168, add label field to toggles if needed change structure)
2564
+ // <p class="cv-toggle-description">Show or hide the ${this.formatToggleName(toggle).toLowerCase()} area </p>
2046
2565
  // Get tab groups
2047
2566
  const tabGroups = this.core.getTabGroups();
2048
- let tabGroupsHTML = '';
2567
+ let tabGroupControlsHTML = '';
2049
2568
  // Check if any tab group or tab labels contain Font Awesome shortcodes
2050
2569
  let hasFontAwesomeShortcodes = false;
2051
2570
  if (this.options.showTabGroups && tabGroups && tabGroups.length > 0) {
@@ -2069,47 +2588,81 @@ ${TAB_STYLES}
2069
2588
  ensureFontAwesomeInjected();
2070
2589
  }
2071
2590
  if (this.options.showTabGroups && tabGroups && tabGroups.length > 0) {
2072
- const tabGroupControls = tabGroups.map(group => {
2073
- const options = group.tabs.map(tab => `<option value="${tab.id}">${replaceIconShortcodes(tab.label || tab.id)}</option>`).join('');
2074
- return `
2075
- <div class="cv-tab-group-control">
2076
- <label for="tab-group-${group.id}">${replaceIconShortcodes(group.label || group.id)}</label>
2077
- <select id="tab-group-${group.id}" class="cv-tab-group-select" data-group-id="${group.id}">
2078
- ${options}
2079
- </select>
2591
+ tabGroupControlsHTML = `
2592
+ <div class="cv-tabgroup-card cv-tabgroup-header">
2593
+ <div class="cv-tabgroup-row">
2594
+ <div class="cv-tabgroup-info">
2595
+ <p class="cv-tabgroup-title">Navigation Headers</p>
2596
+ <p class="cv-tabgroup-description">Show or hide navigation headers</p>
2597
+ </div>
2598
+ <label class="cv-toggle-switch cv-nav-toggle">
2599
+ <input class="cv-nav-pref-input" type="checkbox" aria-label="Show or hide navigation headers" />
2600
+ <span class="cv-switch-bg"></span>
2601
+ <span class="cv-switch-knob"></span>
2602
+ </label>
2080
2603
  </div>
2081
- `;
2082
- }).join('');
2083
- tabGroupsHTML = `
2084
- <h4>Tab Groups</h4>
2085
- <div class="cv-tab-groups">
2086
- ${tabGroupControls}
2604
+ </div>
2605
+ <div class="cv-tab-groups-list">
2606
+ ${tabGroups.map(group => `
2607
+ <div class="cv-tabgroup-card cv-tabgroup-item">
2608
+ <label class="cv-tabgroup-label" for="tab-group-${group.id}">
2609
+ ${replaceIconShortcodes(group.label || group.id)}
2610
+ </label>
2611
+ <select id="tab-group-${group.id}" class="cv-tabgroup-select" data-group-id="${group.id}">
2612
+ ${group.tabs.map(tab => `<option value="${tab.id}">${replaceIconShortcodes(tab.label || tab.id)}</option>`).join('')}
2613
+ </select>
2614
+ </div>
2615
+ `).join('')}
2087
2616
  </div>
2088
2617
  `;
2089
2618
  }
2090
2619
  this.modal.innerHTML = `
2091
2620
  <div class="cv-widget-modal cv-custom-state-modal">
2092
- <div class="cv-widget-modal-header">
2093
- <h3>${this.options.title}</h3>
2094
- <button class="cv-widget-modal-close" aria-label="Close modal">×</button>
2095
- </div>
2096
- <div class="cv-widget-modal-content">
2097
- <div class="cv-custom-state-form">
2098
- <p>${this.options.description}</p>
2099
-
2100
- <h4>Content Sections</h4>
2101
- <div class="cv-custom-toggles">
2102
- ${toggleControls}
2621
+ <header class="cv-modal-header">
2622
+ <div class="cv-modal-header-content">
2623
+ <div class="cv-modal-icon">
2624
+ ${getGearIcon()}
2103
2625
  </div>
2104
-
2105
- ${tabGroupsHTML}
2106
-
2107
- <div class="cv-custom-state-actions">
2108
- ${this.options.showReset ? `<button class="cv-custom-state-reset">Reset to Default</button>` : ''}
2109
- <button class="cv-custom-state-copy-url">Copy Shareable URL</button>
2626
+ <div class="cv-modal-title">${this.options.title}</div>
2627
+ </div>
2628
+ <button class="cv-modal-close" aria-label="Close modal">
2629
+ ${getCloseIcon()}
2630
+ </button>
2631
+ </header>
2632
+ <main class="cv-modal-main">
2633
+ ${this.options.description ? `<p class="cv-modal-description">${this.options.description}</p>` : ''}
2634
+
2635
+ ${toggles.length ? `
2636
+ <div class="cv-content-section">
2637
+ <div class="cv-section-heading">Toggles</div>
2638
+ <div class="cv-toggles-container">
2639
+ ${toggleControlsHtml}
2110
2640
  </div>
2111
2641
  </div>
2112
- </div>
2642
+ ` : ''}
2643
+
2644
+ ${this.options.showTabGroups && tabGroups && tabGroups.length > 0 ? `
2645
+ <div class="cv-content-section">
2646
+ <div class="cv-section-heading">Tab Groups</div>
2647
+ <div class="cv-tabgroups-container">
2648
+ ${tabGroupControlsHTML}
2649
+ </div>
2650
+ </div>
2651
+ ` : ''}
2652
+ </main>
2653
+
2654
+ <footer class="cv-modal-footer">
2655
+ ${this.options.showReset ? `
2656
+ <button class="cv-reset-btn">
2657
+ ${getResetIcon()}
2658
+ <span>Reset to Default</span>
2659
+ </button>
2660
+ ` : ''}
2661
+ <button class="cv-share-btn">
2662
+ ${getShareIcon()}
2663
+ <span>Copy Shareable URL</span>
2664
+ </button>
2665
+ </footer>
2113
2666
  </div>
2114
2667
  `;
2115
2668
  document.body.appendChild(this.modal);
@@ -2124,21 +2677,21 @@ ${TAB_STYLES}
2124
2677
  if (!this.modal)
2125
2678
  return;
2126
2679
  // Close button
2127
- const closeBtn = this.modal.querySelector('.cv-widget-modal-close');
2680
+ const closeBtn = this.modal.querySelector('.cv-modal-close');
2128
2681
  if (closeBtn) {
2129
2682
  closeBtn.addEventListener('click', () => {
2130
2683
  this.closeModal();
2131
2684
  });
2132
2685
  }
2133
2686
  // Copy URL button
2134
- const copyUrlBtn = this.modal.querySelector('.cv-custom-state-copy-url');
2687
+ const copyUrlBtn = this.modal.querySelector('.cv-share-btn');
2135
2688
  if (copyUrlBtn) {
2136
2689
  copyUrlBtn.addEventListener('click', () => {
2137
2690
  this.copyShareableURL();
2138
2691
  });
2139
2692
  }
2140
2693
  // Reset to default button
2141
- const resetBtn = this.modal.querySelector('.cv-custom-state-reset');
2694
+ const resetBtn = this.modal.querySelector('.cv-reset-btn');
2142
2695
  if (resetBtn) {
2143
2696
  resetBtn.addEventListener('click', () => {
2144
2697
  this.core.resetToDefault();
@@ -2146,25 +2699,55 @@ ${TAB_STYLES}
2146
2699
  });
2147
2700
  }
2148
2701
  // Listen to toggle switches
2149
- const toggleSwitches = this.modal.querySelectorAll('.cv-toggle-switch');
2150
- toggleSwitches.forEach(toggleSwitch => {
2151
- toggleSwitch.addEventListener('click', () => {
2152
- toggleSwitch.classList.toggle('cv-toggle-active');
2702
+ const toggleInputs = this.modal.querySelectorAll('.cv-toggle-input');
2703
+ toggleInputs.forEach(toggleInput => {
2704
+ toggleInput.addEventListener('change', () => {
2153
2705
  const state = this.getCurrentCustomStateFromModal();
2154
2706
  this.core.applyState(state);
2155
2707
  });
2156
2708
  });
2157
2709
  // Listen to tab group selects
2158
- const tabGroupSelects = this.modal.querySelectorAll('.cv-tab-group-select');
2710
+ const tabGroupSelects = this.modal.querySelectorAll('.cv-tabgroup-select');
2159
2711
  tabGroupSelects.forEach(select => {
2160
2712
  select.addEventListener('change', () => {
2161
2713
  const groupId = select.dataset.groupId;
2162
2714
  const tabId = select.value;
2163
2715
  if (groupId && tabId) {
2164
- this.core.setActiveTab(groupId, tabId);
2716
+ // Get current state and update the tab for this group, then apply globally
2717
+ // This triggers sync behavior and persistence
2718
+ const currentTabs = this.core.getCurrentActiveTabs();
2719
+ currentTabs[groupId] = tabId;
2720
+ // Apply state globally for persistence and sync
2721
+ const currentToggles = this.core.getCurrentActiveToggles();
2722
+ const newState = {
2723
+ toggles: currentToggles,
2724
+ tabs: currentTabs
2725
+ };
2726
+ this.core.applyState(newState);
2165
2727
  }
2166
2728
  });
2167
2729
  });
2730
+ // Listener for show/hide tab navs
2731
+ const tabNavToggle = this.modal.querySelector('.cv-nav-pref-input');
2732
+ if (tabNavToggle) {
2733
+ tabNavToggle.addEventListener('change', () => {
2734
+ const visible = tabNavToggle.checked;
2735
+ // Persist preference
2736
+ try {
2737
+ localStorage.setItem('cv-tab-navs-visible', visible ? 'true' : 'false');
2738
+ }
2739
+ catch (e) { /* ignore */ }
2740
+ // Apply to DOM using TabManager via core
2741
+ try {
2742
+ const rootEl = document.body;
2743
+ TabManager.setNavsVisibility(rootEl, visible);
2744
+ }
2745
+ catch (e) {
2746
+ // ignore errors
2747
+ console.error('Failed to set tab nav visibility:', e);
2748
+ }
2749
+ });
2750
+ }
2168
2751
  // Overlay click to close
2169
2752
  this.modal.addEventListener('click', (e) => {
2170
2753
  if (e.target === this.modal) {
@@ -2202,15 +2785,15 @@ ${TAB_STYLES}
2202
2785
  }
2203
2786
  // Collect toggle values
2204
2787
  const toggles = [];
2205
- const toggleSwitches = this.modal.querySelectorAll('.cv-toggle-switch');
2206
- toggleSwitches.forEach(toggleSwitch => {
2207
- const toggle = toggleSwitch.dataset.toggle;
2208
- if (toggle && toggleSwitch.classList.contains('cv-toggle-active')) {
2788
+ const toggleInputs = this.modal.querySelectorAll('.cv-toggle-input');
2789
+ toggleInputs.forEach(toggleInput => {
2790
+ const toggle = toggleInput.dataset.toggle;
2791
+ if (toggle && toggleInput.checked) {
2209
2792
  toggles.push(toggle);
2210
2793
  }
2211
2794
  });
2212
2795
  // Collect tab selections
2213
- const tabGroupSelects = this.modal.querySelectorAll('.cv-tab-group-select');
2796
+ const tabGroupSelects = this.modal.querySelectorAll('.cv-tabgroup-select');
2214
2797
  const tabs = {};
2215
2798
  tabGroupSelects.forEach(select => {
2216
2799
  const groupId = select.dataset.groupId;
@@ -2242,27 +2825,45 @@ ${TAB_STYLES}
2242
2825
  return;
2243
2826
  // Get currently active toggles (from custom state or default configuration)
2244
2827
  const activeToggles = this.core.getCurrentActiveToggles();
2245
- // First, deactivate all toggle switches
2246
- const allToggleSwitches = this.modal.querySelectorAll('.cv-toggle-switch');
2247
- allToggleSwitches.forEach(toggleSwitch => {
2248
- toggleSwitch.classList.remove('cv-toggle-active');
2828
+ // First, uncheck all toggle inputs
2829
+ const allToggleInputs = this.modal.querySelectorAll('.cv-toggle-input');
2830
+ allToggleInputs.forEach(toggleInput => {
2831
+ toggleInput.checked = false;
2249
2832
  });
2250
- // Then activate the ones that should be active
2833
+ // Then check the ones that should be active
2251
2834
  activeToggles.forEach(toggle => {
2252
- const toggleSwitch = this.modal?.querySelector(`[data-toggle="${toggle}"]`);
2253
- if (toggleSwitch) {
2254
- toggleSwitch.classList.add('cv-toggle-active');
2835
+ const toggleInput = this.modal?.querySelector(`[data-toggle="${toggle}"]`);
2836
+ if (toggleInput) {
2837
+ toggleInput.checked = true;
2255
2838
  }
2256
2839
  });
2257
2840
  // Load tab group selections
2258
2841
  const activeTabs = this.core.getCurrentActiveTabs();
2259
- const tabGroupSelects = this.modal.querySelectorAll('.cv-tab-group-select');
2842
+ const tabGroupSelects = this.modal.querySelectorAll('.cv-tab-groupselect');
2260
2843
  tabGroupSelects.forEach(select => {
2261
2844
  const groupId = select.dataset.groupId;
2262
2845
  if (groupId && activeTabs[groupId]) {
2263
2846
  select.value = activeTabs[groupId];
2264
2847
  }
2265
2848
  });
2849
+ // Load tab nav visibility preference
2850
+ const navPref = (() => {
2851
+ try {
2852
+ const raw = localStorage.getItem('cv-tab-navs-visible');
2853
+ if (raw === null)
2854
+ return TabManager.areNavsVisible(document.body);
2855
+ return raw === 'true';
2856
+ }
2857
+ catch (e) {
2858
+ return TabManager.areNavsVisible(document.body);
2859
+ }
2860
+ })();
2861
+ const tabNavToggle = this.modal.querySelector('.cv-nav-pref-input');
2862
+ if (tabNavToggle) {
2863
+ tabNavToggle.checked = navPref;
2864
+ // Ensure UI matches actual visibility
2865
+ TabManager.setNavsVisibility(document.body, navPref);
2866
+ }
2266
2867
  }
2267
2868
  /**
2268
2869
  * Format toggle name for display
@@ -2298,21 +2899,25 @@ ${TAB_STYLES}
2298
2899
  this.applyThemeToModal();
2299
2900
  this.modal.innerHTML = `
2300
2901
  <div class="cv-widget-modal cv-welcome-modal">
2301
- <div class="cv-widget-modal-header">
2302
- <h3>${this.options.welcomeTitle}</h3>
2303
- <button class="cv-widget-modal-close" aria-label="Close modal">×</button>
2304
- </div>
2305
- <div class="cv-widget-modal-content">
2306
- <div class="cv-welcome-content">
2307
- <p style="text-align: justify;">${this.options.welcomeMessage}</p>
2308
-
2309
- <div class="cv-welcome-widget-preview">
2310
- <div class="cv-welcome-widget-icon">⚙</div>
2311
- <p class="cv-welcome-widget-label">Look for this widget on the side of the screen</p>
2902
+ <header class="cv-modal-header">
2903
+ <div class="cv-modal-header-content">
2904
+ <div class="cv-modal-icon">
2905
+ ${getGearIcon()}
2906
+ </div>
2907
+ <h1 class="cv-modal-title">${this.options.welcomeTitle}</h1>
2908
+ </div>
2909
+ </header>
2910
+ <div class="cv-modal-main">
2911
+ <p class="cv-welcome-message">${this.options.welcomeMessage}</p>
2912
+
2913
+ <div class="cv-welcome-widget-preview">
2914
+ <div class="cv-welcome-widget-icon">
2915
+ ${getGearIcon()}
2312
2916
  </div>
2313
-
2314
- <button class="cv-welcome-got-it">Got it!</button>
2917
+ <p class="cv-welcome-widget-label">Look for this widget</p>
2315
2918
  </div>
2919
+
2920
+ <button class="cv-welcome-got-it">Got it!</button>
2316
2921
  </div>
2317
2922
  </div>
2318
2923
  `;
@@ -2325,13 +2930,6 @@ ${TAB_STYLES}
2325
2930
  attachWelcomeModalEventListeners() {
2326
2931
  if (!this.modal)
2327
2932
  return;
2328
- // Close button
2329
- const closeBtn = this.modal.querySelector('.cv-widget-modal-close');
2330
- if (closeBtn) {
2331
- closeBtn.addEventListener('click', () => {
2332
- this.closeModal();
2333
- });
2334
- }
2335
2933
  // Got it button
2336
2934
  const gotItBtn = this.modal.querySelector('.cv-welcome-got-it');
2337
2935
  if (gotItBtn) {