feat: JS/TS「消えるブリッジ」層 jp-typeset/enhance を追加(縦書き対応・視覚回帰込み)#3
Merged
Conversation
CSS だけでは全ブラウザで揃わない JLReq 項目を、CSS.supports で feature-detect し native が無い所だけ補い、native 対応が来たら自動で no-op になる opt-in の JS 層を追加。 CSS コア(. export)は実行時依存ゼロのまま維持し、JS と budoux 依存は ./enhance export だけが背負う完全隔離。 - 旗艦: BudouX 文節改行(word-break:auto-phrase の polyfill、見出し・短文限定で 本文 p には当てない)。安定 API parser.parse() のみ使い自前 DOM ウォーカーで <wbr> を挿入(ZWSP 不使用でコピペ/AT/検索を汚さない・ルビ/圏点も非破壊)・冪等。 - 会話文字下げ Refinement(opt-in)、実験的 hanging/spacingTrim(既定 OFF・best-effort) も同一 Bridge 契約・feature-gate・冪等で実装。デフォルト挙動はクリーンに保つ。 - 縦書き(.jp-vertical)完全対応: 挿入余白は論理プロパティ(margin-inline-*/text-indent)、 ぶら下げの行末判定だけ computed writing-mode から軸を切替(縦組みは列下端=inline-end)。 - 配布: ESM(enhance() 明示 API・budoux external・動的 import)+ CDN 自動初期化 IIFE (budoux+日本語モデル内包の単一ファイル)。Vite library mode 2 パス+ tsc で .d.ts 出力。 - テスト: enhance.spec.ts(in-page CSS.supports 基準のゲート/no-op・<wbr>・冪等・非破壊・ 縦書き・IIFE 内包 budoux の実動作を 3 エンジンで決定論検証、ci:gate)+ enhance.visual.spec.ts(横/縦の視覚回帰、test:visual)。gallery.preview に enhance/ enhance-all(全ブリッジ・横/縦)を追加。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
概要
CSS だけでは全ブラウザで揃わない JLReq 項目を、
CSS.supports()で feature-detect して native が無い所だけ補い、native 対応が来たら自動で no-op になる「消えるブリッジ」 opt-in JS 層jp-typeset/enhanceを追加します。CSS コア(
.export)は実行時依存ゼロのまま不変。JS とbudoux依存は./enhanceexport だけが背負う完全隔離で、CSS だけの利用者は一切コストを払いません。機能(
enhance(root?, options?))phrasing<wbr>挿入、本文 p は対象外)word-break: auto-phrasedialogueIndenthanging(実験)hanging-punctuation: firstspacingTrim(実験)text-spacing-trimobserve設計のポイント
parser.parse()のみ使い、自前 DOM ウォーカーで<wbr>を挿入。ZWSP を使わないのでコピペ・スクリーンリーダー・検索を汚さず、ルビ・圏点などインライン要素も非破壊。冪等。Bridge契約・feature-gate・冪等に揃え、デフォルト挙動はクリーンに保つ(能力は最大・既定は最小)。.jp-vertical)完全対応: 挿入余白はすべて論理プロパティ(margin-inline-*/text-indent)、ぶら下げの行末判定だけ computedwriting-modeから軸を切替(縦組みは「列の下端=inline-end」)。横組みの挙動はバイト単位で不変。import { enhance }・tree-shakeable・budouxexternal+動的 import で native ブラウザはモデル未読込)+ CDN 自動初期化 IIFE(<script>一発・budoux+日本語モデル内包)。Vite library mode 2 パス+tsc --emitDeclarationOnlyで型出力。テスト(完備)
tests/enhance.spec.ts(ci:gate): in-pageCSS.supports基準のゲート/no-op・<wbr>挿入・冪等・ルビ/圏点非破壊・縦書き全ブリッジ・IIFE 成果物に内包した BudouX の実動作を 3 エンジンで決定論アサート。tests/enhance.visual.spec.ts(test:visual・非ゲート): 横組み・縦組みの要素単位スクショ(基準画像コミット済み・安定性確認済み)。gallery.preview.tsにenhance/enhance-all(全ブリッジ・横/縦)プレビューを追加。ローカルで CI 手順を完全再現(
--frozen-lockfileinstall →ci:gate→test:visual)し、全エンジン緑を確認済み。生成された縦書き基準画像も目視で文節カラム・ぶら下げ・約物詰め・ルビ/圏点が正しいことを確認。🤖 Generated with Claude Code