@driftime/sanity-plugin-icon 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{adapters-Dw6yeA3A.js → adapters-JowAC3d_.js} +2 -2
- package/dist/{adapters-Dw6yeA3A.js.map → adapters-JowAC3d_.js.map} +1 -1
- package/dist/index.js +41 -40
- package/dist/index.js.map +1 -1
- package/dist/library-D07tGkaC.js +2 -0
- package/dist/{types-CmTEhJK6.js → library-DRfdBS-O.js} +15 -52
- package/dist/library-DRfdBS-O.js.map +1 -0
- package/dist/{loader-2g6inuO6.js → loader-Mo7_FEBf.js} +6 -5
- package/dist/loader-Mo7_FEBf.js.map +1 -0
- package/dist/next-loader.d.ts.map +1 -1
- package/dist/next-loader.js +3 -3
- package/dist/next.js +2 -2
- package/dist/{nodes-Bn7fLVZO.js → nodes-DdErxvpg.js} +8 -2
- package/dist/nodes-DdErxvpg.js.map +1 -0
- package/dist/read-worker.js +2 -2
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +3 -3
- package/dist/render.js.map +1 -1
- package/dist/{sets-DH5UbUV_.js → sets-BfqjcdEo.js} +2 -2
- package/dist/{sets-DH5UbUV_.js.map → sets-BfqjcdEo.js.map} +1 -1
- package/dist/{sets-B5arQvrZ.js → sets-FpS3h5A7.js} +4 -4
- package/dist/{sets-B5arQvrZ.js.map → sets-FpS3h5A7.js.map} +1 -1
- package/dist/types-Dl2HGUL5.js +51 -0
- package/dist/types-Dl2HGUL5.js.map +1 -0
- package/dist/vite.js +2 -2
- package/package.json +1 -1
- package/dist/loader-2g6inuO6.js.map +0 -1
- package/dist/nodes-Bn7fLVZO.js.map +0 -1
- package/dist/types-CmTEhJK6.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as isDefined, l as isRecord, s as convertCase, t as findDrawingProblem } from "./nodes-
|
|
1
|
+
import { c as isDefined, l as isRecord, s as convertCase, t as findDrawingProblem } from "./nodes-DdErxvpg.js";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { readFile, readdir } from "node:fs/promises";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
@@ -629,4 +629,4 @@ const iconAdapters = [
|
|
|
629
629
|
];
|
|
630
630
|
export { readDeclaredPackages as a, convertIcon as c, listPluginFiles as i, createCustomAdapter as n, readJson as o, findPackage as r, readPluginBuild as s, iconAdapters as t };
|
|
631
631
|
|
|
632
|
-
//# sourceMappingURL=adapters-
|
|
632
|
+
//# sourceMappingURL=adapters-JowAC3d_.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapters-Dw6yeA3A.js","names":["createHash","isDefined","XastChild","XastElement","XastRoot","optimize","IconDrawing","IconElement","IconRoot","findDrawingProblem","IconSetIcon","SourceIcon","name","keywords","svg","ConvertedIcon","icon","root","problem","rootOnlyAttributes","Set","toReactName","replaceAll","_match","character","toUpperCase","readAttributes","attributes","Record","omitted","ReadonlySet","Object","fromEntries","entries","flatMap","value","test","has","closeOpenUrls","element","readChildren","children","child","type","trim","nested","readSvgElement","tree","find","undefined","width","replace","height","viewBox","node","filter","readDrawing","result","drawing","declared","includes","multipass","plugins","fn","enter","params","overrides","cleanupNumericValues","convertPathData","convertTransform","inlineStyles","onlyMatchedOnce","mergePaths","prefix","update","digest","slice","parseDrawing","convertIcon","source","nameWords","split","map","keyword","toLowerCase","readFile","readdir","createRequire","path","pathToFileURL","isDefined","isRecord","ElementType","createElement","renderToStaticMarkup","SourceIcon","toReactName","roundStrokeRoot","viewBox","fill","stroke","toKebabName","name","replaceAll","toLowerCase","isReact","value","isServerRenderer","isElementType","loadRenderer","root","react","requireFromProject","server","undefined","render","type","props","Record","toProps","attributes","Object","fromEntries","entries","flatMap","String","writeElementPairs","renderer","Array","isArray","create","elements","pair","index","key","length","xmlns","children","readSvgIcons","folder","files","describe","file","keywords","icons","Promise","all","map","svg","join","listSvgFiles","directory","filter","endsWith","toSorted","importPackageFile","loaded","href","createHash","readFile","readdir","path","isDefined","isRecord","InstalledPackage","name","directory","version","listPluginFiles","files","import","meta","dirname","filter","file","endsWith","toSorted","map","join","readPluginBuild","contents","Promise","all","content","hash","update","basename","digest","slice","readJson","JSON","parse","undefined","listAncestors","parent","findPackage","root","candidates","resolve","folder","manifest","published","readDeclaredPackages","Set","groups","flatMap","group","Object","keys","path","convertCase","isRecord","listSvgFiles","readSvgIcons","IconAdapter","readJson","createCustomAdapter","library","folder","label","packageName","undefined","styles","read","root","directory","resolve","files","keywords","Promise","all","join","file","name","slice","length","listed","Array","isArray","map","String","path","isDefined","isRecord","importPackageFile","isElementType","loadRenderer","toKebabName","IconAdapter","readJson","centralAdapter","library","label","packageName","undefined","packagePrefix","packageExample","styles","read","directory","root","renderer","exports","index","Promise","all","join","aliases","Object","entries","flatMap","exportName","component","startsWith","endsWith","svg","render","mode","listed","keywords","split","map","keyword","trim","name","slice","length","centralFills","const","centralRadii","centralStrokes","centralStyles","flatMap","fill","radius","map","stroke","nucleoStyles","iconLibraryStyles","central","heroicons","hugeicons","iconoir","lucide","nucleo","phosphor","tabler","path","listSvgFiles","readSvgIcons","IconAdapter","iconLibraryStyles","styleFolders","Record","outline","solid","mini","micro","heroiconsAdapter","library","label","packageName","packagePattern","styles","heroicons","read","directory","style","folder","join","files","file","name","slice","length","keywords","isDefined","importPackageFile","toKebabName","writeElementPairs","IconAdapter","iconLibraryStyles","exportSuffixes","hugeiconsAdapter","library","label","packageName","packagePattern","styles","hugeicons","read","directory","root","exports","namesByIcon","Map","exportName","value","Object","entries","set","get","flatMap","exportNames","svg","viewBox","fill","iconNames","filter","endsWith","toSorted","primary","name","replace","keywords","path","listSvgFiles","readSvgIcons","IconAdapter","iconLibraryStyles","iconoirAdapter","library","label","packageName","packagePattern","styles","iconoir","read","directory","style","folder","join","files","file","name","slice","length","keywords","path","isDefined","isRecord","roundStrokeRoot","writeElementPairs","IconAdapter","readJson","iconLibraryStyles","lucideAdapter","library","label","packageName","packagePattern","styles","lucide","read","directory","root","nodes","tags","Promise","all","join","Object","entries","flatMap","name","value","svg","keywords","Array","isArray","map","String","isDefined","importPackageFile","isElementType","loadRenderer","toKebabName","IconAdapter","findStyleSuffix","names","first","rest","length","every","name","at","shared","slice","start","search","nucleoAdapter","library","label","packageName","undefined","packagePrefix","packageExample","styles","read","directory","root","renderer","exports","components","Object","entries","flatMap","exportName","component","startsWith","const","suffix","map","svg","render","keywords","path","isRecord","importPackageFile","listSvgFiles","readSvgIcons","IconAdapter","iconLibraryStyles","readPhosphorKeywords","directory","icons","Array","isArray","Map","flatMap","icon","map","String","const","phosphorAdapter","library","label","packageName","packagePattern","styles","phosphor","read","style","folder","join","files","keywords","Promise","all","suffix","filter","file","endsWith","name","slice","length","get","path","isDefined","isRecord","roundStrokeRoot","writeElementPairs","IconAdapter","readJson","iconLibraryStyles","tablerAdapter","library","label","packageName","packagePattern","styles","tabler","read","directory","style","root","nodes","details","Promise","all","join","attributes","viewBox","fill","Object","entries","flatMap","name","value","svg","detail","undefined","tags","Array","isArray","map","String","keywords","centralAdapter","heroiconsAdapter","hugeiconsAdapter","iconoirAdapter","lucideAdapter","nucleoAdapter","phosphorAdapter","tablerAdapter","IconAdapter","iconAdapters","\"width\"","\"height\"","\"viewBox\"","\"createElement\"","\"renderToStaticMarkup\"","\"version\"","\"name\"","\"dependencies\"","\"devDependencies\"","\"peerDependencies\"","\"iconAliases\"","\"tags\""],"sources":["../src/build/convert.ts","../src/build/adapters/shared.ts","../src/build/packages.ts","../src/build/adapters/custom.ts","../src/build/adapters/central.ts","../src/lib/libraries.ts","../src/build/adapters/heroicons.ts","../src/build/adapters/hugeicons.ts","../src/build/adapters/iconoir.ts","../src/build/adapters/lucide.ts","../src/build/adapters/nucleo.ts","../src/build/adapters/phosphor.ts","../src/build/adapters/tabler.ts","../src/build/adapters/index.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\n\nimport { isDefined } from \"@repo/lib/utils\";\nimport type { XastChild, XastElement, XastRoot } from \"svgo\";\nimport { optimize } from \"svgo\";\n\nimport type { IconDrawing, IconElement, IconRoot } from \"@/lib/nodes\";\nimport { findDrawingProblem } from \"@/lib/nodes\";\nimport type { IconSetIcon } from \"@/lib/sets\";\n\n/** An icon as read from a library, before conversion. */\nexport interface SourceIcon {\n /** Name of the icon in its library. */\n name: string;\n /** Words describing the icon, from its library. */\n keywords: string[];\n /** The icon's SVG markup. */\n svg: string;\n}\n\n/** An icon after conversion, with its own root, or why it couldn't be converted. */\nexport type ConvertedIcon =\n | { icon: IconSetIcon & { root: IconRoot }; problem?: undefined }\n | { icon?: undefined; problem: string };\n\n/** Attributes of the outer SVG that size or label it rather than draw it, since the renderer sets its own. */\nconst rootOnlyAttributes = new Set([\"class\", \"focusable\", \"height\", \"role\", \"version\", \"width\"]);\n\n/**\n * Converts an SVG attribute name to its React form, such as `stroke-width` to `strokeWidth` and `xlink:href` to\n * `xlinkHref`.\n *\n * @param name - The attribute name.\n * @returns The React name.\n */\nexport function toReactName(name: string) {\n return name.replaceAll(/[-:](?<character>[a-z])/gu, (_match, character: string) => character.toUpperCase());\n}\n\n/**\n * Converts attributes to React naming, leaving out namespaces, classes, and data and accessibility attributes, which\n * don't draw anything.\n *\n * @param attributes - The attributes.\n * @param omitted - Further attributes to leave out.\n * @returns The converted attributes.\n */\nfunction readAttributes(attributes: Record<string, string>, omitted: ReadonlySet<string> = new Set([\"class\"])) {\n return Object.fromEntries(\n Object.entries(attributes).flatMap(([name, value]) =>\n /^(?:xmlns|data-|aria-)/u.test(name) || omitted.has(name) ? [] : [[toReactName(name), value]],\n ),\n );\n}\n\n/**\n * Closes a `url(` left open at the end of each attribute value, which is how browsers read it.\n *\n * @param element - The element whose attributes to close.\n */\nfunction closeOpenUrls(element: XastElement) {\n for (const [name, value] of Object.entries(element.attributes)) {\n if (/url\\([^)]*$/u.test(value)) element.attributes[name] = `${value})`;\n }\n}\n\n/**\n * Converts SVGO's parsed children into stored elements, keeping text and dropping comments.\n *\n * @param children - The parsed children.\n * @returns The elements and text.\n */\nfunction readChildren(children: XastChild[]) {\n return children.flatMap((child): (IconElement | string)[] => {\n if (child.type === \"text\") return isDefined(child.value.trim()) ? [child.value] : [];\n if (child.type !== \"element\") return [];\n\n const nested = readChildren(child.children);\n const attributes = readAttributes(child.attributes);\n\n return [isDefined(nested) ? [child.name, attributes, nested] : [child.name, attributes]];\n });\n}\n\n/**\n * Reads SVGO's parsed document into a drawing, from its outer `svg` element.\n *\n * @param tree - The parsed document.\n * @returns The drawing, or undefined when the document has no `svg` element.\n */\nfunction readSvgElement(tree: XastRoot) {\n const element = tree.children.find((child): child is XastElement => child.type === \"element\" && child.name === \"svg\");\n if (!isDefined(element)) return undefined;\n\n // A size like `24px` means 24 units, the way browsers read it.\n const width = element.attributes[\"width\"]?.replace(/px$/u, \"\") ?? \"24\";\n const height = element.attributes[\"height\"]?.replace(/px$/u, \"\") ?? width;\n const attributes = readAttributes(element.attributes, rootOnlyAttributes);\n\n return {\n root: { ...attributes, viewBox: attributes[\"viewBox\"] ?? `0 0 ${width} ${height}` },\n node: readChildren(element.children).filter((child): child is IconElement => typeof child !== \"string\"),\n };\n}\n\n/**\n * Cleans and minifies an icon with SVGO, then reads the result into a drawing. Paths, numbers, and transforms are kept\n * exactly as drawn, since rounding or merging them changes how some icons look, and every identifier gets a prefix\n * unique to the icon, so two icons on one page can't clash.\n *\n * @param svg - The icon's SVG markup.\n * @returns The drawing, or undefined when the markup has no SVG.\n * @throws When the markup can't be parsed.\n */\nfunction readDrawing(svg: string) {\n const result: { drawing?: IconDrawing } = {};\n\n // Browsers accept `xlink:` attributes without the namespace declaration, which React leaves out, but SVGO doesn't.\n const declared =\n svg.includes(\"xlink:\") && !svg.includes(\"xmlns:xlink\")\n ? svg.replace(\"<svg\", '<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\"')\n : svg;\n\n optimize(declared, {\n multipass: true,\n plugins: [\n { name: \"closeOpenUrls\", fn: () => ({ element: { enter: closeOpenUrls } }) },\n {\n name: \"preset-default\",\n params: {\n overrides: {\n cleanupNumericValues: false,\n convertPathData: false,\n convertTransform: false,\n inlineStyles: { onlyMatchedOnce: false },\n mergePaths: false,\n },\n },\n },\n \"removeScripts\",\n \"removeTitle\",\n { name: \"prefixIds\", params: { prefix: `i${createHash(\"sha256\").update(svg).digest(\"hex\").slice(0, 8)}` } },\n {\n name: \"read\",\n fn: () => ({\n root: {\n enter(tree) {\n result.drawing = readSvgElement(tree);\n },\n },\n }),\n },\n ],\n });\n\n return result.drawing;\n}\n\n/**\n * Reads an icon's markup into a drawing, or says why it can't be read.\n *\n * @param svg - The icon's SVG markup.\n * @returns The drawing, or why there isn't one.\n */\nfunction parseDrawing(svg: string) {\n try {\n return readDrawing(svg) ?? \"has no SVG\";\n } catch {\n return \"isn't valid SVG\";\n }\n}\n\n/**\n * Converts one icon into a stored drawing, the same way whichever library it came from.\n *\n * @param source - The icon as read from its library.\n * @returns The converted icon, or why it couldn't be converted.\n */\nexport function convertIcon(source: SourceIcon): ConvertedIcon {\n const drawing = parseDrawing(source.svg);\n if (typeof drawing === \"string\") return { problem: drawing };\n\n const problem = findDrawingProblem(drawing);\n if (isDefined(problem)) return { problem };\n\n const nameWords = new Set(source.name.split(\"-\"));\n const keywords = [...new Set(source.keywords.map((keyword) => keyword.trim().toLowerCase()))].filter(\n (keyword) => isDefined(keyword) && !nameWords.has(keyword),\n );\n\n return { icon: { name: source.name, keywords, node: drawing.node, root: drawing.root } };\n}\n","import { readFile, readdir } from \"node:fs/promises\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nimport { isDefined, isRecord } from \"@repo/lib/utils\";\nimport type { ElementType, createElement } from \"react\";\nimport type { renderToStaticMarkup } from \"react-dom/server\";\n\nimport type { SourceIcon } from \"@/build/convert\";\nimport { toReactName } from \"@/build/convert\";\n\n/** Root of a 24-unit stroke icon with rounded ends, shared by Lucide and Tabler's outline style. */\nexport const roundStrokeRoot = {\n viewBox: \"0 0 24 24\",\n fill: \"none\",\n stroke: \"currentColor\",\n \"stroke-width\": \"2\",\n \"stroke-linecap\": \"round\",\n \"stroke-linejoin\": \"round\",\n};\n\n/**\n * Converts a PascalCase export name to the kebab-case name libraries use on their websites, splitting before numbers\n * too, so `Home01` becomes `home-01`.\n *\n * @param name - The export name.\n * @returns The kebab-case name.\n */\nexport function toKebabName(name: string) {\n return name\n .replaceAll(/(?<upper>[A-Z])(?<next>[A-Z][a-z])/gu, \"$<upper>-$<next>\")\n .replaceAll(/(?<lower>[a-z0-9])(?<upper>[A-Z])/gu, \"$<lower>-$<upper>\")\n .replaceAll(/(?<letter>[a-zA-Z])(?<digit>[0-9])/gu, \"$<letter>-$<digit>\")\n .toLowerCase();\n}\n\n/**\n * Checks whether a module is React, with its element factory.\n *\n * @param value - The module.\n * @returns True if the module is React.\n */\nfunction isReact(value: unknown): value is { createElement: typeof createElement } {\n return isRecord(value) && typeof value[\"createElement\"] === \"function\";\n}\n\n/**\n * Checks whether a module is React's server renderer.\n *\n * @param value - The module.\n * @returns True if the module is the server renderer.\n */\nfunction isServerRenderer(value: unknown): value is { renderToStaticMarkup: typeof renderToStaticMarkup } {\n return isRecord(value) && typeof value[\"renderToStaticMarkup\"] === \"function\";\n}\n\n/**\n * Checks whether a value can be rendered as a React element: a tag name, a component, or a wrapped component such as\n * one made by `memo`.\n *\n * @param value - The value.\n * @returns True if the value is an element type.\n */\nexport function isElementType(value: unknown): value is ElementType {\n return typeof value === \"string\" || typeof value === \"function\" || isRecord(value);\n}\n\n/**\n * Loads the project's React and its server renderer, so markup is written the way the project itself would write it.\n *\n * @param root - The project folder.\n * @returns React's element factory and a function that renders an element to markup, or undefined when the project\n * has no React.\n */\nexport function loadRenderer(root: string) {\n const react = requireFromProject(root, \"react\");\n const server = requireFromProject(root, \"react-dom/server\");\n if (!isReact(react) || !isServerRenderer(server)) return undefined;\n\n return {\n createElement: react.createElement,\n render: (type: ElementType, props: Record<string, unknown> = {}) =>\n server.renderToStaticMarkup(react.createElement(type, props)),\n };\n}\n\n/**\n * Converts attributes to React props, so React writes each name the way SVG spells it.\n *\n * @param attributes - The attributes, in SVG or React naming.\n * @returns The props.\n */\nfunction toProps(attributes: Record<string, unknown>) {\n return Object.fromEntries(\n Object.entries(attributes).flatMap(([name, value]) => (name === \"key\" ? [] : [[toReactName(name), String(value)]])),\n );\n}\n\n/**\n * Writes a list of `[element, attributes]` pairs, the format several libraries ship, as SVG markup. React writes the\n * attributes, so names in either SVG or React form come out right.\n *\n * @param root - The project folder.\n * @param attributes - Attributes of the SVG around the elements.\n * @param value - The list.\n * @returns The markup, or undefined when the value isn't a list of pairs.\n */\nexport function writeElementPairs(root: string, attributes: Record<string, string>, value: unknown) {\n const renderer = loadRenderer(root);\n if (!isDefined(renderer) || !Array.isArray(value)) return undefined;\n\n const { createElement: create, render } = renderer;\n const elements = value.flatMap((pair: unknown, index) =>\n Array.isArray(pair) && typeof pair[0] === \"string\" && isRecord(pair[1])\n ? [create(pair[0], { ...toProps(pair[1]), key: String(index) })]\n : [],\n );\n if (elements.length !== value.length) return undefined;\n\n return render(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", ...toProps(attributes), children: elements });\n}\n\n/**\n * Reads SVG files from a folder into icons.\n *\n * @param folder - The folder.\n * @param files - The file names to read.\n * @param describe - Gives each file's icon name and keywords.\n * @returns The icons, in the order given.\n */\nexport async function readSvgIcons(\n folder: string,\n files: string[],\n describe: (file: string) => { name: string; keywords: string[] },\n) {\n const icons = await Promise.all(\n files.map(async (file): Promise<SourceIcon> => ({\n ...describe(file),\n svg: await readFile(path.join(folder, file), \"utf8\"),\n })),\n );\n\n return icons;\n}\n\n/**\n * Lists the SVG files in a folder.\n *\n * @param directory - The folder.\n * @returns The file names, sorted.\n */\nexport async function listSvgFiles(directory: string) {\n const files = await readdir(directory);\n\n return files.filter((file) => file.endsWith(\".svg\")).toSorted();\n}\n\n/**\n * Imports a JavaScript module from inside an installed package, by path, since some packages don't allow importing\n * the file by name.\n *\n * @param directory - The package folder.\n * @param file - The module's path within the package.\n * @returns The module's exports.\n */\nexport async function importPackageFile(directory: string, file: string): Promise<Record<string, unknown>> {\n const loaded: unknown = await import(pathToFileURL(path.join(directory, file)).href);\n\n return isRecord(loaded) ? loaded : {};\n}\n\n/**\n * Loads a package the way the project itself resolves it, so rendering uses the project's own copy of React.\n *\n * @param root - The project folder.\n * @param name - The package name.\n * @returns The package's exports.\n */\nexport function requireFromProject(root: string, name: string): unknown {\n return createRequire(path.join(root, \"package.json\"))(name);\n}\n","import { createHash } from \"node:crypto\";\nimport { readFile, readdir } from \"node:fs/promises\";\nimport path from \"node:path\";\n\nimport { isDefined, isRecord } from \"@repo/lib/utils\";\n\n/** An installed package's folder and version. */\nexport interface InstalledPackage {\n /** Name the package was published under, which differs from the name it's installed under when it's an alias. */\n name: string;\n /** Folder the package is installed in. */\n directory: string;\n /** Version installed. */\n version: string;\n}\n\n/**\n * Lists the plugin's own published code files.\n *\n * @returns The files' paths, sorted.\n */\nexport async function listPluginFiles() {\n const files = await readdir(import.meta.dirname);\n\n return files\n .filter((file) => file.endsWith(\".js\"))\n .toSorted()\n .map((file) => path.join(import.meta.dirname, file));\n}\n\n/**\n * Hashes the plugin's own published code, so anything built from an older version is replaced. It uses the contents\n * rather than modification times, because packages installed from npm all carry the same fixed date.\n *\n * @returns The hash.\n */\nexport async function readPluginBuild() {\n const files = await listPluginFiles();\n const contents = await Promise.all(files.map(async (file) => ({ file, content: await readFile(file) })));\n const hash = createHash(\"sha256\");\n\n for (const { file, content } of contents) hash.update(path.basename(file)).update(content);\n\n return hash.digest(\"hex\").slice(0, 16);\n}\n\n/**\n * Reads and parses a JSON file.\n *\n * @param file - Path to the file.\n * @returns The parsed contents, or undefined when the file is missing or isn't JSON.\n */\nexport async function readJson(file: string): Promise<unknown> {\n try {\n return JSON.parse(await readFile(file, \"utf8\"));\n } catch {\n return undefined;\n }\n}\n\n/**\n * Lists a folder and every folder above it, nearest first.\n *\n * @param directory - The folder to start from.\n * @returns The folders.\n */\nfunction listAncestors(directory: string): string[] {\n const parent = path.dirname(directory);\n\n return parent === directory ? [directory] : [directory, ...listAncestors(parent)];\n}\n\n/**\n * Finds an installed package by walking up from the project folder through each `node_modules`, the way Node does.\n * Its `package.json` is read directly, because some icon packages don't allow importing it.\n *\n * @param root - The project folder.\n * @param name - The package name.\n * @returns The package, or undefined when it isn't installed.\n */\nexport async function findPackage(root: string, name: string): Promise<InstalledPackage | undefined> {\n const candidates = await Promise.all(\n listAncestors(path.resolve(root)).map(async (folder) => {\n const directory = path.join(folder, \"node_modules\", name);\n\n return { directory, manifest: await readJson(path.join(directory, \"package.json\")) };\n }),\n );\n\n for (const { directory, manifest } of candidates) {\n if (isRecord(manifest) && typeof manifest[\"version\"] === \"string\") {\n const published = typeof manifest[\"name\"] === \"string\" ? manifest[\"name\"] : name;\n\n return { name: published, directory, version: manifest[\"version\"] };\n }\n }\n\n return undefined;\n}\n\n/**\n * Lists the packages a project declares, from its dependencies, dev dependencies, and peer dependencies.\n *\n * @param root - The project folder.\n * @returns The declared package names.\n */\nexport async function readDeclaredPackages(root: string) {\n const manifest = await readJson(path.join(root, \"package.json\"));\n if (!isRecord(manifest)) return new Set<string>();\n\n const groups = [manifest[\"dependencies\"], manifest[\"devDependencies\"], manifest[\"peerDependencies\"]];\n\n return new Set(\n groups.flatMap((group) => (isRecord(group) ? Object.keys(group) : [])).filter((name) => isDefined(name)),\n );\n}\n","import path from \"node:path\";\n\nimport { convertCase, isRecord } from \"@repo/lib/utils\";\n\nimport { listSvgFiles, readSvgIcons } from \"@/build/adapters/shared\";\nimport type { IconAdapter } from \"@/build/adapters/types\";\nimport { readJson } from \"@/build/packages\";\n\n/**\n * Creates an adapter for a folder of the project's own SVG files. Each file becomes an icon named after the file, and an\n * optional `keywords.json` in the folder lists each icon's keywords by name.\n *\n * @param library - Identifier of the set.\n * @param folder - The folder, relative to the project.\n * @returns The adapter.\n */\nexport function createCustomAdapter(library: string, folder: string): IconAdapter {\n return {\n library,\n label: convertCase(library, \"title\"),\n packageName: undefined,\n styles: [\"default\"],\n async read({ root }) {\n const directory = path.resolve(root, folder);\n const [files, keywords] = await Promise.all([\n listSvgFiles(directory),\n readJson(path.join(directory, \"keywords.json\")),\n ]);\n\n return readSvgIcons(directory, files, (file) => {\n const name = convertCase(file.slice(0, -\".svg\".length), \"kebab\");\n const listed = isRecord(keywords) ? keywords[name] : undefined;\n\n return { name, keywords: Array.isArray(listed) ? listed.map(String) : [] };\n });\n },\n };\n}\n","import path from \"node:path\";\n\nimport { isDefined, isRecord } from \"@repo/lib/utils\";\n\nimport { importPackageFile, isElementType, loadRenderer, toKebabName } from \"@/build/adapters/shared\";\nimport type { IconAdapter } from \"@/build/adapters/types\";\nimport { readJson } from \"@/build/packages\";\n\n/**\n * Central, read by rendering the React components of its licensed style packages. Each installed\n * `@central-icons-react/` package is a style, named after the rest of its name, so several can be used at once. Each\n * icon is drawn in Central's raw mode, since its default mode draws through a mask.\n */\nexport const centralAdapter: IconAdapter = {\n library: \"central\",\n label: \"Central Icon System\",\n packageName: undefined,\n packagePrefix: \"@central-icons-react/\",\n packageExample: \"@central-icons-react/round-outlined-radius-2-stroke-1.5\",\n styles: [],\n async read({ directory, root }) {\n const renderer = loadRenderer(root);\n if (!isDefined(renderer)) return [];\n\n const [exports, index] = await Promise.all([\n importPackageFile(directory, \"index.mjs\"),\n readJson(path.join(directory, \"icons-index.json\")),\n ]);\n const aliases = isRecord(index) && isRecord(index[\"iconAliases\"]) ? index[\"iconAliases\"] : {};\n\n return Object.entries(exports).flatMap(([exportName, component]) => {\n // Central's components are wrapped in `memo` and `forwardRef`, so they're objects rather than functions.\n if (!exportName.startsWith(\"Icon\") || exportName.endsWith(\"Default\") || !isElementType(component)) return [];\n\n const svg = renderer.render(component, { mode: \"raw\" });\n\n const listed = aliases[exportName];\n const keywords = typeof listed === \"string\" ? listed.split(\",\").map((keyword) => keyword.trim()) : [];\n\n return [{ name: toKebabName(exportName.slice(\"Icon\".length)), keywords, svg }];\n });\n },\n};\n","/** Fills Central Icon System draws each style in. */\nconst centralFills = [\"outlined\", \"filled\"] as const;\n\n/** Corner radii Central Icon System's round styles come in. */\nconst centralRadii = [\"0\", \"1\", \"2\", \"3\"] as const;\n\n/** Stroke widths Central Icon System's styles come in. */\nconst centralStrokes = [\"1\", \"1.5\", \"2\"] as const;\n\n/** Styles Central Icon System publishes, one package each, named after the corners, fill, radius, and stroke. */\nconst centralStyles = [\n ...centralFills.flatMap((fill) =>\n centralRadii.flatMap((radius) =>\n centralStrokes.map((stroke) => `round-${fill}-radius-${radius}-stroke-${stroke}` as const),\n ),\n ),\n ...centralFills.flatMap((fill) =>\n centralStrokes.map((stroke) => `square-${fill}-radius-0-stroke-${stroke}` as const),\n ),\n];\n\n/** Packages Nucleo publishes, each a style named after the rest of its package name. */\nconst nucleoStyles = [\n \"arcade\",\n \"core-essential-fill-24\",\n \"core-essential-fill-32\",\n \"core-essential-fill-48\",\n \"core-essential-outline-24\",\n \"core-essential-outline-32\",\n \"core-essential-outline-48\",\n \"core-fill-24\",\n \"core-fill-32\",\n \"core-fill-48\",\n \"core-outline-24\",\n \"core-outline-32\",\n \"core-outline-48\",\n \"credit-cards\",\n \"flags\",\n \"glass\",\n \"isometric\",\n \"micro-bold\",\n \"micro-bold-essential\",\n \"pixel\",\n \"pixel-essential\",\n \"sharp\",\n \"sharp-essential\",\n \"social-media\",\n \"ui-essential-fill-12\",\n \"ui-essential-fill-18\",\n \"ui-essential-fill-duo-18\",\n \"ui-essential-outline-12\",\n \"ui-essential-outline-18\",\n \"ui-essential-outline-duo-18\",\n \"ui-fill-12\",\n \"ui-fill-18\",\n \"ui-fill-duo-18\",\n \"ui-outline-12\",\n \"ui-outline-18\",\n \"ui-outline-duo-18\",\n] as const;\n\n/**\n * Styles of each library the plugin supports, the first being the default. For a library published as a family of\n * packages, its styles are the packages it publishes, and the installed ones are used.\n */\nexport const iconLibraryStyles = {\n central: centralStyles,\n heroicons: [\"outline\", \"solid\", \"mini\", \"micro\"],\n hugeicons: [\"stroke-rounded\"],\n iconoir: [\"regular\", \"solid\"],\n lucide: [\"default\"],\n nucleo: nucleoStyles,\n phosphor: [\"regular\", \"thin\", \"light\", \"bold\", \"fill\", \"duotone\"],\n tabler: [\"outline\", \"filled\"],\n} as const;\n","import path from \"node:path\";\n\nimport { listSvgFiles, readSvgIcons } from \"@/build/adapters/shared\";\nimport type { IconAdapter } from \"@/build/adapters/types\";\nimport { iconLibraryStyles } from \"@/lib/libraries\";\n\n/** Folder each Heroicons style is published in, named after the size it's drawn for. */\nconst styleFolders: Record<string, string> = {\n outline: \"24/outline\",\n solid: \"24/solid\",\n mini: \"20/solid\",\n micro: \"16/solid\",\n};\n\n/**\n * Heroicons, read from the SVG files the `heroicons` package ships for each style. It has no keywords, so its icons\n * are found by name.\n */\nexport const heroiconsAdapter: IconAdapter = {\n library: \"heroicons\",\n label: \"Heroicons\",\n packageName: \"heroicons\",\n packagePattern: /^(?:heroicons|@heroicons\\/.+)$/u,\n styles: [...iconLibraryStyles.heroicons],\n async read({ directory, style }) {\n const folder = path.join(directory, styleFolders[style] ?? \"24/outline\");\n const files = await listSvgFiles(folder);\n\n return readSvgIcons(folder, files, (file) => ({ name: file.slice(0, -\".svg\".length), keywords: [] }));\n },\n};\n","import { isDefined } from \"@repo/lib/utils\";\n\nimport { importPackageFile, toKebabName, writeElementPairs } from \"@/build/adapters/shared\";\nimport type { IconAdapter } from \"@/build/adapters/types\";\nimport { iconLibraryStyles } from \"@/lib/libraries\";\n\n/** Suffixes Hugeicons adds to its export names, removed to get the icon's own name. */\nconst exportSuffixes = /(?:FreeIcons|Icon)$/u;\n\n/**\n * Hugeicons, read from the shape data `@hugeicons/core-free-icons` exports. It has no keywords, so its icons are found\n * by name. The package also exports many icons under other libraries' names, which aren't used as keywords because\n * they don't describe the icon.\n */\nexport const hugeiconsAdapter: IconAdapter = {\n library: \"hugeicons\",\n label: \"Hugeicons\",\n packageName: \"@hugeicons/core-free-icons\",\n packagePattern: /^@hugeicons\\//u,\n styles: [...iconLibraryStyles.hugeicons],\n async read({ directory, root }) {\n const exports = await importPackageFile(directory, \"dist/esm/index.js\");\n const namesByIcon = new Map<unknown, string[]>();\n\n for (const [exportName, value] of Object.entries(exports)) {\n namesByIcon.set(value, [...(namesByIcon.get(value) ?? []), exportName]);\n }\n\n return [...namesByIcon].flatMap(([value, exportNames]) => {\n const svg = writeElementPairs(root, { viewBox: \"0 0 24 24\", fill: \"none\" }, value);\n const iconNames = exportNames.filter((exportName) => exportName.endsWith(\"Icon\")).toSorted();\n const [primary] = iconNames;\n if (!isDefined(svg) || !isDefined(primary)) return [];\n\n const name = toKebabName(primary.replace(exportSuffixes, \"\"));\n\n return [{ name, keywords: [], svg }];\n });\n },\n};\n","import path from \"node:path\";\n\nimport { listSvgFiles, readSvgIcons } from \"@/build/adapters/shared\";\nimport type { IconAdapter } from \"@/build/adapters/types\";\nimport { iconLibraryStyles } from \"@/lib/libraries\";\n\n/** Iconoir, read from the SVG files the `iconoir` package ships for each style. It has no keywords. */\nexport const iconoirAdapter: IconAdapter = {\n library: \"iconoir\",\n label: \"Iconoir\",\n packageName: \"iconoir\",\n packagePattern: /^iconoir(?:-.+)?$/u,\n styles: [...iconLibraryStyles.iconoir],\n async read({ directory, style }) {\n const folder = path.join(directory, \"icons\", style);\n const files = await listSvgFiles(folder);\n\n return readSvgIcons(folder, files, (file) => ({ name: file.slice(0, -\".svg\".length), keywords: [] }));\n },\n};\n","import path from \"node:path\";\n\nimport { isDefined, isRecord } from \"@repo/lib/utils\";\n\nimport { roundStrokeRoot, writeElementPairs } from \"@/build/adapters/shared\";\nimport type { IconAdapter } from \"@/build/adapters/types\";\nimport { readJson } from \"@/build/packages\";\nimport { iconLibraryStyles } from \"@/lib/libraries\";\n\n/** Lucide, read from the shape data and keywords `lucide-static` ships. */\nexport const lucideAdapter: IconAdapter = {\n library: \"lucide\",\n label: \"Lucide\",\n packageName: \"lucide-static\",\n packagePattern: /^(?:lucide(?:-.+)?|@lucide\\/.+)$/u,\n styles: [...iconLibraryStyles.lucide],\n async read({ directory, root }) {\n const [nodes, tags] = await Promise.all([\n readJson(path.join(directory, \"icon-nodes.json\")),\n readJson(path.join(directory, \"tags.json\")),\n ]);\n if (!isRecord(nodes)) return [];\n\n return Object.entries(nodes).flatMap(([name, value]) => {\n const svg = writeElementPairs(root, roundStrokeRoot, value);\n if (!isDefined(svg)) return [];\n\n const keywords = isRecord(tags) && Array.isArray(tags[name]) ? tags[name].map(String) : [];\n\n return [{ name, keywords, svg }];\n });\n },\n};\n","import { isDefined } from \"@repo/lib/utils\";\n\nimport { importPackageFile, isElementType, loadRenderer, toKebabName } from \"@/build/adapters/shared\";\nimport type { IconAdapter } from \"@/build/adapters/types\";\n\n/**\n * Finds the style suffix every export name in a Nucleo package ends with, such as `Outline18`, so it can be removed to\n * get each icon's own name.\n *\n * @param names - The export names.\n * @returns The shared suffix, starting at a capital letter, or an empty string when there's none.\n */\nfunction findStyleSuffix(names: string[]) {\n const [first, ...rest] = names;\n if (!isDefined(first)) return \"\";\n\n let length = 0;\n while (length < first.length && rest.every((name) => name.at(-1 - length) === first.at(-1 - length))) length += 1;\n\n const shared = first.slice(first.length - length);\n const start = shared.search(/[A-Z]/u);\n\n return start === -1 ? \"\" : shared.slice(start);\n}\n\n/**\n * Nucleo, read by rendering the React components of its licensed packages. Each installed `nucleo-` package is a\n * style, named after the rest of its name, such as `ui-outline-18`. It has no keywords.\n */\nexport const nucleoAdapter: IconAdapter = {\n library: \"nucleo\",\n label: \"Nucleo\",\n packageName: undefined,\n packagePrefix: \"nucleo-\",\n packageExample: \"nucleo-ui-outline-18\",\n styles: [],\n async read({ directory, root }) {\n const renderer = loadRenderer(root);\n if (!isDefined(renderer)) return [];\n\n const exports = await importPackageFile(directory, \"dist/index.js\");\n const components = Object.entries(exports).flatMap(([exportName, component]) =>\n exportName.startsWith(\"Icon\") && exportName !== \"Icon\" && isElementType(component)\n ? [[exportName, component] as const]\n : [],\n );\n const suffix = findStyleSuffix(components.map(([exportName]) => exportName));\n\n return components.flatMap(([exportName, component]) => {\n const svg = renderer.render(component);\n\n const name = toKebabName(exportName.slice(\"Icon\".length, exportName.length - suffix.length));\n\n return [{ name, keywords: [], svg }];\n });\n },\n};\n","import path from \"node:path\";\n\nimport { isRecord } from \"@repo/lib/utils\";\n\nimport { importPackageFile, listSvgFiles, readSvgIcons } from \"@/build/adapters/shared\";\nimport type { IconAdapter } from \"@/build/adapters/types\";\nimport { iconLibraryStyles } from \"@/lib/libraries\";\n\n/**\n * Reads Phosphor's keywords from the icon list `@phosphor-icons/core` exports.\n *\n * @param directory - The package folder.\n * @returns Keywords keyed by icon name.\n */\nasync function readPhosphorKeywords(directory: string) {\n const { icons } = await importPackageFile(directory, \"dist/index.mjs\");\n if (!Array.isArray(icons)) return new Map<string, string[]>();\n\n return new Map(\n icons.flatMap((icon: unknown) =>\n isRecord(icon) && typeof icon[\"name\"] === \"string\" && Array.isArray(icon[\"tags\"])\n ? [[icon[\"name\"], icon[\"tags\"].map(String)] as const]\n : [],\n ),\n );\n}\n\n/** Phosphor, read from the SVG files `@phosphor-icons/core` ships for each weight. */\nexport const phosphorAdapter: IconAdapter = {\n library: \"phosphor\",\n label: \"Phosphor Icons\",\n packageName: \"@phosphor-icons/core\",\n packagePattern: /^@phosphor-icons\\//u,\n styles: [...iconLibraryStyles.phosphor],\n async read({ directory, style }) {\n const folder = path.join(directory, \"assets\", style);\n const [files, keywords] = await Promise.all([listSvgFiles(folder), readPhosphorKeywords(directory)]);\n const suffix = style === \"regular\" ? \".svg\" : `-${style}.svg`;\n\n return readSvgIcons(\n folder,\n files.filter((file) => file.endsWith(suffix)),\n (file) => {\n const name = file.slice(0, -suffix.length);\n\n return { name, keywords: keywords.get(name) ?? [] };\n },\n );\n },\n};\n","import path from \"node:path\";\n\nimport { isDefined, isRecord } from \"@repo/lib/utils\";\n\nimport { roundStrokeRoot, writeElementPairs } from \"@/build/adapters/shared\";\nimport type { IconAdapter } from \"@/build/adapters/types\";\nimport { readJson } from \"@/build/packages\";\nimport { iconLibraryStyles } from \"@/lib/libraries\";\n\n/** Tabler, read from the shape data and keywords `@tabler/icons` ships for each style. */\nexport const tablerAdapter: IconAdapter = {\n library: \"tabler\",\n label: \"Tabler Icons\",\n packageName: \"@tabler/icons\",\n packagePattern: /^@tabler\\/icons(?:-.+)?$/u,\n styles: [...iconLibraryStyles.tabler],\n async read({ directory, style, root }) {\n const [nodes, details] = await Promise.all([\n readJson(path.join(directory, `tabler-nodes-${style}.json`)),\n readJson(path.join(directory, \"icons.json\")),\n ]);\n if (!isRecord(nodes)) return [];\n\n const attributes = style === \"filled\" ? { viewBox: \"0 0 24 24\", fill: \"currentColor\" } : roundStrokeRoot;\n\n return Object.entries(nodes).flatMap(([name, value]) => {\n const svg = writeElementPairs(root, attributes, value);\n if (!isDefined(svg)) return [];\n\n const detail = isRecord(details) ? details[name] : undefined;\n const tags = isRecord(detail) && Array.isArray(detail[\"tags\"]) ? detail[\"tags\"].map(String) : [];\n\n return [{ name, keywords: tags, svg }];\n });\n },\n};\n","import { centralAdapter } from \"@/build/adapters/central\";\nimport { heroiconsAdapter } from \"@/build/adapters/heroicons\";\nimport { hugeiconsAdapter } from \"@/build/adapters/hugeicons\";\nimport { iconoirAdapter } from \"@/build/adapters/iconoir\";\nimport { lucideAdapter } from \"@/build/adapters/lucide\";\nimport { nucleoAdapter } from \"@/build/adapters/nucleo\";\nimport { phosphorAdapter } from \"@/build/adapters/phosphor\";\nimport { tablerAdapter } from \"@/build/adapters/tabler\";\nimport type { IconAdapter } from \"@/build/adapters/types\";\n\n/** Every library the build step knows how to read from its package. */\nexport const iconAdapters: IconAdapter[] = [\n centralAdapter,\n heroiconsAdapter,\n hugeiconsAdapter,\n iconoirAdapter,\n lucideAdapter,\n nucleoAdapter,\n phosphorAdapter,\n tablerAdapter,\n];\n"],"mappings":";;;;;;;;AA0BA,MAAMmB,qCAAqB,IAAI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ACD,IAAI,CAACd,SAASiB,KAAK,GAAG,OAAO,CAAA;GAE7B,IAAMK,aAAaP,UAAU,WAAW;IAAEQ,SAAS;IAAaC,MAAM;GAAe,IAAIvB;GAEzF,OAAOwB,OAAOC,QAAQT,KAAK,CAAC,CAACU,SAAS,CAACC,MAAMC,WAAW;IACtD,IAAMC,MAAM5B,kBAAkBc,MAAMM,YAAYO,KAAK;IACrD,IAAI,CAAC9B,UAAU+B,GAAG,GAAG,OAAO,CAAA;IAE5B,IAAMC,SAAS/B,SAASkB,OAAO,IAAIA,QAAQU,QAAQI,KAAAA;IAGnD,OAAO,CAAC;KAAEJ;KAAMU,UAFHtC,SAAS+B,MAAM,KAAKG,MAAMC,QAAQJ,OAAO6B,IAAO,IAAI7B,OAAO6B,KAAQxB,IAAIC,MAAM,IAAI,CAAA;KAE9DP;IAAI,CAAC;GACvC,CAAC;EACH;CCfAgB;AAAa"}
|
|
1
|
+
{"version":3,"file":"adapters-JowAC3d_.js","names":["createHash","isDefined","XastChild","XastElement","XastRoot","optimize","IconDrawing","IconElement","IconRoot","findDrawingProblem","IconSetIcon","SourceIcon","name","keywords","svg","ConvertedIcon","icon","root","problem","rootOnlyAttributes","Set","toReactName","replaceAll","_match","character","toUpperCase","readAttributes","attributes","Record","omitted","ReadonlySet","Object","fromEntries","entries","flatMap","value","test","has","closeOpenUrls","element","readChildren","children","child","type","trim","nested","readSvgElement","tree","find","undefined","width","replace","height","viewBox","node","filter","readDrawing","result","drawing","declared","includes","multipass","plugins","fn","enter","params","overrides","cleanupNumericValues","convertPathData","convertTransform","inlineStyles","onlyMatchedOnce","mergePaths","prefix","update","digest","slice","parseDrawing","convertIcon","source","nameWords","split","map","keyword","toLowerCase","readFile","readdir","createRequire","path","pathToFileURL","isDefined","isRecord","ElementType","createElement","renderToStaticMarkup","SourceIcon","toReactName","roundStrokeRoot","viewBox","fill","stroke","toKebabName","name","replaceAll","toLowerCase","isReact","value","isServerRenderer","isElementType","loadRenderer","root","react","requireFromProject","server","undefined","render","type","props","Record","toProps","attributes","Object","fromEntries","entries","flatMap","String","writeElementPairs","renderer","Array","isArray","create","elements","pair","index","key","length","xmlns","children","readSvgIcons","folder","files","describe","file","keywords","icons","Promise","all","map","svg","join","listSvgFiles","directory","filter","endsWith","toSorted","importPackageFile","loaded","href","createHash","readFile","readdir","path","isDefined","isRecord","InstalledPackage","name","directory","version","listPluginFiles","files","import","meta","dirname","filter","file","endsWith","toSorted","map","join","readPluginBuild","contents","Promise","all","content","hash","update","basename","digest","slice","readJson","JSON","parse","undefined","listAncestors","parent","findPackage","root","candidates","resolve","folder","manifest","published","readDeclaredPackages","Set","groups","flatMap","group","Object","keys","path","convertCase","isRecord","listSvgFiles","readSvgIcons","IconAdapter","readJson","createCustomAdapter","library","folder","label","packageName","undefined","styles","read","root","directory","resolve","files","keywords","Promise","all","join","file","name","slice","length","listed","Array","isArray","map","String","path","isDefined","isRecord","importPackageFile","isElementType","loadRenderer","toKebabName","IconAdapter","readJson","centralAdapter","library","label","packageName","undefined","packagePrefix","packageExample","styles","read","directory","root","renderer","exports","index","Promise","all","join","aliases","Object","entries","flatMap","exportName","component","startsWith","endsWith","svg","render","mode","listed","keywords","split","map","keyword","trim","name","slice","length","centralFills","const","centralRadii","centralStrokes","centralStyles","flatMap","fill","radius","map","stroke","nucleoStyles","iconLibraryStyles","central","heroicons","hugeicons","iconoir","lucide","nucleo","phosphor","tabler","path","listSvgFiles","readSvgIcons","IconAdapter","iconLibraryStyles","styleFolders","Record","outline","solid","mini","micro","heroiconsAdapter","library","label","packageName","packagePattern","styles","heroicons","read","directory","style","folder","join","files","file","name","slice","length","keywords","isDefined","importPackageFile","toKebabName","writeElementPairs","IconAdapter","iconLibraryStyles","exportSuffixes","hugeiconsAdapter","library","label","packageName","packagePattern","styles","hugeicons","read","directory","root","exports","namesByIcon","Map","exportName","value","Object","entries","set","get","flatMap","exportNames","svg","viewBox","fill","iconNames","filter","endsWith","toSorted","primary","name","replace","keywords","path","listSvgFiles","readSvgIcons","IconAdapter","iconLibraryStyles","iconoirAdapter","library","label","packageName","packagePattern","styles","iconoir","read","directory","style","folder","join","files","file","name","slice","length","keywords","path","isDefined","isRecord","roundStrokeRoot","writeElementPairs","IconAdapter","readJson","iconLibraryStyles","lucideAdapter","library","label","packageName","packagePattern","styles","lucide","read","directory","root","nodes","tags","Promise","all","join","Object","entries","flatMap","name","value","svg","keywords","Array","isArray","map","String","isDefined","importPackageFile","isElementType","loadRenderer","toKebabName","IconAdapter","findStyleSuffix","names","first","rest","length","every","name","at","shared","slice","start","search","nucleoAdapter","library","label","packageName","undefined","packagePrefix","packageExample","styles","read","directory","root","renderer","exports","components","Object","entries","flatMap","exportName","component","startsWith","const","suffix","map","svg","render","keywords","path","isRecord","importPackageFile","listSvgFiles","readSvgIcons","IconAdapter","iconLibraryStyles","readPhosphorKeywords","directory","icons","Array","isArray","Map","flatMap","icon","map","String","const","phosphorAdapter","library","label","packageName","packagePattern","styles","phosphor","read","style","folder","join","files","keywords","Promise","all","suffix","filter","file","endsWith","name","slice","length","get","path","isDefined","isRecord","roundStrokeRoot","writeElementPairs","IconAdapter","readJson","iconLibraryStyles","tablerAdapter","library","label","packageName","packagePattern","styles","tabler","read","directory","style","root","nodes","details","Promise","all","join","attributes","viewBox","fill","Object","entries","flatMap","name","value","svg","detail","undefined","tags","Array","isArray","map","String","keywords","centralAdapter","heroiconsAdapter","hugeiconsAdapter","iconoirAdapter","lucideAdapter","nucleoAdapter","phosphorAdapter","tablerAdapter","IconAdapter","iconAdapters","\"width\"","\"height\"","\"viewBox\"","\"createElement\"","\"renderToStaticMarkup\"","\"version\"","\"name\"","\"dependencies\"","\"devDependencies\"","\"peerDependencies\"","\"iconAliases\"","\"tags\""],"sources":["../src/build/convert.ts","../src/build/adapters/shared.ts","../src/build/packages.ts","../src/build/adapters/custom.ts","../src/build/adapters/central.ts","../src/lib/libraries.ts","../src/build/adapters/heroicons.ts","../src/build/adapters/hugeicons.ts","../src/build/adapters/iconoir.ts","../src/build/adapters/lucide.ts","../src/build/adapters/nucleo.ts","../src/build/adapters/phosphor.ts","../src/build/adapters/tabler.ts","../src/build/adapters/index.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\n\nimport { isDefined } from \"@repo/lib/utils\";\nimport type { XastChild, XastElement, XastRoot } from \"svgo\";\nimport { optimize } from \"svgo\";\n\nimport type { IconDrawing, IconElement, IconRoot } from \"@/lib/nodes\";\nimport { findDrawingProblem } from \"@/lib/nodes\";\nimport type { IconSetIcon } from \"@/lib/sets\";\n\n/** An icon as read from a library, before conversion. */\nexport interface SourceIcon {\n /** Name of the icon in its library. */\n name: string;\n /** Words describing the icon, from its library. */\n keywords: string[];\n /** The icon's SVG markup. */\n svg: string;\n}\n\n/** An icon after conversion, with its own root, or why it couldn't be converted. */\nexport type ConvertedIcon =\n | { icon: IconSetIcon & { root: IconRoot }; problem?: undefined }\n | { icon?: undefined; problem: string };\n\n/** Attributes of the outer SVG that size or label it rather than draw it, since the renderer sets its own. */\nconst rootOnlyAttributes = new Set([\"class\", \"focusable\", \"height\", \"role\", \"version\", \"width\"]);\n\n/**\n * Converts an SVG attribute name to its React form, such as `stroke-width` to `strokeWidth` and `xlink:href` to\n * `xlinkHref`.\n *\n * @param name - The attribute name.\n * @returns The React name.\n */\nexport function toReactName(name: string) {\n return name.replaceAll(/[-:](?<character>[a-z])/gu, (_match, character: string) => character.toUpperCase());\n}\n\n/**\n * Converts attributes to React naming, leaving out namespaces, classes, and data and accessibility attributes, which\n * don't draw anything.\n *\n * @param attributes - The attributes.\n * @param omitted - Further attributes to leave out.\n * @returns The converted attributes.\n */\nfunction readAttributes(attributes: Record<string, string>, omitted: ReadonlySet<string> = new Set([\"class\"])) {\n return Object.fromEntries(\n Object.entries(attributes).flatMap(([name, value]) =>\n /^(?:xmlns|data-|aria-)/u.test(name) || omitted.has(name) ? [] : [[toReactName(name), value]],\n ),\n );\n}\n\n/**\n * Closes a `url(` left open at the end of each attribute value, which is how browsers read it.\n *\n * @param element - The element whose attributes to close.\n */\nfunction closeOpenUrls(element: XastElement) {\n for (const [name, value] of Object.entries(element.attributes)) {\n if (/url\\([^)]*$/u.test(value)) element.attributes[name] = `${value})`;\n }\n}\n\n/**\n * Converts SVGO's parsed children into stored elements, keeping text and dropping comments.\n *\n * @param children - The parsed children.\n * @returns The elements and text.\n */\nfunction readChildren(children: XastChild[]) {\n return children.flatMap((child): (IconElement | string)[] => {\n if (child.type === \"text\") return isDefined(child.value.trim()) ? [child.value] : [];\n if (child.type !== \"element\") return [];\n\n const nested = readChildren(child.children);\n const attributes = readAttributes(child.attributes);\n\n return [isDefined(nested) ? [child.name, attributes, nested] : [child.name, attributes]];\n });\n}\n\n/**\n * Reads SVGO's parsed document into a drawing, from its outer `svg` element.\n *\n * @param tree - The parsed document.\n * @returns The drawing, or undefined when the document has no `svg` element.\n */\nfunction readSvgElement(tree: XastRoot) {\n const element = tree.children.find((child): child is XastElement => child.type === \"element\" && child.name === \"svg\");\n if (!isDefined(element)) return undefined;\n\n // A size like `24px` means 24 units, the way browsers read it.\n const width = element.attributes[\"width\"]?.replace(/px$/u, \"\") ?? \"24\";\n const height = element.attributes[\"height\"]?.replace(/px$/u, \"\") ?? width;\n const attributes = readAttributes(element.attributes, rootOnlyAttributes);\n\n return {\n root: { ...attributes, viewBox: attributes[\"viewBox\"] ?? `0 0 ${width} ${height}` },\n node: readChildren(element.children).filter((child): child is IconElement => typeof child !== \"string\"),\n };\n}\n\n/**\n * Cleans and minifies an icon with SVGO, then reads the result into a drawing. Paths, numbers, and transforms are kept\n * exactly as drawn, since rounding or merging them changes how some icons look, and every identifier gets a prefix\n * unique to the icon, so two icons on one page can't clash.\n *\n * @param svg - The icon's SVG markup.\n * @returns The drawing, or undefined when the markup has no SVG.\n * @throws When the markup can't be parsed.\n */\nfunction readDrawing(svg: string) {\n const result: { drawing?: IconDrawing } = {};\n\n // Browsers accept `xlink:` attributes without the namespace declaration, which React leaves out, but SVGO doesn't.\n const declared =\n svg.includes(\"xlink:\") && !svg.includes(\"xmlns:xlink\")\n ? svg.replace(\"<svg\", '<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\"')\n : svg;\n\n optimize(declared, {\n multipass: true,\n plugins: [\n { name: \"closeOpenUrls\", fn: () => ({ element: { enter: closeOpenUrls } }) },\n {\n name: \"preset-default\",\n params: {\n overrides: {\n cleanupNumericValues: false,\n convertPathData: false,\n convertTransform: false,\n inlineStyles: { onlyMatchedOnce: false },\n mergePaths: false,\n },\n },\n },\n \"removeScripts\",\n \"removeTitle\",\n { name: \"prefixIds\", params: { prefix: `i${createHash(\"sha256\").update(svg).digest(\"hex\").slice(0, 8)}` } },\n {\n name: \"read\",\n fn: () => ({\n root: {\n enter(tree) {\n result.drawing = readSvgElement(tree);\n },\n },\n }),\n },\n ],\n });\n\n return result.drawing;\n}\n\n/**\n * Reads an icon's markup into a drawing, or says why it can't be read.\n *\n * @param svg - The icon's SVG markup.\n * @returns The drawing, or why there isn't one.\n */\nfunction parseDrawing(svg: string) {\n try {\n return readDrawing(svg) ?? \"has no SVG\";\n } catch {\n return \"isn't valid SVG\";\n }\n}\n\n/**\n * Converts one icon into a stored drawing, the same way whichever library it came from.\n *\n * @param source - The icon as read from its library.\n * @returns The converted icon, or why it couldn't be converted.\n */\nexport function convertIcon(source: SourceIcon): ConvertedIcon {\n const drawing = parseDrawing(source.svg);\n if (typeof drawing === \"string\") return { problem: drawing };\n\n const problem = findDrawingProblem(drawing);\n if (isDefined(problem)) return { problem };\n\n const nameWords = new Set(source.name.split(\"-\"));\n const keywords = [...new Set(source.keywords.map((keyword) => keyword.trim().toLowerCase()))].filter(\n (keyword) => isDefined(keyword) && !nameWords.has(keyword),\n );\n\n return { icon: { name: source.name, keywords, node: drawing.node, root: drawing.root } };\n}\n","import { readFile, readdir } from \"node:fs/promises\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nimport { isDefined, isRecord } from \"@repo/lib/utils\";\nimport type { ElementType, createElement } from \"react\";\nimport type { renderToStaticMarkup } from \"react-dom/server\";\n\nimport type { SourceIcon } from \"@/build/convert\";\nimport { toReactName } from \"@/build/convert\";\n\n/** Root of a 24-unit stroke icon with rounded ends, shared by Lucide and Tabler's outline style. */\nexport const roundStrokeRoot = {\n viewBox: \"0 0 24 24\",\n fill: \"none\",\n stroke: \"currentColor\",\n \"stroke-width\": \"2\",\n \"stroke-linecap\": \"round\",\n \"stroke-linejoin\": \"round\",\n};\n\n/**\n * Converts a PascalCase export name to the kebab-case name libraries use on their websites, splitting before numbers\n * too, so `Home01` becomes `home-01`.\n *\n * @param name - The export name.\n * @returns The kebab-case name.\n */\nexport function toKebabName(name: string) {\n return name\n .replaceAll(/(?<upper>[A-Z])(?<next>[A-Z][a-z])/gu, \"$<upper>-$<next>\")\n .replaceAll(/(?<lower>[a-z0-9])(?<upper>[A-Z])/gu, \"$<lower>-$<upper>\")\n .replaceAll(/(?<letter>[a-zA-Z])(?<digit>[0-9])/gu, \"$<letter>-$<digit>\")\n .toLowerCase();\n}\n\n/**\n * Checks whether a module is React, with its element factory.\n *\n * @param value - The module.\n * @returns True if the module is React.\n */\nfunction isReact(value: unknown): value is { createElement: typeof createElement } {\n return isRecord(value) && typeof value[\"createElement\"] === \"function\";\n}\n\n/**\n * Checks whether a module is React's server renderer.\n *\n * @param value - The module.\n * @returns True if the module is the server renderer.\n */\nfunction isServerRenderer(value: unknown): value is { renderToStaticMarkup: typeof renderToStaticMarkup } {\n return isRecord(value) && typeof value[\"renderToStaticMarkup\"] === \"function\";\n}\n\n/**\n * Checks whether a value can be rendered as a React element: a tag name, a component, or a wrapped component such as\n * one made by `memo`.\n *\n * @param value - The value.\n * @returns True if the value is an element type.\n */\nexport function isElementType(value: unknown): value is ElementType {\n return typeof value === \"string\" || typeof value === \"function\" || isRecord(value);\n}\n\n/**\n * Loads the project's React and its server renderer, so markup is written the way the project itself would write it.\n *\n * @param root - The project folder.\n * @returns React's element factory and a function that renders an element to markup, or undefined when the project\n * has no React.\n */\nexport function loadRenderer(root: string) {\n const react = requireFromProject(root, \"react\");\n const server = requireFromProject(root, \"react-dom/server\");\n if (!isReact(react) || !isServerRenderer(server)) return undefined;\n\n return {\n createElement: react.createElement,\n render: (type: ElementType, props: Record<string, unknown> = {}) =>\n server.renderToStaticMarkup(react.createElement(type, props)),\n };\n}\n\n/**\n * Converts attributes to React props, so React writes each name the way SVG spells it.\n *\n * @param attributes - The attributes, in SVG or React naming.\n * @returns The props.\n */\nfunction toProps(attributes: Record<string, unknown>) {\n return Object.fromEntries(\n Object.entries(attributes).flatMap(([name, value]) => (name === \"key\" ? [] : [[toReactName(name), String(value)]])),\n );\n}\n\n/**\n * Writes a list of `[element, attributes]` pairs, the format several libraries ship, as SVG markup. React writes the\n * attributes, so names in either SVG or React form come out right.\n *\n * @param root - The project folder.\n * @param attributes - Attributes of the SVG around the elements.\n * @param value - The list.\n * @returns The markup, or undefined when the value isn't a list of pairs.\n */\nexport function writeElementPairs(root: string, attributes: Record<string, string>, value: unknown) {\n const renderer = loadRenderer(root);\n if (!isDefined(renderer) || !Array.isArray(value)) return undefined;\n\n const { createElement: create, render } = renderer;\n const elements = value.flatMap((pair: unknown, index) =>\n Array.isArray(pair) && typeof pair[0] === \"string\" && isRecord(pair[1])\n ? [create(pair[0], { ...toProps(pair[1]), key: String(index) })]\n : [],\n );\n if (elements.length !== value.length) return undefined;\n\n return render(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", ...toProps(attributes), children: elements });\n}\n\n/**\n * Reads SVG files from a folder into icons.\n *\n * @param folder - The folder.\n * @param files - The file names to read.\n * @param describe - Gives each file's icon name and keywords.\n * @returns The icons, in the order given.\n */\nexport async function readSvgIcons(\n folder: string,\n files: string[],\n describe: (file: string) => { name: string; keywords: string[] },\n) {\n const icons = await Promise.all(\n files.map(async (file): Promise<SourceIcon> => ({\n ...describe(file),\n svg: await readFile(path.join(folder, file), \"utf8\"),\n })),\n );\n\n return icons;\n}\n\n/**\n * Lists the SVG files in a folder.\n *\n * @param directory - The folder.\n * @returns The file names, sorted.\n */\nexport async function listSvgFiles(directory: string) {\n const files = await readdir(directory);\n\n return files.filter((file) => file.endsWith(\".svg\")).toSorted();\n}\n\n/**\n * Imports a JavaScript module from inside an installed package, by path, since some packages don't allow importing\n * the file by name.\n *\n * @param directory - The package folder.\n * @param file - The module's path within the package.\n * @returns The module's exports.\n */\nexport async function importPackageFile(directory: string, file: string): Promise<Record<string, unknown>> {\n const loaded: unknown = await import(pathToFileURL(path.join(directory, file)).href);\n\n return isRecord(loaded) ? loaded : {};\n}\n\n/**\n * Loads a package the way the project itself resolves it, so rendering uses the project's own copy of React.\n *\n * @param root - The project folder.\n * @param name - The package name.\n * @returns The package's exports.\n */\nexport function requireFromProject(root: string, name: string): unknown {\n return createRequire(path.join(root, \"package.json\"))(name);\n}\n","import { createHash } from \"node:crypto\";\nimport { readFile, readdir } from \"node:fs/promises\";\nimport path from \"node:path\";\n\nimport { isDefined, isRecord } from \"@repo/lib/utils\";\n\n/** An installed package's folder and version. */\nexport interface InstalledPackage {\n /** Name the package was published under, which differs from the name it's installed under when it's an alias. */\n name: string;\n /** Folder the package is installed in. */\n directory: string;\n /** Version installed. */\n version: string;\n}\n\n/**\n * Lists the plugin's own published code files.\n *\n * @returns The files' paths, sorted.\n */\nexport async function listPluginFiles() {\n const files = await readdir(import.meta.dirname);\n\n return files\n .filter((file) => file.endsWith(\".js\"))\n .toSorted()\n .map((file) => path.join(import.meta.dirname, file));\n}\n\n/**\n * Hashes the plugin's own published code, so anything built from an older version is replaced. It uses the contents\n * rather than modification times, because packages installed from npm all carry the same fixed date.\n *\n * @returns The hash.\n */\nexport async function readPluginBuild() {\n const files = await listPluginFiles();\n const contents = await Promise.all(files.map(async (file) => ({ file, content: await readFile(file) })));\n const hash = createHash(\"sha256\");\n\n for (const { file, content } of contents) hash.update(path.basename(file)).update(content);\n\n return hash.digest(\"hex\").slice(0, 16);\n}\n\n/**\n * Reads and parses a JSON file.\n *\n * @param file - Path to the file.\n * @returns The parsed contents, or undefined when the file is missing or isn't JSON.\n */\nexport async function readJson(file: string): Promise<unknown> {\n try {\n return JSON.parse(await readFile(file, \"utf8\"));\n } catch {\n return undefined;\n }\n}\n\n/**\n * Lists a folder and every folder above it, nearest first.\n *\n * @param directory - The folder to start from.\n * @returns The folders.\n */\nfunction listAncestors(directory: string): string[] {\n const parent = path.dirname(directory);\n\n return parent === directory ? [directory] : [directory, ...listAncestors(parent)];\n}\n\n/**\n * Finds an installed package by walking up from the project folder through each `node_modules`, the way Node does.\n * Its `package.json` is read directly, because some icon packages don't allow importing it.\n *\n * @param root - The project folder.\n * @param name - The package name.\n * @returns The package, or undefined when it isn't installed.\n */\nexport async function findPackage(root: string, name: string): Promise<InstalledPackage | undefined> {\n const candidates = await Promise.all(\n listAncestors(path.resolve(root)).map(async (folder) => {\n const directory = path.join(folder, \"node_modules\", name);\n\n return { directory, manifest: await readJson(path.join(directory, \"package.json\")) };\n }),\n );\n\n for (const { directory, manifest } of candidates) {\n if (isRecord(manifest) && typeof manifest[\"version\"] === \"string\") {\n const published = typeof manifest[\"name\"] === \"string\" ? manifest[\"name\"] : name;\n\n return { name: published, directory, version: manifest[\"version\"] };\n }\n }\n\n return undefined;\n}\n\n/**\n * Lists the packages a project declares, from its dependencies, dev dependencies, and peer dependencies.\n *\n * @param root - The project folder.\n * @returns The declared package names.\n */\nexport async function readDeclaredPackages(root: string) {\n const manifest = await readJson(path.join(root, \"package.json\"));\n if (!isRecord(manifest)) return new Set<string>();\n\n const groups = [manifest[\"dependencies\"], manifest[\"devDependencies\"], manifest[\"peerDependencies\"]];\n\n return new Set(\n groups.flatMap((group) => (isRecord(group) ? Object.keys(group) : [])).filter((name) => isDefined(name)),\n );\n}\n","import path from \"node:path\";\n\nimport { convertCase, isRecord } from \"@repo/lib/utils\";\n\nimport { listSvgFiles, readSvgIcons } from \"@/build/adapters/shared\";\nimport type { IconAdapter } from \"@/build/adapters/types\";\nimport { readJson } from \"@/build/packages\";\n\n/**\n * Creates an adapter for a folder of the project's own SVG files. Each file becomes an icon named after the file, and an\n * optional `keywords.json` in the folder lists each icon's keywords by name.\n *\n * @param library - Identifier of the set.\n * @param folder - The folder, relative to the project.\n * @returns The adapter.\n */\nexport function createCustomAdapter(library: string, folder: string): IconAdapter {\n return {\n library,\n label: convertCase(library, \"title\"),\n packageName: undefined,\n styles: [\"default\"],\n async read({ root }) {\n const directory = path.resolve(root, folder);\n const [files, keywords] = await Promise.all([\n listSvgFiles(directory),\n readJson(path.join(directory, \"keywords.json\")),\n ]);\n\n return readSvgIcons(directory, files, (file) => {\n const name = convertCase(file.slice(0, -\".svg\".length), \"kebab\");\n const listed = isRecord(keywords) ? keywords[name] : undefined;\n\n return { name, keywords: Array.isArray(listed) ? listed.map(String) : [] };\n });\n },\n };\n}\n","import path from \"node:path\";\n\nimport { isDefined, isRecord } from \"@repo/lib/utils\";\n\nimport { importPackageFile, isElementType, loadRenderer, toKebabName } from \"@/build/adapters/shared\";\nimport type { IconAdapter } from \"@/build/adapters/types\";\nimport { readJson } from \"@/build/packages\";\n\n/**\n * Central, read by rendering the React components of its licensed style packages. Each installed\n * `@central-icons-react/` package is a style, named after the rest of its name, so several can be used at once. Each\n * icon is drawn in Central's raw mode, since its default mode draws through a mask.\n */\nexport const centralAdapter: IconAdapter = {\n library: \"central\",\n label: \"Central Icon System\",\n packageName: undefined,\n packagePrefix: \"@central-icons-react/\",\n packageExample: \"@central-icons-react/round-outlined-radius-2-stroke-1.5\",\n styles: [],\n async read({ directory, root }) {\n const renderer = loadRenderer(root);\n if (!isDefined(renderer)) return [];\n\n const [exports, index] = await Promise.all([\n importPackageFile(directory, \"index.mjs\"),\n readJson(path.join(directory, \"icons-index.json\")),\n ]);\n const aliases = isRecord(index) && isRecord(index[\"iconAliases\"]) ? index[\"iconAliases\"] : {};\n\n return Object.entries(exports).flatMap(([exportName, component]) => {\n // Central's components are wrapped in `memo` and `forwardRef`, so they're objects rather than functions.\n if (!exportName.startsWith(\"Icon\") || exportName.endsWith(\"Default\") || !isElementType(component)) return [];\n\n const svg = renderer.render(component, { mode: \"raw\" });\n\n const listed = aliases[exportName];\n const keywords = typeof listed === \"string\" ? listed.split(\",\").map((keyword) => keyword.trim()) : [];\n\n return [{ name: toKebabName(exportName.slice(\"Icon\".length)), keywords, svg }];\n });\n },\n};\n","/** Fills Central Icon System draws each style in. */\nconst centralFills = [\"outlined\", \"filled\"] as const;\n\n/** Corner radii Central Icon System's round styles come in. */\nconst centralRadii = [\"0\", \"1\", \"2\", \"3\"] as const;\n\n/** Stroke widths Central Icon System's styles come in. */\nconst centralStrokes = [\"1\", \"1.5\", \"2\"] as const;\n\n/** Styles Central Icon System publishes, one package each, named after the corners, fill, radius, and stroke. */\nconst centralStyles = [\n ...centralFills.flatMap((fill) =>\n centralRadii.flatMap((radius) =>\n centralStrokes.map((stroke) => `round-${fill}-radius-${radius}-stroke-${stroke}` as const),\n ),\n ),\n ...centralFills.flatMap((fill) =>\n centralStrokes.map((stroke) => `square-${fill}-radius-0-stroke-${stroke}` as const),\n ),\n];\n\n/** Packages Nucleo publishes, each a style named after the rest of its package name. */\nconst nucleoStyles = [\n \"arcade\",\n \"core-essential-fill-24\",\n \"core-essential-fill-32\",\n \"core-essential-fill-48\",\n \"core-essential-outline-24\",\n \"core-essential-outline-32\",\n \"core-essential-outline-48\",\n \"core-fill-24\",\n \"core-fill-32\",\n \"core-fill-48\",\n \"core-outline-24\",\n \"core-outline-32\",\n \"core-outline-48\",\n \"credit-cards\",\n \"flags\",\n \"glass\",\n \"isometric\",\n \"micro-bold\",\n \"micro-bold-essential\",\n \"pixel\",\n \"pixel-essential\",\n \"sharp\",\n \"sharp-essential\",\n \"social-media\",\n \"ui-essential-fill-12\",\n \"ui-essential-fill-18\",\n \"ui-essential-fill-duo-18\",\n \"ui-essential-outline-12\",\n \"ui-essential-outline-18\",\n \"ui-essential-outline-duo-18\",\n \"ui-fill-12\",\n \"ui-fill-18\",\n \"ui-fill-duo-18\",\n \"ui-outline-12\",\n \"ui-outline-18\",\n \"ui-outline-duo-18\",\n] as const;\n\n/**\n * Styles of each library the plugin supports, the first being the default. For a library published as a family of\n * packages, its styles are the packages it publishes, and the installed ones are used.\n */\nexport const iconLibraryStyles = {\n central: centralStyles,\n heroicons: [\"outline\", \"solid\", \"mini\", \"micro\"],\n hugeicons: [\"stroke-rounded\"],\n iconoir: [\"regular\", \"solid\"],\n lucide: [\"default\"],\n nucleo: nucleoStyles,\n phosphor: [\"regular\", \"thin\", \"light\", \"bold\", \"fill\", \"duotone\"],\n tabler: [\"outline\", \"filled\"],\n} as const;\n","import path from \"node:path\";\n\nimport { listSvgFiles, readSvgIcons } from \"@/build/adapters/shared\";\nimport type { IconAdapter } from \"@/build/adapters/types\";\nimport { iconLibraryStyles } from \"@/lib/libraries\";\n\n/** Folder each Heroicons style is published in, named after the size it's drawn for. */\nconst styleFolders: Record<string, string> = {\n outline: \"24/outline\",\n solid: \"24/solid\",\n mini: \"20/solid\",\n micro: \"16/solid\",\n};\n\n/**\n * Heroicons, read from the SVG files the `heroicons` package ships for each style. It has no keywords, so its icons\n * are found by name.\n */\nexport const heroiconsAdapter: IconAdapter = {\n library: \"heroicons\",\n label: \"Heroicons\",\n packageName: \"heroicons\",\n packagePattern: /^(?:heroicons|@heroicons\\/.+)$/u,\n styles: [...iconLibraryStyles.heroicons],\n async read({ directory, style }) {\n const folder = path.join(directory, styleFolders[style] ?? \"24/outline\");\n const files = await listSvgFiles(folder);\n\n return readSvgIcons(folder, files, (file) => ({ name: file.slice(0, -\".svg\".length), keywords: [] }));\n },\n};\n","import { isDefined } from \"@repo/lib/utils\";\n\nimport { importPackageFile, toKebabName, writeElementPairs } from \"@/build/adapters/shared\";\nimport type { IconAdapter } from \"@/build/adapters/types\";\nimport { iconLibraryStyles } from \"@/lib/libraries\";\n\n/** Suffixes Hugeicons adds to its export names, removed to get the icon's own name. */\nconst exportSuffixes = /(?:FreeIcons|Icon)$/u;\n\n/**\n * Hugeicons, read from the shape data `@hugeicons/core-free-icons` exports. It has no keywords, so its icons are found\n * by name. The package also exports many icons under other libraries' names, which aren't used as keywords because\n * they don't describe the icon.\n */\nexport const hugeiconsAdapter: IconAdapter = {\n library: \"hugeicons\",\n label: \"Hugeicons\",\n packageName: \"@hugeicons/core-free-icons\",\n packagePattern: /^@hugeicons\\//u,\n styles: [...iconLibraryStyles.hugeicons],\n async read({ directory, root }) {\n const exports = await importPackageFile(directory, \"dist/esm/index.js\");\n const namesByIcon = new Map<unknown, string[]>();\n\n for (const [exportName, value] of Object.entries(exports)) {\n namesByIcon.set(value, [...(namesByIcon.get(value) ?? []), exportName]);\n }\n\n return [...namesByIcon].flatMap(([value, exportNames]) => {\n const svg = writeElementPairs(root, { viewBox: \"0 0 24 24\", fill: \"none\" }, value);\n const iconNames = exportNames.filter((exportName) => exportName.endsWith(\"Icon\")).toSorted();\n const [primary] = iconNames;\n if (!isDefined(svg) || !isDefined(primary)) return [];\n\n const name = toKebabName(primary.replace(exportSuffixes, \"\"));\n\n return [{ name, keywords: [], svg }];\n });\n },\n};\n","import path from \"node:path\";\n\nimport { listSvgFiles, readSvgIcons } from \"@/build/adapters/shared\";\nimport type { IconAdapter } from \"@/build/adapters/types\";\nimport { iconLibraryStyles } from \"@/lib/libraries\";\n\n/** Iconoir, read from the SVG files the `iconoir` package ships for each style. It has no keywords. */\nexport const iconoirAdapter: IconAdapter = {\n library: \"iconoir\",\n label: \"Iconoir\",\n packageName: \"iconoir\",\n packagePattern: /^iconoir(?:-.+)?$/u,\n styles: [...iconLibraryStyles.iconoir],\n async read({ directory, style }) {\n const folder = path.join(directory, \"icons\", style);\n const files = await listSvgFiles(folder);\n\n return readSvgIcons(folder, files, (file) => ({ name: file.slice(0, -\".svg\".length), keywords: [] }));\n },\n};\n","import path from \"node:path\";\n\nimport { isDefined, isRecord } from \"@repo/lib/utils\";\n\nimport { roundStrokeRoot, writeElementPairs } from \"@/build/adapters/shared\";\nimport type { IconAdapter } from \"@/build/adapters/types\";\nimport { readJson } from \"@/build/packages\";\nimport { iconLibraryStyles } from \"@/lib/libraries\";\n\n/** Lucide, read from the shape data and keywords `lucide-static` ships. */\nexport const lucideAdapter: IconAdapter = {\n library: \"lucide\",\n label: \"Lucide\",\n packageName: \"lucide-static\",\n packagePattern: /^(?:lucide(?:-.+)?|@lucide\\/.+)$/u,\n styles: [...iconLibraryStyles.lucide],\n async read({ directory, root }) {\n const [nodes, tags] = await Promise.all([\n readJson(path.join(directory, \"icon-nodes.json\")),\n readJson(path.join(directory, \"tags.json\")),\n ]);\n if (!isRecord(nodes)) return [];\n\n return Object.entries(nodes).flatMap(([name, value]) => {\n const svg = writeElementPairs(root, roundStrokeRoot, value);\n if (!isDefined(svg)) return [];\n\n const keywords = isRecord(tags) && Array.isArray(tags[name]) ? tags[name].map(String) : [];\n\n return [{ name, keywords, svg }];\n });\n },\n};\n","import { isDefined } from \"@repo/lib/utils\";\n\nimport { importPackageFile, isElementType, loadRenderer, toKebabName } from \"@/build/adapters/shared\";\nimport type { IconAdapter } from \"@/build/adapters/types\";\n\n/**\n * Finds the style suffix every export name in a Nucleo package ends with, such as `Outline18`, so it can be removed to\n * get each icon's own name.\n *\n * @param names - The export names.\n * @returns The shared suffix, starting at a capital letter, or an empty string when there's none.\n */\nfunction findStyleSuffix(names: string[]) {\n const [first, ...rest] = names;\n if (!isDefined(first)) return \"\";\n\n let length = 0;\n while (length < first.length && rest.every((name) => name.at(-1 - length) === first.at(-1 - length))) length += 1;\n\n const shared = first.slice(first.length - length);\n const start = shared.search(/[A-Z]/u);\n\n return start === -1 ? \"\" : shared.slice(start);\n}\n\n/**\n * Nucleo, read by rendering the React components of its licensed packages. Each installed `nucleo-` package is a\n * style, named after the rest of its name, such as `ui-outline-18`. It has no keywords.\n */\nexport const nucleoAdapter: IconAdapter = {\n library: \"nucleo\",\n label: \"Nucleo\",\n packageName: undefined,\n packagePrefix: \"nucleo-\",\n packageExample: \"nucleo-ui-outline-18\",\n styles: [],\n async read({ directory, root }) {\n const renderer = loadRenderer(root);\n if (!isDefined(renderer)) return [];\n\n const exports = await importPackageFile(directory, \"dist/index.js\");\n const components = Object.entries(exports).flatMap(([exportName, component]) =>\n exportName.startsWith(\"Icon\") && exportName !== \"Icon\" && isElementType(component)\n ? [[exportName, component] as const]\n : [],\n );\n const suffix = findStyleSuffix(components.map(([exportName]) => exportName));\n\n return components.flatMap(([exportName, component]) => {\n const svg = renderer.render(component);\n\n const name = toKebabName(exportName.slice(\"Icon\".length, exportName.length - suffix.length));\n\n return [{ name, keywords: [], svg }];\n });\n },\n};\n","import path from \"node:path\";\n\nimport { isRecord } from \"@repo/lib/utils\";\n\nimport { importPackageFile, listSvgFiles, readSvgIcons } from \"@/build/adapters/shared\";\nimport type { IconAdapter } from \"@/build/adapters/types\";\nimport { iconLibraryStyles } from \"@/lib/libraries\";\n\n/**\n * Reads Phosphor's keywords from the icon list `@phosphor-icons/core` exports.\n *\n * @param directory - The package folder.\n * @returns Keywords keyed by icon name.\n */\nasync function readPhosphorKeywords(directory: string) {\n const { icons } = await importPackageFile(directory, \"dist/index.mjs\");\n if (!Array.isArray(icons)) return new Map<string, string[]>();\n\n return new Map(\n icons.flatMap((icon: unknown) =>\n isRecord(icon) && typeof icon[\"name\"] === \"string\" && Array.isArray(icon[\"tags\"])\n ? [[icon[\"name\"], icon[\"tags\"].map(String)] as const]\n : [],\n ),\n );\n}\n\n/** Phosphor, read from the SVG files `@phosphor-icons/core` ships for each weight. */\nexport const phosphorAdapter: IconAdapter = {\n library: \"phosphor\",\n label: \"Phosphor Icons\",\n packageName: \"@phosphor-icons/core\",\n packagePattern: /^@phosphor-icons\\//u,\n styles: [...iconLibraryStyles.phosphor],\n async read({ directory, style }) {\n const folder = path.join(directory, \"assets\", style);\n const [files, keywords] = await Promise.all([listSvgFiles(folder), readPhosphorKeywords(directory)]);\n const suffix = style === \"regular\" ? \".svg\" : `-${style}.svg`;\n\n return readSvgIcons(\n folder,\n files.filter((file) => file.endsWith(suffix)),\n (file) => {\n const name = file.slice(0, -suffix.length);\n\n return { name, keywords: keywords.get(name) ?? [] };\n },\n );\n },\n};\n","import path from \"node:path\";\n\nimport { isDefined, isRecord } from \"@repo/lib/utils\";\n\nimport { roundStrokeRoot, writeElementPairs } from \"@/build/adapters/shared\";\nimport type { IconAdapter } from \"@/build/adapters/types\";\nimport { readJson } from \"@/build/packages\";\nimport { iconLibraryStyles } from \"@/lib/libraries\";\n\n/** Tabler, read from the shape data and keywords `@tabler/icons` ships for each style. */\nexport const tablerAdapter: IconAdapter = {\n library: \"tabler\",\n label: \"Tabler Icons\",\n packageName: \"@tabler/icons\",\n packagePattern: /^@tabler\\/icons(?:-.+)?$/u,\n styles: [...iconLibraryStyles.tabler],\n async read({ directory, style, root }) {\n const [nodes, details] = await Promise.all([\n readJson(path.join(directory, `tabler-nodes-${style}.json`)),\n readJson(path.join(directory, \"icons.json\")),\n ]);\n if (!isRecord(nodes)) return [];\n\n const attributes = style === \"filled\" ? { viewBox: \"0 0 24 24\", fill: \"currentColor\" } : roundStrokeRoot;\n\n return Object.entries(nodes).flatMap(([name, value]) => {\n const svg = writeElementPairs(root, attributes, value);\n if (!isDefined(svg)) return [];\n\n const detail = isRecord(details) ? details[name] : undefined;\n const tags = isRecord(detail) && Array.isArray(detail[\"tags\"]) ? detail[\"tags\"].map(String) : [];\n\n return [{ name, keywords: tags, svg }];\n });\n },\n};\n","import { centralAdapter } from \"@/build/adapters/central\";\nimport { heroiconsAdapter } from \"@/build/adapters/heroicons\";\nimport { hugeiconsAdapter } from \"@/build/adapters/hugeicons\";\nimport { iconoirAdapter } from \"@/build/adapters/iconoir\";\nimport { lucideAdapter } from \"@/build/adapters/lucide\";\nimport { nucleoAdapter } from \"@/build/adapters/nucleo\";\nimport { phosphorAdapter } from \"@/build/adapters/phosphor\";\nimport { tablerAdapter } from \"@/build/adapters/tabler\";\nimport type { IconAdapter } from \"@/build/adapters/types\";\n\n/** Every library the build step knows how to read from its package. */\nexport const iconAdapters: IconAdapter[] = [\n centralAdapter,\n heroiconsAdapter,\n hugeiconsAdapter,\n iconoirAdapter,\n lucideAdapter,\n nucleoAdapter,\n phosphorAdapter,\n tablerAdapter,\n];\n"],"mappings":";;;;;;;;AA0BA,MAAMmB,qCAAqB,IAAIC,IAAI;CAAC;CAAS;CAAa;CAAU;CAAQ;CAAW;AAAO,CAAC;;;;;;;;AAS/F,SAAgBC,YAAYT,MAAc;CACxC,OAAOA,KAAKU,WAAW,8BAA8BC,QAAQC,cAAsBA,UAAUC,YAAY,CAAC;AAC5G;;;;;;;;;AAUA,SAASC,eAAeC,YAAoCE,0BAA+B,IAAIT,IAAI,CAAC,OAAO,CAAC,GAAG;CAC7G,OAAOW,OAAOC,YACZD,OAAOE,QAAQN,UAAU,CAAC,CAACO,SAAS,CAACtB,MAAMuB,WACzC,0BAA0BC,KAAKxB,IAAI,KAAKiB,QAAQQ,IAAIzB,IAAI,IAAI,CAAA,IAAK,CAAC,CAACS,YAAYT,IAAI,GAAGuB,KAAK,CAAC,CAC9F,CACF;AACF;;;;;;AAOA,SAASG,cAAcC,SAAsB;CAC3C,KAAK,IAAM,CAAC3B,MAAMuB,UAAUJ,OAAOE,QAAQM,QAAQZ,UAAU,GAC3D,AAAI,eAAeS,KAAKD,KAAK,MAAGI,QAAQZ,WAAWf,QAAQ,GAAGuB,MAAK;AAEvE;;;;;;;AAQA,SAASK,aAAaC,UAAuB;CAC3C,OAAOA,SAASP,SAASQ,UAAoC;EAC3D,IAAIA,MAAMC,SAAS,QAAQ,OAAO1C,UAAUyC,MAAMP,MAAMS,KAAK,CAAC,IAAI,CAACF,MAAMP,KAAK,IAAI,CAAA;EAClF,IAAIO,MAAMC,SAAS,WAAW,OAAO,CAAA;EAErC,IAAME,SAASL,aAAaE,MAAMD,QAAQ,GACpCd,aAAaD,eAAegB,MAAMf,UAAU;EAElD,OAAO,CAAC1B,UAAU4C,MAAM,IAAI;GAACH,MAAM9B;GAAMe;GAAYkB;EA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QAAQ;GACrC,IAAM,CAACC,OAAOC,WAAW,MAAMC,QAAQC,IAAI,CACzChB,SAASN,KAAKuB,KAAKP,WAAW,gBAAgBC,MAAK,MAAO,CAAC,GAC3DX,SAASN,KAAKuB,KAAKP,WAAW,YAAY,CAAC,CAAC,CAC7C;GACD,IAAI,CAACd,SAASiB,KAAK,GAAG,OAAO,CAAA;GAE7B,IAAMK,aAAaP,UAAU,WAAW;IAAEQ,SAAS;IAAaC,MAAM;GAAe,IAAIvB;GAEzF,OAAOwB,OAAOC,QAAQT,KAAK,CAAC,CAACU,SAAS,CAACC,MAAMC,WAAW;IACtD,IAAMC,MAAM5B,kBAAkBc,MAAMM,YAAYO,KAAK;IACrD,IAAI,CAAC9B,UAAU+B,GAAG,GAAG,OAAO,CAAA;IAE5B,IAAMC,SAAS/B,SAASkB,OAAO,IAAIA,QAAQU,QAAQI,KAAAA;IAGnD,OAAO,CAAC;KAAEJ;KAAMU,UAFHtC,SAAS+B,MAAM,KAAKG,MAAMC,QAAQJ,OAAO6B,IAAO,IAAI7B,OAAO6B,KAAQxB,IAAIC,MAAM,IAAI,CAAA;KAE9DP;IAAI,CAAC;GACvC,CAAC;EACH;CCfAgB;AAAa"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { n as pluginName, t as logger } from "./defaults-BEzCWZtH.js";
|
|
2
|
-
import { a as resolveIconDrawing, c as isDefined, o as serializeIconDrawing, s as convertCase } from "./nodes-
|
|
3
|
-
import {
|
|
4
|
-
import { n as getIconSetKey } from "./sets-
|
|
2
|
+
import { a as resolveIconDrawing, c as isDefined, o as serializeIconDrawing, s as convertCase } from "./nodes-DdErxvpg.js";
|
|
3
|
+
import { n as Drawing, t as iconTypeName } from "./types-Dl2HGUL5.js";
|
|
4
|
+
import { n as getIconSetKey } from "./sets-BfqjcdEo.js";
|
|
5
|
+
import { a as splitMatches, i as selectIcons, n as requestLibrary, r as resolveIconStyle, t as normalizeTerms } from "./library-DRfdBS-O.js";
|
|
5
6
|
import { ChangeIndicator, FieldActionsProvider, FieldActionsResolver, FormField, defineField, definePlugin, defineType, getPublishedId, set, setIfMissing, unset, useFormValue } from "sanity";
|
|
6
7
|
import { c } from "react/compiler-runtime";
|
|
7
8
|
import { createElement, useEffect, useRef, useState } from "react";
|
|
@@ -595,11 +596,11 @@ function getRevealedScrollTop(index, scrollTop) {
|
|
|
595
596
|
return top < scrollTop ? top : top + 44 > scrollTop + 348 ? top + 44 - 348 : scrollTop;
|
|
596
597
|
}
|
|
597
598
|
function Picker(t0) {
|
|
598
|
-
let $ = c(
|
|
599
|
+
let $ = c(40), allowed, iconStyle, libraryName, onSelect, props, selected;
|
|
599
600
|
$[0] === t0 ? (allowed = $[1], iconStyle = $[2], libraryName = $[3], onSelect = $[4], props = $[5], selected = $[6]) : ({library: libraryName, iconStyle, allowed, selected, onSelect, ...props} = t0, $[0] = t0, $[1] = allowed, $[2] = iconStyle, $[3] = libraryName, $[4] = onSelect, $[5] = props, $[6] = selected);
|
|
600
|
-
let result = useIconLibrary(libraryName, iconStyle), library = result?.icons, icons = selectIcons(library ?? [], allowed), t1 = libraryName ?? "", t2
|
|
601
|
-
$[7] !==
|
|
602
|
-
let { recent, remember, forget } = useRecentIcons(
|
|
601
|
+
let result = useIconLibrary(libraryName, iconStyle), library = result?.icons, icons = selectIcons(library ?? [], allowed), t1 = libraryName ?? "", t2;
|
|
602
|
+
$[7] !== iconStyle || $[8] !== libraryName || $[9] !== t1 ? (t2 = getIconSetKey(t1, resolveIconStyle(libraryName, iconStyle) ?? ""), $[7] = iconStyle, $[8] = libraryName, $[9] = t1, $[10] = t2) : t2 = $[10];
|
|
603
|
+
let { recent, remember, forget } = useRecentIcons(t2), [search, setSearch] = useState(""), [scrollRow, setScrollRow] = useState(0), [movedIndex, setMovedIndex] = useState(), [scrolling, setScrolling] = useState(!1), scroller = useRef(null), activeCell = useRef(null), focusIndex = useRef(void 0), scrollFrame = useRef(void 0), scrollStop = useRef(void 0), query = normalizeTerms(search), searching = isDefined(query), results = icons.filter((icon) => !searching || icon.terms.includes(query)), byName = new Map(icons.map(_temp)), recentIcons = searching ? [] : recent.flatMap((entry) => {
|
|
603
604
|
let icon_1 = byName.get(entry);
|
|
604
605
|
return isDefined(icon_1) ? [icon_1] : [];
|
|
605
606
|
}), { hovered, handleHover, clearHover } = useIconTooltip(scrolling), rows = getVisibleRows(scrollRow, results.length), selectedIndex = searching || !isDefined(selected) ? -1 : icons.findIndex((icon_2) => icon_2.name === selected), activeIndex = movedIndex ?? Math.max(0, selectedIndex);
|
|
@@ -607,23 +608,23 @@ function Picker(t0) {
|
|
|
607
608
|
let element = scroller.current;
|
|
608
609
|
isDefined(element) && selectedIndex !== -1 && (element.scrollTop = getCenteredScrollTop(selectedIndex));
|
|
609
610
|
}, [scroller, selectedIndex]);
|
|
610
|
-
let
|
|
611
|
-
$[
|
|
611
|
+
let t3, t4;
|
|
612
|
+
$[11] === Symbol.for("react.memo_cache_sentinel") ? (t3 = () => () => {
|
|
612
613
|
isDefined(scrollFrame.current) && cancelAnimationFrame(scrollFrame.current), isDefined(scrollStop.current) && clearTimeout(scrollStop.current);
|
|
613
|
-
},
|
|
614
|
-
let
|
|
615
|
-
$[
|
|
614
|
+
}, t4 = [], $[11] = t3, $[12] = t4) : (t3 = $[11], t4 = $[12]), useEffect(t3, t4);
|
|
615
|
+
let t5, t6;
|
|
616
|
+
$[13] === activeIndex ? (t5 = $[14], t6 = $[15]) : (t5 = () => {
|
|
616
617
|
focusIndex.current === activeIndex && (focusIndex.current = void 0, isDefined(activeCell.current) && activeCell.current.focus());
|
|
617
|
-
},
|
|
618
|
-
let
|
|
619
|
-
$[
|
|
618
|
+
}, t6 = [activeIndex], $[13] = activeIndex, $[14] = t5, $[15] = t6), useEffect(t5, t6);
|
|
619
|
+
let t7;
|
|
620
|
+
$[16] !== onSelect || $[17] !== remember ? (t7 = function handleSelect(icon_3) {
|
|
620
621
|
remember(icon_3.name), onSelect(icon_3);
|
|
621
|
-
}, $[
|
|
622
|
-
let handleSelect =
|
|
623
|
-
$[
|
|
622
|
+
}, $[16] = onSelect, $[17] = remember, $[18] = t7) : t7 = $[18];
|
|
623
|
+
let handleSelect = t7, t8;
|
|
624
|
+
$[19] === Symbol.for("react.memo_cache_sentinel") ? (t8 = function clearSearch() {
|
|
624
625
|
setSearch(""), setMovedIndex(void 0);
|
|
625
|
-
}, $[
|
|
626
|
-
let clearSearch =
|
|
626
|
+
}, $[19] = t8) : t8 = $[19];
|
|
627
|
+
let clearSearch = t8, handleSearch = function handleSearch(event) {
|
|
627
628
|
setSearch(event.currentTarget.value), setMovedIndex(void 0), isDefined(scroller.current) && (scroller.current.scrollTop = 0);
|
|
628
629
|
}, selectActive = function selectActive() {
|
|
629
630
|
let icon_4 = results[activeIndex];
|
|
@@ -656,7 +657,7 @@ function Picker(t0) {
|
|
|
656
657
|
focusIndex.current = index, setMovedIndex(index);
|
|
657
658
|
let element_1 = scroller.current;
|
|
658
659
|
isDefined(element_1) && (element_1.scrollTop = getRevealedScrollTop(index, element_1.scrollTop));
|
|
659
|
-
}, T0 = Dialog, T1 = Stack,
|
|
660
|
+
}, T0 = Dialog, T1 = Stack, t13 = !isDefined(result?.problem) && /* @__PURE__ */ jsx(TextInput, {
|
|
660
661
|
type: "search",
|
|
661
662
|
icon: /* @__PURE__ */ jsx(SearchIcon, {}),
|
|
662
663
|
placeholder: "Search by name or keyword",
|
|
@@ -665,23 +666,23 @@ function Picker(t0) {
|
|
|
665
666
|
onKeyDown: handleSearchKeyDown,
|
|
666
667
|
disabled: !isDefined(library) || !isDefined(icons),
|
|
667
668
|
"aria-label": "Search the icon library"
|
|
668
|
-
}),
|
|
669
|
-
$[
|
|
669
|
+
}), t14;
|
|
670
|
+
$[20] === result ? t14 = $[21] : (t14 = !isDefined(result) && /* @__PURE__ */ jsx(Flex, {
|
|
670
671
|
align: "center",
|
|
671
672
|
justify: "center",
|
|
672
673
|
style: { height: 348 },
|
|
673
674
|
children: /* @__PURE__ */ jsx(Spinner, { muted: !0 })
|
|
674
|
-
}), $[
|
|
675
|
-
let
|
|
676
|
-
$[
|
|
677
|
-
let
|
|
675
|
+
}), $[20] = result, $[21] = t14);
|
|
676
|
+
let t15;
|
|
677
|
+
$[22] === result ? t15 = $[23] : (t15 = isDefined(result?.problem) && /* @__PURE__ */ jsx(Problem, { problem: result.problem }), $[22] = result, $[23] = t15);
|
|
678
|
+
let t16 = isDefined(recentIcons) && /* @__PURE__ */ jsx(Recent, {
|
|
678
679
|
icons: recentIcons,
|
|
679
680
|
selected,
|
|
680
681
|
onSelect: handleSelect,
|
|
681
682
|
onHover: handleHover,
|
|
682
683
|
onForget: forget,
|
|
683
684
|
onMouseLeave: clearHover
|
|
684
|
-
}),
|
|
685
|
+
}), t17 = isDefined(library) && /* @__PURE__ */ jsxs(Stack, {
|
|
685
686
|
gap: 3,
|
|
686
687
|
children: [
|
|
687
688
|
/* @__PURE__ */ jsx(Box, {
|
|
@@ -724,31 +725,31 @@ function Picker(t0) {
|
|
|
724
725
|
onKeyDown: handleGridKeyDown
|
|
725
726
|
})
|
|
726
727
|
]
|
|
727
|
-
}),
|
|
728
|
-
$[
|
|
728
|
+
}), t18 = hovered?.icon.name, t19;
|
|
729
|
+
$[24] !== hovered || $[25] !== query || $[26] !== t18 ? (t19 = /* @__PURE__ */ jsx(Tooltip, {
|
|
729
730
|
hovered,
|
|
730
731
|
query
|
|
731
|
-
},
|
|
732
|
-
let
|
|
733
|
-
$[
|
|
732
|
+
}, t18), $[24] = hovered, $[25] = query, $[26] = t18, $[27] = t19) : t19 = $[27];
|
|
733
|
+
let t20;
|
|
734
|
+
$[28] !== T1 || $[29] !== t13 || $[30] !== t14 || $[31] !== t15 || $[32] !== t16 || $[33] !== t17 || $[34] !== t19 ? (t20 = /* @__PURE__ */ jsxs(T1, {
|
|
734
735
|
gap: 4,
|
|
735
736
|
padding: 4,
|
|
736
737
|
children: [
|
|
738
|
+
t13,
|
|
737
739
|
t14,
|
|
738
740
|
t15,
|
|
739
741
|
t16,
|
|
740
742
|
t17,
|
|
741
|
-
|
|
742
|
-
t20
|
|
743
|
+
t19
|
|
743
744
|
]
|
|
744
|
-
}), $[
|
|
745
|
-
let
|
|
746
|
-
return $[
|
|
745
|
+
}), $[28] = T1, $[29] = t13, $[30] = t14, $[31] = t15, $[32] = t16, $[33] = t17, $[34] = t19, $[35] = t20) : t20 = $[35];
|
|
746
|
+
let t21;
|
|
747
|
+
return $[36] !== T0 || $[37] !== props || $[38] !== t20 ? (t21 = /* @__PURE__ */ jsx(T0, {
|
|
747
748
|
header: "Select icon",
|
|
748
749
|
width: 1,
|
|
749
750
|
...props,
|
|
750
|
-
children:
|
|
751
|
-
}), $[
|
|
751
|
+
children: t20
|
|
752
|
+
}), $[36] = T0, $[37] = props, $[38] = t20, $[39] = t21) : t21 = $[39], t21;
|
|
752
753
|
}
|
|
753
754
|
function _temp(icon_0) {
|
|
754
755
|
return [icon_0.name, icon_0];
|