@gjsify/adwaita-web 0.3.19 → 0.3.21
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/package.json +4 -4
- package/src/elements/adw-card.js +1 -1
- package/src/elements/adw-combo-row.js +1 -1
- package/src/elements/adw-header-bar.js +1 -1
- package/src/elements/adw-overlay-split-view.js +1 -1
- package/src/elements/adw-preferences-group.js +1 -1
- package/src/elements/adw-spin-row.js +1 -1
- package/src/elements/adw-switch-row.js +1 -1
- package/src/elements/adw-toast-overlay.js +1 -1
- package/src/elements/adw-window.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/adwaita-web",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.21",
|
|
4
4
|
"description": "Adwaita/Libadwaita web components for browser targets",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"build:types": "tsc"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@gjsify/adwaita-fonts": "^0.3.
|
|
37
|
-
"@gjsify/adwaita-icons": "^0.3.
|
|
36
|
+
"@gjsify/adwaita-fonts": "^0.3.21",
|
|
37
|
+
"@gjsify/adwaita-icons": "^0.3.21"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@gjsify/cli": "^0.3.
|
|
40
|
+
"@gjsify/cli": "^0.3.21",
|
|
41
41
|
"sass": "^1.99.0",
|
|
42
42
|
"typescript": "^6.0.3"
|
|
43
43
|
}
|
package/src/elements/adw-card.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var AdwCard=class extends HTMLElement{connectedCallback(){this.classList.add(`adw-card`)}};customElements.define(`adw-card`,AdwCard);export{AdwCard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var AdwComboRow=class extends HTMLElement{_select;_valueEl;_items=[];_initialized=!1;static get observedAttributes(){return[`selected`]}get selected(){return this._select?this._select.selectedIndex:parseInt(this.getAttribute(`selected`)||`0`,10)}set selected(e){this.setAttribute(`selected`,String(e))}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=this.getAttribute(`title`)||``;this._items=JSON.parse(this.getAttribute(`items`)||`[]`);let t=parseInt(this.getAttribute(`selected`)||`0`,10),n=document.createElement(`span`);n.className=`adw-row-title`,n.textContent=e;let r=document.createElement(`span`);r.className=`adw-row-value`,r.textContent=this._items[t]??``,this._valueEl=r;let i=document.createElement(`select`);this._items.forEach((e,n)=>{let r=document.createElement(`option`);r.value=String(n),r.textContent=e,n===t&&(r.selected=!0),i.appendChild(r)}),this.appendChild(n),this.appendChild(r),this.appendChild(i),this._select=i,this._select.addEventListener(`change`,()=>{let e=this._select.selectedIndex;this._valueEl.textContent=this._items[e]??``,this.setAttribute(`selected`,String(e)),this.dispatchEvent(new CustomEvent(`notify::selected`,{bubbles:!0,detail:{selected:e}}))})}attributeChangedCallback(e,t,n){if(e===`selected`&&this._select){let e=parseInt(n||`0`,10);this._select.selectedIndex=e,this._valueEl&&(this._valueEl.textContent=this._items[e]??``)}}};customElements.define(`adw-combo-row`,AdwComboRow);export{AdwComboRow};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var AdwHeaderBar=class extends HTMLElement{_initialized=!1;_startEl=null;_endEl=null;get startSection(){return this._startEl}get endSection(){return this._endEl}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=this.getAttribute(`title`)||``,t=Array.from(this.querySelectorAll(`:scope > [slot="start"]`)),n=Array.from(this.querySelectorAll(`:scope > [slot="end"]`));this._startEl=document.createElement(`div`),this._startEl.className=`adw-header-bar-start`;for(let e of t)this._startEl.appendChild(e);let r=document.createElement(`div`);r.className=`adw-header-bar-center`;let i=document.createElement(`span`);i.className=`adw-header-bar-title`,i.textContent=e,r.appendChild(i),this._endEl=document.createElement(`div`),this._endEl.className=`adw-header-bar-end`;for(let e of n)this._endEl.appendChild(e);this.replaceChildren(this._startEl,r,this._endEl)}};customElements.define(`adw-header-bar`,AdwHeaderBar);export{AdwHeaderBar};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var AdwOverlaySplitView=class extends HTMLElement{_initialized=!1;_sidebarEl;_contentEl;_backdropEl;static get observedAttributes(){return[`show-sidebar`,`collapsed`,`sidebar-position`,`min-sidebar-width`,`max-sidebar-width`,`sidebar-width-fraction`]}get showSidebar(){return this.hasAttribute(`show-sidebar`)}set showSidebar(e){e?this.setAttribute(`show-sidebar`,``):this.removeAttribute(`show-sidebar`)}get collapsed(){return this.hasAttribute(`collapsed`)}set collapsed(e){e?this.setAttribute(`collapsed`,``):this.removeAttribute(`collapsed`)}get minSidebarWidth(){return parseFloat(this.getAttribute(`min-sidebar-width`)||`280`)}get maxSidebarWidth(){return parseFloat(this.getAttribute(`max-sidebar-width`)||`400`)}get sidebarWidthFraction(){return parseFloat(this.getAttribute(`sidebar-width-fraction`)||`0.30`)}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=Array.from(this.querySelectorAll(`[slot="sidebar"]`)),t=Array.from(this.querySelectorAll(`[slot="content"]`)),n=Array.from(this.childNodes).filter(n=>!e.includes(n)&&!t.includes(n));this.replaceChildren(),this._sidebarEl=document.createElement(`div`),this._sidebarEl.className=`adw-osv-sidebar`,e.forEach(e=>this._sidebarEl.appendChild(e)),this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-osv-content`,t.forEach(e=>this._contentEl.appendChild(e)),n.forEach(e=>this._contentEl.appendChild(e)),this._backdropEl=document.createElement(`div`),this._backdropEl.className=`adw-osv-backdrop`,this._backdropEl.addEventListener(`click`,()=>this.hideSidebar()),this.append(this._sidebarEl,this._contentEl,this._backdropEl),this._syncClasses(),this._syncSidebarWidth()}attributeChangedCallback(e,t,n){this._initialized&&(this._syncClasses(),(e===`min-sidebar-width`||e===`max-sidebar-width`||e===`sidebar-width-fraction`)&&this._syncSidebarWidth())}openSidebar(){this.showSidebar=!0,this.dispatchEvent(new CustomEvent(`sidebar-toggled`,{detail:{isVisible:!0}}))}hideSidebar(){this.showSidebar=!1,this.dispatchEvent(new CustomEvent(`sidebar-toggled`,{detail:{isVisible:!1}}))}toggleSidebar(){this.showSidebar=!this.showSidebar,this.dispatchEvent(new CustomEvent(`sidebar-toggled`,{detail:{isVisible:this.showSidebar}}))}_syncClasses(){this.classList.toggle(`collapsed`,this.collapsed),this.classList.toggle(`show-sidebar`,this.showSidebar);let e=this.getAttribute(`sidebar-position`)||`start`;if(this.classList.toggle(`sidebar-start`,e===`start`),this.classList.toggle(`sidebar-end`,e===`end`),this._sidebarEl&&!this.collapsed)if(this.showSidebar)this._sidebarEl.style.marginRight=``;else{let e=this._sidebarEl.offsetWidth;this._sidebarEl.style.marginRight=`-${e}px`}}_syncSidebarWidth(){this._sidebarEl&&(this._sidebarEl.style.minWidth=`${this.minSidebarWidth}px`,this._sidebarEl.style.maxWidth=`${this.maxSidebarWidth}px`,this._sidebarEl.style.width=`${this.sidebarWidthFraction*100}%`)}};customElements.define(`adw-overlay-split-view`,AdwOverlaySplitView);export{AdwOverlaySplitView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var AdwPreferencesGroup=class extends HTMLElement{_initialized=!1;connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=this.getAttribute(`title`)||``,t=Array.from(this.childNodes),n=document.createElement(`div`);n.className=`adw-preferences-group-header`;let r=document.createElement(`span`);r.className=`adw-preferences-group-title`,r.textContent=e,n.appendChild(r);let i=document.createElement(`div`);i.className=`adw-preferences-group-listbox`,t.forEach(e=>i.appendChild(e)),this.appendChild(n),this.appendChild(i)}};customElements.define(`adw-preferences-group`,AdwPreferencesGroup);export{AdwPreferencesGroup};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var AdwSpinRow=class extends HTMLElement{_input;_min=0;_max=100;_step=1;_value=0;_initialized=!1;static get observedAttributes(){return[`value`,`min`,`max`,`step`]}get value(){return this._value}set value(e){let t=Math.min(this._max,Math.max(this._min,e)),n=this._countDecimals(this._step);this._value=parseFloat(t.toFixed(n)),this._input&&(this._input.value=this._formatValue(this._value)),this.setAttribute(`value`,String(this._value))}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=this.getAttribute(`title`)||``;this._min=parseFloat(this.getAttribute(`min`)||`0`),this._max=parseFloat(this.getAttribute(`max`)||`100`),this._step=parseFloat(this.getAttribute(`step`)||`1`),this._value=parseFloat(this.getAttribute(`value`)||String(this._min));let t=document.createElement(`span`);t.className=`adw-row-title`,t.textContent=e;let n=document.createElement(`div`);n.className=`adw-spin-control`;let r=document.createElement(`button`);r.className=`adw-spin-dec`,r.textContent=`−`,r.addEventListener(`click`,()=>this._adjust(-this._step));let i=document.createElement(`input`);i.type=`text`,i.value=this._formatValue(this._value),i.addEventListener(`change`,()=>{let e=parseFloat(i.value);isNaN(e)?i.value=this._formatValue(this._value):(this.value=e,this._emitChange())});let a=document.createElement(`button`);a.className=`adw-spin-inc`,a.textContent=`+`,a.addEventListener(`click`,()=>this._adjust(this._step)),n.append(r,i,a),this.append(t,n),this._input=i}attributeChangedCallback(e,t,n){if(!this._initialized)return;let r=parseFloat(n||`0`);switch(e){case`value`:r!==this._value&&(this._value=Math.min(this._max,Math.max(this._min,r)),this._input.value=this._formatValue(this._value));break;case`min`:this._min=r;break;case`max`:this._max=r;break;case`step`:this._step=r;break}}_adjust(e){this.value=this._value+e,this._emitChange()}_emitChange(){this.dispatchEvent(new CustomEvent(`notify::value`,{bubbles:!0,detail:{value:this._value}}))}_countDecimals(e){let t=String(e),n=t.indexOf(`.`);return n===-1?0:t.length-n-1}_formatValue(e){let t=this._countDecimals(this._step);return t>0?e.toFixed(t):String(e)}};customElements.define(`adw-spin-row`,AdwSpinRow);export{AdwSpinRow};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var AdwSwitchRow=class extends HTMLElement{_checkbox;_initialized=!1;static get observedAttributes(){return[`active`]}get active(){return this.hasAttribute(`active`)}set active(e){e?this.setAttribute(`active`,``):this.removeAttribute(`active`)}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=this.getAttribute(`title`)||``,t=this.hasAttribute(`active`),n=document.createElement(`span`);n.className=`adw-row-title`,n.textContent=e;let r=document.createElement(`label`);r.className=`adw-switch`;let i=document.createElement(`input`);i.type=`checkbox`,i.checked=t;let a=document.createElement(`span`);a.className=`adw-switch-slider`,r.appendChild(i),r.appendChild(a),this.appendChild(n),this.appendChild(r),this._checkbox=i,this._checkbox.addEventListener(`change`,()=>{this.toggleAttribute(`active`,this._checkbox.checked),this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active:this._checkbox.checked}}))})}attributeChangedCallback(e,t,n){e===`active`&&this._checkbox&&(this._checkbox.checked=n!==null)}};customElements.define(`adw-switch-row`,AdwSwitchRow);export{AdwSwitchRow};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var AdwToastOverlay=class extends HTMLElement{addToast(e,t=2e3){let n=document.createElement(`div`);n.className=`adw-toast`;let r=document.createElement(`span`);r.className=`adw-toast-title`,r.textContent=e,n.appendChild(r),this.appendChild(n),requestAnimationFrame(()=>{n.classList.add(`visible`)}),setTimeout(()=>{n.classList.remove(`visible`),n.classList.add(`hiding`),n.addEventListener(`transitionend`,()=>n.remove(),{once:!0}),setTimeout(()=>{n.parentNode&&n.remove()},300)},t)}};customElements.define(`adw-toast-overlay`,AdwToastOverlay);export{AdwToastOverlay};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var AdwWindow=class extends HTMLElement{connectedCallback(){let e=this.getAttribute(`width`),t=this.getAttribute(`height`);e&&(this.style.width=`${e}px`),t&&(this.style.height=`${t}px`)}};customElements.define(`adw-window`,AdwWindow);export{AdwWindow};
|