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