@f5-sales-demo/docs-theme 4.0.2 → 4.0.4
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/config.ts +37 -65
- package/package.json +2 -2
- package/src/utils/resolve-icon.test.ts +35 -0
- package/src/utils/resolve-icon.ts +11 -6
package/config.ts
CHANGED
|
@@ -6,6 +6,7 @@ import starlight from '@astrojs/starlight';
|
|
|
6
6
|
import type { StarlightPlugin } from '@astrojs/starlight/types';
|
|
7
7
|
import { BCP47_TO_SLUG, SLUG_LIST } from '@f5-sales-demo/i18n-core';
|
|
8
8
|
import starlightLlmsTxt from '@f5-sales-demo/starlight-llms-txt';
|
|
9
|
+
import type { MegaMenuItem } from '@f5-sales-demo/starlight-mega-menu';
|
|
9
10
|
import starlightMegaMenu from '@f5-sales-demo/starlight-mega-menu';
|
|
10
11
|
import type { AstroIntegration } from 'astro';
|
|
11
12
|
import { defineConfig } from 'astro/config';
|
|
@@ -30,41 +31,12 @@ import {
|
|
|
30
31
|
} from './src/i18n/mega-menu-translations.ts';
|
|
31
32
|
import { sidebarTranslations } from './src/i18n/translations.ts';
|
|
32
33
|
import remarkMermaid from './src/plugins/remark-mermaid.mjs';
|
|
33
|
-
import {
|
|
34
|
+
import { resolveMegaMenuIcon } from './src/utils/resolve-icon.ts';
|
|
34
35
|
import { buildSubcategorySidebar } from './src/utils/subcategory-sidebar.ts';
|
|
35
36
|
|
|
36
37
|
export type { LocaleConfig } from './src/i18n/locales.ts';
|
|
37
38
|
export { f5xcDefaultLocales } from './src/i18n/locales.ts';
|
|
38
39
|
|
|
39
|
-
interface MegaMenuItem {
|
|
40
|
-
label: string;
|
|
41
|
-
translations?: Record<string, string>;
|
|
42
|
-
href?: string;
|
|
43
|
-
content?: {
|
|
44
|
-
layout?: string;
|
|
45
|
-
columns?: number;
|
|
46
|
-
categories?: Array<{
|
|
47
|
-
title: string;
|
|
48
|
-
translations?: Record<string, string>;
|
|
49
|
-
items: Array<{
|
|
50
|
-
label: string;
|
|
51
|
-
translations?: Record<string, string>;
|
|
52
|
-
description?: string;
|
|
53
|
-
descriptionTranslations?: Record<string, string>;
|
|
54
|
-
href: string;
|
|
55
|
-
icon?: string;
|
|
56
|
-
}>;
|
|
57
|
-
}>;
|
|
58
|
-
footer?: {
|
|
59
|
-
label: string;
|
|
60
|
-
translations?: Record<string, string>;
|
|
61
|
-
href: string;
|
|
62
|
-
description?: string;
|
|
63
|
-
descriptionTranslations?: Record<string, string>;
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
|
|
68
40
|
interface HeadEntry {
|
|
69
41
|
tag: string;
|
|
70
42
|
attrs?: Record<string, string>;
|
|
@@ -117,7 +89,7 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
117
89
|
description: 'Firewall policies and configuration',
|
|
118
90
|
descriptionTranslations: itemDescriptions['Firewall policies and configuration'],
|
|
119
91
|
href: 'https://f5-sales-demo.github.io/waf/',
|
|
120
|
-
icon:
|
|
92
|
+
icon: resolveMegaMenuIcon('f5xc:web-app-and-api-protection'),
|
|
121
93
|
},
|
|
122
94
|
{
|
|
123
95
|
label: 'API Security',
|
|
@@ -125,7 +97,7 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
125
97
|
description: 'API discovery and protection',
|
|
126
98
|
descriptionTranslations: itemDescriptions['API discovery and protection'],
|
|
127
99
|
href: 'https://f5-sales-demo.github.io/api-protection/',
|
|
128
|
-
icon:
|
|
100
|
+
icon: resolveMegaMenuIcon('f5xc:application-traffic-insight'),
|
|
129
101
|
},
|
|
130
102
|
{
|
|
131
103
|
label: 'Client-Side Defense',
|
|
@@ -133,7 +105,7 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
133
105
|
description: 'Browser-based threat protection',
|
|
134
106
|
descriptionTranslations: itemDescriptions['Browser-based threat protection'],
|
|
135
107
|
href: 'https://f5-sales-demo.github.io/csd/',
|
|
136
|
-
icon:
|
|
108
|
+
icon: resolveMegaMenuIcon('f5xc:client-side-defense'),
|
|
137
109
|
},
|
|
138
110
|
{
|
|
139
111
|
label: 'Web App Scanning',
|
|
@@ -141,7 +113,7 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
141
113
|
description: 'Vulnerability assessment and scanning',
|
|
142
114
|
descriptionTranslations: itemDescriptions['Vulnerability assessment and scanning'],
|
|
143
115
|
href: 'https://f5-sales-demo.github.io/was/',
|
|
144
|
-
icon:
|
|
116
|
+
icon: resolveMegaMenuIcon('f5xc:web-app-scanning'),
|
|
145
117
|
},
|
|
146
118
|
],
|
|
147
119
|
},
|
|
@@ -155,7 +127,7 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
155
127
|
description: 'Behavioral analysis and AI detection',
|
|
156
128
|
descriptionTranslations: itemDescriptions['Behavioral analysis and AI detection'],
|
|
157
129
|
href: 'https://f5-sales-demo.github.io/bot-advanced/',
|
|
158
|
-
icon:
|
|
130
|
+
icon: resolveMegaMenuIcon('f5xc:bot-defense'),
|
|
159
131
|
},
|
|
160
132
|
{
|
|
161
133
|
label: 'Bot Defense Standard',
|
|
@@ -163,7 +135,7 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
163
135
|
description: 'Signature-based bot detection',
|
|
164
136
|
descriptionTranslations: itemDescriptions['Signature-based bot detection'],
|
|
165
137
|
href: 'https://f5-sales-demo.github.io/bot-standard/',
|
|
166
|
-
icon:
|
|
138
|
+
icon: resolveMegaMenuIcon('f5xc:bot-defense'),
|
|
167
139
|
},
|
|
168
140
|
{
|
|
169
141
|
label: 'DDoS Protection',
|
|
@@ -171,7 +143,7 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
171
143
|
description: 'Distributed denial-of-service mitigation',
|
|
172
144
|
descriptionTranslations: itemDescriptions['Distributed denial-of-service mitigation'],
|
|
173
145
|
href: 'https://f5-sales-demo.github.io/ddos/',
|
|
174
|
-
icon:
|
|
146
|
+
icon: resolveMegaMenuIcon('f5xc:ddos-and-transit-services'),
|
|
175
147
|
},
|
|
176
148
|
],
|
|
177
149
|
},
|
|
@@ -202,7 +174,7 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
202
174
|
description: 'Site connectivity across clouds',
|
|
203
175
|
descriptionTranslations: itemDescriptions['Site connectivity across clouds'],
|
|
204
176
|
href: 'https://f5-sales-demo.github.io/mcn/',
|
|
205
|
-
icon:
|
|
177
|
+
icon: resolveMegaMenuIcon('f5xc:multi-cloud-network-connect'),
|
|
206
178
|
},
|
|
207
179
|
{
|
|
208
180
|
label: 'Content Delivery',
|
|
@@ -210,7 +182,7 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
210
182
|
description: 'Edge caching and distribution',
|
|
211
183
|
descriptionTranslations: itemDescriptions['Edge caching and distribution'],
|
|
212
184
|
href: 'https://f5-sales-demo.github.io/cdn/',
|
|
213
|
-
icon:
|
|
185
|
+
icon: resolveMegaMenuIcon('f5xc:content-delivery-network'),
|
|
214
186
|
},
|
|
215
187
|
{
|
|
216
188
|
label: 'DNS Load Balancing',
|
|
@@ -218,7 +190,7 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
218
190
|
description: 'DNS management and zones',
|
|
219
191
|
descriptionTranslations: itemDescriptions['DNS management and zones'],
|
|
220
192
|
href: 'https://f5-sales-demo.github.io/dns/',
|
|
221
|
-
icon:
|
|
193
|
+
icon: resolveMegaMenuIcon('f5xc:dns-management'),
|
|
222
194
|
},
|
|
223
195
|
{
|
|
224
196
|
label: 'NGINX Management',
|
|
@@ -226,7 +198,7 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
226
198
|
description: 'NGINX integration and configuration',
|
|
227
199
|
descriptionTranslations: itemDescriptions['NGINX integration and configuration'],
|
|
228
200
|
href: 'https://f5-sales-demo.github.io/nginx/',
|
|
229
|
-
icon:
|
|
201
|
+
icon: resolveMegaMenuIcon('f5xc:nginx-one'),
|
|
230
202
|
},
|
|
231
203
|
],
|
|
232
204
|
},
|
|
@@ -240,7 +212,7 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
240
212
|
description: 'Monitoring, metrics, and insights',
|
|
241
213
|
descriptionTranslations: itemDescriptions['Monitoring, metrics, and insights'],
|
|
242
214
|
href: 'https://f5-sales-demo.github.io/observability/',
|
|
243
|
-
icon:
|
|
215
|
+
icon: resolveMegaMenuIcon('f5xc:observability'),
|
|
244
216
|
},
|
|
245
217
|
{
|
|
246
218
|
label: 'Administration',
|
|
@@ -248,7 +220,7 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
248
220
|
description: 'Tenant management and RBAC',
|
|
249
221
|
descriptionTranslations: itemDescriptions['Tenant management and RBAC'],
|
|
250
222
|
href: 'https://f5-sales-demo.github.io/administration/',
|
|
251
|
-
icon:
|
|
223
|
+
icon: resolveMegaMenuIcon('f5xc:administration'),
|
|
252
224
|
},
|
|
253
225
|
],
|
|
254
226
|
},
|
|
@@ -278,7 +250,7 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
278
250
|
description: 'Containerized Astro build system',
|
|
279
251
|
descriptionTranslations: itemDescriptions['Containerized Astro build system'],
|
|
280
252
|
href: 'https://f5-sales-demo.github.io/docs-builder/',
|
|
281
|
-
icon:
|
|
253
|
+
icon: resolveMegaMenuIcon('f5xc:doc'),
|
|
282
254
|
},
|
|
283
255
|
{
|
|
284
256
|
label: 'Docs Theme',
|
|
@@ -286,7 +258,7 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
286
258
|
description: 'Shared branding and styling',
|
|
287
259
|
descriptionTranslations: itemDescriptions['Shared branding and styling'],
|
|
288
260
|
href: 'https://f5-sales-demo.github.io/docs-theme/',
|
|
289
|
-
icon:
|
|
261
|
+
icon: resolveMegaMenuIcon('f5xc:shared-configuration'),
|
|
290
262
|
},
|
|
291
263
|
{
|
|
292
264
|
label: 'Icon Packages',
|
|
@@ -294,7 +266,7 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
294
266
|
description: 'NPM icon component library',
|
|
295
267
|
descriptionTranslations: itemDescriptions['NPM icon component library'],
|
|
296
268
|
href: 'https://f5-sales-demo.github.io/docs-icons/',
|
|
297
|
-
icon:
|
|
269
|
+
icon: resolveMegaMenuIcon('f5xc:distributed-apps'),
|
|
298
270
|
},
|
|
299
271
|
{
|
|
300
272
|
label: 'Dev Container',
|
|
@@ -302,7 +274,7 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
302
274
|
description: 'Isolated development environment',
|
|
303
275
|
descriptionTranslations: itemDescriptions['Isolated development environment'],
|
|
304
276
|
href: 'https://f5-sales-demo.github.io/devcontainer/',
|
|
305
|
-
icon:
|
|
277
|
+
icon: resolveMegaMenuIcon('hashicorp-flight:docker-color'),
|
|
306
278
|
},
|
|
307
279
|
{
|
|
308
280
|
label: 'mvp',
|
|
@@ -314,7 +286,7 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
314
286
|
'Capability program that amplifies F5 Distributed Cloud practitioners with an agentic subject matter expert'
|
|
315
287
|
],
|
|
316
288
|
href: 'https://f5-sales-demo.github.io/mvp/',
|
|
317
|
-
icon:
|
|
289
|
+
icon: resolveMegaMenuIcon('f5xc:ai_assistant_logo'),
|
|
318
290
|
},
|
|
319
291
|
],
|
|
320
292
|
},
|
|
@@ -328,7 +300,7 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
328
300
|
description: 'F5 XC Terraform provider',
|
|
329
301
|
descriptionTranslations: itemDescriptions['F5 XC Terraform provider'],
|
|
330
302
|
href: 'https://f5-sales-demo.github.io/terraform-provider-xcsh/',
|
|
331
|
-
icon:
|
|
303
|
+
icon: resolveMegaMenuIcon('hashicorp-flight:terraform-color'),
|
|
332
304
|
},
|
|
333
305
|
{
|
|
334
306
|
label: 'API Specs',
|
|
@@ -336,7 +308,7 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
336
308
|
description: 'OpenAPI spec validation and reconciliation',
|
|
337
309
|
descriptionTranslations: itemDescriptions['OpenAPI spec validation and reconciliation'],
|
|
338
310
|
href: 'https://f5-sales-demo.github.io/api-specs/',
|
|
339
|
-
icon:
|
|
311
|
+
icon: resolveMegaMenuIcon('f5xc:data-intelligence'),
|
|
340
312
|
},
|
|
341
313
|
{
|
|
342
314
|
label: 'API Specs Enriched',
|
|
@@ -344,14 +316,14 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
344
316
|
description: 'Enriched OpenAPI specifications',
|
|
345
317
|
descriptionTranslations: itemDescriptions['Enriched OpenAPI specifications'],
|
|
346
318
|
href: 'https://f5-sales-demo.github.io/api-specs-enriched/',
|
|
347
|
-
icon:
|
|
319
|
+
icon: resolveMegaMenuIcon('f5xc:data-intelligence'),
|
|
348
320
|
},
|
|
349
321
|
{
|
|
350
322
|
label: 'xcsh Manifest Automation',
|
|
351
323
|
description: 'Deterministic F5 XC manifest operations in GitHub Actions',
|
|
352
324
|
descriptionTranslations: xcshActionDescriptionTranslations,
|
|
353
325
|
href: 'https://f5-sales-demo.github.io/xcsh-action/',
|
|
354
|
-
icon:
|
|
326
|
+
icon: resolveMegaMenuIcon('carbon:workflow-automation'),
|
|
355
327
|
},
|
|
356
328
|
{
|
|
357
329
|
label: 'VS Code Extension',
|
|
@@ -359,7 +331,7 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
359
331
|
description: 'Manage F5 XC resources from VS Code',
|
|
360
332
|
descriptionTranslations: itemDescriptions['Manage F5 XC resources from VS Code'],
|
|
361
333
|
href: 'https://f5-sales-demo.github.io/vscode-xcsh/',
|
|
362
|
-
icon:
|
|
334
|
+
icon: resolveMegaMenuIcon('carbon:code'),
|
|
363
335
|
},
|
|
364
336
|
{
|
|
365
337
|
label: 'xcsh CLI',
|
|
@@ -367,7 +339,7 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
367
339
|
description: 'AI-powered CLI for F5 XC',
|
|
368
340
|
descriptionTranslations: itemDescriptions['AI-powered CLI for F5 XC'],
|
|
369
341
|
href: 'https://f5-sales-demo.github.io/xcsh/',
|
|
370
|
-
icon:
|
|
342
|
+
icon: resolveMegaMenuIcon('carbon:terminal'),
|
|
371
343
|
},
|
|
372
344
|
{
|
|
373
345
|
label: 'xcsh Chrome Extension',
|
|
@@ -375,7 +347,7 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
375
347
|
description: 'Drive the F5 XC console with xcsh',
|
|
376
348
|
descriptionTranslations: itemDescriptions['Drive the F5 XC console with xcsh'],
|
|
377
349
|
href: 'https://f5-sales-demo.github.io/xcsh-chrome-extension/',
|
|
378
|
-
icon:
|
|
350
|
+
icon: resolveMegaMenuIcon('carbon:application-web'),
|
|
379
351
|
},
|
|
380
352
|
],
|
|
381
353
|
},
|
|
@@ -405,7 +377,7 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
405
377
|
description: 'AI-powered marketplace for F5 XC',
|
|
406
378
|
descriptionTranslations: itemDescriptions['AI-powered marketplace for F5 XC'],
|
|
407
379
|
href: 'https://f5-sales-demo.github.io/marketplace/',
|
|
408
|
-
icon:
|
|
380
|
+
icon: resolveMegaMenuIcon('f5xc:ai_assistant_logo'),
|
|
409
381
|
},
|
|
410
382
|
{
|
|
411
383
|
label: 'xcsh',
|
|
@@ -414,7 +386,7 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
414
386
|
descriptionTranslations:
|
|
415
387
|
itemDescriptions['AI-powered development CLI with persistent sessions and native Rust tooling'],
|
|
416
388
|
href: 'https://f5-sales-demo.github.io/xcsh/',
|
|
417
|
-
icon:
|
|
389
|
+
icon: resolveMegaMenuIcon('f5xc:ai_assistant_logo'),
|
|
418
390
|
},
|
|
419
391
|
{
|
|
420
392
|
label: 'Console Catalog',
|
|
@@ -422,7 +394,7 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
422
394
|
description: 'AI-driven browser automation for F5 XC UI',
|
|
423
395
|
descriptionTranslations: itemDescriptions['AI-driven browser automation for F5 XC UI'],
|
|
424
396
|
href: 'https://f5-sales-demo.github.io/console/',
|
|
425
|
-
icon:
|
|
397
|
+
icon: resolveMegaMenuIcon('f5xc:ai_assistant_logo'),
|
|
426
398
|
},
|
|
427
399
|
],
|
|
428
400
|
},
|
|
@@ -445,7 +417,7 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
445
417
|
description: 'Vulnerable web applications for WAF and API testing',
|
|
446
418
|
descriptionTranslations: itemDescriptions['Vulnerable web applications for WAF and API testing'],
|
|
447
419
|
href: 'https://f5-sales-demo.github.io/origin-server/',
|
|
448
|
-
icon:
|
|
420
|
+
icon: resolveMegaMenuIcon('f5xc:distributed-apps'),
|
|
449
421
|
},
|
|
450
422
|
{
|
|
451
423
|
label: 'Traffic Generator',
|
|
@@ -453,7 +425,7 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
453
425
|
description: 'Security tools and attack suites for traffic generation',
|
|
454
426
|
descriptionTranslations: itemDescriptions['Security tools and attack suites for traffic generation'],
|
|
455
427
|
href: 'https://f5-sales-demo.github.io/traffic-generator/',
|
|
456
|
-
icon:
|
|
428
|
+
icon: resolveMegaMenuIcon('f5xc:application-traffic-insight'),
|
|
457
429
|
},
|
|
458
430
|
{
|
|
459
431
|
label: 'CDN Simulator',
|
|
@@ -461,7 +433,7 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
461
433
|
description: 'NGINX-based CDN edge node simulator',
|
|
462
434
|
descriptionTranslations: itemDescriptions['NGINX-based CDN edge node simulator'],
|
|
463
435
|
href: 'https://f5-sales-demo.github.io/cdn-simulator/',
|
|
464
|
-
icon:
|
|
436
|
+
icon: resolveMegaMenuIcon('f5xc:content-delivery-network'),
|
|
465
437
|
},
|
|
466
438
|
],
|
|
467
439
|
},
|
|
@@ -491,7 +463,7 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
491
463
|
description: 'Distributed Cloud management portal',
|
|
492
464
|
descriptionTranslations: itemDescriptions['Distributed Cloud management portal'],
|
|
493
465
|
href: 'https://console.ves.volterra.io',
|
|
494
|
-
icon:
|
|
466
|
+
icon: resolveMegaMenuIcon('f5xc:platform'),
|
|
495
467
|
},
|
|
496
468
|
{
|
|
497
469
|
label: 'F5 Cloud Docs',
|
|
@@ -499,7 +471,7 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
499
471
|
description: 'Official product documentation',
|
|
500
472
|
descriptionTranslations: itemDescriptions['Official product documentation'],
|
|
501
473
|
href: 'https://docs.cloud.f5.com',
|
|
502
|
-
icon:
|
|
474
|
+
icon: resolveMegaMenuIcon('f5xc:doc'),
|
|
503
475
|
},
|
|
504
476
|
{
|
|
505
477
|
label: 'MyF5 Support',
|
|
@@ -507,7 +479,7 @@ export const defaultMegaMenuItems: MegaMenuItem[] = [
|
|
|
507
479
|
description: 'Technical support portal',
|
|
508
480
|
descriptionTranslations: itemDescriptions['Technical support portal'],
|
|
509
481
|
href: 'https://my.f5.com/manage/s/',
|
|
510
|
-
icon:
|
|
482
|
+
icon: resolveMegaMenuIcon('f5xc:support'),
|
|
511
483
|
},
|
|
512
484
|
],
|
|
513
485
|
},
|
|
@@ -654,7 +626,7 @@ export function createF5xcDocsConfig(options: F5xcDocsConfigOptions = {}) {
|
|
|
654
626
|
: undefined;
|
|
655
627
|
|
|
656
628
|
const starlightPlugins: StarlightPlugin[] = [
|
|
657
|
-
starlightMegaMenu({ items: megaMenuItems
|
|
629
|
+
starlightMegaMenu({ items: megaMenuItems, mobileLabels }),
|
|
658
630
|
starlightVideosPlugin(),
|
|
659
631
|
starlightImageZoom(),
|
|
660
632
|
f5xcDocsTheme(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@f5-sales-demo/docs-theme",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.4",
|
|
4
4
|
"description": "F5 Distributed Cloud branded Starlight documentation theme",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
"@astrojs/react": "^6.0.4",
|
|
141
141
|
"@f5-sales-demo/i18n-core": "^1.0.56",
|
|
142
142
|
"@f5-sales-demo/starlight-llms-txt": "2.0.0",
|
|
143
|
-
"@f5-sales-demo/starlight-mega-menu": "^
|
|
143
|
+
"@f5-sales-demo/starlight-mega-menu": "^3.0.0",
|
|
144
144
|
"gray-matter": "^4.0.3",
|
|
145
145
|
"remark-code-import": "^1.2.0",
|
|
146
146
|
"starlight-heading-badges": "^0.8.0",
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { MegaMenuItem, MegaMenuSvgIcon } from '@f5-sales-demo/starlight-mega-menu';
|
|
2
|
+
import { describe, expect, expectTypeOf, it } from 'vitest';
|
|
3
|
+
import { defaultMegaMenuItems } from '../../config.ts';
|
|
4
|
+
import { hasExplicitColors, resolveMegaMenuIcon } from './resolve-icon.ts';
|
|
5
|
+
|
|
6
|
+
describe('resolveMegaMenuIcon', () => {
|
|
7
|
+
it('preserves palette artwork and intrinsic dimensions', () => {
|
|
8
|
+
expect(resolveMegaMenuIcon('hashicorp-flight:docker-color')).toMatchObject({
|
|
9
|
+
width: 24,
|
|
10
|
+
height: 24,
|
|
11
|
+
mode: 'original',
|
|
12
|
+
} satisfies Partial<MegaMenuSvgIcon>);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('classifies monochrome artwork for currentColor rendering', () => {
|
|
16
|
+
expect(resolveMegaMenuIcon('carbon:code')).toMatchObject({
|
|
17
|
+
width: 32,
|
|
18
|
+
height: 32,
|
|
19
|
+
mode: 'currentColor',
|
|
20
|
+
} satisfies Partial<MegaMenuSvgIcon>);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('rejects missing icons', () => {
|
|
24
|
+
expect(() => resolveMegaMenuIcon('carbon:not-a-real-icon')).toThrow('Icon "not-a-real-icon" not found');
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('detects only explicit palette fills', () => {
|
|
28
|
+
expect(hasExplicitColors('<path fill="#e4002b"/>')).toBe(true);
|
|
29
|
+
expect(hasExplicitColors('<path fill="currentColor"/><path fill="none"/>')).toBe(false);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('keeps the default menu assignable to the upstream type without assertions', () => {
|
|
33
|
+
expectTypeOf(defaultMegaMenuItems).toMatchTypeOf<MegaMenuItem[]>();
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
|
+
import type { MegaMenuSvgIcon } from '@f5-sales-demo/starlight-mega-menu';
|
|
2
3
|
import type { IconSetData } from '../types/icon';
|
|
3
4
|
|
|
4
5
|
const require = createRequire(import.meta.url);
|
|
@@ -13,11 +14,11 @@ export function hasExplicitColors(body: string): boolean {
|
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
|
-
* Resolves a `prefix:name` icon identifier to a
|
|
17
|
-
* using the installed Iconify JSON packages. Designed for
|
|
18
|
-
* use at module scope (e.g. in config.ts default values).
|
|
17
|
+
* Resolves a `prefix:name` icon identifier to a serializable mega-menu
|
|
18
|
+
* descriptor using the installed Iconify JSON packages. Designed for
|
|
19
|
+
* synchronous use at module scope (e.g. in config.ts default values).
|
|
19
20
|
*/
|
|
20
|
-
export function
|
|
21
|
+
export function resolveMegaMenuIcon(name: string): MegaMenuSvgIcon {
|
|
21
22
|
const colonIndex = name.indexOf(':');
|
|
22
23
|
if (colonIndex === -1) {
|
|
23
24
|
throw new Error(`Invalid icon name "${name}". Expected "prefix:name" format.`);
|
|
@@ -65,6 +66,10 @@ export function resolveIcon(name: string): string {
|
|
|
65
66
|
const w = icon.width ?? iconData.width ?? 24;
|
|
66
67
|
const h = icon.height ?? iconData.height ?? 24;
|
|
67
68
|
const isPalette = iconData.info?.palette === true || hasExplicitColors(icon.body);
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
return {
|
|
70
|
+
body: icon.body,
|
|
71
|
+
width: w,
|
|
72
|
+
height: h,
|
|
73
|
+
mode: isPalette ? 'original' : 'currentColor',
|
|
74
|
+
};
|
|
70
75
|
}
|