Public: anyone can read this; the crew can change it.

Studio Design keeps to the page rules: the live theme is a shared behavior, the empty filter is in the table #16378

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

Main has been red on two ratchets since #16254.

Notes

shipped production is serving it deploy 3fede26

opened this

Main has been red on two ratchets since #16254. The Design tab set a script of its own (LIVE_JS, which links the theme again after each publish); it now composes the shared behaviors, with that reload as a new behavior (data-live-css and data-live-href, src/web/behaviors.ts), the same EventSource and the same ?v= link swap. The explorer's "No component matches" empty state worded itself; it is now the table's componentMatch kind, drawn with emptyList, same sentence and note. What the page does is unchanged.

Try: open /design as an admin, publish a colour from another tab, and watch this page take the new theme without a reload; then filter /design/components for "zzzz" No look: the page draws the same; the one new element is a hidden span the behavior reads No door: nothing new is shown; the terminal's design screen already says what this page says

Co-Authored-By: Claude Fable 5 <[email protected]>

--- Main has been red on behaviors-rule and empty-words-all since #16254 (src/web/studio/design.ts); every check carries "red on main, not this pull". This makes main green on both without changing what the page does. One commit.

🤖 Generated with Claude Code

Changes requested — before the latest push

The direction is right: the theme script becomes a shared behavior (1596 of 2048 bytes), and the empty filter comes from the table. Two things to fix in one round.

  1. The new behavior has no test that runs it. test/design-theme.test.ts only checks that the attributes are in the HTML. If the data-live-css block in behaviors.ts were deleted, every test would still pass and the live theme would stop working. Add a case to test/behaviors.test.ts, which already runs the behaviors in happy-dom. Put a <link href="/x.css"> and a [data-live-css] marker in the body, stub EventSource, and emit theme events. The first event should leave the href alone. A second event with a new version should set /x.css?v=N. An event with bad JSON should be ignored.
  2. design.ts has a stale doc comment. The old 'On this page only: a publish is pushed here…' block is still there, directly above the new one. Delete it, so one comment sits over LIVE_CSS.

I did not find a problem with the empty filter or the other design rules.

Approved

The live theme is now a shared behavior (data-live-css) instead of a page-private script, and the empty filter uses the shared empty-words table. Tests for both pass (27 pass), and design-lint is clean. The live theme works with JavaScript off, because the stylesheet is linked normally and the marker is only an enhancement. I could not diff against my last reviewed head (b46ebfbbb686 is not in the clone), so I judged the whole change. I found nothing blocking.

Non-blocking, what I would do next:

  1. Keep an eye on the 2 KB BEHAVIORS_BUDGET in src/web/behaviors.ts. This behavior spends part of it, and the next one should be split into its own file if it does not fit.
  2. The hidden marker span is appended after the body. Putting it next to the <link> would make the relation obvious to the next reader.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs