You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
821 B
28 lines
821 B
import { mergeIconData } from '../icon/merge.mjs';
|
|
import { getIconsTree } from './tree.mjs';
|
|
import '../icon/defaults.mjs';
|
|
import '../icon/transformations.mjs';
|
|
|
|
function internalGetIconData(data, name, tree) {
|
|
const icons = data.icons;
|
|
const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
|
|
let currentProps = {};
|
|
function parse(name2) {
|
|
currentProps = mergeIconData(
|
|
icons[name2] || aliases[name2],
|
|
currentProps
|
|
);
|
|
}
|
|
parse(name);
|
|
tree.forEach(parse);
|
|
return mergeIconData(data, currentProps);
|
|
}
|
|
function getIconData(data, name) {
|
|
if (data.icons[name]) {
|
|
return internalGetIconData(data, name, []);
|
|
}
|
|
const tree = getIconsTree(data, [name])[name];
|
|
return tree ? internalGetIconData(data, name, tree) : null;
|
|
}
|
|
|
|
export { getIconData, internalGetIconData };
|
|
|