@rettangoli/ui 1.8.1 → 1.9.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.
- package/dist/rettangoli-iife-layout.min.js +6 -6
- package/dist/rettangoli-iife-ui.min.js +70 -70
- package/dist/themes/base.css +2 -3
- package/package.json +1 -1
- package/src/components/form/form.view.yaml +1 -1
- package/src/components/select/select.handlers.js +89 -1
- package/src/components/select/select.schema.yaml +6 -0
- package/src/components/select/select.store.js +156 -7
- package/src/components/select/select.view.yaml +19 -5
- package/src/primitives/grid.js +3 -3
- package/src/primitives/popover.js +2 -0
- package/src/primitives/view.js +3 -3
- package/src/styles/scrollStyles.js +3 -3
- package/src/themes/base.css +2 -3
|
@@ -468,14 +468,14 @@ var rettangoli=(()=>{var $=`
|
|
|
468
468
|
:host([sh]),
|
|
469
469
|
:host([sv]) {
|
|
470
470
|
-ms-overflow-style: auto;
|
|
471
|
-
scrollbar-gutter: stable
|
|
471
|
+
scrollbar-gutter: stable;
|
|
472
472
|
scrollbar-width: thin;
|
|
473
473
|
scrollbar-color: var(--scrollbar-thumb, var(--muted-foreground)) var(--scrollbar-track, transparent);
|
|
474
474
|
}
|
|
475
475
|
:host([sh])::-webkit-scrollbar,
|
|
476
476
|
:host([sv])::-webkit-scrollbar {
|
|
477
|
-
width: var(--scrollbar-size,
|
|
478
|
-
height: var(--scrollbar-size,
|
|
477
|
+
width: var(--scrollbar-size, var(--spacing-sm));
|
|
478
|
+
height: var(--scrollbar-size, var(--spacing-sm));
|
|
479
479
|
background: var(--scrollbar-track, transparent);
|
|
480
480
|
}
|
|
481
481
|
:host([sh])::-webkit-scrollbar-track,
|
|
@@ -600,7 +600,7 @@ var rettangoli=(()=>{var $=`
|
|
|
600
600
|
${K}
|
|
601
601
|
${W}
|
|
602
602
|
${$}
|
|
603
|
-
`))}constructor(){super(),i.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[i.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"),s=this.getAttribute("rel");this._linkElement=B({shadowRoot:this.shadow,slotElement:this._slotElement,linkElement:this._linkElement,href:t,newTab:e,rel:s})}connectedCallback(){this.updateStyles()}updateStyles(){this._styles=b(),S.forEach(e=>{let s=k=>`${e==="default"?"":`${e}-`}${k}`,r=this.getAttribute(s("wh")),n=u(r===null?this.getAttribute(s("w")):r),o=u(r===null?this.getAttribute(s("h")):r),l=Te(this.getAttribute(s("cols"))),h=this.getAttribute(s("op")),a=this.getAttribute(s("z"));l!==null&&(this._styles[e]["grid-template-columns"]=l),a!==null&&(this._styles[e]["z-index"]=a),h!==null&&(this._styles[e].opacity=h),v({styleBucket:this._styles[e],axis:"width",dimension:n,fillValue:"var(--width-stretch)",allowFlexGrow:!0}),v({styleBucket:this._styles[e],axis:"height",dimension:o,fillValue:"100%",allowFlexGrow:!0}),this.hasAttribute(s("hide"))&&(this._styles[e].display="none"),this.hasAttribute(s("show"))&&(this._styles[e].display="grid");let d=this.hasAttribute(s("sh")),y=this.hasAttribute(s("sv")),x=this.getAttribute(s("overflow"));d&&y?(this._styles[e].overflow="auto",this._styles[e]["scrollbar-gutter"]="stable
|
|
603
|
+
`))}constructor(){super(),i.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[i.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"),s=this.getAttribute("rel");this._linkElement=B({shadowRoot:this.shadow,slotElement:this._slotElement,linkElement:this._linkElement,href:t,newTab:e,rel:s})}connectedCallback(){this.updateStyles()}updateStyles(){this._styles=b(),S.forEach(e=>{let s=k=>`${e==="default"?"":`${e}-`}${k}`,r=this.getAttribute(s("wh")),n=u(r===null?this.getAttribute(s("w")):r),o=u(r===null?this.getAttribute(s("h")):r),l=Te(this.getAttribute(s("cols"))),h=this.getAttribute(s("op")),a=this.getAttribute(s("z"));l!==null&&(this._styles[e]["grid-template-columns"]=l),a!==null&&(this._styles[e]["z-index"]=a),h!==null&&(this._styles[e].opacity=h),v({styleBucket:this._styles[e],axis:"width",dimension:n,fillValue:"var(--width-stretch)",allowFlexGrow:!0}),v({styleBucket:this._styles[e],axis:"height",dimension:o,fillValue:"100%",allowFlexGrow:!0}),this.hasAttribute(s("hide"))&&(this._styles[e].display="none"),this.hasAttribute(s("show"))&&(this._styles[e].display="grid");let d=this.hasAttribute(s("sh")),y=this.hasAttribute(s("sv")),x=this.getAttribute(s("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,s){if(t==="href"||t==="new-tab"||t==="rel"){this._updateDOM();return}e!==s&&this.updateStyles()}},Ft=({render:i,html:t})=>lt;var Dt=c`
|
|
604
604
|
|
|
605
605
|
:host([d="h"]) {
|
|
606
606
|
flex-direction: row;
|
|
@@ -694,7 +694,7 @@ var rettangoli=(()=>{var $=`
|
|
|
694
694
|
${K}
|
|
695
695
|
${W}
|
|
696
696
|
${$}
|
|
697
|
-
`))}constructor(){super(),i.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[i.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"),s=this.getAttribute("rel");this._linkElement=B({shadowRoot:this.shadow,slotElement:this._slotElement,linkElement:this._linkElement,href:t,newTab:e,rel:s})}connectedCallback(){this.updateStyles()}updateStyles(){this._styles=b(),S.forEach(e=>{let s=zt=>`${e==="default"?"":`${e}-`}${zt}`,r=this.getAttribute(s("wh")),n=u(r===null?this.getAttribute(s("w")):r),o=u(r===null?this.getAttribute(s("h")):r),l=this.getAttribute(s("op")),h=this.getAttribute(s("z")),a=P(this.getAttribute(s("ar"))),d=Q(this.getAttribute(s("bgi"))),y=Q(this.getAttribute(s("bgs"))),x=Q(this.getAttribute(s("bgp"))),k=Q(this.getAttribute(s("bgr")));h!==null&&(this._styles[e]["z-index"]=h),l!==null&&(this._styles[e].opacity=l),a!==void 0&&(this._styles[e]["aspect-ratio"]=a),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:n,fillValue:"var(--width-stretch)",allowFlexGrow:!0}),v({styleBucket:this._styles[e],axis:"height",dimension:o,fillValue:"100%",allowFlexGrow:!0}),this.hasAttribute(s("hide"))&&(this._styles[e].display="none"),this.hasAttribute(s("show"))&&(this._styles[e].display="flex");let z=this.getAttribute(s("d")),A=this.getAttribute(s("ah")),E=this.getAttribute(s("av")),I=T({element:this,size:e,attr:"d"});z==="h"?this._styles[e]["flex-direction"]="row":z==="v"?this._styles[e]["flex-direction"]="column":e==="default"&&!z&&["sm","md","lg","xl"].some(ge=>this.hasAttribute(`${ge}-d`))&&(this._styles[e]["flex-direction"]="column");let H=I==="h",J=I==="v"||!I;H&&(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(s("wrap")),ue=this.hasAttribute(s("no-wrap"));ce&&(this._styles[e]["flex-wrap"]="wrap"),ue&&(this._styles[e]["flex-wrap"]="nowrap"),this.hasAttribute(s("stretch"))&&(this._styles[e]["align-self"]="stretch");let kt=this.hasAttribute(s("sh")),It=this.hasAttribute(s("sv")),pe=this.hasAttribute(s("hsb")),me=this.getAttribute(s("overflow"));kt&&It?(this._styles[e].overflow="auto",this._styles[e]["scrollbar-gutter"]="stable
|
|
697
|
+
`))}constructor(){super(),i.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[i.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"),s=this.getAttribute("rel");this._linkElement=B({shadowRoot:this.shadow,slotElement:this._slotElement,linkElement:this._linkElement,href:t,newTab:e,rel:s})}connectedCallback(){this.updateStyles()}updateStyles(){this._styles=b(),S.forEach(e=>{let s=zt=>`${e==="default"?"":`${e}-`}${zt}`,r=this.getAttribute(s("wh")),n=u(r===null?this.getAttribute(s("w")):r),o=u(r===null?this.getAttribute(s("h")):r),l=this.getAttribute(s("op")),h=this.getAttribute(s("z")),a=P(this.getAttribute(s("ar"))),d=Q(this.getAttribute(s("bgi"))),y=Q(this.getAttribute(s("bgs"))),x=Q(this.getAttribute(s("bgp"))),k=Q(this.getAttribute(s("bgr")));h!==null&&(this._styles[e]["z-index"]=h),l!==null&&(this._styles[e].opacity=l),a!==void 0&&(this._styles[e]["aspect-ratio"]=a),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:n,fillValue:"var(--width-stretch)",allowFlexGrow:!0}),v({styleBucket:this._styles[e],axis:"height",dimension:o,fillValue:"100%",allowFlexGrow:!0}),this.hasAttribute(s("hide"))&&(this._styles[e].display="none"),this.hasAttribute(s("show"))&&(this._styles[e].display="flex");let z=this.getAttribute(s("d")),A=this.getAttribute(s("ah")),E=this.getAttribute(s("av")),I=T({element:this,size:e,attr:"d"});z==="h"?this._styles[e]["flex-direction"]="row":z==="v"?this._styles[e]["flex-direction"]="column":e==="default"&&!z&&["sm","md","lg","xl"].some(ge=>this.hasAttribute(`${ge}-d`))&&(this._styles[e]["flex-direction"]="column");let H=I==="h",J=I==="v"||!I;H&&(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(s("wrap")),ue=this.hasAttribute(s("no-wrap"));ce&&(this._styles[e]["flex-wrap"]="wrap"),ue&&(this._styles[e]["flex-wrap"]="nowrap"),this.hasAttribute(s("stretch"))&&(this._styles[e]["align-self"]="stretch");let kt=this.hasAttribute(s("sh")),It=this.hasAttribute(s("sv")),pe=this.hasAttribute(s("hsb")),me=this.getAttribute(s("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,s){if(t==="href"||t==="new-tab"||t==="rel"){this._updateDOM();return}e!==s&&this.updateStyles()}},Vt=({render:i,html:t})=>at;var Oe={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);
|
|
@@ -1540,4 +1540,4 @@ var rettangoli=(()=>{var $=`
|
|
|
1540
1540
|
slot[name="content"] {
|
|
1541
1541
|
display: contents;
|
|
1542
1542
|
}
|
|
1543
|
-
`))}constructor(){super(),i.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[i.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-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,s){t==="open"?s!==null&&!this._isOpen?this.isConnected&&this._show():s===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 Qe){let e=O[t];if(e&&window.matchMedia(Ze(e)).matches)return t}return"default"}_getActiveResponsiveAttribute(t){return T({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(q)!=="true"&&this.setAttribute(q,"true"):this.hasAttribute(q)&&this.removeAttribute(q)}_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"]];for(let[r,n]of e){let o=this.getAttribute(r);o===null?t.removeAttribute(n):t.setAttribute(n,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 s=this.getAttribute("content-style");t.setAttribute("style",s?`${At} ${s}`:At)}_syncContentWrapper({reposition:t=!0}={}){let e=this._ensureContentWrapper(),s=Array.from(this.childNodes).filter(n=>n!==e&&!this._isIgnorableTextNode(n));for(let n of s)n.nodeType===Node.ELEMENT_NODE&&n.getAttribute("slot")==="content"&&n.removeAttribute("slot"),e.appendChild(n);this._syncContentWrapperAttributes(),Array.from(e.childNodes).some(n=>!this._isIgnorableTextNode(n))||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"),s=this._getActivePlace();this._updateActiveStateAttributes();let r=this._popoverContainer.getBoundingClientRect(),{left:n,top:o}=this._calculatePosition(t,e,r.width,r.height,s);this._popoverContainer.style.left=`${n}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,s,r,n){return oe({x:t,y:e,width:s,height:r,place:n,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight})}get popover(){return this._popoverContainer}get content(){return this._contentWrapper}refreshContent(){this._syncContentWrapper()}},de=({render:i,html:t})=>Ct;customElements.define("rtgl-button",Ot({}));customElements.define("rtgl-carousel",Nt({}));customElements.define("rtgl-grid",Ft({}));customElements.define("rtgl-view",Vt({}));customElements.define("rtgl-text",jt({}));customElements.define("rtgl-image",Gt({}));customElements.define("rtgl-tag",Yt({}));customElements.define("rtgl-svg",Qt({}));customElements.define("rtgl-input",L({}));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({}));})();
|
|
1543
|
+
`))}constructor(){super(),i.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[i.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,s){t==="open"?s!==null&&!this._isOpen?this.isConnected&&this._show():s===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 Qe){let e=O[t];if(e&&window.matchMedia(Ze(e)).matches)return t}return"default"}_getActiveResponsiveAttribute(t){return T({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(q)!=="true"&&this.setAttribute(q,"true"):this.hasAttribute(q)&&this.removeAttribute(q)}_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[r,n]of e){let o=this.getAttribute(r);o===null?t.removeAttribute(n):t.setAttribute(n,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 s=this.getAttribute("content-style");t.setAttribute("style",s?`${At} ${s}`:At)}_syncContentWrapper({reposition:t=!0}={}){let e=this._ensureContentWrapper(),s=Array.from(this.childNodes).filter(n=>n!==e&&!this._isIgnorableTextNode(n));for(let n of s)n.nodeType===Node.ELEMENT_NODE&&n.getAttribute("slot")==="content"&&n.removeAttribute("slot"),e.appendChild(n);this._syncContentWrapperAttributes(),Array.from(e.childNodes).some(n=>!this._isIgnorableTextNode(n))||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"),s=this._getActivePlace();this._updateActiveStateAttributes();let r=this._popoverContainer.getBoundingClientRect(),{left:n,top:o}=this._calculatePosition(t,e,r.width,r.height,s);this._popoverContainer.style.left=`${n}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,s,r,n){return oe({x:t,y:e,width:s,height:r,place:n,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight})}get popover(){return this._popoverContainer}get content(){return this._contentWrapper}refreshContent(){this._syncContentWrapper()}},de=({render:i,html:t})=>Ct;customElements.define("rtgl-button",Ot({}));customElements.define("rtgl-carousel",Nt({}));customElements.define("rtgl-grid",Ft({}));customElements.define("rtgl-view",Vt({}));customElements.define("rtgl-text",jt({}));customElements.define("rtgl-image",Gt({}));customElements.define("rtgl-tag",Yt({}));customElements.define("rtgl-svg",Qt({}));customElements.define("rtgl-input",L({}));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({}));})();
|