[Feature]: Apply the saved UI theme before the WASM bundle boots

オープン 初心者向け
#40 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
83/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
javascript, rust, wasm
領域
frontend

調査の方向性

Issue では index.html、crates/app/src/main.rs:36-44、vercel.json、SECURITY.md が示されています。現在のテーマエフェクトと CSP 例外に関する議論を読み、codeframe-ui-theme の値がどのように保存され、どのテーマ値を受け付けるかを確認してください。保存済みのテーマが初回描画前に html に data-theme を設定し、CSP の議論にインラインスクリプトが記載され、起動後のエフェクトが引き続き信頼できる情報源となれば完了です。

索引モデルが issue の本文から書いたものです。

説明

enhancement good first issue
Problem

The saved UI theme is applied by a Leptos Effect that runs after the WASM bundle boots (crates/app/src/main.rs:36-44). Users who selected dark or sepia see a flash of the light theme on every page load, which is most noticeable on slow connections and on the installed PWA.

Proposed solution

Apply the persisted theme before the first paint. The simplest approach is a tiny inline script in index.html that reads the codeframe-ui-theme key from localStorage and sets data-theme on <html>. The CSP in vercel.json already allows script-src 'unsafe-inline' (documented in SECURITY.md as a Trunk bootstrap requirement), so no CSP change is needed, but the script must be added to the same exception discussion to stay auditable.

The Leptos effect can stay as the source of truth after boot; the inline script only prevents the first-paint flash.

Alternatives considered
  • CSS-only solution with prefers-color-scheme: only covers light/dark system preference, not the app's three-way theme or the user's explicit choice.
  • Accept the flash: it is small but visible on every load and works against the "quiet, instant" positioning.
Project constraints
  • This keeps everything client-side (no backend, no server-side processing; code never leaves the browser).
  • This does not introduce a DOM-screenshot library (html2canvas, dom-to-image); rendering stays on Canvas2D/SVG.
  • This respects resolution honesty: the export canvas is drawn at true scale and never upscaled after the fact.
主要言語
Rust
スター
1
フォーク
0
平均マージ
2日 2時間
マージ済み PR(30日)
8

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

suradet-ps/codeframe のほかの issue

suradet-ps/codeframe の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。