import { BrowserContext } from "https://esm.town/v/pomdtr/browser";
export default async function(ctx: BrowserContext) {
const resp = await fetch("https://api.iconify.design/collection?prefix=heroicons");
if (!resp.ok) {
throw new Error(await resp.text());
}
const { uncategorized: icons } = await resp.json() as { uncategorized: string[] };
const items = icons.filter(
(icon) => !icon.endsWith("-solid"),
).map(icon => ({
icon,
title: icon,
commands: [
{
title: "Copy Icon",
val: "pomdtr/copy_text",
params: {
text: icon,
},
},
],
}));
return {
type: "push",
page: {
type: "list",
items,
},
};
}