Ctrl K
ComunidadGuías…

src/lib/v-remixicon.js

Rama main · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
import { defineComponent, h, markRaw } from 'vue';
import {
  RiLayoutColumnLine,
  RiStarFill,
  RiArrowRightLine,
  RiArrowLeftLine,
  RiSendPlaneFill,
  RiAddFill,
  RiAddLine,
  RiArchiveDrawerLine,
  RiArchiveLine,
  RiArrowDownLine,
  RiArrowDownSLine,
  RiArrowDropDownLine,
  RiArrowGoBackLine,
  RiArrowGoForwardLine,
  RiArrowRightSLine,
  RiArrowUpLine,
  RiArrowUpSLine,
  RiArticleLine,
  RiBallPenLine,
  RiBold,
  RiBookletLine,
  RiBookmarkFill,
  RiBookmarkLine,
  RiBrush2Fill,
  RiBrush3Fill,
  RiBrushLine,
  RiCake3Line,
  RiCalculatorLine,
  RiCalendarLine,
  RiCheckFill,
  RiCheckLine,
  RiClipboardLine,
  RiCloseLine,
  RiCodeBoxLine,
  RiCodeLine,
  RiCupLine,
  RiDeleteBackLine,
  RiDeleteBin6Line,
  RiDeleteColumn,
  RiDeleteRow,
  RiDoubleQuotesR,
  RiDownload2Line,
  RiDownloadLine,
  RiDraggable,
  RiEditLine,
  RiEmotionLine,
  RiEmotionUnhappyFill,
  RiEraserLine,
  RiErrorWarningLine,
  RiEyeCloseLine,
  RiEyeLine,
  RiFile2Line,
  RiFileCopyLine,
  RiFileDownloadLine,
  RiFileTextFill,
  RiFileUploadLine,
  RiFlagLine,
  RiFocus3Line,
  RiFolder5Fill,
  RiFolderAddLine,
  RiFolderLine,
  RiFolderOpenFill,
  RiFolderOpenLine,
  RiFolderTransferLine,
  RiFontColor,
  RiFontSize,
  RiFootballLine,
  RiForward5Line,
  RiGithubFill,
  RiGlobalLine,
  RiHeading,
  RiH1,
  RiH2,
  RiH3,
  RiH4,
  RiH5,
  RiH6,
  RiImageLine,
  RiInboxUnarchiveLine,
  RiInformationLine,
  RiInsertColumnLeft,
  RiInsertColumnRight,
  RiInsertRowBottom,
  RiInsertRowTop,
  RiItalic,
  RiKeyboardLine,
  RiLeafLine,
  RiLightbulbLine,
  RiLink,
  RiLinkUnlinkM,
  RiListCheck2,
  RiListOrdered,
  RiListUnordered,
  RiLoader4Line,
  RiLockLine,
  RiLockUnlockLine,
  RiLoopRightLine,
  RiMarkdownLine,
  RiEvernoteFill,
  RiMarkPenLine,
  RiMicLine,
  RiMoonClearLine,
  RiMovieLine,
  RiPagesLine,
  RiParagraph,
  RiPauseFill,
  RiPencilLine,
  RiPieChart2Line,
  RiPlaneLine,
  RiPlayFill,
  RiPriceTag3Line,
  RiQuestionLine,
  RiRefreshLine,
  RiReplay5Line,
  RiRestartLine,
  RiSave3Line,
  RiSearch2Line,
  RiSearchLine,
  RiSettings3Line,
  RiSettingsLine,
  RiShare2Line,
  RiShareLine,
  RiUserSharedLine,
  RiHistoryLine,
  RiSideBarLine,
  RiShieldCheckLine,
  RiShieldKeyholeLine,
  RiSingleQuotesR,
  RiSortAsc,
  RiSortDesc,
  RiSpeedLine,
  RiSplitCellsHorizontal,
  RiSplitCellsVertical,
  RiMergeCellsHorizontal,
  RiStarLine,
  RiStopCircleLine,
  RiStrikethrough,
  RiSubtractLine,
  RiSunLine,
  RiTableLine,
  RiText,
  RiTimerLine,
  RiUnderline,
  RiVolumeDownFill,
  RiVolumeMuteFill,
  RiWindowLine,
  RiShieldLine,
  RiAppleFill,
  RiNotionFill,
  RiMagicLine,
  RiAlignLeft,
  RiAlignCenter,
  RiAlignRight,
  RiAlignJustify,
  RiMicrosoftFill,
  RiSpaceShip2Line,
  RiEqualizer3Line,
  RiExpandWidthLine,
  RiPrinterLine,
  RiFileAddLine,
  RiPaletteLine,
  RiMore2Fill,
  RiMoreFill,
  RiUserLine,
  RiLogoutBoxRLine,
  RiExternalLinkLine,
  RiCloudLine,
  RiComputerLine,
  RiFingerprintLine,
  RiQrCodeLine,
  RiShieldStarLine,
  RiDatabase2Line,
} from '@remixicon/vue';

const RemixIcons = {
  riAddFill: RiAddFill,
  riAddLine: RiAddLine,
  riArchiveDrawerLine: RiArchiveDrawerLine,
  riArchiveLine: RiArchiveLine,
  riArrowDownLine: RiArrowDownLine,
  riArrowDownSLine: RiArrowDownSLine,
  riArrowDropDownLine: RiArrowDropDownLine,
  riArrowGoBackLine: RiArrowGoBackLine,
  riArrowGoForwardLine: RiArrowGoForwardLine,
  riArrowRightSLine: RiArrowRightSLine,
  riArrowUpLine: RiArrowUpLine,
  riArrowUpSLine: RiArrowUpSLine,
  riArticleLine: RiArticleLine,
  riBallPenLine: RiBallPenLine,
  riBold: RiBold,
  riBookletLine: RiBookletLine,
  riBookmarkFill: RiBookmarkFill,
  riBookmarkLine: RiBookmarkLine,
  riBrush2Fill: RiBrush2Fill,
  riBrush3Fill: RiBrush3Fill,
  riBrushLine: RiBrushLine,
  riCake3Line: RiCake3Line,
  riCalculatorLine: RiCalculatorLine,
  riCalendarLine: RiCalendarLine,
  riCheckFill: RiCheckFill,
  riCheckLine: RiCheckLine,
  riClipboardLine: RiClipboardLine,
  riCloseLine: RiCloseLine,
  riCodeBoxLine: RiCodeBoxLine,
  riCodeLine: RiCodeLine,
  riCupLine: RiCupLine,
  riDeleteBackLine: RiDeleteBackLine,
  riDeleteBin6Line: RiDeleteBin6Line,
  riDeleteColumn: RiDeleteColumn,
  riDeleteRow: RiDeleteRow,
  riDoubleQuotesR: RiDoubleQuotesR,
  riDownload2Line: RiDownload2Line,
  riDownloadLine: RiDownloadLine,
  riDraggable: RiDraggable,
  riEditLine: RiEditLine,
  riEmotionLine: RiEmotionLine,
  riEmotionUnhappyFill: RiEmotionUnhappyFill,
  riEraserLine: RiEraserLine,
  riErrorWarningLine: RiErrorWarningLine,
  riEyeCloseLine: RiEyeCloseLine,
  riEyeLine: RiEyeLine,
  riFile2Line: RiFile2Line,
  riFileCopyLine: RiFileCopyLine,
  riFileDownloadLine: RiFileDownloadLine,
  riFileTextFill: RiFileTextFill,
  riFileUploadLine: RiFileUploadLine,
  riFlagLine: RiFlagLine,
  riFocus3Line: RiFocus3Line,
  riFolder5Fill: RiFolder5Fill,
  riFolderAddLine: RiFolderAddLine,
  riFolderLine: RiFolderLine,
  riFolderOpenFill: RiFolderOpenFill,
  riFolderOpenLine: RiFolderOpenLine,
  riFolderTransferLine: RiFolderTransferLine,
  riFontColor: RiFontColor,
  riFontSize: RiFontSize,
  riFootballLine: RiFootballLine,
  riGithubFill: RiGithubFill,
  riGlobalLine: RiGlobalLine,
  riHeading: RiHeading,
  riH1: RiH1,
  riH2: RiH2,
  riH3: RiH3,
  riH4: RiH4,
  riH5: RiH5,
  riH6: RiH6,
  riImageLine: RiImageLine,
  riInboxUnarchiveLine: RiInboxUnarchiveLine,
  riInformationLine: RiInformationLine,
  riInsertColumnLeft: RiInsertColumnLeft,
  riInsertColumnRight: RiInsertColumnRight,
  riInsertRowBottom: RiInsertRowBottom,
  riInsertRowTop: RiInsertRowTop,
  riItalic: RiItalic,
  riKeyboardLine: RiKeyboardLine,
  riLeafLine: RiLeafLine,
  riLightbulbLine: RiLightbulbLine,
  riLink: RiLink,
  riLinkUnlinkM: RiLinkUnlinkM,
  riListCheck2: RiListCheck2,
  riListOrdered: RiListOrdered,
  riListUnordered: RiListUnordered,
  riLoader4Line: RiLoader4Line,
  riLockLine: RiLockLine,
  riLockUnlockLine: RiLockUnlockLine,
  riLoopRightLine: RiLoopRightLine,
  riMarkdownLine: RiMarkdownLine,
  riMarkPenLine: RiMarkPenLine,
  riMicLine: RiMicLine,
  riMoonClearLine: RiMoonClearLine,
  riMovieLine: RiMovieLine,
  riPagesLine: RiPagesLine,
  riParagraph: RiParagraph,
  riPauseFill: RiPauseFill,
  riPencilLine: RiPencilLine,
  riPieChart2Line: RiPieChart2Line,
  riPlaneLine: RiPlaneLine,
  riPlayFill: RiPlayFill,
  riPriceTag3Line: RiPriceTag3Line,
  riQuestionLine: RiQuestionLine,
  riRefreshLine: RiRefreshLine,
  riRestartLine: RiRestartLine,
  riSave3Line: RiSave3Line,
  riSearch2Line: RiSearch2Line,
  riSearchLine: RiSearchLine,
  riSettings3Line: RiSettings3Line,
  riSettingsLine: RiSettingsLine,
  riShare2Line: RiShare2Line,
  riShareLine: RiShareLine,
  riUserSharedLine: RiUserSharedLine,
  riHistoryLine: RiHistoryLine,
  riSideBarLine: RiSideBarLine,
  riShieldCheckLine: RiShieldCheckLine,
  riShieldKeyholeLine: RiShieldKeyholeLine,
  riSingleQuotesR: RiSingleQuotesR,
  riSortAsc: RiSortAsc,
  riSortDesc: RiSortDesc,
  riSplitCellsHorizontal: RiSplitCellsHorizontal,
  riSplitCellsVertical: RiSplitCellsVertical,
  riMergeCellsHorizontal: RiMergeCellsHorizontal,
  riStarLine: RiStarLine,
  riStopCircleLine: RiStopCircleLine,
  riStrikethrough: RiStrikethrough,
  riSubtractLine: RiSubtractLine,
  riSunLine: RiSunLine,
  riTableLine: RiTableLine,
  riText: RiText,
  riTimerLine: RiTimerLine,
  riUnderline: RiUnderline,
  riVolumeDownFill: RiVolumeDownFill,
  riVolumeMuteFill: RiVolumeMuteFill,
  riWindowLine: RiWindowLine,
  riBack5: RiReplay5Line,
  riFoward5: RiForward5Line,
  riSpeedDial: RiSpeedLine,
  riShieldLine: RiShieldLine,
  riArrowRightLine: RiArrowRightLine,
  riArrowLeftLine: RiArrowLeftLine,
  riStarFill: RiStarFill,
  riSendPlaneFill: RiSendPlaneFill,
  riAppleFill: RiAppleFill,
  riMicrosoftFill: RiMicrosoftFill,
  riEvernoteFill: RiEvernoteFill,
  riNotionFill: RiNotionFill,
  riMagicLine: RiMagicLine,
  riAlignLeft: RiAlignLeft,
  riAlignCenter: RiAlignCenter,
  riAlignRight: RiAlignRight,
  riAlignJustify: RiAlignJustify,
  riSpaceShipLine: RiSpaceShip2Line,
  riLayoutColumnLine: RiLayoutColumnLine,
  riEqualizer3Line: RiEqualizer3Line,
  riExpandWidthLine: RiExpandWidthLine,
  riPrinterLine: RiPrinterLine,
  riFileAddLine: RiFileAddLine,
  riPaletteLine: RiPaletteLine,
  riMore2Fill: RiMore2Fill,
  riMoreFill: RiMoreFill,
  riUserLine: RiUserLine,
  riLogoutBoxRLine: RiLogoutBoxRLine,
  riExternalLinkLine: RiExternalLinkLine,
  riCloudLine: RiCloudLine,
  riComputerLine: RiComputerLine,
  riFingerprintLine: RiFingerprintLine,
  riQrCodeLine: RiQrCodeLine,
  riShieldStarLine: RiShieldStarLine,
  riDatabase2Line: RiDatabase2Line,
};

const customIconPaths = {
  mdiRegex: {
    d: 'M16,16.92C15.67,16.97 15.34,17 15,17C14.66,17 14.33,16.97 14,16.92V13.41L11.5,15.89C11,15.5 10.5,15 10.11,14.5L12.59,12H9.08C9.03,11.67 9,11.34 9,11C9,10.66 9.03,10.33 9.08,10H12.59L10.11,7.5C10.3,7.25 10.5,7 10.76,6.76C11,6.5 11.25,6.3 11.5,6.11L14,8.59V5.08C14.33,5.03 14.66,5 15,5C15.34,5 15.67,5.03 16,5.08V8.59L18.5,6.11C19,6.5 19.5,7 19.89,7.5L17.41,10H20.92C20.97,10.33 21,10.66 21,11C21,11.34 20.97,11.67 20.92,12H17.41L19.89,14.5C19.7,14.75 19.5,15 19.24,15.24C19,15.5 18.75,15.7 18.5,15.89L16,13.41V16.92M5,19A2,2 0 0,1 7,17A2,2 0 0,1 9,19A2,2 0 0,1 7,21A2,2 0 0,1 5,19Z',
    viewBox: '0 0 24 24',
  },
  simpleNote: {
    d: 'M89.432 169.864a31.597 31.597 0 0 0 19.708-4.692 32.004 32.004 0 0 0 12.904-15.734c7.394-19.87-7.238-36.687-26.016-41.977a81.867 81.867 0 0 1-34.167-17.292c-9.434-7.925-15.757-18.98-17.834-31.182A54.977 54.977 0 0 1 43.438 43a74.815 74.815 0 0 0-19.732 36.593 75.21 75.21 0 0 0 2.792 41.555 74.602 74.602 0 0 0 24.446 33.576 73.696 73.696 0 0 0 38.487 15.14Zm15.385-147.636c-6.21-.795-12.504.5-17.916 3.685a28.814 28.814 0 0 0-12.038 13.94c-6.203 14.07 3.343 32.401 24.776 38.41a80.164 80.164 0 0 1 32.946 16.287c10.064 7.745 17.067 18.877 19.747 31.389a74.095 74.095 0 0 1 .69 18.061c10.995-13.386 17.003-30.257 16.978-47.672 0-43.615-38.228-73.495-65.183-74.1Z',
    viewBox: '0 0 192 192',
  },
  obsidian: {
    d: 'M113.267 17.073a6 6 0 0 1 7.65 1.994l27.365 40.29a6.004 6.004 0 0 1 .938 4.456l-17.75 96.424a6.008 6.008 0 0 1-.614 1.75l-5.615 10.465a6 6 0 0 1-7.159 2.864l-40.966-13.455a5.998 5.998 0 0 1-3.623-3.292L43.896 91.043a6 6 0 0 1 .075-4.981l20.462-43.107a6 6 0 0 1 2.733-2.792l46.101-23.09Zm-46.804 49.59-10.477 22.07 14.724 33.593-3.134-46.802-1.113-8.861Zm15.11 38.283 3.132 46.777 23.595 7.75-26.727-54.527Zm38.451 51.181 16.637-90.375-24.142-14.339-31.464 25.212 38.969 79.502ZM78.167 63.561l28.341-22.708 1.394-7.672-31.566 15.81 1.831 14.57Zm41.066-25.616-.574 3.158 4.558 2.707-3.984-5.865Z',
    viewBox: '0 0 192 192',
  },
  bear: {
    d: 'M97.665 1.128c8.311 3.043 17.861 7.524 24.151 13.841 8.731 8.5 17.108 8.707 28.933 8.618q3.397-.071 6.795-.15c4.452-.055 8.903-.083 13.355-.098l3.25-.02c17.367.035 38.424 2.628 51.395 15.32a155 155 0 0 1 7.219 8.676c16.208 20.308 53.693 38.321 79.179 41.653l2.79.031c5.164.297 7.845.92 11.625 4.5 4.945 10.272 1.381 21.158-2.168 31.305-8.635 23.016-25.063 36.792-46.832 46.695-8.535 3.858-16.575 5.498-25.813 6.563l-3.344.4a245 245 0 0 1-19.781 1.475c-8.284.336-14.656 1.591-21 7.125-4.533 6.349-5.677 14.834-5.062 22.437.559 3.236 1.347 6.389 2.187 9.563l.686 2.648c2.944 11.16 6.464 21.879 11.478 32.301a203 203 0 0 1 3.422 7.633c6.536 15.379 14.612 29.548 24.396 43.094 5.131 7.106 9.963 14.4 14.802 21.708a1051 1051 0 0 0 15.22 22.342l1.527 2.203 1.342 1.918c.94 1.59.94 1.59.94 3.59q-38.259.142-76.516.207c-11.844.021-23.688.049-35.532.095q-15.495.061-30.99.074c-5.464.006-10.927.018-16.391.047q-7.734.04-15.468.03-2.818 0-5.637.024c-26.945.211-50.96-6.983-70.654-26.102C4.46 307.713.234 278.529.153 247.331l-.008-2.273q-.022-5.938-.029-11.877c-.005-4.061-.03-8.123-.058-12.184q-.025-4.73-.025-9.459a658 658 0 0 0-.024-4.49c-.066-8.014.164-15.09 3.348-22.549a958 958 0 0 0 2-6.625c1.046-3.434 2.084-6.789 3.562-10.062 1.51-3.481 2.57-6.943 3.594-10.59 11.452-36.955 30.745-83.577 60.844-109.723h2l-.08-2.348c-.912-31.08-.912-31.08 6.431-41.585 4.437-4.574 10.3-3.979 15.957-2.438',
    viewBox: '0 0 329 357',
  },
};

function createSvgIcon(iconName, d, viewBox = '0 0 24 24') {
  return defineComponent({
    name: iconName,
    props: {
      size: { type: [String, Number], default: 24 },
      color: { type: String, default: 'currentColor' },
    },
    render() {
      return h(
        'svg',
        {
          width: this.size,
          height: this.size,
          viewBox,
          fill: this.color,
          xmlns: 'http://www.w3.org/2000/svg',
        },
        [h('path', { d })]
      );
    },
  });
}

const CustomIcons = Object.fromEntries(
  Object.entries(customIconPaths).map(([name, { d, viewBox }]) => [
    name,
    createSvgIcon(name, d, viewBox),
  ])
);

export default {
  install(app) {
    app.component(
      'v-remixicon',
      defineComponent({
        name: 'v-remixicon',
        props: {
          name: { type: String, required: true },
          size: { type: [String, Number], default: 24 },
          color: { type: String, default: 'currentColor' },
        },
        render() {
          const RemixIcon = RemixIcons?.[this.name];
          if (RemixIcon) {
            return h(markRaw(RemixIcon), {
              size: String(this.size),
              color: this.color,
            });
          }

          const CustomIcon = CustomIcons?.[this.name];
          if (CustomIcon) {
            return h(CustomIcon, { size: this.size, color: this.color });
          }

          console.warn(`[v-remixicon] Unknown icon: "${this.name}"`);
          return h('span', {
            style: `display:inline-block;width:${this.size}px;height:${this.size}px`,
          });
        },
      })
    );
  },
};