lato 3.11.0 → 3.11.1

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: 890f6071431f470805aa8c253844356565814fbdc2ceb6152135fba2c02e79aa
4
- data.tar.gz: 8eddac1dc91f0a5755ee40a115b45038c023393e7ffee6200e796968c79a1a7f
3
+ metadata.gz: aac7553d07bfc74cea7e43c829e5e68a99ef5c4c1ca84c0abafbe3ed9b28d4e2
4
+ data.tar.gz: 946fa0334adad14cd55836470e5969a04be8d8533085811fd206cc21685bc333
5
5
  SHA512:
6
- metadata.gz: 04ece6a0739114376e060e78d5a05e967d76d5469363635d0f3912de92e1f1861ca7c6b862e666257b31a1beeec31d6387f03a6f9ebbe3ebffb366685929b6b4
7
- data.tar.gz: 113ea99f5ba6a087dafdf6594d348ecb283451010766254b2c207c1ff68841791171482866e2df7b8f4d49a4a68f79755076b5a6a0a54870a71492dc8e738b69
6
+ metadata.gz: fa351b5aaeb8c3610000eef54cfc6dc1fe000ede31e9a6963b5282c2f6591239a475da8285066f7c2e2483f5c8e1f2b7fbc109157cc6c035f4155c7ac66db3a0
7
+ data.tar.gz: 0ec8ec42232d0ec5c0cd4411e6b5821348772cd451ea81c3698b2c852b20b96457e907a387f58634b2a711bf294140b55e55123503074f353d7bf828503eecaa
@@ -55,5 +55,10 @@ document.addEventListener('turbo:before-cache', (e) => {
55
55
  document.querySelector('.navbar-toggler').classList.add('collapsed')
56
56
  document.querySelector('.navbar-collapse').classList.remove('show')
57
57
 
58
+ // remove all tooltips
59
+ document.querySelectorAll('.tooltip').forEach((el) => {
60
+ el.remove()
61
+ })
62
+
58
63
  e.detail?.resume()
59
64
  })
@@ -10,48 +10,65 @@ export default class extends Controller {
10
10
  connect() {
11
11
  const localStorageStatus = localStorage.getItem('lato_guide')
12
12
  this.status = localStorageStatus ? JSON.parse(localStorageStatus) : {}
13
+ this.items = null
14
+ this.showing = false
15
+
13
16
  this.storeStatus()
17
+ this.setupItems()
18
+ this.showGuide()
19
+ }
20
+
21
+ itemTargetConnected(e) {
22
+ this.setupItems()
23
+ this.showGuide()
24
+ }
14
25
 
15
- this.start()
26
+ itemTargetDisconnected(e) {
27
+ this.setupItems()
16
28
  }
17
29
 
18
- start(e = null) {
30
+ setupItems(e = null) {
19
31
  if (e) e.preventDefault()
20
32
 
21
- const targets = this.itemTargets.map(item => ({ element: item, key: item.dataset.guideKey, content: item.dataset.guideContent, index: parseInt(item.dataset.guideIndex) })).map(item => {
33
+ this.items = this.itemTargets.map(item => ({ element: item, key: item.dataset.guideKey, content: item.dataset.guideContent, index: parseInt(item.dataset.guideIndex) })).map(item => {
22
34
  item.index = isNaN(item.index) ? 999 : item.index
23
35
  return item
24
36
  }).sort((a, b) => a.index - b.index)
25
-
26
- this.showGuide(targets)
27
37
  }
28
38
 
29
- async showGuide(targets) {
30
- for (let i = 0; i < targets.length; i++) {
31
- const item = targets[i]
32
- if (this.status[item.key]) continue
39
+ async showGuide() {
40
+ if (this.showing) return
41
+ if (!this.status) return
42
+ if (!this.items) return
33
43
 
34
- await this.showGuideItem(item, i === targets.length - 1)
44
+ for (const item of this.items) {
45
+ if (this.status[item.key]) continue
46
+ await this.showGuideItem(item)
35
47
  }
36
48
  }
37
49
 
38
- async showGuideItem(item, isLast = false) {
50
+ async showGuideItem(item) {
51
+ if (this.showing) return
52
+ if (!this.status) return
39
53
  if (this.status[item.key]) return
40
54
 
55
+ this.showing = true
41
56
  return new Promise((resolve) => {
42
- const tooltipCloseId = `guide-close-${Math.random().toString(36).substring(7)}`
57
+ const tooltipIsLast = this.items.filter(target => !this.status[target.key]).length === 1
58
+ const tooltipCloseId = `lato-guide-close-${Math.random().toString(36).substring(7)}`
43
59
  const tooltipTitle = `
44
- <div class="px-3 py-3">
45
- <p class="mb-1">${item.content}</p>
46
- <a id="${tooltipCloseId}" class="btn btn-light btn-sm mt-2">${isLast ? 'Close' : 'Next'}</a>
60
+ <div class="px-2 py-2 d-flex align-items-center justify-content-between">
61
+ <p class="me-2 mb-0 text-start">${item.content}</p>
62
+ <a id="${tooltipCloseId}" class="btn btn-light btn-sm">${tooltipIsLast ? 'Close' : 'Next'}</a>
47
63
  </div>
48
64
  `
49
65
 
50
- const tooltip = new bootstrap.Tooltip(item.element, { title: tooltipTitle, trigger: 'manual', html: true })
66
+ const tooltip = new bootstrap.Tooltip(item.element, { title: tooltipTitle, trigger: 'manual', html: true, customClass: 'lato-guide-tooltip' })
51
67
  item.element.addEventListener('shown.bs.tooltip', () => {
52
68
  setTimeout(() => {
53
69
  document.getElementById(tooltipCloseId).addEventListener('click', () => {
54
70
  tooltip.hide()
71
+ this.showing = false
55
72
  this.status[item.key] = true
56
73
  this.storeStatus()
57
74
  resolve()
@@ -71,6 +88,6 @@ export default class extends Controller {
71
88
  if (e) e.preventDefault()
72
89
  this.status = {}
73
90
  this.storeStatus()
74
- this.start()
91
+ this.showGuide()
75
92
  }
76
93
  }
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Lato
2
- VERSION = "3.11.0"
2
+ VERSION = "3.11.1"
3
3
  end
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.0
4
+ version: 3.11.1
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-12 00:00:00.000000000 Z
11
+ date: 2025-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails