| 1 |
/** |
| 2 |
* Font Awesome 6 Free — full solid + regular icon lists for the admin picker. |
| 3 |
* Names come from includes/fa-free-icon-names.json (regenerate: npm run sync-fa). |
| 4 |
* Rendering uses webfont CSS (fa-solid / fa-regular + fa-{name}), not bundled SVG defs. |
| 5 |
*/ |
| 6 |
import faManifest from "@yatra/fa-icon-names"; |
| 7 |
|
| 8 |
export type FaPickerStyle = "fa-solid" | "fa-regular"; |
| 9 |
|
| 10 |
export type FaPickerItem = { |
| 11 |
/** Icon name without fa- prefix (Font Awesome iconName) */ |
| 12 |
name: string; |
| 13 |
label: string; |
| 14 |
style: FaPickerStyle; |
| 15 |
}; |
| 16 |
|
| 17 |
const manifest = faManifest as { solid: string[]; regular: string[] }; |
| 18 |
|
| 19 |
function humanizeIconName(iconName: string): string { |
| 20 |
return iconName |
| 21 |
.split("-") |
| 22 |
.filter(Boolean) |
| 23 |
.map((w) => w.charAt(0).toUpperCase() + w.slice(1)) |
| 24 |
.join(" "); |
| 25 |
} |
| 26 |
|
| 27 |
function toPickerItems( |
| 28 |
names: readonly string[], |
| 29 |
style: FaPickerStyle, |
| 30 |
): FaPickerItem[] { |
| 31 |
return names.map((name) => ({ |
| 32 |
name, |
| 33 |
label: humanizeIconName(name), |
| 34 |
style, |
| 35 |
})); |
| 36 |
} |
| 37 |
|
| 38 |
/** Font Awesome Free — Solid (full pack) */ |
| 39 |
export const FA_FREE_SOLID_PICKER: FaPickerItem[] = toPickerItems( |
| 40 |
manifest.solid, |
| 41 |
"fa-solid", |
| 42 |
); |
| 43 |
|
| 44 |
/** Font Awesome Free — Regular (full pack) */ |
| 45 |
export const FA_FREE_REGULAR_PICKER: FaPickerItem[] = toPickerItems( |
| 46 |
manifest.regular, |
| 47 |
"fa-regular", |
| 48 |
); |
| 49 |
|
| 50 |
export const FA_FREE_ALL_PICKER: FaPickerItem[] = [ |
| 51 |
...FA_FREE_SOLID_PICKER, |
| 52 |
...FA_FREE_REGULAR_PICKER, |
| 53 |
]; |
| 54 |
|
| 55 |
export const FA_SOLID_NAME_SET = new Set(manifest.solid); |
| 56 |
export const FA_REGULAR_NAME_SET = new Set(manifest.regular); |
| 57 |
|