studio-engine 0.4.3 → 0.4.4

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: 9666cf8a5b997901079ee936e2ff49cf5b6b653b67e13de85a6588f6bddd93f7
4
- data.tar.gz: 62a8338512f0cdf2f01f37bccaff8e2f41bad93233a4f3c62fe1f0eafda61d37
3
+ metadata.gz: 288a5cb85deb7c2c43a77b24e4d5bc1b958fd5652e2860bbe88a12d43c22f21e
4
+ data.tar.gz: 1c6ee3b69613649611963e56ba681d066dfeda518bc1010e764ac560e9c308af
5
5
  SHA512:
6
- metadata.gz: 873809f43ebcaacb718b8ecec8d45ab933b38f88c706786fa0aa03e89d78c6e41b079579acca0f920d754448d23d1f7a2d899b21483808d20b445077e6b576d7
7
- data.tar.gz: 17b0fb9f7997e3b4d5ba8b87188576360b23bfdb5657d29088fab2d0f805fd91b52c38c6472a6892f5225aefdf559a1f73b7484c902f6867bdb93919705d4138
6
+ metadata.gz: c930ecdf8f851eaaff0d14db9661dc434132a877a08deec34745e66817e77292dbc95fd1d661769c566d74180cae623f3cfeb76f94ce7690bf4ca71a1e0fe649
7
+ data.tar.gz: b3e2862a52d75a9bc7e122865dd1e9222859a17dbbf19f837f50f5e44a90e25bb1a01ec92afe77621a827cbfccda370e6235e8b60ae05ce01855c5f76a8e55ec
data/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@
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.4 (2026-05-20)
6
+
7
+ Sticky-navbar scroll fixes — bounce-free for every consuming app, no migration required.
8
+
9
+ ### Fixed
10
+ - **Navbar scroll-collapse bounce.** A `position: sticky` navbar that shrinks on scroll changes layout above the fold; Chrome/Firefox scroll-anchoring then compensates by moving `scrollY`, which re-crosses the collapse threshold and oscillates. `_head.html.erb` now ships `body { overflow-anchor: none }`, so the navbar resize no longer drags `scrollY`. Every app that renders `layouts/studio/head` gets this automatically.
11
+ - **Navbar unscroll threshold `20 → 5`** in `_navbar.html.erb` — widens the hysteresis dead zone (5/60) so a height change can't push `scrollY` back across the lower bound.
12
+
13
+ ### Added
14
+ - **`--nav-h` CSS variable.** `_head.html.erb` ships a `ResizeObserver` that publishes the page header's live height to `--nav-h` on `:root` — updated on every resize (including the collapse animation) and re-attached after Turbo navigations. Fixed/sticky elements below the navbar can position off `var(--nav-h)` instead of hardcoded px (e.g. `style="top: var(--nav-h)"`). Auto-detects the page `<header>`; no markup changes needed.
15
+
5
16
  ## v0.4.3 (2026-05-19)
6
17
 
7
18
  Tier-3 fix from the turf-monster pre-prod opsec audit (OPSEC-016).
@@ -18,7 +18,7 @@
18
18
  logo_path = Studio.logo_for("Navbar Logo")
19
19
  %>
20
20
 
21
- <header x-data="{ scrolled: false }" <%= '@scroll.window="scrolled = scrolled ? (window.scrollY > 20) : (window.scrollY > 60)"'.html_safe unless is_preview %>
21
+ <header x-data="{ scrolled: false }" <%= '@scroll.window="scrolled = scrolled ? (window.scrollY > 5) : (window.scrollY > 60)"'.html_safe unless is_preview %>
22
22
  class="<%= is_preview ? 'bg-page' : 'sticky top-0 z-50 bg-page transition-shadow duration-300' %>"
23
23
  :class="scrolled && 'shadow-lg border-b border-subtle is-scrolled'">
24
24
  <style>
@@ -73,6 +73,38 @@
73
73
  });
74
74
  </script>
75
75
 
76
+ <style>
77
+ /* studio-engine: a sticky navbar that shrinks on scroll changes layout
78
+ above the fold — Chrome/Firefox scroll-anchoring then compensates by
79
+ moving scrollY, which re-crosses the collapse threshold and bounces.
80
+ Disabling anchoring document-wide stops scrollY being dragged by the
81
+ navbar resize. */
82
+ body { overflow-anchor: none; }
83
+ </style>
84
+ <script>
85
+ // studio-engine: publish the sticky header's live height as the --nav-h
86
+ // CSS variable so fixed/sticky elements below the navbar can position off
87
+ // it (e.g. top: var(--nav-h)) without hardcoded px. Tracks every resize,
88
+ // including scroll-collapse animations, and re-attaches after Turbo nav.
89
+ (function () {
90
+ if (!window.ResizeObserver) return;
91
+ var ro = null;
92
+ function publish(header) {
93
+ document.documentElement.style.setProperty('--nav-h', header.offsetHeight + 'px');
94
+ }
95
+ function attach() {
96
+ var header = document.querySelector('header');
97
+ if (!header) return;
98
+ if (ro) ro.disconnect();
99
+ ro = new ResizeObserver(function () { publish(header); });
100
+ ro.observe(header);
101
+ publish(header);
102
+ }
103
+ document.addEventListener('DOMContentLoaded', attach);
104
+ document.addEventListener('turbo:load', attach);
105
+ })();
106
+ </script>
107
+
76
108
  <%= stylesheet_link_tag "tailwind", "data-turbo-track": "reload" %>
77
109
  <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
78
110
  <%= javascript_importmap_tags %>
@@ -1,3 +1,3 @@
1
1
  module Studio
2
- VERSION = "0.4.3"
2
+ VERSION = "0.4.4"
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.4.3
4
+ version: 0.4.4
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-05-20 00:00:00.000000000 Z
11
+ date: 2026-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails