lato 3.11.0 → 3.11.3
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5f0eb7f689dbdeaf6ed25131cbc8a6a4a3bdd3c0f402426373a29a9124d0506
|
4
|
+
data.tar.gz: ae388fcd54a59d7ac1f0b7ca3d3a342ac7839aaee1807697159b5c5fa7c67094
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c788d7f5b53aeb6f4bea7a4d5614f12697e5883ab99ca40b6752179b1f9dd9903334455153dcbe7f89473888a2a32908bfc1f8009f9043383d836367340d881
|
7
|
+
data.tar.gz: 4402d91bc41aa788e358f9aaea6592ae70630f6b9bbb375f15e51817fc3a01737d9d6b33c4c7679a1a30ae3c5e7f14c92792ee8e5eb058a0477be935d65ffb17
|
@@ -12,65 +12,127 @@ export default class extends Controller {
|
|
12
12
|
this.status = localStorageStatus ? JSON.parse(localStorageStatus) : {}
|
13
13
|
this.storeStatus()
|
14
14
|
|
15
|
-
this.
|
15
|
+
this.connected = true
|
16
|
+
this.tooltip = null
|
17
|
+
this.run()
|
18
|
+
|
19
|
+
window.addEventListener('resize', this.onWindowResize.bind(this))
|
16
20
|
}
|
17
21
|
|
18
|
-
|
19
|
-
|
22
|
+
disconnect() {
|
23
|
+
this.storeStatus()
|
20
24
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
+
if (this.tooltip) {
|
26
|
+
this.tooltip.hide()
|
27
|
+
this.tooltip.dispose()
|
28
|
+
this.tooltip = null
|
29
|
+
}
|
30
|
+
|
31
|
+
this.connected = false
|
25
32
|
|
26
|
-
this.
|
33
|
+
window.removeEventListener('resize', this.onWindowResize.bind(this))
|
27
34
|
}
|
28
35
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
if (this.status[item.key]) continue
|
36
|
+
itemTargetConnected(e) {
|
37
|
+
this.run()
|
38
|
+
}
|
33
39
|
|
34
|
-
|
40
|
+
itemTargetDisconnected(e) {
|
41
|
+
if (this.tooltip && this.tooltip.itemKey === e.target.dataset.guideKey) {
|
42
|
+
this.tooltip.hide()
|
43
|
+
this.tooltip.dispose()
|
44
|
+
this.tooltip = null
|
35
45
|
}
|
36
46
|
}
|
37
47
|
|
38
|
-
|
48
|
+
/**
|
49
|
+
* Exposed functions
|
50
|
+
*/
|
51
|
+
|
52
|
+
rerun(e = null) {
|
53
|
+
if (e) e.preventDefault()
|
54
|
+
this.resetStatus()
|
55
|
+
this.run()
|
56
|
+
}
|
57
|
+
|
58
|
+
run(e = null) {
|
59
|
+
if (e) e.preventDefault()
|
60
|
+
if (!this.connected) return
|
61
|
+
|
62
|
+
const items = this.getNotShowedItems()
|
63
|
+
if (items.length === 0) return
|
64
|
+
|
65
|
+
this.showItem(items[0])
|
66
|
+
}
|
67
|
+
|
68
|
+
/**
|
69
|
+
* Helpers
|
70
|
+
*/
|
71
|
+
|
72
|
+
getNotShowedItems() {
|
73
|
+
const items = this.itemTargets.map(item => ({ element: item, key: item.dataset.guideKey, content: item.dataset.guideContent, index: parseInt(item.dataset.guideIndex) })).map(item => {
|
74
|
+
item.index = isNaN(item.index) ? 999 : item.index
|
75
|
+
return item
|
76
|
+
}).sort((a, b) => a.index - b.index).filter((item) => !this.status[item.key])
|
77
|
+
|
78
|
+
return items
|
79
|
+
}
|
80
|
+
|
81
|
+
showItem(item) {
|
82
|
+
if (!this.status) return
|
39
83
|
if (this.status[item.key]) return
|
84
|
+
if (this.tooltip) return
|
40
85
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
86
|
+
// setup tooltip
|
87
|
+
const tooltipCloseId = `lato-guide-close-${Math.random().toString(36).substring(7)}`
|
88
|
+
const tooltipTitle = `
|
89
|
+
<div class="px-2 py-2 d-flex align-items-center justify-content-between">
|
90
|
+
<p class="me-2 mb-0 text-start">${item.content}</p>
|
91
|
+
<a id="${tooltipCloseId}" class="btn btn-light btn-sm">Next</a>
|
92
|
+
</div>
|
93
|
+
`
|
94
|
+
this.tooltip = new bootstrap.Tooltip(item.element, { title: tooltipTitle, trigger: 'manual', html: true, customClass: 'lato-guide-tooltip' })
|
95
|
+
this.tooltip.itemKey = item.key
|
96
|
+
|
97
|
+
// listen to tooltip close
|
98
|
+
item.element.addEventListener('shown.bs.tooltip', () => {
|
99
|
+
setTimeout(() => {
|
100
|
+
document.getElementById(tooltipCloseId).addEventListener('click', () => {
|
101
|
+
this.tooltip.hide()
|
102
|
+
this.tooltip.dispose()
|
103
|
+
this.tooltip = null
|
104
|
+
this.status[item.key] = true
|
105
|
+
this.storeStatus()
|
106
|
+
this.run()
|
107
|
+
})
|
108
|
+
}, 250)
|
62
109
|
})
|
110
|
+
this.tooltip.show()
|
111
|
+
|
112
|
+
return true
|
63
113
|
}
|
64
114
|
|
65
|
-
storeStatus(
|
66
|
-
if (e) e.preventDefault()
|
115
|
+
storeStatus() {
|
67
116
|
localStorage.setItem('lato_guide', JSON.stringify(this.status))
|
117
|
+
|
118
|
+
return true
|
68
119
|
}
|
69
120
|
|
70
|
-
resetStatus(
|
71
|
-
if (e) e.preventDefault()
|
121
|
+
resetStatus() {
|
72
122
|
this.status = {}
|
73
123
|
this.storeStatus()
|
74
|
-
|
124
|
+
|
125
|
+
return true
|
126
|
+
}
|
127
|
+
|
128
|
+
/**
|
129
|
+
* Events
|
130
|
+
*/
|
131
|
+
|
132
|
+
onWindowResize(e) { // on window resize, repostion tooltip
|
133
|
+
if (this.tooltip) {
|
134
|
+
this.tooltip.hide()
|
135
|
+
this.tooltip.show()
|
136
|
+
}
|
75
137
|
}
|
76
138
|
}
|
@@ -17,6 +17,9 @@ $gray-700: #454f58 !default;
|
|
17
17
|
$gray-800: #313a42 !default;
|
18
18
|
$gray-900: #1f262c !default;
|
19
19
|
|
20
|
+
$tooltip-opacity: 1;
|
21
|
+
$tooltip-max-width: 300px;
|
22
|
+
|
20
23
|
@import url("https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.2/font/bootstrap-icons.css");
|
21
24
|
@import "bootstrap";
|
22
25
|
|
@@ -127,4 +130,8 @@ main, aside {
|
|
127
130
|
100% {
|
128
131
|
transform: rotate(360deg);
|
129
132
|
}
|
133
|
+
}
|
134
|
+
|
135
|
+
.lato-guide-tooltip {
|
136
|
+
|
130
137
|
}
|
data/lib/lato/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lato
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.11.
|
4
|
+
version: 3.11.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregorio Galante
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-02-
|
11
|
+
date: 2025-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|