@arshiash80/strapi-plugin-iconhub
Version:
Icon picker plugin for Strapi with Iconify integration — search, select, and store icons with raw SVG for high-performance rendering.
25 lines (24 loc) • 1.12 kB
TypeScript
import type { IconifyInfo } from '@iconify/types';
export type IconSetCollections = Record<string, IconifyInfo>;
export type GroupedCollections = Record<string, IconSetCollections>;
/**
* Group collections by their category field.
* Sets without a category are placed under "Uncategorized".
*/
export declare function groupByCategory(collections: IconSetCollections): GroupedCollections;
/**
* Filter collections by allowed prefixes.
* Supports partial prefix matching: a prefix ending with '-' matches any
* collection whose prefix starts with that string (e.g. 'mdi-' matches 'mdi-light').
* Returns all collections if allowedPrefixes is empty or undefined.
*/
export declare function filterByAllowedPrefixes(collections: IconSetCollections, allowedPrefixes?: string[]): IconSetCollections;
/**
* Convert a category name to a safe key for use in Strapi option names.
* e.g. "UI 16px / 32px" → "UI_16px_32px"
*/
export declare function slugifyCategory(category: string): string;
/**
* Sort category names in a logical display order.
*/
export declare function sortCategories(categories: string[]): string[];