refactor(css): move document, gallery and image-editor styles to their own file

static/style.css is 51,425 lines and holds every panel's styles, so two
people working on unrelated panels still edit the same file. This is the
first of three steps that give each panel group its own stylesheet. It moves
the document library, image gallery and image editor rules that can move
into static/css/documents-gallery-editor.css.

The new file is loaded eagerly from index.html immediately after style.css,
so the cascade is the concatenation of the two in that order, which is the
order those rules already had. Nothing is deferred and nothing renders
differently.

Rules moved verbatim. A rule stays in style.css when its selector group
covers more than one panel, when the class is shared design language used
from modules outside the panel, or when moving it would flip which of two
equally specific rules wins on an element the markup puts both classes on.
That last rule is what keeps this change small: most panel-prefixed rules on
this branch compete with a shared component rule somewhere later in the file.

Nineteen tests read static/style.css directly and go red the moment a rule
they assert on moves, which says nothing about the page. They now go through
tests/helpers/stylesheets.app_css(), which concatenates the stylesheets in
the order index.html loads them. The helper also exposes the <link> markup
for tests that build a synthetic page through Playwright.
This commit is contained in:
Léo
2026-09-23 16:12:51 +02:00
parent f577934777
commit e3eb7137b7
25 changed files with 1187 additions and 1015 deletions
@@ -1,12 +1,14 @@
from pathlib import Path
import re
from tests.helpers.stylesheets import app_css
ROOT = Path(__file__).resolve().parent.parent
def test_mobile_notes_checklist_rows_remain_tappable():
css = (ROOT / "static" / "style.css").read_text(encoding="utf-8")
css = app_css()
notes = (ROOT / "static" / "js" / "notes.js").read_text(encoding="utf-8")
assert "body.notes-mobile-mode .note-card .note-checkbox {" in css
@@ -39,7 +41,7 @@ def test_mobile_long_press_enters_select_mode_for_that_note():
def test_mobile_select_mode_has_subtle_jiggle_feedback():
css = (ROOT / "static" / "style.css").read_text(encoding="utf-8")
css = app_css()
assert "@keyframes notes-select-jiggle" in css
assert "body.notes-mobile-mode .note-card-selectmode" in css
@@ -81,7 +83,7 @@ def test_calendar_email_attachments_have_a_calendar_import_action():
def test_mobile_bulk_select_long_press_is_shared_across_card_types():
helper = (ROOT / "static" / "js" / "mobileBulkSelect.js").read_text(encoding="utf-8")
css = (ROOT / "static" / "style.css").read_text(encoding="utf-8")
css = app_css()
assert ".memory-item[data-memory-id]" in helper
assert ".skill-card[data-skill-name]" in helper