@ascribed/astro 0.4.4 → 0.4.5-next.34
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/README.md +2 -1
- package/dist/code-languages.d.ts +10 -0
- package/dist/code-languages.js +16 -0
- package/dist/code-languages.js.map +1 -0
- package/dist/code-titles.js +49 -5
- package/dist/code-titles.js.map +1 -1
- package/dist/help-file.d.ts +20 -0
- package/dist/help-file.js +24 -0
- package/dist/help-file.js.map +1 -0
- package/dist/help-route.d.ts +2 -3
- package/dist/help-route.js +12 -6
- package/dist/help-route.js.map +1 -1
- package/dist/help.d.ts +20 -27
- package/dist/help.js +49 -36
- package/dist/help.js.map +1 -1
- package/dist/index.js +9 -6
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts +1 -1
- package/dist/init.js +3 -2
- package/dist/init.js.map +1 -1
- package/dist/names.d.ts +21 -0
- package/dist/names.js +21 -0
- package/dist/names.js.map +1 -1
- package/dist/permalinks.d.ts +13 -7
- package/dist/permalinks.js +11 -3
- package/dist/permalinks.js.map +1 -1
- package/dist/redirects.d.ts +14 -3
- package/dist/redirects.js +31 -10
- package/dist/redirects.js.map +1 -1
- package/dist/run.d.ts +5 -5
- package/dist/run.js +11 -7
- package/dist/run.js.map +1 -1
- package/dist/shapes.d.ts +33 -3
- package/dist/shapes.js.map +1 -1
- package/package.json +5 -4
- package/src/MissingPermalink.astro +3 -3
- package/src/Permalink.astro +14 -2
- package/starter/src/layouts/Docs.astro +48 -33
- package/starter/src/styles/docs.css +329 -0
|
@@ -16,6 +16,9 @@ import {
|
|
|
16
16
|
type SidebarGroup,
|
|
17
17
|
type SidebarPage,
|
|
18
18
|
} from "@ascribed/astro/content";
|
|
19
|
+
// The layout's styles. To style the site your own way, change the file, or
|
|
20
|
+
// delete it and this line.
|
|
21
|
+
import "../styles/docs.css";
|
|
19
22
|
|
|
20
23
|
interface Props {
|
|
21
24
|
entry: CollectionEntry<"docs">;
|
|
@@ -50,6 +53,11 @@ const { available } = page(entry);
|
|
|
50
53
|
// pages right after its own page, each with its depth. With a versioned build,
|
|
51
54
|
// it shows the pages of the line this page is in. Previous and next are the
|
|
52
55
|
// pages before and after this one in the navigation's reading order.
|
|
56
|
+
//
|
|
57
|
+
// The default order puts a section's pages by content type, then title, so
|
|
58
|
+
// "Configure" comes before "Install". To choose another, write ascribe.nav
|
|
59
|
+
// beside ascribe.toml, or drag the pages in the editor: the docs' "Put your
|
|
60
|
+
// pages in order" says how.
|
|
53
61
|
const entries = await getCollection("docs");
|
|
54
62
|
const groups = sidebar(entries, { entry });
|
|
55
63
|
const { previous, next } = neighbors(entry, entries);
|
|
@@ -91,44 +99,51 @@ function items(group: SidebarGroup<CollectionEntry<"docs">>, depth = 0): Item[]
|
|
|
91
99
|
<Elements />
|
|
92
100
|
</head>
|
|
93
101
|
<body>
|
|
94
|
-
<
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
<
|
|
100
|
-
{
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
102
|
+
<details class="menu">
|
|
103
|
+
<summary>Menu</summary>
|
|
104
|
+
<nav aria-label="Docs">
|
|
105
|
+
{
|
|
106
|
+
groups.map((group) => (
|
|
107
|
+
<section>
|
|
108
|
+
<h2 set:html={labelHtml(group)} />
|
|
109
|
+
<ul>
|
|
110
|
+
{items(group).map(({ page: item, depth }) => (
|
|
111
|
+
<li data-depth={depth}>
|
|
112
|
+
<a
|
|
113
|
+
href={item.href}
|
|
114
|
+
aria-current={item.entry.id === entry.id ? "page" : undefined}
|
|
115
|
+
>
|
|
116
|
+
<Fragment set:html={labelHtml(item)} />
|
|
117
|
+
</a>
|
|
118
|
+
</li>
|
|
119
|
+
))}
|
|
120
|
+
</ul>
|
|
121
|
+
</section>
|
|
122
|
+
))
|
|
123
|
+
}
|
|
124
|
+
</nav>
|
|
125
|
+
</details>
|
|
115
126
|
<main>
|
|
116
127
|
<VersionBanner entry={entry} />
|
|
117
128
|
<h1 set:html={titleHtml(entry)} />
|
|
118
129
|
<Availability available={available} />
|
|
119
130
|
<Versions entry={entry} />
|
|
120
|
-
<
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
<
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
131
|
+
<div class="page">
|
|
132
|
+
{
|
|
133
|
+
headings.length > 0 && (
|
|
134
|
+
<nav aria-label="On this page">
|
|
135
|
+
<ul>
|
|
136
|
+
{headings.map((heading) => (
|
|
137
|
+
<li data-depth={heading.depth}>
|
|
138
|
+
<a href={`#${heading.slug}`}>{heading.text}</a>
|
|
139
|
+
</li>
|
|
140
|
+
))}
|
|
141
|
+
</ul>
|
|
142
|
+
</nav>
|
|
143
|
+
)
|
|
144
|
+
}
|
|
145
|
+
<article><slot /></article>
|
|
146
|
+
</div>
|
|
132
147
|
<nav aria-label="Previous and next">
|
|
133
148
|
{
|
|
134
149
|
previous && (
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The layout's styles: a readable column, the sidebar beside the page (a menu
|
|
3
|
+
* on a phone), the table of contents to one side, and both color schemes.
|
|
4
|
+
* They're yours to change, or to replace: delete this file and its import in
|
|
5
|
+
* src/layouts/Docs.astro, and the layout's markup still reads in order.
|
|
6
|
+
*
|
|
7
|
+
* Its colors and spaces are the element library's --ascribe-* properties, so
|
|
8
|
+
* a site that sets them restyles the layout and the elements together. The
|
|
9
|
+
* page's own background and text are the browser's, `Canvas` and
|
|
10
|
+
* `CanvasText`, light or dark as the reader's system is.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
:root {
|
|
14
|
+
color-scheme: light dark;
|
|
15
|
+
--docs-accent: var(--ascribe-tab-active-color);
|
|
16
|
+
--docs-sidebar-width: 16rem;
|
|
17
|
+
--docs-toc-width: 12rem;
|
|
18
|
+
--docs-measure: 46rem;
|
|
19
|
+
--docs-font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
|
20
|
+
--docs-font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
*,
|
|
24
|
+
*::before,
|
|
25
|
+
*::after {
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
body {
|
|
30
|
+
margin: 0;
|
|
31
|
+
background: Canvas;
|
|
32
|
+
color: CanvasText;
|
|
33
|
+
font-family: var(--docs-font);
|
|
34
|
+
line-height: 1.6;
|
|
35
|
+
overflow-wrap: break-word;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
a {
|
|
39
|
+
color: var(--docs-accent);
|
|
40
|
+
text-underline-offset: 0.15em;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
a:focus-visible,
|
|
44
|
+
summary:focus-visible {
|
|
45
|
+
outline: 2px solid var(--ascribe-tab-focus-color);
|
|
46
|
+
outline-offset: 2px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
h1,
|
|
50
|
+
h2,
|
|
51
|
+
h3,
|
|
52
|
+
h4 {
|
|
53
|
+
line-height: 1.25;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
h1 {
|
|
57
|
+
margin-block: 0 var(--ascribe-space-small);
|
|
58
|
+
font-size: 2rem;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
figure {
|
|
62
|
+
margin-inline: 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
img,
|
|
66
|
+
video,
|
|
67
|
+
svg {
|
|
68
|
+
max-width: 100%;
|
|
69
|
+
height: auto;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
code,
|
|
73
|
+
kbd,
|
|
74
|
+
pre,
|
|
75
|
+
samp {
|
|
76
|
+
font-family: var(--docs-font-mono);
|
|
77
|
+
font-size: 0.9em;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
pre {
|
|
81
|
+
overflow-x: auto;
|
|
82
|
+
padding: var(--ascribe-space);
|
|
83
|
+
border: var(--ascribe-border-width) solid var(--ascribe-border-color);
|
|
84
|
+
border-radius: var(--ascribe-radius);
|
|
85
|
+
line-height: 1.5;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* A wide table scrolls in its own box rather than widening the page. */
|
|
89
|
+
table {
|
|
90
|
+
display: block;
|
|
91
|
+
max-width: 100%;
|
|
92
|
+
overflow-x: auto;
|
|
93
|
+
border-collapse: collapse;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
th,
|
|
97
|
+
td {
|
|
98
|
+
padding: var(--ascribe-space-small);
|
|
99
|
+
border: var(--ascribe-border-width) solid var(--ascribe-border-color);
|
|
100
|
+
text-align: start;
|
|
101
|
+
vertical-align: top;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* The frame: the sidebar, then the page --------------------------------- */
|
|
105
|
+
|
|
106
|
+
body {
|
|
107
|
+
display: grid;
|
|
108
|
+
grid-template-columns: minmax(0, 1fr);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
main {
|
|
112
|
+
container-type: inline-size;
|
|
113
|
+
min-width: 0;
|
|
114
|
+
padding: var(--ascribe-space);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* The sidebar is in a <details>: a menu on a phone, and open beside the page
|
|
118
|
+
on a wider screen, where its toggle is hidden. */
|
|
119
|
+
.menu {
|
|
120
|
+
border-block-end: var(--ascribe-border-width) solid var(--ascribe-border-color);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.menu > summary {
|
|
124
|
+
padding: var(--ascribe-space-small) var(--ascribe-space);
|
|
125
|
+
font-weight: var(--ascribe-font-weight-strong);
|
|
126
|
+
cursor: pointer;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.menu > nav {
|
|
130
|
+
padding: 0 var(--ascribe-space) var(--ascribe-space);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
@media (min-width: 50rem) {
|
|
134
|
+
body {
|
|
135
|
+
grid-template-columns: var(--docs-sidebar-width) minmax(0, 1fr);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.menu {
|
|
139
|
+
position: sticky;
|
|
140
|
+
inset-block-start: 0;
|
|
141
|
+
align-self: start;
|
|
142
|
+
height: 100vh;
|
|
143
|
+
overflow-y: auto;
|
|
144
|
+
border-block-end: 0;
|
|
145
|
+
border-inline-end: var(--ascribe-border-width) solid var(--ascribe-border-color);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.menu > summary {
|
|
149
|
+
display: none;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.menu::details-content {
|
|
153
|
+
content-visibility: visible;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.menu > nav {
|
|
157
|
+
padding: var(--ascribe-space);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
main {
|
|
161
|
+
padding: calc(var(--ascribe-space) * 2);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/* The sidebar's groups and pages, each indented by its depth. */
|
|
166
|
+
nav[aria-label="Docs"] h2 {
|
|
167
|
+
margin: var(--ascribe-space) 0 var(--ascribe-space-small);
|
|
168
|
+
color: var(--ascribe-muted-color);
|
|
169
|
+
font-size: var(--ascribe-font-size-small);
|
|
170
|
+
letter-spacing: 0.04em;
|
|
171
|
+
text-transform: uppercase;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
nav[aria-label="Docs"] section:first-child h2 {
|
|
175
|
+
margin-block-start: 0;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
nav[aria-label="Docs"] ul,
|
|
179
|
+
nav[aria-label="On this page"] ul,
|
|
180
|
+
nav[aria-label="Versions"] ul {
|
|
181
|
+
margin: 0;
|
|
182
|
+
padding: 0;
|
|
183
|
+
list-style: none;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
nav[aria-label="Docs"] li {
|
|
187
|
+
margin-block: 0.125rem;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
nav[aria-label="Docs"] li[data-depth="1"] {
|
|
191
|
+
padding-inline-start: var(--ascribe-space);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
nav[aria-label="Docs"] li[data-depth="2"] {
|
|
195
|
+
padding-inline-start: calc(var(--ascribe-space) * 2);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
nav[aria-label="Docs"] a {
|
|
199
|
+
display: block;
|
|
200
|
+
padding: 0.125rem var(--ascribe-space-small);
|
|
201
|
+
border-radius: var(--ascribe-radius);
|
|
202
|
+
color: inherit;
|
|
203
|
+
text-decoration: none;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
nav[aria-label="Docs"] a:hover {
|
|
207
|
+
background: var(--ascribe-tab-hover-background);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
[aria-current="page"] {
|
|
211
|
+
color: var(--docs-accent);
|
|
212
|
+
font-weight: var(--ascribe-font-weight-strong);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
nav[aria-label="Docs"] a[aria-current="page"] {
|
|
216
|
+
color: var(--docs-accent);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/* The page: its column, and the table of contents beside it ------------- */
|
|
220
|
+
|
|
221
|
+
main > *,
|
|
222
|
+
.page {
|
|
223
|
+
max-width: var(--docs-measure);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
nav[aria-label="Versions"] ul {
|
|
227
|
+
display: flex;
|
|
228
|
+
flex-wrap: wrap;
|
|
229
|
+
gap: var(--ascribe-space-small) var(--ascribe-space);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
[data-version-banner] {
|
|
233
|
+
margin-block-end: var(--ascribe-space);
|
|
234
|
+
padding: var(--ascribe-space-small) var(--ascribe-space);
|
|
235
|
+
border-inline-start: 0.25rem solid var(--ascribe-warning-color);
|
|
236
|
+
border-radius: var(--ascribe-radius);
|
|
237
|
+
background: var(--ascribe-warning-background);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
[data-version-banner] p {
|
|
241
|
+
margin: 0;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/* The table of contents: a box above the article, and to its side where the
|
|
245
|
+
page is wide enough for both. */
|
|
246
|
+
nav[aria-label="On this page"] {
|
|
247
|
+
margin-block: var(--ascribe-space);
|
|
248
|
+
padding: var(--ascribe-space-small) var(--ascribe-space);
|
|
249
|
+
border: var(--ascribe-border-width) solid var(--ascribe-border-color);
|
|
250
|
+
border-radius: var(--ascribe-radius);
|
|
251
|
+
font-size: var(--ascribe-font-size-small);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
nav[aria-label="On this page"]::before {
|
|
255
|
+
content: "On this page";
|
|
256
|
+
display: block;
|
|
257
|
+
margin-block-end: 0.25rem;
|
|
258
|
+
color: var(--ascribe-muted-color);
|
|
259
|
+
font-weight: var(--ascribe-font-weight-strong);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
nav[aria-label="On this page"] li[data-depth="3"] {
|
|
263
|
+
padding-inline-start: var(--ascribe-space);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
nav[aria-label="On this page"] li[data-depth="4"] {
|
|
267
|
+
padding-inline-start: calc(var(--ascribe-space) * 2);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
nav[aria-label="On this page"] a {
|
|
271
|
+
color: inherit;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
@container (min-width: 52rem) {
|
|
275
|
+
.page {
|
|
276
|
+
display: grid;
|
|
277
|
+
grid-template-columns: minmax(0, var(--docs-measure)) var(--docs-toc-width);
|
|
278
|
+
column-gap: calc(var(--ascribe-space) * 2);
|
|
279
|
+
max-width: none;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.page > article {
|
|
283
|
+
grid-row: 1;
|
|
284
|
+
grid-column: 1;
|
|
285
|
+
min-width: 0;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
nav[aria-label="On this page"] {
|
|
289
|
+
position: sticky;
|
|
290
|
+
inset-block-start: var(--ascribe-space);
|
|
291
|
+
grid-column: 2;
|
|
292
|
+
align-self: start;
|
|
293
|
+
margin-block: 0;
|
|
294
|
+
padding: 0 0 0 var(--ascribe-space);
|
|
295
|
+
border-width: 0 0 0 var(--ascribe-border-width);
|
|
296
|
+
border-radius: 0;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/* Previous and next: two links apart, the next at the end. */
|
|
301
|
+
nav[aria-label="Previous and next"] {
|
|
302
|
+
display: flex;
|
|
303
|
+
flex-wrap: wrap;
|
|
304
|
+
gap: var(--ascribe-space);
|
|
305
|
+
margin-block-start: calc(var(--ascribe-space) * 2);
|
|
306
|
+
padding-block-start: var(--ascribe-space);
|
|
307
|
+
border-block-start: var(--ascribe-border-width) solid var(--ascribe-border-color);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
nav[aria-label="Previous and next"] a {
|
|
311
|
+
flex: 1 1 14rem;
|
|
312
|
+
padding: var(--ascribe-space-small) var(--ascribe-space);
|
|
313
|
+
border: var(--ascribe-border-width) solid var(--ascribe-border-color);
|
|
314
|
+
border-radius: var(--ascribe-radius);
|
|
315
|
+
text-decoration: none;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
nav[aria-label="Previous and next"] a:hover {
|
|
319
|
+
border-color: var(--docs-accent);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
nav[aria-label="Previous and next"] a[rel="next"] {
|
|
323
|
+
text-align: end;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
nav[aria-label="Previous and next"] a[rel="next"]:only-child {
|
|
327
|
+
margin-inline-start: auto;
|
|
328
|
+
flex-grow: 0;
|
|
329
|
+
}
|