shimmer 0.0.41 → 0.0.42

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: 3314020b6aa5d270ed5edccb0a3a2d8b6ac3e856121a4fd26485086a4d66cc3e
4
- data.tar.gz: 8f1dbd12ed39cd5825804e69c215dd1158c60a475f19fc29658a93178e1d7bb4
3
+ metadata.gz: 557b926b9a2cf8f02c044f15d4a5cd174ffd79c7882fa338f81facf5ca29626d
4
+ data.tar.gz: dcf50f8c696654a586c0c9bfce088fe54beb7d1ae571e6202946fb7395edaf2d
5
5
  SHA512:
6
- metadata.gz: 18a0dc8afa5db10b8ce897c5909c45abbdfac9c99fcd7d1221b9ec95827de8dfad76eb28eecde04e38a711df999e7ec81258f786101dadededff6aecb298d2f5
7
- data.tar.gz: f46b20077102d040374c08ed4870ad100dbd7efa1db2aadc69d2abe85218b0e5c67b35ab3ce390c623c6579615737fdee99e1ce80db50779ea746859319d4b11
6
+ metadata.gz: 5b09d05c6dc817fe747796540fb4c3cf625e42b84313555e8d3a48f73969ac67ee5b3fc528af056d6cd1f08a718c9dcddab65147a606649ebd1a46c81ba7ea8d
7
+ data.tar.gz: 11b0a1a52dbb32986d8a760ff52efea2ae7b3c734678bc672828fbbd911264c5bf553d973a129fc1d923fb04719a691e2b385e0eb6da77490e2bd08f478e1e26
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Shimmer
4
- VERSION = "0.0.41"
4
+ VERSION = "0.0.42"
5
5
  end
data/src/modal.ts CHANGED
@@ -12,6 +12,7 @@ export class ModalPresenter {
12
12
 
13
13
  constructor() {
14
14
  document.addEventListener("turbo:load", this.prepareBlind);
15
+ document.addEventListener("turbo:before-cache", this.leave.bind(this));
15
16
  }
16
17
 
17
18
  async open(options: ModalOptions): Promise<void> {
@@ -38,8 +39,16 @@ export class ModalPresenter {
38
39
  document.body.classList.toggle("modal-open", open);
39
40
  }
40
41
 
42
+ private leave(): void {
43
+ Object.values(this.modals).map((e) => e.destroy());
44
+ this.modals = {};
45
+ this.updateBlindStatus();
46
+ }
47
+
41
48
  private prepareBlind: () => void = () => {
42
- createElement(document.body, "modal-blind");
49
+ if (!document.querySelector("body > .modal-blind")) {
50
+ createElement(document.body, "modal-blind");
51
+ }
43
52
  };
44
53
  }
45
54
 
@@ -82,7 +91,11 @@ export class Modal {
82
91
  }
83
92
  root.classList.remove("modal--open");
84
93
  await wait(1);
85
- root.remove();
94
+ this.destroy();
95
+ }
96
+
97
+ destroy(): void {
98
+ this.root?.remove();
86
99
  this.root = undefined;
87
100
  }
88
101
  }
data/src/util.ts CHANGED
@@ -61,5 +61,5 @@ export function getCookie(key: string): string | null {
61
61
  export function setCookie(key: string, value: string): void {
62
62
  const date = new Date();
63
63
  date.setTime(date.getTime() + 365 * 24 * 60 * 60 * 1000);
64
- document.cookie = `${key}=${value}; expires=${date.toUTCString()}`;
64
+ document.cookie = `${key}=${value}; path=/; expires=${date.toUTCString()}`;
65
65
  }
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shimmer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.41
4
+ version: 0.0.42
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Ravens
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-10-23 00:00:00.000000000 Z
11
+ date: 2025-03-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description:
13
+ description:
14
14
  email:
15
15
  - jens@nerdgeschoss.de
16
16
  executables: []
@@ -120,7 +120,7 @@ licenses:
120
120
  metadata:
121
121
  homepage_uri: https://github.com/nerdgeschoss/shimmer
122
122
  source_code_uri: https://github.com/nerdgeschoss/shimmer
123
- post_install_message:
123
+ post_install_message:
124
124
  rdoc_options: []
125
125
  require_paths:
126
126
  - lib
@@ -135,8 +135,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  - !ruby/object:Gem::Version
136
136
  version: '0'
137
137
  requirements: []
138
- rubygems_version: 3.5.16
139
- signing_key:
138
+ rubygems_version: 3.5.22
139
+ signing_key:
140
140
  specification_version: 4
141
141
  summary: Shimmer brings all the bells and whistles of a hotwired application, right
142
142
  from the start.