lostcoords-ui 0.14.14 → 0.14.15

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: dd77dbe9de01d08ee1a49ee39764c0e4de02307ea2be5a2f7eebe000aca2b0c4
4
- data.tar.gz: 80ca196ac506c0a6410dc7b1d761517c4935b855f24b729d153f468bc752b1b8
3
+ metadata.gz: f76df5760390785be46c697426f361c2e9cb3202dafe87c04c166e14804f705d
4
+ data.tar.gz: 9b2041c4ec8a15c815eac106fb0349d1555eb99446f4acf51b436915ed68be17
5
5
  SHA512:
6
- metadata.gz: 7458a749f77b100455d279d532b5ab6933aa7c6b10bedf399ed6910e84dbf813baec8058bd3c2e73b722c20e6f2362f2810cc657886f7c2e661bde49cdfbbe1a
7
- data.tar.gz: '0324502035085506805b9c0fd65c985404061a52f3cf9a115851954a6b9e66cd01e34d49073da26a674381bae30c78ced352d3f21747b2139a9245aea67e2968'
6
+ metadata.gz: 4534f315b2c41fa8d7b43049eafe7161cf84a8ae61fb6914088ca421212686b314723c35ac16a9bae9490fa80a9201c00a348c489e3d3ab246088e3e1fa7e071
7
+ data.tar.gz: 6bd1c7a60d1fb826a9c1e5fe772b22aa8ceb05dfdc01b8dab8eb1b76e07d180e453970db6c25f10383c7888093be9aba0eba1e0d8c1aa2340885fe63005f6402
@@ -4,6 +4,20 @@ import { Controller } from "@hotwired/stimulus"
4
4
  // label and the new one slides from there to its current link.
5
5
  const spots = new Map()
6
6
 
7
+ // A same-URL refresh morphs the page against server HTML, which carries neither the indicator's
8
+ // place nor the mark of the link the server rendered as current. Morphed away, the indicator
9
+ // would vanish until the next click, and a page restored from Turbo's cache would mark the link
10
+ // clicked last.
11
+ const KEPT = {
12
+ "data-lc-nav-initial": '[data-lc-nav-target~="link"]',
13
+ "data-indicator": '[data-controller~="lc-nav"]',
14
+ style: '[data-lc-nav-target~="indicator"]',
15
+ }
16
+ document.addEventListener("turbo:before-morph-attribute", (event) => {
17
+ const kept = KEPT[event.detail.attributeName]
18
+ if (kept && event.target.matches(kept)) event.preventDefault()
19
+ })
20
+
7
21
  export default class extends Controller {
8
22
  static targets = ["indicator", "link"]
9
23
 
@@ -1,5 +1,5 @@
1
1
  module Lostcoords
2
2
  module Ui
3
- VERSION = "0.14.14"
3
+ VERSION = "0.14.15"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lostcoords-ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.14
4
+ version: 0.14.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lost Coordinates