diff --git a/gs-utils b/gs-utils index 206b97b9..c6bd0931 160000 --- a/gs-utils +++ b/gs-utils @@ -1 +1 @@ -Subproject commit 206b97b9eadb0df1449ce7e72539f1e0199cfad8 +Subproject commit c6bd0931b81adfe59efdf572d27cac44b33b3310 diff --git a/gsuiToggle/gsuiToggle.js b/gsuiToggle/gsuiToggle.js index cfadbc43..665c5a16 100644 --- a/gsuiToggle/gsuiToggle.js +++ b/gsuiToggle/gsuiToggle.js @@ -1,26 +1,25 @@ "use strict"; -class gsuiToggle extends HTMLElement { +class gsuiToggle extends gsui0ne { constructor() { - super(); + super( { + $cmpName: "gsuiToggle", + $tagName: "gsui-toggle", + $attributes: { tabindex: 0 } + } ); Object.seal( this ); - this.oncontextmenu = () => false; + this.oncontextmenu = GSUnoopFalse; this.onmousedown = e => { if ( e.button === 2 ) { - GSUdispatchEvent( this, "gsuiToggle", "toggleSolo" ); + this.$dispatch( "toggleSolo" ); } else if ( e.button === 0 ) { - const off = GSUgetAttribute( this, "off" ) !== null; + const off = GSUhasAttribute( this, "off" ); GSUsetAttribute( this, "off", !off ); - GSUdispatchEvent( this, "gsuiToggle", "toggle", off ); + this.$dispatch( "toggle", off ); } }; } - - // ......................................................................... - connectedCallback() { - GSUsetAttribute( this, "tabindex", 0 ); - } } Object.freeze( gsuiToggle ); diff --git a/gsuiToggle/index.html b/gsuiToggle/index.html index 90153bb6..570bf469 100644 --- a/gsuiToggle/index.html +++ b/gsuiToggle/index.html @@ -41,6 +41,7 @@ +