Skip to content

Commit

Permalink
[Tabs] Fix inline script (#802)
Browse files Browse the repository at this point in the history
  • Loading branch information
atomiks authored Nov 5, 2024
1 parent 2d1cd9e commit 753b194
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
// To update it, modify the corresponding source file and run `pnpm inline-scripts`.

// prettier-ignore
export const script = '!function(){console.log("prehydration");const t=document.currentScript.previousElementSibling;if(!t)return void console.log("no indicator");const o=t.closest(\'[role="tablist"]\');if(!o)return void console.log("no list");const e=o.querySelector(\'[data-selected="true"]\');if(!e)return void console.log("no active tab");const{left:n,right:i,top:r,bottom:l,width:c}=e.getBoundingClientRect(),{left:s,right:g,top:d,bottom:u,width:p}=o.getBoundingClientRect();if(0===c||0===p)return;const a=g-i,f=r-d,h=u-l,b=i-n,v=l-r;function m(o,e){t.style.setProperty(`--active-tab-${o}`,`${e}px`),console.log("setting prop",o,e,t)}m("left",n-s),m("right",a),m("top",f),m("bottom",h),m("width",b),m("height",v)}();';
export const script = '!function(){const t=document.currentScript.previousElementSibling;if(!t)return;const e=t.closest(\'[role="tablist"]\');if(!e)return;const o=e.querySelector(\'[data-selected="true"]\');if(!o)return;const{left:i,right:n,top:r,bottom:c,width:l}=o.getBoundingClientRect(),{left:u,right:s,top:f,bottom:g,width:d}=e.getBoundingClientRect();if(0===l||0===d)return;const h=s-n,p=r-f,b=g-c,a=n-i,m=c-r;function w(e,o){t.style.setProperty(`--active-tab-${e}`,`${o}px`)}w("left",i-u),w("right",h),w("top",p),w("bottom",b),w("width",a),w("height",m)}();';

0 comments on commit 753b194

Please sign in to comment.