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