imba-localization 0.2.7 → 0.2.9
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 -10
- package/package.json +1 -1
package/localization.imba
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export class
|
|
1
|
+
export class Localization
|
|
2
2
|
onready
|
|
3
3
|
onerror
|
|
4
4
|
onchange
|
|
@@ -50,17 +50,20 @@ export class LocalizationState
|
|
|
50
50
|
if window.localStorage.getItem('imba-localization') != name
|
|
51
51
|
window.localStorage.setItem('imba-localization', name)
|
|
52
52
|
onchange(name) if onchange isa Function
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
|
|
54
|
+
const arrow-down =
|
|
55
|
+
<svg viewBox="0 0 256 256">
|
|
56
|
+
<path d="M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z">
|
|
57
|
+
|
|
58
|
+
tag icon-arrow-down
|
|
55
59
|
<self>
|
|
56
|
-
<
|
|
57
|
-
<path d="M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z">
|
|
60
|
+
<{arrow-down}>
|
|
58
61
|
|
|
59
|
-
|
|
62
|
+
tag language-selector
|
|
60
63
|
state
|
|
61
64
|
icons = "https://kapowaz.github.io/square-flags/flags/##.svg"
|
|
62
65
|
#dropdown = false
|
|
63
|
-
arrow =
|
|
66
|
+
icon-arrow = arrow-down
|
|
64
67
|
|
|
65
68
|
def onselect key
|
|
66
69
|
#dropdown = false
|
|
@@ -91,12 +94,11 @@ export tag LocalizationSelector
|
|
|
91
94
|
<div.main [pos:rel d:hcc] .main-active=#dropdown>
|
|
92
95
|
<img.main-flag src=icon(state[state.active].$.flag)>
|
|
93
96
|
<div.main-name> state.$.name
|
|
94
|
-
<{arrow}.main-arrow [scale-y:1]=#dropdown>
|
|
97
|
+
<{icon-arrow}.main-arrow [scale-y:1]=#dropdown>
|
|
95
98
|
|
|
96
99
|
if #dropdown
|
|
97
100
|
<div$menu.menu [pos:abs w:100% > max-content o@off:0] ease>
|
|
98
101
|
for own key, value of state.languages
|
|
99
102
|
<div.menu-item @click=onselect(key) [d:none]=(key == state.active)>
|
|
100
103
|
<img.menu-item-icon src=icon(value.$.flag)>
|
|
101
|
-
<span.menu-item-text> value.$.name
|
|
102
|
-
|
|
104
|
+
<span.menu-item-text> value.$.name
|