1 line
10 KiB
Plaintext
1 line
10 KiB
Plaintext
|
{"version":3,"file":"icons.mjs","names":["aliases","mdi","computed","inject","unref","defineComponent","genericComponent","mergeDeep","propsFactory","IconValue","String","Function","Object","Array","IconSymbol","Symbol","for","makeIconProps","icon","type","tag","required","VComponentIcon","name","props","setup","_ref","slots","Icon","_createVNode","default","VSvgIcon","inheritAttrs","_ref2","attrs","_mergeProps","isArray","map","path","VLigatureIcon","VClassIcon","defaultSets","svg","component","class","createIcons","options","defaultSet","sets","vuetify","useIcon","icons","Error","iconData","iconAlias","trim","startsWith","slice","iconSetName","keys","find","setName","iconName","length","iconSet"],"sources":["../../src/composables/icons.tsx"],"sourcesContent":["// Icons\nimport { aliases, mdi } from '@/iconsets/mdi'\n\n// Utilities\nimport { computed, inject, unref } from 'vue'\nimport { defineComponent, genericComponent, mergeDeep, propsFactory } from '@/util'\n\n// Types\nimport type { InjectionKey, JSXComponent, PropType, Ref } from 'vue'\n\nexport type IconValue =\n | string\n | (string | [path: string, opacity: number])[]\n | JSXComponent\nexport const IconValue = [String, Function, Object, Array] as PropType<IconValue>\n\nexport interface IconAliases {\n [name: string]: IconValue\n complete: IconValue\n cancel: IconValue\n close: IconValue\n delete: IconValue\n clear: IconValue\n success: IconValue\n info: IconValue\n warning: IconValue\n error: IconValue\n prev: IconValue\n next: IconValue\n checkboxOn: IconValue\n checkboxOff: IconValue\n checkboxIndeterminate: IconValue\n delimiter: IconValue\n sortAsc: IconValue\n sortDesc: IconValue\n expand: IconValue\n menu: IconValue\n subgroup: IconValue\n dropdown: IconValue\n radioOn: IconValue\n radioOff: IconValue\n edit: IconValue\n ratingEmpty: IconValue\n ratingFull: IconValue\n ratingHalf: IconValue\n loading: IconValue\n first: IconValue\n last: IconValue\n unfold: IconValue\n file: IconValue\n plus: IconValue\n minus: IconValue\n calendar: IconValue\n}\n\nexport interface IconProps {\n tag: string\n icon?: IconValue\n disabled?: Boolean\n}\n\ntype IconComponent = JSXComponent<IconProps>\n\nexport interface IconSet {\n component: IconComponent\n}\n\nexport type IconOptions = {\n defaultSet?: string\n aliases?: Partial<IconAliases>\n sets?: Record<string, IconSet>\n}\n\ntype IconInstance = {\n component: IconComponent\n icon?: IconValue\n}\n\nexport const IconSymbol: InjectionKey<Required<IconOptions>> = Symbol.for('vuetify:icons')\n\nexport const makeIconProps = propsFactory({\n icon: {\n type: IconValue,\n },\n // Could not remove this and use makeTagProps, types complained because it is not required\n tag: {\n type: String,\n required: true,\n },\n}, 'icon')\n\nexport const VComponentIcon = genericComponent()({\n name: 'VComponentIcon',\n\n props: makeIconProps(),\n\n setup (props, { slots }) {\n return () => {\n const Icon = props.icon as JSXComponent\n return (\n <props.tag>\n { props.icon ? <Icon /> : slots.default?.() }\n </props.tag>\n )\n }\n },\n})\nexport type VComponentIcon = InstanceType<typeof VComponentIcon>\n\nexport const VSvgIcon = defineComponent({\n name: 'VSvgIcon',\n\n inheritAttrs: false,\n\n props: makeIconProps(),\n\n setup (props, { attrs }) {\n return () => {\n return (\n <props.tag { ...attrs } style={ null }>\n <svg\n class=\"v-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n role=\"img\"\n aria-hidden=\"true\"\n >\n { Array.isArray(props.icon)\n ? props.icon.map(path => (\n Array.isArray(path)\n ? <path d={ path[0] as string } fill-opacity={ path[1] }></path>\n : <path d={ path as string }></path>\n ))\n : <path d={ props.icon as string }></path>\n }\n </svg>\n </props.tag>\n )\n
|