lato 0.1.43 → 0.1.45

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: a34ec33506d24a255aa70857414131f233bcc5c812f3b38f139cd4e02cffc9f6
4
- data.tar.gz: f88a6b9db1e9956281ead6dfe9858d62eb421158d45484184df1fbe822fbdd53
3
+ metadata.gz: ba6b933633ecf25125ed9a54bd4378ccd2675dc4e5faba0a7bb24e92288a1dc9
4
+ data.tar.gz: '069cf1f1a248778481e77149c3681624b7fd17402629a116515c952bb62bb1da'
5
5
  SHA512:
6
- metadata.gz: 9ca0377c4ec076da3438e2021ecdc089671ce9f5275e5531dbf9f772c077f6630728806f3f3d889708c2335cead5951e0c3b5bbe289e4cb58a2d7a38bed739c5
7
- data.tar.gz: dde9d1be128466a57cfdceac660b5b6ab7cb2dd2b78465e29e7e42339bb7f7d13f6c7e2e7bb6b05cbcb970cb2884aed8913a08181619d0f3c8c1f21e70a0040c
6
+ metadata.gz: b5b1dd959434a3ccc753b482596fc37d9e6578f1f309b25fc7d490db56ab04931dda5061f48aceec0255720b7268ff7cd8778b9aef4c39761103b904b8f69737
7
+ data.tar.gz: c94d87c207c778834654f5481948b31a681be7c3e74952327f8246cd33f16c4f62f14b4141e5a10c4a74e30eddbabbe0a90077eafc4c173e682d94a9f8024e1b
@@ -5,19 +5,49 @@ import "bootstrap"
5
5
  // Import controllers (stimulus rails)
6
6
  import "controllers"
7
7
 
8
- // Close sidebar before page change with turbo
9
- document.addEventListener("turbo:before-visit", (e) => {
10
- document.body.classList.remove('aside-open')
8
+ /**
9
+ * Manage page transitions
10
+ */
11
+
12
+ const PAGE_TRANSITION_TIME = 150
13
+
14
+ document.addEventListener('DOMContentLoaded', () => {
15
+ console.log('DOMContentLoaded')
16
+
17
+ // add is-loaded class
18
+ document.body.classList.add('is-loaded')
11
19
  })
12
20
 
13
- // Close all boostrap modals before page change with turbo
14
- // NOTE: This is not a good solution, but it seems to work
15
- document.addEventListener("turbo:before-visit", (e) => {
16
- document.querySelectorAll('.modal.show').forEach((modal) => {
17
- modal.classList.remove('show')
18
- })
21
+ document.addEventListener('turbo:load', () => {
22
+ console.log('turbo:load')
23
+
24
+ setTimeout(() => {
25
+ // add is-loaded class
26
+ document.body.classList.add('is-loaded')
27
+ }, PAGE_TRANSITION_TIME)
28
+ })
19
29
 
20
- document.querySelectorAll('.modal-backdrop').forEach((backdrop) => {
21
- backdrop.remove()
30
+ document.addEventListener('turbo:before-render', (e) => {
31
+ console.log('turbo:before-render')
32
+
33
+ e.preventDefault()
34
+
35
+ // remove is-loaded class
36
+ document.body.classList.remove('is-loaded')
37
+
38
+ // hide modals and make body scrollable
39
+ document.querySelectorAll('.modal.show').forEach((el) => {
40
+ el.classList.remove('show')
41
+ el.style.display = 'none'
22
42
  })
23
- })
43
+ document.querySelectorAll('.modal-backdrop').forEach((el) => {
44
+ el.remove()
45
+ })
46
+ document.body.classList.remove('modal-open')
47
+ document.body.style.paddingRight = ''
48
+ document.body.style.overflow = ''
49
+
50
+ setTimeout(() => {
51
+ e.detail.resume()
52
+ }, PAGE_TRANSITION_TIME)
53
+ })
@@ -84,10 +84,7 @@ export default class extends Controller {
84
84
  this.modalBodyTargets[index].innerHTML = `
85
85
  <turbo-frame id="${options.turboFrame}">
86
86
  <div class="placeholder-glow">
87
- <span class="placeholder placeholder-lg col-12"></span>
88
- <span class="placeholder placeholder-lg col-12"></span>
89
- <span class="placeholder placeholder-lg col-12"></span>
90
- <span class="placeholder placeholder-lg col-12"></span>
87
+ ${Array(options.actionRows).fill().map(() => `<span class="placeholder placeholder-lg col-12"></span>`).join('')}
91
88
  </div>
92
89
  </turbo-frame>
93
90
  `
@@ -115,6 +112,8 @@ export default class extends Controller {
115
112
  options.turboFrame = element.getAttribute('data-turbo-frame')
116
113
  options.actionTitle = element.getAttribute('data-action-title')
117
114
  options.actionSize = element.getAttribute('data-action-size')
115
+ options.actionRows = element.getAttribute('data-action-rows')
116
+ options.actionRows = options.actionRows ? parseInt(options.actionRows) : 4
118
117
  return options
119
118
  }
120
119
 
@@ -24,8 +24,18 @@
24
24
 
25
25
  /** Custom style */
26
26
 
27
+ body {
28
+ &.is-loaded {
29
+ main {
30
+ opacity: 1;
31
+ }
32
+ }
33
+ }
34
+
27
35
  main {
28
36
  width: 100%;
37
+ opacity: 0;
38
+ transition: opacity 0.15s ease-in-out;
29
39
  }
30
40
 
31
41
  main, aside {
data/lib/lato/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lato
2
- VERSION = "0.1.43"
2
+ VERSION = "0.1.45"
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: 0.1.43
4
+ version: 0.1.45
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregorio Galante
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-10 00:00:00.000000000 Z
11
+ date: 2023-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails