imba-localization 0.3.6 → 0.3.7
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/localization.imba +12 -2
- package/package.json +1 -1
package/localization.imba
CHANGED
|
@@ -58,6 +58,7 @@ tag language-selector
|
|
|
58
58
|
icons = "https://kapowaz.github.io/square-flags/flags/##.svg"
|
|
59
59
|
#dropdown = false
|
|
60
60
|
arrow = path-arrow-down
|
|
61
|
+
passive = false
|
|
61
62
|
|
|
62
63
|
def setup
|
|
63
64
|
if data
|
|
@@ -74,11 +75,20 @@ tag language-selector
|
|
|
74
75
|
return icons.replace('##',country)
|
|
75
76
|
|
|
76
77
|
def mouseleave e
|
|
78
|
+
return if passive
|
|
77
79
|
const rect = self.getBoundingClientRect!
|
|
78
80
|
const menu = $menu.getBoundingClientRect!
|
|
79
81
|
const inside = e.clientY >= menu.bottom || e.clientY <= rect.top || (e.clientX <= rect.left and e.clientY <= rect.bottom) || (e.clientX <= menu.left and e.clientY >= menu.top) || (e.clientX >= rect.right and e.clientY <= rect.bottom) || (e.clientX >= menu.right and e.clientY >= menu.top)
|
|
80
82
|
#dropdown = !inside
|
|
81
83
|
|
|
84
|
+
def mouseenter
|
|
85
|
+
return if passive
|
|
86
|
+
#dropdown = true
|
|
87
|
+
|
|
88
|
+
def click
|
|
89
|
+
return if !passive
|
|
90
|
+
#dropdown = !#dropdown
|
|
91
|
+
|
|
82
92
|
css
|
|
83
93
|
$ease: 0.5s
|
|
84
94
|
.container rd:8px px:15px py:8px cursor:pointer bgc:light-dark(#000000/10, #FFFFFF/20) fw:500 fs:13px ead:$ease bd:1px solid transparent
|
|
@@ -92,7 +102,7 @@ tag language-selector
|
|
|
92
102
|
.icon h:20px w:20px mr:10px rd:50% bd:1px solid transparent
|
|
93
103
|
.text fs:13px bd:1px solid transparent
|
|
94
104
|
|
|
95
|
-
<self [pos:rel] @mouseenter=
|
|
105
|
+
<self [pos:rel] @mouseenter=mouseenter @mouseleave=mouseleave @click=click>
|
|
96
106
|
<div.container [pos:rel d:hcc] .active=#dropdown>
|
|
97
107
|
<img.flag src=icon(state[state.active].$.flag)>
|
|
98
108
|
<div.name> state.$.name
|
|
@@ -102,6 +112,6 @@ tag language-selector
|
|
|
102
112
|
if #dropdown
|
|
103
113
|
<div$menu.menu [pos:abs w:100% > max-content o@off:0] ease>
|
|
104
114
|
for own key, value of state.languages
|
|
105
|
-
<div.item @click=onselect(key) [d:none]=(key == state.active)>
|
|
115
|
+
<div.item @click.trap=onselect(key) [d:none]=(key == state.active)>
|
|
106
116
|
<img.icon src=icon(value.$.flag)>
|
|
107
117
|
<span.text> value.$.name
|