wani 0.1.13 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8187f35f7910ae78b5be26fec6d2e5cbeab7543991dee476fc560b96636f06cc
4
- data.tar.gz: 0c4e90386a551816cb0cb067226be1bbb883d95445c7c2703af6a23c1f42a5d1
3
+ metadata.gz: 7082411823ce9ed8947c371bc7e16d786fc39f6e90a2b6d3f7a9d184b256fdcb
4
+ data.tar.gz: 3206f7bc05c39168c14007f5c958e07a4e04ddc4791ca05f7fc65e4dbd7969fc
5
5
  SHA512:
6
- metadata.gz: bdfb447264902b48d4ca7ab0ec8d86c52eb1b804c47a1b1f2f2725484bde71b54873d3617e6e445953dbc6026999cbdfda0bce256814c2c22240d2c010dabefc
7
- data.tar.gz: df01ae0a4ffebbed957a0b6d4cca615d36d76acde043b906babab908d4919524cd6bd098bf17c36deb194ed20434c73699cef6beeb1545e0087aef03bf0ca077
6
+ metadata.gz: cc53a8dbcc69c9f768f2af129f650d71263f8239ce0416b6c48420681f958a60feb5012402eea9f11478fa04a32a660c4f3fcec3c48111eb6ae19d9e81be5f70
7
+ data.tar.gz: dd12aa99c08476117ed9e76c5dd2bab050680ba2e6d79d3ed8998c29c625e3353851d4d79206ed2f89906bf99eb4bff95c362e4f482a86a9869bcb7cf44ba9f1
data/README.md CHANGED
@@ -2,61 +2,47 @@
2
2
 
3
3
  Markdown からスライドを作り、ブラウザー内の Ruby でプレゼンテーションするツールです。
4
4
  Rabbit へのオマージュとして、因幡の白兎に登場するワニ(鮫)にちなんだ名前です。
5
+ 兎とワニがスライドの進み具合を楽しく伝えます。
5
6
 
6
- <p align="center">
7
- <img src="docs/images/wani-characters.png" alt="ノートパソコンを使う兎と、それを見守るワニ" width="640">
8
- </p>
7
+ **Markdownを書いたら、あとは話す準備を。**
9
8
 
10
- <p align="center">
11
- <img src="docs/images/rabbit.png" alt="ノートパソコンを持った兎" width="240">
12
- <img src="docs/images/wani.png" alt="笑顔のワニ" width="240">
13
- </p>
9
+ waniは文字サイズを自動調整するプレゼンテーションツールです。
10
+ 表紙のタイトルは中央に、本文は固定サイズで右下に右揃えで表示します。タイトルと本文が重なる場合は警告します。2枚目以降はタイトルも本文もスライドに収まる限り最も大きく表示します。
11
+ 文字サイズの調整に手間を掛けません。
12
+
13
+ 持ち時間も、発表の演出に。
14
+ 最後の5秒は観客と一緒にカウントダウン。
15
+ 時間になるとワニが登場し、発表のフィナーレを飾ります。
14
16
 
15
17
  ## インストールと開始
16
18
 
19
+ ### インストール
20
+
17
21
  [RubyGems.org](https://rubygems.org/gems/wani) からインストールできます。
18
- Ruby 3.2 以上が必要です。利用に Node.js・npm やソースからのビルドは不要です。
19
22
 
20
23
  ```sh
21
24
  gem install wani
22
-
23
- wani new my-talk
24
- cd my-talk
25
- wani check
26
- wani serve
27
25
  ```
28
26
 
29
- ソースからのビルド手順は [開発・検証](docs/development.md) を参照してください。
30
-
31
27
  rbenv 環境でインストール後に `wani: command not found` となる場合は、
32
28
  `rbenv rehash` を実行して実行ファイルの shim を更新してください。
29
+ ソースからのビルド手順は [開発・検証](docs/development.md) を参照してください。
33
30
 
34
- 表示された http://127.0.0.1:8000/ を Chrome または Edge で開きます。
35
- `slides.md` を編集したらブラウザーを再読み込みしてください。
36
- 生成されるプロジェクトには、各種Markdown記法を紹介する10ページの `slides.md` と、`images/` 内のサンプルSVG画像が含まれます。
37
- HTML / CSS / JS ランタイム / wasm は gem が保持し、各プロジェクトへコピーしません。
38
-
39
- ## コマンド
31
+ ### 開始
40
32
 
41
33
  ```sh
42
- wani new DIRECTORY
43
- wani check [FILE]
44
- wani serve [FILE] --port 8000 --bind 127.0.0.1
45
- wani --version
46
- wani --help
34
+ wani new my-talk
35
+ cd my-talk
36
+ wani check
37
+ wani serve
47
38
  ```
48
39
 
49
- - `new`: サンプルを生成します。既存のディレクトリ、ファイル、シンボリックリンクは上書きしません。
50
- - `check`: ファイル省略時は `slides.md`。Front Matter・区切り・タイトル・ノート・画像を検証します。
51
- エラーは終了コード1、成功および警告のみの場合は0です。実際のはみ出しはブラウザーが検出します。
52
- - `serve`: 指定ファイルを静的配信します。省略時は `slides.md`。
53
- `--port` / `-p`、`--bind` / `-b` で変更でき、Ctrl+C で正常終了します。
54
- 初期バインド先は127.0.0.1、ポートは8000です。ポート0を指定すると利用可能なポートを選びます。
40
+ http://127.0.0.1:8000/ をブラウザーで開きます。
55
41
 
56
- Markdown の画像は、そのファイルを基準に相対パスで記述します。
57
- PNG / JPEG / WebP / SVG に対応します。HTTP(S)画像も表示できますが、`check` の存在確認はローカル画像だけです。
42
+ `new`コマンドで生成されるプロジェクトには、Markdown記法を紹介する10ページの `slides.md` とサンプルSVG画像が含まれています。
43
+ `slides.md` の変更はブラウザーを再読み込みすると反映されます。
58
44
 
59
- ## Markdown
45
+ ## Markdown記法
60
46
 
61
47
  ```markdown
62
48
  ---
@@ -82,14 +68,67 @@ notes:
82
68
  見出しレベルが違っても、タイトルのデザインは同じです。
83
69
  ```
84
70
 
85
- 独立した `---` の行でスライドを分割し、各ページの最初の見出しをタイトルにします。
86
- 本文には段落、強調、リスト、引用、コード、リンク、画像、表を使えます。
87
- コードフェンスに `ruby` や `js` などの言語名を付けると、スライド・ノート・PDFで構文ハイライトが適用されます。
88
- `<!-- notes: ... -->` は発表者ノート、`<!-- page-footnote: ... -->` はページごとの脚注です。
71
+ - タイトル:各ページの最初の見出し
72
+ - 画像:slides.mdを基準に相対パスで記述
73
+ - 発表者ノーと:`<!-- notes: ... -->`
74
+ - 本文: 段落、強調、リスト、引用、コード、リンク、画像、表が使用可能
75
+ - ページ区切り : `---`
76
+
77
+ 詳細は [Markdown記法ガイド](docs/markdown.md) を参照してください。
78
+
79
+ ## フォント文字サイズを自動調整
80
+
81
+ - タイトルは1行に収める
82
+ - 本文は全角20文字当の幅を超える場合は自然に折り返し
83
+ - 明示的な改行は維持
84
+ - 文字サイズは本文全体で共通
85
+
86
+ ## コマンド紹介
87
+
88
+ ```sh
89
+ wani new DIRECTORY
90
+ ```
91
+
92
+ `new`: サンプルを生成します。既存のディレクトリ、ファイル、シンボリックリンクは上書きしません。
93
+
94
+ ```sh
95
+ wani check [FILE]
96
+ ```
97
+
98
+ `check`: Front Matter・区切り・タイトル・ノート・画像を検証します。
99
+
100
+ - ファイル省略時は `slides.md`
101
+ - エラーは終了コード1、成功および警告のみの場合は0
102
+ - フォントのスライドからのはみ出しはブラウザーで表示するときに検出
103
+ - HTTP(S)画像も表示できますが、`check` の存在確認はローカル画像のみ
104
+
105
+
106
+ ```sh
107
+ wani serve [FILE] --port 8000 --bind 127.0.0.1
108
+ ```
109
+
110
+ `serve`: 指定ファイルを静的配信します。
111
+
112
+ - ファイル省略時は `slides.md`
113
+ - Ctrl+C で終了
114
+ - 初期バインド先は127.0.0.1。ポート 8000
115
+ - `--port` / `-p`、`--bind` / `-b` で変更
116
+ - ポート0を指定すると利用可能なポートを選択
117
+
118
+ ```sh
119
+ wani --version
120
+ ```
121
+
122
+ `version`: バージョンを表示します。
123
+
124
+ ```sh
125
+ wani --help
126
+ ```
127
+
128
+ `help`: ヘルプを表示します。
89
129
 
90
- 設定、各記法の例、対応範囲と制約は [Markdown記法ガイド](docs/markdown.md) を参照してください。
91
130
 
92
- ## 発表と印刷
131
+ ## 発表中の操作
93
132
 
94
133
  | キー | 操作 |
95
134
  | --- | --- |
@@ -100,67 +139,70 @@ notes:
100
139
  | Esc | 全画面を解除 |
101
140
  | N | 発表者ノートを別ウィンドウに開く |
102
141
 
103
- `#slide=3` のような URL で特定のスライドを開けます。
104
- ノート画面は本文・ノート・ページ番号をメインから一方向で同期します。
105
- 開けない場合はブラウザーのポップアップ設定を確認してください。
106
142
 
107
- スライドは1920×1080、16:9、白背景です。タイトル・本文・脚注を分け、画面に合わせて全体を拡大縮小します。
108
- 画像とフォントを読み込み、幅と高さに合わせて文字サイズを自動調整します。
109
- タイトルは1行に収めます。本文の段落・見出し・箇条書きは、使用フォントの全角20文字(「あ」20個)相当の幅以下なら折り返さず、それを超える場合は自然に折り返します。
110
- 明示的な改行は維持し、改行ごとに幅を判定します。文字サイズは本文全体で共通です。
111
- 画像は比率を維持して縦に配置し、画像だけの場合は本文領域を広く使います。
112
- 収まらない内容は分割・スクロールせず、番号と内容を含む警告を表示します。
113
- 画像の読み込みを最大15秒待ち、失敗やタイムアウトを通知します。
143
+ ### ノート
114
144
 
115
- ツールバーの「PDF」「ノート付き PDF」から印刷ダイアログを開き、PDFとして保存します。
116
- Ctrl+P でも印刷できます。
117
- 用紙は320×180mmを指定し、ブラウザーのヘッダー・フッターはオフにしてください。
118
- 通常版は1スライド1ページ、ノート付きは各スライドの次に対応するノートを置きます。
119
- 画像・フォントの完了後に印刷し、ページごとの脚注とページ番号を出力します。兎と鰐の装飾は常に非表示です。
120
- 装飾はページの進捗に連動します。前半ではワニが右から左へ増えて橋を作り、後半では兎が左の島からサメの背中を通って右の島へ渡ります。
121
- 1ページ目は総ページ数によらず必ずワニ1匹から始め、前半の終わりに橋が20匹で完成するように増やします。
122
- 1ページだけの場合は1匹のまま、2ページの場合は2ページ目で橋を完成させます。
123
- ページを戻すと位置と橋も戻り、最終ページで兎が右端に到着します。
124
- 画面では動きを減らす設定にも対応します。
145
+ - ノート画面はメイン画面の操作に同期
146
+ - 開けない場合はブラウザーのポップアップ設定を確認してください。
147
+
148
+ ### 進捗表示
149
+
150
+ 兎と鰐が進捗に連動します。
151
+
152
+ - 前半ではワニが右から左へ増えて橋を作る
153
+ - 後半では兎が左の島からサメの背中を通って右の島へ渡る
154
+ - ページを戻すと位置と橋も戻る
155
+ - 最終ページで兎が右端に到着
125
156
 
126
157
  ## 発表タイマー
127
158
 
128
- hashなしのURLで開くと、最初のスライドに半透明の黒いベールと「スタート」ボタンを表示します。
129
- 待機中はページ移動と計測を止め、ボタンを押すとベールが消えてタイマーが始まります。Fキーで全画面にして待機できます。
130
- `#slide=1` などのhash付きURLでは、読み込み完了から計測します。
131
- 既定では5分で時間切れ画面を表示します。
132
- Front Matter の `time_limit` に分数を指定して変更できます(小数も可)。
133
- `time_limit: 0` でタイマーを無効にします。
159
+ 最初のスライドに半透明の黒いベールと「スタート」ボタンを表示します。
160
+ URL でスライド番号を指定した場合は、ボタンを表示せず、タイマーも使用しません。
161
+ ボタンを押すとベールが消えてタイマーが始まります。
134
162
 
135
163
  残り30秒になると、全画面表示中もカウントダウンを表示します。
136
- 残り5秒は中央に数字を表示し、画面の短辺に対して20%・40%・60%・80%・100%と強調サイズを増やします。
137
- 各数字は0.8秒で通常サイズに戻ります。動きを減らす設定では拡大アニメーションを省略します。
164
+ 残り5秒は中央に数字を表示します。
138
165
  時間切れになると、兎柄フードをくわえたワニ(さめ)の画像を表示します。
139
- 画像は軽量なWebP形式で配布し、発表開始前に読み込みとデコードを済ませて、時間切れの文字と同時に表示します。
140
166
  左右キーまたは「スライドに戻る」ボタンで、時間切れ直前のスライドに戻れます。
141
- 戻った後は通常通りページを移動でき、時間切れ画面は再表示しません。
142
- 最終スライドの表示中はタイマーを一時停止し、カウントダウンも時間切れ画面も表示しません。
143
- 前のスライドに戻ると、停止前の残り時間から再開します。1ページだけの場合も停止します。
144
- ページを再読み込みするとタイマーも最初から始まります。
145
- 開始待ち画面、タイマー、時間切れ画面はPDFには含めません。
167
+
168
+ 既定では5分です。
169
+ Front Matter の `time_limit` に分数を指定して変更できます(小数も可)。
170
+ `time_limit: 0` でタイマーを無効にします。
171
+
172
+
173
+ ## スライドのフォーマット
174
+
175
+ - 1920×1080、16:9
176
+ - 白背景
177
+ - 画像は比率を維持して縦に配置し、画像だけの場合は本文領域を広く使います。
178
+
179
+ ## 警告
180
+
181
+ - 収まらない内容に警告を表示
182
+ - 画像の読み込みを最大15秒待ち、失敗やタイムアウトを通知
183
+
184
+ ## 印刷
185
+
186
+ ツールバーの「PDF」「ノート付き PDF」から印刷ダイアログを開き、PDFとして保存できます。
187
+ Ctrl+P でも印刷できます。
188
+ 用紙は320×180mmを指定し、ブラウザーのヘッダー・フッターはオフにしてください。
189
+
190
+ - 通常版は1スライド1ページ、ノート付きは各スライドの次に対応するノートを配置
191
+ - ページごとの脚注とページ番号を出力
146
192
 
147
193
  ## 同梱フォント
148
194
 
149
195
  日本語・英数字の標準書体は **IBM Plex Sans JP** です。
150
- 通常と太字のフォントを gem に同梱します。
151
- OS へのインストールや外部 CDN への接続は不要です。
152
-
153
- 本文・タイトル・発表者画面・PDF に同じ書体を使います。
154
- コードは等幅フォントを優先し、日本語の代替候補に IBM Plex Sans JP を指定します。
155
- 読み込みに失敗した場合は警告し、代替書体で表示を続けます。
196
+ コードは **UDEV Gothic** を使い、日本語も半角1:全角2の等幅で表示します。
156
197
 
157
198
  フォントは SIL Open Font License 1.1 です。原文のライセンス・著作権表示と配布元・チェックサムは
158
- [third_party/ibm-plex-sans-jp](third_party/ibm-plex-sans-jp/README.md) に保持しています。
199
+ [third_party/ibm-plex-sans-jp](third_party/ibm-plex-sans-jp/README.md) と
200
+ [third_party/udev-gothic](third_party/udev-gothic/README.md) に保持しています。
159
201
 
160
202
  ## フォントを変更する
161
203
 
162
204
  タイトルと本文には、[Fontsource](https://fontsource.org/fonts)のフォントを追加して使えます。
163
- フォントの追加時にはインターネット接続が必要です。追加後はオフラインで表示・PDF出力ができ、OSへのフォントのインストールやNode.js・npmは不要です。
205
+ フォントの追加時にはインターネット接続が必要です。追加後はオフラインでも表示・PDF出力ができます。
164
206
 
165
207
  ### Fontsourceのフォントを使う
166
208
 
@@ -239,24 +281,6 @@ wani font remove noto-sans-jp
239
281
 
240
282
  スライドで使用中の場合は確認を求めます。削除する場合は、Front Matterの`font`も削除するか、別の追加済みフォントに変更してください。
241
283
 
242
- ### 他の人に渡す場合
243
-
244
- 追加したフォントは`fonts/ID/`、登録情報は`.wani/fonts.yml`に保存されます。
245
- `slides.md`や画像と一緒に、`fonts/`と`.wani/fonts.yml`も保存・配布してください。`.wani`は隠しディレクトリなので、コピーし忘れないようにしてください。
246
-
247
- 各フォントのライセンスは`fonts/ID/LICENSE`に保存されます。Web公開・再配布・PDF配布の際は、そのフォントのライセンス条件を確認してください。
248
-
249
- ## 動作環境と制約
250
-
251
- 確認済みの環境は Linux / Ruby 4.0.7 / Chrome 156.0.8078.47 です。
252
- Windows・WSL2、Edge / Firefox / Safari、通常ブラウザーの印刷ダイアログ操作は未検証です。
253
-
254
- WSL2 内で `wani serve` を起動した場合は、Windows 側のブラウザーで http://localhost:8000/ を開きます。
255
- 環境のポート転送設定に応じて `--bind 0.0.0.0` を指定してください。
256
-
257
- 複雑に入れ子になった Markdown 方言、最適な画像の自動配置、ライブリロードは対象外です。
258
- 発表者画面はメイン画面の終了・再読み込み後に開き直してください。
259
-
260
284
  ## 開発者向けドキュメント
261
285
 
262
286
  - [アーキテクチャ](docs/architecture.md):共通モジュール、静的配信、wasm・ローダー、フォント、レイアウトの設計
data/assets/build.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "0.1.13",
3
- "source_sha256": "dd98a73a6b1051663cba48cffed40393d31d55912e0726cbbd6dad57c0753636",
2
+ "version": "0.1.15",
3
+ "source_sha256": "a9ec44f0f122168b5bdce3783ea9188f6955f1835f53ad67258bebcff1252aaf",
4
4
  "loader_commit": "dc6b0ffd5800ed9bfc49268ed8021d456f10ddf8",
5
- "wasm_sha256": "ee03daf589093dbd33075f2b1238de439e00e6ec69609f47580b39629f4ee95e"
5
+ "wasm_sha256": "bad1062bd0f007e51f7278365f14537dd974666f8c6442c304c13223cb78f3e4"
6
6
  }
Binary file
Binary file
data/assets/style.css CHANGED
@@ -12,6 +12,20 @@
12
12
  font-style: normal;
13
13
  font-display: block;
14
14
  }
15
+ @font-face {
16
+ font-family: "UDEV Gothic";
17
+ src: url("/assets/fonts/UDEVGothic-Regular.ttf") format("truetype");
18
+ font-weight: 400;
19
+ font-style: normal;
20
+ font-display: block;
21
+ }
22
+ @font-face {
23
+ font-family: "UDEV Gothic";
24
+ src: url("/assets/fonts/UDEVGothic-Bold.ttf") format("truetype");
25
+ font-weight: 700;
26
+ font-style: normal;
27
+ font-display: block;
28
+ }
15
29
  :root { font-family: "IBM Plex Sans JP", sans-serif; color: #20352e; background: #e9eee9; }
16
30
  * { box-sizing: border-box; }
17
31
  body { margin: 0; }
@@ -34,13 +48,19 @@ button:focus-visible, a:focus-visible { outline: 2px solid #557e64; outline-offs
34
48
  .title { margin: 0 0 36px; white-space: nowrap; flex: 0 0 160px; font-weight: 700; line-height: 1.12; overflow: hidden; letter-spacing: -.025em; }
35
49
  .body { flex: 1 1 0; min-height: 0; overflow: hidden; line-height: 1.3; }
36
50
  .body p { margin: 0 0 .35em; }
51
+ .body p, .body li { word-break: auto-phrase; text-wrap: pretty; }
37
52
  .titleless .body { display: flex; flex-direction: column; justify-content: safe center; text-align: center; }
38
53
  .titleless .body > * { flex-shrink: 0; }
39
54
  .titleless .body > :last-child { margin-bottom: 0; }
40
55
  .titleless .body img { margin-inline: auto; }
56
+ .cover .title { margin-top: 396px; text-align: center; }
57
+ .cover .body { display: flex; flex-direction: column; align-items: flex-end; justify-content: flex-end; text-align: right; }
58
+ .cover .body > * { flex-shrink: 0; max-width: 100%; }
59
+ .cover .body > :last-child { margin-bottom: 0; }
41
60
  .body ul, .body ol { margin: .2em 0 .4em; padding-left: 1.35em; }
42
61
  .body pre { margin: .3em 0; padding: .4em .55em; background: #f3f6f2; white-space: pre-wrap; tab-size: 2; }
43
- .body code { font-family: ui-monospace, "IBM Plex Sans JP", monospace; font-size: .8em; }
62
+ .titleless .body pre { width: fit-content; max-width: 100%; margin-inline: auto; text-align: left; }
63
+ .body code { font-family: "UDEV Gothic", "IBM Plex Sans JP", monospace; font-size: .8em; }
44
64
  .body blockquote { border-left: .08em solid #b6cbb9; margin: .4em 0; padding-left: .6em; }
45
65
  .body table { border-collapse: collapse; width: 100%; }
46
66
  .body th, .body td { border: 1px solid #bac8bd; padding: .15em .3em; }
@@ -59,11 +79,15 @@ button:focus-visible, a:focus-visible { outline: 2px solid #557e64; outline-offs
59
79
  .rabbit-image { display: block; width: 84px; height: 40px; }
60
80
  .decorations[data-direction="left"] .rabbit-image { scale: -1 1; }
61
81
  .slide.active .bridge-segment[data-appearing="true"] { animation: wani-arrive .35s ease-out; }
62
- .slide.active .decorations[data-moving="true"] .rabbit-position { animation: rabbit-advance .45s ease-in-out; }
63
- .slide.active .decorations[data-moving="true"] .rabbit-image { animation: rabbit-hop .45s ease-in-out; }
82
+ .slide.active .decorations[data-moving="true"] .rabbit-position { animation: rabbit-advance .45s linear; }
83
+ .slide.active .decorations[data-moving="true"] .rabbit-image { animation: rabbit-hop .45s linear; }
64
84
  @keyframes wani-arrive { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
65
85
  @keyframes rabbit-advance { from { left: calc((100% - 84px) * var(--rabbit-from)); } to { left: calc((100% - 84px) * var(--rabbit-progress)); } }
66
- @keyframes rabbit-hop { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
86
+ @keyframes rabbit-hop {
87
+ 0% { transform: translateY(0); animation-timing-function: cubic-bezier(.16, 1, .3, 1); }
88
+ 50% { transform: translateY(-60px); animation-timing-function: cubic-bezier(.333333, 0, .666667, .333333); }
89
+ 100% { transform: translateY(0); }
90
+ }
67
91
  @media (prefers-reduced-motion: reduce) { .decorations * { animation: none !important; } }
68
92
  #stage .slide:not(.active) { display: none; }
69
93
  .help { padding: 8px 24px; font-size: 11px; color: #718578; display: flex; gap: 22px; }
data/assets/wani.wasm CHANGED
Binary file
@@ -17,6 +17,8 @@ module Wani
17
17
  response = JS.global.fetch("/talk/slides.md").await
18
18
  raise "Markdown を読み込めません (HTTP #{response[:status].to_i})" unless response[:ok] == JS::True
19
19
  @presentation = Core::Parser.new.parse(response.text.await.to_s)
20
+ title = @presentation.slides.first.title
21
+ @document[:title] = title unless title.empty?
20
22
  @presentation.diagnostics.each { |item| warn("#{item.slide ? "スライド #{item.slide}: " : ""}#{item.message}") }
21
23
  @renderer = Renderer.new(@document, @presentation)
22
24
  @sections = @presentation.slides.map { |slide| @renderer.slide(slide) }
@@ -36,8 +38,6 @@ module Wani
36
38
  element("start-overlay")[:hidden] = false
37
39
  element("viewport")[:inert] = true
38
40
  element("start-presentation").focus
39
- else
40
- start_timer
41
41
  end
42
42
  element("status")[:textContent] = "準備できました"
43
43
  end
@@ -5,6 +5,7 @@ module Wani
5
5
  HEIGHT = 1080
6
6
  BODY_MIN = 16
7
7
  BODY_MAX = 160
8
+ COVER_BODY_SIZE = 48
8
9
  TITLE_MIN = 24
9
10
  TITLE_MAX = 220
10
11
  NO_WRAP_EMS = 20
@@ -15,14 +16,16 @@ module Wani
15
16
 
16
17
  def wait_assets(root)
17
18
  unless @fonts_loaded
18
- # Hidden slide titles do not trigger font downloads. Load both weights
19
- # explicitly before fitting, including Japanese glyphs in the request.
20
- family = JS.global.getComputedStyle(@document[:documentElement])[:fontFamily].to_s
21
- [400, 700].each do |weight|
22
- begin
23
- @document[:fonts].load("#{weight} 16px #{family}", "日本語 ABC").await
24
- rescue JS::Error
25
- @warn.call("フォントを読み込めませんでした。代替フォントを使用します (#{weight})")
19
+ # Hidden slide titles and code do not trigger font downloads. Load both
20
+ # bundled families and weights explicitly before fitting.
21
+ body_family = JS.global.getComputedStyle(@document[:documentElement])[:fontFamily].to_s
22
+ [body_family, '"UDEV Gothic"'].each do |family|
23
+ [400, 700].each do |weight|
24
+ begin
25
+ @document[:fonts].load("#{weight} 16px #{family}", "日本語 ABC").await
26
+ rescue JS::Error
27
+ @warn.call("フォントを読み込めませんでした。代替フォントを使用します (#{weight})")
28
+ end
26
29
  end
27
30
  end
28
31
  @fonts_loaded = true
@@ -58,8 +61,26 @@ module Wani
58
61
  body = section.querySelector(".body")
59
62
  prepare_wrapping(body)
60
63
  fit_images(body)
61
- fit_font(body, BODY_MIN, BODY_MAX)
62
- @warn.call("スライド #{number}: 本文が収まりません: #{body[:textContent].to_s[0, 120]}") unless fits?(body)
64
+ if section[:classList].contains("cover") == JS::True
65
+ body[:style][:fontSize] = "#{COVER_BODY_SIZE}px"
66
+ else
67
+ fit_font(body, BODY_MIN, BODY_MAX)
68
+ end
69
+ body_fits = if section[:classList].contains("cover") == JS::True
70
+ cover_body_fits?(body)
71
+ else
72
+ fits?(body)
73
+ end
74
+ @warn.call("スライド #{number}: 本文が収まりません: #{body[:textContent].to_s[0, 120]}") unless body_fits
75
+ if section[:classList].contains("cover") == JS::True && title[:style][:display].to_s != "none"
76
+ title_rect = title.getBoundingClientRect
77
+ overlap = body[:children].to_a.any? do |child|
78
+ rect = child.getBoundingClientRect
79
+ rect[:top].to_f < title_rect[:bottom].to_f && rect[:bottom].to_f > title_rect[:top].to_f &&
80
+ rect[:left].to_f < title_rect[:right].to_f && rect[:right].to_f > title_rect[:left].to_f
81
+ end
82
+ @warn.call("スライド #{number}: タイトルと本文が重なっています") if overlap
83
+ end
63
84
  footnote = section.querySelector(".page-footnote")
64
85
  if footnote[:scrollWidth].to_i > footnote[:clientWidth].to_i + 1
65
86
  @warn.call("スライド #{number}: 脚注が1行に収まりません。短くするか、詳細を本文へ移してください。")
@@ -117,6 +138,15 @@ module Wani
117
138
  node[:scrollWidth].to_i <= node[:clientWidth].to_i + 1 && node[:scrollHeight].to_i <= node[:clientHeight].to_i + 1
118
139
  end
119
140
 
141
+ def cover_body_fits?(body)
142
+ bounds = body.getBoundingClientRect
143
+ body[:scrollWidth].to_i <= body[:clientWidth].to_i + 1 && body[:children].to_a.all? do |child|
144
+ rect = child.getBoundingClientRect
145
+ rect[:top].to_f >= bounds[:top].to_f - 1 && rect[:bottom].to_f <= bounds[:bottom].to_f + 1 &&
146
+ rect[:left].to_f >= bounds[:left].to_f - 1 && rect[:right].to_f <= bounds[:right].to_f + 1
147
+ end
148
+ end
149
+
120
150
  def fit_font(node, minimum, maximum)
121
151
  low, high, best = minimum, maximum, minimum
122
152
  while low <= high
@@ -17,6 +17,7 @@ module Wani
17
17
  title[:style][:display] = "none"
18
18
  section[:className] = "slide titleless"
19
19
  end
20
+ section[:classList].add("cover") if slide.number == 1 && !notes
20
21
  body = child(section, "div", "body")
21
22
  body[:innerHTML] = notes ? slide.notes_html : slide.html
22
23
  resolve_links(body)
@@ -8,8 +8,9 @@ module Wani
8
8
  # Only the selected Markdown, images below its directory and fixed gem assets are public.
9
9
  class Application
10
10
  ASSETS = %w[index.html style.css highlight.css rouge.LICENSE bootstrap.rb speaker.html rabbit.svg shark.svg time-expired.webp runtime.pr672.js wani.wasm runtime.LICENSE runtime.NOTICE build.json
11
- fonts/IBMPlexSansJP-Regular.woff2 fonts/IBMPlexSansJP-Bold.woff2].freeze
12
- TYPES = { ".html" => "text/html; charset=utf-8", ".css" => "text/css; charset=utf-8", ".rb" => "text/plain; charset=utf-8", ".js" => "text/javascript", ".wasm" => "application/wasm", ".md" => "text/plain; charset=utf-8", ".svg" => "image/svg+xml", ".png" => "image/png", ".jpg" => "image/jpeg", ".jpeg" => "image/jpeg", ".webp" => "image/webp", ".json" => "application/json", ".woff2" => "font/woff2" }.freeze
11
+ fonts/IBMPlexSansJP-Regular.woff2 fonts/IBMPlexSansJP-Bold.woff2
12
+ fonts/UDEVGothic-Regular.ttf fonts/UDEVGothic-Bold.ttf].freeze
13
+ TYPES = { ".html" => "text/html; charset=utf-8", ".css" => "text/css; charset=utf-8", ".rb" => "text/plain; charset=utf-8", ".js" => "text/javascript", ".wasm" => "application/wasm", ".md" => "text/plain; charset=utf-8", ".svg" => "image/svg+xml", ".png" => "image/png", ".jpg" => "image/jpeg", ".jpeg" => "image/jpeg", ".webp" => "image/webp", ".json" => "application/json", ".woff2" => "font/woff2", ".ttf" => "font/ttf" }.freeze
13
14
  IMAGES = %w[.png .jpg .jpeg .webp .svg].freeze
14
15
 
15
16
  def initialize(file, assets: File.join(Wani::ROOT, "assets"), diagnostics: nil)
data/lib/wani/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Wani
2
- VERSION = "0.1.13"
2
+ VERSION = "0.1.15"
3
3
  end
data/templates/slides.md CHANGED
@@ -6,10 +6,6 @@ time_limit: 5
6
6
 
7
7
  Ruby と Markdown でプレゼンテーション。
8
8
 
9
- - 左右キー・Space で移動
10
- - F で全画面
11
- - N で発表者ノート
12
-
13
9
  <!-- page-footnote: Wani のサンプルへようこそ -->
14
10
 
15
11
  <!-- notes:
@@ -160,6 +156,7 @@ N キーで、このページの実際のノートを確認できます。
160
156
 
161
157
  # 発表と配布へ
162
158
 
159
+ - 左右キー・Space で移動し、F キーで全画面にする
163
160
  - N キーで、このページの発表者ノートを開く
164
161
  - 「PDF」でスライドを保存する
165
162
  - 「ノート付き PDF」で説明も一緒に配布する
@@ -0,0 +1,101 @@
1
+ # Licensing
2
+
3
+ - Source fonts are licensed under SIL OPEN FONT LICENSE Version 1.1.
4
+ For more information, see "LICENSE_<FontName>" file contained in the "source" directory.
5
+ - "UDEV Gothic" are licensed under SIL OPEN FONT LICENSE Version 1.1.
6
+
7
+ ## "UDEV Gothic" licensing
8
+
9
+ Copyright (c) 2022 Yuko OTAWARA. with Reserved Font Name "UDEV Gothic"
10
+
11
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
12
+ This license is copied below, and is also available with a FAQ at:
13
+ https://scripts.sil.org/OFL
14
+
15
+
16
+ -----------------------------------------------------------
17
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
18
+ -----------------------------------------------------------
19
+
20
+ PREAMBLE
21
+ The goals of the Open Font License (OFL) are to stimulate worldwide
22
+ development of collaborative font projects, to support the font creation
23
+ efforts of academic and linguistic communities, and to provide a free and
24
+ open framework in which fonts may be shared and improved in partnership
25
+ with others.
26
+
27
+ The OFL allows the licensed fonts to be used, studied, modified and
28
+ redistributed freely as long as they are not sold by themselves. The
29
+ fonts, including any derivative works, can be bundled, embedded,
30
+ redistributed and/or sold with any software provided that any reserved
31
+ names are not used by derivative works. The fonts and derivatives,
32
+ however, cannot be released under any other type of license. The
33
+ requirement for fonts to remain under this license does not apply
34
+ to any document created using the fonts or their derivatives.
35
+
36
+ DEFINITIONS
37
+ "Font Software" refers to the set of files released by the Copyright
38
+ Holder(s) under this license and clearly marked as such. This may
39
+ include source files, build scripts and documentation.
40
+
41
+ "Reserved Font Name" refers to any names specified as such after the
42
+ copyright statement(s).
43
+
44
+ "Original Version" refers to the collection of Font Software components as
45
+ distributed by the Copyright Holder(s).
46
+
47
+ "Modified Version" refers to any derivative made by adding to, deleting,
48
+ or substituting -- in part or in whole -- any of the components of the
49
+ Original Version, by changing formats or by porting the Font Software to a
50
+ new environment.
51
+
52
+ "Author" refers to any designer, engineer, programmer, technical
53
+ writer or other person who contributed to the Font Software.
54
+
55
+ PERMISSION & CONDITIONS
56
+ Permission is hereby granted, free of charge, to any person obtaining
57
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
58
+ redistribute, and sell modified and unmodified copies of the Font
59
+ Software, subject to the following conditions:
60
+
61
+ 1) Neither the Font Software nor any of its individual components,
62
+ in Original or Modified Versions, may be sold by itself.
63
+
64
+ 2) Original or Modified Versions of the Font Software may be bundled,
65
+ redistributed and/or sold with any software, provided that each copy
66
+ contains the above copyright notice and this license. These can be
67
+ included either as stand-alone text files, human-readable headers or
68
+ in the appropriate machine-readable metadata fields within text or
69
+ binary files as long as those fields can be easily viewed by the user.
70
+
71
+ 3) No Modified Version of the Font Software may use the Reserved Font
72
+ Name(s) unless explicit written permission is granted by the corresponding
73
+ Copyright Holder. This restriction only applies to the primary font name as
74
+ presented to the users.
75
+
76
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
77
+ Software shall not be used to promote, endorse or advertise any
78
+ Modified Version, except to acknowledge the contribution(s) of the
79
+ Copyright Holder(s) and the Author(s) or with their explicit written
80
+ permission.
81
+
82
+ 5) The Font Software, modified or unmodified, in part or in whole,
83
+ must be distributed entirely under this license, and must not be
84
+ distributed under any other license. The requirement for fonts to
85
+ remain under this license does not apply to any document created
86
+ using the Font Software.
87
+
88
+ TERMINATION
89
+ This license becomes null and void if any of the above conditions are
90
+ not met.
91
+
92
+ DISCLAIMER
93
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
94
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
95
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
96
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
97
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
98
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
99
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
100
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
101
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,17 @@
1
+ # UDEV Gothic
2
+
3
+ [公式v2.2.0リリース](https://github.com/yuru7/udev-gothic/releases/tag/v2.2.0) の通常版Regular・Boldを同梱します。
4
+ 半角1:全角2の等幅で、日本語と英数字に同じ書体を使用します。リガチャ・Nerd Fontsなしの版です。
5
+
6
+ - `assets/fonts/UDEVGothic-Regular.ttf`(400)
7
+ - `assets/fonts/UDEVGothic-Bold.ttf`(700)
8
+
9
+ 公式ZIP内の完成版TTFを変換・サブセット化・改名せずに保存しています。
10
+ 配布元・バージョン・アーカイブと各ファイルのSHA-256・サイズは `provenance.json` に記録します。
11
+ 同じタグの `LICENSE` を `LICENSE.txt` として保持します。SIL Open Font License 1.1で配布し、アプリのMITライセンスとは区別します。
12
+
13
+ ## 取得の再現
14
+
15
+ `provenance.json` のURLからZIPを取得し、SHA-256を照合して記録したパスの2ファイルを取り出します。
16
+ ライセンスは https://raw.githubusercontent.com/yuru7/udev-gothic/v2.2.0/LICENSE から取得します。
17
+ 通常利用・ビルド時にダウンロードやOSへのインストールは不要です。
@@ -0,0 +1,19 @@
1
+ {
2
+ "version": "2.2.0",
3
+ "repository": "https://github.com/yuru7/udev-gothic",
4
+ "archive": "https://github.com/yuru7/udev-gothic/releases/download/v2.2.0/UDEVGothic_v2.2.0.zip",
5
+ "archive_sha256": "c104c171f6ed8922ca52d74cd915a271e427f1e884e51431aae71d99e8b3b47b",
6
+ "license": "OFL-1.1",
7
+ "files": {
8
+ "UDEVGothic-Regular.ttf": {
9
+ "source_path": "UDEVGothic_v2.2.0/UDEVGothic-Regular.ttf",
10
+ "bytes": 3874344,
11
+ "sha256": "25fa0eca4be611ac125f03411d280c85494153da01dfa02ba734399c05f6289d"
12
+ },
13
+ "UDEVGothic-Bold.ttf": {
14
+ "source_path": "UDEVGothic_v2.2.0/UDEVGothic-Bold.ttf",
15
+ "bytes": 3865816,
16
+ "sha256": "1a1a7188a6b10195994cde6a30cca1cc7cbbc8badf0420bd29216035baa3d541"
17
+ }
18
+ }
19
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wani
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - ledsun
@@ -90,6 +90,8 @@ files:
90
90
  - assets/build.json
91
91
  - assets/fonts/IBMPlexSansJP-Bold.woff2
92
92
  - assets/fonts/IBMPlexSansJP-Regular.woff2
93
+ - assets/fonts/UDEVGothic-Bold.ttf
94
+ - assets/fonts/UDEVGothic-Regular.ttf
93
95
  - assets/highlight.css
94
96
  - assets/index.html
95
97
  - assets/rabbit.svg
@@ -134,6 +136,9 @@ files:
134
136
  - third_party/ruby-wasm-loader/README.md
135
137
  - third_party/ruby-wasm-loader/browser.script.iife.js
136
138
  - third_party/ruby-wasm-loader/provenance.json
139
+ - third_party/udev-gothic/LICENSE.txt
140
+ - third_party/udev-gothic/README.md
141
+ - third_party/udev-gothic/provenance.json
137
142
  homepage: https://github.com/ledsun/wani
138
143
  licenses:
139
144
  - MIT