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