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