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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f76df5760390785be46c697426f361c2e9cb3202dafe87c04c166e14804f705d
|
|
4
|
+
data.tar.gz: 9b2041c4ec8a15c815eac106fb0349d1555eb99446f4acf51b436915ed68be17
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
|