UNPKG

2.52 kBTypeScriptView Raw
1/**
2 * @fileoverview
3 * Types for Simple Icons SDK.
4 */
5
6import type {CustomLicense, SPDXLicense} from './types';
7
8/**
9 * The data for a third-party extension.
10 *
11 * Includes the module and author of the extension,
12 * both including a name and URL.
13 *
14 * @see {@link https://github.com/simple-icons/simple-icons#third-party-extensions Third-Party Extensions}
15 */
16export type ThirdPartyExtension = {
17 module: ThirdPartyExtensionSubject;
18 author: ThirdPartyExtensionSubject;
19};
20
21type ThirdPartyExtensionSubject = {
22 name: string;
23 url: string;
24};
25
26/**
27 * The aliases for a Simple Icon.
28 *
29 * Corresponds to the `aliases` property in the *_data/simple-icons.json* file.
30 *
31 * @see {@link https://github.com/simple-icons/simple-icons/blob/develop/CONTRIBUTING.md#aliases Aliases}
32 */
33export type Aliases = {
34 aka?: string[];
35 dup?: DuplicateAlias[];
36 loc?: Record<string, string>;
37};
38
39type DuplicateAlias = {
40 title: string;
41 hex?: string;
42 guidelines?: string;
43 loc?: Record<string, string>;
44};
45
46/**
47 * The data for a Simple Icon.
48 *
49 * Corresponds to the data stored for each icon in the *_data/simple-icons.json* file.
50 *
51 * @see {@link https://github.com/mondeja/simple-icons/blob/utils-entrypoint/CONTRIBUTING.md#7-update-the-json-data-for-simpleiconsorg Update the JSON Data for SimpleIcons.org}
52 */
53export type IconData = {
54 title: string;
55 hex: string;
56 source: string;
57 slug?: string;
58 guidelines?: string;
59 license?: Omit<SPDXLicense, 'url'> | CustomLicense;
60 aliases?: Aliases;
61};
62
63/* The next code is autogenerated from sdk.mjs */
64/* eslint-disable */
65
66export const URL_REGEX: RegExp;
67export const SVG_PATH_REGEX: RegExp;
68export function getDirnameFromImportMeta(importMetaUrl: string): string;
69export function getIconSlug(icon: IconData): string;
70export function svgToPath(svg: string): string;
71export function titleToSlug(title: string): string;
72export function slugToVariableName(slug: string): string;
73export function titleToHtmlFriendly(brandTitle: string): string;
74export function htmlFriendlyToTitle(htmlFriendlyTitle: string): string;
75export function getIconDataPath(rootDirectory?: string): string;
76export function getIconsDataString(rootDirectory?: string): string;
77export function getIconsData(rootDirectory?: string): IconData[];
78export function normalizeNewlines(text: string): string;
79export function normalizeColor(text: string): string;
80export function getThirdPartyExtensions(
81 readmePath?: string,
82): Promise<ThirdPartyExtension[]>;
83export const collator: Intl.Collator;