studio-engine 0.4.5 → 0.4.7

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: b8bd5ff3b5b881934c12d4983ed7b2920f1d05cbb4b6cdd366699a074dae0278
4
- data.tar.gz: a8de43a744f4a59201eb12a356b8c6a7958b6530f9140fc0c23de68919bd21a0
3
+ metadata.gz: 63e2696b020195f3525570ece2fa4ee527d4d4e3af6e3f16eb969243be87d107
4
+ data.tar.gz: 735d3d150f0af04de66de164655fbc644f0657c05343cdffbdbc68b7c851aeb1
5
5
  SHA512:
6
- metadata.gz: cea4fef7a573ca81bd340f0c4dfa9008b4f5a061eb7aa4e43a26cd521a80712494b1a118f2267af9a50c05f1b50976b5735ab141ba0bdee3cf497ce0c1ac22d6
7
- data.tar.gz: 76bdfd4a85634ec028f2500a589de5df52cce55063571ba362b589c0a7711794463ae133435299a47737a710cb3aa8ba04057d7f1f4521ca8d8d7ab6b03f6c44
6
+ metadata.gz: d46aea917a51d91c42fb93e554e6ce2e13ba5d33f28896b04d842bea969dd061802e79fec8c52d21aa916a7c533c9d44e35e487e50fe6a5ae371a20f25648a46
7
+ data.tar.gz: e4384713fde2f34a7edfb4d2e0e41efb50716d30d2145ca5967e148e0a904429d77fbab34ce8a76363a96e3173c4fe34c75d9597a70a296cd6c3853d15ab2455
data/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
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.7 (2026-05-23)
6
+
7
+ Bugfix — modal host doc-comment was leaking into rendered pages.
8
+
9
+ ### Fixed
10
+ - **`studio/modals/host` comment block terminated early.** The leading `<%# %>` comment in `_host.html.erb` contained a worked example of the consumer's render-block syntax (`<%%= render ... %%>`). ERB scans for the first `%>` sequence to close the comment, and `%%>` ends in `%>`, so the comment terminated mid-escape — leaving the example markup AND the prose after it as literal output at the bottom of every page that rendered the host. Now any docblock with ERB escapes is removed; the consumer example lives in the gem's README / CHANGELOG instead. No API change.
11
+
12
+ ## v0.4.6 (2026-05-23)
13
+
14
+ Small follow-up to 0.4.5 — modal dismissibility opt-out.
15
+
16
+ ### Added
17
+ - **`props.dismissible: false`** on a modal's props now suppresses escape-key + click-outside close. Required for flows that mustn't be interrupted mid-step — on-chain TX while a Phantom signature is pending, multi-stage withdrawals, etc. Defaults to true (existing behavior). Set per-modal:
18
+ ```js
19
+ $store.modals.open('onchain-tx', { state: 'processing', dismissible: false });
20
+ // ...later, when the TX confirms:
21
+ $store.modals.current().props.dismissible = true; // user can now close
22
+ ```
23
+
5
24
  ## v0.4.5 (2026-05-23)
6
25
 
7
26
  Modal infrastructure — same shape as the toast system from v0.4.0. Apps render `studio/modals/host` once, then open through `Alpine.store('modals')` and compose the shared content blocks. No migration required for v0.4.4 consumers.
@@ -1,43 +1,35 @@
1
1
  <%#
2
2
  Modal host — single shared shell for any modal that opens through
3
3
  Alpine.store('modals'). Owns the backdrop, scroll lock (via
4
- .modal-open on <body>), escape key, click-outside, transitions,
5
- and ARIA dialog role.
4
+ .modal-open on body), escape key, click-outside, transitions, and
5
+ ARIA dialog role. Bundles the scroll-lock CSS, bfcache + Turbo
6
+ Drive snapshot cleanup, store registration, and the
7
+ window.StudioModals.holdAtLeast(ms) helper.
6
8
 
7
- Bundles together (toast partial precedent):
8
- body.modal-open scroll-lock CSS
9
- bfcache + Turbo Drive snapshot cleanup
10
- Alpine.store('modals') registration (stack-based API)
11
- window.StudioModals.holdAtLeast(ms) helper for min-visible-time
12
- The host shell markup (backdrop, card chrome, transitions, ARIA)
13
-
14
- Consumer renders ONCE in the application layout and passes a block
15
- that registers content partials by modal id:
16
-
17
- <%%= render "studio/modals/host" do %%>
18
- <template x-if="$store.modals.current().id === 'auth'">
19
- <%%= render "modals/auth" %%>
20
- </template>
21
- <template x-if="$store.modals.current().id === 'checkEmail'">
22
- <%%= render "modals/check_email" %%>
23
- </template>
24
- <%% end %%>
9
+ Render ONCE from the application layout, passing a block that
10
+ registers content partials by modal id (see this gem's README /
11
+ CHANGELOG for the consumer-side example kept out of this comment
12
+ on purpose because ERB <%# %> terminates at the first %> sequence,
13
+ so embedded <%%= %%> escapes would leak the rest of the comment
14
+ into the page output).
25
15
 
26
16
  Modal CONTENT partials live in the consumer app (each app's auth /
27
17
  checkout / tx / etc. is product-specific). The reusable content
28
18
  BLOCKS live next to this partial in studio/modals/blocks/.
29
19
 
30
- API (window.StudioModals + Alpine store):
31
- $store.modals.open(id, props = {}, opts = {})
32
- opts.replace: true → swap top of stack (no stack flicker)
33
- $store.modals.close() pop top
20
+ API surface (window.StudioModals + the Alpine 'modals' store):
21
+
22
+ $store.modals.open(id, props, opts)
23
+ opts.replace true swaps top of stack (no stack flicker)
24
+ props.dismissible false suppresses escape + click-outside close
25
+ $store.modals.close() — pop top
34
26
  $store.modals.closeAll()
35
27
  $store.modals.isOpen(id)
36
28
  $store.modals.current()
37
29
 
38
- StudioModals.holdAtLeast(ms) returns { then(cb) }
39
- Stamps mount time, delays cb so a fast operation can't flash
40
- past the loading state. Mirrors the _navSpinnerMinMs pattern.
30
+ StudioModals.holdAtLeast(ms)returns { then(cb) }. Stamps
31
+ mount time, delays cb so a fast operation can't flash past the
32
+ loading state. Mirrors the _navSpinnerMinMs pattern.
41
33
 
42
34
  z-[120] sits above the navbar (z-[110]) and above toasts (z-60).
43
35
  %>
@@ -131,12 +123,16 @@
131
123
  </script>
132
124
 
133
125
  <template x-if="$store.modals.current()">
126
+ <%# A modal can opt out of escape + click-outside dismissal by setting
127
+ `dismissible: false` on its props (e.g. processing an on-chain tx
128
+ where an accidental click would orphan a signed but un-confirmed
129
+ transaction). Defaults to dismissible. %>
134
130
  <div class="fixed inset-0 z-[120] flex items-center justify-center p-4"
135
131
  style="background:rgba(0,0,0,0.6)"
136
132
  role="dialog"
137
133
  aria-modal="true"
138
- @keydown.escape.window="$store.modals.close()"
139
- @click.self="$store.modals.close()"
134
+ @keydown.escape.window="$store.modals.current() && $store.modals.current().props.dismissible !== false && $store.modals.close()"
135
+ @click.self="$store.modals.current() && $store.modals.current().props.dismissible !== false && $store.modals.close()"
140
136
  x-transition:enter="transition ease-out duration-200"
141
137
  x-transition:enter-start="opacity-0"
142
138
  x-transition:enter-end="opacity-100"
@@ -6,12 +6,17 @@
6
6
  registers "did anything happen?" instead of "ok, processing →
7
7
  success".
8
8
 
9
- Locals:
10
- title: required string ("Confirming your purchase…", etc.)
11
- message: optional supporting text
9
+ Locals — pass static strings OR `_key` variants for Alpine-driven
10
+ text that updates as state mutates (e.g. live store reads):
11
+ title: static string title
12
+ title_key: Alpine expression for the title (rendered via x-text)
13
+ message: static string message (optional)
14
+ message_key: Alpine expression for the message
12
15
  size: spinner size — 'sm', 'md' (default), 'lg'
13
16
  color: color token for the spinner — 'primary' (default),
14
17
  'success', 'warning'
18
+
19
+ One of `title` or `title_key` is required.
15
20
  %>
16
21
  <%
17
22
  size = local_assigns[:size] || 'md'
@@ -25,8 +30,14 @@
25
30
  %>
26
31
  <div class="text-center py-6">
27
32
  <div class="mx-auto <%= spinner_class %> rounded-full border-<%= color %>/30 border-t-<%= color %> animate-spin mb-5"></div>
28
- <p class="text-base font-bold text-heading mb-1"><%= title %></p>
29
- <% if local_assigns[:message] %>
33
+ <% if local_assigns[:title_key] %>
34
+ <p class="text-base font-bold text-heading mb-1" x-text="<%= title_key %>"></p>
35
+ <% elsif local_assigns[:title] %>
36
+ <p class="text-base font-bold text-heading mb-1"><%= title %></p>
37
+ <% end %>
38
+ <% if local_assigns[:message_key] %>
39
+ <p class="text-xs text-secondary" x-text="<%= message_key %>"></p>
40
+ <% elsif local_assigns[:message] %>
30
41
  <p class="text-xs text-secondary"><%= message %></p>
31
42
  <% end %>
32
43
  </div>
@@ -1,3 +1,3 @@
1
1
  module Studio
2
- VERSION = "0.4.5"
2
+ VERSION = "0.4.7"
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.5
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex McRitchie