studio-engine 0.135.0 → 0.135.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: 1b8bd497e5ba5d6c113a0e6c221b03200f395b1c3d4032aa1327691b7c584c34
4
- data.tar.gz: 0a64eb7f3a70bcbe03a50550d36a1d8da938498d91d5cf0a1fcb257845a76759
3
+ metadata.gz: 28ff2552c8617d0b83ccf3780a8cdd1606deb3a3038407a702a9d6aa485babd9
4
+ data.tar.gz: 61b03ceb320803267f6af0ea35c159c90e7a0d5431970c12d16323981037123a
5
5
  SHA512:
6
- metadata.gz: c325e02d5e2f0c2a9123ab2b342281b59d27635e48cca92396f792cd39a6fc403cf6e79bfc2e920f891ef9dcc30063e0460e393db83e7148470d3895615b4aad
7
- data.tar.gz: 96424698d12cf9d7d60bfee31c6f8d97f5bb464439bb421d8f47ba3ab78f1ce359e9a01bd543f3baab4c45d502c73e117ed3074d4bc306c40582b9819ab3aa53
6
+ metadata.gz: 9199937c1152f34b557f21da4b5139389295aa2e787b63060c522701407a62f09e39d011425f0c58fe0dd28560db930423210cabdd5ff1a6ae3b1806752b0043
7
+ data.tar.gz: e2766e79b19c8821e045b2d4397208bde0c5022464502b2d8f01de49ed8ec9ad7669bbc8e4fe136c9f55696dc7f89046cc223baccac25560b76a0dbfbe08c338
data/CHANGELOG.md CHANGED
@@ -4,6 +4,18 @@ The format is [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). This pro
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## 0.135.2 — 2026-11-08
8
+
9
+ ### Fixed
10
+
11
+ - **A nav-spinner hide no longer ends a later show.** `hideNavSpinner()` waits out the minimum display time before it hides, and a hide still waiting (the layout's load-time hydrate) used to land after a later `showNavSpinner()` and drop that spinner while its work was still running. Each show now starts a generation, and a hide fires only if no later show has started. Nothing to do in a host: it arrives with the engine bump.
12
+
13
+ ## 0.135.1 — 2026-11-07
14
+
15
+ ### Fixed
16
+
17
+ - **The not-found page runs no session tracking and no geo detection.** `Studio::NotFoundController` runs as the exceptions app, outside the session and cookie middleware, so a session-throttled callback never holds there. It added a `Studio::UserSession` row on every signed-in 404, and an app with `Studio::GeoDetection` paid an IP geo lookup (up to 3s) on every 404. The controller now overrides `track_user_session` and `detect_geo_state` as no-ops. The callbacks stay registered, so an app that already skips them in its own initializer (Turf does) still boots; it can drop those lines after it bumps the engine. See `docs/NOT_FOUND_PAGE.md`, *What it skips*.
18
+
7
19
  ## 0.135.0 — 2026-11-07
8
20
 
9
21
  ### Fixed
@@ -24,6 +24,9 @@ module Studio
24
24
  #
25
25
  # skip_before_action :detect_geo_state
26
26
  #
27
+ # The engine's not-found page (Studio::NotFoundController) needs no skip: it
28
+ # overrides the method as a no-op, so an app's own skip there still works.
29
+ #
27
30
  # SESSION KEYS are the plain names an app already has in production
28
31
  # (:geo_state, :geo_country, :geo_ip, :geo_detected_at, :geo_override) so an
29
32
  # app adopting this concern keeps every live visitor's resolved location
@@ -13,6 +13,16 @@ module Studio
13
13
  # public/404.html, so a wall can cost the page its layout but never its status.
14
14
  class NotFoundController < ::ApplicationController
15
15
  skip_before_action :require_authentication, raise: false
16
+ # The page runs as the exceptions app, after the request has left the
17
+ # session and cookie middleware: nothing it writes to the session or a
18
+ # cookie is ever saved. A callback that throttles through the session never
19
+ # holds here, so it would pay its full cost on every 404. Two engine
20
+ # callbacks do that, and both are no-ops below (docs/NOT_FOUND_PAGE.md).
21
+ #
22
+ # Overridden, not skipped: the callbacks stay registered, so an app that
23
+ # already skips them itself with a raising skip_*_action (Turf did) still
24
+ # boots. A skip here would make that app's skip raise ArgumentError.
25
+
16
26
  # No forgery skip: Rails' ShowExceptions calls the exceptions app as a GET
17
27
  # (request_method = "GET"), which never needs the token, so the host's CSRF
18
28
  # allow-lists stay as they are.
@@ -29,6 +39,15 @@ module Studio
29
39
 
30
40
  private
31
41
 
42
+ # Studio::ErrorHandling's after_action. It would add a Studio::UserSession
43
+ # row on every signed-in 404, because the throttle cookie is never saved.
44
+ def track_user_session; end
45
+
46
+ # Studio::GeoDetection's before_action, when the app includes it. It would
47
+ # pay an IP geo lookup (up to 3s) on every 404, because the session stamp is
48
+ # never saved. Harmless in an app without the concern: nothing calls it.
49
+ def detect_geo_state; end
50
+
32
51
  def not_found_logo
33
52
  Studio.navbar_brand&.dig(:logo) || Studio.logo_for("Navbar Logo")
34
53
  end
@@ -14,6 +14,8 @@
14
14
  // Minimum display time prevents quick flashes; per app via
15
15
  // Studio.nav_spinner_min_ms, which the head publishes as
16
16
  // <meta name="studio-nav-spinner-min-ms"> (smooth-load apps drop it to ~300).
17
+ // A hide is bound to the show it ends: one still waiting out the minimum when a
18
+ // later show starts does nothing, and that show's own hide takes the spinner down.
17
19
 
18
20
  // How long hide must still wait so the spinner shows for at least minMs.
19
21
  export function spinnerHideDelay(shownAt, now, minMs) {
@@ -27,6 +29,10 @@ export function spinnerMinMs(doc) {
27
29
  }
28
30
 
29
31
  var spinnerShownAt = 0
32
+ // Each show starts a new generation. A hide captures the generation it ends and
33
+ // hides only if no later show has started one, so a hide still waiting out the
34
+ // minimum (the load's hydrate) never drops a spinner a later press raised.
35
+ var spinnerGeneration = 0
30
36
 
31
37
  function showToggle(doc) {
32
38
  doc.querySelectorAll('.nav-toggle-icon').forEach(function (e) { e.style.opacity = '1'; e.style.transform = 'scale(1) rotate(0deg)' })
@@ -35,13 +41,15 @@ function showToggle(doc) {
35
41
 
36
42
  export function showNavSpinner() {
37
43
  spinnerShownAt = Date.now()
44
+ spinnerGeneration += 1
38
45
  document.querySelectorAll('.nav-toggle-icon').forEach(function (e) { e.style.opacity = '0'; e.style.transform = 'scale(0) rotate(90deg)' })
39
46
  document.querySelectorAll('.nav-spinner-icon').forEach(function (e) { e.style.opacity = '1'; e.style.transform = 'scale(1) rotate(0deg)' })
40
47
  }
41
48
 
42
49
  export function hideNavSpinner() {
50
+ var generation = spinnerGeneration
43
51
  var wait = spinnerHideDelay(spinnerShownAt, Date.now(), spinnerMinMs(document))
44
- setTimeout(function () { showToggle(document) }, wait)
52
+ setTimeout(function () { if (generation === spinnerGeneration) showToggle(document) }, wait)
45
53
  }
46
54
 
47
55
  // Reset spinner state before Turbo caches the page. Installed once.
@@ -1,5 +1,5 @@
1
1
  <%# Theme toggle with scale-morph spinner swap.
2
- showNavSpinner() / hideNavSpinner() (defined in _head.html.erb) cross-fade between
2
+ showNavSpinner() / hideNavSpinner() (studio/head_chrome) cross-fade between
3
3
  the theme toggle and a loading spinner with a scale+rotate animation.
4
4
  %>
5
5
  <span class="relative flex" style="width: 16px; height: 16px;">
@@ -1,3 +1,3 @@
1
1
  module Studio
2
- VERSION = "0.135.0"
2
+ VERSION = "0.135.2"
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.135.0
4
+ version: 0.135.2
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-11-07 00:00:00.000000000 Z
11
+ date: 2026-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails