feat: type global components and especially icon prop
This commit is contained in:
21
src/types/global-components.d.ts
vendored
Normal file
21
src/types/global-components.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
// import FontAwesomeIcon from '@/components/misc/Icon'
|
||||
import type { FontAwesomeIcon as FontAwesomeIconFixedTypes } from './vue-fontawesome'
|
||||
import type XButton from '@/components/input/button.vue'
|
||||
import type Modal from '@/components/misc/modal.vue'
|
||||
import type Card from '@/components/misc/card.vue'
|
||||
|
||||
// Here we define globally imported components
|
||||
// See:
|
||||
// https://github.com/johnsoncodehk/volar/blob/2ca8fd3434423c7bea1c8e08132df3b9ce84eea7/extensions/vscode-vue-language-features/README.md#usage
|
||||
// Under the hidden collapsible "Define Global Components"
|
||||
|
||||
declare module '@vue/runtime-core' {
|
||||
export interface GlobalComponents {
|
||||
Icon: FontAwesomeIconFixedTypes
|
||||
XButton: typeof XButton,
|
||||
Modal: typeof Modal,
|
||||
Card: typeof Card,
|
||||
}
|
||||
}
|
||||
|
||||
export {}
|
40
src/types/vue-fontawesome.ts
Normal file
40
src/types/vue-fontawesome.ts
Normal file
@ -0,0 +1,40 @@
|
||||
// copied and slightly modified from unmerged pull request that corrects types
|
||||
// https://github.com/FortAwesome/vue-fontawesome/pull/355
|
||||
|
||||
import type { FaSymbol, FlipProp, IconLookup, IconProp, PullProp, SizeProp, Transform } from '@fortawesome/fontawesome-svg-core'
|
||||
import type { DefineComponent } from 'vue'
|
||||
|
||||
|
||||
interface FontAwesomeIconProps {
|
||||
border?: boolean
|
||||
fixedWidth?: boolean
|
||||
flip?: FlipProp
|
||||
icon: IconProp
|
||||
mask?: IconLookup
|
||||
listItem?: boolean
|
||||
pull?: PullProp
|
||||
pulse?: boolean
|
||||
rotation?: 90 | 180 | 270 | '90' | '180' | '270'
|
||||
swapOpacity?: boolean
|
||||
size?: SizeProp
|
||||
spin?: boolean
|
||||
transform?: Transform
|
||||
symbol?: FaSymbol
|
||||
title?: string | string[]
|
||||
inverse?: boolean
|
||||
}
|
||||
|
||||
interface FontAwesomeLayersProps {
|
||||
fixedWidth?: boolean
|
||||
}
|
||||
|
||||
interface FontAwesomeLayersTextProps {
|
||||
value: string | number
|
||||
transform?: object | string
|
||||
counter?: boolean
|
||||
position?: 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right'
|
||||
}
|
||||
|
||||
export type FontAwesomeIcon = DefineComponent<FontAwesomeIconProps>
|
||||
export type FontAwesomeLayers = DefineComponent<FontAwesomeLayersProps>
|
||||
export type FontAwesomeLayersText = DefineComponent<FontAwesomeLayersTextProps>
|
Reference in New Issue
Block a user