@writedocs/generator 0.11.0 → 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 +3 -1
- package/src/cli/astro-output.js +44 -11
- package/src/cli/build.js +28 -2
- package/src/cli/dev.js +261 -261
- 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/search.ts +9 -5
- package/src/scripts/sidebar-scroll.ts +61 -65
|
@@ -818,9 +818,7 @@ const fontExtraCss = [fontFaceCss, fontFallbackCss, fontWeightCss].filter(Boolea
|
|
|
818
818
|
logoLight={logoLight}
|
|
819
819
|
logoDark={logoDark}
|
|
820
820
|
brandLabel={brandLabel}
|
|
821
|
-
|
|
822
|
-
<slot name="sidebar" slot="sidebar" />
|
|
823
|
-
</MobileMenu>
|
|
821
|
+
/>
|
|
824
822
|
<div class="wd-shell">
|
|
825
823
|
{showSidebarCol && (
|
|
826
824
|
<div class="wd-sidebar-col">
|
|
@@ -17,14 +17,13 @@
|
|
|
17
17
|
// lib/config.ts, which walks the active PathSegment[] in that exact
|
|
18
18
|
// order) - no tab-specific branching needed here at all.
|
|
19
19
|
//
|
|
20
|
-
// The sidebar itself
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
// so there's no duplicate-content flash either way.
|
|
20
|
+
// The sidebar itself isn't rendered here: `.wd-mobile-menu-sidebar` starts
|
|
21
|
+
// empty, and opening the menu moves the page's one sidebar - the children
|
|
22
|
+
// of BaseLayout's `.wd-sidebar-col`, hidden at this width - into it
|
|
23
|
+
// (src/scripts/mobile-menu.ts); widening the window past 860px moves it
|
|
24
|
+
// back. It used to be a second copy of the `sidebar` slot, and on a site
|
|
25
|
+
// with a long navigation (an OpenAPI section with hundreds of operations)
|
|
26
|
+
// that copy was half of every page's HTML.
|
|
28
27
|
//
|
|
29
28
|
// Split out of BaseLayout.astro, which had grown to ~2200 lines covering
|
|
30
29
|
// several unrelated concerns in one file - see that component's own
|
|
@@ -198,11 +197,8 @@ const showMenu = hasMobileMenu({ sidebar: showSidebarCol, selectors, globalDropd
|
|
|
198
197
|
)}
|
|
199
198
|
</div>
|
|
200
199
|
)}
|
|
201
|
-
{
|
|
202
|
-
|
|
203
|
-
<slot name="sidebar" />
|
|
204
|
-
</div>
|
|
205
|
-
)}
|
|
200
|
+
{/* Filled by initMobileMenu() when the menu opens - see this file's top comment. */}
|
|
201
|
+
{showSidebarCol && <div class="wd-mobile-menu-sidebar"></div>}
|
|
206
202
|
</div>
|
|
207
203
|
</div>
|
|
208
204
|
</div>
|
|
@@ -12,6 +12,18 @@ interface Props {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
const { nodes, hrefForSlug, currentSlug, depth = 0 } = Astro.props as Props;
|
|
15
|
+
|
|
16
|
+
// The <style> below is global, not scoped: a scoped one puts a
|
|
17
|
+
// data-astro-cid-* attribute on every <li>, <a> and <span> here - four per
|
|
18
|
+
// item, 24 bytes each - and the tree is on every page, in full. With a long
|
|
19
|
+
// OpenAPI section that was 30% of each page's HTML. Every selector in it
|
|
20
|
+
// starts from a wd-nav-* class, which nothing else on a page uses.
|
|
21
|
+
//
|
|
22
|
+
// Without the scope, a selector is (0,1,0) less specific per part, so two
|
|
23
|
+
// rules with a different number of parts can trade places. One pair did:
|
|
24
|
+
// `.wd-nav-list a.active` came to outweigh `.wd-nav-group
|
|
25
|
+
// .wd-nav-section-title a` - hence the font-weight there. A new rule has to be
|
|
26
|
+
// weighed against the others with nothing but its own selectors to count.
|
|
15
27
|
---
|
|
16
28
|
|
|
17
29
|
<ul class={`wd-nav-list wd-nav-depth-${depth}`}>
|
|
@@ -122,7 +134,7 @@ const { nodes, hrefForSlug, currentSlug, depth = 0 } = Astro.props as Props;
|
|
|
122
134
|
}
|
|
123
135
|
</ul>
|
|
124
136
|
|
|
125
|
-
<style>
|
|
137
|
+
<style is:global>
|
|
126
138
|
.wd-nav-list {
|
|
127
139
|
list-style: none;
|
|
128
140
|
margin: 0;
|
|
@@ -194,6 +206,9 @@ const { nodes, hrefForSlug, currentSlug, depth = 0 } = Astro.props as Props;
|
|
|
194
206
|
.wd-nav-group .wd-nav-section-title a:hover {
|
|
195
207
|
background: none;
|
|
196
208
|
color: var(--wd-primary);
|
|
209
|
+
/* The title's own weight, not `.wd-nav-list a.active`'s 500 - which
|
|
210
|
+
ties with the rule above on specificity, and comes later. */
|
|
211
|
+
font-weight: inherit;
|
|
197
212
|
}
|
|
198
213
|
.wd-nav-depth-1,
|
|
199
214
|
.wd-nav-depth-2,
|
|
@@ -239,15 +254,15 @@ const { nodes, hrefForSlug, currentSlug, depth = 0 } = Astro.props as Props;
|
|
|
239
254
|
/* text-overflow: ellipsis;
|
|
240
255
|
white-space: nowrap; */
|
|
241
256
|
}
|
|
242
|
-
/* A page's own frontmatter `icon` (Mintlify's)
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
257
|
+
/* A page's own frontmatter `icon` (Mintlify's), which AppIcon.astro
|
|
258
|
+
renders as an svg or a span. */
|
|
259
|
+
svg.wd-nav-page-icon,
|
|
260
|
+
span.wd-nav-page-icon {
|
|
246
261
|
flex-shrink: 0;
|
|
247
262
|
width: 1em;
|
|
248
263
|
height: 1em;
|
|
249
264
|
}
|
|
250
|
-
|
|
265
|
+
span.wd-nav-page-icon {
|
|
251
266
|
display: flex;
|
|
252
267
|
align-items: center;
|
|
253
268
|
justify-content: center;
|
|
@@ -152,7 +152,7 @@ const { navTree, hrefForSlug, currentSlug, switchers = [] } = Astro.props as Pro
|
|
|
152
152
|
margin-top: 0.2rem;
|
|
153
153
|
}
|
|
154
154
|
/* The mobile menu already lists every level as its own row above the
|
|
155
|
-
sidebar - no second
|
|
155
|
+
sidebar (once moved in there) - no second switcher there. */
|
|
156
156
|
:global(#wd-mobile-menu) .wd-sidebar-switcher {
|
|
157
157
|
display: none;
|
|
158
158
|
}
|
|
@@ -192,8 +192,8 @@ const { navTree, hrefForSlug, currentSlug, switchers = [] } = Astro.props as Pro
|
|
|
192
192
|
force it to actually be that tall when content is shorter, which is
|
|
193
193
|
exactly the "empty space below the watermark" case this replaces.
|
|
194
194
|
Scoped to .wd-sidebar-col specifically (not the plain .wd-sidebar
|
|
195
|
-
this component always renders) so the
|
|
196
|
-
MobileMenu.astro's
|
|
195
|
+
this component always renders) so the sidebar is untouched once the
|
|
196
|
+
menu's script moves it into MobileMenu.astro's scrollable panel - forcing a
|
|
197
197
|
tall fixed height there would leave an awkward blank stretch inside
|
|
198
198
|
the mobile drawer under a short nav list, where "pinned to the
|
|
199
199
|
bottom of the screen" isn't really representative of a panel the
|
|
@@ -205,7 +205,7 @@ const { navTree, hrefForSlug, currentSlug, switchers = [] } = Astro.props as Pro
|
|
|
205
205
|
}
|
|
206
206
|
/* Last thing in the nav column. margin-top: auto only has real estate
|
|
207
207
|
to push into on desktop (where the rule above gives .wd-sidebar a
|
|
208
|
-
real fixed height) - inside the mobile menu's
|
|
208
|
+
real fixed height) - inside the mobile menu's panel, .wd-
|
|
209
209
|
sidebar is never a flex container, so this margin resolves to 0 and
|
|
210
210
|
the watermark just falls in after the last nav item instead, same
|
|
211
211
|
as before that rule existed. Either way, padding-top + border-top
|