上のメニューからサンプルテキストを選択してください。
+diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c2658d7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules/ diff --git a/README.md b/README.md index 47a6dd4..a49c826 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,172 @@ -# layout-lab -破滅派でHTML+CSSによる組版のパターンを試すためのリポジトリです。 +# hametuha-reader-lab + +日本語縦書き長文のための Web閲覧UI実験リポジトリ。 + +このリポジトリは、小説投稿サイト「破滅派」での閲覧体験を改善するために、 +長文日本語テキストをブラウザで快適に読むためのレイアウトとUIを検証するための実験環境です。 + +WordPress本体の実装とは切り離し、HTML / CSS / JavaScriptのみで +さまざまな表示方法を試しながら最適な閲覧体験を探索します。 + +⸻ + +## 背景 + +破滅派では以下のような特徴があります。 + + • 原稿用紙20枚程度(約8000文字)の作品が中心 + • 100枚以上(約4万文字以上)の長文作品も存在 + • 作者によって文字サイズ・記号・改行などの使い方が大きく異なる + • 閲覧環境(PC / タブレット / スマートフォン)が多様 + • フォントサイズ変更など読者側のカスタマイズも想定される + +そのため、 + • 固定ページ組版(PDFのようなページ分割) + • 事前に決められた段組 + +などは破綻しやすく、Webブラウザ上での動的なレイアウト設計が必要になります。 + +このリポジトリでは、長文小説に適した閲覧UIを検証します。 + +⸻ + +## このリポジトリで検証すること + +主に次の要素を組み合わせて比較します。 + +レイアウト + • 横書き + • 縦書き(writing-mode: vertical-rl) + +段組 + • 1段 + • 2段(見開き風) + +スクロール方式 + • 通常スクロール + • Scroll Snapによるページ単位スクロール + +操作方式 + • スクロール操作 + • キーボード操作 + • ボタンによるページ送り + +表示環境 + • Desktop + • Tablet + • Smartphone + +テキスト長 + • 約8000文字(短編) + • 約40000文字(長編) + +⸻ + +目標 + +このプロジェクトの目標は 紙の本を再現することではありません。 + +Web上で長文を読む際に重要な次の点を満たすことです。 + • 長時間読んでも疲れない + • 読書位置を見失わない + • フォントサイズ変更に耐える + • 画面サイズの違いで破綻しない + • 長文でもパフォーマンスが落ちない + • ブラウザのジェスチャー(戻る操作など)と衝突しない + +⸻ + +検証予定のUI案 + +A. シンプル縦書きスクロール + +最もシンプルな方式。 + +縦書き +↓ +通常スクロール + +メリット + • 実装が簡単 + • 長文に強い + • パフォーマンスが良い + +デメリット + • 本を読む感覚は弱い + +⸻ + +B. 縦書き2段 + 縦スクロールページ + +1画面を「見開き」として扱う方式。 + +┌─────────────┐ +│ ページ1 │ ページ2 │ +└─────────────┘ + ↓ + 次の見開き + +Scroll Snap を使い、 +1画面単位でページ送りを行う。 + +メリット + • 本に近い体験 + • 横スワイプの戻るジェスチャー問題を回避 + +デメリット + • レイアウト調整が必要 + +⸻ + +C. 疑似ページめくりUI + +電子書籍のようなページめくり表現。 + +メリット + • 視覚的に楽しい + +デメリット + • 実装コストが高い + • 可変テキストと相性が悪い + +⸻ + +プロジェクト構成(予定) + +. +├── index.html +├── styles.css +├── reader.js +└── samples + ├── short.html # 約8000文字 + └── long.html # 約40000文字 + + +⸻ + +実験方針 + +このリポジトリでは次の方針で開発します。 + 1. WordPress依存を持たない + 2. UIのみを検証する + 3. JavaScriptは最小限にする + 4. CSSレイアウトを中心に実験する + +最終的に安定したUIが見つかった場合、 +破滅派本体の閲覧ページへ統合します。 + +⸻ + +将来的な展望 + +この実験が発展すると、次のような用途に拡張できる可能性があります。 + • 小説サイト向け閲覧UIライブラリ + • 日本語縦書きWebリーダー + • EPUB / PDFビューアのWeb版 + • @hametuha/novel での閲覧エンジン + +⸻ + +License + +MIT \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..b284cda --- /dev/null +++ b/package-lock.json @@ -0,0 +1,839 @@ +{ + "name": "layout-lab", + "version": "0.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "layout-lab", + "version": "0.1.0", + "dependencies": { + "express": "^5.1.0", + "marked": "^15.0.0" + } + }, + "node_modules/accepts": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", + "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", + "license": "MIT", + "dependencies": { + "mime-types": "^3.0.0", + "negotiator": "^1.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/body-parser": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.2.tgz", + "integrity": "sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA==", + "license": "MIT", + "dependencies": { + "bytes": "^3.1.2", + "content-type": "^1.0.5", + "debug": "^4.4.3", + "http-errors": "^2.0.0", + "iconv-lite": "^0.7.0", + "on-finished": "^2.4.1", + "qs": "^6.14.1", + "raw-body": "^3.0.1", + "type-is": "^2.0.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/content-disposition": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.1.tgz", + "integrity": "sha512-oIXISMynqSqm241k6kcQ5UwttDILMK4BiurCfGEREw6+X9jkkpEe5T9FZaApyLGGOnFuyMWZpdolTXMtvEJ08Q==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", + "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", + "license": "MIT", + "engines": { + "node": ">=6.6.0" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/express": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz", + "integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==", + "license": "MIT", + "dependencies": { + "accepts": "^2.0.0", + "body-parser": "^2.2.1", + "content-disposition": "^1.0.0", + "content-type": "^1.0.5", + "cookie": "^0.7.1", + "cookie-signature": "^1.2.1", + "debug": "^4.4.0", + "depd": "^2.0.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "finalhandler": "^2.1.0", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "merge-descriptors": "^2.0.0", + "mime-types": "^3.0.0", + "on-finished": "^2.4.1", + "once": "^1.4.0", + "parseurl": "^1.3.3", + "proxy-addr": "^2.0.7", + "qs": "^6.14.0", + "range-parser": "^1.2.1", + "router": "^2.2.0", + "send": "^1.1.0", + "serve-static": "^2.2.0", + "statuses": "^2.0.1", + "type-is": "^2.0.1", + "vary": "^1.1.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/finalhandler": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz", + "integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "on-finished": "^2.4.1", + "parseurl": "^1.3.3", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", + "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", + "license": "MIT", + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/iconv-lite": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz", + "integrity": "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", + "license": "MIT" + }, + "node_modules/marked": { + "version": "15.0.12", + "resolved": "https://registry.npmjs.org/marked/-/marked-15.0.12.tgz", + "integrity": "sha512-8dD6FusOQSrpv9Z1rdNMdlSgQOIP880DHqnohobOmYLElGEqAL/JvxvuxZO16r4HtjTlfPRDC1hbvxC9dPN2nA==", + "license": "MIT", + "bin": { + "marked": "bin/marked.js" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/media-typer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz", + "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/merge-descriptors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", + "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", + "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", + "license": "MIT", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/negotiator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", + "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-to-regexp": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.3.0.tgz", + "integrity": "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/qs": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.15.0.tgz", + "integrity": "sha512-mAZTtNCeetKMH+pSjrb76NAM8V9a05I9aBZOHztWy/UqcJdQYNsf59vrRKWnojAT9Y+GbIvoTBC++CPHqpDBhQ==", + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz", + "integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==", + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.7.0", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/router": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", + "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "depd": "^2.0.0", + "is-promise": "^4.0.0", + "parseurl": "^1.3.3", + "path-to-regexp": "^8.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/send": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz", + "integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.3", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "fresh": "^2.0.0", + "http-errors": "^2.0.1", + "mime-types": "^3.0.2", + "ms": "^2.1.3", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "statuses": "^2.0.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/serve-static": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz", + "integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==", + "license": "MIT", + "dependencies": { + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "parseurl": "^1.3.3", + "send": "^1.2.0" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/type-is": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz", + "integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==", + "license": "MIT", + "dependencies": { + "content-type": "^1.0.5", + "media-typer": "^1.1.0", + "mime-types": "^3.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..4ad749b --- /dev/null +++ b/package.json @@ -0,0 +1,13 @@ +{ + "name": "layout-lab", + "version": "0.1.0", + "private": true, + "description": "日本語縦書き長文のための Web閲覧UI実験", + "scripts": { + "start": "node server.js" + }, + "dependencies": { + "express": "^5.1.0", + "marked": "^15.0.0" + } +} diff --git a/public/css/composition.css b/public/css/composition.css new file mode 100644 index 0000000..c11753a --- /dev/null +++ b/public/css/composition.css @@ -0,0 +1,82 @@ +/* ============================================ + composition.css — 組版 + 行間(line-height)、字間(letter-spacing)、 + マージン、インデントなど + 「文字をどう並べるか」に関するスタイル。 + すべてのスペーシングは --rhythm の倍数で統一。 + ============================================ */ + +/* --- 本文の基本組版 --- */ +.reader article { + text-align: justify; + letter-spacing: var(--letter-spacing); +} + +/* --- 見出しの組版 --- + line-height は rem 長さ指定で rhythm に揃える。 + unitless だと font-size に比例して崩れるため。 */ +.reader article h1 { + line-height: calc(var(--rhythm) * 2); + margin-block-start: calc(var(--rhythm) * 2); + margin-block-end: var(--rhythm); +} + +.reader article h2 { + line-height: calc(var(--rhythm) * 1.5); + margin-block-start: calc(var(--rhythm) * 1.5); + margin-block-end: calc(var(--rhythm) * 0.5); +} + +.reader article h3 { + line-height: calc(var(--rhythm) * 1); + margin-block-start: var(--rhythm); + margin-block-end: calc(var(--rhythm) * 0.5); +} + +/* --- 段落 --- */ +.reader article p { + text-indent: 0; + margin-block: 0; +} + +/* 自動段落下げ: 役物で始まらない段落をインデント */ +.reader.auto-indent article p.indent { + text-indent: 1em; +} + +/* 空行段落 */ +.reader article p:empty, +.reader article p br:only-child { + min-block-size: var(--rhythm); +} + +/* --- blockquote --- */ +.reader article blockquote { + margin-block: var(--rhythm); + padding-inline-start: var(--rhythm); + border-inline-start: 2px solid #ccc; +} + +/* --- リスト --- */ +.reader article ul, +.reader article ol { + margin-block: var(--rhythm); + padding-inline-start: calc(var(--rhythm) * 1.5); +} + +.reader article li { + margin-block: calc(var(--rhythm) * 0.25); +} + +/* --- 区切り線 --- */ +.reader article hr { + border: none; + margin-block: calc(var(--rhythm) * 2); + text-align: center; +} + +.reader article hr::after { + content: "* * *"; + color: #999; + font-size: var(--scale--1); +} diff --git a/public/css/controls.css b/public/css/controls.css new file mode 100644 index 0000000..38403d9 --- /dev/null +++ b/public/css/controls.css @@ -0,0 +1,80 @@ +/* ============================================ + controls.css — UI部品 + ツールバー、ページナビ、プログレスバー。 + 本文の組版とは独立したコントローラー。 + ============================================ */ + +/* --- ツールバー --- */ +.controls { + position: fixed; + top: 0; + left: 0; + right: 0; + z-index: 100; + display: flex; + align-items: center; + gap: 1rem; + padding: 0.5rem 1rem; + background: rgba(255, 255, 255, 0.95); + border-bottom: 1px solid #ddd; + font-family: sans-serif; + font-size: 14px; + backdrop-filter: blur(4px); +} + +.controls label { + display: flex; + align-items: center; + gap: 0.3rem; +} + +.controls select, +.controls input, +.controls button { + font-size: 14px; + padding: 0.2rem 0.5rem; +} + +.controls .spacer { + flex: 1; +} + +/* --- ページナビ (Mode A用) --- */ +.page-nav { + display: none; + position: fixed; + bottom: 1rem; + left: 50%; + transform: translateX(-50%); + z-index: 100; + font-family: sans-serif; + font-size: 14px; +} + +.page-nav button { + padding: 0.5rem 1rem; + margin: 0 0.25rem; + cursor: pointer; + border: 1px solid #ccc; + background: rgba(255, 255, 255, 0.9); + border-radius: 4px; +} + +.page-nav button:hover { + background: #eee; +} + +.reader[data-mode="vertical-columned"] ~ .page-nav { + display: none; +} + +/* --- プログレスバー --- */ +.progress-bar { + position: fixed; + bottom: 0; + left: 0; + height: 3px; + background: #666; + transition: width 0.1s; + z-index: 101; +} diff --git a/public/css/reader.css b/public/css/reader.css new file mode 100644 index 0000000..ba31f7b --- /dev/null +++ b/public/css/reader.css @@ -0,0 +1,48 @@ +/* ============================================ + reader.css — 閲覧モードのコンテナ制御 + writing-mode, 段組, overflow, スクロール方向。 + 「テキストをどの器に入れるか」の定義。 + ============================================ */ + +/* --- 共通 --- */ +.reader { + margin-top: 3rem; + padding: var(--page-padding); + overflow: auto; +} + +/* --- Mode A: 縦書き横スクロール --- */ +.reader[data-mode="vertical-scroll"] { + writing-mode: vertical-rl; + width: 100vw; + height: calc(100vh - 3rem); + overflow-x: auto; + overflow-y: hidden; +} + +/* --- Mode B: 縦書き段組スクロール --- */ +.reader[data-mode="vertical-columned"] { + writing-mode: vertical-rl; + width: 100vw; + height: auto; + column-count: 2; + column-gap: var(--column-gap); + column-rule: solid 1px #ddd; + overflow: visible; +} + +/* scroll-padding でツールバー分を考慮 */ +html:has(.reader[data-mode="vertical-columned"]) { + scroll-padding-top: 3rem; +} + +/* --- Mode C: 横書き中央配置 --- */ +.reader[data-mode="horizontal-scroll"] { + writing-mode: horizontal-tb; + max-width: 40em; + margin-left: auto; + margin-right: auto; + margin-top: 3rem; + height: auto; + overflow: visible; +} diff --git a/public/css/reset.css b/public/css/reset.css new file mode 100644 index 0000000..45e2508 --- /dev/null +++ b/public/css/reset.css @@ -0,0 +1,24 @@ +/* ============================================ + reset.css — リセットとベーススタイル + ブラウザのデフォルトを打ち消し、 + html/body に変数を適用する。 + ============================================ */ + +*, +*::before, +*::after { + box-sizing: border-box; + margin: 0; + padding: 0; +} + +html { + font-size: calc(var(--font-size-base) * var(--font-scale)); +} + +body { + font-family: var(--font-family); + color: var(--text-color); + background-color: var(--bg-color); + line-height: var(--line-height); +} diff --git a/public/css/responsive.css b/public/css/responsive.css new file mode 100644 index 0000000..c1220d6 --- /dev/null +++ b/public/css/responsive.css @@ -0,0 +1,32 @@ +/* ============================================ + responsive.css — メディアクエリ + 全関心事のレスポンシブ調整を一箇所に集約。 + ブレイクポイントの全体像が一目でわかるように。 + ============================================ */ + +/* --- タブレット (768px以下) --- */ +@media (max-width: 768px) { + :root { + --page-padding: 1rem; + } + + /* 段組を1段に */ + .reader[data-mode="vertical-columned"] { + column-count: 1; + } +} + +/* --- スマートフォン (480px以下) --- */ +@media (max-width: 480px) { + .controls { + flex-wrap: wrap; + gap: 0.5rem; + font-size: 12px; + } + + .controls select, + .controls input, + .controls button { + font-size: 12px; + } +} diff --git a/public/css/typography.css b/public/css/typography.css new file mode 100644 index 0000000..4fd716d --- /dev/null +++ b/public/css/typography.css @@ -0,0 +1,32 @@ +/* ============================================ + typography.css — 書体と文字の見た目 + font-size, font-weight, text-combine-upright, + ruby など「文字そのもの」に関するスタイル。 + スペーシングは composition.css が担当。 + ============================================ */ + +/* 見出しサイズ: modular scale */ +.reader article h1 { + font-size: var(--scale-3); + font-weight: bold; +} + +.reader article h2 { + font-size: var(--scale-2); + font-weight: bold; +} + +.reader article h3 { + font-size: var(--scale-1); + font-weight: bold; +} + +/* 自動縦中横 */ +.tcy { + text-combine-upright: all; +} + +/* ルビ */ +.reader ruby rt { + font-size: 0.5em; +} diff --git a/public/css/variables.css b/public/css/variables.css new file mode 100644 index 0000000..cda021d --- /dev/null +++ b/public/css/variables.css @@ -0,0 +1,33 @@ +/* ============================================ + variables.css — 設計トークン + すべてのCSSファイルが参照する変数定義。 + ここを変えれば全体のトーンが変わる。 + ============================================ */ + +:root { + /* --- 書体 --- */ + --font-scale: 1; + --font-size-base: clamp(14px, 2.2vh, 20px); + --font-family: "游明朝", "Yu Mincho", "ヒラギノ明朝 ProN", "Hiragino Mincho ProN", "MS 明朝", serif; + + /* --- Modular scale (ratio 1.25 = Major Third) --- */ + --scale-ratio: 1.25; + --scale-0: 1rem; + --scale-1: calc(1rem * var(--scale-ratio)); + --scale-2: calc(1rem * var(--scale-ratio) * var(--scale-ratio)); + --scale-3: calc(1rem * var(--scale-ratio) * var(--scale-ratio) * var(--scale-ratio)); + --scale--1: calc(1rem / var(--scale-ratio)); + + /* --- 組版 --- */ + --line-height: 1.8; + --letter-spacing: 0em; + --rhythm: calc(1rem * var(--line-height)); + + /* --- 配色 --- */ + --bg-color: #faf8f5; + --text-color: #333; + + /* --- レイアウト --- */ + --page-padding: 2rem; + --column-gap: 2rem; +} diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..d07df1e --- /dev/null +++ b/public/index.html @@ -0,0 +1,90 @@ + + +
+ + +上のメニューからサンプルテキストを選択してください。
+サンプルの読み込みに失敗しました。
佐藤 章
+ +洋酒といえば、誰でも最初に思い浮かべるのがウイスキー。いわば洋酒のシンボル的な存在なのだが、英語表記が[一般に〔米〕ではWhiskey,〔英〕ではWhisky.]であることはあまり知られていない。米英両国では、このスペルの差で自国産と輸入品を区別しているという。わが和製ウイスキーの“Whisky”という英国式表示は、手本にしたスコッチのフォルムに倣ったものであり、それ以上の意味はないようだ。カナ表記にしても、ごくまれに〈ウヰスキー〉という書き方を見かけるが、これとて差別化を意図したものではなく単にカナづかいの時代性にすぎない。 + +現在、カナ表記は〈ウイスキー〉に一本化しており、そこに国産・舶来の区別はない。最近は価格面での差もちぢまり、20年前に¥10,000だった本場のスコッチが半値近くになるなど、ウイスキーは一層ポピュラーなものになってきた。しかし、消費量についていえば、洋酒のトップは何といってもビールだろう。よっぽどの下戸はともかく、まず誰でもタシナミ程度には口にする。 + +そのビールも明治中期には、せいぜい好事家が味わう程度だったらしい。当時流行した川上音二郎の《おっぺけぺ節》では、まるでゲテモノ扱い。「むやみに西洋を鼻にかけ/日本酒なんぞは飲まれない/ビールにブランデーベルモット/腹にも馴れない洋食を/やたらに喰うのも負け惜しみ/ないしょで後架でヘドついて/まじめな顔してコーヒのむ」と、特権階級をギューの目にあわせるネタにしている。観客も「ざまぁみやがれ!」とばかり同調して西洋カブレをオチョクり、日々のうっぷんを晴らしていた。 + +もっとも、オッペケペッポーの攻勢に、ぐぅのネを上げた紳士や淑女がいたかどうか…西洋カブレとは、要するに欧米文化への信奉者のこと。〈鰯ノ頭ヲ信心〉する者があるならヨーロッパやアメリカの文物を信仰する者がいても一向に不思議はない。信ずる者の強さで、依然グラス片手に舞踏会、アン・ドゥ・トロヮとやっていたように思われる。 + +憶測になるが、むしろ辛かったのは庶民の中の飲んべぇ連中ではなかったか。ハイカラ族にユサぶりをかけた手前、泰西の酒には手を出しづらい。「なに、ビールだとぉ、べらぼーめ、こちとら人間サマでぃ、カニじゃあるめぇしアブクなんか飲めるかってんだ」などと強がりながらも、サゾ飲みたかったろうという気がする。 + +しかし明治32年7月4日、恵比寿ビールのPRを目的にしたビアホールが新橋に登場。ジャムパン1ヶ2銭の時代に0.25リットル5銭でビールの1ぱい売りを始めたことから様相は一転する。レンガづくりのモダンな店ながら、法被姿の車夫も金バッヂの紳士もゼニを払えば平等の客。誰はゞかることなくビールをグィとやって舌ツヾミを打てる。当初から評判になって人々がワッと集まり、ファンの数もふえた。2ヵ月後の9月には中央新聞がその盛況ぶりを図入りで伝えたほどだった。 + +この年は西暦1899年。まさに19世紀の〆くくりの年にビールのヌーヴェルバーグがぼっこうしたことになる。恵比寿は文字通り“福の神”となったわけだが、そのころは仮名表記も〈えびす〉・〈エビス〉ならぬ〈ゑびす〉・〈ヱビス〉で、いかにもゴリヤクのありそうな字ヅラになっていた。 + +20世紀に入って1906年になると、夏目漱石は小説『二百十日』(中央公論・明治39年10月号)の中で次のようなエピソードを創作した。舞台は阿蘇のひなびた温泉宿。 + +「ビールは御坐りまつせん」 + +「ビールがない?───君ビールはないとさ。何だか日本の領地でない様な気がする。情ない所だ」 + +「なければ、飲まなくつても、いゝさ」と圭さんは又泰然たる挨拶をする。 + +「ビールは御坐りませんばつてん、恵比寿なら御坐ります」 + +「ハヽヽヽ愈妙になつて来た。おい君ビールでない恵比寿があるつて云ふんだが、その恵比寿でも飲んで見るかね」 + +「うん、飲んでもいゝ。───その恵比寿は矢つ張り瓶に這入つてるんだらうね、姉さん」と圭さんは此時漸く下女に話かけた。 + +ゆ上がりの男2人と、着物を「つんつるてんに着てゐる」下女のやりとりは、いささかマンザイのボケとツッコミのセリフを思わせるが、ビールもこの時期には日本のスミズミまでじゅうぶんに出回っていたのがわかる。 + +こうして19〜20世紀初頭に日本人に受け入れられたビールは、いまでは日常生活にすっかりとけこんでいる。それだけに洋酒という感じがうすい。豚カツが〈和食〉でカステラが〈わぐゎし〉なら、ビールが〈日本の味〉であっても何ら不都合はないはずだ。実際、国産ビールの製造には米が一役かっている。 +――了
\ No newline at end of file diff --git a/server.js b/server.js new file mode 100644 index 0000000..09f1b75 --- /dev/null +++ b/server.js @@ -0,0 +1,43 @@ +const express = require('express'); +const { readdir, readFile } = require('fs/promises'); +const path = require('path'); +const { marked } = require('marked'); + +const app = express(); +const SAMPLES_DIR = path.join(__dirname, 'samples'); +const PORT = process.env.PORT || 3456; + +// Static files +app.use(express.static(path.join(__dirname, 'public'))); + +// List available samples +app.get('/api/samples', async (_req, res) => { + try { + const files = await readdir(SAMPLES_DIR); + const samples = files + .filter((f) => f.endsWith('.md')) + .map((f) => ({ + slug: f.replace(/\.md$/, ''), + filename: f, + })); + res.json(samples); + } catch { + res.json([]); + } +}); + +// Get sample as HTML +app.get('/api/samples/:slug', async (req, res) => { + const filePath = path.join(SAMPLES_DIR, `${req.params.slug}.md`); + try { + const md = await readFile(filePath, 'utf-8'); + const html = marked(md); + res.type('html').send(`