studio-engine 0.4.10 → 0.4.11

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: 69ebed5ecf2c4d41815556f20f2c783e71b14c0b381cd07b5f5731fb89d981ba
4
- data.tar.gz: 264b1eb9ba0a3bf3bb8abb5fe2ee0d60a2b5abd30c792d307885d7b1dd623475
3
+ metadata.gz: b843f965201c31cd83f0c1fd3f39830730fbc9e139a31c3a856c3e99853bf053
4
+ data.tar.gz: c7383f3cf9943f93a2f06150909ee23461d194e93b44c33848bb39106a6f10f9
5
5
  SHA512:
6
- metadata.gz: ce8cb07a7eeba5953bb5704836721b089ab591bc3d26c2af0ee8c7331f2f0b3734cbea4d506bed5f19b1d187adda3c40a585986413d6617ed80206c9158566cd
7
- data.tar.gz: 56fc96ba668bf57fb9cab85cdc7dbc8b02bc9fafb47a6829745b73689dcf5efb3ef0ef9be528ad9764af06f4cf5c7aa1b979c1c3c01776eade15f56a48f2a85a
6
+ metadata.gz: 2b65ebd2d798a2e06aa2572160d241e2c4557033da6aa3fb2ed4c2bb214e9f2c2119b11cd53e778401f100f318fce49a33531f260e0e8fe05d26449df3281fca
7
+ data.tar.gz: 8eae952bd9cc78f3705cea486a63fdfb6b667e112c1c207992813b2d3c942bda0fa513f1df4120069b3916703db4bab1d7aabdac3dd6553cacc0a8e239a77353
data/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  The format is [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). This project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html) — `MAJOR.MINOR.PATCH`. Both consumer Rails apps pin to a tag in their `Gemfile`; bumping the tag is a release.
4
4
 
5
+ ## v0.4.11 (2026-05-24)
6
+
7
+ Preserves non-dismissible modals (e.g. pending on-chain TX) across bfcache restore and Turbo snapshot caching. Previously, the modal host's cleanup hooks called `closeAll()` on both `pageshow.persisted` and `turbo:before-cache`, which silently dropped any `dismissible: false` modal — including the processing card a still-in-flight JS promise was expecting to resolve against. The promise's `solanaModal.success()` then no-op'd against an empty stack and the user saw nothing despite their TX landing on-chain.
8
+
9
+ ### Added
10
+ - **`Alpine.store('modals').closeAllDismissible()`** — drops every modal in the stack whose `props.dismissible !== false`, leaves locked modals in place.
11
+
12
+ ### Changed
13
+ - **bfcache + Turbo snapshot cleanup** now calls `closeAllDismissible()` instead of `closeAll()`. Celebratory modals still clear on return; pending-TX modals survive.
14
+
15
+ ### Migration
16
+ None required — celebratory modal behavior is unchanged. Consumers relying on `dismissible: false` (turf-monster's `onchain-tx` modal) gain crash-recovery for free.
17
+
5
18
  ## v0.4.10 (2026-05-23)
6
19
 
7
20
  Lets consumer apps override toast z-indexes without `!important`. Previously, `#toast-container` set `z-index: 60` via an inline `style=` attribute, which forced any consumer override to use `!important`. Same source-order problem for `.toast-page-blur` (z-index in the inline `<style>` block here loaded after the consumer's `application.tailwind.css`). Both now read from CSS custom properties with the previous values as fallback defaults.
data/README.md CHANGED
@@ -7,13 +7,13 @@ Shared Rails engine for McRitchie apps. Provides authentication, error handling,
7
7
  ## Installation
8
8
 
9
9
  ```ruby
10
- # Gemfile — pin to a tag (recommended; see Releases section)
11
- gem "studio-engine", git: "https://github.com/amcritchie/studio-engine.git", tag: "v0.3.0"
10
+ # Gemfile — install from RubyGems (recommended)
11
+ gem "studio-engine", "~> 0.4.0"
12
12
  ```
13
13
 
14
- Then `bundle install`. The current release is **v0.3.0**; see [`CHANGELOG.md`](./CHANGELOG.md) for the history.
14
+ Then `bundle install`. The current release is **v0.4.10**; see [`CHANGELOG.md`](./CHANGELOG.md) for the history.
15
15
 
16
- > Pinning to a tag (not `main`) is now the recommended pattern. Consumer apps that track `main` will silently inherit any engine merge bad when one merge breaks several apps at once.
16
+ > Published to RubyGems as of v0.4.0 (2026-05-17). Earlier consumers used a `git:` ref pinned to a tag; that pattern is preserved here for reference but new installs should use the RubyGems form, which the consumer Rails apps (`mcritchie-studio`, `turf-monster`, `tax-studio`) already use.
17
17
 
18
18
  ## What It Provides
19
19
 
@@ -70,6 +70,19 @@
70
70
  this.stack = [];
71
71
  this._sync();
72
72
  },
73
+ // Drops every modal whose props don't explicitly opt out of dismissal
74
+ // (i.e. dismissible: false). Used by the bfcache + Turbo snapshot
75
+ // cleanup below so an in-flight on-chain TX modal — which sets
76
+ // dismissible: false precisely to forbid losing its UI mid-flight —
77
+ // survives a back/forward navigation. Celebratory modals (default
78
+ // dismissible: true) are still cleared so users don't return to a
79
+ // stale "Success!" card.
80
+ closeAllDismissible: function() {
81
+ this.stack = this.stack.filter(function(modal) {
82
+ return modal.props && modal.props.dismissible === false;
83
+ });
84
+ this._sync();
85
+ },
73
86
  isOpen: function(id) {
74
87
  for (var i = 0; i < this.stack.length; i++) {
75
88
  if (this.stack[i].id === id) return true;
@@ -93,15 +106,23 @@
93
106
  //
94
107
  // Without this, a user who lands on a celebratory modal and then
95
108
  // navigates away (or hits the browser's bfcache on back) sees the
96
- // modal again on their next visit. Clear the stack on both signals.
97
- function closeAllModals() {
109
+ // modal again on their next visit. closeAllDismissible() keeps
110
+ // dismissible: false modals (e.g. pending on-chain TX) so the
111
+ // user returning via bfcache doesn't silently lose the modal that
112
+ // a still-in-flight JS promise will resolve against.
113
+ function clearStaleModals() {
98
114
  if (window.Alpine && Alpine.store) {
99
115
  var m = Alpine.store('modals');
100
- if (m && typeof m.closeAll === 'function') m.closeAll();
116
+ if (m && typeof m.closeAllDismissible === 'function') {
117
+ m.closeAllDismissible();
118
+ } else if (m && typeof m.closeAll === 'function') {
119
+ // Fallback for older engine versions that registered the store first.
120
+ m.closeAll();
121
+ }
101
122
  }
102
123
  }
103
- window.addEventListener('pageshow', function(e) { if (e.persisted) closeAllModals(); });
104
- document.addEventListener('turbo:before-cache', closeAllModals);
124
+ window.addEventListener('pageshow', function(e) { if (e.persisted) clearStaleModals(); });
125
+ document.addEventListener('turbo:before-cache', clearStaleModals);
105
126
  })();
106
127
  </script>
107
128
 
@@ -1,3 +1,3 @@
1
1
  module Studio
2
- VERSION = "0.4.10"
2
+ VERSION = "0.4.11"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: studio-engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.10
4
+ version: 0.4.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex McRitchie