版博士V2.0程序
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 

196 líneas
3.4 KiB

  1. import "./chunk-SOEV5HRE.mjs";
  2. // src/resolver.ts
  3. import { toArray, uniq } from "@antfu/utils";
  4. import { camelToKebab } from "@iconify/utils/lib/misc/strings";
  5. // src/core/icon-sets.json
  6. var icon_sets_default = [
  7. "academicons",
  8. "akar-icons",
  9. "ant-design",
  10. "arcticons",
  11. "basil",
  12. "bi",
  13. "bpmn",
  14. "brandico",
  15. "bx",
  16. "bxl",
  17. "bxs",
  18. "bytesize",
  19. "carbon",
  20. "charm",
  21. "ci",
  22. "cib",
  23. "cif",
  24. "cil",
  25. "circle-flags",
  26. "circum",
  27. "clarity",
  28. "codicon",
  29. "cryptocurrency",
  30. "cryptocurrency-color",
  31. "dashicons",
  32. "ei",
  33. "el",
  34. "emojione",
  35. "emojione-monotone",
  36. "emojione-v1",
  37. "entypo",
  38. "entypo-social",
  39. "eos-icons",
  40. "ep",
  41. "et",
  42. "eva",
  43. "fa",
  44. "fa-brands",
  45. "fa-regular",
  46. "fa-solid",
  47. "fa6-brands",
  48. "fa6-regular",
  49. "fa6-solid",
  50. "fad",
  51. "fe",
  52. "feather",
  53. "file-icons",
  54. "flag",
  55. "flagpack",
  56. "flat-color-icons",
  57. "flat-ui",
  58. "fluent",
  59. "fluent-emoji",
  60. "fluent-emoji-flat",
  61. "fluent-emoji-high-contrast",
  62. "fluent-mdl2",
  63. "fontelico",
  64. "fontisto",
  65. "foundation",
  66. "fxemoji",
  67. "gala",
  68. "game-icons",
  69. "geo",
  70. "gg",
  71. "gis",
  72. "gridicons",
  73. "grommet-icons",
  74. "healthicons",
  75. "heroicons",
  76. "heroicons-outline",
  77. "heroicons-solid",
  78. "humbleicons",
  79. "ic",
  80. "icomoon-free",
  81. "icon-park",
  82. "icon-park-outline",
  83. "icon-park-solid",
  84. "icon-park-twotone",
  85. "iconoir",
  86. "icons8",
  87. "il",
  88. "ion",
  89. "iwwa",
  90. "jam",
  91. "la",
  92. "line-md",
  93. "logos",
  94. "ls",
  95. "lucide",
  96. "majesticons",
  97. "maki",
  98. "map",
  99. "material-symbols",
  100. "mdi",
  101. "mdi-light",
  102. "medical-icon",
  103. "memory",
  104. "mi",
  105. "mingcute",
  106. "mono-icons",
  107. "nimbus",
  108. "nonicons",
  109. "noto",
  110. "noto-v1",
  111. "octicon",
  112. "oi",
  113. "ooui",
  114. "openmoji",
  115. "pajamas",
  116. "pepicons",
  117. "pepicons-pop",
  118. "pepicons-print",
  119. "ph",
  120. "pixelarticons",
  121. "prime",
  122. "ps",
  123. "quill",
  124. "radix-icons",
  125. "raphael",
  126. "ri",
  127. "si-glyph",
  128. "simple-icons",
  129. "simple-line-icons",
  130. "skill-icons",
  131. "subway",
  132. "svg-spinners",
  133. "system-uicons",
  134. "tabler",
  135. "teenyicons",
  136. "topcoat",
  137. "twemoji",
  138. "typcn",
  139. "uil",
  140. "uim",
  141. "uis",
  142. "uit",
  143. "uiw",
  144. "vaadin",
  145. "vs",
  146. "vscode-icons",
  147. "websymbol",
  148. "whh",
  149. "wi",
  150. "wpf",
  151. "zmdi",
  152. "zondicons"
  153. ];
  154. // src/resolver.ts
  155. function ComponentsResolver(options = {}) {
  156. var _a;
  157. const {
  158. prefix: rawPrefix = (_a = options.componentPrefix) != null ? _a : "i",
  159. enabledCollections = icon_sets_default,
  160. alias = {},
  161. customCollections = [],
  162. extension
  163. } = options;
  164. const prefix = rawPrefix ? `${camelToKebab(rawPrefix)}-` : "";
  165. const ext = extension ? extension.startsWith(".") ? extension : `.${extension}` : "";
  166. const collections = uniq([
  167. ...toArray(enabledCollections),
  168. ...toArray(customCollections),
  169. ...toArray(Object.keys(alias))
  170. ]);
  171. collections.sort((a, b) => b.length - a.length);
  172. return (name) => {
  173. const kebab = camelToKebab(name);
  174. if (!kebab.startsWith(prefix))
  175. return;
  176. const slice = kebab.slice(prefix.length);
  177. const collection = collections.find((i) => slice.startsWith(`${i}-`)) || collections.find((i) => slice.startsWith(i));
  178. if (!collection)
  179. return;
  180. let icon = slice.slice(collection.length);
  181. if (icon[0] === "-")
  182. icon = icon.slice(1);
  183. if (!icon)
  184. return;
  185. const resolvedCollection = alias[collection] || collection;
  186. if (collections.includes(resolvedCollection))
  187. return `~icons/${resolvedCollection}/${icon}${ext}`;
  188. };
  189. }
  190. export {
  191. ComponentsResolver as default
  192. };