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