feat(examples): react-stroke-graph に preset rule/layout 選択 UI を追加#49
Merged
Conversation
事前定義した rule・layout を入力完了ごとに自動ループする方式をやめ、 画面上で preset rule(全 9 種)・preset layout(全 9 種)・入力単語を 明示的に選択できるようにした。 - rule/layout/単語を draft 状態として保持し、適用ボタン押下でまとめて反映 - 適用時に automaton を再構築して打鍵状態をリセット - 単語欄は空白区切りで複数指定でき、入力完了ごとに循環 - 英字・記号を含む単語に対応するため directInputRule を合成 - ルール名・ローマ字表記の表示を削除(選択欄・グラフと重複のため) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ph-preset-selector
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
設計の背景
従来は事前定義した 4 rule × 3 単語を入力完了ごとに自動で切り替えていく方式で、任意の rule/layout/単語を試せなかった。emiel の全 preset rule/layout を手元で確認できるよう、選択 UI に置き換えた。
rule/layout/単語の変更を即座に automaton へ反映すると、文字入力の途中でグラフが再描画されレイアウトが崩れる。これを避けるため操作中の値(draft)と適用済みの値(applied)を分離し、適用ボタン押下時にのみ反映する構成とした。適用は新しい automaton インスタンスへの差し替えで行われ、これがそのまま打鍵状態のリセットになる。
単語が 1 つだけのとき wordIndex が変化せず再構築が走らないため、入力完了ごとに増える round カウンタを automaton 再構築の依存に加えてループを成立させている。
検討した代替案
Test plan
🤖 Generated with Claude Code