Files
homeassistant_espscreen/tests/editor_sources.py
T
Max Gramser 510ebdf885 Rebuild the editor as a Vue app: sidebar, pages side by side, tile settings in a drawer (0.2.74)
The page is now web/ (Vue 3 + Vite + TypeScript), built into screen_manager/app/static
with hashed file names; server.py serves index.html as built and /assets/. The Python
API, the data and the firmware are unchanged. Your screens sit in a sidebar, the pages
of a screen stand next to each other at the screen's own shape, the library sits on the
right, and a tile's settings slide in as a drawer while the mockup stays in view. New
screen, Firmware & USB, Alerts, Override YAML and Settings are pages of their own.
Fonts moved to web/src/assets; the tests read the source through tests/editor_sources.py.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-18 08:30:38 +02:00

26 lines
898 B
Python

"""The editor's source, for the tests that read it.
The page is a Vue app in web/ (app 0.2.74); `npm run build` writes it to screen_manager/app/static. Tests look at
the source, not the build: every .ts and .vue file under web/src as one text (SCRIPT, which is also the markup:
a .vue file carries its template), and the stylesheets as another (CSS).
"""
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
WEB = ROOT / 'web/src'
STATIC = ROOT / 'screen_manager/app/static'
FILES = sorted(p for p in WEB.rglob('*') if p.suffix in ('.ts', '.vue'))
SCRIPT = '\n'.join(p.read_text() for p in FILES)
PAGE = SCRIPT
CSS = '\n'.join(p.read_text() for p in sorted(WEB.glob('styles/*.css')))
def source(name):
"""One file by name, e.g. 'store.ts' or 'components/Sidebar.vue'."""
return (WEB / name).read_text()
def component(name):
return source(f'components/{name}.vue')