refactor(ui): #176 B 案 PR 1.5 — ResultTable + InputField inline style 撤去 + cellStyle API 再設計 - #261
Conversation
- spec: ResultTable + InputField inline style 撤去 + cellStyle API 再設計 - plan: 10 task / TDD-style commit chain - 直前 PR 1 (#256) と同じ pattern で spec/plan を repo commit
…* / .bg-surface-row / .btn-link-plain)
…名統一) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…g 追加 (#176 B 案 PR 1.5)
…1.5) cellPadding flag は <td> のみに適用するよう修正。<th> はオリジナルの hardcoded padding: '0.5rem 0.75rem' 挙動を維持。Task 3/4 で copy 列が cellPadding: 'compact' になった際に header text 'コピー' が縮む regression を予防。
…className) に移行 (#176 B 案 PR 1.5)
…g/className) に移行 (#176 B 案 PR 1.5)
Task 3/4 で全 consumer (UlidGenerator/UuidV7Generator) が新 API (cellPadding/className) に移行完了したため、@deprecated だった cellStyle フィールドを TableColumn<T> から削除。同時に <td> から style={col.cellStyle} 属性も削除し、ResultTable.tsx の JSX inline style を 0 件にする。CSSProperties の未使用 import も整理。 Breaking change: 外部から cellStyle: CSSProperties を渡していた コードはコンパイルエラーになる。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
🖼️ Visual Regression Test 結果
|
実装は --col-width-N (per-index) ではなく --col-width (per-element scoped) を採用。final review 指摘で stale 部分を修正。
… PR 1.5) VRT 結果 (#261 PR comment) を受けた 2 件の修正: 1. InputField サンプルボタン: text-link → text-link-color に変更。 text-link は `text-decoration: underline` を含む(汎用テキストリンク用)が、 元の `colors.link` インライン style は色のみで下線なしだった。 text-link-color は "色のみ" 用 class(global.css line 144)。 2. visual-regression.spec.ts: Date.now の固定に加え、new Date() (引数なし) constructor も FIXED_NOW を返すよう Date global を Proxy 化。 QrTicket.tsx:13 の getDefaultExpiry() が `new Date()` で today+7 を計算し、 VRT 実行日に応じて表示日付がドリフトする問題を解決。 引数付き new Date(arg) の挙動は維持(user 入力 expiry の解釈に影響しない)。
並列レビュー結果(セキュリティ / フロントエンド / 規約)3 観点を並列でレビューしました。critical 0 / important 6 / nit 11。CI 3 種(test / e2e / visual-regression)全 pass、検証履歴記載も充実しており、merge 推奨です。重要指摘のうち a11y 系 2 件と CSP gate 1 件は本 PR スコープ外(既存問題の継承 / PR 6 連動)のため、本 PR は blocking せず別 issue 起票を提案します。 🛡️ セキュリティレビュー結果CSP 🟡 important PR 6(CSP strict 化)前に
|
| 項目 | 結果 |
|---|---|
PR ベース --base develop 明示 |
✅ |
| feature ブランチ命名規約 | ✅ feature/issue-176-b1-5-ui-complex |
| PR タイトル/本文 日本語 | ✅ |
| commit message 日本語 + Conventional Commits | ✅ 14/14 |
| PR 本文に検証履歴(test 603 / astro check 0 / e2e 144 / aria 退化 / grep 検証) | ✅ |
| spec & plan repo commit(PR 1 同パターン) | ✅ |
| CI 状況(test / e2e / visual-regression) | ✅ 全 pass |
memory feedback_e2e_before_pr |
✅ |
memory feedback_positive_control_for_gates |
✅ migration test 13×2 + 陽性対照 3 = 29 |
総評
- 🔴 critical: 0 件
- 🟡 important: 6 件(うち 4 件は本 PR スコープ外 / 別 issue 起票推奨: CSP gate / aria-selected / keyboard nav / commit subject 後始末)
- 🟢 nit: 11 件
merge 推奨。本 PR スコープ内で対処すべき blocker はありません。スコープ外の a11y 系 2 件(aria-selected ARIA spec 整合 / クリック行のキーボード操作)は 別 issue 起票 を推奨します。CSP gate(generator ページの applyProductionCsp E2E)は PR 6(CSP strict 化)の前段または同時に対処を推奨。
レビュー対応並列レビュー結果(critical 0 / important 6 / nit 11)の対応: Important 6 件の処理
Nit 11 件reviewer judgment(merge OK のままで or 将来検討)に従い、本 PR では対応せず。必要なら issue #265 / #266 の議論で取り込み。 記録
merge 準備完了。 |
…th JSDoc 追加 (#176 B 案 PR 1.5) PR #261 のレビュー指摘 (#265 / #266) への post-review fix: #265 (useEffect [columns] anti-pattern): - useEffect+useRef を撤去、ref callback 内で直接 setProperty - consumer 側で columns 配列が毎レンダリング新参照になる問題を構造ごと解消 (reviewer 提案の改善案 (3) 「実装最小」を採用) - 副次的に minWidth が undefined に戻った時の removeProperty も追加 (Final reviewer Minor 4 — minWidth never unset を併せて解消) #266 (width / minWidth origin discipline): - TableColumn<T>.width と Props.minWidth に hard-coded only の JSDoc 追加 - CSSOM の encapsulate と user input bridge 時 sanitize 必須を明文化 - コード変更なし (JSDoc のみ) 検証: npx astro check 0 errors / npm run test 694 pass
レビュー対応 (post-review fix)判断見直し: 軽量な important 2 件は本 PR 内で対応する方針に変更し commit 74161f8 で fix しました。
PR body の 残 3 issue (#262 / #263 / #264) は reviewer 推奨どおり別 issue 維持。
検証: |
再レビュー結果(修正後)
✅ #265 useEffect [columns] anti-pattern → ref callback 統合で根本解消
✅ #266 width / minWidth origin discipline JSDoc 追加
✅ スコープ外指摘の issue 起票(#262 / #263 / #264)
スコープを越えて a11y 改善を本 PR に詰め込まず別 issue 化する判断は、レビュー単位 / PR サイズ規約(memory 🟢 nit(merge 後の housekeeping)#265 / #266 issue を本 PR merge 時に close する
コミット subject
|
概要
#176B 案 PR 1.5:src/components/ui/ResultTable.tsx/src/components/ui/InputField.tsxから JSXstyle={{}}を完全除去し、TableColumn<T>.cellStyle: CSSPropertiesをcellPadding: 'normal' | 'compact'flag +className拡張に置換する。PR 1 (#256) で simple 11 件を migration 済。本 PR は API 破壊変更を伴う complex 2 件を独立に処理(
feedback_pr_size.md/feedback_infra_feature_separation.md準拠)。主要な変更
ResultTable.tsxstyle={{}}を class 化minWidth/ 列widthをsetProperty('--var', value)で CSS 変数注入(PR 1 の ToggleGroup と同手法、CSP 準拠)data-selected属性 +:nth-child(odd/even)+:not(:last-child)で表現(CSS 側に集約)cellStyle?: CSSPropertiesを削除、代わりにcellPadding?: 'normal' | 'compact'を追加<th>は常に normal padding(コミット 681ca56 で fix —cellPadding: 'compact'でも header text が縮まないよう保護)InputField.tsxstyle={{}}を class 化(baseInputStyleconstant →inputClass配列 +.filter(Boolean).join(' ')合成)monoprop 時の font-family が generic'monospace'→ Tailwind v4font-mono(プロジェクト設定の--font-monoに準拠)に統一。consumer (qr-ticket / tools) で既にfont-monoを使っていたため、これで内部一貫性が改善消費側
UlidGenerator.tsx/UuidV7Generator.tsx: columns 配列のcellStyle: {...}を新 API に変換(render 関数内 inline style は本 PR では touch せず、PR 3 / PR 5 スコープ)CSS
global.cssの@layer componentsに追加:.bg-surface/.result-table-*(zebra/selection/separator)/.result-table-col/.btn-link-plain.bg-surface命名は token-semantic(.bg-default/.bg-subtle/.bg-error-tintと整合、reviewer 指摘で.bg-surface-rowから rename)Migration test
inline-style-migration.test.tsのMIGRATED_FILESに 2 件追加(計 13 件、test 数: 13 × 2 + 3 positive control = 29)検証
ローカル (push 前):
npm run test: 603 passed / 1 skipped ✅npx astro check: 0 errors / 0 warnings ✅npm run test:e2e: 144 passed / 1 skipped ✅grep -c "style={{" src/components/ui/{ResultTable,InputField}.tsx: 両方 0 ✅grep -rn "cellStyle" src/: 0 件 ✅CI:
test.yml(required)— 通過想定visual-regression.yml(non-required)— 差分があれば PR comment + artifact link 投稿、意図的差分はupdate-visual-baseline.ymlをworkflow_dispatchtrigger で baseline 更新(PR 1 と同フロー)バッチ計画における位置付け
stripMetaStyleSrc()撤去、src/utils/styles.ts削除)関連
docs/superpowers/specs/2026-05-04-issue-176-b1-5-ui-complex-design.mddocs/superpowers/plans/2026-05-04-issue-176-b1-5-ui-complex.mdレビュアー向け注意点
<col>ref +setProperty('--col-width', ...)ループは API 互換維持のためwidth?: stringを保つ意図的な複雑さ(<col style="width">を使うと CSP の inline style 制約に再び戻るため、CSSOM API 経由で逃がしている)data-selected/aria-selectedの責務分離:data-selectedは視覚 state(zebra + selection の合成のため)、aria-selectedは a11y(onRowClick時のみ)。スペック §3 「衝突確認」参照font-mono化(InputField mono prop)はプロジェクト font stack への upgrade で improvement 扱い、regression ではないupdate-visual-baseline.ymlworkflow_dispatch で対処Closes #265
Closes #266