Commit Graph

18 Commits

Author SHA1 Message Date
Sam Dornan
1f231c84f4 test(precompress): close the gaps the review found in the gzip_static guards
The nginx guard only read the http-level default.conf and the three raw
location bodies, so two ways of reintroducing the ROM-corruption bug went
undetected. Both were confirmed against the suite before this change, each
leaving all seven tests green:

- gzip_static added at server scope in the template, with the locations left
  intact: /library/ and /cache/ inherit it, and a request for Game.nes returns
  Game.nes.gz's bytes.
- gzip_static removed from the fingerprinted-assets regex location, which the
  parametrised list never covered, silently dropping precompressed bundles.

Parse the template's location blocks instead, honouring braces inside the
quoted regex matcher, and assert against server scope, each build-output
location including the regex one, and any location that gains the directive.
A prefix match would have let /assets/romm/resources/ pass as expected, so
matchers resolve exactly and only the regex is keyed by its opening.

Also tie MIN_BYTES to nginx's gzip_min_length with a test rather than a
comment, cover the "gzip made it bigger" branch that the extension filter
kept unreachable, drop an em dash, and correct a comment that claimed every
file without a .gz sibling is gzipped on the fly, which is untrue for types
outside gzip_types.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HDXxq3vAxJVGhm1pQuK8V7
2026-09-12 04:49:06 +00:00
Sam Dornan
64740468ec fix(frontend): address the review findings on the precompress plugin
The summary divided by zero and printed "NaN% smaller" when nothing
cleared the extension and size filters.

The comment on the extension list said it tracks gzip_types, which was
wrong twice over: .svg, .wasm, .webmanifest and .map are absent from that
directive, and gzip_static serves a .gz sibling without consulting it at
all. Someone editing either list on the strength of that comment would
have changed behaviour silently.

Storybook builds ran the plugin too, gzipping storybook-static that nginx
never serves. It is stripped alongside vite-plugin-pwa, which .storybook
already does for the same reason.

The Python test could only grep vite.config.js for the call, so a gutted
closeBundle or apply: "serve" left it green. A vitest suite now runs the
hooks against a temporary directory and checks the archive round-trips,
that small and already-compressed files are skipped, and that a rerun does
not compress its own output.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HDXxq3vAxJVGhm1pQuK8V7
2026-09-12 02:09:24 +00:00
Sam Dornan
36cda30407 refactor(frontend): run precompression as a build plugin
Chaining the step onto the build script left `vite build` on its own
without compression, and only worked because npm ran the chain. A plugin
makes it part of the build itself, so there is nothing to bypass.

It runs with enforce: post so the service worker vite-plugin-pwa emits is
compressed too, and reads its output directory from the resolved config
rather than assuming dist. The precache is generated earlier in the build
and still lists no .gz entries.

Written here rather than taken off the shelf: vite-plugin-compression was
last published in 2022, vite-plugin-brotli caps at vite 7, and
vite-plugin-compression2 declares no vite 8 support while depending on
@rollup/pluginutils, which this rolldown-based build does not use. Node's
zlib covers it in one file with no dependency.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HDXxq3vAxJVGhm1pQuK8V7
2026-09-12 01:38:01 +00:00
Sam Dornan
76ab7ac7c7 perf(frontend): precompress built assets and serve them with gzip_static
The SPA bundle was compressed on every cold page load. Writing a .gz
sibling at build time and turning on gzip_static moves that work to the
build: serving the 1.6 MB main bundle drops from ~71ms to ~9ms per
request, measured over 25 requests against a local nginx.

Level 9 is affordable when it runs once, though it lands within a percent
of what nginx produces at runtime, so the win is the CPU rather than the
bytes. Anything without a .gz sibling still compresses on the fly.

The step is chained into build rather than a postbuild hook because
frontend/.npmrc sets ignore-scripts, which stops npm running pre and post
hooks at all. Node's zlib does the work, so no new dependency.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HDXxq3vAxJVGhm1pQuK8V7
2026-09-12 01:30:10 +00:00
zurdi
45f55bf633 fix(v2): gallery header/nav mobile polish + dimension tokens
- RTabNav: the horizontal tab strip no longer swallows vertical swipes
  (`overflow-y: hidden` so it's not a vertical scroll container; drop
  `touch-action: pan-x`, which froze the page) — the view scrolls even
  when the swipe starts on the tabs.
- AppNav: remove the "back to v1" escape-hatch button (and its now-dead
  code / imports / styles); the v1 UI keeps its own switch.
- GalleryShell/AlphaStrip: the stuck toolbar overlay now insets by the
  strip's real footprint via shared tokens, so it lines up exactly with
  the in-flow toolbar; wider, more tappable strip on phones, raised to
  centre in the visible band (above the bottom bar).
- CollectionHead / PlatformHead: bigger collection cover on phones
  (matches the index); the platform icon is a per-breakpoint square in a
  box that grows to it, so it reflows instead of overflowing/clipping.
- Add `--r-coll-cover-*` and `--r-alpha-strip-w*` dimension tokens.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-03 11:56:42 +00:00
zurdi
c8bc51dc81 Enhance light theme support with color adjustments and new tokens 2026-06-24 17:52:21 +00:00
zurdi
25b9397467 feat: implement CRT mode with visual effects and toggle functionality 2026-06-17 01:28:17 +02:00
zurdi
da0961281a Implement responsive navigation layout with BottomNav and BreakpointBadge components 2026-06-05 15:09:26 +02:00
zurdi
16d6cef03e feat: implement drawer z-index and enhance search context handling 2026-05-25 20:44:37 +00:00
zurdi
1aa23bd46e feat: unified RDialog consumers 2026-05-21 16:25:31 +00:00
zurdi
d7eb469f1f feat: introduce zIndex tokens for consistent stacking layers across components 2026-05-14 17:08:35 +00:00
zurdi
674ca98c57 feat: add RExpandTransition component for height animations
- Introduced RExpandTransition.vue to animate height changes of wrapped elements using v-if or v-show.
- Added index.ts to export the new RExpandTransition component.
- Updated RList, RListItem, RToolbar, RTooltip, RVirtualScroller components to remove Vuetify references in comments.
- Replaced v-expand-transition with RExpandTransition in Login.vue and Patcher.vue for consistent animation behavior.
- Refactored Scan.vue to manage open panels using a Set for better performance and clarity.
- Updated styles in global.css and tokens.css to improve focus ring visibility and component styling.
- Removed vuetify.ts theme definitions as they are no longer needed.
2026-05-14 15:07:03 +00:00
zurdi
8b796098d0 feat: implement list mode enhancements; add new components for list row and header, update styles and tokens for improved layout 2026-05-07 15:09:26 +00:00
zurdi
1728980948 feat: add status action to GameActionBtn and integrate with GameCard
- Introduced a new "status" action in GameActionBtn, allowing users to set and display game status.
- Replaced the StatusBadge component with the GameActionBtn in GameCard for a unified interface.
- Updated various components to accommodate the new status feature, including GameDetails and AppNav.
- Added CSS variables for page max width to ensure consistent layout on ultrawide displays.
- Removed redundant max-width styles from several components to streamline layout management.

Co-authored-by: Copilot <copilot@github.com>
2026-05-06 09:34:10 +00:00
zurdi
ca5aa0ef6b refactor: update color usage across components to utilize color-mix for improved theming
- Replaced hardcoded RGBA colors with color-mix for various UI elements in AuthCard, MissingFSBadge, PageHeader, AppLayout, RTable, RMenuPanel, RDialog, global styles, and tokens.
- Enhanced consistency in color application by introducing new color tokens for brand, status, and overlay colors.
- Updated background and border styles in multiple views including ControllerDebug, Pair, Patcher, Player, Scan, and Settings to align with new theming approach.
- Improved accessibility and visual coherence by ensuring color contrasts are maintained across light and dark themes.
2026-04-29 09:39:50 +00:00
zurdi
f97d7d28c9 feat(frontend-v2): eliminate hardcoded rgba(255, ...) outside tokens.css
Adds three new token groups so the 21 sites previously documented as
"intentional hardcoded rgba" can use proper tokens instead:

- colorOverlay (fixed dark glass, never theme-flips) — drives the
  surfaces sitting on cover artwork: StatusBadge, GameCard
  platform-icon / badge, GameActionBtn. Tokens: --r-color-overlay-fg
  (.95) / -fg-secondary (.85) / -fg-muted (.45) / -border (.12) /
  -border-strong (.25) / -scrim-soft (.55) / -scrim-strong (.78).

- panel + panelBorder pair (theme-flipped, in colorDark/colorLight) —
  the deep-glass / off-white surfaces that RDialog and RMenuPanel
  share. The inline `:global(.r-v2-light) X` overrides collapse into
  single rules.

- tooltipBg + tooltipBorder pair (theme-flipped) — moves the
  v-overlay__content.r-tooltip skin in global.css off literals.

- shimmerSweep (theme-flipped) — moves the linear-gradient sweep
  inside RSkeletonBlock::after off the hand-paired rgba values.

Also: RMenuItem danger hover background now uses
`color-mix(in srgb, var(--r-color-danger) 12%, transparent)`
instead of the raw rgba(255, 80, 80, 0.12) — derived from the
canonical danger token.

Outside tokens.css (which holds the source values), v2 now has
zero `rgba(255, 255, 255, X)` literals.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 08:31:14 +00:00
zurdi
49d01f65d6 chore(frontend-v2): polish tokens script and drop layout scope redundancy
build-tokens.ts: import the source as .js (compatible with vue-tsc
without enabling allowImportingTsExtensions), wrap top-level await
in main(), drop a leftover unused helper. Doc strings now point to
"npm run build:tokens" — the script name avoids npm's reserved
"token" subcommand. Header in the regenerated tokens.css matches.

AppLayout, AuthLayout and PairShell: drop the redundant
"r-v2 r-v2-{dark|light}" classes from their root divs. RomM.vue
already toggles those on <html>, which covers both the in-tree
shell and any teleported overlays — anchoring them again on the
layout root was harmless duplication that complicated the v1 →
v2-only cleanup. Each layout keeps its own BEM root class
(.r-v2-shell, .r-v2-auth, .r-v2-pair-shell) for its scoped styles.
useThemeClass becomes unused and is removed; when v1 is deleted,
the only thing left to clean is the toggle in RomM.vue.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 13:12:58 +00:00
zurdi
b3180a5aca feat(frontend-v2): generate tokens.css from index.ts as single source
scripts/build-tokens.ts emits src/v2/styles/tokens.css with explicit
naming overrides for the special cases (--r-row-pad, --r-elev-*,
--r-nav-h, abbreviated layout vars). tsx wired into devDeps;
build:tokens script + predev/prebuild hooks keep the CSS in sync.

Backfill missing tokens that lived only in CSS: --r-color-fav
joins colorBrand, and the focus colors in colorDark / colorLight
match the translucent values components actually consume (not the
unused #ffffff / #111117 they used to declare). Drop the orphan
--r-focus-ring-color (zero references in the codebase).

Adopt --r-radius-card (14px) for RMenuPanel and RDialog instead of
hard-coded 14px; switch a NotesTab badge from 10px to --r-radius-lg.
Closes the "panels use 14px not --r-radius-lg" pitfall — the
constitution no longer needs that footnote.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 13:09:50 +00:00