@rettangoli/ui 1.9.1 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var rettangoli=(()=>{var
|
|
1
|
+
var rettangoli=(()=>{var L=`
|
|
2
2
|
:host([href]) {
|
|
3
3
|
cursor: pointer;
|
|
4
4
|
position: relative;
|
|
@@ -12,26 +12,26 @@ var rettangoli=(()=>{var $=`
|
|
|
12
12
|
bottom: 0;
|
|
13
13
|
z-index: 1;
|
|
14
14
|
}
|
|
15
|
-
`,
|
|
16
|
-
${
|
|
15
|
+
`,W=({linkElement:s,href:t,newTab:e,rel:i})=>{s.href=t,e?s.target="_blank":s.removeAttribute("target"),i!=null?s.rel=i:e?s.rel="noopener noreferrer":s.removeAttribute("rel")},O=({shadowRoot:s,slotElement:t,linkElement:e,href:i,newTab:n,rel:r})=>{if(t.parentNode!==s&&s.appendChild(t),!i)return e&&e.parentNode===s&&s.removeChild(e),null;let o=e||document.createElement("a");return W({linkElement:o,href:i,newTab:n,rel:r}),o.parentNode!==s&&s.appendChild(o),o},tt=({shadowRoot:s,childElement:t,linkElement:e,href:i,newTab:n,rel:r})=>{if(!i)return e?(t.parentNode===e&&s.appendChild(t),e.parentNode===s&&s.removeChild(e),null):(t.parentNode!==s&&s.appendChild(t),null);let o=e||document.createElement("a");return W({linkElement:o,href:i,newTab:n,rel:r}),t.parentNode!==o&&o.appendChild(t),o.parentNode!==s&&s.appendChild(o),o};var S=["default","sm","md","lg","xl"],b=()=>S.reduce((s,t)=>(s[t]={},s),{}),zt=["sm","md","lg","xl"],fe=({size:s,attr:t})=>s==="default"?t:`${s}-${t}`,be=({size:s,includeDefault:t=!0})=>{if(s==="default")return["default"];let e=zt.indexOf(s);if(e===-1)return t?["default"]:[];let i=zt.slice(e);return t&&i.push("default"),i},B=({element:s,size:t,attr:e,includeDefault:i=!0})=>{let n=be({size:t,includeDefault:i});for(let r of n){let o=fe({size:r,attr:e}),l=s.getAttribute(o);if(l!==null)return l}return null};var ve=/^([1-9]|1[0-2])fg$/,_e=/^([1-9]\d*)\/([1-9]\d*)fb$/,et=s=>typeof s=="string"&&ve.test(s),G=s=>{if(typeof s!="string")return null;let t=s.match(_e);if(!t)return null;let e=Number(t[1]),i=Number(t[2]);return!Number.isInteger(e)||!Number.isInteger(i)||i<=0||e>i?null:{numerator:e,denominator:i}};function Lt({numerator:s,denominator:t,gapVar:e}){return s===t?"100%":s===1?`calc((100% - ((${t} - 1) * ${e})) / ${t})`:`calc(((100% - ((${t} - 1) * ${e})) * ${s}) / ${t})`}var v=({styleBucket:s,axis:t,dimension:e,fillValue:i,allowFlexGrow:n=!1,flexMinDimension:r="0",lockBounds:o=!0})=>{let l=()=>{!n||t!=="width"||(s["flex-grow"]="0",s["flex-shrink"]="1",s["flex-basis"]="auto")},a=()=>{s[`min-${t}`]="unset",s[`max-${t}`]="unset"};if(e===void 0)return;if(e==="f"){l(),s[t]=i,a();return}if(n&&et(e)){s["flex-grow"]=e.slice(0,-2),s["flex-basis"]="0%",s[`min-${t}`]=r,s[`max-${t}`]="unset";return}let h=n?G(e):null;if(h){s["flex-grow"]="0",s["flex-shrink"]="0",s["flex-basis"]=Lt({...h,gapVar:"var(--rtgl-flex-gap, 0px)"}),s[`min-${t}`]=r,s[`max-${t}`]="unset";return}l(),s[t]=e,o&&(s[`min-${t}`]=e,s[`max-${t}`]=e)},M=({style:s,width:t,fillValue:e="var(--width-stretch)",allowFlexGrow:i=!0,flexMinWidth:n="0"})=>{if(t==="f"){s.width=e,s.flexGrow="",s.flexBasis="",s.minWidth="";return}if(i&&et(t)){s.width="",s.flexGrow=t.slice(0,-2),s.flexShrink="",s.flexBasis="0%",s.minWidth=n;return}let r=i?G(t):null;if(r){s.width="",s.flexGrow="0",s.flexShrink="0",s.flexBasis=Lt({...r,gapVar:"var(--rtgl-flex-gap, 0px)"}),s.minWidth=n;return}if(t!=null){s.width=t,s.flexGrow="",s.flexShrink="",s.flexBasis="",s.minWidth="";return}s.width="",s.flexGrow="",s.flexShrink="",s.flexBasis="",s.minWidth=""};var ye=s=>`${s}`.trim().replace(/\s*\/\s*/g,"/"),P=s=>{if(s==null)return;let t=ye(s);if(t.length!==0)return typeof CSS<"u"&&typeof CSS.supports=="function"?CSS.supports("aspect-ratio",t)?t:void 0:t};function c(s,...t){let e="";return s.forEach((i,n)=>{e+=i+(t[n]||"")}),e}var we=["sm","md","lg","xl"],Ot={mt:"margin-top",mr:"margin-right",mb:"margin-bottom",ml:"margin-left",m:"margin",mh:"margin-left margin-right",mv:"margin-top margin-bottom",pt:"padding-top",pr:"padding-right",pb:"padding-bottom",pl:"padding-left",p:"padding",ph:"padding-left padding-right",pv:"padding-top padding-bottom",g:"gap --rtgl-flex-gap",gv:"row-gap --rtgl-flex-gap",gh:"column-gap --rtgl-flex-gap",bw:"border-width",bwt:"border-top-width",bwr:"border-right-width",bwb:"border-bottom-width",bwl:"border-left-width",bc:"border-color",br:"border-radius",pos:"position",shadow:"box-shadow",cur:"cursor"},C=Object.keys(Ot),g=s=>s.concat(we.flatMap(t=>s.map(e=>`${t}-${e}`))),$={default:void 0,xl:"@media only screen and (max-width: 1280px)",lg:"@media only screen and (max-width: 1024px)",md:"@media only screen and (max-width: 768px)",sm:"@media only screen and (max-width: 640px)"},_=(s,t={},e=null)=>{let i="";for(let[n,r]of Object.entries($)){n!=="default"&&(i+=`${r} {`);for(let[o,l]of Object.entries(s))for(let[a,h]of Object.entries(l)){let d=Ot[o],y=h.startsWith("--")?`var(${h})`:h,x=n==="default"?o:`${n}-${o}`,k=n==="default"?`h-${o}`:`${n}-h-${o}`,T=(A,E=!1)=>{let I=E?`:host([${A}="${a}"]:hover)`:`:host([${A}="${a}"])`;if(e)return e.split(",").map(J=>`${I} ${J.trim()}`).join(", ");let q=t[o];return q?`${I} ${q}`:I};if(d){let E=d.split(" ").map(I=>`${I}: ${y};`).join(" ");i+=`
|
|
16
|
+
${T(x)}{
|
|
17
17
|
${E}
|
|
18
18
|
}
|
|
19
|
-
${
|
|
19
|
+
${T(k,!0)}{
|
|
20
20
|
${E}
|
|
21
21
|
}
|
|
22
|
-
`}else
|
|
23
|
-
${
|
|
24
|
-
${
|
|
22
|
+
`}else i+=`
|
|
23
|
+
${T(x)}{
|
|
24
|
+
${h}
|
|
25
25
|
}
|
|
26
|
-
${
|
|
27
|
-
${
|
|
26
|
+
${T(k,!0)}{
|
|
27
|
+
${h}
|
|
28
28
|
}
|
|
29
|
-
`}
|
|
30
|
-
`);let o="";for(let[l,
|
|
29
|
+
`}n!=="default"&&(i+="}")}return i};function xe(s){if(s===null||s.includes("/"))return!1;let t=String(s);return/[0-9]$/.test(t)}var Se=s=>/%$/.test(s),Ee=s=>/^([1-9]|1[0-2])fg$/.test(s),u=s=>{if(s!=null)return Ee(s)||Se(s)?s:xe(s)?`${s}px`:Object.keys(p).includes(s)?`var(${p[s]})`:s},p={xs:"--spacing-xs",sm:"--spacing-sm",md:"--spacing-md",lg:"--spacing-lg",xl:"--spacing-xl"};function w(s,t=":host"){let e="",i=["default","xl","lg","md","sm"];for(let n of i){let r=$[n];if(!s[n]||Object.keys(s[n]).length===0)continue;n!=="default"&&(e+=`${r} {
|
|
30
|
+
`);let o="";for(let[l,a]of Object.entries(s[n]))a!=null&&(o+=`${l}: ${a} !important;
|
|
31
31
|
`);e+=`${t} {
|
|
32
32
|
${o.trim()}
|
|
33
33
|
}
|
|
34
|
-
`,
|
|
34
|
+
`,n!=="default"&&(e+=`}
|
|
35
35
|
`)}return e}var Ae={mt:p,mr:p,mb:p,ml:p,m:p,mh:p,mv:p,s:{sm:`
|
|
36
36
|
height: 28px;
|
|
37
37
|
padding-left: 12px;
|
|
@@ -81,7 +81,7 @@ var rettangoli=(()=>{var $=`
|
|
|
81
81
|
`,lk:`
|
|
82
82
|
background-color: transparent;
|
|
83
83
|
color: var(--foreground);
|
|
84
|
-
`}},
|
|
84
|
+
`}},Bt=_(Ae,{},".surface");var Ce=[{prefix:"sm",maxWidth:640},{prefix:"md",maxWidth:768},{prefix:"lg",maxWidth:1024},{prefix:"xl",maxWidth:1280}],it=class s extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){s.styleSheet||(s.styleSheet=new CSSStyleSheet,s.styleSheet.replaceSync(c`
|
|
85
85
|
:host {
|
|
86
86
|
display: inline-flex;
|
|
87
87
|
}
|
|
@@ -252,8 +252,8 @@ var rettangoli=(()=>{var $=`
|
|
|
252
252
|
color: inherit;
|
|
253
253
|
}
|
|
254
254
|
|
|
255
|
-
${
|
|
256
|
-
`))}constructor(){super(),
|
|
255
|
+
${Bt}
|
|
256
|
+
`))}constructor(){super(),s.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[s.styleSheet],this._containerElement=null,this._surfaceElement=document.createElement("button"),this._slotElement=document.createElement("slot"),this._prefixIcon=null,this._suffixIcon=null,this._surfaceElement.className="surface",this._surfaceElement.appendChild(this._slotElement),this._onWindowResize=this._onWindowResize.bind(this)}static get observedAttributes(){return["key","href","new-tab","rel","w","pre","suf","disabled","v","s","sq","sm-s","md-s","lg-s","xl-s"]}connectedCallback(){window.addEventListener("resize",this._onWindowResize),this._updateButton()}disconnectedCallback(){window.removeEventListener("resize",this._onWindowResize)}attributeChangedCallback(t,e,i){this._updateButton()}_onWindowResize(){(this.hasAttribute("sm-s")||this.hasAttribute("md-s")||this.hasAttribute("lg-s")||this.hasAttribute("xl-s"))&&this._updateIcon()}_resolveResponsiveSizeToken(){let t=window.innerWidth;for(let{prefix:e,maxWidth:i}of Ce){let n=`${e}-s`;if(t<=i&&this.hasAttribute(n))return this.getAttribute(n)}return this.getAttribute("s")}_updateButton(){this.shadow.innerHTML="";let t=this.hasAttribute("disabled"),e=this.getAttribute("href"),i=this.hasAttribute("new-tab"),n=this.getAttribute("rel"),r=e&&!t,o=r?"a":"button";if(this._surfaceElement.tagName.toLowerCase()!==o){let l=document.createElement(o);l.className="surface",l.appendChild(this._slotElement),this._surfaceElement=l}this._updateIcon(),this.hasAttribute("sq")?(this.style.width="",this.style.minWidth="",this.style.maxWidth="",this._surfaceElement.style.width="",this._surfaceElement.style.minWidth="",this._surfaceElement.style.maxWidth=""):this._updateWidth(),r?(W({linkElement:this._surfaceElement,href:e,newTab:i,rel:n}),this._surfaceElement.removeAttribute("disabled")):(this._surfaceElement.removeAttribute("href"),this._surfaceElement.removeAttribute("target"),this._surfaceElement.removeAttribute("rel"),t?this._surfaceElement.setAttribute("disabled",""):this._surfaceElement.removeAttribute("disabled")),this.shadow.appendChild(this._surfaceElement),this._containerElement=this._surfaceElement}_updateIcon(){this._prefixIcon&&(this._prefixIcon.remove(),this._prefixIcon=null),this._suffixIcon&&(this._suffixIcon.remove(),this._suffixIcon=null);let t={sm:14,md:18,lg:22},e=this._resolveResponsiveSizeToken(),i=18;this.hasAttribute("sq")?i={sm:14,lg:22}[e]||18:i=t[e]||18;let n=this.getAttribute("pre");n&&(this._prefixIcon=document.createElement("rtgl-svg"),this._prefixIcon.setAttribute("svg",n),this._prefixIcon.setAttribute("wh",i.toString()),this._prefixIcon.style.color="inherit",this._surfaceElement.insertBefore(this._prefixIcon,this._slotElement));let r=this.getAttribute("suf");r&&(this._suffixIcon=document.createElement("rtgl-svg"),this._suffixIcon.setAttribute("svg",r),this._suffixIcon.setAttribute("wh",i.toString()),this._suffixIcon.style.color="inherit",this._surfaceElement.appendChild(this._suffixIcon))}_updateWidth(){let t=u(this.getAttribute("w"));t==="f"?(this.style.width="var(--width-stretch)",this.style.minWidth="",this.style.maxWidth="",this._surfaceElement.style.width="100%",this._surfaceElement.style.minWidth="",this._surfaceElement.style.maxWidth=""):t!=null?(this.style.width=t,this.style.minWidth=t,this.style.maxWidth=t,this._surfaceElement.style.width="100%",this._surfaceElement.style.minWidth="",this._surfaceElement.style.maxWidth=""):(this.style.width="",this.style.minWidth="",this.style.maxWidth="",this._surfaceElement.style.width="",this._surfaceElement.style.minWidth="",this._surfaceElement.style.maxWidth="")}getBoundingClientRect(){return this._surfaceElement?this._surfaceElement.getBoundingClientRect():super.getBoundingClientRect()}},$t=({render:s,html:t})=>it;var ke=({numerator:s,denominator:t,gapVar:e})=>s===t?"100%":s===1?`calc((100% - ((${t} - 1) * ${e})) / ${t})`:`calc(((100% - ((${t} - 1) * ${e})) * ${s}) / ${t})`,K=({index:s,maxIndex:t})=>!Number.isFinite(s)||!Number.isFinite(t)||t<0?0:Math.min(Math.max(Math.trunc(s),0),t),st=({value:s,defaultValue:t=!1})=>{if(s==null)return t;let e=`${s}`.trim().toLowerCase();return e.length===0?!0:!(e==="false"||e==="0"||e==="no"||e==="off"||e==="none")},nt=s=>{if(s==null)return"x mandatory";let t=`${s}`.trim().toLowerCase();return t===""||t==="true"||t==="1"||t==="yes"?"x mandatory":t==="false"||t==="0"||t==="no"||t==="off"||t==="none"?"none":"x mandatory"},Rt=({slideLeft:s,slideWidth:t,viewportWidth:e,scrollPaddingInlineStart:i=0,scrollPaddingInlineEnd:n=0,snapAlign:r="center",maxScrollLeft:o=Number.POSITIVE_INFINITY})=>{if(!Number.isFinite(s)||!Number.isFinite(t)||!Number.isFinite(e))return 0;let l=i,a=e-n,h=Math.max(a-l,0),d;r==="start"?d=s-l:r==="end"?d=s+t-a:d=s+t/2-(l+h/2);let y=Number.isFinite(o)?Math.max(o,0):Number.POSITIVE_INFINITY;return Math.min(Math.max(d,0),y)},Wt=({slideWidthCss:s,snapAlign:t="center"})=>`${t??""}`.trim().toLowerCase()!=="center"?"0px":`max(calc((100% - (${s&&`${s}`.trim().length>0?`${s}`.trim():"100%"})) / 2), 0px)`,Mt=({slideWidth:s,gapVar:t="var(--rtgl-carousel-gap, 0px)"})=>{if(s==null||`${s}`.trim()===""||s==="f")return"100%";let e=G(`${s}`.trim());return e?ke({...e,gapVar:t}):u(`${s}`.trim())??"100%"};var Ie=["a","button","input","select","textarea","label","summary","[contenteditable]"].join(", "),rt=s=>{if(s==null)return null;let t=`${s}`.trim();return t.length>0?t:null},Te=s=>s<.5?2*s*s:1-Math.pow(-2*s+2,2)/2,Pt=s=>{let t="http://www.w3.org/2000/svg",e=document.createElementNS(t,"svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false");let i=document.createElementNS(t,"path");return i.setAttribute("d",s==="left"?"M15 18 9 12l6-6":"M9 18l6-6-6-6"),i.setAttribute("fill","none"),i.setAttribute("stroke","currentColor"),i.setAttribute("stroke-width","2"),i.setAttribute("stroke-linecap","round"),i.setAttribute("stroke-linejoin","round"),e.appendChild(i),e},ot=class s extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){s.styleSheet||(s.styleSheet=new CSSStyleSheet,s.styleSheet.replaceSync(c`
|
|
257
257
|
:host {
|
|
258
258
|
display: block;
|
|
259
259
|
width: 100%;
|
|
@@ -448,7 +448,7 @@ var rettangoli=(()=>{var $=`
|
|
|
448
448
|
border-color: var(--foreground);
|
|
449
449
|
transform: scale(1.2);
|
|
450
450
|
}
|
|
451
|
-
`))}static get observedAttributes(){return["index","sw","sna","g","spi","sbh","snap","nav","pager"]}constructor(){super(),i.initializeStyleSheet(),this._slides=[],this._pagerButtons=[],this._currentIndex=0,this._clickSuppressUntil=0,this._dragState=null,this._scrollFrame=null,this._resizeFrame=null,this._scrollAnimationFrame=null,this._isReflectingIndex=!1,this._slideStyleCache=new WeakMap,this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[i.styleSheet],this._rootElement=document.createElement("div"),this._rootElement.id="root",this._viewportShellElement=document.createElement("div"),this._viewportShellElement.id="viewport-shell",this._viewportShellElement.setAttribute("part","viewport-shell"),this._viewportElement=document.createElement("div"),this._viewportElement.id="viewport",this._viewportElement.tabIndex=0,this._viewportElement.setAttribute("part","viewport"),this._slotElement=document.createElement("slot"),this._viewportElement.appendChild(this._slotElement),this._controlsElement=document.createElement("div"),this._controlsElement.id="controls",this._controlsElement.setAttribute("part","controls"),this._controlsElement.hidden=!0,this._prevButton=document.createElement("button"),this._prevButton.id="prev-button",this._prevButton.type="button",this._prevButton.hidden=!0,this._prevButton.append(Pt("left")),this._prevButton.setAttribute("part","nav-button prev-button"),this._prevButton.setAttribute("aria-label","Previous slide"),this._pagerElement=document.createElement("div"),this._pagerElement.id="pager",this._pagerElement.setAttribute("part","pager"),this._pagerElement.hidden=!0,this._nextButton=document.createElement("button"),this._nextButton.id="next-button",this._nextButton.type="button",this._nextButton.hidden=!0,this._nextButton.append(Pt("right")),this._nextButton.setAttribute("part","nav-button next-button"),this._nextButton.setAttribute("aria-label","Next slide"),this._viewportShellElement.append(this._viewportElement,this._prevButton,this._nextButton),this._controlsElement.append(this._pagerElement),this._rootElement.append(this._viewportShellElement,this._controlsElement),this.shadow.append(this._rootElement),this._handleSlotChange=this._handleSlotChange.bind(this),this._handleClickPrev=this._handleClickPrev.bind(this),this._handleClickNext=this._handleClickNext.bind(this),this._handleViewportKeydown=this._handleViewportKeydown.bind(this),this._handleViewportScroll=this._handleViewportScroll.bind(this),this._handleViewportPointerDown=this._handleViewportPointerDown.bind(this),this._handlePointerMove=this._handlePointerMove.bind(this),this._handlePointerUp=this._handlePointerUp.bind(this),this._handleViewportClickCapture=this._handleViewportClickCapture.bind(this),this._resizeObserver=typeof ResizeObserver<"u"?new ResizeObserver(()=>{this._resizeFrame!==null&&cancelAnimationFrame(this._resizeFrame),this._resizeFrame=requestAnimationFrame(()=>{this._resizeFrame=null,!(this._dragState?.dragging||!this._slides.length)&&this.goTo(this._currentIndex,{behavior:"auto"})})}):null}get index(){return this._currentIndex}set index(t){let e=Number(t);this.setAttribute("index",Number.isFinite(e)?`${e}`:"0")}get snap(){return nt(this.getAttribute("snap"))!=="none"}set snap(t){if(t===!1||`${t}`.trim().toLowerCase()==="false"){this.setAttribute("snap","false");return}this.setAttribute("snap","true")}connectedCallback(){this._slotElement.addEventListener("slotchange",this._handleSlotChange),this._prevButton.addEventListener("click",this._handleClickPrev),this._nextButton.addEventListener("click",this._handleClickNext),this._viewportElement.addEventListener("keydown",this._handleViewportKeydown),this._viewportElement.addEventListener("scroll",this._handleViewportScroll,{passive:!0}),this._viewportElement.addEventListener("pointerdown",this._handleViewportPointerDown),this._viewportElement.addEventListener("click",this._handleViewportClickCapture,!0),this._resizeObserver?.observe(this._viewportElement),this._syncSlides(),this._updateLayoutStyles();let t=this.hasAttribute("index")?Number(this.getAttribute("index")):0;this.goTo(t,{behavior:"auto"})}disconnectedCallback(){this._slotElement.removeEventListener("slotchange",this._handleSlotChange),this._prevButton.removeEventListener("click",this._handleClickPrev),this._nextButton.removeEventListener("click",this._handleClickNext),this._viewportElement.removeEventListener("keydown",this._handleViewportKeydown),this._viewportElement.removeEventListener("scroll",this._handleViewportScroll),this._viewportElement.removeEventListener("pointerdown",this._handleViewportPointerDown),this._viewportElement.removeEventListener("click",this._handleViewportClickCapture,!0),this._removePointerListeners(),this._resizeObserver?.disconnect(),this._scrollFrame!==null&&(cancelAnimationFrame(this._scrollFrame),this._scrollFrame=null),this._resizeFrame!==null&&(cancelAnimationFrame(this._resizeFrame),this._resizeFrame=null),this._cancelScrollAnimation(),this._setDraggingState(!1),this._slides.forEach(t=>{this._restoreSlideStyles(t),t.removeAttribute("data-rtgl-carousel-active")})}attributeChangedCallback(t,e,s){if(e!==s){if(t==="index"){if(this._isReflectingIndex){this._isReflectingIndex=!1;return}this.goTo(Number(s),{behavior:"smooth"});return}if(t==="nav"||t==="pager"){this._updateControls();return}this._updateLayoutStyles()}}next(){this.goTo(this._currentIndex+1)}prev(){this.goTo(this._currentIndex-1)}_showsNavControls(){return st({value:this.getAttribute("nav"),defaultValue:!0})}_showsPagerControls(){return st({value:this.getAttribute("pager"),defaultValue:!1})}goTo(t,e={}){if(!this._slides.length){this._setCurrentIndex(0,{emit:!1,reflect:!0});return}let s=X({index:Number(t),maxIndex:this._slides.length-1}),r=this._slides[s],n=e.behavior??"smooth";r&&(this._scrollViewportTo(this._getSlideTargetScrollLeft(r),{behavior:n}),this._setCurrentIndex(s))}_handleSlotChange(){this._syncSlides(),this._updateLayoutStyles(),this.goTo(this._currentIndex,{behavior:"auto"})}_handleClickPrev(){this.prev()}_handleClickNext(){this.next()}_handleViewportKeydown(t){t.key==="ArrowRight"?(t.preventDefault(),this.next()):t.key==="ArrowLeft"&&(t.preventDefault(),this.prev())}_handleViewportScroll(){this._scrollAnimationFrame===null&&(this._dragState?.dragging||this._requestSyncFromScroll())}_handleViewportPointerDown(t){t.pointerType==="mouse"&&(t.button!==0||!this._slides.length||this._eventTargetsInteractiveElement(t)||(this._cancelScrollAnimation(),this._dragState={pointerId:t.pointerId,startX:t.clientX,startScrollLeft:this._viewportElement.scrollLeft,dragging:!1},this._viewportElement.setPointerCapture(t.pointerId),this._viewportElement.addEventListener("pointermove",this._handlePointerMove),this._viewportElement.addEventListener("pointerup",this._handlePointerUp),this._viewportElement.addEventListener("pointercancel",this._handlePointerUp)))}_handlePointerMove(t){if(!this._dragState||t.pointerId!==this._dragState.pointerId)return;let e=t.clientX-this._dragState.startX;!this._dragState.dragging&&Math.abs(e)>6&&(this._dragState.dragging=!0,this._setDraggingState(!0)),this._dragState.dragging&&(t.preventDefault(),this._viewportElement.scrollLeft=this._dragState.startScrollLeft-e)}_handlePointerUp(t){if(!this._dragState||t.pointerId!==this._dragState.pointerId)return;let e=this._dragState.dragging,s=e?this._findNearestSlideIndex():this._currentIndex;this._viewportElement.hasPointerCapture(t.pointerId)&&this._viewportElement.releasePointerCapture(t.pointerId),this._dragState=null,this._setDraggingState(!1),this._removePointerListeners(),e&&(this._clickSuppressUntil=performance.now()+250,this.snap?this.goTo(s,{behavior:"smooth"}):this._requestSyncFromScroll())}_handleViewportClickCapture(t){performance.now()<this._clickSuppressUntil&&(t.preventDefault(),t.stopPropagation())}_removePointerListeners(){this._viewportElement.removeEventListener("pointermove",this._handlePointerMove),this._viewportElement.removeEventListener("pointerup",this._handlePointerUp),this._viewportElement.removeEventListener("pointercancel",this._handlePointerUp)}_eventTargetsInteractiveElement(t){return t.composedPath().some(e=>e instanceof Element&&e.matches(Ie))}_requestSyncFromScroll(){this._scrollFrame!==null&&cancelAnimationFrame(this._scrollFrame),this._scrollFrame=requestAnimationFrame(()=>{this._scrollFrame=null;let t=this._findNearestSlideIndex();this._setCurrentIndex(t)})}_findNearestSlideIndex(){if(!this._slides.length)return 0;let t=this._viewportElement.scrollLeft,e=this._currentIndex,s=Number.POSITIVE_INFINITY;return this._slides.forEach((r,n)=>{let o=Math.abs(this._getSlideTargetScrollLeft(r)-t);o<s&&(e=n,s=o)}),e}_syncSlides(){let t=new Set(this._slides),e=this._slotElement.assignedElements({flatten:!0}).filter(s=>!s.hasAttribute("hidden"));t.forEach(s=>{e.includes(s)||(this._restoreSlideStyles(s),s.removeAttribute("data-rtgl-carousel-active"))}),this._slides=e,this._slides.forEach(s=>{this._slideStyleCache.has(s)||this._slideStyleCache.set(s,{flex:s.style.flex,width:s.style.width,minWidth:s.style.minWidth,maxWidth:s.style.maxWidth,boxSizing:s.style.boxSizing,scrollSnapAlign:s.style.scrollSnapAlign,scrollSnapStop:s.style.scrollSnapStop})}),this._buildPager(),this._setCurrentIndex(X({index:this._currentIndex,maxIndex:this._slides.length-1}),{emit:!1,reflect:!0})}_restoreSlideStyles(t){let e=this._slideStyleCache.get(t);e&&(t.style.flex=e.flex,t.style.width=e.width,t.style.minWidth=e.minWidth,t.style.maxWidth=e.maxWidth,t.style.boxSizing=e.boxSizing,t.style.scrollSnapAlign=e.scrollSnapAlign,t.style.scrollSnapStop=e.scrollSnapStop)}_updateLayoutStyles(){let t=Mt({slideWidth:this.getAttribute("sw")}),e=rt(this.getAttribute("sna"))??"center",s=nt(this.getAttribute("snap")),r=u(this.getAttribute("g"))??"var(--spacing-md)",n=u(this.getAttribute("spi"))??"0px",o=rt(this.getAttribute("sbh"))??"smooth",l=Rt({slideWidthCss:t,snapAlign:e});this.style.setProperty("--rtgl-carousel-slide-width",t),this.style.setProperty("--rtgl-carousel-gap",r),this.style.setProperty("--rtgl-carousel-scroll-snap-type",s),this.style.setProperty("--rtgl-carousel-scroll-padding-inline",n),this.style.setProperty("--rtgl-carousel-edge-padding-inline",l),this.style.setProperty("--rtgl-carousel-scroll-behavior",o),this.style.setProperty("--rtgl-carousel-snap-align",e),this._slides.forEach(h=>{h.style.flex=`0 0 ${t}`,h.style.width=t,h.style.minWidth="0",h.style.maxWidth="unset",h.style.boxSizing="border-box",h.style.scrollSnapAlign=e,h.style.scrollSnapStop="always"})}_setDraggingState(t){if(t){this.setAttribute("dragging",""),this._viewportElement.style.scrollSnapType="none",this._viewportElement.style.scrollBehavior="auto";return}this.removeAttribute("dragging"),this._viewportElement.style.scrollSnapType="",this._viewportElement.style.scrollBehavior=""}_scrollViewportTo(t,e={}){let s=e.behavior??"smooth",r=Math.min(Math.max(t,0),Math.max(this._viewportElement.scrollWidth-this._viewportElement.clientWidth,0));if(s!=="smooth"||Math.abs(r-this._viewportElement.scrollLeft)<1){this._cancelScrollAnimation(),this._viewportElement.scrollLeft=r;return}this._cancelScrollAnimation();let n=this._viewportElement.scrollLeft,o=r-n,l=Math.min(720,Math.max(420,Math.abs(o)*.35)),h=performance.now();this._setAnimatingScrollState(!0);let a=d=>{let y=d-h,x=Math.min(y/l,1),k=ze(x);if(this._viewportElement.scrollLeft=n+o*k,x<1){this._scrollAnimationFrame=requestAnimationFrame(a);return}this._viewportElement.scrollLeft=r,this._scrollAnimationFrame=null,this._setAnimatingScrollState(!1)};this._scrollAnimationFrame=requestAnimationFrame(a)}_cancelScrollAnimation(){this._scrollAnimationFrame!==null&&(cancelAnimationFrame(this._scrollAnimationFrame),this._scrollAnimationFrame=null,this._setAnimatingScrollState(!1))}_buildPager(){this._pagerElement.replaceChildren(),this._pagerButtons=[],this._slides.forEach((t,e)=>{let s=document.createElement("button");s.type="button",s.setAttribute("part","pager-button"),s.setAttribute("aria-label",`Go to slide ${e+1}`),s.setAttribute("title",`Go to slide ${e+1}`),s.addEventListener("click",()=>{this.goTo(e)}),this._pagerElement.appendChild(s),this._pagerButtons.push(s)}),this._updateControls()}_updateControls(){let t=this._slides.length>0,e=this._slides.length>1,s=this._currentIndex<=0,r=this._currentIndex>=this._slides.length-1,n=e&&this._showsNavControls(),o=e&&this._showsPagerControls();this._prevButton.hidden=!n,this._nextButton.hidden=!n,this._pagerElement.hidden=!o,this._controlsElement.hidden=!o,this._prevButton.disabled=!t||s,this._nextButton.disabled=!t||r,this._pagerButtons.forEach((l,h)=>{let a=h===this._currentIndex;l.classList.toggle("is-active",a),l.disabled=a,l.setAttribute("part",a?"pager-button pager-button-active":"pager-button"),a?l.setAttribute("aria-current","true"):l.removeAttribute("aria-current")})}_setCurrentIndex(t,e={}){let s=X({index:t,maxIndex:this._slides.length-1}),r=e.emit??!0,n=e.reflect??!0,o=this._currentIndex;this._currentIndex=s,this._slides.forEach((l,h)=>{h===s?l.setAttribute("data-rtgl-carousel-active","true"):l.removeAttribute("data-rtgl-carousel-active")}),this._updateControls(),n&&this.getAttribute("index")!==`${s}`&&(this._isReflectingIndex=!0,this.setAttribute("index",`${s}`)),r&&o!==s&&this.dispatchEvent(new CustomEvent("index-change",{detail:{index:s},bubbles:!0}))}_resolveScrollInlinePosition(){let t=rt(this.getAttribute("sna"))??"center";return t==="start"||t==="end"||t==="center"?t:"center"}_getSlideTargetScrollLeft(t){let e=this._viewportElement.getBoundingClientRect(),s=t.getBoundingClientRect();if(e.width<=0||s.width<=0)return this._viewportElement.scrollLeft;let r=getComputedStyle(this._viewportElement),n=this._viewportElement.scrollLeft,o=s.left-e.left+n;return Wt({slideLeft:o,slideWidth:s.width,viewportWidth:e.width,scrollPaddingInlineStart:this._parsePx(r.scrollPaddingInlineStart),scrollPaddingInlineEnd:this._parsePx(r.scrollPaddingInlineEnd),snapAlign:this._resolveScrollInlinePosition(),maxScrollLeft:this._viewportElement.scrollWidth-this._viewportElement.clientWidth})}_parsePx(t){let e=Number.parseFloat(t);return Number.isFinite(e)?e:0}_setAnimatingScrollState(t){if(t){this._viewportElement.style.scrollSnapType="none",this._viewportElement.style.scrollBehavior="auto";return}this._dragState?.dragging||(this._viewportElement.style.scrollSnapType="",this._viewportElement.style.scrollBehavior="")}},Nt=()=>ot;var Le={cur:{alias:"alias","all-scroll":"all-scroll",auto:"auto",cell:"cell","col-resize":"col-resize","context-menu":"context-menu",copy:"copy",crosshair:"crosshair",default:"default","e-resize":"e-resize","ew-resize":"ew-resize",grab:"grab",grabbing:"grabbing",help:"help",move:"move","n-resize":"n-resize","ne-resize":"ne-resize","nesw-resize":"nesw-resize","ns-resize":"ns-resize","nw-resize":"nw-resize","nwse-resize":"nwse-resize","no-drop":"no-drop",none:"none","not-allowed":"not-allowed",pointer:"pointer",progress:"progress","row-resize":"row-resize","s-resize":"s-resize","se-resize":"se-resize","sw-resize":"sw-resize",text:"text",url:"url","w-resize":"w-resize",wait:"wait","zoom-in":"zoom-in","zoom-out":"zoom-out"}},m=_(Le);var Y=c`
|
|
451
|
+
`))}static get observedAttributes(){return["index","sw","sna","g","spi","sbh","snap","nav","pager"]}constructor(){super(),s.initializeStyleSheet(),this._slides=[],this._pagerButtons=[],this._currentIndex=0,this._clickSuppressUntil=0,this._dragState=null,this._scrollFrame=null,this._resizeFrame=null,this._scrollAnimationFrame=null,this._isReflectingIndex=!1,this._slideStyleCache=new WeakMap,this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[s.styleSheet],this._rootElement=document.createElement("div"),this._rootElement.id="root",this._viewportShellElement=document.createElement("div"),this._viewportShellElement.id="viewport-shell",this._viewportShellElement.setAttribute("part","viewport-shell"),this._viewportElement=document.createElement("div"),this._viewportElement.id="viewport",this._viewportElement.tabIndex=0,this._viewportElement.setAttribute("part","viewport"),this._slotElement=document.createElement("slot"),this._viewportElement.appendChild(this._slotElement),this._controlsElement=document.createElement("div"),this._controlsElement.id="controls",this._controlsElement.setAttribute("part","controls"),this._controlsElement.hidden=!0,this._prevButton=document.createElement("button"),this._prevButton.id="prev-button",this._prevButton.type="button",this._prevButton.hidden=!0,this._prevButton.append(Pt("left")),this._prevButton.setAttribute("part","nav-button prev-button"),this._prevButton.setAttribute("aria-label","Previous slide"),this._pagerElement=document.createElement("div"),this._pagerElement.id="pager",this._pagerElement.setAttribute("part","pager"),this._pagerElement.hidden=!0,this._nextButton=document.createElement("button"),this._nextButton.id="next-button",this._nextButton.type="button",this._nextButton.hidden=!0,this._nextButton.append(Pt("right")),this._nextButton.setAttribute("part","nav-button next-button"),this._nextButton.setAttribute("aria-label","Next slide"),this._viewportShellElement.append(this._viewportElement,this._prevButton,this._nextButton),this._controlsElement.append(this._pagerElement),this._rootElement.append(this._viewportShellElement,this._controlsElement),this.shadow.append(this._rootElement),this._handleSlotChange=this._handleSlotChange.bind(this),this._handleClickPrev=this._handleClickPrev.bind(this),this._handleClickNext=this._handleClickNext.bind(this),this._handleViewportKeydown=this._handleViewportKeydown.bind(this),this._handleViewportScroll=this._handleViewportScroll.bind(this),this._handleViewportPointerDown=this._handleViewportPointerDown.bind(this),this._handlePointerMove=this._handlePointerMove.bind(this),this._handlePointerUp=this._handlePointerUp.bind(this),this._handleViewportClickCapture=this._handleViewportClickCapture.bind(this),this._resizeObserver=typeof ResizeObserver<"u"?new ResizeObserver(()=>{this._resizeFrame!==null&&cancelAnimationFrame(this._resizeFrame),this._resizeFrame=requestAnimationFrame(()=>{this._resizeFrame=null,!(this._dragState?.dragging||!this._slides.length)&&this.goTo(this._currentIndex,{behavior:"auto"})})}):null}get index(){return this._currentIndex}set index(t){let e=Number(t);this.setAttribute("index",Number.isFinite(e)?`${e}`:"0")}get snap(){return nt(this.getAttribute("snap"))!=="none"}set snap(t){if(t===!1||`${t}`.trim().toLowerCase()==="false"){this.setAttribute("snap","false");return}this.setAttribute("snap","true")}connectedCallback(){this._slotElement.addEventListener("slotchange",this._handleSlotChange),this._prevButton.addEventListener("click",this._handleClickPrev),this._nextButton.addEventListener("click",this._handleClickNext),this._viewportElement.addEventListener("keydown",this._handleViewportKeydown),this._viewportElement.addEventListener("scroll",this._handleViewportScroll,{passive:!0}),this._viewportElement.addEventListener("pointerdown",this._handleViewportPointerDown),this._viewportElement.addEventListener("click",this._handleViewportClickCapture,!0),this._resizeObserver?.observe(this._viewportElement),this._syncSlides(),this._updateLayoutStyles();let t=this.hasAttribute("index")?Number(this.getAttribute("index")):0;this.goTo(t,{behavior:"auto"})}disconnectedCallback(){this._slotElement.removeEventListener("slotchange",this._handleSlotChange),this._prevButton.removeEventListener("click",this._handleClickPrev),this._nextButton.removeEventListener("click",this._handleClickNext),this._viewportElement.removeEventListener("keydown",this._handleViewportKeydown),this._viewportElement.removeEventListener("scroll",this._handleViewportScroll),this._viewportElement.removeEventListener("pointerdown",this._handleViewportPointerDown),this._viewportElement.removeEventListener("click",this._handleViewportClickCapture,!0),this._removePointerListeners(),this._resizeObserver?.disconnect(),this._scrollFrame!==null&&(cancelAnimationFrame(this._scrollFrame),this._scrollFrame=null),this._resizeFrame!==null&&(cancelAnimationFrame(this._resizeFrame),this._resizeFrame=null),this._cancelScrollAnimation(),this._setDraggingState(!1),this._slides.forEach(t=>{this._restoreSlideStyles(t),t.removeAttribute("data-rtgl-carousel-active")})}attributeChangedCallback(t,e,i){if(e!==i){if(t==="index"){if(this._isReflectingIndex){this._isReflectingIndex=!1;return}this.goTo(Number(i),{behavior:"smooth"});return}if(t==="nav"||t==="pager"){this._updateControls();return}this._updateLayoutStyles()}}next(){this.goTo(this._currentIndex+1)}prev(){this.goTo(this._currentIndex-1)}_showsNavControls(){return st({value:this.getAttribute("nav"),defaultValue:!0})}_showsPagerControls(){return st({value:this.getAttribute("pager"),defaultValue:!1})}goTo(t,e={}){if(!this._slides.length){this._setCurrentIndex(0,{emit:!1,reflect:!0});return}let i=K({index:Number(t),maxIndex:this._slides.length-1}),n=this._slides[i],r=e.behavior??"smooth";n&&(this._scrollViewportTo(this._getSlideTargetScrollLeft(n),{behavior:r}),this._setCurrentIndex(i))}_handleSlotChange(){this._syncSlides(),this._updateLayoutStyles(),this.goTo(this._currentIndex,{behavior:"auto"})}_handleClickPrev(){this.prev()}_handleClickNext(){this.next()}_handleViewportKeydown(t){t.key==="ArrowRight"?(t.preventDefault(),this.next()):t.key==="ArrowLeft"&&(t.preventDefault(),this.prev())}_handleViewportScroll(){this._scrollAnimationFrame===null&&(this._dragState?.dragging||this._requestSyncFromScroll())}_handleViewportPointerDown(t){t.pointerType==="mouse"&&(t.button!==0||!this._slides.length||this._eventTargetsInteractiveElement(t)||(this._cancelScrollAnimation(),this._dragState={pointerId:t.pointerId,startX:t.clientX,startScrollLeft:this._viewportElement.scrollLeft,dragging:!1},this._viewportElement.setPointerCapture(t.pointerId),this._viewportElement.addEventListener("pointermove",this._handlePointerMove),this._viewportElement.addEventListener("pointerup",this._handlePointerUp),this._viewportElement.addEventListener("pointercancel",this._handlePointerUp)))}_handlePointerMove(t){if(!this._dragState||t.pointerId!==this._dragState.pointerId)return;let e=t.clientX-this._dragState.startX;!this._dragState.dragging&&Math.abs(e)>6&&(this._dragState.dragging=!0,this._setDraggingState(!0)),this._dragState.dragging&&(t.preventDefault(),this._viewportElement.scrollLeft=this._dragState.startScrollLeft-e)}_handlePointerUp(t){if(!this._dragState||t.pointerId!==this._dragState.pointerId)return;let e=this._dragState.dragging,i=e?this._findNearestSlideIndex():this._currentIndex;this._viewportElement.hasPointerCapture(t.pointerId)&&this._viewportElement.releasePointerCapture(t.pointerId),this._dragState=null,this._setDraggingState(!1),this._removePointerListeners(),e&&(this._clickSuppressUntil=performance.now()+250,this.snap?this.goTo(i,{behavior:"smooth"}):this._requestSyncFromScroll())}_handleViewportClickCapture(t){performance.now()<this._clickSuppressUntil&&(t.preventDefault(),t.stopPropagation())}_removePointerListeners(){this._viewportElement.removeEventListener("pointermove",this._handlePointerMove),this._viewportElement.removeEventListener("pointerup",this._handlePointerUp),this._viewportElement.removeEventListener("pointercancel",this._handlePointerUp)}_eventTargetsInteractiveElement(t){return t.composedPath().some(e=>e instanceof Element&&e.matches(Ie))}_requestSyncFromScroll(){this._scrollFrame!==null&&cancelAnimationFrame(this._scrollFrame),this._scrollFrame=requestAnimationFrame(()=>{this._scrollFrame=null;let t=this._findNearestSlideIndex();this._setCurrentIndex(t)})}_findNearestSlideIndex(){if(!this._slides.length)return 0;let t=this._viewportElement.scrollLeft,e=this._currentIndex,i=Number.POSITIVE_INFINITY;return this._slides.forEach((n,r)=>{let o=Math.abs(this._getSlideTargetScrollLeft(n)-t);o<i&&(e=r,i=o)}),e}_syncSlides(){let t=new Set(this._slides),e=this._slotElement.assignedElements({flatten:!0}).filter(i=>!i.hasAttribute("hidden"));t.forEach(i=>{e.includes(i)||(this._restoreSlideStyles(i),i.removeAttribute("data-rtgl-carousel-active"))}),this._slides=e,this._slides.forEach(i=>{this._slideStyleCache.has(i)||this._slideStyleCache.set(i,{flex:i.style.flex,width:i.style.width,minWidth:i.style.minWidth,maxWidth:i.style.maxWidth,boxSizing:i.style.boxSizing,scrollSnapAlign:i.style.scrollSnapAlign,scrollSnapStop:i.style.scrollSnapStop})}),this._buildPager(),this._setCurrentIndex(K({index:this._currentIndex,maxIndex:this._slides.length-1}),{emit:!1,reflect:!0})}_restoreSlideStyles(t){let e=this._slideStyleCache.get(t);e&&(t.style.flex=e.flex,t.style.width=e.width,t.style.minWidth=e.minWidth,t.style.maxWidth=e.maxWidth,t.style.boxSizing=e.boxSizing,t.style.scrollSnapAlign=e.scrollSnapAlign,t.style.scrollSnapStop=e.scrollSnapStop)}_updateLayoutStyles(){let t=Mt({slideWidth:this.getAttribute("sw")}),e=rt(this.getAttribute("sna"))??"center",i=nt(this.getAttribute("snap")),n=u(this.getAttribute("g"))??"var(--spacing-md)",r=u(this.getAttribute("spi"))??"0px",o=rt(this.getAttribute("sbh"))??"smooth",l=Wt({slideWidthCss:t,snapAlign:e});this.style.setProperty("--rtgl-carousel-slide-width",t),this.style.setProperty("--rtgl-carousel-gap",n),this.style.setProperty("--rtgl-carousel-scroll-snap-type",i),this.style.setProperty("--rtgl-carousel-scroll-padding-inline",r),this.style.setProperty("--rtgl-carousel-edge-padding-inline",l),this.style.setProperty("--rtgl-carousel-scroll-behavior",o),this.style.setProperty("--rtgl-carousel-snap-align",e),this._slides.forEach(a=>{a.style.flex=`0 0 ${t}`,a.style.width=t,a.style.minWidth="0",a.style.maxWidth="unset",a.style.boxSizing="border-box",a.style.scrollSnapAlign=e,a.style.scrollSnapStop="always"})}_setDraggingState(t){if(t){this.setAttribute("dragging",""),this._viewportElement.style.scrollSnapType="none",this._viewportElement.style.scrollBehavior="auto";return}this.removeAttribute("dragging"),this._viewportElement.style.scrollSnapType="",this._viewportElement.style.scrollBehavior=""}_scrollViewportTo(t,e={}){let i=e.behavior??"smooth",n=Math.min(Math.max(t,0),Math.max(this._viewportElement.scrollWidth-this._viewportElement.clientWidth,0));if(i!=="smooth"||Math.abs(n-this._viewportElement.scrollLeft)<1){this._cancelScrollAnimation(),this._viewportElement.scrollLeft=n;return}this._cancelScrollAnimation();let r=this._viewportElement.scrollLeft,o=n-r,l=Math.min(720,Math.max(420,Math.abs(o)*.35)),a=performance.now();this._setAnimatingScrollState(!0);let h=d=>{let y=d-a,x=Math.min(y/l,1),k=Te(x);if(this._viewportElement.scrollLeft=r+o*k,x<1){this._scrollAnimationFrame=requestAnimationFrame(h);return}this._viewportElement.scrollLeft=n,this._scrollAnimationFrame=null,this._setAnimatingScrollState(!1)};this._scrollAnimationFrame=requestAnimationFrame(h)}_cancelScrollAnimation(){this._scrollAnimationFrame!==null&&(cancelAnimationFrame(this._scrollAnimationFrame),this._scrollAnimationFrame=null,this._setAnimatingScrollState(!1))}_buildPager(){this._pagerElement.replaceChildren(),this._pagerButtons=[],this._slides.forEach((t,e)=>{let i=document.createElement("button");i.type="button",i.setAttribute("part","pager-button"),i.setAttribute("aria-label",`Go to slide ${e+1}`),i.setAttribute("title",`Go to slide ${e+1}`),i.addEventListener("click",()=>{this.goTo(e)}),this._pagerElement.appendChild(i),this._pagerButtons.push(i)}),this._updateControls()}_updateControls(){let t=this._slides.length>0,e=this._slides.length>1,i=this._currentIndex<=0,n=this._currentIndex>=this._slides.length-1,r=e&&this._showsNavControls(),o=e&&this._showsPagerControls();this._prevButton.hidden=!r,this._nextButton.hidden=!r,this._pagerElement.hidden=!o,this._controlsElement.hidden=!o,this._prevButton.disabled=!t||i,this._nextButton.disabled=!t||n,this._pagerButtons.forEach((l,a)=>{let h=a===this._currentIndex;l.classList.toggle("is-active",h),l.disabled=h,l.setAttribute("part",h?"pager-button pager-button-active":"pager-button"),h?l.setAttribute("aria-current","true"):l.removeAttribute("aria-current")})}_setCurrentIndex(t,e={}){let i=K({index:t,maxIndex:this._slides.length-1}),n=e.emit??!0,r=e.reflect??!0,o=this._currentIndex;this._currentIndex=i,this._slides.forEach((l,a)=>{a===i?l.setAttribute("data-rtgl-carousel-active","true"):l.removeAttribute("data-rtgl-carousel-active")}),this._updateControls(),r&&this.getAttribute("index")!==`${i}`&&(this._isReflectingIndex=!0,this.setAttribute("index",`${i}`)),n&&o!==i&&this.dispatchEvent(new CustomEvent("index-change",{detail:{index:i},bubbles:!0}))}_resolveScrollInlinePosition(){let t=rt(this.getAttribute("sna"))??"center";return t==="start"||t==="end"||t==="center"?t:"center"}_getSlideTargetScrollLeft(t){let e=this._viewportElement.getBoundingClientRect(),i=t.getBoundingClientRect();if(e.width<=0||i.width<=0)return this._viewportElement.scrollLeft;let n=getComputedStyle(this._viewportElement),r=this._viewportElement.scrollLeft,o=i.left-e.left+r;return Rt({slideLeft:o,slideWidth:i.width,viewportWidth:e.width,scrollPaddingInlineStart:this._parsePx(n.scrollPaddingInlineStart),scrollPaddingInlineEnd:this._parsePx(n.scrollPaddingInlineEnd),snapAlign:this._resolveScrollInlinePosition(),maxScrollLeft:this._viewportElement.scrollWidth-this._viewportElement.clientWidth})}_parsePx(t){let e=Number.parseFloat(t);return Number.isFinite(e)?e:0}_setAnimatingScrollState(t){if(t){this._viewportElement.style.scrollSnapType="none",this._viewportElement.style.scrollBehavior="auto";return}this._dragState?.dragging||(this._viewportElement.style.scrollSnapType="",this._viewportElement.style.scrollBehavior="")}},Nt=()=>ot;var ze={cur:{alias:"alias","all-scroll":"all-scroll",auto:"auto",cell:"cell","col-resize":"col-resize","context-menu":"context-menu",copy:"copy",crosshair:"crosshair",default:"default","e-resize":"e-resize","ew-resize":"ew-resize",grab:"grab",grabbing:"grabbing",help:"help",move:"move","n-resize":"n-resize","ne-resize":"ne-resize","nesw-resize":"nesw-resize","ns-resize":"ns-resize","nw-resize":"nw-resize","nwse-resize":"nwse-resize","no-drop":"no-drop",none:"none","not-allowed":"not-allowed",pointer:"pointer",progress:"progress","row-resize":"row-resize","s-resize":"s-resize","se-resize":"se-resize","sw-resize":"sw-resize",text:"text",url:"url","w-resize":"w-resize",wait:"wait","zoom-in":"zoom-in","zoom-out":"zoom-out"}},m=_(ze);var X=c`
|
|
452
452
|
:host([sh]:not([sv])) {
|
|
453
453
|
overflow-x: auto;
|
|
454
454
|
flex-wrap: nowrap;
|
|
@@ -528,7 +528,7 @@ var rettangoli=(()=>{var $=`
|
|
|
528
528
|
}
|
|
529
529
|
}
|
|
530
530
|
|
|
531
|
-
`;var N={none:"0",xs:"--border-width-xs",sm:"--border-width-sm",md:"--border-width-md",lg:"--border-width-lg",xl:"--border-width-xl"}
|
|
531
|
+
`;var N={none:"0",xs:"--border-width-xs",sm:"--border-width-sm",md:"--border-width-md",lg:"--border-width-lg",xl:"--border-width-xl"},Le={bgc:{pr:`
|
|
532
532
|
background-color: var(--primary);
|
|
533
533
|
`,se:`
|
|
534
534
|
background-color: var(--secondary);
|
|
@@ -570,7 +570,7 @@ var rettangoli=(()=>{var $=`
|
|
|
570
570
|
left: 0;
|
|
571
571
|
top: 0;
|
|
572
572
|
height: 100%;
|
|
573
|
-
`},shadow:{sm:"--shadow-sm",md:"--shadow-md",lg:"--shadow-lg"},pt:p,pr:p,pb:p,pl:p,p,ph:p,pv:p,g:p,gv:p,gh:p,bw:N,bwt:N,bwr:N,bwb:N,bwl:N,bc:{pr:"--primary",se:"--secondary",de:"--destructive",fg:"--foreground",bg:"--background",su:"--surface",mu:"--muted",ac:"--accent",bo:"--border",tr:"transparent"},br:{xs:"--border-radius-xs",sm:"--border-radius-sm",md:"--border-radius-md",lg:"--border-radius-lg",xl:"--border-radius-xl",f:"--border-radius-f"}},
|
|
573
|
+
`},shadow:{sm:"--shadow-sm",md:"--shadow-md",lg:"--shadow-lg"},pt:p,pr:p,pb:p,pl:p,p,ph:p,pv:p,g:p,gv:p,gh:p,bw:N,bwt:N,bwr:N,bwb:N,bwl:N,bc:{pr:"--primary",se:"--secondary",de:"--destructive",fg:"--foreground",bg:"--background",su:"--surface",mu:"--muted",ac:"--accent",bo:"--border",tr:"transparent"},br:{xs:"--border-radius-xs",sm:"--border-radius-sm",md:"--border-radius-md",lg:"--border-radius-lg",xl:"--border-radius-xl",f:"--border-radius-f"}},Y=_(Le);var Oe={mt:p,mr:p,mb:p,ml:p,m:p,mh:p,mv:p},f=_(Oe);var R=c`
|
|
574
574
|
a, a:link, a:visited, a:hover, a:active {
|
|
575
575
|
color: inherit;
|
|
576
576
|
text-decoration: none;
|
|
@@ -580,7 +580,7 @@ var rettangoli=(()=>{var $=`
|
|
|
580
580
|
margin: 0;
|
|
581
581
|
font: inherit;
|
|
582
582
|
}
|
|
583
|
-
`;var
|
|
583
|
+
`;var Be=s=>{if(s==null)return null;let t=s.trim();return t===""?null:/^[1-9]\d*$/.test(t)?`repeat(${t}, minmax(0, 1fr))`:t},lt=class s extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){s.styleSheet||(s.styleSheet=new CSSStyleSheet,s.styleSheet.replaceSync(c`
|
|
584
584
|
slot {
|
|
585
585
|
display: contents;
|
|
586
586
|
}
|
|
@@ -594,13 +594,13 @@ var rettangoli=(()=>{var $=`
|
|
|
594
594
|
border-color: var(--border);
|
|
595
595
|
}
|
|
596
596
|
|
|
597
|
-
${
|
|
597
|
+
${X}
|
|
598
598
|
${f}
|
|
599
599
|
${m}
|
|
600
|
-
${
|
|
601
|
-
${
|
|
602
|
-
${
|
|
603
|
-
`))}constructor(){super(),
|
|
600
|
+
${Y}
|
|
601
|
+
${R}
|
|
602
|
+
${L}
|
|
603
|
+
`))}constructor(){super(),s.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[s.styleSheet],this._styleElement=document.createElement("style"),this._slotElement=document.createElement("slot"),this._linkElement=null,this.shadow.appendChild(this._styleElement),this._updateDOM()}static get observedAttributes(){return["href","new-tab","rel",...g([...C,"cols","op","wh","w","h","hide","show","sh","sv","z","overflow"])]}_styles=b();_lastStyleString="";_updateDOM(){let t=this.getAttribute("href"),e=this.hasAttribute("new-tab"),i=this.getAttribute("rel");this._linkElement=O({shadowRoot:this.shadow,slotElement:this._slotElement,linkElement:this._linkElement,href:t,newTab:e,rel:i})}connectedCallback(){this.updateStyles()}updateStyles(){this._styles=b(),S.forEach(e=>{let i=k=>`${e==="default"?"":`${e}-`}${k}`,n=this.getAttribute(i("wh")),r=u(n===null?this.getAttribute(i("w")):n),o=u(n===null?this.getAttribute(i("h")):n),l=Be(this.getAttribute(i("cols"))),a=this.getAttribute(i("op")),h=this.getAttribute(i("z"));l!==null&&(this._styles[e]["grid-template-columns"]=l),h!==null&&(this._styles[e]["z-index"]=h),a!==null&&(this._styles[e].opacity=a),v({styleBucket:this._styles[e],axis:"width",dimension:r,fillValue:"var(--width-stretch)",allowFlexGrow:!0}),v({styleBucket:this._styles[e],axis:"height",dimension:o,fillValue:"100%",allowFlexGrow:!0}),this.hasAttribute(i("hide"))&&(this._styles[e].display="none"),this.hasAttribute(i("show"))&&(this._styles[e].display="grid");let d=this.hasAttribute(i("sh")),y=this.hasAttribute(i("sv")),x=this.getAttribute(i("overflow"));d&&y?(this._styles[e].overflow="auto",this._styles[e]["scrollbar-gutter"]="stable"):d?(this._styles[e]["overflow-x"]="auto",this._styles[e]["scrollbar-gutter"]="stable"):y&&(this._styles[e]["overflow-y"]="auto",this._styles[e]["scrollbar-gutter"]="stable"),x==="hidden"&&(this._styles[e].overflow="hidden")});let t=w(this._styles);t!==this._lastStyleString&&(this._styleElement.textContent=t,this._lastStyleString=t)}attributeChangedCallback(t,e,i){if(t==="href"||t==="new-tab"||t==="rel"){this._updateDOM();return}e!==i&&this.updateStyles()}},Dt=({render:s,html:t})=>lt;var Ft=c`
|
|
604
604
|
|
|
605
605
|
:host([d="h"]) {
|
|
606
606
|
flex-direction: row;
|
|
@@ -671,7 +671,7 @@ var rettangoli=(()=>{var $=`
|
|
|
671
671
|
justify-content: center;
|
|
672
672
|
}
|
|
673
673
|
}
|
|
674
|
-
`;var Q=
|
|
674
|
+
`;var Q=s=>{if(s==null)return null;let t=`${s}`.trim();return t.length>0?t:null},at=class s extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){s.styleSheet||(s.styleSheet=new CSSStyleSheet,s.styleSheet.replaceSync(c`
|
|
675
675
|
slot {
|
|
676
676
|
display: contents;
|
|
677
677
|
}
|
|
@@ -687,14 +687,14 @@ var rettangoli=(()=>{var $=`
|
|
|
687
687
|
}
|
|
688
688
|
|
|
689
689
|
|
|
690
|
-
${
|
|
691
|
-
${
|
|
690
|
+
${X}
|
|
691
|
+
${Ft}
|
|
692
692
|
${f}
|
|
693
693
|
${m}
|
|
694
|
-
${
|
|
695
|
-
${
|
|
696
|
-
${
|
|
697
|
-
`))}constructor(){super(),
|
|
694
|
+
${Y}
|
|
695
|
+
${R}
|
|
696
|
+
${L}
|
|
697
|
+
`))}constructor(){super(),s.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[s.styleSheet],this._styleElement=document.createElement("style"),this._slotElement=document.createElement("slot"),this._linkElement=null,this.shadow.appendChild(this._styleElement),this._updateDOM()}static get observedAttributes(){return["href","new-tab","rel",...g([...C,"op","wh","w","h","ar","bgi","bgs","bgp","bgr","hsb","hide","show","sh","sv","z","d","ah","av","wrap","no-wrap","overflow","stretch"])]}_styles=b();_lastStyleString="";_updateDOM(){let t=this.getAttribute("href"),e=this.hasAttribute("new-tab"),i=this.getAttribute("rel");this._linkElement=O({shadowRoot:this.shadow,slotElement:this._slotElement,linkElement:this._linkElement,href:t,newTab:e,rel:i})}connectedCallback(){this.updateStyles()}updateStyles(){this._styles=b(),S.forEach(e=>{let i=Tt=>`${e==="default"?"":`${e}-`}${Tt}`,n=this.getAttribute(i("wh")),r=u(n===null?this.getAttribute(i("w")):n),o=u(n===null?this.getAttribute(i("h")):n),l=this.getAttribute(i("op")),a=this.getAttribute(i("z")),h=P(this.getAttribute(i("ar"))),d=Q(this.getAttribute(i("bgi"))),y=Q(this.getAttribute(i("bgs"))),x=Q(this.getAttribute(i("bgp"))),k=Q(this.getAttribute(i("bgr")));a!==null&&(this._styles[e]["z-index"]=a),l!==null&&(this._styles[e].opacity=l),h!==void 0&&(this._styles[e]["aspect-ratio"]=h),d!==null&&(this._styles[e]["background-image"]=d),y!==null&&(this._styles[e]["background-size"]=y),x!==null&&(this._styles[e]["background-position"]=x),k!==null&&(this._styles[e]["background-repeat"]=k),v({styleBucket:this._styles[e],axis:"width",dimension:r,fillValue:"var(--width-stretch)",allowFlexGrow:!0}),v({styleBucket:this._styles[e],axis:"height",dimension:o,fillValue:"100%",allowFlexGrow:!0}),this.hasAttribute(i("hide"))&&(this._styles[e].display="none"),this.hasAttribute(i("show"))&&(this._styles[e].display="flex");let T=this.getAttribute(i("d")),A=this.getAttribute(i("ah")),E=this.getAttribute(i("av")),I=B({element:this,size:e,attr:"d"});T==="h"?this._styles[e]["flex-direction"]="row":T==="v"?this._styles[e]["flex-direction"]="column":e==="default"&&!T&&["sm","md","lg","xl"].some(ge=>this.hasAttribute(`${ge}-d`))&&(this._styles[e]["flex-direction"]="column");let q=I==="h",J=I==="v"||!I;q&&(A==="c"?this._styles[e]["justify-content"]="center":A==="e"?this._styles[e]["justify-content"]="flex-end":A==="s"&&(this._styles[e]["justify-content"]="flex-start"),E==="c"?(this._styles[e]["align-items"]="center",this._styles[e]["align-content"]="center"):E==="e"?(this._styles[e]["align-items"]="flex-end",this._styles[e]["align-content"]="flex-end"):E==="s"&&(this._styles[e]["align-items"]="flex-start")),J&&(A!==null||E!==null)&&(A==="c"?this._styles[e]["align-items"]="center":A==="e"?this._styles[e]["align-items"]="flex-end":A==="s"&&(this._styles[e]["align-items"]="flex-start"),E==="c"?this._styles[e]["justify-content"]="center":E==="e"?this._styles[e]["justify-content"]="flex-end":E==="s"&&(this._styles[e]["justify-content"]="flex-start"));let ce=this.hasAttribute(i("wrap")),ue=this.hasAttribute(i("no-wrap"));ce&&(this._styles[e]["flex-wrap"]="wrap"),ue&&(this._styles[e]["flex-wrap"]="nowrap"),this.hasAttribute(i("stretch"))&&(this._styles[e]["align-self"]="stretch");let kt=this.hasAttribute(i("sh")),It=this.hasAttribute(i("sv")),pe=this.hasAttribute(i("hsb")),me=this.getAttribute(i("overflow"));kt&&It?(this._styles[e].overflow="auto",this._styles[e]["scrollbar-gutter"]="stable",this._styles[e]["flex-wrap"]="nowrap"):kt?(this._styles[e]["overflow-x"]="auto",this._styles[e]["scrollbar-gutter"]="stable",this._styles[e]["flex-wrap"]="nowrap"):It&&(this._styles[e]["overflow-y"]="auto",this._styles[e]["scrollbar-gutter"]="stable",this._styles[e]["flex-wrap"]="nowrap"),me==="hidden"&&(this._styles[e].overflow="hidden",this._styles[e]["flex-wrap"]="nowrap"),pe&&(this._styles[e]["-ms-overflow-style"]="none",this._styles[e]["scrollbar-gutter"]="auto",this._styles[e]["scrollbar-width"]="none")});let t=w(this._styles);t!==this._lastStyleString&&(this._styleElement.textContent=t,this._lastStyleString=t)}attributeChangedCallback(t,e,i){if(t==="href"||t==="new-tab"||t==="rel"){this._updateDOM();return}e!==i&&this.updateStyles()}},Vt=({render:s,html:t})=>at;var $e={ta:{s:"text-align: start;",c:"text-align: center;",e:"text-align: end;",j:"text-align: justify;"},s:{h1:`
|
|
698
698
|
font-size: var(--h1-font-size);
|
|
699
699
|
font-weight: var(--h1-font-weight);
|
|
700
700
|
line-height: var(--h1-line-height);
|
|
@@ -734,7 +734,7 @@ var rettangoli=(()=>{var $=`
|
|
|
734
734
|
font-weight: var(--xs-font-weight);
|
|
735
735
|
line-height: var(--xs-line-height);
|
|
736
736
|
letter-spacing: var(--xs-letter-spacing);
|
|
737
|
-
`}},Ut=_(
|
|
737
|
+
`}},Ut=_($e);var Re={c:{pr:"color: var(--primary);",se:"color: var(--secondary);",de:"color: var(--destructive);",fg:"color: var(--foreground);",bg:"color: var(--background);",mu:"color: var(--muted-foreground);",ac:"color: var(--accent);",bo:"color: var(--border);",tr:"color: transparent;","pr-fg":"color: var(--primary-foreground);","se-fg":"color: var(--secondary-foreground);","de-fg":"color: var(--destructive-foreground);","mu-fg":"color: var(--muted-foreground);","ac-fg":"color: var(--accent-foreground);"}},Z=_(Re);var ht=class s extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){s.styleSheet||(s.styleSheet=new CSSStyleSheet,s.styleSheet.replaceSync(c`
|
|
738
738
|
:host {
|
|
739
739
|
display: block;
|
|
740
740
|
font-size: var(--md-font-size);
|
|
@@ -753,12 +753,12 @@ var rettangoli=(()=>{var $=`
|
|
|
753
753
|
text-decoration: var(--anchor-text-decoration-hover);
|
|
754
754
|
color: var(--anchor-color-hover);
|
|
755
755
|
}
|
|
756
|
-
${
|
|
756
|
+
${L}
|
|
757
757
|
${Ut}
|
|
758
758
|
${Z}
|
|
759
759
|
${f}
|
|
760
760
|
${m}
|
|
761
|
-
`))}constructor(){super(),
|
|
761
|
+
`))}constructor(){super(),s.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[s.styleSheet],this._slotElement=document.createElement("slot"),this._linkElement=null,this._updateDOM()}static get observedAttributes(){return["key","w","ellipsis","href","new-tab","rel","break-long-tokens"]}connectedCallback(){this._updateStyling(),this._updateDOM()}attributeChangedCallback(t,e,i){t==="href"||t==="new-tab"||t==="rel"?this._updateDOM():this._updateStyling()}_updateStyling(){let t=u(this.getAttribute("w")),e=this.hasAttribute("ellipsis"),i=this.hasAttribute("break-long-tokens");e?(this.style.overflow="hidden",this.style.textOverflow="ellipsis",this.style.whiteSpace="nowrap",this.style.overflowWrap="",this.style.wordBreak=""):(this.style.overflow="",this.style.textOverflow="",this.style.whiteSpace="",this.style.overflowWrap=i?"anywhere":"",this.style.wordBreak=i?"break-word":""),M({style:this.style,width:t,flexMinWidth:"0"})}_updateDOM(){let t=this.getAttribute("href"),e=this.hasAttribute("new-tab"),i=this.getAttribute("rel");this._linkElement=O({shadowRoot:this.shadow,slotElement:this._slotElement,linkElement:this._linkElement,href:t,newTab:e,rel:i})}},jt=({render:s,html:t})=>ht;var D={none:"0",xs:"--border-width-xs",sm:"--border-width-sm",md:"--border-width-md",lg:"--border-width-lg",xl:"--border-width-xl"},We={bgc:{pr:"background-color: var(--primary);",se:"background-color: var(--secondary);",de:"background-color: var(--destructive);",fg:"background-color: var(--foreground);",bg:"background-color: var(--background);",su:"background-color: var(--surface);",mu:"background-color: var(--muted);",ac:"background-color: var(--accent);",bo:"background-color: var(--border);"},pos:{rel:"relative",abs:"absolute",fix:"fixed"},shadow:{sm:"--shadow-sm",md:"--shadow-md",lg:"--shadow-lg"},bw:D,bwt:D,bwr:D,bwb:D,bwl:D,bc:{pr:"--primary",se:"--secondary",de:"--destructive",fg:"--foreground",bg:"--background",su:"--surface",mu:"--muted",ac:"--accent",bo:"--border",tr:"transparent"},br:{xs:"--border-radius-xs",sm:"--border-radius-sm",md:"--border-radius-md",lg:"--border-radius-lg",xl:"--border-radius-xl",f:"--border-radius-f"}},Ht=s=>_(We,{},s);var Me={mt:p,mr:p,mb:p,ml:p,m:p,mh:p,mv:p},qt=s=>_(Me,{},s);var dt=class s extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){s.styleSheet||(s.styleSheet=new CSSStyleSheet,s.styleSheet.replaceSync(c`
|
|
762
762
|
:host {
|
|
763
763
|
display: contents;
|
|
764
764
|
}
|
|
@@ -785,7 +785,7 @@ var rettangoli=(()=>{var $=`
|
|
|
785
785
|
height: auto;
|
|
786
786
|
}
|
|
787
787
|
|
|
788
|
-
${
|
|
788
|
+
${R}
|
|
789
789
|
|
|
790
790
|
a {
|
|
791
791
|
display: block;
|
|
@@ -793,10 +793,10 @@ var rettangoli=(()=>{var $=`
|
|
|
793
793
|
width: 100%;
|
|
794
794
|
}
|
|
795
795
|
|
|
796
|
-
${qt("img, a")}
|
|
797
796
|
${Ht("img, a")}
|
|
797
|
+
${qt("img, a")}
|
|
798
798
|
${m}
|
|
799
|
-
`))}constructor(){super(),
|
|
799
|
+
`))}constructor(){super(),s.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[s.styleSheet],this._styleElement=document.createElement("style"),this._imgElement=document.createElement("img"),this._linkElement=null,this.shadow.appendChild(this._styleElement),this._updateDOM()}static get observedAttributes(){return g([...C,"key","src","alt","href","new-tab","rel","wh","w","h","ar","hide","show","op","z","of"])}_styles=b();_lastStyleString="";_updateDOM(){let t=this.getAttribute("href"),e=this.hasAttribute("new-tab"),i=this.getAttribute("rel");this._linkElement=tt({shadowRoot:this.shadow,childElement:this._imgElement,linkElement:this._linkElement,href:t,newTab:e,rel:i})}connectedCallback(){this._updateImageAttributes(),this.updateStyles()}attributeChangedCallback(t,e,i){if(t==="href"||t==="new-tab"||t==="rel"){this._updateDOM();return}if(t==="src"||t==="alt"){this._updateImageAttributes();return}e!==i&&this.updateStyles()}updateStyles(){this._styles=b(),S.forEach(e=>{let i=d=>`${e==="default"?"":`${e}-`}${d}`,n=this.getAttribute(i("wh")),r=u(n===null?this.getAttribute(i("w")):n),o=u(n===null?this.getAttribute(i("h")):n),l=this.getAttribute(i("op")),a=this.getAttribute(i("z")),h=P(this.getAttribute(i("ar")));a!==null&&(this._styles[e]["z-index"]=a),l!==null&&(this._styles[e].opacity=l),h!==void 0&&(this._styles[e]["aspect-ratio"]=h),v({styleBucket:this._styles[e],axis:"width",dimension:r,fillValue:"var(--width-stretch)"}),v({styleBucket:this._styles[e],axis:"height",dimension:o,fillValue:"100%"}),this.hasAttribute(i("hide"))&&(this._styles[e].display="none !important"),this.hasAttribute(i("show"))&&(this._styles[e].display="block !important")});let t=w(this._styles,"img, a");t!==this._lastStyleString&&(this._styleElement.textContent=t,this._lastStyleString=t)}_updateImageAttributes(){let t=this.getAttribute("src"),e=this.getAttribute("alt");t!==null?this._imgElement.setAttribute("src",t):this._imgElement.removeAttribute("src"),e!==null?this._imgElement.setAttribute("alt",e):this._imgElement.removeAttribute("alt")}},Gt=({render:s,html:t})=>dt;var Pe={s:{sm:`
|
|
800
800
|
height: 20px;
|
|
801
801
|
padding-left: 8px;
|
|
802
802
|
padding-right: 8px;
|
|
@@ -849,7 +849,7 @@ var rettangoli=(()=>{var $=`
|
|
|
849
849
|
background-color: var(--destructive);
|
|
850
850
|
color: var(--destructive-foreground);
|
|
851
851
|
border-color: transparent;
|
|
852
|
-
`}},
|
|
852
|
+
`}},Kt=_(Pe,{},".surface");var ct=class s extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){s.styleSheet||(s.styleSheet=new CSSStyleSheet,s.styleSheet.replaceSync(c`
|
|
853
853
|
:host {
|
|
854
854
|
display: inline-flex;
|
|
855
855
|
min-width: 0;
|
|
@@ -945,13 +945,13 @@ var rettangoli=(()=>{var $=`
|
|
|
945
945
|
opacity: 1;
|
|
946
946
|
}
|
|
947
947
|
|
|
948
|
-
${
|
|
948
|
+
${Kt}
|
|
949
949
|
:host .surface {
|
|
950
950
|
border-radius: var(--tag-border-radius) !important;
|
|
951
951
|
}
|
|
952
952
|
${f}
|
|
953
953
|
${m}
|
|
954
|
-
`))}constructor(){super(),
|
|
954
|
+
`))}constructor(){super(),s.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[s.styleSheet],this._surfaceElement=document.createElement("span"),this._surfaceElement.className="surface",this._surfaceElement.setAttribute("part","surface"),this._labelElement=document.createElement("span"),this._labelElement.className="label",this._labelElement.setAttribute("part","label"),this._slotElement=document.createElement("slot"),this._labelElement.appendChild(this._slotElement),this._surfaceElement.appendChild(this._labelElement),this.shadow.appendChild(this._surfaceElement),this._prefixIcon=null,this._suffixIcon=null,this._removeButton=null,this._onRemoveClick=this._onRemoveClick.bind(this)}static get observedAttributes(){return["key","pre","suf","removable","w"]}connectedCallback(){this._updateWidth(),this._updateStructure()}attributeChangedCallback(t,e,i){if(t==="w"){this._updateWidth();return}e!==i&&this._updateStructure()}_updateWidth(){let t=u(this.getAttribute("w"));M({style:this.style,width:t,flexMinWidth:"0"})}_createIconElement(t,e){let i=document.createElement("rtgl-svg");return i.className=t,i.setAttribute("part",e),i.setAttribute("aria-hidden","true"),i}_syncIcon({iconName:t,element:e,className:i,part:n,insertBeforeElement:r}){if(!t)return e&&e.remove(),null;let o=e||this._createIconElement(i,n);return o.setAttribute("svg",t),o.parentNode!==this._surfaceElement?this._surfaceElement.insertBefore(o,r):o.nextSibling!==r&&this._surfaceElement.insertBefore(o,r),o}_syncRemoveButton(){if(!this.hasAttribute("removable")){this._removeButton&&(this._removeButton.removeEventListener("click",this._onRemoveClick),this._removeButton.remove(),this._removeButton=null);return}this._removeButton||(this._removeButton=document.createElement("button"),this._removeButton.type="button",this._removeButton.className="removeButton",this._removeButton.setAttribute("part","remove-button"),this._removeButton.setAttribute("aria-label","Remove tag"),this._removeButton.addEventListener("click",this._onRemoveClick),this._surfaceElement.appendChild(this._removeButton))}_updateStructure(){this._prefixIcon=this._syncIcon({iconName:this.getAttribute("pre"),element:this._prefixIcon,className:"prefixIcon",part:"prefix-icon",insertBeforeElement:this._labelElement}),this._syncRemoveButton(),this._suffixIcon=this._syncIcon({iconName:this.getAttribute("suf"),element:this._suffixIcon,className:"suffixIcon",part:"suffix-icon",insertBeforeElement:this._removeButton})}_onRemoveClick(t){t.preventDefault(),t.stopPropagation(),this.dispatchEvent(new CustomEvent("remove-click",{detail:{value:this.getAttribute("value")},bubbles:!0,composed:!0}))}},Xt=({render:s,html:t})=>ct;var Yt=c`
|
|
955
955
|
:host([pt="xs"]) svg {
|
|
956
956
|
padding-top: var(--spacing-xs);
|
|
957
957
|
}
|
|
@@ -1067,7 +1067,7 @@ var rettangoli=(()=>{var $=`
|
|
|
1067
1067
|
padding-top: var(--spacing-xl);
|
|
1068
1068
|
padding-bottom: var(--spacing-xl);
|
|
1069
1069
|
}
|
|
1070
|
-
`;var ut=class
|
|
1070
|
+
`;var ut=class s extends HTMLElement{static styleSheet=null;static _icons={};static initializeStyleSheet(){s.styleSheet||(s.styleSheet=new CSSStyleSheet,s.styleSheet.replaceSync(c`
|
|
1071
1071
|
:host {
|
|
1072
1072
|
display: contents;
|
|
1073
1073
|
color: var(--foreground);
|
|
@@ -1093,10 +1093,10 @@ var rettangoli=(()=>{var $=`
|
|
|
1093
1093
|
}
|
|
1094
1094
|
|
|
1095
1095
|
${Z}
|
|
1096
|
-
${
|
|
1096
|
+
${Yt}
|
|
1097
1097
|
${f}
|
|
1098
1098
|
${m}
|
|
1099
|
-
`))}constructor(){super(),
|
|
1099
|
+
`))}constructor(){super(),s.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[s.styleSheet]}static get observedAttributes(){return["key","svg","w","h","wh"]}static get icons(){return s._icons}static addIcon(t,e){s._icons[t]=e}connectedCallback(){this._updateSizing(),this._render()}attributeChangedCallback(t,e,i){this._updateSizing(),this._render()}_updateSizing(){let t=this.getAttribute("wh"),e=u(t===null?this.getAttribute("w"):t),i=u(t===null?this.getAttribute("h"):t);e!=null?this.style.width=e:this.style.width="",i!=null?this.style.height=i:this.style.height=""}getBoundingClientRect(){let t=this.shadow.querySelector("svg");return t?t.getBoundingClientRect():super.getBoundingClientRect()}_render(){try{let t=this.getAttribute("svg"),e=s._icons[t]||(window.rtglIcons||{})[t];if(e){this.shadow.innerHTML=e;return}}catch(t){console.log("error in rtgl-svg render",t)}this.shadow.innerHTML=""}},Qt=({render:s,html:t})=>ut;var Ne=["mt","mr","mb","ml","m","mh","mv","cur"],pt=class s extends HTMLElement{static styleSheet=null;static inputSpecificAttributes=["type","disabled","min","max","step","s"];static initializeStyleSheet(){s.styleSheet||(s.styleSheet=new CSSStyleSheet,s.styleSheet.replaceSync(c`
|
|
1100
1100
|
:host {
|
|
1101
1101
|
display: contents;
|
|
1102
1102
|
}
|
|
@@ -1160,7 +1160,7 @@ var rettangoli=(()=>{var $=`
|
|
|
1160
1160
|
}
|
|
1161
1161
|
${f}
|
|
1162
1162
|
${m}
|
|
1163
|
-
`))}constructor(){super(),
|
|
1163
|
+
`))}constructor(){super(),s.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[s.styleSheet],this._styles=b(),this._lastStyleString="",this._inputElement=document.createElement("input"),this._styleElement=document.createElement("style"),this.shadow.appendChild(this._styleElement),this.shadow.appendChild(this._inputElement),this._inputElement.addEventListener("input",this._onInput),this._inputElement.addEventListener("change",this._onChange)}static get observedAttributes(){return["key","type","placeholder","disabled","value","min","max","step","s",...g([...Ne,"wh","w","h","hide","show","op","z"])]}get value(){return this._inputElement.value}set value(t){this._inputElement.value=t}focus(){this._inputElement.focus()}_onInput=()=>{this.dispatchEvent(new CustomEvent("value-input",{detail:{value:this._inputElement.value},bubbles:!0}))};_onChange=()=>{this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this._inputElement.value},bubbles:!0}))};attributeChangedCallback(t,e,i){if(e!==i){if(t==="key"){this._syncValueAttribute();return}if(t==="value"){this._syncValueAttribute();return}if(t==="placeholder"){this._syncPlaceholderAttribute();return}if(s.inputSpecificAttributes.includes(t)){this._updateInputAttributes();return}this.updateStyles()}}updateStyles(){this._styles=b(),S.forEach(e=>{let i=h=>`${e==="default"?"":`${e}-`}${h}`,n=this.getAttribute(i("wh")),r=u(n===null?this.getAttribute(i("w")):n),o=u(n===null?this.getAttribute(i("h")):n),l=this.getAttribute(i("op")),a=this.getAttribute(i("z"));a!==null&&(this._styles[e]["z-index"]=a),l!==null&&(this._styles[e].opacity=l),v({styleBucket:this._styles[e],axis:"width",dimension:r,fillValue:"var(--width-stretch)"}),v({styleBucket:this._styles[e],axis:"height",dimension:o,fillValue:"100%"}),this.hasAttribute(i("hide"))&&(this._styles[e].display="none"),this.hasAttribute(i("show"))&&(this._styles[e].display="block")});let t=w(this._styles,"input");t!==this._lastStyleString&&(this._styleElement.textContent=t,this._lastStyleString=t)}_setOrRemoveInputAttribute(t,e){if(e==null||e==="null"){this._inputElement.removeAttribute(t);return}this._inputElement.setAttribute(t,e)}_syncValueAttribute(){this._inputElement.value=this.getAttribute("value")??""}_syncPlaceholderAttribute(){this._setOrRemoveInputAttribute("placeholder",this.getAttribute("placeholder"))}_updateInputAttributes(){let t=this.getAttribute("type"),i=new Set(["text","password","date","time","datetime-local"]).has(t)?t:"text",n=this.getAttribute("min"),r=this.getAttribute("max"),o=this.getAttribute("step"),l=this.hasAttribute("disabled");this._setOrRemoveInputAttribute("type",i),this._setOrRemoveInputAttribute("min",n),this._setOrRemoveInputAttribute("max",r),this._setOrRemoveInputAttribute("step",o),l?this._inputElement.setAttribute("disabled",""):this._inputElement.removeAttribute("disabled")}connectedCallback(){this._updateInputAttributes(),this._syncValueAttribute(),this._syncPlaceholderAttribute(),this.updateStyles()}},z=({render:s,html:t})=>pt;var De=z({}),F="date",mt=class extends De{connectedCallback(){this.getAttribute("type")!==F&&super.setAttribute("type",F),super.connectedCallback&&super.connectedCallback()}attributeChangedCallback(t,e,i){if(t==="type"&&i!==F){this.getAttribute("type")!==F&&super.setAttribute("type",F);return}super.attributeChangedCallback&&super.attributeChangedCallback(t,e,i)}},Zt=({render:s,html:t})=>mt;var Fe=z({}),V="time",gt=class extends Fe{connectedCallback(){this.getAttribute("type")!==V&&super.setAttribute("type",V),super.connectedCallback&&super.connectedCallback()}attributeChangedCallback(t,e,i){if(t==="type"&&i!==V){this.getAttribute("type")!==V&&super.setAttribute("type",V);return}super.attributeChangedCallback&&super.attributeChangedCallback(t,e,i)}},Jt=({render:s,html:t})=>gt;var Ve=z({}),U="datetime-local",ft=class extends Ve{connectedCallback(){this.getAttribute("type")!==U&&super.setAttribute("type",U),super.connectedCallback&&super.connectedCallback()}attributeChangedCallback(t,e,i){if(t==="type"&&i!==U){this.getAttribute("type")!==U&&super.setAttribute("type",U);return}super.attributeChangedCallback&&super.attributeChangedCallback(t,e,i)}},te=({render:s,html:t})=>ft;var Ue=["mt","mr","mb","ml","m","mh","mv","cur"],bt=class s extends HTMLElement{static styleSheet=null;static inputSpecificAttributes=["disabled","step","min","max","s"];static initializeStyleSheet(){s.styleSheet||(s.styleSheet=new CSSStyleSheet,s.styleSheet.replaceSync(c`
|
|
1164
1164
|
:host {
|
|
1165
1165
|
display: contents;
|
|
1166
1166
|
}
|
|
@@ -1195,7 +1195,7 @@ var rettangoli=(()=>{var $=`
|
|
|
1195
1195
|
}
|
|
1196
1196
|
${f}
|
|
1197
1197
|
${m}
|
|
1198
|
-
`))}constructor(){super(),
|
|
1198
|
+
`))}constructor(){super(),s.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[s.styleSheet],this._styles=b(),this._lastStyleString="",this._inputElement=document.createElement("input"),this._styleElement=document.createElement("style"),this.shadow.appendChild(this._styleElement),this.shadow.appendChild(this._inputElement),this._inputElement.addEventListener("input",this._onInput),this._inputElement.addEventListener("change",this._onChange)}static get observedAttributes(){return["key","placeholder","disabled","value","step","min","max","s",...g([...Ue,"wh","w","h","hide","show","op","z"])]}get value(){return this._inputElement.value}set value(t){this._inputElement.value=t}focus(){this._inputElement.focus()}_emitValueEvent=(t,{commit:e=!1}={})=>{if(this._inputElement.value.trim()===""){if(this._inputElement.validity.badInput)return;this.dispatchEvent(new CustomEvent(t,{detail:{value:null},bubbles:!0}));return}let n=this._inputElement.valueAsNumber;if(!Number.isNaN(n)){let r=e?this._clampValueToBounds(n):n;e&&(this._inputElement.value=r.toString()),this.dispatchEvent(new CustomEvent(t,{detail:{value:r},bubbles:!0}))}};_onInput=()=>{this._emitValueEvent("value-input")};_onChange=()=>{this._emitValueEvent("value-change",{commit:!0})};attributeChangedCallback(t,e,i){if(e!==i){if(t==="key"){this._syncValueAttribute();return}if(t==="value"){this._syncValueAttribute();return}if(t==="placeholder"){this._syncPlaceholderAttribute();return}if(s.inputSpecificAttributes.includes(t)){this._updateInputAttributes(),(t==="min"||t==="max")&&this._syncValueAttribute();return}this.updateStyles()}}updateStyles(){this._styles=b(),S.forEach(e=>{let i=h=>`${e==="default"?"":`${e}-`}${h}`,n=this.getAttribute(i("wh")),r=u(n===null?this.getAttribute(i("w")):n),o=u(n===null?this.getAttribute(i("h")):n),l=this.getAttribute(i("op")),a=this.getAttribute(i("z"));a!==null&&(this._styles[e]["z-index"]=a),l!==null&&(this._styles[e].opacity=l),v({styleBucket:this._styles[e],axis:"width",dimension:r,fillValue:"var(--width-stretch)"}),v({styleBucket:this._styles[e],axis:"height",dimension:o,fillValue:"100%"}),this.hasAttribute(i("hide"))&&(this._styles[e].display="none"),this.hasAttribute(i("show"))&&(this._styles[e].display="block")});let t=w(this._styles,"input");t!==this._lastStyleString&&(this._styleElement.textContent=t,this._lastStyleString=t)}_setOrRemoveInputAttribute(t,e){if(e==null||e==="null"){this._inputElement.removeAttribute(t);return}this._inputElement.setAttribute(t,e)}_clampValueToBounds(t){let e=t,i=this.getAttribute("min");if(i!==null){let r=parseFloat(i);isNaN(r)||(e=Math.max(e,r))}let n=this.getAttribute("max");if(n!==null){let r=parseFloat(n);isNaN(r)||(e=Math.min(e,r))}return e}_syncValueAttribute(){let t=this.getAttribute("value");if(t==null||t===""){this._inputElement.value="";return}let e=parseFloat(t);if(isNaN(e)){this._inputElement.value="";return}let i=this._clampValueToBounds(e);this._inputElement.value=i.toString()}_syncPlaceholderAttribute(){this._setOrRemoveInputAttribute("placeholder",this.getAttribute("placeholder"))}_updateInputAttributes(){let t=this.getAttribute("step"),e=this.getAttribute("min"),i=this.getAttribute("max"),n=this.hasAttribute("disabled");this._inputElement.setAttribute("type","number"),this._setOrRemoveInputAttribute("step",t),this._setOrRemoveInputAttribute("min",e),this._setOrRemoveInputAttribute("max",i),n?this._inputElement.setAttribute("disabled",""):this._inputElement.removeAttribute("disabled")}connectedCallback(){this._updateInputAttributes(),this._syncValueAttribute(),this._syncPlaceholderAttribute(),this.updateStyles()}},ee=({render:s,html:t})=>bt;var vt=class s extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){s.styleSheet||(s.styleSheet=new CSSStyleSheet,s.styleSheet.replaceSync(c`
|
|
1199
1199
|
:host {
|
|
1200
1200
|
display: contents;
|
|
1201
1201
|
}
|
|
@@ -1223,7 +1223,7 @@ var rettangoli=(()=>{var $=`
|
|
|
1223
1223
|
}
|
|
1224
1224
|
${f}
|
|
1225
1225
|
${m}
|
|
1226
|
-
`))}constructor(){super(),
|
|
1226
|
+
`))}constructor(){super(),s.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[s.styleSheet],this._styles={default:{},sm:{},md:{},lg:{},xl:{}},this._lastStyleString="",this._textareaElement=document.createElement("textarea"),this._styleElement=document.createElement("style"),this.shadow.appendChild(this._styleElement),this.shadow.appendChild(this._textareaElement),this._textareaElement.addEventListener("input",this._onInput),this._textareaElement.addEventListener("change",this._onChange)}_onInput=()=>{this.dispatchEvent(new CustomEvent("value-input",{detail:{value:this._textareaElement.value},bubbles:!0}))};_onChange=()=>{this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this._textareaElement.value},bubbles:!0}))};static get observedAttributes(){return["key","placeholder","disabled","value","cols","rows",...g([...C,"wh","w","h","hide","show","op","z"])]}get value(){return this._textareaElement.value}set value(t){this._textareaElement.value=t}connectedCallback(){this._updateTextareaAttributes()}focus(){this._textareaElement&&this._textareaElement.focus()}select(){this._textareaElement&&this._textareaElement.select()}attributeChangedCallback(t,e,i){if(t==="key"){requestAnimationFrame(()=>{let r=this.getAttribute("value");this._textareaElement.value=r??""});return}if(t==="value"&&requestAnimationFrame(()=>{let r=this.getAttribute("value");this._textareaElement.value=r??""}),t==="placeholder"&&requestAnimationFrame(()=>{let r=this.getAttribute("placeholder");r===void 0||r==="null"?this._textareaElement.removeAttribute("placeholder"):this._textareaElement.setAttribute("placeholder",r??"")}),["cols","rows","disabled"].includes(t)){this._updateTextareaAttributes();return}this._styles={default:{},sm:{},md:{},lg:{},xl:{}},["default","sm","md","lg","xl"].forEach(r=>{let o=x=>`${r==="default"?"":`${r}-`}${x}`,l=this.getAttribute(o("wh")),a=u(l===null?this.getAttribute(o("w")):l),h=u(l===null?this.getAttribute(o("h")):l),d=this.getAttribute(o("op")),y=this.getAttribute(o("z"));y!==null&&(this._styles[r]["z-index"]=y),d!==null&&(this._styles[r].opacity=d),a==="f"?this._styles[r].width="var(--width-stretch)":a!==void 0&&(this._styles[r].width=a,this._styles[r]["min-width"]=a,this._styles[r]["max-width"]=a),h==="f"?this._styles[r].height="100%":h!==void 0&&(this._styles[r].height=h,this._styles[r]["min-height"]=h,this._styles[r]["max-height"]=h),this.hasAttribute(o("hide"))&&(this._styles[r].display="none"),this.hasAttribute(o("show"))&&(this._styles[r].display="block")});let n=w(this._styles,"textarea");n!==this._lastStyleString&&(this._styleElement.textContent=n,this._lastStyleString=n)}_updateTextareaAttributes(){let t=this.getAttribute("cols"),e=this.getAttribute("rows"),i=this.hasAttribute("disabled");t!==null?this._textareaElement.setAttribute("cols",t):this._textareaElement.removeAttribute("cols"),e!==null?this._textareaElement.setAttribute("rows",e):this._textareaElement.removeAttribute("rows"),i?this._textareaElement.setAttribute("disabled",""):this._textareaElement.removeAttribute("disabled")}},ie=({render:s,html:t})=>vt;var je=["mt","mr","mb","ml","m","mh","mv","cur"],He=/^#[0-9a-fA-F]{6}$/,_t=class s extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){s.styleSheet||(s.styleSheet=new CSSStyleSheet,s.styleSheet.replaceSync(c`
|
|
1227
1227
|
:host {
|
|
1228
1228
|
display: contents;
|
|
1229
1229
|
}
|
|
@@ -1246,7 +1246,7 @@ var rettangoli=(()=>{var $=`
|
|
|
1246
1246
|
}
|
|
1247
1247
|
${f}
|
|
1248
1248
|
${m}
|
|
1249
|
-
`))}constructor(){super(),
|
|
1249
|
+
`))}constructor(){super(),s.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[s.styleSheet],this._styles=b(),this._lastStyleString="",this._inputElement=document.createElement("input"),this._inputElement.type="color",this._styleElement=document.createElement("style"),this.shadow.appendChild(this._styleElement),this.shadow.appendChild(this._inputElement),this._inputElement.addEventListener("change",this._onChange),this._inputElement.addEventListener("input",this._onInput)}static get observedAttributes(){return["key","value","disabled",...g([...je,"wh","w","h","hide","show","op","z"])]}get value(){return this._inputElement.value}set value(t){this._inputElement.value=t}_onChange=()=>{this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this._inputElement.value},bubbles:!0}))};_onInput=()=>{this.dispatchEvent(new CustomEvent("value-input",{detail:{value:this._inputElement.value},bubbles:!0}))};attributeChangedCallback(t,e,i){if(e!==i){if(t==="key"){this._syncValueAttribute();return}if(["value","disabled"].includes(t)){this._updateInputAttributes();return}this.updateStyles()}}updateStyles(){this._styles=b(),S.forEach(e=>{let i=h=>`${e==="default"?"":`${e}-`}${h}`,n=this.getAttribute(i("wh")),r=u(n===null?this.getAttribute(i("w")):n),o=u(n===null?this.getAttribute(i("h")):n),l=this.getAttribute(i("op")),a=this.getAttribute(i("z"));a!==null&&(this._styles[e]["z-index"]=a),l!==null&&(this._styles[e].opacity=l),v({styleBucket:this._styles[e],axis:"width",dimension:r,fillValue:"var(--width-stretch)"}),v({styleBucket:this._styles[e],axis:"height",dimension:o,fillValue:"100%"}),this.hasAttribute(i("hide"))&&(this._styles[e].display="none"),this.hasAttribute(i("show"))&&(this._styles[e].display="block")});let t=w(this._styles,'input[type="color"]');t!==this._lastStyleString&&(this._styleElement.textContent=t,this._lastStyleString=t)}_syncValueAttribute(){let t=this.getAttribute("value");if(t===null){this._inputElement.value="#000000";return}this._inputElement.value=He.test(t)?t:"#000000"}_updateInputAttributes(){let t=this.hasAttribute("disabled");this._syncValueAttribute(),t?this._inputElement.setAttribute("disabled",""):this._inputElement.removeAttribute("disabled")}connectedCallback(){this._updateInputAttributes(),this.updateStyles()}},se=({render:s,html:t})=>_t;var yt=class s extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){s.styleSheet||(s.styleSheet=new CSSStyleSheet,s.styleSheet.replaceSync(c`
|
|
1250
1250
|
:host {
|
|
1251
1251
|
display: contents;
|
|
1252
1252
|
}
|
|
@@ -1300,8 +1300,8 @@ var rettangoli=(()=>{var $=`
|
|
|
1300
1300
|
}
|
|
1301
1301
|
${f}
|
|
1302
1302
|
${m}
|
|
1303
|
-
`))}constructor(){super(),
|
|
1304
|
-
${
|
|
1303
|
+
`))}constructor(){super(),s.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[s.styleSheet],this._styles={default:{},sm:{},md:{},lg:{},xl:{}},this._lastStyleString="",this._inputElement=document.createElement("input"),this._inputElement.type="range",this._styleElement=document.createElement("style"),this.shadow.appendChild(this._styleElement),this.shadow.appendChild(this._inputElement),this._inputElement.addEventListener("input",this._onInput),this._inputElement.addEventListener("change",this._onChange)}static get observedAttributes(){return["key","value","min","max","step","disabled",...g([...C,"wh","w","h","hide","show","op","z"])]}get value(){return this._inputElement.value}set value(t){this._inputElement.value=t}_onInput=()=>{this.dispatchEvent(new CustomEvent("value-input",{detail:{value:Number(this._inputElement.value)},bubbles:!0}))};_onChange=()=>{this.dispatchEvent(new CustomEvent("value-change",{detail:{value:Number(this._inputElement.value)},bubbles:!0}))};attributeChangedCallback(t,e,i){if(t==="key"&&e!==i){requestAnimationFrame(()=>{let r=this.getAttribute("value"),o=this.getAttribute("min")||"0";this._inputElement.value=r??o});return}if(["value","min","max","step","disabled"].includes(t)){this._updateInputAttributes();return}this._styles={default:{},sm:{},md:{},lg:{},xl:{}},["default","sm","md","lg","xl"].forEach(r=>{let o=x=>`${r==="default"?"":`${r}-`}${x}`,l=this.getAttribute(o("wh")),a=u(l===null?this.getAttribute(o("w")):l),h=u(l===null?this.getAttribute(o("h")):l),d=this.getAttribute(o("op")),y=this.getAttribute(o("z"));y!==null&&(this._styles[r]["z-index"]=y),d!==null&&(this._styles[r].opacity=d),a==="f"?this._styles[r].width="var(--width-stretch)":a!==void 0&&(this._styles[r].width=a,this._styles[r]["min-width"]=a,this._styles[r]["max-width"]=a),h==="f"?this._styles[r].height="100%":h!==void 0&&(this._styles[r].height=h,this._styles[r]["min-height"]=h,this._styles[r]["max-height"]=h),this.hasAttribute(o("hide"))&&(this._styles[r].display="none"),this.hasAttribute(o("show"))&&(this._styles[r].display="block")});let n=w(this._styles,'input[type="range"]');n!==this._lastStyleString&&(this._styleElement.textContent=n,this._lastStyleString=n)}_updateInputAttributes(){let t=this.getAttribute("value"),e=this.getAttribute("min"),i=this.getAttribute("max"),n=this.getAttribute("step"),r=this.hasAttribute("disabled");t!==null?this._inputElement.value=t:this._inputElement.value=e??0,e!==null?this._inputElement.min=e:this._inputElement.min="0",i!==null?this._inputElement.max=i:this._inputElement.max="100",n!==null?this._inputElement.step=n:this._inputElement.step="1",r?this._inputElement.setAttribute("disabled",""):this._inputElement.removeAttribute("disabled")}connectedCallback(){this._updateInputAttributes()}},ne=({render:s,html:t})=>yt;var wt=40,qe=6,Ge=["sm","md","lg","xl"],xt=32,St=8,j="data-rtgl-active-layout",Ke=`:host([${j}="fixed"])`,Xe=new Set(["date","datetime-local","month","time","week"]),Ye=s=>s.replace(/^@media\s+/,""),Qe=s=>c`
|
|
1304
|
+
${s} dialog {
|
|
1305
1305
|
width: 100vw !important;
|
|
1306
1306
|
max-width: 100vw !important;
|
|
1307
1307
|
height: 100vh !important;
|
|
@@ -1312,7 +1312,7 @@ var rettangoli=(()=>{var $=`
|
|
|
1312
1312
|
overflow: hidden !important;
|
|
1313
1313
|
}
|
|
1314
1314
|
|
|
1315
|
-
${
|
|
1315
|
+
${s} slot[name="content"] {
|
|
1316
1316
|
box-sizing: border-box;
|
|
1317
1317
|
width: 100vw !important;
|
|
1318
1318
|
max-width: 100vw !important;
|
|
@@ -1327,7 +1327,7 @@ var rettangoli=(()=>{var $=`
|
|
|
1327
1327
|
padding-top: max(var(--spacing-lg), env(safe-area-inset-top));
|
|
1328
1328
|
padding-bottom: max(var(--spacing-lg), env(safe-area-inset-bottom));
|
|
1329
1329
|
}
|
|
1330
|
-
`,Et=class
|
|
1330
|
+
`,Et=class s extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){s.styleSheet||(s.styleSheet=new CSSStyleSheet,s.styleSheet.replaceSync(c`
|
|
1331
1331
|
:host {
|
|
1332
1332
|
display: contents;
|
|
1333
1333
|
}
|
|
@@ -1443,7 +1443,7 @@ var rettangoli=(()=>{var $=`
|
|
|
1443
1443
|
margin-right: 0;
|
|
1444
1444
|
}
|
|
1445
1445
|
|
|
1446
|
-
${
|
|
1446
|
+
${$.md} {
|
|
1447
1447
|
:host(:not([w])[s="sm"]) slot[name="content"],
|
|
1448
1448
|
:host(:not([w])[s="md"]) slot[name="content"],
|
|
1449
1449
|
:host(:not([w])[s="lg"]) slot[name="content"] {
|
|
@@ -1479,7 +1479,7 @@ var rettangoli=(()=>{var $=`
|
|
|
1479
1479
|
}
|
|
1480
1480
|
}
|
|
1481
1481
|
|
|
1482
|
-
${Ke
|
|
1482
|
+
${Qe(Ke)}
|
|
1483
1483
|
|
|
1484
1484
|
:host([no-padding]) slot[name="content"] {
|
|
1485
1485
|
margin-left: 0;
|
|
@@ -1487,7 +1487,22 @@ var rettangoli=(()=>{var $=`
|
|
|
1487
1487
|
max-width: 100vw;
|
|
1488
1488
|
padding: 0;
|
|
1489
1489
|
}
|
|
1490
|
-
`))}constructor(){super(),i.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[i.styleSheet],this._dialogElement=document.createElement("dialog"),this._dialogElement.tabIndex=-1,this.shadow.appendChild(this._dialogElement),this._slotElement=null,this._closeButtonElement=null,this._isConnected=!1,this._adaptiveFrameId=null,this._layoutRetryCount=0,this._observedContentElement=null,this._managedLongTokenTextElements=new Set,this._contentMutationObserver=typeof MutationObserver<"u"?new MutationObserver(()=>{this._syncLongTokenWrapping()}):null,this._resizeObserver=typeof ResizeObserver<"u"?new ResizeObserver(()=>{this._scheduleAdaptiveCentering()}):null,this._onSlotChange=()=>{this._syncLongTokenWrapping(),this._observeAssignedContent(),this._scheduleAdaptiveCentering({resetRetries:!0})},this._onWindowResize=()=>{this._updateActiveLayoutAttribute(),this._scheduleAdaptiveCentering({resetRetries:!0})},this._onDialogScroll=()=>{this._updateCloseButtonPosition()},this._onCloseButtonClick=t=>{t.preventDefault(),t.stopPropagation(),this._attemptClose()},this._mouseDownInContent=!1,this._dialogElement.addEventListener("mousedown",t=>{this._mouseDownInContent=t.target!==this._dialogElement}),this._dialogElement.addEventListener("click",t=>{t.target===this._dialogElement&&!this._mouseDownInContent&&this._attemptClose(),this._mouseDownInContent=!1}),this._dialogElement.addEventListener("contextmenu",t=>{t.target===this._dialogElement&&!this._mouseDownInContent&&(t.preventDefault(),this._attemptClose()),this._mouseDownInContent=!1}),this._dialogElement.addEventListener("cancel",t=>{t.preventDefault(),this._attemptClose()})}_attemptClose(){this.dispatchEvent(new CustomEvent("close",{detail:{},bubbles:!0}))}static get observedAttributes(){return["open","w","s","close-button",...g(["layout"])]}connectedCallback(){this._updateDialog(),this._isConnected=!0,this.hasAttribute("open")&&this._showModal()}disconnectedCallback(){this._isConnected=!1,this._clearManagedLongTokenWrapping(),this._stopAdaptiveObservers(),this._slotElement&&this._slotElement.removeEventListener("slotchange",this._onSlotChange),this._dialogElement.open&&this._dialogElement.close()}attributeChangedCallback(t,e,s){t==="open"?s!==null&&!this._dialogElement.open&&this._isConnected?this._showModal():s===null&&this._dialogElement.open&&this._hideModal():t==="s"||t.endsWith("layout")?(this._updateActiveLayoutAttribute(),this._scheduleAdaptiveCentering({resetRetries:!0})):t==="w"?this._updateWidth():t==="close-button"&&(this._updateCloseButton(),this._updateCloseButtonPosition())}_updateDialog(){this._updateWidth(),this._updateCloseButton(),this._updateActiveLayoutAttribute()}_updateWidth(){let t=this.getAttribute("w");t?this._dialogElement.style.width=t:this._dialogElement.style.width=""}_updateCloseButton(){this._closeButtonElement&&(this._closeButtonElement.setAttribute("aria-label","Close dialog"),this._closeButtonElement.hidden=!this.hasAttribute("close-button"))}_createCloseButtonElement(){let t=document.createElement("button");return t.type="button",t.className="close-button",t.addEventListener("click",this._onCloseButtonClick),t}_clearManagedLongTokenWrapping(){for(let t of this._managedLongTokenTextElements)t?.isConnected&&t.removeAttribute("break-long-tokens");this._managedLongTokenTextElements.clear()}_collectTextElements(t,e){if(!(!t||t.nodeType!==Node.ELEMENT_NODE)){t.localName==="rtgl-text"&&e.push(t);for(let s of t.children)this._collectTextElements(s,e);if(t.shadowRoot)for(let s of t.shadowRoot.children)this._collectTextElements(s,e)}}_syncLongTokenWrapping(){if(this._clearManagedLongTokenWrapping(),!this._slotElement)return;let t=this._slotElement.assignedNodes({flatten:!0}),e=[];for(let s of t)this._collectTextElements(s,e);for(let s of e)s.hasAttribute("ellipsis")||s.hasAttribute("break-long-tokens")||(s.setAttribute("break-long-tokens",""),this._managedLongTokenTextElements.add(s))}_showModal(){this._dialogElement.open||(this._slotElement||(this._slotElement=document.createElement("slot"),this._slotElement.setAttribute("name","content"),this._slotElement.addEventListener("slotchange",this._onSlotChange),this._dialogElement.appendChild(this._slotElement)),this._closeButtonElement||(this._closeButtonElement=this._createCloseButtonElement(),this._dialogElement.appendChild(this._closeButtonElement)),this._updateCloseButton(),this._updateActiveLayoutAttribute(),this._dialogElement.showModal(),this.shadow.activeElement===this._closeButtonElement&&this._dialogElement.focus({preventScroll:!0}),this._dialogElement.scrollTop=0,window.addEventListener("resize",this._onWindowResize),this._dialogElement.addEventListener("scroll",this._onDialogScroll,{passive:!0}),this._syncLongTokenWrapping(),this._observeAssignedContent(),this._layoutRetryCount=0,this._applyAdaptiveCentering())}_hideModal(){this._dialogElement.open&&(this._clearManagedLongTokenWrapping(),this._stopAdaptiveObservers(),this._dialogElement.close(),this._slotElement&&(this._slotElement.removeEventListener("slotchange",this._onSlotChange),this._slotElement.style.marginTop="",this._slotElement.style.marginBottom="",this._dialogElement.removeChild(this._slotElement),this._slotElement=null),this._closeButtonElement&&(this._closeButtonElement.removeEventListener("click",this._onCloseButtonClick),this._dialogElement.removeChild(this._closeButtonElement),this._closeButtonElement=null),this._dialogElement.style.height="",this._dialogElement.style.removeProperty("--rtgl-dialog-close-top"),this._dialogElement.style.removeProperty("--rtgl-dialog-close-left"))}_stopAdaptiveObservers(){this._adaptiveFrameId!==null&&(cancelAnimationFrame(this._adaptiveFrameId),this._adaptiveFrameId=null),this._layoutRetryCount=0,window.removeEventListener("resize",this._onWindowResize),this._dialogElement.removeEventListener("scroll",this._onDialogScroll),this._resizeObserver&&this._observedContentElement&&this._resizeObserver.unobserve(this._observedContentElement),this._contentMutationObserver&&this._contentMutationObserver.disconnect(),this._observedContentElement=null}_getAssignedContentElement(){if(!this._slotElement)return null;let t=this._slotElement.assignedElements({flatten:!0});return t.length>0?t[0]:null}_observeAssignedContent(){if(!this._resizeObserver&&!this._contentMutationObserver)return;let t=this._getAssignedContentElement();this._observedContentElement!==t&&(this._observedContentElement&&(this._resizeObserver&&this._resizeObserver.unobserve(this._observedContentElement),this._contentMutationObserver&&this._contentMutationObserver.disconnect()),this._observedContentElement=t,this._observedContentElement&&(this._resizeObserver&&this._resizeObserver.observe(this._observedContentElement),this._contentMutationObserver&&this._contentMutationObserver.observe(this._observedContentElement,{childList:!0,subtree:!0}),this._syncLongTokenWrapping()))}_scheduleAdaptiveCentering({resetRetries:t=!1}={}){!this._slotElement||!this._dialogElement.open||(t&&(this._layoutRetryCount=0),this._adaptiveFrameId!==null&&cancelAnimationFrame(this._adaptiveFrameId),this._adaptiveFrameId=requestAnimationFrame(()=>{this._adaptiveFrameId=requestAnimationFrame(()=>{this._adaptiveFrameId=null,this._applyAdaptiveCentering()})}))}_getActiveResponsiveSize(){if(typeof window>"u"||typeof window.matchMedia!="function")return"default";for(let t of Ge){let e=O[t];if(e&&window.matchMedia(Ye(e)).matches)return t}return"default"}_getActiveLayout(){return T({element:this,size:this._getActiveResponsiveSize(),attr:"layout"})||"centered"}_isFixedLayoutActive(){return this._updateActiveLayoutAttribute()==="fixed"}_updateActiveLayoutAttribute(){let t=this._getActiveLayout();return t==="fixed"?this.getAttribute(j)!=="fixed"&&this.setAttribute(j,"fixed"):this.hasAttribute(j)&&this.removeAttribute(j),t}_updateCloseButtonPosition(){if(!this._slotElement||!this._closeButtonElement||!this._dialogElement.open)return;let t=Math.round(this._slotElement.getBoundingClientRect().width),e=Math.round(this._dialogElement.scrollTop),s=Math.round(this._dialogElement.scrollLeft),r=Math.max(0,Math.round(this._slotElement.offsetTop)+e+St),n=Math.max(0,Math.round(this._slotElement.offsetLeft)+s+t-xt-St);this._dialogElement.style.setProperty("--rtgl-dialog-close-top",`${r}px`),this._dialogElement.style.setProperty("--rtgl-dialog-close-left",`${n}px`)}_applyAdaptiveCentering(){if(!this._slotElement||!this._dialogElement.open)return;if(this._isFixedLayoutActive()){this._slotElement.style.marginTop="",this._slotElement.style.marginBottom="",this._dialogElement.style.height="",this._updateCloseButtonPosition(),this._layoutRetryCount=0;return}this._observeAssignedContent();let t=this._getAssignedContentElement(),e=t?Math.round(t.getBoundingClientRect().height):0;if(e<=0){this._layoutRetryCount<He&&(this._layoutRetryCount+=1,this._scheduleAdaptiveCentering());return}this._layoutRetryCount=0;let s=window.innerHeight;if(e>=s-2*wt){this._slotElement.style.marginTop=`${wt}px`,this._slotElement.style.marginBottom=`${wt}px`,this._dialogElement.style.height="100vh",this._updateCloseButtonPosition();return}let r=s-e,n=Math.floor(r/2);this._slotElement.style.marginTop=`${n}px`,this._slotElement.style.marginBottom=`${n}px`,this._dialogElement.style.height="auto",this._updateCloseButtonPosition()}get dialog(){return this._dialogElement}},re=({render:i,html:t})=>Et;var oe=({x:i,y:t,width:e,height:s,place:r,viewportWidth:n,viewportHeight:o,offset:l=8,padding:h=8})=>{let a=i,d=t;switch(r){case"t":a=i-e/2,d=t-s-l;break;case"ts":a=i,d=t-s-l;break;case"te":a=i-e,d=t-s-l;break;case"r":a=i+l,d=t-s/2;break;case"rs":a=i+l,d=t;break;case"re":a=i+l,d=t-s;break;case"b":a=i-e/2,d=t+l;break;case"bs":a=i,d=t+l;break;case"be":a=i-e,d=t+l;break;case"l":a=i-e-l,d=t-s/2;break;case"ls":a=i-e-l,d=t;break;case"le":a=i-e-l,d=t-s;break;case"center":case"c":a=(n-e)/2,d=(o-s)/2;break;default:a=i,d=t+l;break}return{left:Math.max(h,Math.min(a,n-e-h)),top:Math.max(h,Math.min(d,o-s-h))}};var le="data-rtgl-popover-content",At="min-width: 200px; max-width: 400px; box-sizing: border-box;",q="data-rtgl-active-overlay",ae="data-rtgl-active-place",Qe=["sm","md","lg","xl"],Ze=i=>i.replace(/^@media\s+/,""),he=(i,t=!1)=>{if(i==null)return t;if(typeof i=="boolean")return i;let e=`${i}`.trim().toLowerCase();return!["false","0","no","off"].includes(e)},Ct=class i extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){i.styleSheet||(i.styleSheet=new CSSStyleSheet,i.styleSheet.replaceSync(c`
|
|
1490
|
+
|
|
1491
|
+
:host([bare]) dialog::backdrop {
|
|
1492
|
+
background-color: transparent;
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
:host([bare]) slot[name="content"] {
|
|
1496
|
+
animation: none;
|
|
1497
|
+
background-color: transparent !important;
|
|
1498
|
+
border: none;
|
|
1499
|
+
border-radius: 0;
|
|
1500
|
+
margin-left: 0;
|
|
1501
|
+
margin-right: 0;
|
|
1502
|
+
max-width: 100vw;
|
|
1503
|
+
padding: 0;
|
|
1504
|
+
}
|
|
1505
|
+
`))}constructor(){super(),s.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[s.styleSheet],this._dialogElement=document.createElement("dialog"),this._dialogElement.tabIndex=-1,this.shadow.appendChild(this._dialogElement),this._slotElement=null,this._closeButtonElement=null,this._isConnected=!1,this._adaptiveFrameId=null,this._layoutRetryCount=0,this._observedContentElement=null,this._managedLongTokenTextElements=new Set,this._contentMutationObserver=typeof MutationObserver<"u"?new MutationObserver(()=>{this._syncLongTokenWrapping()}):null,this._resizeObserver=typeof ResizeObserver<"u"?new ResizeObserver(()=>{this._scheduleAdaptiveCentering()}):null,this._onSlotChange=()=>{this._syncLongTokenWrapping(),this._observeAssignedContent(),this._scheduleAdaptiveCentering({resetRetries:!0})},this._onWindowResize=()=>{this._updateActiveLayoutAttribute(),this._scheduleAdaptiveCentering({resetRetries:!0})},this._onDialogScroll=()=>{this._updateCloseButtonPosition()},this._onDialogKeyDown=t=>{this._containTabFocus(t)},this._onCloseButtonClick=t=>{t.preventDefault(),t.stopPropagation(),this._attemptClose()},this._mouseDownInContent=!1,this._dialogElement.addEventListener("mousedown",t=>{this._mouseDownInContent=t.target!==this._dialogElement}),this._dialogElement.addEventListener("click",t=>{t.target===this._dialogElement&&!this._mouseDownInContent&&this._attemptClose(),this._mouseDownInContent=!1}),this._dialogElement.addEventListener("contextmenu",t=>{t.target===this._dialogElement&&!this._mouseDownInContent&&(t.preventDefault(),this._attemptClose()),this._mouseDownInContent=!1}),this._dialogElement.addEventListener("cancel",t=>{t.preventDefault(),this._attemptClose()}),this._dialogElement.addEventListener("keydown",this._onDialogKeyDown)}_attemptClose(){this.dispatchEvent(new CustomEvent("close",{detail:{},bubbles:!0}))}static get observedAttributes(){return["open","w","s","close-button",...g(["layout"])]}connectedCallback(){this._updateDialog(),this._isConnected=!0,this.hasAttribute("open")&&this._showModal()}disconnectedCallback(){this._isConnected=!1,this._clearManagedLongTokenWrapping(),this._stopAdaptiveObservers(),this._slotElement&&this._slotElement.removeEventListener("slotchange",this._onSlotChange),this._dialogElement.open&&this._dialogElement.close()}attributeChangedCallback(t,e,i){t==="open"?i!==null&&!this._dialogElement.open&&this._isConnected?this._showModal():i===null&&this._dialogElement.open&&this._hideModal():t==="s"||t.endsWith("layout")?(this._updateActiveLayoutAttribute(),this._scheduleAdaptiveCentering({resetRetries:!0})):t==="w"?this._updateWidth():t==="close-button"&&(this._updateCloseButton(),this._updateCloseButtonPosition())}_updateDialog(){this._updateWidth(),this._updateCloseButton(),this._updateActiveLayoutAttribute()}_updateWidth(){let t=this.getAttribute("w");t?this._dialogElement.style.width=t:this._dialogElement.style.width=""}_updateCloseButton(){this._closeButtonElement&&(this._closeButtonElement.setAttribute("aria-label","Close dialog"),this._closeButtonElement.hidden=!this.hasAttribute("close-button"))}_createCloseButtonElement(){let t=document.createElement("button");return t.type="button",t.className="close-button",t.addEventListener("click",this._onCloseButtonClick),t}_isTabbableElement(t){return this._isTabbableElementIgnoringRadioGroup(t)?!(t instanceof HTMLInputElement&&t.type==="radio"&&!this._isTabbableRadio(t)):!1}_getComposedParent(t){if(t.assignedSlot)return t.assignedSlot;if(t.parentElement)return t.parentElement;let e=t.getRootNode?.();return e instanceof ShadowRoot?e.host:null}_hasInertComposedAncestor(t){let e=t;for(;e;){if(e instanceof HTMLElement&&e.inert)return!0;e=this._getComposedParent(e)}return!1}_isEditingHost(t){if(!(t instanceof HTMLElement)||!t.isContentEditable)return!1;let e=this._getComposedParent(t);return!(e instanceof HTMLElement&&e.isContentEditable)}_getSequentialTabIndex(t){return typeof t.tabIndex=="number"&&t.tabIndex>=0?t.tabIndex:!t.hasAttribute("tabindex")&&this._isEditingHost(t)?0:null}_isHiddenByClosedDetails(t){let e=t,i=this._getComposedParent(e);for(;i;){if(i instanceof HTMLDetailsElement&&!i.open){let n=[...i.children].find(r=>r instanceof HTMLElement&&r.localName==="summary");if(e!==n)return!0}e=i,i=this._getComposedParent(e)}return!1}_isInsideDialog(t){let e=t;for(;e;){if(e===this._dialogElement)return!0;e=this._getComposedParent(e)}return!1}_isTabbableRadio(t){if(!t.name)return!0;let i=[...t.getRootNode().querySelectorAll("input[type='radio']")].filter(r=>r.name===t.name&&r.form===t.form&&this._isInsideDialog(r)&&this._isTabbableElementIgnoringRadioGroup(r)),n=i.find(r=>r.checked);return t===(n??i[0])}_isTabbableElementIgnoringRadioGroup(t){if(!(t instanceof Element)||this._getSequentialTabIndex(t)===null||t.matches(":disabled")||t instanceof HTMLInputElement&&t.type==="hidden"||this._hasInertComposedAncestor(t)||this._isHiddenByClosedDetails(t))return!1;let e=getComputedStyle(t),i=e.display!=="none"&&e.visibility!=="hidden"&&e.visibility!=="collapse";return t instanceof HTMLAreaElement?i&&this._hasVisibleAssociatedImage(t):t.getClientRects().length>0&&i}_hasVisibleAssociatedImage(t){let e=t.closest("map[name]");if(!(e instanceof HTMLMapElement)||!e.name)return!1;let i=e.getRootNode();return i instanceof Document||i instanceof ShadowRoot?[...i.querySelectorAll("img[usemap]")].some(n=>{if(n.getAttribute("usemap")?.trim()!==`#${e.name}`||this._hasInertComposedAncestor(n)||this._isHiddenByClosedDetails(n))return!1;let o=getComputedStyle(n);return n.getClientRects().length>0&&o.display!=="none"&&o.visibility!=="hidden"&&o.visibility!=="collapse"}):!1}_appendTabScope(t,e,i){let n=t.hasAttribute("tabindex");if(n&&t.tabIndex<0)return;let r=[];this._collectTabOrderItems(e,r);let o=[];this._isTabbableElement(t)&&o.push(t),o.push(...this._sortTabOrderItems(r)),o.length>0&&i.push({tabIndex:n?t.tabIndex:0,elements:o})}_collectTabOrderItems(t,e){for(let i of t)if(i instanceof Element){if(i instanceof HTMLSlotElement){let n=i.assignedElements(),r=n.length>0?n:[...i.children];this._appendTabScope(i,r,e);continue}if(i.shadowRoot){this._appendTabScope(i,[...i.shadowRoot.children],e);continue}this._isTabbableElement(i)&&e.push({tabIndex:this._getSequentialTabIndex(i),elements:[i]}),this._collectTabOrderItems(i.children,e)}}_sortTabOrderItems(t){let e=t.map((n,r)=>({...n,documentOrder:r})).filter(n=>n.tabIndex>0).sort((n,r)=>n.tabIndex-r.tabIndex||n.documentOrder-r.documentOrder),i=t.filter(n=>n.tabIndex===0);return[...e,...i].flatMap(n=>n.elements)}_getTabbableElements(){let t=[];return this._collectTabOrderItems(this._dialogElement.children,t),this._sortTabOrderItems(t)}_getDeepActiveElement(){let t=document.activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}_hasNativeInternalTabSequence(t){return t instanceof HTMLInputElement&&Xe.has(t.type)}_deferNativeTabContainment(t){setTimeout(()=>{if(!this._dialogElement.matches(":modal"))return;let e=this._getDeepActiveElement();if(e&&this._isInsideDialog(e))return;let i=this._getTabbableElements(),n=t?i[i.length-1]:i[0];n?n.focus({preventScroll:!0}):this._dialogElement.focus({preventScroll:!0})},0)}_containTabFocus(t){if(t.key!=="Tab"||t.defaultPrevented||t.altKey||t.ctrlKey||t.metaKey||!this._isTabEventOwnedByDialog(t))return;let e=this._getTabbableElements();if(e.length===0){t.preventDefault(),this._dialogElement.focus({preventScroll:!0});return}let i=this._getDeepActiveElement(),n=e[0],r=e[e.length-1],o=t.shiftKey&&(i===n||i===this._dialogElement),l=!t.shiftKey&&i===r;if(!o&&!l)return;if(this._hasNativeInternalTabSequence(i)){this._deferNativeTabContainment(o);return}t.preventDefault(),(o?r:n).focus({preventScroll:!0})}_isTabEventOwnedByDialog(t){for(let e of t.composedPath())if(e instanceof HTMLDialogElement){if(e===this._dialogElement)return!0;if(e.matches(":modal"))return!1}return!1}_clearManagedLongTokenWrapping(){for(let t of this._managedLongTokenTextElements)t?.isConnected&&t.removeAttribute("break-long-tokens");this._managedLongTokenTextElements.clear()}_collectTextElements(t,e){if(!(!t||t.nodeType!==Node.ELEMENT_NODE)){t.localName==="rtgl-text"&&e.push(t);for(let i of t.children)this._collectTextElements(i,e);if(t.shadowRoot)for(let i of t.shadowRoot.children)this._collectTextElements(i,e)}}_syncLongTokenWrapping(){if(this._clearManagedLongTokenWrapping(),!this._slotElement)return;let t=this._slotElement.assignedNodes({flatten:!0}),e=[];for(let i of t)this._collectTextElements(i,e);for(let i of e)i.hasAttribute("ellipsis")||i.hasAttribute("break-long-tokens")||(i.setAttribute("break-long-tokens",""),this._managedLongTokenTextElements.add(i))}_showModal(){this._dialogElement.open||(this._slotElement||(this._slotElement=document.createElement("slot"),this._slotElement.setAttribute("name","content"),this._slotElement.addEventListener("slotchange",this._onSlotChange),this._dialogElement.appendChild(this._slotElement)),this._closeButtonElement||(this._closeButtonElement=this._createCloseButtonElement(),this._dialogElement.appendChild(this._closeButtonElement)),this._updateCloseButton(),this._updateActiveLayoutAttribute(),this._dialogElement.showModal(),this.shadow.activeElement===this._closeButtonElement&&this._dialogElement.focus({preventScroll:!0}),this._dialogElement.scrollTop=0,window.addEventListener("resize",this._onWindowResize),this._dialogElement.addEventListener("scroll",this._onDialogScroll,{passive:!0}),this._syncLongTokenWrapping(),this._observeAssignedContent(),this._layoutRetryCount=0,this._applyAdaptiveCentering())}_hideModal(){this._dialogElement.open&&(this._clearManagedLongTokenWrapping(),this._stopAdaptiveObservers(),this._dialogElement.close(),this._slotElement&&(this._slotElement.removeEventListener("slotchange",this._onSlotChange),this._slotElement.style.marginTop="",this._slotElement.style.marginBottom="",this._dialogElement.removeChild(this._slotElement),this._slotElement=null),this._closeButtonElement&&(this._closeButtonElement.removeEventListener("click",this._onCloseButtonClick),this._dialogElement.removeChild(this._closeButtonElement),this._closeButtonElement=null),this._dialogElement.style.height="",this._dialogElement.style.removeProperty("--rtgl-dialog-close-top"),this._dialogElement.style.removeProperty("--rtgl-dialog-close-left"))}_stopAdaptiveObservers(){this._adaptiveFrameId!==null&&(cancelAnimationFrame(this._adaptiveFrameId),this._adaptiveFrameId=null),this._layoutRetryCount=0,window.removeEventListener("resize",this._onWindowResize),this._dialogElement.removeEventListener("scroll",this._onDialogScroll),this._resizeObserver&&this._observedContentElement&&this._resizeObserver.unobserve(this._observedContentElement),this._contentMutationObserver&&this._contentMutationObserver.disconnect(),this._observedContentElement=null}_getAssignedContentElement(){if(!this._slotElement)return null;let t=this._slotElement.assignedElements({flatten:!0});return t.length>0?t[0]:null}_observeAssignedContent(){if(!this._resizeObserver&&!this._contentMutationObserver)return;let t=this._getAssignedContentElement();this._observedContentElement!==t&&(this._observedContentElement&&(this._resizeObserver&&this._resizeObserver.unobserve(this._observedContentElement),this._contentMutationObserver&&this._contentMutationObserver.disconnect()),this._observedContentElement=t,this._observedContentElement&&(this._resizeObserver&&this._resizeObserver.observe(this._observedContentElement),this._contentMutationObserver&&this._contentMutationObserver.observe(this._observedContentElement,{childList:!0,subtree:!0}),this._syncLongTokenWrapping()))}_scheduleAdaptiveCentering({resetRetries:t=!1}={}){!this._slotElement||!this._dialogElement.open||(t&&(this._layoutRetryCount=0),this._adaptiveFrameId!==null&&cancelAnimationFrame(this._adaptiveFrameId),this._adaptiveFrameId=requestAnimationFrame(()=>{this._adaptiveFrameId=requestAnimationFrame(()=>{this._adaptiveFrameId=null,this._applyAdaptiveCentering()})}))}_getActiveResponsiveSize(){if(typeof window>"u"||typeof window.matchMedia!="function")return"default";for(let t of Ge){let e=$[t];if(e&&window.matchMedia(Ye(e)).matches)return t}return"default"}_getActiveLayout(){return B({element:this,size:this._getActiveResponsiveSize(),attr:"layout"})||"centered"}_isFixedLayoutActive(){return this._updateActiveLayoutAttribute()==="fixed"}_updateActiveLayoutAttribute(){let t=this._getActiveLayout();return t==="fixed"?this.getAttribute(j)!=="fixed"&&this.setAttribute(j,"fixed"):this.hasAttribute(j)&&this.removeAttribute(j),t}_updateCloseButtonPosition(){if(!this._slotElement||!this._closeButtonElement||!this._dialogElement.open)return;let t=Math.round(this._slotElement.getBoundingClientRect().width),e=Math.round(this._dialogElement.scrollTop),i=Math.round(this._dialogElement.scrollLeft),n=Math.max(0,Math.round(this._slotElement.offsetTop)+e+St),r=Math.max(0,Math.round(this._slotElement.offsetLeft)+i+t-xt-St);this._dialogElement.style.setProperty("--rtgl-dialog-close-top",`${n}px`),this._dialogElement.style.setProperty("--rtgl-dialog-close-left",`${r}px`)}_applyAdaptiveCentering(){if(!this._slotElement||!this._dialogElement.open)return;if(this._isFixedLayoutActive()){this._slotElement.style.marginTop="",this._slotElement.style.marginBottom="",this._dialogElement.style.height="",this._updateCloseButtonPosition(),this._layoutRetryCount=0;return}this._observeAssignedContent();let t=this._getAssignedContentElement(),e=t?Math.round(t.getBoundingClientRect().height):0;if(e<=0){this._layoutRetryCount<qe&&(this._layoutRetryCount+=1,this._scheduleAdaptiveCentering());return}this._layoutRetryCount=0;let i=window.innerHeight;if(e>=i-2*wt){this._slotElement.style.marginTop=`${wt}px`,this._slotElement.style.marginBottom=`${wt}px`,this._dialogElement.style.height="100vh",this._updateCloseButtonPosition();return}let n=i-e,r=Math.floor(n/2);this._slotElement.style.marginTop=`${r}px`,this._slotElement.style.marginBottom=`${r}px`,this._dialogElement.style.height="auto",this._updateCloseButtonPosition()}get dialog(){return this._dialogElement}},re=({render:s,html:t})=>Et;var oe=({x:s,y:t,width:e,height:i,place:n,viewportWidth:r,viewportHeight:o,offset:l=8,padding:a=8})=>{let h=s,d=t;switch(n){case"t":h=s-e/2,d=t-i-l;break;case"ts":h=s,d=t-i-l;break;case"te":h=s-e,d=t-i-l;break;case"r":h=s+l,d=t-i/2;break;case"rs":h=s+l,d=t;break;case"re":h=s+l,d=t-i;break;case"b":h=s-e/2,d=t+l;break;case"bs":h=s,d=t+l;break;case"be":h=s-e,d=t+l;break;case"l":h=s-e-l,d=t-i/2;break;case"ls":h=s-e-l,d=t;break;case"le":h=s-e-l,d=t-i;break;case"center":case"c":h=(r-e)/2,d=(o-i)/2;break;default:h=s,d=t+l;break}return{left:Math.max(a,Math.min(h,r-e-a)),top:Math.max(a,Math.min(d,o-i-a))}};var le="data-rtgl-popover-content",At="min-width: 200px; max-width: 400px; box-sizing: border-box;",H="data-rtgl-active-overlay",ae="data-rtgl-active-place",Ze=["sm","md","lg","xl"],Je=s=>s.replace(/^@media\s+/,""),he=(s,t=!1)=>{if(s==null)return t;if(typeof s=="boolean")return s;let e=`${s}`.trim().toLowerCase();return!["false","0","no","off"].includes(e)},Ct=class s extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){s.styleSheet||(s.styleSheet=new CSSStyleSheet,s.styleSheet.replaceSync(c`
|
|
1491
1506
|
:host {
|
|
1492
1507
|
display: contents;
|
|
1493
1508
|
}
|
|
@@ -1517,7 +1532,7 @@ var rettangoli=(()=>{var $=`
|
|
|
1517
1532
|
pointer-events: auto;
|
|
1518
1533
|
}
|
|
1519
1534
|
|
|
1520
|
-
:host([${
|
|
1535
|
+
:host([${H}="true"]) dialog::backdrop {
|
|
1521
1536
|
background-color: rgba(0, 0, 0, 0.5);
|
|
1522
1537
|
}
|
|
1523
1538
|
|
|
@@ -1540,4 +1555,4 @@ var rettangoli=(()=>{var $=`
|
|
|
1540
1555
|
slot[name="content"] {
|
|
1541
1556
|
display: contents;
|
|
1542
1557
|
}
|
|
1543
|
-
`))}constructor(){super(),
|
|
1558
|
+
`))}constructor(){super(),s.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[s.styleSheet],this._dialogElement=document.createElement("dialog"),this.shadow.appendChild(this._dialogElement),this._dialogElement.addEventListener("click",t=>{t.stopPropagation();let e=t.composedPath();(e[0]===this._dialogElement||e[0].nodeName==="DIALOG"&&e[0]===this._dialogElement)&&this._emitClose()}),this._dialogElement.addEventListener("contextmenu",t=>{let e=t.composedPath();(e[0]===this._dialogElement||e[0].nodeName==="DIALOG"&&e[0]===this._dialogElement)&&(t.preventDefault(),this._emitClose())}),this._dialogElement.addEventListener("cancel",t=>{t.preventDefault(),this._emitClose()}),this._popoverContainer=document.createElement("div"),this._popoverContainer.className="popover-container",this._dialogElement.appendChild(this._popoverContainer),this._slotElement=null,this._contentWrapper=null,this._isOpen=!1,this._positionFrameId=null,this._revealFrameId=null,this._positionVersion=0,this._isObservingResize=!1,this._isModalOpen=!1,this._observedContentWrapper=null,this._onWindowResize=()=>{this._updateActiveStateAttributes(),this._syncDialogMode(),this._schedulePositionUpdate()},this._resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>{this._isOpen&&this._schedulePositionUpdate()}):null}_emitClose(){this.dispatchEvent(new CustomEvent("close",{detail:{},bubbles:!0}))}static get observedAttributes(){return["open","x","y",...g(["place","overlay","no-overlay"]),"content-w","content-h","content-wh","content-g","content-sv","content-hsb","content-ph","content-pv","content-bgc","content-style"]}connectedCallback(){this._syncContentWrapper({reposition:!1}),this._updateActiveStateAttributes(),this.hasAttribute("open")&&this._show()}disconnectedCallback(){this._cancelScheduledPositionUpdate(),this._stopResizeObserver(),window.removeEventListener("resize",this._onWindowResize),this._isOpen&&this._dialogElement.open&&this._dialogElement.close(),this._isModalOpen=!1}attributeChangedCallback(t,e,i){t==="open"?i!==null&&!this._isOpen?this.isConnected&&this._show():i===null&&this._isOpen&&this._hide():t==="x"||t==="y"||t.endsWith("place")?(this._updateActiveStateAttributes(),this._isOpen&&this._schedulePositionUpdate()):t.endsWith("overlay")?(this._updateActiveStateAttributes(),this._isOpen&&(this._syncDialogMode(),this._schedulePositionUpdate())):t.startsWith("content-")&&this._syncContentWrapper()}_getActiveResponsiveSize(){if(typeof window>"u"||typeof window.matchMedia!="function")return"default";for(let t of Ze){let e=$[t];if(e&&window.matchMedia(Je(e)).matches)return t}return"default"}_getActiveResponsiveAttribute(t){return B({element:this,size:this._getActiveResponsiveSize(),attr:t})}_getActivePlace(){return this._getActiveResponsiveAttribute("place")||"bs"}_isOverlayActive(){return he(this._getActiveResponsiveAttribute("overlay"),!1)}_isNoOverlayActive(){return he(this._getActiveResponsiveAttribute("no-overlay"),!1)}_shouldUseModalDialog(){return this._isOverlayActive()||!this._isNoOverlayActive()}_updateActiveStateAttributes(){let t=this._getActivePlace(),e=this._isOverlayActive();this.getAttribute(ae)!==t&&this.setAttribute(ae,t),e?this.getAttribute(H)!=="true"&&this.setAttribute(H,"true"):this.hasAttribute(H)&&this.removeAttribute(H)}_openDialogElement(){this._dialogElement.open||(this._shouldUseModalDialog()?(this._dialogElement.showModal(),this._isModalOpen=!0):(this._dialogElement.show(),this._isModalOpen=!1))}_syncDialogMode(){!this._isOpen||!this._dialogElement.open||this._shouldUseModalDialog()===this._isModalOpen||(this._dialogElement.close(),this._isModalOpen=!1,this._openDialogElement())}_isIgnorableTextNode(t){return t?.nodeType===Node.TEXT_NODE&&t.textContent?.trim()===""}_ensureContentWrapper(){if(this._contentWrapper?.parentNode===this)return this._contentWrapper;let t=Array.from(this.children).find(e=>e.hasAttribute(le));return t?this._contentWrapper=t:(this._contentWrapper=document.createElement("rtgl-view"),this._contentWrapper.setAttribute(le,""),this._contentWrapper.setAttribute("part","content"),this._contentWrapper.setAttribute("bgc","su"),this._contentWrapper.setAttribute("bw","xs"),this._contentWrapper.setAttribute("bc","bo"),this._contentWrapper.setAttribute("br","md"),this._contentWrapper.setAttribute("ph","sm"),this._contentWrapper.setAttribute("pv","sm"),this._contentWrapper.setAttribute("style",At)),this._contentWrapper.parentNode!==this&&this.appendChild(this._contentWrapper),this._contentWrapper}_syncContentWrapperAttributes(){let t=this._ensureContentWrapper(),e=[["content-w","w"],["content-h","h"],["content-wh","wh"],["content-g","g"],["content-sv","sv"],["content-hsb","hsb"]];for(let[n,r]of e){let o=this.getAttribute(n);o===null?t.removeAttribute(r):t.setAttribute(r,o)}t.setAttribute("bgc",this.getAttribute("content-bgc")||"su"),t.setAttribute("ph",this.getAttribute("content-ph")||"sm"),t.setAttribute("pv",this.getAttribute("content-pv")||"sm");let i=this.getAttribute("content-style");t.setAttribute("style",i?`${At} ${i}`:At)}_syncContentWrapper({reposition:t=!0}={}){let e=this._ensureContentWrapper(),i=Array.from(this.childNodes).filter(r=>r!==e&&!this._isIgnorableTextNode(r));for(let r of i)r.nodeType===Node.ELEMENT_NODE&&r.getAttribute("slot")==="content"&&r.removeAttribute("slot"),e.appendChild(r);this._syncContentWrapperAttributes(),Array.from(e.childNodes).some(r=>!this._isIgnorableTextNode(r))||this.hasAttribute("open")?e.setAttribute("slot","content"):e.removeAttribute("slot"),t&&this._isOpen&&this._schedulePositionUpdate()}_show(){this._isOpen||(this._syncContentWrapper({reposition:!1}),this._updateActiveStateAttributes(),this._slotElement||(this._slotElement=document.createElement("slot"),this._slotElement.setAttribute("name","content"),this._popoverContainer.appendChild(this._slotElement)),this._isOpen=!0,this._startResizeObserver(),window.addEventListener("resize",this._onWindowResize),this._dialogElement.open?this._schedulePositionUpdate():setTimeout(()=>{this._isOpen&&this._dialogElement&&!this._dialogElement.open&&this._openDialogElement(),this._schedulePositionUpdate()},0))}_hide(){this._isOpen&&(this._isOpen=!1,this._cancelScheduledPositionUpdate(),this._stopResizeObserver(),window.removeEventListener("resize",this._onWindowResize),this._dialogElement.open&&this._dialogElement.close(),this._isModalOpen=!1,this._slotElement&&(this._popoverContainer.removeChild(this._slotElement),this._slotElement=null))}_startResizeObserver(){this._resizeObserver&&(this._isObservingResize||(this._resizeObserver.observe(this._popoverContainer),this._isObservingResize=!0),this._contentWrapper&&this._observedContentWrapper!==this._contentWrapper&&(this._observedContentWrapper&&this._resizeObserver.unobserve(this._observedContentWrapper),this._resizeObserver.observe(this._contentWrapper),this._observedContentWrapper=this._contentWrapper))}_stopResizeObserver(){this._resizeObserver?.disconnect(),this._isObservingResize=!1,this._observedContentWrapper=null}_cancelScheduledPositionUpdate(){this._positionFrameId!==null&&(cancelAnimationFrame(this._positionFrameId),this._positionFrameId=null),this._revealFrameId!==null&&(cancelAnimationFrame(this._revealFrameId),this._revealFrameId=null),this._positionVersion+=1,this.removeAttribute("positioned")}_readCoordinateAttr(t){let e=parseFloat(this.getAttribute(t)||"0");return Number.isFinite(e)?e:0}_schedulePositionUpdate(){this._isOpen&&(this.removeAttribute("positioned"),this._positionVersion+=1,this._positionFrameId===null&&(this._positionFrameId=requestAnimationFrame(()=>{if(this._positionFrameId=null,!this._isOpen)return;if(!this._dialogElement.open){this._schedulePositionUpdate();return}this._syncContentWrapper({reposition:!1}),this._startResizeObserver();let t=this._readCoordinateAttr("x"),e=this._readCoordinateAttr("y"),i=this._getActivePlace();this._updateActiveStateAttributes();let n=this._popoverContainer.getBoundingClientRect(),{left:r,top:o}=this._calculatePosition(t,e,n.width,n.height,i);this._popoverContainer.style.left=`${r}px`,this._popoverContainer.style.top=`${o}px`;let l=this._positionVersion;this._revealFrameId=requestAnimationFrame(()=>{this._revealFrameId=null,this._isOpen&&this._positionVersion===l&&this.setAttribute("positioned","")})})))}_calculatePosition(t,e,i,n,r){return oe({x:t,y:e,width:i,height:n,place:r,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight})}get popover(){return this._popoverContainer}get content(){return this._contentWrapper}refreshContent(){this._syncContentWrapper()}},de=({render:s,html:t})=>Ct;customElements.define("rtgl-button",$t({}));customElements.define("rtgl-carousel",Nt({}));customElements.define("rtgl-grid",Dt({}));customElements.define("rtgl-view",Vt({}));customElements.define("rtgl-text",jt({}));customElements.define("rtgl-image",Gt({}));customElements.define("rtgl-tag",Xt({}));customElements.define("rtgl-svg",Qt({}));customElements.define("rtgl-input",z({}));customElements.define("rtgl-input-date",Zt({}));customElements.define("rtgl-input-time",Jt({}));customElements.define("rtgl-input-datetime",te({}));customElements.define("rtgl-input-number",ee({}));customElements.define("rtgl-textarea",ie({}));customElements.define("rtgl-color-picker",se({}));customElements.define("rtgl-slider",ne({}));customElements.define("rtgl-dialog",re({}));customElements.define("rtgl-popover",de({}));})();
|