@writedocs/generator 0.11.1 → 0.12.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.
- package/package.json +1 -1
- package/src/cli/build.js +203 -177
- package/src/cli/og-image-worker.js +20 -0
- package/src/cli/og-images.js +70 -0
- package/src/cli/run-astro.js +97 -93
- package/src/components/ApiReferencePanel.astro +1792 -1792
- package/src/layout/BaseLayout.astro +1 -3
- package/src/layout/components/MobileMenu.astro +9 -13
- package/src/layout/components/NavTree.astro +21 -6
- package/src/layout/components/Sidebar.astro +4 -4
- package/src/layout/styles/base.css +326 -327
- package/src/layout/styles/mobile-menu.css +285 -285
- package/src/lib/og-cards.js +33 -0
- package/src/lib/og-image.js +235 -168
- package/src/pages/og/[...slug].png.ts +63 -64
- package/src/scripts/mobile-menu.ts +80 -55
- package/src/scripts/sidebar-scroll.ts +61 -65
|
@@ -1,285 +1,285 @@
|
|
|
1
|
-
/* MobileMenu.astro's own styling - the <= 860px drawer panel itself (not
|
|
2
|
-
the hamburger toggle button that opens it, which lives in topbar.css
|
|
3
|
-
alongside the rest of TopBar.astro's own markup). */
|
|
4
|
-
|
|
5
|
-
.wd-mobile-menu { display: none; }
|
|
6
|
-
@media (max-width: 860px) {
|
|
7
|
-
.wd-mobile-menu {
|
|
8
|
-
display: block;
|
|
9
|
-
/* Always laid out (positioned off-screen via the panel's own
|
|
10
|
-
transform below), not display:none, so .open can transition
|
|
11
|
-
smoothly instead of snapping - a transition can't animate *out of*
|
|
12
|
-
display:none. visibility is what keeps it non-visible/out of the
|
|
13
|
-
tab order while closed (visibility: hidden also removes descendants
|
|
14
|
-
from hit-testing and the accessibility tree); initMobileMenu()
|
|
15
|
-
(src/scripts/mobile-menu.ts) toggles the `inert` attribute
|
|
16
|
-
alongside .open as a second, JS-driven layer of the same
|
|
17
|
-
guarantee, since not every browser/AT combination is guaranteed to
|
|
18
|
-
treat visibility:hidden identically. pointer-events is deliberately
|
|
19
|
-
NOT toggled here on the container itself - see the comment below
|
|
20
|
-
for why: this element's own box spans the *entire* viewport
|
|
21
|
-
(position: fixed; inset: 0), so giving *it* pointer-events: auto
|
|
22
|
-
would make its empty top strip (behind the topbar) swallow clicks
|
|
23
|
-
meant for the topbar underneath, even though nothing of this
|
|
24
|
-
element's own visible content is painted there. */
|
|
25
|
-
visibility: hidden;
|
|
26
|
-
}
|
|
27
|
-
.wd-mobile-menu.open {
|
|
28
|
-
visibility: visible;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
.wd-mobile-menu {
|
|
32
|
-
position: fixed;
|
|
33
|
-
inset: 0;
|
|
34
|
-
z-index: 40;
|
|
35
|
-
/* Never toggled: this box covers the full viewport (inset: 0). If this
|
|
36
|
-
were pointer-events: auto while open, its own box would be a valid
|
|
37
|
-
hit target everywhere within it (an element with no background is
|
|
38
|
-
not "invisible" to hit-testing - only pointer-events: none makes it
|
|
39
|
-
click-through), and being a higher z-index than the topbar, would
|
|
40
|
-
swallow clicks meant for whatever's underneath. Interactivity is
|
|
41
|
-
granted instead to the backdrop and panel individually below. */
|
|
42
|
-
pointer-events: none;
|
|
43
|
-
}
|
|
44
|
-
.wd-mobile-menu-backdrop,
|
|
45
|
-
.wd-mobile-menu-panel {
|
|
46
|
-
pointer-events: none;
|
|
47
|
-
}
|
|
48
|
-
.wd-mobile-menu.open .wd-mobile-menu-backdrop,
|
|
49
|
-
.wd-mobile-menu.open .wd-mobile-menu-panel {
|
|
50
|
-
pointer-events: auto;
|
|
51
|
-
}
|
|
52
|
-
.wd-mobile-menu-backdrop {
|
|
53
|
-
position: absolute;
|
|
54
|
-
/* Full viewport (top: 0, not 5rem) - the panel itself also reaches
|
|
55
|
-
top: 0 with its own header (brand/close/theme, see
|
|
56
|
-
.wd-mobile-menu-header below) replicating the real topbar's row, so
|
|
57
|
-
there's nothing under the backdrop still worth keeping
|
|
58
|
-
un-dimmed/interactive: the real topbar is either fully covered by the
|
|
59
|
-
panel's own opaque background (its width) or genuinely just dimmed
|
|
60
|
-
decoration past it. */
|
|
61
|
-
inset: 0;
|
|
62
|
-
background: rgba(0, 0, 0, 0.4);
|
|
63
|
-
opacity: 0;
|
|
64
|
-
transition: opacity 0.25s ease;
|
|
65
|
-
}
|
|
66
|
-
.wd-mobile-menu.open .wd-mobile-menu-backdrop {
|
|
67
|
-
opacity: 1;
|
|
68
|
-
}
|
|
69
|
-
/* A left-anchored drawer (Mintlify's own mobile nav - the reference this
|
|
70
|
-
was built against - works the same way), not a centered/inset floating
|
|
71
|
-
card: flush to the screen's left edge, full viewport height top to
|
|
72
|
-
bottom (top: 0, not just below the topbar - see .wd-mobile-menu-header
|
|
73
|
-
below for why), sliding in from off-screen rather than just appearing. */
|
|
74
|
-
.wd-mobile-menu-panel {
|
|
75
|
-
position: absolute;
|
|
76
|
-
inset: 0 auto 0 0;
|
|
77
|
-
width: min(88vw, 340px);
|
|
78
|
-
display: flex;
|
|
79
|
-
flex-direction: column;
|
|
80
|
-
/* Same --wd-navbar-background as .wd-topbar (topbar.css) - this panel's
|
|
81
|
-
own header row replicates the real topbar's brand row (see the
|
|
82
|
-
comment on .wd-mobile-menu-header below), so it should share its
|
|
83
|
-
background too rather than looking like a separate, differently-
|
|
84
|
-
colored surface once a site configures theme.colors.navbar. */
|
|
85
|
-
background: var(--wd-navbar-background);
|
|
86
|
-
border-right: 1px solid var(--wd-border);
|
|
87
|
-
box-shadow: 8px 0 24px rgba(0, 0, 0, 0.15);
|
|
88
|
-
transform: translateX(-100%);
|
|
89
|
-
transition: transform 0.25s ease;
|
|
90
|
-
}
|
|
91
|
-
.wd-mobile-menu.open .wd-mobile-menu-panel {
|
|
92
|
-
transform: translateX(0);
|
|
93
|
-
}
|
|
94
|
-
/* Replicates the real topbar's brand row - same left-to-right order
|
|
95
|
-
(close-toggle, brand, theme) - as a fixed header pinned to the top of
|
|
96
|
-
the panel, so it reads as one continuous navbar with the real one
|
|
97
|
-
underneath rather than a separate piece with a seam. `flex-shrink: 0`
|
|
98
|
-
keeps it pinned above .wd-mobile-menu-scroll's own independent
|
|
99
|
-
scrolling below. .wd-topbar-brand and .wd-theme-toggle themselves are
|
|
100
|
-
defined in topbar.css, imported by this component too - see this
|
|
101
|
-
file's own top comment. */
|
|
102
|
-
.wd-mobile-menu-header {
|
|
103
|
-
display: flex;
|
|
104
|
-
align-items: center;
|
|
105
|
-
gap: 0.5rem;
|
|
106
|
-
flex-shrink: 0;
|
|
107
|
-
padding: 0.75rem 1rem;
|
|
108
|
-
border-bottom: 1px solid var(--wd-border);
|
|
109
|
-
}
|
|
110
|
-
.wd-mobile-menu-header .wd-topbar-brand {
|
|
111
|
-
flex: 1;
|
|
112
|
-
min-width: 0;
|
|
113
|
-
}
|
|
114
|
-
.wd-mobile-menu-close {
|
|
115
|
-
display: flex;
|
|
116
|
-
align-items: center;
|
|
117
|
-
justify-content: center;
|
|
118
|
-
width: 2rem;
|
|
119
|
-
height: 2rem;
|
|
120
|
-
padding: 0;
|
|
121
|
-
border: none;
|
|
122
|
-
border-radius: 0.4rem;
|
|
123
|
-
background: none;
|
|
124
|
-
cursor: pointer;
|
|
125
|
-
/* --wd-navbar-foreground-muted, not --wd-text-muted - this button sits
|
|
126
|
-
on the panel's own --wd-navbar-background (see .wd-mobile-menu-panel
|
|
127
|
-
above), same reasoning as topbar.css's identical swap for its
|
|
128
|
-
desktop-row counterparts. Falls back to var(--wd-text-muted) when
|
|
129
|
-
theme.navbar has no `foreground` set, so this is a no-op unless a
|
|
130
|
-
site actually configures one. */
|
|
131
|
-
color: var(--wd-navbar-foreground-muted);
|
|
132
|
-
flex-shrink: 0;
|
|
133
|
-
}
|
|
134
|
-
.wd-mobile-menu-close:hover { color: var(--wd-navbar-foreground); background: var(--wd-surface); }
|
|
135
|
-
.wd-mobile-menu-scroll {
|
|
136
|
-
flex: 1;
|
|
137
|
-
min-height: 0;
|
|
138
|
-
overflow-y: auto;
|
|
139
|
-
padding: 1rem 0.75rem;
|
|
140
|
-
}
|
|
141
|
-
.wd-mobile-menu-selectors {
|
|
142
|
-
display: flex;
|
|
143
|
-
flex-direction: column;
|
|
144
|
-
gap: 0.5rem;
|
|
145
|
-
margin-bottom: 0.75rem;
|
|
146
|
-
padding-bottom: 0.75rem;
|
|
147
|
-
border-bottom: 1px solid var(--wd-border);
|
|
148
|
-
}
|
|
149
|
-
/* A page without a sidebar (`mode: custom`): nothing below to divide off. */
|
|
150
|
-
.wd-mobile-menu-selectors:last-child {
|
|
151
|
-
margin-bottom: 0;
|
|
152
|
-
padding-bottom: 0;
|
|
153
|
-
border-bottom: none;
|
|
154
|
-
}
|
|
155
|
-
/* position: relative makes this the containing block for its own
|
|
156
|
-
.wd-mobile-accordion-options panel below, which floats over whatever
|
|
157
|
-
comes after it instead of pushing it down the page - a `<details>`'s
|
|
158
|
-
open content is normal, in-flow block content by default, which *would*
|
|
159
|
-
push later siblings down; taking the options panel out of flow via
|
|
160
|
-
position: absolute is what avoids that. The [open] z-index bump is what
|
|
161
|
-
then guarantees *this* accordion's floating panel paints above the
|
|
162
|
-
*later*, still-closed accordion rows below it: any position: relative
|
|
163
|
-
element - open or not - already paints above its plain in-flow siblings
|
|
164
|
-
regardless of z-index (per CSS's stacking rules), but two position:
|
|
165
|
-
relative siblings with no z-index of their own paint in DOM order, i.e.
|
|
166
|
-
a later closed row would otherwise sit on top of an earlier open one's
|
|
167
|
-
panel despite being visually "behind" it. */
|
|
168
|
-
.wd-mobile-accordion {
|
|
169
|
-
position: relative;
|
|
170
|
-
border: 1px solid var(--wd-border);
|
|
171
|
-
border-radius: 0.5rem;
|
|
172
|
-
}
|
|
173
|
-
.wd-mobile-accordion[open] {
|
|
174
|
-
z-index: 5;
|
|
175
|
-
}
|
|
176
|
-
/* --wd-navbar-foreground, not --wd-text: this row (and every other
|
|
177
|
-
selector row/link directly inside .wd-mobile-menu-scroll, down through
|
|
178
|
-
.wd-mobile-menu-link below) sits directly on .wd-mobile-menu-panel's own
|
|
179
|
-
--wd-navbar-background, same as the header above - only the *floating*
|
|
180
|
-
.wd-mobile-accordion-options-panel a click reveals (further down this
|
|
181
|
-
file) sits on the ordinary --wd-background instead, which is why that
|
|
182
|
-
one's own rules are deliberately left on --wd-text/--wd-primary,
|
|
183
|
-
unchanged. */
|
|
184
|
-
.wd-mobile-accordion-trigger {
|
|
185
|
-
display: flex;
|
|
186
|
-
align-items: center;
|
|
187
|
-
gap: 0.5rem;
|
|
188
|
-
padding: 0.65rem 0.75rem;
|
|
189
|
-
cursor: pointer;
|
|
190
|
-
font-size: 0.9rem;
|
|
191
|
-
color: var(--wd-navbar-foreground);
|
|
192
|
-
list-style: none;
|
|
193
|
-
}
|
|
194
|
-
.wd-mobile-accordion-trigger::-webkit-details-marker { display: none; }
|
|
195
|
-
.wd-mobile-accordion-trigger::marker { content: ''; }
|
|
196
|
-
.wd-mobile-accordion-label { flex: 1; min-width: 0; }
|
|
197
|
-
.wd-mobile-accordion-caret {
|
|
198
|
-
flex-shrink: 0;
|
|
199
|
-
color: var(--wd-navbar-foreground-muted);
|
|
200
|
-
transition: transform 0.15s ease;
|
|
201
|
-
}
|
|
202
|
-
.wd-mobile-accordion[open] > .wd-mobile-accordion-trigger .wd-mobile-accordion-caret {
|
|
203
|
-
transform: rotate(180deg);
|
|
204
|
-
}
|
|
205
|
-
/* Floats directly below the trigger (top: 100%, same "padding-top for the
|
|
206
|
-
gap, not a top offset, so there's no dead unhoverable/untappable strip
|
|
207
|
-
between them" reasoning as .wd-dropdown-menu in dropdown.css) rather
|
|
208
|
-
than sitting in normal flow beneath it, so opening one of these
|
|
209
|
-
overlays the accordion rows/sidebar content below it instead of shoving
|
|
210
|
-
them further down the page. */
|
|
211
|
-
.wd-mobile-accordion-options {
|
|
212
|
-
position: absolute;
|
|
213
|
-
top: 100%;
|
|
214
|
-
left: 0;
|
|
215
|
-
right: 0;
|
|
216
|
-
padding-top: 0.35rem;
|
|
217
|
-
}
|
|
218
|
-
.wd-mobile-accordion-options-panel {
|
|
219
|
-
display: flex;
|
|
220
|
-
flex-direction: column;
|
|
221
|
-
gap: 0.3rem;
|
|
222
|
-
max-height: 45vh;
|
|
223
|
-
overflow-y: auto;
|
|
224
|
-
background: var(--wd-background);
|
|
225
|
-
border: 1px solid var(--wd-border);
|
|
226
|
-
border-radius: 0.5rem;
|
|
227
|
-
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
|
|
228
|
-
padding: 0.4rem;
|
|
229
|
-
}
|
|
230
|
-
.wd-mobile-accordion-options a {
|
|
231
|
-
display: flex;
|
|
232
|
-
align-items: center;
|
|
233
|
-
gap: 0.5rem;
|
|
234
|
-
padding: 0.55rem 0.65rem;
|
|
235
|
-
border: 1.5px solid transparent;
|
|
236
|
-
border-radius: 0.4rem;
|
|
237
|
-
text-decoration: none;
|
|
238
|
-
color: var(--wd-text);
|
|
239
|
-
font-size: 0.9rem;
|
|
240
|
-
}
|
|
241
|
-
.wd-mobile-accordion-options a:hover { background: var(--wd-surface); }
|
|
242
|
-
.wd-mobile-accordion-options a.active {
|
|
243
|
-
border-color: var(--wd-primary);
|
|
244
|
-
color: var(--wd-primary);
|
|
245
|
-
font-weight: 500;
|
|
246
|
-
}
|
|
247
|
-
.wd-mobile-accordion-option-label { flex: 1; min-width: 0; }
|
|
248
|
-
.wd-mobile-accordion-check { flex-shrink: 0; color: var(--wd-primary); }
|
|
249
|
-
.wd-mobile-menu-link {
|
|
250
|
-
display: flex;
|
|
251
|
-
align-items: center;
|
|
252
|
-
gap: 0.5rem;
|
|
253
|
-
padding: 0.65rem 0.75rem;
|
|
254
|
-
border: 1px solid var(--wd-border);
|
|
255
|
-
border-radius: 0.5rem;
|
|
256
|
-
text-decoration: none;
|
|
257
|
-
color: var(--wd-navbar-foreground);
|
|
258
|
-
font-size: 0.9rem;
|
|
259
|
-
}
|
|
260
|
-
.wd-mobile-menu-link:hover { background: var(--wd-surface); }
|
|
261
|
-
/* An item's options with none chosen (MobileMenu.astro) - an open list, in
|
|
262
|
-
one box like a closed level's row. */
|
|
263
|
-
.wd-mobile-menu-choices {
|
|
264
|
-
display: flex;
|
|
265
|
-
flex-direction: column;
|
|
266
|
-
gap: 0.15rem;
|
|
267
|
-
padding: 0.3rem;
|
|
268
|
-
border: 1px solid var(--wd-border);
|
|
269
|
-
border-radius: 0.5rem;
|
|
270
|
-
}
|
|
271
|
-
.wd-mobile-menu-choices a {
|
|
272
|
-
display: flex;
|
|
273
|
-
align-items: center;
|
|
274
|
-
gap: 0.5rem;
|
|
275
|
-
padding: 0.5rem 0.45rem;
|
|
276
|
-
border-radius: 0.4rem;
|
|
277
|
-
text-decoration: none;
|
|
278
|
-
color: var(--wd-navbar-foreground);
|
|
279
|
-
font-size: 0.9rem;
|
|
280
|
-
}
|
|
281
|
-
.wd-mobile-menu-choices a:hover { background: var(--wd-surface); }
|
|
282
|
-
/* The sidebar
|
|
283
|
-
column sizing (width/border/min-height) - it's just
|
|
284
|
-
inside an already-padded, already-scrollable panel. */
|
|
285
|
-
.wd-mobile-menu-sidebar .wd-sidebar { padding: 0; }
|
|
1
|
+
/* MobileMenu.astro's own styling - the <= 860px drawer panel itself (not
|
|
2
|
+
the hamburger toggle button that opens it, which lives in topbar.css
|
|
3
|
+
alongside the rest of TopBar.astro's own markup). */
|
|
4
|
+
|
|
5
|
+
.wd-mobile-menu { display: none; }
|
|
6
|
+
@media (max-width: 860px) {
|
|
7
|
+
.wd-mobile-menu {
|
|
8
|
+
display: block;
|
|
9
|
+
/* Always laid out (positioned off-screen via the panel's own
|
|
10
|
+
transform below), not display:none, so .open can transition
|
|
11
|
+
smoothly instead of snapping - a transition can't animate *out of*
|
|
12
|
+
display:none. visibility is what keeps it non-visible/out of the
|
|
13
|
+
tab order while closed (visibility: hidden also removes descendants
|
|
14
|
+
from hit-testing and the accessibility tree); initMobileMenu()
|
|
15
|
+
(src/scripts/mobile-menu.ts) toggles the `inert` attribute
|
|
16
|
+
alongside .open as a second, JS-driven layer of the same
|
|
17
|
+
guarantee, since not every browser/AT combination is guaranteed to
|
|
18
|
+
treat visibility:hidden identically. pointer-events is deliberately
|
|
19
|
+
NOT toggled here on the container itself - see the comment below
|
|
20
|
+
for why: this element's own box spans the *entire* viewport
|
|
21
|
+
(position: fixed; inset: 0), so giving *it* pointer-events: auto
|
|
22
|
+
would make its empty top strip (behind the topbar) swallow clicks
|
|
23
|
+
meant for the topbar underneath, even though nothing of this
|
|
24
|
+
element's own visible content is painted there. */
|
|
25
|
+
visibility: hidden;
|
|
26
|
+
}
|
|
27
|
+
.wd-mobile-menu.open {
|
|
28
|
+
visibility: visible;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
.wd-mobile-menu {
|
|
32
|
+
position: fixed;
|
|
33
|
+
inset: 0;
|
|
34
|
+
z-index: 40;
|
|
35
|
+
/* Never toggled: this box covers the full viewport (inset: 0). If this
|
|
36
|
+
were pointer-events: auto while open, its own box would be a valid
|
|
37
|
+
hit target everywhere within it (an element with no background is
|
|
38
|
+
not "invisible" to hit-testing - only pointer-events: none makes it
|
|
39
|
+
click-through), and being a higher z-index than the topbar, would
|
|
40
|
+
swallow clicks meant for whatever's underneath. Interactivity is
|
|
41
|
+
granted instead to the backdrop and panel individually below. */
|
|
42
|
+
pointer-events: none;
|
|
43
|
+
}
|
|
44
|
+
.wd-mobile-menu-backdrop,
|
|
45
|
+
.wd-mobile-menu-panel {
|
|
46
|
+
pointer-events: none;
|
|
47
|
+
}
|
|
48
|
+
.wd-mobile-menu.open .wd-mobile-menu-backdrop,
|
|
49
|
+
.wd-mobile-menu.open .wd-mobile-menu-panel {
|
|
50
|
+
pointer-events: auto;
|
|
51
|
+
}
|
|
52
|
+
.wd-mobile-menu-backdrop {
|
|
53
|
+
position: absolute;
|
|
54
|
+
/* Full viewport (top: 0, not 5rem) - the panel itself also reaches
|
|
55
|
+
top: 0 with its own header (brand/close/theme, see
|
|
56
|
+
.wd-mobile-menu-header below) replicating the real topbar's row, so
|
|
57
|
+
there's nothing under the backdrop still worth keeping
|
|
58
|
+
un-dimmed/interactive: the real topbar is either fully covered by the
|
|
59
|
+
panel's own opaque background (its width) or genuinely just dimmed
|
|
60
|
+
decoration past it. */
|
|
61
|
+
inset: 0;
|
|
62
|
+
background: rgba(0, 0, 0, 0.4);
|
|
63
|
+
opacity: 0;
|
|
64
|
+
transition: opacity 0.25s ease;
|
|
65
|
+
}
|
|
66
|
+
.wd-mobile-menu.open .wd-mobile-menu-backdrop {
|
|
67
|
+
opacity: 1;
|
|
68
|
+
}
|
|
69
|
+
/* A left-anchored drawer (Mintlify's own mobile nav - the reference this
|
|
70
|
+
was built against - works the same way), not a centered/inset floating
|
|
71
|
+
card: flush to the screen's left edge, full viewport height top to
|
|
72
|
+
bottom (top: 0, not just below the topbar - see .wd-mobile-menu-header
|
|
73
|
+
below for why), sliding in from off-screen rather than just appearing. */
|
|
74
|
+
.wd-mobile-menu-panel {
|
|
75
|
+
position: absolute;
|
|
76
|
+
inset: 0 auto 0 0;
|
|
77
|
+
width: min(88vw, 340px);
|
|
78
|
+
display: flex;
|
|
79
|
+
flex-direction: column;
|
|
80
|
+
/* Same --wd-navbar-background as .wd-topbar (topbar.css) - this panel's
|
|
81
|
+
own header row replicates the real topbar's brand row (see the
|
|
82
|
+
comment on .wd-mobile-menu-header below), so it should share its
|
|
83
|
+
background too rather than looking like a separate, differently-
|
|
84
|
+
colored surface once a site configures theme.colors.navbar. */
|
|
85
|
+
background: var(--wd-navbar-background);
|
|
86
|
+
border-right: 1px solid var(--wd-border);
|
|
87
|
+
box-shadow: 8px 0 24px rgba(0, 0, 0, 0.15);
|
|
88
|
+
transform: translateX(-100%);
|
|
89
|
+
transition: transform 0.25s ease;
|
|
90
|
+
}
|
|
91
|
+
.wd-mobile-menu.open .wd-mobile-menu-panel {
|
|
92
|
+
transform: translateX(0);
|
|
93
|
+
}
|
|
94
|
+
/* Replicates the real topbar's brand row - same left-to-right order
|
|
95
|
+
(close-toggle, brand, theme) - as a fixed header pinned to the top of
|
|
96
|
+
the panel, so it reads as one continuous navbar with the real one
|
|
97
|
+
underneath rather than a separate piece with a seam. `flex-shrink: 0`
|
|
98
|
+
keeps it pinned above .wd-mobile-menu-scroll's own independent
|
|
99
|
+
scrolling below. .wd-topbar-brand and .wd-theme-toggle themselves are
|
|
100
|
+
defined in topbar.css, imported by this component too - see this
|
|
101
|
+
file's own top comment. */
|
|
102
|
+
.wd-mobile-menu-header {
|
|
103
|
+
display: flex;
|
|
104
|
+
align-items: center;
|
|
105
|
+
gap: 0.5rem;
|
|
106
|
+
flex-shrink: 0;
|
|
107
|
+
padding: 0.75rem 1rem;
|
|
108
|
+
border-bottom: 1px solid var(--wd-border);
|
|
109
|
+
}
|
|
110
|
+
.wd-mobile-menu-header .wd-topbar-brand {
|
|
111
|
+
flex: 1;
|
|
112
|
+
min-width: 0;
|
|
113
|
+
}
|
|
114
|
+
.wd-mobile-menu-close {
|
|
115
|
+
display: flex;
|
|
116
|
+
align-items: center;
|
|
117
|
+
justify-content: center;
|
|
118
|
+
width: 2rem;
|
|
119
|
+
height: 2rem;
|
|
120
|
+
padding: 0;
|
|
121
|
+
border: none;
|
|
122
|
+
border-radius: 0.4rem;
|
|
123
|
+
background: none;
|
|
124
|
+
cursor: pointer;
|
|
125
|
+
/* --wd-navbar-foreground-muted, not --wd-text-muted - this button sits
|
|
126
|
+
on the panel's own --wd-navbar-background (see .wd-mobile-menu-panel
|
|
127
|
+
above), same reasoning as topbar.css's identical swap for its
|
|
128
|
+
desktop-row counterparts. Falls back to var(--wd-text-muted) when
|
|
129
|
+
theme.navbar has no `foreground` set, so this is a no-op unless a
|
|
130
|
+
site actually configures one. */
|
|
131
|
+
color: var(--wd-navbar-foreground-muted);
|
|
132
|
+
flex-shrink: 0;
|
|
133
|
+
}
|
|
134
|
+
.wd-mobile-menu-close:hover { color: var(--wd-navbar-foreground); background: var(--wd-surface); }
|
|
135
|
+
.wd-mobile-menu-scroll {
|
|
136
|
+
flex: 1;
|
|
137
|
+
min-height: 0;
|
|
138
|
+
overflow-y: auto;
|
|
139
|
+
padding: 1rem 0.75rem;
|
|
140
|
+
}
|
|
141
|
+
.wd-mobile-menu-selectors {
|
|
142
|
+
display: flex;
|
|
143
|
+
flex-direction: column;
|
|
144
|
+
gap: 0.5rem;
|
|
145
|
+
margin-bottom: 0.75rem;
|
|
146
|
+
padding-bottom: 0.75rem;
|
|
147
|
+
border-bottom: 1px solid var(--wd-border);
|
|
148
|
+
}
|
|
149
|
+
/* A page without a sidebar (`mode: custom`): nothing below to divide off. */
|
|
150
|
+
.wd-mobile-menu-selectors:last-child {
|
|
151
|
+
margin-bottom: 0;
|
|
152
|
+
padding-bottom: 0;
|
|
153
|
+
border-bottom: none;
|
|
154
|
+
}
|
|
155
|
+
/* position: relative makes this the containing block for its own
|
|
156
|
+
.wd-mobile-accordion-options panel below, which floats over whatever
|
|
157
|
+
comes after it instead of pushing it down the page - a `<details>`'s
|
|
158
|
+
open content is normal, in-flow block content by default, which *would*
|
|
159
|
+
push later siblings down; taking the options panel out of flow via
|
|
160
|
+
position: absolute is what avoids that. The [open] z-index bump is what
|
|
161
|
+
then guarantees *this* accordion's floating panel paints above the
|
|
162
|
+
*later*, still-closed accordion rows below it: any position: relative
|
|
163
|
+
element - open or not - already paints above its plain in-flow siblings
|
|
164
|
+
regardless of z-index (per CSS's stacking rules), but two position:
|
|
165
|
+
relative siblings with no z-index of their own paint in DOM order, i.e.
|
|
166
|
+
a later closed row would otherwise sit on top of an earlier open one's
|
|
167
|
+
panel despite being visually "behind" it. */
|
|
168
|
+
.wd-mobile-accordion {
|
|
169
|
+
position: relative;
|
|
170
|
+
border: 1px solid var(--wd-border);
|
|
171
|
+
border-radius: 0.5rem;
|
|
172
|
+
}
|
|
173
|
+
.wd-mobile-accordion[open] {
|
|
174
|
+
z-index: 5;
|
|
175
|
+
}
|
|
176
|
+
/* --wd-navbar-foreground, not --wd-text: this row (and every other
|
|
177
|
+
selector row/link directly inside .wd-mobile-menu-scroll, down through
|
|
178
|
+
.wd-mobile-menu-link below) sits directly on .wd-mobile-menu-panel's own
|
|
179
|
+
--wd-navbar-background, same as the header above - only the *floating*
|
|
180
|
+
.wd-mobile-accordion-options-panel a click reveals (further down this
|
|
181
|
+
file) sits on the ordinary --wd-background instead, which is why that
|
|
182
|
+
one's own rules are deliberately left on --wd-text/--wd-primary,
|
|
183
|
+
unchanged. */
|
|
184
|
+
.wd-mobile-accordion-trigger {
|
|
185
|
+
display: flex;
|
|
186
|
+
align-items: center;
|
|
187
|
+
gap: 0.5rem;
|
|
188
|
+
padding: 0.65rem 0.75rem;
|
|
189
|
+
cursor: pointer;
|
|
190
|
+
font-size: 0.9rem;
|
|
191
|
+
color: var(--wd-navbar-foreground);
|
|
192
|
+
list-style: none;
|
|
193
|
+
}
|
|
194
|
+
.wd-mobile-accordion-trigger::-webkit-details-marker { display: none; }
|
|
195
|
+
.wd-mobile-accordion-trigger::marker { content: ''; }
|
|
196
|
+
.wd-mobile-accordion-label { flex: 1; min-width: 0; }
|
|
197
|
+
.wd-mobile-accordion-caret {
|
|
198
|
+
flex-shrink: 0;
|
|
199
|
+
color: var(--wd-navbar-foreground-muted);
|
|
200
|
+
transition: transform 0.15s ease;
|
|
201
|
+
}
|
|
202
|
+
.wd-mobile-accordion[open] > .wd-mobile-accordion-trigger .wd-mobile-accordion-caret {
|
|
203
|
+
transform: rotate(180deg);
|
|
204
|
+
}
|
|
205
|
+
/* Floats directly below the trigger (top: 100%, same "padding-top for the
|
|
206
|
+
gap, not a top offset, so there's no dead unhoverable/untappable strip
|
|
207
|
+
between them" reasoning as .wd-dropdown-menu in dropdown.css) rather
|
|
208
|
+
than sitting in normal flow beneath it, so opening one of these
|
|
209
|
+
overlays the accordion rows/sidebar content below it instead of shoving
|
|
210
|
+
them further down the page. */
|
|
211
|
+
.wd-mobile-accordion-options {
|
|
212
|
+
position: absolute;
|
|
213
|
+
top: 100%;
|
|
214
|
+
left: 0;
|
|
215
|
+
right: 0;
|
|
216
|
+
padding-top: 0.35rem;
|
|
217
|
+
}
|
|
218
|
+
.wd-mobile-accordion-options-panel {
|
|
219
|
+
display: flex;
|
|
220
|
+
flex-direction: column;
|
|
221
|
+
gap: 0.3rem;
|
|
222
|
+
max-height: 45vh;
|
|
223
|
+
overflow-y: auto;
|
|
224
|
+
background: var(--wd-background);
|
|
225
|
+
border: 1px solid var(--wd-border);
|
|
226
|
+
border-radius: 0.5rem;
|
|
227
|
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
|
|
228
|
+
padding: 0.4rem;
|
|
229
|
+
}
|
|
230
|
+
.wd-mobile-accordion-options a {
|
|
231
|
+
display: flex;
|
|
232
|
+
align-items: center;
|
|
233
|
+
gap: 0.5rem;
|
|
234
|
+
padding: 0.55rem 0.65rem;
|
|
235
|
+
border: 1.5px solid transparent;
|
|
236
|
+
border-radius: 0.4rem;
|
|
237
|
+
text-decoration: none;
|
|
238
|
+
color: var(--wd-text);
|
|
239
|
+
font-size: 0.9rem;
|
|
240
|
+
}
|
|
241
|
+
.wd-mobile-accordion-options a:hover { background: var(--wd-surface); }
|
|
242
|
+
.wd-mobile-accordion-options a.active {
|
|
243
|
+
border-color: var(--wd-primary);
|
|
244
|
+
color: var(--wd-primary);
|
|
245
|
+
font-weight: 500;
|
|
246
|
+
}
|
|
247
|
+
.wd-mobile-accordion-option-label { flex: 1; min-width: 0; }
|
|
248
|
+
.wd-mobile-accordion-check { flex-shrink: 0; color: var(--wd-primary); }
|
|
249
|
+
.wd-mobile-menu-link {
|
|
250
|
+
display: flex;
|
|
251
|
+
align-items: center;
|
|
252
|
+
gap: 0.5rem;
|
|
253
|
+
padding: 0.65rem 0.75rem;
|
|
254
|
+
border: 1px solid var(--wd-border);
|
|
255
|
+
border-radius: 0.5rem;
|
|
256
|
+
text-decoration: none;
|
|
257
|
+
color: var(--wd-navbar-foreground);
|
|
258
|
+
font-size: 0.9rem;
|
|
259
|
+
}
|
|
260
|
+
.wd-mobile-menu-link:hover { background: var(--wd-surface); }
|
|
261
|
+
/* An item's options with none chosen (MobileMenu.astro) - an open list, in
|
|
262
|
+
one box like a closed level's row. */
|
|
263
|
+
.wd-mobile-menu-choices {
|
|
264
|
+
display: flex;
|
|
265
|
+
flex-direction: column;
|
|
266
|
+
gap: 0.15rem;
|
|
267
|
+
padding: 0.3rem;
|
|
268
|
+
border: 1px solid var(--wd-border);
|
|
269
|
+
border-radius: 0.5rem;
|
|
270
|
+
}
|
|
271
|
+
.wd-mobile-menu-choices a {
|
|
272
|
+
display: flex;
|
|
273
|
+
align-items: center;
|
|
274
|
+
gap: 0.5rem;
|
|
275
|
+
padding: 0.5rem 0.45rem;
|
|
276
|
+
border-radius: 0.4rem;
|
|
277
|
+
text-decoration: none;
|
|
278
|
+
color: var(--wd-navbar-foreground);
|
|
279
|
+
font-size: 0.9rem;
|
|
280
|
+
}
|
|
281
|
+
.wd-mobile-menu-choices a:hover { background: var(--wd-surface); }
|
|
282
|
+
/* The sidebar, once the menu's script has moved it in here, needs none of
|
|
283
|
+
.wd-sidebar-col's own column sizing (width/border/min-height) - it's just
|
|
284
|
+
flowing content inside an already-padded, already-scrollable panel. */
|
|
285
|
+
.wd-mobile-menu-sidebar .wd-sidebar { padding: 0; }
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// The link-preview cards a site gets (lib/og-image.js draws one), decided in
|
|
2
|
+
// one place for both places that draw them: src/pages/og/[...slug].png.ts,
|
|
3
|
+
// on request in `writedocs dev`, and the build's own step after Astro
|
|
4
|
+
// (src/cli/og-images.js), which draws them all in parallel. Which pages get
|
|
5
|
+
// one, and what's on it - the title, the description, the logo, the color -
|
|
6
|
+
// and where it goes: /og/<page id>.png (ogImagePath() in lib/og-image.js).
|
|
7
|
+
//
|
|
8
|
+
// Plain JavaScript, for scripts/og-images.test.js and the build's threads.
|
|
9
|
+
import { imageFileFor } from './image-size.js';
|
|
10
|
+
import { logoForCard, wantsGeneratedCard } from './og-image.js';
|
|
11
|
+
|
|
12
|
+
/** The cards of a site. `pages` is every page as { id, data, seo }: the
|
|
13
|
+
* collection entry's normalized id (normalizeEntryId() in lib/config.ts),
|
|
14
|
+
* its frontmatter, and the site's `seo` with the page's merged over it
|
|
15
|
+
* (mergeSeo()). What every card shares is said once - the logo is read and
|
|
16
|
+
* encoded once, not once per page. */
|
|
17
|
+
export function ogCardSet(config, pages, contentDir) {
|
|
18
|
+
const logoSetting = config.styles.logo;
|
|
19
|
+
const logoPath = typeof logoSetting === 'string' ? logoSetting : (logoSetting?.light ?? logoSetting?.dark);
|
|
20
|
+
return {
|
|
21
|
+
siteName: config.name,
|
|
22
|
+
primary: config.styles.colors.primary,
|
|
23
|
+
logo: logoForCard(logoPath ? imageFileFor(logoPath, contentDir) : null),
|
|
24
|
+
cards: pages
|
|
25
|
+
.filter(({ data, seo }) => wantsGeneratedCard(seo, data, config.seo))
|
|
26
|
+
.map(({ id, data }) => ({ slug: id, title: data.title, description: data.seo?.description ?? data.description ?? config.description })),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** What ogImagePng() draws for one card of a set. */
|
|
31
|
+
export function ogCardOptions(set, card) {
|
|
32
|
+
return { title: card.title, description: card.description, siteName: set.siteName, primary: set.primary, logo: set.logo };
|
|
33
|
+
}
|