studio-engine 0.105.0 → 0.106.0.rc2
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 +4 -4
- data/CHANGELOG.md +29 -0
- data/README.md +4 -4
- data/app/assets/tailwind/studio_engine/engine.css +16 -0
- data/app/views/components/_user_nav.html.erb +20 -4
- data/app/views/layouts/_navbar.html.erb +17 -0
- data/lib/studio/navbar_identity.rb +13 -2
- data/lib/studio/navbar_wordmark.rb +57 -0
- data/lib/studio/version.rb +1 -1
- data/lib/studio.rb +19 -2
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: be24916d860667899a893bce707087ca252ac14dcc8525974a1ff54f48b45f0b
|
|
4
|
+
data.tar.gz: 2b97f80181cf0af261fcfc623b18fc0212f4547eee5fd49fbe5042bd780d73f1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 619518448f747b05444d75f6cf662055a13a03c5a7adb5b8eb46ca24f9eb416ed934a8d6e03bbcfde331b367f6e039877150b067231e2e6cb09fe518f5b25fc7
|
|
7
|
+
data.tar.gz: 5453348e783a3d4c65968a1a7ef91aab01772244d51378730c31efc4e842c3936c51a371daf99c907d8999a01b7e954b2a5b802dcbe2f8026670b91c98ca6d57
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,35 @@ The format is [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). This pro
|
|
|
4
4
|
|
|
5
5
|
## Unreleased
|
|
6
6
|
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- **`config.navbar_wordmark`: a brand lockup image in the engine navbar, off by
|
|
10
|
+
default.** Set it to `{ light: "/brand/navbar-light.svg", dark:
|
|
11
|
+
"/brand/navbar-dark.svg" }` and `layouts/_navbar` draws the lockup in place of
|
|
12
|
+
the "Navbar Logo" image and the `app_name` text, inside the same root link and
|
|
13
|
+
brand h1, with `alt` set to `app_name`. Both files render and engine.css shows
|
|
14
|
+
the one matching the root's `dark` class. Its height follows the logo's
|
|
15
|
+
collapse size and it scales down inside the phone column. Unset, the navbar is
|
|
16
|
+
byte-identical. See `docs/NAVBAR_SETUP.md`.
|
|
17
|
+
|
|
18
|
+
## 0.106.0 — 2026-10-14
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- **The navbar names the signed-in user by first name.** With
|
|
23
|
+
`Studio.navbar_user_name` unset, the user nav (and anything else calling
|
|
24
|
+
`Studio.navbar_user_name_for`) prints the user's `first_name`, else the first
|
|
25
|
+
word of `name`, else `display_name` whole, as before. A host that configures
|
|
26
|
+
the setting is unchanged. A user nav with no second row now centres its icon
|
|
27
|
+
column, so the gear and theme toggle sit level with the name rather than at
|
|
28
|
+
the top of the bar.
|
|
29
|
+
- **A host can make the name and avatar open the link sidebar.** Define the
|
|
30
|
+
view helper `studio_account_opens_sidebar?` as true and the account link
|
|
31
|
+
carries the sidebar's toggle attributes (`data-profile-image-toggle`,
|
|
32
|
+
`aria-controls`), so `studio/link_sidebar` opens the sidebar on click; the
|
|
33
|
+
link keeps its href for a click before that script loads. Without the helper
|
|
34
|
+
the link is unchanged.
|
|
35
|
+
|
|
7
36
|
## 0.105.0 — 2026-10-13
|
|
8
37
|
|
|
9
38
|
### Added
|
data/README.md
CHANGED
|
@@ -624,13 +624,13 @@ end
|
|
|
624
624
|
|
|
625
625
|
### Navbar identity — `Studio.navbar_user_name` and `Studio.sign_in_label`
|
|
626
626
|
|
|
627
|
-
Two words the navbar says about the viewer.
|
|
628
|
-
|
|
629
|
-
`lib/studio/navbar_identity.rb`.
|
|
627
|
+
Two words the navbar says about the viewer. The name defaults to the user's
|
|
628
|
+
first name: the `first_name` column, else the first word of `name`, else
|
|
629
|
+
`display_name` whole. Rules: `lib/studio/navbar_identity.rb`.
|
|
630
630
|
|
|
631
631
|
```ruby
|
|
632
632
|
Studio.configure do |config|
|
|
633
|
-
# The signed-in name in components/_user_nav. nil (the default) is
|
|
633
|
+
# The signed-in name in components/_user_nav. nil (the default) is the first name.
|
|
634
634
|
config.navbar_user_name = :player_name # a method on the user
|
|
635
635
|
# config.navbar_user_name = ->(user, view) { user.player_name } # or a callable
|
|
636
636
|
|
|
@@ -540,6 +540,22 @@ body.modal-open .studio-app-banner {
|
|
|
540
540
|
.nav-shell .nav-title { font-size: var(--nav-title-size); line-height: var(--nav-title-lead); }
|
|
541
541
|
.nav-shell .nav-title span:last-child { font-size: var(--nav-title-lead-size); }
|
|
542
542
|
|
|
543
|
+
/* Studio.navbar_wordmark: a brand lockup image in place of the logo and
|
|
544
|
+
title. HEIGHT-LED: it rides --nav-logo-size, so it collapses exactly as
|
|
545
|
+
the logo does in every band, and its width is the artwork's own. On a
|
|
546
|
+
phone the left column is what is left beside the user column's
|
|
547
|
+
min(14rem, 46vw) cap; the brand box and the image both carry min-width 0
|
|
548
|
+
and the image max-width 100%, so a wide lockup scales down inside that
|
|
549
|
+
column (object-fit keeps its aspect, pinned left) instead of painting
|
|
550
|
+
over the user nav. Both theme files render and the root's `dark` class
|
|
551
|
+
picks one: the light file on a light page, the dark file on a dark page. */
|
|
552
|
+
.nav-wordmark-brand { display: flex; align-items: center; min-width: 0; margin: 0; }
|
|
553
|
+
.nav-wordmark { display: block; width: auto; max-width: 100%; min-width: 0; object-fit: contain; object-position: left center; }
|
|
554
|
+
.nav-shell .nav-wordmark { height: var(--nav-logo-size); }
|
|
555
|
+
.nav-wordmark-dark { display: none; }
|
|
556
|
+
.dark .nav-wordmark-light { display: none; }
|
|
557
|
+
.dark .nav-wordmark-dark { display: block; }
|
|
558
|
+
|
|
543
559
|
@media (max-width: 767px) {
|
|
544
560
|
.nav-title { flex-direction: column; gap: 0; }
|
|
545
561
|
.nav-title span:first-child { margin-bottom: -4px; }
|
|
@@ -78,8 +78,10 @@
|
|
|
78
78
|
defaults to min-width auto, and without it this column refuses to
|
|
79
79
|
shrink below balance + icons. On a 320px phone with a balance the
|
|
80
80
|
reserved column is 147px, and a column that will not give pushed the
|
|
81
|
-
avatar 17px past the screen edge (e2e/header_phone_width.spec.js).
|
|
82
|
-
|
|
81
|
+
avatar 17px past the screen edge (e2e/header_phone_width.spec.js).
|
|
82
|
+
It is a centred flex column, so with no second row the icons sit level
|
|
83
|
+
with the name and avatar rather than at the top of the bar. %>
|
|
84
|
+
<div class="flex-1 min-w-0 flex flex-col justify-center" data-nav-tools>
|
|
83
85
|
<%# Div 1 (Bigger): balance + icons. %>
|
|
84
86
|
<div class="flex items-center gap-2 leading-none" :style="'padding: 0 6px;' + ($store.devMode ? 'background: cornflowerblue;' : '')">
|
|
85
87
|
<%= studio_nav_slot.call(balance_slot, balance_html) %>
|
|
@@ -207,8 +209,22 @@
|
|
|
207
209
|
column beside it is what gives way. So the name cannot truncate by
|
|
208
210
|
flex shrinking: from md up its box carries a max width instead, and
|
|
209
211
|
the name ellipsizes inside it. The avatar is aria-hidden: the name is
|
|
210
|
-
the link's accessible name.
|
|
212
|
+
the link's accessible name.
|
|
213
|
+
|
|
214
|
+
A host whose link sidebar heads with the profile can make the link open
|
|
215
|
+
the sidebar instead, by defining studio_account_opens_sidebar? as true
|
|
216
|
+
(a view helper; the engine defines none, so every other host keeps the
|
|
217
|
+
link). The link then carries the sidebar's toggle attributes and
|
|
218
|
+
studio/link_sidebar claims its click; the href stays, so a click before
|
|
219
|
+
that script loads still reaches the account page. %>
|
|
211
220
|
<% account_classes = "group flex items-center gap-2 flex-shrink-0" %>
|
|
221
|
+
<% account_toggle =
|
|
222
|
+
if studio_nav_destination && respond_to?(:studio_account_opens_sidebar?) && studio_account_opens_sidebar?
|
|
223
|
+
{ "data-profile-image-toggle": "", "aria-controls": "studio-link-sidebar studio-link-sidebar-mobile",
|
|
224
|
+
"aria-haspopup": "dialog", ":aria-expanded": "$store.sidebars && $store.sidebars.linkTreeOpen ? 'true' : 'false'" }
|
|
225
|
+
else
|
|
226
|
+
{}
|
|
227
|
+
end %>
|
|
212
228
|
<% account_inner = capture do %>
|
|
213
229
|
<span class="sr-only md:not-sr-only md:max-w-40"><span class="block truncate text-right text-heading font-semibold text-base leading-none transition<%= " group-hover:text-primary" if studio_nav_destination %>" data-nav-name><%= Studio.navbar_user_name_for(current_user, self) %></span></span>
|
|
214
230
|
<span class="flex-shrink-0 flex items-center" aria-hidden="true">
|
|
@@ -216,7 +232,7 @@
|
|
|
216
232
|
</span>
|
|
217
233
|
<% end %>
|
|
218
234
|
<% if studio_nav_destination %>
|
|
219
|
-
<%= link_to account_inner, studio_nav_destination, class: "#{account_classes} hover:opacity-80 transition", "data-nav-account": "", "x-bind:style": "$store.devMode && 'background: lightgreen'" %>
|
|
235
|
+
<%= link_to account_inner, studio_nav_destination, class: "#{account_classes} hover:opacity-80 transition", "data-nav-account": "", "x-bind:style": "$store.devMode && 'background: lightgreen'", **account_toggle %>
|
|
220
236
|
<% else %>
|
|
221
237
|
<span class="<%= account_classes %>" data-nav-account x-bind:style="$store.devMode && 'background: lightgreen'"><%= account_inner %></span>
|
|
222
238
|
<% end %>
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
last_word = words.pop
|
|
43
43
|
prefix = words.join(" ")
|
|
44
44
|
logo_path = Studio.logo_for("Navbar Logo")
|
|
45
|
+
wordmark = Studio.navbar_wordmark
|
|
45
46
|
%>
|
|
46
47
|
|
|
47
48
|
<%# nav-shell is the --nav-p scope: the engine's nav-collapse controller (studio/nav_collapse) writes
|
|
@@ -143,6 +144,21 @@
|
|
|
143
144
|
<div class="flex-1 min-w-0 px-4">
|
|
144
145
|
<div class="flex items-center gap-6 min-w-0">
|
|
145
146
|
<%= link_to root_path, class: "nav-logo-link inline-flex items-center gap-3 group min-w-0" do %>
|
|
147
|
+
<% if wordmark %>
|
|
148
|
+
<%# Studio.navbar_wordmark: the brand lockup (icon + words as one
|
|
149
|
+
artwork) replaces the logo AND the title text. Both theme files
|
|
150
|
+
render; engine.css (.nav-wordmark-light / -dark) shows the one
|
|
151
|
+
matching the root's `dark` class, so a toggle needs no script.
|
|
152
|
+
The brand_tag still wraps it, so the page keeps its h1 and the
|
|
153
|
+
h1's accessible name is the alt text. Height follows
|
|
154
|
+
--nav-logo-size; width is the artwork's own, shrinking with the
|
|
155
|
+
column (the min-w-0 chain above; the brand box's own min-width 0
|
|
156
|
+
is in engine.css) rather than spilling. %>
|
|
157
|
+
<<%= brand_tag %> class="nav-wordmark-brand">
|
|
158
|
+
<img src="<%= wordmark[:light] %>" alt="<%= Studio.app_name %>" class="nav-wordmark nav-wordmark-light">
|
|
159
|
+
<img src="<%= wordmark[:dark] %>" alt="<%= Studio.app_name %>" class="nav-wordmark nav-wordmark-dark">
|
|
160
|
+
</<%= brand_tag %>>
|
|
161
|
+
<% else %>
|
|
146
162
|
<% if logo_path %>
|
|
147
163
|
<%# No w-*/h-* utility here: .nav-shell .nav-logo sizes it off --nav-p.
|
|
148
164
|
transition-transform, NOT transition-all — the hover lift still
|
|
@@ -155,6 +171,7 @@
|
|
|
155
171
|
`truncate` on the h1 would clip the flex CONTAINER and leave the
|
|
156
172
|
spans drawing outside it, which is the bug rather than the fix. %>
|
|
157
173
|
<<%= brand_tag %> class="nav-title font-extrabold text-heading tracking-tight min-w-0"><span class="truncate"><%= prefix %></span><span class="text-primary truncate"><%= last_word %></span></<%= brand_tag %>>
|
|
174
|
+
<% end %>
|
|
158
175
|
<% end %>
|
|
159
176
|
<%# Desktop nav — Studio.navbar_links %>
|
|
160
177
|
<nav class="hidden md:flex items-center gap-4"<%= ' aria-label="Main"'.html_safe if navbar_links.any? %>>
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
#
|
|
8
8
|
# Studio.navbar_user_name is one of:
|
|
9
9
|
#
|
|
10
|
-
# nil the default: user
|
|
10
|
+
# nil the default: the user's first name (first_name, else
|
|
11
|
+
# the first word of name), else user.display_name
|
|
11
12
|
# :player_name a method called on the user ("player_name" works too)
|
|
12
13
|
# ->(user, view) { ... } a callable; a one-argument callable gets the user only
|
|
13
14
|
#
|
|
@@ -32,7 +33,7 @@ module Studio
|
|
|
32
33
|
|
|
33
34
|
def user_name(user, view = nil, config: Studio.navbar_user_name)
|
|
34
35
|
fallback = user.display_name # outside the rescue: the default path is not ours to swallow
|
|
35
|
-
return fallback if config.nil?
|
|
36
|
+
return first_name(user) || fallback if config.nil?
|
|
36
37
|
|
|
37
38
|
begin
|
|
38
39
|
text = plain_text(configured_name(config, user, view))
|
|
@@ -62,6 +63,16 @@ module Studio
|
|
|
62
63
|
@reported_lock.synchronize { @reported.clear }
|
|
63
64
|
end
|
|
64
65
|
|
|
66
|
+
# The default name: the first_name column, else the first word of name; nil
|
|
67
|
+
# when the host has neither, and the caller prints display_name. display_name
|
|
68
|
+
# itself is never split: a host may build it from a username or an email.
|
|
69
|
+
def first_name(user)
|
|
70
|
+
given = plain_text(user.first_name) if user.respond_to?(:first_name)
|
|
71
|
+
return given unless given.to_s.empty?
|
|
72
|
+
|
|
73
|
+
plain_text(user.name).split.first if user.respond_to?(:name)
|
|
74
|
+
end
|
|
75
|
+
|
|
65
76
|
def configured_name(config, user, view)
|
|
66
77
|
return user.public_send(config.to_sym) unless config.respond_to?(:call)
|
|
67
78
|
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Studio.navbar_wordmark: an opt-in brand lockup image (an icon plus the app's
|
|
4
|
+
# words, made as one piece of artwork) that the engine navbar draws in place of
|
|
5
|
+
# the "Navbar Logo" image and the app_name text. Pure Ruby, so the unit suite
|
|
6
|
+
# covers it without the dummy app.
|
|
7
|
+
#
|
|
8
|
+
# The config is nil (the default, and the navbar renders as it always has) or
|
|
9
|
+
# a Hash naming one file per theme:
|
|
10
|
+
#
|
|
11
|
+
# config.navbar_wordmark = { light: "/brand/navbar-light.svg",
|
|
12
|
+
# dark: "/brand/navbar-dark.svg" }
|
|
13
|
+
#
|
|
14
|
+
# light is the artwork drawn on a LIGHT page, dark the artwork drawn on a DARK
|
|
15
|
+
# page (the root carries the `dark` class). Both images render; engine.css hides
|
|
16
|
+
# the one that does not match the theme, so a toggle swaps them with no script.
|
|
17
|
+
module Studio
|
|
18
|
+
module NavbarWordmark
|
|
19
|
+
class InvalidConfig < ArgumentError; end
|
|
20
|
+
|
|
21
|
+
THEMES = %i[light dark].freeze
|
|
22
|
+
|
|
23
|
+
module_function
|
|
24
|
+
|
|
25
|
+
# The config as { light: String, dark: String }, or nil when unset.
|
|
26
|
+
def normalize(config)
|
|
27
|
+
return nil if config.nil?
|
|
28
|
+
|
|
29
|
+
validate!(config)
|
|
30
|
+
THEMES.to_h { |theme| [theme, fetch(config, theme).strip] }
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def validate!(config)
|
|
34
|
+
return nil if config.nil?
|
|
35
|
+
|
|
36
|
+
unless config.is_a?(Hash)
|
|
37
|
+
raise InvalidConfig, "Studio.navbar_wordmark must be nil or a Hash of " \
|
|
38
|
+
"{ light: path, dark: path } (got #{config.inspect})"
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
extra = config.keys.map(&:to_sym) - THEMES
|
|
42
|
+
raise InvalidConfig, "Studio.navbar_wordmark takes only :light and :dark (got #{extra.inspect})" if extra.any?
|
|
43
|
+
|
|
44
|
+
THEMES.each do |theme|
|
|
45
|
+
value = fetch(config, theme)
|
|
46
|
+
next if value.is_a?(String) && !value.strip.empty?
|
|
47
|
+
|
|
48
|
+
raise InvalidConfig, "Studio.navbar_wordmark[:#{theme}] must be a non-blank path (got #{value.inspect})"
|
|
49
|
+
end
|
|
50
|
+
nil
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def fetch(config, theme)
|
|
54
|
+
config.key?(theme) ? config[theme] : config[theme.to_s]
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
data/lib/studio/version.rb
CHANGED
data/lib/studio.rb
CHANGED
|
@@ -33,6 +33,7 @@ require "studio/site_footer"
|
|
|
33
33
|
require "studio/booking"
|
|
34
34
|
require "studio/navbar_links"
|
|
35
35
|
require "studio/navbar_identity"
|
|
36
|
+
require "studio/navbar_wordmark"
|
|
36
37
|
require "studio/auth_labels"
|
|
37
38
|
require "studio/profile_sections"
|
|
38
39
|
require "studio/profile_image"
|
|
@@ -223,7 +224,7 @@ module Studio
|
|
|
223
224
|
|
|
224
225
|
# ---- Navbar identity ----
|
|
225
226
|
# The name the signed-in user nav prints, and the signed-out button's label.
|
|
226
|
-
#
|
|
227
|
+
# The name defaults to the user's first name. The engine has no
|
|
227
228
|
# I18n catalogue, so the label is plain config rather than a locale key.
|
|
228
229
|
# The label also words the engine's auth pages (lib/studio/auth_labels.rb).
|
|
229
230
|
# Rules: lib/studio/navbar_identity.rb.
|
|
@@ -232,7 +233,8 @@ module Studio
|
|
|
232
233
|
# config.navbar_user_name = ->(user, view) { user.player_name } # or a callable
|
|
233
234
|
# config.sign_in_label = "Sign in"
|
|
234
235
|
#
|
|
235
|
-
# nil means
|
|
236
|
+
# nil means the first name (first_name, else the first word of name), else
|
|
237
|
+
# user.display_name. A method or callable that raises, or answers
|
|
236
238
|
# blank, falls back to display_name; a raise is reported once, never a 500.
|
|
237
239
|
mattr_reader :navbar_user_name, default: nil
|
|
238
240
|
|
|
@@ -244,6 +246,21 @@ module Studio
|
|
|
244
246
|
|
|
245
247
|
mattr_reader :sign_in_label, default: NavbarIdentity::DEFAULT_SIGN_IN_LABEL
|
|
246
248
|
|
|
249
|
+
# ---- Navbar wordmark ----
|
|
250
|
+
# A brand lockup image (icon plus words as one artwork) drawn in place of the
|
|
251
|
+
# "Navbar Logo" and the app_name text. nil, the default, renders the navbar
|
|
252
|
+
# byte-identical to before. light is the file for a light page, dark the file
|
|
253
|
+
# for a dark page; both render and engine.css shows the one matching the
|
|
254
|
+
# root's `dark` class. Rules: lib/studio/navbar_wordmark.rb.
|
|
255
|
+
#
|
|
256
|
+
# config.navbar_wordmark = { light: "/brand/navbar-light.svg",
|
|
257
|
+
# dark: "/brand/navbar-dark.svg" }
|
|
258
|
+
mattr_reader :navbar_wordmark, default: nil
|
|
259
|
+
|
|
260
|
+
def self.navbar_wordmark=(config)
|
|
261
|
+
@@navbar_wordmark = NavbarWordmark.normalize(config)
|
|
262
|
+
end
|
|
263
|
+
|
|
247
264
|
def self.sign_in_label=(label)
|
|
248
265
|
NavbarIdentity.validate_label!(label)
|
|
249
266
|
@@sign_in_label = label
|
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
|
+
version: 0.106.0.rc2
|
|
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-10-
|
|
11
|
+
date: 2026-10-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -760,6 +760,7 @@ files:
|
|
|
760
760
|
- lib/studio/name_parts.rb
|
|
761
761
|
- lib/studio/navbar_identity.rb
|
|
762
762
|
- lib/studio/navbar_links.rb
|
|
763
|
+
- lib/studio/navbar_wordmark.rb
|
|
763
764
|
- lib/studio/newsletter.rb
|
|
764
765
|
- lib/studio/oauth_identity.rb
|
|
765
766
|
- lib/studio/partial_block.rb
|