studio-engine 0.69.5 → 0.70.0

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: 44ac04785253cb277ef70cd1d6398b81718e223adc7e300c1a19329183a88be5
4
- data.tar.gz: 01c13c3974eb5da7887fc82e77f3526eb50af53a3e590b993a7602914e8daa81
3
+ metadata.gz: f1c217135776ee0fcd67dd4ed2e9a72f1aedf5260ac23cfc23615ab83754133a
4
+ data.tar.gz: 42878ae8f85ed0c911b99c940e3c5094ca7329fed4bbb727ebfa4466bba99dfb
5
5
  SHA512:
6
- metadata.gz: db96cbe447a67732cc7d2babc54f605071ccd9e3d77d20da4fb7486c5e89f5354e21dc34066757ec7bde7f66fb7fb08e257a15c364753d3a98f34ea8065df25b
7
- data.tar.gz: f8a47251bf78b0c3bab42dfc743565c2dba66502f6f204516718144cd9506a5206bf6342b7ce496fa12f6f67a34727dc8fc7cbc5e03529ce5d3ab1e3727b4761
6
+ metadata.gz: d72745a5c54559b745fc0fefe1ac1c45b3921efeccbe5769f3b1da5ceaa1e11463c317984847fc1300fb0387610c33c4f0c7504e279871630f5535db563c935e
7
+ data.tar.gz: 16be22a876c99c848169a2dcd551593ff4b8c377427acd9d84c04bf732847d261422c79d9b7f30397bf8b04c2d13a894999cc542a95bb1037f9deeaea0c5c32a
data/CHANGELOG.md CHANGED
@@ -6,6 +6,43 @@ The format is [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). This pro
6
6
 
7
7
  ### Added
8
8
 
9
+ - **A `required` mode on the shared first-name card.**
10
+ `studio/modals/onboarding/_first_name` grows one local. `required: true`
11
+ renders the card with BOTH skip affordances gone — the "Skip for now" button
12
+ is not emitted at all, and the × merely CLOSES and is labelled `Close` — and
13
+ swaps the sub-copy to the audience being gated. Default `false`, so the
14
+ post-auth chain card McRitchie Studio renders today does not move.
15
+
16
+ **IT IS FOR A HOST THAT GATES SOMETHING ON THE NAME.** turf-monster's entry
17
+ gate opens this card as the first validation of hold-to-confirm, and that gate
18
+ reads the stored COLUMN — so a recorded skip buys the user nothing and the
19
+ Skip link is a door painted on a wall, promising a way past a wall that does
20
+ not move.
21
+
22
+ **IT IS DELIBERATELY NOT A TRAP.** Closing stays reachable, because abandoning
23
+ the flow and slipping past the gate are two different things: the × still
24
+ dismisses the card, it just stops calling `skip()` and stops claiming it did.
25
+ A `required` that also removed the × would satisfy every "hides the skip"
26
+ reading and be a worse card, so the two are asserted as a PAIR.
27
+
28
+ **RESOLVED SERVER-SIDE, not through an Alpine `x-show`** — the source this was
29
+ ported from hides its skip button reactively, which leaves a button that must
30
+ not exist sitting in the DOM and clickable for as long as Alpine has not
31
+ mounted, and there for good if it never does. `required` is known at render
32
+ time, so the button is simply never emitted.
33
+
34
+ The default render is asserted **byte-for-byte identical** to `required:
35
+ false`, which is what pins the existing consumer. Mutation-checked 5/5:
36
+ flipping the default, un-hiding the skip button, making the × always skip,
37
+ freezing the label, and freezing the sub-copy each turn the suite red on a
38
+ different test.
39
+
40
+ This was the LAST mode turf-monster's own 240-line `modals/_onboarding` had
41
+ that the gem did not, so that copy can be deleted next release. A host wanting
42
+ both modes mounts two `<template x-if>` ids rather than branching one at
43
+ runtime — which is how the two cards already differ in copy, not just in
44
+ affordances.
45
+
9
46
  - **Knowledge coverage view** — `/admin/knowledge/coverage` +
10
47
  `Studio::KnowledgeExpectation`: the "what SHOULD exist" half of the
11
48
  knowledge layer. Expectations carry an entity, folder, provenance
@@ -21,6 +58,41 @@ The format is [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). This pro
21
58
  `Studio.draw_knowledge_routes` opt-in. Built for the Commercial Welding
22
59
  65-item diligence tracker; app-agnostic like the rest of the layer.
23
60
 
61
+ - **The style guide grows the two modal simulators that review ENGINE
62
+ behaviour** — `#modals-motion-registry` ("Enter & leave animations") and
63
+ `#modals-stack-mechanics` ("Stack behaviour") in `style/_modals`. Both are
64
+ ported from turf-monster's `/admin/modals` gallery, which is being deleted:
65
+ the rest of that page was consumer showroom, but these two exercised engine
66
+ mechanics — the `window.ModalAnimations` registry, and the modal stack's
67
+ dismissibility / `holdAtLeast` / LIFO rules — and would have gone with it.
68
+
69
+ The motion section BUILDS ITS CONTROLS FROM THE LIVE REGISTRY at load
70
+ (a button and a dropdown option per registered key, per channel), so
71
+ registering a new animation surfaces it on the guide with no edit to the
72
+ page. That is the property the section exists for, and
73
+ `test/views/style_guide_modal_simulator_test.rb` pins it from both sides:
74
+ the containers must ship EMPTY, and the build must enumerate
75
+ `window.ModalAnimations` rather than a local literal.
76
+
77
+ The stack demos drive `$store.dsModals` and the guide's own `onchain-tx`
78
+ specimen directly. **One demo did not come across: "error with recovery."**
79
+ turf's `setRecovery(label, fn, { phantom })` is a method on that app's
80
+ legacy compatibility proxy and renders a recovery button on ITS `_onchain_tx`
81
+ card; the engine specimen's error state is `blocks/_card_header` plus a plain
82
+ Close, with no recovery affordance. Porting it would have meant designing a
83
+ new block into a shipped partial, so it was dropped rather than shimmed —
84
+ roughly half the ported demos drove that proxy, and none of them reference it
85
+ now (asserted).
86
+
87
+ **Both sections are graded in a browser**, because neither is observable from
88
+ the response bytes: `e2e/style_modal_simulators.spec.js` (7 specs) drives a new
89
+ `/lab/style_modals` lab page, which mounts the shared modal host exactly as a
90
+ consumer layout does — without it `window.ModalAnimations` is undefined, the
91
+ build produces no controls, and "the controls match the registry" would be
92
+ vacuously true at `0 == 0`. Each spec was verified RED against its own defect
93
+ reintroduced, with the lab server restarted between runs. The lane contract
94
+ moves 116 → 123 (`config/e2e_lane.yml`), re-derived with the lister.
95
+
24
96
  ### Changed
25
97
 
26
98
  - **`Gemfile.lock` resolves solana-studio 0.5.7, and a gate now keeps it there.** The lock had sat on **0.5.3 for four patch releases** while BOTH consumers shipped 0.5.7 (turf-monster `~> 0.5.3`, mcritchie-studio `~> 0.5`). Nothing was red and nothing could have been: engine CI installs with `bundler-cache: true`, so it resolves from the lock and never fresh — the drift does not self-correct and never surfaces as flakiness. It matters because `test/views/style_web3_specimens_test.rb` exists to prove "the style guide renders the REAL gem cards" and reads them off whatever the LOCK resolved; four versions behind, that guard certifies a card no consumer receives. It still passes — only its MEANING changes. MEASURED on this span, the gem's whole `app/` tree was byte-identical 0.5.3 → 0.5.7 (only `CHANGELOG.md`, `README.md` and `version.rb` differ), so this instance cost nothing, which is exactly why it went four releases unnoticed.
@@ -55,6 +127,22 @@ The format is [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). This pro
55
127
 
56
128
  ### Fixed
57
129
 
130
+ - **The style guide's page-scoped modal store now resolves animations through
131
+ the LIVE registry, so the guide can no longer disagree with itself.**
132
+ `style/_modals`' `dsModals` carried a hard-coded COPY of the animation table
133
+ while the new simulator builds its controls from `window.ModalAnimations`.
134
+ The two agreed today, which is exactly why this was invisible — but a
135
+ consumer registering a key would have grown a control from the registry that
136
+ the store then resolved back to `pop`: the button said "shake", the card
137
+ popped, and nothing reported the gap. Its `modalAnim` now reads
138
+ `window.ModalAnimations` at CALL time with the same late-binding guard the
139
+ shared host uses (unknown keys and a gutted registry still fall back to
140
+ `pop`, so a miss can never throw on `.ms` and strand a modal open); the local
141
+ table remains only as the fallback for a guide rendered without the host.
142
+ MEASURED in a browser both ways: registering a new key at runtime surfaces a
143
+ control AND plays it, and with this fix reverted the same key surfaces a
144
+ control that plays `modal-card-mount`.
145
+
58
146
  - **Onboarding no longer truncates a surname to fit a first name's cap.**
59
147
  `Studio::OnboardingController#first_name` measured the WHOLE typed answer with
60
148
  `Studio::FIRST_NAME_MAX_LENGTH` — the PER-FIELD cap, 40. The field asks for a
@@ -12,8 +12,18 @@
12
12
  Locals (all optional, defaults via local_assigns.fetch):
13
13
  submit_path — POST target for the name (default "/onboarding/first_name")
14
14
  skip_path — POST target for the skip (default "/onboarding/skip_first_name")
15
+ required — hide the SKIP affordances (default false, which keeps today's
16
+ skippable card). The × then merely CLOSES and is labelled
17
+ Close, and the "Skip for now" button is not rendered. For a
18
+ host that GATES something on the name: offering to skip would
19
+ promise a way past a wall that does not move. Closing stays
20
+ available — a required step abandons the flow, it never traps
21
+ the user in it.
15
22
  heading — (default "What should we call you?")
16
- subtext — the one-line why (default speaks about emails)
23
+ subtext — the one-line why (default speaks about emails; the DEFAULT
24
+ follows `required`, because a card that cannot be skipped is
25
+ talking to a different audience — a host that passes its own
26
+ subtext still wins)
17
27
  placeholder — (default "Alex")
18
28
  max_length — (default Studio::FULL_NAME_MAX_LENGTH; the server stays the
19
29
  real bound, and it REFUSES past that rather than truncating,
@@ -40,15 +50,27 @@
40
50
  <%
41
51
  submit_path = local_assigns.fetch(:submit_path, "/onboarding/first_name")
42
52
  skip_path = local_assigns.fetch(:skip_path, "/onboarding/skip_first_name")
53
+ required = local_assigns.fetch(:required, false)
43
54
  heading = local_assigns.fetch(:heading, "What should we call you?")
44
- subtext = local_assigns.fetch(:subtext,
45
- "Just your first name we use it to address you in emails.")
55
+ default_subtext = if required
56
+ "One last thing — just your first name, so we can address you in emails."
57
+ else
58
+ "Just your first name — we use it to address you in emails."
59
+ end
60
+ subtext = local_assigns.fetch(:subtext, default_subtext)
46
61
  placeholder = local_assigns.fetch(:placeholder, "Alex")
47
62
  max_length = local_assigns.fetch(:max_length, Studio::FULL_NAME_MAX_LENGTH)
48
63
  progress = local_assigns.fetch(:progress, nil)
49
64
  modal_store = local_assigns.fetch(:modal_store, "modals")
50
65
  done_event = local_assigns.fetch(:done_event, "onboarding-step-done")
51
66
  field_id = local_assigns.fetch(:id, "onboarding-first-name")
67
+ # The × mirrors the skip affordance it sits beside: it SKIPS while the step is
68
+ # skippable, and merely CLOSES once it is required. Resolved here rather than in
69
+ # an Alpine expression because `required` is known at render time — and a skip
70
+ # button hidden with x-show is still in the DOM, and still clickable, for as
71
+ # long as Alpine has not mounted.
72
+ dismiss_action = required ? "$store.#{modal_store}.close()" : "skip()"
73
+ dismiss_label = required ? "Close" : "Skip"
52
74
  %>
53
75
  <div x-data="{
54
76
  get props() { var c = $store.<%= modal_store %>.current(); return (c && c.props) || {}; },
@@ -101,10 +123,15 @@
101
123
  <h3 class="text-heading font-bold text-lg leading-tight text-center pt-1"><%= heading %></h3>
102
124
  <%# The × SKIPS rather than merely closing: this lands seconds after signup,
103
125
  and a close that silently abandons the chain is how a host ends up with a
104
- step nobody can answer again. %>
105
- <button @click="skip()"
126
+ step nobody can answer again.
127
+
128
+ When the host passes required: true it merely CLOSES, and says so. That
129
+ step is gating something the host will not let through without a name, so
130
+ recording a skip would promise a way past a wall that does not move.
131
+ Closing still works — it abandons the flow rather than slipping past it. %>
132
+ <button @click="<%= dismiss_action %>"
106
133
  class="absolute top-0 right-0 -mr-2 text-secondary hover:text-heading text-xl leading-none"
107
- aria-label="Skip">&times;</button>
134
+ aria-label="<%= dismiss_label %>">&times;</button>
108
135
  </div>
109
136
  <% if progress %>
110
137
  <%= render "studio/modals/blocks/progress_pill", current: progress.first, total: progress.last %>
@@ -134,8 +161,13 @@
134
161
  </button>
135
162
  </form>
136
163
 
137
- <button type="button" @click="skip()" :disabled="submitting"
138
- class="mt-3 w-full text-center text-sm text-secondary hover:text-heading disabled:opacity-50">
139
- Skip for now
140
- </button>
164
+ <%# Gone entirely when required — see the × above for why offering it there
165
+ would promise a way past a wall that does not move. Omitted rather than
166
+ hidden, for the same reason the × is resolved server-side. %>
167
+ <% unless required %>
168
+ <button type="button" @click="skip()" :disabled="submitting"
169
+ class="mt-3 w-full text-center text-sm text-secondary hover:text-heading disabled:opacity-50">
170
+ Skip for now
171
+ </button>
172
+ <% end %>
141
173
  </div>
@@ -211,7 +211,20 @@
211
211
  // slide uses the modal-card-swap-* classes regardless of these keys.
212
212
  var CLOSE_ANIM_MS = 220;
213
213
  var SWAP_IN_MS = 220;
214
- var Anim = {
214
+
215
+ // THE LIVE REGISTRY IS window.ModalAnimations, NOT THIS TABLE. This is a
216
+ // fallback only, for the case where the guide renders without the shared
217
+ // host (studio/modals/_host) that publishes the registry — both consumer
218
+ // layouts mount it, so in practice the lookup below always finds it.
219
+ //
220
+ // It used to be a hard-coded local copy, and that made the Enter/Leave
221
+ // simulator below a LIAR: the simulator builds its controls from the live
222
+ // registry, so a newly registered animation grew a button here while the
223
+ // store silently resolved the unknown key back to 'pop'. The control said
224
+ // "shake", the card popped, and nothing reported the gap. Reading the
225
+ // registry at CALL time is what makes a registered animation actually
226
+ // playable on this page.
227
+ var ANIM_FALLBACK = {
215
228
  enter: {
216
229
  pop: { cls: 'modal-card-mount', ms: 320 },
217
230
  shake: { cls: 'modal-card-shake-in', ms: 600 },
@@ -222,9 +235,13 @@
222
235
  slide: { cls: 'modal-card-swap-out', ms: 220 }
223
236
  }
224
237
  };
238
+ // Same late-binding guard, and for the same reason, as the host's own
239
+ // modalAnim: never return undefined. A miss would throw on .ms in close()
240
+ // and strand the modal open, so an unknown key falls back to 'pop'.
225
241
  function modalAnim(channel, key) {
226
- var table = Anim[channel] || {};
227
- return table[key] || table.pop;
242
+ var table = (window.ModalAnimations && window.ModalAnimations[channel]) ||
243
+ ANIM_FALLBACK[channel];
244
+ return table[key] || table.pop || ANIM_FALLBACK[channel].pop;
228
245
  }
229
246
 
230
247
  Alpine.store('dsModals', {
@@ -766,7 +783,7 @@
766
783
  <div class="grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
767
784
  <%= render layout: "style/modal_specimen", locals: {
768
785
  label: "First name",
769
- reference: %(the shared onboarding first-name step (studio-engine studio/modals/onboarding/_first_name) — open with $store.dsModals.open('onboarding-first-name'). Posts to submit_path/skip_path (defaults /onboarding/first_name and /onboarding/skip_first_name) and dispatches its done_event with the steps the SERVER says remain),
786
+ reference: %(the shared onboarding first-name step (studio-engine studio/modals/onboarding/_first_name) — open with $store.dsModals.open('onboarding-first-name'). Posts to submit_path/skip_path (defaults /onboarding/first_name and /onboarding/skip_first_name) and dispatches its done_event with the steps the SERVER says remain. A host that GATES on the name passes required: true, which drops BOTH skip affordances and leaves the × merely closing — this specimen shows the default, skippable card),
770
787
  open_expr: "$store.dsModals.open('onboarding-first-name')",
771
788
  glow_when: ds_glow.call("onboarding-first-name")
772
789
  } do %>
@@ -1914,4 +1931,355 @@
1914
1931
  </div>
1915
1932
  </section>
1916
1933
 
1934
+ <%# ===================================================================== %>
1935
+ <%# 8. MOTION REGISTRY (the enter / leave animation simulator) %>
1936
+ <%# ===================================================================== %>
1937
+ <section id="modals-motion-registry" class="space-y-5">
1938
+ <div class="space-y-1">
1939
+ <h3 class="text-xl font-bold text-heading">Enter &amp; leave animations</h3>
1940
+ <p class="text-muted text-sm">
1941
+ The per-modal entrance/exit registry &mdash;
1942
+ <code class="font-mono text-2xs">window.ModalAnimations</code>, published by
1943
+ <code class="font-mono text-2xs">studio/modals/_host</code>. Any modal opens with
1944
+ <code class="font-mono text-2xs">open(id, { enterAnim, exitAnim })</code>; omit either
1945
+ and it uses <code class="font-mono text-2xs">pop</code>. Every control below is
1946
+ <strong class="text-heading font-semibold">generated from the live registry</strong>,
1947
+ so registering a new animation surfaces it here with no edit to this page. Demo card:
1948
+ <code class="font-mono text-2xs">email-change-pending</code>.
1949
+ </p>
1950
+ </div>
1951
+
1952
+ <div class="grid gap-4 sm:grid-cols-2">
1953
+ <%# One control per registered ENTER key, built by the script below. %>
1954
+ <div class="card p-5 space-y-3">
1955
+ <h4 class="text-heading font-semibold text-sm">
1956
+ Enter <span class="text-muted text-xs font-normal">&mdash; watch it arrive</span>
1957
+ </h4>
1958
+ <p class="text-secondary text-xs">
1959
+ Opens the demo card with that entrance. Dismiss with Escape, click-outside, or Close.
1960
+ </p>
1961
+ <div id="modal-anim-enter-buttons" class="flex flex-wrap gap-2"></div>
1962
+ </div>
1963
+
1964
+ <%# One control per registered EXIT key: opens with a plain entrance, then
1965
+ auto-closes a beat later so the exit keyframe is what you watch. %>
1966
+ <div class="card p-5 space-y-3">
1967
+ <h4 class="text-heading font-semibold text-sm">
1968
+ Leave <span class="text-muted text-xs font-normal">&mdash; watch it dismiss</span>
1969
+ </h4>
1970
+ <p class="text-secondary text-xs">
1971
+ Opens with a plain entrance, then closes itself so the exit keyframe is the star.
1972
+ </p>
1973
+ <div id="modal-anim-exit-buttons" class="flex flex-wrap gap-2"></div>
1974
+ </div>
1975
+
1976
+ <%# The full matrix: any entrance crossed with any exit. %>
1977
+ <div class="card p-5 space-y-3 sm:col-span-2">
1978
+ <h4 class="text-heading font-semibold text-sm">Combine</h4>
1979
+ <p class="text-secondary text-xs">Pick any entrance and exit, then run the round trip.</p>
1980
+ <div class="flex flex-wrap items-end gap-3">
1981
+ <label class="text-xs text-secondary">Enter
1982
+ <select id="modal-anim-enter-select"
1983
+ class="block mt-1 text-sm bg-inset border border-subtle rounded px-2 py-1 text-heading"></select>
1984
+ </label>
1985
+ <label class="text-xs text-secondary">Leave
1986
+ <select id="modal-anim-exit-select"
1987
+ class="block mt-1 text-sm bg-inset border border-subtle rounded px-2 py-1 text-heading"></select>
1988
+ </label>
1989
+ <button type="button" class="btn btn-primary btn-sm"
1990
+ onclick="dsModalDemos.animOpenSelected()">Open</button>
1991
+ <button type="button" class="btn btn-outline btn-sm"
1992
+ onclick="dsModalDemos.animRoundTripSelected()">Open, then auto-close</button>
1993
+ <button type="button" class="btn btn-outline btn-sm"
1994
+ @click="$store.dsModals.close()">Close</button>
1995
+ </div>
1996
+ </div>
1997
+ </div>
1998
+ </section>
1999
+
2000
+ <%# ===================================================================== %>
2001
+ <%# 9. STACK MECHANICS (dismissibility, hold-at-least, LIFO stacking) %>
2002
+ <%# ===================================================================== %>
2003
+ <section id="modals-stack-mechanics" class="space-y-5">
2004
+ <div class="space-y-1">
2005
+ <h3 class="text-xl font-bold text-heading">Stack behaviour</h3>
2006
+ <p class="text-muted text-sm">
2007
+ The engine modal-stack mechanics, poked at directly on
2008
+ <code class="font-mono text-2xs">$store.dsModals</code>: the on-chain TX card states,
2009
+ dismissibility, the minimum-visible-duration floor, and LIFO stacking.
2010
+ </p>
2011
+ </div>
2012
+
2013
+ <div class="grid gap-4 sm:grid-cols-2">
2014
+ <%# The three states of style/modals/_onchain_tx. The two static buttons open
2015
+ the card AT a state; the two timed buttons drive the transition through
2016
+ the store's advance(), which is the in-flow step primitive. %>
2017
+ <div class="card p-5 space-y-3">
2018
+ <h4 class="text-heading font-semibold text-sm">On-chain TX states</h4>
2019
+ <p class="text-secondary text-xs">
2020
+ Engine <code class="font-mono text-2xs">blocks/_card_header</code> and
2021
+ <code class="font-mono text-2xs">blocks/_onchain_success</code>. The timed pair
2022
+ transitions a live card with
2023
+ <code class="font-mono text-2xs">advance()</code>.
2024
+ </p>
2025
+ <div class="flex flex-wrap gap-2">
2026
+ <button type="button" class="btn btn-outline btn-sm"
2027
+ onclick="dsModalDemos.processing()">Processing</button>
2028
+ <button type="button" class="btn btn-outline btn-sm"
2029
+ onclick="dsModalDemos.success()">Success</button>
2030
+ <button type="button" class="btn btn-outline btn-sm"
2031
+ onclick="dsModalDemos.error()">Error</button>
2032
+ <button type="button" class="btn btn-primary btn-sm"
2033
+ onclick="dsModalDemos.processThenSuccess()">Processing to success (3s)</button>
2034
+ <button type="button" class="btn btn-primary btn-sm"
2035
+ onclick="dsModalDemos.processThenError()">Processing to error (3s)</button>
2036
+ </div>
2037
+ </div>
2038
+
2039
+ <%# dismissible: false is what a pending transaction sets so a stray Escape
2040
+ cannot orphan an in-flight signature. %>
2041
+ <div class="card p-5 space-y-3">
2042
+ <h4 class="text-heading font-semibold text-sm">Dismissibility</h4>
2043
+ <p class="text-secondary text-xs">
2044
+ A processing card passes <code class="font-mono text-2xs">dismissible: false</code>, so
2045
+ Escape and click-outside are both suppressed until it resolves.
2046
+ </p>
2047
+ <div class="flex flex-wrap gap-2">
2048
+ <button type="button" class="btn btn-outline btn-sm"
2049
+ onclick="dsModalDemos.processing()">Try Escape (locked)</button>
2050
+ <button type="button" class="btn btn-outline btn-sm"
2051
+ onclick="dsModalDemos.dismissible()">Dismissible processing</button>
2052
+ </div>
2053
+ </div>
2054
+
2055
+ <%# The anti-flicker floor from studio/modals/_load_convention. %>
2056
+ <div class="card p-5 space-y-3">
2057
+ <h4 class="text-heading font-semibold text-sm">Hold at least</h4>
2058
+ <p class="text-secondary text-xs">
2059
+ <code class="font-mono text-2xs">StudioModals.holdAtLeast(ms)</code> keeps a fast
2060
+ operation from flashing the spinner. Run both and watch the difference.
2061
+ </p>
2062
+ <div class="flex flex-wrap gap-2">
2063
+ <button type="button" class="btn btn-primary btn-sm"
2064
+ onclick="dsModalDemos.fastWithHold()">Fast op, hold 1500ms</button>
2065
+ <button type="button" class="btn btn-outline btn-sm"
2066
+ onclick="dsModalDemos.fastNoHold()">Fast op, no hold (flashes)</button>
2067
+ </div>
2068
+ </div>
2069
+
2070
+ <%# LIFO: open pushes, close pops back to what was underneath. %>
2071
+ <div class="card p-5 space-y-3">
2072
+ <h4 class="text-heading font-semibold text-sm">Stacking</h4>
2073
+ <p class="text-secondary text-xs">
2074
+ LIFO &mdash; a second <code class="font-mono text-2xs">open()</code> pushes the first
2075
+ card behind it, and <code class="font-mono text-2xs">close()</code> pops back to it.
2076
+ </p>
2077
+ <div class="flex flex-wrap gap-2">
2078
+ <button type="button" class="btn btn-primary btn-sm"
2079
+ onclick="dsModalDemos.stackTwo()">Open two</button>
2080
+ <button type="button" class="btn btn-outline btn-sm"
2081
+ @click="$store.dsModals.closeAll()">closeAll()</button>
2082
+ </div>
2083
+ </div>
2084
+ </div>
2085
+ </section>
2086
+
2087
+ <%# ---- Demo drivers for the two sections above -------------------------
2088
+ Deliberately NOT an Alpine component: these are multi-step sequences with
2089
+ timers, and an x-data scope would be cloned per specimen card. One global
2090
+ namespace, defined after the markup it drives so the control containers
2091
+ exist when the registry build runs.
2092
+
2093
+ THE STORE IS dsModals. turf-monster's version of this page drove roughly
2094
+ half of these through its legacy solana-modal compatibility proxy, a store
2095
+ this engine does not ship; every demo here goes through the page-scoped
2096
+ store and the onchain-tx specimen directly instead. The exact spelling of
2097
+ that legacy store name is deliberately absent from this file, because
2098
+ style_guide_modal_simulator_test scans the source for it. %>
2099
+ <script>
2100
+ window.dsModalDemos = (function () {
2101
+ var SAMPLE_TX = '5xTrDemoSignature1234567890abcXYZ';
2102
+
2103
+ function store() { return Alpine.store('dsModals'); }
2104
+
2105
+ // Open the onchain-tx specimen. The defaults mirror a real pending
2106
+ // transaction, INCLUDING dismissible: false — the demos that want an
2107
+ // escapable card override it explicitly.
2108
+ function openTx(props) {
2109
+ store().open('onchain-tx', Object.assign({
2110
+ state: 'processing',
2111
+ title: 'Submitting entry',
2112
+ message: 'Awaiting wallet signature',
2113
+ dismissible: false
2114
+ }, props || {}));
2115
+ }
2116
+
2117
+ // In-flow state change on the card that is already open. advance() patches
2118
+ // props WITHOUT replacing the stack entry, so the specimen's x-data scope
2119
+ // survives the transition. Guarded to a still-open onchain-tx card: a timer
2120
+ // that fires after the user closed it must do nothing rather than patch
2121
+ // whatever card happens to be on top now.
2122
+ function advanceTx(patch) {
2123
+ var cur = store().current();
2124
+ if (!cur || cur.id !== 'onchain-tx' || cur._closing) return;
2125
+ store().advance(patch);
2126
+ }
2127
+
2128
+ var SUCCESS = {
2129
+ state: 'success',
2130
+ txSignature: SAMPLE_TX,
2131
+ successTitle: 'Entry confirmed',
2132
+ successSubtitle: 'Your entry is confirmed on-chain.',
2133
+ ctaLabel: 'View wallet',
2134
+ ctaHref: null,
2135
+ dismissible: true
2136
+ };
2137
+ var FAILURE = {
2138
+ state: 'error',
2139
+ title: 'Submission failed',
2140
+ errorMessage: 'Transaction simulation failed: insufficient SOL for rent.',
2141
+ dismissible: true
2142
+ };
2143
+
2144
+ // === Enter / leave simulator =====================================
2145
+ // The demo vehicle is the always-registered email-change-pending card, so
2146
+ // only the motion varies between runs.
2147
+ var ANIM_DEMO_ID = 'email-change-pending';
2148
+ var ANIM_DEMO_PROPS = { currentEmail: 'you@example.com', newEmail: 'new@example.com' };
2149
+
2150
+ function animOpen(enterAnim, exitAnim) {
2151
+ store().open(ANIM_DEMO_ID, Object.assign({}, ANIM_DEMO_PROPS, {
2152
+ enterAnim: enterAnim, exitAnim: exitAnim
2153
+ }));
2154
+ }
2155
+
2156
+ // Open, let the entrance settle, then close so the chosen EXIT keyframe is
2157
+ // what you watch. The hold is the entrance's own registry duration plus a
2158
+ // beat, read from the live registry rather than assumed.
2159
+ function animRoundTrip(enterAnim, exitAnim) {
2160
+ animOpen(enterAnim, exitAnim);
2161
+ var reg = window.ModalAnimations || { enter: {}, exit: {} };
2162
+ var enterMs = ((reg.enter[enterAnim] || {}).ms) || 320;
2163
+ setTimeout(function () { store().close(); }, enterMs + 700);
2164
+ }
2165
+
2166
+ function el(id) { return document.getElementById(id); }
2167
+
2168
+ // Build the quick buttons and the dropdown options FROM THE LIVE REGISTRY.
2169
+ // This is the property the section exists to demonstrate: a newly
2170
+ // registered animation key grows a control here with no edit to this file.
2171
+ // Idempotent — it clears each container first, so re-running on a Turbo
2172
+ // visit cannot double the controls.
2173
+ function buildAnimControls() {
2174
+ var reg = window.ModalAnimations || { enter: {}, exit: {} };
2175
+
2176
+ var label = function (key) {
2177
+ return key.charAt(0).toUpperCase() + key.slice(1) + (key === 'pop' ? ' (default)' : '');
2178
+ };
2179
+ var addOption = function (sel, key) {
2180
+ if (!sel) return;
2181
+ var o = document.createElement('option');
2182
+ o.value = key;
2183
+ o.textContent = label(key);
2184
+ if (key === 'pop') o.selected = true;
2185
+ sel.appendChild(o);
2186
+ };
2187
+ var addButton = function (container, key, onClick, suffix) {
2188
+ if (!container) return;
2189
+ var b = document.createElement('button');
2190
+ b.type = 'button';
2191
+ b.className = 'btn btn-outline btn-sm';
2192
+ b.textContent = label(key) + (suffix || '');
2193
+ b.onclick = onClick;
2194
+ container.appendChild(b);
2195
+ };
2196
+
2197
+ var enterBtns = el('modal-anim-enter-buttons');
2198
+ var exitBtns = el('modal-anim-exit-buttons');
2199
+ var enterSel = el('modal-anim-enter-select');
2200
+ var exitSel = el('modal-anim-exit-select');
2201
+
2202
+ [enterBtns, exitBtns, enterSel, exitSel].forEach(function (node) {
2203
+ if (node) node.innerHTML = '';
2204
+ });
2205
+
2206
+ Object.keys(reg.enter || {}).forEach(function (key) {
2207
+ addButton(enterBtns, key, function () { animOpen(key, 'pop'); }, ' ↗');
2208
+ addOption(enterSel, key);
2209
+ });
2210
+ Object.keys(reg.exit || {}).forEach(function (key) {
2211
+ addButton(exitBtns, key, function () { animRoundTrip('pop', key); });
2212
+ addOption(exitSel, key);
2213
+ });
2214
+ }
2215
+
2216
+ // WHEN TO BUILD. window.ModalAnimations is published by the shared host's
2217
+ // inline script, which a host layout may render AFTER this one — so the
2218
+ // build waits for the rest of the body either way:
2219
+ // full load — DOMContentLoaded, the host script has run by then;
2220
+ // Turbo visit — DOMContentLoaded already fired and never fires again, so
2221
+ // fall through to a macrotask, which runs after the body
2222
+ // swap finishes inserting its scripts.
2223
+ // turbo:load covers the remaining visits; the build is idempotent, so the
2224
+ // overlap between these paths is redundant work and nothing worse.
2225
+ if (document.readyState === 'loading') {
2226
+ document.addEventListener('DOMContentLoaded', buildAnimControls);
2227
+ } else {
2228
+ setTimeout(buildAnimControls, 0);
2229
+ }
2230
+ if (!window.__dsAnimControlsBound) {
2231
+ window.__dsAnimControlsBound = true;
2232
+ document.addEventListener('turbo:load', buildAnimControls);
2233
+ }
2234
+
2235
+ return {
2236
+ // Stack behaviour
2237
+ processing: function () { openTx({}); },
2238
+ success: function () { openTx(SUCCESS); },
2239
+ error: function () { openTx(FAILURE); },
2240
+ processThenSuccess: function () {
2241
+ openTx({ message: 'Awaiting RPC confirmation' });
2242
+ setTimeout(function () { advanceTx(SUCCESS); }, 3000);
2243
+ },
2244
+ processThenError: function () {
2245
+ openTx({ message: 'Awaiting RPC confirmation' });
2246
+ setTimeout(function () { advanceTx(FAILURE); }, 3000);
2247
+ },
2248
+ dismissible: function () {
2249
+ openTx({
2250
+ dismissible: true,
2251
+ title: 'Dismissible processing',
2252
+ message: 'Escape and click-outside both close this one.'
2253
+ });
2254
+ },
2255
+ fastWithHold: function () {
2256
+ openTx({ title: 'Fast operation', message: 'Holding the spinner for at least 1500ms' });
2257
+ window.StudioModals.holdAtLeast(1500).then(function () { advanceTx(SUCCESS); });
2258
+ },
2259
+ fastNoHold: function () {
2260
+ openTx({ title: 'Fast operation', message: 'No hold, so this flashes past' });
2261
+ setTimeout(function () { advanceTx(SUCCESS); }, 50);
2262
+ },
2263
+ stackTwo: function () {
2264
+ openTx({
2265
+ dismissible: true,
2266
+ title: 'Bottom of the stack',
2267
+ message: 'A second card is about to push in front of this one.'
2268
+ });
2269
+ setTimeout(function () {
2270
+ store().open(ANIM_DEMO_ID, ANIM_DEMO_PROPS);
2271
+ }, 700);
2272
+ },
2273
+
2274
+ // Enter / leave simulator
2275
+ animOpenSelected: function () {
2276
+ animOpen(el('modal-anim-enter-select').value, el('modal-anim-exit-select').value);
2277
+ },
2278
+ animRoundTripSelected: function () {
2279
+ animRoundTrip(el('modal-anim-enter-select').value, el('modal-anim-exit-select').value);
2280
+ }
2281
+ };
2282
+ })();
2283
+ </script>
2284
+
1917
2285
  </section>
@@ -1,3 +1,3 @@
1
1
  module Studio
2
- VERSION = "0.69.5"
2
+ VERSION = "0.70.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: studio-engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.69.5
4
+ version: 0.70.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex McRitchie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-09-06 00:00:00.000000000 Z
11
+ date: 2026-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails