Skip to content

Refactor: Remove SRCL UI and replace with local Tailwind-based primitives#44

Open
deepfates wants to merge 11 commits intomainfrom
codex/refactor-app-to-use-tailwind
Open

Refactor: Remove SRCL UI and replace with local Tailwind-based primitives#44
deepfates wants to merge 11 commits intomainfrom
codex/refactor-app-to-use-tailwind

Conversation

@deepfates
Copy link
Copy Markdown
Owner

Motivation

  • Complete cutover off the external SRCL UI library to a minimal, local Tailwind/CSS-based implementation while preserving the app's existing menu/gamepad UI behavior and class semantics.
  • Simplify build/time-to-boot by removing SRCL-specific aliases and dependency wiring so the app relies on in-repo primitives and Tailwind utilities.

Description

  • Removed the SRCL provider and global/font imports from the client bootstrap so the app now mounts directly via client/App.tsx and client/main.tsx using local styles (client/styles/terminal.css).
  • Replaced SRCL menu primitives with native/Tailwind-friendly controls by converting ActionListItem, Checkbox, RowSpaceBetween, and NumberRangeSlider usages to local implementations in client/interface/components/MenuSelect.tsx, MenuKnob.tsx, and MenuToggle.tsx, and updated SettingsMenu.tsx to use the new primitives while keeping .menu-item/selected semantics.
  • Replaced the SRCL theme helper with a local onHandleThemeChange function at client/utils/theme.ts and added minimal in-repo theme-* and font-use-* CSS variable definitions in client/styles/terminal.css to preserve the existing theme and font-class behavior.
  • Removed SRCL references from build and TypeScript configs by deleting Vite/TS path aliases and optimizeDeps exclusions in config/vite.config.ts, server/vite.ts, and config/tsconfig.json, and removed the srcl dependency from package.json.

Testing

  • Ran bun run lint, which completed successfully with no errors.
  • Ran bun test, which passed all tests (37 passing, 0 failing).
  • Ran bun run build, which produced successful server and client production bundles.

Codex Task

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b3f2368661

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread client/styles/terminal.css Outdated
Comment on lines +106 to +110
.font-use-anonymous-pro, .font-use-atkinson-hyperlegible-mono,
.font-use-berkeley-mono, .font-use-fira-code, .font-use-iosevka-term,
.font-use-monaspace-argon, .font-use-monaspace-krypton,
.font-use-monaspace-neon, .font-use-monaspace-radon,
.font-use-monaspace-xenon, .font-use-serious-shanns,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore per-font mappings for font-use classes

This rule groups every font-use-* class under the same --font-family-mono value, so changing the Font setting no longer changes typography. Before removing SRCL, these classes resolved to different font families; with this consolidation, every option renders identically and the font selector becomes effectively a no-op for users.

Useful? React with 👍 / 👎.

Copies 17 font files from node_modules/srcl into client/assets/fonts so
the font selector actually resolves to distinct faces without relying on
the SRCL package being installed.

Addresses Codex review on #44 about font-use classes collapsing to a
single --font-family-mono value.
- Add @font-face declarations pointing at vendored font files and map
  each .font-use-* class to its specific family.
- Replace the two grouped theme selectors with 14 distinct palettes
  extracted from SRCL (Aperture, BSOD, Highlight, OS 9, W95, Westworld,
  Holo, NERV, Midnight, Neon, Phosphor, Sulfur, LCARS, Outrun) using
  concrete rgba values.
- Restore compact menu item layouts to match live: MenuSelect renders
  "Label: Value" on one line, MenuKnob hides the native range input and
  shows a thin progress bar, MenuToggle uses a visually-hidden checkbox
  with a "×" glyph. Selected row uses --theme-focused-foreground-subdued
  for its background fill (SRCL convention).
- Add vertical spacing between models-menu entries.
- Story list uses a border-only selection (no glow).
The pre-hydration script in index.html adds the default theme class to
both <html> and <body> to avoid a flash. After React mounted,
applyThemeClass was only updating <html>, so body's original theme class
stayed and its scoped CSS vars overrode html's for every descendant.
That made the map, settings, and stories screens render with the
initial theme even after the user picked a new one.

Remove and reapply the theme (and font) class on both elements so the
selection propagates to everything inside body.
Adds @playwright/test dev dependency and scripts under scripts/parity/
that capture the live site at loompad.lol side-by-side with the local
dev server across screens, themes, and keyboard-driven flows. Output
directory (shots/) is gitignored.

- capture.ts: loom, map, stories, settings, edit, models, model-editor
  at desktop and mobile viewports
- capture-themes.ts: settings rendered in each of the 14 themes
- verify-theme-switch.ts: proves theme change propagates to map after
  closing settings
- verify-generation.ts: smoke test that triggers /api/generate end to
  end with a real OpenRouter key
SFMonoSquare-Regular.woff was 6.3 MB — a single font accounting for
nearly half the PWA precache. Removed from vendor dir and picker.
Added a short README noting provenance and OFL attribution for the
subset of faces that need it.
- Theme + font class now live on <html> only. Pre-hydration reads the
  modern loompad-theme-preferences key (falling back through the legacy
  key and system preference) and seeds the class. ThemeToggle's
  applyThemeClass writes to <html> only and strips any stale class from
  <body> from older pre-hydration scripts. Removes the dual-writer
  scenario that caused the map/settings theme-switch bug.
- Knob slider is now a 2px rule built from currentColor at 25%/100% via
  color-mix, so it inverts automatically with the row's text color when
  selected. Dropped the opacity-juggling and state-specific overrides.
- Removed the --theme-text-muted variable and its 14 per-theme
  declarations — nothing reads it.
- Deduped .menu-item--inline rule and consolidated .menu-item--knob into
  a single declaration; added a comment documenting the two selection
  conventions (filled row for settings/models, border-only for stories).
The manual .text-theme-* / .bg-theme-* / .border-theme-* rules at the
bottom of terminal.css duplicated what Tailwind v4 already generates
from the @theme color tokens at the top. Removed them; verified all
reachable screens render identically via scripts/parity/capture.ts.
@deepfates
Copy link
Copy Markdown
Owner Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

--color-theme-bg: var(--theme-background);
--color-theme-bg-modal: var(--theme-background-modal);
--color-theme-bg-modal-footer: var(--theme-background-modal-footer);
--color-theme-bg-input: var(--theme-background-input);

P2 Badge Preserve theme text utility compatibility

After removing srcl/global.css, the local @theme block now defines theme-bg* utilities, but the app still uses text-theme-background and text-theme-background-modal-footer (in client/interface/Interface.tsx) and those classes are no longer defined anywhere in the repo. That means these spans silently fall back to inherited color, changing intended contrast in the story view. Add compatibility aliases or switch usages to the generated text-theme-bg* utility names.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +925 to +929
.menu-knob__slider {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep menu knobs interactive for pointer users

The refactor hides .menu-knob__slider, which is the only actual <input type="range"> in MenuKnob, so Temperature/Auto Mode can no longer be adjusted via mouse/touch drag and become keyboard/gamepad-only. In the previous implementation the SRCL slider was interactive; now the visible bar is decorative and has no pointer handlers. Please keep a reachable interactive control (or attach pointer interaction to the bar) so non-keyboard input still works.

Useful? React with 👍 / 👎.

Ship Iosevka (standard sans) and Iosevka Slab as the entire font
palette. Keep Highlight, BSOD, Aperture (light) and Phosphor, NERV,
Outrun (dark) as the entire theme palette.

Removes 17 vendored font files and their @font-face / .font-use-* rules,
and 8 theme blocks from terminal.css. THEME_PRESETS and FONT_OPTIONS in
ThemeToggle.tsx reduced to the six themes and two fonts respectively.
Pre-hydration script in index.html updated to match the simplified
font-class mapping. :root fallback stack now names "Iosevka" first.

Picker goes from 16 fonts × 14 themes = 224 combinations to 2 × 6 = 12.
PWA precache drops from ~14 MB to ~3.3 MB. Every surviving theme is
designed to work against every surviving font without pairing rules.

Direction set by the user: keep things restrained, let each theme be a
recognizable mood, and let fonts be orthogonal to theme choice rather
than pairing them in packages.
Playwright scripts used to shop and QA the design space:
- tour-srcl.ts: tile sacred.computer + monaspace.githubnext.com for reference
- tour-fonts.ts: capture specimens for candidate fonts (Iosevka, Monaspace,
  Commit, Maple, Departure, Victor, Workbench, IBM Plex, JetBrains, 0xProto,
  Atkinson, Recursive, etc.)
- tour-loompad.ts: render the live loompad.lol across its full
  themes × fonts matrix
- tour-installed-fonts.ts: render each installed font inside the app
- render-prose.ts: render a real prose passage in every font at body size
- qa-reduced-set.ts: verify the reduced 2 fonts × 6 themes × 3 screens
  combinatoric renders without regressions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant