shimmer 0.0.40 → 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: 5506a51bba0e3b7bd2e1890b492495dd81e6b022ac80ad89f3742554a8af1cfa
4
- data.tar.gz: 27306ea6f76d995b790f0285fc3e4810b3ffc85819438f464073ce3bb037ca48
3
+ metadata.gz: 557b926b9a2cf8f02c044f15d4a5cd174ffd79c7882fa338f81facf5ca29626d
4
+ data.tar.gz: dcf50f8c696654a586c0c9bfce088fe54beb7d1ae571e6202946fb7395edaf2d
5
5
  SHA512:
6
- metadata.gz: 171daf856ef54a34063e037118e506cc4bd7e5577170e643d69e410fdea7b322e944d9122a60ab82a8992587f7f2a565d1f5a492349026547d8c570d08139bfe
7
- data.tar.gz: 0461e40d0a5847ad8ff5aeb28fb43e8c504a573363a8c5e50595d4bfd28e44d1c29085bd0167858f0e3131f1ac1dac9afc63aaf18325014f3b84d1c4a964cfe6
6
+ metadata.gz: 5b09d05c6dc817fe747796540fb4c3cf625e42b84313555e8d3a48f73969ac67ee5b3fc528af056d6cd1f08a718c9dcddab65147a606649ebd1a46c81ba7ea8d
7
+ data.tar.gz: 11b0a1a52dbb32986d8a760ff52efea2ae7b3c734678bc672828fbbd911264c5bf553d973a129fc1d923fb04719a691e2b385e0eb6da77490e2bd08f478e1e26
@@ -17,8 +17,9 @@ module Shimmer
17
17
  key = method_name.delete_suffix("!").delete_suffix("?").to_sym
18
18
  required = method_name.end_with?("!")
19
19
  type = :bool if method_name.end_with?("?")
20
- value = ENV[key.to_s.upcase].presence
21
- value ||= credentials.dig(Rails.env.to_sym, key)
20
+ value = @stubbed_values&.dig(key)
21
+ value ||= ENV[key.to_s.upcase].presence
22
+ value ||= credentials.dig(ENV["CONFIG_ENV"]&.to_sym || Rails.env.to_sym, key)
22
23
  value ||= credentials[key]
23
24
  value = default_value if value.nil?
24
25
  raise MissingConfigError, "#{key.upcase} environment value is missing" if required && value.blank?
@@ -30,6 +31,13 @@ module Shimmer
30
31
  true
31
32
  end
32
33
 
34
+ def stub(**values)
35
+ @stubbed_values = values.to_h.deep_transform_keys(&:to_sym)
36
+ yield
37
+ ensure
38
+ @stubbed_values = nil
39
+ end
40
+
33
41
  private
34
42
 
35
43
  def coerce(value, type)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Shimmer
4
- VERSION = "0.0.40"
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.40
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: []
@@ -25,7 +25,6 @@ files:
25
25
  - ".prettierrc"
26
26
  - ".rspec"
27
27
  - ".rubocop.yml"
28
- - ".ruby-version"
29
28
  - ".solargraph.yml"
30
29
  - ".vscode/settings.json"
31
30
  - CHANGELOG.md
@@ -121,7 +120,7 @@ licenses:
121
120
  metadata:
122
121
  homepage_uri: https://github.com/nerdgeschoss/shimmer
123
122
  source_code_uri: https://github.com/nerdgeschoss/shimmer
124
- post_install_message:
123
+ post_install_message:
125
124
  rdoc_options: []
126
125
  require_paths:
127
126
  - lib
@@ -136,8 +135,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
135
  - !ruby/object:Gem::Version
137
136
  version: '0'
138
137
  requirements: []
139
- rubygems_version: 3.3.27
140
- signing_key:
138
+ rubygems_version: 3.5.22
139
+ signing_key:
141
140
  specification_version: 4
142
141
  summary: Shimmer brings all the bells and whistles of a hotwired application, right
143
142
  from the start.
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 3.1.6