studio-engine 0.144.0 → 0.144.1

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: 98d7d512ad7dbca4f6610b95f82ea7c0975450f9150522a4a68e89df5f392bf5
4
- data.tar.gz: 8b2e116b30cc9a8d7d927a1f1bfd1eb155fc02d7cbbbbc0f6dccd4f33b41446e
3
+ metadata.gz: c43f1f30b1b77ed84d5f243c25d5210b01008ecbb43a96dc5c55a8ccf08b53d7
4
+ data.tar.gz: 71623f99204ce7afb7c6381186d632045764fd385fb08fe1af08c1eaea1a8fbc
5
5
  SHA512:
6
- metadata.gz: 0c58133319c6e482aca21bbfe8a5478c59b285b01ce5b1cbeed3136dd9e64138d94c5a3cfec3f590f6ddf35dd7bc1084271efc078faa7e3cb868b162af9f1d15
7
- data.tar.gz: 7aba5316e9c073cd58359bac595c3ef9d2f9b02cecedadfa80131d9effc6b343a86c5d0df89db380bc2b17e2bd59a66ba5215e976fd8b0a3b3986e8fbcbe1caa
6
+ metadata.gz: 671142acad89b5deee37b401108764b0d516cdfffb1a30ff0763ca7b0220780b8008f61d2846397daf63a728e25f19fff0e3af23fba725032b357ce837a2b330
7
+ data.tar.gz: 43e6e425adc3e096d4215f2d8099148ba6ebd63f2fbba9f0f5f17b3784ba4d2b38bd177dc3a8ed6ad2b6daaeec0e226e43ad424f590d90f826a301c49a56e664
data/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ The format is [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). This pro
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## 0.144.1 — 2026-11-27
8
+
9
+ ### Fixed
10
+
11
+ - **`Studio::SystemTestCase` system tests pass on Chrome 158.** Capybara 3.40.0's Chrome and Edge `reset!` ends with `Storage.clearDataForOrigin` for origin `"*"`, which Chrome 158 refuses ("invalid argument: * is not a valid URL"), so every system test errored in teardown. A prepend on Capybara's Chrome and Edge specializations now names the real origins: each http(s) origin the driver visited since the last reset, the page it is on at reset, and `Capybara.app_host`. Cookies still clear for every origin, through `Network.clearBrowserCookies`. No change for a consumer that adopts the base: it loads with `require "studio/system_test_case"`. An app on Chrome 158 needs the base (or its own patch) before shared CI drops its `chrome-version: "157"` pin.
12
+
7
13
  ## 0.144.0 — 2026-11-11
8
14
 
9
15
  ### Added
@@ -0,0 +1,56 @@
1
+ /*
2
+ studio-engine HOST ENTRY — what a host's one Tailwind line resolves to.
3
+
4
+ @import "tailwindcss";
5
+ @import "../builds/tailwind/studio_engine";
6
+
7
+ tailwindcss-rails' engines contract (Tailwindcss::Engines.bundle) writes
8
+ app/assets/builds/tailwind/studio_engine.css as an @import of the gem's
9
+ engine.css. Studio::TailwindEntry (lib/studio/tailwind_entry.rb) rewrites
10
+ that entry, right after the bundle runs, to import THIS file instead, so a
11
+ host gets, from the same line and with nothing of its own:
12
+
13
+ - engine.css: the theme (theme.css, the tokens that replaced the JS
14
+ preset and the host's `@config`) and the component @utility layer;
15
+ - the @source scan below, so no host lists the gem in a content glob or
16
+ safelists its classes;
17
+ - engine-motion.css, the motion / effect / leveling layer, which used to
18
+ need a per-host rake task (lib/tasks/tailwindcss_engine_motion.rake).
19
+
20
+ The path is resolved by Ruby from the gem's root, so Node never runs bundler
21
+ to find the gem. engine.css stays importable on its own as the narrow layer.
22
+ Recipe: README, "Tailwind".
23
+ */
24
+ @import "./engine.css";
25
+
26
+ /* -- Sources: every engine directory that emits a class --------------------
27
+ Tailwind v4 compiles only the classes it SEES, so every directory whose
28
+ files put a utility class on the page is scanned here, relative to this
29
+ file, in every host that imports it, with no host edit: views and
30
+ partials, the ViewComponents (their colour classes live in Ruby), the
31
+ helpers that build markup (admin_model_table), and the engine's ES modules
32
+ (app/javascript: classes added at runtime). app/assets/javascripts is not
33
+ scanned: since the engine's scripts became modules it holds the vendored,
34
+ minified third-party builds (Alpine, Leaflet, Sortable, canvas-confetti) and
35
+ studio/session.js, which puts no class on a page (held by
36
+ test/integration/component_tailwind_source_test.rb).
37
+
38
+ The exclusions are NARROW on purpose: the vendored bundles are not engine
39
+ markup, and scanning them mints junk utilities from their identifiers. Never exclude a whole directory: the hub's
40
+ `@source not "../../../vendor/bundle"` once dropped every one of these
41
+ lines in CI, because the gem itself lives under vendor/bundle there.
42
+
43
+ test/integration/component_tailwind_source_test.rb proves every class these
44
+ directories emit compiles, and that dropping any one line turns it red. A
45
+ class built by interpolation (`bg-<%= tone %>`) is invisible to the scan;
46
+ test/views/dynamic_tailwind_class_guard_test.rb refuses one. */
47
+ @source "../../../views";
48
+
49
+ @source "../../../helpers";
50
+ @source "../../../javascript";
51
+ @source not "../../../javascript/studio/vendor";
52
+
53
+ /* -- Motion / effect / leveling layer ---------------------------------------
54
+ Last, so the theme and component layer it reads are in scope, as when hosts
55
+ imported it after engine.css themselves. */
56
+ @import "./engine-motion.css";
@@ -19,6 +19,7 @@
19
19
  # not declare. The host requires it from its system-test base only.
20
20
  require "action_dispatch/system_test_case"
21
21
  require "capybara/selenium/driver"
22
+ require "uri"
22
23
 
23
24
  module Studio
24
25
  class SystemTestCase < ActionDispatch::SystemTestCase
@@ -108,6 +109,71 @@ module Studio
108
109
  end
109
110
  Capybara::Selenium::Driver.prepend(RestoresScriptTimeout)
110
111
 
112
+ # Capybara 3.40.0's Chrome and Edge reset! end with
113
+ # execute_cdp("Storage.clearDataForOrigin", origin: "*", ...)
114
+ # Chrome 158 refuses "*" ("invalid argument: * is not a valid URL"), so every
115
+ # system test's teardown errors. This names the real origins instead: each
116
+ # http(s) origin the driver visited since the last reset, the page it is on
117
+ # at reset, and Capybara.app_host. Cookies are still cleared for every
118
+ # origin, as "*" did, through Network.clearBrowserCookies. A pure bug fix,
119
+ # so no opt-out (task engine-reset-fix-chrome-158).
120
+ module ClearsStorageByOrigin
121
+ ANY_ORIGIN = "*"
122
+ CLEAR_COMMAND = "Storage.clearDataForOrigin"
123
+
124
+ # The origin Chrome keys storage by ("http://127.0.0.1:4567"), or nil for
125
+ # a URL with none (about:blank, data:, a bare path).
126
+ def self.origin_of(url)
127
+ uri = URI.parse(url.to_s)
128
+ return unless %w[http https].include?(uri.scheme) && uri.host
129
+
130
+ port = uri.port == uri.default_port ? "" : ":#{uri.port}"
131
+ "#{uri.scheme}://#{uri.host}#{port}"
132
+ rescue URI::InvalidURIError
133
+ nil
134
+ end
135
+
136
+ def visit(url)
137
+ studio_note_origin { url }
138
+ super
139
+ end
140
+
141
+ def reset!
142
+ studio_note_origin { @browser.current_url } if @browser
143
+ super
144
+ ensure
145
+ @studio_storage_origins = nil
146
+ end
147
+
148
+ def studio_storage_origins
149
+ origins = (@studio_storage_origins || []).dup
150
+ app_origin = ClearsStorageByOrigin.origin_of(Capybara.app_host)
151
+ origins << app_origin if app_origin
152
+ origins.uniq
153
+ end
154
+
155
+ private
156
+
157
+ def execute_cdp(cmd, params = {})
158
+ return super unless cmd == CLEAR_COMMAND && params[:origin] == ANY_ORIGIN
159
+
160
+ super("Network.clearBrowserCookies") if params[:storageTypes].to_s.split(",").include?("cookies")
161
+ studio_storage_origins.each { |origin| super(cmd, params.merge(origin: origin)) }
162
+ nil
163
+ end
164
+
165
+ # Best effort: a read that fails (an open alert at reset) notes nothing,
166
+ # and never stops the reset.
167
+ def studio_note_origin
168
+ origin = ClearsStorageByOrigin.origin_of(yield)
169
+ (@studio_storage_origins ||= []) << origin if origin
170
+ rescue StandardError
171
+ nil
172
+ end
173
+ end
174
+ Capybara::Selenium::Driver::ChromeDriver.prepend(ClearsStorageByOrigin)
175
+ Capybara::Selenium::Driver::EdgeDriver.prepend(ClearsStorageByOrigin)
176
+
111
177
  driven_by :selenium, using: :headless_chrome, screen_size: DEFAULT_DESKTOP_SIZE
112
178
 
113
179
  # The base's setup runs before any setup a subclass declares, so an app's
@@ -1,3 +1,3 @@
1
1
  module Studio
2
- VERSION = "0.144.0"
2
+ VERSION = "0.144.1"
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.144.0
4
+ version: 0.144.1
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-11 00:00:00.000000000 Z
11
+ date: 2026-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -434,6 +434,7 @@ files:
434
434
  - app/assets/stylesheets/studio/sticky_table_header.css
435
435
  - app/assets/tailwind/studio_engine/engine-motion.css
436
436
  - app/assets/tailwind/studio_engine/engine.css
437
+ - app/assets/tailwind/studio_engine/host-variant-25559-c64c1299.css
437
438
  - app/assets/tailwind/studio_engine/host.css
438
439
  - app/assets/tailwind/studio_engine/theme.css
439
440
  - app/components/previews/studio/badge_component_preview.rb