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