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