@customviews-js/customviews 1.1.9 → 1.1.11

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @customviews-js/customviews v1.1.8
2
+ * @customviews-js/customviews v1.1.11
3
3
  * (c) 2025 Chan Ger Teck
4
4
  * Released under the MIT License.
5
5
  */
@@ -297,6 +297,122 @@ class VisibilityManager {
297
297
  }
298
298
  }
299
299
 
300
+ /**
301
+ * Icon utilities for CustomViews widget
302
+ * Centralized SVG icons for better maintainability and reusability
303
+ */
304
+ /**
305
+ * Settings gear icon for modal header
306
+ */
307
+ function getGearIcon() {
308
+ return `<svg class="cv-modal-icon-svg" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
309
+ <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"/>
310
+ <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"/>
311
+ </svg>`;
312
+ }
313
+ /**
314
+ * Close/X icon for modal close button
315
+ */
316
+ function getCloseIcon() {
317
+ 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">
318
+ <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>
319
+ </svg>`;
320
+ }
321
+ /**
322
+ * Reset/refresh icon for reset button
323
+ */
324
+ function getResetIcon() {
325
+ return `<svg class="cv-btn-icon" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
326
+ <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"/>
327
+ </svg>`;
328
+ }
329
+ /**
330
+ * Copy icon for sharing URL button
331
+ */
332
+ function getCopyIcon() {
333
+ return `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="18" height="18" viewBox="0 0 18 18" version="1.1" fill="currentColor">
334
+ <g id="surface1">
335
+ <path d="M 11.273438 0 L 2.546875 0 C 1.746094 0 1.089844 0.613281 1.089844
336
+ 1.363281 L 1.089844 10.910156 L 2.546875 10.910156 L 2.546875 1.363281 L 11.273438
337
+ 1.363281 Z M 13.453125 2.726562 L 5.453125 2.726562 C 4.65625 2.726562 4 3.339844 4
338
+ 4.089844 L 4 13.636719 C 4 14.386719 4.65625 15 5.453125 15 L 13.453125 15 C 14.253906
339
+ 15 14.910156 14.386719 14.910156 13.636719 L 14.910156 4.089844 C 14.910156 3.339844
340
+ 14.253906 2.726562 13.453125 2.726562 Z M 13.453125 13.636719 L 5.453125 13.636719 L
341
+ 5.453125 4.089844 L 13.453125 4.089844 Z M 13.453125 13.636719 "></path>
342
+ </g>
343
+ </svg>`;
344
+ }
345
+ function getTickIcon() {
346
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="2 2 22 22" fill="currentColor">
347
+ <path d="M 19.28125 5.28125 L 9 15.5625 L 4.71875 11.28125 L 3.28125 12.71875 L 8.28125 17.71875
348
+ L 9 18.40625 L 9.71875 17.71875 L 20.71875 6.71875 Z"></path>
349
+ </svg>`;
350
+ }
351
+ function getNavHeadingOnIcon() {
352
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="250" height="181" viewBox="0 0 250 181">
353
+ <rect y="34.5001" width="250" height="146" rx="4" stroke="currentColor" stroke-width="10" fill="none"/>
354
+ <line x1="27" y1="62.0001" x2="77" y2="62.0001" stroke="currentColor" stroke-width="5"/>
355
+ <line x1="27" y1="77.8888" x2="77" y2="77.8888" stroke="currentColor" stroke-width="5"/>
356
+ <line x1="27" y1="97.4454" x2="221" y2="97.4454" stroke="currentColor" stroke-width="5"/>
357
+ <line x1="27" y1="114.555" x2="221" y2="114.555" stroke="currentColor" stroke-width="5"/>
358
+ <line x1="27" y1="132.889" x2="221" y2="132.889" stroke="currentColor" stroke-width="5"/>
359
+ <line x1="27" y1="150" x2="221" y2="150" stroke="currentColor" stroke-width="5"/>
360
+ <line x1="247.5" y1="43.0001" x2="247.5" y2="13.0001" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>
361
+ <path d="M185 12.5001L247 12.5001" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>
362
+ <line x1="204.09" y1="36.6095" x2="181.698" y2="10.0228" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>
363
+ <path d="M125 9.50012L181 9.50012" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>
364
+ <path d="M144.305 35.2579L120.095 6.56679" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>
365
+ <path d="M120 6.50037L64 6.50037" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>
366
+ <path d="M87.1957 36.1024L59 2.50008" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>
367
+ <path d="M59 2.50037L3 2.50037" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>
368
+ <path d="M2.5 38.5001L2.5 3.00012" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>
369
+ </svg>`;
370
+ }
371
+ function getNavHeadingOffIcon() {
372
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="250" height="181" viewBox="0 0 250 181" fill="currentColor">
373
+ <rect y="34.5001" width="250" height="146" rx="4" stroke="currentColor" stroke-width="10" fill="none"/>
374
+ <line x1="27" y1="62" x2="77" y2="62" stroke="currentColor" stroke-width="5"/>
375
+ <line x1="27" y1="77.8887" x2="77" y2="77.8887" stroke="currentColor" stroke-width="5"/>
376
+ <line x1="27" y1="97.4453" x2="221" y2="97.4453" stroke="currentColor" stroke-width="5"/>
377
+ <line x1="27" y1="114.555" x2="221" y2="114.555" stroke="currentColor" stroke-width="5"/>
378
+ <line x1="27" y1="132.889" x2="221" y2="132.889" stroke="currentColor" stroke-width="5"/>
379
+ <line x1="27" y1="150" x2="221" y2="150" stroke="currentColor" stroke-width="5"/>
380
+ </svg>`;
381
+ }
382
+ /**
383
+ * Transition Icon for Navigation Headings
384
+ */
385
+ function getNavDashed() {
386
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="250" height="181" viewBox="0 0 250 181">
387
+ <rect y="34.5001" width="250" height="146" rx="4" stroke="currentColor" stroke-width="10" fill="none"/>
388
+ <line x1="27" y1="62.0001" x2="77" y2="62.0001" stroke="currentColor" stroke-width="5"/>
389
+ <line x1="27" y1="77.8888" x2="77" y2="77.8888" stroke="currentColor" stroke-width="5"/>
390
+ <line x1="27" y1="97.4454" x2="221" y2="97.4454" stroke="currentColor" stroke-width="5"/>
391
+ <line x1="27" y1="114.555" x2="221" y2="114.555" stroke="currentColor" stroke-width="5"/>
392
+ <line x1="27" y1="132.889" x2="221" y2="132.889" stroke="currentColor" stroke-width="5"/>
393
+ <line x1="27" y1="150" x2="221" y2="150" stroke="currentColor" stroke-width="5"/>
394
+ <path d="M245 37.0001V39.5001H250V37.0001H247.5H245ZM250 13.0001C250 11.6194 248.881 10.5001 247.5 10.5001C246.119 10.5001 245 11.6194 245 13.0001H247.5H250ZM250 31.0001C250 29.6194 248.881 28.5001 247.5 28.5001C246.119 28.5001 245 29.6194 245 31.0001H247.5H250ZM245 19.0001C245 20.3808 246.119 21.5001 247.5 21.5001C248.881 21.5001 250 20.3808 250 19.0001H247.5H245ZM247.5 37.0001H250V31.0001H247.5H245V37.0001H247.5ZM247.5 19.0001H250V13.0001H247.5H245V19.0001H247.5Z" fill="currentColor"/>
395
+ <line x1="204.09" y1="36.6095" x2="181.698" y2="10.0228" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-dasharray="10 10"/>
396
+ <path d="M125 9.50012L181 9.50012" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-dasharray="10 10"/>
397
+ <path d="M144.305 35.2579L120.095 6.56679" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-dasharray="10 10"/>
398
+ <path d="M120 6.50037L64 6.50037" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-dasharray="10 10"/>
399
+ <path d="M87.1957 36.1024L59 2.50008" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-dasharray="10 10"/>
400
+ <path d="M59 2.50037L3 2.50037" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-dasharray="10 10"/>
401
+ <path d="M2.5 38.5001L2.5 3.00012" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-dasharray="10 10"/>
402
+ <path d="M185 12.5001L247 12.5001" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-dasharray="10 10"/>
403
+ </svg>`;
404
+ }
405
+ function getPinIcon(isPinned = false) {
406
+ const opacity = isPinned ? '1' : '0.6'; // Optional: additional dimming effect
407
+ return `
408
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" opacity="${opacity}" xmlns="http://www.w3.org/2000/svg">
409
+ <g transform="rotate(45 8 8)">
410
+ <path d="M10.5 2H12V0H4V2H5.5V6L4 7.5V9H7.2V15H8.8V9H12V7.5L10.5 6V2Z"/>
411
+ </g>
412
+ </svg>
413
+ `.trim();
414
+ }
415
+
300
416
  // Constants for selectors
301
417
  const TABGROUP_SELECTOR = 'cv-tabgroup';
302
418
  const TAB_SELECTOR = 'cv-tab';
@@ -316,19 +432,34 @@ class TabManager {
316
432
  /**
317
433
  * Apply tab selections to all tab groups in the DOM
318
434
  */
319
- static applySelections(rootEl, tabs, cfgGroups) {
435
+ static applyTabSelections(rootEl, tabs, cfgGroups) {
320
436
  // Find all cv-tabgroup elements
321
437
  const tabGroups = rootEl.querySelectorAll(TABGROUP_SELECTOR);
322
438
  tabGroups.forEach((groupEl) => {
323
439
  const groupId = groupEl.getAttribute('id');
324
- if (!groupId)
325
- return;
326
440
  // Determine the active tab for this group
327
- const activeTabId = this.resolveActiveTabForGroup(groupId, tabs, cfgGroups, groupEl);
441
+ let activeTabId;
442
+ if (groupId) {
443
+ activeTabId = this.resolveActiveTabForGroup(groupId, tabs, cfgGroups, groupEl);
444
+ }
445
+ else {
446
+ // For standalone groups without id, activate the first tab
447
+ const tabElements = Array.from(groupEl.children).filter((child) => child.tagName.toLowerCase() === TAB_SELECTOR);
448
+ const firstTab = tabElements[0];
449
+ if (firstTab) {
450
+ const firstTabId = firstTab.getAttribute('id') || firstTab.getAttribute('data-cv-internal-id') || '';
451
+ const splitIds = this.splitTabIds(firstTabId);
452
+ activeTabId = splitIds[0] || null;
453
+ }
454
+ else {
455
+ activeTabId = null;
456
+ }
457
+ }
328
458
  // Apply visibility to direct child cv-tab elements only (not nested ones)
329
459
  const tabElements = Array.from(groupEl.children).filter((child) => child.tagName.toLowerCase() === TAB_SELECTOR);
330
460
  tabElements.forEach((tabEl) => {
331
- const tabId = tabEl.getAttribute('id');
461
+ // Use id or internal id
462
+ const tabId = tabEl.getAttribute('id') || tabEl.getAttribute('data-cv-internal-id');
332
463
  if (!tabId)
333
464
  return;
334
465
  // Split IDs and check if any match the active tab
@@ -348,13 +479,10 @@ class TabManager {
348
479
  if (tabs[groupId]) {
349
480
  return tabs[groupId];
350
481
  }
351
- // 2. Check config default
482
+ // 2. Check config for first tab
352
483
  if (cfgGroups) {
353
484
  const groupCfg = cfgGroups.find(g => g.id === groupId);
354
485
  if (groupCfg) {
355
- if (groupCfg.default) {
356
- return groupCfg.default;
357
- }
358
486
  // Fallback to first tab in config
359
487
  const firstConfigTab = groupCfg.tabs[0];
360
488
  if (firstConfigTab) {
@@ -365,7 +493,9 @@ class TabManager {
365
493
  // 3. Fallback to first direct cv-tab child in DOM
366
494
  const firstTab = Array.from(groupEl.children).find((child) => child.tagName.toLowerCase() === TAB_SELECTOR);
367
495
  if (firstTab) {
368
- const splitIds = this.splitTabIds(firstTab.getAttribute('id') || '');
496
+ // Use id or internal id
497
+ const tabId = firstTab.getAttribute('id') || firstTab.getAttribute('data-cv-internal-id') || '';
498
+ const splitIds = this.splitTabIds(tabId);
369
499
  return splitIds[0] || null;
370
500
  }
371
501
  return null;
@@ -407,15 +537,15 @@ class TabManager {
407
537
  };
408
538
  }
409
539
  /**
410
- * Build navigation for tab groups with nav="auto" (one-time setup)
540
+ * Build navigation for tab groups (one-time setup)
411
541
  */
412
542
  static buildNavs(rootEl, cfgGroups, onTabClick, onTabDoubleClick) {
413
543
  // Find all cv-tabgroup elements with nav="auto" or no nav attribute
414
544
  const tabGroups = rootEl.querySelectorAll(NAV_AUTO_SELECTOR);
415
545
  tabGroups.forEach((groupEl) => {
416
- const groupId = groupEl.getAttribute('id');
417
- if (!groupId)
418
- return;
546
+ const groupId = groupEl.getAttribute('id') || null;
547
+ // Note: groupId can be null for standalone tabgroups
548
+ // These won't sync with other groups or persist state
419
549
  // Check if nav already exists - if so, skip building
420
550
  let navContainer = groupEl.querySelector(`.${NAV_CONTAINER_CLASS}`);
421
551
  if (navContainer)
@@ -439,10 +569,13 @@ class TabManager {
439
569
  }
440
570
  groupEl.insertBefore(navContainer, groupEl.firstChild);
441
571
  // Build nav items
442
- tabElements.forEach((tabEl) => {
443
- const rawTabId = tabEl.getAttribute('id');
444
- if (!rawTabId)
445
- return;
572
+ tabElements.forEach((tabEl, index) => {
573
+ let rawTabId = tabEl.getAttribute('id');
574
+ // If tab has no id, generate one based on position
575
+ if (!rawTabId) {
576
+ rawTabId = `${groupId}-tab-${index}`;
577
+ tabEl.setAttribute('data-cv-internal-id', rawTabId);
578
+ }
446
579
  const splitIds = this.splitTabIds(rawTabId);
447
580
  // If multiple IDs, use the first as primary
448
581
  const tabId = splitIds[0] || rawTabId;
@@ -460,8 +593,19 @@ class TabManager {
460
593
  header = headerAttr;
461
594
  }
462
595
  else {
463
- // Use config label or id as fallback
464
- header = this.getTabLabel(tabId, groupId, cfgGroups) || tabId || '';
596
+ // Use config label if available (only if group has an id)
597
+ const configLabel = groupId ? this.getTabLabel(tabId, groupId, cfgGroups) : null;
598
+ if (configLabel) {
599
+ header = configLabel;
600
+ }
601
+ else if (tabEl.getAttribute('id')) {
602
+ // Use the original id if it exists
603
+ header = tabId;
604
+ }
605
+ else {
606
+ // Auto-generate label for tabs without id (Tab 1, Tab 2, etc.)
607
+ header = `Tab ${index + 1}`;
608
+ }
465
609
  }
466
610
  }
467
611
  // Create a single nav link for this tab element
@@ -469,14 +613,30 @@ class TabManager {
469
613
  listItem.className = 'nav-item';
470
614
  const navLink = document.createElement('a');
471
615
  navLink.className = 'nav-link';
472
- navLink.innerHTML = header;
473
616
  navLink.href = '#';
474
617
  navLink.setAttribute('data-tab-id', tabId);
475
618
  navLink.setAttribute('data-raw-tab-id', rawTabId);
476
- navLink.setAttribute('data-group-id', groupId);
619
+ if (groupId) {
620
+ navLink.setAttribute('data-group-id', groupId);
621
+ }
477
622
  navLink.setAttribute('role', 'tab');
623
+ // Create header container with text and pin icon
624
+ const headerContainer = document.createElement('span');
625
+ headerContainer.className = 'cv-tab-header-container';
626
+ const headerText = document.createElement('span');
627
+ headerText.className = 'cv-tab-header-text';
628
+ headerText.innerHTML = header;
629
+ const pinIcon = document.createElement('span');
630
+ pinIcon.className = 'cv-tab-pin-icon';
631
+ pinIcon.innerHTML = getPinIcon(true);
632
+ pinIcon.style.display = 'none'; // Hidden by default
633
+ headerContainer.appendChild(headerText);
634
+ headerContainer.appendChild(pinIcon);
635
+ navLink.appendChild(headerContainer);
478
636
  // Check if any of the split IDs is active
479
- const activeTabId = this.resolveActiveTabForGroup(groupId, {}, cfgGroups, groupEl); // Pass empty tabs for initial state
637
+ const activeTabId = groupId
638
+ ? this.resolveActiveTabForGroup(groupId, {}, cfgGroups, groupEl)
639
+ : (index === 0 ? tabId : null); // For standalone groups, activate first tab
480
640
  const isActive = splitIds.includes(activeTabId || '');
481
641
  if (isActive) {
482
642
  navLink.classList.add('active');
@@ -489,15 +649,14 @@ class TabManager {
489
649
  if (onTabClick) {
490
650
  navLink.addEventListener('click', (e) => {
491
651
  e.preventDefault();
492
- // console.log("Single-click detected");
493
- onTabClick(groupId, tabId, groupEl);
652
+ // For standalone groups (no groupId), use empty string
653
+ onTabClick(groupId || '', tabId, groupEl);
494
654
  });
495
655
  }
496
- // Add double-click handler for sync
497
- if (onTabDoubleClick) {
656
+ // Add double-click handler for sync (only for groups with id)
657
+ if (onTabDoubleClick && groupId) {
498
658
  navLink.addEventListener('dblclick', (e) => {
499
659
  e.preventDefault();
500
- // console.log("Double-click detected");
501
660
  onTabDoubleClick(groupId, tabId, groupEl);
502
661
  });
503
662
  }
@@ -624,7 +783,8 @@ class TabManager {
624
783
  static applyTabLocalOnly(groupEl, activeTabId) {
625
784
  const tabElements = Array.from(groupEl.children).filter((child) => child.tagName.toLowerCase() === TAB_SELECTOR);
626
785
  tabElements.forEach((tabEl) => {
627
- const tabId = tabEl.getAttribute('id');
786
+ // Use id or internal id
787
+ const tabId = tabEl.getAttribute('id') || tabEl.getAttribute('data-cv-internal-id');
628
788
  if (!tabId)
629
789
  return;
630
790
  const splitIds = this.splitTabIds(tabId);
@@ -639,7 +799,8 @@ class TabManager {
639
799
  static groupHasTab(groupEl, tabId) {
640
800
  const tabElements = Array.from(groupEl.children).filter((child) => child.tagName.toLowerCase() === TAB_SELECTOR);
641
801
  return tabElements.some((tabEl) => {
642
- const idAttr = tabEl.getAttribute('id') || '';
802
+ // Use id or internal id
803
+ const idAttr = tabEl.getAttribute('id') || tabEl.getAttribute('data-cv-internal-id') || '';
643
804
  const splitIds = this.splitTabIds(idAttr);
644
805
  return splitIds.includes(tabId);
645
806
  });
@@ -658,6 +819,36 @@ class TabManager {
658
819
  });
659
820
  return syncedGroupEls;
660
821
  }
822
+ /**
823
+ * Update pin icon visibility for all tab groups based on current state.
824
+ * Shows pin icon for tabs that are in the persisted state (i.e., have been double-clicked).
825
+ */
826
+ static updatePinIcons(rootEl, tabs) {
827
+ const tabGroups = rootEl.querySelectorAll(TABGROUP_SELECTOR);
828
+ tabGroups.forEach((groupEl) => {
829
+ const groupId = groupEl.getAttribute('id');
830
+ if (!groupId)
831
+ return;
832
+ const persistedTabId = tabs[groupId];
833
+ // Find all nav links in this group
834
+ const navLinks = groupEl.querySelectorAll('.nav-link');
835
+ navLinks.forEach((link) => {
836
+ const rawTabId = link.getAttribute('data-raw-tab-id');
837
+ const pinIcon = link.querySelector('.cv-tab-pin-icon');
838
+ if (!pinIcon || !rawTabId)
839
+ return;
840
+ // Check if persisted tab ID matches any of the split IDs (for multi-ID tabs)
841
+ const splitIds = this.splitTabIds(rawTabId);
842
+ const shouldShowPin = persistedTabId && splitIds.includes(persistedTabId);
843
+ if (shouldShowPin) {
844
+ pinIcon.style.display = 'inline-block';
845
+ }
846
+ else {
847
+ pinIcon.style.display = 'none';
848
+ }
849
+ });
850
+ });
851
+ }
661
852
  }
662
853
 
663
854
  class AssetsManager {
@@ -847,191 +1038,312 @@ class ToggleManager {
847
1038
  }
848
1039
  }
849
1040
 
1041
+ // src/utils/scroll-manager.ts
1042
+ class ScrollManager {
1043
+ /**
1044
+ * Finds the highest tab group currently in the viewport.
1045
+ * This is intended to be called BEFORE the state changes, to identify which element to scroll to.
1046
+ * @returns The HTMLElement of the highest visible tab group, or null if none are found.
1047
+ */
1048
+ static findHighestVisibleTabGroup() {
1049
+ // console.log('[ScrollManager] Finding highest visible tab group.');
1050
+ // 1. Detect fixed/sticky header and calculate its height for offset.
1051
+ let headerOffset = 0;
1052
+ const headerEl = document.querySelector('header');
1053
+ let isHeaderFixedOrSticky = false;
1054
+ if (headerEl) {
1055
+ const headerStyle = window.getComputedStyle(headerEl);
1056
+ isHeaderFixedOrSticky = ['fixed', 'sticky'].includes(headerStyle.position);
1057
+ if (isHeaderFixedOrSticky) {
1058
+ headerOffset = headerEl.getBoundingClientRect().height;
1059
+ }
1060
+ }
1061
+ const contentTop = headerOffset; // Viewport-relative position where content begins.
1062
+ // 2. Find all tab groups, filtering out any inside the main header.
1063
+ const allTabGroups = Array.from(document.querySelectorAll('cv-tabgroup'));
1064
+ const candidateGroups = allTabGroups.filter(groupEl => {
1065
+ if (isHeaderFixedOrSticky && headerEl && groupEl.closest('header') === headerEl) {
1066
+ return false;
1067
+ }
1068
+ return true;
1069
+ });
1070
+ // 3. Find the highest group that is visible in the content area (below the header).
1071
+ let highestVisibleGroup = null;
1072
+ let highestVisibleGroupTop = Infinity;
1073
+ for (const groupEl of candidateGroups) {
1074
+ const rect = groupEl.getBoundingClientRect();
1075
+ // A group is "visible" if it's not completely above the content area or completely below the viewport.
1076
+ const isVisibleInContentArea = rect.bottom > contentTop && rect.top < window.innerHeight;
1077
+ if (isVisibleInContentArea) {
1078
+ // We want the one with the smallest 'top' value (closest to the top of the viewport).
1079
+ if (rect.top < highestVisibleGroupTop) {
1080
+ highestVisibleGroup = groupEl;
1081
+ highestVisibleGroupTop = rect.top;
1082
+ }
1083
+ }
1084
+ }
1085
+ return highestVisibleGroup;
1086
+ }
1087
+ /**
1088
+ * Scrolls the page to align the given tab group's header (or the group itself)
1089
+ * to the top of the viewport, accounting for a fixed/sticky page header.
1090
+ * This should be called AFTER the content has changed.
1091
+ * @param groupEl The tab group element to scroll to.
1092
+ */
1093
+ static scrollToTabGroup(groupEl) {
1094
+ // console.log('[ScrollManager] Scrolling to tab group:', groupEl);
1095
+ // 1. Detect fixed/sticky header and calculate its height for offset.
1096
+ let headerOffset = 0;
1097
+ const headerEl = document.querySelector('header');
1098
+ if (headerEl) {
1099
+ const headerStyle = window.getComputedStyle(headerEl);
1100
+ if (['fixed', 'sticky'].includes(headerStyle.position)) {
1101
+ headerOffset = headerEl.getBoundingClientRect().height;
1102
+ }
1103
+ }
1104
+ const PADDING_BELOW_HEADER = 20; // Extra space.
1105
+ // 2. Calculate the target position.
1106
+ const targetElementRect = groupEl.getBoundingClientRect();
1107
+ // Calculate the absolute top position of the target element in the document.
1108
+ const scrollTargetY = targetElementRect.top + window.scrollY;
1109
+ // Adjust for the header offset and padding to position it just below the header.
1110
+ const finalScrollY = scrollTargetY - headerOffset - PADDING_BELOW_HEADER;
1111
+ // change to 'auto' if instant scroll is preferred.
1112
+ window.scrollTo({
1113
+ top: finalScrollY,
1114
+ behavior: 'smooth',
1115
+ });
1116
+ }
1117
+ /**
1118
+ * Adjusts the scroll position to keep a specific element in the same visual location
1119
+ * after a content change. This is useful for preventing the page from jumping when
1120
+ * content above the element is added or removed.
1121
+ * @param scrollAnchor An object containing the element to anchor and its initial top position.
1122
+ */
1123
+ static handleScrollAnchor(scrollAnchor) {
1124
+ requestAnimationFrame(() => {
1125
+ const { element, top: initialTop } = scrollAnchor;
1126
+ const newTop = element.getBoundingClientRect().top;
1127
+ const scrollDelta = newTop - initialTop;
1128
+ // Only scroll if there's a noticeable change to avoid jitter
1129
+ if (Math.abs(scrollDelta) > 1) {
1130
+ window.scrollBy({
1131
+ top: scrollDelta,
1132
+ behavior: 'instant'
1133
+ });
1134
+ }
1135
+ });
1136
+ }
1137
+ }
1138
+
850
1139
  /**
851
1140
  * Styles for toggle visibility and animations
852
1141
  */
853
- const TOGGLE_STYLES = `
854
- /* Core toggle visibility transitions */
855
- [data-cv-toggle], [data-customviews-toggle], cv-toggle {
856
- transition: opacity 150ms ease,
857
- transform 150ms ease,
858
- max-height 200ms ease,
859
- margin 150ms ease;
860
- will-change: opacity, transform, max-height, margin;
861
- }
862
-
863
- .cv-visible {
864
- opacity: 1 !important;
865
- transform: translateY(0) !important;
866
- max-height: var(--cv-max-height, 9999px) !important;
867
- }
868
-
869
- .cv-hidden {
870
- opacity: 0 !important;
871
- transform: translateY(-4px) !important;
872
- pointer-events: none !important;
873
- padding-top: 0 !important;
874
- padding-bottom: 0 !important;
875
- border-top-width: 0 !important;
876
- border-bottom-width: 0 !important;
877
- max-height: 0 !important;
878
- margin-top: 0 !important;
879
- margin-bottom: 0 !important;
880
- overflow: hidden !important;
881
- }
1142
+ const TOGGLE_STYLES = `
1143
+ /* Core toggle visibility transitions */
1144
+ [data-cv-toggle], [data-customviews-toggle], cv-toggle {
1145
+ transition: opacity 150ms ease,
1146
+ transform 150ms ease,
1147
+ max-height 200ms ease,
1148
+ margin 150ms ease;
1149
+ will-change: opacity, transform, max-height, margin;
1150
+ }
1151
+
1152
+ .cv-visible {
1153
+ opacity: 1 !important;
1154
+ transform: translateY(0) !important;
1155
+ max-height: var(--cv-max-height, 9999px) !important;
1156
+ }
1157
+
1158
+ .cv-hidden {
1159
+ opacity: 0 !important;
1160
+ transform: translateY(-4px) !important;
1161
+ pointer-events: none !important;
1162
+ padding-top: 0 !important;
1163
+ padding-bottom: 0 !important;
1164
+ border-top-width: 0 !important;
1165
+ border-bottom-width: 0 !important;
1166
+ max-height: 0 !important;
1167
+ margin-top: 0 !important;
1168
+ margin-bottom: 0 !important;
1169
+ overflow: hidden !important;
1170
+ }
882
1171
  `;
883
1172
 
884
1173
  /**
885
1174
  * Styles for tab groups and tab navigation
886
1175
  */
887
- const TAB_STYLES = `
888
- /* Tab navigation styles - Bootstrap-style tabs matching MarkBind */
889
- .cv-tabs-nav {
890
- display: flex;
891
- flex-wrap: wrap;
892
- padding-left: 0;
893
- margin-top: 0.5rem;
894
- margin-bottom: 1rem;
895
- list-style: none;
896
- border-bottom: 1px solid #dee2e6;
897
-
898
- align-items: stretch;
899
- }
900
-
901
- .cv-tabs-nav .nav-item {
902
- margin-bottom: -1px;
903
- list-style: none;
904
- display: flex; /* was inline-block → make flex to stretch height */
905
- align-items: stretch; /* stretch link to full height */
906
- }
907
-
908
- .cv-tabs-nav .nav-link {
909
- display: flex;
910
- align-items: center;
911
- justify-content: center;
912
- padding: 0.5rem 1rem;
913
- color: #495057;
914
- text-decoration: none;
915
- background-color: transparent;
916
- border: 1px solid transparent;
917
- border-top-left-radius: 0.25rem;
918
- border-top-right-radius: 0.25rem;
919
- transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
920
- cursor: pointer;
921
- min-height: 2.5rem;
922
- box-sizing: border-box;
923
- }
924
-
925
- .cv-tabs-nav .nav-link p {
926
- margin: 0; /* remove default margins */
927
- display: inline; /* or inline-block */
928
- }
929
-
930
- .cv-tabs-nav .nav-link:hover,
931
- .cv-tabs-nav .nav-link:focus {
932
- border-color: #e9ecef #e9ecef #dee2e6;
933
- isolation: isolate;
934
- }
935
-
936
- .cv-tabs-nav .nav-link.active {
937
- color: #495057;
938
- background-color: #fff;
939
- border-color: #dee2e6 #dee2e6 #fff;
940
- }
941
-
942
- .cv-tabs-nav .nav-link:focus {
943
- outline: 0;
944
- box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
945
- }
946
-
947
- /* Legacy button-based nav (deprecated, kept for compatibility) */
948
- .cv-tabs-nav-item {
949
- background: none;
950
- border: none;
951
- border-bottom: 2px solid transparent;
952
- padding: 0.5rem 1rem;
953
- cursor: pointer;
954
- font-size: 1rem;
955
- color: #6c757d;
956
- transition: color 150ms ease, border-color 150ms ease;
957
- }
958
-
959
- .cv-tabs-nav-item:hover {
960
- color: #495057;
961
- border-bottom-color: #dee2e6;
962
- }
963
-
964
- .cv-tabs-nav-item.active {
965
- color: #007bff;
966
- border-bottom-color: #007bff;
967
- font-weight: 500;
968
- }
969
-
970
- .cv-tabs-nav-item:focus {
971
- outline: 2px solid #007bff;
972
- outline-offset: 2px;
973
- }
974
-
975
- /* Tab panel base styles */
976
- cv-tab {
977
- display: block;
978
- }
979
-
980
- /* Hide cv-tab-header source element; content is extracted to nav link */
981
- cv-tab-header {
982
- display: none !important;
983
- }
984
-
985
- /* Allow cv-tab-body to flow naturally */
986
- cv-tab-body {
987
- display: block;
988
- }
989
-
990
- /* Override visibility for tab panels - use display instead of collapse animation */
991
- cv-tab.cv-hidden {
992
- display: none !important;
993
- }
994
-
995
- cv-tab.cv-visible {
996
- display: block !important;
997
- }
998
-
999
- cv-tabgroup {
1000
- display: block;
1001
- margin-bottom: 1.5rem;
1002
- }
1003
-
1004
- /* Bottom border line for tab groups */
1005
- .cv-tabgroup-bottom-border {
1006
- border-bottom: 1px solid #dee2e6;
1007
- margin-top: 1rem;
1008
- }
1009
-
1010
- /* Tab content wrapper */
1011
- .cv-tab-content {
1012
- padding: 1rem 0;
1013
- }
1014
-
1015
- /* Viewer-controlled nav visibility: hide nav containers when requested */
1016
- .cv-tabs-nav-hidden {
1017
- display: none !important;
1018
- }
1019
-
1020
- /* Print-friendly: hide tab navigation when printing to reduce clutter */
1021
- @media print {
1022
- .cv-tabs-nav {
1023
- display: none !important;
1024
- }
1025
- }
1176
+ const TAB_STYLES = `
1177
+ /* Tab navigation styles - Bootstrap-style tabs matching MarkBind */
1178
+ .cv-tabs-nav {
1179
+ display: flex;
1180
+ flex-wrap: wrap;
1181
+ padding-left: 0;
1182
+ margin-top: 0.5rem;
1183
+ margin-bottom: 1rem;
1184
+ list-style: none;
1185
+ border-bottom: 1px solid #dee2e6;
1186
+
1187
+ align-items: stretch;
1188
+ }
1189
+
1190
+ .cv-tabs-nav .nav-item {
1191
+ margin-bottom: -1px;
1192
+ list-style: none;
1193
+ display: flex; /* was inline-block → make flex to stretch height */
1194
+ align-items: stretch; /* stretch link to full height */
1195
+ }
1196
+
1197
+ .cv-tabs-nav .nav-link {
1198
+ display: flex;
1199
+ align-items: center;
1200
+ justify-content: center;
1201
+ padding: 0.5rem 1rem;
1202
+ color: #495057;
1203
+ text-decoration: none;
1204
+ background-color: transparent;
1205
+ border: 1px solid transparent;
1206
+ border-top-left-radius: 0.25rem;
1207
+ border-top-right-radius: 0.25rem;
1208
+ transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
1209
+ cursor: pointer;
1210
+ min-height: 2.5rem;
1211
+ box-sizing: border-box;
1212
+ }
1213
+
1214
+ .cv-tabs-nav .nav-link p {
1215
+ margin: 0; /* remove default margins */
1216
+ display: inline; /* or inline-block */
1217
+ }
1218
+
1219
+ /* Tab header container with pin icon */
1220
+ .cv-tab-header-container {
1221
+ display: flex;
1222
+ align-items: center;
1223
+ gap: 0.5rem;
1224
+ }
1225
+
1226
+ .cv-tab-header-text {
1227
+ flex: 1;
1228
+ }
1229
+
1230
+ .cv-tab-pin-icon {
1231
+ display: inline-block;
1232
+ line-height: 0;
1233
+ flex-shrink: 0;
1234
+ }
1235
+
1236
+ .cv-tab-pin-icon svg {
1237
+ vertical-align: middle;
1238
+ width: 14px;
1239
+ height: 14px;
1240
+ }
1241
+
1242
+ .cv-tabs-nav .nav-link:hover,
1243
+ .cv-tabs-nav .nav-link:focus {
1244
+ border-color: #e9ecef #e9ecef #dee2e6;
1245
+ isolation: isolate;
1246
+ }
1247
+
1248
+ .cv-tabs-nav .nav-link.active {
1249
+ color: #495057;
1250
+ background-color: #fff;
1251
+ border-color: #dee2e6 #dee2e6 #fff;
1252
+ }
1253
+
1254
+ .cv-tabs-nav .nav-link:focus {
1255
+ outline: 0;
1256
+ box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
1257
+ }
1258
+
1259
+ /* Legacy button-based nav (deprecated, kept for compatibility) */
1260
+ .cv-tabs-nav-item {
1261
+ background: none;
1262
+ border: none;
1263
+ border-bottom: 2px solid transparent;
1264
+ padding: 0.5rem 1rem;
1265
+ cursor: pointer;
1266
+ font-size: 1rem;
1267
+ color: #6c757d;
1268
+ transition: color 150ms ease, border-color 150ms ease;
1269
+ }
1270
+
1271
+ .cv-tabs-nav-item:hover {
1272
+ color: #495057;
1273
+ border-bottom-color: #dee2e6;
1274
+ }
1275
+
1276
+ .cv-tabs-nav-item.active {
1277
+ color: #007bff;
1278
+ border-bottom-color: #007bff;
1279
+ font-weight: 500;
1280
+ }
1281
+
1282
+ .cv-tabs-nav-item:focus {
1283
+ outline: 2px solid #007bff;
1284
+ outline-offset: 2px;
1285
+ }
1286
+
1287
+ /* Tab panel base styles */
1288
+ cv-tab {
1289
+ display: block;
1290
+ }
1291
+
1292
+ /* Hide cv-tab-header source element; content is extracted to nav link */
1293
+ cv-tab-header {
1294
+ display: none !important;
1295
+ }
1296
+
1297
+ /* Allow cv-tab-body to flow naturally */
1298
+ cv-tab-body {
1299
+ display: block;
1300
+ }
1301
+
1302
+ /* Override visibility for tab panels - use display instead of collapse animation */
1303
+ cv-tab.cv-hidden {
1304
+ display: none !important;
1305
+ }
1306
+
1307
+ cv-tab.cv-visible {
1308
+ display: block !important;
1309
+ }
1310
+
1311
+ cv-tabgroup {
1312
+ display: block;
1313
+ margin-bottom: 1.5rem;
1314
+ }
1315
+
1316
+ /* Bottom border line for tab groups */
1317
+ .cv-tabgroup-bottom-border {
1318
+ border-bottom: 1px solid #dee2e6;
1319
+ margin-top: 1rem;
1320
+ }
1321
+
1322
+ /* Tab content wrapper */
1323
+ .cv-tab-content {
1324
+ padding: 1rem 0;
1325
+ }
1326
+
1327
+ /* Viewer-controlled nav visibility: hide nav containers when requested */
1328
+ .cv-tabs-nav-hidden {
1329
+ display: none !important;
1330
+ }
1331
+
1332
+ /* Print-friendly: hide tab navigation when printing to reduce clutter */
1333
+ @media print {
1334
+ .cv-tabs-nav {
1335
+ display: none !important;
1336
+ }
1337
+ }
1026
1338
  `;
1027
1339
 
1028
1340
  /**
1029
1341
  * Combined core styles for toggles and tabs
1030
1342
  */
1031
- const CORE_STYLES = `
1032
- ${TOGGLE_STYLES}
1033
-
1034
- ${TAB_STYLES}
1343
+ const CORE_STYLES = `
1344
+ ${TOGGLE_STYLES}
1345
+
1346
+ ${TAB_STYLES}
1035
1347
  `;
1036
1348
  /**
1037
1349
  * Add styles for hiding and showing toggles animations and transitions to the document head
@@ -1063,7 +1375,7 @@ class CustomViewsCore {
1063
1375
  this.persistenceManager = new PersistenceManager();
1064
1376
  this.visibilityManager = new VisibilityManager();
1065
1377
  this.showUrlEnabled = opt.showUrl ?? false;
1066
- this.lastAppliedState = this.cloneState(this.config?.defaultState);
1378
+ this.lastAppliedState = this.cloneState(this.getComputedDefaultState());
1067
1379
  }
1068
1380
  getConfig() {
1069
1381
  return this.config;
@@ -1074,6 +1386,36 @@ class CustomViewsCore {
1074
1386
  getTabGroups() {
1075
1387
  return this.config.tabGroups;
1076
1388
  }
1389
+ /**
1390
+ * Generate a computed default state:
1391
+ * - If config.defaultState is defined, use it (even if empty)
1392
+ * - Otherwise, compute a default: enable all toggles and set all tab groups to their first tab
1393
+ */
1394
+ getComputedDefaultState() {
1395
+ const configDefaultState = this.config?.defaultState;
1396
+ // If defaultState is explicitly defined in config, use it as-is
1397
+ if (configDefaultState !== undefined) {
1398
+ return configDefaultState;
1399
+ }
1400
+ // Otherwise, compute a default state: all toggles on, all tabs to first
1401
+ const tabs = {};
1402
+ // Set all tab groups to their first tab
1403
+ if (this.config.tabGroups?.length) {
1404
+ this.config.tabGroups.forEach(group => {
1405
+ if (group.tabs && group.tabs.length > 0) {
1406
+ const firstTab = group.tabs[0];
1407
+ if (firstTab?.id) {
1408
+ tabs[group.id] = firstTab.id;
1409
+ }
1410
+ }
1411
+ });
1412
+ }
1413
+ const computedState = {
1414
+ toggles: [...(this.config.allToggles || [])],
1415
+ tabs
1416
+ };
1417
+ return computedState;
1418
+ }
1077
1419
  /**
1078
1420
  * Get currently active tabs (from URL > persisted (localStorage) > defaults)
1079
1421
  */
@@ -1085,7 +1427,7 @@ class CustomViewsCore {
1085
1427
  if (persistedState?.tabs) {
1086
1428
  return { ...persistedState.tabs };
1087
1429
  }
1088
- return this.config?.defaultState?.tabs ? { ...this.config.defaultState.tabs } : {};
1430
+ return this.getComputedDefaultState().tabs || {};
1089
1431
  }
1090
1432
  /**
1091
1433
  * Set active tab for a group and apply state
@@ -1115,7 +1457,11 @@ class CustomViewsCore {
1115
1457
  this.setActiveTab(groupId, tabId, groupEl);
1116
1458
  },
1117
1459
  // Double click: sync across all tabgroups with same id (with persistence)
1118
- (groupId, tabId, _groupEl) => {
1460
+ (groupId, tabId, groupEl) => {
1461
+ // 1. Record position before state change
1462
+ const navHeader = groupEl.querySelector('.cv-tabs-nav');
1463
+ const anchorElement = navHeader instanceof HTMLElement ? navHeader : groupEl;
1464
+ const initialTop = anchorElement.getBoundingClientRect().top;
1119
1465
  const currentTabs = this.getCurrentActiveTabs();
1120
1466
  currentTabs[groupId] = tabId;
1121
1467
  const currentToggles = this.getCurrentActiveToggles();
@@ -1123,8 +1469,10 @@ class CustomViewsCore {
1123
1469
  toggles: currentToggles,
1124
1470
  tabs: currentTabs
1125
1471
  };
1126
- // applyState() will handle all visual updates via renderState()
1127
- this.applyState(newState);
1472
+ // 2. Apply state with scroll anchor information
1473
+ this.applyState(newState, {
1474
+ scrollAnchor: { element: anchorElement, top: initialTop }
1475
+ });
1128
1476
  });
1129
1477
  // Apply stored nav visibility preference on page load
1130
1478
  const navPref = this.persistenceManager.getPersistedTabNavVisibility();
@@ -1137,7 +1485,7 @@ class CustomViewsCore {
1137
1485
  });
1138
1486
  this.loadAndCallApplyState();
1139
1487
  }
1140
- // Priority: URL state > persisted state > default
1488
+ // Priority: URL state > persisted state > config default > computed default
1141
1489
  // Also filters using the visibility manager to persist selection
1142
1490
  // across back/forward button clicks
1143
1491
  async loadAndCallApplyState() {
@@ -1153,13 +1501,21 @@ class CustomViewsCore {
1153
1501
  this.applyState(persistedState);
1154
1502
  return;
1155
1503
  }
1156
- // 3. Local Config Fallback
1157
- this.renderState(this.config.defaultState);
1504
+ // 3. Computed Default Fallback
1505
+ this.renderState(this.getComputedDefaultState());
1158
1506
  }
1159
1507
  /**
1160
1508
  * Apply a custom state, saves to localStorage and updates the URL
1509
+ * Add 'source' in options to indicate the origin of the state change
1510
+ * (e.g., 'widget' to trigger scroll behavior)
1511
+ * Add scrollAnchor in options to maintain scroll position of a specific element
1161
1512
  */
1162
- applyState(state) {
1513
+ applyState(state, options) {
1514
+ // console.log(`[Core] applyState called with source: ${options?.source}`, state);
1515
+ let groupToScrollTo = null;
1516
+ if (options?.source === 'widget') {
1517
+ groupToScrollTo = ScrollManager.findHighestVisibleTabGroup();
1518
+ }
1163
1519
  const snapshot = this.cloneState(state);
1164
1520
  this.renderState(snapshot);
1165
1521
  this.persistenceManager.persistState(snapshot);
@@ -1169,20 +1525,33 @@ class CustomViewsCore {
1169
1525
  else {
1170
1526
  URLStateManager.clearURL();
1171
1527
  }
1528
+ if (groupToScrollTo) {
1529
+ // Defer scrolling until after the DOM has been updated by renderState
1530
+ queueMicrotask(() => {
1531
+ ScrollManager.scrollToTabGroup(groupToScrollTo);
1532
+ });
1533
+ }
1534
+ // Handle scroll anchoring for double-clicks
1535
+ // scroll to original position after content changes
1536
+ if (options?.scrollAnchor) {
1537
+ ScrollManager.handleScrollAnchor(options.scrollAnchor);
1538
+ }
1172
1539
  }
1173
1540
  /** Render all toggles for the current state */
1174
1541
  renderState(state) {
1175
1542
  this.lastAppliedState = this.cloneState(state);
1176
- const toggles = state.toggles || [];
1543
+ const toggles = state?.toggles || [];
1177
1544
  const finalToggles = this.visibilityManager.filterVisibleToggles(toggles);
1178
1545
  // Apply toggle visibility
1179
1546
  ToggleManager.applyToggles(this.rootEl, finalToggles);
1180
1547
  // Render assets into toggles
1181
1548
  ToggleManager.renderAssets(this.rootEl, finalToggles, this.assetsManager);
1182
1549
  // Apply tab selections
1183
- TabManager.applySelections(this.rootEl, state.tabs || {}, this.config.tabGroups);
1550
+ TabManager.applyTabSelections(this.rootEl, state.tabs || {}, this.config.tabGroups);
1184
1551
  // Update nav active states (without rebuilding)
1185
1552
  TabManager.updateAllNavActiveStates(this.rootEl, state.tabs || {}, this.config.tabGroups);
1553
+ // Update pin icons to show which tabs are persisted
1554
+ TabManager.updatePinIcons(this.rootEl, state.tabs || {});
1186
1555
  // Notify state change listeners (like widgets)
1187
1556
  this.notifyStateChangeListeners();
1188
1557
  }
@@ -1192,7 +1561,7 @@ class CustomViewsCore {
1192
1561
  resetToDefault() {
1193
1562
  this.persistenceManager.clearAll();
1194
1563
  if (this.config) {
1195
- this.renderState(this.config.defaultState);
1564
+ this.renderState(this.getComputedDefaultState());
1196
1565
  }
1197
1566
  else {
1198
1567
  console.warn("No configuration loaded, cannot reset to default state");
@@ -1210,7 +1579,7 @@ class CustomViewsCore {
1210
1579
  return this.lastAppliedState.toggles || [];
1211
1580
  }
1212
1581
  if (this.config) {
1213
- return this.config.defaultState.toggles || [];
1582
+ return this.getComputedDefaultState().toggles || [];
1214
1583
  }
1215
1584
  return [];
1216
1585
  }
@@ -1220,7 +1589,7 @@ class CustomViewsCore {
1220
1589
  clearPersistence() {
1221
1590
  this.persistenceManager.clearAll();
1222
1591
  if (this.config) {
1223
- this.renderState(this.config.defaultState);
1592
+ this.renderState(this.getComputedDefaultState());
1224
1593
  }
1225
1594
  else {
1226
1595
  console.warn("No configuration loaded, cannot reset to default state");
@@ -1299,7 +1668,7 @@ class CustomViewsCore {
1299
1668
  return this.cloneState(this.lastAppliedState);
1300
1669
  }
1301
1670
  if (this.config) {
1302
- return this.cloneState(this.config.defaultState);
1671
+ return this.cloneState(this.getComputedDefaultState());
1303
1672
  }
1304
1673
  return {};
1305
1674
  }
@@ -1459,1216 +1828,1110 @@ class CustomViews {
1459
1828
  * Note: Styles are kept as a TypeScript string for compatibility with the build system.
1460
1829
  * This approach ensures the styles are properly bundled and don't require separate CSS file handling.
1461
1830
  */
1462
- const WIDGET_STYLES = `
1463
- /* Rounded rectangle widget icon styles */
1464
- .cv-widget-icon {
1465
- position: fixed;
1466
- /* Slightly transparent by default so the widget is subtle at the page edge */
1467
- background: rgba(255, 255, 255, 0.92);
1468
- color: rgba(0, 0, 0, 0.9);
1469
- opacity: 0.6;
1470
- display: flex;
1471
- align-items: center;
1472
- justify-content: center;
1473
- font-size: 18px;
1474
- font-weight: bold;
1475
- cursor: pointer;
1476
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
1477
- z-index: 9998;
1478
- transition: all 0.3s ease;
1479
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
1480
- }
1481
-
1482
- .cv-widget-icon:hover {
1483
- /* Become fully opaque on hover to improve readability */
1484
- background: rgba(255, 255, 255, 1);
1485
- color: rgba(0, 0, 0, 1);
1486
- opacity: 1;
1487
- }
1488
-
1489
- /* Top-right: rounded end on left, sticks out leftward on hover */
1490
- .cv-widget-top-right {
1491
- top: 20px;
1492
- right: 0;
1493
- border-radius: 18px 0 0 18px;
1494
- padding-left: 8px;
1495
- justify-content: flex-start;
1496
- }
1497
-
1498
- /* Top-left: rounded end on right, sticks out rightward on hover */
1499
- .cv-widget-top-left {
1500
- top: 20px;
1501
- left: 0;
1502
- border-radius: 0 18px 18px 0;
1503
- padding-right: 8px;
1504
- justify-content: flex-end;
1505
- }
1506
-
1507
- /* Bottom-right: rounded end on left, sticks out leftward on hover */
1508
- .cv-widget-bottom-right {
1509
- bottom: 20px;
1510
- right: 0;
1511
- border-radius: 18px 0 0 18px;
1512
- padding-left: 8px;
1513
- justify-content: flex-start;
1514
- }
1515
-
1516
- /* Bottom-left: rounded end on right, sticks out rightward on hover */
1517
- .cv-widget-bottom-left {
1518
- bottom: 20px;
1519
- left: 0;
1520
- border-radius: 0 18px 18px 0;
1521
- padding-right: 8px;
1522
- justify-content: flex-end;
1523
- }
1524
-
1525
- /* Middle-left: rounded end on right, sticks out rightward on hover */
1526
- .cv-widget-middle-left {
1527
- top: 50%;
1528
- left: 0;
1529
- transform: translateY(-50%);
1530
- border-radius: 0 18px 18px 0;
1531
- padding-right: 8px;
1532
- justify-content: flex-end;
1533
- }
1534
-
1535
- /* Middle-right: rounded end on left, sticks out leftward on hover */
1536
- .cv-widget-middle-right {
1537
- top: 50%;
1538
- right: 0;
1539
- transform: translateY(-50%);
1540
- border-radius: 18px 0 0 18px;
1541
- padding-left: 8px;
1542
- justify-content: flex-start;
1543
- }
1544
-
1545
- .cv-widget-top-right,
1546
- .cv-widget-middle-right,
1547
- .cv-widget-bottom-right,
1548
- .cv-widget-top-left,
1549
- .cv-widget-middle-left,
1550
- .cv-widget-bottom-left {
1551
- height: 36px;
1552
- width: 36px;
1553
- }
1554
-
1555
- .cv-widget-middle-right:hover,
1556
- .cv-widget-top-right:hover,
1557
- .cv-widget-bottom-right:hover,
1558
- .cv-widget-top-left:hover,
1559
- .cv-widget-middle-left:hover,
1560
- .cv-widget-bottom-left:hover {
1561
- width: 55px;
1562
- }
1563
-
1564
- /* Modal content styles */
1565
- .cv-widget-section {
1566
- margin-bottom: 16px;
1567
- }
1568
-
1569
- .cv-widget-section:last-child {
1570
- margin-bottom: 0;
1571
- }
1572
-
1573
- .cv-widget-section label {
1574
- display: block;
1575
- margin-bottom: 4px;
1576
- font-weight: 500;
1577
- color: #555;
1578
- }
1579
-
1580
- .cv-widget-profile-select,
1581
- .cv-widget-state-select {
1582
- width: 100%;
1583
- padding: 8px 12px;
1584
- border: 1px solid #ddd;
1585
- border-radius: 4px;
1586
- background: white;
1587
- font-size: 14px;
1588
- }
1589
-
1590
- .cv-widget-profile-select:focus,
1591
- .cv-widget-state-select:focus {
1592
- outline: none;
1593
- border-color: #007bff;
1594
- box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
1595
- }
1596
-
1597
- .cv-widget-profile-select:disabled,
1598
- .cv-widget-state-select:disabled {
1599
- background: #f8f9fa;
1600
- color: #6c757d;
1601
- cursor: not-allowed;
1602
- }
1603
-
1604
- .cv-widget-current {
1605
- margin: 16px 0;
1606
- padding: 12px;
1607
- background: #f8f9fa;
1608
- border-radius: 4px;
1609
- border-left: 4px solid #007bff;
1610
- }
1611
-
1612
- .cv-widget-current label {
1613
- font-size: 12px;
1614
- text-transform: uppercase;
1615
- letter-spacing: 0.5px;
1616
- color: #666;
1617
- margin-bottom: 4px;
1618
- }
1619
-
1620
- .cv-widget-current-view {
1621
- font-weight: 500;
1622
- color: #333;
1623
- }
1624
-
1625
- .cv-widget-reset {
1626
- width: 100%;
1627
- padding: 8px 16px;
1628
- background: #dc3545;
1629
- color: white;
1630
- border: none;
1631
- border-radius: 4px;
1632
- cursor: pointer;
1633
- font-size: 14px;
1634
- font-weight: 500;
1635
- }
1636
-
1637
- .cv-widget-reset:hover {
1638
- background: #c82333;
1639
- }
1640
-
1641
- .cv-widget-reset:active {
1642
- background: #bd2130;
1643
- }
1644
-
1645
- /* Responsive design for mobile */
1646
- @media (max-width: 768px) {
1647
- .cv-widget-top-right,
1648
- .cv-widget-top-left {
1649
- top: 10px;
1650
- }
1651
-
1652
- .cv-widget-bottom-right,
1653
- .cv-widget-bottom-left {
1654
- bottom: 10px;
1655
- }
1656
-
1657
- /* All widgets stay flush with screen edges */
1658
- .cv-widget-top-right,
1659
- .cv-widget-bottom-right,
1660
- .cv-widget-middle-right {
1661
- right: 0;
1662
- }
1663
-
1664
- .cv-widget-top-left,
1665
- .cv-widget-bottom-left,
1666
- .cv-widget-middle-left {
1667
- left: 0;
1668
- }
1669
-
1670
- /* Slightly smaller on mobile */
1671
- .cv-widget-icon {
1672
- width: 60px;
1673
- height: 32px;
1674
- }
1675
-
1676
- .cv-widget-icon:hover {
1677
- width: 75px;
1678
- }
1679
- }
1680
-
1681
- /* Modal styles */
1682
- .cv-widget-modal-overlay {
1683
- position: fixed;
1684
- top: 0;
1685
- left: 0;
1686
- right: 0;
1687
- bottom: 0;
1688
- background: rgba(0, 0, 0, 0.5);
1689
- display: flex;
1690
- align-items: center;
1691
- justify-content: center;
1692
- z-index: 10002;
1693
- animation: fadeIn 0.2s ease;
1694
- }
1695
-
1696
- @keyframes fadeIn {
1697
- from { opacity: 0; }
1698
- to { opacity: 1; }
1699
- }
1700
-
1701
- .cv-widget-modal {
1702
- background: white;
1703
- border-radius: 0.75rem;
1704
- box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
1705
- max-width: 32rem;
1706
- width: 90vw;
1707
- max-height: 80vh;
1708
- animation: slideIn 0.2s ease;
1709
- display: flex;
1710
- flex-direction: column;
1711
- }
1712
-
1713
- @keyframes slideIn {
1714
- from {
1715
- opacity: 0;
1716
- transform: scale(0.9) translateY(-20px);
1717
- }
1718
- to {
1719
- opacity: 1;
1720
- transform: scale(1) translateY(0);
1721
- }
1722
- }
1723
-
1724
- .cv-modal-header {
1725
- display: flex;
1726
- align-items: center;
1727
- justify-content: space-between;
1728
- padding: 0.5rem 1rem;
1729
- border-bottom: 1px solid rgba(0, 0, 0, 0.1);
1730
- }
1731
-
1732
- .cv-modal-header-content {
1733
- display: flex;
1734
- align-items: center;
1735
- gap: 0.75rem;
1736
- }
1737
-
1738
- .cv-modal-icon {
1739
- position: relative;
1740
- width: 1rem;
1741
- height: 1rem;
1742
- display: flex;
1743
- align-items: center;
1744
- justify-content: center;
1745
- border-radius: 9999px;
1746
- }
1747
-
1748
- .cv-modal-icon-svg {
1749
- width: 100%;
1750
- height: 100%;
1751
- opacity: 1;
1752
- }
1753
-
1754
- .cv-modal-title {
1755
- font-size: 1.125rem;
1756
- font-weight: bold;
1757
- color: rgba(0, 0, 0, 0.9);
1758
- margin: 0;
1759
- }
1760
-
1761
- .cv-modal-close {
1762
- width: 2rem;
1763
- height: 2rem;
1764
- display: flex;
1765
- align-items: center;
1766
- justify-content: center;
1767
- border-radius: 9999px;
1768
- background: transparent;
1769
- border: none;
1770
- color: rgba(0, 0, 0, 0.6);
1771
- cursor: pointer;
1772
- transition: all 0.2s ease;
1773
- }
1774
-
1775
- .cv-modal-close:hover {
1776
- background: rgba(62, 132, 244, 0.1);
1777
- color: #3e84f4;
1778
- }
1779
-
1780
- .cv-modal-close-icon {
1781
- width: 1.25rem;
1782
- height: 1.25rem;
1783
- }
1784
-
1785
- .cv-modal-main {
1786
- padding: 1rem;
1787
- flex: 1;
1788
- display: flex;
1789
- flex-direction: column;
1790
- gap: 1rem;
1791
- overflow-y: auto;
1792
- max-height: calc(80vh - 8rem);
1793
- }
1794
-
1795
- .cv-modal-description {
1796
- font-size: 0.875rem;
1797
- color: rgba(0, 0, 0, 0.8);
1798
- margin: 0;
1799
- line-height: 1.4;
1800
- }
1801
-
1802
- .cv-content-section,
1803
- .cv-tab-groups-section {
1804
- display: flex;
1805
- flex-direction: column;
1806
- gap: 0.75rem;
1807
- }
1808
-
1809
- .cv-section-heading {
1810
- font-size: 1rem;
1811
- font-weight: bold;
1812
- color: rgba(0, 0, 0, 0.9);
1813
- margin: 0;
1814
- }
1815
-
1816
- .cv-widget-modal-actions {
1817
- margin-top: 20px;
1818
- padding-top: 16px;
1819
- border-top: 1px solid #e9ecef;
1820
- }
1821
-
1822
- .cv-widget-restore {
1823
- width: 100%;
1824
- padding: 10px 16px;
1825
- background: #28a745;
1826
- color: white;
1827
- border: none;
1828
- border-radius: 4px;
1829
- cursor: pointer;
1830
- font-size: 14px;
1831
- font-weight: 500;
1832
- }
1833
-
1834
- .cv-widget-restore:hover {
1835
- background: #218838;
1836
- }
1837
-
1838
- .cv-widget-create-state {
1839
- width: 100%;
1840
- padding: 10px 16px;
1841
- background: #007bff;
1842
- color: white;
1843
- border: none;
1844
- border-radius: 4px;
1845
- cursor: pointer;
1846
- font-size: 14px;
1847
- font-weight: 500;
1848
- margin-bottom: 10px;
1849
- }
1850
-
1851
- .cv-widget-create-state:hover {
1852
- background: #0056b3;
1853
- }
1854
-
1855
- .cv-widget-theme-dark .cv-widget-modal {
1856
- background: #101722;
1857
- color: #e2e8f0;
1858
- }
1859
-
1860
- .cv-widget-theme-dark .cv-modal-header {
1861
- border-color: rgba(255, 255, 255, 0.1);
1862
- }
1863
-
1864
- .cv-widget-theme-dark .cv-modal-title {
1865
- color: #e2e8f0;
1866
- }
1867
-
1868
- .cv-widget-theme-dark .cv-modal-close {
1869
- color: rgba(255, 255, 255, 0.6);
1870
- }
1871
-
1872
- .cv-widget-theme-dark .cv-modal-close:hover {
1873
- background: rgba(62, 132, 244, 0.2);
1874
- color: #3e84f4;
1875
- }
1876
-
1877
- .cv-widget-theme-dark .cv-modal-description {
1878
- color: rgba(255, 255, 255, 0.8);
1879
- }
1880
-
1881
- .cv-widget-theme-dark .cv-section-heading {
1882
- color: #e2e8f0;
1883
- }
1884
-
1885
- .cv-widget-theme-dark .cv-toggles-container
1886
- .cv-widget-theme-dark .cv-tabgroups-container {
1887
- border-color: rgba(255, 255, 255, 0.1);
1888
- }
1889
-
1890
- .cv-widget-theme-dark .cv-toggle-card,
1891
- .cv-widget-theme-dark .cv-tabgroup-card {
1892
- background: #101722;
1893
- border-color: rgba(255, 255, 255, 0.1);
1894
- }
1895
-
1896
- .cv-widget-theme-dark .cv-toggle-title,
1897
- .cv-widget-theme-dark .cv-tabgroup-title {
1898
- color: #e2e8f0;
1899
- }
1900
-
1901
- .cv-widget-theme-dark .cv-toggle-description,
1902
- .cv-widget-theme-dark .cv-tabgroup-description {
1903
- color: rgba(255, 255, 255, 0.6);
1904
- }
1905
-
1906
- .cv-widget-theme-dark .cv-toggle-slider {
1907
- background: rgba(255, 255, 255, 0.2);
1908
- }
1909
-
1910
- .cv-widget-theme-dark .cv-tab-group-description {
1911
- color: rgba(255, 255, 255, 0.8);
1912
- }
1913
-
1914
- .cv-widget-theme-dark .cv-tabgroup-select {
1915
- background: #101722;
1916
- border-color: rgba(255, 255, 255, 0.2);
1917
- color: #e2e8f0;
1918
- }
1919
-
1920
- .cv-widget-theme-dark .cv-modal-footer {
1921
- border-color: rgba(255, 255, 255, 0.1);
1922
- background: #101722;
1923
- }
1924
-
1925
- .cv-widget-theme-dark .cv-reset-btn {
1926
- color: #e2e8f0;
1927
- background: rgba(255, 255, 255, 0.1);
1928
- }
1929
-
1930
- .cv-widget-theme-dark .cv-reset-btn:hover {
1931
- background: rgba(255, 255, 255, 0.2);
1932
- }
1933
-
1934
- /* Custom state creator styles */
1935
- .cv-custom-state-modal {
1936
- max-width: 500px;
1937
- }
1938
-
1939
- .cv-custom-state-form .cv-section-header {
1940
- font-size: 16px;
1941
- font-weight: 600;
1942
- color: #333;
1943
- border-bottom: 1px solid #e9ecef;
1944
- padding-bottom: 5px;
1945
- }
1946
-
1947
- .cv-custom-state-form p {
1948
- font-size: 15px;
1949
- line-height: 1.6;
1950
- color: #555;
1951
- margin-bottom: 24px;
1952
- text-align: justify;
1953
- }
1954
-
1955
- .cv-custom-state-section {
1956
- margin-bottom: 16px;
1957
- }
1958
-
1959
- .cv-custom-state-section label {
1960
- display: block;
1961
- margin-bottom: 4px;
1962
- font-weight: 500;
1963
- color: #555;
1964
- }
1965
-
1966
- .cv-custom-state-input {
1967
- width: 100%;
1968
- padding: 8px 12px;
1969
- border: 1px solid #ddd;
1970
- border-radius: 4px;
1971
- background: white;
1972
- font-size: 14px;
1973
- }
1974
-
1975
- .cv-custom-state-input:focus {
1976
- outline: none;
1977
- border-color: #007bff;
1978
- box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
1979
- }
1980
-
1981
- /* Toggles Container */
1982
- .cv-toggles-container {
1983
- display: flex;
1984
- flex-direction: column;
1985
- gap: 0.5rem;
1986
- border-radius: 0.5rem;
1987
- border: 1px solid rgba(0, 0, 0, 0.1);
1988
- overflow: hidden;
1989
- }
1990
-
1991
- .cv-toggle-card,
1992
- .cv-tabgroup-card {
1993
- background: white;
1994
- border-bottom: 1px solid rgba(0, 0, 0, 0.1);
1995
- }
1996
-
1997
- .cv-toggle-card:last-child {
1998
- border-bottom: none;
1999
- }
2000
-
2001
- .cv-toggle-content {
2002
- display: flex;
2003
- align-items: center;
2004
- justify-content: space-between;
2005
- padding: 0.75rem;
2006
- }
2007
-
2008
- .cv-toggle-title {
2009
- font-weight: 500;
2010
- font-size: 0.875rem;
2011
- color: rgba(0, 0, 0, 0.9);
2012
- margin: 0 0 0.125rem 0;
2013
- }
2014
-
2015
- .cv-toggle-description {
2016
- font-size: 0.75rem;
2017
- color: rgba(0, 0, 0, 0.6);
2018
- margin: 0;
2019
- }
2020
-
2021
- .cv-toggle-label{
2022
- position: relative;
2023
- display: inline-block;
2024
- width: 2.75rem;
2025
- height: 1.5rem;
2026
- cursor: pointer;
2027
- }
2028
-
2029
- .cv-toggle-input {
2030
- opacity: 0;
2031
- width: 0;
2032
- height: 0;
2033
- }
2034
-
2035
- .cv-toggle-slider {
2036
- position: absolute;
2037
- top: 0;
2038
- left: 0;
2039
- right: 0;
2040
- bottom: 0;
2041
- background: rgba(0, 0, 0, 0.2);
2042
- border-radius: 9999px;
2043
- transition: background-color 0.2s ease;
2044
- }
2045
-
2046
- .cv-toggle-slider:before {
2047
- position: absolute;
2048
- content: "";
2049
- height: 1rem;
2050
- width: 1rem;
2051
- left: 0.25rem;
2052
- bottom: 0.25rem;
2053
- background: white;
2054
- border-radius: 50%;
2055
- transition: transform 0.2s ease;
2056
- }
2057
-
2058
- .cv-toggle-input:checked + .cv-toggle-slider {
2059
- background: #3e84f4;
2060
- }
2061
-
2062
- .cv-toggle-input:checked + .cv-toggle-slider:before {
2063
- transform: translateX(1.25rem);
2064
- }
2065
-
2066
- /* Dark theme toggle switch styles */
2067
- .cv-widget-theme-dark .cv-toggle-switch {
2068
- background: #4a5568;
2069
- }
2070
-
2071
- .cv-widget-theme-dark .cv-toggle-switch:hover {
2072
- background: #5a6578;
2073
- }
2074
-
2075
- .cv-widget-theme-dark .cv-toggle-switch.cv-toggle-active {
2076
- background: #63b3ed;
2077
- }
2078
-
2079
- .cv-widget-theme-dark .cv-toggle-switch.cv-toggle-active:hover {
2080
- background: #4299e1;
2081
- }
2082
-
2083
- /* Tab Groups Container */
2084
- .cv-tab-groups-list {
2085
- display: flex;
2086
- flex-direction: column;
2087
- gap: 1px;
2088
- border: 1px solid rgba(0, 0, 0, 0.1);
2089
- border-radius: 0.5rem;
2090
- overflow: hidden;
2091
- }
2092
-
2093
- /* Tab Group Card - Header (Navigation Headers toggle) */
2094
- .cv-tabgroup-card.cv-tabgroup-header {
2095
- display: flex;
2096
- align-items: center;
2097
- justify-content: space-between;
2098
- padding: 0.75rem;
2099
- border-bottom: 0px;
2100
- }
2101
-
2102
- .cv-tabgroup-card.cv-tabgroup-header .cv-tabgroup-row {
2103
- display: flex;
2104
- align-items: center;
2105
- justify-content: space-between;
2106
- width: 100%;
2107
- gap: 1rem;
2108
- }
2109
-
2110
- /* Navigation toggle icon container */
2111
- .cv-nav-toggle-container {
2112
- display: flex;
2113
- align-items: center;
2114
- gap: 0.5rem;
2115
- }
2116
-
2117
- .cv-nav-icon {
2118
- width: 2rem;
2119
- height: 2rem;
2120
- color: rgba(0, 0, 0, 0.8);
2121
- display: flex;
2122
- align-items: center;
2123
- justify-content: center;
2124
- flex-shrink: 0;
2125
- transition: color 0.2s ease;
2126
- }
2127
-
2128
- /* Logo box - centered grey box on its own row */
2129
- .cv-tabgroup-logo-box {
2130
- width: 3.5rem;
2131
- height: 3.5rem;
2132
- background: rgba(0, 0, 0, 0.08);
2133
- border-radius: 0.5rem;
2134
- display: flex;
2135
- align-items: center;
2136
- justify-content: center;
2137
- flex-shrink: 0;
2138
- margin-bottom: 0.5rem;
2139
- }
2140
-
2141
- /* Title container for title alignment (without icon) */
2142
- .cv-tabgroup-title-container {
2143
- display: flex;
2144
- align-items: center;
2145
- gap: 0.5rem;
2146
- }
2147
-
2148
- /* Hover state for icon - apply to the entire tabgroup-row */
2149
- .cv-tabgroup-card.cv-tabgroup-header:hover .cv-nav-icon {
2150
- color: #3e84f4;
2151
- }
2152
-
2153
- .cv-widget-theme-dark .cv-nav-icon {
2154
- color: rgba(255, 255, 255, 0.8);
2155
- }
2156
-
2157
- .cv-widget-theme-dark .cv-tabgroup-card.cv-tabgroup-header:hover .cv-nav-icon {
2158
- color: #60a5fa;
2159
- }
2160
-
2161
- /* Tab Group Card - Items */
2162
- .cv-tabgroup-card.cv-tabgroup-item {
2163
- display: flex;
2164
- flex-direction: column;
2165
- gap: 0.5rem;
2166
- padding: 0.75rem;
2167
- background: white;
2168
- border-bottom: 1px solid rgba(0, 0, 0, 0.05);
2169
- }
2170
-
2171
- .cv-tabgroup-card.cv-tabgroup-item:last-child {
2172
- border-bottom: none;
2173
- }
2174
-
2175
- /* Tab Group Info */
2176
- .cv-tabgroup-info {
2177
- flex: 1;
2178
- display: flex;
2179
- flex-direction: column;
2180
- gap: 0.25rem;
2181
- }
2182
-
2183
- .cv-tabgroup-title {
2184
- font-weight: 500;
2185
- font-size: 0.875rem;
2186
- color: rgba(0, 0, 0, 0.9);
2187
- margin: 0 0 0 0;
2188
- }
2189
-
2190
- .cv-tabgroup-description {
2191
- font-size: 0.75rem;
2192
- color: rgba(0, 0, 0, 0.6);
2193
- margin: 0;
2194
- line-height: 1.3;
2195
- }
2196
-
2197
- /* Tab Group Label (for select dropdowns) */
2198
- .cv-tabgroup-label {
2199
- font-size: 0.875rem;
2200
- color: rgba(0, 0, 0, 0.8);
2201
- margin: 0;
2202
- line-height: 1.4;
2203
- font-weight: 500;
2204
- display: block;
2205
- cursor: pointer;
2206
- }
2207
-
2208
- /* Tab Group Select */
2209
- .cv-tabgroup-select {
2210
- width: 100%;
2211
- border-radius: 0.5rem;
2212
- background: white;
2213
- border: 1px solid rgba(0, 0, 0, 0.15);
2214
- color: rgba(0, 0, 0, 0.9);
2215
- padding: 0.5rem 0.75rem;
2216
- font-size: 0.875rem;
2217
- cursor: pointer;
2218
- transition: all 0.15s ease;
2219
- font-family: inherit;
2220
- }
2221
-
2222
- .cv-tabgroup-select:hover {
2223
- border-color: rgba(0, 0, 0, 0.25);
2224
- }
2225
-
2226
- .cv-tabgroup-select:focus {
2227
- outline: none;
2228
- border-color: #3e84f4;
2229
- box-shadow: 0 0 0 2px rgba(62, 132, 244, 0.2);
2230
- }
2231
-
2232
- /* Modern Toggle Switch */
2233
- .cv-toggle-switch {
2234
- position: relative;
2235
- display: inline-flex;
2236
- align-items: center;
2237
- width: 44px;
2238
- height: 24px;
2239
- background: rgba(0, 0, 0, 0.1);
2240
- border-radius: 9999px;
2241
- padding: 2px;
2242
- box-sizing: border-box;
2243
- cursor: pointer;
2244
- transition: background-color 0.2s ease;
2245
- border: none;
2246
- }
2247
-
2248
- .cv-toggle-switch input {
2249
- display: none;
2250
- }
2251
-
2252
- .cv-toggle-switch .cv-switch-bg {
2253
- position: absolute;
2254
- inset: 0;
2255
- border-radius: 9999px;
2256
- background: rgba(0, 0, 0, 0.1);
2257
- transition: background-color 0.2s ease;
2258
- pointer-events: none;
2259
- }
2260
-
2261
- .cv-toggle-switch .cv-switch-knob {
2262
- position: relative;
2263
- width: 20px;
2264
- height: 20px;
2265
- background: white;
2266
- border-radius: 50%;
2267
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
2268
- transition: transform 0.2s ease;
2269
- z-index: 1;
2270
- }
2271
-
2272
- .cv-toggle-switch input:checked + .cv-switch-bg {
2273
- background: #3e84f4;
2274
- }
2275
-
2276
- .cv-toggle-switch input:checked ~ .cv-switch-knob {
2277
- transform: translateX(20px);
2278
- }
2279
-
2280
- /* Dark Theme - Tab Groups */
2281
- .cv-widget-theme-dark .cv-tabgroup-card.cv-tabgroup-header {
2282
- background: #101722;
2283
- border-bottom-color: rgba(255, 255, 255, 0.1);
2284
- }
2285
-
2286
- .cv-widget-theme-dark .cv-tabgroup-card.cv-tabgroup-item {
2287
- background: #101722;
2288
- border-bottom-color: rgba(255, 255, 255, 0.05);
2289
- }
2290
-
2291
- .cv-widget-theme-dark .cv-tabgroup-title {
2292
- color: #e2e8f0;
2293
- }
2294
-
2295
- .cv-widget-theme-dark .cv-tabgroup-description {
2296
- color: rgba(255, 255, 255, 0.6);
2297
- }
2298
-
2299
- .cv-widget-theme-dark .cv-tabgroup-label {
2300
- color: rgba(255, 255, 255, 0.8);
2301
- }
2302
-
2303
- .cv-widget-theme-dark .cv-tab-groups-list {
2304
- border-color: rgba(255, 255, 255, 0.1);
2305
- }
2306
-
2307
- .cv-widget-theme-dark .cv-tabgroup-select {
2308
- background: #101722;
2309
- border-color: rgba(255, 255, 255, 0.15);
2310
- color: #e2e8f0;
2311
- }
2312
-
2313
- .cv-widget-theme-dark .cv-tabgroup-select:hover {
2314
- border-color: rgba(255, 255, 255, 0.25);
2315
- }
2316
-
2317
- .cv-widget-theme-dark .cv-tabgroup-select:focus {
2318
- border-color: #60a5fa;
2319
- box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2);
2320
- }
2321
-
2322
- /* Dark Theme - Toggle Switch */
2323
- .cv-widget-theme-dark .cv-toggle-switch .cv-switch-bg {
2324
- background: rgba(255, 255, 255, 0.1);
2325
- }
2326
-
2327
- .cv-widget-theme-dark .cv-toggle-switch .cv-switch-knob {
2328
- background: #e2e8f0;
2329
- }
2330
-
2331
- .cv-widget-theme-dark .cv-toggle-switch input:checked + .cv-switch-bg {
2332
- background: #63b3ed;
2333
- }
2334
-
2335
- .cv-modal-footer {
2336
- display: flex;
2337
- justify-content: space-between;
2338
- align-items: center;
2339
- padding: 0.75rem;
2340
- border-top: 1px solid rgba(0, 0, 0, 0.1);
2341
- }
2342
-
2343
- .cv-reset-btn,
2344
- .cv-share-btn {
2345
- display: flex;
2346
- align-items: center;
2347
- gap: 0.5rem;
2348
- padding: 0.375rem 0.75rem;
2349
- border-radius: 0.5rem;
2350
- font-weight: 600;
2351
- font-size: 0.875rem;
2352
- cursor: pointer;
2353
- transition: all 0.2s ease;
2354
- border: none;
2355
- }
2356
-
2357
- .cv-reset-btn {
2358
- color: rgba(0, 0, 0, 0.9);
2359
- background: rgba(0, 0, 0, 0.1);
2360
- }
2361
-
2362
- .cv-reset-btn:hover {
2363
- background: rgba(0, 0, 0, 0.2);
2364
- }
2365
-
2366
- .cv-share-btn {
2367
- color: white;
2368
- background: #3e84f4;
2369
- }
2370
-
2371
- .cv-share-btn:hover {
2372
- background: rgba(62, 132, 244, 0.9);
2373
- }
2374
-
2375
- .cv-btn-icon {
2376
- width: 1rem;
2377
- height: 1rem;
2378
- display: flex;
2379
- align-items: center;
2380
- justify-content: center;
2381
- transition: transform 0.2s ease;
2382
- }
2383
-
2384
- /* Dark theme custom state styles */
2385
- /* Welcome modal styles */
2386
- .cv-welcome-modal {
2387
- max-width: 32rem;
2388
- width: 90vw;
2389
- background: white;
2390
- border-radius: 0.75rem;
2391
- box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
2392
- animation: slideIn 0.2s ease;
2393
- display: flex;
2394
- flex-direction: column;
2395
- }
2396
-
2397
- .cv-modal-main {
2398
- padding: 1rem;
2399
- flex: 1;
2400
- display: flex;
2401
- flex-direction: column;
2402
- gap: 1rem;
2403
- overflow-y: auto;
2404
- max-height: calc(80vh - 8rem);
2405
- }
2406
-
2407
- .cv-welcome-message {
2408
- font-size: 0.875rem;
2409
- color: rgba(0, 0, 0, 0.8);
2410
- margin: 0;
2411
- line-height: 1.4;
2412
- text-align: center;
2413
- }
2414
-
2415
- .cv-welcome-message a {
2416
- color: #3e84f4;
2417
- text-align: justify;
2418
- text-decoration: none;
2419
- }
2420
-
2421
- .cv-welcome-message a:hover {
2422
- text-decoration: underline;
2423
- }
2424
-
2425
- .cv-welcome-widget-preview {
2426
- display: flex;
2427
- align-items: center;
2428
- justify-content: center;
2429
- gap: 1rem;
2430
- padding: 1rem;
2431
- background: #f8f9fa;
2432
- border-radius: 0.5rem;
2433
- margin: 1rem 0;
2434
- }
2435
-
2436
- .cv-welcome-widget-icon {
2437
- width: 2rem;
2438
- height: 2rem;
2439
- background: rgba(62, 132, 244, 0.1);
2440
- border-radius: 9999px;
2441
- display: flex;
2442
- align-items: center;
2443
- justify-content: center;
2444
- animation: cv-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
2445
- color: #3e84f4;
2446
- }
2447
-
2448
- .cv-welcome-widget-label {
2449
- font-size: 0.875rem;
2450
- font-weight: 500;
2451
- color: rgba(0, 0, 0, 0.8);
2452
- margin: 0;
2453
- }
2454
-
2455
- .cv-welcome-got-it {
2456
- width: 100%;
2457
- background: #3e84f4;
2458
- color: white;
2459
- font-weight: 600;
2460
- padding: 0.75rem 1rem;
2461
- border-radius: 0.5rem;
2462
- border: none;
2463
- cursor: pointer;
2464
- font-size: 0.875rem;
2465
- transition: background-color 0.2s ease;
2466
- outline: none;
2467
- }
2468
-
2469
- .cv-welcome-got-it:hover {
2470
- background: rgba(62, 132, 244, 0.9);
2471
- }
2472
-
2473
- .cv-welcome-got-it:focus {
2474
- box-shadow: 0 0 0 2px rgba(62, 132, 244, 0.5);
2475
- }
2476
-
2477
- /* Animations */
2478
- @keyframes cv-pulse {
2479
- 0%, 100% {
2480
- opacity: 1;
2481
- }
2482
- 50% {
2483
- opacity: 0.5;
2484
- }
2485
- }
2486
-
2487
- /* Dark theme welcome modal styles */
2488
- .cv-widget-theme-dark .cv-welcome-modal {
2489
- background: #101722;
2490
- }
2491
-
2492
- .cv-widget-theme-dark .cv-welcome-message {
2493
- color: rgba(255, 255, 255, 0.8);
2494
- }
2495
-
2496
- .cv-widget-theme-dark .cv-welcome-message a {
2497
- color: #60a5fa;
2498
- }
2499
-
2500
- .cv-widget-theme-dark .cv-welcome-widget-preview {
2501
- background: rgba(255, 255, 255, 0.1);
2502
- }
2503
-
2504
- .cv-widget-theme-dark .cv-welcome-widget-label {
2505
- color: #e2e8f0;
2506
- }
2507
-
2508
- /* Dark theme logo box */
2509
- .cv-widget-theme-dark .cv-tabgroup-logo-box {
2510
- background: rgba(255, 255, 255, 0.1);
2511
- }
2512
-
2513
- /* Spinning animation for reset button icon */
2514
- @keyframes cv-spin {
2515
- from {
2516
- transform: rotate(0deg);
2517
- }
2518
- to {
2519
- transform: rotate(-360deg);
2520
- }
2521
- }
2522
-
2523
- .cv-spinning {
2524
- animation: cv-spin 0.6s ease-in-out;
2525
- }
2526
-
2527
- /* Hide widget icon in print view */
2528
- @media print {
2529
- .cv-widget-icon {
2530
- display: none !important;
2531
- }
2532
- }
2533
- `;
2534
- /**
2535
- * Inject widget styles into the document head
2536
- */
2537
- function injectWidgetStyles() {
2538
- // Check if styles are already injected
2539
- if (document.querySelector('#cv-widget-styles'))
2540
- return;
2541
- const style = document.createElement('style');
2542
- style.id = 'cv-widget-styles';
2543
- style.textContent = WIDGET_STYLES;
2544
- document.head.appendChild(style);
1831
+ const WIDGET_STYLES = `
1832
+ /* Rounded rectangle widget icon styles */
1833
+ .cv-widget-icon {
1834
+ position: fixed;
1835
+ /* Slightly transparent by default so the widget is subtle at the page edge */
1836
+ background: rgba(255, 255, 255, 0.92);
1837
+ color: rgba(0, 0, 0, 0.9);
1838
+ opacity: 0.6;
1839
+ display: flex;
1840
+ align-items: center;
1841
+ justify-content: center;
1842
+ font-size: 18px;
1843
+ font-weight: bold;
1844
+ cursor: pointer;
1845
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
1846
+ z-index: 9998;
1847
+ transition: all 0.3s ease;
1848
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
2545
1849
  }
2546
1850
 
2547
- /**
2548
- * Icon utilities for CustomViews widget
2549
- * Centralized SVG icons for better maintainability and reusability
2550
- */
2551
- /**
2552
- * Settings gear icon for modal header
2553
- */
2554
- function getGearIcon() {
2555
- return `<svg class="cv-modal-icon-svg" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
2556
- <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"/>
2557
- <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"/>
2558
- </svg>`;
1851
+ .cv-widget-icon:hover {
1852
+ /* Become fully opaque on hover to improve readability */
1853
+ background: rgba(255, 255, 255, 1);
1854
+ color: rgba(0, 0, 0, 1);
1855
+ opacity: 1;
2559
1856
  }
2560
- /**
2561
- * Close/X icon for modal close button
2562
- */
2563
- function getCloseIcon() {
2564
- 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">
2565
- <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>
2566
- </svg>`;
1857
+
1858
+ /* Top-right: rounded end on left, sticks out leftward on hover */
1859
+ .cv-widget-top-right {
1860
+ top: 20px;
1861
+ right: 0;
1862
+ border-radius: 18px 0 0 18px;
1863
+ padding-left: 8px;
1864
+ justify-content: flex-start;
2567
1865
  }
2568
- /**
2569
- * Reset/refresh icon for reset button
2570
- */
2571
- function getResetIcon() {
2572
- return `<svg class="cv-btn-icon" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
2573
- <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"/>
2574
- </svg>`;
1866
+
1867
+ /* Top-left: rounded end on right, sticks out rightward on hover */
1868
+ .cv-widget-top-left {
1869
+ top: 20px;
1870
+ left: 0;
1871
+ border-radius: 0 18px 18px 0;
1872
+ padding-right: 8px;
1873
+ justify-content: flex-end;
2575
1874
  }
2576
- /**
2577
- * Copy icon for sharing URL button
2578
- */
2579
- function getCopyIcon() {
2580
- return `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="18" height="18" viewBox="0 0 18 18" version="1.1" fill="currentColor">
2581
- <g id="surface1">
2582
- <path d="M 11.273438 0 L 2.546875 0 C 1.746094 0 1.089844 0.613281 1.089844
2583
- 1.363281 L 1.089844 10.910156 L 2.546875 10.910156 L 2.546875 1.363281 L 11.273438
2584
- 1.363281 Z M 13.453125 2.726562 L 5.453125 2.726562 C 4.65625 2.726562 4 3.339844 4
2585
- 4.089844 L 4 13.636719 C 4 14.386719 4.65625 15 5.453125 15 L 13.453125 15 C 14.253906
2586
- 15 14.910156 14.386719 14.910156 13.636719 L 14.910156 4.089844 C 14.910156 3.339844
2587
- 14.253906 2.726562 13.453125 2.726562 Z M 13.453125 13.636719 L 5.453125 13.636719 L
2588
- 5.453125 4.089844 L 13.453125 4.089844 Z M 13.453125 13.636719 "></path>
2589
- </g>
2590
- </svg>`;
1875
+
1876
+ /* Bottom-right: rounded end on left, sticks out leftward on hover */
1877
+ .cv-widget-bottom-right {
1878
+ bottom: 20px;
1879
+ right: 0;
1880
+ border-radius: 18px 0 0 18px;
1881
+ padding-left: 8px;
1882
+ justify-content: flex-start;
2591
1883
  }
2592
- function getTickIcon() {
2593
- return `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="2 2 22 22" fill="currentColor">
2594
- <path d="M 19.28125 5.28125 L 9 15.5625 L 4.71875 11.28125 L 3.28125 12.71875 L 8.28125 17.71875
2595
- L 9 18.40625 L 9.71875 17.71875 L 20.71875 6.71875 Z"></path>
2596
- </svg>`;
1884
+
1885
+ /* Bottom-left: rounded end on right, sticks out rightward on hover */
1886
+ .cv-widget-bottom-left {
1887
+ bottom: 20px;
1888
+ left: 0;
1889
+ border-radius: 0 18px 18px 0;
1890
+ padding-right: 8px;
1891
+ justify-content: flex-end;
2597
1892
  }
2598
- function getNavHeadingOnIcon() {
2599
- return `<svg xmlns="http://www.w3.org/2000/svg" width="250" height="181" viewBox="0 0 250 181">
2600
- <rect y="34.5001" width="250" height="146" rx="4" stroke="currentColor" stroke-width="10" fill="none"/>
2601
- <line x1="27" y1="62.0001" x2="77" y2="62.0001" stroke="currentColor" stroke-width="5"/>
2602
- <line x1="27" y1="77.8888" x2="77" y2="77.8888" stroke="currentColor" stroke-width="5"/>
2603
- <line x1="27" y1="97.4454" x2="221" y2="97.4454" stroke="currentColor" stroke-width="5"/>
2604
- <line x1="27" y1="114.555" x2="221" y2="114.555" stroke="currentColor" stroke-width="5"/>
2605
- <line x1="27" y1="132.889" x2="221" y2="132.889" stroke="currentColor" stroke-width="5"/>
2606
- <line x1="27" y1="150" x2="221" y2="150" stroke="currentColor" stroke-width="5"/>
2607
- <line x1="247.5" y1="43.0001" x2="247.5" y2="13.0001" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>
2608
- <path d="M185 12.5001L247 12.5001" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>
2609
- <line x1="204.09" y1="36.6095" x2="181.698" y2="10.0228" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>
2610
- <path d="M125 9.50012L181 9.50012" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>
2611
- <path d="M144.305 35.2579L120.095 6.56679" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>
2612
- <path d="M120 6.50037L64 6.50037" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>
2613
- <path d="M87.1957 36.1024L59 2.50008" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>
2614
- <path d="M59 2.50037L3 2.50037" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>
2615
- <path d="M2.5 38.5001L2.5 3.00012" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>
2616
- </svg>`;
1893
+
1894
+ /* Middle-left: rounded end on right, sticks out rightward on hover */
1895
+ .cv-widget-middle-left {
1896
+ top: 50%;
1897
+ left: 0;
1898
+ transform: translateY(-50%);
1899
+ border-radius: 0 18px 18px 0;
1900
+ padding-right: 8px;
1901
+ justify-content: flex-end;
2617
1902
  }
2618
- function getNavHeadingOffIcon() {
2619
- return `<svg xmlns="http://www.w3.org/2000/svg" width="250" height="181" viewBox="0 0 250 181" fill="currentColor">
2620
- <rect y="34.5001" width="250" height="146" rx="4" stroke="currentColor" stroke-width="10" fill="none"/>
2621
- <line x1="27" y1="62" x2="77" y2="62" stroke="currentColor" stroke-width="5"/>
2622
- <line x1="27" y1="77.8887" x2="77" y2="77.8887" stroke="currentColor" stroke-width="5"/>
2623
- <line x1="27" y1="97.4453" x2="221" y2="97.4453" stroke="currentColor" stroke-width="5"/>
2624
- <line x1="27" y1="114.555" x2="221" y2="114.555" stroke="currentColor" stroke-width="5"/>
2625
- <line x1="27" y1="132.889" x2="221" y2="132.889" stroke="currentColor" stroke-width="5"/>
2626
- <line x1="27" y1="150" x2="221" y2="150" stroke="currentColor" stroke-width="5"/>
2627
- </svg>`;
1903
+
1904
+ /* Middle-right: rounded end on left, sticks out leftward on hover */
1905
+ .cv-widget-middle-right {
1906
+ top: 50%;
1907
+ right: 0;
1908
+ transform: translateY(-50%);
1909
+ border-radius: 18px 0 0 18px;
1910
+ padding-left: 8px;
1911
+ justify-content: flex-start;
2628
1912
  }
2629
- /**
2630
- * Transition Icon for Navigation Headings
2631
- */
2632
- function getNavDashed() {
2633
- return `<svg xmlns="http://www.w3.org/2000/svg" width="250" height="181" viewBox="0 0 250 181">
2634
- <rect y="34.5001" width="250" height="146" rx="4" stroke="currentColor" stroke-width="10" fill="none"/>
2635
- <line x1="27" y1="62.0001" x2="77" y2="62.0001" stroke="currentColor" stroke-width="5"/>
2636
- <line x1="27" y1="77.8888" x2="77" y2="77.8888" stroke="currentColor" stroke-width="5"/>
2637
- <line x1="27" y1="97.4454" x2="221" y2="97.4454" stroke="currentColor" stroke-width="5"/>
2638
- <line x1="27" y1="114.555" x2="221" y2="114.555" stroke="currentColor" stroke-width="5"/>
2639
- <line x1="27" y1="132.889" x2="221" y2="132.889" stroke="currentColor" stroke-width="5"/>
2640
- <line x1="27" y1="150" x2="221" y2="150" stroke="currentColor" stroke-width="5"/>
2641
- <path d="M245 37.0001V39.5001H250V37.0001H247.5H245ZM250 13.0001C250 11.6194 248.881 10.5001 247.5 10.5001C246.119 10.5001 245 11.6194 245 13.0001H247.5H250ZM250 31.0001C250 29.6194 248.881 28.5001 247.5 28.5001C246.119 28.5001 245 29.6194 245 31.0001H247.5H250ZM245 19.0001C245 20.3808 246.119 21.5001 247.5 21.5001C248.881 21.5001 250 20.3808 250 19.0001H247.5H245ZM247.5 37.0001H250V31.0001H247.5H245V37.0001H247.5ZM247.5 19.0001H250V13.0001H247.5H245V19.0001H247.5Z" fill="currentColor"/>
2642
- <line x1="204.09" y1="36.6095" x2="181.698" y2="10.0228" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-dasharray="10 10"/>
2643
- <path d="M125 9.50012L181 9.50012" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-dasharray="10 10"/>
2644
- <path d="M144.305 35.2579L120.095 6.56679" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-dasharray="10 10"/>
2645
- <path d="M120 6.50037L64 6.50037" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-dasharray="10 10"/>
2646
- <path d="M87.1957 36.1024L59 2.50008" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-dasharray="10 10"/>
2647
- <path d="M59 2.50037L3 2.50037" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-dasharray="10 10"/>
2648
- <path d="M2.5 38.5001L2.5 3.00012" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-dasharray="10 10"/>
2649
- <path d="M185 12.5001L247 12.5001" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-dasharray="10 10"/>
2650
- </svg>`;
1913
+
1914
+ .cv-widget-top-right,
1915
+ .cv-widget-middle-right,
1916
+ .cv-widget-bottom-right,
1917
+ .cv-widget-top-left,
1918
+ .cv-widget-middle-left,
1919
+ .cv-widget-bottom-left {
1920
+ height: 36px;
1921
+ width: 36px;
2651
1922
  }
2652
1923
 
2653
- class CustomViewsWidget {
2654
- core;
2655
- container;
2656
- widgetIcon = null;
2657
- options;
2658
- // Modal state
2659
- modal = null;
2660
- constructor(options) {
2661
- this.core = options.core;
2662
- this.container = options.container || document.body;
2663
- // Set defaults
2664
- this.options = {
2665
- core: options.core,
2666
- container: this.container,
2667
- position: options.position || 'middle-left',
2668
- theme: options.theme || 'light',
2669
- showReset: options.showReset ?? true,
2670
- title: options.title || 'Customize View',
2671
- description: options.description || '',
1924
+ .cv-widget-middle-right:hover,
1925
+ .cv-widget-top-right:hover,
1926
+ .cv-widget-bottom-right:hover,
1927
+ .cv-widget-top-left:hover,
1928
+ .cv-widget-middle-left:hover,
1929
+ .cv-widget-bottom-left:hover {
1930
+ width: 55px;
1931
+ }
1932
+
1933
+ /* Modal content styles */
1934
+ .cv-widget-section {
1935
+ margin-bottom: 16px;
1936
+ }
1937
+
1938
+ .cv-widget-section:last-child {
1939
+ margin-bottom: 0;
1940
+ }
1941
+
1942
+ .cv-widget-section label {
1943
+ display: block;
1944
+ margin-bottom: 4px;
1945
+ font-weight: 500;
1946
+ color: #555;
1947
+ }
1948
+
1949
+ .cv-widget-profile-select,
1950
+ .cv-widget-state-select {
1951
+ width: 100%;
1952
+ padding: 8px 12px;
1953
+ border: 1px solid #ddd;
1954
+ border-radius: 4px;
1955
+ background: white;
1956
+ font-size: 14px;
1957
+ }
1958
+
1959
+ .cv-widget-profile-select:focus,
1960
+ .cv-widget-state-select:focus {
1961
+ outline: none;
1962
+ border-color: #007bff;
1963
+ box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
1964
+ }
1965
+
1966
+ .cv-widget-profile-select:disabled,
1967
+ .cv-widget-state-select:disabled {
1968
+ background: #f8f9fa;
1969
+ color: #6c757d;
1970
+ cursor: not-allowed;
1971
+ }
1972
+
1973
+ .cv-widget-current {
1974
+ margin: 16px 0;
1975
+ padding: 12px;
1976
+ background: #f8f9fa;
1977
+ border-radius: 4px;
1978
+ border-left: 4px solid #007bff;
1979
+ }
1980
+
1981
+ .cv-widget-current label {
1982
+ font-size: 12px;
1983
+ text-transform: uppercase;
1984
+ letter-spacing: 0.5px;
1985
+ color: #666;
1986
+ margin-bottom: 4px;
1987
+ }
1988
+
1989
+ .cv-widget-current-view {
1990
+ font-weight: 500;
1991
+ color: #333;
1992
+ }
1993
+
1994
+ .cv-widget-reset {
1995
+ width: 100%;
1996
+ padding: 8px 16px;
1997
+ background: #dc3545;
1998
+ color: white;
1999
+ border: none;
2000
+ border-radius: 4px;
2001
+ cursor: pointer;
2002
+ font-size: 14px;
2003
+ font-weight: 500;
2004
+ }
2005
+
2006
+ .cv-widget-reset:hover {
2007
+ background: #c82333;
2008
+ }
2009
+
2010
+ .cv-widget-reset:active {
2011
+ background: #bd2130;
2012
+ }
2013
+
2014
+ /* Responsive design for mobile */
2015
+ @media (max-width: 768px) {
2016
+ .cv-widget-top-right,
2017
+ .cv-widget-top-left {
2018
+ top: 10px;
2019
+ }
2020
+
2021
+ .cv-widget-bottom-right,
2022
+ .cv-widget-bottom-left {
2023
+ bottom: 10px;
2024
+ }
2025
+
2026
+ /* All widgets stay flush with screen edges */
2027
+ .cv-widget-top-right,
2028
+ .cv-widget-bottom-right,
2029
+ .cv-widget-middle-right {
2030
+ right: 0;
2031
+ }
2032
+
2033
+ .cv-widget-top-left,
2034
+ .cv-widget-bottom-left,
2035
+ .cv-widget-middle-left {
2036
+ left: 0;
2037
+ }
2038
+
2039
+ /* Slightly smaller on mobile */
2040
+ .cv-widget-icon {
2041
+ width: 60px;
2042
+ height: 32px;
2043
+ }
2044
+
2045
+ .cv-widget-icon:hover {
2046
+ width: 75px;
2047
+ }
2048
+ }
2049
+
2050
+ /* Modal styles */
2051
+ .cv-widget-modal-overlay {
2052
+ position: fixed;
2053
+ top: 0;
2054
+ left: 0;
2055
+ right: 0;
2056
+ bottom: 0;
2057
+ background: rgba(0, 0, 0, 0.5);
2058
+ display: flex;
2059
+ align-items: center;
2060
+ justify-content: center;
2061
+ z-index: 10002;
2062
+ animation: fadeIn 0.2s ease;
2063
+ }
2064
+
2065
+ @keyframes fadeIn {
2066
+ from { opacity: 0; }
2067
+ to { opacity: 1; }
2068
+ }
2069
+
2070
+ .cv-widget-modal {
2071
+ background: white;
2072
+ border-radius: 0.75rem;
2073
+ box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
2074
+ max-width: 32rem;
2075
+ width: 90vw;
2076
+ max-height: 80vh;
2077
+ animation: slideIn 0.2s ease;
2078
+ display: flex;
2079
+ flex-direction: column;
2080
+ }
2081
+
2082
+ @keyframes slideIn {
2083
+ from {
2084
+ opacity: 0;
2085
+ transform: scale(0.9) translateY(-20px);
2086
+ }
2087
+ to {
2088
+ opacity: 1;
2089
+ transform: scale(1) translateY(0);
2090
+ }
2091
+ }
2092
+
2093
+ .cv-modal-header {
2094
+ display: flex;
2095
+ align-items: center;
2096
+ justify-content: space-between;
2097
+ padding: 0.5rem 1rem;
2098
+ border-bottom: 1px solid rgba(0, 0, 0, 0.1);
2099
+ }
2100
+
2101
+ .cv-modal-header-content {
2102
+ display: flex;
2103
+ align-items: center;
2104
+ gap: 0.75rem;
2105
+ }
2106
+
2107
+ .cv-modal-icon {
2108
+ position: relative;
2109
+ width: 1rem;
2110
+ height: 1rem;
2111
+ display: flex;
2112
+ align-items: center;
2113
+ justify-content: center;
2114
+ border-radius: 9999px;
2115
+ }
2116
+
2117
+ .cv-modal-icon-svg {
2118
+ width: 100%;
2119
+ height: 100%;
2120
+ opacity: 1;
2121
+ }
2122
+
2123
+ .cv-modal-title {
2124
+ font-size: 1.125rem;
2125
+ font-weight: bold;
2126
+ color: rgba(0, 0, 0, 0.9);
2127
+ margin: 0;
2128
+ }
2129
+
2130
+ .cv-modal-close {
2131
+ width: 2rem;
2132
+ height: 2rem;
2133
+ display: flex;
2134
+ align-items: center;
2135
+ justify-content: center;
2136
+ border-radius: 9999px;
2137
+ background: transparent;
2138
+ border: none;
2139
+ color: rgba(0, 0, 0, 0.6);
2140
+ cursor: pointer;
2141
+ transition: all 0.2s ease;
2142
+ }
2143
+
2144
+ .cv-modal-close:hover {
2145
+ background: rgba(62, 132, 244, 0.1);
2146
+ color: #3e84f4;
2147
+ }
2148
+
2149
+ .cv-modal-close-icon {
2150
+ width: 1.25rem;
2151
+ height: 1.25rem;
2152
+ }
2153
+
2154
+ .cv-modal-main {
2155
+ padding: 1rem;
2156
+ flex: 1;
2157
+ display: flex;
2158
+ flex-direction: column;
2159
+ gap: 1rem;
2160
+ overflow-y: auto;
2161
+ max-height: calc(80vh - 8rem);
2162
+ }
2163
+
2164
+ .cv-modal-description {
2165
+ font-size: 0.875rem;
2166
+ color: rgba(0, 0, 0, 0.8);
2167
+ margin: 0;
2168
+ line-height: 1.4;
2169
+ }
2170
+
2171
+ .cv-content-section,
2172
+ .cv-tab-groups-section {
2173
+ display: flex;
2174
+ flex-direction: column;
2175
+ gap: 0.75rem;
2176
+ }
2177
+
2178
+ .cv-section-heading {
2179
+ font-size: 1rem;
2180
+ font-weight: bold;
2181
+ color: rgba(0, 0, 0, 0.9);
2182
+ margin: 0;
2183
+ }
2184
+
2185
+ .cv-widget-modal-actions {
2186
+ margin-top: 20px;
2187
+ padding-top: 16px;
2188
+ border-top: 1px solid #e9ecef;
2189
+ }
2190
+
2191
+ .cv-widget-restore {
2192
+ width: 100%;
2193
+ padding: 10px 16px;
2194
+ background: #28a745;
2195
+ color: white;
2196
+ border: none;
2197
+ border-radius: 4px;
2198
+ cursor: pointer;
2199
+ font-size: 14px;
2200
+ font-weight: 500;
2201
+ }
2202
+
2203
+ .cv-widget-restore:hover {
2204
+ background: #218838;
2205
+ }
2206
+
2207
+ .cv-widget-create-state {
2208
+ width: 100%;
2209
+ padding: 10px 16px;
2210
+ background: #007bff;
2211
+ color: white;
2212
+ border: none;
2213
+ border-radius: 4px;
2214
+ cursor: pointer;
2215
+ font-size: 14px;
2216
+ font-weight: 500;
2217
+ margin-bottom: 10px;
2218
+ }
2219
+
2220
+ .cv-widget-create-state:hover {
2221
+ background: #0056b3;
2222
+ }
2223
+
2224
+ .cv-widget-theme-dark .cv-widget-modal {
2225
+ background: #101722;
2226
+ color: #e2e8f0;
2227
+ }
2228
+
2229
+ .cv-widget-theme-dark .cv-modal-header {
2230
+ border-color: rgba(255, 255, 255, 0.1);
2231
+ }
2232
+
2233
+ .cv-widget-theme-dark .cv-modal-title {
2234
+ color: #e2e8f0;
2235
+ }
2236
+
2237
+ .cv-widget-theme-dark .cv-modal-close {
2238
+ color: rgba(255, 255, 255, 0.6);
2239
+ }
2240
+
2241
+ .cv-widget-theme-dark .cv-modal-close:hover {
2242
+ background: rgba(62, 132, 244, 0.2);
2243
+ color: #3e84f4;
2244
+ }
2245
+
2246
+ .cv-widget-theme-dark .cv-modal-description {
2247
+ color: rgba(255, 255, 255, 0.8);
2248
+ }
2249
+
2250
+ .cv-widget-theme-dark .cv-section-heading {
2251
+ color: #e2e8f0;
2252
+ }
2253
+
2254
+ .cv-widget-theme-dark .cv-toggles-container
2255
+ .cv-widget-theme-dark .cv-tabgroups-container {
2256
+ border-color: rgba(255, 255, 255, 0.1);
2257
+ }
2258
+
2259
+ .cv-widget-theme-dark .cv-toggle-card,
2260
+ .cv-widget-theme-dark .cv-tabgroup-card {
2261
+ background: #101722;
2262
+ border-color: rgba(255, 255, 255, 0.1);
2263
+ }
2264
+
2265
+ .cv-widget-theme-dark .cv-toggle-title,
2266
+ .cv-widget-theme-dark .cv-tabgroup-title {
2267
+ color: #e2e8f0;
2268
+ }
2269
+
2270
+ .cv-widget-theme-dark .cv-toggle-description,
2271
+ .cv-widget-theme-dark .cv-tabgroup-description {
2272
+ color: rgba(255, 255, 255, 0.6);
2273
+ }
2274
+
2275
+ .cv-widget-theme-dark .cv-toggle-slider {
2276
+ background: rgba(255, 255, 255, 0.2);
2277
+ }
2278
+
2279
+ .cv-widget-theme-dark .cv-tab-group-description {
2280
+ color: rgba(255, 255, 255, 0.8);
2281
+ }
2282
+
2283
+ .cv-widget-theme-dark .cv-tabgroup-select {
2284
+ background: #101722;
2285
+ border-color: rgba(255, 255, 255, 0.2);
2286
+ color: #e2e8f0;
2287
+ }
2288
+
2289
+ .cv-widget-theme-dark .cv-modal-footer {
2290
+ border-color: rgba(255, 255, 255, 0.1);
2291
+ background: #101722;
2292
+ }
2293
+
2294
+ .cv-widget-theme-dark .cv-reset-btn {
2295
+ color: #e2e8f0;
2296
+ background: rgba(255, 255, 255, 0.1);
2297
+ }
2298
+
2299
+ .cv-widget-theme-dark .cv-reset-btn:hover {
2300
+ background: rgba(255, 255, 255, 0.2);
2301
+ }
2302
+
2303
+ /* Custom state creator styles */
2304
+ .cv-custom-state-modal {
2305
+ max-width: 500px;
2306
+ }
2307
+
2308
+ .cv-custom-state-form .cv-section-header {
2309
+ font-size: 16px;
2310
+ font-weight: 600;
2311
+ color: #333;
2312
+ border-bottom: 1px solid #e9ecef;
2313
+ padding-bottom: 5px;
2314
+ }
2315
+
2316
+ .cv-custom-state-form p {
2317
+ font-size: 15px;
2318
+ line-height: 1.6;
2319
+ color: #555;
2320
+ margin-bottom: 24px;
2321
+ text-align: justify;
2322
+ }
2323
+
2324
+ .cv-custom-state-section {
2325
+ margin-bottom: 16px;
2326
+ }
2327
+
2328
+ .cv-custom-state-section label {
2329
+ display: block;
2330
+ margin-bottom: 4px;
2331
+ font-weight: 500;
2332
+ color: #555;
2333
+ }
2334
+
2335
+ .cv-custom-state-input {
2336
+ width: 100%;
2337
+ padding: 8px 12px;
2338
+ border: 1px solid #ddd;
2339
+ border-radius: 4px;
2340
+ background: white;
2341
+ font-size: 14px;
2342
+ }
2343
+
2344
+ .cv-custom-state-input:focus {
2345
+ outline: none;
2346
+ border-color: #007bff;
2347
+ box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
2348
+ }
2349
+
2350
+ /* Toggles Container */
2351
+ .cv-toggles-container {
2352
+ display: flex;
2353
+ flex-direction: column;
2354
+ gap: 0.5rem;
2355
+ border-radius: 0.5rem;
2356
+ border: 1px solid rgba(0, 0, 0, 0.1);
2357
+ overflow: hidden;
2358
+ }
2359
+
2360
+ .cv-toggle-card,
2361
+ .cv-tabgroup-card {
2362
+ background: white;
2363
+ border-bottom: 1px solid rgba(0, 0, 0, 0.1);
2364
+ }
2365
+
2366
+ .cv-toggle-card:last-child {
2367
+ border-bottom: none;
2368
+ }
2369
+
2370
+ .cv-toggle-content {
2371
+ display: flex;
2372
+ align-items: center;
2373
+ justify-content: space-between;
2374
+ padding: 0.75rem;
2375
+ }
2376
+
2377
+ .cv-toggle-title {
2378
+ font-weight: 500;
2379
+ font-size: 0.875rem;
2380
+ color: rgba(0, 0, 0, 0.9);
2381
+ margin: 0 0 0.125rem 0;
2382
+ }
2383
+
2384
+ .cv-toggle-description {
2385
+ font-size: 0.75rem;
2386
+ color: rgba(0, 0, 0, 0.6);
2387
+ margin: 0;
2388
+ }
2389
+
2390
+ .cv-toggle-label{
2391
+ position: relative;
2392
+ display: inline-block;
2393
+ width: 2.75rem;
2394
+ height: 1.5rem;
2395
+ cursor: pointer;
2396
+ }
2397
+
2398
+ .cv-toggle-input {
2399
+ opacity: 0;
2400
+ width: 0;
2401
+ height: 0;
2402
+ }
2403
+
2404
+ .cv-toggle-slider {
2405
+ position: absolute;
2406
+ top: 0;
2407
+ left: 0;
2408
+ right: 0;
2409
+ bottom: 0;
2410
+ background: rgba(0, 0, 0, 0.2);
2411
+ border-radius: 9999px;
2412
+ transition: background-color 0.2s ease;
2413
+ }
2414
+
2415
+ .cv-toggle-slider:before {
2416
+ position: absolute;
2417
+ content: "";
2418
+ height: 1rem;
2419
+ width: 1rem;
2420
+ left: 0.25rem;
2421
+ bottom: 0.25rem;
2422
+ background: white;
2423
+ border-radius: 50%;
2424
+ transition: transform 0.2s ease;
2425
+ }
2426
+
2427
+ .cv-toggle-input:checked + .cv-toggle-slider {
2428
+ background: #3e84f4;
2429
+ }
2430
+
2431
+ .cv-toggle-input:checked + .cv-toggle-slider:before {
2432
+ transform: translateX(1.25rem);
2433
+ }
2434
+
2435
+ /* Dark theme toggle switch styles */
2436
+ .cv-widget-theme-dark .cv-toggle-switch {
2437
+ background: #4a5568;
2438
+ }
2439
+
2440
+ .cv-widget-theme-dark .cv-toggle-switch:hover {
2441
+ background: #5a6578;
2442
+ }
2443
+
2444
+ .cv-widget-theme-dark .cv-toggle-switch.cv-toggle-active {
2445
+ background: #63b3ed;
2446
+ }
2447
+
2448
+ .cv-widget-theme-dark .cv-toggle-switch.cv-toggle-active:hover {
2449
+ background: #4299e1;
2450
+ }
2451
+
2452
+ /* Tab Groups Container */
2453
+ .cv-tab-groups-list {
2454
+ display: flex;
2455
+ flex-direction: column;
2456
+ gap: 1px;
2457
+ border: 1px solid rgba(0, 0, 0, 0.1);
2458
+ border-radius: 0.5rem;
2459
+ overflow: hidden;
2460
+ }
2461
+
2462
+ /* Tab Group Card - Header (Navigation Headers toggle) */
2463
+ .cv-tabgroup-card.cv-tabgroup-header {
2464
+ display: flex;
2465
+ align-items: center;
2466
+ justify-content: space-between;
2467
+ padding: 0.75rem;
2468
+ border-bottom: 0px;
2469
+ }
2470
+
2471
+ .cv-tabgroup-card.cv-tabgroup-header .cv-tabgroup-row {
2472
+ display: flex;
2473
+ align-items: center;
2474
+ justify-content: space-between;
2475
+ width: 100%;
2476
+ gap: 1rem;
2477
+ }
2478
+
2479
+ /* Navigation toggle icon container */
2480
+ .cv-nav-toggle-container {
2481
+ display: flex;
2482
+ align-items: center;
2483
+ gap: 0.5rem;
2484
+ }
2485
+
2486
+ .cv-nav-icon {
2487
+ width: 2rem;
2488
+ height: 2rem;
2489
+ color: rgba(0, 0, 0, 0.8);
2490
+ display: flex;
2491
+ align-items: center;
2492
+ justify-content: center;
2493
+ flex-shrink: 0;
2494
+ transition: color 0.2s ease;
2495
+ }
2496
+
2497
+ /* Logo box - centered grey box on its own row */
2498
+ .cv-tabgroup-logo-box {
2499
+ width: 3.5rem;
2500
+ height: 3.5rem;
2501
+ background: rgba(0, 0, 0, 0.08);
2502
+ border-radius: 0.5rem;
2503
+ display: flex;
2504
+ align-items: center;
2505
+ justify-content: center;
2506
+ flex-shrink: 0;
2507
+ margin-bottom: 0.5rem;
2508
+ }
2509
+
2510
+ /* Title container for title alignment (without icon) */
2511
+ .cv-tabgroup-title-container {
2512
+ display: flex;
2513
+ align-items: center;
2514
+ gap: 0.5rem;
2515
+ }
2516
+
2517
+ /* Hover state for icon - apply to the entire tabgroup-row */
2518
+ .cv-tabgroup-card.cv-tabgroup-header:hover .cv-nav-icon {
2519
+ color: #3e84f4;
2520
+ }
2521
+
2522
+ .cv-widget-theme-dark .cv-nav-icon {
2523
+ color: rgba(255, 255, 255, 0.8);
2524
+ }
2525
+
2526
+ .cv-widget-theme-dark .cv-tabgroup-card.cv-tabgroup-header:hover .cv-nav-icon {
2527
+ color: #60a5fa;
2528
+ }
2529
+
2530
+ /* Tab Group Card - Items */
2531
+ .cv-tabgroup-card.cv-tabgroup-item {
2532
+ display: flex;
2533
+ flex-direction: column;
2534
+ gap: 0.5rem;
2535
+ padding: 0.75rem;
2536
+ background: white;
2537
+ border-bottom: 1px solid rgba(0, 0, 0, 0.05);
2538
+ }
2539
+
2540
+ .cv-tabgroup-card.cv-tabgroup-item:last-child {
2541
+ border-bottom: none;
2542
+ }
2543
+
2544
+ /* Tab Group Info */
2545
+ .cv-tabgroup-info {
2546
+ flex: 1;
2547
+ display: flex;
2548
+ flex-direction: column;
2549
+ gap: 0.25rem;
2550
+ }
2551
+
2552
+ .cv-tabgroup-title {
2553
+ font-weight: 500;
2554
+ font-size: 0.875rem;
2555
+ color: rgba(0, 0, 0, 0.9);
2556
+ margin: 0 0 0 0;
2557
+ }
2558
+
2559
+ .cv-tabgroup-description {
2560
+ font-size: 0.75rem;
2561
+ color: rgba(0, 0, 0, 0.6);
2562
+ margin: 0;
2563
+ line-height: 1.3;
2564
+ }
2565
+
2566
+ /* Tab Group Label (for select dropdowns) */
2567
+ .cv-tabgroup-label {
2568
+ font-size: 0.875rem;
2569
+ color: rgba(0, 0, 0, 0.8);
2570
+ margin: 0;
2571
+ line-height: 1.4;
2572
+ font-weight: 500;
2573
+ display: block;
2574
+ cursor: pointer;
2575
+ }
2576
+
2577
+ /* Tab Group Select */
2578
+ .cv-tabgroup-select {
2579
+ width: 100%;
2580
+ border-radius: 0.5rem;
2581
+ background: white;
2582
+ border: 1px solid rgba(0, 0, 0, 0.15);
2583
+ color: rgba(0, 0, 0, 0.9);
2584
+ padding: 0.5rem 0.75rem;
2585
+ font-size: 0.875rem;
2586
+ cursor: pointer;
2587
+ transition: all 0.15s ease;
2588
+ font-family: inherit;
2589
+ }
2590
+
2591
+ .cv-tabgroup-select:hover {
2592
+ border-color: rgba(0, 0, 0, 0.25);
2593
+ }
2594
+
2595
+ .cv-tabgroup-select:focus {
2596
+ outline: none;
2597
+ border-color: #3e84f4;
2598
+ box-shadow: 0 0 0 2px rgba(62, 132, 244, 0.2);
2599
+ }
2600
+
2601
+ /* Modern Toggle Switch */
2602
+ .cv-toggle-switch {
2603
+ position: relative;
2604
+ display: inline-flex;
2605
+ align-items: center;
2606
+ width: 44px;
2607
+ height: 24px;
2608
+ background: rgba(0, 0, 0, 0.1);
2609
+ border-radius: 9999px;
2610
+ padding: 2px;
2611
+ box-sizing: border-box;
2612
+ cursor: pointer;
2613
+ transition: background-color 0.2s ease;
2614
+ border: none;
2615
+ }
2616
+
2617
+ .cv-toggle-switch input {
2618
+ display: none;
2619
+ }
2620
+
2621
+ .cv-toggle-switch .cv-switch-bg {
2622
+ position: absolute;
2623
+ inset: 0;
2624
+ border-radius: 9999px;
2625
+ background: rgba(0, 0, 0, 0.1);
2626
+ transition: background-color 0.2s ease;
2627
+ pointer-events: none;
2628
+ }
2629
+
2630
+ .cv-toggle-switch .cv-switch-knob {
2631
+ position: relative;
2632
+ width: 20px;
2633
+ height: 20px;
2634
+ background: white;
2635
+ border-radius: 50%;
2636
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
2637
+ transition: transform 0.2s ease;
2638
+ z-index: 1;
2639
+ }
2640
+
2641
+ .cv-toggle-switch input:checked + .cv-switch-bg {
2642
+ background: #3e84f4;
2643
+ }
2644
+
2645
+ .cv-toggle-switch input:checked ~ .cv-switch-knob {
2646
+ transform: translateX(20px);
2647
+ }
2648
+
2649
+ /* Dark Theme - Tab Groups */
2650
+ .cv-widget-theme-dark .cv-tabgroup-card.cv-tabgroup-header {
2651
+ background: #101722;
2652
+ border-bottom-color: rgba(255, 255, 255, 0.1);
2653
+ }
2654
+
2655
+ .cv-widget-theme-dark .cv-tabgroup-card.cv-tabgroup-item {
2656
+ background: #101722;
2657
+ border-bottom-color: rgba(255, 255, 255, 0.05);
2658
+ }
2659
+
2660
+ .cv-widget-theme-dark .cv-tabgroup-title {
2661
+ color: #e2e8f0;
2662
+ }
2663
+
2664
+ .cv-widget-theme-dark .cv-tabgroup-description {
2665
+ color: rgba(255, 255, 255, 0.6);
2666
+ }
2667
+
2668
+ .cv-widget-theme-dark .cv-tabgroup-label {
2669
+ color: rgba(255, 255, 255, 0.8);
2670
+ }
2671
+
2672
+ .cv-widget-theme-dark .cv-tab-groups-list {
2673
+ border-color: rgba(255, 255, 255, 0.1);
2674
+ }
2675
+
2676
+ .cv-widget-theme-dark .cv-tabgroup-select {
2677
+ background: #101722;
2678
+ border-color: rgba(255, 255, 255, 0.15);
2679
+ color: #e2e8f0;
2680
+ }
2681
+
2682
+ .cv-widget-theme-dark .cv-tabgroup-select:hover {
2683
+ border-color: rgba(255, 255, 255, 0.25);
2684
+ }
2685
+
2686
+ .cv-widget-theme-dark .cv-tabgroup-select:focus {
2687
+ border-color: #60a5fa;
2688
+ box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2);
2689
+ }
2690
+
2691
+ /* Dark Theme - Toggle Switch */
2692
+ .cv-widget-theme-dark .cv-toggle-switch .cv-switch-bg {
2693
+ background: rgba(255, 255, 255, 0.1);
2694
+ }
2695
+
2696
+ .cv-widget-theme-dark .cv-toggle-switch .cv-switch-knob {
2697
+ background: #e2e8f0;
2698
+ }
2699
+
2700
+ .cv-widget-theme-dark .cv-toggle-switch input:checked + .cv-switch-bg {
2701
+ background: #63b3ed;
2702
+ }
2703
+
2704
+ .cv-modal-footer {
2705
+ display: flex;
2706
+ justify-content: space-between;
2707
+ align-items: center;
2708
+ padding: 0.75rem;
2709
+ border-top: 1px solid rgba(0, 0, 0, 0.1);
2710
+ }
2711
+
2712
+ .cv-reset-btn,
2713
+ .cv-share-btn {
2714
+ display: flex;
2715
+ align-items: center;
2716
+ gap: 0.5rem;
2717
+ padding: 0.375rem 0.75rem;
2718
+ border-radius: 0.5rem;
2719
+ font-weight: 600;
2720
+ font-size: 0.875rem;
2721
+ cursor: pointer;
2722
+ transition: all 0.2s ease;
2723
+ border: none;
2724
+ }
2725
+
2726
+ .cv-reset-btn {
2727
+ color: rgba(0, 0, 0, 0.9);
2728
+ background: rgba(0, 0, 0, 0.1);
2729
+ }
2730
+
2731
+ .cv-reset-btn:hover {
2732
+ background: rgba(0, 0, 0, 0.2);
2733
+ }
2734
+
2735
+ .cv-share-btn {
2736
+ color: white;
2737
+ background: #3e84f4;
2738
+ }
2739
+
2740
+ .cv-share-btn:hover {
2741
+ background: rgba(62, 132, 244, 0.9);
2742
+ }
2743
+
2744
+ .cv-btn-icon {
2745
+ width: 1rem;
2746
+ height: 1rem;
2747
+ display: flex;
2748
+ align-items: center;
2749
+ justify-content: center;
2750
+ transition: transform 0.2s ease;
2751
+ }
2752
+
2753
+ /* Dark theme custom state styles */
2754
+ /* Welcome modal styles */
2755
+ .cv-welcome-modal {
2756
+ max-width: 32rem;
2757
+ width: 90vw;
2758
+ background: white;
2759
+ border-radius: 0.75rem;
2760
+ box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
2761
+ animation: slideIn 0.2s ease;
2762
+ display: flex;
2763
+ flex-direction: column;
2764
+ }
2765
+
2766
+ .cv-modal-main {
2767
+ padding: 1rem;
2768
+ flex: 1;
2769
+ display: flex;
2770
+ flex-direction: column;
2771
+ gap: 1rem;
2772
+ overflow-y: auto;
2773
+ max-height: calc(80vh - 8rem);
2774
+ }
2775
+
2776
+ .cv-welcome-message {
2777
+ font-size: 0.875rem;
2778
+ color: rgba(0, 0, 0, 0.8);
2779
+ margin: 0;
2780
+ line-height: 1.4;
2781
+ text-align: center;
2782
+ }
2783
+
2784
+ .cv-welcome-message a {
2785
+ color: #3e84f4;
2786
+ text-align: justify;
2787
+ text-decoration: none;
2788
+ }
2789
+
2790
+ .cv-welcome-message a:hover {
2791
+ text-decoration: underline;
2792
+ }
2793
+
2794
+ .cv-welcome-widget-preview {
2795
+ display: flex;
2796
+ align-items: center;
2797
+ justify-content: center;
2798
+ gap: 1rem;
2799
+ padding: 1rem;
2800
+ background: #f8f9fa;
2801
+ border-radius: 0.5rem;
2802
+ margin: 1rem 0;
2803
+ }
2804
+
2805
+ .cv-welcome-widget-icon {
2806
+ width: 2rem;
2807
+ height: 2rem;
2808
+ background: rgba(62, 132, 244, 0.1);
2809
+ border-radius: 9999px;
2810
+ display: flex;
2811
+ align-items: center;
2812
+ justify-content: center;
2813
+ animation: cv-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
2814
+ color: #3e84f4;
2815
+ }
2816
+
2817
+ .cv-welcome-widget-label {
2818
+ font-size: 0.875rem;
2819
+ font-weight: 500;
2820
+ color: rgba(0, 0, 0, 0.8);
2821
+ margin: 0;
2822
+ }
2823
+
2824
+ .cv-welcome-got-it {
2825
+ width: 100%;
2826
+ background: #3e84f4;
2827
+ color: white;
2828
+ font-weight: 600;
2829
+ padding: 0.75rem 1rem;
2830
+ border-radius: 0.5rem;
2831
+ border: none;
2832
+ cursor: pointer;
2833
+ font-size: 0.875rem;
2834
+ transition: background-color 0.2s ease;
2835
+ outline: none;
2836
+ }
2837
+
2838
+ .cv-welcome-got-it:hover {
2839
+ background: rgba(62, 132, 244, 0.9);
2840
+ }
2841
+
2842
+ .cv-welcome-got-it:focus {
2843
+ box-shadow: 0 0 0 2px rgba(62, 132, 244, 0.5);
2844
+ }
2845
+
2846
+ /* Animations */
2847
+ @keyframes cv-pulse {
2848
+ 0%, 100% {
2849
+ opacity: 1;
2850
+ }
2851
+ 50% {
2852
+ opacity: 0.5;
2853
+ }
2854
+ }
2855
+
2856
+ /* Dark theme welcome modal styles */
2857
+ .cv-widget-theme-dark .cv-welcome-modal {
2858
+ background: #101722;
2859
+ }
2860
+
2861
+ .cv-widget-theme-dark .cv-welcome-message {
2862
+ color: rgba(255, 255, 255, 0.8);
2863
+ }
2864
+
2865
+ .cv-widget-theme-dark .cv-welcome-message a {
2866
+ color: #60a5fa;
2867
+ }
2868
+
2869
+ .cv-widget-theme-dark .cv-welcome-widget-preview {
2870
+ background: rgba(255, 255, 255, 0.1);
2871
+ }
2872
+
2873
+ .cv-widget-theme-dark .cv-welcome-widget-label {
2874
+ color: #e2e8f0;
2875
+ }
2876
+
2877
+ /* Dark theme logo box */
2878
+ .cv-widget-theme-dark .cv-tabgroup-logo-box {
2879
+ background: rgba(255, 255, 255, 0.1);
2880
+ }
2881
+
2882
+ /* Spinning animation for reset button icon */
2883
+ @keyframes cv-spin {
2884
+ from {
2885
+ transform: rotate(0deg);
2886
+ }
2887
+ to {
2888
+ transform: rotate(-360deg);
2889
+ }
2890
+ }
2891
+
2892
+ .cv-spinning {
2893
+ animation: cv-spin 0.6s ease-in-out;
2894
+ }
2895
+
2896
+ /* Hide widget icon in print view */
2897
+ @media print {
2898
+ .cv-widget-icon {
2899
+ display: none !important;
2900
+ }
2901
+ }
2902
+ `;
2903
+ /**
2904
+ * Inject widget styles into the document head
2905
+ */
2906
+ function injectWidgetStyles() {
2907
+ // Check if styles are already injected
2908
+ if (document.querySelector('#cv-widget-styles'))
2909
+ return;
2910
+ const style = document.createElement('style');
2911
+ style.id = 'cv-widget-styles';
2912
+ style.textContent = WIDGET_STYLES;
2913
+ document.head.appendChild(style);
2914
+ }
2915
+
2916
+ class CustomViewsWidget {
2917
+ core;
2918
+ container;
2919
+ widgetIcon = null;
2920
+ options;
2921
+ // Modal state
2922
+ modal = null;
2923
+ constructor(options) {
2924
+ this.core = options.core;
2925
+ this.container = options.container || document.body;
2926
+ // Set defaults
2927
+ this.options = {
2928
+ core: options.core,
2929
+ container: this.container,
2930
+ position: options.position || 'middle-left',
2931
+ theme: options.theme || 'light',
2932
+ showReset: options.showReset ?? true,
2933
+ title: options.title || 'Customize View',
2934
+ description: options.description || '',
2672
2935
  showWelcome: options.showWelcome ?? false,
2673
2936
  welcomeTitle: options.welcomeTitle || 'Site Customization',
2674
2937
  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>.',
@@ -2750,18 +3013,18 @@ class CustomViewsWidget {
2750
3013
  this.modal = document.createElement('div');
2751
3014
  this.modal.className = 'cv-widget-modal-overlay';
2752
3015
  this.applyThemeToModal();
2753
- const toggleControlsHtml = toggles.map(toggle => `
2754
- <div class="cv-toggle-card">
2755
- <div class="cv-toggle-content">
2756
- <div>
2757
- <p class="cv-toggle-title">${this.formatToggleName(toggle)}</p>
2758
- </div>
2759
- <label class="cv-toggle-label">
2760
- <input class="cv-toggle-input" type="checkbox" data-toggle="${toggle}"/>
2761
- <span class="cv-toggle-slider"></span>
2762
- </label>
2763
- </div>
2764
- </div>
3016
+ const toggleControlsHtml = toggles.map(toggle => `
3017
+ <div class="cv-toggle-card">
3018
+ <div class="cv-toggle-content">
3019
+ <div>
3020
+ <p class="cv-toggle-title">${this.formatToggleName(toggle)}</p>
3021
+ </div>
3022
+ <label class="cv-toggle-label">
3023
+ <input class="cv-toggle-input" type="checkbox" data-toggle="${toggle}"/>
3024
+ <span class="cv-toggle-slider"></span>
3025
+ </label>
3026
+ </div>
3027
+ </div>
2765
3028
  `).join('');
2766
3029
  // Todo: Re-add description if needed (Line 168, add label field to toggles if needed change structure)
2767
3030
  // <p class="cv-toggle-description">Show or hide the ${this.formatToggleName(toggle).toLowerCase()} area </p>
@@ -2771,87 +3034,87 @@ class CustomViewsWidget {
2771
3034
  if (this.options.showTabGroups && tabGroups && tabGroups.length > 0) {
2772
3035
  // Determine initial nav visibility state
2773
3036
  const initialNavsVisible = TabManager.areNavsVisible(document.body);
2774
- tabGroupControlsHTML = `
2775
- <div class="cv-tabgroup-card cv-tabgroup-header">
2776
- <div class="cv-tabgroup-row">
2777
- <div class="cv-tabgroup-logo-box" id="cv-nav-icon-box">
2778
- <div class="cv-nav-icon" id="cv-nav-icon">${initialNavsVisible ? getNavHeadingOnIcon() : getNavHeadingOffIcon()}</div>
2779
- </div>
2780
- <div class="cv-tabgroup-info">
2781
- <div class="cv-tabgroup-title-container">
2782
- <p class="cv-tabgroup-title">Navigation Headers</p>
2783
- </div>
2784
- <p class="cv-tabgroup-description">Show or hide navigation headers</p>
2785
- </div>
2786
- <label class="cv-toggle-switch cv-nav-toggle">
2787
- <input class="cv-nav-pref-input" type="checkbox" ${initialNavsVisible ? 'checked' : ''} aria-label="Show or hide navigation headers" />
2788
- <span class="cv-switch-bg"></span>
2789
- <span class="cv-switch-knob"></span>
2790
- </label>
2791
- </div>
2792
- </div>
2793
- <div class="cv-tab-groups-list">
2794
- ${tabGroups.map(group => `
2795
- <div class="cv-tabgroup-card cv-tabgroup-item">
2796
- <label class="cv-tabgroup-label" for="tab-group-${group.id}">
2797
- ${group.label || group.id}
2798
- </label>
2799
- <select id="tab-group-${group.id}" class="cv-tabgroup-select" data-group-id="${group.id}">
2800
- ${group.tabs.map(tab => `<option value="${tab.id}">${tab.label || tab.id}</option>`).join('')}
2801
- </select>
2802
- </div>
2803
- `).join('')}
2804
- </div>
3037
+ tabGroupControlsHTML = `
3038
+ <div class="cv-tabgroup-card cv-tabgroup-header">
3039
+ <div class="cv-tabgroup-row">
3040
+ <div class="cv-tabgroup-logo-box" id="cv-nav-icon-box">
3041
+ <div class="cv-nav-icon" id="cv-nav-icon">${initialNavsVisible ? getNavHeadingOnIcon() : getNavHeadingOffIcon()}</div>
3042
+ </div>
3043
+ <div class="cv-tabgroup-info">
3044
+ <div class="cv-tabgroup-title-container">
3045
+ <p class="cv-tabgroup-title">Navigation Headers</p>
3046
+ </div>
3047
+ <p class="cv-tabgroup-description">Show or hide navigation headers</p>
3048
+ </div>
3049
+ <label class="cv-toggle-switch cv-nav-toggle">
3050
+ <input class="cv-nav-pref-input" type="checkbox" ${initialNavsVisible ? 'checked' : ''} aria-label="Show or hide navigation headers" />
3051
+ <span class="cv-switch-bg"></span>
3052
+ <span class="cv-switch-knob"></span>
3053
+ </label>
3054
+ </div>
3055
+ </div>
3056
+ <div class="cv-tab-groups-list">
3057
+ ${tabGroups.map(group => `
3058
+ <div class="cv-tabgroup-card cv-tabgroup-item">
3059
+ <label class="cv-tabgroup-label" for="tab-group-${group.id}">
3060
+ ${group.label || group.id}
3061
+ </label>
3062
+ <select id="tab-group-${group.id}" class="cv-tabgroup-select" data-group-id="${group.id}">
3063
+ ${group.tabs.map(tab => `<option value="${tab.id}">${tab.label || tab.id}</option>`).join('')}
3064
+ </select>
3065
+ </div>
3066
+ `).join('')}
3067
+ </div>
2805
3068
  `;
2806
3069
  }
2807
- this.modal.innerHTML = `
2808
- <div class="cv-widget-modal cv-custom-state-modal">
2809
- <header class="cv-modal-header">
2810
- <div class="cv-modal-header-content">
2811
- <div class="cv-modal-icon">
2812
- ${getGearIcon()}
2813
- </div>
2814
- <div class="cv-modal-title">${this.options.title}</div>
2815
- </div>
2816
- <button class="cv-modal-close" aria-label="Close modal">
2817
- ${getCloseIcon()}
2818
- </button>
2819
- </header>
2820
- <main class="cv-modal-main">
2821
- ${this.options.description ? `<p class="cv-modal-description">${this.options.description}</p>` : ''}
2822
-
2823
- ${toggles.length ? `
2824
- <div class="cv-content-section">
2825
- <div class="cv-section-heading">Toggles</div>
2826
- <div class="cv-toggles-container">
2827
- ${toggleControlsHtml}
2828
- </div>
2829
- </div>
2830
- ` : ''}
2831
-
2832
- ${this.options.showTabGroups && tabGroups && tabGroups.length > 0 ? `
2833
- <div class="cv-content-section">
2834
- <div class="cv-section-heading">Tab Groups</div>
2835
- <div class="cv-tabgroups-container">
2836
- ${tabGroupControlsHTML}
2837
- </div>
2838
- </div>
2839
- ` : ''}
2840
- </main>
2841
-
2842
- <footer class="cv-modal-footer">
2843
- ${this.options.showReset ? `
2844
- <button class="cv-reset-btn">
2845
- <span class="cv-reset-btn-icon">${getResetIcon()}</span>
2846
- <span>Reset to Default</span>
2847
- </button>
2848
- ` : ''}
2849
- <button class="cv-share-btn">
2850
- <span>Copy Shareable URL</span>
2851
- <span class="cv-share-btn-icon">${getCopyIcon()}</span>
2852
- </button>
2853
- </footer>
2854
- </div>
3070
+ this.modal.innerHTML = `
3071
+ <div class="cv-widget-modal cv-custom-state-modal">
3072
+ <header class="cv-modal-header">
3073
+ <div class="cv-modal-header-content">
3074
+ <div class="cv-modal-icon">
3075
+ ${getGearIcon()}
3076
+ </div>
3077
+ <div class="cv-modal-title">${this.options.title}</div>
3078
+ </div>
3079
+ <button class="cv-modal-close" aria-label="Close modal">
3080
+ ${getCloseIcon()}
3081
+ </button>
3082
+ </header>
3083
+ <main class="cv-modal-main">
3084
+ ${this.options.description ? `<p class="cv-modal-description">${this.options.description}</p>` : ''}
3085
+
3086
+ ${toggles.length ? `
3087
+ <div class="cv-content-section">
3088
+ <div class="cv-section-heading">Toggles</div>
3089
+ <div class="cv-toggles-container">
3090
+ ${toggleControlsHtml}
3091
+ </div>
3092
+ </div>
3093
+ ` : ''}
3094
+
3095
+ ${this.options.showTabGroups && tabGroups && tabGroups.length > 0 ? `
3096
+ <div class="cv-content-section">
3097
+ <div class="cv-section-heading">Tab Groups</div>
3098
+ <div class="cv-tabgroups-container">
3099
+ ${tabGroupControlsHTML}
3100
+ </div>
3101
+ </div>
3102
+ ` : ''}
3103
+ </main>
3104
+
3105
+ <footer class="cv-modal-footer">
3106
+ ${this.options.showReset ? `
3107
+ <button class="cv-reset-btn">
3108
+ <span class="cv-reset-btn-icon">${getResetIcon()}</span>
3109
+ <span>Reset to Default</span>
3110
+ </button>
3111
+ ` : ''}
3112
+ <button class="cv-share-btn">
3113
+ <span>Copy Shareable URL</span>
3114
+ <span class="cv-share-btn-icon">${getCopyIcon()}</span>
3115
+ </button>
3116
+ </footer>
3117
+ </div>
2855
3118
  `;
2856
3119
  document.body.appendChild(this.modal);
2857
3120
  this.attachStateModalEventListeners();
@@ -2912,7 +3175,7 @@ class CustomViewsWidget {
2912
3175
  toggleInputs.forEach(toggleInput => {
2913
3176
  toggleInput.addEventListener('change', () => {
2914
3177
  const state = this.getCurrentCustomStateFromModal();
2915
- this.core.applyState(state);
3178
+ this.core.applyState(state, { source: 'widget' });
2916
3179
  });
2917
3180
  });
2918
3181
  // Listen to tab group selects
@@ -2932,7 +3195,7 @@ class CustomViewsWidget {
2932
3195
  toggles: currentToggles,
2933
3196
  tabs: currentTabs
2934
3197
  };
2935
- this.core.applyState(newState);
3198
+ this.core.applyState(newState, { source: 'widget' });
2936
3199
  }
2937
3200
  });
2938
3201
  });
@@ -3134,29 +3397,29 @@ class CustomViewsWidget {
3134
3397
  this.modal = document.createElement('div');
3135
3398
  this.modal.className = 'cv-widget-modal-overlay cv-welcome-modal-overlay';
3136
3399
  this.applyThemeToModal();
3137
- this.modal.innerHTML = `
3138
- <div class="cv-widget-modal cv-welcome-modal">
3139
- <header class="cv-modal-header">
3140
- <div class="cv-modal-header-content">
3141
- <div class="cv-modal-icon">
3142
- ${getGearIcon()}
3143
- </div>
3144
- <h1 class="cv-modal-title">${this.options.welcomeTitle}</h1>
3145
- </div>
3146
- </header>
3147
- <div class="cv-modal-main">
3148
- <p class="cv-welcome-message">${this.options.welcomeMessage}</p>
3149
-
3150
- <div class="cv-welcome-widget-preview">
3151
- <div class="cv-welcome-widget-icon">
3152
- ${getGearIcon()}
3153
- </div>
3154
- <p class="cv-welcome-widget-label">Look for this widget</p>
3155
- </div>
3156
-
3157
- <button class="cv-welcome-got-it">Got it!</button>
3158
- </div>
3159
- </div>
3400
+ this.modal.innerHTML = `
3401
+ <div class="cv-widget-modal cv-welcome-modal">
3402
+ <header class="cv-modal-header">
3403
+ <div class="cv-modal-header-content">
3404
+ <div class="cv-modal-icon">
3405
+ ${getGearIcon()}
3406
+ </div>
3407
+ <h1 class="cv-modal-title">${this.options.welcomeTitle}</h1>
3408
+ </div>
3409
+ </header>
3410
+ <div class="cv-modal-main">
3411
+ <p class="cv-welcome-message">${this.options.welcomeMessage}</p>
3412
+
3413
+ <div class="cv-welcome-widget-preview">
3414
+ <div class="cv-welcome-widget-icon">
3415
+ ${getGearIcon()}
3416
+ </div>
3417
+ <p class="cv-welcome-widget-label">Look for this widget</p>
3418
+ </div>
3419
+
3420
+ <button class="cv-welcome-got-it">Got it!</button>
3421
+ </div>
3422
+ </div>
3160
3423
  `;
3161
3424
  document.body.appendChild(this.modal);
3162
3425
  this.attachWelcomeModalEventListeners();