wani 0.1.8 → 0.1.10
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 +4 -4
- data/README.md +3 -1
- data/assets/build.json +3 -3
- data/assets/style.css +1 -0
- data/assets/wani.wasm +2 -2
- data/lib/wani/browser/layout.rb +37 -0
- data/lib/wani/browser/renderer.rb +1 -0
- data/lib/wani/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f85a23004f1df4d2bbbbc63f5f0b1390fc23476719bdf53af05d493a2c2cbc2d
|
|
4
|
+
data.tar.gz: dc2c7fbeed8adceb6c10ce6efb0f8c3bc418625e82878845426c203a20a8bfd6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b75c77c939e09c3e195a63b119f4e6e5c8557bcb5f120edf5496a00a2ee20da64b70cae8b18d8a87a98dd0e70299fe1e9881ebbfbdbdf6f94e2995725b531a56
|
|
7
|
+
data.tar.gz: e207c8c3ae8ceb6906702ce73a2dbca34005b09c7a2a80b178cf1f9c832f4abeb75fcb48844e31e46738cb128bc03eaa5431c3ebc0ac41683bacda36a9075f01
|
data/README.md
CHANGED
|
@@ -25,7 +25,7 @@ npm ci
|
|
|
25
25
|
bundle exec rake build:wasm
|
|
26
26
|
|
|
27
27
|
gem build wani.gemspec
|
|
28
|
-
gem install ./wani-0.1.
|
|
28
|
+
gem install ./wani-0.1.10.gem
|
|
29
29
|
|
|
30
30
|
wani new my-talk
|
|
31
31
|
cd my-talk
|
|
@@ -111,6 +111,8 @@ notes:
|
|
|
111
111
|
|
|
112
112
|
スライドは1920×1080、16:9、白背景です。タイトル・本文・脚注を分け、画面に合わせて全体を拡大縮小します。
|
|
113
113
|
画像とフォントを読み込み、幅と高さに合わせて文字サイズを自動調整します。
|
|
114
|
+
タイトルは1行に収めます。本文の段落・見出し・箇条書きは、使用フォントの全角20文字(「あ」20個)相当の幅以下なら折り返さず、それを超える場合は自然に折り返します。
|
|
115
|
+
明示的な改行は維持し、改行ごとに幅を判定します。文字サイズは本文全体で共通です。
|
|
114
116
|
画像は比率を維持して縦に配置し、画像だけの場合は本文領域を広く使います。
|
|
115
117
|
収まらない内容は分割・スクロールせず、番号と内容を含む警告を表示します。
|
|
116
118
|
画像の読み込みを最大15秒待ち、失敗やタイムアウトを通知します。
|
data/assets/build.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.1.
|
|
3
|
-
"source_sha256": "
|
|
2
|
+
"version": "0.1.10",
|
|
3
|
+
"source_sha256": "b66ef1d534e169a73a33bf97aacbb95049b982a006fc6487baf5969a897b6dc9",
|
|
4
4
|
"loader_commit": "dc6b0ffd5800ed9bfc49268ed8021d456f10ddf8",
|
|
5
|
-
"wasm_sha256": "
|
|
5
|
+
"wasm_sha256": "0b632b9dc039dfa2e6a76f5ab54938788a334ffe24aaeb07570f0e23f0ac2215"
|
|
6
6
|
}
|
data/assets/style.css
CHANGED
|
@@ -52,6 +52,7 @@ button:focus-visible, a:focus-visible { outline: 2px solid #557e64; outline-offs
|
|
|
52
52
|
.bridge-wani { display: block; width: 100%; height: 44px; object-fit: contain; }
|
|
53
53
|
.rabbit-position { position: absolute; bottom: 30px; width: 84px; height: 40px; left: calc((100% - 84px) * var(--rabbit-progress)); }
|
|
54
54
|
.rabbit-image { display: block; width: 84px; height: 40px; }
|
|
55
|
+
.decorations[data-direction="left"] .rabbit-image { scale: -1 1; }
|
|
55
56
|
.slide.active .bridge-segment[data-appearing="true"] { animation: wani-arrive .35s ease-out; }
|
|
56
57
|
.slide.active .decorations[data-moving="true"] .rabbit-position { animation: rabbit-advance .45s ease-in-out; }
|
|
57
58
|
.slide.active .decorations[data-moving="true"] .rabbit-image { animation: rabbit-hop .45s ease-in-out; }
|
data/assets/wani.wasm
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: data/assets/wani.wasm
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 35167886 bytes
|
|
4
|
+
sha256: 0b632b9dc039dfa2e6a76f5ab54938788a334ffe24aaeb07570f0e23f0ac2215
|
data/lib/wani/browser/layout.rb
CHANGED
|
@@ -7,6 +7,7 @@ module Wani
|
|
|
7
7
|
BODY_MAX = 160
|
|
8
8
|
TITLE_MIN = 24
|
|
9
9
|
TITLE_MAX = 220
|
|
10
|
+
NO_WRAP_EMS = 20
|
|
10
11
|
|
|
11
12
|
def initialize(document, &warn)
|
|
12
13
|
@document, @warn = document, warn
|
|
@@ -55,6 +56,7 @@ module Wani
|
|
|
55
56
|
@warn.call("スライド #{number}: タイトルが収まりません: #{title[:textContent]}") unless fits?(title)
|
|
56
57
|
end
|
|
57
58
|
body = section.querySelector(".body")
|
|
59
|
+
prepare_wrapping(body)
|
|
58
60
|
fit_images(body)
|
|
59
61
|
fit_font(body, BODY_MIN, BODY_MAX)
|
|
60
62
|
@warn.call("スライド #{number}: 本文が収まりません: #{body[:textContent].to_s[0, 120]}") unless fits?(body)
|
|
@@ -72,6 +74,41 @@ module Wani
|
|
|
72
74
|
|
|
73
75
|
private
|
|
74
76
|
|
|
77
|
+
def prepare_wrapping(body)
|
|
78
|
+
# Rebuild the wrappers when a slide is fitted again (for example after
|
|
79
|
+
# editing). Ranges preserve links, emphasis and explicit line breaks.
|
|
80
|
+
body.querySelectorAll("[data-wani-line]").to_a.each do |line|
|
|
81
|
+
line.replaceWith(*line[:childNodes].to_a)
|
|
82
|
+
end
|
|
83
|
+
body[:style][:fontSize] = "#{BODY_MIN}px"
|
|
84
|
+
body.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li").to_a.each do |block|
|
|
85
|
+
next unless block.querySelector("p, ul, ol") == JS::Null
|
|
86
|
+
breaks = block.querySelectorAll("br").to_a
|
|
87
|
+
# Work backwards so extracting a range does not invalidate the next.
|
|
88
|
+
(0..breaks.length).to_a.reverse_each do |index|
|
|
89
|
+
range = @document.createRange
|
|
90
|
+
range.selectNodeContents(block)
|
|
91
|
+
range.setStartAfter(breaks[index - 1]) if index.positive?
|
|
92
|
+
range.setEndBefore(breaks[index]) if index < breaks.length
|
|
93
|
+
line = @document.createElement("span")
|
|
94
|
+
line.setAttribute("data-wani-line", "")
|
|
95
|
+
line[:style][:whiteSpace] = "nowrap"
|
|
96
|
+
line.appendChild(range.extractContents)
|
|
97
|
+
range.insertNode(line)
|
|
98
|
+
|
|
99
|
+
reference = @document.createElement("span")
|
|
100
|
+
reference[:textContent] = "あ" * NO_WRAP_EMS
|
|
101
|
+
reference[:style][:position] = "absolute"
|
|
102
|
+
reference[:style][:whiteSpace] = "nowrap"
|
|
103
|
+
block.appendChild(reference)
|
|
104
|
+
if line.getBoundingClientRect[:width].to_f > reference.getBoundingClientRect[:width].to_f + 0.01
|
|
105
|
+
line[:style][:whiteSpace] = "normal"
|
|
106
|
+
end
|
|
107
|
+
reference.remove
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
75
112
|
def fits?(node)
|
|
76
113
|
node[:scrollWidth].to_i <= node[:clientWidth].to_i + 1 && node[:scrollHeight].to_i <= node[:clientHeight].to_i + 1
|
|
77
114
|
end
|
|
@@ -53,6 +53,7 @@ module Wani
|
|
|
53
53
|
current = BridgeProgress.new(scene.getAttribute("data-slide").to_s.to_i, @presentation.slides.length)
|
|
54
54
|
scene[:style].setProperty("--rabbit-from", previous.rabbit_fraction.to_s)
|
|
55
55
|
scene.setAttribute("data-moving", (previous.rabbit_fraction != current.rabbit_fraction).to_s)
|
|
56
|
+
scene.setAttribute("data-direction", current.rabbit_fraction < previous.rabbit_fraction ? "left" : "right")
|
|
56
57
|
scene.querySelectorAll(".bridge-segment").to_a.each_with_index do |segment, index|
|
|
57
58
|
appearing = index >= BridgeProgress::SEGMENTS - current.sharks && index < BridgeProgress::SEGMENTS - previous.sharks
|
|
58
59
|
segment.setAttribute("data-appearing", appearing.to_s)
|
data/lib/wani/version.rb
CHANGED
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.
|
|
4
|
+
version: 0.1.10
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ledsun
|
|
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
153
153
|
- !ruby/object:Gem::Version
|
|
154
154
|
version: '0'
|
|
155
155
|
requirements: []
|
|
156
|
-
rubygems_version: 4.0.
|
|
156
|
+
rubygems_version: 4.0.20
|
|
157
157
|
specification_version: 4
|
|
158
158
|
summary: Markdown presentations rendered by Ruby in the browser
|
|
159
159
|
test_files: []
|