@writedocs/generator 0.10.20 → 0.11.1
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/astro.config.mjs +32 -8
- package/package.json +3 -1
- package/src/cli/astro-output.js +44 -11
- package/src/cli/base-path-layout.js +44 -0
- package/src/cli/build.js +18 -9
- package/src/cli/check-built-styles.js +41 -33
- package/src/cli/dev.js +21 -4
- package/src/cli/run-pagefind.js +154 -148
- package/src/cli/write-mcp-files.js +103 -96
- package/src/cli/write-redirects-file.js +25 -8
- package/src/components/AppIcon.astro +51 -50
- package/src/components/Card.astro +193 -192
- package/src/components/CopyPageMenu.astro +374 -370
- package/src/components/Hint.astro +188 -187
- package/src/components/Icon.astro +72 -71
- package/src/components/Image.astro +3 -2
- package/src/components/Tile.astro +67 -66
- package/src/components/Video.astro +137 -136
- package/src/layout/BaseLayout.astro +21 -12
- package/src/layout/components/AnalyticsScripts.astro +6 -2
- package/src/layout/components/Breadcrumbs.astro +98 -97
- package/src/layout/components/ConsentBanner.astro +119 -118
- package/src/layout/components/MobileMenu.astro +229 -228
- package/src/layout/components/NavTree.astro +393 -392
- package/src/layout/components/Sidebar.astro +232 -231
- package/src/layout/components/SiteFooter.astro +87 -86
- package/src/layout/components/TopBar.astro +386 -385
- package/src/lib/agent-markdown.js +164 -162
- package/src/lib/asset-dimensions.js +89 -89
- package/src/lib/base-path.js +90 -0
- package/src/lib/config-schema.js +10 -0
- package/src/lib/config-schema.ts +17 -0
- package/src/lib/config.ts +1314 -1289
- package/src/lib/consent.js +108 -102
- package/src/lib/json-schema-descriptions.js +1 -0
- package/src/lib/link-check.js +7 -2
- package/src/lib/llms-index.ts +90 -88
- package/src/lib/mcp-dev-integration.js +65 -60
- package/src/lib/mcp-index.ts +102 -101
- package/src/lib/project-files-integration.js +2 -2
- package/src/lib/rehype-base-path.js +62 -0
- package/src/lib/robots-txt.js +21 -16
- package/src/lib/seo-tags.js +155 -140
- package/src/lib/site-base.ts +27 -0
- package/src/lib/styles-asset-integration.js +23 -10
- package/src/lib/wdignore-cases.json +195 -195
- package/src/lib/wdignore.js +177 -177
- package/src/pages/404.astro +63 -62
- package/src/pages/[...slug].astro +1604 -1597
- package/src/pages/[...slug].md.ts +93 -93
- package/src/pages/llms-full.txt.ts +88 -86
- package/src/scripts/search.ts +245 -237
- package/writedocs.schema.json +6 -0
|
@@ -1,187 +1,188 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { extraClasses } from './class-names';
|
|
3
|
-
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
icon
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
<span class="wd-hint-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
</span>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
text-decoration-
|
|
71
|
-
text-decoration-
|
|
72
|
-
text-decoration-
|
|
73
|
-
text-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
.wd-hint:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
stroke
|
|
89
|
-
stroke-
|
|
90
|
-
stroke-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
.wd-hint:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
font-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
width:
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
border
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
.wd-hint:
|
|
152
|
-
.wd-hint:focus-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
.wd-hint-rich:
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
.wd-hint-
|
|
173
|
-
.wd-hint-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
1
|
+
---
|
|
2
|
+
import { extraClasses } from './class-names';
|
|
3
|
+
import { siteHref } from '../lib/site-base';
|
|
4
|
+
// Inline, text-level component - unlike every other built-in here
|
|
5
|
+
// (Callout, Card, Accordion, ...), which are all block-level and get
|
|
6
|
+
// their own line, a Hint sits mid-sentence: `word <Hint tip="...">this
|
|
7
|
+
// bit</Hint> continues`. That's why this renders a <span>, not a <div>,
|
|
8
|
+
// and why its own trigger area is its slotted text plus, by default, a
|
|
9
|
+
// small info icon after it - a dotted underline and that icon are the
|
|
10
|
+
// whole cue, no padding box drawing attention to itself the way a Callout
|
|
11
|
+
// does. `icon={false}` leaves just the underlined text.
|
|
12
|
+
//
|
|
13
|
+
// tip is a plain string prop (not a slot) deliberately - the tooltip
|
|
14
|
+
// bubble itself needs to be one line of plain text CSS can center/
|
|
15
|
+
// position predictably; a second <slot> would let an author put
|
|
16
|
+
// arbitrary markup (another Hint, a link, a whole paragraph) in there,
|
|
17
|
+
// which the hover-bubble layout below was never built to hold.
|
|
18
|
+
//
|
|
19
|
+
// `headline`, `cta` and `href` exist for Mintlify's <Tooltip> (see
|
|
20
|
+
// Tooltip.astro): an optional bold line above the tip, and an optional
|
|
21
|
+
// link below it. They're still plain strings, not slots - same reasoning
|
|
22
|
+
// as above. A tooltip with a link has to stay open while the pointer moves
|
|
23
|
+
// from the trigger onto the bubble, so the bubble takes pointer events
|
|
24
|
+
// once shown, and a transparent ::before bridges the gap between them.
|
|
25
|
+
interface Props {
|
|
26
|
+
tip: string;
|
|
27
|
+
headline?: string;
|
|
28
|
+
cta?: string;
|
|
29
|
+
href?: string;
|
|
30
|
+
/** The small info icon after the text. On unless set to false. */
|
|
31
|
+
icon?: boolean;
|
|
32
|
+
}
|
|
33
|
+
const { tip, headline, cta, href, icon = true } = Astro.props as Props;
|
|
34
|
+
const hasLink = Boolean(cta && href);
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
<span class:list={["wd-hint", { "wd-hint-rich": Boolean(headline) || hasLink }, extraClasses(Astro.props)]} tabindex="0">
|
|
38
|
+
<span class="wd-hint-trigger"><slot /></span>{icon && (
|
|
39
|
+
<svg class="wd-hint-icon" viewBox="0 0 24 24" aria-hidden="true">
|
|
40
|
+
<circle cx="12" cy="12" r="9.5" />
|
|
41
|
+
<path d="M12 16.5v-5M12 8h.01" />
|
|
42
|
+
</svg>
|
|
43
|
+
)}
|
|
44
|
+
<span class="wd-hint-tooltip" role="tooltip">
|
|
45
|
+
{headline && <span class="wd-hint-headline">{headline}</span>}
|
|
46
|
+
<span class="wd-hint-tip">{tip}</span>
|
|
47
|
+
{hasLink && <a class="wd-hint-cta" href={siteHref(href)}>{cta}</a>}
|
|
48
|
+
</span>
|
|
49
|
+
</span>
|
|
50
|
+
<style>
|
|
51
|
+
.wd-hint {
|
|
52
|
+
position: relative;
|
|
53
|
+
/* display: inline, not inline-block - this needs to be able to wrap
|
|
54
|
+
across a line break exactly like the plain text around it would
|
|
55
|
+
(it's often a whole sentence, not one short word), which
|
|
56
|
+
inline-block would prevent by forcing the whole span to stay on
|
|
57
|
+
one line or break as a single rigid box. */
|
|
58
|
+
display: inline;
|
|
59
|
+
/* tabindex above + :focus-visible below make this reachable and
|
|
60
|
+
revealable by keyboard, not just a mouse hover - the underline
|
|
61
|
+
and cursor: help both double as the visual cue that there's a
|
|
62
|
+
hint here at all, since nothing about plain underlined text
|
|
63
|
+
otherwise signals "hover me" the way an icon or button would. */
|
|
64
|
+
cursor: help;
|
|
65
|
+
}
|
|
66
|
+
/* A dotted underline under the text, drawn by the font's own underline
|
|
67
|
+
rather than a border, so it follows the text across a line break and
|
|
68
|
+
sits clear of descenders. */
|
|
69
|
+
.wd-hint-trigger {
|
|
70
|
+
text-decoration-line: underline;
|
|
71
|
+
text-decoration-style: dotted;
|
|
72
|
+
text-decoration-thickness: 2px;
|
|
73
|
+
text-decoration-color: color-mix(in srgb, currentColor 55%, transparent);
|
|
74
|
+
text-underline-offset: 0.22em;
|
|
75
|
+
}
|
|
76
|
+
.wd-hint:hover .wd-hint-trigger,
|
|
77
|
+
.wd-hint:focus-visible .wd-hint-trigger {
|
|
78
|
+
text-decoration-color: currentColor;
|
|
79
|
+
}
|
|
80
|
+
/* Smaller than the text, a little clear of it, in the muted color. */
|
|
81
|
+
.wd-hint-icon {
|
|
82
|
+
display: inline-block;
|
|
83
|
+
width: 0.72em;
|
|
84
|
+
height: 0.72em;
|
|
85
|
+
margin-left: 0.22em;
|
|
86
|
+
vertical-align: -0.04em;
|
|
87
|
+
fill: none;
|
|
88
|
+
stroke: currentColor;
|
|
89
|
+
stroke-width: 2.2;
|
|
90
|
+
stroke-linecap: round;
|
|
91
|
+
stroke-linejoin: round;
|
|
92
|
+
color: var(--wd-text-muted);
|
|
93
|
+
transition: color 0.15s ease;
|
|
94
|
+
}
|
|
95
|
+
.wd-hint:hover .wd-hint-icon,
|
|
96
|
+
.wd-hint:focus-visible .wd-hint-icon {
|
|
97
|
+
color: var(--wd-text);
|
|
98
|
+
}
|
|
99
|
+
.wd-hint-tooltip {
|
|
100
|
+
position: absolute;
|
|
101
|
+
bottom: calc(100% + 0.55rem);
|
|
102
|
+
left: 50%;
|
|
103
|
+
transform: translateX(-50%) translateY(4px);
|
|
104
|
+
/* Fixed dark-on-light regardless of [data-theme] - deliberately not
|
|
105
|
+
var(--wd-text)/var(--wd-background) (which flip a Hint's own
|
|
106
|
+
tooltip to light-on-dark in dark mode) since the bubble needs to
|
|
107
|
+
read as "a label floating above the page", the same fixed
|
|
108
|
+
look in both themes, not as page content that itself follows the
|
|
109
|
+
theme - the same reasoning Card.astro's method badges already
|
|
110
|
+
settled on for their own always-colored, never-theme-flipping
|
|
111
|
+
backgrounds. */
|
|
112
|
+
background: #18181b;
|
|
113
|
+
color: #fff;
|
|
114
|
+
padding: 0.45rem 0.75rem;
|
|
115
|
+
border-radius: 0.4rem;
|
|
116
|
+
font-size: 0.75rem;
|
|
117
|
+
font-weight: 700;
|
|
118
|
+
line-height: 1.3;
|
|
119
|
+
/* No white-space: nowrap - a long tip (a UUID example, a full
|
|
120
|
+
sentence) needs to actually wrap onto a second line within
|
|
121
|
+
max-width; nowrap combined with max-width caps the *box* but
|
|
122
|
+
leaves overflow: visible's default behavior letting the text
|
|
123
|
+
itself spill out past the painted background/border-radius
|
|
124
|
+
instead of wrapping inside it - exactly the "text sticking out
|
|
125
|
+
past the dark bubble" bug a real screenshot caught. Wrapping
|
|
126
|
+
normally keeps the background sized to whatever it's actually
|
|
127
|
+
covering, at the cost of a short tip's box no longer perfectly
|
|
128
|
+
hugging one line's width (an intentional trade - a tip that's
|
|
129
|
+
readable matters more than one that's minimally-sized). */
|
|
130
|
+
max-width: 16rem;
|
|
131
|
+
width: max-content;
|
|
132
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
|
|
133
|
+
opacity: 0;
|
|
134
|
+
visibility: hidden;
|
|
135
|
+
pointer-events: none;
|
|
136
|
+
transition:
|
|
137
|
+
opacity 0.15s ease,
|
|
138
|
+
transform 0.15s ease,
|
|
139
|
+
visibility 0.15s;
|
|
140
|
+
z-index: 30;
|
|
141
|
+
}
|
|
142
|
+
.wd-hint-tooltip::after {
|
|
143
|
+
content: "";
|
|
144
|
+
position: absolute;
|
|
145
|
+
top: 100%;
|
|
146
|
+
left: 50%;
|
|
147
|
+
transform: translateX(-50%);
|
|
148
|
+
border: 5px solid transparent;
|
|
149
|
+
border-top-color: #18181b;
|
|
150
|
+
}
|
|
151
|
+
.wd-hint:hover .wd-hint-tooltip,
|
|
152
|
+
.wd-hint:focus-visible .wd-hint-tooltip,
|
|
153
|
+
.wd-hint:focus-within .wd-hint-tooltip {
|
|
154
|
+
opacity: 1;
|
|
155
|
+
visibility: visible;
|
|
156
|
+
transform: translateX(-50%) translateY(0);
|
|
157
|
+
}
|
|
158
|
+
/* Only a tooltip with a headline or link is interactive - a plain one
|
|
159
|
+
keeps pointer-events: none so it never blocks the text under it. */
|
|
160
|
+
.wd-hint-rich:hover .wd-hint-tooltip,
|
|
161
|
+
.wd-hint-rich:focus-within .wd-hint-tooltip {
|
|
162
|
+
pointer-events: auto;
|
|
163
|
+
}
|
|
164
|
+
.wd-hint-rich .wd-hint-tooltip::before {
|
|
165
|
+
content: "";
|
|
166
|
+
position: absolute;
|
|
167
|
+
top: 100%;
|
|
168
|
+
left: 0;
|
|
169
|
+
right: 0;
|
|
170
|
+
height: 0.6rem;
|
|
171
|
+
}
|
|
172
|
+
.wd-hint-tip,
|
|
173
|
+
.wd-hint-headline,
|
|
174
|
+
.wd-hint-cta {
|
|
175
|
+
display: block;
|
|
176
|
+
}
|
|
177
|
+
.wd-hint-rich .wd-hint-tip {
|
|
178
|
+
font-weight: 400;
|
|
179
|
+
}
|
|
180
|
+
.wd-hint-headline {
|
|
181
|
+
margin-bottom: 0.2rem;
|
|
182
|
+
}
|
|
183
|
+
.wd-hint-cta {
|
|
184
|
+
margin-top: 0.35rem;
|
|
185
|
+
color: #93c5fd;
|
|
186
|
+
text-decoration: underline;
|
|
187
|
+
}
|
|
188
|
+
</style>
|
|
@@ -1,71 +1,72 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { extraClasses } from './class-names';
|
|
3
|
-
// Renders either a real icon (via `icon`) or a custom image (via
|
|
4
|
-
// `src`) inline with surrounding text - modeled on Mintlify's own Icon
|
|
5
|
-
// (https://www.mintlify.com/docs/components/icons), which documents
|
|
6
|
-
// exactly this "one of `icon` or `src`" split. `icon` reuses
|
|
7
|
-
// AppIcon.astro - the same Lucide/Iconify/literal-text resolution
|
|
8
|
-
// every other icon prop on this site already goes through (Card,
|
|
9
|
-
// Badge, writedocs.json's own tab/dropdown/product icons) - so this
|
|
10
|
-
// component's `icon` prop behaves identically to theirs, just laid out
|
|
11
|
-
// for inline text flow instead of block/flex placement.
|
|
12
|
-
//
|
|
13
|
-
// The `src` branch is a second, independent code path (a plain <img>,
|
|
14
|
-
// not AppIcon) since it isn't resolving an icon set at all - it's
|
|
15
|
-
// dropping in an arbitrary image (a project-local file or an external
|
|
16
|
-
// URL) and just needs to sit inline at a controlled height, the exact
|
|
17
|
-
// behavior of the InlineImage React component this was modeled on
|
|
18
|
-
// (display: inline, a `height` prop controlling size, no margin).
|
|
19
|
-
import AppIcon from './AppIcon.astro';
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
//
|
|
33
|
-
//
|
|
34
|
-
height
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
1
|
+
---
|
|
2
|
+
import { extraClasses } from './class-names';
|
|
3
|
+
// Renders either a real icon (via `icon`) or a custom image (via
|
|
4
|
+
// `src`) inline with surrounding text - modeled on Mintlify's own Icon
|
|
5
|
+
// (https://www.mintlify.com/docs/components/icons), which documents
|
|
6
|
+
// exactly this "one of `icon` or `src`" split. `icon` reuses
|
|
7
|
+
// AppIcon.astro - the same Lucide/Iconify/literal-text resolution
|
|
8
|
+
// every other icon prop on this site already goes through (Card,
|
|
9
|
+
// Badge, writedocs.json's own tab/dropdown/product icons) - so this
|
|
10
|
+
// component's `icon` prop behaves identically to theirs, just laid out
|
|
11
|
+
// for inline text flow instead of block/flex placement.
|
|
12
|
+
//
|
|
13
|
+
// The `src` branch is a second, independent code path (a plain <img>,
|
|
14
|
+
// not AppIcon) since it isn't resolving an icon set at all - it's
|
|
15
|
+
// dropping in an arbitrary image (a project-local file or an external
|
|
16
|
+
// URL) and just needs to sit inline at a controlled height, the exact
|
|
17
|
+
// behavior of the InlineImage React component this was modeled on
|
|
18
|
+
// (display: inline, a `height` prop controlling size, no margin).
|
|
19
|
+
import AppIcon from './AppIcon.astro';
|
|
20
|
+
import { siteHref } from '../lib/site-base';
|
|
21
|
+
|
|
22
|
+
interface Props {
|
|
23
|
+
icon?: string;
|
|
24
|
+
src?: string;
|
|
25
|
+
alt?: string;
|
|
26
|
+
// Only meaningful for the `icon` branch - a pixel size (Mintlify's
|
|
27
|
+
// own `size` prop is a number, not a CSS length) and a CSS color,
|
|
28
|
+
// applied as an inline style since these are arbitrary per-instance
|
|
29
|
+
// values, not a fixed set of classes.
|
|
30
|
+
size?: number;
|
|
31
|
+
color?: string;
|
|
32
|
+
// Only meaningful for the `src` branch - a CSS length string (not a
|
|
33
|
+
// bare number, unlike `size` above), matching the InlineImage
|
|
34
|
+
// reference component's own `height` prop and its "1.6em" default.
|
|
35
|
+
height?: string;
|
|
36
|
+
}
|
|
37
|
+
const { icon, src, alt = '', size, color, height = '1.6em' } = Astro.props as Props;
|
|
38
|
+
|
|
39
|
+
const iconStyle =
|
|
40
|
+
[size ? `width:${size}px` : null, size ? `height:${size}px` : null, color ? `color:${color}` : null]
|
|
41
|
+
.filter(Boolean)
|
|
42
|
+
.join(';') || undefined;
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
{
|
|
46
|
+
src ? (
|
|
47
|
+
<img src={siteHref(src)} alt={alt} class:list={["wd-icon-image", extraClasses(Astro.props)]} style={`height:${height}`} />
|
|
48
|
+
) : icon ? (
|
|
49
|
+
<AppIcon icon={icon} class={["wd-icon-inline", ...extraClasses(Astro.props)].join(" ")} style={iconStyle} />
|
|
50
|
+
) : null
|
|
51
|
+
}
|
|
52
|
+
<style>
|
|
53
|
+
.wd-icon-image {
|
|
54
|
+
display: inline;
|
|
55
|
+
vertical-align: middle;
|
|
56
|
+
height: 1.6em;
|
|
57
|
+
margin: 0;
|
|
58
|
+
}
|
|
59
|
+
/* :global() is load-bearing, same reason as every other AppIcon
|
|
60
|
+
consumer's identical comment (Card.astro, Badge.astro): AppIcon
|
|
61
|
+
renders this span/svg, not Icon.astro, so it never carries this
|
|
62
|
+
component's own scope attribute. 1em default (overridden inline
|
|
63
|
+
via the `size` prop's style attribute when set) keeps an
|
|
64
|
+
unsized icon proportional to its surrounding text, the same way a
|
|
65
|
+
real glyph would be. */
|
|
66
|
+
:global(.wd-icon-inline) {
|
|
67
|
+
display: inline;
|
|
68
|
+
vertical-align: middle;
|
|
69
|
+
width: 1em;
|
|
70
|
+
height: 1em;
|
|
71
|
+
}
|
|
72
|
+
</style>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
import { extraClasses } from './class-names';
|
|
3
3
|
import { imageFileFor, imageSize } from '../lib/image-size.js';
|
|
4
|
+
import { siteHref } from '../lib/site-base';
|
|
4
5
|
// Block-level (own line, centered) - unlike Hint (inline/text-level),
|
|
5
6
|
// this is meant to be dropped in on its own the way Callout/Card are.
|
|
6
7
|
//
|
|
@@ -85,8 +86,8 @@ const sizeStyle = size ? `--wd-image-size:${size}` : undefined;
|
|
|
85
86
|
class:list={["wd-image-figure", caption && "wd-image-figure-framed", srcDark && "wd-image-has-dark", extraClasses(Astro.props)]}
|
|
86
87
|
style={sizeStyle}
|
|
87
88
|
>
|
|
88
|
-
<img src={src} alt={alt} class="wd-image wd-image-light" nozoom={noZoom || undefined} loading={loading} decoding="async" width={light.width} height={light.height} />
|
|
89
|
-
{srcDark && <img src={srcDark} alt={alt} class="wd-image wd-image-dark" nozoom={noZoom || undefined} loading={loading} decoding="async" width={dark.width} height={dark.height} />}
|
|
89
|
+
<img src={siteHref(src)} alt={alt} class="wd-image wd-image-light" nozoom={noZoom || undefined} loading={loading} decoding="async" width={light.width} height={light.height} />
|
|
90
|
+
{srcDark && <img src={siteHref(srcDark)} alt={alt} class="wd-image wd-image-dark" nozoom={noZoom || undefined} loading={loading} decoding="async" width={dark.width} height={dark.height} />}
|
|
90
91
|
{caption && <figcaption class="wd-image-caption">{caption}</figcaption>}
|
|
91
92
|
</figure>
|
|
92
93
|
<style>
|