@customviews-js/customviews 1.1.3 → 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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @customviews-js/customviews v1.1.3
2
+ * @customviews-js/customviews v1.1.4
3
3
  * (c) 2025 Chan Ger Teck
4
4
  * Released under the MIT License.
5
5
  */
@@ -281,8 +281,12 @@ function ensureFontAwesomeInjected() {
281
281
  document.head.appendChild(link);
282
282
  }
283
283
  function replaceIconShortcodes(text) {
284
- // Handle Font Awesome shortcodes
285
- return text.replace(/:fa-([\w-]+):/g, (_, icon) => `<i class="fa fa-${icon}"></i>`);
284
+ // Matches :fa-*, :fas-*, :fab-* etc.
285
+ return text.replace(/:(fa[b|s|r]?)-([\w-]+):/g, (_, style, icon) => {
286
+ // style = fa, fas, fab, far, etc.
287
+ // Default to "fa" if only "fa-" is given
288
+ return `<i class="${style} fa-${icon}"></i>`;
289
+ });
286
290
  }
287
291
  /** --- Basic renderers --- */
288
292
  function renderImage(el, asset) {
@@ -366,10 +370,17 @@ const TABGROUP_SELECTOR = 'cv-tabgroup';
366
370
  const TAB_SELECTOR = 'cv-tab';
367
371
  const NAV_AUTO_SELECTOR = 'cv-tabgroup[nav="auto"], cv-tabgroup:not([nav])';
368
372
  const NAV_CONTAINER_CLASS = 'cv-tabs-nav';
369
- /**
370
- * TabManager handles discovery, visibility, and navigation for tab groups and tabs
371
- */
373
+ const NAV_HIDE_ROOT_CLASS = 'cv-hide-tab-navs';
374
+ const NAV_HIDDEN_CLASS = 'cv-tabs-nav-hidden';
372
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
+ }
373
384
  /**
374
385
  * Apply tab selections to all tab groups in the DOM
375
386
  */
@@ -381,22 +392,26 @@ class TabManager {
381
392
  if (!groupId)
382
393
  return;
383
394
  // Determine the active tab for this group
384
- const activeTabId = this.resolveActiveTab(groupId, tabs, cfgGroups, groupEl);
395
+ const activeTabId = this.resolveActiveTabForGroup(groupId, tabs, cfgGroups, groupEl);
385
396
  // Apply visibility to direct child cv-tab elements only (not nested ones)
386
397
  const tabElements = Array.from(groupEl.children).filter((child) => child.tagName.toLowerCase() === TAB_SELECTOR);
387
398
  tabElements.forEach((tabEl) => {
388
399
  const tabId = tabEl.getAttribute('id');
389
400
  if (!tabId)
390
401
  return;
391
- 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 || '');
392
405
  this.applyTabVisibility(tabEl, isActive);
393
406
  });
394
407
  });
395
408
  }
396
409
  /**
397
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
398
413
  */
399
- static resolveActiveTab(groupId, tabs, cfgGroups, groupEl) {
414
+ static resolveActiveTabForGroup(groupId, tabs, cfgGroups, groupEl) {
400
415
  // 1. Check state
401
416
  if (tabs[groupId]) {
402
417
  return tabs[groupId];
@@ -418,7 +433,8 @@ class TabManager {
418
433
  // 3. Fallback to first direct cv-tab child in DOM
419
434
  const firstTab = Array.from(groupEl.children).find((child) => child.tagName.toLowerCase() === TAB_SELECTOR);
420
435
  if (firstTab) {
421
- return firstTab.getAttribute('id');
436
+ const splitIds = this.splitTabIds(firstTab.getAttribute('id') || '');
437
+ return splitIds[0] || null;
422
438
  }
423
439
  return null;
424
440
  }
@@ -438,7 +454,7 @@ class TabManager {
438
454
  /**
439
455
  * Build navigation for tab groups with nav="auto" (one-time setup)
440
456
  */
441
- static buildNavs(rootEl, cfgGroups, onTabClick) {
457
+ static buildNavs(rootEl, cfgGroups, onTabClick, onTabDoubleClick) {
442
458
  // Find all cv-tabgroup elements with nav="auto" or no nav attribute
443
459
  const tabGroups = rootEl.querySelectorAll(NAV_AUTO_SELECTOR);
444
460
  // Check if any tab headers contain Font Awesome shortcodes
@@ -449,11 +465,14 @@ class TabManager {
449
465
  if (!groupId)
450
466
  return;
451
467
  const tabElements = Array.from(groupEl.children).filter((child) => child.tagName.toLowerCase() === 'cv-tab');
468
+ // Check for Font Awesome shortcodes in tab headers
452
469
  tabElements.forEach((tabEl) => {
453
470
  const tabId = tabEl.getAttribute('id');
454
471
  if (!tabId)
455
472
  return;
456
- 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 || '';
457
476
  if (/:fa-[\w-]+:/.test(header)) {
458
477
  hasFontAwesomeShortcodes = true;
459
478
  }
@@ -479,41 +498,90 @@ class TabManager {
479
498
  navContainer = document.createElement('ul');
480
499
  navContainer.className = `${NAV_CONTAINER_CLASS} nav-tabs`;
481
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
+ }
482
510
  groupEl.insertBefore(navContainer, groupEl.firstChild);
483
511
  // Build nav items
484
512
  tabElements.forEach((tabEl) => {
485
513
  const tabId = tabEl.getAttribute('id');
486
514
  if (!tabId)
487
515
  return;
488
- const header = tabEl.getAttribute('header') || this.getTabLabel(tabId, groupId, cfgGroups) || tabId;
489
- const listItem = document.createElement('li');
490
- listItem.className = 'nav-item';
491
- const navLink = document.createElement('a');
492
- navLink.className = 'nav-link';
493
- // Replace icon shortcodes in header
494
- navLink.innerHTML = replaceIconShortcodes(header);
495
- navLink.href = '#';
496
- navLink.setAttribute('data-tab-id', tabId);
497
- navLink.setAttribute('data-group-id', groupId);
498
- navLink.setAttribute('role', 'tab');
499
- // Check if this tab is currently active
500
- const isActive = tabEl.classList.contains('cv-visible');
501
- if (isActive) {
502
- navLink.classList.add('active');
503
- 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());
504
523
  }
505
- else {
506
- 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;
507
529
  }
508
- // Add click handler
509
- if (onTabClick) {
510
- navLink.addEventListener('click', (e) => {
511
- e.preventDefault();
512
- onTabClick(groupId, tabId);
513
- });
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 || '';
514
533
  }
515
- listItem.appendChild(navLink);
516
- 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
+ });
517
585
  });
518
586
  // Add bottom border line at the end of the tab group
519
587
  const bottomBorder = document.createElement('div');
@@ -521,6 +589,44 @@ class TabManager {
521
589
  groupEl.appendChild(bottomBorder);
522
590
  });
523
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
+ }
524
630
  /**
525
631
  * Get tab label from config
526
632
  */
@@ -534,23 +640,25 @@ class TabManager {
534
640
  return tabCfg?.label || null;
535
641
  }
536
642
  /**
537
- * Update active state in navs after selection change (single group)
643
+ * Update active state in navs for a specific tabgroup element only
538
644
  */
539
- static updateNavActiveState(rootEl, groupId, activeTabId) {
540
- const tabGroups = rootEl.querySelectorAll(`${TABGROUP_SELECTOR}[id="${groupId}"]`);
541
- tabGroups.forEach((groupEl) => {
542
- const navLinks = groupEl.querySelectorAll('.nav-link');
543
- navLinks.forEach((link) => {
544
- const tabId = link.getAttribute('data-tab-id');
545
- if (tabId === activeTabId) {
546
- link.classList.add('active');
547
- link.setAttribute('aria-selected', 'true');
548
- }
549
- else {
550
- link.classList.remove('active');
551
- link.setAttribute('aria-selected', 'false');
552
- }
553
- });
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
+ }
554
662
  });
555
663
  }
556
664
  /**
@@ -563,14 +671,19 @@ class TabManager {
563
671
  if (!groupId)
564
672
  return;
565
673
  // Determine the active tab for this group
566
- const activeTabId = this.resolveActiveTab(groupId, tabs, cfgGroups, groupEl);
674
+ const activeTabId = this.resolveActiveTabForGroup(groupId, tabs, cfgGroups, groupEl);
567
675
  if (!activeTabId)
568
676
  return;
569
677
  // Update nav links for this group
570
678
  const navLinks = groupEl.querySelectorAll('.nav-link');
571
679
  navLinks.forEach((link) => {
572
- const tabId = link.getAttribute('data-tab-id');
573
- 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) {
574
687
  link.classList.add('active');
575
688
  link.setAttribute('aria-selected', 'true');
576
689
  }
@@ -581,6 +694,47 @@ class TabManager {
581
694
  });
582
695
  });
583
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
+ }
584
738
  }
585
739
 
586
740
  class AssetsManager {
@@ -835,6 +989,18 @@ cv-tabgroup {
835
989
  .cv-tab-content {
836
990
  padding: 1rem 0;
837
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
+ }
838
1004
  `;
839
1005
 
840
1006
  /**
@@ -902,33 +1068,51 @@ class CustomViewsCore {
902
1068
  /**
903
1069
  * Set active tab for a group and apply state
904
1070
  */
905
- setActiveTab(groupId, tabId) {
906
- // Get current state
907
- const currentToggles = this.getCurrentActiveToggles();
908
- const currentTabs = this.getCurrentActiveTabs();
909
- // Merge new tab selection
910
- const newTabs = { ...currentTabs, [groupId]: tabId };
911
- // Create new state
912
- const newState = {
913
- toggles: currentToggles,
914
- tabs: newTabs
915
- };
916
- // Apply the state
917
- this.applyState(newState);
918
- // Emit custom event
919
- const event = new CustomEvent('customviews:tab-change', {
920
- detail: { groupId, tabId },
921
- bubbles: true
922
- });
923
- 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
+ }
924
1085
  }
925
1086
  // Inject styles, setup listeners and call rendering logic
926
1087
  async init() {
927
1088
  injectCoreStyles();
928
- // Build navigation once (with click handlers)
929
- TabManager.buildNavs(this.rootEl, this.config.tabGroups, (groupId, tabId) => {
930
- 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);
931
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 */ }
932
1116
  // For session history, clicks on back/forward button
933
1117
  window.addEventListener("popstate", () => {
934
1118
  this.loadAndCallApplyState();
@@ -1460,13 +1644,14 @@ const WIDGET_STYLES = `
1460
1644
 
1461
1645
  .cv-widget-modal {
1462
1646
  background: white;
1463
- border-radius: 8px;
1464
- box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
1465
- 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;
1466
1650
  width: 90vw;
1467
1651
  max-height: 80vh;
1468
- overflow-y: auto;
1469
1652
  animation: slideIn 0.2s ease;
1653
+ display: flex;
1654
+ flex-direction: column;
1470
1655
  }
1471
1656
 
1472
1657
  @keyframes slideIn {
@@ -1480,47 +1665,96 @@ const WIDGET_STYLES = `
1480
1665
  }
1481
1666
  }
1482
1667
 
1483
- .cv-widget-modal-header {
1668
+ .cv-modal-header {
1484
1669
  display: flex;
1670
+ align-items: center;
1485
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;
1486
1678
  align-items: center;
1487
- padding: 16px 20px;
1488
- border-bottom: 1px solid #e9ecef;
1489
- background: #f8f9fa;
1490
- border-radius: 8px 8px 0 0;
1679
+ gap: 0.75rem;
1491
1680
  }
1492
1681
 
1493
- .cv-widget-modal-header h3 {
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;
1696
+ }
1697
+
1698
+ .cv-modal-title {
1699
+ font-size: 1.125rem;
1700
+ font-weight: bold;
1701
+ color: rgba(0, 0, 0, 0.9);
1494
1702
  margin: 0;
1495
- font-size: 18px;
1496
- font-weight: 600;
1497
- color: #333;
1498
1703
  }
1499
1704
 
1500
- .cv-widget-modal-close {
1501
- background: none;
1502
- border: none;
1503
- font-size: 20px;
1504
- cursor: pointer;
1505
- padding: 0;
1506
- width: 32px;
1507
- height: 32px;
1705
+ .cv-modal-close {
1706
+ width: 2rem;
1707
+ height: 2rem;
1508
1708
  display: flex;
1509
1709
  align-items: center;
1510
1710
  justify-content: center;
1511
- border-radius: 4px;
1512
- color: #666;
1513
- line-height: 1;
1711
+ border-radius: 9999px;
1712
+ background: transparent;
1713
+ border: none;
1714
+ color: rgba(0, 0, 0, 0.6);
1715
+ cursor: pointer;
1514
1716
  transition: all 0.2s ease;
1515
1717
  }
1516
1718
 
1517
- .cv-widget-modal-close:hover {
1518
- background: #e9ecef;
1519
- color: #333;
1719
+ .cv-modal-close:hover {
1720
+ background: rgba(62, 132, 244, 0.1);
1721
+ color: #3e84f4;
1520
1722
  }
1521
1723
 
1522
- .cv-widget-modal-content {
1523
- padding: 20px;
1724
+ .cv-modal-close-icon {
1725
+ width: 1.25rem;
1726
+ height: 1.25rem;
1727
+ }
1728
+
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;
1524
1758
  }
1525
1759
 
1526
1760
  .cv-widget-modal-actions {
@@ -1562,32 +1796,83 @@ const WIDGET_STYLES = `
1562
1796
  background: #0056b3;
1563
1797
  }
1564
1798
 
1565
- /* Dark theme modal styles */
1566
1799
  .cv-widget-theme-dark .cv-widget-modal {
1567
- background: #2d3748;
1800
+ background: #101722;
1568
1801
  color: #e2e8f0;
1569
1802
  }
1570
1803
 
1571
- .cv-widget-theme-dark .cv-widget-modal-header {
1572
- background: #1a202c;
1573
- border-color: #4a5568;
1804
+ .cv-widget-theme-dark .cv-modal-header {
1805
+ border-color: rgba(255, 255, 255, 0.1);
1574
1806
  }
1575
1807
 
1576
- .cv-widget-theme-dark .cv-widget-modal-header h3 {
1808
+ .cv-widget-theme-dark .cv-modal-title {
1577
1809
  color: #e2e8f0;
1578
1810
  }
1579
1811
 
1580
- .cv-widget-theme-dark .cv-widget-modal-close {
1581
- color: #a0aec0;
1812
+ .cv-widget-theme-dark .cv-modal-close {
1813
+ color: rgba(255, 255, 255, 0.6);
1582
1814
  }
1583
1815
 
1584
- .cv-widget-theme-dark .cv-widget-modal-close:hover {
1585
- 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 {
1586
1842
  color: #e2e8f0;
1587
1843
  }
1588
1844
 
1589
- .cv-widget-theme-dark .cv-widget-modal-actions {
1590
- border-color: #4a5568;
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);
1861
+ color: #e2e8f0;
1862
+ }
1863
+
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);
1591
1876
  }
1592
1877
 
1593
1878
  /* Custom state creator styles */
@@ -1595,8 +1880,7 @@ const WIDGET_STYLES = `
1595
1880
  max-width: 500px;
1596
1881
  }
1597
1882
 
1598
- .cv-custom-state-form h4 {
1599
- margin: 20px 0 10px 0;
1883
+ .cv-custom-state-form .cv-section-header {
1600
1884
  font-size: 16px;
1601
1885
  font-weight: 600;
1602
1886
  color: #333;
@@ -1638,63 +1922,89 @@ const WIDGET_STYLES = `
1638
1922
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
1639
1923
  }
1640
1924
 
1641
- .cv-custom-toggles {
1642
- display: grid;
1643
- grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
1644
- 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;
1645
1933
  }
1646
1934
 
1647
- .cv-custom-state-toggle {
1648
- display: flex;
1649
- 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);
1650
1939
  }
1651
1940
 
1652
- .cv-custom-state-toggle label {
1941
+ .cv-toggle-card:last-child {
1942
+ border-bottom: none;
1943
+ }
1944
+
1945
+ .cv-toggle-content {
1653
1946
  display: flex;
1654
1947
  align-items: center;
1655
- cursor: pointer;
1656
- 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);
1657
1962
  margin: 0;
1658
1963
  }
1659
1964
 
1660
- .cv-toggle-switch {
1965
+ .cv-toggle-label{
1661
1966
  position: relative;
1662
- width: 44px;
1663
- height: 24px;
1664
- background: #ccc;
1665
- border-radius: 12px;
1666
- margin-right: 12px;
1967
+ display: inline-block;
1968
+ width: 2.75rem;
1969
+ height: 1.5rem;
1667
1970
  cursor: pointer;
1668
- transition: background-color 0.3s ease;
1669
- flex-shrink: 0;
1670
- }
1671
-
1672
- .cv-toggle-switch:hover {
1673
- background: #bbb;
1674
1971
  }
1675
1972
 
1676
- .cv-toggle-switch.cv-toggle-active {
1677
- background: #007bff;
1973
+ .cv-toggle-input {
1974
+ opacity: 0;
1975
+ width: 0;
1976
+ height: 0;
1678
1977
  }
1679
1978
 
1680
- .cv-toggle-switch.cv-toggle-active:hover {
1681
- 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;
1682
1988
  }
1683
1989
 
1684
- .cv-toggle-handle {
1990
+ .cv-toggle-slider:before {
1685
1991
  position: absolute;
1686
- top: 2px;
1687
- left: 2px;
1688
- width: 20px;
1689
- height: 20px;
1992
+ content: "";
1993
+ height: 1rem;
1994
+ width: 1rem;
1995
+ left: 0.25rem;
1996
+ bottom: 0.25rem;
1690
1997
  background: white;
1691
1998
  border-radius: 50%;
1692
- transition: transform 0.3s ease;
1693
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
1999
+ transition: transform 0.2s ease;
1694
2000
  }
1695
2001
 
1696
- .cv-toggle-switch.cv-toggle-active .cv-toggle-handle {
1697
- 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);
1698
2008
  }
1699
2009
 
1700
2010
  /* Dark theme toggle switch styles */
@@ -1714,200 +2024,371 @@ const WIDGET_STYLES = `
1714
2024
  background: #4299e1;
1715
2025
  }
1716
2026
 
1717
- .cv-tab-groups {
1718
- 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;
2035
+ }
2036
+
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;
1719
2044
  }
1720
2045
 
1721
- .cv-tab-group-control {
1722
- margin-bottom: 15px;
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;
1723
2052
  }
1724
2053
 
1725
- .cv-tab-group-control label {
1726
- display: block;
1727
- margin-bottom: 5px;
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 {
1728
2074
  font-weight: 500;
1729
- font-size: 14px;
2075
+ font-size: 0.875rem;
2076
+ color: rgba(0, 0, 0, 0.9);
2077
+ margin: 0 0 0.25rem 0;
1730
2078
  }
1731
2079
 
1732
- .cv-tab-group-select {
1733
- width: 100%;
1734
- padding: 8px 12px;
1735
- border: 1px solid #ced4da;
1736
- border-radius: 4px;
1737
- font-size: 14px;
1738
- 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;
1739
2095
  cursor: pointer;
1740
2096
  }
1741
2097
 
1742
- .cv-tab-group-select:focus {
1743
- outline: none;
1744
- border-color: #007bff;
1745
- 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;
1746
2110
  }
1747
2111
 
1748
- .cv-widget-theme-dark .cv-tab-group-select {
1749
- background-color: #2d3748;
1750
- border-color: #4a5568;
1751
- color: #e2e8f0;
2112
+ .cv-tabgroup-select:hover {
2113
+ border-color: rgba(0, 0, 0, 0.25);
1752
2114
  }
1753
2115
 
1754
- .cv-custom-state-actions {
1755
- display: flex;
1756
- gap: 10px;
1757
- margin-top: 20px;
1758
- padding-top: 16px;
1759
- 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);
1760
2120
  }
1761
2121
 
1762
- .cv-custom-state-cancel,
1763
- .cv-custom-state-copy-url {
1764
- flex: 1;
1765
- padding: 10px 16px;
1766
- border: none;
1767
- 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;
1768
2133
  cursor: pointer;
1769
- font-size: 14px;
1770
- font-weight: 500;
2134
+ transition: background-color 0.2s ease;
2135
+ border: none;
1771
2136
  }
1772
2137
 
1773
- .cv-custom-state-reset {
1774
- flex: 1;
1775
- padding: 10px 16px;
1776
- border: none;
1777
- border-radius: 4px;
1778
- cursor: pointer;
1779
- font-size: 14px;
1780
- font-weight: 500;
1781
- background: #dc3545;
1782
- color: white;
2138
+ .cv-toggle-switch input {
2139
+ display: none;
1783
2140
  }
1784
2141
 
1785
- .cv-custom-state-reset:hover {
1786
- 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;
1787
2149
  }
1788
2150
 
1789
- .cv-custom-state-cancel {
1790
- background: #6c757d;
1791
- 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;
1792
2160
  }
1793
2161
 
1794
- .cv-custom-state-cancel:hover {
1795
- background: #5a6268;
2162
+ .cv-toggle-switch input:checked + .cv-switch-bg {
2163
+ background: #3e84f4;
1796
2164
  }
1797
2165
 
1798
- .cv-custom-state-copy-url {
1799
- background: #28a745;
1800
- color: white;
2166
+ .cv-toggle-switch input:checked ~ .cv-switch-knob {
2167
+ transform: translateX(20px);
1801
2168
  }
1802
2169
 
1803
- .cv-custom-state-copy-url:hover {
1804
- 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);
1805
2174
  }
1806
2175
 
1807
- /* Dark theme custom state styles */
1808
- .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 {
1809
2182
  color: #e2e8f0;
1810
- border-color: #4a5568;
1811
2183
  }
1812
2184
 
1813
- .cv-widget-theme-dark .cv-custom-state-form p {
1814
- color: #cbd5e0;
2185
+ .cv-widget-theme-dark .cv-tabgroup-description {
2186
+ color: rgba(255, 255, 255, 0.6);
1815
2187
  }
1816
2188
 
1817
- .cv-widget-theme-dark .cv-custom-state-section label {
1818
- color: #a0aec0;
2189
+ .cv-widget-theme-dark .cv-tabgroup-label {
2190
+ color: rgba(255, 255, 255, 0.8);
1819
2191
  }
1820
2192
 
1821
- .cv-widget-theme-dark .cv-custom-state-input {
1822
- background: #1a202c;
1823
- 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);
1824
2200
  color: #e2e8f0;
1825
2201
  }
1826
2202
 
1827
- .cv-widget-theme-dark .cv-custom-state-actions {
1828
- 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);
2215
+ }
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);
1829
2254
  }
1830
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 */
1831
2271
  /* Welcome modal styles */
1832
2272
  .cv-welcome-modal {
1833
- 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);
1834
2291
  }
1835
2292
 
1836
- .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;
1837
2298
  text-align: center;
1838
2299
  }
1839
2300
 
1840
- .cv-welcome-content p {
1841
- font-size: 15px;
1842
- line-height: 1.6;
1843
- color: #555;
1844
- margin-bottom: 24px;
2301
+ .cv-welcome-message a {
2302
+ color: #3e84f4;
1845
2303
  text-align: justify;
2304
+ text-decoration: none;
2305
+ }
2306
+
2307
+ .cv-welcome-message a:hover {
2308
+ text-decoration: underline;
1846
2309
  }
1847
2310
 
1848
2311
  .cv-welcome-widget-preview {
1849
2312
  display: flex;
1850
- flex-direction: column;
1851
2313
  align-items: center;
1852
- gap: 12px;
1853
- padding: 20px;
2314
+ justify-content: center;
2315
+ gap: 1rem;
2316
+ padding: 1rem;
1854
2317
  background: #f8f9fa;
1855
- border-radius: 8px;
1856
- margin-bottom: 24px;
2318
+ border-radius: 0.5rem;
2319
+ margin: 1rem 0;
1857
2320
  }
1858
2321
 
1859
2322
  .cv-welcome-widget-icon {
1860
- width: 36px;
1861
- height: 36px;
1862
- background: white;
1863
- color: black;
1864
- border-radius: 0 18px 18px 0;
2323
+ width: 2rem;
2324
+ height: 2rem;
2325
+ background: rgba(62, 132, 244, 0.1);
2326
+ border-radius: 9999px;
1865
2327
  display: flex;
1866
2328
  align-items: center;
1867
2329
  justify-content: center;
1868
- font-size: 18px;
1869
- 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;
1870
2332
  }
1871
2333
 
1872
2334
  .cv-welcome-widget-label {
1873
- font-size: 14px;
1874
- color: #666;
1875
- margin: 0;
2335
+ font-size: 0.875rem;
1876
2336
  font-weight: 500;
2337
+ color: rgba(0, 0, 0, 0.8);
2338
+ margin: 0;
1877
2339
  }
1878
2340
 
1879
2341
  .cv-welcome-got-it {
1880
2342
  width: 100%;
1881
- padding: 12px 24px;
1882
- background: #007bff;
2343
+ background: #3e84f4;
1883
2344
  color: white;
2345
+ font-weight: 600;
2346
+ padding: 0.75rem 1rem;
2347
+ border-radius: 0.5rem;
1884
2348
  border: none;
1885
- border-radius: 4px;
1886
2349
  cursor: pointer;
1887
- font-size: 16px;
1888
- font-weight: 600;
1889
- transition: background 0.2s ease;
2350
+ font-size: 0.875rem;
2351
+ transition: background-color 0.2s ease;
2352
+ outline: none;
1890
2353
  }
1891
2354
 
1892
2355
  .cv-welcome-got-it:hover {
1893
- 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);
1894
2361
  }
1895
2362
 
1896
- .cv-welcome-got-it:active {
1897
- background: #004494;
2363
+ /* Animations */
2364
+ @keyframes cv-pulse {
2365
+ 0%, 100% {
2366
+ opacity: 1;
2367
+ }
2368
+ 50% {
2369
+ opacity: 0.5;
2370
+ }
1898
2371
  }
1899
2372
 
1900
2373
  /* Dark theme welcome modal styles */
1901
- .cv-widget-theme-dark .cv-welcome-content p {
1902
- 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;
1903
2384
  }
1904
2385
 
1905
2386
  .cv-widget-theme-dark .cv-welcome-widget-preview {
1906
- background: #1a202c;
2387
+ background: rgba(255, 255, 255, 0.1);
1907
2388
  }
1908
2389
 
1909
2390
  .cv-widget-theme-dark .cv-welcome-widget-label {
1910
- color: #a0aec0;
2391
+ color: #e2e8f0;
1911
2392
  }
1912
2393
  `;
1913
2394
  /**
@@ -1923,6 +2404,45 @@ function injectWidgetStyles() {
1923
2404
  document.head.appendChild(style);
1924
2405
  }
1925
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
+
1926
2446
  class CustomViewsWidget {
1927
2447
  core;
1928
2448
  container;
@@ -1941,7 +2461,7 @@ class CustomViewsWidget {
1941
2461
  theme: options.theme || 'light',
1942
2462
  showReset: options.showReset ?? true,
1943
2463
  title: options.title || 'Customize View',
1944
- 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 || '',
1945
2465
  showWelcome: options.showWelcome ?? false,
1946
2466
  welcomeTitle: options.welcomeTitle || 'Site Customization',
1947
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>.',
@@ -2023,63 +2543,122 @@ class CustomViewsWidget {
2023
2543
  this.modal = document.createElement('div');
2024
2544
  this.modal.className = 'cv-widget-modal-overlay';
2025
2545
  this.applyThemeToModal();
2026
- const toggleControls = toggles.length
2027
- ? toggles.map(toggle => `
2028
- <div class="cv-custom-state-toggle">
2029
- <label>
2030
- <div class="cv-toggle-switch" data-toggle="${toggle}">
2031
- <div class="cv-toggle-handle"></div>
2032
- </div>
2033
- ${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>
2034
2555
  </label>
2035
2556
  </div>
2036
- `).join('')
2037
- : `<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>
2038
2561
  // Get tab groups
2039
2562
  const tabGroups = this.core.getTabGroups();
2040
- let tabGroupsHTML = '';
2563
+ let tabGroupControlsHTML = '';
2564
+ // Check if any tab group or tab labels contain Font Awesome shortcodes
2565
+ let hasFontAwesomeShortcodes = false;
2041
2566
  if (this.options.showTabGroups && tabGroups && tabGroups.length > 0) {
2042
- const tabGroupControls = tabGroups.map(group => {
2043
- const options = group.tabs.map(tab => `<option value="${tab.id}">${tab.label || tab.id}</option>`).join('');
2044
- return `
2045
- <div class="cv-tab-group-control">
2046
- <label for="tab-group-${group.id}">${group.label || group.id}</label>
2047
- <select id="tab-group-${group.id}" class="cv-tab-group-select" data-group-id="${group.id}">
2048
- ${options}
2049
- </select>
2567
+ for (const group of tabGroups) {
2568
+ if (group.label && /:fa-[\w-]+:/.test(group.label)) {
2569
+ hasFontAwesomeShortcodes = true;
2570
+ break;
2571
+ }
2572
+ for (const tab of group.tabs) {
2573
+ if (tab.label && /:fa-[\w-]+:/.test(tab.label)) {
2574
+ hasFontAwesomeShortcodes = true;
2575
+ break;
2576
+ }
2577
+ }
2578
+ if (hasFontAwesomeShortcodes)
2579
+ break;
2580
+ }
2581
+ }
2582
+ // Inject Font Awesome only if shortcodes are found
2583
+ if (hasFontAwesomeShortcodes) {
2584
+ ensureFontAwesomeInjected();
2585
+ }
2586
+ if (this.options.showTabGroups && tabGroups && tabGroups.length > 0) {
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>
2050
2599
  </div>
2051
- `;
2052
- }).join('');
2053
- tabGroupsHTML = `
2054
- <h4>Tab Groups</h4>
2055
- <div class="cv-tab-groups">
2056
- ${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('')}
2057
2612
  </div>
2058
2613
  `;
2059
2614
  }
2060
2615
  this.modal.innerHTML = `
2061
2616
  <div class="cv-widget-modal cv-custom-state-modal">
2062
- <div class="cv-widget-modal-header">
2063
- <h3>${this.options.title}</h3>
2064
- <button class="cv-widget-modal-close" aria-label="Close modal">×</button>
2065
- </div>
2066
- <div class="cv-widget-modal-content">
2067
- <div class="cv-custom-state-form">
2068
- <p>${this.options.description}</p>
2069
-
2070
- <h4>Content Sections</h4>
2071
- <div class="cv-custom-toggles">
2072
- ${toggleControls}
2617
+ <header class="cv-modal-header">
2618
+ <div class="cv-modal-header-content">
2619
+ <div class="cv-modal-icon">
2620
+ ${getGearIcon()}
2073
2621
  </div>
2074
-
2075
- ${tabGroupsHTML}
2076
-
2077
- <div class="cv-custom-state-actions">
2078
- ${this.options.showReset ? `<button class="cv-custom-state-reset">Reset to Default</button>` : ''}
2079
- <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}
2080
2636
  </div>
2081
2637
  </div>
2082
- </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>
2083
2662
  </div>
2084
2663
  `;
2085
2664
  document.body.appendChild(this.modal);
@@ -2094,21 +2673,21 @@ class CustomViewsWidget {
2094
2673
  if (!this.modal)
2095
2674
  return;
2096
2675
  // Close button
2097
- const closeBtn = this.modal.querySelector('.cv-widget-modal-close');
2676
+ const closeBtn = this.modal.querySelector('.cv-modal-close');
2098
2677
  if (closeBtn) {
2099
2678
  closeBtn.addEventListener('click', () => {
2100
2679
  this.closeModal();
2101
2680
  });
2102
2681
  }
2103
2682
  // Copy URL button
2104
- const copyUrlBtn = this.modal.querySelector('.cv-custom-state-copy-url');
2683
+ const copyUrlBtn = this.modal.querySelector('.cv-share-btn');
2105
2684
  if (copyUrlBtn) {
2106
2685
  copyUrlBtn.addEventListener('click', () => {
2107
2686
  this.copyShareableURL();
2108
2687
  });
2109
2688
  }
2110
2689
  // Reset to default button
2111
- const resetBtn = this.modal.querySelector('.cv-custom-state-reset');
2690
+ const resetBtn = this.modal.querySelector('.cv-reset-btn');
2112
2691
  if (resetBtn) {
2113
2692
  resetBtn.addEventListener('click', () => {
2114
2693
  this.core.resetToDefault();
@@ -2116,25 +2695,55 @@ class CustomViewsWidget {
2116
2695
  });
2117
2696
  }
2118
2697
  // Listen to toggle switches
2119
- const toggleSwitches = this.modal.querySelectorAll('.cv-toggle-switch');
2120
- toggleSwitches.forEach(toggleSwitch => {
2121
- toggleSwitch.addEventListener('click', () => {
2122
- toggleSwitch.classList.toggle('cv-toggle-active');
2698
+ const toggleInputs = this.modal.querySelectorAll('.cv-toggle-input');
2699
+ toggleInputs.forEach(toggleInput => {
2700
+ toggleInput.addEventListener('change', () => {
2123
2701
  const state = this.getCurrentCustomStateFromModal();
2124
2702
  this.core.applyState(state);
2125
2703
  });
2126
2704
  });
2127
2705
  // Listen to tab group selects
2128
- const tabGroupSelects = this.modal.querySelectorAll('.cv-tab-group-select');
2706
+ const tabGroupSelects = this.modal.querySelectorAll('.cv-tabgroup-select');
2129
2707
  tabGroupSelects.forEach(select => {
2130
2708
  select.addEventListener('change', () => {
2131
2709
  const groupId = select.dataset.groupId;
2132
2710
  const tabId = select.value;
2133
2711
  if (groupId && tabId) {
2134
- 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);
2135
2723
  }
2136
2724
  });
2137
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
+ }
2138
2747
  // Overlay click to close
2139
2748
  this.modal.addEventListener('click', (e) => {
2140
2749
  if (e.target === this.modal) {
@@ -2172,15 +2781,15 @@ class CustomViewsWidget {
2172
2781
  }
2173
2782
  // Collect toggle values
2174
2783
  const toggles = [];
2175
- const toggleSwitches = this.modal.querySelectorAll('.cv-toggle-switch');
2176
- toggleSwitches.forEach(toggleSwitch => {
2177
- const toggle = toggleSwitch.dataset.toggle;
2178
- 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) {
2179
2788
  toggles.push(toggle);
2180
2789
  }
2181
2790
  });
2182
2791
  // Collect tab selections
2183
- const tabGroupSelects = this.modal.querySelectorAll('.cv-tab-group-select');
2792
+ const tabGroupSelects = this.modal.querySelectorAll('.cv-tabgroup-select');
2184
2793
  const tabs = {};
2185
2794
  tabGroupSelects.forEach(select => {
2186
2795
  const groupId = select.dataset.groupId;
@@ -2212,27 +2821,45 @@ class CustomViewsWidget {
2212
2821
  return;
2213
2822
  // Get currently active toggles (from custom state or default configuration)
2214
2823
  const activeToggles = this.core.getCurrentActiveToggles();
2215
- // First, deactivate all toggle switches
2216
- const allToggleSwitches = this.modal.querySelectorAll('.cv-toggle-switch');
2217
- allToggleSwitches.forEach(toggleSwitch => {
2218
- 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;
2219
2828
  });
2220
- // Then activate the ones that should be active
2829
+ // Then check the ones that should be active
2221
2830
  activeToggles.forEach(toggle => {
2222
- const toggleSwitch = this.modal?.querySelector(`[data-toggle="${toggle}"]`);
2223
- if (toggleSwitch) {
2224
- toggleSwitch.classList.add('cv-toggle-active');
2831
+ const toggleInput = this.modal?.querySelector(`[data-toggle="${toggle}"]`);
2832
+ if (toggleInput) {
2833
+ toggleInput.checked = true;
2225
2834
  }
2226
2835
  });
2227
2836
  // Load tab group selections
2228
2837
  const activeTabs = this.core.getCurrentActiveTabs();
2229
- const tabGroupSelects = this.modal.querySelectorAll('.cv-tab-group-select');
2838
+ const tabGroupSelects = this.modal.querySelectorAll('.cv-tab-groupselect');
2230
2839
  tabGroupSelects.forEach(select => {
2231
2840
  const groupId = select.dataset.groupId;
2232
2841
  if (groupId && activeTabs[groupId]) {
2233
2842
  select.value = activeTabs[groupId];
2234
2843
  }
2235
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
+ }
2236
2863
  }
2237
2864
  /**
2238
2865
  * Format toggle name for display
@@ -2268,21 +2895,25 @@ class CustomViewsWidget {
2268
2895
  this.applyThemeToModal();
2269
2896
  this.modal.innerHTML = `
2270
2897
  <div class="cv-widget-modal cv-welcome-modal">
2271
- <div class="cv-widget-modal-header">
2272
- <h3>${this.options.welcomeTitle}</h3>
2273
- <button class="cv-widget-modal-close" aria-label="Close modal">×</button>
2274
- </div>
2275
- <div class="cv-widget-modal-content">
2276
- <div class="cv-welcome-content">
2277
- <p style="text-align: justify;">${this.options.welcomeMessage}</p>
2278
-
2279
- <div class="cv-welcome-widget-preview">
2280
- <div class="cv-welcome-widget-icon">⚙</div>
2281
- <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()}
2282
2912
  </div>
2283
-
2284
- <button class="cv-welcome-got-it">Got it!</button>
2913
+ <p class="cv-welcome-widget-label">Look for this widget</p>
2285
2914
  </div>
2915
+
2916
+ <button class="cv-welcome-got-it">Got it!</button>
2286
2917
  </div>
2287
2918
  </div>
2288
2919
  `;
@@ -2295,13 +2926,6 @@ class CustomViewsWidget {
2295
2926
  attachWelcomeModalEventListeners() {
2296
2927
  if (!this.modal)
2297
2928
  return;
2298
- // Close button
2299
- const closeBtn = this.modal.querySelector('.cv-widget-modal-close');
2300
- if (closeBtn) {
2301
- closeBtn.addEventListener('click', () => {
2302
- this.closeModal();
2303
- });
2304
- }
2305
2929
  // Got it button
2306
2930
  const gotItBtn = this.modal.querySelector('.cv-welcome-got-it');
2307
2931
  if (gotItBtn) {