@customviews-js/customviews 1.3.0 → 1.4.0
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 +286 -153
- package/dist/custom-views.core.cjs.js.map +1 -1
- package/dist/custom-views.core.esm.js +286 -153
- package/dist/custom-views.core.esm.js.map +1 -1
- package/dist/custom-views.esm.js +286 -153
- package/dist/custom-views.esm.js.map +1 -1
- package/dist/custom-views.js +286 -153
- 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 +0 -1
- package/dist/types/core/core.d.ts.map +1 -1
- package/dist/types/core/widget.d.ts +1 -0
- package/dist/types/core/widget.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 +4 -0
- package/dist/types/utils/icons.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/types/core/share-button.d.ts +0 -13
- package/dist/types/core/share-button.d.ts.map +0 -1
- package/dist/types/styles/share-button-styles.d.ts +0 -3
- package/dist/types/styles/share-button-styles.d.ts.map +0 -1
package/dist/custom-views.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @customviews-js/customviews v1.
|
|
2
|
+
* @customviews-js/customviews v1.4.0
|
|
3
3
|
* (c) 2025 Chan Ger Teck
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -430,6 +430,14 @@ function getShareIcon() {
|
|
|
430
430
|
<path fill="currentColor" d="M11 6.41V12a1 1 0 0 0 2 0V6.41l1.29 1.3a1 1 0 0 0 1.42 0a1 1 0 0 0 0-1.42l-3-3a1 1 0 0 0-1.42 0l-3 3a1 1 0 1 0 1.42 1.42L11 6.41z"/>
|
|
431
431
|
</svg>`;
|
|
432
432
|
}
|
|
433
|
+
/**
|
|
434
|
+
* GitHub icon for footer link
|
|
435
|
+
*/
|
|
436
|
+
function getGitHubIcon() {
|
|
437
|
+
return `<svg viewBox="0 0 98 96" width="16" height="16" xmlns="http://www.w3.org/2000/svg" fill="currentColor">
|
|
438
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z"/>
|
|
439
|
+
</svg>`;
|
|
440
|
+
}
|
|
433
441
|
|
|
434
442
|
// Constants for selectors
|
|
435
443
|
const TABGROUP_SELECTOR$1 = 'cv-tabgroup';
|
|
@@ -2133,114 +2141,6 @@ class ShareManager {
|
|
|
2133
2141
|
}
|
|
2134
2142
|
}
|
|
2135
2143
|
|
|
2136
|
-
const SHARE_BUTTON_ID = 'cv-share-button';
|
|
2137
|
-
const SHARE_BUTTON_STYLES = `
|
|
2138
|
-
#${SHARE_BUTTON_ID} {
|
|
2139
|
-
position: fixed;
|
|
2140
|
-
bottom: 20px;
|
|
2141
|
-
right: 100px;
|
|
2142
|
-
width: 50px;
|
|
2143
|
-
height: 50px;
|
|
2144
|
-
border-radius: 50%;
|
|
2145
|
-
background-color: #007bff; /* Primary Blue */
|
|
2146
|
-
color: white;
|
|
2147
|
-
border: none;
|
|
2148
|
-
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08); /* Drop shadow */
|
|
2149
|
-
z-index: 9998; /* Below modals (9999) but above content */
|
|
2150
|
-
cursor: pointer;
|
|
2151
|
-
display: flex;
|
|
2152
|
-
align-items: center;
|
|
2153
|
-
justify-content: center;
|
|
2154
|
-
transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.2s;
|
|
2155
|
-
opacity: 1;
|
|
2156
|
-
transform: scale(1);
|
|
2157
|
-
padding: 0;
|
|
2158
|
-
margin: 0;
|
|
2159
|
-
}
|
|
2160
|
-
|
|
2161
|
-
#${SHARE_BUTTON_ID}:hover {
|
|
2162
|
-
background-color: #0056b3; /* Darker blue on hover */
|
|
2163
|
-
transform: scale(1.05);
|
|
2164
|
-
}
|
|
2165
|
-
|
|
2166
|
-
#${SHARE_BUTTON_ID}:active {
|
|
2167
|
-
transform: scale(0.95);
|
|
2168
|
-
}
|
|
2169
|
-
|
|
2170
|
-
#${SHARE_BUTTON_ID}.cv-hidden {
|
|
2171
|
-
opacity: 0;
|
|
2172
|
-
pointer-events: none;
|
|
2173
|
-
transform: scale(0.8);
|
|
2174
|
-
}
|
|
2175
|
-
|
|
2176
|
-
@media print {
|
|
2177
|
-
#${SHARE_BUTTON_ID} {
|
|
2178
|
-
display: none !important;
|
|
2179
|
-
}
|
|
2180
|
-
}
|
|
2181
|
-
|
|
2182
|
-
#${SHARE_BUTTON_ID} svg {
|
|
2183
|
-
width: 24px;
|
|
2184
|
-
height: 24px;
|
|
2185
|
-
fill: currentColor;
|
|
2186
|
-
}
|
|
2187
|
-
`;
|
|
2188
|
-
|
|
2189
|
-
class ShareButton {
|
|
2190
|
-
shareManager;
|
|
2191
|
-
button = null;
|
|
2192
|
-
boundHandleClick;
|
|
2193
|
-
constructor(shareManager) {
|
|
2194
|
-
this.shareManager = shareManager;
|
|
2195
|
-
this.boundHandleClick = () => this.shareManager.toggleShareMode();
|
|
2196
|
-
}
|
|
2197
|
-
init() {
|
|
2198
|
-
if (this.button)
|
|
2199
|
-
return;
|
|
2200
|
-
this.injectStyles();
|
|
2201
|
-
this.button = this.createButton();
|
|
2202
|
-
document.body.appendChild(this.button);
|
|
2203
|
-
// Subscribe to share manager state changes
|
|
2204
|
-
this.shareManager.addStateChangeListener((isActive) => {
|
|
2205
|
-
this.setShareModeActive(isActive);
|
|
2206
|
-
});
|
|
2207
|
-
}
|
|
2208
|
-
destroy() {
|
|
2209
|
-
if (this.button) {
|
|
2210
|
-
this.button.remove();
|
|
2211
|
-
this.button = null;
|
|
2212
|
-
}
|
|
2213
|
-
}
|
|
2214
|
-
createButton() {
|
|
2215
|
-
const btn = document.createElement('button');
|
|
2216
|
-
btn.id = SHARE_BUTTON_ID;
|
|
2217
|
-
btn.setAttribute('aria-label', 'Share specific sections');
|
|
2218
|
-
btn.title = 'Select sections to share';
|
|
2219
|
-
// Using the link icon from utils, ensuring it's white via CSS currentColor
|
|
2220
|
-
btn.innerHTML = getShareIcon();
|
|
2221
|
-
btn.addEventListener('click', this.boundHandleClick);
|
|
2222
|
-
return btn;
|
|
2223
|
-
}
|
|
2224
|
-
injectStyles() {
|
|
2225
|
-
if (!document.getElementById('cv-share-button-styles')) {
|
|
2226
|
-
const style = document.createElement('style');
|
|
2227
|
-
style.id = 'cv-share-button-styles';
|
|
2228
|
-
style.textContent = SHARE_BUTTON_STYLES;
|
|
2229
|
-
document.head.appendChild(style);
|
|
2230
|
-
}
|
|
2231
|
-
}
|
|
2232
|
-
setShareModeActive(isActive) {
|
|
2233
|
-
if (!this.button)
|
|
2234
|
-
return;
|
|
2235
|
-
if (isActive) {
|
|
2236
|
-
this.button.classList.add('cv-hidden');
|
|
2237
|
-
}
|
|
2238
|
-
else {
|
|
2239
|
-
this.button.classList.remove('cv-hidden');
|
|
2240
|
-
}
|
|
2241
|
-
}
|
|
2242
|
-
}
|
|
2243
|
-
|
|
2244
2144
|
const FOCUS_MODE_STYLE_ID = 'cv-focus-mode-styles';
|
|
2245
2145
|
const BODY_FOCUS_CLASS = 'cv-focus-mode';
|
|
2246
2146
|
const HIDDEN_CLASS = 'cv-focus-hidden';
|
|
@@ -2582,7 +2482,6 @@ class CustomViewsCore {
|
|
|
2582
2482
|
visibilityManager;
|
|
2583
2483
|
observer = null;
|
|
2584
2484
|
shareManager;
|
|
2585
|
-
shareButton;
|
|
2586
2485
|
focusManager;
|
|
2587
2486
|
componentRegistry = {
|
|
2588
2487
|
toggles: new Set(),
|
|
@@ -2605,7 +2504,6 @@ class CustomViewsCore {
|
|
|
2605
2504
|
const excludedIds = [...DEFAULT_EXCLUDED_IDS, ...(this.config.shareExclusions?.ids || [])];
|
|
2606
2505
|
const commonOptions = { excludedTags, excludedIds };
|
|
2607
2506
|
this.shareManager = new ShareManager(commonOptions);
|
|
2608
|
-
this.shareButton = new ShareButton(this.shareManager);
|
|
2609
2507
|
this.focusManager = new FocusManager(this.rootEl, commonOptions);
|
|
2610
2508
|
}
|
|
2611
2509
|
getShareManager() {
|
|
@@ -2756,7 +2654,6 @@ class CustomViewsCore {
|
|
|
2756
2654
|
});
|
|
2757
2655
|
this.loadAndCallApplyState();
|
|
2758
2656
|
this.focusManager.init();
|
|
2759
|
-
this.shareButton.init();
|
|
2760
2657
|
this.initObserver();
|
|
2761
2658
|
}
|
|
2762
2659
|
initializeNewComponents() {
|
|
@@ -4065,6 +3962,33 @@ const WIDGET_STYLES = `
|
|
|
4065
3962
|
padding: 0.75rem;
|
|
4066
3963
|
border-top: 1px solid rgba(0, 0, 0, 0.1);
|
|
4067
3964
|
}
|
|
3965
|
+
|
|
3966
|
+
.cv-footer-link {
|
|
3967
|
+
display: flex;
|
|
3968
|
+
align-items: center;
|
|
3969
|
+
justify-content: center;
|
|
3970
|
+
gap: 0.5rem;
|
|
3971
|
+
font-size: 0.75rem;
|
|
3972
|
+
color: rgba(0, 0, 0, 0.5);
|
|
3973
|
+
text-decoration: none;
|
|
3974
|
+
transition: color 0.2s ease;
|
|
3975
|
+
}
|
|
3976
|
+
|
|
3977
|
+
.cv-footer-link:hover {
|
|
3978
|
+
color: #3e84f4;
|
|
3979
|
+
}
|
|
3980
|
+
|
|
3981
|
+
.cv-footer-link svg {
|
|
3982
|
+
opacity: 0.8;
|
|
3983
|
+
}
|
|
3984
|
+
|
|
3985
|
+
.cv-widget-theme-dark .cv-footer-link {
|
|
3986
|
+
color: rgba(255, 255, 255, 0.4);
|
|
3987
|
+
}
|
|
3988
|
+
|
|
3989
|
+
.cv-widget-theme-dark .cv-footer-link:hover {
|
|
3990
|
+
color: #60a5fa;
|
|
3991
|
+
}
|
|
4068
3992
|
|
|
4069
3993
|
.cv-reset-btn,
|
|
4070
3994
|
.cv-share-btn {
|
|
@@ -4256,6 +4180,154 @@ const WIDGET_STYLES = `
|
|
|
4256
4180
|
display: none !important;
|
|
4257
4181
|
}
|
|
4258
4182
|
}
|
|
4183
|
+
/* Widget Modal Tabs */
|
|
4184
|
+
.cv-modal-tabs {
|
|
4185
|
+
display: flex;
|
|
4186
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
|
4187
|
+
margin-bottom: 0.5rem;
|
|
4188
|
+
}
|
|
4189
|
+
|
|
4190
|
+
.cv-tab-content > .cv-content-section + .cv-content-section {
|
|
4191
|
+
margin-top: 1.5rem;
|
|
4192
|
+
}
|
|
4193
|
+
|
|
4194
|
+
.cv-modal-tab {
|
|
4195
|
+
padding: 0.75rem 1.5rem;
|
|
4196
|
+
font-size: 0.875rem;
|
|
4197
|
+
font-weight: 500;
|
|
4198
|
+
color: rgba(0, 0, 0, 0.6);
|
|
4199
|
+
background: none;
|
|
4200
|
+
border: none;
|
|
4201
|
+
border-bottom: 2px solid transparent;
|
|
4202
|
+
cursor: pointer;
|
|
4203
|
+
transition: all 0.2s ease;
|
|
4204
|
+
}
|
|
4205
|
+
|
|
4206
|
+
.cv-modal-tab:hover {
|
|
4207
|
+
color: rgba(0, 0, 0, 0.9);
|
|
4208
|
+
}
|
|
4209
|
+
|
|
4210
|
+
.cv-modal-tab.active {
|
|
4211
|
+
color: #3e84f4;
|
|
4212
|
+
border-bottom-color: #3e84f4;
|
|
4213
|
+
}
|
|
4214
|
+
|
|
4215
|
+
.cv-tab-content {
|
|
4216
|
+
display: none;
|
|
4217
|
+
animation: fadeIn 0.3s ease;
|
|
4218
|
+
}
|
|
4219
|
+
|
|
4220
|
+
.cv-tab-content.active {
|
|
4221
|
+
display: block;
|
|
4222
|
+
}
|
|
4223
|
+
|
|
4224
|
+
/* Share Tab Content */
|
|
4225
|
+
.cv-share-content {
|
|
4226
|
+
display: flex;
|
|
4227
|
+
flex-direction: column;
|
|
4228
|
+
gap: 1rem;
|
|
4229
|
+
padding: 1rem 0;
|
|
4230
|
+
align-items: center;
|
|
4231
|
+
text-align: center;
|
|
4232
|
+
}
|
|
4233
|
+
|
|
4234
|
+
.cv-share-instruction {
|
|
4235
|
+
font-size: 0.9rem;
|
|
4236
|
+
color: rgba(0, 0, 0, 0.7);
|
|
4237
|
+
margin-bottom: 1rem;
|
|
4238
|
+
}
|
|
4239
|
+
|
|
4240
|
+
.cv-share-action-btn {
|
|
4241
|
+
display: flex;
|
|
4242
|
+
align-items: center;
|
|
4243
|
+
justify-content: center;
|
|
4244
|
+
gap: 0.5rem;
|
|
4245
|
+
width: 100%;
|
|
4246
|
+
padding: 12px 16px;
|
|
4247
|
+
background: white;
|
|
4248
|
+
color: #333;
|
|
4249
|
+
border: 1px solid rgba(0, 0, 0, 0.15);
|
|
4250
|
+
border-radius: 6px;
|
|
4251
|
+
cursor: pointer;
|
|
4252
|
+
font-size: 0.9rem;
|
|
4253
|
+
font-weight: 500;
|
|
4254
|
+
transition: all 0.2s ease;
|
|
4255
|
+
}
|
|
4256
|
+
|
|
4257
|
+
.cv-share-action-btn:hover {
|
|
4258
|
+
background: #f8f9fa;
|
|
4259
|
+
border-color: rgba(0, 0, 0, 0.25);
|
|
4260
|
+
transform: translateY(-1px);
|
|
4261
|
+
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
|
|
4262
|
+
}
|
|
4263
|
+
|
|
4264
|
+
.cv-share-action-btn.primary {
|
|
4265
|
+
background: #3e84f4;
|
|
4266
|
+
color: white;
|
|
4267
|
+
border-color: #3e84f4;
|
|
4268
|
+
}
|
|
4269
|
+
|
|
4270
|
+
.cv-share-action-btn.primary:hover {
|
|
4271
|
+
background: #2b74e6;
|
|
4272
|
+
border-color: #2b74e6;
|
|
4273
|
+
}
|
|
4274
|
+
|
|
4275
|
+
.cv-done-btn {
|
|
4276
|
+
padding: 0.375rem 1rem;
|
|
4277
|
+
background: #3e84f4;
|
|
4278
|
+
color: white;
|
|
4279
|
+
border: none;
|
|
4280
|
+
border-radius: 0.5rem;
|
|
4281
|
+
font-weight: 600;
|
|
4282
|
+
font-size: 0.875rem;
|
|
4283
|
+
cursor: pointer;
|
|
4284
|
+
transition: all 0.2s ease;
|
|
4285
|
+
}
|
|
4286
|
+
|
|
4287
|
+
.cv-done-btn:hover {
|
|
4288
|
+
background: #2b74e6;
|
|
4289
|
+
}
|
|
4290
|
+
|
|
4291
|
+
/* Dark Theme Adjustments */
|
|
4292
|
+
.cv-widget-theme-dark .cv-modal-tabs {
|
|
4293
|
+
border-color: rgba(255, 255, 255, 0.1);
|
|
4294
|
+
}
|
|
4295
|
+
|
|
4296
|
+
.cv-widget-theme-dark .cv-modal-tab {
|
|
4297
|
+
color: rgba(255, 255, 255, 0.6);
|
|
4298
|
+
}
|
|
4299
|
+
|
|
4300
|
+
.cv-widget-theme-dark .cv-modal-tab:hover {
|
|
4301
|
+
color: rgba(255, 255, 255, 0.9);
|
|
4302
|
+
}
|
|
4303
|
+
|
|
4304
|
+
.cv-widget-theme-dark .cv-modal-tab.active {
|
|
4305
|
+
color: #60a5fa;
|
|
4306
|
+
border-bottom-color: #60a5fa;
|
|
4307
|
+
}
|
|
4308
|
+
|
|
4309
|
+
.cv-widget-theme-dark .cv-share-instruction {
|
|
4310
|
+
color: rgba(255, 255, 255, 0.7);
|
|
4311
|
+
}
|
|
4312
|
+
|
|
4313
|
+
.cv-widget-theme-dark .cv-share-action-btn {
|
|
4314
|
+
background: #1a202c;
|
|
4315
|
+
color: white;
|
|
4316
|
+
border-color: rgba(255, 255, 255, 0.15);
|
|
4317
|
+
}
|
|
4318
|
+
|
|
4319
|
+
.cv-widget-theme-dark .cv-share-action-btn:hover {
|
|
4320
|
+
background: #2d3748;
|
|
4321
|
+
}
|
|
4322
|
+
|
|
4323
|
+
.cv-widget-theme-dark .cv-share-action-btn.primary {
|
|
4324
|
+
background: #3e84f4;
|
|
4325
|
+
border-color: #3e84f4;
|
|
4326
|
+
}
|
|
4327
|
+
|
|
4328
|
+
.cv-widget-theme-dark .cv-share-action-btn.primary:hover {
|
|
4329
|
+
background: #2b74e6;
|
|
4330
|
+
}
|
|
4259
4331
|
`;
|
|
4260
4332
|
/**
|
|
4261
4333
|
* Inject widget styles into the document head
|
|
@@ -4278,6 +4350,7 @@ class CustomViewsWidget {
|
|
|
4278
4350
|
_hasVisibleConfig = false;
|
|
4279
4351
|
pageToggleIds = new Set();
|
|
4280
4352
|
pageTabIds = new Set();
|
|
4353
|
+
currentTab = 'customize';
|
|
4281
4354
|
// Modal state
|
|
4282
4355
|
stateModal = null;
|
|
4283
4356
|
constructor(options) {
|
|
@@ -4453,12 +4526,12 @@ class CustomViewsWidget {
|
|
|
4453
4526
|
</div>
|
|
4454
4527
|
<div class="cv-tabgroup-info">
|
|
4455
4528
|
<div class="cv-tabgroup-title-container">
|
|
4456
|
-
<p class="cv-tabgroup-title">
|
|
4529
|
+
<p class="cv-tabgroup-title">Show only the selected tab</p>
|
|
4457
4530
|
</div>
|
|
4458
|
-
<p class="cv-tabgroup-description">
|
|
4531
|
+
<p class="cv-tabgroup-description">Hide the navigation headers</p>
|
|
4459
4532
|
</div>
|
|
4460
4533
|
<label class="cv-toggle-switch cv-nav-toggle">
|
|
4461
|
-
<input class="cv-nav-pref-input" type="checkbox" ${initialNavsVisible ? '
|
|
4534
|
+
<input class="cv-nav-pref-input" type="checkbox" ${initialNavsVisible ? '' : 'checked'} aria-label="Show only the selected tab" />
|
|
4462
4535
|
<span class="cv-switch-bg"></span>
|
|
4463
4536
|
<span class="cv-switch-knob"></span>
|
|
4464
4537
|
</label>
|
|
@@ -4494,37 +4567,64 @@ class CustomViewsWidget {
|
|
|
4494
4567
|
<main class="cv-modal-main">
|
|
4495
4568
|
${this.options.description ? `<p class="cv-modal-description">${this.options.description}</p>` : ''}
|
|
4496
4569
|
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
<
|
|
4500
|
-
|
|
4501
|
-
|
|
4570
|
+
<div class="cv-modal-tabs">
|
|
4571
|
+
<button class="cv-modal-tab ${this.currentTab === 'customize' ? 'active' : ''}" data-tab="customize">Customize</button>
|
|
4572
|
+
<button class="cv-modal-tab ${this.currentTab === 'share' ? 'active' : ''}" data-tab="share">Share</button>
|
|
4573
|
+
</div>
|
|
4574
|
+
|
|
4575
|
+
<div class="cv-tab-content ${this.currentTab === 'customize' ? 'active' : ''}" data-content="customize">
|
|
4576
|
+
${visibleToggles.length ? `
|
|
4577
|
+
<div class="cv-content-section">
|
|
4578
|
+
<div class="cv-section-heading">Toggles</div>
|
|
4579
|
+
<div class="cv-toggles-container">
|
|
4580
|
+
${toggleControlsHtml}
|
|
4581
|
+
</div>
|
|
4502
4582
|
</div>
|
|
4583
|
+
` : ''}
|
|
4584
|
+
|
|
4585
|
+
${this.options.showTabGroups && tabGroups && tabGroups.length > 0 ? `
|
|
4586
|
+
<div class="cv-content-section">
|
|
4587
|
+
<div class="cv-section-heading">Tab Groups</div>
|
|
4588
|
+
<div class="cv-tabgroups-container">
|
|
4589
|
+
${tabGroupControlsHTML}
|
|
4590
|
+
</div>
|
|
4591
|
+
</div>
|
|
4592
|
+
` : ''}
|
|
4503
4593
|
</div>
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4594
|
+
|
|
4595
|
+
<div class="cv-tab-content ${this.currentTab === 'share' ? 'active' : ''}" data-content="share">
|
|
4596
|
+
<div class="cv-share-content">
|
|
4597
|
+
<div class="cv-share-instruction">
|
|
4598
|
+
Create a shareable link for your current customization, or select specific parts of the page to share.
|
|
4599
|
+
</div>
|
|
4600
|
+
|
|
4601
|
+
<button class="cv-share-action-btn primary cv-start-share-btn">
|
|
4602
|
+
<span class="cv-btn-icon">${getShareIcon()}</span>
|
|
4603
|
+
<span>Select elements to share</span>
|
|
4604
|
+
</button>
|
|
4605
|
+
|
|
4606
|
+
<button class="cv-share-action-btn cv-copy-url-btn">
|
|
4607
|
+
<span class="cv-btn-icon">${getCopyIcon()}</span>
|
|
4608
|
+
<span>Copy Shareable URL of Settings</span>
|
|
4609
|
+
</button>
|
|
4511
4610
|
</div>
|
|
4512
4611
|
</div>
|
|
4513
|
-
` : ''}
|
|
4514
4612
|
</main>
|
|
4515
4613
|
|
|
4516
4614
|
<footer class="cv-modal-footer">
|
|
4517
4615
|
${this.options.showReset ? `
|
|
4518
|
-
<button class="cv-reset-btn">
|
|
4616
|
+
<button class="cv-reset-btn" title="Reset to Default">
|
|
4519
4617
|
<span class="cv-reset-btn-icon">${getResetIcon()}</span>
|
|
4520
|
-
<span>Reset
|
|
4521
|
-
</button>
|
|
4522
|
-
` : ''}
|
|
4523
|
-
<button class="cv-share-btn">
|
|
4524
|
-
<span>Copy Shareable URL</span>
|
|
4525
|
-
<span class="cv-share-btn-icon">${getCopyIcon()}</span>
|
|
4618
|
+
<span>Reset</span>
|
|
4526
4619
|
</button>
|
|
4620
|
+
` : '<div></div>'}
|
|
4621
|
+
|
|
4622
|
+
<a href="https://github.com/customviews-js/customviews" target="_blank" class="cv-footer-link">
|
|
4623
|
+
${getGitHubIcon()}
|
|
4624
|
+
<span>View on GitHub</span>
|
|
4625
|
+
</a>
|
|
4527
4626
|
|
|
4627
|
+
<button class="cv-done-btn">Done</button>
|
|
4528
4628
|
</footer>
|
|
4529
4629
|
</div>
|
|
4530
4630
|
`;
|
|
@@ -4545,20 +4645,6 @@ class CustomViewsWidget {
|
|
|
4545
4645
|
this.closeModal();
|
|
4546
4646
|
return;
|
|
4547
4647
|
}
|
|
4548
|
-
// Copy URL button
|
|
4549
|
-
if (target.closest('.cv-share-btn')) {
|
|
4550
|
-
this.copyShareableURL();
|
|
4551
|
-
const copyUrlBtn = target.closest('.cv-share-btn');
|
|
4552
|
-
const iconContainer = copyUrlBtn?.querySelector('.cv-share-btn-icon');
|
|
4553
|
-
if (iconContainer) {
|
|
4554
|
-
const originalIcon = iconContainer.innerHTML;
|
|
4555
|
-
iconContainer.innerHTML = getTickIcon();
|
|
4556
|
-
setTimeout(() => {
|
|
4557
|
-
iconContainer.innerHTML = originalIcon;
|
|
4558
|
-
}, 3000);
|
|
4559
|
-
}
|
|
4560
|
-
return;
|
|
4561
|
-
}
|
|
4562
4648
|
// Reset to default button
|
|
4563
4649
|
if (target.closest('.cv-reset-btn')) {
|
|
4564
4650
|
const resetBtn = target.closest('.cv-reset-btn');
|
|
@@ -4575,6 +4661,11 @@ class CustomViewsWidget {
|
|
|
4575
4661
|
}, 600);
|
|
4576
4662
|
return;
|
|
4577
4663
|
}
|
|
4664
|
+
// Done button
|
|
4665
|
+
if (target.closest('.cv-done-btn')) {
|
|
4666
|
+
this.closeModal();
|
|
4667
|
+
return;
|
|
4668
|
+
}
|
|
4578
4669
|
// Overlay click to close
|
|
4579
4670
|
if (e.target === this.stateModal) {
|
|
4580
4671
|
this.closeModal();
|
|
@@ -4635,10 +4726,10 @@ class CustomViewsWidget {
|
|
|
4635
4726
|
navIcon.innerHTML = isVisible ? getNavHeadingOnIcon() : getNavHeadingOffIcon();
|
|
4636
4727
|
}
|
|
4637
4728
|
};
|
|
4638
|
-
navHeaderCard.addEventListener('mouseenter', () => updateIcon(tabNavToggle.checked, true));
|
|
4639
|
-
navHeaderCard.addEventListener('mouseleave', () => updateIcon(tabNavToggle.checked, false));
|
|
4729
|
+
navHeaderCard.addEventListener('mouseenter', () => updateIcon(!tabNavToggle.checked, true));
|
|
4730
|
+
navHeaderCard.addEventListener('mouseleave', () => updateIcon(!tabNavToggle.checked, false));
|
|
4640
4731
|
tabNavToggle.addEventListener('change', () => {
|
|
4641
|
-
const visible = tabNavToggle.checked;
|
|
4732
|
+
const visible = !tabNavToggle.checked;
|
|
4642
4733
|
updateIcon(visible, false);
|
|
4643
4734
|
this.core.persistTabNavVisibility(visible);
|
|
4644
4735
|
try {
|
|
@@ -4649,6 +4740,48 @@ class CustomViewsWidget {
|
|
|
4649
4740
|
}
|
|
4650
4741
|
});
|
|
4651
4742
|
}
|
|
4743
|
+
// Tab switching
|
|
4744
|
+
const tabs = this.stateModal.querySelectorAll('.cv-modal-tab');
|
|
4745
|
+
tabs.forEach(tab => {
|
|
4746
|
+
tab.addEventListener('click', () => {
|
|
4747
|
+
const tabId = tab.dataset.tab;
|
|
4748
|
+
if (tabId === 'customize' || tabId === 'share') {
|
|
4749
|
+
this.currentTab = tabId;
|
|
4750
|
+
// Update UI without full re-render
|
|
4751
|
+
tabs.forEach(t => t.classList.remove('active'));
|
|
4752
|
+
tab.classList.add('active');
|
|
4753
|
+
const contents = this.stateModal?.querySelectorAll('.cv-tab-content');
|
|
4754
|
+
contents?.forEach(c => {
|
|
4755
|
+
c.classList.remove('active');
|
|
4756
|
+
if (c.dataset.content === tabId) {
|
|
4757
|
+
c.classList.add('active');
|
|
4758
|
+
}
|
|
4759
|
+
});
|
|
4760
|
+
}
|
|
4761
|
+
});
|
|
4762
|
+
});
|
|
4763
|
+
// Share buttons (inside content)
|
|
4764
|
+
const startShareBtn = this.stateModal.querySelector('.cv-start-share-btn');
|
|
4765
|
+
if (startShareBtn) {
|
|
4766
|
+
startShareBtn.addEventListener('click', () => {
|
|
4767
|
+
this.closeModal();
|
|
4768
|
+
this.core.toggleShareMode();
|
|
4769
|
+
});
|
|
4770
|
+
}
|
|
4771
|
+
const copyUrlBtn = this.stateModal.querySelector('.cv-copy-url-btn');
|
|
4772
|
+
if (copyUrlBtn) {
|
|
4773
|
+
copyUrlBtn.addEventListener('click', () => {
|
|
4774
|
+
this.copyShareableURL();
|
|
4775
|
+
const iconContainer = copyUrlBtn.querySelector('.cv-btn-icon');
|
|
4776
|
+
if (iconContainer) {
|
|
4777
|
+
const originalIcon = iconContainer.innerHTML;
|
|
4778
|
+
iconContainer.innerHTML = getTickIcon();
|
|
4779
|
+
setTimeout(() => {
|
|
4780
|
+
iconContainer.innerHTML = originalIcon;
|
|
4781
|
+
}, 2000);
|
|
4782
|
+
}
|
|
4783
|
+
});
|
|
4784
|
+
}
|
|
4652
4785
|
}
|
|
4653
4786
|
/**
|
|
4654
4787
|
* Apply theme class to the modal overlay based on options
|
|
@@ -4744,7 +4877,7 @@ class CustomViewsWidget {
|
|
|
4744
4877
|
const tabNavToggle = this.stateModal.querySelector('.cv-nav-pref-input');
|
|
4745
4878
|
const navIcon = this.stateModal?.querySelector('#cv-nav-icon');
|
|
4746
4879
|
if (tabNavToggle) {
|
|
4747
|
-
tabNavToggle.checked = navPref;
|
|
4880
|
+
tabNavToggle.checked = !navPref;
|
|
4748
4881
|
// Ensure UI matches actual visibility
|
|
4749
4882
|
TabManager.setNavsVisibility(document.body, navPref);
|
|
4750
4883
|
// Update the nav icon to reflect the current state
|