@hagicode/hagilight-core 0.19.1-dev.185.1.a85e2a8 → 0.19.1-dev.189.1.6e24429
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/Footer.astro +225 -80
- package/README.md +9 -0
- package/dist/footer-columns.d.ts +63 -0
- package/dist/footer-columns.js +78 -0
- package/dist/links.d.ts +12 -0
- package/dist/links.js +47 -3
- package/package.json +1 -1
package/Footer.astro
CHANGED
|
@@ -50,70 +50,60 @@ const resolvedLinks = resolveSiteLinks(locale, {
|
|
|
50
50
|
siteUrl={siteUrl}
|
|
51
51
|
/>
|
|
52
52
|
<div class="hagilight-footer__sections">
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
<
|
|
56
|
-
|
|
53
|
+
<div class="hagilight-cols">
|
|
54
|
+
{resolvedLinks.columns.map((column, index) => (
|
|
55
|
+
<nav
|
|
56
|
+
class="hagilight-col"
|
|
57
|
+
data-column={column.id}
|
|
58
|
+
style={`--hagilight-col-i: ${index}`}
|
|
59
|
+
aria-labelledby={`hagilight-col-${column.id}`}
|
|
60
|
+
>
|
|
61
|
+
<h2 id={`hagilight-col-${column.id}`}>{resolvedLinks.labels.columns[column.id]}</h2>
|
|
57
62
|
<ul>
|
|
58
|
-
{
|
|
63
|
+
{column.entries.map((entry) => (
|
|
59
64
|
<li>
|
|
60
|
-
<a
|
|
65
|
+
<a
|
|
66
|
+
href={entry.href}
|
|
67
|
+
target={entry.target}
|
|
68
|
+
rel={entry.rel}
|
|
69
|
+
aria-label={entry.ariaLabel}
|
|
70
|
+
{...(entry.source === 'link' ? siteLinkGaAttributes(entry, 'footer') : {})}
|
|
71
|
+
>{entry.label}</a>
|
|
61
72
|
</li>
|
|
62
73
|
))}
|
|
63
74
|
</ul>
|
|
64
75
|
</nav>
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
<section>
|
|
68
|
-
<h2>{resolvedLinks.labels.quickLinks}</h2>
|
|
69
|
-
<nav aria-label={resolvedLinks.labels.navigation.quickLinks}>
|
|
70
|
-
<ul>
|
|
71
|
-
{resolvedLinks.quick.map((link) => (
|
|
72
|
-
<li>
|
|
73
|
-
<a
|
|
74
|
-
href={link.href}
|
|
75
|
-
target={link.target}
|
|
76
|
-
rel={link.rel}
|
|
77
|
-
aria-label={link.ariaLabel}
|
|
78
|
-
{...siteLinkGaAttributes(link, 'footer')}
|
|
79
|
-
>{link.label}</a>
|
|
80
|
-
</li>
|
|
81
|
-
))}
|
|
82
|
-
</ul>
|
|
83
|
-
</nav>
|
|
84
|
-
</section>
|
|
85
|
-
<section>
|
|
86
|
-
<h2>{resolvedLinks.labels.community}</h2>
|
|
87
|
-
<nav aria-label={resolvedLinks.labels.navigation.community}>
|
|
88
|
-
<ul>
|
|
89
|
-
{resolvedLinks.community.map((link) => (
|
|
90
|
-
<li>
|
|
91
|
-
<a
|
|
92
|
-
href={link.href}
|
|
93
|
-
target={link.target}
|
|
94
|
-
rel={link.rel}
|
|
95
|
-
aria-label={link.ariaLabel}
|
|
96
|
-
{...siteLinkGaAttributes(link, 'footer')}
|
|
97
|
-
>{link.label}</a>
|
|
98
|
-
</li>
|
|
99
|
-
))}
|
|
100
|
-
</ul>
|
|
101
|
-
</nav>
|
|
102
|
-
</section>
|
|
76
|
+
))}
|
|
77
|
+
</div>
|
|
103
78
|
</div>
|
|
104
|
-
<
|
|
105
|
-
{resolvedLinks.
|
|
106
|
-
<
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
79
|
+
<div class="hagilight-footer__base">
|
|
80
|
+
{resolvedLinks.feeds.length > 0 && (
|
|
81
|
+
<nav class="hagilight-footer__feeds" aria-label={resolvedLinks.labels.navigation.feeds}>
|
|
82
|
+
{resolvedLinks.feeds.map((link) => (
|
|
83
|
+
<a
|
|
84
|
+
href={link.href}
|
|
85
|
+
target={link.target}
|
|
86
|
+
rel={link.rel}
|
|
87
|
+
aria-label={link.ariaLabel}
|
|
88
|
+
{...siteLinkGaAttributes(link, 'footer')}
|
|
89
|
+
>{link.label}</a>
|
|
90
|
+
))}
|
|
91
|
+
</nav>
|
|
115
92
|
)}
|
|
116
|
-
|
|
93
|
+
<nav class="hagilight-footer__filings" aria-label={resolvedLinks.labels.navigation.filings}>
|
|
94
|
+
{resolvedLinks.filings.map((link) => (
|
|
95
|
+
<a
|
|
96
|
+
href={link.href}
|
|
97
|
+
target={link.target}
|
|
98
|
+
rel={link.rel}
|
|
99
|
+
aria-label={link.ariaLabel}
|
|
100
|
+
>{link.label}</a>
|
|
101
|
+
))}
|
|
102
|
+
{consent && (
|
|
103
|
+
<button type="button" class="hagilight-footer__consent" data-consent-preferences>{consentCopy.footerEntry}</button>
|
|
104
|
+
)}
|
|
105
|
+
</nav>
|
|
106
|
+
</div>
|
|
117
107
|
<p class="hagilight-footer__copyright">
|
|
118
108
|
<Copyright name="HagiCode" />
|
|
119
109
|
{Astro.slots.has('attribution') && (
|
|
@@ -144,19 +134,17 @@ const resolvedLinks = resolveSiteLinks(locale, {
|
|
|
144
134
|
}
|
|
145
135
|
|
|
146
136
|
.hagilight-footer__sections {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
gap: 1.5rem;
|
|
150
|
-
margin: 0 auto 1.5rem;
|
|
137
|
+
container: hagilight-cols / inline-size;
|
|
138
|
+
margin: 0 auto 1.75rem;
|
|
151
139
|
max-width: 72rem;
|
|
152
140
|
}
|
|
153
141
|
|
|
154
|
-
.hagilight-
|
|
155
|
-
|
|
142
|
+
.hagilight-footer__base {
|
|
143
|
+
margin: 0 auto;
|
|
144
|
+
max-width: 72rem;
|
|
156
145
|
}
|
|
157
146
|
|
|
158
147
|
.hagilight-footer h2 {
|
|
159
|
-
margin: 0 0 0.75rem;
|
|
160
148
|
font-size: 0.95rem;
|
|
161
149
|
font-weight: 650;
|
|
162
150
|
}
|
|
@@ -196,16 +184,6 @@ const resolvedLinks = resolveSiteLinks(locale, {
|
|
|
196
184
|
cursor: pointer;
|
|
197
185
|
}
|
|
198
186
|
|
|
199
|
-
.hagilight-footer__filings {
|
|
200
|
-
display: flex;
|
|
201
|
-
flex-wrap: wrap;
|
|
202
|
-
justify-content: center;
|
|
203
|
-
gap: 0.75rem 1.5rem;
|
|
204
|
-
border-top: 1px solid var(--hagilight-footer-border, currentColor);
|
|
205
|
-
padding-top: 1rem;
|
|
206
|
-
text-align: center;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
187
|
.hagilight-footer__copyright {
|
|
210
188
|
margin: 1rem 0 0;
|
|
211
189
|
font-size: 0.8rem;
|
|
@@ -220,15 +198,182 @@ const resolvedLinks = resolveSiteLinks(locale, {
|
|
|
220
198
|
overflow-wrap: anywhere;
|
|
221
199
|
}
|
|
222
200
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
201
|
+
/* Footer columns: four level, purpose-based columns. Each column owns a rule that
|
|
202
|
+
draws in as it scrolls into view and runs the full width while the column is
|
|
203
|
+
used; the other columns' headings step back. */
|
|
204
|
+
.hagilight-cols,
|
|
205
|
+
.hagilight-footer__base {
|
|
206
|
+
--_accent: var(--hagilight-footer-accent, var(--sl-color-accent, var(--ifm-color-primary, currentColor)));
|
|
207
|
+
--_track: var(--hagilight-footer-border, color-mix(in srgb, currentColor 26%, transparent));
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.hagilight-cols {
|
|
211
|
+
--_ease: cubic-bezier(0.16, 1, 0.3, 1);
|
|
212
|
+
display: grid;
|
|
213
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
214
|
+
gap: 1.75rem 1.5rem;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
@container hagilight-cols (max-width: 19rem) {
|
|
218
|
+
.hagilight-cols { grid-template-columns: minmax(0, 1fr); }
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
@container hagilight-cols (min-width: 40rem) {
|
|
222
|
+
.hagilight-cols { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 2.25rem; }
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.hagilight-col {
|
|
226
|
+
--_seg: 0.12;
|
|
227
|
+
position: relative;
|
|
228
|
+
min-width: 0;
|
|
229
|
+
padding-top: 1.125rem;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.hagilight-col::before,
|
|
233
|
+
.hagilight-col::after {
|
|
234
|
+
content: '';
|
|
235
|
+
position: absolute;
|
|
236
|
+
inset: 0 0 auto;
|
|
237
|
+
height: 1px;
|
|
238
|
+
pointer-events: none;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.hagilight-col::before { background: var(--_track); }
|
|
242
|
+
|
|
243
|
+
.hagilight-col::after {
|
|
244
|
+
height: 2px;
|
|
245
|
+
margin-top: -0.5px;
|
|
246
|
+
background: var(--_accent);
|
|
247
|
+
transform-origin: left center;
|
|
248
|
+
scale: var(--_seg) 1;
|
|
249
|
+
transition: scale 0.6s var(--_ease);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.hagilight-col h2 {
|
|
253
|
+
margin: 0 0 0.875rem;
|
|
254
|
+
transition: opacity 0.3s ease-out;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.hagilight-col ul { gap: 0.4rem; }
|
|
258
|
+
|
|
259
|
+
.hagilight-col a {
|
|
260
|
+
position: relative;
|
|
261
|
+
display: inline-block;
|
|
262
|
+
padding-block: 0.125rem;
|
|
263
|
+
text-decoration: underline;
|
|
264
|
+
text-decoration-color: transparent;
|
|
265
|
+
text-decoration-thickness: 1px;
|
|
266
|
+
text-underline-offset: 0.25em;
|
|
267
|
+
transition: text-decoration-color 0.25s ease-out;
|
|
268
|
+
-webkit-tap-highlight-color: transparent;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/* The link's own rule draws in the gutter, so a hover never reflows the label. */
|
|
272
|
+
.hagilight-col a::before {
|
|
273
|
+
content: '';
|
|
274
|
+
position: absolute;
|
|
275
|
+
top: 0.82em;
|
|
276
|
+
left: -0.95rem;
|
|
277
|
+
width: 0.7rem;
|
|
278
|
+
height: 1px;
|
|
279
|
+
background: var(--_accent);
|
|
280
|
+
transform-origin: left center;
|
|
281
|
+
scale: 0 1;
|
|
282
|
+
transition: scale 0.35s var(--_ease);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.hagilight-col a[target='_blank']::after {
|
|
286
|
+
/* Joined to the last word by no-break spaces, so the arrow never wraps onto a line of its own. */
|
|
287
|
+
content: '\00a0\00a0\00a0';
|
|
288
|
+
background: currentColor;
|
|
289
|
+
opacity: 0.5;
|
|
290
|
+
-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 11.5l7-7M5.5 4.5h6v6' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right center / 0.62em 0.62em no-repeat;
|
|
291
|
+
mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 11.5l7-7M5.5 4.5h6v6' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right center / 0.62em 0.62em no-repeat;
|
|
292
|
+
transition: mask-position 0.3s var(--_ease), opacity 0.3s ease-out;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.hagilight-col a:is(:hover, :focus-visible) { text-decoration-color: currentColor; }
|
|
296
|
+
.hagilight-col a:is(:hover, :focus-visible)::before { scale: 1 1; }
|
|
297
|
+
.hagilight-col a[target='_blank']:is(:hover, :focus-visible)::after {
|
|
298
|
+
opacity: 0.9;
|
|
299
|
+
-webkit-mask-position: calc(100% + 0.1em) calc(50% - 0.1em);
|
|
300
|
+
mask-position: calc(100% + 0.1em) calc(50% - 0.1em);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.hagilight-col:is(:hover, :focus-within) { --_seg: 1; }
|
|
304
|
+
|
|
305
|
+
@media (hover: hover) {
|
|
306
|
+
.hagilight-cols:has(.hagilight-col:is(:hover, :focus-within)) .hagilight-col:not(:hover, :focus-within) h2 {
|
|
307
|
+
opacity: 0.5;
|
|
227
308
|
}
|
|
309
|
+
}
|
|
228
310
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
311
|
+
.hagilight-cols ::selection,
|
|
312
|
+
.hagilight-footer__base ::selection {
|
|
313
|
+
background: color-mix(in srgb, var(--_accent) 34%, transparent);
|
|
314
|
+
color: inherit;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/* The one authored moment: columns rise out of a blur, one after another, as the footer scrolls in.
|
|
318
|
+
Without scroll-driven animation support, or under reduced motion, the columns are simply there. */
|
|
319
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
320
|
+
@supports (animation-timeline: view()) {
|
|
321
|
+
.hagilight-col {
|
|
322
|
+
animation-name: hagilight-col-in;
|
|
323
|
+
animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
|
|
324
|
+
animation-fill-mode: both;
|
|
325
|
+
animation-timeline: view();
|
|
326
|
+
animation-range: entry calc(var(--hagilight-col-i, 0) * 6%) entry calc(46% + var(--hagilight-col-i, 0) * 6%);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.hagilight-col::after {
|
|
330
|
+
animation-name: hagilight-col-rule;
|
|
331
|
+
animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
|
|
332
|
+
animation-fill-mode: both;
|
|
333
|
+
animation-timeline: view();
|
|
334
|
+
animation-range: entry calc(var(--hagilight-col-i, 0) * 6%) entry calc(60% + var(--hagilight-col-i, 0) * 6%);
|
|
335
|
+
}
|
|
232
336
|
}
|
|
233
337
|
}
|
|
338
|
+
|
|
339
|
+
@keyframes hagilight-col-in {
|
|
340
|
+
from { opacity: 0; translate: 0 1.25rem; filter: blur(6px); }
|
|
341
|
+
to { opacity: 1; translate: 0 0; filter: blur(0); }
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
@keyframes hagilight-col-rule {
|
|
345
|
+
from { clip-path: inset(0 100% 0 0); }
|
|
346
|
+
to { clip-path: inset(0 0 0 0); }
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/* The bottom row: feeds on the start side, filings on the end side. */
|
|
350
|
+
.hagilight-footer__base {
|
|
351
|
+
display: flex;
|
|
352
|
+
flex-wrap: wrap;
|
|
353
|
+
align-items: baseline;
|
|
354
|
+
justify-content: space-between;
|
|
355
|
+
gap: 0.75rem 2rem;
|
|
356
|
+
border-top: 1px solid var(--_track);
|
|
357
|
+
padding-top: 1rem;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
.hagilight-footer__feeds,
|
|
361
|
+
.hagilight-footer__filings {
|
|
362
|
+
display: flex;
|
|
363
|
+
flex-wrap: wrap;
|
|
364
|
+
gap: 0.5rem 1.25rem;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.hagilight-footer__feeds a,
|
|
368
|
+
.hagilight-footer__filings a {
|
|
369
|
+
text-decoration: underline;
|
|
370
|
+
text-decoration-color: transparent;
|
|
371
|
+
text-decoration-thickness: 1px;
|
|
372
|
+
text-underline-offset: 0.25em;
|
|
373
|
+
transition: text-decoration-color 0.25s ease-out;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.hagilight-footer__feeds a:is(:hover, :focus-visible),
|
|
377
|
+
.hagilight-footer__filings a:is(:hover, :focus-visible) { text-decoration-color: currentColor; }
|
|
378
|
+
|
|
234
379
|
</style>
|
package/README.md
CHANGED
|
@@ -496,6 +496,15 @@ resolveSiteLinks('en-US', { siteId: 'docs' });
|
|
|
496
496
|
- Tags are added after deduplication, so a tagged and a clean destination still collapse into one entry. `normalizeUrl` is unchanged. Canonical URLs, `og:url` and sitemap entries are built from page URLs and never contain `utm_*`.
|
|
497
497
|
- Footer clicks report the tagged `href` as `link_url` in the GA click event. The `link_url` dimension therefore includes `utm_source` and `utm_medium` for first-party footer clicks. No new event parameter is added.
|
|
498
498
|
|
|
499
|
+
### Footer columns
|
|
500
|
+
|
|
501
|
+
`resolveSiteLinks` still returns `quick`, `community` and `relatedSites` as before, and adds two regrouped views that every footer renders:
|
|
502
|
+
|
|
503
|
+
- `columns`: four level, purpose-based columns in page order, `start` (get started), `learn` (docs and learning), `build` (tools and resources) and `community` (community and support), each `{ id, entries }`. Entries are `{ id, source: 'link' | 'site', label, href, target?, rel?, ariaLabel? }`; `source` tells a view whether the entry may report a GA click event (only `link` entries can). Placement is by id (`src/footer-columns.ts`); an entry the map does not know stays visible: an extra `quick` link joins `start`, an extra `community` link joins `community`, and any other site joins the shortest column. A column with no entries is dropped.
|
|
504
|
+
- `feeds`: the RSS, locale RSS and sitemap links, shown in the footer's bottom row beside the filings instead of in a column.
|
|
505
|
+
|
|
506
|
+
Localized headings are `labels.columns.<id>` and the feeds navigation label is `labels.navigation.feeds`. The footers draw each column's top rule as it scrolls into view (scroll-driven, with a static fallback and no motion under `prefers-reduced-motion`), run the rule across the column while it is hovered or focused, and step the other headings back. A site can tint the rule with `--hagilight-footer-accent`; it falls back to `--sl-color-accent`, then `--ifm-color-primary`, then the text color.
|
|
507
|
+
|
|
499
508
|
### Options
|
|
500
509
|
|
|
501
510
|
- `links.siteId` (Starlight, Docusaurus, and the `Footer`/`Header` components) enables footer tags. The Starlight and Docusaurus promotion banners read this same value.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regroups the footer's catalog links and ecosystem sites into balanced,
|
|
3
|
+
* purpose-based columns.
|
|
4
|
+
*
|
|
5
|
+
* The three source lists (`quick`, `community`, `relatedSites`) stay the public
|
|
6
|
+
* contract of `resolveSiteLinks`; this module only decides where each entry is
|
|
7
|
+
* shown, so a site that removes, replaces or adds links keeps working. Feed and
|
|
8
|
+
* sitemap links are machine-facing, so they leave the columns and sit in the
|
|
9
|
+
* footer's bottom row.
|
|
10
|
+
*/
|
|
11
|
+
export declare const FOOTER_COLUMN_IDS: readonly ["start", "learn", "build", "community"];
|
|
12
|
+
export type FooterColumnId = (typeof FOOTER_COLUMN_IDS)[number];
|
|
13
|
+
/** Catalog ids that leave the columns for the bottom row. */
|
|
14
|
+
export declare const FOOTER_FEED_IDS: readonly string[];
|
|
15
|
+
export type FooterEntrySource = 'link' | 'site';
|
|
16
|
+
/** One link as a footer view renders it. */
|
|
17
|
+
export interface FooterColumnEntry {
|
|
18
|
+
id: string;
|
|
19
|
+
/** `link` entries come from the catalog or `extraLinks` and may report GA click events; `site` entries never do. */
|
|
20
|
+
source: FooterEntrySource;
|
|
21
|
+
label: string;
|
|
22
|
+
href: string;
|
|
23
|
+
target?: '_blank';
|
|
24
|
+
rel?: string;
|
|
25
|
+
ariaLabel?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface FooterColumn {
|
|
28
|
+
id: FooterColumnId;
|
|
29
|
+
entries: FooterColumnEntry[];
|
|
30
|
+
}
|
|
31
|
+
interface LinkLike {
|
|
32
|
+
id: string;
|
|
33
|
+
label: string;
|
|
34
|
+
href: string;
|
|
35
|
+
target?: '_blank';
|
|
36
|
+
rel?: string;
|
|
37
|
+
ariaLabel?: string;
|
|
38
|
+
}
|
|
39
|
+
interface SiteLike {
|
|
40
|
+
id: string;
|
|
41
|
+
name: string;
|
|
42
|
+
href: string;
|
|
43
|
+
target?: '_blank';
|
|
44
|
+
rel?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface FooterColumnInput {
|
|
47
|
+
quick: readonly LinkLike[];
|
|
48
|
+
community: readonly LinkLike[];
|
|
49
|
+
relatedSites: readonly SiteLike[];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Returns the non-empty columns in page order, plus the feed links.
|
|
53
|
+
*
|
|
54
|
+
* An entry the curated map does not know (a consumer's extra link, a custom
|
|
55
|
+
* ecosystem site, a future catalog entry) still shows: extra quick links join
|
|
56
|
+
* `start`, extra community links join `community`, and any other site joins the
|
|
57
|
+
* shortest column, so the columns stay level without anyone editing this file.
|
|
58
|
+
*/
|
|
59
|
+
export declare function groupFooterColumns(input: FooterColumnInput): {
|
|
60
|
+
columns: FooterColumn[];
|
|
61
|
+
feeds: FooterColumnEntry[];
|
|
62
|
+
};
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regroups the footer's catalog links and ecosystem sites into balanced,
|
|
3
|
+
* purpose-based columns.
|
|
4
|
+
*
|
|
5
|
+
* The three source lists (`quick`, `community`, `relatedSites`) stay the public
|
|
6
|
+
* contract of `resolveSiteLinks`; this module only decides where each entry is
|
|
7
|
+
* shown, so a site that removes, replaces or adds links keeps working. Feed and
|
|
8
|
+
* sitemap links are machine-facing, so they leave the columns and sit in the
|
|
9
|
+
* footer's bottom row.
|
|
10
|
+
*/
|
|
11
|
+
export const FOOTER_COLUMN_IDS = ['start', 'learn', 'build', 'community'];
|
|
12
|
+
/** Catalog ids that leave the columns for the bottom row. */
|
|
13
|
+
export const FOOTER_FEED_IDS = ['rss', 'rssLocale', 'sitemap'];
|
|
14
|
+
/**
|
|
15
|
+
* Curated placement by id; the order here is the order on the page. Link ids and
|
|
16
|
+
* ecosystem site ids share one namespace on purpose: they never collide.
|
|
17
|
+
*/
|
|
18
|
+
const ASSIGNMENT = {
|
|
19
|
+
start: ['downloadClient', 'microsoftStore', 'dockerCompose', 'productDocs', 'about', 'hagicode-main'],
|
|
20
|
+
learn: [
|
|
21
|
+
'blogPosts', 'openspec-docs', 'omniroute-docs', 'fullstack-tutorial',
|
|
22
|
+
'impeccable-site', 'awesome-sites', 'awesome-design-gallery',
|
|
23
|
+
],
|
|
24
|
+
build: ['hagitask', 'compose-builder', 'soul-builder', 'trait-builder', 'costCalculator', 'gallery', 'index-data'],
|
|
25
|
+
community: ['github', 'discord', 'issueFeedback', 'contactEmail', 'qqGroup', 'newbe-blog', 'status-page'],
|
|
26
|
+
};
|
|
27
|
+
function fromLink(link) {
|
|
28
|
+
const { id, label, href, target, rel, ariaLabel } = link;
|
|
29
|
+
return { id, source: 'link', label, href, ...(target ? { target } : {}), ...(rel ? { rel } : {}), ...(ariaLabel ? { ariaLabel } : {}) };
|
|
30
|
+
}
|
|
31
|
+
function fromSite(site) {
|
|
32
|
+
const { id, name, href, target, rel } = site;
|
|
33
|
+
return { id, source: 'site', label: name, href, ...(target ? { target } : {}), ...(rel ? { rel } : {}) };
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Returns the non-empty columns in page order, plus the feed links.
|
|
37
|
+
*
|
|
38
|
+
* An entry the curated map does not know (a consumer's extra link, a custom
|
|
39
|
+
* ecosystem site, a future catalog entry) still shows: extra quick links join
|
|
40
|
+
* `start`, extra community links join `community`, and any other site joins the
|
|
41
|
+
* shortest column, so the columns stay level without anyone editing this file.
|
|
42
|
+
*/
|
|
43
|
+
export function groupFooterColumns(input) {
|
|
44
|
+
const isFeed = (link) => FOOTER_FEED_IDS.includes(link.id);
|
|
45
|
+
const feeds = input.quick.filter(isFeed).map(fromLink);
|
|
46
|
+
const slots = new Map();
|
|
47
|
+
for (const columnId of FOOTER_COLUMN_IDS) {
|
|
48
|
+
for (const id of ASSIGNMENT[columnId])
|
|
49
|
+
slots.set(id, columnId);
|
|
50
|
+
}
|
|
51
|
+
const columns = FOOTER_COLUMN_IDS.map((id) => ({ id, entries: [] }));
|
|
52
|
+
const unplaced = [];
|
|
53
|
+
const place = (entry, fallback) => {
|
|
54
|
+
const columnId = slots.get(entry.id);
|
|
55
|
+
if (columnId)
|
|
56
|
+
columns.find((column) => column.id === columnId)?.entries.push(entry);
|
|
57
|
+
else
|
|
58
|
+
unplaced.push({ entry, fallback });
|
|
59
|
+
};
|
|
60
|
+
for (const link of input.quick)
|
|
61
|
+
if (!isFeed(link))
|
|
62
|
+
place(fromLink(link), 'start');
|
|
63
|
+
for (const link of input.community)
|
|
64
|
+
place(fromLink(link), 'community');
|
|
65
|
+
for (const site of input.relatedSites)
|
|
66
|
+
place(fromSite(site));
|
|
67
|
+
// Curated order wins inside a column; the sort is stable, so entries sharing a slot keep their arrival order.
|
|
68
|
+
const rank = (columnId, id) => ASSIGNMENT[columnId].indexOf(id);
|
|
69
|
+
for (const column of columns)
|
|
70
|
+
column.entries.sort((a, b) => rank(column.id, a.id) - rank(column.id, b.id));
|
|
71
|
+
for (const { entry, fallback } of unplaced) {
|
|
72
|
+
const target = fallback
|
|
73
|
+
? columns.find((column) => column.id === fallback)
|
|
74
|
+
: columns.reduce((shortest, column) => (column.entries.length < shortest.entries.length ? column : shortest));
|
|
75
|
+
target?.entries.push(entry);
|
|
76
|
+
}
|
|
77
|
+
return { columns: columns.filter((column) => column.entries.length > 0), feeds };
|
|
78
|
+
}
|
package/dist/links.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { LinkRel } from './link-policy.js';
|
|
2
|
+
export type { FooterColumn, FooterColumnEntry, FooterColumnId } from './footer-columns.js';
|
|
2
3
|
export { classifyLink, getLinkRel, withCampaignUtm } from './link-policy.js';
|
|
3
4
|
export type { CampaignMedium, CampaignTagOptions, ClassifyLinkOptions, LinkClass, LinkRel, } from './link-policy.js';
|
|
4
5
|
export type SiteLinkKey = 'home' | 'blog' | 'support' | 'downloadClient' | 'about' | 'dockerCompose' | 'productDocs' | 'blogPosts' | 'sitemap' | 'rss' | 'rssLocale' | 'costCalculator' | 'github' | 'discord' | 'issueFeedback' | 'contactEmail' | 'qqGroup' | 'microsoftStore' | 'icpFiling' | 'publicSecurityFiling';
|
|
@@ -50,7 +51,14 @@ export declare function resolveSiteLinks(localeInput?: string | null, options?:
|
|
|
50
51
|
relatedSites: string;
|
|
51
52
|
quickLinks: string;
|
|
52
53
|
community: string;
|
|
54
|
+
columns: {
|
|
55
|
+
start: string;
|
|
56
|
+
learn: string;
|
|
57
|
+
build: string;
|
|
58
|
+
community: string;
|
|
59
|
+
};
|
|
53
60
|
navigation: {
|
|
61
|
+
feeds: string;
|
|
54
62
|
relatedSites: string;
|
|
55
63
|
quickLinks: string;
|
|
56
64
|
community: string;
|
|
@@ -75,4 +83,8 @@ export declare function resolveSiteLinks(localeInput?: string | null, options?:
|
|
|
75
83
|
} & {
|
|
76
84
|
untaggedHref?: string;
|
|
77
85
|
})[];
|
|
86
|
+
/** The same entries as `quick`, `community` and `relatedSites`, regrouped into balanced columns by purpose. */
|
|
87
|
+
columns: import("./footer-columns.js").FooterColumn[];
|
|
88
|
+
/** RSS and sitemap links, shown in the footer's bottom row instead of a column. */
|
|
89
|
+
feeds: import("./footer-columns.js").FooterColumnEntry[];
|
|
78
90
|
};
|
package/dist/links.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import docsRelatedSites from './related-sites.json' with { type: 'json' };
|
|
2
2
|
import { classifyLink, getLinkRel, withCampaignUtm } from './link-policy.js';
|
|
3
|
+
import { groupFooterColumns } from './footer-columns.js';
|
|
3
4
|
export { classifyLink, getLinkRel, withCampaignUtm } from './link-policy.js';
|
|
4
5
|
const translations = {
|
|
5
6
|
home: {
|
|
@@ -370,6 +371,14 @@ export function resolveSiteLinks(localeInput, options = {}) {
|
|
|
370
371
|
untaggedHref: link.href,
|
|
371
372
|
}
|
|
372
373
|
: link);
|
|
374
|
+
const taggedQuick = resolvedGroups.quick.map(tag);
|
|
375
|
+
const taggedCommunity = resolvedGroups.community.map(tag);
|
|
376
|
+
const taggedRelated = relatedSites.map(tag);
|
|
377
|
+
const { columns, feeds } = groupFooterColumns({
|
|
378
|
+
quick: taggedQuick,
|
|
379
|
+
community: taggedCommunity,
|
|
380
|
+
relatedSites: taggedRelated,
|
|
381
|
+
});
|
|
373
382
|
return {
|
|
374
383
|
locale,
|
|
375
384
|
labels: {
|
|
@@ -392,7 +401,38 @@ export function resolveSiteLinks(localeInput, options = {}) {
|
|
|
392
401
|
'fr-FR': 'Communauté', 'es-ES': 'Comunidad',
|
|
393
402
|
'pt-BR': 'Comunidade', 'ru-RU': 'Сообщество',
|
|
394
403
|
}, locale, 'Community'),
|
|
404
|
+
columns: {
|
|
405
|
+
start: resolveLocalized({
|
|
406
|
+
'zh-CN': '开始使用', 'zh-Hant': '開始使用', 'en-US': 'Get Started',
|
|
407
|
+
'ja-JP': 'はじめる', 'ko-KR': '시작하기', 'de-DE': 'Loslegen',
|
|
408
|
+
'fr-FR': 'Démarrer', 'es-ES': 'Empezar', 'pt-BR': 'Começar', 'ru-RU': 'Начать',
|
|
409
|
+
}, locale, 'Get Started'),
|
|
410
|
+
learn: resolveLocalized({
|
|
411
|
+
'zh-CN': '学习与文档', 'zh-Hant': '學習與文件', 'en-US': 'Learn & Docs',
|
|
412
|
+
'ja-JP': '学ぶ・ドキュメント', 'ko-KR': '학습 및 문서', 'de-DE': 'Lernen & Doku',
|
|
413
|
+
'fr-FR': 'Apprendre & docs', 'es-ES': 'Aprender y docs', 'pt-BR': 'Aprender e docs',
|
|
414
|
+
'ru-RU': 'Обучение и документация',
|
|
415
|
+
}, locale, 'Learn & Docs'),
|
|
416
|
+
build: resolveLocalized({
|
|
417
|
+
'zh-CN': '工具与资源', 'zh-Hant': '工具與資源', 'en-US': 'Tools & Resources',
|
|
418
|
+
'ja-JP': 'ツールとリソース', 'ko-KR': '도구 및 리소스', 'de-DE': 'Tools & Ressourcen',
|
|
419
|
+
'fr-FR': 'Outils & ressources', 'es-ES': 'Herramientas y recursos',
|
|
420
|
+
'pt-BR': 'Ferramentas e recursos', 'ru-RU': 'Инструменты и ресурсы',
|
|
421
|
+
}, locale, 'Tools & Resources'),
|
|
422
|
+
community: resolveLocalized({
|
|
423
|
+
'zh-CN': '社区与支持', 'zh-Hant': '社群與支援', 'en-US': 'Community & Support',
|
|
424
|
+
'ja-JP': 'コミュニティとサポート', 'ko-KR': '커뮤니티 및 지원', 'de-DE': 'Community & Support',
|
|
425
|
+
'fr-FR': 'Communauté & assistance', 'es-ES': 'Comunidad y soporte',
|
|
426
|
+
'pt-BR': 'Comunidade e suporte', 'ru-RU': 'Сообщество и поддержка',
|
|
427
|
+
}, locale, 'Community & Support'),
|
|
428
|
+
},
|
|
395
429
|
navigation: {
|
|
430
|
+
feeds: resolveLocalized({
|
|
431
|
+
'zh-CN': '订阅与站点地图', 'zh-Hant': '訂閱與網站地圖', 'en-US': 'Feeds and sitemap',
|
|
432
|
+
'ja-JP': '配信とサイトマップ', 'ko-KR': '구독 및 사이트맵', 'de-DE': 'Feeds und Sitemap',
|
|
433
|
+
'fr-FR': 'Flux et plan du site', 'es-ES': 'Feeds y mapa del sitio',
|
|
434
|
+
'pt-BR': 'Feeds e mapa do site', 'ru-RU': 'Ленты и карта сайта',
|
|
435
|
+
}, locale, 'Feeds and sitemap'),
|
|
396
436
|
relatedSites: resolveLocalized({
|
|
397
437
|
'zh-CN': '生态站点链接', 'zh-Hant': '生態站點連結', 'en-US': 'Ecosystem site links',
|
|
398
438
|
'ja-JP': 'エコシステムサイトへのリンク', 'ko-KR': '에코시스템 사이트 링크',
|
|
@@ -423,9 +463,13 @@ export function resolveSiteLinks(localeInput, options = {}) {
|
|
|
423
463
|
},
|
|
424
464
|
},
|
|
425
465
|
header: resolvedGroups.header,
|
|
426
|
-
quick:
|
|
427
|
-
community:
|
|
466
|
+
quick: taggedQuick,
|
|
467
|
+
community: taggedCommunity,
|
|
428
468
|
filings: resolvedGroups.filings,
|
|
429
|
-
relatedSites:
|
|
469
|
+
relatedSites: taggedRelated,
|
|
470
|
+
/** The same entries as `quick`, `community` and `relatedSites`, regrouped into balanced columns by purpose. */
|
|
471
|
+
columns,
|
|
472
|
+
/** RSS and sitemap links, shown in the footer's bottom row instead of a column. */
|
|
473
|
+
feeds,
|
|
430
474
|
};
|
|
431
475
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hagicode/hagilight-core",
|
|
3
|
-
"version": "0.19.1-dev.
|
|
3
|
+
"version": "0.19.1-dev.189.1.6e24429",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Shared TypeScript utilities, components, and assets for HagiCode Astro and Starlight sites",
|
|
6
6
|
"repository": {
|