ultimate_turbo_modal 2.0.0 → 2.0.2

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: f3b5904322605f3b7396d94ded0bdc75811c650a60f2519a0146ae35264dba8d
4
- data.tar.gz: c15e270e64dc9edd02dee5edaf34d628675939753652dda7ddee66350e5ea0ff
3
+ metadata.gz: eb5a2d990486959d808b557642c17ada12d887416c4158d42550e9655dbe6b2f
4
+ data.tar.gz: dc3ee5b170cd735bc87a0a67a693a9a68c36c8b9cc9bde371a2a7bca0c512744
5
5
  SHA512:
6
- metadata.gz: b4201e5baf0af117cd4899ed12ade81dabc871766124922b5b37ff26eab65affcbeefeb9e41c0f4e9de314c7495f2e36c9ac65b8c95cff63dc4c415f66f93eb0
7
- data.tar.gz: 30d25cd678cd64d36211043def154e5e8ec5c6c71fd4956b58b9fdd9be1bb75541aaa25332507283e0aebd78ef7b031a0eba268859894628b2a44525325a6d04
6
+ metadata.gz: 5474e9849437b9e97496ba1af522d449c7c3dc26cda3e296c603acc3356f53c1ef24527cb96ecbd42e9713553940d1dd54890297fb9fa2d98f62763b39b1424e
7
+ data.tar.gz: af196848be428193650a240b3ad78512b175cf294f76821fb279546630ecbcb0d0bb3029e97d538382bc1c7c8c7005a3d03ed3354487321a0890132edf729c7e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [2.0.2] - 2025-04-11
2
+
3
+ - Warn if the NPM package and Ruby Gem versions don't match.
4
+
5
+ ## [2.0.1] - 2025-04-11
6
+
7
+ - Properly call `raw` for Phlex 2, and `unsafe_raw` for Phlex 1. Thanks @cavenk!
8
+
1
9
  ## [2.0.0] - 2025-04-07 - Breaking changes!
2
10
 
3
11
  - Much simplified installation with a Rails generator
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ultimate_turbo_modal (2.0.0)
4
+ ultimate_turbo_modal (2.0.2)
5
5
  phlex-rails
6
6
  rails
7
7
  stimulus-rails
data/README.md CHANGED
@@ -22,17 +22,6 @@ $ bundle exec rails g ultimate_turbo_modal:install
22
22
   
23
23
   
24
24
 
25
- ### Upgrading from version 1.x
26
-
27
- - Remove the two `setupUltimateTurboModal`-related lines from `app/javascript/controllers/index.js`:
28
-
29
- - Remove anything UTMR-specific in `tailwind.config.js`.
30
-
31
- - Remove the optional Idiomorph tweaks:
32
- - `<script src="https://unpkg.com/idiomorph"></script>` from your HTML
33
- - `addEventListener("turbo:before-frame-render", (event) => {...` from `application.js`
34
- - Update the gem to the newest version and follow the installation instructions above.
35
-
36
25
  ## Features and capabilities
37
26
 
38
27
  - Extremely easy to use
@@ -163,6 +152,18 @@ You can set a custom title and footer by passing a block. For example
163
152
 
164
153
  &nbsp;
165
154
  &nbsp;
155
+
156
+ ## Upgrading from version 1.x
157
+
158
+ - Remove the two `setupUltimateTurboModal`-related lines from `app/javascript/controllers/index.js`:
159
+
160
+ - Remove anything UTMR-specific in `tailwind.config.js`.
161
+
162
+ - Remove the optional Idiomorph tweaks:
163
+ - `<script src="https://unpkg.com/idiomorph"></script>` from your HTML
164
+ - `addEventListener("turbo:before-frame-render", (event) => {...` from `application.js`
165
+ - Update the gem to the newest version and follow the installation instructions above.
166
+
166
167
  ## Thanks
167
168
 
168
169
  Thanks to [@joeldrapper](https://github.com/joeldrapper) and [@konnorrogers](https://github.com/KonnorRogers) for all the help!
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0
1
+ 2.0.2
@@ -1,6 +1,9 @@
1
1
  import { Controller } from '@hotwired/stimulus';
2
2
  import { enter, leave } from 'el-transition';
3
3
 
4
+ // This placeholder will be replaced by rollup
5
+ const PACKAGE_VERSION = '__PACKAGE_VERSION__';
6
+
4
7
  export default class extends Controller {
5
8
  static targets = ["container", "content"]
6
9
  static values = {
@@ -10,6 +13,9 @@ export default class extends Controller {
10
13
 
11
14
  connect() {
12
15
  let _this = this;
16
+
17
+ this.#checkVersions();
18
+
13
19
  this.showModal();
14
20
 
15
21
  this.turboFrame = this.element.closest('turbo-frame');
@@ -105,4 +111,19 @@ export default class extends Controller {
105
111
  #resetHistoryAdvanced() {
106
112
  document.body.removeAttribute("data-turbo-modal-history-advanced");
107
113
  }
114
+
115
+ #checkVersions() {
116
+ const gemVersion = this.element.dataset.utmrVersion;
117
+
118
+ if (!gemVersion) {
119
+ // If the attribute isn't set (e.g., in production), skip the check.
120
+ return;
121
+ }
122
+
123
+ if (gemVersion !== PACKAGE_VERSION) {
124
+ console.warn(
125
+ `[UltimateTurboModal] Version Mismatch!\n\nGem Version: ${gemVersion}\nJS Version: ${PACKAGE_VERSION}\n\nPlease ensure both the 'ultimate_turbo_modal' gem and the 'ultimate-turbo-modal' npm package are updated to the same version.\nElement:`, this.element
126
+ );
127
+ }
128
+ }
108
129
  }