@rettangoli/ui 1.8.2 → 1.9.1
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 +2 -2
- package/dist/rettangoli-iife-ui.min.js +68 -68
- 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/popover.js +2 -0
- package/src/styles/buttonMarginStyles.js +1 -1
|
@@ -72,7 +72,7 @@ var rettangoli=(()=>{var $=`
|
|
|
72
72
|
background-color: var(--destructive);
|
|
73
73
|
color: var(--primary-foreground);
|
|
74
74
|
`,ol:`
|
|
75
|
-
background-color:
|
|
75
|
+
background-color: var(--background);
|
|
76
76
|
color: var(--foreground);
|
|
77
77
|
border-width: 1px;
|
|
78
78
|
`,gh:`
|
|
@@ -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({}));})();
|