howdoc 0.4.0 → 0.5.0

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: 9201c07602657e340541387ddb7704ca43fcde6183ce52fd1273f036dd87513b
4
- data.tar.gz: 2f9bc01470635e9d626141909f12196cb950e41e80c11077aa78943216291259
3
+ metadata.gz: 87dfef0ef3ca14057c666eaa64c003057f7b7f8ba17cb1f992375c4add7358e6
4
+ data.tar.gz: 5a3f3ecfccd3e57262e00b434ba69d79874251d25e74b527e8a6d03754e5c0ef
5
5
  SHA512:
6
- metadata.gz: c970647ba28984988f284e173b3a675123cee78b35a66a1c0ff8c5d7ed4d6ca856e41dbf3b7e8eade8a4b852121a636d86869d1f002007f5df3eba6b5c9ab10a
7
- data.tar.gz: ea877687bd2a0ef1c550769f96d5cfea425ccda4f74ee1d4d71dde7575f5f473c13e97a13998d71f9958d01aa6fbeed69ca3daeb056ad0448e32f5f2ab42d3a9
6
+ metadata.gz: 80ffc63f82dd61163966cd9afa236ff758b29ad02bf1dcf54486d41db1fcdee943bcbd337d0966a9a6c69aae624355d43b732164ac31425483dabc9c395812d0
7
+ data.tar.gz: 756e73c34a33a1a4b5cdb0b41f4cf2143414c3b97bc30096e62511d38961ff8cc07b44ba9e35c2956b0cb0e942bd9d669bb8574ec2d578a6dba368c8dce5135d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.0
4
+
5
+ The menu now fits a phone. Twenty guides listed above the page filled the
6
+ screen before the guide a reader had come for began, so a narrow screen folds
7
+ the list away behind a line they can tap, and a wide one, which has room for it
8
+ beside the page, shows it exactly as before.
9
+
10
+ - The menu on a narrow screen is a slim bar carrying the name of the
11
+ documentation set, the languages and one line to open the guides
12
+ (`howdoc.nav.guides`). It follows the reader down the page while the list is
13
+ folded, and steps out of the way while it is open.
14
+ - The index is the one page whose menu is the page, so there the list is open
15
+ from the start and follows the heading that says what the guides are for
16
+ instead of pushing it under twenty links.
17
+ - Only `shared/html/nav.haml` and the stylesheet changed, so an application
18
+ with a menu template of its own keeps what it has.
19
+
3
20
  ## 0.4.0
4
21
 
5
22
  Screenshots can now show what the step is about, the way a guide made by hand
data/README.md CHANGED
@@ -263,6 +263,11 @@ an empty placeholder and the index pass -- which has just read every page back
263
263
 
264
264
  Both are optional. A template that carries neither is left exactly as it is.
265
265
 
266
+ Above the page rather than beside it -- a phone, a narrow window -- the list of
267
+ guides folds away behind a line the reader taps, so the guide begins where the
268
+ screen begins. The stylesheet unfolds it again where there is room beside the
269
+ page, and the index, whose menu is the page, is open from the start.
270
+
266
271
  The menu also links the same guide in every other language the application
267
272
  publishes. Guides are matched by their identifier rather than their file name,
268
273
  because a translated heading gives a translated file name, and each language
@@ -21,6 +21,8 @@ en:
21
21
  follow_steps: 'Follow these steps:'
22
22
  languages:
23
23
  en: English
24
+ nav:
25
+ guides: All guides
24
26
  pager:
25
27
  next: Next
26
28
  previous: Previous
@@ -21,6 +21,8 @@ et:
21
21
  follow_steps: 'Palun jälgige järgnevaid samme:'
22
22
  languages:
23
23
  et: Eesti
24
+ nav:
25
+ guides: Kõik juhendid
24
26
  pager:
25
27
  next: Järgmine
26
28
  previous: Eelmine
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Howdoc
4
- VERSION = '0.4.0'
4
+ VERSION = '0.5.0'
5
5
  end
@@ -31,6 +31,12 @@ body.howdoc {
31
31
  padding: 3rem 1.25rem 6rem;
32
32
  }
33
33
 
34
+ /* The index ends where its menu begins, so the space below it is the menu's
35
+ to give. */
36
+ .howdoc-index {
37
+ padding-bottom: 1.5rem;
38
+ }
39
+
34
40
  .howdoc h1 {
35
41
  margin: 0 0 1rem;
36
42
  font-size: 1.9rem;
@@ -68,7 +74,7 @@ body.howdoc {
68
74
 
69
75
  .howdoc-toc {
70
76
  list-style: none;
71
- margin: 1.5rem 0 0;
77
+ margin: 1rem 0 0;
72
78
  padding: 0;
73
79
  }
74
80
 
@@ -96,19 +102,84 @@ body.howdoc {
96
102
  text-decoration: underline;
97
103
  }
98
104
 
99
- /* The menu sits beside the page it belongs to, and above it when there is no
100
- room beside. A guide written before the index pass has an empty menu, and an
101
- empty menu is no menu at all. */
105
+ /* The menu sits beside the page it belongs to, and folded above it when there
106
+ is no room beside. A guide written before the index pass has an empty menu,
107
+ and an empty menu is no menu at all. */
102
108
  .howdoc-nav:empty,
103
109
  .howdoc-pager:empty {
104
110
  display: none;
105
111
  }
106
112
 
113
+ /* Above the page, the menu is a slim bar the reader keeps within reach
114
+ wherever they have scrolled to, with the guides folded away behind a line
115
+ they can tap. Unfolded, the list is taller than the screen, so the bar stops
116
+ following along and scrolls away with the page like anything else. */
107
117
  .howdoc-nav {
108
- padding: 1.5rem 1.25rem;
118
+ position: sticky;
119
+ top: 0;
120
+ z-index: 2;
121
+ background: var(--howdoc-bg);
122
+ padding: 0.9rem 1.25rem 1rem;
109
123
  border-bottom: 1px solid var(--howdoc-rule);
110
124
  }
111
125
 
126
+ .howdoc-nav:has(.howdoc-nav-guides[open]) {
127
+ position: static;
128
+ }
129
+
130
+ /* The index is the one page whose menu is the page, so its menu is open and
131
+ there is nothing to fold. It comes after the heading that says what the
132
+ guides are for, rather than pushing that heading under twenty links. */
133
+ body.howdoc {
134
+ display: flex;
135
+ flex-direction: column;
136
+ }
137
+
138
+ .howdoc-nav-index {
139
+ order: 1;
140
+ }
141
+
142
+ /* Nothing to fold on the index: the list is the page, so the line that would
143
+ fold it away is not offered there. */
144
+ .howdoc-nav-index .howdoc-nav-summary {
145
+ display: none;
146
+ }
147
+
148
+ .howdoc-nav-summary {
149
+ display: flex;
150
+ align-items: center;
151
+ justify-content: space-between;
152
+ gap: 0.75rem;
153
+ margin-top: 0.75rem;
154
+ padding: 0.55rem 0.85rem;
155
+ border: 1px solid var(--howdoc-rule);
156
+ border-radius: 8px;
157
+ color: var(--howdoc-fg);
158
+ font-size: 0.95rem;
159
+ font-weight: 600;
160
+ cursor: pointer;
161
+ list-style: none;
162
+ }
163
+
164
+ .howdoc-nav-summary::-webkit-details-marker {
165
+ display: none;
166
+ }
167
+
168
+ /* The chevron that says the line can be tapped: down while the list is folded,
169
+ up while it is not. */
170
+ .howdoc-nav-summary::after {
171
+ content: '';
172
+ width: 0.45rem;
173
+ height: 0.45rem;
174
+ border-right: 2px solid var(--howdoc-muted);
175
+ border-bottom: 2px solid var(--howdoc-muted);
176
+ transform: translateY(-0.15rem) rotate(45deg);
177
+ }
178
+
179
+ .howdoc-nav-guides[open] > .howdoc-nav-summary::after {
180
+ transform: translateY(0.15rem) rotate(-135deg);
181
+ }
182
+
112
183
  @media (min-width: 60rem) {
113
184
  body.howdoc {
114
185
  display: grid;
@@ -116,15 +187,39 @@ body.howdoc {
116
187
  align-items: start;
117
188
  }
118
189
 
119
- .howdoc-nav {
190
+ .howdoc-nav,
191
+ .howdoc-nav:has(.howdoc-nav-guides[open]) {
120
192
  position: sticky;
121
193
  top: 0;
194
+ z-index: auto;
122
195
  max-height: 100vh;
123
196
  overflow-y: auto;
124
197
  padding: 2rem 1.25rem 3rem;
125
198
  border-right: 1px solid var(--howdoc-rule);
126
199
  border-bottom: 0;
127
200
  }
201
+
202
+ .howdoc-nav-index {
203
+ order: 0;
204
+ }
205
+
206
+ /* Beside the page there is room for the whole list, so the fold is undone:
207
+ the line to tap goes away and every guide is shown whether the reader ever
208
+ tapped it or not. Two rules for two kinds of browser -- the older kind
209
+ folds content away by not displaying it, the newer kind through
210
+ ::details-content. */
211
+ .howdoc-nav-summary {
212
+ display: none;
213
+ }
214
+
215
+ .howdoc-nav-guides > *:not(summary) {
216
+ display: block;
217
+ }
218
+
219
+ .howdoc-nav-guides::details-content {
220
+ content-visibility: visible;
221
+ block-size: auto;
222
+ }
128
223
  }
129
224
 
130
225
  .howdoc-nav-head {
@@ -2,7 +2,7 @@
2
2
  -# no other guide exists yet -- so a guide leaves the empty <nav> below and the
3
3
  -# index pass fills it in once every guide is on disk. The index renders it
4
4
  -# directly, because by then it knows.
5
- %nav.howdoc-nav{ data: { howdoc_nav: true } }
5
+ %nav.howdoc-nav{ class: ('howdoc-nav-index' if @current.nil?), data: { howdoc_nav: true } }
6
6
  .howdoc-nav-head
7
7
  %a.howdoc-nav-home{ href: './index.html' }= Howdoc::Narrator.phrase(:index, :title, locale: @locale)
8
8
  - if @languages.size > 1
@@ -13,13 +13,20 @@
13
13
  %a{ href: language[:href], lang: language[:code] }= language[:label]
14
14
  - else
15
15
  %span{ lang: language[:code] }= language[:label]
16
- %ul.howdoc-toc
17
- - previous_group = nil
18
- - @records.each do |record|
19
- - group = @config.group_label.call(record)
20
- - if group && group != previous_group
21
- %li.howdoc-toc-group= group
22
- - previous_group = group
23
- - current = @current && record.filename == @current.filename
24
- %li.howdoc-toc-entry{ class: ('howdoc-current' if current) }
25
- %a{ href: "./#{record.filename}", 'aria-current': (current ? 'page' : nil) }= record.heading
16
+ -# On a phone a list of twenty guides fills the screen before the guide the
17
+ -# reader came to read has begun, so the list is folded away behind a line
18
+ -# they can tap. A wide screen has room for it beside the page and unfolds it
19
+ -# again in the stylesheet. The index is the one page whose menu is the page,
20
+ -# so there it is open from the start.
21
+ %details.howdoc-nav-guides{ open: @current.nil? }
22
+ %summary.howdoc-nav-summary= Howdoc::Narrator.phrase(:nav, :guides, locale: @locale)
23
+ %ul.howdoc-toc
24
+ - previous_group = nil
25
+ - @records.each do |record|
26
+ - group = @config.group_label.call(record)
27
+ - if group && group != previous_group
28
+ %li.howdoc-toc-group= group
29
+ - previous_group = group
30
+ - current = @current && record.filename == @current.filename
31
+ %li.howdoc-toc-entry{ class: ('howdoc-current' if current) }
32
+ %a{ href: "./#{record.filename}", 'aria-current': (current ? 'page' : nil) }= record.heading
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: howdoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Priit Tark